Introduction
Provides various features to help with battle testing.
Features
Run custom code at the start of each battle test.
Control the quantity of items given during battle test.
Set the starting HP/MP Rate of the party, as well as give a bonus/penalty to starting TP during battle test.
Allows for logging details of the battle to the console.
Allows for not closing the game after a battle test.
How to use
Save as APHO_BattleTest.js, add it via the plugin manager, adjust parameters as you see fit.
Spoiler: Parameters Explanation
Battle Test Initialise Code:
Put custom code that you want to run before a battle test here. This will only apply to battle tests, and not test play.
Override setupBattleTestItems:
If enabled, allows you to set the quantity of items given during battle test. You can also set a different quantity for regular/key items/hidden items A/B.
Exclude Item Prefix:
Items whose names start with this are never given during battle test. Leave blank to not exclude anything.
(For example, if you use items with names like '==POTIONS==' to divide your database for organisation, you can set this to '==' to ignore all such items)
HP Rate, MP Rate:
Starting HP/MP Rate of the party during a battle test. Must be a value between 0 to 1, where 1 is full HP/MP.
TP Bonus:
Grant a flat bonus to TP at the start of battle test. Can be negative to instead lose TP. Requires 'Preserve TP'.
Detailed log:
If set to true, details of the battle will be logged to the console. This works during test play as well. Set the value display and decimal rounding to whatever you prefer (if you do not want decimals to be rounded, set Decimals to -1), and set each parameter in the list to whether you want it logged or not.
Close after battle test:
By default, the game will close itself after a battle test.
You may optionally choose to not close the game.
This might be useful if you wish to review the logs at the end of battle.
Note that doing so requires overriding BattleManager.updateBattleEnd whenever in a battle test.
Script
Spoiler: CODE
JavaScript:
//==========================================
// APHO_BattleTest.js
//==========================================
/*:
* @title Battle Test
* @author Apho
* @plugindesc v1.0 Provides various features to help with battle testing.
*
* @param BattleTestInitCode
* @text Battle Test Initialise Code
* @desc Code to run whenever a battle test starts. This runs after the default functions.
* @type note
* @default ""
*
* @param OverridesetupBattleTestItems
* @text Override setupBattleTestItems?
* @desc Override the default setupBattleTestItems function which gives the max number of all items?
* @type boolean
* @default false
*
* @param ExcludeItemPrefix
* @parent OverridesetupBattleTestItems
* @text Exclude Item Prefix
* @desc Items whose names start with this are never given during battle test. Leave blank to not exclude anything.
* @type string
* @default
*
* @param RegularItemQty
* @parent OverridesetupBattleTestItems
* @text Regular Item Quantity
* @desc Quantity of each regular item that will be given at the start of a battle test. This is an eval.
* @type string
* @default this.maxItems(item)
*
* @param KeyItemQty
* @parent OverridesetupBattleTestItems
* @text Key Item Quantity
* @desc Quantity of each key item that will be given at the start of a battle test. This is an eval.
* @type string
* @default 0
*
* @param HiddenItemAQty
* @parent OverridesetupBattleTestItems
* @text Hidden Item A Quantity
* @desc Quantity of each hidden item A that will be given at the start of a battle test. This is an eval.
* @type string
* @default 0
*
* @param HiddenItemBQty
* @parent OverridesetupBattleTestItems
* @text Hidden Item B Quantity
* @desc Quantity of each hidden item B that will be given at the start of a battle test. This is an eval.
* @type string
* @default 0
*
* @param HpRate
* @text HP Rate
* @desc Starting HP rate of the party during battle test.
* @type number
* @decimals 10
* @max 1
* @min 0
* @default 1
*
* @param MpRate
* @text MP Rate
* @desc Starting MP rate of the party during battle test.
* @type number
* @decimals 10
* @max 1
* @min 0
* @default 1
*
* @param TpBonus
* @text TP Bonus
* @desc Grant a flat bonus (or penalty) to TP at the start of battle test. Requires 'Preserve TP'.
* @type number
* @min -999999
* @default 0
*
* @param DetailedLog
* @text Detailed Log
* @desc Displays detailed information about the battle in the console.
* @type boolean
* @default true
*
* @param ValueDisplay
* @parent DetailedLog
* @text Value Display
* @desc How should values in the log be displayed as?
* @type select
* @option Decimal
* @value 0
* @option Percentage
* @value 1
* @default 1
*
* @param Decimals
* @parent DetailedLog
* @text Decimals
* @desc How many decimal places should values in the log be rounded to? Set to -1 for no rounding.
* @type number
* @min -1
* @default -1
*
* @param EscapeRate
* @parent DetailedLog
* @text Escape Rate
* @desc Show the current escape success rate. This is shown as a decimal, where 1.0 = 100%.
* @type boolean
* @default true
*
* @param PartyAvgHP
* @parent DetailedLog
* @text Party Average HP
* @desc Show the average HP% of party members. Dead members count as having 0%.
* @type boolean
* @default true
*
* @param PartyAvgMP
* @parent DetailedLog
* @text Party Average MP
* @desc Show the average MP% of party members. Members with 0 max MP count as having 0%.
* @type boolean
* @default true
*
* @param PartyAvgTP
* @parent DetailedLog
* @text Party Average TP
* @desc Show the average TP% of party members.
* @type boolean
* @default true
* @param TroopAvgHP
* @parent DetailedLog
* @text Troop Average HP
* @desc Show the average HP% of enemy troop members. Dead members count as having 0%.
* @type boolean
* @default true
*
* @param TroopAvgMP
* @parent DetailedLog
* @text Troop Average MP
* @desc Show the average MP% of enemy troop members. Members with 0 max MP count as having 0%.
* @type boolean
* @default true
*
* @param TroopAvgTP
* @parent DetailedLog
* @text Troop Average TP
* @desc Show the average TP% of enemy troop members.
* @type boolean
* @default true
*
* @param CloseAfterBattleTest
* @text Close after battle test
* @desc Close the game after a battle test ends?
* @type boolean
* @default true
*
* @help
* Battle Test Initialise Code:
* Allows for running custom code upon starting a battle test.
*
* Override setupBattleTestItems:
* Allows for overriding the default function that gives the max amount of items.
* If enabled, you may exclude items, as well as specify the quantity based on
* type. (regular item, key item, etc)
* Evals may also be used. Use 'item' to refer to the item.
*
* HP Rate, MP Rate, TP Bonus:
* Set the starting HP/MP Rate of the party during battle test.
* HP/MP Rate must be a value from 0 to 1, where 1 is full HP/MP.
* TP Bonus is a flat value added to starting TP. Can be negative.
* Requires 'Preserve TP'.
*
* Detailed Log:
* Allows for logging details of the battle to the console (F8).
* Unlike the other features, this also works during regular test play battles.
* This log will be updated at the end of each turn / battle.
* You may have the values displayed either as a decimal (where 1.0 = 100%), or
* as a percentage, as well as specify which values will be logged and number of
* decimal places rounded to.
*
* Close after battle test:
* By default, the game will close itself after a battle test.
* You may optionally choose to not close the game.
* This might be useful if you wish to review the logs at the end of battle.
* Note that doing so requires overriding BattleManager.updateBattleEnd
* whenever in a battle test.
*
* NOTES
* - Since this plugin is purely for testing purposes, it can be removed or
* disabled prior to deployment.
* - If using YEP_BattleEngineCore.js, place this plugin above it in the Plugin
* Manager.
*
* TERMS OF USE
* - Edits allowed for personal use.
* - Do not repost or claim as your own, even if edited.
*
* VERSION HISTORY
* v1.0 - 2023/10/19 - Initial release.
*/
(function(){
var parameters = PluginManager.parameters('APHO_BattleTest');
if (!this.isBattleTest()) BattleManager_updateBattleEnd.call(this);
};
}
})();
复制代码
Notes
Since this plugin is purely for testing purposes, it can be removed or disabled prior to deployment.
If using YEP_BattleEngineCore.js, place this plugin above it in the Plugin Manager.
Terms of Use
Edits allowed for personal use.
Do not repost or claim as your own, even if edited.
Do not use for training AI models. This includes, but is not limited to, inputting the plugin contents or part thereof into AI models that train on user input.
Version History
v1.0 - 2023/10/19 - Initial release.