Hi, I'm pretty new to javascript and most of the time I'm mix and matching my way through yanflys lunatic mode but now I'm stuck on this one state and I can't get it to work.
I'm trying to recreate the living bomb skill from WoW. Simply a skill that creates a state with a DoT (no problem there). which in return when expiring will damage the whole enemy squad.
I used a mix from yanflys unstable affliction and overheating scripts, but I'm stuck and can't get it to work properly. When the leave effect is triggered, it applies the damage twice plus the normal regeneration effect damage to all enemies.
Maybe someone more profficient could take a look at the code for me.
here's what I'm using:
Spoiler
<Custom Apply Effect>
// Calculate the damage to be dealt by the formula.
target._DoT = Math.ceil(origin.mat * 0.50);
</Custom Apply Effect>
<Custom Leave Effect>
// Calculate the damage to be dealt by the formula.
var dmg = Math.ceil(origin.mat * 3);
// Get the element ID
var ElementId = 2;
// Get all living battle members on the battlefield
var members = user.friendsUnit().aliveMembers().concat(target.friendsUnit().aliveMembers());
// Loop through each of the members
for (var i = 0; i < members.length; ++i) {
// Get the currently looped member
var member = members;
// Check if the member exists
if (member) {
// Make the member take damage
member.gainHp(-1 * dmg * member.elementRate(ElementId));
// Start the damage popup
member.startDamagePopup();
// Check if the member is dead
if (member.isDead()) {
// If it is, collapse the member
member.performCollapse();
}
// Clear the results
member.clearResult();
}
}
</Custom Leave Effect>
<Custom Regenerate Effect>
// Get the element.
var elementId = 2;
// Default the DoT formula.
target._DoT = target._DoT || Math.ceil(origin.mat * 0.50)*user.elementRate(elementId);
// Play an animation on the target.
target.startAnimation(67);
// Reduce the target's HP
target.gainHp(-target._DoT);
// Start the damage popup.
target.startDamagePopup();
// Check if the target is dead.
if (target.isDead()) {
// Make the target collapse.
target.performCollapse();
}
// Clear the target's results.
target.clearResult();
</Custom Regenerate Effect>
I'm trying to recreate the living bomb skill from WoW. Simply a skill that creates a state with a DoT (no problem there). which in return when expiring will damage the whole enemy squad.
I used a mix from yanflys unstable affliction and overheating scripts, but I'm stuck and can't get it to work properly. When the leave effect is triggered, it applies the damage twice plus the normal regeneration effect damage to all enemies.
Maybe someone more profficient could take a look at the code for me.
here's what I'm using:
Spoiler
<Custom Apply Effect>
// Calculate the damage to be dealt by the formula.
target._DoT = Math.ceil(origin.mat * 0.50);
</Custom Apply Effect>
<Custom Leave Effect>
// Calculate the damage to be dealt by the formula.
var dmg = Math.ceil(origin.mat * 3);
// Get the element ID
var ElementId = 2;
// Get all living battle members on the battlefield
var members = user.friendsUnit().aliveMembers().concat(target.friendsUnit().aliveMembers());
// Loop through each of the members
for (var i = 0; i < members.length; ++i) {
// Get the currently looped member
var member = members;
// Check if the member exists
if (member) {
// Make the member take damage
member.gainHp(-1 * dmg * member.elementRate(ElementId));
// Start the damage popup
member.startDamagePopup();
// Check if the member is dead
if (member.isDead()) {
// If it is, collapse the member
member.performCollapse();
}
// Clear the results
member.clearResult();
}
}
</Custom Leave Effect>
<Custom Regenerate Effect>
// Get the element.
var elementId = 2;
// Default the DoT formula.
target._DoT = target._DoT || Math.ceil(origin.mat * 0.50)*user.elementRate(elementId);
// Play an animation on the target.
target.startAnimation(67);
// Reduce the target's HP
target.gainHp(-target._DoT);
// Start the damage popup.
target.startDamagePopup();
// Check if the target is dead.
if (target.isDead()) {
// Make the target collapse.
target.performCollapse();
}
// Clear the target's results.
target.clearResult();
</Custom Regenerate Effect>