This commit is contained in:
59
Plugins/PkmnLib.Plugin.Gen7/Scripts/Weather/HarshSunlight.cs
Normal file
59
Plugins/PkmnLib.Plugin.Gen7/Scripts/Weather/HarshSunlight.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Weather;
|
||||
|
||||
/// <summary>
|
||||
/// HarshSunlight is a weather condition that intensifies the effects of sunlight.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Harsh_sunlight">Bulbapedia - Harsh Sunlight</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Weather, "harsh_sunlight")]
|
||||
public class HarshSunlight : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
|
||||
{
|
||||
var hitType = move.GetHitData(target, hit).Type;
|
||||
if (hitType?.Name == "fire" || move.UseMove.Name == "hydro_steam")
|
||||
{
|
||||
// Increase Fire-type move power by 50% in harsh sunlight
|
||||
basePower = (ushort)(basePower * 1.5);
|
||||
}
|
||||
else if (hitType?.Name == "water")
|
||||
{
|
||||
basePower = (ushort)(basePower * 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void CustomTrigger(StringKey eventName, IDictionary<StringKey, object?>? parameters)
|
||||
{
|
||||
if (eventName == CustomTriggers.BypassChargeMove)
|
||||
{
|
||||
if (parameters == null || !parameters.TryGetValue("move", out var moveObj) ||
|
||||
moveObj is not IExecutingMove move)
|
||||
return;
|
||||
if (move.UseMove.Name == "solar_beam" || move.UseMove.Name == "solar_blade")
|
||||
{
|
||||
parameters["bypassCharge"] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void PreventStatusChange(IPokemon pokemonImpl, StringKey status, ref bool preventStatus)
|
||||
{
|
||||
if (status == ScriptUtils.ResolveName<Status.Frozen>())
|
||||
{
|
||||
preventStatus = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeAccuracy(IExecutingMove executingMove, IPokemon target, byte hitIndex,
|
||||
ref int modifiedAccuracy)
|
||||
{
|
||||
if (executingMove.UseMove.Name == "thunder" || executingMove.UseMove.Name == "hurricane")
|
||||
{
|
||||
modifiedAccuracy = (int)(modifiedAccuracy * 0.5);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user