This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Weather;
|
||||
|
||||
[Script(ScriptCategory.Weather, "desolate_lands")]
|
||||
public class DesolateLands : HarshSunlight, IScriptFailMove, IScriptOnEndTurn, IScriptOnSwitchOut
|
||||
public class DesolateLands : HarshSunlight, IScriptFailMove, IScriptOnEndTurn, IScriptOnSwitchOut,
|
||||
IScriptPreventWeatherChange
|
||||
{
|
||||
private readonly HashSet<IPokemon> _placers = [];
|
||||
|
||||
@@ -19,7 +20,7 @@ public class DesolateLands : HarshSunlight, IScriptFailMove, IScriptOnEndTurn, I
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void PreventWeatherChange(StringKey? weatherName, ref bool preventWeatherChange)
|
||||
public void PreventWeatherChange(StringKey? weatherName, ref bool preventWeatherChange)
|
||||
{
|
||||
if (weatherName == ScriptUtils.ResolveName<PrimordialSea>() ||
|
||||
weatherName == ScriptUtils.ResolveName<StrongWinds>())
|
||||
|
||||
@@ -30,7 +30,7 @@ public class Hail : Script, ILimitedTurnsScript, IScriptOnEndTurn
|
||||
if (pokemon.Types.Contains(iceType))
|
||||
continue;
|
||||
var args = new CustomTriggers.IgnoreHailArgs(pokemon);
|
||||
pokemon.RunScriptHook(x => x.CustomTrigger(CustomTriggers.IgnoreHail, args));
|
||||
pokemon.RunScriptHook<IScriptCustomTrigger>(x => x.CustomTrigger(CustomTriggers.IgnoreHail, args));
|
||||
if (args.Ignore)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -6,7 +6,8 @@ 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, ILimitedTurnsScript, IScriptChangeBasePower, IScriptOnEndTurn
|
||||
public class HarshSunlight : Script, ILimitedTurnsScript, IScriptChangeBasePower, IScriptOnEndTurn,
|
||||
IScriptPreventStatusChange, IScriptCustomTrigger, IScriptChangeAccuracy
|
||||
{
|
||||
private int? _duration;
|
||||
|
||||
@@ -45,7 +46,7 @@ public class HarshSunlight : Script, ILimitedTurnsScript, IScriptChangeBasePower
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void CustomTrigger(StringKey eventName, ICustomTriggerArgs args)
|
||||
public void CustomTrigger(StringKey eventName, ICustomTriggerArgs args)
|
||||
{
|
||||
if (eventName != CustomTriggers.BypassChargeMove)
|
||||
return;
|
||||
@@ -58,8 +59,7 @@ public class HarshSunlight : Script, ILimitedTurnsScript, IScriptChangeBasePower
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void PreventStatusChange(IPokemon pokemon, StringKey status, bool selfInflicted,
|
||||
ref bool preventStatus)
|
||||
public void PreventStatusChange(IPokemon pokemon, StringKey status, bool selfInflicted, ref bool preventStatus)
|
||||
{
|
||||
if (status == ScriptUtils.ResolveName<Status.Frozen>())
|
||||
{
|
||||
@@ -68,8 +68,7 @@ public class HarshSunlight : Script, ILimitedTurnsScript, IScriptChangeBasePower
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeAccuracy(IExecutingMove executingMove, IPokemon target, byte hitIndex,
|
||||
ref int modifiedAccuracy)
|
||||
public void ChangeAccuracy(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref int modifiedAccuracy)
|
||||
{
|
||||
if (executingMove.UseMove.Name == "thunder" || executingMove.UseMove.Name == "hurricane")
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Weather;
|
||||
|
||||
[Script(ScriptCategory.Weather, "primordial_sea")]
|
||||
public class PrimordialSea : Rain, IScriptFailMove, IScriptOnEndTurn, IScriptOnSwitchOut
|
||||
public class PrimordialSea : Rain, IScriptFailMove, IScriptOnEndTurn, IScriptOnSwitchOut, IScriptPreventWeatherChange
|
||||
{
|
||||
private HashSet<IPokemon> _placers = new();
|
||||
|
||||
@@ -19,7 +19,7 @@ public class PrimordialSea : Rain, IScriptFailMove, IScriptOnEndTurn, IScriptOnS
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void PreventWeatherChange(StringKey? weatherName, ref bool preventWeatherChange)
|
||||
public void PreventWeatherChange(StringKey? weatherName, ref bool preventWeatherChange)
|
||||
{
|
||||
if (weatherName == ScriptUtils.ResolveName<DesolateLands>() ||
|
||||
weatherName == ScriptUtils.ResolveName<StrongWinds>())
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Weather;
|
||||
|
||||
[Script(ScriptCategory.Weather, "rain")]
|
||||
public class Rain : Script, ILimitedTurnsScript, IScriptChangeBasePower, IScriptOnEndTurn
|
||||
public class Rain : Script, ILimitedTurnsScript, IScriptChangeBasePower, IScriptOnEndTurn, IScriptChangeAccuracy
|
||||
{
|
||||
private int? _duration;
|
||||
|
||||
@@ -41,8 +41,7 @@ public class Rain : Script, ILimitedTurnsScript, IScriptChangeBasePower, IScript
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeAccuracy(IExecutingMove executingMove, IPokemon target, byte hitIndex,
|
||||
ref int modifiedAccuracy)
|
||||
public void ChangeAccuracy(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref int modifiedAccuracy)
|
||||
{
|
||||
modifiedAccuracy = executingMove.UseMove.Name.ToString() switch
|
||||
{
|
||||
|
||||
@@ -16,7 +16,8 @@ public class Sandstorm : Script, IScriptChangeBasePower, IScriptChangeDefensiveS
|
||||
continue;
|
||||
}
|
||||
var bypassSandstormArgs = new CustomTriggers.BypassSandstormDamageArgs(pokemon);
|
||||
pokemon.RunScriptHook(x => x.CustomTrigger(CustomTriggers.BypassSandstormDamage, bypassSandstormArgs));
|
||||
pokemon.RunScriptHook<IScriptCustomTrigger>(x =>
|
||||
x.CustomTrigger(CustomTriggers.BypassSandstormDamage, bypassSandstormArgs));
|
||||
if (bypassSandstormArgs.Bypass)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Weather;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Strong_winds">Bulbapedia - Strong Winds</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Weather, "strong_winds")]
|
||||
public class StrongWinds : Script, IScriptOnSwitchOut
|
||||
public class StrongWinds : Script, IScriptOnSwitchOut, IScriptChangeTypesForMove, IScriptPreventWeatherChange
|
||||
{
|
||||
private HashSet<IPokemon> _placers = new();
|
||||
|
||||
@@ -24,7 +24,7 @@ public class StrongWinds : Script, IScriptOnSwitchOut
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void PreventWeatherChange(StringKey? weatherName, ref bool preventWeatherChange)
|
||||
public void PreventWeatherChange(StringKey? weatherName, ref bool preventWeatherChange)
|
||||
{
|
||||
if (weatherName == ScriptUtils.ResolveName<DesolateLands>() ||
|
||||
weatherName == ScriptUtils.ResolveName<PrimordialSea>())
|
||||
@@ -33,7 +33,7 @@ public class StrongWinds : Script, IScriptOnSwitchOut
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeTypesForMove(IExecutingMove executingMove, IPokemon target, byte hitIndex,
|
||||
public void ChangeTypesForMove(IExecutingMove executingMove, IPokemon target, byte hitIndex,
|
||||
IList<TypeIdentifier> types)
|
||||
{
|
||||
var flyingType = types.FirstOrDefault(x => x.Name == "flying");
|
||||
|
||||
Reference in New Issue
Block a user