Lunatic Pack - State Protection (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
- Buffs & States Core

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

This plugin allows you to add a variety of protection effects to your states
to allow them to reduce HP or MP damage in more unique ways, from cutting
off a percentage of the original damage, blocking off damage entirely once
certain break points are met, capping damage in certain ways, and surviving
fatal damage. And should any of those effects trigger, you can set the state
to perform special effects, too!

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

---

State Notetags:

  <Protection Animation: x>
  - If a protection effect goes off, it will display animation x on the
  protected unit. This animation will be played in place of the default
  animation to indicate the effect has taken place.

  <type Protection: effect>
  - Most of this plugin's notetags will follow the above format. 'type' will
  be replaced with either 'HP', 'MP', or 'Both' to indicate which damage
  types will be protected against. Replace 'effect' with one of the effects
  found below. Insert multiple entries of this notetag to give it multiple
  effects. The order of effects will be played by the order they're inserted
  into the notebox.

=-=-=-= Protection EFFECTS =-=-=-=

  --- Damage Reduction ---

  <type Protection: Damage Cut x%>
  - Replace 'x' with a number. Will reduce damage by x% of the original
  damage value and not the current value.
  SUGGESTED BY: Yanfly

  <type Protection: Damage Block -x>
  <type Protection: Damage Block +x>
  - Replace 'x' with a flat value you wish to block (or increase) damage by.
  This is a flat change to the damage final value.
  SUGGESTED BY: Yanfly

  --- Damage Nullifiers ---

  <type Protection: Damage Null x%>
  - Replace 'x' with the percentage value of the target's MaxHP/MaxMP you
  wish to set as the break point. If the damage value is less than or equal
  to the break point, damage will be nullified and set to zero.
  SUGGESTED BY: Yanfly

  <type Protection: Damage Barrier x%>
  - Replace 'x' with the percentage value of the target's MaxHP/MaxMP you
  wish to set as the break point. If the damage value is less than or
  equal to the break point, damage will be nullified and set to zero.
  SUGGESTED BY: Yanfly

  --- Damage Cappers ---

  <type Protection: Damage Ceiling x%>
  - Replace 'x' with the percentage value of the target's MaxHP/MaxMP you
  wish to set as the break point. If the current damage value is above the
  break point, the damage value will become the break point.
  SUGGESTED BY: Yanfly

  <type Protection: Damage Floor x%>
  - Replace 'x' with the percentage value of the target's MaxHP/MaxMP you
  wish to set as the break point. If the current damage value is below the
  break point, the damage value will become the break point.
  SUGGESTED BY: Yanfly

  --- Death Cheaters ---

  <HP Protection: Guts x%>
  - Works only with HP type. Replace 'x' with the success rate percentage
  you wish to give this effect. If the affected target were to receive fatal
  damage as a result of this attack, there would be a x% chance the target
  would be able to survive with 1 HP left. This will not trigger if the
  target has exactly 1 HP left.
  SUGGESTED BY: Yanfly

  <HP Protection: True Guts x%>
  - Works only with HP type. Replace 'x' with the success rate percentage
  you wish to give this effect. If the affected target were to receive fatal
  damage as a result of this attack, there would be a x% chance the target
  would be able to survive with 1 HP left. Unlike the regular guts, this
  remain in effect even if the user is at exactly 1 HP left.
  SUGGESTED BY: Joshua Pactor

  <HP Protection: Fatal Damage Absorbx %>
  - Works only with HP type. Replace 'x' with the success rate percentage
  you wish to give this effect. If the affected target were to receive fatal
  damage as a result of this attack, the target would receive the damage as
  recovered health instead.
  SUGGESTED BY: Shaun Pattenden

  --- Triggers ---

  <type Protection: Trigger Removal x%>
  - If any of this state's protection effects have been triggered/activated,
  then remove this state as a result of the effect happening. Replace 'x'
  with the success rate you wish for this effect to occur.
  SUGGESTED BY: Yanfly

  <type Protection: Trigger Add x Buff>
  <type Protection: Trigger Add x Buff, y Turns>
  <type Protection: Trigger Add x Debuff>
  <type Protection: Trigger Add x Debuff, y Turns>
  - If any of this state's protection effects have been triggered/activated,
  then add a buff/debuff for parameter 'x'. Replace 'x' with 'MaxHP',
  'MaxMP', 'ATK', 'DEF', 'MAT', 'MDF', 'AGI', or 'LUK'. You can replace 'y'
  with the number of turns the buff/debuff will last. If you do not use the
  notetag variant with the turn count, then it will default to 5 turns.
  SUGGESTED BY: Yanfly

  <type Protection: Trigger Remove x Buff>
  <type Protection: Trigger Remove x Debuff>
  - If any of this state's protection effects have been triggered/activated,
  then remove a buff/debuff for parameter 'x'. Replace 'x' with 'MaxHP',
  'MaxMP', 'ATK', 'DEF', 'MAT', 'MDF', 'AGI', or 'LUK'.
  SUGGESTED BY: Yanfly

  <type Protection: Trigger Add State x>
  - If any of this state's protection effects have been triggered/activated,
  then add state 'x' onto the target. Replace 'x' with the state ID you wish
  to apply to the target.
  SUGGESTED BY: Yanfly

  <type Protection: Trigger Remove State x>
  - If any of this state's protection effects have been triggered/activated,
  then remove state 'x' onto the target. Replace 'x' with the state ID you
  wish to remove from the target.
  SUGGESTED BY: Yanfly

=-=-=-= Examples =-=-=-=

  <HP Protection: Damage Cut 70%>
  - This will reduce incoming HP damage for the affected unit by 70% meaning
  only 30% of the damage will go through.

  <HP Protection: Damage Block -500>
  <HP Protection: Damage Null 20%>
  - This will reduce incoming HP damage for the affected unit by a flat 500
  first. If the damage is less than 20% of the unit's MaxHP, then it will be
  nullified completely.

  <MP Protection: Damage Barrier 20%>
  - If the affected unit receives MP damage and the MP damage is more than
  20% of the unit's MaxMP, nullify that damage completely.

  <HP Protection: Damage Ceiling 30%>
  - If the affected unit receives HP damage and the HP damage is more than
  30% of the unit's MaxHP, then the damage will be reduced to equal 30% of
  the unit's MaxHP.

  <HP Protection: Guts 100%>
  <HP Protection: Trigger Removal 100%>
  - If the affected unit receives HP damage that would be fatal, the damage
  is reduced until the unit would be left with 1 HP left. At that point, the
  state that gives the Guts effect will be removed.

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:

---

// ----------------
// 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.

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!