Hello! I've been trying to figure out how to create an electricity state that calculates any damage the affected actor/enemy takes and spreads it evenly between any other actors/enemies that have the state as well. If possible, I would like the actor/enemy who was originally targeted to take the full, original damage and the other affected entities to take a portion of it. Damage should not spread between enemies and actors but instead be limited to either party, if this is not possible I can compromise.
I am also unable to use VisuStella plugins in my project unfortunately, but I'm open to other plugins.
My mess of a plugin list is attached below. If any more information is needed please ask!
I think you can add extra line in apply() to call a function with additional effects. I quickly tested it and it seemed to work. But if you want to start multiple damage popups with different values, I think you need a plugin for that (then you can add the code to the below). You could also try and build this differently to alias the apply method but here I just overwrote them. Change the skill id and state ids in the custom second function. Also at the moment the others take quarter of the damage, you can change that too if you want.
Game_Action.prototype.apply = function(target) {
const result = target.result();
this.subject().clearResult();
result.clear();
result.used = this.testApply(target);
result.missed = result.used && Math.random() >= this.itemHit(target);
result.evaded = !result.missed && Math.random() < this.itemEva(target);
result.physical = this.isPhysical();
result.drain = this.isDrain();
if (result.isHit()) {
if (this.item().damage.type > 0) {
result.critical = Math.random() < this.itemCri(target);
const value = this.makeDamageValue(target, result.critical);
this.executeDamage(target, value);
this.applyAdditionalEffects(target, value);
}
for (const effect of this.item().effects) {
this.applyItemEffect(target, effect);
}
this.applyItemUserEffect(target);
}
this.updateLastTarget(target);
};
Game_Action.prototype.applyAdditionalEffects = function(target, value) {
if (target.isStateAffected(11)) {
target.friendsUnit().aliveMembers().forEach(member => {
if (member !== target && member.isStateAffected(11))
member.gainHp(Math.round(-value*0.25));
}
)
}
}
EDIT: Actually I read a bit wrong, you don't need to check the skill if you want it for all damage. I changed the code.
EDIT2: You might also want to add a check that it's hp damage.
It works perfectly! Thank you a ton for the quick and helpful response 😂