I was looking a 'Tips & Tricks' video of Yanfly about a weapon from LoL called Wit's End, that adds Magic Damage to basic attacks and buffs user MD and debuffs the enemy's MD, he applied a similar effect in game and he even gave the code to use it, but looking at the code, where does it specify that is the Magic Defense that has to be buffed or debuffed?
<Custom Confirm Effect>
// Check if the action is a basic attack.
if (this.isAttack()) {
// Calculate the number of turns the user has for MDF buff.
var turns = user.buffTurns(5);
// Make the minimum number of turns for MDF buff to 3.
turns = Math.max(3, turns);
// Increase the MDF rate for user.
user.addBuff(5, turns);
// Calculate the number of turns the target has for MDF buff.
var turns = target.buffTurns(5);
// Make the minimum number of turns for MDF debuff to 3.
turns = Math.max(3, turns);
// Decrease the MDF rate for target.
target.addDebuff(5, turns);
// Calculate the damage dealt.
var damage = (user.mat - target.mdf) * 0.40;
// Round the damage dealt upward.
damage = Math.ceil(damage);
// Ensure that the bonus damage has a minimum of 0 damage.
value += Math.max(0, damage);
// Set the color used for a screen flash.
var color = [0, 255, 255, 64];
// Set the duration of the screen flash.
var duration = 8;
// Cause the screen to flash when a basic attack connects.
$gameScreen.startFlash(color, duration);
}
</Custom Confirm Effect>
<Custom Confirm Effect>
// Check if the action is a basic attack.
if (this.isAttack()) {
// Calculate the number of turns the user has for MDF buff.
var turns = user.buffTurns(5);
// Make the minimum number of turns for MDF buff to 3.
turns = Math.max(3, turns);
// Increase the MDF rate for user.
user.addBuff(5, turns);
// Calculate the number of turns the target has for MDF buff.
var turns = target.buffTurns(5);
// Make the minimum number of turns for MDF debuff to 3.
turns = Math.max(3, turns);
// Decrease the MDF rate for target.
target.addDebuff(5, turns);
// Calculate the damage dealt.
var damage = (user.mat - target.mdf) * 0.40;
// Round the damage dealt upward.
damage = Math.ceil(damage);
// Ensure that the bonus damage has a minimum of 0 damage.
value += Math.max(0, damage);
// Set the color used for a screen flash.
var color = [0, 255, 255, 64];
// Set the duration of the screen flash.
var duration = 8;
// Cause the screen to flash when a basic attack connects.
$gameScreen.startFlash(color, duration);
}
</Custom Confirm Effect>