This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Delta Stream is an ability that creates strong winds when the Pokémon enters battle.
|
||||
/// These winds weaken the power of super-effective Flying-type moves and prevent other weather conditions.
|
||||
/// This ability is exclusive to Mega Rayquaza.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Delta_Stream_(Ability)">Bulbapedia - Delta Stream</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "delta_stream")]
|
||||
public class DeltaStreamAbility : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
{
|
||||
var battle = pokemon.BattleData?.Battle;
|
||||
if (battle == null)
|
||||
return;
|
||||
|
||||
battle.SetWeather(ScriptUtils.ResolveName<Weather.StrongWinds>(), -1);
|
||||
if (battle.WeatherName == ScriptUtils.ResolveName<Weather.StrongWinds>())
|
||||
{
|
||||
((Weather.StrongWinds)battle.WeatherScript.Script!).MarkAsPlaced(pokemon);
|
||||
battle.EventHook.Invoke(new AbilityTriggerEvent(pokemon));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Desolate Land is an ability that creates extremely harsh sunlight when the Pokémon enters battle.
|
||||
/// This sunlight is so intense that it prevents other weather conditions and makes Water-type moves fail.
|
||||
/// This ability is exclusive to Primal Groudon.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Desolate_Land_(Ability)">Bulbapedia - Desolate Land</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "desolate_land")]
|
||||
public class DesolateLandAbility : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
{
|
||||
var battle = pokemon.BattleData?.Battle;
|
||||
if (battle == null)
|
||||
return;
|
||||
|
||||
battle.SetWeather(ScriptUtils.ResolveName<Weather.DesolateLands>(), -1);
|
||||
if (battle.WeatherName == ScriptUtils.ResolveName<Weather.DesolateLands>())
|
||||
{
|
||||
((Weather.DesolateLands)battle.WeatherScript.Script!).MarkAsPlaced(pokemon);
|
||||
battle.EventHook.Invoke(new AbilityTriggerEvent(pokemon));
|
||||
}
|
||||
}
|
||||
}
|
||||
50
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Disguise.cs
Normal file
50
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Disguise.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using PkmnLib.Static.Species;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Disguise is an ability that allows the Pokémon to avoid damage from one attack.
|
||||
/// After being hit, the disguise is broken and the Pokémon's appearance changes.
|
||||
/// This ability is exclusive to Mimikyu.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Disguise_(Ability)">Bulbapedia - Disguise</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "disguise")]
|
||||
public class Disguise : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeIncomingDamage(IPokemon pokemon, DamageSource source, ref uint damage)
|
||||
{
|
||||
if (pokemon.BattleData == null)
|
||||
return;
|
||||
if (source is not DamageSource.MoveDamage and not DamageSource.Confusion)
|
||||
return;
|
||||
if (pokemon.Form.Name == "busted" || pokemon.Form.Name == "totem-busted")
|
||||
return;
|
||||
IForm form;
|
||||
if (pokemon.Form.Name == "default")
|
||||
{
|
||||
if (!pokemon.Species.TryGetForm("busted", out form!))
|
||||
return;
|
||||
}
|
||||
else if (pokemon.Form.Name == "totem-disguised")
|
||||
{
|
||||
if (!pokemon.Species.TryGetForm("totem-busted", out form!))
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
EventBatchId batchId = new();
|
||||
|
||||
pokemon.BattleData.Battle.EventHook.Invoke(new AbilityTriggerEvent(pokemon)
|
||||
{
|
||||
BatchId = batchId,
|
||||
});
|
||||
pokemon.ChangeForm(form, batchId);
|
||||
|
||||
damage = 0;
|
||||
}
|
||||
}
|
||||
36
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Download.cs
Normal file
36
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Download.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Download is an ability that raises the Pokémon's Attack or Special Attack stat when it enters battle,
|
||||
/// depending on which stat is lower on the opposing Pokémon.
|
||||
/// This ability is commonly associated with Porygon and its evolutions.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Download_(Ability)">Bulbapedia - Download</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "download")]
|
||||
public class Download : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
{
|
||||
var battleData = pokemon.BattleData;
|
||||
if (battleData == null)
|
||||
return;
|
||||
|
||||
var opponents = battleData.Battle.Sides.Where(x => x != battleData.BattleSide).SelectMany(x => x.Pokemon)
|
||||
.WhereNotNull().ToArray();
|
||||
if (opponents.Length == 0)
|
||||
return;
|
||||
var opponentAverageDefense = opponents.Average(x => x.BoostedStats.Defense);
|
||||
var opponentAverageSpecialDefense = opponents.Average(x => x.BoostedStats.SpecialDefense);
|
||||
|
||||
EventBatchId batchId = new();
|
||||
battleData.Battle.EventHook.Invoke(new AbilityTriggerEvent(pokemon)
|
||||
{
|
||||
BatchId = batchId,
|
||||
});
|
||||
pokemon.ChangeStatBoost(
|
||||
opponentAverageDefense < opponentAverageSpecialDefense ? Statistic.Attack : Statistic.SpecialAttack, 1,
|
||||
true, batchId);
|
||||
}
|
||||
}
|
||||
27
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Drizzle.cs
Normal file
27
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Drizzle.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Drizzle is an ability that creates rain when the Pokémon enters battle.
|
||||
/// This rain boosts Water-type moves and weakens Fire-type moves.
|
||||
/// This ability is commonly associated with Kyogre and Politoed.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Drizzle_(Ability)">Bulbapedia - Drizzle</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "drizzle")]
|
||||
public class Drizzle : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
{
|
||||
var battleData = pokemon.BattleData;
|
||||
if (battleData == null)
|
||||
return;
|
||||
|
||||
EventBatchId batchId = new();
|
||||
battleData.Battle.EventHook.Invoke(new AbilityTriggerEvent(pokemon)
|
||||
{
|
||||
BatchId = batchId,
|
||||
});
|
||||
battleData.Battle.SetWeather(ScriptUtils.ResolveName<Weather.Rain>(), 5, batchId);
|
||||
}
|
||||
}
|
||||
27
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Drought.cs
Normal file
27
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Drought.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Drought is an ability that creates harsh sunlight when the Pokémon enters battle.
|
||||
/// This sunlight boosts Fire-type moves and weakens Water-type moves.
|
||||
/// This ability is commonly associated with Groudon and Ninetales.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Drought_(Ability)">Bulbapedia - Drought</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "drought")]
|
||||
public class Drought : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
{
|
||||
var battleData = pokemon.BattleData;
|
||||
if (battleData == null)
|
||||
return;
|
||||
|
||||
EventBatchId batchId = new();
|
||||
battleData.Battle.EventHook.Invoke(new AbilityTriggerEvent(pokemon)
|
||||
{
|
||||
BatchId = batchId,
|
||||
});
|
||||
battleData.Battle.SetWeather(ScriptUtils.ResolveName<Weather.HarshSunlight>(), 5, batchId);
|
||||
}
|
||||
}
|
||||
58
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/DrySkin.cs
Normal file
58
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/DrySkin.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Dry Skin is an ability that makes the Pokémon take more damage from Fire-type moves,
|
||||
/// heal from Water-type moves, heal in rain, and take damage in harsh sunlight.
|
||||
/// This ability is commonly associated with Paras and Toxicroak.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Dry_Skin_(Ability)">Bulbapedia - Dry Skin</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "dry_skin")]
|
||||
public class DrySkin : Script
|
||||
{
|
||||
private IPokemon? _owningPokemon;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnAddedToParent(IScriptSource source)
|
||||
{
|
||||
if (source is not IPokemon pokemon)
|
||||
{
|
||||
throw new ArgumentException("DrySkin script must be added to a Pokemon.", nameof(source));
|
||||
}
|
||||
_owningPokemon = pokemon;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
|
||||
{
|
||||
var hitType = move.GetHitData(target, hit).Type;
|
||||
if (hitType?.Name == "fire")
|
||||
{
|
||||
modifier *= 1.25f;
|
||||
}
|
||||
else if (hitType?.Name == "water")
|
||||
{
|
||||
modifier = 0;
|
||||
target.BattleData?.Battle.EventHook.Invoke(new AbilityTriggerEvent(target));
|
||||
target.Heal(target.MaxHealth / 4);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IBattle battle)
|
||||
{
|
||||
if (_owningPokemon == null)
|
||||
return;
|
||||
var weather = battle.WeatherName;
|
||||
if (weather == ScriptUtils.ResolveName<Weather.Rain>())
|
||||
{
|
||||
_owningPokemon.BattleData?.Battle.EventHook.Invoke(new AbilityTriggerEvent(_owningPokemon));
|
||||
_owningPokemon.Heal(_owningPokemon.MaxHealth / 8);
|
||||
}
|
||||
else if (weather == ScriptUtils.ResolveName<Weather.HarshSunlight>())
|
||||
{
|
||||
_owningPokemon.BattleData?.Battle.EventHook.Invoke(new AbilityTriggerEvent(_owningPokemon));
|
||||
_owningPokemon.Damage(_owningPokemon.MaxHealth / 8, DamageSource.Weather);
|
||||
}
|
||||
}
|
||||
}
|
||||
25
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/EarlyBird.cs
Normal file
25
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/EarlyBird.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Early Bird is an ability that allows the Pokémon to wake up from sleep twice as fast.
|
||||
/// This means the number of turns the Pokémon stays asleep is halved, rounded down.
|
||||
/// This ability is commonly associated with Kangaskhan and Dodrio.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Early_Bird_(Ability)">Bulbapedia - Early Bird</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "early_bird")]
|
||||
public class EarlyBird : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void CustomTrigger(StringKey eventName, IDictionary<StringKey, object?>? parameters)
|
||||
{
|
||||
if (eventName != CustomTriggers.ModifySleepTurns)
|
||||
return;
|
||||
if (parameters == null)
|
||||
return;
|
||||
if (parameters.TryGetValue("turns", out var turnsObj) && turnsObj is int turns)
|
||||
{
|
||||
parameters["turns"] = turns / 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
49
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/EffectSpore.cs
Normal file
49
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/EffectSpore.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Effect Spore is an ability that has a 30% chance of inflicting a status condition on the attacker
|
||||
/// when hit by a contact move. The status condition can be poison (9%), paralysis (10%), or sleep (11%).
|
||||
/// This ability is commonly associated with Paras and Shroomish.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Effect_Spore_(Ability)">Bulbapedia - Effect Spore</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "effect_spore")]
|
||||
public class EffectSpore : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
if (move.User.Types.Any(x => x.Name == "grass"))
|
||||
return;
|
||||
if (move.User.ActiveAbility?.Name == "effect_spore")
|
||||
return;
|
||||
if (move.User.HasHeldItem("safety_goggles"))
|
||||
return;
|
||||
if (!move.UseMove.HasFlag("contact"))
|
||||
return;
|
||||
|
||||
var rng = move.Battle.Random;
|
||||
var chance = rng.GetInt(0, 100);
|
||||
EventBatchId batchId = new();
|
||||
if (chance < 30)
|
||||
{
|
||||
move.Battle.EventHook.Invoke(new AbilityTriggerEvent(target)
|
||||
{
|
||||
BatchId = batchId,
|
||||
});
|
||||
}
|
||||
|
||||
switch (chance)
|
||||
{
|
||||
case < 9:
|
||||
move.User.SetStatus(ScriptUtils.ResolveName<Status.Poisoned>(), batchId);
|
||||
break;
|
||||
case < 19:
|
||||
move.User.SetStatus(ScriptUtils.ResolveName<Status.Paralyzed>(), batchId);
|
||||
break;
|
||||
case < 30:
|
||||
move.User.SetStatus(ScriptUtils.ResolveName<Status.Sleep>(), batchId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using PkmnLib.Static.Utils;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Electric Surge is an ability that creates Electric Terrain when the Pokémon enters battle.
|
||||
/// This terrain prevents grounded Pokémon from falling asleep and boosts Electric-type moves.
|
||||
/// This ability is exclusive to Tapu Koko.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Electric_Surge_(Ability)">Bulbapedia - Electric Surge</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "electric_surge")]
|
||||
public class ElectricSurge : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
{
|
||||
var battleData = pokemon.BattleData;
|
||||
if (battleData == null)
|
||||
return;
|
||||
|
||||
EventBatchId batchId = new();
|
||||
battleData.Battle.EventHook.Invoke(new AbilityTriggerEvent(pokemon)
|
||||
{
|
||||
BatchId = batchId,
|
||||
});
|
||||
battleData.Battle.SetTerrain(ScriptUtils.ResolveName<Terrain.ElectricTerrain>(), batchId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Emergency Exit is an ability that makes the Pokémon switch out when its HP drops below half.
|
||||
/// This ability is similar to Wimp Out and is exclusive to Golisopod.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Emergency_Exit_(Ability)">Bulbapedia - Emergency Exit</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "emergency_exit")]
|
||||
public class EmergencyExit : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnDamage(IPokemon pokemon, DamageSource source, uint oldHealth, uint newHealth)
|
||||
{
|
||||
if (pokemon.BattleData is null)
|
||||
return;
|
||||
if (source is DamageSource.Confusion)
|
||||
return;
|
||||
|
||||
var oldHealthFraction = (float)oldHealth / pokemon.MaxHealth;
|
||||
var newHealthFraction = (float)newHealth / pokemon.MaxHealth;
|
||||
if (!(oldHealthFraction >= 0.5f) || !(newHealthFraction < 0.5f))
|
||||
return;
|
||||
|
||||
if (pokemon.BattleData.Battle.IsWildBattle)
|
||||
{
|
||||
pokemon.BattleData.Battle.ForceEndBattle();
|
||||
return;
|
||||
}
|
||||
pokemon.BattleData.BattleSide.SwapPokemon(pokemon.BattleData.Position, null);
|
||||
}
|
||||
}
|
||||
34
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/FairyAura.cs
Normal file
34
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/FairyAura.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Fairy Aura is an ability that increases the power of Fairy-type moves by 33% for all Pokémon on the field.
|
||||
/// The effect can be modified by other abilities (such as Aura Break) via a custom script hook.
|
||||
/// This ability is exclusive to Xerneas.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Fairy_Aura_(Ability)">Bulbapedia - Fairy Aura</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "fairy_aura")]
|
||||
public class FairyAura : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
|
||||
{
|
||||
if (move.GetHitData(target, hit).Type?.Name == "fairy")
|
||||
{
|
||||
var auraModifier = 5448f / 4096f;
|
||||
var parameters = new Dictionary<StringKey, object?>
|
||||
{
|
||||
["aura_type"] = "fairy",
|
||||
["modifier"] = auraModifier,
|
||||
};
|
||||
move.Battle.Sides.SelectMany(side => side.Pokemon).WhereNotNull()
|
||||
.RunScriptHook(x => x.CustomTrigger(CustomTriggers.ModifyAuraEffect, parameters));
|
||||
if (parameters.TryGetValue("modifier", out var modObj) && modObj is float modValue)
|
||||
{
|
||||
auraModifier = modValue;
|
||||
}
|
||||
modifier *= auraModifier;
|
||||
move.Battle.EventHook.Invoke(new AbilityTriggerEvent(move.User));
|
||||
}
|
||||
}
|
||||
}
|
||||
22
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Filter.cs
Normal file
22
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Filter.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Filter is an ability that reduces the damage taken from super-effective moves by 25%.
|
||||
/// This ability is similar to Solid Rock, but is exclusive to certain Pokémon like Mr. Mime.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Filter_(Ability)">Bulbapedia - Filter</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "filter")]
|
||||
public class Filter : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeIncomingMoveDamageModifier(IExecutingMove move, IPokemon target, byte hit,
|
||||
ref float modifier)
|
||||
{
|
||||
if (move.GetHitData(target, hit).Effectiveness >= 2.0f)
|
||||
{
|
||||
modifier *= 0.75f;
|
||||
move.Battle.EventHook.Invoke(new AbilityTriggerEvent(move.User));
|
||||
}
|
||||
}
|
||||
}
|
||||
25
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/FlameBody.cs
Normal file
25
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/FlameBody.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Flame Body is an ability that has a 30% chance of burning the attacker when hit by a contact move.
|
||||
/// This ability is similar to Effect Spore and Static, but inflicts burn instead of other status conditions.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Flame_Body_(Ability)">Bulbapedia - Flame Body</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "flame_body")]
|
||||
public class FlameBody : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
if (!move.UseMove.HasFlag("contact"))
|
||||
return;
|
||||
|
||||
var rng = move.Battle.Random;
|
||||
if (rng.GetInt(0, 100) >= 30) // 30% chance
|
||||
return;
|
||||
|
||||
move.Battle.EventHook.Invoke(new AbilityTriggerEvent(target));
|
||||
move.User.SetStatus(ScriptUtils.ResolveName<Status.Burned>());
|
||||
}
|
||||
}
|
||||
23
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/FlareBoost.cs
Normal file
23
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/FlareBoost.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using PkmnLib.Static.Moves;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Flare Boost is an ability that increases the power of special moves by 50% when the Pokémon is burned.
|
||||
/// This ability is exclusive to Drifblim.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Flare_Boost_(Ability)">Bulbapedia - Flare Boost</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "flare_boost")]
|
||||
public class FlareBoost : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
|
||||
{
|
||||
if (!move.User.HasStatus(ScriptUtils.ResolveName<Status.Burned>()))
|
||||
return;
|
||||
|
||||
if (move.UseMove.Category == MoveCategory.Special)
|
||||
modifier *= 1.5f;
|
||||
}
|
||||
}
|
||||
29
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/FlashFire.cs
Normal file
29
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/FlashFire.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Flash Fire is an ability that makes the Pokémon immune to Fire-type moves.
|
||||
/// When hit by a Fire-type move, the ability activates and increases the power of the Pokémon's Fire-type moves by 50%.
|
||||
/// This ability is commonly associated with Ninetales and Arcanine.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Flash_Fire_(Ability)">Bulbapedia - Flash Fire</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "flash_fire")]
|
||||
public class FlashFire : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeIncomingEffectiveness(IExecutingMove executingMove, IPokemon target, byte hitIndex,
|
||||
ref float effectiveness)
|
||||
{
|
||||
if (executingMove.GetHitData(target, hitIndex).Type?.Name == "fire")
|
||||
{
|
||||
effectiveness = 0f;
|
||||
|
||||
if (target.Volatile.Contains<FlashFireEffect>())
|
||||
return;
|
||||
target.Volatile.Add(new FlashFireEffect());
|
||||
executingMove.Battle.EventHook.Invoke(new AbilityTriggerEvent(target));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user