munch
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 

275 lines
9.0 KiB

  1. "use strict";
  2. function attack(attacker, defender, baseDamage) {
  3. let damage = Math.round((Math.random() * 0.5 - 0.25 + 1) * baseDamage);
  4. defender.health -= damage;
  5. return damage;
  6. }
  7. function isNormal(entity) {
  8. return entity.grappled != true;
  9. }
  10. function isGrappled(entity) {
  11. return entity.grappled == true;
  12. }
  13. function punchAttack(attacker) {
  14. return {
  15. name: "Punch",
  16. desc: "Punch a nerd",
  17. attack: function(defender) {
  18. return "You punch the " + defender.description() + " for " + attack(attacker, defender, attacker.str) + " damage";
  19. },
  20. attackPlayer: function(defender) {
  21. return "The " + attacker.description() + " punches you for " + attack(attacker, defender, attacker.str) + " damage";
  22. }, requirements: [
  23. function(attacker, defender) { return isNormal(attacker) && isNormal(defender); }
  24. ],
  25. priority: 1,
  26. };
  27. }
  28. function flankAttack(attacker) {
  29. return {
  30. name: "Flank",
  31. desc: "Be sneaky",
  32. attack: function(defender) {
  33. return "You run around the " + defender.description() + " and attack for " + attack(attacker, defender, attacker.dex) + " damage";
  34. },
  35. attackPlayer: function(defender) {
  36. return "The " + attacker.description() + " runs past you, then turns and hits you for " + attack(attacker, defender, attacker.str) + " damage";
  37. }, requirements: [
  38. function(attacker, defender) { return isNormal(attacker) && isNormal(defender); }
  39. ],
  40. priority: 1,
  41. };
  42. }
  43. function grapple(attacker) {
  44. return {
  45. name: "Grapple",
  46. desc: "Try to grab your opponent",
  47. attack: function(defender) {
  48. let success = Math.random() < 0.5;
  49. if (success) {
  50. defender.grappled = true;
  51. return "You charge at the " + defender.description() + ", tackling them and knocking them to the ground.";
  52. } else {
  53. return "You charge at the " + defender.description() + ", but they dodge out of the way!";
  54. }
  55. },
  56. attackPlayer: function(defender) {
  57. let success = Math.random() < 0.5;
  58. if (success) {
  59. defender.grappled = true;
  60. return "The " + attacker.description() + " lunges at you, pinning you to the floor!";
  61. } else {
  62. return "The " + attacker.description() + " tries to tackle you, but you deftly avoid them.";
  63. }
  64. },
  65. requirements: [
  66. function(attacker, defender) { return isNormal(attacker) && isNormal(defender); }
  67. ],
  68. priority: 1,
  69. };
  70. }
  71. function grappleDevour(attacker) {
  72. return {
  73. name: "Devour",
  74. desc: "Try to consume your grappled opponent",
  75. attack: function(defender) {
  76. let success = Math.random() < 0.25 + (1 - defender.health / defender.maxHealth) * 0.75;
  77. if (success) {
  78. attacker.stomach.feed(defender);
  79. defender.grappled = false;
  80. changeMode("explore");
  81. return "You open your jaws wide, stuffing the " + defender.description() + "'s head into your gullet and greedily wolfing them down. Delicious.";
  82. } else {
  83. return "Your jaws open wide, but the " + defender.description() + " manages to avoid becoming " + attacker.species + " chow.";
  84. }
  85. },
  86. attackPlayer: function(defender) {
  87. let success = Math.random() < 0.5 + (1 - defender.health / defender.maxHealth)*0.5 && Math.random() < 0.5;
  88. if(success) {
  89. defender.grappled = false;
  90. changeMode("eaten");
  91. return "The " + attacker.description() + " forces your head into their sloppy jaws, devouring you despite your frantic struggles. Glp.";
  92. } else {
  93. return "The " + attacker.description() + " tries to swallow you down, but you manage to resist their hunger.";
  94. }
  95. }, requirements: [
  96. function(attacker, defender) { return isNormal(attacker) && isGrappled(defender); }
  97. ], conditions: [
  98. function(prefs, player=false) { return player || prefs.player.prey; }
  99. ],
  100. priority: 1,
  101. };
  102. }
  103. function grappleAnalVore(attacker) {
  104. return {
  105. name: "Anal Vore",
  106. desc: "Try to shove your opponent up your ass.",
  107. attack: function(defender) {
  108. let success = Math.random() < 0.25 + (1 - defender.health / defender.maxHealth) * 0.75;
  109. if (success) {
  110. attacker.butt.feed(defender);
  111. defender.grappled = false;
  112. changeMode("explore");
  113. return "You shove the " + defender.description() + " between your cheeks. Their head slips into your ass with a wet <i>shlk</i>, and the rest of their body follows suit. You moan and gasp, working them deeper and deeper...";
  114. } else {
  115. return "Your grasp and shove the " + defender.description() + ", but they manage to avoid becoming " + attacker.species + " chow.";
  116. }
  117. }, requirements: [
  118. function(attacker, defender) { return isNormal(attacker) && isGrappled(defender); }
  119. ], conditions: [
  120. function(prefs, player=false) { return player || prefs.player.prey; }
  121. ],
  122. priority: 1,
  123. };
  124. }
  125. function grappleRelease(attacker) {
  126. return {
  127. name: "Release",
  128. desc: "Release your opponent",
  129. attack: function(defender) {
  130. defender.grappled = false;
  131. return "You throw the " + defender.description() + " back, dealing " + attack(attacker, defender, attacker.str*1.5) + " damage";
  132. }, requirements: [
  133. function(attacker, defender) { return isNormal(attacker) && isGrappled(defender); }
  134. ],
  135. priority: 1,
  136. };
  137. }
  138. function grappledStruggle(attacker) {
  139. return {
  140. name: "Struggle",
  141. desc: "Try to break your opponent's pin",
  142. attack: function(defender) {
  143. let success = Math.random() < 0.5 + (1 - defender.health / defender.maxHealth)*0.5;
  144. if (success) {
  145. attacker.grappled = false;
  146. return "You struggle and shove the " + defender.description() + " off of you.";
  147. } else {
  148. return "You struggle, but to no avail.";
  149. }
  150. },
  151. attackPlayer: function(defender) {
  152. let success = Math.random() < 0.5 + (1 - defender.health / defender.maxHealth)*0.5 && Math.random() < 0.5;
  153. if (success) {
  154. attacker.grappled = false;
  155. return "Your prey shoves you back, breaking your grapple!";
  156. } else {
  157. return "Your prey squirms, but remains pinned.";
  158. }
  159. },
  160. requirements: [
  161. function(attacker, defender) { return isGrappled(attacker) && isNormal(defender); }
  162. ],
  163. priority: 1,
  164. };
  165. }
  166. function grappledReverse(attacker) {
  167. return {
  168. name: "Reversal",
  169. desc: "Try to pin your grappler. Less likely to work than struggling.",
  170. attack: function(defender) {
  171. let success = Math.random() < 0.25 + (1 - defender.health / defender.maxHealth) * 0.5;
  172. if (success) {
  173. attacker.grappled = false;
  174. defender.grappled = true;
  175. return "You surprise the " + defender.description() + " with a burst of strength, flipping them over and pinning them.";
  176. } else {
  177. return "You try to throw your opponent off of you, but fail.";
  178. }
  179. },
  180. attackPlayer: function(defender) {
  181. let success = Math.random() < 0.5 + (1 - defender.health / defender.maxHealth)*0.5 && Math.random() < 0.5;
  182. if (success) {
  183. attacker.grappled = false;
  184. defender.grappled = true;
  185. return "Your prey suddenly grabs hold and flips you over, pinning you!";
  186. } else {
  187. return "Your prey tries to grab at you, but you keep them under control.";
  188. }
  189. },
  190. requirements: [
  191. function(attacker, defender) { return isGrappled(attacker) && isNormal(defender); }
  192. ],
  193. priority: 1,
  194. };
  195. }
  196. function pass(attacker) {
  197. return {
  198. name: "Pass",
  199. desc: "You can't do anything!",
  200. attack: function(defender) {
  201. return "You do nothing.";
  202. },
  203. attackPlayer: function(defender) {
  204. return "The " + attacker.description() + " does nothing.";
  205. },
  206. priority: 0,
  207. };
  208. }
  209. function devourPlayer(attacker) {
  210. return {
  211. name: "Devours YOU!",
  212. desc: "You won't see this",
  213. conditions: [
  214. function(prefs) { return prefs.player.prey; }
  215. ],
  216. requirements: [
  217. function(attacker, defender) { return attacker.leering == true; }
  218. ],
  219. attackPlayer: function(defender) {
  220. changeMode("eaten");
  221. return "The voracious " + attacker.description() + " pins you down and devours you in seconds.";
  222. },
  223. priority: 1,
  224. };
  225. }
  226. function leer(attacker) {
  227. return {
  228. name: "Leer",
  229. desc: "Leer at something",
  230. attackPlayer: function(defender) {
  231. attacker.leering = true;
  232. return "The " + attacker.description() + " leers at you.";
  233. },
  234. requirements: [
  235. function(attacker, defender) { return attacker.leering != true && attacker.grappled != true; }
  236. ],
  237. priority: 1,
  238. };
  239. }
  240. function poke(attacker) {
  241. return {
  242. name: "Poke",
  243. desc: "Poke a nerd",
  244. attackPlayer: function(defender) {
  245. return "The " + attacker.description() + " pokes you on the snout for " + attack(attacker, defender, 1e12) + " damage";
  246. },
  247. priority: 1,
  248. };
  249. }
  250. function digestPlayerStomach(predator,damage=20) {
  251. return {
  252. digest: function(player) {
  253. attack(predator, player, damage);
  254. return "The " + predator.description() + "'s stomach grinds over your body, swiftly digesting you.";
  255. },
  256. priority: 1,
  257. };
  258. }