Difference between revisions of "Category:Lunatic Mode (MV)"

From Yanfly.moe Wiki
Jump to navigation Jump to search
(Message Core)
(Damage Core)
Line 1,109: Line 1,109:
 
   value *= target.rec                  value = this.applyHealRate
 
   value *= target.rec                  value = this.applyHealRate
 
   value = this.applyCritical(value)    value = this.applyCriticalRate
 
   value = this.applyCritical(value)    value = this.applyCriticalRate
 +
</nowiki>
 +
 +
=== [[Armor Scaling (YEP)|Armor Scaling]] ===
 +
<hr>
 +
 +
<nowiki>
 +
For those with some JavaScript experience, you can make use of Lunatic Mode
 +
to calculate the way you want armor scaling done for particular skills and
 +
items right within the notebox!
 +
 +
  <Positive Armor Rate>
 +
  value *= 100;
 +
  value /= 100 + armor;
 +
  </Positive Armor Rate>
 +
  This enables you to set a custom positive armor calculation rate for the
 +
  skill/item instead of using the default positive armor rate.
 +
 +
  <Negative Armor Rate>
 +
  value *= 2 - (100 / (100 - armor));
 +
  value *= 1.5;
 +
  </Negative Armor Rate>
 +
  This enables you to set a custom negative armor calculation rate for the
 +
  skill/item instead of using the default positive armor rate.
 +
 +
  <Base Armor>
 +
  armor = target.def;
 +
  armor -= user.atk / 4;
 +
  </Base Armor>
 +
  This enables you to set a custom way for the skill/item to calculate the
 +
  base armor value used for armor scaling.
 
</nowiki>
 
</nowiki>
  

Revision as of 18:13, 26 June 2019

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.


Introduction

Lunatic Mode is a key phrase coined by Yanfly and is often seen used across the RPG Maker community by many users to refer to advanced usage of plugins involving code of some sort. It usually pertains to the usage of notetags, but it can also be applied to other things, such as Plugin Parameters and comment tags, too. It is recommended that users don't dabble with Lunatic Mode features unless they understand that what they're using can cause their game to crash if the code is made incorrectly.

Origin

The origin of Lunatic Mode came from Touhou Project, a Japanese bullet hell shoot 'em up game series. In the games, there are often four modes: Easy, Normal, Hard, and Lunatic. During the RPG Maker VX era, the Yanfly Engine ReDux series had their usage labeled in the four categories:

  • Easy Mode: The scripts would be plug and play by simply adding the script to your list.
  • Normal Mode: The scripts would require interaction with the game project through the usage of notetags.
  • Hard Mode: The scripts would require alteration of the script's module settings.
  • Lunatic Mode: The scripts would require basic coding knowledge to use correctly.

This difficulty scheme was never used again since the VX script libraries, but the term Lunatic Mode has stuck with the community since then.

Absorption Barrier

Custom Barrier Points
For those with JavaScript proficiency, you can utilize these notetags to
allow your skills and items to give battlers custom Barrier Point totals.

Skill and Item Notetags:

  --- Target ---

  <Custom Target Barrier>
   value = target.level;
  </Custom Target Barrier>
  The 'value' variable determines the total amount of Barrier Points that
  will be added to the target's unexpiring Barrier Point total.

  <Custom Target Barrier x Turns>
   value = target.level;
  </Custom Target Barrier x Turns>
  The 'value' variable determines the total amount of Barrier Points that
  will be added to the target for x amount of turns.

  --- User ---

  <Custom User Barrier>
   value = user.level;
  </Custom User Barrier>
  The 'value' variable determines the total amount of Barrier Points that
  will be added to the user's unexpiring Barrier Point total.

  <Custom User Barrier x Turns>
   value = user.level;
  </Custom User Barrier x Turns>
  The 'value' variable determines the total amount of Barrier Points that
  will be added to the user for x amount of turns.

Custom Barrier Penetration
For those with JavaScript proficiency, you can utilize these notetags to
give your skills, items, actors, classes, enemies, weapons, armors, and
states custom Barrier Penetration effects.

