munch
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

149 lines
3.8 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() { return "wolf"; };
  36. this.attacks = [];
  37. this.attacks.push(wolfBite(this));
  38. //this.attacks.push(wolfSwallow(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 ["Oh no a feral wolf"];
  47. };
  48. this.finishCombat = function() {
  49. return ["Oops eaten"];
  50. };
  51. this.status = function(player) {
  52. return ["It's a wolf"];
  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 wolfTackle(attacker) {
  74. return {
  75. attackPlayer: function(defender){
  76. defender.flags.grappled = true;
  77. return ["The wolf leaps on top of you, pinning you to the ground!"];
  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 1.25 - defender.health/defender.maxHealth; }
  89. };
  90. }
  91. function wolfTackleSwallow(attacker) {
  92. return {
  93. attackPlayer: function(defender){
  94. attacker.flags.stage = "oral";
  95. 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."];
  96. },
  97. conditions: [
  98. function(attacker, defender) {
  99. return defender.prefs.prey && defender.prefs.vore.oral > 0;
  100. }
  101. ],
  102. requirements: [
  103. function(attacker, defender) {
  104. return attacker.flags.stage == "combat";
  105. },
  106. function(attacker, defender) {
  107. return !attacker.flags.grappled && defender.flags.grappled;
  108. }
  109. ],
  110. priority: 1,
  111. weight: function(attacker, defender) { return 1; }
  112. };
  113. }
  114. function wolfDigest(attacker) {
  115. return {
  116. attackPlayer: function(defender){
  117. let damage = attack(attacker, defender, 25);
  118. return ["The wolf's churning guts wear you down."];
  119. },
  120. requirements: [
  121. function(attacker, defender) {
  122. return attacker.flags.stage == "oral";
  123. }
  124. ],
  125. priority: 1,
  126. weight: function(attacker, defender) { return 1; }
  127. };
  128. }