Custom Eval for a Yanfly Statebuffcore Ability

(https://alistairengine.wordpress.co...ion-black-shield-league-of-legends/#more-1196)
I copy/pasted this exact code, only changing the parts marked in red (anywhere that says "132") to correspond with the state I am using, and it does successfully create the shield, displays the absorption amount, but other than that, it does nothing. Does anyone know enough about this kind of custom eval to figure out why, or what the problem is?

(this makes use of the following Plugin: http://yanfly.moe/2015/12/25/yep-50-buffs-states-core/)
The code was only for the damage shield effect, if you want the immunity, thats added via the Traits of the state itself.

Also, the damage shield is only for "magical" damage, meaning for skills whose "Hit Type" is set to "Magical Hit".. It wont work for "Physical Hit" or "Certain Hit" skills
The code was only for the damage shield effect, if you want the immunity, thats added via the Traits of the state itself.

Also, the damage shield is only for "magical" damage, meaning for skills whose "Hit Type" is set to "Magical Hit".. It wont work for "Physical Hit" or "Certain Hit" skills

Exactly. And therein lies the issue I'm having. I see no raisin for it to not be working. The shield comes up properly, the display (the numerical value on the shield) is correct, but for some raisin, it won't block/absorb any kind of damage. Now, that got me thinking, could it be any kind of clashing with another plugin issue? I suppose it IS possible, but I don't believe it's very likely at all, for the reason that this is the very first custom eval I've copied that DIDN'T work properly. (I have like 5 or 6 others that all function 100% correctly).

Is it maybe possible to maybe change it so instead of checking for if it's a "magical" hit, it checks what element is incoming, therefore opening up wider possibilities in general?
Maybe you have a plugin that changes the behavior of hit types? Else if the skill you're getting hit by is really of magical hit type then it should be blocking it (can you actually post a screenshot of the database entry of the magical skill that hits you?)..

Its possible to change it to element ID but I dont know the exact MV code for that, so we need to wait for somebody else to supply you the code to replace the check with
Maybe you have a plugin that changes the behavior of hit types? Else if the skill you're getting hit by is really of magical hit type then it should be blocking it (can you actually post a screenshot of the database entry of the magical skill that hits you?)..

Its possible to change it to element ID but I dont know the exact MV code for that, so we need to wait for somebody else to supply you the code to replace the check with
image0.jpg
I noticed at least one of the minus signs is an en-/em-dash rather than a hyphen, which may be the problem. 😅

Here's my version of it; I quickly tested and it seems to be working for me:
Code:
<Custom Apply Effect>
target._blackShield = Math.round(350 + origin.mat * 0.7);
target.setStateCounter(stateId, target._blackShield);
</Custom Apply Effect>

<Custom React Effect>
if (this.isMagical()) {
  if (target._blackShield - value > 0) {
    target._blackShield -= value;
    target.setStateCounter(stateId, target._blackShield);
    value = 0;
  } else {
    value -= target._blackShield;
    target.removeState(stateId);
  }
}
</Custom React Effect>
I noticed at least one of the minus signs is an en-/em-dash rather than a hyphen, which may be the problem. 😅

Here's my version of it; I quickly tested and it seems to be working for me:
Code:
<Custom Apply Effect>
target._blackShield = Math.round(350 + origin.mat * 0.7);
target.setStateCounter(stateId, target._blackShield);
</Custom Apply Effect>

<Custom React Effect>
if (this.isMagical()) {
  if (target._blackShield - value > 0) {
    target._blackShield -= value;
    target.setStateCounter(stateId, target._blackShield);
    value = 0;
  } else {
    value -= target._blackShield;
    target.removeState(stateId);
  }
}
</Custom React Effect>
Perfect! that did it, thank you so much!

Original thread: https://forums.rpgmakerweb.com/threads/custom-eval-for-a-yanfly-statebuffcore-ability.105630/