Buffs & States Core (YEP)

From Yanfly.moe Wiki
Jump to navigation Jump to search
Welcome to the wiki! This is where you can find resources from Yanfly.moe, Ækashics.moe,
Visustella, Caz Wolf, Fallen Angel Olivia, Atelier Irina, and other affiliated content creators.



System

This is a plugin created for RPG Maker MV.

For help on how to install plugins, click here.

For help on how to update plugins, click here.

Got errors with your RPG Maker MV plugin? Click here.

Download

Extension Plugins

The following plugins are Extension Plugins that require this plugin as its Parent Plugin.

Place the following plugins below this plugin located in the Plugin Manager if you plan on using them.

Yanfly Engine Plugins

This plugin is a part of the Yanfly Engine Plugins library.


Introduction

If you are using YEP_BattleEngineCore.js, please this plugin under
YEP_BattleEngineCore in the plugin list for the best effect.

Alter the basic mechanics behind buffs and states that aren't adjustable
within the RPG Maker editor. Such mechanics include altering the maximum
number of times buffs can stack, changing the turns remaining on buffs and
states, and the rules involved when reapplying states.

A turn indicator has been added to show the amount of turns remaining on
buffs, debuffs, and states. Buffs and debuffs will operate off the plugin
parameter settings while states can operate on individual settings if you
choose for them to have unique settings.

Furthermore, a lot of Lunatic Mode options are added with this plugin to
allow those with JavaScript proficiency maximum control with states and any
unique effects that follow.

Notetags

NotetagsMV.png

RPG Maker MV's editor is unable to allow for custom traits/properties that a game dev may wish to associate with a database object, event, map, etc. Notetags are used to work around such limitations by allowing the game dev to tag certain traits/properties using specific Notetags declared by the related plugin.

Here is a list of Notetag(s) that you may use.

The following are various notetags you can use to modify states and buffs.

--- Buff Related ---

Actor, Class, Enemy, Weapon, Armor, and State notetags:
  <Max stat Buff: +x>
  <Max stat Buff: -x>
  <Max stat Debuff: +x>
  <Max stat Debuff: -x>
  Replace 'stat' with 'maxhp', 'maxmp', 'atk', 'def', 'mat', 'mdf', 'agi',
  or 'luk' without the quotes. This notetag adjusts the maximum number of
  times the stat can be buffed or debuffed to the Maximum Limit cap in the
  plugin parameters.

Skill and Item Notetags:
  <stat Buff Turns: +x>
  <stat Buff Turns: -x>
  <stat Debuff Turns: +x>
  <stat Debuff Turns: -x>
  Modifies already applied buff/debuff turns on target by x value. If this
  brings a buff/debuff to 0 or below, the buff/debuff is removed.

--- State Related ---

State Notetags:
  <Show Turns>
  <Hide Turns>
  Show/hide the turn count remaining for the state. This will override the
  default setting.

  <Turn Font Size: x>
  Sets the font size used for this specific state to be x. This will
  override the default setting.

  <Turn Alignment: Left>
  <Turn Alignment: Center>
  <Turn Alignment: Right>
  This sets the text alignment for the turn count indicator. This will
  override the default setting.

  <Turn Buffer X: +x>
  <Turn Buffer X: -x>
  <Turn Buffer Y: +x>
  <Turn Buffer Y: -x>
  Allows you to adjust the x/y position manually for the turn count for this
  particular state. This will override the default settings.

  <Turn Color: x>
  This will set the turn count display color to text color x. This will
  override the default setting.

  <Reapply Ignore Turns>
  <Reapply Reset Turns>
  <Reapply Add Turns>
  Changes the rules when this state is reapplied on a battler. When ignored,
  the turn count remains unchanged. When reset, the turn count is set back
  to the default amount with variance. When added, the turn count is added
  upon with variance.

Skill and Item Notetags:
  <State x Turns: +y>
  <State x Turns: -y>
  <State named Turns: +y>
  <State named Turns: -y>
  Modifies already applied state x turns on target by y value. If this
  brings the state to 0 or below turns, the state is removed. If you are
  using named states and have multiple states with the same name, priority
  will be given to the state with the highest ID.

