Hello,
Once again I try to change a Tips & Tricks to adapt it to my needs.
I think it's doable but I need someone who knows java script.
This is the "Aura of Sacrifice" effect. In the script that I will show you below, it allows you to create a state that will redirect the damage suffered by the allied characters to a single ally (the tank logically).
Example: I have 4 characters in my team (A B C and D).
A has the damage redirection state.
All damage suffered by B C and D are redirected to A. The script also reduces the amount of damage suffered by 50%.
Now I will explain what I would like.
I would like to create a state that is placed on an enemy, redirecting half of the damage suffered by my allied characters on him.
Example: If A B C and D must suffer 100 damage
==> they only take 50 damage each, and the enemy marked with the state will take 200 (4 x 50).
Is it possible ?
(Translation made by google, please ask me to rephrase if necessary)
The original formula:
<Custom React Effect>
// Check if the action dealt HP damage
if (this.isHpEffect() && value > 0) {
// Get the target's allies
var members = target.friendsUnit().aliveMembers();
// Get the Aura's Origin State ID
var auraOriginId = 246;
// Make the origin user undefined
var auraOriginUser = undefined;
// Loop through each member
for (var i = 0; i < members.length; ++i) {
// Get the currently looped member
var member = members;
// Check if the member exists, isn't the target, and is the aura holder
if (member && member !== target && member.isStateAffected(auraOriginId)) {
// Set the origin user to that member
auraOriginUser = member;
// Break the loop
break;
}
}
// Check if the origin user exists
if (auraOriginUser) {
// Calculate the amount of reduction
var reduction = Math.ceil(0.50 * value);
// Set the damage to the target to 0.
value = 0;
// Make the origin user take damage instead.
auraOriginUser.gainHp(-reduction);
// Display an animation on the origin user.
auraOriginUser.startAnimation(2);
// Make the origin user display a damage popup.
auraOriginUser.startDamagePopup();
// Check if the origin user is dead
if (auraOriginUser.isDead()) {
// Collapse the origin user if dead
auraOriginUser.performCollapse();
}
// Clear the origin user's results
auraOriginUser.clearResult();
}
}
</Custom React Effect>
Once again I try to change a Tips & Tricks to adapt it to my needs.
I think it's doable but I need someone who knows java script.
This is the "Aura of Sacrifice" effect. In the script that I will show you below, it allows you to create a state that will redirect the damage suffered by the allied characters to a single ally (the tank logically).
Example: I have 4 characters in my team (A B C and D).
A has the damage redirection state.
All damage suffered by B C and D are redirected to A. The script also reduces the amount of damage suffered by 50%.
Now I will explain what I would like.
I would like to create a state that is placed on an enemy, redirecting half of the damage suffered by my allied characters on him.
Example: If A B C and D must suffer 100 damage
==> they only take 50 damage each, and the enemy marked with the state will take 200 (4 x 50).
Is it possible ?
(Translation made by google, please ask me to rephrase if necessary)
The original formula:
<Custom React Effect>
// Check if the action dealt HP damage
if (this.isHpEffect() && value > 0) {
// Get the target's allies
var members = target.friendsUnit().aliveMembers();
// Get the Aura's Origin State ID
var auraOriginId = 246;
// Make the origin user undefined
var auraOriginUser = undefined;
// Loop through each member
for (var i = 0; i < members.length; ++i) {
// Get the currently looped member
var member = members;
// Check if the member exists, isn't the target, and is the aura holder
if (member && member !== target && member.isStateAffected(auraOriginId)) {
// Set the origin user to that member
auraOriginUser = member;
// Break the loop
break;
}
}
// Check if the origin user exists
if (auraOriginUser) {
// Calculate the amount of reduction
var reduction = Math.ceil(0.50 * value);
// Set the damage to the target to 0.
value = 0;
// Make the origin user take damage instead.
auraOriginUser.gainHp(-reduction);
// Display an animation on the origin user.
auraOriginUser.startAnimation(2);
// Make the origin user display a damage popup.
auraOriginUser.startDamagePopup();
// Check if the origin user is dead
if (auraOriginUser.isDead()) {
// Collapse the origin user if dead
auraOriginUser.performCollapse();
}
// Clear the origin user's results
auraOriginUser.clearResult();
}
}
</Custom React Effect>