More unit tests, fixes
This commit is contained in:
@@ -37,7 +37,7 @@ public class BatonPass : Script, IScriptOnSecondaryEffect
|
||||
foreach (var script in volatileScripts)
|
||||
{
|
||||
if (script is not IBatonPassException)
|
||||
return;
|
||||
continue;
|
||||
toSwitch.Volatile.Add(script);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,11 @@ public class BellyDrum : Script, IScriptOnSecondaryEffect
|
||||
move.GetHitData(target, hit).Fail();
|
||||
return;
|
||||
}
|
||||
if (target.StatBoost.Attack >= 6)
|
||||
{
|
||||
move.GetHitData(target, hit).Fail();
|
||||
return;
|
||||
}
|
||||
|
||||
target.Damage(maxHealthHalved, DamageSource.Misc, forceDamage: true);
|
||||
// Raising the user's Attack by 12 stages should always set it to +6.
|
||||
|
||||
@@ -7,7 +7,7 @@ public class Bestow : Script, IScriptOnSecondaryEffect
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
var user = move.User;
|
||||
var userHeldItem = user.RemoveHeldItemForBattle();
|
||||
var userHeldItem = user.HeldItem;
|
||||
var targetHeldItem = target.HeldItem;
|
||||
|
||||
if (userHeldItem == null || targetHeldItem != null)
|
||||
@@ -15,7 +15,7 @@ public class Bestow : Script, IScriptOnSecondaryEffect
|
||||
move.GetHitData(target, hit).Fail();
|
||||
return;
|
||||
}
|
||||
|
||||
userHeldItem = user.RemoveHeldItemForBattle();
|
||||
_ = target.ForceSetHeldItem(userHeldItem);
|
||||
}
|
||||
}
|
||||
@@ -16,11 +16,18 @@ public class Bide : Script, IScriptOnSecondaryEffect
|
||||
}
|
||||
|
||||
bideEffect.Turns += 1;
|
||||
if (bideEffect.Turns < 2)
|
||||
if (bideEffect.Turns < 3)
|
||||
return;
|
||||
var lastPokemon = bideEffect.HitBy.LastOrDefault(x => x.BattleData?.IsOnBattlefield == true);
|
||||
lastPokemon?.Damage(bideEffect.DamageTaken, DamageSource.MoveDamage);
|
||||
if (bideEffect.DamageTaken == 0)
|
||||
{
|
||||
move.GetHitData(target, hit).Fail();
|
||||
}
|
||||
else
|
||||
{
|
||||
var lastPokemon = bideEffect.HitBy.LastOrDefault(x => x.BattleData?.IsOnBattlefield == true);
|
||||
lastPokemon?.Damage(bideEffect.DamageTaken * 2, DamageSource.MoveDamage);
|
||||
}
|
||||
|
||||
RemoveSelf();
|
||||
move.User.Volatile.Remove<BideEffect>();
|
||||
}
|
||||
}
|
||||
@@ -5,9 +5,13 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
[Script(ScriptCategory.Move, "block")]
|
||||
public class Block : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
private static StringKey GhostTypeName => new("ghost");
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
if (target.Types.Any(x => x.Name == GhostTypeName))
|
||||
return;
|
||||
target.Volatile.Add(new BlockEffect());
|
||||
}
|
||||
}
|
||||
@@ -8,10 +8,8 @@ public class BrickBreak : Script, IScriptOnBeforeMove
|
||||
/// <inheritdoc />
|
||||
public void OnBeforeMove(IExecutingMove move)
|
||||
{
|
||||
var sides = move.User.BattleData?.Battle.Sides;
|
||||
if (sides == null)
|
||||
return;
|
||||
|
||||
var targets = move.Targets.WhereNotNull();
|
||||
var sides = targets.Select(x => x.BattleData!.BattleSide).Distinct();
|
||||
foreach (var side in sides)
|
||||
{
|
||||
side.VolatileScripts.Remove(ScriptUtils.ResolveName<ReflectEffect>());
|
||||
|
||||
@@ -9,7 +9,7 @@ public class BanefulBunkerEffect : ProtectionEffectScript
|
||||
public override void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
||||
{
|
||||
base.BlockIncomingHit(executingMove, target, hitIndex, ref block);
|
||||
if (executingMove.UseMove.Category != MoveCategory.Status &&
|
||||
if (block && executingMove.UseMove.Category != MoveCategory.Status &&
|
||||
executingMove.GetHitData(target, hitIndex).IsContact)
|
||||
{
|
||||
executingMove.User.SetStatus(ScriptUtils.ResolveName<Status.Poisoned>(), executingMove.User);
|
||||
|
||||
@@ -30,7 +30,7 @@ public class ChargeBounceEffect : Script, IScriptForceTurnSelection, IScriptChan
|
||||
/// <inheritdoc />
|
||||
public void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
if (!move.UseMove.HasFlag(MoveFlags.EffectiveAgainstFly))
|
||||
if (move.UseMove.HasFlag(MoveFlags.EffectiveAgainstFly))
|
||||
damage *= 2;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user