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

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

View File

@ -15,7 +15,7 @@ public interface IDamageCalculator
/// <summary> /// <summary>
/// Calculate the base power for a given hit on a Pokemon. /// Calculate the base power for a given hit on a Pokemon.
/// </summary> /// </summary>
byte GetBasePower(IExecutingMove executingMove, IPokemon target, byte hitNumber, IHitData hitData); ushort GetBasePower(IExecutingMove executingMove, IPokemon target, byte hitNumber, IHitData hitData);
/// <summary> /// <summary>
/// Returns whether a specified hit should be critical or not. /// Returns whether a specified hit should be critical or not.

View File

@ -76,9 +76,16 @@ public static class MoveTurnExecutor
if (failed) if (failed)
{ {
// TODO: fail handling // TODO: fail handling
executingMove.MoveChoice.Fail();
return; return;
} }
ExecuteMove(executingMove); ExecuteMove(executingMove);
if (executingMove.Hits.All(x => x.HasFailed) || (executingMove.UseMove.Category != MoveCategory.Status &&
executingMove.Hits.All(x => x.Damage == 0)))
{
executingMove.MoveChoice.Fail();
}
} }
public static void ExecuteMove(IExecutingMove executingMove) public static void ExecuteMove(IExecutingMove executingMove)

View File

@ -20,7 +20,7 @@ public interface IHitData
/// <summary> /// <summary>
/// The base power of the hit. /// The base power of the hit.
/// </summary> /// </summary>
byte BasePower { get; } ushort BasePower { get; }
/// <summary> /// <summary>
/// The effectiveness of the hit. /// The effectiveness of the hit.
@ -55,7 +55,7 @@ public record HitData : IHitData
public bool IsCritical { get; internal set; } public bool IsCritical { get; internal set; }
/// <inheritdoc /> /// <inheritdoc />
public byte BasePower { get; internal set; } public ushort BasePower { get; internal set; }
/// <inheritdoc /> /// <inheritdoc />
public float Effectiveness { get; internal set; } public float Effectiveness { get; internal set; }

View File

@ -76,6 +76,11 @@ public interface ILearnedMove : IDeepCloneable
/// </summary> /// </summary>
bool TryUse(byte amount = 1); bool TryUse(byte amount = 1);
/// <summary>
/// Reduce the remaining PP by a certain amount. If the number of PP is already 0, return false.
/// </summary>
bool ReduceUses(byte amount = 1);
/// <summary> /// <summary>
/// Set the remaining PP to the max amount of PP. /// Set the remaining PP to the max amount of PP.
/// </summary> /// </summary>
@ -139,6 +144,20 @@ public class LearnedMoveImpl : ILearnedMove
return true; return true;
} }
/// <inheritdoc />
public bool ReduceUses(byte amount = 1)
{
if (CurrentPp == 0)
return false;
if (CurrentPp >= amount)
CurrentPp -= amount;
else
CurrentPp = 0;
return true;
}
/// <summary> /// <summary>
/// Restore the PP to the maximum amount of PP. /// Restore the PP to the maximum amount of PP.
/// </summary> /// </summary>

View File

@ -403,6 +403,12 @@ public interface IPokemon : IScriptSource, IDeepCloneable
/// </summary> /// </summary>
void ChangeAbility(IAbility ability); void ChangeAbility(IAbility ability);
/// <summary>
/// Whether the Pokémon is levitating. This is used for moves like Magnet Rise, and abilities such as
/// Levitate.
/// </summary>
bool IsFloating { get; }
/// <summary> /// <summary>
/// Converts the data structure to a serializable format. /// Converts the data structure to a serializable format.
/// </summary> /// </summary>
@ -1206,6 +1212,17 @@ public class PokemonImpl : ScriptSource, IPokemon
} }
} }
/// <inheritdoc />
public bool IsFloating
{
get
{
var isFloating = Types.Any(x => x.Name == "flying");
this.RunScriptHook(x => x.IsFloating(this, ref isFloating));
return isFloating;
}
}
/// <inheritdoc /> /// <inheritdoc />
public SerializedPokemon Serialize() => new(this); public SerializedPokemon Serialize() => new(this);

View File

