ave369's Damage Control (now 1.1)

ave36

Veteran
Veteran
Joined
Jun 23, 2019
Messages
145
Reaction score
55
First Language
Russian
Primarily Uses
RMMV
ave369's Damage Control
by ave369

Version 1.1

Introduction
This plugin allows controlling skill and item damage by introducing a bottom and a cap, a la classic Final Fantasy games. Remember doing the 9999 with your attacks? This plugin will allow you to do the same and more.

Features
- Allows to set up caps and bottoms for both damage and healing;
- Allows to designate Uncapped skills and items that can break the limit (but are still subject to bottom);
- Allows to designate Unbound skills that ignore both cap and bottom.

Changelog

* 1.1: 100% Elemental Defense exception added. The plugin will now always allow 0 Damage if the cause of it is an elemental attack against 100% defense.
* 1.0: plugin released

How to Use
Use the standard Plugin Manager, set up your caps, bottoms, capless and unbound skills, and enjoy!

Code:

Code:
//==============================================================================
// ave369s_DamageControl.js
//==============================================================================

/*:
* @plugindesc Allows controlling skill and item damage by introducing a bottom and a cap, a la classic Final Fantasy games
* @author ave369
*
* @param Damage Bottom
* @desc The smallest damage possible. Default is 1. Negative damage (healing, absorbtion, etc) ignores this parameter.
* @default 1
*
* @param Healing Bottom
* @desc The smallest amount of healing/absorption possible. Default is 1.
* @default 1
*
* @param Damage Cap
* @desc The greatest damage possible for skills and items unless specified otherwise in the Capless params.
* @default 9999
*
* @param Healing Cap
* @desc The greatest amount of healing/absorption possible unless specified otherwise in the Capless params.
* @default 9999
*
* @param Capless Skills
* @desc IDs of skills that can exceed the cap. Input a list of numerals separated by commas. Default is 3,4,5
* @default 3,4,5
*
* @param Capless Items
* @desc IDs of items that can exceed the cap. Input a list of numerals separated by commas. Default is 2,3
* @default 2,3
*
* @param Unbound Skills
* @desc IDs of skills that ignore both cap and bottom. Input a list of numerals separated by commas. Default is 6,7,8
* @default 6,7,8
*
* @param Unbound Items
* @desc IDs of items that ignore both cap and bottom. Input a list of numerals separated by commas. Default is 4,5
* @default 4,5
*
*
* @help
* --------------------------------------------------------------------------------
* This plugin has eight parameters.
*
* Damage Bottom: The smallest damage possible. Default is 1. Negative damage
* (healing, absorbtion, etc) ignores this parameter and uses Healing Bottom instead.
*
* Healing Bottom: The smallest amount of healing/absorption possible. Default is 1.
*
* Damage Cap: The greatest damage possible for skills and items unless specified
* otherwise in the Capless / Unbound params. Negative damage ignores this parameter
* and uses Healing Cap instead.
*
* Healing Cap: The greatest amount of healing/absorption possible unless specified
* otherwise in the Capless / Unbound params.
*
* Capless Skills and Capless Items: these skills and items ignore the cap but not
* the bottom. Use it for extra strong techniques that break the limit.
*
* Unbound Skills and Unbound Items: these skills and items ignore both cap and
* bottom. It is recommended to use the Unbound parameter for skills and items
* that can do 0 damage or healing. Note that if your skill/item does 0 healing
* and is not marked as unbound, the game treats it as damage, and the Bottom
* damage is applied.
*
* Terms of Use
* --------------------------------------------------------------------------------
* This plugin is Forever Free. If I, ave369, ever charge money for this plugin,
* you have the right to call me the most deplorable of human beings.
* Credit ave369 if using this plugin in your project.
* Free for commercial and non-commercial projects.
* --------------------------------------------------------------------------------
* Version 1.1
* Special thanks to:
* Mr. Trivel for his Minimum Damage plugin that inspired mine;
* iavra for a tip how to include arrays as plugin params.
*
* --------------------------------------------------------------------------------
*/

