More moves implemented
This commit is contained in:
34
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Curse.cs
Normal file
34
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Curse.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System.Linq;
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
using PkmnLib.Static;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "curse")]
|
||||
public class Curse : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
var battleData = move.User.BattleData;
|
||||
if (battleData == null)
|
||||
return;
|
||||
var typeLibrary = battleData.Battle.Library.StaticLibrary.Types;
|
||||
if (!typeLibrary.TryGetTypeIdentifier("ghost", out var ghostType))
|
||||
return;
|
||||
if (move.User.Types.Contains(ghostType))
|
||||
{
|
||||
move.User.Damage(move.User.CurrentHealth / 2, DamageSource.Misc);
|
||||
if (move.User.CurrentHealth == 0)
|
||||
return;
|
||||
target.Volatile.Add(new GhostCurseEffect(target));
|
||||
}
|
||||
else
|
||||
{
|
||||
EventBatchId batchId = new();
|
||||
move.User.ChangeStatBoost(Statistic.Speed, -1, true, batchId);
|
||||
move.User.ChangeStatBoost(Statistic.Defense, 1, true, batchId);
|
||||
move.User.ChangeStatBoost(Statistic.Attack, 1, true, batchId);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user