diff --git a/public/media/cafat/images/belly-crush.webp b/public/media/cafat/images/belly-crush.webp new file mode 100644 index 0000000..cef5431 --- /dev/null +++ b/public/media/cafat/images/belly-crush.webp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e8cb78e4cbaaa195ca23b200037128734f2d00e8ce73fe766ff91d63454fe1e1 +size 34866 diff --git a/src/game/combat.ts b/src/game/combat.ts index 2e2898a..69234c8 100644 --- a/src/game/combat.ts +++ b/src/game/combat.ts @@ -316,8 +316,9 @@ export class AttackAction extends TogetherAction { execute (user: Creature, target: Creature): LogEntry { if (this.test.test(user, target)) { - target.takeDamage(this.damage) - return this.successLines.run(user, target, { damage: this.damage }) + const targetResult = target.takeDamage(this.damage) + const ownResult = this.successLines.run(user, target, { damage: this.damage }) + return new CompositeLog(ownResult, targetResult) } else { return this.failLines.run(user, target) } diff --git a/src/game/creatures/cafat.ts b/src/game/creatures/cafat.ts index e91d7eb..00b8247 100644 --- a/src/game/creatures/cafat.ts +++ b/src/game/creatures/cafat.ts @@ -5,6 +5,33 @@ import { VoreType, Stomach, InnerStomach, Container, Bowels } from '../vore' import { LogLine, LogLines, LogEntry, FAElem, CompositeLog, ImgElem } from '../interface' import { Wolf } from '../creatures' +class BellyCrushAction extends AttackAction { + successLines = new POVPairArgs([ + [[POV.First, POV.Third], (user, target, args) => new CompositeLog(new LogLine( + `You crush on ${target.name} with your belly for `, + args.damage.renderShort() + ), new ImgElem('./media/cafat/images/belly-crush.webp'))], + [[POV.Third, POV.First], (user, target, args) => new CompositeLog(new LogLine( + `${user.name.capital} crushes on you with ${user.pronouns.possessive} belly for `, + args.damage.renderShort() + ), new ImgElem('./media/cafat/images/belly-crush.webp'))], + [[POV.Third, POV.Third], (user, target, args) => new CompositeLog(new LogLine( + `${user.name.capital} crushes on ${target.name} with ${user.pronouns.possessive} belly for `, + args.damage.renderShort() + ), new ImgElem('./media/cafat/images/belly-crush.webp'))] + ]) + + constructor (private _damage: Damage) { + super(_damage) + this.name = 'Belly Crush' + } + + execute (user: Creature, target: Creature): LogEntry { + this.damage = this._damage.scale(user.bulk / 25 + 1) + return super.execute(user, target) + } +} + class BelchAction extends AttackAction { successLines = new POVPairArgs([ [[POV.First, POV.Third], (user, target, args) => new CompositeLog(new LogLine( @@ -96,6 +123,8 @@ export class Cafat extends Creature { this.actions.push(transfer) this.actions.push(new TransferAction(lowerStomach, stomach)) + this.actions.push(new AttackAction(new Damage({ amount: 40, type: DamageType.Crush, target: Vigor.Health }))) + this.actions.push(new BellyCrushAction(new Damage({ amount: 10, type: DamageType.Crush, target: Vigor.Health }, { amount: 10, type: DamageType.Dominance, target: Vigor.Willpower }))) this.actions.push(new BelchAction(new Damage( { amount: 100, target: Vigor.Willpower, type: DamageType.Acid } ))) diff --git a/src/game/entity.ts b/src/game/entity.ts index 98bce6f..5b8c801 100644 --- a/src/game/entity.ts +++ b/src/game/entity.ts @@ -1,6 +1,6 @@ import { DamageType, Damage, Combatant, Stats, Action, Vigor } from './combat' import { Noun, Pronoun } from './language' - +import { LogEntry, LogLine } from './interface' import { Vore, Container, VoreType } from './vore' export enum POV {First, Third} @@ -19,7 +19,7 @@ export interface Mortal extends Entity { takeDamage: (damage: Damage) => void; stats: Stats; status: string; - destroy: () => void; + destroy: () => LogEntry; } export class Creature extends Vore implements Combatant { @@ -47,7 +47,7 @@ export class Creature extends Vore implements Combatant { private baseBulk: number; get bulk (): number { - return this.baseBulk + return this.baseBulk + this.containers.reduce((total, conatiner) => { return total + conatiner.contents.reduce((total, prey) => total + prey.bulk, 0) }, 0) } containedIn: Container|null = null; @@ -61,7 +61,7 @@ export class Creature extends Vore implements Combatant { return this.name.toString() } - takeDamage (damage: Damage): void { + takeDamage (damage: Damage): LogEntry { damage.damages.forEach(instance => { const resistance: number|undefined = this.resistances.get(instance.type) if (resistance !== undefined) { @@ -72,7 +72,9 @@ export class Creature extends Vore implements Combatant { }) if (this.vigors.Health <= -100) { - this.destroy() + return this.destroy() + } else { + return new LogLine() } } @@ -113,7 +115,7 @@ export class Creature extends Vore implements Combatant { }) } - destroy (): void { - super.destroy() + destroy (): LogEntry { + return super.destroy() } } diff --git a/src/game/vore.ts b/src/game/vore.ts index ac87946..6c8f1c2 100644 --- a/src/game/vore.ts +++ b/src/game/vore.ts @@ -26,7 +26,7 @@ export abstract class Vore implements Mortal { abstract containedIn: Container | null; abstract predPrefs: Set; abstract containers: Array; - destroy (): void { + destroy (): LogEntry { this.containers.map(container => { container.contents.map(prey => { prey.containedIn = this.containedIn @@ -35,6 +35,8 @@ export abstract class Vore implements Mortal { } }) }) + + return new LogLine(`${this.name.capital} dies!`) } }