Minor performance tweaks
This commit is contained in:
parent
7c270a6d52
commit
084ae84130
@ -25,11 +25,9 @@ public class HighestDamageAI : PokemonAI
|
||||
if (opponent == null)
|
||||
{
|
||||
var move = moves.FirstOrDefault();
|
||||
if (move != null)
|
||||
{
|
||||
return new MoveChoice(pokemon, move, opponentSide, 0);
|
||||
}
|
||||
return battle.Library.MiscLibrary.ReplacementChoice(pokemon, opponentSide, 0);
|
||||
return move != null
|
||||
? new MoveChoice(pokemon, move, opponentSide, 0)
|
||||
: battle.Library.MiscLibrary.ReplacementChoice(pokemon, opponentSide, 0);
|
||||
}
|
||||
|
||||
var movesWithDamage = moves.Select(move =>
|
||||
@ -47,12 +45,12 @@ public class HighestDamageAI : PokemonAI
|
||||
Damage = battle.Library.DamageCalculator.GetDamage(null, move.MoveData.Category, pokemon, opponent, 1,
|
||||
0, hitData),
|
||||
};
|
||||
}).OrderByDescending(x => x.Damage).ToList();
|
||||
if (movesWithDamage.Count == 0)
|
||||
}).OrderByDescending(x => x.Damage).FirstOrDefault();
|
||||
if (movesWithDamage is null)
|
||||
{
|
||||
return battle.Library.MiscLibrary.ReplacementChoice(pokemon, opponentSide, 0);
|
||||
}
|
||||
var bestMove = movesWithDamage.First().Move;
|
||||
var bestMove = movesWithDamage.Move;
|
||||
return new MoveChoice(pokemon, bestMove, opponentSide, 0);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user