namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "2_5_hit_move")]
public class MultiHitMove : Script, IScriptChangeNumberOfHits
{
///
public void ChangeNumberOfHits(IMoveChoice choice, ref byte numberOfHits)
{
var random = choice.User.BattleData?.Battle.Random;
if (random == null)
return;
var roll = random.GetInt(100);
// 35% chance that it will hit 2 times, a 35% chance it will hit 3 times, a 15% chance it
// will hit 4 times, and a 15% chance it will hit 5 times.
var newHits = roll switch
{
< 35 => 2,
< 70 => 3,
< 85 => 4,
_ => 5,
};
var triggerArgs = new CustomTriggers.Modify2_5HitMoveArgs(choice, (byte)newHits);
choice.RunScriptHook(x => x.CustomTrigger(CustomTriggers.Modify2_5HitMove, triggerArgs));
newHits = triggerArgs.NumberOfHits;
numberOfHits = (byte)newHits;
}
}