using System.Collections.Generic;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "magnitude")]
public class Magnitude : Script
{
///
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
{
var battleData = move.User.BattleData;
if (battleData == null)
return;
var random = battleData.Battle.Random;
var magnitudePercentage = random.GetInt(0, 100);
var magnitude = magnitudePercentage switch
{
// 5% chance for 4
< 5 => 4,
// 10% chance for 5
< 15 => 5,
// 20% chance for 6
< 35 => 6,
// 30% chance for 7
< 65 => 7,
// 20% chance for 8
< 85 => 8,
// 10% chance for 9
< 95 => 9,
// 5% chance for 10
_ => 10,
};
battleData.Battle.EventHook.Invoke(new DialogEvent("magnitude", new Dictionary
{
{ "magnitude", magnitude },
{ "user", move.User },
{ "target", target },
}));
basePower = magnitude switch
{
4 => 10,
5 => 30,
6 => 50,
7 => 70,
8 => 90,
9 => 110,
_ => 150,
};
}
}