Enemy Notetags:
  <Show State Turns>
  <Hide State Turns>
  Affected by the Battle Engine Core. When selecting enemies, the state
  turns will show up in the help window. You can use this to have certain
  enemies show the state turns or hide them.

Lunatic Mode

JavaScript.png

For advanced users who have an understanding of JavaScript, you can use the following features added by the plugin to further enhance what you can do with your game project.

Custom Turn Modifiers

For those with an understanding of JavaScript, you can use these notetags to
give conditional turn modifiers when altering a target's buff/state turn
count. Follow the instructions below:

Skill and Item Notetags:

  <Custom stat Buff Turn>
   turn = 10;
   turn += user.agi;
  </Custom stat Buff Turn>
  Replace 'stat' with 'maxhp', 'maxmp', 'atk', 'def', 'mat', 'mdf', 'agi',
  or 'luk' without the quotes. Whatever the 'turn' variable returns is what
  the turn count will be set to for the stat buff.

  <Custom stat Debuff Turn>
   turn = 10;
   turn += user.agi;
  </Custom stat Debuff Turn>
  Replace 'stat' with 'maxhp', 'maxmp', 'atk', 'def', 'mat', 'mdf', 'agi',
  or 'luk' without the quotes. Whatever the 'turn' variable returns is what
  the turn count will be set to for the stat debuff.

  <Custom State X Turn>
   turn = 10;
   turn += user.agi;
  </Custom State X Turn>
  This alters the turn count for state x. Whatever the 'turn' variable
  returns is what the turn count will be set for state x.

  <Custom State name Turn>
   turn = 10;
   turn += user.agi;
  </Custom State name Turn>
  This alters the turn count for state 'name'. Whatever the 'turn' variable
  returns is what the turn count will be set for state 'name'. If you have
  multiple states in your database with the same name, priority will be
  given to the state with the highest ID.

Custom Timing Effects

For those with an understanding of JavaScript, you can use these notetags to
cause code to run at certain times.

Quick Reference:
  - Apply:        When a state is added.
  - Remove:       When a state is removed.
  - Leave:        When a state expires by reaching 0 turns.
  - Turn Start:   Whenever the battler's turn starts.
  - Action Start: Whenever the battler performs a new action.
  - Action End:   Whenever the battler finishes an action.
  - Regenerate:   Whenever the battler would regenerate HP/MP/TP.
  - Turn End:     Whenever the battler's turn ends.
  - Battle:       Whenever a battle is started.
  - Victory:      Whenever a battle is won. *Note1
  - Escape:       Whenever a battle is escaped. *Note1
  - Defeat:       Whenever a battle is lost. *Note1

*Note1: If the state is set to expire on battle end, the expiration will
occur before the custom effects would take place, meaning the effects will
not occur at all unless the expiration is set to off.

State Notetags:

--- Timing Effects ---

