Cleans up Anticipation a bit

This commit is contained in:
Deukhoofd 2021-11-20 14:46:58 +01:00
parent baae9377ef
commit 57e5e03dc3
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
1 changed files with 5 additions and 20 deletions

View File

@ -10,34 +10,19 @@ namespace Gen7 {
bool DoesOpponentHaveSuperEffectiveMove(Battle@ battle, Pokemon@ pokemon){
bool hasSuperEffectiveMove = false;
auto typeLib = battle.Library.StaticLibrary.TypeLibrary;
for (uint64 i = 0; i < battle.Sides.Length; i++){
if (hasSuperEffectiveMove){
break;
}
for (uint64 i = 0; i < battle.Sides.Length && !hasSuperEffectiveMove; i++){
auto side = battle.Sides[i];
if (side is pokemon.BattleSide){
continue;
}
for (uint64 j = 0; j < side.Pokemon.Length; j++){
if (hasSuperEffectiveMove){
break;
}
for (uint64 j = 0; j < side.Pokemon.Length && !hasSuperEffectiveMove; j++){
auto opponent = side.Pokemon[j];
if (opponent is null){
if (opponent is null || opponent.IsFainted){
continue;
}
if (opponent.IsFainted){
continue;
}
for (uint64 k = 0; k < opponent.Moves.Length; k++){
if (hasSuperEffectiveMove){
break;
}
for (uint64 k = 0; k < opponent.Moves.Length && !hasSuperEffectiveMove; k++){
auto move = opponent.Moves[k];
if (move is null){
continue;
}
if (typeLib.GetEffectiveness(move.MoveData.Type, pokemon) > 1){
if (move !is null && typeLib.GetEffectiveness(move.MoveData.Type, pokemon) > 1){
hasSuperEffectiveMove = true;
break;
}