@ -307,7 +307,7 @@ public abstract class Script : IDeepCloneable
/// <summary> /// <summary>
/// This function allows a script to change the effective base power of a move hit. /// This function allows a script to change the effective base power of a move hit.
/// </summary> /// </summary>
public virtual void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower) public virtual void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{ {
} }
@ -697,4 +697,8 @@ public abstract class Script : IDeepCloneable
public virtual void PreventVolatileAdd(Script script, ref bool preventVolatileAdd) public virtual void PreventVolatileAdd(Script script, ref bool preventVolatileAdd)
{ {
} }
public virtual void IsFloating(IPokemon pokemon, ref bool isFloating)
{
}
} }

View File

@ -41,6 +41,15 @@ public static class NumericHelpers
return result > ushort.MaxValue ? ushort.MaxValue : (ushort)result; return result > ushort.MaxValue ? ushort.MaxValue : (ushort)result;
} }
/// <summary>
/// Multiplies two values. If this overflows, returns <see cref="ushort.MaxValue"/>.
/// </summary>
public static ushort MultiplyOrMax(this ushort value, float multiplier)
{
var result = value * multiplier;
return result > ushort.MaxValue ? ushort.MaxValue : (ushort)result;
}
/// <summary> /// <summary>
/// Multiplies two values. If this overflows, returns <see cref="short.MaxValue"/>. /// Multiplies two values. If this overflows, returns <see cref="short.MaxValue"/>.
/// </summary> /// </summary>

View File

