Last couple abilities
This commit is contained in:
parent
cd6095455a
commit
b11203cb3a
@ -726,17 +726,34 @@
|
|||||||
"water_absorb": {
|
"water_absorb": {
|
||||||
"effect": "water_absorb"
|
"effect": "water_absorb"
|
||||||
},
|
},
|
||||||
"water_bubble": {},
|
"water_bubble": {
|
||||||
"water_compaction": {},
|
"effect": "water_bubble"
|
||||||
"water_veil": {},
|
},
|
||||||
"weak_armor": {},
|
"water_compaction": {
|
||||||
"white_smoke": {},
|
"effect": "water_compaction"
|
||||||
"wimp_out": {},
|
},
|
||||||
"wonder_guard": {},
|
"water_veil": {
|
||||||
"wonder_skin": {},
|
"effect": "water_veil"
|
||||||
|
},
|
||||||
|
"weak_armor": {
|
||||||
|
"effect": "weak_armor"
|
||||||
|
},
|
||||||
|
"white_smoke": {
|
||||||
|
"effect": "white_smoke"
|
||||||
|
},
|
||||||
|
"wimp_out": {
|
||||||
|
"effect": "wimp_out"
|
||||||
|
},
|
||||||
|
"wonder_guard": {
|
||||||
|
"effect": "wonder_guard"
|
||||||
|
},
|
||||||
|
"wonder_skin": {
|
||||||
|
"effect": "wonder_skin"
|
||||||
|
},
|
||||||
"zen_mode": {
|
"zen_mode": {
|
||||||
"flags": [
|
"flags": [
|
||||||
"cant_be_copied"
|
"cant_be_copied"
|
||||||
]
|
],
|
||||||
|
"effect": "zen_mode"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -25251,6 +25251,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"zen": {
|
"zen": {
|
||||||
|
"isBattleOnly": true,
|
||||||
"abilities": [
|
"abilities": [
|
||||||
"sheer_force"
|
"sheer_force"
|
||||||
],
|
],
|
||||||
|
@ -8,21 +8,11 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
[Script(ScriptCategory.Ability, "shields_down")]
|
[Script(ScriptCategory.Ability, "shields_down")]
|
||||||
public class ShieldsDown : Script
|
public class ShieldsDown : Script
|
||||||
{
|
{
|
||||||
private IPokemon? _owningPokemon;
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public override void OnAddedToParent(IScriptSource source)
|
|
||||||
{
|
|
||||||
if (source is not IPokemon pokemon)
|
|
||||||
throw new ArgumentException("ShieldsDown script must be added to a Pokemon.", nameof(source));
|
|
||||||
_owningPokemon = pokemon;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchIn(IPokemon pokemon, byte position) => ChangeFormIfNeeded(pokemon);
|
public override void OnSwitchIn(IPokemon pokemon, byte position) => ChangeFormIfNeeded(pokemon);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnEndTurn(IScriptSource owner, IBattle battle) => ChangeFormIfNeeded(_owningPokemon);
|
public override void OnEndTurn(IScriptSource owner, IBattle battle) => ChangeFormIfNeeded(owner as IPokemon);
|
||||||
|
|
||||||
private static void ChangeFormIfNeeded(IPokemon? pokemon)
|
private static void ChangeFormIfNeeded(IPokemon? pokemon)
|
||||||
{
|
{
|
||||||
|
32
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/WaterBubble.cs
Normal file
32
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/WaterBubble.cs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Water Bubble is an ability that halves the damage taken from Fire-type moves and prevents the Pokémon from being burned.
|
||||||
|
///
|
||||||
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Water_Bubble_(Ability)">Bulbapedia - Water Bubble</see>
|
||||||
|
/// </summary>
|
||||||
|
[Script(ScriptCategory.Ability, "water_bubble")]
|
||||||
|
public class WaterBubble : Script
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void PreventStatusChange(IPokemon pokemon, StringKey status, bool selfInflicted,
|
||||||
|
ref bool preventStatus)
|
||||||
|
{
|
||||||
|
if (status == ScriptUtils.ResolveName<Status.Burned>())
|
||||||
|
preventStatus = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||||
|
{
|
||||||
|
if (move.GetHitData(target, hit).Type?.Name == "fire")
|
||||||
|
damage /= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||||
|
{
|
||||||
|
if (move.GetHitData(target, hit).Type?.Name == "water")
|
||||||
|
damage *= 2;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Water Compaction is an ability that sharply raises Defense when hit by a Water-type move.
|
||||||
|
///
|
||||||
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Water_Compaction_(Ability)">Bulbapedia - Water Compaction</see>
|
||||||
|
/// </summary>
|
||||||
|
[Script(ScriptCategory.Ability, "water_compaction")]
|
||||||
|
public class WaterCompaction : Script
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
|
||||||
|
{
|
||||||
|
if (move.GetHitData(target, hit).Type?.Name != "water")
|
||||||
|
return;
|
||||||
|
target.BattleData?.Battle.EventHook.Invoke(new AbilityTriggerEvent(target));
|
||||||
|
target.ChangeStatBoost(Statistic.Defense, 2, true, false);
|
||||||
|
}
|
||||||
|
}
|
18
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/WaterVeil.cs
Normal file
18
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/WaterVeil.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Water Veil is an ability that prevents the Pokémon from being burned.
|
||||||
|
///
|
||||||
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Water_Veil_(Ability)">Bulbapedia - Water Veil</see>
|
||||||
|
/// </summary>
|
||||||
|
[Script(ScriptCategory.Ability, "water_veil")]
|
||||||
|
public class WaterVeil : Script
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void PreventStatusChange(IPokemon pokemon, StringKey status, bool selfInflicted,
|
||||||
|
ref bool preventStatus)
|
||||||
|
{
|
||||||
|
if (status == ScriptUtils.ResolveName<Status.Burned>())
|
||||||
|
preventStatus = true;
|
||||||
|
}
|
||||||
|
}
|
23
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/WeakArmor.cs
Normal file
23
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/WeakArmor.cs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
using PkmnLib.Static.Moves;
|
||||||
|
|
||||||
|
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Weak Armor is an ability that lowers Defense and raises Speed when hit by a physical move.
|
||||||
|
///
|
||||||
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Weak_Armor_(Ability)">Bulbapedia - Weak Armor</see>
|
||||||
|
/// </summary>
|
||||||
|
[Script(ScriptCategory.Ability, "weak_armor")]
|
||||||
|
public class WeakArmor : Script
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
|
||||||
|
{
|
||||||
|
if (move.UseMove.Category != MoveCategory.Physical)
|
||||||
|
return;
|
||||||
|
|
||||||
|
target.BattleData?.Battle.EventHook.Invoke(new AbilityTriggerEvent(target));
|
||||||
|
target.ChangeStatBoost(Statistic.Defense, -1, true, false);
|
||||||
|
target.ChangeStatBoost(Statistic.Speed, 1, true, false);
|
||||||
|
}
|
||||||
|
}
|
20
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/WhiteSmoke.cs
Normal file
20
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/WhiteSmoke.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// White Smoke is an ability that prevents the Pokémon's stats from being lowered by other Pokémon.
|
||||||
|
///
|
||||||
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/White_Smoke_(Ability)">Bulbapedia - White Smoke</see>
|
||||||
|
/// </summary>
|
||||||
|
[Script(ScriptCategory.Ability, "white_smoke")]
|
||||||
|
public class WhiteSmoke : Script
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void PreventStatBoostChange(IPokemon target, Statistic stat, sbyte amount, bool selfInflicted,
|
||||||
|
ref bool prevent)
|
||||||
|
{
|
||||||
|
if (selfInflicted || amount >= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
prevent = true;
|
||||||
|
}
|
||||||
|
}
|
12
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/WimpOut.cs
Normal file
12
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/WimpOut.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Wimp Out is an ability that causes the Pokémon to switch out when its HP falls below half.
|
||||||
|
///
|
||||||
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Wimp_Out_(Ability)">Bulbapedia - Wimp Out</see>
|
||||||
|
/// </summary>
|
||||||
|
[Script(ScriptCategory.Ability, "wimp_out")]
|
||||||
|
public class WimpOut : Script
|
||||||
|
{
|
||||||
|
// TODO: Implement Wimp Out ability logic
|
||||||
|
}
|
20
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/WonderGuard.cs
Normal file
20
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/WonderGuard.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Wonder Guard is an ability that only allows super-effective moves to hit the Pokémon.
|
||||||
|
///
|
||||||
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Wonder_Guard_(Ability)">Bulbapedia - Wonder Guard</see>
|
||||||
|
/// </summary>
|
||||||
|
[Script(ScriptCategory.Ability, "wonder_guard")]
|
||||||
|
public class WonderGuard : Script
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
||||||
|
{
|
||||||
|
var effectiveness = executingMove.GetHitData(target, hitIndex).Effectiveness;
|
||||||
|
if (!(effectiveness <= 1.0))
|
||||||
|
return;
|
||||||
|
executingMove.Battle.EventHook.Invoke(new AbilityTriggerEvent(target));
|
||||||
|
block = true;
|
||||||
|
}
|
||||||
|
}
|
23
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/WonderSkin.cs
Normal file
23
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/WonderSkin.cs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
using PkmnLib.Static.Moves;
|
||||||
|
|
||||||
|
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Wonder Skin is an ability that makes status moves more likely to miss.
|
||||||
|
///
|
||||||
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Wonder_Skin_(Ability)">Bulbapedia - Wonder Skin</see>
|
||||||
|
/// </summary>
|
||||||
|
[Script(ScriptCategory.Ability, "wonder_skin")]
|
||||||
|
public class WonderSkin : Script
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void ChangeIncomingAccuracy(IExecutingMove executingMove, IPokemon target, byte hitIndex,
|
||||||
|
ref int modifiedAccuracy)
|
||||||
|
{
|
||||||
|
if (executingMove.UseMove.Category == MoveCategory.Status && executingMove.UseMove.Accuracy != 255)
|
||||||
|
{
|
||||||
|
executingMove.Battle.EventHook.Invoke(new AbilityTriggerEvent(target));
|
||||||
|
modifiedAccuracy /= 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
34
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/ZenMode.cs
Normal file
34
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/ZenMode.cs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Zen Mode is an ability that changes the Pokémon's form when its HP falls below half.
|
||||||
|
///
|
||||||
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Zen_Mode_(Ability)">Bulbapedia - Zen Mode</see>
|
||||||
|
/// </summary>
|
||||||
|
[Script(ScriptCategory.Ability, "zen_mode")]
|
||||||
|
public class ZenMode : Script
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void OnSwitchIn(IPokemon pokemon, byte position) => ChangeFormIfNeeded(pokemon);
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void OnEndTurn(IScriptSource owner, IBattle battle) => ChangeFormIfNeeded(owner as IPokemon);
|
||||||
|
|
||||||
|
private static void ChangeFormIfNeeded(IPokemon? pokemon)
|
||||||
|
{
|
||||||
|
if (pokemon is null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (pokemon.Species.Name != "darmanitan" || pokemon.BattleData?.Battle == null)
|
||||||
|
return;
|
||||||
|
if (pokemon.CurrentHealth < pokemon.MaxHealth / 2 && pokemon.Form.Name != "zen" &&
|
||||||
|
pokemon.Species.TryGetForm("zen", out var zenForm))
|
||||||
|
{
|
||||||
|
pokemon.ChangeForm(zenForm);
|
||||||
|
}
|
||||||
|
else if (pokemon.CurrentHealth >= pokemon.MaxHealth / 2 && pokemon.Form.Name == "zen")
|
||||||
|
{
|
||||||
|
pokemon.ChangeForm(pokemon.Species.GetDefaultForm());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user