This commit is contained in:
@@ -3,7 +3,6 @@ using System.Text.Json;
|
||||
using PkmnLib.Dynamic.Libraries;
|
||||
using PkmnLib.Dynamic.Plugins;
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
using PkmnLib.Plugin.Gen7.Common;
|
||||
using PkmnLib.Static.Moves;
|
||||
using PkmnLib.Static.Utils;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using PkmnLib.Dynamic.Events;
|
||||
using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
using PkmnLib.Static.Species;
|
||||
using PkmnLib.Static.Utils;
|
||||
@@ -333,7 +332,7 @@ public class AftermathTests
|
||||
aftermath.OnFaint(target, DamageSource.MoveDamage);
|
||||
|
||||
// Assert
|
||||
await Assert.That(GetDamageSource(user)).IsEqualTo(DamageSource.Misc);
|
||||
await Assert.That(GetDamageSource(user)!.Value).IsEqualTo(DamageSource.Misc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
using Assembly = System.Reflection.Assembly;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Tests.Scripts;
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ public class AcrobaticsTests
|
||||
acrobatics.ChangeBasePower(move, target, 0, ref basePower);
|
||||
|
||||
// Assert
|
||||
await Assert.That(basePower).IsEqualTo((byte)20);
|
||||
await Assert.That(basePower).IsEqualTo((ushort)20);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -41,7 +41,7 @@ public class AcrobaticsTests
|
||||
acrobatics.ChangeBasePower(move, target, 0, ref basePower);
|
||||
|
||||
// Assert
|
||||
await Assert.That(basePower).IsEqualTo((byte)10);
|
||||
await Assert.That(basePower).IsEqualTo((ushort)10);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -77,7 +77,7 @@ public class BatonPassTests
|
||||
script.OnSecondaryEffect(move, user, 0);
|
||||
|
||||
// Assert
|
||||
side.Received(1).SwapPokemon((byte)1, toSwitch);
|
||||
side.Received(1).SwapPokemon(1, toSwitch);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -85,7 +85,7 @@ public class BeakBlastTests
|
||||
// Assert
|
||||
await Assert.That(capturedEvent).IsNotNull();
|
||||
await Assert.That(capturedEvent!.Message).IsEqualTo("beak_blast_charge");
|
||||
await Assert.That(capturedEvent.Parameters!["user"]).IsEqualTo(user);
|
||||
await Assert.That((IPokemon)capturedEvent.Parameters!["user"]).IsEqualTo(user);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -70,7 +70,7 @@ public class BellyDrumTests
|
||||
script.OnSecondaryEffect(move, user, 0);
|
||||
|
||||
// Assert
|
||||
await Assert.That(GetDamageCall(user)).IsEqualTo((expectedDeduction, DamageSource.Misc, true));
|
||||
await Assert.That(GetDamageCall(user)!.Value).IsEqualTo((expectedDeduction, DamageSource.Misc, true));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -45,7 +45,7 @@ public class BestowTests
|
||||
script.OnSecondaryEffect(move, target, 0);
|
||||
|
||||
// Assert
|
||||
target.Received(1).ForceSetHeldItem(userItem);
|
||||
_ = target.Received(1).ForceSetHeldItem(userItem);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -115,7 +115,7 @@ public class BestowTests
|
||||
script.OnSecondaryEffect(move, target, 0);
|
||||
|
||||
// Assert
|
||||
target.DidNotReceive().ForceSetHeldItem(Arg.Any<IItem>());
|
||||
_ = target.DidNotReceive().ForceSetHeldItem(Arg.Any<IItem>());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -135,7 +135,7 @@ public class BideTests
|
||||
script.OnSecondaryEffect(move, target, 0);
|
||||
|
||||
// Assert
|
||||
await Assert.That(GetDamageAmount(attacker)).IsEqualTo(expectedDamage);
|
||||
await Assert.That(GetDamageAmount(attacker)!.Value).IsEqualTo(expectedDamage);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -154,7 +154,7 @@ public class BideTests
|
||||
script.OnSecondaryEffect(move, target, 0);
|
||||
|
||||
// Assert
|
||||
await Assert.That(GetDamageSource(attacker)).IsEqualTo(DamageSource.MoveDamage);
|
||||
await Assert.That(GetDamageSource(attacker)!.Value).IsEqualTo(DamageSource.MoveDamage);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -126,7 +126,7 @@ public class BindTests
|
||||
effect!.OnEndTurn(target, Substitute.For<IBattle>());
|
||||
|
||||
// Assert
|
||||
await Assert.That(GetDamageAmount(target)).IsEqualTo(expectedDamage);
|
||||
await Assert.That(GetDamageAmount(target)!.Value).IsEqualTo(expectedDamage);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -193,7 +193,7 @@ public class BindTests
|
||||
effect!.OnEndTurn(target, Substitute.For<IBattle>());
|
||||
|
||||
// Assert
|
||||
await Assert.That(GetDamageAmount(target)).IsEqualTo(expectedDamage);
|
||||
await Assert.That(GetDamageAmount(target)!.Value).IsEqualTo(expectedDamage);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -3,7 +3,6 @@ using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
using PkmnLib.Static.Utils;
|
||||
using TUnit.Assertions.AssertConditions.Throws;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Tests.Scripts.Moves;
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
using PkmnLib.Static;
|
||||
using PkmnLib.Static.Utils;
|
||||
using TUnit.Assertions.AssertConditions.Throws;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Tests.Scripts.Moves;
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ public class DrainTests
|
||||
drain.OnSecondaryEffect(move, target, 0);
|
||||
|
||||
// Assert
|
||||
await Assert.That(GetHealAmount(user)).IsEqualTo(50u);
|
||||
await Assert.That(GetHealAmount(user)!.Value).IsEqualTo(50u);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -97,7 +97,7 @@ public class DrainTests
|
||||
drain.OnSecondaryEffect(move, target, 0);
|
||||
|
||||
// Assert
|
||||
await Assert.That(GetHealAmount(user)).IsEqualTo(expectedHeal);
|
||||
await Assert.That(GetHealAmount(user)!.Value).IsEqualTo(expectedHeal);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -115,7 +115,7 @@ public class DrainTests
|
||||
drain.OnSecondaryEffect(move, target, 0);
|
||||
|
||||
// Assert
|
||||
await Assert.That(GetHealAmount(user)).IsEqualTo(1u);
|
||||
await Assert.That(GetHealAmount(user)!.Value).IsEqualTo(1u);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -132,7 +132,7 @@ public class DrainTests
|
||||
drain.OnSecondaryEffect(move, target, 0);
|
||||
|
||||
// Assert - 65% of 100 damage
|
||||
await Assert.That(GetHealAmount(user)).IsEqualTo(65u);
|
||||
await Assert.That(GetHealAmount(user)!.Value).IsEqualTo(65u);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -149,7 +149,7 @@ public class DrainTests
|
||||
drain.OnSecondaryEffect(move, target, 0);
|
||||
|
||||
// Assert - user takes the 50 HP it would have gained, and is not healed
|
||||
await Assert.That(GetDamageAmount(user)).IsEqualTo(50u);
|
||||
await Assert.That(GetDamageAmount(user)!.Value).IsEqualTo(50u);
|
||||
await Assert.That(user.ReceivedCalls().Any(c => c.GetMethodInfo().Name == "Heal")).IsFalse();
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ public class DrainTests
|
||||
drain.OnSecondaryEffect(move, target, 0);
|
||||
|
||||
// Assert
|
||||
await Assert.That(GetDamageSource(user)).IsEqualTo(DamageSource.Misc);
|
||||
await Assert.That(GetDamageSource(user)!.Value).IsEqualTo(DamageSource.Misc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -184,7 +184,7 @@ public class DrainTests
|
||||
drain.OnSecondaryEffect(move, target, 0);
|
||||
|
||||
// Assert
|
||||
await Assert.That(GetDamageAmount(user)).IsEqualTo(65u);
|
||||
await Assert.That(GetDamageAmount(user)!.Value).IsEqualTo(65u);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -238,6 +238,6 @@ public class DrainTests
|
||||
drain.OnSecondaryEffect(move, target, 0);
|
||||
|
||||
// Assert
|
||||
await Assert.That(GetHealAmount(user)).IsEqualTo(50u);
|
||||
await Assert.That(GetHealAmount(user)!.Value).IsEqualTo(50u);
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ namespace PkmnLib.Plugin.Gen7.Tests.Scripts.Moves;
|
||||
|
||||
public class HiddenPowerTests
|
||||
{
|
||||
public record TestCaseData(IndividualValueStatisticSet Ivs, StringKey ExpectedType, byte ExpectedPower)
|
||||
public record TestCaseData(IndividualValueStatisticSet Ivs, StringKey ExpectedType, ushort ExpectedPower)
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string ToString() =>
|
||||
|
||||
@@ -86,6 +86,6 @@ public class MultiAttackTests
|
||||
multiAttack.ChangeMoveType(move, target, 0, ref typeIdentifier);
|
||||
|
||||
// Assert
|
||||
await Assert.That(typeIdentifier!.Value.Name).IsEqualTo(test.ExpectedTypeName);
|
||||
await Assert.That(typeIdentifier!.Value.Name.ToString()).IsEqualTo(test.ExpectedTypeName);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using PkmnLib.Dynamic.AI.Explicit;
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Status;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
using PkmnLib.Plugin.Gen7.Common;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/RKS_System_(Ability)">Bulbapedia - RKS System</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "rks_system")]
|
||||
public class RKSSystem : Script, IScriptOnAfterHeldItemChange
|
||||
public class RksSystem : Script, IScriptOnAfterHeldItemChange
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnAfterHeldItemChange(IPokemon pokemon, IItem? previous, IItem? item)
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
using PkmnLib.Plugin.Gen7.Common;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -6,7 +6,7 @@ public class KnockOff : Script, IScriptOnSecondaryEffect
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
if (!target.TryStealHeldItem(out var item))
|
||||
if (!target.TryStealHeldItem(out _))
|
||||
{
|
||||
move.GetHitData(target, hit).Fail();
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "magma_storm")]
|
||||
public class MagmaStorm : MultiHitMove
|
||||
public class MagmaStorm : MultiHitMove, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||
using PkmnLib.Static.Moves;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
using PkmnLib.Plugin.Gen7.Common;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "protect")]
|
||||
|
||||
@@ -30,7 +30,7 @@ public class PursuitEffect : Script, IScriptOnSwitchOut
|
||||
|
||||
var choiceQueue = battleData.Battle.ChoiceQueue;
|
||||
|
||||
var choice = choiceQueue?.FirstOrDefault(x => x == _choice);
|
||||
var choice = choiceQueue?.FirstOrDefault(x => Equals(x, _choice));
|
||||
if (choice == null)
|
||||
return;
|
||||
choiceQueue!.Remove(choice);
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
using PkmnLib.Plugin.Gen7.Common;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Status;
|
||||
|
||||
[Script(ScriptCategory.Status, "frozen")]
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Weather;
|
||||
|
||||
[Script(ScriptCategory.Weather, "desolate_lands")]
|
||||
public class DesolateLands : HarshSunlight, IScriptFailMove, IScriptOnEndTurn, IScriptOnSwitchOut,
|
||||
IScriptPreventWeatherChange
|
||||
public class DesolateLands : HarshSunlight, IScriptFailMove, IScriptOnSwitchOut, IScriptPreventWeatherChange
|
||||
{
|
||||
private readonly HashSet<IPokemon> _placers = [];
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Weather;
|
||||
|
||||
[Script(ScriptCategory.Weather, "primordial_sea")]
|
||||
public class PrimordialSea : Rain, IScriptFailMove, IScriptOnEndTurn, IScriptOnSwitchOut, IScriptPreventWeatherChange
|
||||
public class PrimordialSea : Rain, IScriptFailMove, IScriptOnSwitchOut, IScriptPreventWeatherChange
|
||||
{
|
||||
private HashSet<IPokemon> _placers = new();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user