Even more moves
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-05-05 16:58:03 +02:00
parent 292c303fc0
commit 7727f92f4e
132 changed files with 624 additions and 171 deletions

View File

@@ -2,4 +2,5 @@ global using PkmnLib.Dynamic.ScriptHandling;
global using PkmnLib.Dynamic.ScriptHandling.Registry;
global using PkmnLib.Dynamic.Events;
global using PkmnLib.Dynamic.Models;
global using PkmnLib.Dynamic.Models.Choices;
global using PkmnLib.Dynamic.Models.Choices;
global using PkmnLib.Static;

View File

@@ -1,6 +1,5 @@
using System;
using PkmnLib.Dynamic.Libraries;
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Libraries;

View File

@@ -1,6 +1,5 @@
using System;
using PkmnLib.Dynamic.Libraries;
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Libraries;

View File

@@ -1,7 +1,6 @@
using System;
using System.Linq;
using PkmnLib.Dynamic.Libraries;
using PkmnLib.Static;
using PkmnLib.Static.Moves;
namespace PkmnLib.Plugin.Gen7.Libraries;
@@ -69,11 +68,11 @@ public class Gen7DamageCalculator(bool hasRandomness) : IDamageCalculator
}
/// <inheritdoc />
public byte GetBasePower(IExecutingMove executingMove, IPokemon target, byte hitNumber, IHitData hitData)
public ushort GetBasePower(IExecutingMove executingMove, IPokemon target, byte hitNumber, IHitData hitData)
{
if (executingMove.UseMove.Category == MoveCategory.Status)
return 0;
var basePower = executingMove.UseMove.BasePower;
var basePower = (ushort)executingMove.UseMove.BasePower;
executingMove.RunScriptHook(script => script.ChangeBasePower(executingMove, target, hitNumber, ref basePower));
return basePower;
}

View File

@@ -2,7 +2,6 @@ using System.Collections.Generic;
using System.Linq;
using PkmnLib.Dynamic;
using PkmnLib.Dynamic.Libraries;
using PkmnLib.Static;
using PkmnLib.Static.Moves;
using PkmnLib.Static.Utils;

View File

@@ -1,5 +1,4 @@
using System.Collections.Generic;
using PkmnLib.Static;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
@@ -7,6 +6,8 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
[Script(ScriptCategory.Battle, "gravity")]
public class Gravity : Script
{
private int _turns = 5;
/// <inheritdoc />
public override void ChangeTypesForIncomingMove(IExecutingMove executingMove, IPokemon target, byte hitIndex,
IList<TypeIdentifier> types)
@@ -25,4 +26,21 @@ public class Gravity : Script
if (move.UseMove.HasFlag("gravity"))
fail = true;
}
/// <inheritdoc />
public override void IsFloating(IPokemon pokemon, ref bool isFloating)
{
// Gravity makes all Pokémon susceptible to Ground-type moves
isFloating = false;
}
/// <inheritdoc />
public override void OnEndTurn(IBattle battle)
{
_turns--;
if (_turns > 0)
return;
RemoveSelf();
}
}

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
[Script(ScriptCategory.Move, "ion_deluge")]

View File

@@ -1,5 +1,4 @@
using System.Collections.Generic;
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;

View File

@@ -8,7 +8,7 @@ public class MudSportEffect : Script
private int _turnsLeft = 5;
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower)
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{
if (move.UseMove.MoveType.Name == "electric")
{

View File

@@ -1,5 +1,4 @@
using System.Collections.Generic;
using PkmnLib.Static;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Items;

View File

@@ -1,5 +1,4 @@
using System.Collections.Generic;
using PkmnLib.Static;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Items;

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
[Script(ScriptCategory.MoveVolatile, "electrify")]

View File

@@ -6,6 +6,6 @@ namespace PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
public class MeFirstPowerBoost : Script
{
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower) =>
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) =>
basePower = basePower.MultiplyOrMax(1.5f);
}

View File

@@ -6,6 +6,6 @@ namespace PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
public class RoundPowerBoost : Script
{
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower) =>
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) =>
basePower = basePower.MultiplyOrMax(2f);
}

View File