Skill, Item, Actor, Class, Enemy, Weapon, Armor, State Notetags:

  --- Rate ---

  <Custom Barrier Penetration Rate>
   rate = target.hpRate();
  </Custom Barrier Penetration Rate>
  The 'rate' variable determines the percentile amount of damage the user
  will bypass for the target's Barrier Points. This is a multiplicative
  bonus and will be applied before any flat bonuses.

  --- Flat ---

  <Custom Barrier Penetration Flat>
   flat = target.level;
  </Custom Barrier Penetration Flat>
  The 'flat' variable determines the flat amount of damage the user will
  bypass for the target's Barrier Points. This is a flat bonus and will be
  applied after all multiplicative bonuses.

Custom Barrier Points on Battle Start
For those with JavaScript proficiency, you can utilize these notetags to
add a dynamic amount of Barrier Points during the start up of a battle.

Actor, Class, Enemy, Weapon, Armor, and State Notetags:

   --- Unexpiring ---

   <Custom Barrier Points>
    value += user.hp;
   </Custom Barrier Points>
   The 'value' variable determines how many Barrier Points the user will
   start a battle with. The Barrier Points added through this notetag are
   unexpiring Barrier Points.

   --- Timed ---

   <Custom Barrier Points x Turns>
    value += user.hp;
   </Custom Barrier Points x Turns>
   The 'value' variable determines how many Barrier Points the user will
   start a battle with but expires after x turns.

Custom Barrier Regeneration
For those with JavaScript proficiency, you can utilize these notetags to
add a dynamic amount of Barrier Points during the user's regeneration phase.

Actor, Class, Enemy, Weapon, Armor, and State Notetags:

   --- Unexpiring ---

   <Custom Barrier Regen>
    value += user.hp / 4;
   </Custom Barrier Regen>
   The 'value' variable determines how many Barrier Points the user will
   gain during the user's regeneration phase. The Barrier Points added with
   this notetag are unexpiring Barrier Points.

   --- Timed ---

   <Custom Barrier Regen x Turns>
    value += user.hp / 4;
   </Custom Barrier Regen x Turns>
   The 'value' variable determines how many Barrier Points the user will
   gain during the user's regeneration phase. The Barrier Points added with
   this notetag will last x turns.

Base Parameter Control

Class Base Parameters


Custom Class Parameters
If your formulas are short and simple, you can use this notetag to cover the
entire formula list for all of the base parameters:

Class Notetag:

  <Custom Class Parameters>
   maxhp = level * 30 + 300;
   maxmp = level * 20 + 150;
   atk = level * 15 + 15;
   def = level * 11 + 16;
   mat = level * 12 + 14;
   mdf = level * 10 + 13;
   agi = level * 14 + 15;
   luk = level * 13 + 12;
   exp = level * 100;
  </Custom Class Parameters>
  The 'maxhp', 'maxmp', 'atk', 'def', 'mat', 'mdf', 'agi', 'luk', and 'exp'.
  variables each refer to their own individual stats. The 'level' variable
  refers to the actor's current level. The formula can be made any way you
  like as long as it returns a legal number.
  * Note: The 'exp' stat here refers to the amount of exp needed to reach
  the next level.

Detailed Custom Parameter Formulas
For those who wish to put a bit more detail in calculating the formula for
each stat, you can use the following notetag setup:

Class Notetags:

  <Custom Param Formula>
   if (this.name() === 'Harold') {
     value = level * 30 + 300;
   } else {
     value = level * 25 + 250;
   }
  </Custom Param Formula>
  Replace 'Param' with 'maxhp', 'maxmp', 'atk', 'def', 'mat', 'mdf', 'agi',
  'luk', or 'exp'. The 'value' variable is the final result that's returned
  to count as the base class parameter. The 'level' variable refers to the
  actor's current level. The formula can be made any way you like as long as
  it returns a legal number.
  * Note: The 'exp' stat here refers to the amount of exp needed to reach
  the next level.

Battle Engine Core

Battle System - ATB


Conditional ATB Speed and Conditional ATB Charge
For those who have a bit of JavaScript experience and would like to have
more unique ways of performing ATB speed and charge changes, you can use the
following notetags:

