Move all battle state from IPokemon to an ephemeral IBattlePokemon wrapper
This commit is contained in:
@@ -10,7 +10,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class Acrobatics : Script, IScriptChangeBasePower
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
|
||||
public void ChangeBasePower(IExecutingMove move, IBattlePokemon target, byte hit, ref ushort basePower)
|
||||
{
|
||||
if (move.User.HeldItem == null)
|
||||
basePower = basePower.MultiplyOrMax(2);
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class Acupressure : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
var possibleStats = target.StatBoost.Where(x => x.statistic != Statistic.Hp && x.value < 6).ToArray();
|
||||
// If the target has no stats to raise, the move fails
|
||||
@@ -22,7 +22,7 @@ public class Acupressure : Script, IScriptOnSecondaryEffect
|
||||
return;
|
||||
}
|
||||
|
||||
var index = move.User.BattleData!.Battle.Random.GetInt(0, possibleStats.Length);
|
||||
var index = move.User.Battle.Random.GetInt(0, possibleStats.Length);
|
||||
var stat = possibleStats[index].statistic;
|
||||
target.ChangeStatBoost(stat, 2, false, false);
|
||||
}
|
||||
|
||||
@@ -13,9 +13,9 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class AfterYou : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
var queue = move.User.BattleData!.Battle.ChoiceQueue;
|
||||
var queue = move.User.Battle.ChoiceQueue;
|
||||
if (queue == null)
|
||||
return;
|
||||
|
||||
|
||||
@@ -20,16 +20,14 @@ public class Assist : Script, IScriptChangeMove
|
||||
public void ChangeMove(IMoveChoice choice, ref StringKey moveName)
|
||||
{
|
||||
var user = choice.User;
|
||||
if (user.BattleData == null)
|
||||
return;
|
||||
var battle = user.BattleData.Battle;
|
||||
var party = battle.Parties.FirstOrDefault(p => p.Party.Contains(user));
|
||||
var battle = user.Battle;
|
||||
var party = battle.Parties.FirstOrDefault(p => p.BattlePokemon.Contains(user));
|
||||
if (party == null)
|
||||
{
|
||||
choice.Fail();
|
||||
return;
|
||||
}
|
||||
var moves = GetPartyMoves(party.Party, user).ToList();
|
||||
var moves = GetPartyMoves(party.BattlePokemon, user).ToList();
|
||||
if (moves.Count == 0)
|
||||
{
|
||||
choice.Fail();
|
||||
@@ -39,7 +37,7 @@ public class Assist : Script, IScriptChangeMove
|
||||
moveName = moves[random].Name;
|
||||
}
|
||||
|
||||
private static IEnumerable<IMoveData> GetPartyMoves(IPokemonParty party, IPokemon user)
|
||||
private static IEnumerable<IMoveData> GetPartyMoves(IReadOnlyList<IBattlePokemon?> party, IBattlePokemon user)
|
||||
{
|
||||
foreach (var pokemon in party.WhereNotNull())
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class Attract : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
if (target.Gender == move.User.Gender)
|
||||
{
|
||||
|
||||
@@ -25,9 +25,9 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class AuroraVeil : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
var battle = move.User.BattleData?.Battle;
|
||||
var battle = move.User.Battle;
|
||||
if (battle == null)
|
||||
return;
|
||||
|
||||
@@ -37,7 +37,7 @@ public class AuroraVeil : Script, IScriptOnSecondaryEffect
|
||||
return;
|
||||
}
|
||||
|
||||
var side = battle.Sides[move.User.BattleData!.SideIndex];
|
||||
var side = battle.Sides[move.User.SideIndex];
|
||||
|
||||
var args = new CustomTriggers.AuroraVeilDurationArgs(move, 5);
|
||||
move.User.RunScriptHook<IScriptCustomTrigger>(x => x.CustomTrigger(CustomTriggers.AuroraVeilDuration, args));
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class Autotomize : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
var user = move.User;
|
||||
if (!user.ChangeStatBoost(Statistic.Speed, 2, true, false))
|
||||
@@ -30,7 +30,7 @@ public class Autotomize : Script, IScriptOnSecondaryEffect
|
||||
return;
|
||||
|
||||
user.Volatile.StackOrAdd(ScriptUtils.ResolveName<AutotomizeEffect>(), () => new AutotomizeEffect());
|
||||
var battle = user.BattleData?.Battle;
|
||||
var battle = user.Battle;
|
||||
battle?.EventHook.Invoke(new DialogEvent("pokemon_became_nimble", new Dictionary<string, object>
|
||||
{
|
||||
{ "pokemon", user },
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public abstract class BaseChargeMove<TVolatile> : Script, IScriptPreventMove, IScriptOnBeforeMove,
|
||||
IScriptOnSecondaryEffect where TVolatile : RequireChargeEffect
|
||||
{
|
||||
public abstract TVolatile CreateVolatile(IPokemon user);
|
||||
public abstract TVolatile CreateVolatile(IBattlePokemon user);
|
||||
|
||||
public void PreventMove(IExecutingMove move, ref bool prevent)
|
||||
{
|
||||
@@ -18,7 +18,7 @@ public abstract class BaseChargeMove<TVolatile> : Script, IScriptPreventMove, IS
|
||||
return;
|
||||
|
||||
move.User.Volatile.Add(CreateVolatile(move.User));
|
||||
move.User.BattleData?.Battle.EventHook.Invoke(new DialogEvent("began_charging", new Dictionary<string, object>
|
||||
move.User.Battle.EventHook.Invoke(new DialogEvent("began_charging", new Dictionary<string, object>
|
||||
{
|
||||
{ "user", move.User },
|
||||
}));
|
||||
@@ -32,7 +32,7 @@ public abstract class BaseChargeMove<TVolatile> : Script, IScriptPreventMove, IS
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public virtual void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -6,15 +6,15 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class BatonPass : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
var user = move.User;
|
||||
var additionalData = move.MoveChoice.AdditionalData;
|
||||
if (additionalData == null)
|
||||
return;
|
||||
if (additionalData["to_switch"] is not IPokemon toSwitch)
|
||||
if (additionalData["to_switch"] is not IBattlePokemon toSwitch)
|
||||
return;
|
||||
var battleData = user.BattleData;
|
||||
var battleData = user;
|
||||
if (battleData == null)
|
||||
return;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ public class BeakBlast : Script, IScriptOnBeforeTurnStart, IScriptOnSecondaryEff
|
||||
/// <inheritdoc />
|
||||
public void OnBeforeTurnStart(ITurnChoice choice)
|
||||
{
|
||||
var battleData = choice.User.BattleData;
|
||||
var battleData = choice.User;
|
||||
if (battleData == null)
|
||||
return;
|
||||
choice.User.Volatile.Add(new BeakBlastEffect());
|
||||
@@ -19,7 +19,7 @@ public class BeakBlast : Script, IScriptOnBeforeTurnStart, IScriptOnSecondaryEff
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
move.User.Volatile.Remove(ScriptUtils.ResolveName<BeakBlastEffect>());
|
||||
}
|
||||
|
||||
@@ -3,16 +3,12 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
[Script(ScriptCategory.Move, "beat_up")]
|
||||
public class BeatUp : Script, IScriptChangeNumberOfHits, IScriptChangeBasePower
|
||||
{
|
||||
private IPokemon[]? _relevantPartyMembers;
|
||||
private IBattlePokemon[]? _relevantPartyMembers;
|
||||
|
||||
private static IEnumerable<IPokemon> GetRelevantPartyMembers(IPokemon user)
|
||||
private static IEnumerable<IBattlePokemon> GetRelevantPartyMembers(IBattlePokemon user)
|
||||
{
|
||||
var battleData = user.BattleData;
|
||||
if (battleData == null)
|
||||
return [];
|
||||
|
||||
var party = battleData.Battle.Parties.FirstOrDefault(x => x.Party.Contains(user));
|
||||
return party?.Party.WhereNotNull().Where(x => x.IsUsable && x.StatusScript.IsEmpty) ?? [];
|
||||
var party = user.Battle.Parties.FirstOrDefault(x => x.BattlePokemon.Contains(user));
|
||||
return party?.BattlePokemon.WhereNotNull().Where(x => x.IsUsable && x.StatusScript.IsEmpty) ?? [];
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -26,7 +22,7 @@ public class BeatUp : Script, IScriptChangeNumberOfHits, IScriptChangeBasePower
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
|
||||
public void ChangeBasePower(IExecutingMove move, IBattlePokemon target, byte hit, ref ushort basePower)
|
||||
{
|
||||
var relevantPartyMembers = _relevantPartyMembers ??= GetRelevantPartyMembers(move.User).ToArray();
|
||||
var hittingPokemon = relevantPartyMembers.ElementAtOrDefault(hit);
|
||||
|
||||
@@ -6,7 +6,7 @@ public class Belch : Script, IScriptPreventMoveSelection
|
||||
/// <inheritdoc />
|
||||
public void PreventMoveSelection(IMoveChoice choice, ref bool prevent)
|
||||
{
|
||||
var battleData = choice.User.BattleData;
|
||||
var battleData = choice.User;
|
||||
if (battleData == null)
|
||||
return;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class BellyDrum : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
var maxHealthHalved = target.BoostedStats.Hp / 2;
|
||||
if (target.CurrentHealth <= maxHealthHalved)
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class Bestow : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
var user = move.User;
|
||||
var userHeldItem = user.HeldItem;
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class Bide : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
var bideEffect = move.User.Volatile.Get<BideEffect>();
|
||||
if (bideEffect == null)
|
||||
@@ -24,7 +24,7 @@ public class Bide : Script, IScriptOnSecondaryEffect
|
||||
}
|
||||
else
|
||||
{
|
||||
var lastPokemon = bideEffect.HitBy.LastOrDefault(x => x.BattleData?.IsOnBattlefield == true);
|
||||
var lastPokemon = bideEffect.HitBy.LastOrDefault(x => x.IsOnBattlefield == true);
|
||||
lastPokemon?.Damage(bideEffect.DamageTaken * 2, DamageSource.MoveDamage);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class Bind : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
var args = new CustomTriggers.ModifyBindArgs(move);
|
||||
move.User.RunScriptHook<IScriptCustomTrigger>(x => x.CustomTrigger(CustomTriggers.ModifyBind, args));
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class Block : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
if (target.Types.Any(x => x.Name == TypeNames.Ghost))
|
||||
return;
|
||||
|
||||
@@ -13,7 +13,7 @@ public class Bounce : Script, IScriptPreventMove, IScriptOnBeforeMove, IScriptOn
|
||||
|
||||
move.User.Volatile.Add(new ChargeBounceEffect(move.User));
|
||||
move.MoveChoice.SetAdditionalData("bounce_charge", true);
|
||||
move.User.BattleData?.Battle.EventHook.Invoke(new DialogEvent("bounce_charge", new Dictionary<string, object>
|
||||
move.User.Battle.EventHook.Invoke(new DialogEvent("bounce_charge", new Dictionary<string, object>
|
||||
{
|
||||
{ "user", move.User },
|
||||
}));
|
||||
@@ -27,9 +27,9 @@ public class Bounce : Script, IScriptPreventMove, IScriptOnBeforeMove, IScriptOn
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
var battle = move.User.BattleData?.Battle;
|
||||
var battle = move.User.Battle;
|
||||
if (battle == null)
|
||||
return;
|
||||
var random = battle.Random;
|
||||
|
||||
@@ -9,7 +9,7 @@ public class BrickBreak : Script, IScriptOnBeforeMove
|
||||
public void OnBeforeMove(IExecutingMove move)
|
||||
{
|
||||
var targets = move.Targets.WhereNotNull();
|
||||
var sides = targets.Select(x => x.BattleData!.BattleSide).Distinct();
|
||||
var sides = targets.Select(x => x.BattleSide).Distinct();
|
||||
foreach (var side in sides)
|
||||
{
|
||||
side.VolatileScripts.Remove(ScriptUtils.ResolveName<ReflectEffect>());
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class Brine : Script, IScriptChangeBasePower
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
|
||||
public void ChangeBasePower(IExecutingMove move, IBattlePokemon target, byte hit, ref ushort basePower)
|
||||
{
|
||||
if (target.CurrentHealth <= target.BoostedStats.Hp / 2)
|
||||
{
|
||||
|
||||
@@ -4,10 +4,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class BugBite : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
var user = move.User;
|
||||
var battleData = user.BattleData;
|
||||
var battleData = user;
|
||||
if (battleData == null)
|
||||
return;
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class BurnUp : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
var battleData = move.User.BattleData;
|
||||
var battleData = move.User;
|
||||
if (battleData == null)
|
||||
return;
|
||||
var typeLibrary = battleData.Battle.Library.StaticLibrary.Types;
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class Camouflage : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
var type = GetTypeIdentifier(move.Battle);
|
||||
if (type == null)
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class Captivate : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
var user = move.User;
|
||||
if (target.Gender == Gender.Genderless || target.Gender == user.Gender || user.Gender == Gender.Genderless)
|
||||
|
||||
@@ -20,7 +20,7 @@ public class ChangeAllTargetStats : Script, IScriptOnInitialize, IScriptOnSecond
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
target.ChangeStatBoost(Statistic.Attack, _amount, target == move.User, false);
|
||||
target.ChangeStatBoost(Statistic.Defense, _amount, target == move.User, false);
|
||||
|
||||
@@ -25,7 +25,7 @@ public class ChangeMultipleTargetStatBoosts : Script, IScriptOnInitialize, IScri
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
EventBatchId batchId = new();
|
||||
foreach (var stat in _statBoosts)
|
||||
|
||||
@@ -25,7 +25,7 @@ public class ChangeMultipleUserStatBoosts : Script, IScriptOnInitialize, IScript
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
EventBatchId batchId = new();
|
||||
foreach (var stat in _statBoosts)
|
||||
|
||||
@@ -30,7 +30,7 @@ public abstract class ChangeTargetStats : Script, IScriptOnInitialize, IScriptOn
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
target.ChangeStatBoost(_stat, _amount, target == move.User, false);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public abstract class ChangeUserStats : Script, IScriptOnInitialize, IScriptOnSe
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public virtual void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
move.User.ChangeStatBoost(_stat, _amount, true, false);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class Charge : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
move.User.ChangeStatBoost(Statistic.SpecialDefense, 1, true, false);
|
||||
move.User.Volatile.Add(new ChargeEffect());
|
||||
|
||||
@@ -4,10 +4,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class ChipAway : Script, IScriptBypassDefensiveStatBoosts, IScriptBypassEvasionStatBoosts
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void BypassDefensiveStatBoosts(IExecutingMove move, IPokemon target, byte hit, ref bool bypass) =>
|
||||
public void BypassDefensiveStatBoosts(IExecutingMove move, IBattlePokemon target, byte hit, ref bool bypass) =>
|
||||
bypass = true;
|
||||
|
||||
/// <inheritdoc />
|
||||
public void BypassEvasionStatBoosts(IExecutingMove move, IPokemon target, byte hitIndex, ref bool bypass) =>
|
||||
public void BypassEvasionStatBoosts(IExecutingMove move, IBattlePokemon target, byte hitIndex, ref bool bypass) =>
|
||||
bypass = true;
|
||||
}
|
||||
@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class Confuse : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
target.Volatile.Add(new Confusion());
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class Conversion : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
var moveType = move.User.Moves.WhereNotNull().FirstOrDefault()?.MoveData.MoveType;
|
||||
if (moveType == null)
|
||||
|
||||
@@ -7,21 +7,21 @@ public class Conversion2 : Script, IScriptOnSecondaryEffect
|
||||
private static readonly StringKey NoneTypeName = "none";
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
var lastMoveByTarget = target.BattleData?.LastMoveChoice;
|
||||
var lastMoveByTarget = target.LastMoveChoice;
|
||||
if (lastMoveByTarget == null || lastMoveByTarget.ChosenMove.MoveData.MoveType.Name == NoneTypeName)
|
||||
{
|
||||
move.GetHitData(target, hit).Fail();
|
||||
return;
|
||||
}
|
||||
|
||||
var typeLibrary = move.User.BattleData!.Battle.Library.StaticLibrary.Types;
|
||||
var typeLibrary = move.User.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 && !move.User.Types.Contains(x.type))
|
||||
// Shuffle them randomly, but deterministically
|
||||
.OrderBy(_ => move.User.BattleData.Battle.Random.GetInt()).ThenBy(x => x.type.Value)
|
||||
.OrderBy(_ => move.User.Battle.Random.GetInt()).ThenBy(x => x.type.Value)
|
||||
// And grab the first one
|
||||
.Select(x => x.type).FirstOrDefault();
|
||||
if (type == null)
|
||||
|
||||
@@ -8,7 +8,7 @@ public class Copycat : Script, IScriptChangeMove
|
||||
/// <inheritdoc />
|
||||
public void ChangeMove(IMoveChoice choice, ref StringKey moveName)
|
||||
{
|
||||
var lastMove = choice.User.BattleData?.LastMoveChoice;
|
||||
var lastMove = choice.User.LastMoveChoice;
|
||||
if (lastMove == null || !lastMove.ChosenMove.MoveData.CanCopyMove())
|
||||
{
|
||||
choice.Fail();
|
||||
|
||||
@@ -4,9 +4,9 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class CoreEnforcer : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
var battleData = target.BattleData;
|
||||
var battleData = target;
|
||||
if (battleData == null)
|
||||
return;
|
||||
var turnChoices = battleData.Battle.PreviousTurnChoices.Last();
|
||||
|
||||
@@ -12,7 +12,7 @@ public class Counter : Script, IScriptOnBeforeTurnStart, IScriptChangeTargets, I
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void ChangeTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets)
|
||||
public void ChangeTargets(IMoveChoice moveChoice, ref IReadOnlyList<IBattlePokemon?> targets)
|
||||
{
|
||||
var counterHelper = moveChoice.User.Volatile.Get<CounterHelperEffect>();
|
||||
var lastHitBy = counterHelper?.LastHitBy;
|
||||
@@ -25,7 +25,7 @@ public class Counter : Script, IScriptOnBeforeTurnStart, IScriptChangeTargets, I
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
public void ChangeMoveDamage(IExecutingMove move, IBattlePokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
var counterHelper = move.User.Volatile.Get<CounterHelperEffect>();
|
||||
if (counterHelper == null || counterHelper.LastHitBy == null || counterHelper.LastHitBy != target)
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class Covet : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
if (target.HeldItem == null)
|
||||
return;
|
||||
|
||||
@@ -6,9 +6,9 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class CraftyShield : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
var battleData = move.User.BattleData;
|
||||
var battleData = move.User;
|
||||
if (battleData == null)
|
||||
return;
|
||||
var side = battleData.Battle.Sides[battleData.SideIndex];
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class CrushGrip : Script, IScriptChangeBasePower
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
|
||||
public void ChangeBasePower(IExecutingMove move, IBattlePokemon target, byte hit, ref ushort basePower)
|
||||
{
|
||||
basePower = Math.Max((byte)(120 * target.CurrentHealth / target.BoostedStats.Hp), (byte)1);
|
||||
}
|
||||
|
||||
@@ -4,16 +4,13 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class CurePartyStatus : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
var user = move.User;
|
||||
var battle = user.BattleData?.Battle;
|
||||
if (battle == null)
|
||||
return;
|
||||
var party = battle.Parties.FirstOrDefault(p => p.Party.Contains(user));
|
||||
var party = user.Battle.Parties.FirstOrDefault(p => p.BattlePokemon.Contains(user));
|
||||
if (party == null)
|
||||
return;
|
||||
foreach (var pokemon in party.Party.WhereNotNull())
|
||||
foreach (var pokemon in party.BattlePokemon.WhereNotNull())
|
||||
{
|
||||
pokemon.ClearStatus();
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class Curse : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
var battleData = move.User.BattleData;
|
||||
var battleData = move.User;
|
||||
if (battleData == null)
|
||||
return;
|
||||
var typeLibrary = battleData.Battle.Library.StaticLibrary.Types;
|
||||
|
||||
@@ -4,10 +4,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class DarkestLariat : Script, IScriptBypassDefensiveStatBoosts, IScriptBypassEvasionStatBoosts
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void BypassDefensiveStatBoosts(IExecutingMove move, IPokemon target, byte hit, ref bool bypass) =>
|
||||
public void BypassDefensiveStatBoosts(IExecutingMove move, IBattlePokemon target, byte hit, ref bool bypass) =>
|
||||
bypass = true;
|
||||
|
||||
/// <inheritdoc />
|
||||
public void BypassEvasionStatBoosts(IExecutingMove move, IPokemon target, byte hitIndex, ref bool bypass) =>
|
||||
public void BypassEvasionStatBoosts(IExecutingMove move, IBattlePokemon target, byte hitIndex, ref bool bypass) =>
|
||||
bypass = true;
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
[Script(ScriptCategory.Move, "defense_curl")]
|
||||
public class DefenseCurl : ChangeUserDefense
|
||||
{
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
base.OnSecondaryEffect(move, target, hit);
|
||||
move.User.Volatile.StackOrAdd(ScriptUtils.ResolveName<DefenseCurlEffect>(), () => new DefenseCurlEffect());
|
||||
|
||||
@@ -20,14 +20,11 @@ public class Defog : Script, IScriptOnSecondaryEffect
|
||||
];
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
if (target.BattleData == null)
|
||||
return;
|
||||
|
||||
target.ChangeStatBoost(Statistic.Evasion, -1, false, false);
|
||||
|
||||
foreach (var sides in target.BattleData.Battle.Sides)
|
||||
foreach (var sides in target.Battle.Sides)
|
||||
{
|
||||
foreach (var effect in DefoggedEffects)
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class DestinyBond : Script, IScriptOnSecondaryEffect, IScriptFailMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
move.User.Volatile.Add(new DestinyBondEffect());
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ public class Dig : Script, IScriptPreventMove, IScriptOnBeforeMove
|
||||
|
||||
move.User.Volatile.Add(new DigEffect(move.User));
|
||||
move.MoveChoice.SetAdditionalData("dig_charge", true);
|
||||
move.User.BattleData?.Battle.EventHook.Invoke(new DialogEvent("dig_charge", new Dictionary<string, object>
|
||||
move.User.Battle.EventHook.Invoke(new DialogEvent("dig_charge", new Dictionary<string, object>
|
||||
{
|
||||
{ "user", move.User },
|
||||
}));
|
||||
|
||||
@@ -6,9 +6,9 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class Disable : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
var battleData = move.User.BattleData;
|
||||
var battleData = move.User;
|
||||
if (battleData == null)
|
||||
return;
|
||||
if (target.Volatile.Contains<DisableEffect>())
|
||||
@@ -16,7 +16,7 @@ public class Disable : Script, IScriptOnSecondaryEffect
|
||||
move.GetHitData(target, hit).Fail();
|
||||
return;
|
||||
}
|
||||
var lastMove = target.BattleData?.LastMoveChoice;
|
||||
var lastMove = target.LastMoveChoice;
|
||||
if (lastMove == null)
|
||||
{
|
||||
move.GetHitData(target, hit).Fail();
|
||||
|
||||
@@ -13,7 +13,7 @@ public class Dive : Script, IScriptPreventMove, IScriptOnSecondaryEffect
|
||||
|
||||
move.User.Volatile.Add(new DiveEffect(move.User));
|
||||
move.MoveChoice.SetAdditionalData("dive_charge", true);
|
||||
move.User.BattleData?.Battle.EventHook.Invoke(new DialogEvent("dive_charge", new Dictionary<string, object>
|
||||
move.User.Battle.EventHook.Invoke(new DialogEvent("dive_charge", new Dictionary<string, object>
|
||||
{
|
||||
{ "user", move.User },
|
||||
}));
|
||||
@@ -21,7 +21,7 @@ public class Dive : Script, IScriptPreventMove, IScriptOnSecondaryEffect
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
move.User.Volatile.Remove(ScriptUtils.ResolveName<DiveEffect>());
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class DoomDesire : Script, IScriptBlockOutgoingHit
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void BlockOutgoingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
||||
public void BlockOutgoingHit(IExecutingMove executingMove, IBattlePokemon target, byte hitIndex, ref bool block)
|
||||
{
|
||||
var battleData = target.BattleData;
|
||||
var battleData = target;
|
||||
if (battleData == null)
|
||||
return;
|
||||
var side = battleData.Battle.Sides[battleData.SideIndex];
|
||||
|
||||
@@ -10,7 +10,7 @@ public class DoublePowerIfTargetDamagedInTurn : Script, IScriptOnBeforeTurnStart
|
||||
{
|
||||
if (choice is IMoveChoice moveChoice)
|
||||
{
|
||||
var battle = choice.User.BattleData?.Battle;
|
||||
var battle = choice.User.Battle;
|
||||
if (battle == null)
|
||||
return;
|
||||
var side = battle.Sides[moveChoice.TargetSide];
|
||||
@@ -19,14 +19,12 @@ public class DoublePowerIfTargetDamagedInTurn : Script, IScriptOnBeforeTurnStart
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
|
||||
public void ChangeBasePower(IExecutingMove move, IBattlePokemon target, byte hit, ref ushort basePower)
|
||||
{
|
||||
var battle = move.User.BattleData?.Battle;
|
||||
var battle = move.User.Battle;
|
||||
if (battle == null)
|
||||
return;
|
||||
if (target.BattleData == null)
|
||||
return;
|
||||
var side = battle.Sides[target.BattleData.SideIndex];
|
||||
var side = battle.Sides[target.SideIndex];
|
||||
var data = side.VolatileScripts.Get<DoublePowerIfTargetDamagedInTurnData>();
|
||||
if (data == null)
|
||||
return;
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class DragonAscent : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
EventBatchId batchId = new();
|
||||
move.User.ChangeStatBoost(Statistic.Defense, -1, true, false, batchId);
|
||||
|
||||
@@ -14,7 +14,7 @@ public class Drain : Script, IScriptOnInitialize, IScriptOnSecondaryEffect
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
var user = move.User;
|
||||
var damage = move.GetHitData(target, hit).Damage;
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class DreamEater : Script, IScriptOnSecondaryEffect, IScriptBlockOutgoingHit
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void BlockOutgoingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
||||
public void BlockOutgoingHit(IExecutingMove executingMove, IBattlePokemon target, byte hitIndex, ref bool block)
|
||||
{
|
||||
if (!target.HasStatus(ScriptUtils.ResolveName<Status.Sleep>()) &&
|
||||
target.ActiveAbility?.Name != AbilityNames.Comatose)
|
||||
@@ -12,7 +12,7 @@ public class DreamEater : Script, IScriptOnSecondaryEffect, IScriptBlockOutgoing
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
var user = move.User;
|
||||
var damage = move.GetHitData(target, hit).Damage;
|
||||
|
||||
@@ -5,9 +5,9 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
[Script(ScriptCategory.Move, "echoed_voice")]
|
||||
public class EchoedVoice : Script, IScriptOnSecondaryEffect, IScriptChangeBasePower
|
||||
{
|
||||
public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
|
||||
public void ChangeBasePower(IExecutingMove move, IBattlePokemon target, byte hit, ref ushort basePower)
|
||||
{
|
||||
var battleData = move.User.BattleData;
|
||||
var battleData = move.User;
|
||||
if (battleData == null)
|
||||
return;
|
||||
var side = battleData.Battle.Sides[battleData.SideIndex];
|
||||
@@ -20,9 +20,9 @@ public class EchoedVoice : Script, IScriptOnSecondaryEffect, IScriptChangeBasePo
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
var battleData = move.User.BattleData;
|
||||
var battleData = move.User;
|
||||
if (battleData == null)
|
||||
return;
|
||||
var side = battleData.Battle.Sides[battleData.SideIndex];
|
||||
|
||||
@@ -4,9 +4,9 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class ElectricTerrain : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
var battleData = move.User.BattleData;
|
||||
var battleData = move.User;
|
||||
battleData?.Battle.SetTerrain(ScriptUtils.ResolveName<Terrain.ElectricTerrain>());
|
||||
}
|
||||
}
|
||||
@@ -6,9 +6,9 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class Electrify : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
var choiceQueue = target.BattleData?.Battle.ChoiceQueue;
|
||||
var choiceQueue = target.Battle.ChoiceQueue;
|
||||
if (choiceQueue == null)
|
||||
return;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class ElectroBall : Script, IScriptChangeBasePower
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
|
||||
public void ChangeBasePower(IExecutingMove move, IBattlePokemon target, byte hit, ref ushort basePower)
|
||||
{
|
||||
var user = move.User;
|
||||
var targetSpeed = target.BoostedStats.Speed;
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class Embargo : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
target.Volatile.Add(new EmbargoEffect());
|
||||
}
|
||||
|
||||
@@ -7,13 +7,13 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class Encore : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
var battle = target.BattleData?.Battle;
|
||||
var battle = target.Battle;
|
||||
if (battle == null)
|
||||
return;
|
||||
|
||||
var lastMove = target.BattleData?.LastMoveChoice;
|
||||
var lastMove = target.LastMoveChoice;
|
||||
if (lastMove == null || battle.Library.MiscLibrary.IsReplacementChoice(lastMove) ||
|
||||
lastMove.ChosenMove.MoveData.HasFlag(MoveFlags.CantRepeat))
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class Endeavor : Script, IScriptChangeMoveDamage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
public void ChangeMoveDamage(IExecutingMove move, IBattlePokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
var user = move.User;
|
||||
var userHealth = user.CurrentHealth;
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class Entrainment : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
var userAbility = move.User.ActiveAbility;
|
||||
var targetAbility = target.ActiveAbility;
|
||||
|
||||
@@ -3,7 +3,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
[Script(ScriptCategory.Move, "eruption")]
|
||||
public class Eruption : Script, IScriptChangeBasePower
|
||||
{
|
||||
public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
|
||||
public void ChangeBasePower(IExecutingMove move, IBattlePokemon target, byte hit, ref ushort basePower)
|
||||
{
|
||||
basePower = Math.Max((byte)(150 * move.User.CurrentHealth / move.User.BoostedStats.Hp), (byte)1);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class Explosion : Script, IScriptOnAfterHits
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnAfterHits(IExecutingMove move, IPokemon target)
|
||||
public void OnAfterHits(IExecutingMove move, IBattlePokemon target)
|
||||
{
|
||||
move.User.Damage(move.User.CurrentHealth * 10, DamageSource.Misc);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class Facade : Script, IScriptChangeBasePower, IScriptChangeMoveDamage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
|
||||
public void ChangeBasePower(IExecutingMove move, IBattlePokemon target, byte hit, ref ushort basePower)
|
||||
{
|
||||
var status = move.User.StatusScript.Script?.Name;
|
||||
if (status == ScriptUtils.ResolveName<Paralyzed>() || status == ScriptUtils.ResolveName<Burned>() ||
|
||||
@@ -17,7 +17,7 @@ public class Facade : Script, IScriptChangeBasePower, IScriptChangeMoveDamage
|
||||
}
|
||||
}
|
||||
|
||||
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
public void ChangeMoveDamage(IExecutingMove move, IBattlePokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
var status = move.User.StatusScript.Script?.Name;
|
||||
if (status != ScriptUtils.ResolveName<Burned>())
|
||||
|
||||
@@ -6,9 +6,9 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class FairyLock : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
var battle = target.BattleData?.Battle;
|
||||
var battle = target.Battle;
|
||||
battle?.Volatile.Add(new FairyLockEffect());
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ public class FakeOut : Script, IScriptStopBeforeMove, IScriptOnSecondaryEffect
|
||||
/// <inheritdoc />
|
||||
public void StopBeforeMove(IExecutingMove move, ref bool stop)
|
||||
{
|
||||
var battleData = move.User.BattleData;
|
||||
var battleData = move.User;
|
||||
if (battleData == null)
|
||||
return;
|
||||
if (battleData.SwitchInTurn != battleData.Battle.CurrentTurnNumber)
|
||||
@@ -16,7 +16,7 @@ public class FakeOut : Script, IScriptStopBeforeMove, IScriptOnSecondaryEffect
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
target.Volatile.Add(new FlinchEffect());
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class FalseSwipe : Script, IScriptChangeMoveDamage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
public void ChangeMoveDamage(IExecutingMove move, IBattlePokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
if ((int)target.CurrentHealth - damage < 1)
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class Feint : Script, IScriptOnBeforeHit
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnBeforeHit(IExecutingMove move, IPokemon target, byte hitIndex)
|
||||
public void OnBeforeHit(IExecutingMove move, IBattlePokemon target, byte hitIndex)
|
||||
{
|
||||
var toRemove = new List<ScriptContainer>();
|
||||
foreach (var script in target.Volatile)
|
||||
@@ -22,7 +22,7 @@ public class Feint : Script, IScriptOnBeforeHit
|
||||
script.Clear();
|
||||
}
|
||||
|
||||
var battleData = target.BattleData;
|
||||
var battleData = target;
|
||||
if (battleData is not null)
|
||||
{
|
||||
if (battleData.BattleSide.VolatileScripts.Contains<CraftyShieldEffect>())
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class FellStinger : Script, IScriptOnAfterHits
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnAfterHits(IExecutingMove move, IPokemon target)
|
||||
public void OnAfterHits(IExecutingMove move, IBattlePokemon target)
|
||||
{
|
||||
if (target.IsFainted)
|
||||
{
|
||||
|
||||
@@ -4,13 +4,13 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class FinalGambit : Script, IScriptOnSecondaryEffect, IScriptChangeMoveDamage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
public void ChangeMoveDamage(IExecutingMove move, IBattlePokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
damage = move.User.CurrentHealth;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
move.User.Damage(move.User.CurrentHealth * 10, DamageSource.Misc);
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class FireFang : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
var battleData = target.BattleData;
|
||||
var battleData = target;
|
||||
if (battleData == null)
|
||||
return;
|
||||
var random = battleData.Battle.Random;
|
||||
|
||||
@@ -15,7 +15,7 @@ public class FirePledge : Script, IScriptStopBeforeMove
|
||||
}
|
||||
|
||||
var pledgeMove = (IMoveChoice?)move.Battle.ChoiceQueue?.FirstOrDefault(x =>
|
||||
x is IMoveChoice mc && mc.User.BattleData?.SideIndex == move.User.BattleData?.SideIndex &&
|
||||
x is IMoveChoice mc && mc.User.SideIndex == move.User.SideIndex &&
|
||||
(mc.ChosenMove.MoveData.Name == MoveNames.WaterPledge ||
|
||||
mc.ChosenMove.MoveData.Name == MoveNames.GrassPledge));
|
||||
if (pledgeMove is null)
|
||||
|
||||
@@ -6,11 +6,11 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class FireSpin : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
target.Volatile.StackOrAdd("fire_spin", () =>
|
||||
{
|
||||
var turns = target.BattleData!.Battle.Random.GetInt(4, 6);
|
||||
var turns = target.Battle.Random.GetInt(4, 6);
|
||||
return new FireSpinEffect(target, turns, move.User);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ public class FirstImpression : Script, IScriptStopBeforeMove
|
||||
{
|
||||
public void StopBeforeMove(IExecutingMove move, ref bool stop)
|
||||
{
|
||||
var battleData = move.User.BattleData;
|
||||
var battleData = move.User;
|
||||
if (battleData == null)
|
||||
return;
|
||||
if (battleData.SwitchInTurn != battleData.Battle.CurrentTurnNumber)
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class Flail : Script, IScriptChangeBasePower
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
|
||||
public void ChangeBasePower(IExecutingMove move, IBattlePokemon target, byte hit, ref ushort basePower)
|
||||
{
|
||||
var remainingHealth = move.User.CurrentHealth / (float)move.User.BoostedStats.Hp;
|
||||
var fraction = remainingHealth * 48;
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class FlameBurst : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
var adjacentFoes = GetAdjacentFoes(target).WhereNotNull();
|
||||
EventBatchId batchId = new();
|
||||
@@ -14,9 +14,9 @@ public class FlameBurst : Script, IScriptOnSecondaryEffect
|
||||
}
|
||||
}
|
||||
|
||||
private static IEnumerable<IPokemon?> GetAdjacentFoes(IPokemon pokemon)
|
||||
private static IEnumerable<IBattlePokemon?> GetAdjacentFoes(IBattlePokemon pokemon)
|
||||
{
|
||||
var battleData = pokemon.BattleData;
|
||||
var battleData = pokemon;
|
||||
if (battleData == null)
|
||||
yield break;
|
||||
if (battleData.Battle.PositionsPerSide == 1)
|
||||
|
||||
@@ -17,7 +17,7 @@ public class FlameWheel : Script, IScriptOnInitialize, IScriptOnSecondaryEffect
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
if (move.User.HasStatus(ScriptUtils.ResolveName<Status.Frozen>()))
|
||||
{
|
||||
|
||||
@@ -4,9 +4,9 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class FlareBlitz : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
var battleData = target.BattleData;
|
||||
var battleData = target;
|
||||
if (battleData == null)
|
||||
return;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class Flatter : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
target.ChangeStatBoost(Statistic.SpecialAttack, 1, false, false);
|
||||
target.Volatile.StackOrAdd("confusion", () => new Confusion());
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class Flinch : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
target.Volatile.Add(new FlinchEffect());
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class Fling : Script, IScriptOnSecondaryEffect, IScriptChangeBasePower
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
|
||||
public void ChangeBasePower(IExecutingMove move, IBattlePokemon target, byte hit, ref ushort basePower)
|
||||
{
|
||||
var item = move.User.HeldItem;
|
||||
if (item == null)
|
||||
@@ -29,6 +29,6 @@ public class Fling : Script, IScriptOnSecondaryEffect, IScriptChangeBasePower
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit) =>
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit) =>
|
||||
move.User.RemoveHeldItemForBattle();
|
||||
}
|
||||
@@ -4,11 +4,11 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class FloralHealing : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
if (target.IsFainted)
|
||||
return;
|
||||
var battleData = target.BattleData;
|
||||
var battleData = target;
|
||||
if (battleData == null)
|
||||
return;
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class FlowerShield : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
var battleData = target.BattleData;
|
||||
var battleData = target;
|
||||
if (battleData == null)
|
||||
return;
|
||||
if (!battleData.Battle.Library.StaticLibrary.Types.TryGetTypeIdentifier(TypeNames.Grass, out var grassType))
|
||||
|
||||
@@ -13,7 +13,7 @@ public class Fly : Script, IScriptPreventMove, IScriptOnBeforeMove
|
||||
|
||||
move.User.Volatile.Add(new ChargeFlyEffect(move.User));
|
||||
move.MoveChoice.SetAdditionalData("fly_charge", true);
|
||||
move.User.BattleData?.Battle.EventHook.Invoke(new DialogEvent("fly_charge", new Dictionary<string, object>
|
||||
move.User.Battle.EventHook.Invoke(new DialogEvent("fly_charge", new Dictionary<string, object>
|
||||
{
|
||||
{ "user", move.User },
|
||||
}));
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class FlyingPress : Script, IScriptChangeTypesForMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void ChangeTypesForMove(IExecutingMove executingMove, IPokemon target, byte hitIndex,
|
||||
public void ChangeTypesForMove(IExecutingMove executingMove, IBattlePokemon target, byte hitIndex,
|
||||
IList<TypeIdentifier> types)
|
||||
{
|
||||
var typeLibrary = executingMove.User.Library.StaticLibrary.Types;
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class FocusEnergy : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
if (target.Volatile.Contains<Pokemon.FocusEnergyEffect>())
|
||||
{
|
||||
|
||||
@@ -9,11 +9,10 @@ public class FocusPunch : Script, IScriptOnBeforeTurnStart, IScriptPreventMove
|
||||
public void OnBeforeTurnStart(ITurnChoice choice)
|
||||
{
|
||||
choice.User.Volatile.Add(new FocusPunchEffect());
|
||||
choice.User.BattleData?.Battle.EventHook.Invoke(new DialogEvent("focus_punch_charge",
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "pokemon", choice.User },
|
||||
}));
|
||||
choice.User.Battle.EventHook.Invoke(new DialogEvent("focus_punch_charge", new Dictionary<string, object>
|
||||
{
|
||||
{ "pokemon", choice.User },
|
||||
}));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -5,9 +5,9 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
[Script(ScriptCategory.Move, "follow_me")]
|
||||
public class FollowMe : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
move.User.BattleData!.BattleSide.VolatileScripts.StackOrAdd(ScriptUtils.ResolveName<FollowMeEffect>(),
|
||||
move.User.BattleSide.VolatileScripts.StackOrAdd(ScriptUtils.ResolveName<FollowMeEffect>(),
|
||||
() => new FollowMeEffect(move.User));
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class ForceCritical : Script, IScriptChangeCriticalStage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void ChangeCriticalStage(IExecutingMove move, IPokemon target, byte hit, ref byte stage)
|
||||
public void ChangeCriticalStage(IExecutingMove move, IBattlePokemon target, byte hit, ref byte stage)
|
||||
{
|
||||
stage = 100;
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class Foresight : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
var battleData = target.BattleData;
|
||||
var battleData = target;
|
||||
if (battleData == null)
|
||||
return;
|
||||
if (target.StatBoost.Evasion > 0)
|
||||
|
||||
@@ -6,9 +6,9 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class ForestsCurse : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
var battleData = target.BattleData;
|
||||
var battleData = target;
|
||||
if (battleData == null)
|
||||
return;
|
||||
var typeLibrary = battleData.Battle.Library.StaticLibrary.Types;
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class FoulPlay : Script, IScriptChangeOffensiveStatValue
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint _,
|
||||
public void ChangeOffensiveStatValue(IExecutingMove move, IBattlePokemon target, byte hit, uint _,
|
||||
ImmutableStatisticSet<uint> targetStats, Statistic stat, ref uint value)
|
||||
{
|
||||
value = move.UseMove.Category == MoveCategory.Physical
|
||||
|
||||
@@ -4,9 +4,9 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class FreezeDry : Script, IScriptChangeEffectiveness, IScriptOnSecondaryEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void ChangeEffectiveness(IExecutingMove move, IPokemon target, byte hit, ref float effectiveness)
|
||||
public void ChangeEffectiveness(IExecutingMove move, IBattlePokemon target, byte hit, ref float effectiveness)
|
||||
{
|
||||
var battleData = target.BattleData;
|
||||
var battleData = target;
|
||||
if (battleData == null)
|
||||
return;
|
||||
|
||||
@@ -24,9 +24,9 @@ public class FreezeDry : Script, IScriptChangeEffectiveness, IScriptOnSecondaryE
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
var battleData = target.BattleData;
|
||||
var battleData = target;
|
||||
if (battleData == null)
|
||||
return;
|
||||
|
||||
|
||||
@@ -6,12 +6,12 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class FreezeShock : BaseChargeMove<RequireChargeEffect>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override RequireChargeEffect CreateVolatile(IPokemon user) => new(user, "freeze_shock");
|
||||
public override RequireChargeEffect CreateVolatile(IBattlePokemon user) => new(user, "freeze_shock");
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
var battleData = target.BattleData;
|
||||
var battleData = target;
|
||||
if (battleData == null)
|
||||
return;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class Frustration : Script, IScriptChangeBasePower
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
|
||||
public void ChangeBasePower(IExecutingMove move, IBattlePokemon target, byte hit, ref ushort basePower)
|
||||
{
|
||||
var friendship = move.User.Happiness;
|
||||
basePower = Math.Max((byte)1, (byte)((255 - friendship) * 2 / 5));
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class FuryCutter : Script, IScriptChangeBasePower
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
|
||||
public void ChangeBasePower(IExecutingMove move, IBattlePokemon target, byte hit, ref ushort basePower)
|
||||
{
|
||||
var userEffect = move.User.Volatile.Get<FuryCutterEffect>();
|
||||
if (userEffect == null)
|
||||
|
||||
@@ -4,9 +4,9 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class FusionBolt : Script, IScriptChangeDamageModifier
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
|
||||
public void ChangeDamageModifier(IExecutingMove move, IBattlePokemon target, byte hit, ref float modifier)
|
||||
{
|
||||
var battleData = target.BattleData;
|
||||
var battleData = target;
|
||||
if (battleData == null)
|
||||
return;
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class FusionFlare : Script, IScriptChangeDamageModifier
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
|
||||
public void ChangeDamageModifier(IExecutingMove move, IBattlePokemon target, byte hit, ref float modifier)
|
||||
{
|
||||
var battleData = target.BattleData;
|
||||
var battleData = target;
|
||||
if (battleData == null)
|
||||
return;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ public class FutureSight : Script, IScriptStopBeforeMove
|
||||
/// <inheritdoc />
|
||||
public void StopBeforeMove(IExecutingMove move, ref bool prevent)
|
||||
{
|
||||
var battleData = move.User.BattleData;
|
||||
var battleData = move.User;
|
||||
if (battleData == null)
|
||||
return;
|
||||
var battle = battleData.Battle;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user