Alright!
So I want to make a move that removes positive states from enemies and negative ones from allies. To do this I have combined the code from Yanfly's tips and tricks for biotic Grenade, Absorb Ailments and Buff Breaker.
www.yanfly.moe
www.yanfly.moe
www.yanfly.moe
I thought I had what I needed here but I'm not getting it to remove any states.
This is hurting enemies and healing allies, which is good, but its not removing the states or scaling the damage which makes me think there is something wrong with my loops
If someone knows how to Skill Core or Java Script to let me know where I went wrong here that would be awesome!
So I want to make a move that removes positive states from enemies and negative ones from allies. To do this I have combined the code from Yanfly's tips and tricks for biotic Grenade, Absorb Ailments and Buff Breaker.
Buff Breaker (MV Plugin Tips & Tricks) - Yanfly.moe Wiki
Biotic Grenade (MV Plugin Tips & Tricks) - Yanfly.moe Wiki
Absorb Ailments (MV Plugin Tips & Tricks) - Yanfly.moe Wiki
I thought I had what I needed here but I'm not getting it to remove any states.
Code:
<Target: Everybody> //yanfly target core
<Damage Formula>
// Check if target and user are on the same team.
if (target.isActor() === user.isActor()) {
// Heal formula for allies.
value = user.mdf * 6;
// Otherwise for enemies...
} else {
// Damage formula for enemies.
value = user.mat * 10;
}
</Damage Formula>
<Pre-Damage Eval>
// Check if target and user are on the same team.
if (target.isActor() === user.isActor()) {
// Make it heal the ally instead.
value = -1 * Math.abs(value);
var group = user.friendsUnit().aliveMembers();
//make array with bad states to remove
var absorbedBadStates = [];
absorbedBadStates.push(5,11)
// Loop through each member in the group
for (var i = 0; i < group.length; ++i) {
// Get the currently looped member
var member = group[i];
// Check if the member exists
if (member) {
// Loop through each of the absorbable states
for (var j = 0; j < absorbedBadStates.length; ++j) {
// Get the currently looped state's ID
var id = absorbedBadStates[j]
// Check if the state exists and if the member is affected by it
if ($dataStates[id] && member.isStateAffected(id)) {
//remove state
member.removeState(id);
Increase the amount healed
value += value;
}
}
}
}
}else{
//good states to eat
var absorbedGoodStates = [];
absorbedGoodStates.push(54, 56);
var group2 = user.opponentsUnit().aliveMembers();
// Loop through each member in the group
for (var t = 0; t < group2.length; ++t) {
// Get the currently looped member
var member2 = group2[t];
// Loop through each of the absorbable states
for (var b = 0; b < absorbedGoodStates.length; ++b) {
// Get the currently looped state's ID
var id = absorbedGoodStates[b]
// Check if the state exists and if the member is affected by it
if ($dataStates[id] && member.isStateAffected(id)) {
//remove states
member.removeState(id);
//Increase the amount of damage
value += value;
}
}
}
}
</Pre-Damage Eval>
This is hurting enemies and healing allies, which is good, but its not removing the states or scaling the damage which makes me think there is something wrong with my loops
If someone knows how to Skill Core or Java Script to let me know where I went wrong here that would be awesome!