This commit is contained in:
18
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/VoltTackle.cs
Normal file
18
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/VoltTackle.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "volt_tackle")]
|
||||
public class VoltTackle : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
var hitData = move.GetHitData(target, hit);
|
||||
var recoilDamage = (uint)(hitData.Damage * (1f / 3f));
|
||||
move.User.Damage(recoilDamage, DamageSource.Misc);
|
||||
|
||||
if (move.Battle.Random.EffectChance(10, move, target, hit))
|
||||
{
|
||||
target.SetStatus(ScriptUtils.ResolveName<Status.Paralyzed>());
|
||||
}
|
||||
}
|
||||
}
|
||||
26
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/WakeUpSlap.cs
Normal file
26
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/WakeUpSlap.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using PkmnLib.Static.Utils;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "wake_up_slap")]
|
||||
public class WakeUpSlap : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
|
||||
{
|
||||
if (target.HasStatus(ScriptUtils.ResolveName<Status.Sleep>()))
|
||||
{
|
||||
basePower = basePower.MultiplyOrMax(2);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
// Wake up the target if it is asleep
|
||||
if (target.HasStatus(ScriptUtils.ResolveName<Status.Sleep>()))
|
||||
{
|
||||
target.ClearStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
7
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/WaterPledge.cs
Normal file
7
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/WaterPledge.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "water_pledge")]
|
||||
public class WaterPledge : Script
|
||||
{
|
||||
// TODO: pledge moves
|
||||
}
|
||||
17
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/WaterSport.cs
Normal file
17
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/WaterSport.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Battle;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "water_sport")]
|
||||
public class WaterSport : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
var effect = move.Battle.Volatile.Add(new WaterSportEffect());
|
||||
if (effect?.Script is WaterSportEffect waterSportEffect)
|
||||
{
|
||||
waterSportEffect.Placers.Add(move.User);
|
||||
}
|
||||
}
|
||||
}
|
||||
39
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/WeatherBall.cs
Normal file
39
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/WeatherBall.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using PkmnLib.Static.Utils;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "weather_ball")]
|
||||
public class WeatherBall : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
|
||||
{
|
||||
if (move.Battle.WeatherName is not null)
|
||||
{
|
||||
basePower = basePower.MultiplyOrMax(2);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit,
|
||||
ref TypeIdentifier? typeIdentifier)
|
||||
{
|
||||
var weather = move.Battle.WeatherName;
|
||||
var typeLibrary = move.Battle.Library.StaticLibrary.Types;
|
||||
if (weather is null)
|
||||
return;
|
||||
|
||||
if (weather == ScriptUtils.ResolveName<Weather.Sunny>() &&
|
||||
typeLibrary.TryGetTypeIdentifier("fire", out var fireType))
|
||||
typeIdentifier = fireType;
|
||||
else if (weather == ScriptUtils.ResolveName<Weather.Rain>() &&
|
||||
typeLibrary.TryGetTypeIdentifier("water", out var waterType))
|
||||
typeIdentifier = waterType;
|
||||
else if (weather == ScriptUtils.ResolveName<Weather.Hail>() &&
|
||||
typeLibrary.TryGetTypeIdentifier("ice", out var iceType))
|
||||
typeIdentifier = iceType;
|
||||
else if (weather == ScriptUtils.ResolveName<Weather.Sandstorm>() &&
|
||||
typeLibrary.TryGetTypeIdentifier("rock", out var rockType))
|
||||
typeIdentifier = rockType;
|
||||
}
|
||||
}
|
||||
28
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Whirlpool.cs
Normal file
28
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Whirlpool.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
using PkmnLib.Static.Utils;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "whirlpool")]
|
||||
public class Whirlpool : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
var userVolatile = move.User.Volatile.Add(new WhirlpoolEffect());
|
||||
if (userVolatile?.Script is WhirlpoolEffect whirlpoolEffect)
|
||||
{
|
||||
var turns = move.Battle.Random.GetInt(4, 6);
|
||||
var damagePercent = 0.125f;
|
||||
var parameters = new Dictionary<StringKey, object?>
|
||||
{
|
||||
{ "number_of_turns", turns },
|
||||
{ "damage_percent", damagePercent },
|
||||
};
|
||||
move.RunScriptHook(x => x.CustomTrigger(CustomTriggers.Whirlpool, parameters));
|
||||
turns = parameters.GetValueOrDefault("number_of_turns", turns) as int? ?? turns;
|
||||
damagePercent = parameters.GetValueOrDefault("damage_percent", damagePercent) as float? ?? damagePercent;
|
||||
whirlpoolEffect.AddTargetedPokemon(target, turns, damagePercent);
|
||||
}
|
||||
}
|
||||
}
|
||||
18
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/WideGuard.cs
Normal file
18
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/WideGuard.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "wide_guard")]
|
||||
public class WideGuard : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
if (move.Battle.ChoiceQueue?.HasNext() != true)
|
||||
{
|
||||
move.GetHitData(target, hit).Fail();
|
||||
return;
|
||||
}
|
||||
move.User.BattleData?.BattleSide.VolatileScripts.Add(new WideGuardEffect());
|
||||
}
|
||||
}
|
||||
11
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Wish.cs
Normal file
11
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Wish.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "wish")]
|
||||
public class Wish : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
move.User.Volatile.Add(new Pokemon.WishEffect());
|
||||
}
|
||||
}
|
||||
13
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/WonderRoom.cs
Normal file
13
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/WonderRoom.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Battle;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "wonder_room")]
|
||||
public class WonderRoom : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
move.Battle.Volatile.Add(new WonderRoomEffect());
|
||||
}
|
||||
}
|
||||
17
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/WorrySeed.cs
Normal file
17
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/WorrySeed.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "worry_seed")]
|
||||
public class WorrySeed : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
var abilityLibrary = move.Battle.Library.StaticLibrary.Abilities;
|
||||
if (!abilityLibrary.TryGet("insomnia", out var ability))
|
||||
{
|
||||
// Edge case: if the ability is not found, we should not change the ability.
|
||||
return;
|
||||
}
|
||||
target.ChangeAbility(ability);
|
||||
}
|
||||
}
|
||||
13
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Yawn.cs
Normal file
13
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Yawn.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "yawn")]
|
||||
public class Yawn : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
target.Volatile.Add(new YawnEffect());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user