バトラーが吸収バリアで囲むことができるプラグイン – YEP_AbsorptionBarrier.js

タイトル
Battlers can be surrounded by an absorption barrierthat would mitigate damage dealt to HP.
作者名
ヘルプ
============================================================================
Introduction
============================================================================

The Absorption Barrier is a new mechanic added for battle. Barrier Points, a
new type of stat, provide a layer of protection for battlers. Any direct
damage that would normally be done to HP would be dealt to the battler's
Barrier Points first, mitigating any real damage dealt to the battler.
Any remaining damage is then dealt to the battler.

There are various mechanics to exploit via this mechanic such as unexpiring
barriers, expiring barriers, barrier penetration, barrier bypassing, etc.
Read about it more in the next section~

============================================================================
Barrier Points - Explanation
============================================================================

Barrier Points are a buffer placed on top of a battler's HP. Any direct form
of damage from skills or items will be dealt to the battler's Barrier Points
first before being dealt to the battler's HP. Let's see how the mechanics
work in the following examples:

--- Example 1 ----

For example, let's assume the target has 100 Barrier Points. 150 damage is
to be dealt to the target's HP through a skill or item.

150 DMG vs 100 Barrier Points: 50 DMG goes through

As a result, the target's Barrier Points are reduced to 0 and the target's
HP will suffer only 50 DMG.

--- Example 2---

The target has 100 Barrier Points. 50 damage is to be dealt to the target's
HP through a skill or item.

50 DMG vs 100 Barrier Points: 0 DMG goes through

As a result, the target's Barrier Points are reduced to 50 and no damage
goes through to the user's HP.

============================================================================
Barrier Penetration - Explanation
============================================================================

Some skills and items can possess a unique trait called Barrier Penetration.
Barrier Penetration allows a percentile or flat amount of the damage to go
through and ignore the target's absorption barrier. The more Barrier
Penetration on an action, the more of the target's Barrier Points are
ignored.

--- Example ---

The target has 500 Barrier Points. 100 damage is to be dealt to the target's
HP through a skill or item. The attacker has 75% Barrier Penetration.

100 DMG vs 500 Barrier Points: 75 DMG goes through

As a result, 75% of the damage will go through, meaning exactly 75 damage is
dealt to the target's HP. However, 25% of it gets absorbed by the target's
Barrier Points reducing the Barrier Points to 475 total.

============================================================================
Unexpiring Barriers vs Timed Barriers - Explanation
============================================================================

There are two types of Absorption Barriers: Unexpiring Barriers and Timed
Barriers. Unexpiring Barriers do not expire during the course of battle. The
Barrier Points they acquire, if left untouched, will remain that value. On
the other hand, Timed Barriers will last a certain amount of turns. When the
turns reach 0 during the Regeneration Phase for the user, the Barrier Points
are then stripped away.

--- Example ---

Turn 1 - 100 Barrier Points
Turn 2 - 200 Barrier Points
Turn 3 - 300 Barrier Points

Right now, the user has 600 Barrier Points total. After the Regeneration
Phase, it will become this:

Turn 1 - 200 Barrier Points
Turn 2 - 300 Barrier Points

And the user will have 500 Barrier Points total.

---

So, when damage is dealt, how do the Barrier Points absorb it? Damage is
always dealt to the lowest turn, then the next lowest, etc. until it reaches
the highest. After the highest, damage will then be dealt to Unexpiring
Barrier Points. For example:

--- Example ---

Turn 1 - 100 Barrier Points
Turn 2 - 200 Barrier Points
Unexpiring - 300 Barrier Points

Now, let's suppose 500 damage will be dealt. It will result in this:

Turn 1 - 0 Barrier Points
Turn 2 - 0 Barrier Points
Unexpiring - 100 Barrier Points

============================================================================
Notetags
============================================================================

Use the following notetags to alter the various mechanics of Barrier Points.

Skill and Item Notetags:

<User Barrier: +x>
<Target Barrier: +x>
This adjusts the Barrier Points for user or the target respectively by +x.
The Barrier Points altered for this notetag are unexpiring Barrier Points
that do not remove themselves as time passes.

<User Barrier: -x>
<Target Barrier: -x>
This will remove x barrier points from the user or the target. This is
applied to unexpiring and temporary barrier points alike.

<User Barrier x Turns: +y>
<Target Barrier x Turns: +y>
This adjusts the Barrier Points for the user or target respectively at x
turns by +y amount. These Barrier Points will expire after x turns. Each
turn goes by during the battler's regeneration timing.

