|  |  | @@ -1,5 +1,5 @@ | 
		
	
		
			
			|  |  |  | import { Mortal } from './entity' | 
		
	
		
			
			|  |  |  | import { Damage, DamageType, Stats, Actionable, Action, Vigor, VoreStats, VisibleStatus, VoreStat } from './combat' | 
		
	
		
			
			|  |  |  | import { Damage, DamageType, Stats, Actionable, Action, Vigor, VoreStats, VisibleStatus, VoreStat, DamageInstance } from './combat' | 
		
	
		
			
			|  |  |  | import { LogLines, LogEntry, LogLine } from './interface' | 
		
	
		
			
			|  |  |  | import { Noun, Pronoun, ImproperNoun, TextLike, Verb, SecondPersonPronouns, PronounAsNoun, FirstPersonPronouns, PairLineArgs, SoloLine, POV } from './language' | 
		
	
		
			
			|  |  |  | import { DigestAction, DevourAction, ReleaseAction, StruggleAction } from './combat/actions' | 
		
	
	
		
			
				|  |  | @@ -21,11 +21,15 @@ export abstract class Vore extends Mortal { | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | voreStats: VoreStats | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | constructor (name: Noun, kind: Noun, pronouns: Pronoun, baseStats: Stats, public preyPrefs: Set<VoreType>, public predPrefs: Set<VoreType>, public mass: number) { | 
		
	
		
			
			|  |  |  | constructor (name: Noun, kind: Noun, pronouns: Pronoun, baseStats: Stats, public preyPrefs: Set<VoreType>, public predPrefs: Set<VoreType>, private baseMass: number) { | 
		
	
		
			
			|  |  |  | super(name, kind, pronouns, baseStats) | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | const containers = this.containers | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | // we can't use arrow notation for getters, so we gotta do this | 
		
	
		
			
			|  |  |  | // eslint-disable-next-line | 
		
	
		
			
			|  |  |  | const self = this | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | this.voreStats = { | 
		
	
		
			
			|  |  |  | get [VoreStat.Bulk] () { | 
		
	
		
			
			|  |  |  | return containers.reduce( | 
		
	
	
		
			
				|  |  | @@ -45,7 +49,12 @@ export abstract class Vore extends Mortal { | 
		
	
		
			
			|  |  |  | this.Mass | 
		
	
		
			
			|  |  |  | ) | 
		
	
		
			
			|  |  |  | }, | 
		
	
		
			
			|  |  |  | [VoreStat.Mass]: mass, | 
		
	
		
			
			|  |  |  | get [VoreStat.Mass] () { | 
		
	
		
			
			|  |  |  | return self.baseMass | 
		
	
		
			
			|  |  |  | }, | 
		
	
		
			
			|  |  |  | set [VoreStat.Mass] (mass: number) { | 
		
	
		
			
			|  |  |  | self.baseMass = mass | 
		
	
		
			
			|  |  |  | }, | 
		
	
		
			
			|  |  |  | get [VoreStat.PreyCount] () { | 
		
	
		
			
			|  |  |  | return containers.reduce( | 
		
	
		
			
			|  |  |  | (total: number, container: VoreContainer) => { | 
		
	
	
		
			
				|  |  | @@ -224,6 +233,7 @@ export abstract class NormalVoreContainer extends NormalContainer implements Vor | 
		
	
		
			
			|  |  |  | fluidColor = "#00ff0088" | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | digested: Array<Vore> = [] | 
		
	
		
			
			|  |  |  | absorbed: Array<Vore> = [] | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | constructor (name: Noun, owner: Vore, voreTypes: Set<VoreType>, capacity: number, private damage: Damage) { | 
		
	
		
			
			|  |  |  | super(name, owner, voreTypes, capacity) | 
		
	
	
		
			
				|  |  | @@ -234,7 +244,7 @@ export abstract class NormalVoreContainer extends NormalContainer implements Vor | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | get fullness (): number { | 
		
	
		
			
			|  |  |  | return Array.from(this.contents.concat(this.digested).values()).reduce((total: number, prey: Vore) => total + prey.voreStats.Bulk, 0) | 
		
	
		
			
			|  |  |  | return Array.from(this.contents.concat(this.digested, this.absorbed).values()).reduce((total: number, prey: Vore) => total + prey.voreStats.Bulk, 0) | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | consumeLine: PairLineArgs<Vore, { container: Container }> = (user, target, args) => { | 
		
	
	
		
			
				|  |  | @@ -249,8 +259,13 @@ export abstract class NormalVoreContainer extends NormalContainer implements Vor | 
		
	
		
			
			|  |  |  | return new LogLine(`${user.name.capital.possessive} ${args.container.name} ${args.container.name.conjugate(new Verb('finish', 'finishes'))} ${Words.Digests.present} ${target.name.objective} down, ${target.pronouns.possessive} ${Words.Struggles.singular} fading away.`) | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | absorbLine: PairLineArgs<Vore, { container: VoreContainer }> = (user, target, args) => { | 
		
	
		
			
			|  |  |  | return new LogLine(`${user.name.capital.possessive} ${args.container.name} ${args.container.name.conjugate(new Verb('finish', 'finishes'))} ${Words.Absorbs.present} ${target.name.objective}, fully claiming ${target.pronouns.objective}.`) | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | tick (dt: number): LogEntry { | 
		
	
		
			
			|  |  |  | const justDigested: Array<Vore> = [] | 
		
	
		
			
			|  |  |  | const justAbsorbed: Array<Vore> = [] | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | const scaled = this.damage.scale(dt / 60) | 
		
	
		
			
			|  |  |  | 
 | 
		
	
	
		
			
				|  |  | @@ -268,13 +283,43 @@ export abstract class NormalVoreContainer extends NormalContainer implements Vor | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | this.digested.forEach(prey => { | 
		
	
		
			
			|  |  |  | const damageTotal: number = prey.effectiveDamage(scaled).damages.filter(instance => instance.target === Vigor.Health).reduce( | 
		
	
		
			
			|  |  |  | (total: number, instance: DamageInstance) => total + instance.amount, | 
		
	
		
			
			|  |  |  | 0 | 
		
	
		
			
			|  |  |  | ) | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | console.log(damageTotal) | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | const massStolen = Math.min(damageTotal / 100, prey.voreStats.Mass) | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | console.log(massStolen) | 
		
	
		
			
			|  |  |  | prey.voreStats.Mass -= massStolen | 
		
	
		
			
			|  |  |  | this.owner.voreStats.Mass += massStolen | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | if (prey.voreStats.Mass === 0) { | 
		
	
		
			
			|  |  |  | this.absorbed.push(prey) | 
		
	
		
			
			|  |  |  | justAbsorbed.push(prey) | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | const digestedEntries = this.digest(justDigested) | 
		
	
		
			
			|  |  |  | const absorbedEntries = this.absorb(justAbsorbed) | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | console.log(this.digested, this.absorbed) | 
		
	
		
			
			|  |  |  | this.contents = this.contents.filter(prey => { | 
		
	
		
			
			|  |  |  | return prey.vigors[Vigor.Health] > 0 | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | return new LogLines(tickedEntries, new LogLines(...damageResults), digestedEntries) | 
		
	
		
			
			|  |  |  | this.digested = this.digested.filter(prey => { | 
		
	
		
			
			|  |  |  | return prey.voreStats.Mass > 0 | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | return new LogLines(tickedEntries, new LogLines(...damageResults), digestedEntries, absorbedEntries) | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | absorb (preys: Vore[]): LogEntry { | 
		
	
		
			
			|  |  |  | return new LogLines(...preys.map(prey => this.absorbLine(this.owner, prey, { container: this }))) | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | digest (preys: Vore[]): LogEntry { | 
		
	
	
		
			
				|  |  | 
 |