Skill and Item Notetags:
  <Target ATB Eval>
  speed = x;
  charge = x;
  </Target ATB Eval>
  You can omit speed and/or charge. Whatever you set 'speed' to will change
  the ATB speed of the target. If the target is charging, 'charge' will
  cause the target's charge to change to that value. To make things more
  simple, 'max' will be the full gauge value.

  Here is an example:

  <Target ATB Eval>
  speed = target.hp / target.mhp * max;
  charge = target.hp / target.mhp * max;
  </Target ATB Eval>
  The above code will set the user's current ATB gauge to position equal to
  the target's HP ratio. If the target has 25% HP, the ATB gauge will go to
  25% full for the target.

  --- --- --- --- ---

  <After ATB Eval>
  speed = x;
  </After ATB Eval>
  This is the ATB set after the user has used the skill/item and the custom
  ATB amount you want the user to be at after. 'max' be the value of the
  full gauge value. Whatever you set 'speed', the user's ATB speed value
  will change to that much:

  Here is an example:

  <After ATB Eval>
  speed = user.mp / user.mmp * max;
  </After ATB Eval>
  The above code will set the user's ATB gauge after using the skill/item to
  equal the user's MP ratio. If the user has 25% MP, the ATB gauge will go
  to 25% full for the user.

  --- --- --- --- ---

  <ATB Interrupt Eval>
  interrupt = true;
  </ATB Interrupt Eval>
  This will allow you to set custom conditions for interrupting a target.
  Keep in mind that even though it is a custom condition, it still requires
  the target to be in the charging phase for the interrupt to work. By
  setting 'interrupt = true', the target will be interrupted.

  Here is an example:

  <ATB Interrupt Eval>
  if (user.hp > target.hp) {
     interrupt = true;
  }
  </ATB Interrupt Eval>
  The above code will state that if the user has more HP than the target,
  the target will be interrupted.

Battle System - CTB


Conditional CTB Speed and Conditional CTB Charge
For those who have a bit of JavaScript experience and would like to have
more unique ways of performing CTB speed and charge changes, you can use the
following notetags:

Skill and Item Notetags:
  <Target CTB Speed Eval>
  speed = x;
  charge = x;
  </Target CTB Speed Eval>
  You can omit speed and/or charge. Whatever you set 'speed' to will change
  the CTB speed of the target. If the target is charging, 'charge' will
  cause the target's charge to change to that value. To make things more
  simple, 'max' will be the full gauge value.

  Here is an example:

  <Target CTB Speed Eval>
  speed = target.hp / target.mhp * max;
  charge = target.hp / target.mhp * max;
  </Target CTB Speed Eval>
  The above code will set the user's current CTB gauge to position equal to
  the target's HP ratio. If the target has 25% HP, the CTB gauge will go to
  25% full for the target.

  --- --- --- --- ---

  <Target CTB Order Eval>
  order = x;
  </Target CTB Order Eval>
  Set the 'order' variable to how much you want to alter the target's
  current turn order by. If 'order' is positive, the order will need to wait
  that many more turns before its turn comes up. If 'order' is negative, it
  will will that amount of turns less before the order comes up.

  Here is an example:

  <Target CTB Order Eval>
  if (target.hp > 1000) {
    order = 3;
  } else {
    order = -1;
  }
  </Target CTB Order Eval>
  If the target when attacked has over 1000 HP left, the target will have to
  wait 3 more turns before its turn arrives. If the target has 1000 or less,
  the target actually waits 1 less turn.

  --- --- --- --- ---

  <After CTB Eval>
  speed = x;
  </After CTB Eval>
  This is the CTB set after the user has used the skill/item and the custom
  CTB amount you want the user to be at after. 'max' be the value of the
  full gauge value. Whatever you set 'speed', the user's CTB speed value
  will change to that much:

  Here is an example:

  <After CTB Eval>
  speed = user.mp / user.mmp * max;
  </After CTB Eval>
  The above code will set the user's CTB gauge after using the skill/item to
  equal the user's MP ratio. If the user has 25% MP, the CTB gauge will go
  to 25% full for the user.

Counter Control


Custom Counter Skills
For those with JavaScript proficiency, you can use the following Lunatic
Mode notetags to give a dynamic set of skills granted for counter usage.

Actor, Class, Enemy, Weapon, Armor, and State Notetags:

  <Custom Counter Skills>
   if (user.name() === 'Harold') {
     skills.push(50, 51, 52);
   } else if (user.name() === 'Therese') {
     skills.push(53, 54, 55);
   } else if (user.name() === 'Marsha') {
     skills.push(56, 57, 58);
   } else if (user.name() === 'Lucius') {
     skills.push(59, 60, 61);
   }
  </Custom Counter Skills>
  The 'skills' variable is an array that will contain all the counter skills
  that will be added to the list of potential skills the battler can counter
  actions with provided that their requirements are met.

