mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
- Updated AF Pump AI.
This commit is contained in:
@@ -330,9 +330,8 @@ public class AbilityFactoryPump {
|
|||||||
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("Unblockable") || keyword.endsWith("Fear")
|
||||||
|| keyword.endsWith("Unblockable") || keyword.endsWith("Fear") || keyword.endsWith("Intimidate")
|
|| keyword.endsWith("Intimidate") || keyword.endsWith("Shadow"));
|
||||||
|| keyword.endsWith("Shadow"));
|
|
||||||
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"));
|
||||||
// give evasive keywords to creatures that can or do attack
|
// give evasive keywords to creatures that can or do attack
|
||||||
@@ -343,6 +342,37 @@ public class AbilityFactoryPump {
|
|||||||
|| (card.getNetCombatDamage() <= 0) || (AllZoneUtil.getCreaturesInPlay(human).size() < 1)) {
|
|| (card.getNetCombatDamage() <= 0) || (AllZoneUtil.getCreaturesInPlay(human).size() < 1)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
} else if (keyword.endsWith("Flying")) {
|
||||||
|
if (ph.isPlayerTurn(human)
|
||||||
|
&& ph.getPhase().equals(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY)
|
||||||
|
&& !AllZone.getCombat().getAttackerList().getKeyword("Flying").isEmpty()
|
||||||
|
&& !card.hasKeyword("Reach")
|
||||||
|
&& CombatUtil.canBlock(card)
|
||||||
|
&& CombatUtil.lifeInDanger(AllZone.getCombat())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (ph.isPlayerTurn(human) || !(CombatUtil.canAttack(card) || card.isAttacking())
|
||||||
|
|| !CombatUtil.canBeBlocked(card)
|
||||||
|
|| ph.getPhase().isAfter(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY)
|
||||||
|
|| card.getNetCombatDamage() <= 0
|
||||||
|
|| AllZoneUtil.getCreaturesInPlay(human).getNotKeyword("Flying").isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else if (keyword.endsWith("Horsemanship")) {
|
||||||
|
if (ph.isPlayerTurn(human)
|
||||||
|
&& ph.getPhase().equals(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY)
|
||||||
|
&& !AllZone.getCombat().getAttackerList().getKeyword("Horsemanship").isEmpty()
|
||||||
|
&& CombatUtil.canBlock(card)
|
||||||
|
&& CombatUtil.lifeInDanger(AllZone.getCombat())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (ph.isPlayerTurn(human) || !(CombatUtil.canAttack(card) || card.isAttacking())
|
||||||
|
|| !CombatUtil.canBeBlocked(card)
|
||||||
|
|| ph.getPhase().isAfter(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY)
|
||||||
|
|| card.getNetCombatDamage() <= 0
|
||||||
|
|| AllZoneUtil.getCreaturesInPlay(human).getNotKeyword("Horsemanship").isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} else if (keyword.endsWith("Haste")) {
|
} else if (keyword.endsWith("Haste")) {
|
||||||
if (!card.hasSickness() || ph.isPlayerTurn(human) || card.isTapped()
|
if (!card.hasSickness() || ph.isPlayerTurn(human) || card.isTapped()
|
||||||
|| card.hasKeyword("CARDNAME can attack as though it had haste.")
|
|| card.hasKeyword("CARDNAME can attack as though it had haste.")
|
||||||
@@ -423,9 +453,10 @@ public class AbilityFactoryPump {
|
|||||||
}
|
}
|
||||||
} else if (keyword.equals("Reach")) {
|
} else if (keyword.equals("Reach")) {
|
||||||
if (ph.isPlayerTurn(computer)
|
if (ph.isPlayerTurn(computer)
|
||||||
|| ph.getPhase().isAfter(PhaseType.COMBAT_DECLARE_BLOCKERS)
|
|| !ph.getPhase().equals(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY)
|
||||||
|| !AllZone.getCombat().getAttackerList().getKeyword("Flying").isEmpty()
|
|| AllZone.getCombat().getAttackerList().getKeyword("Flying").isEmpty()
|
||||||
|| !card.hasKeyword("Flying")) {
|
|| card.hasKeyword("Flying")
|
||||||
|
|| !CombatUtil.canBlock(card)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (keyword.equals("Shroud") || keyword.equals("Hexproof")) {
|
} else if (keyword.equals("Shroud") || keyword.equals("Hexproof")) {
|
||||||
@@ -484,14 +515,13 @@ public class AbilityFactoryPump {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the life of the computer is in danger, try to pump
|
// if the life of the computer is in danger, try to pump blockers blocking Tramplers
|
||||||
// potential blockers before declaring blocks
|
if (phase.getPhase().equals(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)
|
||||||
if (phase.getPhase().isAfter(PhaseType.COMBAT_DECLARE_ATTACKERS)
|
|
||||||
&& phase.getPhase().isBefore(PhaseType.COMBAT_DAMAGE)
|
|
||||||
&& phase.isPlayerTurn(AllZone.getHumanPlayer())
|
&& phase.isPlayerTurn(AllZone.getHumanPlayer())
|
||||||
&& !AllZone.getCombat().getAttackers().isEmpty()
|
&& c.isBlocking()
|
||||||
&& CombatUtil.canBlock(c, AllZone.getCombat())
|
&& defense > 0
|
||||||
&& CombatUtil.lifeInDanger(AllZone.getCombat())) {
|
&& AllZone.getCombat().getAttackerBlockedBy(c).hasKeyword("Trample")
|
||||||
|
&& (sa.isAbility() || CombatUtil.lifeInDanger(AllZone.getCombat()))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user