37 lines
1.6 KiB
C#
37 lines
1.6 KiB
C#
|
using System.Collections.Generic;
|
||
|
using PkmnLib.Static;
|
||
|
|
||
|
namespace PkmnLib.Plugin.Gen7.Moves;
|
||
|
|
||
|
/// <summary>
|
||
|
/// The user sheds part of its body to make itself lighter and sharply raise its Speed stat.
|
||
|
/// </summary>
|
||
|
/// <remarks>
|
||
|
/// Autotomize raises the user's Speed stat by two stages and (if the user successfully changes its Speed) decreases its
|
||
|
/// weight by 220 lbs. (100 kg). If the user successfully changes its weight, the message "Pokémon became nimble!"
|
||
|
/// is displayed.
|
||
|
/// <br />
|
||
|
/// Autotomize cannot decrease the user's weight below the minimum 0.2 lbs (0.1 kg); if the user's weight would drop
|
||
|
/// below the minimum, it becomes the minimum instead. Weight loss from Autotomize stacks, so using it multiple times
|
||
|
/// will continue to decrease the user's weight accordingly until it reaches the minimum weight. Autotomize's weight
|
||
|
/// reduction cannot be transferred by Baton Pass or removed by Haze. A Pokémon's weight is reset if it changes form
|
||
|
/// (from Generation VI onward), switches out or faints, or the battle ends.
|
||
|
/// </remarks>
|
||
|
[Script(ScriptCategory.Move, "autotomize")]
|
||
|
public class Autotomize : Script
|
||
|
{
|
||
|
/// <inheritdoc />
|
||
|
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||
|
{
|
||
|
var user = move.User;
|
||
|
if (user.ChangeStatBoost(Statistic.Speed, 2, true) &&
|
||
|
user.ChangeWeightInKgBy(-100.0f))
|
||
|
{
|
||
|
var battle = user.BattleData?.Battle;
|
||
|
battle?.EventHook.Invoke(new DialogEvent("pokemon_became_nimble", new Dictionary<string, object>()
|
||
|
{
|
||
|
{ "pokemon", user }
|
||
|
}));
|
||
|
}
|
||
|
}
|
||
|
}
|