| @@ -238,4 +238,7 @@ function Trance() { | |||||
| this.startCombat = function() { return ["You yelp and turn around as hot breath spills over your shoulder. A massive sergal has crept up on you...and he looks <i>hungry</i>"]; }; | this.startCombat = function() { return ["You yelp and turn around as hot breath spills over your shoulder. A massive sergal has crept up on you...and he looks <i>hungry</i>"]; }; | ||||
| this.digestFinish = function() { return ["The sergal's crushing guts reduce you to a pool of chyme..."]; }; | this.digestFinish = function() { return ["The sergal's crushing guts reduce you to a pool of chyme..."]; }; | ||||
| this.defeated = function() { changeMode("explore"); update(["The sergal winces and stumbles, grabbing a thick branch to steady himself...and snapping in half like a twig. You decide discretion is the better part of valor and run while you can."]); }; | |||||
| this.prefs.prey = false; | |||||
| } | } | ||||
| @@ -66,13 +66,17 @@ function PhoneCall() { | |||||
| function FallenFoe(foe) { | function FallenFoe(foe) { | ||||
| DialogNode.call(this); | DialogNode.call(this); | ||||
| this.text = ["What do you want to do with your enemy?"]; | |||||
| this.text = [foe.description("The") + " falls to the ground!", newline, "What do you want to do with your enemy?"]; | |||||
| { | { | ||||
| let nodeEat = new DialogNode(); | let nodeEat = new DialogNode(); | ||||
| this.addChoice("Devour!",nodeEat); | this.addChoice("Devour!",nodeEat); | ||||
| nodeEat.text = ["You grab your helpless prey and force them down your gullet. You hack up their wallet a minute later, finding $" + foe.cash + " inside."]; | nodeEat.text = ["You grab your helpless prey and force them down your gullet. You hack up their wallet a minute later, finding $" + foe.cash + " inside."]; | ||||
| nodeEat.requirements.push( function(attacker, defender) { | |||||
| return defender.prefs.prey; | |||||
| }); | |||||
| nodeEat.hooks.push(function() { | nodeEat.hooks.push(function() { | ||||
| player.cash += foe.cash; | player.cash += foe.cash; | ||||
| }); | }); | ||||
| @@ -398,8 +398,7 @@ function attackClicked(index) { | |||||
| update(playerAttacks[index].attack(currentFoe)); | update(playerAttacks[index].attack(currentFoe)); | ||||
| if (currentFoe.health <= 0) { | if (currentFoe.health <= 0) { | ||||
| update([currentFoe.description("The") + " falls to the ground!"]); | |||||
| startDialog(new FallenFoe(currentFoe)); | |||||
| currentFoe.defeated(); | |||||
| } else if (mode == "combat") { | } else if (mode == "combat") { | ||||
| let attack = pick(filterPriority(filterValid(currentFoe.attacks, currentFoe, player)), currentFoe, player); | let attack = pick(filterPriority(filterValid(currentFoe.attacks, currentFoe, player)), currentFoe, player); | ||||
| @@ -52,6 +52,8 @@ function Creature(name = "Creature", str=10, dex=10, con=10) { | |||||
| this.startCombat = function() { return [this.description("A") + " appears. It's a fight!"]; }; | this.startCombat = function() { return [this.description("A") + " appears. It's a fight!"]; }; | ||||
| this.finishDigest = function() { return [this.description("The") + " digests you..."]; }; | this.finishDigest = function() { return [this.description("The") + " digests you..."]; }; | ||||
| this.defeated = function() { startDialog(new FallenFoe(this)); }; | |||||
| } | } | ||||
| function Player(name = "Player") { | function Player(name = "Player") { | ||||