mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
- Attempt to stop AI players in multiplayer games from always only attacking the human until dead. They will now gang up on an opponent with less than 8 life but otherwise attack a random opponent. Feel free to improve the ai.
This commit is contained in:
@@ -323,18 +323,18 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
* @return
|
||||
*/
|
||||
public final Player getWeakestOpponent() {
|
||||
List<Player> opponnets = this.getOpponents();
|
||||
Player weakest = opponnets.get(0);
|
||||
for (int i = 1; i < opponnets.size(); i++) {
|
||||
if (weakest.getLife() > opponnets.get(i).getLife()) {
|
||||
weakest = opponnets.get(i);
|
||||
List<Player> opponents = this.getOpponents();
|
||||
Player weakest = opponents.get(0);
|
||||
for (int i = 1; i < opponents.size(); i++) {
|
||||
if (weakest.getLife() > opponents.get(i).getLife()) {
|
||||
weakest = opponents.get(i);
|
||||
}
|
||||
}
|
||||
return weakest;
|
||||
}
|
||||
|
||||
public boolean isOpponentOf(Player other) {
|
||||
return other != this && other != null && ( other.teamNumber < 0 || other.teamNumber != this.teamNumber );
|
||||
return other != this && other != null && ( other.teamNumber < 0 || other.teamNumber != this.teamNumber );
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user