Lunatic Pack - Critical Sway (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.



Download

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.


Masterarbeit Writer

Required Plugins

The following plugins are required in order to use this plugin.

Place the following plugins above this plugin located in the Plugin Manager.

Yanfly Engine Plugins

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


Introduction

This plugin requires the following plugins:
- Battle Engine Core
- Damage Core
- Critical Control

Place this plugin beneath the above listed plugins in the plugin manager.

Ever wanted to have a bit more variety in how critical hits are determined
in your game? This plugin gives you the ability to sway the critical hit
rate of skills, items, and states in your game! Users affected by it can
have their actions result in criticals based off their own HP values or the
enemy's! Or perhaps the idea of linking the critical hit rate to the element
rate of the action, too? You can also alter the critical hit rate based off
the number of states, buffs, or debuffs on either the user or the target!

*NOTE*: This plugin is best used with RPG Maker MV version 1.5.0+. You can
still use this plugin with a lower version number, but you will have a much
harder time altering the plugin parameters without it.

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.

---

Insert the following notetags into a skill or item's notebox to give it one
of these effects:

---

Skill, Item, State Notetags:

  <Custom Critical Rate: effect>
  - Most of this plugin's notetags will follow the above format. Replace
  'effect' with one of the following entries from the EFFECT section below.
  Insert multiple entries to give your skills/items/states multiple effects.
  If there are multiple effects that modify the critical hit rate, they will
  go in the order of the skill/item first, then in priority order for the
  user's states. Multiple entries of the same notetag effect can stack with
  one another unless mentioned otherwise.

  <Custom Critical Rate: effect, nonstackable>
  - Using the above notetag format and sticking on 'nonstackable' at the end
  of the effect will make it nonstackable with other modifiers of the same
  type. As a result, only the first entry of a similar effect will go
  through regardless of whether or not the effect is stronger or weaker.
  It will go through in the order of skill/item first, then in priority
  order for the user's states. Not all effects can become nonstackable.
  Effects listed below will suggest if they can become nonstackable.

=-=-=-= Effect CONDITIONS =-=-=-=

  --- User Param Rate ---

  <Custom Critical Rate: x Pride y%>
  <Custom Critical Rate: x Pride y%, nonstackable>
  - Replace 'x' with 'HP', 'MP', or 'TP'. This will use the attacker's
  current HP, MP, or TP rate as a critical hit rate modifier. Replace 'y'
  with a percentage value on how much you'd want this modifier to matter.
  The higher the attacker's HP, MP, or TP rate, the higher the modifier.
  SUGGESTED BY: Yanfly

  <Custom Critical Rate: x Crisis y%>
  <Custom Critical Rate: x Crisis y%, nonstackable>
  - Replace 'x' with 'HP', 'MP', or 'TP'. This will use the attacker's
  current HP, MP, or TP rate as a critical hit rate modifier. Replace 'y'
  with a percentage value on how much you'd want this modifier to matter.
  The higher the attacker's HP, MP, or TP rate, the higher the modifier.
  SUGGESTED BY: Yanfly

  --- Target Param Rate ---

  <Custom Critical Rate: x Hero y%>
  <Custom Critical Rate: x Hero y%, nonstackable>
  - Replace 'x' with 'HP', 'MP', or 'TP'. This will use the defender's
  current HP, MP, or TP rate as a critical hit rate modifier. Replace 'y'
  with a percentage value on how much you'd want this modifier to matter.
  The higher the defender's HP, MP, or TP rate, the higher the modifier.
  SUGGESTED BY: Yanfly

  <Custom Critical Rate: x Bully y%>
  <Custom Critical Rate: x Bully y%, nonstackable>
  - Replace 'x' with 'HP', 'MP', or 'TP'. This will use the defender's
  current HP, MP, or TP rate as a critical hit rate modifier. Replace 'y'
  with a percentage value on how much you'd want this modifier to matter.
  The higher the defender's HP, MP, or TP rate, the higher the modifier.
  SUGGESTED BY: Yanfly

  --- Element Rate ---

  <Custom Critical Rate: Element Rate x%>
  <Custom Critical Rate: Element Rate x%, nonstackable>
  - If the current action has an element attached to it, this effect will
  adjust the critical hit rate based off the target's damage rate against
  the action's element. Replace 'x' with a percentage value of how much you
  want the element rate to influence the critical hit rate.
  SUGGESTED BY: Yanfly

  --- State Modifiers ---

  <Custom Critical Rate: User States +x%>
  <Custom Critical Rate: User States -x%>
  <Custom Critical Rate: User States +x%, nonstackable>
  <Custom Critical Rate: User States -x%, nonstackable>
  - Alters the critical rate for the current action based off the number of
  states the user has. The amount altered will be determined by the percent
  'x' to increase/decrease the current critical hit rate per state.
  SUGGESTED BY: Yanfly

  <Custom Critical Rate: Target States +x%>
  <Custom Critical Rate: Target States -x%>
  <Custom Critical Rate: Target States +x%, nonstackable>
  <Custom Critical Rate: Target States -x%, nonstackable>
  - Alters the critical rate for the current action based off the number of
  states the target has. The amount altered will be determined by the
  percent 'x' to increase/decrease the current critical hit rate per state.
  SUGGESTED BY: Yanfly

  --- Buff Modifiers ---

  <Custom Critical Rate: User Buffs +x%>
  <Custom Critical Rate: User Buffs -x%>
  <Custom Critical Rate: User Buffs +x%, nonstackable>
  <Custom Critical Rate: User Buffs -x%, nonstackable>
  - Alters the critical rate for the current action based off the number of
  buff types the user has. The amount altered will be determined by the
  percent 'x' to increase/decrease the current critical hit rate per buff
  type. This does not include the stacks per buff.
  SUGGESTED BY: Yanfly

  <Custom Critical Rate: Target States +x%>
  <Custom Critical Rate: Target States -x%>
  <Custom Critical Rate: Target States +x%, nonstackable>
  <Custom Critical Rate: Target States -x%, nonstackable>
  - Alters the critical rate for the current action based off the number of
  buff types the target has. The amount altered will be determined by the
  percent 'x' to increase/decrease the current critical hit rate per buff
  type. This does not include the stacks per buff.
  SUGGESTED BY: Yanfly

  --- Debuff Modifiers ---

  <Custom Critical Rate: User Buffs +x%>
  <Custom Critical Rate: User Buffs -x%>
  <Custom Critical Rate: User Buffs +x%, nonstackable>
  <Custom Critical Rate: User Buffs -x%, nonstackable>
  - Alters the critical rate for the current action based off the number of
  debuff types the user has. The amount altered will be determined by the
  percent 'x' to increase/decrease the current critical hit rate per debuff
  type. This does not include the stacks per debuff.
  SUGGESTED BY: Yanfly

  <Custom Critical Rate: Target States +x%>
  <Custom Critical Rate: Target States -x%>
  <Custom Critical Rate: Target States +x%, nonstackable>
  <Custom Critical Rate: Target States -x%, nonstackable>
  - Alters the critical rate for the current action based off the number of
  debuff types the target has. The amount altered will be determined by the
  percent 'x' to increase/decrease the current critical hit rate per debuff
  type. This does not include the stacks per debuff.
  SUGGESTED BY: Yanfly

=-=-=-= Effect EXAMPLES =-=-=-=

  <Custom Critical Rate: TP Pride 50%>
  - This will raise the user's critical hit rate relative to the user's
  current TP rate up to 50% (every 1 TP will add 0.5% critical hit rate).

  <Custom Critical Rate: HP Crisis 200%>
  <Custom Critical Rate: HP Hero 50%>
  - This will raise the user's critical hit rate based off how low the
  user's current HP is and how high the target's current HP is. For every
  1% HP the user is missing, the critical hit rate will increase by 2% and
  for every 1% HP the target has, the critical hit rate will also increase
  by 0.5%.

  <Custom Critical Rate: Element Rate 100%>
  - This will alter the user's critical hit rate against the target if the
  current action is elemental. If the target is 200% weak to the element,
  then the critical hit rate will also be increased by 200%. If the target
  is 50% resistant against the element, then the critical hit rate will also
  be adjusted to be 50% lower.

  <Custom Critical Rate: Target States +5%>
  - This will raise the user's critical hit rate by 5% for every state the
  target is affected by.

  <Custom Critical Rate: User Buffs +3%>
  <Custom Critical Rate: Target Debuffs +6%>
  - This will raise the user's critical hit rate by 3% for every buff the
  user has and by 6% for every debuff the target has.

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.

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:

---

// ---------------
// User Param Rate
// ---------------
if (data.match(/(.*)[ ]PRIDE[ ](\d+)([%%])/i)) {
  var param = String(RegExp.$1).toUpperCase();
  var modifier = parseFloat(RegExp.$2) * 0.01;
  if (param === 'HP') {
    var paramRate = user.hpRate();
    if (nonstack) {
      stackCheck = this._stackHpPride;
      this._stackHpPride = true;
    }
  } else if (param === 'MP') {
    var paramRate = user.mpRate();
    if (nonstack) {
      stackCheck = this._stackMpPride;
      this._stackMpPride = true;
    }
  } else if (param === 'TP') {
    var paramRate = user.tpRate();
    if (nonstack) {
      stackCheck = this._stackTpPride;
      this._stackTpPride = true;
    }
  } else {
    skip = true;
  }
  rate += paramRate * modifier;

...

// -------------------------------
// 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:
  --------------------   ---------------------------------------------------
  rate                   The current critical hit rate to be returned

  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

  nonstack               Returns if effect's nonstacking or not (true/false)
  stackCheck             If true, it will autoskip the current effect

  skip                   Default: false. If true, returns the previous rate

---

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.

Changelog

Version 1.01:
- 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.00:
- Finished Plugin!