These effects specifically occur at certain intervals or timings.

  <Custom Apply Effect>
   code
   code
  </Custom Apply Effect>
  The code in between these notetags will run when the state is added onto
  a battler. The code will process after the state is actually applied.

  <Custom Remove Effect>
   code
   code
  </Custom Remove Effect>
  The code in between these notetags will run when the state is removed from
  a battler either manually or due to turn decay. The code will process
  after the state is actually removed but before <Custom Leave Effect>.

  <Custom Leave Effect>
   code
   code
  </Custom Leave Effect>
  The code in between these notetags will run when the state is removed from
  a battler due to turn decay. The code will process after the state is
  actually removed and after <Custom Remove Effect>.

  <Custom Turn Start Effect>
   code
   code
  </Custom Turn Start Effect>
  This requires YEP_BattleEngineCore. This effect will run at the start of
  each of the battler's turns. The code will process after all the other
  turn start effects have taken course.

  <Custom Action Start Effect>
   code
   code
  </Custom Action Start Effect>
  This effect will run at the start of each of the battler's actions. The
  code will process before the skill/item cost takes place.

  <Custom Action End Effect>
   code
   code
  </Custom Action End Effect>
  This effect will run at the end of each of the battler's actions. The
  code will process before the action end steps takes place.

  <Custom Regenerate Effect>
   code
   code
  </Custom Regenerate Effect>
  This effect will run whenever the battler would regenerate HP, MP, or TP.
  The code will process after all the other regenerate effects have ran.

  <Custom Turn End Effect>
   code
   code
  </Custom Turn End Effect>
  This effect will run at the end of each of the battler's turns. The code
  will process after all the other turn end effects have taken course.

  <Custom Battle Effect>
   code
   code
  </Custom Battle Effect>
  This effect will occur at the start of battle if the battler has the state
  already applied (usually through a passive state).

  <Custom Victory Effect>
   code
   code
  </Custom Victory Effect>
  This effect will occur at the end of battle if the party is victorious.
  This will only apply to the player's party. If this state can expire at
  the end of battle, this effect will not occur as state expiration will
  occur before this effect will happen.

  <Custom Escape Effect>
   code
   code
  </Custom Escape Effect>
  This effect will occur at the end of battle if the party has escaped.
  This will only apply to the player's party. If this state can expire at
  the end of battle, this effect will not occur as state expiration will
  occur before this effect will happen.

  <Custom Defeat Effect>
   code
   code
  </Custom Defeat Effect>
  This effect will occur at the end of battle if the party is defeated.
  This will only apply to the player's party. If this state can expire at
  the end of battle, this effect will not occur as state expiration will
  occur before this effect will happen.

Custom Action Effects

For those with an understanding of JavaScript, you can use these notetags to
cause code to run during actions.

Quick Reference:
  Action Starts
  - Attacker: Initiate
  - Defender: Select
  Action Connects as a Success Hit, skip if Missed or Evaded
  - Attacker: Confirm
  - Defender: React
  Damage is Applied to the Defender
  - Defender: Respond
  - Attacker: Establish
  These occur regardless if the action is successfully hit.
  - Defender: Deselect
  - Attacker: Conclude

State Notetags:

--- On Action Effects ---

These effects specifically occur when the battler is a target of an action.

  <Custom Initiate Effect>
   code
   code
  </Custom Initiate Effect>
  This effect will run when the battler selects a target. This will occur
  before hit/miss/evade confirmation and damage execution. This effect will
  run before everything else has taken course.

  <Custom Select Effect>
   code
   code
  </Custom Select Effect>
  This effect will run when the battler is selected as a target. This will
  occur before hit/miss/evade confirmation and damage execution. This effect
  will run after <Custom Initiate Effect> before everything else has ran.

  <Custom Confirm Effect>
   code
   code
  </Custom Confirm Effect>
  This effect will run when the battler connects a hit and before damage
  execution occurs. This effect will run after <Custom Initiate Effect> and
  <Custom Select Effect> and before everything else.

  <Custom React Effect>
   value -= 100;
   value -= user.def;
  </Custom React Effect>
  This effect will run when the battler is selected as a target. This will
  occur only if the action connects and will occur before damage execution.
  This effect will run before damage calculation occurs and will return the
  'value' variable as a damage modifier. After <Custom Confirm Effect>, this
  effect will run.

  <Custom Respond Effect>
   code
   code
  </Custom Respond Effect>
  This effect will run when the battler is selected as a target. This will
  occur only if the action connects and will occur after damage execution.
  This effect will run after damage calculation occurs. The 'value' variable
  is equal to the damage dealt to the battler. This is the first effect to
  run after damage execution has taken place.

  <Custom Establish Effect>
   code
   code
  </Custom Establish Effect>
  This effect will run when the battler connects a hit and after damage
  execution occurs. This effect will run after <Custom Respond Effect> has
  occurred and before everything else.

  <Custom Deselect Effect>
   code
   code
  </Custom Deselect Effect>
  This effect will run when the battler is selected as a target. This will
  occur after hit/miss/evade confirmation and damage execution. This effect
  will run after everything else has taken course.

  <Custom Conclude Effect>
   code
   code
  </Custom Conclude Effect>
  This is the final effect to be run after the battler selects a target and
  will occur after hit/miss/evade confirmation and damage execution.

