Death Nova (MV Plugin Tips & Tricks) - Yanfly.moe Wiki
Hey all, so I'm using this effect in my game and would like it to be damage element type 10.
This is what Yanfly's code looks like with my game's specific state values etc.
JavaScript:
// Death Nova
<Custom Apply Effect>
// Get the Death Nova state's ID
var deathNovaId = 56;
// Check if the target is dead and is affected by the Death Nova state
if (target.isDead() && target.isStateAffected(deathNovaId)) {
// Get the burn state
var poisonId = 12;
// Get the original caster for the Death Nova state
var caster = target.stateOrigin(97);
// Calculate the damage dealt
var dmg = 500 + caster.mat * 12;
// Get the dying unit's opponents
var foes = target.opponentsUnit().aliveMembers();
// Loop through the foes
for (var i = 0; i < foes.length; ++i) {
// Get the currently looped foe
var foe = foes[i];
// Check if the foe exists
if (foe) {
// Make the foe take damage.
foe.gainHp(-dmg);
// Add the burn state to the foe.
foe.addState(12);
// Show the damage popup.
foe.startDamagePopup();
// Check if the foe is dead
if (foe.isDead()) {
// If it is, collapse the foe
foe.performCollapse();
}
// Clear the foe's results
foe.clearResult();
}
}
// Play an animation on the dying unit
target.startAnimation(109);
// Remove the Death Nova state
target.removeState(56);
}
</Custom Apply Effect>