Damage Core (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

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.

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

Introduction

The game gives a lot of control over the damage formula, but it doesn't give
much control for everything else after calculating it. This plugin will give
you control over the order the damage formula is calculated in addition to
letting you insert your own changes to it at whatever you wish.

If you have YEP_BattleEngineCore.js installed, place this plugin under
YEP_BattleEngineCore.js if you wish to make use of the extra features this
plugin has to offer.

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 some notetags you can use to modify the damage caps.

Skill and Item Notetag:
  <Bypass Damage Cap>
  This causes the skill/item to ignore the damage cap and go with the
  regular value of the calculated damage. This will cancel out any damage
  cap effects otherwise. This will take priority over any damage cap
  breaking effects.

Actor, Class, Enemy, Weapon, Armor, and State Notetags:
  <Bypass Damage Cap>
  This will cause the related battler to bypass any damage capping effects
  and its skills/items will go with the uncapped calculated value.

  <Damage Cap: x>
  <Heal Cap: x>
  This will set the skill to have a damage/healing cap of x. This will
  cancel out any damage cap bypassers. If a battler has more than one
  damage cap, it will go with the highest value. This means if an actor that
  has a weapon that brings the damage cap to 99,999 and an accessory that
  brings the damage cap to 999,999, then the battler's damage cap will be
  the highest value of 999,999.

Plugin Commands

PluginCommandsMV.png

Plugin Commands are event commands that are used to call upon functions added by a plugin that aren't inherently a part of RPG Maker MV.

Here is a list of Plugin Command(s) that you may use:

The following are plugins you can use to set the damage cap rulings for your
game. Keep in mind that individual aspects such as equipment traits, skill
properties, etc. will take priority over these default caps.

Plugin Command:
  SetDamageCap 9999     Sets the default damage cap to 9999.
  SetHealingCap 9999    Sets the default healing cap to 9999.
  EnableDamageCap       Enables default cap for both damage and healing.
  DisableDamageCap      Disables default cap for both damage and healing.

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.

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

Action Sequences

These are action sequences that you can use with this plugin. Action Sequences will require Yanfly's Battle Engine Core to work.

Action Sequences - ala Melody

Battle Engine Core includes Yanfly Engine Melody's Battle Engine system, where each individual aspect of the skill and item effects can be controlled to a degree. These are called Action Sequences, where each command in the action sequence causes the game to perform a distinct individual action.

Each skill and item consists of five different action sequences. They are as follows:

1. Setup Actions
They prepare the active battler before carrying out the bulk of the action

and its individual effects. Usually what you see here are things such as the active battler moving forward a bit, unsheathing their weapon, etc. This step will occur before the active battler expends their skill or item costs.

2. Whole Actions
These actions will affect all of the targets simultaneously. Although this

section does not need to be used, most actions will use this for displaying animations upon all enemies. This step occurs after skill and item costs.

3. Target Actions
This section will affect all of the targets individually. Used primarily

for physical attacks that will deliver more personal forms of damage. Actions that occur here will not affect other targets unless specifically ordered to do so otherwise.

4. Follow Actions
This section will dedicate towards cleanup work after the individual

targeting actions. Here, it'll do things such as removing immortal flags, start up common events, and more.

5. Finish Actions
This section will have the active battler close up the action sequence.

Usually stuff like running waits and holds at the last minute for skills and items, moving back to place, and others.

Now that you know each of the five steps each action sequence goes through, here's the tags you can insert inside of skills and items. Pay attention to each tag name.

1. <setup action>
    action list
    action list
   </setup action>

2. <whole action>
    action list  
    action list  
   </whole action>

3. <target action>
    action list
    action list
   </target action>

4. <follow action>
    action list
    action list
   </follow action>

5. <finish action>
    action list
    action list
   </finish action>

They will do their own respective action sets. The methods to insert for the action list can be found below in the core of the Help Manual.

Furthermore, to prevent overflooding every single one of your database item's noteboxes with action sequence lists, there's a shortcut you can take to copy all of the setup actions, whole actions, target actions, follow actions, and finish actions with just one line.

<action copy: x:y>

Replace x with "item" or "skill" to set the type for the action list code to directly copy. The integer y is then the ID assigned for that particular object type. For example, to copy 45th skill's action sequences, the code would be <action copy: skill:45> for anything that will accept these action codes. If you do use this notetag, it will take priority over any custom that you've placed in the notebox.

Target Typing

You may notice that in some of the actions below will say "refer to target typing" which is this section right here. Here's a quick run down on the various targets you may select.

user This will select the active battler.
target, targets These will select the active targets in question.
actors, existing actors These will select all living actors.
all actors This will select all actors including dead ones.
dead actors This will select only dead actors.
actors not user This will select all living actors except for the user.
actor x This will select the actor in slot x.
character x This will select the specific character with actor ID x.
enemies, existing enemies This will select all living enemies.
all enemies This will select all enemies, even dead.
dead enemies This will select only dead enemies.
enemies not user This will select all enemies except for the user.
enemy x This will select the enemy in slot x.
friends This will select the battler's alive allies.
all friends This will select the all of battler's allies, even dead.
dead friends This will select the battler's dead allies.
friends not user This will select the battler's allies except itself.
friend x This will select the battler's ally in slot x.
opponents This will select the battler's alive opponents.
all opponents This will select the all of the battler's opponents.
dead opponents This will select the battler's dead opponents.
opponent x This will select the battler's opponent in slot x.
all alive Selects all living actors and enemies.
all members Selects all living and dead actors and enemies.
all dead Selects all dead actors and enemies.
all not user This will select all living battlers except user.
focus Selects the active battler and its targets.
not focus Selects everything but the active battler and its targets.
prev target Requires Action Sequence Impact.

During <Target Actions>, this will get the previous target in the targets list.

next target Requires Action Sequence Impact.

During <Target Actions>, this will get the next target in the targets list.

$UnisonMemberX Requires Unison Attack.

Replace X with the Unison Attack participant where X is slot used based on the <Unison Skill: x, y, z> notetag.

$UnisonMembers Requires Unison Attack.

Returns all of the participating Unison Skill members.

Action Sequence List

The following is a list of Action Sequences provided by this plugin.

If you have YEP_BattleEngineCore.js installed with this plugin located
underneath it in the Plugin Manager, you can make use of these extra
damage related action sequences.

=============================================================================
BYPASS DAMAGE CAP
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
This will override all damage caps. This is applied to healing, too.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Usage Example: bypass damage cap
=============================================================================

=============================================================================
DAMAGE CAP: x
HEALING CAP: x
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
This sets the action's damage cap to x, overriding all over damage caps in
play except its own. This will also apply to healing, too.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Usage Example: damage cap: 999
               healing cap: 999999
=============================================================================

=============================================================================
DAMAGE RATE: x%
DAMAGE RATE: x.y
DAMAGE RATE: VARIABLE x
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
This changes the damage rate across all types of damage (physical, magical,
and certain hit). The damage rate is reset at the end of each action
sequence. If you use a variable, it is treated as a percentage.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Usage Example: damage rate: 50%
               damage rate: 8.667
               damage rate: variable 3
=============================================================================

=============================================================================
FLAT DAMAGE: +x
FLAT DAMAGE: -x
FLAT DAMAGE: VARIABLE x
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
This adds a flat damage across all types of damage (physical, magical, and
certain hit). The flat damage is reset at the end of each action sequence.
If you use a variable, it is added onto the damage.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Usage Example: flat damage: +100
               flat damage: -250
               flat damage: variable 3
=============================================================================

=============================================================================
FLAT GLOBAL: +x
FLAT GLOBAL: -x
FLAT GLOBAL: VARIABLE x
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
This adds a flat global damage and heal across all types of damage
(physical, magical, and certain hit). The flat damage and heal is reset at
the end of each action sequence. If you use a variable, it is added onto the
damage and heal.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Usage Example: flat global: +100
               flat global: -250
               flat global: variable 3
=============================================================================

=============================================================================
FLAT HEAL: +x
FLAT HEAL: -x
FLAT HEAL: VARIABLE x
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
This adds a flat heal across all types of damage (physical, magical, and
certain hit). The flat heal is reset at the end of each action sequence.
If you use a variable, it is added onto the heal.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Usage Example: flat heal: +100
               flat heal: -250
               flat heal: variable 3
=============================================================================

=============================================================================
GLOBAL RATE: x%
GLOBAL RATE: x.y
GLOBAL RATE: VARIABLE x
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
This changes the damage and healing rates across all types of damage
(physical, magical, and certain hit). The damage and healing rates are reset
at the end of each action sequence. If you use a variable, it is treated as
a percentage.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Usage Example: global rate: 50%
               global rate: 8.667
               global rate: variable 3
=============================================================================

=============================================================================
HEAL RATE: x%
HEAL RATE: x.y
HEAL RATE: VARIABLE x
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
This changes the healing rate across all types of damage (physical, magical,
and certain hit). The healing rate is reset at the end of each action
sequence. If you use a variable, it is treated as a percentage.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Usage Example: heal rate: 50%
               heal rate: 8.667
               heal rate: variable 3
=============================================================================

=============================================================================
RESET DAMAGE CAP
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
This will reset the damage cap implemented by the Damage Cap action
sequence. This will also reset the effects of the Bypass Damage Cap
action sequence.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Usage Example: reset damage cap
=============================================================================

=============================================================================
RESET DAMAGE MODIFIERS
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
This will cause all damage and healing modifiers caused by action sequences
to reset. While they normally reset at the end of each action sequence, this
will allow you to do it manually.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Usage Example: reset damage modifiers
=============================================================================

Tips & Tricks

The following Tips & Tricks effects use this plugin:

Changelog

Version 1.08:
- 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.07:
- Updated for RPG Maker MV version 1.5.0.

Version 1.06:
- Lunatic Mode fail safes added.

Version 1.05:
- Added failsafe for damage cap check in case Lunatic Mode effects of other
plugins would push the damage past the capped amount.

Version 1.04:
- Rewored Damage Steps 1 through 8. If you're updating from an old version,
please update the these manually:
  Step 1: baseDamage = this.modifyBaseDamage(value, baseDamage, target);
  Step 2: baseDamage *= this.calcElementRate(target);
  Steps 3 through 5: (empty)
  Step 6: critical = this.modifyCritical(critical, baseDamage, target);
  Step 7: target.result().critical = critical;
  Step 8: value = baseDamage;
- This change was made to Element Absorb and Disperse Damage better. This
damage step change is also more efficient in calculating damage effects that
alters the baseDamage.

Version 1.03:
- Changed default parameter in Damage Step 4 from
  'baseDamage = this.modifyBaseDamage(value, baseDamage, target);' to
  'value = this.modifyBaseDamage(value, baseDamage, target);'
Be sure to manually change this yourself if you want to get things like the
Selection Control's Disperse Damage mechanic to work.

Version 1.02:
- Updated for RPG Maker MV version 1.1.0.
- <Damage Formula> notetag now supports comments.

Version 1.01:
- Fixed a bug with <Damage Formula> not recording custom formulas correctly.

Version 1.00:
- Finished plugin!