For a little more context than just the title, in the states I've created, I've got two called Redirection and Conduction. Using Visustella's Aggro Control System plugin, they're a Physical Taunt and Magical Taunt respectively. I'm currently trying to make a passive state that halves or doubles damage taken based on these effects. For example, if an actor has Redirection active on them, physical damage they take will be halved, while magical damage will be doubled.
I've tried hashing out some code and I think I'm close to something working, but I'm running into issues. This is the itteration of the code that works best:
This code properly halved physical damage when the actor was affected by Redirection, but didn't do anything to magical damage. I tried a second version with a different structure, but it didn't have any effect at all.
Would anyone mind looking over my code and helping me figure out what I need to change to get it working?
I've tried hashing out some code and I think I'm close to something working, but I'm running into issues. This is the itteration of the code that works best:
Code:
//Attempt 1
<JS Pre-Damage as Target>
const stateRedirectId = 60;
const stateConductId = 61;
//Check if taking Damage
if(this.isHpEffect() && value > 0) {
//Check if under effect of Redirection
if(target.states().includes($dataStates[stateRedirectId])) {
//Check for damage type
if(this.isPhysical) {
//Halve damage
value *= 0.5;
} else if (this.isMagical) {
//Double damage
value *= 2;
} else {
value *= 1;
}
}
//Check if under effect of Conduction
if(target.states().includes($dataStates[stateConductId])) {
//Check for damage type
if(this.isPhysical) {
//Double damage
value *= 2;
} else if (this.isMagical) {
//Halve damage
value *= 0.5;
} else {
value *= 1;
}
}
}
</JS Pre-Damage as Target>
This code properly halved physical damage when the actor was affected by Redirection, but didn't do anything to magical damage. I tried a second version with a different structure, but it didn't have any effect at all.
Would anyone mind looking over my code and helping me figure out what I need to change to get it working?