Feast 2.0!
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 
 

307 líneas
7.6 KiB

  1. import { Place, Choice, Direction, World } from '../world'
  2. import { ProperNoun, ImproperNoun, MalePronouns, FemalePronouns, TheyPronouns } from '../language'
  3. import { Encounter, Stat, Damage, DamageType, Vigor, Side } from '../combat'
  4. import * as Creatures from '../creatures'
  5. import * as Items from '../items'
  6. import { LogLine, nilLog, LogLines } 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. import { RandomAI, VoreAI } from '../ai'
  12. function makeParty (): Creature[] {
  13. const fighter = new Creatures.Human(new ProperNoun("Redgar"), MalePronouns, {
  14. stats: {
  15. Toughness: 20,
  16. Power: 20,
  17. Speed: 15,
  18. Willpower: 15,
  19. Charm: 10
  20. }
  21. })
  22. fighter.title = "Lv. 6 Fighter"
  23. fighter.equip(new Items.Sword(), Items.EquipmentSlot.MainHand)
  24. const rogue = new Creatures.Human(new ProperNoun('Lidda'), FemalePronouns, {
  25. stats: {
  26. Toughness: 10,
  27. Power: 15,
  28. Speed: 20,
  29. Willpower: 15,
  30. Charm: 20
  31. }
  32. })
  33. rogue.title = "Lv. 5 Rogue"
  34. rogue.equip(new Items.Dagger(), Items.EquipmentSlot.MainHand)
  35. const wizard = new Creatures.Human(new ProperNoun('Mialee'), FemalePronouns, {
  36. stats: {
  37. Toughness: 10,
  38. Power: 10,
  39. Speed: 15,
  40. Willpower: 20,
  41. Charm: 25
  42. }
  43. })
  44. wizard.title = "Lv. 6 Wizard"
  45. wizard.equip(new Items.Wand(), Items.EquipmentSlot.MainHand)
  46. const cleric = new Creatures.Human(new ProperNoun('Jozan'), MalePronouns, {
  47. stats: {
  48. Toughness: 15,
  49. Power: 15,
  50. Speed: 10,
  51. Willpower: 20,
  52. Charm: 15
  53. }
  54. })
  55. cleric.title = "Lv. 5 Cleric"
  56. cleric.equip(new Items.Mace(), Items.EquipmentSlot.MainHand)
  57. return [fighter, cleric, rogue, wizard]
  58. }
  59. export const Town = (): Place => {
  60. const home = new Place(
  61. new ProperNoun('Your home'),
  62. "A very home-y place"
  63. )
  64. const westAve = new Place(
  65. new ImproperNoun('West Avenue'),
  66. "Streets of Sim City"
  67. )
  68. const northAve = new Place(
  69. new ImproperNoun('North Avenue'),
  70. "Streets of Sim City"
  71. )
  72. const eastAve = new Place(
  73. new ImproperNoun('East Avenue'),
  74. "Streets of Sim City"
  75. )
  76. const southAve = new Place(
  77. new ImproperNoun('South Avenue'),
  78. "Streets of Sim City"
  79. )
  80. const alley = new Place(
  81. new ImproperNoun('alley'),
  82. "A spooky alley"
  83. )
  84. const westRoad = new Place(
  85. new ImproperNoun('road'),
  86. "West of town"
  87. )
  88. const woods = new Place(
  89. new ImproperNoun('woods'),
  90. "Scary woods"
  91. )
  92. const bosses = new Place(
  93. new ProperNoun("BOSS ZONE"),
  94. "Extra scary"
  95. )
  96. const square = new Place(
  97. new ProperNoun("Central Square"),
  98. "The center of town"
  99. )
  100. woods.choices.push(
  101. new Choice(
  102. "Fight a wolf",
  103. "yolo",
  104. (world, executor) => {
  105. world.encounter = new Encounter(
  106. {
  107. name: "You punched a wolf",
  108. intro: (world: World) => new LogLine(`You punched a wolf. The wolf is angry.`)
  109. },
  110. [executor, new Creatures.Wolf()]
  111. )
  112. return new LogLine(`FIGHT TIME`)
  113. }
  114. )
  115. )
  116. woods.choices.push(
  117. new Choice(
  118. "Fight Geta",
  119. "yolo",
  120. (world, executor) => {
  121. world.encounter = new Encounter(
  122. {
  123. name: "You punched Geta",
  124. intro: (world: World) => new LogLine(`You punched Geta. Geta is angry.`)
  125. },
  126. [executor, new Creatures.Geta()]
  127. )
  128. return new LogLine(`FIGHT TIME`)
  129. }
  130. )
  131. )
  132. woods.choices.push(
  133. new Choice(
  134. "Fight a dragon",
  135. "yolo",
  136. (world, executor) => {
  137. world.encounter = new Encounter(
  138. {
  139. name: "You punched a dragon",
  140. intro: (world: World) => new LogLine(`You punched a dragon. The dragon is angry.`)
  141. },
  142. [executor, new Creatures.Dragon()]
  143. )
  144. return new LogLine(`FIGHT TIME`)
  145. }
  146. )
  147. )
  148. const bossEncounters = [
  149. new Encounter(
  150. { name: "Withers & Kenzie", intro: (world: World) => nilLog },
  151. makeParty().concat([new Creatures.Withers(), new Creatures.Kenzie()])
  152. ),
  153. new Encounter(
  154. { name: "Goldeneye", intro: (world: World) => nilLog },
  155. makeParty().concat([new Creatures.Goldeneye()])
  156. ),
  157. new Encounter(
  158. { name: "Large Wah", intro: (world: World) => nilLog },
  159. makeParty().concat([new Creatures.Shingo()])
  160. ),
  161. new Encounter(
  162. { name: "Cafat", intro: (world: World) => nilLog },
  163. makeParty().concat([new Creatures.Cafat()])
  164. )
  165. ]
  166. home.choices.push(
  167. new Choice(
  168. "Nap",
  169. "Zzzzzz",
  170. (world, executor) => {
  171. return new LogLines(
  172. `You lie down for a nice nap...`,
  173. world.advance(moment.duration(1, "hour"))
  174. )
  175. }
  176. )
  177. )
  178. home.choices.push(
  179. new Choice(
  180. "Boost stats",
  181. "Make your stats more good-er",
  182. (world, executor) => {
  183. Object.keys(Stat).forEach(stat => {
  184. executor.baseStats[stat as Stat] += 5
  185. executor.takeDamage(new Damage(
  186. { amount: 5, target: (stat as Stat), type: DamageType.Heal }
  187. ))
  188. })
  189. return new LogLine(`You're stronger now`)
  190. }
  191. )
  192. )
  193. home.choices.push(
  194. new Choice(
  195. "Heal",
  196. "Become not dead",
  197. (world, executor) => {
  198. Object.keys(Vigor).forEach(vigor => {
  199. executor.vigors[vigor as Vigor] = executor.maxVigors[vigor as Vigor]
  200. })
  201. return new LogLine(`You're stronger now`)
  202. }
  203. )
  204. )
  205. westAve.choices.push(
  206. new Choice(
  207. "Eat someone",
  208. "Slurp",
  209. (world, executor) => {
  210. const snack = new Creatures.Human(new ProperNoun(["Snack", "Treat", "Tasty", "Dinner", "Appetizer"][Math.floor(Math.random() * 5)]), TheyPronouns)
  211. snack.applyEffect(new SurrenderEffect())
  212. const options = executor.validActions(snack).filter(action => action instanceof DevourAction)
  213. return options[Math.floor(options.length * Math.random())].execute(executor, snack)
  214. }
  215. )
  216. )
  217. westAve.choices.push(
  218. new Choice(
  219. "Fight someone",
  220. "Ow",
  221. (world, executor) => {
  222. const enemy = new Creatures.Human(new ProperNoun("Nerd"), TheyPronouns)
  223. enemy.side = Side.Monsters
  224. enemy.ai = new RandomAI()
  225. const encounter = new Encounter(
  226. {
  227. name: "Fight some nerd",
  228. intro: world => new LogLine(`You find some nerd to fight.`)
  229. },
  230. [world.player, enemy]
  231. )
  232. world.encounter = encounter
  233. return nilLog
  234. }
  235. )
  236. )
  237. alley.choices.push(
  238. new Choice(
  239. "Kuro",
  240. "Get eaten by a Luxray",
  241. (world, executor) => {
  242. const enemy = new Creatures.Kuro()
  243. enemy.ai = new VoreAI()
  244. const encounter = new Encounter(
  245. {
  246. name: "Luxray time",
  247. intro: world => new LogLine(`Luxray time!`)
  248. },
  249. [world.player, enemy]
  250. )
  251. world.encounter = encounter
  252. return nilLog
  253. }
  254. )
  255. )
  256. bossEncounters.forEach(encounter => {
  257. bosses.choices.push(
  258. new Choice(
  259. encounter.desc.name,
  260. "Boss fight!",
  261. (world, executor) => {
  262. world.encounter = encounter
  263. return nilLog
  264. }
  265. )
  266. )
  267. })
  268. home.biconnect(Direction.North, westAve)
  269. westAve.biconnect(Direction.West, westRoad)
  270. westAve.biconnect(Direction.North, alley)
  271. westRoad.biconnect(Direction.South, woods)
  272. westRoad.biconnect(Direction.North, bosses)
  273. square.biconnect(Direction.East, eastAve)
  274. square.biconnect(Direction.West, westAve)
  275. square.biconnect(Direction.North, northAve)
  276. square.biconnect(Direction.South, southAve)
  277. return home
  278. }