More move scripts
This commit is contained in:
25
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/SkillSwap.cs
Normal file
25
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/SkillSwap.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "skill_swap")]
|
||||
public class SkillSwap : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
var targetAbility = target.ActiveAbility;
|
||||
var userAbility = move.User.ActiveAbility;
|
||||
if (targetAbility == null || userAbility == null)
|
||||
{
|
||||
move.GetHitData(target, hit).Fail();
|
||||
return;
|
||||
}
|
||||
if (targetAbility.HasFlag("cant_be_changed") || userAbility.HasFlag("cant_be_changed"))
|
||||
{
|
||||
move.GetHitData(target, hit).Fail();
|
||||
return;
|
||||
}
|
||||
|
||||
move.User.ChangeAbility(targetAbility);
|
||||
target.ChangeAbility(userAbility);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user