<User Barrier x Turns: -y>
<Target Barrier x Turns: -y>
This will remove y barrier points from the user or target up to x turns.

<Bypass Barrier>
This causes this skill to be able to bypass Barrier Points to directly
deal damage to the target.

<Barrier Penetration: x%>
Causes x% of this skill or item's damage to bypass the action target's
Barrier Points. If the target does not have enough Barrier Points, more
damage will be dealt. This is a percentile value.

<Barrier Penetration: x>
Causes x value of this skill or item's damage to bypass action target's
Barrier Points. If the target does not have enough Barrier Points, more
damage will be dealt. This is a flat value.

Actor, Class, Enemy, Weapon, Armor, State Notetags:

<Barrier Penetration: +x%>
<Barrier Penetration: -x%>
This makes any damaging action by the attacker to have +x% or -x% bonus
Barrier Penetration. This is a multiplicative bonus and applied before
flat bonuses have been made.

<Barrier Penetration: +x>
<Barrier Penetration: -x>
This makes any damaging action by the attacker to have +x or -x bonus
Barrier Penetration. This is a flat bonus and applied after multiplicative
changes have been made.

<Barrier Points: +x>
<Barrier Points: -x>
The amount of unexpiring Barrier Points are gained at the start of a new
battle for the affected user.

<Barrier Points x Turns: +y>
<Barrier Points x Turns: -y>
The amount of Barrier Points are gained at the start of a new battle for
the affected user that will last x turns.

<Barrier Regen: +x>
<Barrier Regen: -x>
During the regeneration phase, the user will regenerate +x/-x unexpiring
Barrier Points.

<Barrier Regen x Turns: +y>
<Barrier Regen x Turns: -y>
During the regeneration phase, the user will regenerate Barrier Points
that last x turns with a +y/-y value.

============================================================================
Lunatic Mode - Custom Barrier Points
============================================================================

For those with JavaScript proficiency, you can utilize these notetags to
allow your skills and items to give battlers custom Barrier Point totals.

Skill and Item Notetags:

--- Target ---

<Custom Target Barrier>
value = target.level;
</Custom Target Barrier>
The 'value' variable determines the total amount of Barrier Points that
will be added to the target's unexpiring Barrier Point total.

<Custom Target Barrier x Turns>
value = target.level;
</Custom Target Barrier x Turns>
The 'value' variable determines the total amount of Barrier Points that
will be added to the target for x amount of turns.

--- User ---

<Custom User Barrier>
value = user.level;
</Custom User Barrier>
The 'value' variable determines the total amount of Barrier Points that
will be added to the user's unexpiring Barrier Point total.

<Custom User Barrier x Turns>
value = user.level;
</Custom User Barrier x Turns>
The 'value' variable determines the total amount of Barrier Points that
will be added to the user for x amount of turns.

============================================================================
Lunatic Mode - Custom Barrier Penetration
============================================================================

For those with JavaScript proficiency, you can utilize these notetags to
give your skills, items, actors, classes, enemies, weapons, armors, and
states custom Barrier Penetration effects.

Skill, Item, Actor, Class, Enemy, Weapon, Armor, State Notetags:

--- Rate ---

<Custom Barrier Penetration Rate>
rate = target.hpRate();
</Custom Barrier Penetration Rate>
The 'rate' variable determines the percentile amount of damage the user
will bypass for the target's Barrier Points. This is a multiplicative
bonus and will be applied before any flat bonuses.

--- Flat ---

<Custom Barrier Penetration Flat>
flat = target.level;
</Custom Barrier Penetration Flat>
The 'flat' variable determines the flat amount of damage the user will
bypass for the target's Barrier Points. This is a flat bonus and will be
applied after all multiplicative bonuses.

============================================================================
Lunatic Mode - Custom Barrier Points on Battle Start
============================================================================

For those with JavaScript proficiency, you can utilize these notetags to
add a dynamic amount of Barrier Points during the start up of a battle.

Actor, Class, Enemy, Weapon, Armor, and State Notetags:

--- Unexpiring ---

<Custom Barrier Points>
value += user.hp;
</Custom Barrier Points>
The 'value' variable determines how many Barrier Points the user will
start a battle with. The Barrier Points added through this notetag are
unexpiring Barrier Points.

--- Timed ---

