Lunatic Pack - Skill Rewards (YEP)

From Yanfly.moe Wiki
Jump to navigation Jump to search


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

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.

Click here if you want to help support Team Yanfly on Patreon.

Introduction

This plugin requires the following plugins:
- Battle Engine Core
- Skill Core

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

This plugin allows you to add a variety of effects to your items and skills
to reward the player for good (or bad) gameplay. Certain effects can only
trigger under specific conditions, such as defeating the target, landing a
critical hit, or striking the target's weakness. After these conditions have
been met, the effects can range from refunding skill costs, adding buffs,
removing debuffs, or even applying states.

*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 and Item Notetags:

  <Reward Animation: x>
  - If there's a reward tied to this skill/item effect and conditions are
  met, this animation will be played in place of the default animations to
  indicate an effect has taken place.

  <condition Reward: effect>
  - Most of this plugin's notetags will follow the above format. 'condition'
  and 'effect' in the notetag will be replaced respectively by entries in
  the following CONDITION and EFFECT sections below. Insert multiple entries
  to give your skills/items multiple effects.

=-=-=-= Reward CONDITIONS =-=-=-=

  <Defeat Reward: effect>
  - Replace 'condition' with 'Defeat' and you'll enable the notetag to take
  effect when the target is defeated (HP reaches 0 or receives death state).

  <Critical Reward: effect>
  - Replace 'condition' with 'Critical' and you'll enable the notetag to
  take effect when the user lands a critical hit on the target.

  <Noncritical Reward: effect>
  - Replace 'condition' with 'Nonnritical' and you'll enable the notetag to
  take effect when the user fails to land a critical hit on the target.

  <Hit Reward: effect>
  - Replace 'condition' with 'Hit' and you'll enable the notetag to take
  effect when the user has successfully hit the target.

  <Missed Reward: effect>
  - Replace 'condition' with 'Missed' and you'll enable the notetag to take
  effect when the user misses the action or the target evades the action.

  <Weakness Reward: effect>
  - Replace 'condition' with 'Weakness' and you'll enable the notetag to
  take effect when the user hits an elemental weakness on the target.

  <Resisted Reward: effect>
  - Replace 'condition' with 'Resisted' and you'll enable the notetag to
  take effect when the user hits an elemental resistance on the target.

  <Nulled Reward: effect>
  - Replace 'condition' with 'Nulled' and you'll enable the notetag to take
  effect when the user hits a nulled element on the target.

  <Absorb Reward: effect>
  - Replace 'condition' with 'Nulled' and you'll enable the notetag to take
  effect when the user hits an absorbed element on the target.

