diff --git a/feast.js b/feast.js index 6a48e05..c7182f2 100644 --- a/feast.js +++ b/feast.js @@ -313,7 +313,7 @@ function updateActions() { actions = []; currentRoom.objects.forEach(function (object) { object.actions.forEach(function (action) { - if (action.conditions == undefined || action.conditions.reduce((result, cond) => result && cond(player.prefs), true)) + if (action.conditions == undefined || action.conditions.reduce((result, cond) => result && cond(player), true)) actions.push(action); }); }); diff --git a/forest.js b/forest.js index 6abbfad..a4d729f 100644 --- a/forest.js +++ b/forest.js @@ -38,16 +38,15 @@ function Wolf() { this.hasName = false; - this.description = function() { return "wolf"; }; + this.description = function(prefix) { return prefix + " wolf"; }; this.attacks = []; this.attacks.push(wolfBite(this)); - - //this.attacks.push(wolfSwallow(this)); + this.attacks.push(wolfHowl(this)); this.attacks.push(wolfTackle(this)); - //this.attacks.push(wolfTackleBite(this)); + this.attacks.push(wolfTackleBite(this)); this.attacks.push(wolfTackleSwallow(this)); this.attacks.push(wolfDigest(this)); @@ -57,15 +56,15 @@ function Wolf() { this.flags.stage = "combat"; this.startCombat = function(player) { - return ["Oh no a feral wolf"]; + return ["A snapping twig grabs your attention. You turn and find yourself facing a large, mangy wolf. The cur stands at least half your height at the shoulder, and it looks hungry."]; }; this.finishCombat = function() { - return ["Oops eaten"]; + return ["The wolf knocks you to the ground. You bash your head on a rock and black out."]; }; this.status = function(player) { - return ["It's a wolf"]; + return []; }; } @@ -88,6 +87,26 @@ function wolfBite(attacker) { }; } +function wolfHowl(attacker) { + return { + attackPlayer: function(defender){ + attacker.statBuffs.push(new StatBuff("str", 1.25)); + return ["The wolf backs up and lets out a long, wailing howl.",newline,"It seems emboldened."]; + }, + requirements: [ + function(attacker, defender) { + return attacker.flags.stage == "combat"; + }, + function(attacker, defender) { + return !attacker.flags.grappled && !defender.flags.grappled; + } + ], + priority: 1, + weight: function(attacker, defender) { return 0.25; } + }; +} + + function wolfTackle(attacker) { return { attackPlayer: function(defender){ @@ -107,6 +126,29 @@ function wolfTackle(attacker) { }; } +function wolfTackleBite(attacker) { + return { + attackPlayer: function(defender){ + let damage = attack(attacker, defender, attacker.str * 1.5); + return pickRandom([ + ["Pain shoots through your arm as the wolf bites it for " + damage + " damage!"], + ["You struggle against the wolf as it bites your shoulder for " + damage + " damage."], + ["The wolf's claws dig into your legs for " + damage + " damage."] + ]); + }, + requirements: [ + function(attacker, defender) { + return attacker.flags.stage == "combat"; + }, + function(attacker, defender) { + return !attacker.flags.grappled && defender.flags.grappled; + } + ], + priority: 1, + weight: function(attacker, defender) { return 1 + defender.health/defender.maxHealth; } + }; +} + function wolfTackleSwallow(attacker) { return { attackPlayer: function(defender){ diff --git a/vore.js b/vore.js index 3577a7c..984c8d3 100644 --- a/vore.js +++ b/vore.js @@ -1,5 +1,10 @@ "use strict"; +function StatBuff(type, amount) { + this.stat = type; + this.amount = amount; +} + function Creature(name = "Creature", str = 10, dex = 10, con = 10) { this.name = name;