mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
Fix PlayEffect skipping some checks (e.g. split second on AI) (#8162)
This commit is contained in:
@@ -3007,18 +3007,10 @@ public class AbilityUtils {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
final Spell newSA = (Spell) s.copy(controller);
|
final Spell newSA = (Spell) s.copy(controller);
|
||||||
SpellAbilityRestriction res = new SpellAbilityRestriction();
|
newSA.getRestrictions().setZone(null);
|
||||||
// timing restrictions still apply
|
|
||||||
res.setPlayerTurn(s.getRestrictions().getPlayerTurn());
|
|
||||||
res.setOpponentTurn(s.getRestrictions().getOpponentTurn());
|
|
||||||
res.setPhases(s.getRestrictions().getPhases());
|
|
||||||
res.setZone(null);
|
|
||||||
newSA.setRestrictions(res);
|
|
||||||
// timing restrictions still apply
|
|
||||||
if (res.checkTimingRestrictions(tgtCard, newSA)
|
|
||||||
// still need to check the other restrictions like Aftermath
|
|
||||||
&& res.checkOtherRestrictions(tgtCard, newSA, controller)) {
|
|
||||||
newSA.setCastFromPlayEffect(true);
|
newSA.setCastFromPlayEffect(true);
|
||||||
|
// extra timing restrictions still apply
|
||||||
|
if (newSA.canPlay()) {
|
||||||
sas.add(newSA);
|
sas.add(newSA);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1713,14 +1713,7 @@ public class Player extends GameEntity implements Comparable<Player> {
|
|||||||
if (!canCastSorcery() && (landSa == null || !landSa.withFlash(land, this))) {
|
if (!canCastSorcery() && (landSa == null || !landSa.withFlash(land, this))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// CantBeCast static abilities
|
|
||||||
if (StaticAbilityCantBeCast.cantPlayLandAbility(landSa, land, this)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (land != null && !ignoreZoneAndTiming) {
|
|
||||||
final boolean mayPlay = landSa == null ? !land.mayPlay(this).isEmpty() : landSa.getMayPlay() != null;
|
final boolean mayPlay = landSa == null ? !land.mayPlay(this).isEmpty() : landSa.getMayPlay() != null;
|
||||||
if (land.getOwner() != this && !mayPlay) {
|
if (land.getOwner() != this && !mayPlay) {
|
||||||
return false;
|
return false;
|
||||||
@@ -1732,6 +1725,11 @@ public class Player extends GameEntity implements Comparable<Player> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CantBeCast static abilities
|
||||||
|
if (StaticAbilityCantBeCast.cantPlayLandAbility(landSa, land, this)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// **** Check for land play limit per turn ****
|
// **** Check for land play limit per turn ****
|
||||||
// Dev Mode
|
// Dev Mode
|
||||||
if (getMaxLandPlaysInfinite()) {
|
if (getMaxLandPlaysInfinite()) {
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public abstract class Spell extends SpellAbility implements java.io.Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CR 118.6 cost is unpayable
|
// CR 118.6 cost is unpayable
|
||||||
if (getPayCosts().hasManaCost() && getPayCosts().getCostMana().getMana().isNoCost()) {
|
if (!isCastFromPlayEffect() && getPayCosts().hasManaCost() && getPayCosts().getCostMana().getMana().isNoCost()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -353,6 +353,10 @@ public class SpellAbilityRestriction extends SpellAbilityVariables {
|
|||||||
public final boolean checkActivatorRestrictions(final Card c, final SpellAbility sa) {
|
public final boolean checkActivatorRestrictions(final Card c, final SpellAbility sa) {
|
||||||
Player activator = sa.getActivatingPlayer();
|
Player activator = sa.getActivatingPlayer();
|
||||||
|
|
||||||
|
if (sa.isCastFromPlayEffect()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (sa.isSpell()) {
|
if (sa.isSpell()) {
|
||||||
// Spells should always default to "controller" but use mayPlay check.
|
// Spells should always default to "controller" but use mayPlay check.
|
||||||
final CardPlayOption o = c.mayPlay(sa.getMayPlay());
|
final CardPlayOption o = c.mayPlay(sa.getMayPlay());
|
||||||
@@ -615,14 +619,12 @@ public class SpellAbilityRestriction extends SpellAbilityVariables {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sa.isCastFromPlayEffect()) {
|
|
||||||
if (!checkTimingRestrictions(c, sa)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!checkActivatorRestrictions(c, sa)) {
|
if (!checkActivatorRestrictions(c, sa)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!checkTimingRestrictions(c, sa)) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!checkZoneRestrictions(c, sa)) {
|
if (!checkZoneRestrictions(c, sa)) {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ Name:Zenos yae Galvus
|
|||||||
ManaCost:3 B B
|
ManaCost:3 B B
|
||||||
Types:Legendary Creature Human Noble Warrior
|
Types:Legendary Creature Human Noble Warrior
|
||||||
PT:4/4
|
PT:4/4
|
||||||
T:Mode$ ChangesZone | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigChoose | TriggerDescription$ My First Friend — When CARDNAME enters, choose a creature an opponent controls. Until end of turn, creatures other than Zenos yae Galvus and the chosen creature get -2/-2.
|
T:Mode$ ChangesZone | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigChoose | TriggerDescription$ My First Friend — When CARDNAME enters, choose a creature an opponent controls. Until end of turn, creatures other than CARDNAME and the chosen creature get -2/-2.
|
||||||
SVar:TrigChoose:DB$ ChooseCard | Choices$ Creature.OppCtrl | Mandatory$ True | SubAbility$ DBPumpAll
|
SVar:TrigChoose:DB$ ChooseCard | Choices$ Creature.OppCtrl | Mandatory$ True | SubAbility$ DBPumpAll
|
||||||
SVar:DBPumpAll:DB$ PumpAll | NumAtt$ -2 | NumDef$ -2 | ValidCards$ Creature.Other+!ChosenCardStrict | IsCurse$ True
|
SVar:DBPumpAll:DB$ PumpAll | NumAtt$ -2 | NumDef$ -2 | ValidCards$ Creature.Other+!ChosenCardStrict | IsCurse$ True
|
||||||
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Any | ValidCard$ Card.ChosenCardStrict | TriggerZones$ Battlefield | Execute$ TrigTransform | TriggerDescription$ When the chosen creature leaves the battlefield, transform CARDNAME.
|
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Any | ValidCard$ Card.ChosenCardStrict | TriggerZones$ Battlefield | Execute$ TrigTransform | TriggerDescription$ When the chosen creature leaves the battlefield, transform CARDNAME.
|
||||||
|
|||||||
Reference in New Issue
Block a user