This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Shadow Shield is an ability that reduces damage taken when at full HP.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Shadow_Shield_(Ability)">Bulbapedia - Shadow Shield</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "shadow_shield")]
|
||||
public class ShadowShield : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
if (target.CurrentHealth == target.BoostedStats.Hp)
|
||||
{
|
||||
damage = (uint)(damage * 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnBeforeAnyHookInvoked(ref List<ScriptCategory>? suppressedCategories)
|
||||
{
|
||||
// Shadow Shield can not be suppressed by any other script, so we remove it from the list of suppressed categories
|
||||
// if it was added.
|
||||
if (suppressedCategories != null && suppressedCategories.Contains(ScriptCategory.Ability))
|
||||
suppressedCategories.Remove(ScriptCategory.Ability);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user