More move effects
This commit is contained in:
32
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/FlowerShield.cs
Normal file
32
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/FlowerShield.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System.Linq;
|
||||
using PkmnLib.Static;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "flower_shield")]
|
||||
public class FlowerShield : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
var battleData = target.BattleData;
|
||||
if (battleData == null)
|
||||
return;
|
||||
if (!battleData.Battle.Library.StaticLibrary.Types.TryGetTypeIdentifier("grass", out var grassType))
|
||||
return;
|
||||
|
||||
var batchId = new EventBatchId();
|
||||
var sides = battleData.Battle.Sides;
|
||||
foreach (var side in sides)
|
||||
{
|
||||
foreach (var pokemon in side.Pokemon)
|
||||
{
|
||||
if (pokemon == null || pokemon.IsFainted)
|
||||
continue;
|
||||
if (!pokemon.Types.Contains(grassType))
|
||||
continue;
|
||||
pokemon.ChangeStatBoost(Statistic.Defense, 1, pokemon == move.User, batchId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user