Bunch more moves, changes in how additional information for items works.
This commit is contained in:
51
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/MetalBurst.cs
Normal file
51
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/MetalBurst.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using PkmnLib.Static.Moves;
|
||||
using PkmnLib.Static.Utils;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "metal_burst")]
|
||||
public class MetalBurst : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnBeforeTurnStart(ITurnChoice choice)
|
||||
{
|
||||
choice.User.Volatile.Add(new MetalBurstHelper());
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
var helper = target.Volatile.Get<MetalBurstHelper>();
|
||||
|
||||
if (helper?.LastAttacker == null || helper.LastAttacker != move.User)
|
||||
{
|
||||
move.GetHitData(target, hit).Fail();
|
||||
return;
|
||||
}
|
||||
|
||||
damage = helper.LastDamage.MultiplyOrMax(1.5f);
|
||||
target.Volatile.Remove<MetalBurstHelper>();
|
||||
}
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "metal_burst_helper")]
|
||||
private class MetalBurstHelper : Script
|
||||
{
|
||||
public IPokemon? LastAttacker { get; set; }
|
||||
public uint LastDamage { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
if (move.UseMove.Category == MoveCategory.Status)
|
||||
return;
|
||||
LastAttacker = move.User;
|
||||
LastDamage = move.GetHitData(target, hit).Damage;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IBattle battle)
|
||||
{
|
||||
RemoveSelf();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user