This commit is contained in:
@@ -8,25 +8,7 @@ public class Conversion2 : Script, IScriptOnSecondaryEffect
|
||||
{
|
||||
var previousTurnChoices = target.BattleData?.Battle.PreviousTurnChoices;
|
||||
var nextExecutingChoice = target.BattleData?.Battle.ChoiceQueue?.Peek();
|
||||
var lastMoveByTarget = previousTurnChoices?
|
||||
// The previous turn choices include the choices of the current turn, so we need to have special handling for
|
||||
// the current turn
|
||||
.Select((x, index) =>
|
||||
{
|
||||
// All choices before the current turn are valid
|
||||
if (index < previousTurnChoices.Count - 1)
|
||||
return x;
|
||||
// If there is no next choice, we're at the end of the list, so we can just return the whole list
|
||||
if (nextExecutingChoice == null)
|
||||
return x;
|
||||
// Otherwise we determine where the next choice is and return everything before that
|
||||
var indexOfNext = x.IndexOf(nextExecutingChoice);
|
||||
if (indexOfNext == -1)
|
||||
return x;
|
||||
return x.Take(indexOfNext);
|
||||
}).SelectMany(x => x)
|
||||
// We only want the last move choice by the target
|
||||
.OfType<IMoveChoice>().FirstOrDefault(x => x.User == target);
|
||||
var lastMoveByTarget = target.BattleData?.LastMoveChoice;
|
||||
if (lastMoveByTarget == null)
|
||||
{
|
||||
move.GetHitData(target, hit).Fail();
|
||||
|
||||
Reference in New Issue
Block a user