Difference between revisions of "Damage Core (YEP)"

From Yanfly.moe Wiki
Jump to navigation Jump to search
(Created page with "{{MvPlugin |preview=<youtube>https://www.youtube.com/watch?v=wIvAoxFDaw0</youtube> |link1=<html><iframe src="https://itch.io/embed/398324" height="167" width="552" frameborder...")
 
Line 1: Line 1:
 
{{MvPlugin
 
{{MvPlugin
|preview=<youtube>https://www.youtube.com/watch?v=wIvAoxFDaw0</youtube>
+
|preview = <youtube>https://www.youtube.com/watch?v=wIvAoxFDaw0</youtube>
|link1=<html><iframe src="https://itch.io/embed/398324" height="167" width="552" frameborder="0"></iframe></html>
+
|link1 = <html><iframe src="https://itch.io/embed/398324" height="167" width="552" frameborder="0"></iframe></html>
|link2=[http://yanfly.moe/plugins/en/YEP_DamageCore.js Mirror]
+
|link2 = [http://yanfly.moe/plugins/en/YEP_DamageCore.js Mirror]
  
 
}}
 
}}
Line 14: Line 14:
 
{{Yanfly Engine Plugins}}
 
{{Yanfly Engine Plugins}}
  
== Help File ==
+
== Introduction ==
  
 
  <nowiki>
 
  <nowiki>
============================================================================
 
Introduction
 
============================================================================
 
 
 
The game gives a lot of control over the damage formula, but it doesn't give
 
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
 
much control for everything else after calculating it. This plugin will give
Line 29: Line 25:
 
YEP_BattleEngineCore.js if you wish to make use of the extra features this
 
YEP_BattleEngineCore.js if you wish to make use of the extra features this
 
plugin has to offer.
 
plugin has to offer.
 +
</nowiki>
  
============================================================================
+
== Notetags ==
Notetags
 
============================================================================
 
  
 +
<nowiki>
 
The following are some notetags you can use to modify the damage caps.
 
The following are some notetags you can use to modify the damage caps.
  
Line 56: Line 52:
 
   brings the damage cap to 999,999, then the battler's damage cap will be
 
   brings the damage cap to 999,999, then the battler's damage cap will be
 
   the highest value of 999,999.
 
   the highest value of 999,999.
 +
</nowiki>
  
============================================================================
+
== Plugin Commands ==
Plugin Commands
 
============================================================================
 
  
 +
<nowiki>
 
The following are plugins you can use to set the damage cap rulings for your
 
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
 
game. Keep in mind that individual aspects such as equipment traits, skill
Line 70: Line 66:
 
   EnableDamageCap      Enables default cap for both damage and healing.
 
   EnableDamageCap      Enables default cap for both damage and healing.
 
   DisableDamageCap      Disables default cap for both damage and healing.
 
   DisableDamageCap      Disables default cap for both damage and healing.
 +
</nowiki>
  
============================================================================
+
== Lunatic Mode - Damage Formula ==
Lunatic Mode - Damage Formula
 
============================================================================
 
  
 +
<nowiki>
 
For those who think the damage formula box is too small and would like to
 
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
 
use the notebox instead to declare the damage formula, you can use the
Line 94: Line 90:
 
   target  - Refers to the target actor/enemy on the receiving end of
 
   target  - Refers to the target actor/enemy on the receiving end of
 
             the skill/item.
 
             the skill/item.
 +
</nowiki>
  
============================================================================
+
== Lunatic Mode - Damage Steps ==
Lunatic Mode - Damage Steps
 
============================================================================
 
  
 +
<nowiki>
 
The damage formula isn't all there is to calculating the damage that appears
 
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
 
at the very end. In this plugin's parameters towards the bottom, you'll see
Line 139: Line 135:
 
   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>
  
============================================================================
+
== Yanfly Engine Plugins - Battle Engine Extension - Action Sequence Commands ==
Yanfly Engine Plugins - Battle Engine Extension - Action Sequence Commands
 
============================================================================
 
  
 +
<nowiki>
 
If you have YEP_BattleEngineCore.js installed with this plugin located
 
If you have YEP_BattleEngineCore.js installed with this plugin located
 
underneath it in the Plugin Manager, you can make use of these extra
 
underneath it in the Plugin Manager, you can make use of these extra
Line 272: Line 268:
 
Usage Example: reset damage modifiers
 
Usage Example: reset damage modifiers
 
=============================================================================
 
=============================================================================
 +
</nowiki>
  
============================================================================
+
== Changelog ==
Changelog
 
============================================================================
 
  
 +
<nowiki>
 
Version 1.08:
 
Version 1.08:
 
- Bypass the isDevToolsOpen() error when bad code is inserted into a script
 
- Bypass the isDevToolsOpen() error when bad code is inserted into a script

Revision as of 00:47, 22 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.



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

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.


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

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

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

Lunatic Mode - 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

Yanfly Engine Plugins - Battle Engine Extension - Action Sequence Commands

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

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!