forked from 2hh8899/ArcaneLab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
custom-status.js
62 lines (61 loc) · 2.64 KB
/
custom-status.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
ig.module("game.feature.combat.model.custom-status").requires(
"game.feature.combat.model.combat-status",
"game.feature.player.modifiers",
"game.feature.combat.gui.custom-status-bar",
"game.feature.combat.model.modifier-apply")
.defines(function() {
sc.MODIFIERS.TOXIC_HAZARD = {
altSheet: "media/gui/status-gui.png",
offX: 96,
offY: 0,
icon: -1,
order: 100
};
sc.PoisonStatus = sc.CombatStatusBase.extend({
id: 0,
label: "poison",
statusBarEntry: "POISONED",
offenseModifier: "TOXIC_HAZARD",
defenseModifier: null,
duration: 20,
poisonTimer: 0,
onUpdate: function(b, a) {
this.poisonTimer = this.poisonTimer +
ig.system.ingameTick;
if ((!b.getCombatantRoot()
.isPlayer || !sc.model.isCutscene()) && this.poisonTimer > 0.5) {
var d = Math.floor(a.getStat("hp") * (0.3 / (this.duration / 0.5)) * this.getEffectiveness(a));
b.instantDamage(d, 0.5);
this.effects.spawnOnTarget("burnDamage", b);
this.poisonTimer = 0
}
}
});
var poisonIdx = sc.COMBAT_STATUS.push(sc.PoisonStatus) - 1;
sc.STATUS_BAR_ENTRY.POISONED = {
icon: 0,
gfx: "media/gui/poison-status.png",
init: null,
barY: 0,
barX: 0,
half: true
}
var aConst = 0.25,
dConst = 1.5,
cConst = 3;
sc.DAMAGE_MODIFIER_FUNCS.TOXIC_HAZARD = (attackInfo, damageFactor, combatantRoot, shieldResult, hitIgnore, params) => {
var l = attackInfo.noHack || false,
r = attackInfo.attackerParams.getStat("focus", l) / params.getStat("focus", l),
v = (Math.pow(1 + (r >= 1 ? r - 1 : 1 - r) * cConst, aConst) - 1) * dConst;
r = r >= 1 ? 1 + v : Math.max(0, 1 - v);
var p = 1,
q = attackInfo.element;
q && (p = params.getStat("elemFactor")[q - 1] * params.tmpElemFactor[q - 1]);
var pppm = r * attackInfo.attackerParams.getModifier("TOXIC_HAZARD") * p;
if (pppm > 0) pppm = params.statusStates[poisonIdx].getInflictValue(pppm, params, attackInfo, shieldResult);
var applyDamageCallback = () => {
pppm && params.statusStates[poisonIdx].inflict(pppm, params, attackInfo);
};
return { attackInfo, damageFactor, applyDamageCallback }
};
});