mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
TriggerMilledAll (for Zellix [CLB]) (#1064)
* TriggerMilledAll.java * TriggerType.MilledAll * Player.mill run MilledAll trigger * CardZoneTable remove redundant Map
This commit is contained in:
@@ -56,7 +56,7 @@ public class CardZoneTable extends ForwardingTable<ZoneType, ZoneType, CardColle
|
|||||||
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||||
runParams.put(AbilityKey.Cards, new CardZoneTable(this));
|
runParams.put(AbilityKey.Cards, new CardZoneTable(this));
|
||||||
runParams.put(AbilityKey.Cause, cause);
|
runParams.put(AbilityKey.Cause, cause);
|
||||||
game.getTriggerHandler().runTrigger(TriggerType.ChangesZoneAll, AbilityKey.newMap(runParams), false);
|
game.getTriggerHandler().runTrigger(TriggerType.ChangesZoneAll, runParams, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1603,6 +1603,12 @@ public class Player extends GameEntity implements Comparable<Player> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MilledAll trigger
|
||||||
|
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||||
|
runParams.put(AbilityKey.Cards, milled);
|
||||||
|
runParams.put(AbilityKey.Player, this);
|
||||||
|
game.getTriggerHandler().runTrigger(TriggerType.MilledAll, runParams, false);
|
||||||
|
|
||||||
return milled;
|
return milled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,71 @@
|
|||||||
|
package forge.game.trigger;
|
||||||
|
|
||||||
|
import forge.game.ability.AbilityKey;
|
||||||
|
import forge.game.card.Card;
|
||||||
|
import forge.game.card.CardCollection;
|
||||||
|
import forge.game.card.CardLists;
|
||||||
|
import forge.game.spellability.SpellAbility;
|
||||||
|
import forge.util.Localizer;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* TriggerMilledAll class.
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
public class TriggerMilledAll extends Trigger {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Constructor for TriggerMilledAll
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param params
|
||||||
|
* a {@link java.util.HashMap} object.
|
||||||
|
* @param host
|
||||||
|
* a {@link forge.game.card.Card} object.
|
||||||
|
* @param intrinsic
|
||||||
|
* the intrinsic
|
||||||
|
*/
|
||||||
|
public TriggerMilledAll (final Map<String, String> params, final Card host, final boolean intrinsic) {
|
||||||
|
super(params, host, intrinsic);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc}
|
||||||
|
* @param runParams*/
|
||||||
|
@Override
|
||||||
|
public final boolean performTest(final Map<AbilityKey, Object> runParams) {
|
||||||
|
|
||||||
|
if (!matchesValidParam("ValidPlayer", runParams.get(AbilityKey.Player))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!matchesValidParam("ValidCard", runParams.get(AbilityKey.Cards))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@Override
|
||||||
|
public final void setTriggeringObjects(final SpellAbility sa, Map<AbilityKey, Object> runParams) {
|
||||||
|
CardCollection cards = (CardCollection) runParams.get(AbilityKey.Cards);
|
||||||
|
|
||||||
|
if (hasParam("ValidCard")) {
|
||||||
|
cards = CardLists.getValidCards(cards, getParam("ValidCard"), getHostCard().getController(),
|
||||||
|
getHostCard(), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
sa.setTriggeringObject(AbilityKey.Cards, cards);
|
||||||
|
sa.setTriggeringObjectsFrom(runParams, AbilityKey.Player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getImportantStackObjects(SpellAbility sa) {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append(Localizer.getInstance().getMessage("lblPlayer")).append(": ");
|
||||||
|
sb.append(sa.getTriggeringObject(AbilityKey.Player));
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -80,6 +80,7 @@ public enum TriggerType {
|
|||||||
LifeGained(TriggerLifeGained.class),
|
LifeGained(TriggerLifeGained.class),
|
||||||
LifeLost(TriggerLifeLost.class),
|
LifeLost(TriggerLifeLost.class),
|
||||||
LosesGame(TriggerLosesGame.class),
|
LosesGame(TriggerLosesGame.class),
|
||||||
|
MilledAll(TriggerMilledAll.class),
|
||||||
Mutates(TriggerMutates.class),
|
Mutates(TriggerMutates.class),
|
||||||
NewGame(TriggerNewGame.class),
|
NewGame(TriggerNewGame.class),
|
||||||
PayCumulativeUpkeep(TriggerPayCumulativeUpkeep.class),
|
PayCumulativeUpkeep(TriggerPayCumulativeUpkeep.class),
|
||||||
|
|||||||
Reference in New Issue
Block a user