@ -10608,7 +10608,10 @@
"flags": [ "flags": [
"reflectable", "reflectable",
"nonskybattle" "nonskybattle"
] ],
"effect": {
"name": "spikes"
}
}, },
{ {
"name": "spiky_shield", "name": "spiky_shield",
@ -10619,7 +10622,10 @@
"priority": 4, "priority": 4,
"target": "Self", "target": "Self",
"category": "status", "category": "status",
"flags": [] "flags": [],
"effect": {
"name": "spiky_shield"
}
}, },
{ {
"name": "spirit_shackle", "name": "spirit_shackle",
@ -10633,7 +10639,10 @@
"flags": [ "flags": [
"protect", "protect",
"mirror" "mirror"
] ],
"effect": {
"name": "prevent_foes_exit"
}
}, },
{ {
"name": "spit_up", "name": "spit_up",
@ -10646,7 +10655,10 @@
"category": "special", "category": "special",
"flags": [ "flags": [
"protect" "protect"
] ],
"effect": {
"name": "spit_up"
}
}, },
{ {
"name": "spite", "name": "spite",
@ -10662,7 +10674,10 @@
"reflectable", "reflectable",
"mirror", "mirror",
"ignore-substitute" "ignore-substitute"
] ],
"effect": {
"name": "spite"
}
}, },
{ {
"name": "splash", "name": "splash",
@ -10676,6 +10691,7 @@
"flags": [ "flags": [
"gravity" "gravity"
] ]
// No secondary effect
}, },
{ {
"name": "spore", "name": "spore",
@ -10691,7 +10707,13 @@
"reflectable", "reflectable",
"mirror", "mirror",
"powder" "powder"
] ],
"effect": {
"name": "set_status",
"parameters": {
"status": "sleep"
}
}
}, },
{ {
"name": "spotlight", "name": "spotlight",
@ -10705,7 +10727,10 @@
"flags": [ "flags": [
"protect", "protect",
"reflectable" "reflectable"
] ],
"effect": {
"name": "spotlight"
}
}, },
{ {
"name": "stealth_rock", "name": "stealth_rock",
@ -10718,7 +10743,10 @@
"category": "status", "category": "status",
"flags": [ "flags": [
"reflectable" "reflectable"
] ],
"effect": {
"name": "stealth_rock"
}
}, },
{ {
"name": "steam_eruption", "name": "steam_eruption",
@ -10733,7 +10761,14 @@
"protect", "protect",
"mirror", "mirror",
"defrost" "defrost"
] ],
"effect": {
"name": "set_status",
"chance": 30,
"parameters": {
"status": "burned"
}
}
}, },
{ {
"name": "steamroller", "name": "steamroller",
@ -10748,7 +10783,11 @@
"contact", "contact",
"protect", "protect",
"mirror" "mirror"
] ],
"effect": {
"name": "flinch",
"chance": 30
}
}, },
{ {
"name": "steel_wing", "name": "steel_wing",
@ -10763,7 +10802,13 @@
"contact", "contact",
"protect", "protect",
"mirror" "mirror"
] ],
"effect": {
"name": "change_user_defense",
"parameters": {
"amount": 1
}
}
}, },
{ {
"name": "sticky_web", "name": "sticky_web",
@ -10776,7 +10821,10 @@
"category": "status", "category": "status",
"flags": [ "flags": [
"reflectable" "reflectable"
] ],
"effect": {
"name": "sticky_web"
}
}, },
{ {
"name": "stockpile", "name": "stockpile",
@ -10789,7 +10837,10 @@
"category": "status", "category": "status",
"flags": [ "flags": [
"snatch" "snatch"
] ],
"effect": {
"name": "stockpile"
}
}, },
{ {
"name": "stoked_sparksurfer", "name": "stoked_sparksurfer",
@ -10800,7 +10851,13 @@
"priority": 0, "priority": 0,
"target": "Any", "target": "Any",
"category": "special", "category": "special",
"flags": [] "flags": [],
"effect": {
"name": "set_status",
"parameters": {
"status": "paralyzed"
}
}
}, },
{ {
"name": "stomp", "name": "stomp",
@ -10816,7 +10873,11 @@
"protect", "protect",
"mirror", "mirror",
"nonskybattle" "nonskybattle"
] ],
"effect": {
"name": "flinch",
"chance": 30
}
}, },
{ {
"name": "stomping_tantrum", "name": "stomping_tantrum",
@ -10831,7 +10892,10 @@
"contact", "contact",
"protect", "protect",
"mirror" "mirror"
] ],
"effect": {
"name": "stomping_tantrum"
}
}, },
{ {
"name": "stone_edge", "name": "stone_edge",
@ -10845,7 +10909,10 @@
"flags": [ "flags": [
"protect", "protect",
"mirror" "mirror"
] ],
"effect": {
"name": "increased_critical_stage"
}
}, },
{ {
"name": "stored_power", "name": "stored_power",
@ -10859,7 +10926,10 @@
"flags": [ "flags": [
"protect", "protect",
"mirror" "mirror"
] ],
"effect": {
"name": "power_trip"
}
}, },
{ {
"name": "storm_throw", "name": "storm_throw",
@ -10874,7 +10944,10 @@
"contact", "contact",
"protect", "protect",
"mirror" "mirror"
] ],
"effect": {
"name": "storm_throw"
}
}, },
{ {
"name": "strength", "name": "strength",
@ -10890,6 +10963,7 @@
"protect", "protect",
"mirror" "mirror"
] ]
// No secondary effect
}, },
{ {
"name": "strength_sap", "name": "strength_sap",
@ -10905,7 +10979,10 @@
"reflectable", "reflectable",
"mirror", "mirror",
"heal" "heal"
] ],
"effect": {
"name": "strength_sap"
}
}, },
{ {
"name": "string_shot", "name": "string_shot",
@ -10920,7 +10997,13 @@
"protect", "protect",
"reflectable", "reflectable",
"mirror" "mirror"
] ],
"effect": {
"name": "change_target_speed",
"parameters": {
"amount": -2
}
}
}, },
{ {
"name": "struggle_bug", "name": "struggle_bug",
@ -10934,7 +11017,13 @@
"flags": [ "flags": [
"protect", "protect",
"mirror" "mirror"
] ],
"effect": {
"name": "change_target_special_attack",
"parameters": {
"amount": -1
}
}
}, },
{ {
"name": "stun_spore", "name": "stun_spore",
@ -10950,7 +11039,13 @@
"reflectable", "reflectable",
"mirror", "mirror",
"powder" "powder"
] ],
"effect": {
"name": "set_status",
"parameters": {
"status": "paralyzed"
}
}
}, },
{ {
"name": "submission", "name": "submission",
@ -10965,7 +11060,13 @@
"contact", "contact",
"protect", "protect",
"mirror" "mirror"
] ],
"effect": {
"name": "recoil",
"parameters": {
"recoilPercent": 0.25
}
}
}, },
{ {
"name": "substitute", "name": "substitute",

View File

@ -56,4 +56,35 @@ public class MoveDataTests
e); e);
} }
} }
public record SetStatusTestCaseData(IDynamicLibrary Library, IMoveData Move)
{
/// <inheritdoc />
public override string ToString() => Move.Name + " has valid status: " +
Move.SecondaryEffect?.Parameters.GetValueOrDefault("status");
}
public static IEnumerable<Func<SetStatusTestCaseData>> SetStatusMovesHaveValidStatusData()
{
var library = LibraryHelpers.LoadLibrary();
var moveLibrary = library.StaticLibrary.Moves;
foreach (var move in moveLibrary)
{
if (move.SecondaryEffect?.Name != "set_status")
continue;
yield return () => new SetStatusTestCaseData(library, move);
}
}
[Test, MethodDataSource(nameof(SetStatusMovesHaveValidStatusData))]
public async Task SetStatusMovesHaveValidStatus(SetStatusTestCaseData test)
{
if (test.Move.SecondaryEffect == null)
return;
var status = test.Move.SecondaryEffect.Parameters["status"]?.ToString();
if (status == null)
throw new Exception("Missing required parameter 'status'");
await Assert.That(test.Library.ScriptResolver.TryResolve(ScriptCategory.Status, status, null, out _)).IsTrue();
}
} }

