This commit is contained in:
@@ -3,7 +3,7 @@ using PkmnLib.Static.Moves;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "metal_burst")]
|
||||
public class MetalBurst : Script, IScriptOnBeforeTurnStart, IScriptChangeMoveDamage
|
||||
public class MetalBurst : Script, IScriptOnBeforeTurnStart, IScriptChangeTargets, IScriptChangeMoveDamage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnBeforeTurnStart(ITurnChoice choice)
|
||||
@@ -11,19 +11,31 @@ public class MetalBurst : Script, IScriptOnBeforeTurnStart, IScriptChangeMoveDam
|
||||
choice.User.Volatile.Add(new MetalBurstHelper());
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void ChangeTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets)
|
||||
{
|
||||
var helper = moveChoice.User.Volatile.Get<MetalBurstHelper>();
|
||||
var lastAttacker = helper?.LastAttacker;
|
||||
if (lastAttacker == null)
|
||||
{
|
||||
moveChoice.Fail();
|
||||
return;
|
||||
}
|
||||
targets = [lastAttacker];
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
var helper = target.Volatile.Get<MetalBurstHelper>();
|
||||
var helper = move.User.Volatile.Get<MetalBurstHelper>();
|
||||
|
||||
if (helper?.LastAttacker == null || helper.LastAttacker != move.User)
|
||||
if (helper?.LastAttacker == null || helper.LastAttacker != target)
|
||||
{
|
||||
move.GetHitData(target, hit).Fail();
|
||||
return;
|
||||
}
|
||||
|
||||
damage = helper.LastDamage.MultiplyOrMax(1.5f);
|
||||
target.Volatile.Remove<MetalBurstHelper>();
|
||||
}
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "metal_burst_helper")]
|
||||
|
||||
Reference in New Issue
Block a user