So I started using
In other words, the game thinks the "origin" of the Burn state is the targeted enemy instead of the caster of the spell that inflicted the Burn! The following is a snippet from YEP_BuffStatesCore.js that I believe defines which unit is the "origin". I'm hoping to find something in here to edit so that the correct unit is considered the "origin" instead. (I'm also open to other solutions/suggestions)
I really hope to get "origin" working, cuz my workarounds are getting more and more complicated...
I mean just look at what I have to put in my Skill & State notetags to replicate origin's functionality!
console.log() quite often as of late and by doing so, I've found out why "origin" hasn't been working for me all this time. It turns out, it's selecting the wrong unit! For instance, if my Hero casts Ignite to inflict a Burn on the target, the "origin" of the Burn state should be our Hero. However, when I placed a <Custom Apply Effect> notetag containing console.log(this.stateOrigin()), it returns the following when I cast the spell:Game_Enemy {_hp: 175, _mp: 140, _tp: 54, _hidden: false, _paramPlus: Array(8), …}In other words, the game thinks the "origin" of the Burn state is the targeted enemy instead of the caster of the spell that inflicted the Burn! The following is a snippet from YEP_BuffStatesCore.js that I believe defines which unit is the "origin". I'm hoping to find something in here to edit so that the correct unit is considered the "origin" instead. (I'm also open to other solutions/suggestions)
JavaScript:
Game_BattlerBase.prototype.stateOrigin = function(stateId) {
if (this._stateOrigin === undefined) this._stateOrigin = {};
if (!this._stateOrigin[stateId]) return this;
var arr = this._stateOrigin[stateId];
if (arr[0] === 0) return $gameActors.actor(arr[1]);
if (arr[0] === 1) return $gameTroop.members()[arr[1]];
return this;
};
Game_BattlerBase.prototype.setStateOrigin = function(stateId, battler) {
if (this._stateOrigin === undefined) this._stateOrigin = {};
if (!$gameParty.inBattle()) return;
if (!battler) {
var battler = BattleManager._subject;
if (!battler) return;
}
if (battler.isActor()) {
var arr = [0, battler._actorId];
} else {
var arr = [1, battler.index()];
}
this._stateOrigin[stateId] = arr;
};
I mean just look at what I have to put in my Skill & State notetags to replicate origin's functionality!
JavaScript:
<letbs>
scope: circle(3)
sequence: skill
</letbs>
<Custom Show Eval>
if (!$gameParty.inBattle()) {
visible = true;
} else if ($gameParty.menuActor().battleSkills().contains($dataSkills[272])) {
visible = true;
} else {
visible = false;
}
</Custom Show Eval>
<Critical Rate Formula>
rate = user.cri - (user.agi / 1000) + (user.mat / 1000) - target.cev;
</Critical Rate Formula>
<Critical Multiplier Formula>
value *= 1.5 + (user.mat / 100) + bonus;
</Critical Multiplier Formula>
<Custom Execution>
if (user.isLearnedSkill(273)) {
var w = Math.round(user.mat / 4);
} else {
var w = 0;
}
if (user.isLearnedSkill(277)) {
var x = 1;
} else {
var x = 0;
}
if (user.isLearnedSkill(285)) {
var y = 1;
} else {
var y = 0;
}
if (user.isLearnedSkill(289)) {
var z = 1;
} else {
var z = 0;
}
if (user == $gameParty.members()[0]) {
$gameVariables.setValue(27, user.mat);
$gameVariables.setValue(30, user.mdf);
$gameVariables.setValue(84, w);
$gameVariables.setValue(87, x);
$gameVariables.setValue(90, y);
$gameVariables.setValue(93, z);
} else if (user == $gameParty.members()[1]) {
$gameVariables.setValue(28, user.mat);
$gameVariables.setValue(31, user.mdf);
$gameVariables.setValue(85, w);
$gameVariables.setValue(88, x);
$gameVariables.setValue(91, y);
$gameVariables.setValue(94, z);
} else if (user == $gameParty.members()[2]) {
$gameVariables.setValue(29, user.mat);
$gameVariables.setValue(32, user.mdf);
$gameVariables.setValue(86, w);
$gameVariables.setValue(89, x);
$gameVariables.setValue(92, y);
$gameVariables.setValue(95, z);
}
</Custom Execution>
<After Eval>
if (user == $gameParty.members()[0]) {
$gameVariables.setValue(27, 0);
$gameVariables.setValue(30, 0);
$gameVariables.setValue(84, 0);
$gameVariables.setValue(87, 0);
$gameVariables.setValue(90, 0);
$gameVariables.setValue(93, 0);
} else if (user == $gameParty.members()[1]) {
$gameVariables.setValue(28, 0);
$gameVariables.setValue(31, 0);
$gameVariables.setValue(85, 0);
$gameVariables.setValue(88, 0);
$gameVariables.setValue(91, 0);
$gameVariables.setValue(94, 0);
} else if (user == $gameParty.members()[2]) {
$gameVariables.setValue(29, 0);
$gameVariables.setValue(32, 0);
$gameVariables.setValue(86, 0);
$gameVariables.setValue(89, 0);
$gameVariables.setValue(92, 0);
$gameVariables.setValue(95, 0);
}
</After Eval>
<Custom State 142 Turns>
if (user.isLearnedSkill(281)) {
turn += 1;
}
</Custom State 142 Turns>
JavaScript:
<Custom Apply Effect>
console.log(this.stateOrigin());
console.log(this._stateOrigin);
var intellect = $gameVariables.value(27) + $gameVariables.value(28) + $gameVariables.value(29);
var willpower = $gameVariables.value(30) + $gameVariables.value(31) + $gameVariables.value(32);
var hyperthermia = $gameVariables.value(84) + $gameVariables.value(85) + $gameVariables.value(86);
var cauterization = $gameVariables.value(87) + $gameVariables.value(88) + $gameVariables.value(89);
var firePower = $gameVariables.value(90) + $gameVariables.value(91) + $gameVariables.value(92);
var flammable = $gameVariables.value(93) + $gameVariables.value(94) + $gameVariables.value(95);
target._burn = target._burn || 0;
target._burnINT = intellect;
target._burnWIL = willpower;
target._hyperthermia = hyperthermia;
target._cauterization = cauterization;
target._firePower = firePower;
target._flammable = flammable;
if (target._burn == 0) {
target.minusAtk(hyperthermia);
target.minusMdf(hyperthermia);
target._burn += 1;
}
</Custom Apply Effect>
<Custom React Effect>
if (value > 0 && this.isHpEffect() && this.getItemElements().contains(4) && target._firePower > 0) {
var elementRate = (target.elementRate(4) + target.stateTurns(142) * 0.05) / target.elementRate(4);
value = Math.round(value * elementRate);
}
if (value < 0 && this.isHpEffect() && target._cauterization > 0) {
value = Math.round(value * 0.75);
}
</Custom React Effect>
<Custom Regenerate Effect>
var value = Math.round(target.elementRate(4) * target._burnINT ** (1 + target._burnWIL / 1000) * 0.3 * (100 + target.level) / (100 + target.mdf));
var msg = target.name() + ' took ' + value + ' \\c[17]Fire\\c damage!';
console.log(target.elementRate(4));
console.log(target._burnINT);
console.log(target._burnWIL);
console.log(target.level);
console.log(target.mdf);
target.gainHp(-value);
BattleManagerTBS._logWindow.addText(msg);
BattleManagerTBS.activeEntity().addPopup();
//BattleManagerTBS._logWindow.clear();
</Custom Regenerate Effect>
<Custom Leave Effect>
target.addState(143);
</Custom Leave Effect>
<Custom Remove Effect>
target.addAtk(target._hyperthermia);
target.addMdf(target._hyperthermia);
delete target._hyperthermia;
delete target._firePower;
delete target._burn;
</Custom Remove Effect>
<element rate: 5, -30% />
<Reapply Add Turns>