More abilities
This commit is contained in:
@@ -33,7 +33,7 @@ public class Harvest : Script
|
||||
if (battle.WeatherName != ScriptUtils.ResolveName<Weather.HarshSunlight>() && rng.GetInt(1) != 0)
|
||||
return;
|
||||
battle.EventHook.Invoke(new AbilityTriggerEvent(_pokemon));
|
||||
_ = _pokemon.SetHeldItem(consumedBerry);
|
||||
_ = _pokemon.ForceSetHeldItem(consumedBerry);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,6 @@ public class Magician : Script
|
||||
return;
|
||||
|
||||
move.Battle.EventHook.Invoke(new AbilityTriggerEvent(move.User));
|
||||
_ = move.User.SetHeldItem(item);
|
||||
_ = move.User.ForceSetHeldItem(item);
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,6 @@ public class Pickpocket : Script
|
||||
!move.User.TryStealHeldItem(out var item))
|
||||
return;
|
||||
move.Battle.EventHook.Invoke(new AbilityTriggerEvent(target));
|
||||
_ = target.SetHeldItem(item);
|
||||
_ = target.ForceSetHeldItem(item);
|
||||
}
|
||||
}
|
||||
20
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Triage.cs
Normal file
20
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Triage.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Triage is an ability that gives priority to healing moves.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Triage_(Ability)">Bulbapedia - Triage</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "triage")]
|
||||
public class Triage : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangePriority(IMoveChoice choice, ref sbyte priority)
|
||||
{
|
||||
if (!choice.ChosenMove.MoveData.HasFlag("heal"))
|
||||
return;
|
||||
if (priority == sbyte.MaxValue)
|
||||
return;
|
||||
priority++;
|
||||
}
|
||||
}
|
||||
18
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Truant.cs
Normal file
18
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Truant.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Truant is an ability that causes the Pokémon to only be able to move every other turn.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Truant_(Ability)">Bulbapedia - Truant</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "truant")]
|
||||
public class Truant : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnAfterMove(IExecutingMove move)
|
||||
{
|
||||
move.User.Volatile.Add(new TruantEffect(move.User));
|
||||
}
|
||||
}
|
||||
24
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Unaware.cs
Normal file
24
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Unaware.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Unaware is an ability that ignores the opposing Pokémon's stat changes when attacking or defending.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Unaware_(Ability)">Bulbapedia - Unaware</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "unaware")]
|
||||
public class Unaware : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeIncomingMoveOffensiveStatValue(IExecutingMove executingMove, IPokemon target,
|
||||
byte hitNumber, uint defensiveStat, StatisticSet<uint> targetStats, Statistic offensive, ref uint offensiveStat)
|
||||
{
|
||||
offensiveStat = executingMove.User.FlatStats.GetStatistic(offensive);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeDefensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint offensiveStat,
|
||||
ImmutableStatisticSet<uint> targetStats, Statistic stat, ref uint value)
|
||||
{
|
||||
value = target.FlatStats.GetStatistic(stat);
|
||||
}
|
||||
}
|
||||
19
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Unburden.cs
Normal file
19
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Unburden.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Unburden is an ability that doubles the Pokémon's Speed if it loses its held item.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Unburden_(Ability)">Bulbapedia - Unburden</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "unburden")]
|
||||
public class Unburden : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeSpeed(ITurnChoice choice, ref uint speed)
|
||||
{
|
||||
if (choice.User.HasItemBeenRemovedForBattle)
|
||||
{
|
||||
speed = speed.MultiplyOrMax(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Unnerve.cs
Normal file
12
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Unnerve.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Unnerve is an ability that prevents opposing Pokémon from using their held Berries.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Unnerve_(Ability)">Bulbapedia - Unnerve</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "unnerve")]
|
||||
public class Unnerve : Script
|
||||
{
|
||||
// TODO: Implement Unnerve ability logic
|
||||
}
|
||||
17
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/VictoryStar.cs
Normal file
17
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/VictoryStar.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Victory Star is an ability that boosts the accuracy of the Pokémon and its allies.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Victory_Star_(Ability)">Bulbapedia - Victory Star</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "victory_star")]
|
||||
public class VictoryStar : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeAccuracy(IExecutingMove executingMove, IPokemon target, byte hitIndex,
|
||||
ref int modifiedAccuracy)
|
||||
{
|
||||
modifiedAccuracy = modifiedAccuracy.MultiplyOrMax(1.1f);
|
||||
}
|
||||
}
|
||||
20
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/VitalSpirit.cs
Normal file
20
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/VitalSpirit.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Vital Spirit is an ability that prevents the Pokémon from falling asleep.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Vital_Spirit_(Ability)">Bulbapedia - Vital Spirit</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "vital_spirit")]
|
||||
public class VitalSpirit : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void PreventStatusChange(IPokemon pokemon, StringKey status, bool selfInflicted,
|
||||
ref bool preventStatus)
|
||||
{
|
||||
if (status == ScriptUtils.ResolveName<Status.Sleep>() && !selfInflicted)
|
||||
{
|
||||
preventStatus = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
20
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/VoltAbsorb.cs
Normal file
20
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/VoltAbsorb.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Volt Absorb is an ability that heals the Pokémon when hit by an Electric-type move.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Volt_Absorb_(Ability)">Bulbapedia - Volt Absorb</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "volt_absorb")]
|
||||
public class VoltAbsorb : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void IsInvulnerableToMove(IExecutingMove move, IPokemon target, ref bool invulnerable)
|
||||
{
|
||||
if (move.GetHitData(target, 0).Type?.Name != "electric")
|
||||
return;
|
||||
invulnerable = true;
|
||||
target.BattleData?.Battle.EventHook.Invoke(new AbilityTriggerEvent(target));
|
||||
target.Heal(target.MaxHealth / 4);
|
||||
}
|
||||
}
|
||||
20
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/WaterAbsorb.cs
Normal file
20
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/WaterAbsorb.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Water Absorb is an ability that heals the Pokémon when hit by a Water-type move.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Water_Absorb_(Ability)">Bulbapedia - Water Absorb</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "water_absorb")]
|
||||
public class WaterAbsorb : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void IsInvulnerableToMove(IExecutingMove move, IPokemon target, ref bool invulnerable)
|
||||
{
|
||||
if (move.GetHitData(target, 0).Type?.Name != "water")
|
||||
return;
|
||||
invulnerable = true;
|
||||
target.BattleData?.Battle.EventHook.Invoke(new AbilityTriggerEvent(target));
|
||||
target.Heal(target.MaxHealth / 4);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user