(function() {
    var parameters = PluginManager.parameters('ave369s_DamageControl');
    var minDamage = Number(parameters['Damage Bottom'] || 1);
    var minHealing = Number(parameters['Healing Bottom'] || 1);
    var maxDamage = Number(parameters['Damage Cap'] || 9999);
    var maxHealing = Number(parameters['Healing Cap'] || 9999);
    var limitBrokenRaw = String(parameters['Capless Skills'] || '3,4,5');
    var limitBroken = limitBrokenRaw.split(/\s*,\s*/).filter(function(value){ return !!value; });
    var limitBrokenItemsRaw = String(parameters['Capless Items'] || '2,3');
    var limitBrokenItems = limitBrokenItemsRaw.split(/\s*,\s*/).filter(function(value){ return !!value; });
    var limitUnboundRaw = String(parameters['Unbound Skills'] || '6,7,8');
    var limitUnbound = limitUnboundRaw.split(/\s*,\s*/).filter(function(value){ return !!value; });
    var limitUnboundItemsRaw = String(parameters['Unbound Items'] || '4,5');
    var limitUnboundItems = limitUnboundItemsRaw.split(/\s*,\s*/).filter(function(value){ return !!value; });
    //var thisIsAnItem = false;
    var _Game_Action_makeDamageValue = Game_Action.prototype.makeDamageValue;

    Game_Action.prototype.makeDamageValue = function(target, critical) {
        var do_damage = _Game_Action_makeDamageValue.call(this, target, critical);
        var id_check = String(this.item().id);
        // Only apply bottom restrictions for uncapped skills & items
        if (limitBroken.includes(id_check) && this.isSkill()) {
            return (do_damage >= 0 ? Math.max(do_damage, minDamage) : Math.min (do_damage, -minHealing));
        }
        else if (limitBrokenItems.includes(id_check) && this.isItem()) {
            return (do_damage >= 0 ? Math.max(do_damage, minDamage) : Math.min (do_damage, -minHealing));
        }
        // Apply no restrictions at all for unbound items
        else if (limitUnbound.includes(id_check) && this.isSkill()) {
            return do_damage;
        }
        else if (limitUnboundItems.includes(id_check) && this.isItem()) {
            return do_damage;
        }
        else if (this.calcElementRate(target) == 0) return 0; //special exception, 100% elemental resist is always a 0
        // Apply all restrictions
        else return (do_damage >= 0 ? Math.min (maxDamage, Math.max(do_damage, minDamage)) : Math.max (-maxHealing, Math.min (do_damage, -minHealing)));
    };
})();
FAQ
Q: This plugin is sloppily written! How so?
A: This is my first plugin. Please do not be mean. I'm just learning.

Q: Who should i credit?
A: ave369, or Arinwende (that's me).

Q: Is it available for commercial projects? For non-commercial projects? Is it free?
A: This plugin is Forever Free for both commercial and non-commercial projects. Paid plugins suck! If I, ave369, ever charge money for this plugin, or a future version thereof, you have the right to call me the most deplorable of human beings.

Q: What to expect in future versions?
A: Notetags. 2.0 will feature them. Versions further than that will have more features such as secondary caps.

Credit and Thanks
- Mr. Trivel for his Minimum Damage plugin that inspired mine. I saw his tiny plugin and wanted a bigger, better version of it with more functions. There was none (except for the paid plugin by Yanfly), so I had to write my own.
- iavra for the hint how to make arrays from plugin params.

Author's Notes
Have fun!
 

Attachments

Last edited:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

When you're lost out therrrrre and you're alllll alone, ahwahwah waitin, to carry you hooooommmme, uhhheverywhere you look! (someone hit me with those backing vocals)
X.X cant focus... too many thing want do... help!
Day 2 of teaching MV, student can move cat across the map.
Got inspired and started writing a simple tower defence battle system last night :o
Good news! I have located an amazing 3D website called SketchFab that has rotatable renderings of famous statues!

Forum statistics

Threads
100,524
Messages
976,787
Members
132,080
Latest member
nwr
Top