crunch
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 

191 řádky
5.3 KiB

  1. function ForestExplore() {
  2. GameObject.call(this, "Explore the Forest");
  3. this.actions.push({
  4. "name": "Explore",
  5. "action": function() {
  6. let outcome = Math.random();
  7. advanceTime(60*30 * (Math.random() * 0.2 + 0.9));
  8. if (outcome < 0.25) {
  9. currentRoom.flags.exit = true;
  10. update(["You find a way back!"]);
  11. } else if (outcome < 0.5) {
  12. startCombat(new Wolf());
  13. } else if (outcome < 0.6) {
  14. startCombat(new AlphaWolf());
  15. } else {
  16. update(["You explore the forest for a while, but don't find anything."]);
  17. }
  18. }
  19. });
  20. this.actions.push({
  21. "name": "Leave",
  22. "action": function() {
  23. moveToByName("East Trail", "You leave the forest");
  24. },
  25. "conditions": [
  26. function(player) {
  27. return currentRoom.flags.exit;
  28. }
  29. ]
  30. });
  31. }
  32. function Wolf() {
  33. Creature.call(this, "Wolf", 10, 15, 15);
  34. this.hasName = false;
  35. this.description = function(prefix) { return prefix + " wolf"; };
  36. this.attacks = [];
  37. this.attacks.push(wolfBite(this));
  38. this.attacks.push(wolfHowl(this));
  39. this.attacks.push(wolfTackle(this));
  40. this.attacks.push(wolfTackleBite(this));
  41. this.attacks.push(wolfTackleSwallow(this));
  42. this.attacks.push(wolfDigest(this));
  43. this.backupAttack = pass(this);
  44. this.flags.stage = "combat";
  45. this.startCombat = function(player) {
  46. 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 <i>hungry.</i>"];
  47. };
  48. this.finishCombat = function() {
  49. return ["The wolf knocks you to the ground. You bash your head on a rock and black out."];
  50. };
  51. this.status = function(player) {
  52. return [];
  53. };
  54. }
  55. function wolfBite(attacker) {
  56. return {
  57. attackPlayer: function(defender){
  58. let damage = attack(attacker, defender, attacker.str);
  59. return ["The wolf jumps at you, biting for " + damage + " damage"];
  60. },
  61. requirements: [
  62. function(attacker, defender) {
  63. return attacker.flags.stage == "combat";
  64. },
  65. function(attacker, defender) {
  66. return !attacker.flags.grappled && !defender.flags.grappled;
  67. }
  68. ],
  69. priority: 1,
  70. weight: function(attacker, defender) { return 1 + defender.health/defender.maxHealth; }
  71. };
  72. }
  73. function wolfHowl(attacker) {
  74. return {
  75. attackPlayer: function(defender){
  76. attacker.statBuffs.push(new StatBuff("str", 1.25));
  77. return ["The wolf backs up and lets out a long, wailing howl.",newline,"It seems emboldened."];
  78. },
  79. requirements: [
  80. function(attacker, defender) {
  81. return attacker.flags.stage == "combat";
  82. },
  83. function(attacker, defender) {
  84. return !attacker.flags.grappled && !defender.flags.grappled;
  85. }
  86. ],
  87. priority: 1,
  88. weight: function(attacker, defender) { return 0.25; }
  89. };
  90. }
  91. function wolfTackle(attacker) {
  92. return {
  93. attackPlayer: function(defender){
  94. defender.flags.grappled = true;
  95. return ["The wolf leaps on top of you, pinning you to the ground!"];
  96. },
  97. requirements: [
  98. function(attacker, defender) {
  99. return attacker.flags.stage == "combat";
  100. },
  101. function(attacker, defender) {
  102. return !attacker.flags.grappled && !defender.flags.grappled;
  103. }
  104. ],
  105. priority: 1,
  106. weight: function(attacker, defender) { return 1.25 - defender.health/defender.maxHealth; }
  107. };
  108. }
  109. function wolfTackleBite(attacker) {
  110. return {
  111. attackPlayer: function(defender){
  112. let damage = attack(attacker, defender, attacker.str * 1.5);
  113. return pickRandom([
  114. ["Pain shoots through your arm as the wolf bites it for " + damage + " damage!"],
  115. ["You struggle against the wolf as it bites your shoulder for " + damage + " damage."],
  116. ["The wolf's claws dig into your legs for " + damage + " damage."]
  117. ]);
  118. },
  119. requirements: [
  120. function(attacker, defender) {
  121. return attacker.flags.stage == "combat";
  122. },
  123. function(attacker, defender) {
  124. return !attacker.flags.grappled && defender.flags.grappled;
  125. }
  126. ],
  127. priority: 1,
  128. weight: function(attacker, defender) { return 1 + defender.health/defender.maxHealth; }
  129. };
  130. }
  131. function wolfTackleSwallow(attacker) {
  132. return {
  133. attackPlayer: function(defender){
  134. attacker.flags.stage = "oral";
  135. return ["You struggle against the wolf, but it's not enough - its greedy jaws envelop your head, then your shoulders. The hungry beast swallows you down in seconds, cramming you into its hot, slimy stomach."];
  136. },
  137. conditions: [
  138. function(attacker, defender) {
  139. return defender.prefs.prey && defender.prefs.vore.oral > 0;
  140. }
  141. ],
  142. requirements: [
  143. function(attacker, defender) {
  144. return attacker.flags.stage == "combat";
  145. },
  146. function(attacker, defender) {
  147. return !attacker.flags.grappled && defender.flags.grappled;
  148. }
  149. ],
  150. priority: 1,
  151. weight: function(attacker, defender) { return 1; }
  152. };
  153. }
  154. function wolfDigest(attacker) {
  155. return {
  156. attackPlayer: function(defender){
  157. let damage = attack(attacker, defender, 25);
  158. return ["The wolf's churning guts wear you down."];
  159. },
  160. requirements: [
  161. function(attacker, defender) {
  162. return attacker.flags.stage == "oral";
  163. }
  164. ],
  165. priority: 1,
  166. weight: function(attacker, defender) { return 1; }
  167. };
  168. }