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