=-=-=-= Reward EFFECTS =-=-=-=

  --- HP Effects ---

  <condition Reward: +x HP>
  - Replace 'effect' with the above format. Replace 'x' with a flat amount
  of HP you wish to reward the user when the skill/item condition is met.
  SUGGESTED BY: Yanfly

  <condition Reward: +x% HP>
  - Replace 'effect' with the above format. Replace 'x' with a HP equal to
  x% of the user's MaxHP to reward the user when the condition is met.
  SUGGESTED BY: Yanfly

  <condition Reward: +x% Refund HP Cost>
  - Replace 'effect' with the above format. Replace 'x' with a percentage of
  the HP cost of the skill used to reward the user if conditions are met.
  *Note: Can only be used with skills.
  SUGGESTED BY: Yanfly

  --- MP Effects ---

  <condition Reward: +x MP>
  - Replace 'effect' with the above format. Replace 'x' with a flat amount
  of MP you wish to reward the user when the skill/item condition is met.
  SUGGESTED BY: Yanfly

  <condition Reward: +x% MP>
  - Replace 'effect' with the above format. Replace 'x' with a MP equal to
  x% of the user's MaxMP to reward the user when the condition is met.
  SUGGESTED BY: Yanfly

  <condition Reward: +x% Refund MP Cost>
  - Replace 'effect' with the above format. Replace 'x' with a percentage of
  the HP cost of the skill used to reward the user if conditions are met.
  *Note: Can only be used with skills.
  SUGGESTED BY: Yanfly

  --- TP Effects ---

  <condition Reward: +x TP>
  - Replace 'effect' with the above format. Replace 'x' with a flat amount
  of TP you wish to reward the user when the skill/item condition is met.
  SUGGESTED BY: Yanfly

  <condition Reward: +x% TP>
  - Replace 'effect' with the above format. Replace 'x' with a TP equal to
  x% of the user's MaxTP to reward the user when the condition is met.
  SUGGESTED BY: Yanfly

  <condition Reward: +x% Refund TP Cost>
  - Replace 'effect' with the above format. Replace 'x' with a percentage of
  the HP cost of the skill used to reward the user if conditions are met.
  *Note: Can only be used with skills.
  SUGGESTED BY: Yanfly

  --- Item Effects ---

  <condition Reward: x% Refund Item>
  - Replace 'effect' with the above format. Replace 'x' with the chance the
  user has to refund the item (getting it back) if conditions are met.

  *Note: Can only be used with items. Best if used with consumable items.
  SUGGESTED BY: Yanfly

  --- Buff/Debuff Effects ---

  <condition Reward: Add x Buff>
  <condition Reward: Add x Buff, y Turns>
  <condition Reward: Add x Debuff>
  <condition Reward: Add x Debuff, y Turns>
  - Replace 'effect' with the above format(s). Replace 'x' with any of the
  following parameters: 'MaxHP', 'MaxMP', 'ATK', 'DEF', 'MAT', 'MDF', 'AGI',
  or 'LUK' to have the effect alter the respective stat. If using the format
  with 'y' turns, replace 'y' with the number of turns you wish for the buff
  or debuff to last. If 'y' is not used, it will last for 5 turns instead.
  SUGGESTED BY: Yanfly

  <condition Reward: Remove x Buff>
  <condition Reward: Remove x Debuff>
  - Replace 'effect' with the above format(s). Replace 'x' with any of the
  following parameters: 'MaxHP', 'MaxMP', 'ATK', 'DEF', 'MAT', 'MDF', 'AGI',
  or 'LUK' to have the effect remove the respective buff/debuff from the
  user if the conditions are met.  If 'y' is not used, it will last for 5
  turns instead.
  SUGGESTED BY: Yanfly

  --- State Effects ---

  <condition Reward: Add State x>
  - Replace 'effect' with the above format(s). Replace 'x' with the state ID
  you wish to add to the user when conditions are met.
  SUGGESTED BY: Yanfly

  <condition Reward: Remove State x>
  - Replace 'effect' with the above format(s). Replace 'x' with the state ID
  you wish to remove from the user when conditions are met.
  SUGGESTED BY: Yanfly

  --- Rolling Critical ---

  <condition Reward: Rolling Critical +x%>
  <condition Reward: Rolling Critical -x%>
  - Replace 'effect' with the above format(s). Replace 'x' with the percent
  increase/decrease for the next usage of the skill. This change will only
  occur for the user if the conditions are met.

  *Note: Can only be used with skills. Turn on critical hits for the skill.
  SUGGESTED BY: Goldschuss

  <condition Reward: Rolling Critical x%>
  - Replace 'effect' with the above format(s). Replace 'x' with the percent
  rate for the next usage of the skill when the conditions are met.

  *Note: Can only be used with skills. Turn on critical hits for the skill.
  SUGGESTED BY: Goldschuss

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

  <Defeat Reward: +50% MP>
  - When the target is defeated by this skill, refunding 50% of the MP the
  user has spent in order to cast the skill.

  <Critical Reward: Add ATK Buff, 8 Turns>
  - When the user lands a critical hit on the enemy, grant the user an ATK
  buff that lasts 8 turns.

  <Hit Reward: Add DEF Buff, 2 Turns>
  - When the user lands a successful hit on the enemy, buff the user's DEF
  for 2 turns.

  <Missed Reward: Refund Item>
  - When the user fails to land using the item, make sure it won't be
  consumed by refunding it.

  <Weakness Reward: +20 TP>
  - If the user performs this skill on an enemy weak to this skill's element
  then grant the user +20 additional TP.

  <Critical Reward: Rolling Critical 0%>
  <Noncritical Reward: Rolling Critical +10%>
  - If the user fails to land a critical hit with this skill, the user will
  have a 10% chance to do so the next time the user performs the skill. The
  critical hit rate will continue to rise by 10% each time until the user
  finally manages to land the critical hit. Once the user does, the critical
  hit rate bonus will reset back to 0%.

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:

---

// ----------
// Flat Gains
// ----------
if (data.match(/([\+\-]\d+)[ ]HP/i)) {
  value = parseInt(RegExp.$1);
  user.gainHp(value);
  animation = animation || hpAnimation;

} else if (data.match(/([\+\-]\d+)[ ]MP/i)) {
  value = parseInt(RegExp.$1);
  user.gainMp(value);
  animation = animation || mpAnimation;

...

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

  animation              The animation to be played. You can set it equal to
                         any of the following which corresponds to plugin
                         parameter settings:
                         - hpAnimation
                         - mpAnimation
                         - tpAnimation
                         - itemAnimation
                         - buffAnimation
                         - debuffAnimation
                         - addStateAnimation
                         - removeStateAnimation
                         - miscAnimation

  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!