Sfoglia il codice sorgente

Add a belly crush move; add text when a creature dies

master
Fen Dweller 5 anni fa
parent
commit
14996d5266
5 ha cambiato i file con 47 aggiunte e 10 eliminazioni
  1. BIN
      public/media/cafat/images/belly-crush.webp
  2. +3
    -2
      src/game/combat.ts
  3. +29
    -0
      src/game/creatures/cafat.ts
  4. +9
    -7
      src/game/entity.ts
  5. +3
    -1
      src/game/vore.ts

BIN
public/media/cafat/images/belly-crush.webp (Memorizzati con Git LFS) Vedi File

oid sha256:e8cb78e4cbaaa195ca23b200037128734f2d00e8ce73fe766ff91d63454fe1e1
size 34866

+ 3
- 2
src/game/combat.ts Vedi File

@@ -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)
}


+ 29
- 0
src/game/creatures/cafat.ts Vedi File

@@ -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<Entity, Entity, { damage: Damage }>([
[[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<Entity, Entity, { damage: Damage }>([
[[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 }
)))


+ 9
- 7
src/game/entity.ts Vedi File

@@ -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()
}
}

+ 3
- 1
src/game/vore.ts Vedi File

@@ -26,7 +26,7 @@ export abstract class Vore implements Mortal {
abstract containedIn: Container | null;
abstract predPrefs: Set<VoreType>;
abstract containers: Array<Container>;
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!`)
}
}



Loading…
Annulla
Salva