mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
- Cleanup of canPlayAndPayFor function.
This commit is contained in:
@@ -97,12 +97,12 @@ public class AiController {
|
|||||||
SpellAbility counter = chooseCounterSpell(getPlayableCounters(cards));
|
SpellAbility counter = chooseCounterSpell(getPlayableCounters(cards));
|
||||||
if( counter != null ) return counter;
|
if( counter != null ) return counter;
|
||||||
|
|
||||||
SpellAbility counterETB = chooseSpellAbilities(this.getPossibleETBCounters(), false);
|
SpellAbility counterETB = chooseSpellAbilyToPlay(this.getPossibleETBCounters(), false);
|
||||||
if( counterETB != null )
|
if( counterETB != null )
|
||||||
return counterETB;
|
return counterETB;
|
||||||
}
|
}
|
||||||
|
|
||||||
return chooseSpellAbilities(getSpellAbilities(cards), true);
|
return chooseSpellAbilyToPlay(getSpellAbilities(cards), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -442,7 +442,7 @@ public class AiController {
|
|||||||
* objects.
|
* objects.
|
||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
private SpellAbility chooseSpellAbilities(final List<SpellAbility> all, boolean skipCounter) {
|
private SpellAbility chooseSpellAbilyToPlay(final List<SpellAbility> all, boolean skipCounter) {
|
||||||
if ( all == null || all.isEmpty() )
|
if ( all == null || all.isEmpty() )
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
@@ -467,14 +467,15 @@ public class AiController {
|
|||||||
|
|
||||||
// This is for playing spells regularly (no Cascade/Ripple etc.)
|
// This is for playing spells regularly (no Cascade/Ripple etc.)
|
||||||
private boolean canPlayAndPayFor(final SpellAbility sa) {
|
private boolean canPlayAndPayFor(final SpellAbility sa) {
|
||||||
boolean canPlay = sa.canPlay();
|
if (!sa.canPlay()) {
|
||||||
if (!canPlay)
|
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
//System.out.printf("Ai thinks of %s @ %s >>> ", sa, sa.getActivatingPlayer().getGame().getPhaseHandler().debugPrintState());
|
//System.out.printf("Ai thinks of %s @ %s >>> ", sa, sa.getActivatingPlayer().getGame().getPhaseHandler().debugPrintState());
|
||||||
boolean aiWouldPlay = sa.canPlayAI();
|
if (!sa.canPlayAI()) {
|
||||||
boolean canPay = ComputerUtilCost.canPayCost(sa, player);
|
return false;
|
||||||
|
}
|
||||||
//System.out.printf("wouldPlay: %s, canPay: %s%n", aiWouldPlay, canPay);
|
//System.out.printf("wouldPlay: %s, canPay: %s%n", aiWouldPlay, canPay);
|
||||||
return aiWouldPlay && canPay;
|
return ComputerUtilCost.canPayCost(sa, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
// not sure "playing biggest spell" matters?
|
// not sure "playing biggest spell" matters?
|
||||||
|
|||||||
Reference in New Issue
Block a user