Feast 2.0!
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.
 
 
 
 
 

364 line
12 KiB

  1. import { Creature } from "../creature"
  2. import { Damage, DamageType, ConstantDamageFormula, Vigor, Side, GroupAction, CombatTest, Stat, DamageFormula, UniformRandomDamageFormula, Action, DamageInstance, StatDamageFormula, VoreStat } from '../combat'
  3. import { ImproperNoun, ProperNoun, FemalePronouns, RandomWord, Adjective, Verb, PairLine } from '../language'
  4. import { LogLine, LogLines, LogEntry, Newline } from '../interface'
  5. import { VoreType, Stomach, VoreContainer, NormalContainer, Container } from '../vore'
  6. import { AttackAction, FeedAction, TransferAction } from '../combat/actions'
  7. import { TogetherCondition, ContainsCondition, EnemyCondition, AllyCondition, PairCondition, CapableCondition } from '../combat/conditions'
  8. import { InstantKillEffect, DamageTypeResistanceEffect } from '../combat/effects'
  9. import * as Words from '../words'
  10. import { StatVigorTest } from '../combat/tests'
  11. class LevelDrain extends Action {
  12. constructor (private container: Container) {
  13. super(
  14. 'Level Drain',
  15. 'Drain energy from your prey',
  16. [
  17. new ContainsCondition(container),
  18. new CapableCondition()
  19. ]
  20. )
  21. }
  22. execute (user: Creature, target: Creature): LogEntry {
  23. const damage: Damage = new Damage(...Object.keys(Stat).map(stat => {
  24. return {
  25. type: DamageType.Acid,
  26. target: stat as Stat,
  27. amount: target.baseStats[stat as Stat] / 5
  28. }
  29. }))
  30. const heal: Damage = new Damage(...Object.keys(Stat).map(stat => {
  31. return {
  32. type: DamageType.Heal,
  33. target: stat as Stat,
  34. amount: target.baseStats[stat as Stat] / 5
  35. }
  36. }))
  37. // TODO make this respect resistances
  38. user.takeDamage(heal)
  39. const targetResult = target.takeDamage(damage)
  40. return new LogLines(
  41. new LogLine(`${user.name.capital.possessive} ${this.container.name} drains power from ${target.name.objective}, siphoning `, damage.renderShort(), ` from ${target.pronouns.possessive} body!`),
  42. targetResult
  43. )
  44. }
  45. describe (user: Creature, target: Creature): LogEntry {
  46. return new LogLine(`Drain energy from ${target.name}`)
  47. }
  48. }
  49. class HypnotizeAction extends Action {
  50. constructor () {
  51. super(
  52. `Hypnotize`,
  53. `Change their mind!`,
  54. [
  55. new TogetherCondition(),
  56. new EnemyCondition(),
  57. new CapableCondition()
  58. ]
  59. )
  60. }
  61. line: PairLine<Creature> = (user, target) => new LogLine(
  62. `${user.name.capital.possessive} hypnotic gaze enthralls ${target.name}, putting ${target.pronouns.objective} under ${user.pronouns.possessive} control!`
  63. )
  64. execute (user: Creature, target: Creature): LogEntry {
  65. target.side = user.side
  66. return this.line(user, target)
  67. }
  68. describe (user: Creature, target: Creature): LogEntry {
  69. return new LogLine(`Force your target to fight by your side`)
  70. }
  71. }
  72. class MawContainer extends NormalContainer {
  73. consumeVerb = new Verb('grab', 'grabs', 'grabbing', 'grabbed')
  74. releaseVerb = new Verb('release')
  75. struggleVerb = new Verb('struggle', 'struggles', 'struggling', 'struggled')
  76. constructor (owner: Creature, stomach: VoreContainer) {
  77. super(new ImproperNoun('maw'), owner, new Set([VoreType.Oral]), 0.05)
  78. const transfer = new TransferAction(this, stomach)
  79. transfer.verb = new Verb('gulp')
  80. this.actions.push(transfer)
  81. }
  82. }
  83. class FlexToesAction extends GroupAction {
  84. constructor (private damage: DamageFormula, container: Container) {
  85. super('Flex Toes', 'Flex your toes!', [
  86. new ContainsCondition(container),
  87. new PairCondition()
  88. ])
  89. }
  90. line = (user: Creature, target: Creature, args: { damage: Damage }) => new LogLine(`${user.name.capital.possessive} toes crush ${target.name.objective} for `, args.damage.renderShort(), ` damage!`)
  91. describeGroup (user: Creature, targets: Creature[]): LogEntry {
  92. return new LogLine(`Flex your toes. `, this.damage.explain(user))
  93. }
  94. execute (user: Creature, target: Creature): LogEntry {
  95. const damage = this.damage.calc(user, target)
  96. return new LogLines(target.takeDamage(damage), this.line(user, target, { damage: damage }))
  97. }
  98. describe (user: Creature, target: Creature): LogEntry {
  99. return new LogLine(`Flex your toes! `, this.damage.describe(user, target))
  100. }
  101. }
  102. class BootContainer extends NormalContainer {
  103. consumeVerb = new Verb('trap', 'traps', 'trapped', 'trapping')
  104. releaseVerb = new Verb('dump')
  105. struggleVerb = new Verb('struggle', 'struggles', 'struggling', 'struggled')
  106. constructor (owner: Creature) {
  107. super(new ImproperNoun('boot'), owner, new Set(), 0.05)
  108. const flex = new FlexToesAction(
  109. new UniformRandomDamageFormula(new Damage(
  110. { target: Stat.Toughness, type: DamageType.Crush, amount: 10 },
  111. { target: Stat.Power, type: DamageType.Crush, amount: 10 },
  112. { target: Stat.Speed, type: DamageType.Crush, amount: 10 },
  113. { target: Stat.Willpower, type: DamageType.Crush, amount: 30 },
  114. { target: Stat.Charm, type: DamageType.Crush, amount: 10 }
  115. ), 0.5),
  116. this
  117. )
  118. this.actions.push(flex)
  119. }
  120. }
  121. const huge = new RandomWord([
  122. new Adjective('massive'),
  123. new Adjective('colossal'),
  124. new Adjective('big ol\''),
  125. new Adjective('heavy'),
  126. new Adjective('crushing'),
  127. new Adjective('huge')
  128. ])
  129. class BiteAction extends AttackAction {
  130. constructor () {
  131. super(
  132. new ConstantDamageFormula(new Damage({ amount: 50, type: DamageType.Slash, target: Vigor.Health })),
  133. new Verb('bite', 'bites', 'biting', 'bit')
  134. )
  135. this.name = "Bite"
  136. }
  137. }
  138. class ChewAction extends GroupAction {
  139. constructor (private damage: DamageFormula, container: Container, private killAction: Action) {
  140. super('Chew', 'Give them the big chew', [
  141. new ContainsCondition(container)
  142. ])
  143. }
  144. line = (user: Creature, target: Creature, args: { damage: Damage }) => new LogLine(`${user.name.capital} chews on ${target.name.objective} for `, args.damage.renderShort(), `!`)
  145. describeGroup (user: Creature, targets: Creature[]): LogEntry {
  146. return new LogLine('Crunch \'em all. ', this.damage.explain(user))
  147. }
  148. execute (user: Creature, target: Creature): LogEntry {
  149. const damage = this.damage.calc(user, target)
  150. const results: Array<LogEntry> = []
  151. results.push(this.line(user, target, { damage: damage }))
  152. results.push(new LogLine(' '))
  153. results.push(target.takeDamage(damage))
  154. if (target.vigors.Health <= 0) {
  155. if (this.killAction.allowed(user, target)) {
  156. results.push(new Newline())
  157. results.push(this.killAction.execute(user, target))
  158. }
  159. }
  160. return new LogLine(...results)
  161. }
  162. describe (user: Creature, target: Creature): LogEntry {
  163. return new LogLine('Do the crunch')
  164. }
  165. }
  166. class StompAction extends GroupAction {
  167. constructor () {
  168. super('Stomp', 'STOMP!', [
  169. new TogetherCondition(),
  170. new EnemyCondition(),
  171. new CapableCondition()
  172. ])
  173. }
  174. line: PairLine<Creature> = (user, target) => new LogLine(
  175. `${user.name.capital} ${user.name.conjugate(new Verb('flatten'))} ${target.name.objective} under ${user.pronouns.possessive} ${huge} foot!`
  176. )
  177. execute (user: Creature, target: Creature): LogEntry {
  178. return new LogLines(this.line(user, target), target.applyEffect(new InstantKillEffect()))
  179. }
  180. describe (user: Creature, target: Creature): LogEntry {
  181. return new LogLine('Stomp one sucker')
  182. }
  183. describeGroup (user: Creature, targets: Array<Creature>): LogEntry {
  184. return new LogLine('Stomp all ', targets.length.toString(), ' of \'em!')
  185. }
  186. }
  187. class StompAllyAction extends Action {
  188. constructor () {
  189. super('Stomp Ally', '-1 ally, +1 buff', [
  190. new TogetherCondition(),
  191. new AllyCondition(),
  192. new CapableCondition()
  193. ])
  194. }
  195. line: PairLine<Creature> = (user, target) => new LogLine(
  196. `${user.name.capital} ${user.name.conjugate(new Verb('flatten'))} ${target.name.objective} under ${user.pronouns.possessive} ${huge} boot!`
  197. )
  198. execute (user: Creature, target: Creature): LogEntry {
  199. const damages: Array<DamageInstance> = Object.keys(Stat).map(stat => ({
  200. target: stat as Stat,
  201. amount: target.stats[stat as Stat] / 3,
  202. type: DamageType.Heal
  203. }))
  204. const heal = new Damage(
  205. ...damages
  206. )
  207. user.takeDamage(heal)
  208. target.destroyed = true
  209. return new LogLines(
  210. this.line(user, target),
  211. target.applyEffect(new InstantKillEffect()),
  212. user.applyEffect(new DamageTypeResistanceEffect(
  213. [DamageType.Crush, DamageType.Slash, DamageType.Pierce],
  214. 0.5
  215. )),
  216. new LogLine(`${user.name.capital} absorbs ${target.pronouns.possessive} power, gaining `, heal.renderShort())
  217. )
  218. }
  219. describe (user: Creature, target: Creature): LogEntry {
  220. return new LogLine('Crush an ally to absorb their power')
  221. }
  222. }
  223. class DevourAllAction extends GroupAction {
  224. constructor (private container: VoreContainer) {
  225. super('Devour All', 'GULP!', [
  226. new TogetherCondition(),
  227. new EnemyCondition(),
  228. new CapableCondition()
  229. ])
  230. }
  231. line = (user: Creature, target: Creature) => new LogLine(`${user.name.capital} ${user.name.conjugate(new Verb('scoop'))} ${target.name} up!`)
  232. groupLine = (user: Creature, args: { count: number }) => new LogLine(`${Words.SwallowSound.allCaps}! All ${args.count} of ${user.pronouns.possessive} prey pour down ${user.name.possessive} ${Words.Slick} gullet as ${user.pronouns.subjective} ${user.name.conjugate(Words.Swallows)}; they're just ${user.kind.all} chow now`)
  233. execute (user: Creature, target: Creature): LogEntry {
  234. this.container.consume(target)
  235. return new LogLines(this.line(user, target))
  236. }
  237. describe (user: Creature, target: Creature): LogEntry {
  238. return new LogLine('Stomp one sucker')
  239. }
  240. executeGroup (user: Creature, targets: Array<Creature>): LogEntry {
  241. return new LogLines(...targets.map(target => this.execute(user, target)).concat(
  242. [
  243. new Newline(),
  244. this.groupLine(user, { count: targets.length })
  245. ]
  246. ))
  247. }
  248. describeGroup (user: Creature, targets: Array<Creature>): LogEntry {
  249. return new LogLine('Eat all ', targets.length.toString(), ' of \'em!')
  250. }
  251. }
  252. export class Withers extends Creature {
  253. title = "Huge Hellhound"
  254. desc = "Will eat your party"
  255. constructor () {
  256. super(
  257. new ProperNoun('Withers'),
  258. new ImproperNoun('hellhound', 'hellhounds'),
  259. FemalePronouns,
  260. { Toughness: 40, Power: 50, Speed: 30, Willpower: 40, Charm: 70 },
  261. new Set(),
  262. new Set([VoreType.Oral]),
  263. 5000
  264. )
  265. this.actions.push(new BiteAction())
  266. this.groupActions.push(new StompAction())
  267. this.side = Side.Monsters
  268. const stomach = new Stomach(this, 0.1, new ConstantDamageFormula(new Damage(
  269. { amount: 300, type: DamageType.Acid, target: Vigor.Health },
  270. { amount: 200, type: DamageType.Crush, target: Vigor.Stamina },
  271. { amount: 200, type: DamageType.Dominance, target: Vigor.Resolve }
  272. )))
  273. this.containers.push(stomach)
  274. this.otherActions.push(new FeedAction(stomach))
  275. this.groupActions.push(new DevourAllAction(stomach))
  276. const maw = new MawContainer(this, stomach)
  277. this.otherContainers.push(maw)
  278. const transfer = new TransferAction(maw, stomach)
  279. transfer.verb = new Verb('gulp')
  280. this.actions.push(new ChewAction(
  281. new UniformRandomDamageFormula(new Damage(
  282. { target: Vigor.Health, type: DamageType.Crush, amount: 10000 }
  283. ), 0.5),
  284. maw,
  285. transfer
  286. ))
  287. const boot = new BootContainer(this)
  288. this.otherContainers.push(boot)
  289. this.actions.push(new StompAllyAction())
  290. this.actions.push(
  291. new AttackAction(
  292. new StatDamageFormula([
  293. { fraction: 0.5, stat: Stat.Toughness, target: Vigor.Health, type: DamageType.Crush },
  294. { fraction: 0.05, stat: VoreStat.Bulk, target: Vigor.Health, type: DamageType.Crush }
  295. ]),
  296. new Verb('stomp')
  297. )
  298. )
  299. this.actions.push(new HypnotizeAction())
  300. this.actions.push(new LevelDrain(stomach))
  301. }
  302. }