Custom Counter Total
For those with JavaScript proficiency, you can use the following Lunatic
Mode notetags to give a dynamic counter total bonus:

Actor, Class, Enemy, Weapon, Armor, and State Notetags:

  <Custom Counter Total>
   value = user.level;
  </Custom Counter Total>
  The 'value' variable is the total amount of counters is increased or
  decreased by. If the total counter value reaches 0 or less than 0 for the
  battler, the battler is unable to use counter skills.

Custom Counter Rate
For those with JavaScript proficiency, you can use the following Lunatic
Mode notetags to make the attacker's traits alter the target's CNT rate.

Actor, Class, Enemy, Weapon, Armor, and State Notetags:

  <Custom Target Counter Rate>
   rate -= user.hpRate();
  </Custom Target Counter Rate>
  The 'rate' variable is the final rate used to determine the counter rate
  the target has. It is already given the value calculated from the target's
  CNT value. This is calculated before the skill's custom counter rate.

Custom Counter Rates
For those with JavaScript proficiency, you can use the following Lunatic
Mode notetags to give skills a dynamic chance for the target to counter.

Skill and Item Notetags:

  <Custom Counter Rate>
   rate += target.hpRate();
  </Custom Counter Rate>
  The 'rate' variable is the final rate used to determine the counter rate
  the target has. It is already given the value calculated from the target's
  CNT value plus any additional counter rate modifiers from the skill. This
  is calculated after the attacker's custom target counter rate.

Custom Counter Condition
For those with JavaScript proficiency, you can use the following Luantic
Mode notetags to give counter skills a custom counter condition. While you
can do the same with an Eval condition, this notetag is for those who prefer
to take control over everything at once.

Skill Notetags:

  <Custom Counter Condition>
   if (attacker.name() === 'Harold') {
     condition = true;
   } else if (defender.name() === 'Therese') {
     condition = true;
   } else {
     condition = false;
   }
  </Custom Counter Condition>
  The 'condition' variable determines whether or not the counter skill will
  pass or fail. If the 'condition' variable returns 'true', the condition is
  met. If the 'condition' variable returns 'false', the condition fails to
  be met. Once the condition is met, the rest of the <Counter Condition>
  conditions will be checked.

Lunatic Pack - Action Beginning and End Effects


For experienced users that know JavaScript and have RPG Maker MV 1.5.0+, you
can add new notetag effects that can be used by the plugin or alter the
effects of currently existing notetag effects from the plugin parameters
entry: Effect Code. It should look something like this:

---

// ---------
// Animation
// ---------
if (data.match(/ANIMATION[ ](\d+)/i)) {
  var animationId = parseInt(RegExp.$1);
  var mirror = data.match(/MIRROR/i);
  if (data.match(/DELAY[ ](\d+)/i)) {
    var delay = parseInt(RegExp.$1);
  } else {
    var delay = 0;
  }
  user.startAnimation(animationId, mirror, delay);

...

// -------------------------------
// Add new effects above this line
// -------------------------------
} else {
  skip = true;
}

---

Here's what each of the variables used in this code bit refer to:

  --------------------   ---------------------------------------------------
  Variable:              Refers to:
  --------------------   ---------------------------------------------------
  item                   The item being used by this action
  skill                  The skill being used by this action

  isItem                 Returns true if action is an item
  isSkill                Returns true if action is a skill

  a                      Returns the action user
  user                   Returns the action user
  subject                Returns the action user

  b                      Returns the action's current target
  target                 Returns the action's current target

  s[x]                   Return switch x (true/false)
  v[x]                   Return variable x's current value

  user._result           The current results for the user
  target._result         The current results for the target
  userPreviousResult     The results for the user before any changes
  targetPreviousResult   The results for the target before any changes

  totalHpDamage          The total amount of HP damage dealt this action
  totalMpDamage          The total amount of MP damage dealt this action

  skip                   Default: false. If true, popups

---

If you need to revert the Effect Code back to its original state, delete the
plugin from your plugin manager list and then add it again. The code will be
back to default.

Weak Enemy Poses


For those with JavaScript experience, you can alter the pose used for an
enemy (static only, not animated) using these Lunatic Mode notetags:

