mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
- More work on the AI of AF Pump.
This commit is contained in:
@@ -280,14 +280,15 @@ public class AbilityFactoryPump {
|
|||||||
final PhaseHandler ph = Singletons.getModel().getGameState().getPhaseHandler();
|
final PhaseHandler ph = Singletons.getModel().getGameState().getPhaseHandler();
|
||||||
final Player computer = AllZone.getComputerPlayer();
|
final Player computer = AllZone.getComputerPlayer();
|
||||||
final Player human = AllZone.getHumanPlayer();
|
final Player human = AllZone.getHumanPlayer();
|
||||||
|
int attack = getNumAttack(sa);
|
||||||
|
//int defense = getNumDefense(sa);
|
||||||
if (!CardUtil.isStackingKeyword(keyword) && card.hasKeyword(keyword)) {
|
if (!CardUtil.isStackingKeyword(keyword) && card.hasKeyword(keyword)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final boolean evasive = (keyword.endsWith("Flying") || keyword.endsWith("Horsemanship")
|
final boolean evasive = (keyword.endsWith("Flying") || keyword.endsWith("Horsemanship")
|
||||||
|| keyword.endsWith("Unblockable") || keyword.endsWith("Fear") || keyword.endsWith("Intimidate"));
|
|| keyword.endsWith("Unblockable") || keyword.endsWith("Fear") || keyword.endsWith("Intimidate"));
|
||||||
final boolean combatRelevant = (keyword.endsWith("First Strike")
|
final boolean combatRelevant = (keyword.endsWith("First Strike")
|
||||||
|| keyword.contains("Bushido") || keyword.endsWith("Deathtouch")
|
|| keyword.contains("Bushido") || keyword.endsWith("Deathtouch"));
|
||||||
|| keyword.contains("Trample"));
|
|
||||||
// give evasive keywords to creatures that can attack
|
// give evasive keywords to creatures that can attack
|
||||||
if (evasive) {
|
if (evasive) {
|
||||||
if (ph.isPlayerTurn(human) || !CombatUtil.canAttack(card)
|
if (ph.isPlayerTurn(human) || !CombatUtil.canAttack(card)
|
||||||
@@ -325,6 +326,13 @@ public class AbilityFactoryPump {
|
|||||||
|| AllZoneUtil.getCreaturesInPlay(human).getNotKeyword("Flanking").size() < 1) {
|
|| AllZoneUtil.getCreaturesInPlay(human).getNotKeyword("Flanking").size() < 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
} else if (keyword.startsWith("Trample")) {
|
||||||
|
if (ph.isPlayerTurn(human) || !CombatUtil.canAttack(card) || !CombatUtil.canBeBlocked(card)
|
||||||
|
|| ph.isAfter(Constant.Phase.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY)
|
||||||
|
|| (AllZoneUtil.getCreaturesInPlay(human).size() < 1)
|
||||||
|
|| card.getNetCombatDamage() + attack <= 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} else if (keyword.equals("Infect")) {
|
} else if (keyword.equals("Infect")) {
|
||||||
if (card.getNetCombatDamage() <= 0) {
|
if (card.getNetCombatDamage() <= 0) {
|
||||||
return false;
|
return false;
|
||||||
@@ -433,7 +441,7 @@ public class AbilityFactoryPump {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// is the creature blocked and the blocker would survive
|
// is the creature blocked and the blocker would survive
|
||||||
if (phase.isAfter(Constant.Phase.COMBAT_DECLARE_BLOCKERS) && (attack > 0)
|
if (phase.is(Constant.Phase.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY) && (attack > 0)
|
||||||
&& AllZone.getCombat().isAttacking(c) && AllZone.getCombat().isBlocked(c)
|
&& AllZone.getCombat().isAttacking(c) && AllZone.getCombat().isBlocked(c)
|
||||||
&& AllZone.getCombat().getBlockers(c) != null
|
&& AllZone.getCombat().getBlockers(c) != null
|
||||||
&& !AllZone.getCombat().getBlockers(c).isEmpty()
|
&& !AllZone.getCombat().getBlockers(c).isEmpty()
|
||||||
@@ -444,7 +452,7 @@ public class AbilityFactoryPump {
|
|||||||
// if the life of the computer is in danger, try to pump
|
// if the life of the computer is in danger, try to pump
|
||||||
// potential blockers before declaring blocks
|
// potential blockers before declaring blocks
|
||||||
if (phase.isAfter(Constant.Phase.COMBAT_DECLARE_ATTACKERS)
|
if (phase.isAfter(Constant.Phase.COMBAT_DECLARE_ATTACKERS)
|
||||||
&& phase.isBefore(Constant.Phase.MAIN2)
|
&& phase.isBefore(Constant.Phase.COMBAT_DAMAGE)
|
||||||
&& phase.isPlayerTurn(AllZone.getHumanPlayer())
|
&& phase.isPlayerTurn(AllZone.getHumanPlayer())
|
||||||
&& !AllZone.getCombat().getAttackers().isEmpty()
|
&& !AllZone.getCombat().getAttackers().isEmpty()
|
||||||
&& CombatUtil.canBlock(c, AllZone.getCombat())
|
&& CombatUtil.canBlock(c, AllZone.getCombat())
|
||||||
|
|||||||
Reference in New Issue
Block a user