Skip to content

Commit

Permalink
Changing checkAIPlayers to isAIPlayers
Browse files Browse the repository at this point in the history
  • Loading branch information
WCSumpton committed Sep 26, 2023
1 parent e91dd14 commit 48f0bd0
Showing 1 changed file with 19 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class RulesAttachment extends AbstractPlayerRulesAttachment {
// condition for having specific relationships
private @Nullable List<String> relationship = null;
// condition for checking ai player
private boolean checkAIPlayers = false;
private Boolean isAIPlayers = null;
// condition for being at war
private @Nullable Set<GamePlayer> atWarPlayers = null;
private int atWarCount = -1;
Expand Down Expand Up @@ -491,20 +491,20 @@ private void resetUnitPresence() {
unitPresence = null;
}

private void setCheckAIPlayers(final String s) {
checkAIPlayers = getBool(s);
private void setIsAIPlayers(final String s) {
isAIPlayers = (s == null) ? null : getBool(s);
}

private void setCheckAIPlayers(final Boolean s) {
checkAIPlayers = s;
private void setIsAIPlayers(final Boolean s) {
isAIPlayers = s;
}

public boolean getCheckAIPlayers() {
return checkAIPlayers;
public Boolean getIsAIPlayers() {
return isAIPlayers;
}

private void resetCheckAIPlayers() {
checkAIPlayers = false;
private void resetIsAIPlayers() {
isAIPlayers = null;
}

private int getAtWarCount() {
Expand Down Expand Up @@ -754,8 +754,8 @@ public boolean isSatisfied(
objectiveMet = checkDirectOwnership(listedTerritories, players);
}
// check for ai controlled player
if (objectiveMet && getCheckAIPlayers()) {
objectiveMet = checkCheckAIPlayers(players);
if (objectiveMet && getIsAIPlayers() != null) {
objectiveMet = checkIsAIPlayers(players);
}
// get attached to player
final GamePlayer playerAttachedTo = (GamePlayer) getAttachedTo();
Expand Down Expand Up @@ -1025,10 +1025,11 @@ private boolean matchTerritories(
return numberMet >= getTerritoryCount();
}

private boolean checkCheckAIPlayers(final List<GamePlayer> players) {
private boolean checkIsAIPlayers(final List<GamePlayer> players) {
boolean bcheck = true;
for (GamePlayer player : players) {
bcheck = (bcheck && player.isAi());
// need to retain true/false
bcheck = (bcheck && (getIsAIPlayers() == player.isAi()));
}
return bcheck;
}
Expand Down Expand Up @@ -1089,12 +1090,12 @@ public MutableProperty<?> getPropertyOrNull(String propertyName) {
this::setRelationship,
this::getRelationship,
this::resetRelationship);
case "checkAIPlayer":
case "isAIPlayers":
return MutableProperty.of(
this::setCheckAIPlayers,
this::setCheckAIPlayers,
this::getCheckAIPlayers,
this::resetCheckAIPlayers);
this::setIsAIPlayers,
this::setIsAIPlayers,
this::getIsAIPlayers,
this::resetIsAIPlayers);
case "atWarPlayers":
return MutableProperty.of(
this::setAtWarPlayers,
Expand Down

0 comments on commit 48f0bd0

Please sign in to comment.