|
|
|
@@ -0,0 +1,137 @@ |
|
|
|
import { Creature } from "../creature" |
|
|
|
import { Damage, DamageType, ConstantDamageFormula, Vigor, Side, StatDamageFormula, Stat, Action, DamageFormula } from '../combat' |
|
|
|
import { ImproperNoun, ProperNoun, FemalePronouns, MalePronouns, Verb, PairLineArgs, PairLine } from '../language' |
|
|
|
import { VoreType, Stomach, Bowels, NormalContainer, InnerContainer, VoreContainer, Container } from '../vore' |
|
|
|
import { AttackAction, TransferAction, FeedAction, StruggleAction } from '../combat/actions' |
|
|
|
import { LogLine, LogEntry, LogLines } from '../interface' |
|
|
|
import { ContainsCondition, CapableCondition, EnemyCondition } from '../combat/conditions' |
|
|
|
import { StatTest } from '../combat/tests' |
|
|
|
|
|
|
|
class Hand extends NormalContainer { |
|
|
|
consumeVerb: Verb = new Verb('grab', 'grabs', 'grabbing', 'grabbed') |
|
|
|
releaseVerb: Verb = new Verb('release', 'releases', 'releasing', 'released') |
|
|
|
struggleVerb: Verb = new Verb('squirm', 'squirms', 'squirming', 'squirmed') |
|
|
|
|
|
|
|
constructor (owner: Creature) { |
|
|
|
super(new ImproperNoun('hand', 'hands'), owner, new Set(), 100) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
export class ChewAction extends Action { |
|
|
|
protected test: StatTest |
|
|
|
|
|
|
|
constructor (protected damage: DamageFormula, protected verb: Verb = new Verb('smack'), container: Container) { |
|
|
|
super( |
|
|
|
verb.root.capital, |
|
|
|
'Chew your victim', |
|
|
|
[new CapableCondition(), new ContainsCondition(container), new EnemyCondition()] |
|
|
|
) |
|
|
|
this.test = new StatTest(Stat.Power) |
|
|
|
} |
|
|
|
|
|
|
|
execute (user: Creature, target: Creature): LogEntry { |
|
|
|
const effectResults = target.effects.map(effect => effect.preAttack(target, user)) |
|
|
|
|
|
|
|
if (effectResults.some(result => result.prevented)) { |
|
|
|
return new LogLines(...effectResults.map(result => result.log)) |
|
|
|
} |
|
|
|
if (this.test.test(user, target)) { |
|
|
|
const damage = this.damage.calc(user, target) |
|
|
|
const targetResult = target.takeDamage(damage) |
|
|
|
const ownResult = this.successLine(user, target, { damage: damage }) |
|
|
|
return new LogLines(ownResult, targetResult) |
|
|
|
} else { |
|
|
|
return this.failLine(user, target) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
describe (user: Creature, target: Creature): LogEntry { |
|
|
|
return new LogLine(`Attack ${target.name}. `, this.damage.describe(user, target), '. ', this.test.explain(user, target)) |
|
|
|
} |
|
|
|
|
|
|
|
protected successLine: PairLineArgs<Creature, { damage: Damage }> = (user, target, args) => new LogLine( |
|
|
|
`${user.name.capital} ${user.name.conjugate(this.verb)} ${target.name.objective} for `, |
|
|
|
target.effectiveDamage(args.damage).renderShort() |
|
|
|
) |
|
|
|
|
|
|
|
protected failLine: PairLine<Creature> = (user, target) => new LogLine( |
|
|
|
`${user.name.capital} ${user.name.conjugate(new Verb('miss', 'misses'))} ${target.name.objective}` |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
class Maw extends NormalContainer { |
|
|
|
consumeVerb: Verb = new Verb('grab', 'grabs', 'grabbing', 'grabbed') |
|
|
|
releaseVerb: Verb = new Verb('release', 'releases', 'releasing', 'released') |
|
|
|
struggleVerb: Verb = new Verb('squirm', 'squirms', 'squirming', 'squirmed') |
|
|
|
|
|
|
|
constructor (owner: Creature) { |
|
|
|
super(new ImproperNoun('maw', 'maws'), owner, new Set([VoreType.Oral]), 100) |
|
|
|
|
|
|
|
this.actions = [] |
|
|
|
this.actions.push(new StruggleAction(this)) |
|
|
|
this.actions.push(new ChewAction( |
|
|
|
new ConstantDamageFormula( |
|
|
|
new Damage( |
|
|
|
{ amount: 200, target: Vigor.Health, type: DamageType.Crush } |
|
|
|
) |
|
|
|
), |
|
|
|
new Verb('chew'), |
|
|
|
this |
|
|
|
)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
export class Shingo extends Creature { |
|
|
|
constructor () { |
|
|
|
super( |
|
|
|
new ProperNoun('Shingo'), |
|
|
|
new ImproperNoun('red panda', 'red pandas'), |
|
|
|
MalePronouns, |
|
|
|
{ Toughness: 40, Power: 50, Speed: 30, Willpower: 30, Charm: 60 }, |
|
|
|
new Set(), |
|
|
|
new Set([VoreType.Oral]), |
|
|
|
3000 |
|
|
|
) |
|
|
|
|
|
|
|
this.actions.push( |
|
|
|
new AttackAction( |
|
|
|
new StatDamageFormula( |
|
|
|
[ |
|
|
|
{ fraction: 0.5, stat: Stat.Power, target: Vigor.Health, type: DamageType.Crush } |
|
|
|
] |
|
|
|
) |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
this.side = Side.Monsters |
|
|
|
|
|
|
|
const stomach = new Stomach(this, 50, new Damage( |
|
|
|
{ amount: 200, type: DamageType.Acid, target: Vigor.Health }, |
|
|
|
{ amount: 100, type: DamageType.Crush, target: Vigor.Stamina }, |
|
|
|
{ amount: 100, type: DamageType.Dominance, target: Vigor.Resolve } |
|
|
|
)) |
|
|
|
|
|
|
|
this.containers.push(stomach) |
|
|
|
|
|
|
|
this.otherActions.push(new FeedAction(stomach)) |
|
|
|
|
|
|
|
const hand = new Hand(this) |
|
|
|
const maw = new Maw(this) |
|
|
|
this.otherContainers.push(hand) |
|
|
|
this.otherContainers.push(maw) |
|
|
|
|
|
|
|
const stuff = new TransferAction(hand, maw) |
|
|
|
stuff.verb = new Verb('stuff') |
|
|
|
stuff.line = (user, target, args) => new LogLine( |
|
|
|
`${user.name.capital} ${user.name.conjugate(stuff.verb)} ${target.name.objective} into ${user.pronouns.possessive} ${args.to.name}!` |
|
|
|
) |
|
|
|
this.actions.push(stuff) |
|
|
|
|
|
|
|
const gulp = new TransferAction(maw, stomach) |
|
|
|
gulp.verb = new Verb('gulp') |
|
|
|
gulp.line = (user, target, args) => new LogLine( |
|
|
|
`${user.name.capital} ${user.name.conjugate(gulp.verb)} ${target.name.objective} down ${user.pronouns.possessive} tight, inescapable gullet, sending ${target.pronouns.objective} down to ${user.pronouns.possessive} ${args.to.name}` |
|
|
|
) |
|
|
|
this.actions.push(gulp) |
|
|
|
} |
|
|
|
} |