Enemy Notetags:

  <Custom Enemy Pose>
   if (user.mpRate() >= 0.50) {
     name = 'Scorpion';
     hue = 180;
   } else {
     name = 'Spider';
   }
  </Custom Enemy Pose>
  - The 'name' variable will refer to the filename used for the battler
  image. The filename is case sensitive and must not include the file
  extension. If the 'hue' variable is used, then that hue will be forced.
  Otherwise, it will use the default hue of the enemy. The hue must be a
  value between 0 and 360.
  * NOTE: This applies only to static enemies and NOT animated enemies.

State Notetags:

  <Custom Enemy Pose>
   if (user.mpRate() >= 0.50) {
     name = 'Scorpion';
     hue = 180;
   } else {
     name = 'Spider';
   }
  </Custom Enemy Pose>
  - When an enemy is afflicted with this state, the enemy would take on the
  'name' image as long as that state is the highest priority state with a
  forced enemy pose. The filename is case sensitive and must not include the
  file extension. If the 'hue' variable is used, then that hue will be
  forced. Otherwise, it will use the default hue of the enemy. The hue must
  be a value between 0 and 360.
  * NOTE: This applies only to static enemies and NOT animated enemies.

For the other variable to use:

  defaultBattlerName
  - This will be the default battler's name.

  defaultBattlerHue
  - This will be the default battler's hue.

Buffs & States Core

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.

Extended Damage Over Time


For those with JavaScript experience and would like to create more complex
formulas for custom damage/healing over time states, you can use these
following notetags below.

State Notetags:

  ---

  <Custom DoT Formula>
   if (a.isActor()) {
     value = a.level * 100;
     variance = 20;
     element = 1;
   } else {
     value = a.hp / 50;
     variance = 10;
     element = 2;
   }
  </Custom DoT Formula>
  - The damage to be dealt will be equal to the 'value'. This is the base
  damage dealt primarily by the formula alone. The finalized damage to be
  dealt will be affected by the 'variance' and 'element' values, which can
  be changed within this formula, too. If 'variance' or 'element' are left
  out of the formula, they will take on their default values. If you are
  going to make a healing effect, use the notetag below this one.

  ---

  <Custom Regen Formula>
   if (a.isActor()) {
     value = a.level * 8;
     variance = 15;
     element = 3;
   } else {
     value = a.hp / 2;
     variance = 5;
     element = 4;
   }
  </Custom Regen Formula>
  - The healing to be dealt will be equal to the 'value'. This is the base
  heal dealt primarily by the formula alone. The finalized healing to be
  dealt will be affected by the 'variance' and 'element' values, which can
  be changed within this formula, too. If 'variance' or 'element' are left
  out of the formula, they will take on their default values. If you are
  going to make a damaging effect, use the notetag above this one.

Lunatic Pack - State Protection


For experienced users that know JavaScript and have RPG Maker MV 1.5.0+, you
can add new notetag effects that can be used by the plugin or alter the
effects of currently existing notetag effects from the plugin parameters
entry: Effect Code. It should look something like this:

---

// ----------------
// Damage Reduction
// ----------------
if (data.match(/DAMAGE CUT[ ](\d+)([%%])/i)) {
  rate = parseFloat(RegExp.$1) * 0.01;
  blocked = originalValue * rate;
  value -= blocked;
  value = Math.max(value, 0);

} else if (data.match(/DAMAGE BLOCK[ ]([\+\-]\d+)/i)) {
  blocked = parseInt(RegExp.$1);
  value -= blocked;
  value = Math.max(value, 0);

...

// -------------------------------
// Add new effects above this line
// -------------------------------
} else {
  skip = true;
}

---

Here's what each of the variables used in this code bit refer to:

  --------------------   ---------------------------------------------------
  Variable:              Refers to:
  --------------------   ---------------------------------------------------
  state                  The state this effect belongs to
  stateId                The state ID this effect belongs to

  value                  The HP/MP damage being affected by this effect. Any
                         changes made to this value will be permanent unless
                         the effect is skipped.

  originalValue          The original HP/MP damage before any of the protect
                         state effects have been applied.

  item                   The item being used by this action
  skill                  The skill being used by this action

  isItem                 Returns true if action is an item
  isSkill                Returns true if action is a skill

  a                      Returns the action user
  user                   Returns the action user
  subject                Returns the action user

  b                      Returns the action's current target
  target                 Returns the action's current target

  s[x]                   Return switch x (true/false)
  v[x]                   Return variable x's current value

  user._result           The current results for the user
  target._result         The current results for the target
  userPreviousResult     The results for the user before any changes
  targetPreviousResult   The results for the target before any changes

  animation              The animation to be played.

  triggered              Returns if any of this state's protection effects
                         have been triggered (true) or not (false)

  skip                   Default: false. If true, skips popups & animations

