More move scripts
This commit is contained in:
37
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/FlameWheel.cs
Normal file
37
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/FlameWheel.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using PkmnLib.Static.Utils;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "flame_wheel")]
|
||||
public class FlameWheel : Script
|
||||
{
|
||||
private float _burnChance;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override 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 override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
if (move.User.HasStatus("frozen"))
|
||||
{
|
||||
move.User.ClearStatus();
|
||||
}
|
||||
|
||||
var burnChance = _burnChance;
|
||||
if (move.Battle.Random.EffectChance(_burnChance, move, target, hit))
|
||||
{
|
||||
target.SetStatus("burned");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user