mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
cleanup
This commit is contained in:
@@ -89,6 +89,7 @@ public class AiController {
|
|||||||
private boolean useSimulation;
|
private boolean useSimulation;
|
||||||
private SpellAbilityPicker simPicker;
|
private SpellAbilityPicker simPicker;
|
||||||
private int lastAttackAggression;
|
private int lastAttackAggression;
|
||||||
|
private boolean useLivingEnd;
|
||||||
|
|
||||||
public AiController(final Player computerPlayer, final Game game0) {
|
public AiController(final Player computerPlayer, final Game game0) {
|
||||||
player = computerPlayer;
|
player = computerPlayer;
|
||||||
@@ -1573,7 +1574,7 @@ public class AiController {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
//update LivingEndPlayer
|
//update LivingEndPlayer
|
||||||
player.setHasLivingEnd(CardLists.filter(player.getZone(ZoneType.Library).getCards(), c-> "Living End".equalsIgnoreCase(c.getName())).size() > 0);
|
useLivingEnd = Iterables.any(player.getZone(ZoneType.Library), CardPredicates.nameEquals("Living End"));
|
||||||
|
|
||||||
SpellAbility chosenSa = chooseSpellAbilityToPlayFromList(saList, true);
|
SpellAbility chosenSa = chooseSpellAbilityToPlayFromList(saList, true);
|
||||||
|
|
||||||
@@ -1597,7 +1598,7 @@ public class AiController {
|
|||||||
Sentry.captureMessage(ex.getMessage() + "\nAssertionError [verifyTransitivity]: " + assertex);
|
Sentry.captureMessage(ex.getMessage() + "\nAssertionError [verifyTransitivity]: " + assertex);
|
||||||
}
|
}
|
||||||
//avoid ComputerUtil.aiLifeInDanger in loops as it slows down a lot.. call this outside loops will generally be fast...
|
//avoid ComputerUtil.aiLifeInDanger in loops as it slows down a lot.. call this outside loops will generally be fast...
|
||||||
boolean isLifeInDanger = player.isLivingEnd() && ComputerUtil.aiLifeInDanger(player, true, 0);
|
boolean isLifeInDanger = useLivingEnd && ComputerUtil.aiLifeInDanger(player, true, 0);
|
||||||
for (final SpellAbility sa : ComputerUtilAbility.getOriginalAndAltCostAbilities(all, player)) {
|
for (final SpellAbility sa : ComputerUtilAbility.getOriginalAndAltCostAbilities(all, player)) {
|
||||||
// Don't add Counterspells to the "normal" playcard lookups
|
// Don't add Counterspells to the "normal" playcard lookups
|
||||||
if (skipCounter && sa.getApi() == ApiType.Counter) {
|
if (skipCounter && sa.getApi() == ApiType.Counter) {
|
||||||
@@ -1614,7 +1615,7 @@ public class AiController {
|
|||||||
}
|
}
|
||||||
//living end AI decks
|
//living end AI decks
|
||||||
AiPlayDecision aiPlayDecision = AiPlayDecision.CantPlaySa;
|
AiPlayDecision aiPlayDecision = AiPlayDecision.CantPlaySa;
|
||||||
if (player.isLivingEnd()) {
|
if (useLivingEnd) {
|
||||||
if (sa.isCycling() && sa.canCastTiming(player)) {
|
if (sa.isCycling() && sa.canCastTiming(player)) {
|
||||||
if (ComputerUtilCost.canPayCost(sa, player, sa.isTrigger()))
|
if (ComputerUtilCost.canPayCost(sa, player, sa.isTrigger()))
|
||||||
aiPlayDecision = AiPlayDecision.WillPlay;
|
aiPlayDecision = AiPlayDecision.WillPlay;
|
||||||
@@ -1640,7 +1641,7 @@ public class AiController {
|
|||||||
sa.setLastStateGraveyard(game.getLastStateGraveyard());
|
sa.setLastStateGraveyard(game.getLastStateGraveyard());
|
||||||
}
|
}
|
||||||
//override decision for living end player
|
//override decision for living end player
|
||||||
AiPlayDecision opinion = player.isLivingEnd() && AiPlayDecision.WillPlay.equals(aiPlayDecision) ? aiPlayDecision : canPlayAndPayFor(sa);
|
AiPlayDecision opinion = useLivingEnd && AiPlayDecision.WillPlay.equals(aiPlayDecision) ? aiPlayDecision : canPlayAndPayFor(sa);
|
||||||
|
|
||||||
// reset LastStateBattlefield
|
// reset LastStateBattlefield
|
||||||
sa.clearLastState();
|
sa.clearLastState();
|
||||||
|
|||||||
@@ -2146,11 +2146,10 @@ public class ComputerUtil {
|
|||||||
final int handSize = handList.size();
|
final int handSize = handList.size();
|
||||||
final int landSize = lands.size();
|
final int landSize = lands.size();
|
||||||
int score = handList.size();
|
int score = handList.size();
|
||||||
if (ai.isLivingEnd()) {
|
//adjust score for Living End decks
|
||||||
final CardCollectionView livingEnd = CardLists.filter(handList, c -> "Living End".equalsIgnoreCase(c.getName()));
|
final CardCollectionView livingEnd = CardLists.filter(handList, c -> "Living End".equalsIgnoreCase(c.getName()));
|
||||||
if (livingEnd.size() > 0)
|
if (livingEnd.size() > 0)
|
||||||
score = -(livingEnd.size() * 10);
|
score = -(livingEnd.size() * 10);
|
||||||
}
|
|
||||||
|
|
||||||
if (handSize/2 == landSize || handSize/2 == landSize +1) {
|
if (handSize/2 == landSize || handSize/2 == landSize +1) {
|
||||||
score += 10;
|
score += 10;
|
||||||
|
|||||||
@@ -168,7 +168,6 @@ public class Player extends GameEntity implements Comparable<Player> {
|
|||||||
private int maxHandSize = 7;
|
private int maxHandSize = 7;
|
||||||
private int startingHandSize = 7;
|
private int startingHandSize = 7;
|
||||||
private boolean unlimitedHandSize = false;
|
private boolean unlimitedHandSize = false;
|
||||||
private boolean hasLivingEnd = false;
|
|
||||||
private Card lastDrawnCard;
|
private Card lastDrawnCard;
|
||||||
private Card ringBearer, theRing;
|
private Card ringBearer, theRing;
|
||||||
private String namedCard = "";
|
private String namedCard = "";
|
||||||
@@ -456,13 +455,6 @@ public class Player extends GameEntity implements Comparable<Player> {
|
|||||||
return isOpponentOf(otherPlayer);
|
return isOpponentOf(otherPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLivingEnd() {
|
|
||||||
return hasLivingEnd;
|
|
||||||
}
|
|
||||||
public void setHasLivingEnd(boolean value) {
|
|
||||||
hasLivingEnd = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public final boolean setLife(final int newLife, final SpellAbility sa) {
|
public final boolean setLife(final int newLife, final SpellAbility sa) {
|
||||||
boolean change = false;
|
boolean change = false;
|
||||||
// rule 119.5
|
// rule 119.5
|
||||||
|
|||||||
Reference in New Issue
Block a user