24 lines
745 B
C#
24 lines
745 B
C#
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||
|
|
||
|
[Script(ScriptCategory.Move, "2_5_hit_move")]
|
||
|
public class MultiHitMove : Script
|
||
|
{
|
||
|
/// <inheritdoc />
|
||
|
public override 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
|
||
|
};
|
||
|
numberOfHits = (byte)newHits;
|
||
|
}
|
||
|
}
|