This commit is contained in:
@@ -33,4 +33,10 @@ public class DesolateLands : HarshSunlight
|
||||
if (move.UseMove.MoveType.Name == "water")
|
||||
fail = true;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IBattle battle)
|
||||
{
|
||||
// We don't want to call base.OnEndTurn here, as we want to prevent the weather from ending
|
||||
}
|
||||
}
|
||||
@@ -6,8 +6,29 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Weather;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Harsh_sunlight">Bulbapedia - Harsh Sunlight</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Weather, "harsh_sunlight")]
|
||||
public class HarshSunlight : Script
|
||||
public class HarshSunlight : Script, ILimitedTurnsScript
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Weather;
|
||||
|
||||
[Script(ScriptCategory.Weather, "primordial_sea")]
|
||||
public class PrimordialSea : Script
|
||||
public class PrimordialSea : Rain
|
||||
{
|
||||
private HashSet<IPokemon> _placers = new();
|
||||
|
||||
@@ -26,4 +26,16 @@ public class PrimordialSea : Script
|
||||
return;
|
||||
preventWeatherChange = true;
|
||||
}
|
||||
|
||||
public override void FailMove(IExecutingMove move, ref bool fail)
|
||||
{
|
||||
if (move.UseMove.MoveType.Name == "fire")
|
||||
fail = true;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IBattle battle)
|
||||
{
|
||||
// We don't want to call base.OnEndTurn here, as we want to prevent the weather from ending
|
||||
}
|
||||
}
|
||||
@@ -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