diff --git a/combat.js b/combat.js index db95ab0..94d8f72 100644 --- a/combat.js +++ b/combat.js @@ -7,11 +7,15 @@ function attack(attacker, defender, baseDamage) { } function isNormal(entity) { - return entity.grappled != true; + return entity.flags.grappled != true && entity.flags.shrunk != true; +} + +function isNormalSize(entity) { + return entity.flags.shrunk != true; } function isGrappled(entity) { - return entity.grappled == true; + return entity.flags.grappled == true; } function doComp(attackStat, defendStat) { @@ -70,7 +74,7 @@ function grapple(attacker) { attack: function(defender) { let success = statHealthCheck(attacker, defender, "str"); if (success) { - defender.grappled = true; + defender.flags.grappled = true; return "You charge at " + defender.description("the") + ", tackling them and knocking them to the ground."; } else { return "You charge at " + defender.description("the") + ", but they dodge out of the way!"; @@ -79,7 +83,7 @@ function grapple(attacker) { attackPlayer: function(defender) { let success = Math.random() < 0.5; if (success) { - defender.grappled = true; + defender.flags.grappled = true; return attacker.description("The") + " lunges at you, pinning you to the floor!"; } else { return attacker.description("The") + " tries to tackle you, but you deftly avoid them."; @@ -101,7 +105,7 @@ function grappleDevour(attacker) { let success = statHealthCheck(attacker, defender, "str"); if (success) { attacker.stomach.feed(defender); - defender.grappled = false; + defender.flags.grappled = false; changeMode("explore"); return "You open your jaws wide, stuffing " + defender.description("the") + "'s head into your gullet and greedily wolfing them down. Delicious."; } else { @@ -111,7 +115,7 @@ function grappleDevour(attacker) { attackPlayer: function(defender) { let success = statHealthCheck(attacker, defender, "str"); if(success) { - defender.grappled = false; + defender.flags.grappled = false; changeMode("eaten"); return attacker.description("The") + " forces your head into their sloppy jaws, devouring you despite your frantic struggles. Glp."; } else { @@ -134,7 +138,7 @@ function grappleAnalVore(attacker) { let success = statHealthCheck(attacker, defender, "str"); if (success) { attacker.butt.feed(defender); - defender.grappled = false; + defender.flags.grappled = false; changeMode("explore"); return "You shove " + defender.description("the") + " between your cheeks. Their head slips into your ass with a wet shlk, and the rest of their body follows suit. You moan and gasp, working them deeper and deeper..."; } else { @@ -154,7 +158,7 @@ function grappleRelease(attacker) { name: "Release", desc: "Release your opponent", attack: function(defender) { - defender.grappled = false; + defender.flags.grappled = false; return "You throw " + defender.description("the") + " back, dealing " + attack(attacker, defender, attacker.str*1.5) + " damage"; }, requirements: [ function(attacker, defender) { return isNormal(attacker) && isGrappled(defender); } @@ -170,7 +174,7 @@ function grappledStruggle(attacker) { attack: function(defender) { let success = statHealthCheck(attacker, defender, "str"); if (success) { - attacker.grappled = false; + attacker.flags.grappled = false; return "You struggle and shove " + defender.description("the") + " off of you."; } else { return "You struggle, but to no avail."; @@ -179,14 +183,14 @@ function grappledStruggle(attacker) { attackPlayer: function(defender) { let success = statHealthCheck(attacker, defender, "str"); if (success) { - attacker.grappled = false; + attacker.flags.grappled = false; return "Your prey shoves you back, breaking your grapple!"; } else { return "Your prey squirms, but remains pinned."; } }, requirements: [ - function(attacker, defender) { return isGrappled(attacker) && isNormal(defender); } + function(attacker, defender) { return isGrappled(attacker) && isNormalSize(attacker) && isNormal(defender); } ], priority: 1, }; @@ -199,8 +203,8 @@ function grappledReverse(attacker) { attack: function(defender) { let success = statHealthCheck(attacker, defender, "str"); if (success) { - attacker.grappled = false; - defender.grappled = true; + attacker.flags.grappled = false; + defender.flags.grappled = true; return "You surprise " + defender.description("the") + " with a burst of strength, flipping them over and pinning them."; } else { return "You try to throw your opponent off of you, but fail."; @@ -209,15 +213,15 @@ function grappledReverse(attacker) { attackPlayer: function(defender) { let success = statHealthCheck(attacker, defender, "str"); if (success) { - attacker.grappled = false; - defender.grappled = true; + attacker.flags.grappled = false; + defender.flags.grappled = true; return "Your prey suddenly grabs hold and flips you over, pinning you!"; } else { return "Your prey tries to grab at you, but you keep them under control."; } }, requirements: [ - function(attacker, defender) { return isGrappled(attacker) && isNormal(defender); } + function(attacker, defender) { return isGrappled(attacker) && isNormalSize(attacker) && isNormal(defender); } ], priority: 1, }; @@ -230,7 +234,7 @@ function flee(attacker) { attack: function(defender) { let success = statCheck(attacker, defender, "dex"); if (success) { - attacker.grappled = false; + attacker.flags.grappled = false; changeMode("explore"); return "You successfully run away."; } else { @@ -283,7 +287,7 @@ function leer(attacker) { return attacker.description("The") + " leers at you."; }, requirements: [ - function(attacker, defender) { return attacker.leering != true && attacker.grappled != true; } + function(attacker, defender) { return attacker.leering != true && attacker.flags.grappled != true; } ], priority: 1, }; diff --git a/customs.js b/customs.js index 6b5db73..69bf67b 100644 --- a/customs.js +++ b/customs.js @@ -4,8 +4,119 @@ function Geta() { Creature.call(this, "Geta", 5, 15, 10); this.hasName = true; - - this.description = function() { return "Geta" }; + + this.description = function() { return "Geta"; }; + + this.attacks.push(new punchAttack(this)); + this.attacks.push(new getaShrink(this)); + this.attacks.push(new getaGrab(this)); + this.attacks.push(new getaTease(this)); + this.attacks.push(new getaSuckle(this)); + this.attacks.push(new getaSalivaSwallow(this)); + this.attacks.push(new getaSwallow(this)); + + this.backupAttack = new pass(this); + + this.digests = []; + + this.digests.push(new digestPlayerStomach(this,50)); + this.struggles = []; + + this.struggles.push(new rub(this)); +} + +function getaShrink(attacker) { + return { + attackPlayer: function(defender) { + let success = true; + + if (success) { + defender.flags.shrunk = true; + return attacker.description() + " pulls a strange device from his pocket and points it at you. A blinding flash envelops your vision...and as your sight returns, you find yourself shrunken down to no more than two inches tall."; + } + }, + requirements: [ + function(attacker, defender) { + return isNormal(attacker) && isNormal(defender); + } + ], + priority: 2 + }; +} + +function getaGrab(attacker) { + return { + attackPlayer: function(defender) { + defender.flags.grappled = true; + return attacker.description() + " leans down and snatches you up, stuffing you into his maw."; + }, + requirements: [ + function(attacker, defender) { + return isNormal(attacker) && defender.flags.shrunk == true && defender.flags.grappled != true; + } + ], + priority: 2 + }; +} + +function getaTease(attacker) { + return { + attackPlayer: function(defender) { + defender.stamina = Math.max(defender.stamina - 25, 0); + return attacker.description() + " grinds you against the roof of his maw with his tongue."; + }, + requirements: [ + function(attacker, defender) { + return isNormal(attacker) && defender.flags.shrunk == true && defender.flags.grappled == true && defender.stamina > 0; + } + ], + priority: 1 + }; +} + +function getaSuckle(attacker) { + return { + attackPlayer: function(defender) { + defender.stamina = Math.max(defender.stamina - 45, 0); + return attacker.description() + " shuts his jaws and suckles on you."; + }, + requirements: [ + function(attacker, defender) { + return isNormal(attacker) && defender.flags.shrunk == true && defender.flags.grappled == true && defender.stamina > 0; + } + ], + priority: 1 + }; +} + +function getaSalivaSwallow(attacker) { + return { + attackPlayer: function(defender) { + defender.stamina = Math.max(defender.stamina - 15, 0); + return attacker.description() + " swallows, draining the drool from his jaws - leaving you on the precipice of his gullet."; + }, + requirements: [ + function(attacker, defender) { + return isNormal(attacker) && defender.flags.shrunk == true && defender.flags.grappled == true && defender.stamina > 0; + } + ], + priority: 1 + }; +} + +function getaSwallow(attacker) { + return { + attackPlayer: function(defender) { + changeMode("eaten"); + return attacker.description() + " shuts his jaws and swallows, dragging you down into his tight throat and dumping you into a caustic stomach."; + }, + requirements: [ + function(attacker, defender) { + return isNormal(attacker) && defender.flags.shrunk == true && defender.flags.grappled == true && defender.stamina <= 0; + } + ], + priority: 2 + }; } function GetaObj() { diff --git a/feast.js b/feast.js index a111371..f806965 100644 --- a/feast.js +++ b/feast.js @@ -42,7 +42,7 @@ function pick(list, attacker, defender) { if (list.length == 0) return null; else { - let sum = list.reduce((sum, choice) => choice.weight == undefined ? 1 : choice.weight(attacker, defender) + sum, 0); + let sum = list.reduce((sum, choice) => choice.weight == undefined ? sum + 1 : sum + choice.weight(attacker, defender) + sum, 0); let target = Math.random() * sum; @@ -364,6 +364,7 @@ function changeMode(newMode) { function respawn(respawnRoom) { moveTo(respawnRoom,"You drift through space and time..."); + player.clear(); player.stomach.contents = []; player.butt.contents = []; advanceTime(86400/2); diff --git a/vore.js b/vore.js index d6c21fa..1ccb953 100644 --- a/vore.js +++ b/vore.js @@ -31,6 +31,12 @@ function Creature(name = "Creature", str=10, dex=10, con=10) { this.restoreStamina = function(time) { this.stamina = Math.min(this.maxStamina, this.stamina + this.maxStamina * time * this.staminaRate); }; + + this.flags = {}; + + this.clear = function() { + this.flags = {}; + }; } function Player(name = "Player") { @@ -127,6 +133,8 @@ function Fen() { this.build = "loomy"; this.species = "crux"; + this.description = function(prefix) { return "Fen"; }; + this.attacks = []; this.attacks.push(new devourPlayer(this));