<Custom Barrier Points x Turns>
value += user.hp;
</Custom Barrier Points x Turns>
The 'value' variable determines how many Barrier Points the user will
start a battle with but expires after x turns.

============================================================================
Lunatic Mode - Custom Barrier Regeneration
============================================================================

For those with JavaScript proficiency, you can utilize these notetags to
add a dynamic amount of Barrier Points during the user's regeneration phase.

Actor, Class, Enemy, Weapon, Armor, and State Notetags:

--- Unexpiring ---

<Custom Barrier Regen>
value += user.hp / 4;
</Custom Barrier Regen>
The 'value' variable determines how many Barrier Points the user will
gain during the user's regeneration phase. The Barrier Points added with
this notetag are unexpiring Barrier Points.

--- Timed ---

<Custom Barrier Regen x Turns>
value += user.hp / 4;
</Custom Barrier Regen x Turns>
The 'value' variable determines how many Barrier Points the user will
gain during the user's regeneration phase. The Barrier Points added with
this notetag will last x turns.

============================================================================
Lunatic Mode - New JavaScript Functions
============================================================================

For those familiar with JavaScript, here is a quick reference list of new
JavaScript functions you can use for your own code and/or Lunatic Mode.

JavaScript functions:

battler.barrierPoints()
- Returns the total amount of Barrier Points the battler has.

battler.barrierPoints(-1)
- Returns the amount of unexpiring Barrier Points the battler has.

battler.barrierPoints(x)
- Returns the amount of Barrier Points the battler has for that turn.

battler.gainBarrier(value, turn)
- Makes battler gain barrier points equal to 'value' that lasts a certain
amount of 'turns'. If turns is left at 0, the value will be unexpiring
Barrier Points.

battler.loseBarrier(value)
- Makes the battler lose 'value' worth of Barrier Points.

battler.startBarrierAnimation()
- Makes the battler play the barrier struck animation.

battler.updateBarrierTurns()
- Makes the battler's Barrier Points update their turns.

============================================================================
Changelog
============================================================================

Version 1.04:
- <User Barrier: -x>, <Target Barrier: -x>, <User Barrier x Turns: -y>, and
<Target Barrier x Turns: -y> notetags have been revamped. They will also
show popups now. If <Target Barrier x Turns: -y> is used, it will remove y
barrier points up to x turns.

Version 1.03:
- Updated for RPG Maker MV version 1.1.0.

Version 1.02:
- Fixed a bug where if Barrier Penetration was at 100%, it would be treated
as 0%.
- Added 'Barrier State' parameter. This parameter will passively apply a
certain state to the battler if the battler has barrier points. This can be
turned off by leaving this plugin parameter value at 0.

Version 1.01:
- Fixed a bug that prevented Barrier Points to be gained at the start of
battle properly.
- When a user grants an Absorption Barrier to itself, the user will gain 1
additional turn for the Barrier to stay up so it won't dissolve immediately.

Version 1.00:
- Finished Plugin!
パラメータ
param Barrier State
desc If a battler has even 1 Barrier Point, the battler will
be affected by this state. Leave at 0 for no state.
default 0

param Barrier Color 1
desc The text code color 1 used for the barriers.
default 13

param Barrier Color 2
desc The text code color 2 used for the barriers.
default 5

param Barrier Animation
desc Animation played when barrier points are lost.
Leave at 0 for no animation.
default 0

param Break Animation
desc Animation played when barrier points are emptied.
Leave at 0 for no animation.
default 0

param Barrier Popup
desc If using the Battle Engine Core, this is the popup color
shown for barrier damage. Red, Green, Blue, Opacity
default 255, 0, 255, 160

param Display 0 HP Damage
desc Display 0 HP Damage if 0 Damage is dealt to HP?
NO - false YES - true
default false

param Clear Per Battle
desc Clear barrier points at the start and end of battle?
NO - false YES - true
default true

param Clear on Death
desc Clear barrier points if the battler dies?
NO - false YES - true
default true

param Default Penetration Rate
desc The default Barrier Penetration Rate for all actions.
Example: if you want 50%, use 0.50.
default 0

param Default Penetration Flat
desc The default Barrier Penetration Flat for all actions.
Example: if you want 100 flat penetration, use 100.
default 0

ライセンス表記
Barrier Points first, mitigating any real damage dealt to the battler.

紹介ページ https://github.com/suppayami/yami-engine-delta/blob/master/demo/js/plugins/YEP_AbsorptionBarrier.js