State Counters

State Counters are newly added features to suplement states. They are used
purely in custom manners, which means they do not serve any function by
themselves. State Counters can be used to note a number of stacks, a stored
percentage, display a message, etc. All of it is purely updated based on
JavaScript functions.

---

There are a couple of notetags you can use for states:

  <Counter Font Size: x>
  This adjusts the font size of the counter.

  <Counter Alignment: left>
  <Counter Alignment: center>
  <Counter Alignment: right>
  This changes the alignment of the counter text.

  <Counter Buffer X: +x>
  <Counter Buffer X: -x>
  This adjusts the X buffer range for the counter text.

  <Counter Buffer Y: +x>
  <Counter Buffer Y: -x>
  This adjusts the Y buffer range for the counter text.

  <Counter Text Color: x>
  This changes the font color of the text to the text color x.

---

The following are JavaScript functions you may use to adjust counters:

  battler.clearStateCounters();
  - This will clear all the counter values for all states.

  battler.setStateCounter(stateId, value);
  - This will set the counter value for the particular state to 'value'.

  battler.addStateCounter(stateId, value);
  - This will add to the counter value for the state. The counter must be
  a number in order for this to work.

  battler.clampStateCounter(stateId, min, max);
  - This will set a minimum and maximum value for the counter value of the
  particular state. The counter must be a number in order for this to work.

  battler.removeStateCounter(stateId)
  - This will clear the counter value for the state.

  battler.getStateCounter(stateId)
  - This will return the current state counter value.

Tips & Tricks

The following Tips & Tricks effects use this plugin:

Changelog

Version 1.16:
- Bypass the isDevToolsOpen() error when bad code is inserted into a script
call or custom Lunatic Mode code segment due to updating to MV 1.6.1.

Version 1.15:
- Updated for RPG Maker MV version 1.6.1.

Version 1.14:
- Updated for RPG Maker MV version 1.5.0.
- Fixed documentation error.

Version 1.13:
- Custom Turn End effects will no longer occur outside of battle.

Version 1.12a:
- Lunatic Mode fail safes added.
- Optimization update.

Version 1.11:
- Fixed a bug involving Lunatic state effects not occuring in the right
order when a state is removed.

Version 1.10b:
- Added new plugin parameter: Show Buff Rate. This will display the current
buff or debuff rate on the buff icon.
- Optimization Update.
- Documentation fix for battler.clampStateCounter(stateId, min, max).

Version 1.09b:
- Added new plugin parameters: Show Enemy Icons, Enemy Buff Turn, Enemy
State Turn, and Enemy State Counter to optionally display the enemy state
icons, states, buffs, their turns, and their counters.
- Added 'Lunatic Mode - State Counters'. Read more on it in the help file!
- Added anti-crash method for newly added effect in case non-YEP plugins
have non-battlers attached to battler sprites.
- Fixed a bug that prevented screen flashes when walking around on the map
when an actor is poisoned.

Version 1.08:
- Fixed an issue that caused adding states midway through Lunatic Mode to
shift the order of states around causing some effects to be skipped.

Version 1.07:
- Updated for RPG Maker MV version 1.1.0.

Version 1.06:
- Added new notetags for <Custom Battle Effect>, <Custom Victory Effect>,
<Custom Escape Effect>, and <Custom Defeat Effect> for Lunatic Mode.

Version 1.05a:
- Fixed a bug with the 'Show Turns' parameter not working properly.
- Fixed a bug with math issues for timed states.

Version 1.04:
- Changed timing of when Add/Remove/Leave Lunatic Effects occur to add more
flexibility in custom effects.
- Added a fail safe for when there are no targets to modify.
- Fixed a bug with reapply ignore states.

Version 1.03a:
- Fixed a bug that would cause NaN to show up in state turns.

Version 1.02:
- Synched up <Custom Turn End Effect> with tick-based battle systems.

Version 1.01:
- Fixed a bug that didn't reset the font settings with the battle status.

Version 1.00:
- Finished Plugin!