@@ -12,7 +12,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class Acrobatics : Script
{
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower)
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{
if (move.User.HeldItem == null)
basePower = basePower.MultiplyOrMax(2);

View File

@@ -1,5 +1,4 @@
using System.Linq;
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,5 +1,4 @@
using System.Collections.Generic;
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,6 +1,5 @@
using System;
using System.Linq;
using PkmnLib.Static;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -30,7 +30,7 @@ public class BeatUp : Script
}
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower)
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{
var relevantPartyMembers = _relevantPartyMembers ??= GetRelevantPartyMembers(move.User).ToArray();
var hittingPokemon = relevantPartyMembers.ElementAtOrDefault(hit);

View File

@@ -1,5 +1,4 @@
using System.Linq;
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "belly_drum")]

View File

@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class Brine : Script
{
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower)
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{
if (target.CurrentHealth <= target.BoostedStats.Hp / 2)
{

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "bug_bite")]

View File

@@ -1,4 +1,3 @@
using PkmnLib.Static;
using PkmnLib.Static.Species;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using PkmnLib.Static;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using PkmnLib.Static;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using PkmnLib.Static;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using PkmnLib.Static;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using PkmnLib.Static;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,5 +1,4 @@
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class CrushGrip : Script
{
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower)
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{
basePower = Math.Max((byte)(120 * target.CurrentHealth / target.BoostedStats.Hp), (byte)1);
}

View File

@@ -1,6 +1,5 @@
using System.Linq;
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -14,7 +14,8 @@ public class Defog : Script
ScriptUtils.ResolveName<LightScreenEffect>(),
ScriptUtils.ResolveName<ReflectEffect>(),
ScriptUtils.ResolveName<SafeguardEffect>(),
"spikes",
ScriptUtils.ResolveName<StickyWebEffect>(),
ScriptUtils.ResolveName<SpikesEffect>(),
"toxic_spikes",
"stealth_rock",
];

View File

@@ -19,7 +19,7 @@ public class DoublePowerIfTargetDamagedInTurn : Script
}
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower)
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{
var battle = move.User.BattleData?.Battle;
if (battle == null)

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "dragon_ascent")]

View File

@@ -4,7 +4,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class ElectroBall : Script
{
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower)
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{
var user = move.User;
var targetSpeed = target.BoostedStats.Speed;

View File

@@ -5,7 +5,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "eruption")]
public class Eruption : Script
{
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower)
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{
basePower = Math.Max((byte)(150 * move.User.CurrentHealth / move.User.BoostedStats.Hp), (byte)1);
}

View File

@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class Facade : Script
{
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower)
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{
var status = move.User.StatusScript.Script?.Name;
if (status == "paralyzed" || status == "burned" || status == "poisoned")

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "fell_stinger")]

View File

@@ -4,7 +4,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class Flail : Script
{
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower)
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{
var remainingHealth = move.User.CurrentHealth / move.User.BoostedStats.Hp;
var fraction = remainingHealth * 48;

View File

@@ -1,5 +1,4 @@
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,12 +1,10 @@
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "fling")]
public class Fling : Script
{
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower)
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{
var item = move.User.HeldItem;
if (item == null)

View File

@@ -1,5 +1,4 @@
using System.Linq;
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,5 +1,4 @@
using System.Collections.Generic;
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,5 +1,4 @@
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,4 +1,3 @@
using PkmnLib.Static;
using PkmnLib.Static.Moves;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class Frustration : Script
{
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower)
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{
var friendship = move.User.Happiness;
basePower = Math.Max((byte)1, (byte)((255 - friendship) * 2 / 5));

View File

@@ -8,7 +8,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class FuryCutter : Script
{
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower)
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{
var userEffect = move.User.Volatile.Get<FuryCutterEffect>();
if (userEffect == null)

View File

@@ -1,4 +1,3 @@
using PkmnLib.Static;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,5 +1,4 @@
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -4,7 +4,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class GrassKnot : Script
{
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower)
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{
var targetWeight = target.WeightInKg;
basePower = targetWeight switch

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "guard_split")]

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "guard_swap")]

View File

@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class GyroBall : Script
{
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower)
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{
basePower = Math.Min((byte)150, (byte)(25 * target.BoostedStats.Speed / move.User.BoostedStats.Speed + 1));
}