---

If you need to revert the Effect Code back to its original state, delete the
plugin from your plugin manager list and then add it again. The code will be
back to default.

State Categories


Custom State Category Removal
For those with JavaScript experience and would like to remove a dynamic
number of states of a pertaining category, you can do so with the following
notetags!

Skill and Item Notetags:

  <Custom Remove State Category: text>
   value += user.level;
   value -= target.level;
  </Custom Remove State Category: text>
  The 'value' variable is the amount of states to be removed by the action.
  If there was a <Remove x State Category: text> in the skill/item notebox,
  then the 'value' variable will start off with that amount. If not, the
  'value' variable will start off at 1.

Damage Core

Damage Formula
For those who think the damage formula box is too small and would like to
use the notebox instead to declare the damage formula, you can use the
notetags below:

Skill and Item Notetags:
  <damage formula>
   value = 500;
   value += 2500;
  </damage formula>
  This will overwrite the damage formula found at the top and use the
  strings in the middle as the formula instead. Keep in mind that using
  comments here will cancel out anything following after. New variables can
  be used, too, to make damage calculations a bit easier.

  value   - Refers to the amount that will become the base damage value.
  user    - Refers to the actor/enemy using the skill/item.
  subject - Refers to the actor/enemy using the skill/item.
  target  - Refers to the target actor/enemy on the receiving end of
            the skill/item.

Damage Steps
The damage formula isn't all there is to calculating the damage that appears
at the very end. In this plugin's parameters towards the bottom, you'll see
a large list of Damage Steps. Each one of these steps is a line of code that
the damage count will run through in order to calculate and finalize the
damage output.

The purpose of those parameters is to allow you ease of access on where you
want to insert code that is your own or custom code provided by another
plugin. Here's a quick reference on how the original damage flow looked like:

Game_Action.prototype.makeDamageValue = function(target, critical) {
    var item = this.item();
    var baseDamage = this.evalDamageFormula(target);
    var value = baseDamage * this.calcElementRate(target);
    if (this.isPhysical()) {
        value *= target.pdr;
    }
    if (this.isMagical()) {
        value *= target.mdr;
    }
    if (baseDamage < 0) {
        value *= target.rec;
    }
    if (critical) {
        value = this.applyCritical(value);
    }
    value = this.applyVariance(value, item.damage.variance);
    value = this.applyGuard(value, target);
    value = Math.round(value);
    return value;
};

In the vein of keeping everything organized, the following lines have been
incorporated into new functions:

Formula                               New Function
  value *= target.pdr                   value = this.applyPhysicalRate
  value *= target.mdr                   value = this.applyMagicalRate
  value *= target.rec                   value = this.applyHealRate
  value = this.applyCritical(value)     value = this.applyCriticalRate

Armor Scaling


For those with some JavaScript experience, you can make use of Lunatic Mode
to calculate the way you want armor scaling done for particular skills and
items right within the notebox!

  <Positive Armor Rate>
   value *= 100;
   value /= 100 + armor;
  </Positive Armor Rate>
  This enables you to set a custom positive armor calculation rate for the
  skill/item instead of using the default positive armor rate.

  <Negative Armor Rate>
   value *= 2 - (100 / (100 - armor));
   value *= 1.5;
  </Negative Armor Rate>
  This enables you to set a custom negative armor calculation rate for the
  skill/item instead of using the default positive armor rate.

  <Base Armor>
   armor = target.def;
   armor -= user.atk / 4;
  </Base Armor>
  This enables you to set a custom way for the skill/item to calculate the
  base armor value used for armor scaling.

Message Core

Extended Message Pack 2


For those with JavaScript experience and would like to customize the way the
text codes provided by this plugin behave, you can alter the code used for
each of the text codes within the plugin parameters.

Inside the plugin parameters exist the code used when each text code is
being converted by the in-game message functions. Refer to the variables
displayed in the comments at the top of each code to understand which of the
variables are being used and how they're being used.

By default:

  x
  - Refers to the x variable being inserted into the text code. This can be
  a number or string, depending on the text code.

  y
  - Refers to the y variable being inserted into the text code. This can be
  a number of string, depending on the text code.

  text
  - Refers to the text that will be displayed by the message system. This is
  what will appear as the final result for using the said text code.