This commit is contained in:
@@ -136,7 +136,7 @@ public interface IBattle : IScriptSource, IDeepCloneable, IDisposable
|
||||
/// <summary>
|
||||
/// Sets the current weather for the battle. If null is passed, this clears the weather.
|
||||
/// A duration can be passed to set the duration of the weather in turns. This duration can be modified by
|
||||
/// other scripts before the weather is set through the <see cref="Script.ChangeWeatherDuration"/> script hook.
|
||||
/// other scripts before the weather is set through the <see cref="IScriptChangeWeatherDuration"/> script hook.
|
||||
/// </summary>
|
||||
bool SetWeather(StringKey? weatherName, int duration, EventBatchId batchId = default);
|
||||
|
||||
@@ -369,18 +369,18 @@ public class BattleImpl : ScriptSource, IBattle
|
||||
|
||||
return true;
|
||||
|
||||
bool IsValidForForcedTurn(ITurnChoice forcedChoice, ITurnChoice choiceToCheck)
|
||||
bool IsValidForForcedTurn(ITurnChoice forcedChoiceInner, ITurnChoice choiceToCheck)
|
||||
{
|
||||
// If the forced choice is a move choice, we can only use it if the move is the same
|
||||
if (forcedChoice is IMoveChoice forcedMove && choiceToCheck is IMoveChoice moveChoice)
|
||||
if (forcedChoiceInner is IMoveChoice forcedMove && choiceToCheck is IMoveChoice moveChoiceInner)
|
||||
{
|
||||
return forcedMove.ChosenMove.MoveData.Name == moveChoice.ChosenMove.MoveData.Name;
|
||||
return forcedMove.ChosenMove.MoveData.Name == moveChoiceInner.ChosenMove.MoveData.Name;
|
||||
}
|
||||
if (forcedChoice is IPassChoice && choiceToCheck is IPassChoice)
|
||||
if (forcedChoiceInner is IPassChoice && choiceToCheck is IPassChoice)
|
||||
{
|
||||
return true; // Both are pass choices, so they are valid
|
||||
}
|
||||
return forcedChoice.Equals(choiceToCheck);
|
||||
return forcedChoiceInner.Equals(choiceToCheck);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ public class BattleChoiceQueue : IDeepCloneable
|
||||
/// <inheritdoc cref="BattleChoiceQueue"/>
|
||||
public BattleChoiceQueue(ITurnChoice[] choices)
|
||||
{
|
||||
Array.Sort(choices, TurnChoiceComparer.Instance!);
|
||||
Array.Sort(choices, TurnChoiceComparer.Instance);
|
||||
_choices = choices;
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ public class BattleChoiceQueue : IDeepCloneable
|
||||
/// </summary>
|
||||
public void Remove(ITurnChoice choice)
|
||||
{
|
||||
var index = Array.FindIndex(_choices, _currentIndex, x => x == choice);
|
||||
var index = Array.FindIndex(_choices, _currentIndex, x => Equals(x, choice));
|
||||
if (index == -1)
|
||||
return;
|
||||
_choices[index] = null;
|
||||
|
||||
@@ -47,5 +47,6 @@ public class FleeTurnChoice : TurnChoice, IFleeChoice
|
||||
|
||||
/// <inheritdoc />
|
||||
public override int GetHashCode() =>
|
||||
// ReSharper disable once ConditionalAccessQualifierIsNonNullableAccordingToAPIContract
|
||||
User?.GetHashCode() ?? 0;
|
||||
}
|
||||
@@ -51,5 +51,6 @@ public class PassChoice : TurnChoice, IPassChoice
|
||||
|
||||
/// <inheritdoc />
|
||||
public override int GetHashCode() =>
|
||||
// ReSharper disable once ConditionalAccessQualifierIsNonNullableAccordingToAPIContract
|
||||
User?.GetHashCode() ?? 0;
|
||||
}
|
||||
@@ -60,5 +60,6 @@ public class SwitchChoice : TurnChoice, ISwitchChoice
|
||||
|
||||
/// <inheritdoc />
|
||||
public override int GetHashCode() =>
|
||||
// ReSharper disable twice ConditionalAccessQualifierIsNonNullableAccordingToAPIContract
|
||||
User?.GetHashCode() ?? 0 ^ SwitchTo?.GetHashCode() ?? 0;
|
||||
}
|
||||
Reference in New Issue
Block a user