More abilities, refactor IPokemon.SetStatus to pass pokemon that caused the status change
All checks were successful
Build / Build (push) Successful in 50s
All checks were successful
Build / Build (push) Successful in 50s
This commit is contained in:
@@ -36,13 +36,13 @@ public class EffectSpore : Script
|
||||
switch (chance)
|
||||
{
|
||||
case < 9:
|
||||
move.User.SetStatus(ScriptUtils.ResolveName<Status.Poisoned>(), false, batchId);
|
||||
move.User.SetStatus(ScriptUtils.ResolveName<Status.Poisoned>(), move.User, batchId);
|
||||
break;
|
||||
case < 19:
|
||||
move.User.SetStatus(ScriptUtils.ResolveName<Status.Paralyzed>(), false, batchId);
|
||||
move.User.SetStatus(ScriptUtils.ResolveName<Status.Paralyzed>(), move.User, batchId);
|
||||
break;
|
||||
case < 30:
|
||||
move.User.SetStatus(ScriptUtils.ResolveName<Status.Sleep>(), false, batchId);
|
||||
move.User.SetStatus(ScriptUtils.ResolveName<Status.Sleep>(), move.User, batchId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,6 @@ public class FlameBody : Script
|
||||
return;
|
||||
|
||||
move.Battle.EventHook.Invoke(new AbilityTriggerEvent(target));
|
||||
move.User.SetStatus(ScriptUtils.ResolveName<Status.Burned>(), false);
|
||||
move.User.SetStatus(ScriptUtils.ResolveName<Status.Burned>(), move.User);
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,6 @@ public class PoisonPoint : Script
|
||||
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
if (move.GetHitData(target, hit).IsContact)
|
||||
move.User.SetStatus(ScriptUtils.ResolveName<Status.Poisoned>(), false);
|
||||
move.User.SetStatus(ScriptUtils.ResolveName<Status.Poisoned>(), move.User);
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,6 @@ public class PoisonTouch : Script
|
||||
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
if (move.GetHitData(target, hit).IsContact && move.Battle.Random.GetInt(0, 100) < PoisonChance)
|
||||
move.User.SetStatus(ScriptUtils.ResolveName<Status.Poisoned>(), false);
|
||||
move.User.SetStatus(ScriptUtils.ResolveName<Status.Poisoned>(), target);
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ public class Static : Script
|
||||
if (move.Battle.Random.GetInt(0, 100) < ChanceToParalyze)
|
||||
{
|
||||
EventBatchId batchId = new();
|
||||
if (target.SetStatus(ScriptUtils.ResolveName<Status.Paralyzed>(), false, batchId))
|
||||
if (target.SetStatus(ScriptUtils.ResolveName<Status.Paralyzed>(), target, batchId))
|
||||
{
|
||||
move.Battle.EventHook.Invoke(new AbilityTriggerEvent(target)
|
||||
{
|
||||
|
||||
19
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/StrongJaw.cs
Normal file
19
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/StrongJaw.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Strong Jaw is an ability that boosts the power of biting moves.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Strong_Jaw_(Ability)">Bulbapedia - Strong Jaw</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "strong_jaw")]
|
||||
public class StrongJaw : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
|
||||
{
|
||||
if (move.UseMove.HasFlag("bite"))
|
||||
{
|
||||
basePower = basePower.MultiplyOrMax(1.5f);
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Sturdy.cs
Normal file
19
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Sturdy.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Sturdy is an ability that allows the Pokémon to survive a one-hit KO attack with 1 HP.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Sturdy_(Ability)">Bulbapedia - Sturdy</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "sturdy")]
|
||||
public class Sturdy : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
if (damage >= target.MaxHealth && target.CurrentHealth == target.MaxHealth)
|
||||
{
|
||||
damage = target.MaxHealth - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/SuctionCups.cs
Normal file
12
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/SuctionCups.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Suction Cups is an ability that prevents the Pokémon from being forced to switch out.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Suction_Cups_(Ability)">Bulbapedia - Suction Cups</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "suction_cups")]
|
||||
public class SuctionCups : Script
|
||||
{
|
||||
// TODO: Implement Suction Cups ability logic
|
||||
}
|
||||
18
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/SuperLuck.cs
Normal file
18
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/SuperLuck.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Super Luck is an ability that increases the critical hit ratio of the Pokémon's moves.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Super_Luck_(Ability)">Bulbapedia - Super Luck</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "super_luck")]
|
||||
public class SuperLuck : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeCriticalStage(IExecutingMove move, IPokemon target, byte hit, ref byte stage)
|
||||
{
|
||||
if (stage == byte.MaxValue)
|
||||
return;
|
||||
stage++;
|
||||
}
|
||||
}
|
||||
19
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/SurgeSurfer.cs
Normal file
19
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/SurgeSurfer.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Surge Surfer is an ability that doubles the Pokémon's Speed while Electric Terrain is active.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Surge_Surfer_(Ability)">Bulbapedia - Surge Surfer</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "surge_surfer")]
|
||||
public class SurgeSurfer : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeSpeed(ITurnChoice choice, ref uint speed)
|
||||
{
|
||||
if (choice.User.BattleData?.Battle.TerrainName == ScriptUtils.ResolveName<Terrain.ElectricTerrain>())
|
||||
{
|
||||
speed = speed.MultiplyOrMax(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
20
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Swarm.cs
Normal file
20
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Swarm.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Swarm is an ability that powers up Bug-type moves when the Pokémon's HP is low.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Swarm_(Ability)">Bulbapedia - Swarm</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "swarm")]
|
||||
public class Swarm : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint defensiveStat,
|
||||
ImmutableStatisticSet<uint> targetStats, Statistic stat, ref uint value)
|
||||
{
|
||||
if (move.GetHitData(target, hit).Type?.Name == "bug" && target.CurrentHealth <= target.MaxHealth / 3)
|
||||
{
|
||||
value = value.MultiplyOrMax(1.5f);
|
||||
}
|
||||
}
|
||||
}
|
||||
20
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/SweetVeil.cs
Normal file
20
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/SweetVeil.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Sweet Veil is an ability that prevents the Pokémon and its allies from falling asleep.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Sweet_Veil_(Ability)">Bulbapedia - Sweet Veil</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "sweet_veil")]
|
||||
public class SweetVeil : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void PreventStatusChange(IPokemon pokemon, StringKey status, bool selfInflicted,
|
||||
ref bool preventStatus)
|
||||
{
|
||||
if (status == ScriptUtils.ResolveName<Status.Sleep>())
|
||||
{
|
||||
preventStatus = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/SwiftSwim.cs
Normal file
19
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/SwiftSwim.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Swift Swim is an ability that doubles the Pokémon's Speed in rain.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Swift_Swim_(Ability)">Bulbapedia - Swift Swim</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "swift_swim")]
|
||||
public class SwiftSwim : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeSpeed(ITurnChoice choice, ref uint speed)
|
||||
{
|
||||
if (choice.User.BattleData?.Battle.WeatherName == ScriptUtils.ResolveName<Weather.Rain>())
|
||||
{
|
||||
speed = speed.MultiplyOrMax(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Symbiosis.cs
Normal file
12
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Symbiosis.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Symbiosis is an ability that passes the user's held item to an ally if the ally consumes its own held item.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Symbiosis_(Ability)">Bulbapedia - Symbiosis</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "symbiosis")]
|
||||
public class Symbiosis : Script
|
||||
{
|
||||
// TODO: Implement Symbiosis ability logic
|
||||
}
|
||||
19
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Synchronize.cs
Normal file
19
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Synchronize.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Synchronize is an ability that passes major status conditions to the foe that inflicted them.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Synchronize_(Ability)">Bulbapedia - Synchronize</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "synchronize")]
|
||||
public class Synchronize : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnAfterStatusChange(IPokemon pokemon, StringKey status, IPokemon? originPokemon)
|
||||
{
|
||||
if (originPokemon == null || pokemon == originPokemon)
|
||||
return;
|
||||
pokemon.BattleData?.Battle.EventHook.Invoke(new AbilityTriggerEvent(pokemon));
|
||||
originPokemon.SetStatus(status, pokemon);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user