diff --git a/combat.js b/combat.js index b474651..db95ab0 100644 --- a/combat.js +++ b/combat.js @@ -34,10 +34,10 @@ function punchAttack(attacker) { name: "Punch", desc: "Punch a nerd", attack: function(defender) { - return "You punch the " + defender.description() + " for " + attack(attacker, defender, attacker.str) + " damage"; + return "You punch " + defender.description("the") + " for " + attack(attacker, defender, attacker.str) + " damage"; }, attackPlayer: function(defender) { - return "The " + attacker.description() + " punches you for " + attack(attacker, defender, attacker.str) + " damage"; + return attacker.description("The") + " punches you for " + attack(attacker, defender, attacker.str) + " damage"; }, requirements: [ function(attacker, defender) { return isNormal(attacker) && isNormal(defender); } ], @@ -51,10 +51,10 @@ function flankAttack(attacker) { name: "Flank", desc: "Be sneaky", attack: function(defender) { - return "You run around the " + defender.description() + " and attack for " + attack(attacker, defender, attacker.dex) + " damage"; + return "You run around " + defender.description("the") + " and attack for " + attack(attacker, defender, attacker.dex) + " damage"; }, attackPlayer: function(defender) { - return "The " + attacker.description() + " runs past you, then turns and hits you for " + attack(attacker, defender, attacker.str) + " damage"; + return attacker.description("The") + " runs past you, then turns and hits you for " + attack(attacker, defender, attacker.str) + " damage"; }, requirements: [ function(attacker, defender) { return isNormal(attacker) && isNormal(defender); } ], @@ -71,18 +71,18 @@ function grapple(attacker) { let success = statHealthCheck(attacker, defender, "str"); if (success) { defender.grappled = true; - return "You charge at the " + defender.description() + ", tackling them and knocking them to the ground."; + return "You charge at " + defender.description("the") + ", tackling them and knocking them to the ground."; } else { - return "You charge at the " + defender.description() + ", but they dodge out of the way!"; + return "You charge at " + defender.description("the") + ", but they dodge out of the way!"; } }, attackPlayer: function(defender) { let success = Math.random() < 0.5; if (success) { defender.grappled = true; - return "The " + attacker.description() + " lunges at you, pinning you to the floor!"; + return attacker.description("The") + " lunges at you, pinning you to the floor!"; } else { - return "The " + attacker.description() + " tries to tackle you, but you deftly avoid them."; + return attacker.description("The") + " tries to tackle you, but you deftly avoid them."; } }, requirements: [ @@ -103,9 +103,9 @@ function grappleDevour(attacker) { attacker.stomach.feed(defender); defender.grappled = false; changeMode("explore"); - return "You open your jaws wide, stuffing the " + defender.description() + "'s head into your gullet and greedily wolfing them down. Delicious."; + return "You open your jaws wide, stuffing " + defender.description("the") + "'s head into your gullet and greedily wolfing them down. Delicious."; } else { - return "Your jaws open wide, but the " + defender.description() + " manages to avoid becoming " + attacker.species + " chow."; + return "Your jaws open wide, but " + defender.description("the") + " manages to avoid becoming " + attacker.species + " chow."; } }, attackPlayer: function(defender) { @@ -113,9 +113,9 @@ function grappleDevour(attacker) { if(success) { defender.grappled = false; changeMode("eaten"); - return "The " + attacker.description() + " forces your head into their sloppy jaws, devouring you despite your frantic struggles. Glp."; + return attacker.description("The") + " forces your head into their sloppy jaws, devouring you despite your frantic struggles. Glp."; } else { - return "The " + attacker.description() + " tries to swallow you down, but you manage to resist their hunger."; + return attacker.description("The") + " tries to swallow you down, but you manage to resist their hunger."; } }, requirements: [ function(attacker, defender) { return isNormal(attacker) && isGrappled(defender); } @@ -136,9 +136,9 @@ function grappleAnalVore(attacker) { attacker.butt.feed(defender); defender.grappled = false; changeMode("explore"); - return "You shove the " + defender.description() + " between your cheeks. Their head slips into your ass with a wet shlk, and the rest of their body follows suit. You moan and gasp, working them deeper and deeper..."; + return "You shove " + defender.description("the") + " between your cheeks. Their head slips into your ass with a wet shlk, and the rest of their body follows suit. You moan and gasp, working them deeper and deeper..."; } else { - return "Your grasp and shove the " + defender.description() + ", but they manage to avoid becoming " + attacker.species + " chow."; + return "Your grasp and shove " + defender.description("the") + ", but they manage to avoid becoming " + attacker.species + " chow."; } }, requirements: [ function(attacker, defender) { return isNormal(attacker) && isGrappled(defender); } @@ -155,7 +155,7 @@ function grappleRelease(attacker) { desc: "Release your opponent", attack: function(defender) { defender.grappled = false; - return "You throw the " + defender.description() + " back, dealing " + attack(attacker, defender, attacker.str*1.5) + " damage"; + return "You throw " + defender.description("the") + " back, dealing " + attack(attacker, defender, attacker.str*1.5) + " damage"; }, requirements: [ function(attacker, defender) { return isNormal(attacker) && isGrappled(defender); } ], @@ -171,7 +171,7 @@ function grappledStruggle(attacker) { let success = statHealthCheck(attacker, defender, "str"); if (success) { attacker.grappled = false; - return "You struggle and shove the " + defender.description() + " off of you."; + return "You struggle and shove " + defender.description("the") + " off of you."; } else { return "You struggle, but to no avail."; } @@ -201,7 +201,7 @@ function grappledReverse(attacker) { if (success) { attacker.grappled = false; defender.grappled = true; - return "You surprise the " + defender.description() + " with a burst of strength, flipping them over and pinning them."; + return "You surprise " + defender.description("the") + " with a burst of strength, flipping them over and pinning them."; } else { return "You try to throw your opponent off of you, but fail."; } @@ -250,7 +250,7 @@ function pass(attacker) { return "You do nothing."; }, attackPlayer: function(defender) { - return "The " + attacker.description() + " does nothing."; + return attacker.description("The") + " does nothing."; }, priority: 0, }; @@ -280,7 +280,7 @@ function leer(attacker) { desc: "Leer at something", attackPlayer: function(defender) { attacker.leering = true; - return "The " + attacker.description() + " leers at you."; + return attacker.description("The") + " leers at you."; }, requirements: [ function(attacker, defender) { return attacker.leering != true && attacker.grappled != true; } @@ -294,7 +294,7 @@ function poke(attacker) { name: "Poke", desc: "Poke a nerd", attackPlayer: function(defender) { - return "The " + attacker.description() + " pokes you on the snout for " + attack(attacker, defender, 1e12) + " damage"; + return attacker.description("The") + " pokes you on the snout for " + attack(attacker, defender, 1e12) + " damage"; }, priority: 1, }; @@ -304,7 +304,7 @@ function digestPlayerStomach(predator,damage=20) { return { digest: function(player) { attack(predator, player, damage); - return "The " + predator.description() + "'s stomach grinds over your body, swiftly digesting you."; + return predator.description("The") + "'s stomach grinds over your body, swiftly digesting you."; }, priority: 1, }; diff --git a/customs.js b/customs.js new file mode 100644 index 0000000..6b5db73 --- /dev/null +++ b/customs.js @@ -0,0 +1,41 @@ +/* AEZNON COMMISSION */ + +function Geta() { + Creature.call(this, "Geta", 5, 15, 10); + + this.hasName = true; + + this.description = function() { return "Geta" }; +} + +function GetaObj() { + GameObject.call(this, "Geta"); + this.actions.push( { + "name": "Approach Geta", + "action": function() { + startDialog(new GetaDialog()); + } + }); +} + +function GetaDialog() { + DialogNode.call(this); + + this.text = "You approach the sandy-furred fox."; + + { + let nodeFight = new DialogNode(); + this.addChoice("He certainly looks tasty...", nodeFight); + + nodeFight.text = "You stalk up to your prey, but he sees you coming. You're going to have to fight!"; + nodeFight.hooks.push( function(){ + currentFoe = new Geta(); + changeMode("combat"); + }); + } + + { + let nodeIgnore = new DialogNode(); + this.addChoice("Leave him be", nodeIgnore); + } +} diff --git a/dialog.js b/dialog.js index 5139577..0665334 100644 --- a/dialog.js +++ b/dialog.js @@ -21,7 +21,7 @@ function EatDude() { let nerd = new Anthro(); - this.text = "You approach the " + nerd.description(); + this.text = "You approach " + nerd.description("the"); let eatHim = new DialogNode(); diff --git a/feast.html b/feast.html index c484828..eb5c354 100644 --- a/feast.html +++ b/feast.html @@ -8,6 +8,7 @@ + diff --git a/feast.js b/feast.js index d22aa96..a111371 100644 --- a/feast.js +++ b/feast.js @@ -23,13 +23,13 @@ let prefs = { function join(things) { if (things.length == 1) { - return "a " + things[0].description(); + return things[0].description("a"); } else if (things.length == 2) { - return "a " + things[0].description() + " and a " + things[1].description(); + return things[0].description("a") + " and " + things[1].description("a"); } else { let line = ""; - line = things.slice(0,-1).reduce((line, prey) => line + "a " + prey.description() + ", ", line); - line += " and a " + things[things.length-1].description(); + line = things.slice(0,-1).reduce((line, prey) => line + prey.description("a") + ", ", line); + line += " and " + things[things.length-1].description("a"); return line; } } @@ -375,14 +375,14 @@ function respawn(respawnRoom) { function startCombat(opponent) { currentFoe = opponent; changeMode("combat"); - update(["Oh shit it's a " + opponent.description()]); + update(["Oh shit it's " + opponent.description("a")]); } function attackClicked(index) { update([playerAttacks[index].attack(currentFoe)]); if (currentFoe.health <= 0) { - update(["The " + currentFoe.description() + " falls to the ground!"]); + update([currentFoe.description("The") + " falls to the ground!"]); startDialog(new FallenFoe(currentFoe)); } else if (mode == "combat") { let attack = pick(filterPriority(filterValid(currentFoe.attacks, currentFoe, player)), currentFoe, player); @@ -427,7 +427,7 @@ function struggleClicked(index) { update([digest.digest(player)]); if (player.health <= -100) { - update(["You digest in the depths of the " + currentFoe.description()]); + update(["You digest in the depths of " + currentFoe.description("the")]); respawn(respawnRoom); } } @@ -449,7 +449,7 @@ function dialogClicked(index) { currentDialog = currentDialog.choices[index].node; update([currentDialog.text]); currentDialog.visit(); - if (currentDialog.choices.length == 0) { + if (currentDialog.choices.length == 0 && mode == "dialog") { changeMode("explore"); updateDisplay(); } diff --git a/vore.js b/vore.js index ff90f7e..d6c21fa 100644 --- a/vore.js +++ b/vore.js @@ -13,6 +13,8 @@ function Creature(name = "Creature", str=10, dex=10, con=10) { this.dex = dex; this.con = con; + this.hasName = false; + Object.defineProperty(this, "maxHealth", {get: function() { return this.str * 5 + this.con * 10 }}); this.health = this.maxHealth; Object.defineProperty(this, "maxStamina", {get: function() { return this.dex * 5 + this.con * 10 }}); @@ -80,11 +82,20 @@ function Anthro(name="Anthro") { } this.species = pickRandom(["dog","cat","lizard","deer","wolf","fox"]); - this.description = function() { + + // todo better lol + + this.description = function(prefix="") { if (this.build == "") - return this.species; + if (prefix == "") + return this.species; + else + return prefix + " " + this.species; else - return this.build + " " + this.species; + if (prefix == "") + return this.build + " " + this.species; + else + return prefix + " " + this.build + " " + this.species; }; this.attacks.push(new punchAttack(this)); @@ -215,15 +226,15 @@ class Stomach extends Container { } describeDamage(prey) { - return "Your guts gurgle and churn, slowly wearing down the " + prey.description() + " trapped within."; + return "Your guts gurgle and churn, slowly wearing down " + prey.description("the") + " trapped within."; } describeKill(prey) { - return "The " + prey.description() + "'s struggles wane as your stomach overpowers them."; + return prey.description("The") + "'s struggles wane as your stomach overpowers them."; } describeFinish(prey) { - return "Your churning guts have reduced a " + prey.description() + " to meaty chyme."; + return "Your churning guts have reduced " + prey.description("a") + " to meaty chyme."; } fill(amount) { @@ -253,7 +264,7 @@ class Butt extends Container { pushed.forEach(function(x) { this.stomach.feed(x); - lines.push("Your winding guts squeeze the " + x.description() + " into your stomach."); + lines.push("Your winding guts squeeze " + x.description("the") + " into your stomach."); },this); this.contents = this.contents.filter(prey => prey.timeInButt < 60 * 30); @@ -262,11 +273,11 @@ class Butt extends Container { } describeDamage(prey) { - return "Your bowels gurgle and squeeze, working to wear down the " + prey.description() + " trapped in those musky confines."; + return "Your bowels gurgle and squeeze, working to wear down " + prey.description("the") + " trapped in those musky confines."; } describeKill(prey) { - return "The " + prey.description() + " abruptly stops struggling, overpowered by your winding intestines."; + return prey.description("The") + " abruptly stops struggling, overpowered by your winding intestines."; } describeFinish(prey) { @@ -319,12 +330,12 @@ function plead(predator) { if (escape) { return { "escape": escape, - "lines": ["You plead for the " + predator.description() + " to let you free, and they begrudingly agree, horking you up and leaving you shivering on the ground"] + "lines": ["You plead for " + predator.description("the") + " to let you free, and they begrudingly agree, horking you up and leaving you shivering on the ground"] }; } else { return { "escape": escape, - "lines": ["You plead with the " + predator.description() + " to let you go, but they refuse."] + "lines": ["You plead with " + predator.description("the") + " to let you go, but they refuse."] }; } } @@ -341,12 +352,12 @@ function struggle(predator) { if (escape) { return { "escape": escape, - "lines": ["You struggle and squirm, forcing the " + predator.description() + " to hork you up. They groan and stumble away, exhausted by your efforts."] + "lines": ["You struggle and squirm, forcing " + predator.description("the") + " to hork you up. They groan and stumble away, exhausted by your efforts."] }; } else { return { "escape": escape, - "lines": ["You squirm and writhe within the " + predator.description() + " to no avail."] + "lines": ["You squirm and writhe within " + predator.description("the") + " to no avail."] }; } } @@ -360,7 +371,7 @@ function rub(predator) { struggle: function(player) { return { "escape": false, - "lines": ["You rub the walls of your predator's belly. At least the " + predator.description() + " is getting something out of this."] + "lines": ["You rub the walls of your predator's belly. At least " + predator.description("the") + " is getting something out of this."] }; } }; diff --git a/world.js b/world.js index 06c91f7..3d4ed90 100644 --- a/world.js +++ b/world.js @@ -169,7 +169,8 @@ let locationsSrc = [ } ], "objs": [ - NatureTrailExercise + NatureTrailExercise, + GetaObj ] }, {