DoubleX RMMV Autobattle Bugfix

DoubleX

Just a nameless weakling
Veteran
Joined
Jan 2, 2014
Messages
1,598
Reaction score
659
First Language
Chinese
Primarily Uses
N/A
Purpose
Lets you fixes leaked side effects bugs when an autobattle actor has skills/items with damage formulae having side effects

1. In the default RMMV battle system, doing anything other than calculating the skill/item damage in its damage formula can lead to those side effects unintentionally applied to all possible targets of that skill/item if the actor having it is in autobattle mode as its damage formula will be run to have the evaluated damage value for each target in order to determine which usable skill/item should be used to which possible target
2. This plugin lets you specify a regular expression to use only the desired portions of the damage formula when running the aforementioned evaluation, while still preserving the damage formula as-is when actually executing the action
3. You should try to standardize the damage formula structure so you can write an easy, simple and small regular expression that can always separate the side effects parts from the damage calculation parts


JavaScript:
 * @param isEnabled
* @type note
* @desc Sets whether this plugin will be enabled
* It'll be the contents of a function returning a Boolean
* @default "return true;"
*
* @param sideEffectFreeDmgFormula
* @type note
* @desc Sets how to pick which damage formula part to use
* It'll be the contents of a function returning a String
* @default "return dmgFormula.replace(new RegExp('.*[};] *', 'gim'), '');"

JavaScript:
 *    # Function arguments
*      1. isEnabled
*         None
*      2. sideEffectFreeDmgFormula
*         dmgFormula - The original damage formula of the skill/item to be
*                      evaluated when the actor in the autobattle mode
*                      evaluates which skill/item to be used on which target
*    # Valid values
*      1. isEnabled
*         Any valid Javascript(It'll always be regarded as truthy/falsy)
*      2. sideEffectFreeDmgFormula
*         Any valid Javascript returning the damage formula which returns a
*         Number and has no unintended side effects
*    # Examples
*      1. isEnabled
*         Setting isEnabled as
*         return $gameSwitches.value(1);
*         will enable this plugin only if the game switch with id 1 is on
*      2. sideEffectFreeDmgFormula
*         Setting sideEffectFreeDmgFormula as
*         return dmgFormula.replace(new RegExp(.*[};] *, 'gim'), "");
*         will only use the damage formula portion after the last } or ;
*         - The following original damage formula:
*           if ($gameSwitches.value(2)) { b.addState(4); } a.atk * 2 - b.def
*           Will become:
*           a.atk * 2 - b.def
*           Which is a valid damage formula just returning the damage
*         - The following original damage formula:
*           b.addState(4); a.atk * 2 - b.def
*           Will become:
*           a.atk * 2 - b.def
*           Which is a valid damage formula just returning the damage
*         - The following original damage formula:
*           $gameSwitches.value(2)?(b.addState(4);a.atk*4-b.def*2):a.atk*2-b.def
*           Will become:
*           a.atk*4-b.def*2):a.atk*2-b.def
*           Which is syntactically invalid so the new formula won't be run

Abilities:
1. Little RMMV plugin development proficiency to fully utilize this plugin in intended ways
Regular Expression Learning Sites:
1. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
2. https://regex101.com/
Javascript Sandbox:
1. https://playcode.io/

1. The default plugin parameters file name is doubleX rmmv autobattle bugfix v100a
If you want to change that, you must edit the value of DoubleX_RMMV.Autobattle_Bugfix_File, which must be done via opening this plugin js file directly

1. Commercial use's always allowed and crediting me's always optional.
2. You shall keep this plugin's Plugin Info part's contents intact.
3. You shalln't claim that this plugin's written by anyone other than DoubleX or my aliases. I always reserve the right to deny you from using any of my plugins anymore if you've violated this.
4. If you repost this plugin directly(rather than just linking back), you shall inform me of these direct repostings. I always reserve the right to request you to edit those direct repostings.
5. CC BY 4.0, except those conflicting with any of the above, applies to this plugin, unless you've my permissions not needing follow so.
6. I always reserve the right to deny you from using this plugin anymore if you've violated any of the above.

Authors:
1. DoubleX
Plugin Development Collaborators:
- None So Far
Bug Reporters:
- None So Far
Compatibility Issue Raisers:
- None So Far
Feature Requesters:
- None So Far

v1.00a(GMT 0400 7-Jun-2020)
1. 1st version of this plugin finished

Download Link
Pastebin
 
Last edited:

ravenhood

Veteran
Veteran
Joined
Feb 26, 2020
Messages
47
Reaction score
13
First Language
Chinese
Primarily Uses
RMMV
@DoubleX welcome back, my King. I'm glad to see you making plugins again
 

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,782
Members
132,080
Latest member
nwr
Top