Cleans up Anticipation a bit
This commit is contained in:
parent
baae9377ef
commit
57e5e03dc3
|
@ -10,34 +10,19 @@ namespace Gen7 {
|
||||||
bool DoesOpponentHaveSuperEffectiveMove(Battle@ battle, Pokemon@ pokemon){
|
bool DoesOpponentHaveSuperEffectiveMove(Battle@ battle, Pokemon@ pokemon){
|
||||||
bool hasSuperEffectiveMove = false;
|
bool hasSuperEffectiveMove = false;
|
||||||
auto typeLib = battle.Library.StaticLibrary.TypeLibrary;
|
auto typeLib = battle.Library.StaticLibrary.TypeLibrary;
|
||||||
for (uint64 i = 0; i < battle.Sides.Length; i++){
|
for (uint64 i = 0; i < battle.Sides.Length && !hasSuperEffectiveMove; i++){
|
||||||
if (hasSuperEffectiveMove){
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
auto side = battle.Sides[i];
|
auto side = battle.Sides[i];
|
||||||
if (side is pokemon.BattleSide){
|
if (side is pokemon.BattleSide){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (uint64 j = 0; j < side.Pokemon.Length; j++){
|
for (uint64 j = 0; j < side.Pokemon.Length && !hasSuperEffectiveMove; j++){
|
||||||
if (hasSuperEffectiveMove){
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
auto opponent = side.Pokemon[j];
|
auto opponent = side.Pokemon[j];
|
||||||
if (opponent is null){
|
if (opponent is null || opponent.IsFainted){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (opponent.IsFainted){
|
for (uint64 k = 0; k < opponent.Moves.Length && !hasSuperEffectiveMove; k++){
|
||||||
continue;
|
|
||||||
}
|
|
||||||
for (uint64 k = 0; k < opponent.Moves.Length; k++){
|
|
||||||
if (hasSuperEffectiveMove){
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
auto move = opponent.Moves[k];
|
auto move = opponent.Moves[k];
|
||||||
if (move is null){
|
if (move !is null && typeLib.GetEffectiveness(move.MoveData.Type, pokemon) > 1){
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (typeLib.GetEffectiveness(move.MoveData.Type, pokemon) > 1){
|
|
||||||
hasSuperEffectiveMove = true;
|
hasSuperEffectiveMove = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue