Feast 2.0!
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 

174 строки
4.2 KiB

  1. import { Place, Choice, Direction } from '../world'
  2. import { ProperNoun, ImproperNoun, MalePronouns, FemalePronouns, TheyPronouns } from '../language'
  3. import { Encounter } from '../combat'
  4. import * as Creatures from '../creatures'
  5. import * as Items from '../items'
  6. import { LogLine, nilLog } from '../interface'
  7. import { Creature } from '../creature'
  8. import { DevourAction } from '../combat/actions'
  9. import { SurrenderEffect } from '../combat/effects'
  10. import moment from 'moment'
  11. function makeParty (): Creature[] {
  12. const fighter = new Creatures.Human(new ProperNoun("Redgar"), MalePronouns, {
  13. stats: {
  14. Toughness: 20,
  15. Power: 20,
  16. Speed: 15,
  17. Willpower: 15,
  18. Charm: 10
  19. }
  20. })
  21. fighter.title = "Lv. 6 Fighter"
  22. fighter.equipment.set(Items.EquipmentSlot.MainHand, new Items.Sword())
  23. const rogue = new Creatures.Human(new ProperNoun('Lidda'), FemalePronouns, {
  24. stats: {
  25. Toughness: 10,
  26. Power: 15,
  27. Speed: 20,
  28. Willpower: 15,
  29. Charm: 20
  30. }
  31. })
  32. rogue.title = "Lv. 5 Rogue"
  33. rogue.equipment.set(Items.EquipmentSlot.MainHand, new Items.Dagger())
  34. const wizard = new Creatures.Human(new ProperNoun('Mialee'), FemalePronouns, {
  35. stats: {
  36. Toughness: 10,
  37. Power: 10,
  38. Speed: 15,
  39. Willpower: 20,
  40. Charm: 25
  41. }
  42. })
  43. wizard.title = "Lv. 6 Wizard"
  44. wizard.equipment.set(Items.EquipmentSlot.MainHand, new Items.Wand())
  45. const cleric = new Creatures.Human(new ProperNoun('Jozan'), MalePronouns, {
  46. stats: {
  47. Toughness: 15,
  48. Power: 15,
  49. Speed: 10,
  50. Willpower: 20,
  51. Charm: 15
  52. }
  53. })
  54. cleric.title = "Lv. 5 Cleric"
  55. cleric.equipment.set(Items.EquipmentSlot.MainHand, new Items.Mace())
  56. return [fighter, cleric, rogue, wizard]
  57. }
  58. export const Town = (): Place => {
  59. const home = new Place(
  60. new ProperNoun('Your home'),
  61. "A very home-y place"
  62. )
  63. const westAve = new Place(
  64. new ImproperNoun('West Avenue'),
  65. "Streets of Sim City"
  66. )
  67. const westRoad = new Place(
  68. new ImproperNoun('road'),
  69. "West of town"
  70. )
  71. const woods = new Place(
  72. new ImproperNoun('woods'),
  73. "Scary woods"
  74. )
  75. const bosses = new Place(
  76. new ProperNoun("BOSS ZONE"),
  77. "Extra scary"
  78. )
  79. woods.choices.push(
  80. new Choice(
  81. "Fight a wolf",
  82. "yolo",
  83. (world, executor) => {
  84. world.encounter = new Encounter(
  85. { name: "You punched a wolf" },
  86. [executor, new Creatures.Wolf()]
  87. )
  88. return new LogLine(`FIGHT TIME`)
  89. }
  90. )
  91. )
  92. woods.choices.push(
  93. new Choice(
  94. "Fight a dragon",
  95. "yolo",
  96. (world, executor) => {
  97. world.encounter = new Encounter(
  98. { name: "You punched a dragon" },
  99. [executor, new Creatures.Dragon()]
  100. )
  101. return new LogLine(`FIGHT TIME`)
  102. }
  103. )
  104. )
  105. const bossEncounters = [
  106. new Encounter(
  107. { name: "Withers & Kenzie" },
  108. makeParty().concat([new Creatures.Withers(), new Creatures.Kenzie()])
  109. ),
  110. new Encounter(
  111. { name: "Goldeneye" },
  112. makeParty().concat([new Creatures.Goldeneye()])
  113. ),
  114. new Encounter(
  115. { name: "Large Wah" },
  116. makeParty().concat([new Creatures.Shingo()])
  117. )
  118. ]
  119. home.choices.push(
  120. new Choice(
  121. "Nap",
  122. "Zzzzzz",
  123. (world, executor) => {
  124. return world.advance(moment.duration(1, "hour"))
  125. }
  126. )
  127. )
  128. home.choices.push(
  129. new Choice(
  130. "Eat someone",
  131. "Slurp",
  132. (world, executor) => {
  133. const snack = new Creatures.Human(new ProperNoun("Snack"), TheyPronouns)
  134. snack.applyEffect(new SurrenderEffect())
  135. const options = executor.validActions(snack).filter(action => action instanceof DevourAction)
  136. return options[Math.floor(options.length * Math.random())].execute(executor, snack)
  137. }
  138. )
  139. )
  140. bossEncounters.forEach(encounter => {
  141. bosses.choices.push(
  142. new Choice(
  143. encounter.desc.name,
  144. "Boss fight!",
  145. (world, executor) => {
  146. world.encounter = encounter
  147. return nilLog
  148. }
  149. )
  150. )
  151. })
  152. home.biconnect(Direction.North, westAve)
  153. westAve.biconnect(Direction.West, westRoad)
  154. westRoad.biconnect(Direction.South, woods)
  155. westRoad.biconnect(Direction.North, bosses)
  156. return home
  157. }