This commit is contained in:
@@ -1,7 +1,53 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Weather;
|
||||
|
||||
[Script(ScriptCategory.Weather, "rain")]
|
||||
public class Rain : Script
|
||||
public class Rain : Script, ILimitedTurnsScript
|
||||
{
|
||||
// TODO: Implement Rain
|
||||
private int? _duration;
|
||||
|
||||
/// <inheritdoc />
|
||||
public int TurnsRemaining => _duration ?? 0;
|
||||
|
||||
/// <inheritdoc />
|
||||
public void SetTurns(int turns)
|
||||
{
|
||||
_duration = turns;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IBattle battle)
|
||||
{
|
||||
_duration--;
|
||||
if (_duration <= 0)
|
||||
{
|
||||
battle.SetWeather(null, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
|
||||
{
|
||||
var hitType = move.GetHitData(target, hit).Type;
|
||||
if (hitType?.Name == "water")
|
||||
{
|
||||
// Increase Water-type move power by 50% in rain
|
||||
basePower = (ushort)(basePower * 1.5);
|
||||
}
|
||||
else if (hitType?.Name == "fire")
|
||||
{
|
||||
// Decrease Fire-type move power by 50% in rain
|
||||
basePower = (ushort)(basePower * 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeAccuracy(IExecutingMove executingMove, IPokemon target, byte hitIndex,
|
||||
ref int modifiedAccuracy)
|
||||
{
|
||||
modifiedAccuracy = executingMove.UseMove.Name.ToString() switch
|
||||
{
|
||||
"thunder" or "hurricane" or "bleakwind_storm" or "windbolt_storm" or "sandsear_storm" => 1000,
|
||||
_ => modifiedAccuracy,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user