소스 검색

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 년 전
부모
커밋
9c1aa2b4d4
1개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  1. +5
    -1
      src/game/creature.ts

+ 5
- 1
src/game/creature.ts 파일 보기

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


불러오는 중...
취소
저장