View File

@ -12,7 +12,7 @@ public class AcrobaticsTests
// Arrange // Arrange
var move = Substitute.For<IExecutingMove>(); var move = Substitute.For<IExecutingMove>();
var target = Substitute.For<IPokemon>(); var target = Substitute.For<IPokemon>();
byte basePower = 10; ushort basePower = 10;
var user = Substitute.For<IPokemon>(); var user = Substitute.For<IPokemon>();
user.HeldItem.Returns((IItem?)null); user.HeldItem.Returns((IItem?)null);
move.User.Returns(user); move.User.Returns(user);
@ -31,7 +31,7 @@ public class AcrobaticsTests
// Arrange // Arrange
var move = Substitute.For<IExecutingMove>(); var move = Substitute.For<IExecutingMove>();
var target = Substitute.For<IPokemon>(); var target = Substitute.For<IPokemon>();
byte basePower = 10; ushort basePower = 10;
var user = Substitute.For<IPokemon>(); var user = Substitute.For<IPokemon>();
user.HeldItem.Returns(Substitute.For<IItem>()); user.HeldItem.Returns(Substitute.For<IItem>());
move.User.Returns(user); move.User.Returns(user);
@ -50,7 +50,7 @@ public class AcrobaticsTests
// Arrange // Arrange
var move = Substitute.For<IExecutingMove>(); var move = Substitute.For<IExecutingMove>();
var target = Substitute.For<IPokemon>(); var target = Substitute.For<IPokemon>();
byte basePower = 200; ushort basePower = ushort.MaxValue - 100;
var user = Substitute.For<IPokemon>(); var user = Substitute.For<IPokemon>();
move.User.Returns(user); move.User.Returns(user);
user.HeldItem.Returns((IItem?)null); user.HeldItem.Returns((IItem?)null);
@ -60,6 +60,6 @@ public class AcrobaticsTests
acrobatics.ChangeBasePower(move, target, 0, ref basePower); acrobatics.ChangeBasePower(move, target, 0, ref basePower);
// Assert // Assert
await Assert.That(basePower).IsEqualTo(byte.MaxValue); await Assert.That(basePower).IsEqualTo(ushort.MaxValue);
} }
} }

View File

@ -82,7 +82,7 @@ public class HiddenPowerTests
dynamicLibrary.StaticLibrary.Returns(staticLibrary); dynamicLibrary.StaticLibrary.Returns(staticLibrary);
var hiddenPower = new HiddenPower(); var hiddenPower = new HiddenPower();
byte power = 0; ushort power = 0;
hiddenPower.ChangeBasePower(executingMove, target, 0, ref power); hiddenPower.ChangeBasePower(executingMove, target, 0, ref power);
await Assert.That(power).IsEqualTo(test.ExpectedPower); await Assert.That(power).IsEqualTo(test.ExpectedPower);

View File

@ -2,4 +2,5 @@ global using PkmnLib.Dynamic.ScriptHandling;
global using PkmnLib.Dynamic.ScriptHandling.Registry; global using PkmnLib.Dynamic.ScriptHandling.Registry;
global using PkmnLib.Dynamic.Events; global using PkmnLib.Dynamic.Events;
global using PkmnLib.Dynamic.Models; 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 System;
using PkmnLib.Dynamic.Libraries; using PkmnLib.Dynamic.Libraries;
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Libraries; namespace PkmnLib.Plugin.Gen7.Libraries;

View File

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

View File

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

View File

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

View File

