32 lines
1.0 KiB
C#
32 lines
1.0 KiB
C#
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
|
|
|
[Script(ScriptCategory.Move, "flame_wheel")]
|
|
public class FlameWheel : Script, IScriptOnInitialize, IScriptOnSecondaryEffect
|
|
{
|
|
private float _burnChance;
|
|
|
|
/// <inheritdoc />
|
|
public void OnInitialize(IReadOnlyDictionary<StringKey, object?>? parameters)
|
|
{
|
|
if (parameters is null || !parameters.TryGetValue("burn_chance", out var burnChance) ||
|
|
burnChance is not float chance)
|
|
{
|
|
throw new Exception("Flame Wheel: Missing or invalid parameters.");
|
|
}
|
|
_burnChance = chance;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
|
{
|
|
if (move.User.HasStatus(ScriptUtils.ResolveName<Status.Frozen>()))
|
|
{
|
|
move.User.ClearStatus();
|
|
}
|
|
|
|
if (move.Battle.Random.EffectChance(_burnChance, move, target, hit))
|
|
{
|
|
target.SetStatus(ScriptUtils.ResolveName<Status.Burned>(), move.User);
|
|
}
|
|
}
|
|
} |