Merge branch 'taprefactor' into 'master'

ETBTapped refactor (+Archelos)

See merge request core-developers/forge!3403
This commit is contained in:
Michael Kamensky
2020-11-21 06:06:40 +00:00
22 changed files with 58 additions and 137 deletions

View File

@@ -538,6 +538,9 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
if (sa.hasParam("Tapped") || sa.hasParam("Ninjutsu")) {
gameCard.setTapped(true);
}
if (sa.hasParam("Untapped")) {
gameCard.setTapped(false);
}
if (sa.hasParam("Transformed")) {
if (gameCard.isDoubleFaced()) {
gameCard.changeCardState("Transform", null, sa);
@@ -651,6 +654,9 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
if (sa.hasParam("Tapped") || sa.hasParam("Ninjutsu")) {
movedCard.setTapped(true);
}
if (sa.hasParam("Untapped")) {
movedCard.setTapped(false);
}
movedCard.setTimestamp(ts);
} else {
// might set before card is moved only for nontoken
@@ -1077,8 +1083,9 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
else if (destination.equals(ZoneType.Battlefield)) {
if (sa.hasParam("Tapped")) {
c.setTapped(true);
} else if (sa.hasParam("Untapped")) {
c.setTapped(false);
}
Map<AbilityKey, Object> moveParams = Maps.newEnumMap(AbilityKey.class);
if (sa.hasAdditionalAbility("AnimateSubAbility")) {
@@ -1189,6 +1196,8 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
movedCard = game.getAction().moveTo(c.getController().getZone(destination), c, cause, moveParams);
if (sa.hasParam("Tapped")) {
movedCard.setTapped(true);
} else if (sa.hasParam("Untapped")) {
c.setTapped(false);
}
// need to do that again?

View File

@@ -442,37 +442,6 @@ public class StaticAbility extends CardTraitBase implements IIdentifiable, Clone
return false;
}
/**
* Apply ability.
*
* @param mode
* the mode
* @param card
* the card
* @return true, if successful
*/
public final boolean applyAbility(final String mode, final Card card) {
// don't apply the ability if it hasn't got the right mode
if (!getParam("Mode").equals(mode)) {
return false;
}
if (this.isSuppressed() || !this.checkConditions()) {
return false;
}
if (mode.equals("ETBTapped")) {
return StaticAbilityETBTapped.applyETBTappedAbility(this, card);
}
if (mode.equals("GainAbilitiesOf")) {
}
return false;
}
public final boolean applyAbility(final String mode, final Card card, final boolean isCombat) {
// don't apply the ability if it hasn't got the right mode
if (!getParam("Mode").equals(mode)) {

View File

@@ -1,50 +0,0 @@
/*
* Forge: Play Magic: the Gathering.
* Copyright (C) 2011 Forge Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package forge.game.staticability;
import forge.game.CardTraitBase;
import forge.game.card.Card;
/**
* The Class StaticAbility_CantBeCast.
*/
public class StaticAbilityETBTapped {
/**
* TODO Write javadoc for this method.
*
* @param stAb
* a StaticAbility
* @param card
* the card
* @return true, if successful
*/
public static boolean applyETBTappedAbility(final StaticAbility stAb, final Card card) {
final Card hostCard = stAb.getHostCard();
if (stAb.hasParam("ValidCard")) {
if (!CardTraitBase.matchesValid(card, stAb.getParam("ValidCard").split(","), hostCard)) {
return false;
}
}
return true;
}
}

View File

@@ -63,19 +63,6 @@ public class PlayerZoneBattlefield extends PlayerZone {
super.add(c, position, latestState);
if (trigger) {
// ETBTapped static abilities
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
for (final StaticAbility stAb : ca.getStaticAbilities()) {
if (stAb.applyAbility("ETBTapped", c)) {
// it enters the battlefield this way, and should
// not fire triggers
c.setTapped(true);
}
}
}
}
if (trigger) {
c.setSickness(true); // summoning sickness
c.runComesIntoPlayCommands();

View File

@@ -4,7 +4,8 @@ Types:Creature Archon
PT:2/3
K:Flying
S:Mode$ CantBeCast | ValidCard$ Card | Caster$ Player | NumLimitEachTurn$ 1 | Description$ Each player can't cast more than one spell each turn.
S:Mode$ ETBTapped | ValidCard$ Land.OppCtrl+nonBasic | Description$ Nonbasic lands your opponents control enter the battlefield tapped.
R:Event$ Moved | ValidCard$ Land.OppCtrl+nonBasic | Destination$ Battlefield | ReplaceWith$ ETBTapped | ActiveZones$ Battlefield | Description$ Nonbasic lands your opponents control enter the battlefield tapped.
SVar:ETBTapped:DB$ ChangeZone | Origin$ All | Destination$ Battlefield | Tapped$ True | Defined$ ReplacedCard
SVar:NonStackingEffect:True
AI:RemoveDeck:Random
Oracle:Flying\nEach player can't cast more than one spell each turn.\nNonbasic lands your opponents control enter the battlefield tapped.

View File

@@ -4,7 +4,7 @@ Types:Enchantment
K:ETBReplacement:Other:ChooseEvenOdd
SVar:ChooseEvenOdd:DB$ ChooseEvenOdd | Defined$ You | ListTitle$ Choose ODD or EVEN | AILogic$ CMCInHand | SpellDescription$ As CARDNAME enters the battlefield, choose odd or even. (Zero is even.)
S:Mode$ Continuous | Affected$ Creature.cmcChosenEvenOdd | AddKeyword$ Haste | Description$ Each creature with converted mana cost of the chosen value has haste.
S:Mode$ ETBTapped | ValidCard$ Creature.cmcNotChosenEvenOdd | Description$ Each creature without converted mana cost of the chosen value enters the battlefield tapped.
R:Event$ Moved | ValidCard$ Creature.cmcNotChosenEvenOdd | Destination$ Battlefield | ReplaceWith$ ETBTapped | ActiveZones$ Battlefield | Description$ Each creature without converted mana cost of the chosen value enters the battlefield tapped.
SVar:ETBTapped:DB$ ChangeZone | Origin$ All | Destination$ Battlefield | Tapped$ True | Defined$ ReplacedCard
AI:RemoveDeck:All
SVar:Picture:http://www.wizards.com/global/images/magic/general/ashlings_prerogative.jpg
Oracle:As Ashling's Prerogative enters the battlefield, choose odd or even. (Zero is even.)\nEach creature with converted mana cost of the chosen value has haste.\nEach creature without converted mana cost of the chosen value enters the battlefield tapped.

View File

@@ -1,8 +1,8 @@
Name:Authority of the Consuls
ManaCost:W
Types:Enchantment
S:Mode$ ETBTapped | ValidCard$ Creature.OppCtrl | Description$ Creatures your opponents control enter the battlefield tapped.
R:Event$ Moved | ValidCard$ Creature.OppCtrl | Destination$ Battlefield | ReplaceWith$ ETBTapped | ActiveZones$ Battlefield | Description$ Creatures your opponents control enter the battlefield tapped.
SVar:ETBTapped:DB$ ChangeZone | Origin$ All | Destination$ Battlefield | Tapped$ True | Defined$ ReplacedCard
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Creature.OppCtrl | TriggerZones$ Battlefield | Execute$ TrigGainLife | TriggerDescription$ Whenever a creature enters the battlefield under an opponent's control, you gain 1 life.
SVar:TrigGainLife:DB$GainLife | Defined$ You | LifeAmount$ 1
SVar:Picture:http://www.wizards.com/global/images/magic/general/authority_of_the_consuls.jpg
SVar:TrigGainLife:DB$GainLife | Defined$ You | LifeAmount$ 1
Oracle:Creatures your opponents control enter the battlefield tapped.\nWhenever a creature enters the battlefield under an opponent's control, you gain 1 life.

View File

@@ -2,6 +2,6 @@ Name:Blind Obedience
ManaCost:1 W
Types:Enchantment
K:Extort
S:Mode$ ETBTapped | ValidCard$ Artifact.OppCtrl,Creature.OppCtrl | Description$ Artifacts and creatures your opponents control enter the battlefield tapped.
SVar:Picture:http://www.wizards.com/global/images/magic/general/blind_obedience.jpg
R:Event$ Moved | ValidCard$ Artifact.OppCtrl,Creature.OppCtrl | Destination$ Battlefield | ReplaceWith$ ETBTapped | ActiveZones$ Battlefield | Description$ Artifacts and creatures your opponents control enter the battlefield tapped.
SVar:ETBTapped:DB$ ChangeZone | Origin$ All | Destination$ Battlefield | Tapped$ True | Defined$ ReplacedCard
Oracle:Extort (Whenever you cast a spell, you may pay {W/B}. If you do, each opponent loses 1 life and you gain that much life.)\nArtifacts and creatures your opponents control enter the battlefield tapped.

View File

@@ -1,8 +1,8 @@
Name:Due Respect
ManaCost:1 W
Types:Instant
A:SP$ Effect | Cost$ 1 W | Name$ Due Respect Effect | StaticAbilities$ STETBTapped | SubAbility$ DBDraw | AILogic$ BeginningOfOppTurn | SpellDescription$ Permanents enter the battlefield tapped this turn.
SVar:STETBTapped:Mode$ ETBTapped | EffectZone$ Command | ValidCard$ Permanent | Description$ Permanents enter the battlefield tapped this turn.
SVar:DBDraw:DB$Draw | NumCards$ 1 | SpellDescription$ Draw a card.
SVar:Picture:http://www.wizards.com/global/images/magic/general/due_respect.jpg
A:SP$ Effect | Cost$ 1 W | ReplacementEffects$ RepETB | SVars$ ETBTapped | SubAbility$ DBDraw | AILogic$ BeginningOfOppTurn | SpellDescription$ Permanents enter the battlefield tapped this turn.
SVar:RepETB:Event$ Moved | ValidCard$ Permanent | Destination$ Battlefield | ReplaceWith$ ETBTapped | Description$ Permanents enter the battlefield tapped this turn.
SVar:ETBTapped:DB$ ChangeZone | Origin$ All | Destination$ Battlefield | Tapped$ True | Defined$ ReplacedCard
SVar:DBDraw:DB$ Draw | NumCards$ 1 | SpellDescription$ Draw a card.
Oracle:Permanents enter the battlefield tapped this turn.\nDraw a card.

View File

@@ -1,7 +1,6 @@
Name:Frozen Aether
ManaCost:3 U
Types:Enchantment
S:Mode$ ETBTapped | ValidCard$ Artifact.OppCtrl,Creature.OppCtrl,Land.OppCtrl | Description$ Artifacts, creatures, and lands your opponents control enter the battlefield tapped.
SVar:NonStackingEffect:True
SVar:Picture:http://www.wizards.com/global/images/magic/general/frozen_aether.jpg
R:Event$ Moved | ValidCard$ Artifact.OppCtrl,Creature.OppCtrl,Land.OppCtrl | Destination$ Battlefield | ReplaceWith$ ETBTapped | ActiveZones$ Battlefield | Description$ Artifacts, creatures, and lands your opponents control enter the battlefield tapped.
SVar:ETBTapped:DB$ ChangeZone | Origin$ All | Destination$ Battlefield | Tapped$ True | Defined$ ReplacedCard
Oracle:Artifacts, creatures, and lands your opponents control enter the battlefield tapped.

View File

@@ -2,6 +2,6 @@ Name:Imposing Sovereign
ManaCost:1 W
Types:Creature Human Noble
PT:2/1
S:Mode$ ETBTapped | ValidCard$ Creature.OppCtrl | Description$ Creatures your opponents control enter the battlefield tapped.
SVar:Picture:http://www.wizards.com/global/images/magic/general/imposing_sovereign.jpg
R:Event$ Moved | ValidCard$ Creature.OppCtrl | Destination$ Battlefield | ReplaceWith$ ETBTapped | ActiveZones$ Battlefield | Description$ Creatures your opponents control enter the battlefield tapped.
SVar:ETBTapped:DB$ ChangeZone | Origin$ All | Destination$ Battlefield | Tapped$ True | Defined$ ReplacedCard
Oracle:Creatures your opponents control enter the battlefield tapped.

View File

@@ -3,6 +3,6 @@ ManaCost:2 W
Types:Creature Dinosaur
PT:2/3
K:Flying
S:Mode$ ETBTapped | ValidCard$ Creature.OppCtrl | Description$ Creatures your opponents control enter the battlefield tapped.
SVar:Picture:http://www.wizards.com/global/images/magic/general/kinjallis_sunwing.jpg
R:Event$ Moved | ValidCard$ Creature.OppCtrl | Destination$ Battlefield | ReplaceWith$ ETBTapped | ActiveZones$ Battlefield | Description$ Creatures your opponents control enter the battlefield tapped.
SVar:ETBTapped:DB$ ChangeZone | Origin$ All | Destination$ Battlefield | Tapped$ True | Defined$ ReplacedCard
Oracle:Flying\nCreatures your opponents control enter the battlefield tapped.

View File

@@ -1,7 +1,6 @@
Name:Kismet
ManaCost:3 W
Types:Enchantment
S:Mode$ ETBTapped | ValidCard$ Artifact.OppCtrl,Creature.OppCtrl,Land.OppCtrl | Description$ Artifacts, creatures, and lands your opponents control enter the battlefield tapped.
SVar:NonStackingEffect:True
SVar:Picture:http://www.wizards.com/global/images/magic/general/kismet.jpg
R:Event$ Moved | ValidCard$ Artifact.OppCtrl,Creature.OppCtrl,Land.OppCtrl | Destination$ Battlefield | ReplaceWith$ ETBTapped | ActiveZones$ Battlefield | Description$ Artifacts, creatures, and lands your opponents control enter the battlefield tapped.
SVar:ETBTapped:DB$ ChangeZone | Origin$ All | Destination$ Battlefield | Tapped$ True | Defined$ ReplacedCard
Oracle:Artifacts, creatures, and lands your opponents control enter the battlefield tapped.

View File

@@ -2,6 +2,6 @@ Name:Loxodon Gatekeeper
ManaCost:2 W W
Types:Creature Elephant Soldier
PT:2/3
S:Mode$ ETBTapped | ValidCard$ Artifact.OppCtrl,Creature.OppCtrl,Land.OppCtrl | Description$ Artifacts, creatures, and lands your opponents control enter the battlefield tapped.
SVar:Picture:http://www.wizards.com/global/images/magic/general/loxodon_gatekeeper.jpg
R:Event$ Moved | ValidCard$ Artifact.OppCtrl,Creature.OppCtrl,Land.OppCtrl | Destination$ Battlefield | ReplaceWith$ ETBTapped | ActiveZones$ Battlefield | Description$ Artifacts, creatures, and lands your opponents control enter the battlefield tapped.
SVar:ETBTapped:DB$ ChangeZone | Origin$ All | Destination$ Battlefield | Tapped$ True | Defined$ ReplacedCard
Oracle:Artifacts, creatures, and lands your opponents control enter the battlefield tapped.

View File

@@ -4,7 +4,7 @@ Types:Creature Beast
PT:2/2
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigDestroy | OptionalDecider$ You | TriggerDescription$ When CARDNAME enters the battlefield, you may destroy target artifact.
SVar:TrigDestroy:DB$ Destroy | ValidTgts$ Artifact | TgtPrompt$ Choose target artifact
S:Mode$ ETBTapped | ValidCard$ Artifact.OppCtrl | Description$ Artifacts your opponents control enter the battlefield tapped.
R:Event$ Moved | ValidCard$ Artifact.OppCtrl | Destination$ Battlefield | ReplaceWith$ ETBTapped | ActiveZones$ Battlefield | Description$ Artifacts your opponents control enter the battlefield tapped.
SVar:ETBTapped:DB$ ChangeZone | Origin$ All | Destination$ Battlefield | Tapped$ True | Defined$ ReplacedCard
SVar:PlayMain1:TRUE
SVar:Picture:http://www.wizards.com/global/images/magic/general/manglehorn.jpg
Oracle:When Manglehorn enters the battlefield, you may destroy target artifact.\nArtifacts your opponents control enter the battlefield tapped.

View File

@@ -4,9 +4,10 @@ Types:Sorcery
A:SP$ Sacrifice | Cost$ X R R | SacValid$ Land | Amount$ X | References$ X | RememberSacrificed$ True | SubAbility$ DBDraw | StackDescription$ SpellDescription | SpellDescription$ Sacrifice X lands. For each land sacrificed this way, draw a card. You may play X additional lands this turn. Lands you control enter the battlefield tapped this turn.
SVar:DBDraw:DB$ Draw | NumCards$ Y | References$ Y | SubAbility$ DBStoreSVar | StackDescription$ None
SVar:DBStoreSVar:DB$ StoreSVar | SVar$ XLands | Type$ CountSVar | Expression$ X | SubAbility$ DBEffect
SVar:DBEffect:DB$ Effect | StaticAbilities$ PlayMoreLand,LandETBTapped | SVars$ XLands | SubAbility$ DBCleanup
SVar:DBEffect:DB$ Effect | StaticAbilities$ PlayMoreLand | ReplacementEffects$ LandETB | SVars$ XLands,ETBTapped | SubAbility$ DBCleanup
SVar:PlayMoreLand:Mode$ Continuous | Affected$ You | AdjustLandPlays$ XLands | References$ XLands | EffectZone$ Command | Description$ You may play X additional lands this turn.
SVar:LandETBTapped:Mode$ ETBTapped | EffectZone$ Command | ValidCard$ Land.YouCtrl | Description$ Lands you control enter the battlefield tapped this turn.
SVar:LandETB:Event$ Moved | ValidCard$ Land.YouCtrl | Destination$ Battlefield | ReplaceWith$ ETBTapped | Description$ Lands you control enter the battlefield tapped this turn.
SVar:ETBTapped:DB$ ChangeZone | Origin$ All | Destination$ Battlefield | Tapped$ True | Defined$ ReplacedCard
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:X:Count$xPaid
SVar:Y:Count$RememberedSize

View File

@@ -1,8 +1,7 @@
Name:Orb of Dreams
ManaCost:3
Types:Artifact
S:Mode$ ETBTapped | ValidCard$ Permanent | Description$ Permanents enter the battlefield tapped.
SVar:NonStackingEffect:True
R:Event$ Moved | ValidCard$ Permanent | Destination$ Battlefield | ReplaceWith$ ETBTapped | ActiveZones$ Battlefield | Description$ Permanents enter the battlefield tapped.
SVar:ETBTapped:DB$ ChangeZone | Origin$ All | Destination$ Battlefield | Tapped$ True | Defined$ ReplacedCard
AI:RemoveDeck:Random
SVar:Picture:http://www.wizards.com/global/images/magic/general/orb_of_dreams.jpg
Oracle:Permanents enter the battlefield tapped.

View File

@@ -1,8 +1,7 @@
Name:Root Maze
ManaCost:G
Types:Enchantment
S:Mode$ ETBTapped | ValidCard$ Artifact,Land | Description$ Artifacts and lands enter the battlefield tapped.
SVar:NonStackingEffect:True
R:Event$ Moved | ValidCard$ Artifact,Land | Destination$ Battlefield | ReplaceWith$ ETBTapped | ActiveZones$ Battlefield | Description$ Artifacts and lands enter the battlefield tapped.
SVar:ETBTapped:DB$ ChangeZone | Origin$ All | Destination$ Battlefield | Tapped$ True | Defined$ ReplacedCard
AI:RemoveDeck:Random
SVar:Picture:http://www.wizards.com/global/images/magic/general/root_maze.jpg
Oracle:Artifacts and lands enter the battlefield tapped.

View File

@@ -3,6 +3,6 @@ ManaCost:2 W
Types:Legendary Creature Human Soldier
PT:3/2
K:First Strike
S:Mode$ ETBTapped | ValidCard$ Creature.OppCtrl,Land.nonBasic+OppCtrl | Description$ Creatures and non-basic lands your opponents control enter the battlefield tapped.
SVar:Picture:http://www.wizards.com/global/images/magic/general/thalia_heretic_cathar.jpg
Oracle:First strike\nCreatures and non-basic lands your opponents control enter the battlefield tapped.
R:Event$ Moved | ValidCard$ Creature.OppCtrl,Land.nonBasic+OppCtrl | Destination$ Battlefield | ReplaceWith$ ETBTapped | ActiveZones$ Battlefield | Description$ Creatures and non-basic lands your opponents control enter the battlefield tapped.
SVar:ETBTapped:DB$ ChangeZone | Origin$ All | Destination$ Battlefield | Tapped$ True | Defined$ ReplacedCard
Oracle:First strike\nCreatures and non-basic lands your opponents control enter the battlefield tapped.

View File

@@ -1,7 +1,6 @@
Name:Uphill Battle
ManaCost:2 R
Types:Enchantment
S:Mode$ ETBTapped | ValidCard$ Creature.OppCtrl | Description$ Creatures played by your opponents enter the battlefield tapped.
SVar:NonStackingEffect:True
SVar:Picture:http://www.wizards.com/global/images/magic/general/uphill_battle.jpg
R:Event$ Moved | ValidCard$ Creature.OppCtrl | Destination$ Battlefield | ReplaceWith$ ETBTapped | ActiveZones$ Battlefield | Description$ Creatures played by your opponents enter the battlefield tapped.
SVar:ETBTapped:DB$ ChangeZone | Origin$ All | Destination$ Battlefield | Tapped$ True | Defined$ ReplacedCard
Oracle:Creatures played by your opponents enter the battlefield tapped.

View File

@@ -3,8 +3,8 @@ ManaCost:3 R R
Types:Legendary Creature Praetor
PT:4/4
S:Mode$ Continuous | Affected$ Creature.YouCtrl | AddKeyword$ Haste | Description$ Creatures you control have haste.
S:Mode$ ETBTapped | ValidCard$ Creature.OppCtrl | Description$ Creatures your opponents control enter the battlefield tapped.
R:Event$ Moved | ValidCard$ Creature.OppCtrl | Destination$ Battlefield | ReplaceWith$ ETBTapped | ActiveZones$ Battlefield | Description$ Creatures your opponents control enter the battlefield tapped.
SVar:ETBTapped:DB$ ChangeZone | Origin$ All | Destination$ Battlefield | Tapped$ True | Defined$ ReplacedCard
SVar:PlayMain1:TRUE
SVar:BuffedBy:Creature
SVar:Picture:http://www.wizards.com/global/images/magic/general/urabrask_the_hidden.jpg
Oracle:Creatures you control have haste.\nCreatures your opponents control enter the battlefield tapped.

View File

@@ -0,0 +1,9 @@
Name:Archelos, Lagoon Mystic
ManaCost:1 B G U
Types:Legendary Creature Turtle Shaman
PT:2/4
R:Event$ Moved | ValidCard$ Permanent | Destination$ Battlefield | IsPresent$ Card.Self+tapped | ReplaceWith$ ETBTapped | ActiveZones$ Battlefield | Description$ As long as CARDNAME is tapped, other permanents enter the battlefield tapped.
SVar:ETBTapped:DB$ ChangeZone | Origin$ All | Destination$ Battlefield | Tapped$ True | Defined$ ReplacedCard
R:Event$ Moved | ValidCard$ Permanent | Destination$ Battlefield | IsPresent$ Card.Self+untapped | ReplaceWith$ ETBUntapped | ActiveZones$ Battlefield | Description$ As long as NICKNAME is untapped, other permanents enter the battlefield untapped.
SVar:ETBUntapped:DB$ ChangeZone | Origin$ All | Destination$ Battlefield | Untapped$ True | Defined$ ReplacedCard
Oracle:As long as Archelos, Lagoon Mystic is tapped, other permanents enter the battlefield tapped.\nAs long as Archelos is untapped, other permanents enter the battlefield untapped.