Jump to content
DoubleX

DoubleX RMMV Autobattle Bugfix

Recommended Posts

Purpose

Lets you fixes leaked side effects bugs when an autobattle actor has skills/items with damage formulae having side effects

 

Introduction

Spoiler

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

 

Video

Youtube

 

Parameters

Spoiler

 * @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'), '');"

 

 

Parameter Info

Spoiler

 *    # 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

 

 

Prerequisites

Spoiler

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/

 

Instructions

Spoiler

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

 

Terms Of Use

Spoiler

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.

 

Collaborators

Spoiler

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

 

Changelog

Spoiler

v1.00a(GMT 0400 7-Jun-2020)

1. 1st version of this plugin finished

 

Download Link

Pastebin

Edited by DoubleX

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted