mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
- Fixed AI not always playing Shivan Meteor from suspend.
This commit is contained in:
@@ -110,10 +110,6 @@ public abstract class SpellAbilityAi {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sa.isTrigger()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ComputerUtil.playImmediately(ai, sa)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class DamageDealAi extends DamageAiBase {
|
||||
dmg = ComputerUtilMana.determineLeftoverMana(sa, ai);
|
||||
source.setSVar("PayX", Integer.toString(dmg));
|
||||
}
|
||||
if (!this.damageTargetAI(ai, sa, dmg)) {
|
||||
if (!this.damageTargetAI(ai, sa, dmg, true)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -96,7 +96,7 @@ public class DamageDealAi extends DamageAiBase {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!this.damageTargetAI(ai, sa, dmg)) {
|
||||
if (!this.damageTargetAI(ai, sa, dmg, false)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -211,7 +211,7 @@ public class DamageDealAi extends DamageAiBase {
|
||||
* a int.
|
||||
* @return a boolean.
|
||||
*/
|
||||
private boolean damageTargetAI(final Player ai, final SpellAbility saMe, final int dmg) {
|
||||
private boolean damageTargetAI(final Player ai, final SpellAbility saMe, final int dmg, final boolean immediately) {
|
||||
final TargetRestrictions tgt = saMe.getTargetRestrictions();
|
||||
|
||||
if (tgt == null) {
|
||||
@@ -222,7 +222,7 @@ public class DamageDealAi extends DamageAiBase {
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.damageChoosingTargets(ai, saMe, tgt, dmg, false, false);
|
||||
return this.damageChoosingTargets(ai, saMe, tgt, dmg, false, immediately);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -241,7 +241,7 @@ public class DamageDealAi extends DamageAiBase {
|
||||
* @return a boolean.
|
||||
*/
|
||||
private boolean damageChoosingTargets(final Player ai, final SpellAbility sa, final TargetRestrictions tgt, int dmg,
|
||||
final boolean isTrigger, final boolean mandatory) {
|
||||
final boolean mandatory, boolean immediately) {
|
||||
final Card source = sa.getHostCard();
|
||||
final boolean noPrevention = sa.hasParam("NoPrevention");
|
||||
final Game game = source.getGame();
|
||||
@@ -268,6 +268,8 @@ public class DamageDealAi extends DamageAiBase {
|
||||
return false;
|
||||
}
|
||||
|
||||
immediately |= ComputerUtil.playImmediately(ai, sa);
|
||||
|
||||
if ("ChoiceBurn".equals(sa.getParam("AILogic"))) {
|
||||
// do not waste burns on player if other choices are present
|
||||
if (this.shouldTgtP(ai, sa, dmg, noPrevention)) {
|
||||
@@ -341,7 +343,7 @@ public class DamageDealAi extends DamageAiBase {
|
||||
final Card c = this.dealDamageChooseTgtC(ai, sa, dmg, noPrevention, enemy, false);
|
||||
if (c != null) {
|
||||
//option to hold removal instead only applies for single targeted removal
|
||||
if (sa.isSpell() && tgt.getMaxTargets(sa.getHostCard(), sa) == 1 && !divided && !isTrigger) {
|
||||
if (sa.isSpell() && !divided && !immediately && tgt.getMaxTargets(sa.getHostCard(), sa) == 1) {
|
||||
if (!ComputerUtilCard.useRemovalNow(sa, c, dmg, ZoneType.Graveyard)) {
|
||||
return false;
|
||||
}
|
||||
@@ -368,9 +370,8 @@ public class DamageDealAi extends DamageAiBase {
|
||||
// on the stack
|
||||
// or from taking combat damage
|
||||
|
||||
boolean freePing = isTrigger || sa.getPayCosts() == null
|
||||
|| sa.getTargets().getNumTargeted() > 0
|
||||
|| ComputerUtil.playImmediately(ai, sa);
|
||||
boolean freePing = immediately || sa.getPayCosts() == null
|
||||
|| sa.getTargets().getNumTargeted() > 0;
|
||||
|
||||
if (!source.isSpell()) {
|
||||
if (phase.is(PhaseType.END_OF_TURN) && sa.isAbility()) {
|
||||
@@ -397,7 +398,7 @@ public class DamageDealAi extends DamageAiBase {
|
||||
final Card c = this.dealDamageChooseTgtC(ai, sa, dmg, noPrevention, enemy, mandatory);
|
||||
if (c != null) {
|
||||
//option to hold removal instead only applies for single targeted removal
|
||||
if (!sa.isTrigger() && tgt.getMaxTargets(sa.getHostCard(), sa) == 1 && !divided) {
|
||||
if (!immediately && tgt.getMaxTargets(sa.getHostCard(), sa) == 1 && !divided) {
|
||||
if (!ComputerUtilCard.useRemovalNow(sa, c, dmg, ZoneType.Graveyard)) {
|
||||
return false;
|
||||
}
|
||||
@@ -429,7 +430,7 @@ public class DamageDealAi extends DamageAiBase {
|
||||
else if (sa.canTarget(enemy)) {
|
||||
if ((phase.is(PhaseType.END_OF_TURN) && phase.getNextTurn().equals(ai))
|
||||
|| (SpellAbilityAi.isSorcerySpeed(sa) && phase.is(PhaseType.MAIN2))
|
||||
|| sa.getPayCosts() == null || isTrigger
|
||||
|| sa.getPayCosts() == null || immediately
|
||||
|| this.shouldTgtP(ai, sa, dmg, noPrevention)) {
|
||||
sa.getTargets().add(enemy);
|
||||
if (divided) {
|
||||
@@ -589,7 +590,7 @@ public class DamageDealAi extends DamageAiBase {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!this.damageChoosingTargets(ai, sa, tgt, dmg, true, mandatory) && !mandatory) {
|
||||
if (!this.damageChoosingTargets(ai, sa, tgt, dmg, mandatory, true) && !mandatory) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,9 +14,10 @@ public class ManaEffectAi extends SpellAbilityAi {
|
||||
if (ai.getGame().getPhaseHandler().is(PhaseType.MAIN2) && ComputerUtil.activateForCost(sa, ai)) {
|
||||
return true;
|
||||
}
|
||||
if (ComputerUtil.playImmediately(ai, sa) && sa.getPayCosts() != null && sa.getPayCosts().hasNoManaCost()
|
||||
if (sa.getPayCosts() != null && sa.getPayCosts().hasNoManaCost()
|
||||
&& sa.getPayCosts().isReusuableResource()
|
||||
&& sa.getSubAbility() == null) {
|
||||
&& sa.getSubAbility() == null
|
||||
&& ComputerUtil.playImmediately(ai, sa)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user