@ -1,5 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using PkmnLib.Static;
using PkmnLib.Static.Utils; using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Battle; namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
@ -7,6 +6,8 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
[Script(ScriptCategory.Battle, "gravity")] [Script(ScriptCategory.Battle, "gravity")]
public class Gravity : Script public class Gravity : Script
{ {
private int _turns = 5;
/// <inheritdoc /> /// <inheritdoc />
public override void ChangeTypesForIncomingMove(IExecutingMove executingMove, IPokemon target, byte hitIndex, public override void ChangeTypesForIncomingMove(IExecutingMove executingMove, IPokemon target, byte hitIndex,
IList<TypeIdentifier> types) IList<TypeIdentifier> types)
@ -25,4 +26,21 @@ public class Gravity : Script
if (move.UseMove.HasFlag("gravity")) if (move.UseMove.HasFlag("gravity"))
fail = true; 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; namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
[Script(ScriptCategory.Move, "ion_deluge")] [Script(ScriptCategory.Move, "ion_deluge")]

View File

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

View File

@ -8,7 +8,7 @@ public class MudSportEffect : Script
private int _turnsLeft = 5; private int _turnsLeft = 5;
/// <inheritdoc /> /// <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") if (move.UseMove.MoveType.Name == "electric")
{ {

View File

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

View File

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

View File

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

View File

@ -6,6 +6,6 @@ namespace PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
public class MeFirstPowerBoost : Script public class MeFirstPowerBoost : Script
{ {
/// <inheritdoc /> /// <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); basePower = basePower.MultiplyOrMax(1.5f);
} }

View File

@ -6,6 +6,6 @@ namespace PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
public class RoundPowerBoost : Script public class RoundPowerBoost : Script
{ {
/// <inheritdoc /> /// <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); basePower = basePower.MultiplyOrMax(2f);
} }

View File

@ -12,7 +12,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class Acrobatics : Script public class Acrobatics : Script
{ {
/// <inheritdoc /> /// <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) if (move.User.HeldItem == null)
basePower = basePower.MultiplyOrMax(2); basePower = basePower.MultiplyOrMax(2);

View File

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

View File

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

View File

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

View File

@ -30,7 +30,7 @@ public class BeatUp : Script
} }
/// <inheritdoc /> /// <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 relevantPartyMembers = _relevantPartyMembers ??= GetRelevantPartyMembers(move.User).ToArray();
var hittingPokemon = relevantPartyMembers.ElementAtOrDefault(hit); var hittingPokemon = relevantPartyMembers.ElementAtOrDefault(hit);

View File

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

View File

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

View File

@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class Brine : Script public class Brine : Script
{ {
/// <inheritdoc /> /// <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) if (target.CurrentHealth <= target.BoostedStats.Hp / 2)
{ {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class CrushGrip : Script public class CrushGrip : Script
{ {
/// <inheritdoc /> /// <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); basePower = Math.Max((byte)(120 * target.CurrentHealth / target.BoostedStats.Hp), (byte)1);
} }

View File

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

View File

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

View File

@ -19,7 +19,7 @@ public class DoublePowerIfTargetDamagedInTurn : Script
} }
/// <inheritdoc /> /// <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; var battle = move.User.BattleData?.Battle;
if (battle == null) if (battle == null)

View File

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

View File

@ -4,7 +4,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class ElectroBall : Script public class ElectroBall : Script
{ {
/// <inheritdoc /> /// <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 user = move.User;
var targetSpeed = target.BoostedStats.Speed; var targetSpeed = target.BoostedStats.Speed;

View File

@ -5,7 +5,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "eruption")] [Script(ScriptCategory.Move, "eruption")]
public class Eruption : Script 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); 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 public class Facade : Script
{ {
/// <inheritdoc /> /// <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; var status = move.User.StatusScript.Script?.Name;
if (status == "paralyzed" || status == "burned" || status == "poisoned") if (status == "paralyzed" || status == "burned" || status == "poisoned")

View File

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

View File

@ -4,7 +4,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class Flail : Script public class Flail : Script
{ {
/// <inheritdoc /> /// <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 remainingHealth = move.User.CurrentHealth / move.User.BoostedStats.Hp;
var fraction = remainingHealth * 48; var fraction = remainingHealth * 48;

View File

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

View File

@ -1,12 +1,10 @@
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves; namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "fling")] [Script(ScriptCategory.Move, "fling")]
public class Fling : Script public class Fling : Script
{ {
/// <inheritdoc /> /// <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; var item = move.User.HeldItem;
if (item == null) if (item == null)

View File

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

View File

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

View File

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

View File

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

View File

@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class Frustration : Script public class Frustration : Script
{ {
/// <inheritdoc /> /// <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 friendship = move.User.Happiness;
basePower = Math.Max((byte)1, (byte)((255 - friendship) * 2 / 5)); 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 public class FuryCutter : Script
{ {
/// <inheritdoc /> /// <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>(); var userEffect = move.User.Volatile.Get<FuryCutterEffect>();
if (userEffect == null) if (userEffect == null)

View File

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

View File

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

View File

@ -4,7 +4,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class GrassKnot : Script public class GrassKnot : Script
{ {
/// <inheritdoc /> /// <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; var targetWeight = target.WeightInKg;
basePower = targetWeight switch basePower = targetWeight switch

View File

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

View File

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

View File

@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class GyroBall : Script public class GyroBall : Script
{ {
/// <inheritdoc /> /// <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)); basePower = Math.Min((byte)150, (byte)(25 * target.BoostedStats.Speed / move.User.BoostedStats.Speed + 1));
} }

View File

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

View File

@ -4,7 +4,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class HeatCrash : Script public class HeatCrash : Script
{ {
/// <inheritdoc /> /// <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; var weightMultiplier = move.User.WeightInKg / target.WeightInKg;
basePower = weightMultiplier switch basePower = weightMultiplier switch

View File

@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class Hex : Script public class Hex : Script
{ {
/// <inheritdoc /> /// <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) if (!target.StatusScript.IsEmpty)
{ {

View File

@ -1,5 +1,4 @@
using System; using System;
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves; namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
@ -18,7 +17,7 @@ public class HiddenPower : Script
} }
/// <inheritdoc /> /// <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; var ivs = move.User.IndividualValues;

View File

@ -8,7 +8,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class IceBall : Script public class IceBall : Script
{ {
/// <inheritdoc /> /// <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>(); var userEffect = move.User.Volatile.Get<IceBallEffect>();
if (userEffect == null) if (userEffect == null)

View File

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

View File

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

View File

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

View File

@ -4,7 +4,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class LowKick : Script public class LowKick : Script
{ {
/// <inheritdoc /> /// <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 basePower = target.WeightInKg switch
{ {

View File

@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class Magnitude : Script public class Magnitude : Script
{ {
/// <inheritdoc /> /// <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; var battleData = move.User.BattleData;
if (battleData == null) if (battleData == null)

View File

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

View File

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

View File

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

View File

@ -1,5 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using PkmnLib.Static;
using PkmnLib.Static.Utils; using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves; namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
@ -8,7 +7,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class NaturalGift : Script public class NaturalGift : Script
{ {
/// <inheritdoc /> /// <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); var naturalGiftData = GetNaturalGiftData(move.User.HeldItem);
if (naturalGiftData == null) if (naturalGiftData == null)

View File

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

View File

@ -9,7 +9,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class Payback : Script public class Payback : Script
{ {
/// <inheritdoc /> /// <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; var battleData = move.User.BattleData;

View File

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

View File

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

View File

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

View File

@ -40,7 +40,7 @@ public class Present : Script
} }
/// <inheritdoc /> /// <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; basePower = _basePower;
} }

View File

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

View File

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

View File

@ -1,5 +1,4 @@
using System.Linq; using System.Linq;
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves; namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
@ -7,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class Punishment : Script public class Punishment : Script
{ {
/// <inheritdoc /> /// <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) if (move.User.BattleData == null)
return; return;

View File

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

View File

@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class Retaliate : Script public class Retaliate : Script
{ {
/// <inheritdoc /> /// <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; var battleData = move.User.BattleData;
if (battleData is null) if (battleData is null)

View File

@ -4,7 +4,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class Return : Script public class Return : Script
{ {
/// <inheritdoc /> /// <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 friendship = move.User.Happiness;
var power = friendship * 2 / 5; var power = friendship * 2 / 5;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,3 @@
using System;
using System.Linq; using System.Linq;
using PkmnLib.Plugin.Gen7.Scripts.MoveVolatile; using PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
using PkmnLib.Plugin.Gen7.Scripts.Utils; 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.Plugin.Gen7.Scripts.Pokemon;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves; namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

View File

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

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