Eval Collection: Defile (League of Legends)

karthus_0

Defile is an ability of Karthus from League of Legends. The ability has a toggle mechanic. Toggled off, it passively restores mana upon killing a unit. Toggled on, it drains Mana while damaging enemies surrounding Karthus.

1.PNG

Requirements:

♦ YEP_BuffsStatesCore.js

♦ YEP_AutoPassiveStates.js

♦ YEP_X_PassiveAuras.js

Optional:

♦ YEP_X_VisualStateFX.js

Make sure that you have all required plugins installed!

This will be a bit more complex so read carefully:

Step 1:

First, we’ll create the Defile skill. It should have the following properties:
Scope: The User
Occasion:
Battle Screen
Hit Type: Certain Hit
No Damage formula!

Use the following notetag in its notebox:


//Replace 139 with the State ID of your "Defile Toggle Off" state
<Passive State: 139>

<Before Eval>
// Replace 140 with the State ID of your "Defile Toggle On" state
if (user.isStateAffected(140)) {
// Same here!
user.removeState(140);
} else {
// Same here!
user.addState(140);
};
</Before Eval>

Step 2:

As you may have noticed we need a few states! Let’s go on and create them. We’ll need a total of three states.

First, create the “Defile Toggle Off” state. As the name says, this will be a passive state that stays on your actor as long as Defile’s toggle is off!

Use this in its notebox:


<Custom Passive Condition>
// Replace 140 with the State ID of your "Defile Toggle On" state
if (!user.isStateAffected(140)) {
condition = true;
} else {
condition = false;
};
</Custom Passive Condition>

<Custom Establish Effect>
// The amount of MP gained whenever an enemy is killed. Default: 48
var mpGain = 48;
if (target.hp <= 0) {
user.gainMp(mpGain);
};
</Custom Establish Effect>


Next, we’ll create the “Defile Toggle On” state. This state will be on your actor when you activate Defile. It’s an aura state!

Use the following in its notebox:


<Custom Regenerate Effect>
// The amount of MP needed each turn to keep Defile active! Default: 78
var upkeep = 78
if (user.mp < upkeep) {
// Replace 140 with the State ID of your "Defile Toggle On" state
user.removeState(140);
} else {
user.gainMp(-upkeep);
user.startDamagePopup();
user.clearResult();
};
</Custom Regenerate Effect>

// Replace 141 with the State ID of your "Defile on foe" state
<Foe Aura: 141>


Let’s create the third and final state that I just mentioned, the “Defile on foe” state. This state will be applied to all enemies by the aura state. It will ensure that the foe is damaged each turn.

This notetag needs to be used:


<Custom Regenerate Effect>
// Get origin of aura. Note: It will loop through the Actor party not the enemies.
// If you want this ability to be used by enemies instead, you'll need to replace
// $gameParty.battleMembers().length with $gameTroop._enemies.length
// and $gameParty.battleMembers()[i] with $gameTroop._enemies[i]
for (var i = 0; i < $gameParty.battleMembers().length; i++) {
var actor = $gameParty.battleMembers()[i];
// Replace 140 with the State ID of your "Defile Toggle On" state
if (actor.isStateAffected(140)) {
var auraOrigin = actor;
break;
};
};

// The damage the enemy takes each turn.
var damage = 110 + auraOrigin.mat * 0.2;
user.gainHp(-Math.floor(damage));
// Play an animation, if you want.
user.startAnimation(101);
</Custom Regenerate Effect>


Please read my comments in the notetags. You need to replace a lot of State IDs and it’s vital that you don’t miss any of them. If you have questions, feel free to ask me.

And sorry about my “inactivity”. I was ill earlier this week and then I was buried with teacher’s work.

Advertisements

Write a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s