mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 20:58:03 +00:00
- Little AI improvements for AF Pump Curse.
This commit is contained in:
@@ -284,6 +284,9 @@ public class AbilityFactory_Pump {
|
|||||||
final boolean addsKeywords = Keywords.size() > 0;
|
final boolean addsKeywords = Keywords.size() > 0;
|
||||||
|
|
||||||
if (addsKeywords) {
|
if (addsKeywords) {
|
||||||
|
if(!containsCombatRelevantKeyword(Keywords) && AllZone.getPhase().isBefore(Constant.Phase.Main2))
|
||||||
|
list.clear(); //this keyword is not combat relevenat
|
||||||
|
|
||||||
list = list.filter(new CardListFilter() {
|
list = list.filter(new CardListFilter() {
|
||||||
public boolean addCard(Card c) {
|
public boolean addCard(Card c) {
|
||||||
return !c.hasAnyKeyword(KWs); // don't add duplicate negative keywords
|
return !c.hasAnyKeyword(KWs); // don't add duplicate negative keywords
|
||||||
@@ -296,6 +299,16 @@ public class AbilityFactory_Pump {
|
|||||||
return list;
|
return list;
|
||||||
}//getCurseCreatures()
|
}//getCurseCreatures()
|
||||||
|
|
||||||
|
private boolean containsCombatRelevantKeyword(ArrayList<String> keywords) {
|
||||||
|
boolean flag = false;
|
||||||
|
for (String keyword : keywords) {
|
||||||
|
//since most keywords are combat relevant check for those that are not
|
||||||
|
if (!keyword.equals("HIDDEN This card doesn't untap during your next untap step."))
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>pumpPlayAI.</p>
|
* <p>pumpPlayAI.</p>
|
||||||
*
|
*
|
||||||
@@ -309,7 +322,6 @@ public class AbilityFactory_Pump {
|
|||||||
|
|
||||||
Cost cost = sa.getPayCosts();
|
Cost cost = sa.getPayCosts();
|
||||||
|
|
||||||
// temporarily disabled until AI is improved
|
|
||||||
if (!CostUtil.checkLifeCost(cost, hostCard, 4))
|
if (!CostUtil.checkLifeCost(cost, hostCard, 4))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -327,8 +339,7 @@ public class AbilityFactory_Pump {
|
|||||||
// Phase Restrictions
|
// Phase Restrictions
|
||||||
if (AllZone.getStack().size() == 0 && AllZone.getPhase().isBefore(Constant.Phase.Combat_Begin)) {
|
if (AllZone.getStack().size() == 0 && AllZone.getPhase().isBefore(Constant.Phase.Combat_Begin)) {
|
||||||
// Instant-speed pumps should not be cast outside of combat when the stack is empty
|
// Instant-speed pumps should not be cast outside of combat when the stack is empty
|
||||||
if (!AF.isCurse()) {
|
if (!AF.isCurse() && !AbilityFactory.isSorcerySpeed(sa)) {
|
||||||
if (!AbilityFactory.isSorcerySpeed(sa))
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (AllZone.getStack().size() > 0) {
|
} else if (AllZone.getStack().size() > 0) {
|
||||||
@@ -412,7 +423,7 @@ public class AbilityFactory_Pump {
|
|||||||
*/
|
*/
|
||||||
private boolean pumpTgtAI(SpellAbility sa, int defense, int attack, boolean mandatory) {
|
private boolean pumpTgtAI(SpellAbility sa, int defense, int attack, boolean mandatory) {
|
||||||
if (!mandatory && AllZone.getPhase().isAfter(Constant.Phase.Combat_Declare_Blockers_InstantAbility)
|
if (!mandatory && AllZone.getPhase().isAfter(Constant.Phase.Combat_Declare_Blockers_InstantAbility)
|
||||||
&& !(AF.isCurse() && defense < 0))
|
&& !(AF.isCurse() && (defense < 0 || !containsCombatRelevantKeyword(Keywords))))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Target tgt = AF.getAbTgt();
|
Target tgt = AF.getAbTgt();
|
||||||
|
|||||||
Reference in New Issue
Block a user