From ad6237a61c92471e48260bc2ddf5d153b226753f Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Wed, 14 Mar 2018 11:12:31 -0400 Subject: [PATCH] Enemies have meaningful builds now, with different stats --- feast.js | 4 ++++ vore.js | 38 ++++++++++++++++++++++++++++---------- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/feast.js b/feast.js index 3bd0333..9217e8f 100644 --- a/feast.js +++ b/feast.js @@ -21,6 +21,10 @@ let prefs = { } }; +function pickRandom(list) { + return list[Math.floor(Math.random() * list.length)]; +} + function pick(list, attacker, defender) { if (list.length == 0) return null; diff --git a/vore.js b/vore.js index 798d08e..9845ba2 100644 --- a/vore.js +++ b/vore.js @@ -52,20 +52,38 @@ function Player(name = "Player") { this.backupAttack = new pass(this); } -function Anthro() { - Creature.call(this, name); +function Anthro(name="Anthro") { + this.build = pickRandom(["skinny", "fat", "muscular", "sickly", "ordinary"]); + + switch(this.build) { + case "skinny": + Creature.call(this, name, 8, 12, 8); + this.mass *= ( Math.random() * 0.2 + 0.7 ); + break; + case "fat": + Creature.call(this, name, 10, 7, 15); + this.mass *= ( Math.random() * 0.4 + 1.1); + break; + case "muscular": + Creature.call(this, name, 13, 11, 13); + this.mass *= ( Math.random() * 0.1 + 1.1); + break; + case "sickly": + Creature.call(this, name, 6, 8, 6); + this.mass *= ( Math.random() * 0.2 + 0.6 ); + break; + case "ordinary": + Creature.call(this, name, 10, 10, 10); + break; - this.mass = 80 * (Math.random()/2 - 0.25 + 1); - this.build = "ordinary"; - if (this.mass < 70) { - this.build = "skinny"; - } else if (this.mass > 90) { - this.build = "fat"; } - this.species = pick(["dog","cat","lizard","deer","wolf","fox"]); + this.species = pickRandom(["dog","cat","lizard","deer","wolf","fox"]); this.description = function() { - return this.build + " " + this.species; + if (this.build == "") + return this.species; + else + return this.build + " " + this.species; }; this.attacks.push(new punchAttack(this));