mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
[CLB] Implemented The Council of Four
This commit is contained in:
parent
63f07e3b55
commit
12af6ab2e5
4 changed files with 95 additions and 5 deletions
55
Mage.Sets/src/mage/cards/t/TheCouncilOfFour.java
Normal file
55
Mage.Sets/src/mage/cards/t/TheCouncilOfFour.java
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
package mage.cards.t;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.CastSecondSpellTriggeredAbility;
|
||||
import mage.abilities.common.DrawSecondCardTriggeredAbility;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.constants.TargetController;
|
||||
import mage.game.permanent.token.KnightToken;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class TheCouncilOfFour extends CardImpl {
|
||||
|
||||
public TheCouncilOfFour(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}{U}");
|
||||
|
||||
this.addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.NOBLE);
|
||||
this.power = new MageInt(0);
|
||||
this.toughness = new MageInt(8);
|
||||
|
||||
// Whenever a player draws their second card during their turn, you draw a card.
|
||||
this.addAbility(new DrawSecondCardTriggeredAbility(
|
||||
new DrawCardSourceControllerEffect(1)
|
||||
.setText("you draw a card"),
|
||||
false, TargetController.ACTIVE
|
||||
));
|
||||
|
||||
// Whenever a player casts their second spell during their own, you create a 2/2 white Knight creature token.
|
||||
this.addAbility(new CastSecondSpellTriggeredAbility(
|
||||
new CreateTokenEffect(new KnightToken())
|
||||
.setText("you create a 2/2 white Knight creature token"),
|
||||
TargetController.ACTIVE
|
||||
));
|
||||
}
|
||||
|
||||
private TheCouncilOfFour(final TheCouncilOfFour card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TheCouncilOfFour copy() {
|
||||
return new TheCouncilOfFour(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -105,6 +105,7 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Swamp", 459, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Swiftfoot Boots", 339, Rarity.UNCOMMON, mage.cards.s.SwiftfootBoots.class));
|
||||
cards.add(new SetCardInfo("Tasha, the Witch Queen", 294, Rarity.MYTHIC, mage.cards.t.TashaTheWitchQueen.class));
|
||||
cards.add(new SetCardInfo("The Council of Four", 271, Rarity.RARE, mage.cards.t.TheCouncilOfFour.class));
|
||||
cards.add(new SetCardInfo("Treasure Keeper", 341, Rarity.UNCOMMON, mage.cards.t.TreasureKeeper.class));
|
||||
cards.add(new SetCardInfo("Tymora's Invoker", 101, Rarity.COMMON, mage.cards.t.TymorasInvoker.class));
|
||||
cards.add(new SetCardInfo("Viconia, Drow Apostate", 156, Rarity.UNCOMMON, mage.cards.v.ViconiaDrowApostate.class));
|
||||
|
|
|
|||
|
|
@ -60,6 +60,10 @@ public class CastSecondSpellTriggeredAbility extends TriggeredAbilityImpl {
|
|||
return false;
|
||||
}
|
||||
break;
|
||||
case ACTIVE:
|
||||
if (!game.isActivePlayer(event.getPlayerId())) {
|
||||
return false;
|
||||
}
|
||||
case ANY:
|
||||
break;
|
||||
default:
|
||||
|
|
@ -76,6 +80,8 @@ public class CastSecondSpellTriggeredAbility extends TriggeredAbilityImpl {
|
|||
return "Whenever you cast your second spell each turn, ";
|
||||
case OPPONENT:
|
||||
return "Whenever an opponent casts their second spell each turn, ";
|
||||
case ACTIVE:
|
||||
return "Whenever a player casts their second spell during their own, ";
|
||||
case ANY:
|
||||
return "Whenever a player casts their second spell each turn, ";
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import mage.abilities.dynamicvalue.common.CardsDrawnThisTurnDynamicValue;
|
|||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.hint.Hint;
|
||||
import mage.abilities.hint.ValueHint;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
|
|
@ -21,15 +22,22 @@ public class DrawSecondCardTriggeredAbility extends TriggeredAbilityImpl {
|
|||
private static final Hint hint = new ValueHint(
|
||||
"Cards drawn this turn", CardsDrawnThisTurnDynamicValue.instance
|
||||
);
|
||||
private final TargetController targetController;
|
||||
|
||||
public DrawSecondCardTriggeredAbility(Effect effect, boolean optional) {
|
||||
this(effect, optional, TargetController.YOU);
|
||||
}
|
||||
|
||||
public DrawSecondCardTriggeredAbility(Effect effect, boolean optional, TargetController targetController) {
|
||||
super(Zone.BATTLEFIELD, effect, optional);
|
||||
this.addWatcher(new DrawSecondCardWatcher());
|
||||
this.targetController = targetController;
|
||||
this.addHint(hint);
|
||||
}
|
||||
|
||||
private DrawSecondCardTriggeredAbility(final DrawSecondCardTriggeredAbility ability) {
|
||||
super(ability);
|
||||
this.targetController = ability.targetController;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -39,13 +47,33 @@ public class DrawSecondCardTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
DrawSecondCardWatcher watcher = game.getState().getWatcher(DrawSecondCardWatcher.class);
|
||||
return watcher != null && watcher.checkEvent(getControllerId(), event);
|
||||
switch (targetController) {
|
||||
case YOU:
|
||||
if (!isControlledBy(event.getPlayerId())) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case ACTIVE:
|
||||
if (!game.isActivePlayer(event.getPlayerId())) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("TargetController " + targetController + " not supported");
|
||||
}
|
||||
return DrawSecondCardWatcher.checkEvent(event.getPlayerId(), event, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTriggerPhrase() {
|
||||
return "Whenever you draw your second card each turn, " ;
|
||||
switch (targetController) {
|
||||
case YOU:
|
||||
return "Whenever you draw your second card each turn, ";
|
||||
case ACTIVE:
|
||||
return "Whenever a player draws their second card during their turn, ";
|
||||
default:
|
||||
throw new IllegalArgumentException("TargetController " + targetController + " not supported");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -82,7 +110,7 @@ class DrawSecondCardWatcher extends Watcher {
|
|||
secondDrawMap.clear();
|
||||
}
|
||||
|
||||
boolean checkEvent(UUID playerId, GameEvent event) {
|
||||
return event.getId().equals(secondDrawMap.getOrDefault(playerId, null));
|
||||
static boolean checkEvent(UUID playerId, GameEvent event, Game game) {
|
||||
return event.getId().equals(game.getState().getWatcher(DrawSecondCardWatcher.class).secondDrawMap.getOrDefault(playerId, null));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue