mirror of
https://github.com/correl/mage.git
synced 2025-04-03 17:00:16 -09:00
[STX] Implemented Strixhaven Stadium
This commit is contained in:
parent
ae22f99b54
commit
a3bbc0b470
5 changed files with 162 additions and 53 deletions
Mage.Sets/src/mage
Mage/src/main/java/mage
|
@ -1,30 +1,31 @@
|
|||
|
||||
package mage.cards.c;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.DealsDamageToAPlayerAllTriggeredAbility;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamagedPlayerEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.filter.StaticFilters;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Xavierv3131
|
||||
*/
|
||||
public final class CoastalPiracy extends CardImpl {
|
||||
|
||||
public CoastalPiracy(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{U}{U}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}{U}");
|
||||
|
||||
// Whenever a creature you control deals combat damage to an opponent, you may draw a card.
|
||||
this.addAbility(new CoastalPiracyTriggeredAbility());
|
||||
this.addAbility(new DealsDamageToAPlayerAllTriggeredAbility(
|
||||
Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1),
|
||||
StaticFilters.FILTER_CONTROLLED_CREATURE, true, SetTargetPointer.PLAYER,
|
||||
true, true, TargetController.OPPONENT
|
||||
));
|
||||
}
|
||||
|
||||
private CoastalPiracy(final CoastalPiracy card) {
|
||||
|
@ -36,43 +37,3 @@ public final class CoastalPiracy extends CardImpl {
|
|||
return new CoastalPiracy(this);
|
||||
}
|
||||
}
|
||||
|
||||
class CoastalPiracyTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public CoastalPiracyTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1));
|
||||
this.optional = true;
|
||||
}
|
||||
|
||||
public CoastalPiracyTriggeredAbility(final CoastalPiracyTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CoastalPiracyTriggeredAbility copy() {
|
||||
return new CoastalPiracyTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.DAMAGED_PLAYER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (((DamagedPlayerEvent) event).isCombatDamage()
|
||||
&& game.getOpponents(this.controllerId).contains(event.getPlayerId())) {
|
||||
Permanent creature = game.getPermanent(event.getSourceId());
|
||||
if (creature != null && creature.isControlledBy(controllerId)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever a creature you control deals combat damage to an opponent, you may draw a card.";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
134
Mage.Sets/src/mage/cards/s/StrixhavenStadium.java
Normal file
134
Mage.Sets/src/mage/cards/s/StrixhavenStadium.java
Normal file
|
@ -0,0 +1,134 @@
|
|||
package mage.cards.s;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.DealsDamageToAPlayerAllTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.abilities.effects.common.counter.RemoveCounterSourceEffect;
|
||||
import mage.abilities.mana.ColorlessManaAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamagedPlayerEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class StrixhavenStadium extends CardImpl {
|
||||
|
||||
public StrixhavenStadium(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
|
||||
|
||||
// {T}: Add {C}. Put a point counter on Strixhaven Stadium.
|
||||
Ability ability = new ColorlessManaAbility();
|
||||
ability.addEffect(new AddCountersSourceEffect(CounterType.POINT.createInstance()));
|
||||
this.addAbility(ability);
|
||||
|
||||
// Whenever a creature deals combat damage to you, remove a point counter from Strixhaven Stadium.
|
||||
this.addAbility(new StrixhavenStadiumTriggeredAbility());
|
||||
|
||||
// Whenever a creature you control deals combat damage to an opponent, put a point counter on Strixhaven Stadium. Then if it has ten or more point counters on it, remove them all and that player loses the game.
|
||||
ability = new DealsDamageToAPlayerAllTriggeredAbility(
|
||||
Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.POINT.createInstance()),
|
||||
StaticFilters.FILTER_CONTROLLED_CREATURE, false, SetTargetPointer.PLAYER,
|
||||
true, true, TargetController.OPPONENT
|
||||
);
|
||||
ability.addEffect(new StrixhavenStadiumEffect());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
private StrixhavenStadium(final StrixhavenStadium card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StrixhavenStadium copy() {
|
||||
return new StrixhavenStadium(this);
|
||||
}
|
||||
}
|
||||
|
||||
class StrixhavenStadiumTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
StrixhavenStadiumTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new RemoveCounterSourceEffect(CounterType.POINT.createInstance()));
|
||||
}
|
||||
|
||||
private StrixhavenStadiumTriggeredAbility(final StrixhavenStadiumTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StrixhavenStadiumTriggeredAbility copy() {
|
||||
return new StrixhavenStadiumTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.DAMAGED_PLAYER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event;
|
||||
Permanent sourcePermanent = game.getPermanent(event.getSourceId());
|
||||
return isControlledBy(damageEvent.getTargetId())
|
||||
&& damageEvent.isCombatDamage()
|
||||
&& sourcePermanent != null
|
||||
&& sourcePermanent.isCreature();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever a creature deals combat damage to you, remove a point counter from {this}.";
|
||||
}
|
||||
}
|
||||
|
||||
class StrixhavenStadiumEffect extends OneShotEffect {
|
||||
|
||||
StrixhavenStadiumEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "Then if it has ten or more point counters on it, remove them all and that player loses the game";
|
||||
}
|
||||
|
||||
private StrixhavenStadiumEffect(final StrixhavenStadiumEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StrixhavenStadiumEffect copy() {
|
||||
return new StrixhavenStadiumEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
|
||||
boolean lki = false;
|
||||
if (permanent == null) {
|
||||
lki = true;
|
||||
permanent = source.getSourcePermanentOrLKI(game);
|
||||
}
|
||||
if (permanent == null || permanent.getCounters(game).getCount(CounterType.POINT) < 10) {
|
||||
return false;
|
||||
}
|
||||
if (!lki) {
|
||||
permanent.removeCounters(CounterType.POINT.createInstance(
|
||||
permanent.getCounters(game).getCount(CounterType.POINT)
|
||||
), source, game);
|
||||
}
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
if (player != null) {
|
||||
player.lost(game);
|
||||
return true;
|
||||
}
|
||||
return !lki;
|
||||
}
|
||||
}
|
|
@ -263,6 +263,7 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Stonebound Mentor", 239, Rarity.COMMON, mage.cards.s.StoneboundMentor.class));
|
||||
cards.add(new SetCardInfo("Stonerise Spirit", 32, Rarity.COMMON, mage.cards.s.StoneriseSpirit.class));
|
||||
cards.add(new SetCardInfo("Storm-Kiln Artist", 115, Rarity.UNCOMMON, mage.cards.s.StormKilnArtist.class));
|
||||
cards.add(new SetCardInfo("Strixhaven Stadium", 259, Rarity.RARE, mage.cards.s.StrixhavenStadium.class));
|
||||
cards.add(new SetCardInfo("Study Break", 34, Rarity.COMMON, mage.cards.s.StudyBreak.class));
|
||||
cards.add(new SetCardInfo("Sudden Breakthrough", 116, Rarity.COMMON, mage.cards.s.SuddenBreakthrough.class));
|
||||
cards.add(new SetCardInfo("Swamp", 370, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS));
|
||||
|
|
|
@ -4,6 +4,7 @@ package mage.abilities.common;
|
|||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.game.Game;
|
||||
|
@ -21,6 +22,7 @@ public class DealsDamageToAPlayerAllTriggeredAbility extends TriggeredAbilityImp
|
|||
private final SetTargetPointer setTargetPointer;
|
||||
private final boolean onlyCombat;
|
||||
private final boolean affectsDefendingPlayer;
|
||||
private final TargetController targetController;
|
||||
|
||||
public DealsDamageToAPlayerAllTriggeredAbility(Effect effect, FilterPermanent filter, boolean optional, SetTargetPointer setTargetPointer, boolean onlyCombat) {
|
||||
this(effect, filter, optional, setTargetPointer, onlyCombat, false);
|
||||
|
@ -31,11 +33,16 @@ public class DealsDamageToAPlayerAllTriggeredAbility extends TriggeredAbilityImp
|
|||
}
|
||||
|
||||
public DealsDamageToAPlayerAllTriggeredAbility(Zone zone, Effect effect, FilterPermanent filter, boolean optional, SetTargetPointer setTargetPointer, boolean onlyCombat, boolean affectsDefendingPlayer) {
|
||||
this(zone, effect, filter, optional, setTargetPointer, onlyCombat, affectsDefendingPlayer, TargetController.ANY);
|
||||
}
|
||||
|
||||
public DealsDamageToAPlayerAllTriggeredAbility(Zone zone, Effect effect, FilterPermanent filter, boolean optional, SetTargetPointer setTargetPointer, boolean onlyCombat, boolean affectsDefendingPlayer, TargetController targetController) {
|
||||
super(zone, effect, optional);
|
||||
this.setTargetPointer = setTargetPointer;
|
||||
this.filter = filter;
|
||||
this.onlyCombat = onlyCombat;
|
||||
this.affectsDefendingPlayer = affectsDefendingPlayer;
|
||||
this.targetController = targetController;
|
||||
}
|
||||
|
||||
public DealsDamageToAPlayerAllTriggeredAbility(final DealsDamageToAPlayerAllTriggeredAbility ability) {
|
||||
|
@ -44,6 +51,7 @@ public class DealsDamageToAPlayerAllTriggeredAbility extends TriggeredAbilityImp
|
|||
this.filter = ability.filter;
|
||||
this.onlyCombat = ability.onlyCombat;
|
||||
this.affectsDefendingPlayer = ability.affectsDefendingPlayer;
|
||||
this.targetController = ability.targetController;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -61,6 +69,10 @@ public class DealsDamageToAPlayerAllTriggeredAbility extends TriggeredAbilityImp
|
|||
if (onlyCombat && !((DamagedPlayerEvent) event).isCombatDamage()) {
|
||||
return false;
|
||||
}
|
||||
if (targetController == TargetController.OPPONENT
|
||||
&& !game.getOpponents(getControllerId()).contains(event.getTargetId())) {
|
||||
return false;
|
||||
}
|
||||
Permanent permanent = game.getPermanent(event.getSourceId());
|
||||
if (permanent == null || !filter.match(permanent, getSourceId(), getControllerId(), game)) {
|
||||
return false;
|
||||
|
@ -84,7 +96,7 @@ public class DealsDamageToAPlayerAllTriggeredAbility extends TriggeredAbilityImp
|
|||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever " + filter.getMessage() + " deals " + (onlyCombat ? "combat " : "") + "damage to a player, " + super.getRule();
|
||||
return "Whenever " + filter.getMessage() + " deals " + (onlyCombat ? "combat " : "") + "damage to "
|
||||
+ (targetController == TargetController.OPPONENT ? "an opponent" : "a player") + ", " + super.getRule();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -127,6 +127,7 @@ public enum CounterType {
|
|||
PLAGUE("plague"),
|
||||
PLOT("plot"),
|
||||
POLYP("polyp"),
|
||||
POINT("point"),
|
||||
POISON("poison"),
|
||||
PRESSURE("pressure"),
|
||||
PREY("prey"),
|
||||
|
|
Loading…
Add table
Reference in a new issue