mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-14 01:38:13 +00:00
@@ -59,7 +59,7 @@ public class AttachAi extends SpellAbilityAi {
|
||||
|
||||
// TODO: improve this so that the AI can use a flash aura buff as a means of killing opposing creatures
|
||||
// and gaining card advantage
|
||||
if (source.hasKeyword("MayFlashSac") && !ai.couldCastSorcery(sa)) {
|
||||
if (source.hasKeyword("MayFlashSac") && !ai.canCastSorcery()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ public class PermanentAi extends SpellAbilityAi {
|
||||
protected boolean checkPhaseRestrictions(final Player ai, final SpellAbility sa, final PhaseHandler ph) {
|
||||
final Card card = sa.getHostCard();
|
||||
|
||||
if (card.hasKeyword("MayFlashSac") && !ai.couldCastSorcery(sa)) {
|
||||
if (card.hasKeyword("MayFlashSac") && !ai.canCastSorcery()) {
|
||||
// AiPlayDecision.AnotherTime
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -340,7 +340,7 @@ public class ForgeScript {
|
||||
String unescaped = k[1].replace("~", "+");
|
||||
boolean found = false;
|
||||
for (GameObject o : AbilityUtils.getDefinedObjects(source, unescaped, spellAbility)) {
|
||||
if (sa.isTargeting(o)) {
|
||||
if (sa.getRootAbility().isTargeting(o)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ public final class GameActionUtil {
|
||||
|
||||
for (CardPlayOption o : source.mayPlay(activator)) {
|
||||
// do not appear if it can be cast with SorcerySpeed
|
||||
if (o.getAbility().hasParam("MayPlayNotSorcerySpeed") && activator.couldCastSorcery(sa)) {
|
||||
if (o.getAbility().hasParam("MayPlayNotSorcerySpeed") && activator.canCastSorcery()) {
|
||||
continue;
|
||||
}
|
||||
// non basic are only allowed if PayManaCost is yes
|
||||
|
||||
@@ -305,7 +305,7 @@ public class CardProperty {
|
||||
return false;
|
||||
}
|
||||
SpellAbility sp = (SpellAbility)spellAbility;
|
||||
if (!sp.isTargeting(card)) {
|
||||
if (!sp.getRootAbility().isTargeting(card)) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.equals("TargetedPlayerCtrl")) {
|
||||
@@ -607,9 +607,12 @@ public class CardProperty {
|
||||
}
|
||||
} else if (property.startsWith("CanBeTargetedBy")) {
|
||||
final String def = property.substring(15);
|
||||
final SpellAbility targetingSA = AbilityUtils.getDefinedSpellAbilities(source, def, spellAbility).get(0);
|
||||
if (!targetingSA.canTarget(card)) {
|
||||
return false;
|
||||
SpellAbility targetingSA = AbilityUtils.getDefinedSpellAbilities(source, def, spellAbility).get(0);
|
||||
while (targetingSA != null) {
|
||||
if (targetingSA.usesTargeting() && !targetingSA.canTarget(card)) {
|
||||
return false;
|
||||
}
|
||||
targetingSA = targetingSA.getSubAbility();
|
||||
}
|
||||
} else if (property.startsWith("HauntedBy")) {
|
||||
if (!card.isHauntedBy(source)) {
|
||||
|
||||
@@ -2519,20 +2519,6 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
return now.isPlayerTurn(this) && now.getPhase().isMain() && game.getStack().isEmpty();
|
||||
}
|
||||
|
||||
//NOTE: for conditions the stack must only have the sa being checked
|
||||
public boolean couldCastSorcery(final SpellAbility sa) {
|
||||
final Card source = sa.getRootAbility().getHostCard();
|
||||
|
||||
for (final Card card : game.getCardsIn(ZoneType.Stack)) {
|
||||
if (!card.equals(source)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
PhaseHandler now = game.getPhaseHandler();
|
||||
return now.isPlayerTurn(this) && now.getPhase().isMain();
|
||||
}
|
||||
|
||||
public final PlayerController getController() {
|
||||
if (!controlledBy.isEmpty()) {
|
||||
return controlledBy.lastEntry().getValue().getValue();
|
||||
|
||||
@@ -2068,7 +2068,7 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
if (getTargets().contains(o)) {
|
||||
return true;
|
||||
}
|
||||
SpellAbility p = getParent();
|
||||
SpellAbility p = getSubAbility();
|
||||
return p != null && p.isTargeting(o);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user