Style cleanup

This commit is contained in:
2025-03-02 17:19:57 +01:00
parent c0bc905c46
commit 284ab3079c
175 changed files with 588 additions and 650 deletions

View File

@@ -16,7 +16,7 @@ public class BideEffect : Script
private BideEffect()
{
}
public BideEffect(IPokemon owner)
{
_owner = owner;
@@ -33,7 +33,7 @@ public class BideEffect : Script
{
DamageTaken += oldHealth - newHealth;
}
private ITurnChoice? _choice;
/// <inheritdoc />

View File

@@ -6,8 +6,7 @@ public class BindEffect : Script
private readonly IPokemon? _owner;
private int _turns;
private readonly float _percentOfMaxHealth;
public BindEffect(IPokemon owner, int turns, float percentOfMaxHealth)
{
_owner = owner;
@@ -25,7 +24,7 @@ public class BindEffect : Script
_turns--;
_owner.Damage((uint)(_owner.MaxHealth * _percentOfMaxHealth), DamageSource.Misc);
}
if (_turns <= 0)
if (_turns <= 0)
RemoveSelf();
}

View File

@@ -11,7 +11,7 @@ public class ChargeBounceEffect : Script
{
_owner = owner;
}
/// <inheritdoc />
public override void ForceTurnSelection(byte sideIndex, byte position, ref ITurnChoice? choice)
{

View File

@@ -11,7 +11,7 @@ public class ChargeFlyEffect : Script
{
_owner = owner;
}
/// <inheritdoc />
public override void ForceTurnSelection(byte sideIndex, byte position, ref ITurnChoice? choice)
{

View File

@@ -7,7 +7,7 @@ public class CounterHelperEffect : Script
{
public IPokemon? LastHitBy { get; private set; }
public uint LastDamage { get; private set; }
/// <inheritdoc />
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
{

View File

@@ -11,6 +11,7 @@ public class DigEffect : Script
{
_owner = owner;
}
/// <inheritdoc />
public override void ForceTurnSelection(byte sideIndex, byte position, ref ITurnChoice? choice)
{

View File

@@ -11,6 +11,7 @@ public class DiveEffect : Script
{
_owner = owner;
}
/// <inheritdoc />
public override void ForceTurnSelection(byte sideIndex, byte position, ref ITurnChoice? choice)
{

View File

@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
public class EmbargoEffect : Script
{
private int _turns = 5;
/// <inheritdoc />
public override void PreventHeldItemConsume(IPokemon pokemon, IItem heldItem, ref bool prevented)
{

View File

@@ -16,7 +16,7 @@ public class EncoreEffect : Script
_move = move;
_turns = turns;
}
/// <inheritdoc />
public override void ForceTurnSelection(byte sideIndex, byte position, ref ITurnChoice? choice)
{
@@ -24,9 +24,8 @@ public class EncoreEffect : Script
choice = TurnChoiceHelper.CreateMoveChoice(_owner, _move, opposingSideIndex, position);
if (choice is IMoveChoice { ChosenMove.CurrentPp: <= 0 } moveChoice)
{
choice =
moveChoice.User.BattleData?.Battle.Library.MiscLibrary.ReplacementChoice(_owner, opposingSideIndex,
position);
choice = moveChoice.User.BattleData?.Battle.Library.MiscLibrary.ReplacementChoice(_owner, opposingSideIndex,
position);
}
}

View File

@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
public class FocusPunchEffect : Script
{
public bool WasHit { get; private set; }
/// <inheritdoc />
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
{
@@ -14,7 +14,7 @@ public class FocusPunchEffect : Script
target.BattleData?.Battle.EventHook.Invoke(new DialogEvent("focus_punch_lost_focus",
new Dictionary<string, object>()
{
{ "pokemon", target }
{ "pokemon", target },
}));
}
}

View File

@@ -19,18 +19,18 @@ public class ForesightEffect : Script
typeLibrary.TryGetTypeIdentifier("fighting", out _fightingType);
typeLibrary.TryGetTypeIdentifier("ghost", out _ghostType);
}
/// <inheritdoc />
public override void PreventStatBoostChange(IPokemon target, Statistic stat, sbyte amount, bool selfInflicted, ref bool prevent)
public override void PreventStatBoostChange(IPokemon target, Statistic stat, sbyte amount, bool selfInflicted,
ref bool prevent)
{
if (stat == Statistic.Evasion)
if (stat == Statistic.Evasion)
prevent = true;
}
/// <inheritdoc />
public override void ChangeEffectiveness(IExecutingMove move, IPokemon target, byte hit, ref float effectiveness)
{
var hitData = move.GetHitData(target, hit);
if (hitData.Type == _normalType && target.Types.Contains(_fightingType))
effectiveness = _typeLibrary.GetEffectiveness(_normalType, target.Types.Where(x => x != _ghostType));

View File

@@ -4,12 +4,12 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
public class GhostCurseEffect : Script
{
private IPokemon _pokemon;
public GhostCurseEffect(IPokemon pokemon)
{
_pokemon = pokemon;
}
/// <inheritdoc />
public override void OnEndTurn(IBattle battle)
{

View File

@@ -9,7 +9,7 @@ public class HealEachEndOfTurnEffect : Script
private HealEachEndOfTurnEffect()
{
}
public HealEachEndOfTurnEffect(float healPercentage, IPokemon pokemon)
{
_healPercentage = healPercentage;
@@ -24,7 +24,7 @@ public class HealEachEndOfTurnEffect : Script
return;
if (_pokemon.BattleData?.IsOnBattlefield != true)
return;
var amount = _pokemon.BoostedStats.Hp * _healPercentage;
if (_pokemon.HasHeldItem("big_root"))
amount *= 1.3f;

View File

@@ -9,7 +9,7 @@ public class ProtectionFailureScript : Script
{
public int ProtectTurns { get; set; }
public bool UsedProtect { get; set; }
/// <inheritdoc />
public override void OnBeforeTurnStart(ITurnChoice choice)
{

View File

@@ -11,7 +11,7 @@ public class RequiresRechargeEffect : Script
{
_owner = owner;
}
/// <inheritdoc />
public override void ForceTurnSelection(byte sideIndex, byte position, ref ITurnChoice? choice)
{
@@ -25,7 +25,7 @@ public class RequiresRechargeEffect : Script
_owner.BattleData?.Battle.EventHook.Invoke(new DialogEvent("pokemon_must_recharge",
new Dictionary<string, object>()
{
{ "pokemon", _owner }
{ "pokemon", _owner },
}));
}
}