More moves implemented
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
using PkmnLib.Static.Moves;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "counterhelper")]
|
||||
public class CounterHelperEffect : Script
|
||||
{
|
||||
public IPokemon? LastHitBy { get; private set; }
|
||||
public uint LastDamage { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
if (move.UseMove.Category == MoveCategory.Physical)
|
||||
{
|
||||
LastHitBy = move.User;
|
||||
LastDamage = move.GetHitData(target, hit).Damage;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "destiny_bond")]
|
||||
public class DestinyBondEffect : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnFaint(IPokemon pokemon, DamageSource source)
|
||||
{
|
||||
if (source == DamageSource.MoveDamage)
|
||||
{
|
||||
if (pokemon.BattleData?.Battle.ChoiceQueue?.LastRanChoice is not IMoveChoice lastChoice)
|
||||
return;
|
||||
lastChoice.User.Damage(lastChoice.User.BoostedStats.Hp * 10, DamageSource.Misc);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnBeforeMove(IExecutingMove move)
|
||||
{
|
||||
RemoveSelf();
|
||||
}
|
||||
}
|
||||
34
Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/DigEffect.cs
Normal file
34
Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/DigEffect.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "dig")]
|
||||
public class DigEffect : Script
|
||||
{
|
||||
private readonly IPokemon _owner;
|
||||
|
||||
public DigEffect(IPokemon owner)
|
||||
{
|
||||
_owner = owner;
|
||||
}
|
||||
/// <inheritdoc />
|
||||
public override void ForceTurnSelection(byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||
{
|
||||
var opposingSideIndex = (byte)(_owner.BattleData?.SideIndex == 0 ? 1 : 0);
|
||||
choice = TurnChoiceHelper.CreateMoveChoice(_owner, "dig", opposingSideIndex, position);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
||||
{
|
||||
if (!executingMove.UseMove.HasFlag("hit_underground"))
|
||||
block = true;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeIncomingDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
if (!move.UseMove.HasFlag("effective_against_underground"))
|
||||
damage *= 2;
|
||||
}
|
||||
}
|
||||
21
Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/DisableEffect.cs
Normal file
21
Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/DisableEffect.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using PkmnLib.Static.Utils;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "disable")]
|
||||
public class DisableEffect : Script
|
||||
{
|
||||
private readonly StringKey _move;
|
||||
|
||||
public DisableEffect(StringKey move)
|
||||
{
|
||||
_move = move;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void PreventMoveSelection(IMoveChoice choice, ref bool prevent)
|
||||
{
|
||||
if (choice.ChosenMove.MoveData.Name == _move)
|
||||
prevent = true;
|
||||
}
|
||||
}
|
||||
34
Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/DiveEffect.cs
Normal file
34
Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/DiveEffect.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "dive")]
|
||||
public class DiveEffect : Script
|
||||
{
|
||||
private readonly IPokemon _owner;
|
||||
|
||||
public DiveEffect(IPokemon owner)
|
||||
{
|
||||
_owner = owner;
|
||||
}
|
||||
/// <inheritdoc />
|
||||
public override void ForceTurnSelection(byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||
{
|
||||
var opposingSideIndex = (byte)(_owner.BattleData?.SideIndex == 0 ? 1 : 0);
|
||||
choice = TurnChoiceHelper.CreateMoveChoice(_owner, "dive", opposingSideIndex, position);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
||||
{
|
||||
if (!executingMove.UseMove.HasFlag("hit_underwater"))
|
||||
block = true;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeIncomingDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
if (!move.UseMove.HasFlag("effective_against_underwater"))
|
||||
damage *= 2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "ghostcurse")]
|
||||
public class GhostCurseEffect : Script
|
||||
{
|
||||
private IPokemon _pokemon;
|
||||
|
||||
public GhostCurseEffect(IPokemon pokemon)
|
||||
{
|
||||
_pokemon = pokemon;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IBattle battle)
|
||||
{
|
||||
_pokemon.Damage(_pokemon.CurrentHealth / 4, DamageSource.Misc);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
public abstract class ProtectionEffectScript : Script
|
||||
public class ProtectionEffectScript : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
||||
|
||||
Reference in New Issue
Block a user