stable
This commit is contained in:
parent
fbdac9ebf1
commit
86226ccc94
97 changed files with 5790 additions and 2307 deletions
|
|
@ -126,9 +126,11 @@ const HEALTH = (() => {
|
|||
}
|
||||
|
||||
function applyDamage(t, amount, reason = "") {
|
||||
const before = t.energy;
|
||||
const maxEnergy = typeof tarinaiMaxEnergy === "function" ? tarinaiMaxEnergy(t) : (Number(t.maxEnergy) || 100);
|
||||
t.maxEnergy = maxEnergy;
|
||||
const before = clamp(Number(t.energy) || 0, 0, maxEnergy);
|
||||
const loss = Math.max(0, amount || 0);
|
||||
t.energy = clamp(t.energy - loss, 0, 100);
|
||||
t.energy = clamp(before - loss, 0, maxEnergy);
|
||||
const actualLoss = Math.max(0, before - t.energy);
|
||||
let cause = "";
|
||||
if (actualLoss > 0.01) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue