Bläddra i källkod

Fix mass gain/loss being wrong when grown/shrunk

Changing a creature's mass sets its base mass so that, after
effects are applied, its mass is correct.
vintage
Fen Dweller 5 år sedan
förälder
incheckning
9c1aa2b4d4
1 ändrade filer med 5 tillägg och 1 borttagningar
  1. +5
    -1
      src/game/creature.ts

+ 5
- 1
src/game/creature.ts Visa fil

@@ -69,8 +69,12 @@ export class Creature extends Mortal {
const adjusted = self.effects.reduce((scale: number, effect: Effective) => effect.scale(scale), base)
return adjusted
},
// we want to account for anything changing our current size;
// we will assume that the modifiers are all multiplicative
set [VoreStat.Mass] (mass: number) {
self.baseMass = mass
const modifier = self.effects.reduce((scale: number, effect: Effective) => effect.scale(scale), 1)
const adjusted = mass / modifier
self.baseMass = adjusted
},
get [VoreStat.PreyCount] () {
return self.containers.reduce(


Laddar…
Avbryt
Spara