Yanfly Engine Plugins is a plugin library made for RPG Maker MV, a wonderful piece of software to help you make that role playing game of your dreams. You can find out more about RPG Maker MV here.
The Erratic Deflector is an interesting effect. It deflects damage equal to 4x the user’s DEF/MDF, whichever is higher. The amount deflected will be split evenly across random allies. And the Deflector has a 20% chance of failure while active. It’s a rather random way of defense, but it can certainly keep things interesting! Here’s how we can make this effect in RPG Maker MV!
You can grab the copy/paste code here:
Insert the following code into your state’s notebox. Change the values in red to reflect your game’s settings.
<Custom React Effect> // Check if this action deals HP damage if (this.isHpEffect() && value > 0) { // The success rate of the deflector var successRate = 0.80; // Check if the success rate passed if (Math.random() < successRate) { // Get the target's alive allies var allies = target.friendsUnit().aliveMembers(); // Check if the ally count is more than 1 if (allies.length > 1) { // Remove the target from the allies allies.splice(allies.indexOf(target), 1); // Set the maximum amount of total targets var max = Math.min(allies.length, 4); // Set the minimum amount of total targets var min = 1; // Get a random number between them var totalTargets = Math.floor(Math.random() * (max - min + 1) + min); // Loop the amount while (allies.length > totalTargets) { // Remove random allies from the pool allies.splice(Math.floor(Math.random() * allies.length), 1); } // Calculate the redirected damage var redirectedDamage = Math.min(value, Math.max(target.def * 4, target.mdf * 4)); redirectedDamage = Math.ceil(redirectedDamage / totalTargets); // Reduce the value of the damage value = value - redirectedDamage; // Loop through the remaining allies while (allies.length > 0) { // Get the currently looped ally var member = allies.shift(); // Check if the ally exists if (member) { // Make that member take damage member.gainHp(-redirectedDamage); // Display a popup member.startDamagePopup(); // Show an animation member.startAnimation(2); // Check if the member is dead if (member.isDead()) { // Collapse the member member.performCollapse(); } // Clear the member's results member.clearResult(); } } } } } </Custom React Effect>
Enjoy!
Please wait while you are redirected...or Click Here if you do not want to wait.