View File

@@ -1,5 +1,4 @@
using System;
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -4,7 +4,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class HeatCrash : Script
{
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower)
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{
var weightMultiplier = move.User.WeightInKg / target.WeightInKg;
basePower = weightMultiplier switch

View File

@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class Hex : Script
{
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower)
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{
if (!target.StatusScript.IsEmpty)
{

View File

@@ -1,5 +1,4 @@
using System;
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
@@ -18,7 +17,7 @@ public class HiddenPower : Script
}
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower)
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{
var ivs = move.User.IndividualValues;

View File

@@ -8,7 +8,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class IceBall : Script
{
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower)
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{
var userEffect = move.User.Volatile.Get<IceBallEffect>();
if (userEffect == null)

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "incinerate")]

View File

@@ -15,7 +15,7 @@ public class Instruct : Script
if (battleData == null)
return;
var lastMoveChoiceByTarget = battleData.Battle.PreviousTurnChoices.SelectMany(x => x)
var lastMoveChoiceByTarget = battleData.Battle.PreviousTurnChoices.SelectMany(x => x).Reverse()
.SkipWhile(x => x != move.MoveChoice).OfType<MoveChoice>().FirstOrDefault(x => x.User == target);
if (lastMoveChoiceByTarget == null || !battleData.Battle.CanUse(lastMoveChoiceByTarget))

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "judgement")]

View File

@@ -4,7 +4,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class LowKick : Script
{
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower)
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{
basePower = target.WeightInKg switch
{

View File

@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class Magnitude : Script
{
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower)
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{
var battleData = move.User.BattleData;
if (battleData == null)

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "memento")]

View File

@@ -1,5 +1,4 @@
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "multi_attack")]

View File

@@ -1,5 +1,4 @@
using System.Collections.Generic;
using PkmnLib.Static;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
@@ -8,7 +7,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class NaturalGift : Script
{
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower)
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{
var naturalGiftData = GetNaturalGiftData(move.User.HeldItem);
if (naturalGiftData == null)

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
/// <summary>

View File

@@ -9,7 +9,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class Payback : Script
{
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower)
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{
var battleData = move.User.BattleData;

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "power_split")]

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "power_swap")]

View File

@@ -1,5 +1,4 @@
using System;
using PkmnLib.Static;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -40,7 +40,7 @@ public class Present : Script
}
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower)
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{
basePower = _basePower;
}

View File

@@ -1,5 +1,4 @@
using System;
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "psyshock")]

View File

@@ -1,5 +1,4 @@
using System.Linq;
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
@@ -7,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class Punishment : Script
{
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower)
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{
if (move.User.BattleData == null)
return;

View File

@@ -1,4 +1,5 @@
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
using PkmnLib.Plugin.Gen7.Scripts.Side;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
@@ -12,12 +13,16 @@ public class RapidSpin : Script
move.User.Volatile.Remove<BindEffect>();
move.User.Volatile.Remove<FireSpinEffect>();
move.User.Volatile.Remove<MagmaStormEffect>();
// TODO: Sand Tomb effect removal
// TODO: Whirlpool effect removal
// TODO: Wrap effect removal
// TODO: Remove Spikes
// TODO: Remove Toxic Spikes
// TODO: Remove Stealth Rock
var battleData = move.User.BattleData;
if (battleData != null)
{
battleData.BattleSide.VolatileScripts.Remove<SpikesEffect>();
battleData.BattleSide.VolatileScripts.Remove<StickyWebEffect>();
// TODO: Remove Toxic Spikes
// TODO: Remove Stealth Rock
}
}
}

View File

@@ -1,5 +1,4 @@
using System;
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class Retaliate : Script
{
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower)
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{
var battleData = move.User.BattleData;
if (battleData is null)

View File

@@ -4,7 +4,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class Return : Script
{
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower)
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{
var friendship = move.User.Happiness;
var power = friendship * 2 / 5;

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "revelation_dance")]

View File

@@ -1,5 +1,4 @@
using System.Linq;
using PkmnLib.Static;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "shell_smash")]

View File

@@ -1,5 +1,4 @@
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,5 +1,4 @@
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,4 +1,3 @@
using System;
using System.Linq;
using PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
using PkmnLib.Plugin.Gen7.Scripts.Utils;

