mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
- Added a new trigger: "ChangesController".
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -11034,6 +11034,7 @@ src/main/java/forge/card/trigger/TriggerAttacks.java svneol=native#text/plain
|
||||
src/main/java/forge/card/trigger/TriggerBecomesTarget.java svneol=native#text/plain
|
||||
src/main/java/forge/card/trigger/TriggerBlocks.java svneol=native#text/plain
|
||||
src/main/java/forge/card/trigger/TriggerChampioned.java svneol=native#text/plain
|
||||
src/main/java/forge/card/trigger/TriggerChangesController.java -text
|
||||
src/main/java/forge/card/trigger/TriggerChangesZone.java svneol=native#text/plain
|
||||
src/main/java/forge/card/trigger/TriggerClashed.java svneol=native#text/plain
|
||||
src/main/java/forge/card/trigger/TriggerCounterAdded.java svneol=native#text/plain
|
||||
|
||||
@@ -363,6 +363,10 @@ public class GameAction {
|
||||
|
||||
c.setTurnInZone(tiz);
|
||||
|
||||
final HashMap<String, Object> runParams = new HashMap<String, Object>();
|
||||
runParams.put("Card", c);
|
||||
AllZone.getTriggerHandler().runTrigger("ChangesController", runParams);
|
||||
|
||||
AllZone.getTriggerHandler().clearSuppression("ChangesZone");
|
||||
((PlayerZoneComesIntoPlay) AllZone.getHumanPlayer().getZone(Zone.Battlefield)).setTriggers(true);
|
||||
((PlayerZoneComesIntoPlay) AllZone.getComputerPlayer().getZone(Zone.Battlefield)).setTriggers(true);
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* 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.card.trigger;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import forge.Card;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* TriggerChangesController class.
|
||||
* </p>
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id: TriggerChangesZone.java 12297 2011-11-28 19:56:47Z jendave $
|
||||
*/
|
||||
public class TriggerChangesController extends Trigger {
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Constructor for Trigger_ChangesZone.
|
||||
* </p>
|
||||
*
|
||||
* @param params
|
||||
* a {@link java.util.HashMap} object.
|
||||
* @param host
|
||||
* a {@link forge.Card} object.
|
||||
* @param intrinsic
|
||||
* the intrinsic
|
||||
*/
|
||||
public TriggerChangesController(final HashMap<String, String> params, final Card host, final boolean intrinsic) {
|
||||
super(params, host, intrinsic);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final boolean performTest(final java.util.Map<String, Object> runParams2) {
|
||||
final Card moved = (Card) runParams2.get("Card");
|
||||
|
||||
if (this.getMapParams().containsKey("ValidCard")) {
|
||||
if (!moved.isValid(this.getMapParams().get("ValidCard").split(","), this.getHostCard().getController(),
|
||||
this.getHostCard())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerChangesZone(this.getMapParams(), this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
copy.setName(this.getName());
|
||||
copy.setID(this.getId());
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setTriggeringObjects(final SpellAbility sa) {
|
||||
sa.setTriggeringObject("Card", this.getRunParams().get("Card"));
|
||||
}
|
||||
}
|
||||
@@ -219,6 +219,8 @@ public class TriggerHandler {
|
||||
ret = new TriggerBlocks(mapParams, host, intrinsic);
|
||||
} else if (mode.equals("Championed")) {
|
||||
ret = new TriggerChampioned(mapParams, host, intrinsic);
|
||||
} else if (mode.equals("ChangesController")) {
|
||||
ret = new TriggerChangesController(mapParams, host, intrinsic);
|
||||
} else if (mode.equals("ChangesZone")) {
|
||||
ret = new TriggerChangesZone(mapParams, host, intrinsic);
|
||||
} else if (mode.equals("Clashed")) {
|
||||
|
||||
Reference in New Issue
Block a user