More tests, more fixes
All checks were successful
Build / Build (push) Successful in 1m57s

This commit is contained in:
2026-07-05 18:26:55 +02:00
parent 1ab15110f5
commit 6a82c20cf2
20 changed files with 1682 additions and 12 deletions

View File

@@ -9,7 +9,7 @@ public class Captivate : Script, IScriptOnSecondaryEffect
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
var user = move.User;
if (target.Gender == Gender.Genderless || target.Gender == user.Gender)
if (target.Gender == Gender.Genderless || target.Gender == user.Gender || user.Gender == Gender.Genderless)
{
move.GetHitData(target, hit).Fail();
return;

View File

@@ -16,7 +16,7 @@ public class Conversion2 : Script, IScriptOnSecondaryEffect
var typeLibrary = move.User.BattleData!.Battle.Library.StaticLibrary.Types;
// Get all types against which the last move would be not very effective
var type = typeLibrary.GetAllEffectivenessFromAttacking(lastMoveByTarget.ChosenMove.MoveData.MoveType)
.Where(x => x.effectiveness < 1)
.Where(x => x.effectiveness < 1 && !move.User.Types.Contains(x.type))
// Shuffle them randomly, but deterministically
.OrderBy(_ => move.User.BattleData.Battle.Random.GetInt()).ThenBy(x => x.type.Value)
// And grab the first one

View File

@@ -11,8 +11,8 @@ public class CoreEnforcer : Script, IScriptOnSecondaryEffect
return;
var turnChoices = battleData.Battle.PreviousTurnChoices.Last();
var currentChoiceIndex = turnChoices.IndexOf(move.MoveChoice);
if (currentChoiceIndex == -1 ||
!turnChoices.Take(currentChoiceIndex).Any(choice => choice is IMoveChoice or IItemChoice))
if (currentChoiceIndex == -1 || !turnChoices.Take(currentChoiceIndex)
.Any(choice => choice is IMoveChoice or IItemChoice && choice.User == target))
{
move.GetHitData(target, hit).Fail();
return;

View File

@@ -8,7 +8,9 @@ public class Covet : Script, IScriptOnSecondaryEffect
{
if (target.HeldItem == null)
return;
if (!move.User.TryStealHeldItem(out var item))
if (move.User.HeldItem is not null)
return;
if (!target.TryStealHeldItem(out var item))
return;
_ = move.User.ForceSetHeldItem(item);
}

View File

@@ -16,9 +16,7 @@ public class Curse : Script, IScriptOnSecondaryEffect
return;
if (move.User.Types.Contains(ghostType))
{
move.User.Damage(move.User.CurrentHealth / 2, DamageSource.Misc, forceDamage: true);
if (move.User.CurrentHealth == 0)
return;
move.User.Damage(move.User.MaxHealth / 2, DamageSource.Misc, forceDamage: true);
target.Volatile.Add(new GhostCurseEffect(target));
}
else