View File

@@ -1,7 +1,4 @@
using System.Collections.Generic;
using System.Linq;
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "speed_swap")]

View File

@@ -0,0 +1,13 @@
using PkmnLib.Plugin.Gen7.Scripts.Side;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "spikes")]
public class Spikes : Script
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
target.BattleData?.Battle.Volatile.Add(new SpikesEffect());
}
}

View File

@@ -0,0 +1,10 @@
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "spiky_shield")]
public class SpikyShield : ProtectionScript
{
/// <inheritdoc />
protected override Script GetEffectScript() => new SpikyShieldEffect();
}

View File

@@ -0,0 +1,21 @@
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "spit_up")]
public class SpitUp : Script
{
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{
var stockpileEffect = move.User.Volatile.Get<StockpileEffect>();
if (stockpileEffect == null || stockpileEffect.StockpileCount == 0)
{
move.GetHitData(target, hit).Fail();
return;
}
var stockpileCount = stockpileEffect.StockpileCount;
basePower = basePower.MultiplyOrMax(stockpileCount);
}
}

View File

@@ -0,0 +1,24 @@
using System.Linq;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "spite")]
public class Spite : Script
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
var lastMoveChoiceByTarget = move.Battle.PreviousTurnChoices.SelectMany(x => x).Reverse()
.SkipWhile(x => x != move.MoveChoice).OfType<MoveChoice>().FirstOrDefault(x => x.User == target);
if (lastMoveChoiceByTarget == null || lastMoveChoiceByTarget.HasFailed)
{
move.GetHitData(target, hit).Fail();
return;
}
if (!lastMoveChoiceByTarget.ChosenMove.ReduceUses(4))
{
move.GetHitData(target, hit).Fail();
return;
}
}
}

View File

@@ -0,0 +1,11 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "splintered_stormshards")]
public class SplinteredStormshards : Script
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
move.Battle.SetTerrain(null);
}
}

View File

@@ -0,0 +1,14 @@
using PkmnLib.Plugin.Gen7.Scripts.Side;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "spotlight")]
public class Spotlight : Script
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
var battleData = target.BattleData;
battleData?.BattleSide.VolatileScripts.Add(new SpotlightEffect(battleData.BattleSide, battleData.Position));
}
}

View File

@@ -0,0 +1,13 @@
using PkmnLib.Plugin.Gen7.Scripts.Side;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "stealth_rock")]
public class StealthRock : Script
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
target.BattleData?.BattleSide.VolatileScripts.Add(new StealthRockEffect());
}
}

View File

@@ -0,0 +1,13 @@
using PkmnLib.Plugin.Gen7.Scripts.Side;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "sticky_web")]
public class StickyWeb : Script
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
target.BattleData?.BattleSide.VolatileScripts.Add(new StickyWebEffect());
}
}

View File

@@ -0,0 +1,17 @@
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "stockpile")]
public class Stockpile : Script
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
EventBatchId batchId = new();
move.User.ChangeStatBoost(Statistic.Defense, 1, true, batchId);
move.User.ChangeStatBoost(Statistic.SpecialDefense, 1, true, batchId);
move.User.Volatile.StackOrAdd(ScriptUtils.ResolveName<StockpileEffect>(), () => new StockpileEffect());
}
}

View File

@@ -0,0 +1,19 @@
using System.Linq;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "stomping_tantrum")]
public class StompingTantrum : Script
{
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{
var lastMoveChoice = move.Battle.PreviousTurnChoices.Reverse().Skip(1).SelectMany(x => x.Reverse())
.OfType<IMoveChoice>().FirstOrDefault(x => x.User == move.User);
if (lastMoveChoice is { HasFailed: true })
{
basePower = basePower.MultiplyOrMax(2);
}
}
}

View File

@@ -0,0 +1,13 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "storm_throw")]
public class StormThrow : Script
{
/// <inheritdoc />
public override void ChangeCriticalStage(IExecutingMove move, IPokemon target, byte hit, ref byte stage)
{
// Storm Throw always results in a critical hit
// Setting to any value higher than 2 will always result in a critical hit.
stage = 100;
}
}

Some files were not shown because too many files have changed in this diff Show More