diff --git a/combat.js b/combat.js index 6f44966..6659ec7 100644 --- a/combat.js +++ b/combat.js @@ -39,6 +39,9 @@ function devourPlayer(attacker) { conditions: [ function(prefs) { return prefs.player.prey; } ], + requirements: [ + function(attacker, defender) { return attacker.leering == true; } + ], attackPlayer: function(defender) { changeMode("eaten"); return "The voracious " + attacker.description() + " pins you down and devours you in seconds."; @@ -46,13 +49,24 @@ function devourPlayer(attacker) { } } +function leer(attacker) { + return { + name: "Leer", + desc: "Leer at something", + attackPlayer: function(defender) { + attacker.leering = true; + return "The " + attacker.description() + " leers at you."; + }, + requirements: [ + function(attacker, defender) { return attack.leering != true; } + ] + }; +} + function poke(attacker) { return { name: "Poke", desc: "Poke a nerd", - attack: function(defender) { - return "You poke the " + defender.description() + " for " + attack(attacker, defender, 1e12) + " damage"; - }, attackPlayer: function(defender) { return "The " + attacker.description() + " pokes you on the snout for " + attack(attacker, defender, 1e12) + " damage"; } diff --git a/feast.js b/feast.js index c157b29..c23991e 100644 --- a/feast.js +++ b/feast.js @@ -311,8 +311,11 @@ function attackClicked(index) { update(["The " + currentFoe.description() + " falls to the ground!"]); startDialog(new FallenFoe(currentFoe)); } else { - let attack = pick(currentFoe.attacks.filter(attack => attack.conditions == undefined || attack.conditions.reduce((result, test) => result && test(prefs), true))); + let attacks = currentFoe.attacks.filter(attack => attack.conditions == undefined || attack.conditions.reduce((result, test) => result && test(prefs), true)); + attacks = attacks.filter(attack => attack.requirements == undefined || attack.requirements.reduce((result, test) => result && test(currentFoe, player), true)); + let attack = pick(attacks); + if (attack == null) { attack = currentFoe.backupAttack; } diff --git a/vore.js b/vore.js index 7310c55..237db28 100644 --- a/vore.js +++ b/vore.js @@ -69,7 +69,7 @@ function Fen() { this.attacks = []; this.attacks.push(new devourPlayer(this)); - + this.attacks.push(new leer(this)); this.backupAttack = new poke(this); this.struggles = [];