From da4a18870b9a766d5f0517aef14b321459c3fd1d Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Wed, 18 Apr 2018 17:30:28 -0400 Subject: [PATCH] Added Wyrm. Just bites you --- feast.html | 1 + mountain.js | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++ world.js | 19 ++++++++++++++ 3 files changed, 95 insertions(+) create mode 100644 mountain.js diff --git a/feast.html b/feast.html index 39ca360..61b72c9 100644 --- a/feast.html +++ b/feast.html @@ -7,6 +7,7 @@ + diff --git a/mountain.js b/mountain.js new file mode 100644 index 0000000..972e1fc --- /dev/null +++ b/mountain.js @@ -0,0 +1,75 @@ +function MountainExplore() { + GameObject.call(this, "Explore"); + + this.actions.push({ + "name": "Explore", + "action": function() { + let outcome = Math.random(); + advanceTime(60*15); + + if (outcome < 0.25) { + startCombat(new MountainWyrm()); + } else { + update(["You wander around for a bit, but haven't found your way out yet."]); + } + } + }); +} + +function MountainWyrm() { + Creature.call(this, "Wyrm", 25, 15, 35); + + this.hasName = false; + + this.description = function(prefix) { return prefix + " wyrm"; }; + + this.attacks = []; + + this.flags.state = "combat"; + + this.attacks.push(wyrmBite(this)); + /*this.attacks.push(wyrmTail(this)); + this.attacks.push(wyrmRoar(this)); + + this.attacks.push(wyrmPounce(this)); + + this.attacks.push(wyrmGrind(this)); + this.attacks.push(wyrmCockVore(this)); + + this.attacks.push(wyrmCockSwallow(this)); + this.attacks.push(wyrmCockCrush(this)); + + this.attacks.push(wyrmCockDigest(this)); + + this.attacks.push(grappledStruggle(this));*/ + + this.startCombat = function(player) { + return ["A shadow falls over you; a heartbeat later, a hound-sized wyrm swoops down, landing with a heavy thump on the rocky ground. He hisses and snarls at you, rearing up in an attempt to intimidate you..and showing off his throbbing shaft."]; + }; + + this.finishCombat = function() { + if (this.flags.stage == "combat") + return [this.description("The") + " knocks you to the ground. You bash your head on a rock and black out."]; + else if (this.flags.stage == "balls") + return ["You fall limp in " + this.description("the") + "'s balls."]; + }; +} + +function wyrmBite(attacker) { + return { + attackPlayer: function(defender){ + let damage = attack(attacker, defender, attacker.str); + return [attacker.description("The") + " rushes up and bites you for " + damage + " damage"]; + }, + requirements: [ + function(attacker, defender) { + return attacker.flags.state == "combat"; + }, + function(attacker, defender) { + return !attacker.flags.grappled && !defender.flags.grappled; + } + ], + priority: 1, + weight: function(attacker, defender) { return 1 + defender.health/defender.maxHealth; } + }; +} diff --git a/world.js b/world.js index dde6f44..53c8643 100644 --- a/world.js +++ b/world.js @@ -203,6 +203,11 @@ let locationsSrc = [ "dir": NORTH, "desc": "You wander into the woods." }, + { + "name": "Mountains", + "dir": EAST, + "desc": "You head up into the mountains." + }, { "name": "Woods", "dir": SOUTH, @@ -318,6 +323,20 @@ let locationsSrc = [ "desc": "You leave the store." } ] + }, + { + "name": "Mountains", + "desc": "Steep, chilly slopes.", + "conn": [ + { + "name": "East Trail", + "dir": WEST, + "desc": "You clamber down from the mountains." + } + ], + "objs": [ + MountainExplore + ] } ];