Add ValidSA check to LandPlayed trigger

This commit is contained in:
Lyu Zong-Hong
2021-07-23 11:38:55 +09:00
parent 5d9e0f54a6
commit ebcfa5b084
4 changed files with 16 additions and 11 deletions

View File

@@ -1778,7 +1778,9 @@ public class Player extends GameEntity implements Comparable<Player> {
game.fireEvent(new GameEventLandPlayed(this, land)); game.fireEvent(new GameEventLandPlayed(this, land));
// Run triggers // Run triggers
game.getTriggerHandler().runTrigger(TriggerType.LandPlayed, AbilityKey.mapFromCard(land), false); Map<AbilityKey, Object> runParams = AbilityKey.mapFromCard(land);
runParams.put(AbilityKey.SpellAbility, cause);
game.getTriggerHandler().runTrigger(TriggerType.LandPlayed, runParams, false);
game.getStack().unfreezeStack(); game.getStack().unfreezeStack();
addLandPlayedThisTurn(); addLandPlayedThisTurn();

View File

@@ -71,7 +71,7 @@ public class LandAbility extends Ability {
@Override @Override
public void resolve() { public void resolve() {
getHostCard().setSplitStateToPlayAbility(this); getHostCard().setSplitStateToPlayAbility(this);
final Card result = getActivatingPlayer().playLandNoCheck(getHostCard(), null); final Card result = getActivatingPlayer().playLandNoCheck(getHostCard(), this);
// increase mayplay used // increase mayplay used
if (getMayPlay() != null) { if (getMayPlay() != null) {

View File

@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
@@ -28,7 +28,7 @@ import forge.util.Localizer;
* <p> * <p>
* Trigger_LandPlayed class. * Trigger_LandPlayed class.
* </p> * </p>
* *
* @author Forge * @author Forge
* @version $Id$ * @version $Id$
*/ */
@@ -38,7 +38,7 @@ public class TriggerLandPlayed extends Trigger {
* <p> * <p>
* Constructor for Trigger_LandPlayed. * Constructor for Trigger_LandPlayed.
* </p> * </p>
* *
* @param params * @param params
* a {@link java.util.HashMap} object. * a {@link java.util.HashMap} object.
* @param host * @param host
@@ -71,6 +71,10 @@ public class TriggerLandPlayed extends Trigger {
return false; return false;
} }
if (!matchesValidParam("ValidSA", runParams.get(AbilityKey.SpellAbility))) {
return false;
}
if (hasParam("NotFirstLand")) { if (hasParam("NotFirstLand")) {
Card land = (Card) runParams.get(AbilityKey.Card); Card land = (Card) runParams.get(AbilityKey.Card);
if (land.getController().getLandsPlayedThisTurn() < 1) { if (land.getController().getLandsPlayedThisTurn() < 1) {

View File

@@ -1,8 +1,7 @@
Name:Share the Spoils Name:Share the Spoils
ManaCost:1 R ManaCost:1 R
Types:Enchantment Types:Enchantment
T:Mode$ ChangesZone | ValidCard$ Card.nonLand+IsRemembered | Origin$ Exile | Destination$ Any | ExcludedDestinations$ Stack | TriggerZones$ Battlefield | Execute$ TrigForget | Static$ True T:Mode$ ChangesZone | ValidCard$ Card.IsRemembered | Origin$ Exile | Destination$ Any | TriggerZones$ Battlefield | Execute$ TrigForget | Static$ True
T:Mode$ ChangesZone | ValidCard$ Land.IsRemembered | Origin$ Exile | Destination$ Any | ExcludedDestinations$ Battlefield | TriggerZones$ Battlefield | Execute$ TrigForget | Static$ True
SVar:TrigForget:DB$ Pump | ForgetObjects$ TriggeredCard SVar:TrigForget:DB$ Pump | ForgetObjects$ TriggeredCard
T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Battlefield | Destination$ Any | Execute$ DBCleanup | Static$ True T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Battlefield | Destination$ Any | Execute$ DBCleanup | Static$ True
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
@@ -10,7 +9,7 @@ T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Any | Destination$ Battlefi
T:Mode$ LosesGame | ValidPlayer$ Player.Opponent | TriggerZones$ Battlefield | Execute$ TrigExile | Secondary$ True | TriggerDescription$ When CARDNAME enters the battlefield or an opponent loses the game, exile the top card of each player's library. T:Mode$ LosesGame | ValidPlayer$ Player.Opponent | TriggerZones$ Battlefield | Execute$ TrigExile | Secondary$ True | TriggerDescription$ When CARDNAME enters the battlefield or an opponent loses the game, exile the top card of each player's library.
SVar:TrigExile:DB$ Dig | DigNum$ 1 | ChangeNum$ All | Defined$ Player | DestinationZone$ Exile | RememberChanged$ True SVar:TrigExile:DB$ Dig | DigNum$ 1 | ChangeNum$ All | Defined$ Player | DestinationZone$ Exile | RememberChanged$ True
S:Mode$ Continuous | Affected$ Card.IsRemembered | MayPlay$ True | MayPlayLimit$ 1 | MayPlayIgnoreColor$ True | MayPlayPlayer$ ActivePlayer | EffectZone$ Battlefield | AffectedZone$ Exile | Description$ During each player's turn, that player may play a land or cast a spell from among cards exiled with CARDNAME, and they may spend mana as though it were mana of any color to cast that spell. When they do, exile the top card of their library. S:Mode$ Continuous | Affected$ Card.IsRemembered | MayPlay$ True | MayPlayLimit$ 1 | MayPlayIgnoreColor$ True | MayPlayPlayer$ ActivePlayer | EffectZone$ Battlefield | AffectedZone$ Exile | Description$ During each player's turn, that player may play a land or cast a spell from among cards exiled with CARDNAME, and they may spend mana as though it were mana of any color to cast that spell. When they do, exile the top card of their library.
T:Mode$ SpellCast | ValidCard$ Card.IsRemembered | TriggerZones$ Battlefield | Execute$ TrigExileTop | Secondary$ True | TriggerDescription$ When they do, exile the top card of their library. T:Mode$ SpellCast | ValidCard$ Card | ValidSA$ Spell.MayPlaySource | TriggerZones$ Battlefield | Execute$ TrigExileTop | Secondary$ True | TriggerDescription$ When they do, exile the top card of their library.
T:Mode$ LandPlayed | ValidCard$ Card.IsRemembered | TriggerZones$ Battlefield | Execute$ TrigExileTop | Secondary$ True | TriggerDescription$ When they do, exile the top card of their library. T:Mode$ LandPlayed | ValidCard$ Land | ValidSA$ SpellAbility.MayPlaySource | TriggerZones$ Battlefield | Execute$ TrigExileTop | Secondary$ True | TriggerDescription$ When they do, exile the top card of their library.
SVar:TrigExileTop:DB$ Dig | DigNum$ 1 | ChangeNum$ All | Defined$ TriggeredCardController | DestinationZone$ Exile | RememberChanged$ True | SubAbility$ TrigForget SVar:TrigExileTop:DB$ Dig | DigNum$ 1 | ChangeNum$ All | Defined$ TriggeredCardController | DestinationZone$ Exile | RememberChanged$ True
Oracle:When Share the Spoils enters the battlefield or an opponent loses the game, exile the top card of each player's library.\nDuring each player's turn, that player may play a land or cast a spell from among cards exiled with Share the Spoils, and they may spend mana as though it were mana of any color to cast that spell. When they do, exile the top card of their library. Oracle:When Share the Spoils enters the battlefield or an opponent loses the game, exile the top card of each player's library.\nDuring each player's turn, that player may play a land or cast a spell from among cards exiled with Share the Spoils, and they may spend mana as though it were mana of any color to cast that spell. When they do, exile the top card of their library.