mirror of
https://github.com/correl/mage.git
synced 2024-11-29 03:00:12 +00:00
[MOM] Implement Axgard Artisan
This commit is contained in:
parent
ac611ae6e0
commit
33ec1b7e58
4 changed files with 133 additions and 43 deletions
77
Mage.Sets/src/mage/cards/a/AxgardArtisan.java
Normal file
77
Mage.Sets/src/mage/cards/a/AxgardArtisan.java
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
package mage.cards.a;
|
||||||
|
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
|
import mage.abilities.effects.common.CreateTokenEffect;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.SubType;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import mage.counters.CounterType;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.game.permanent.token.TreasureToken;
|
||||||
|
import mage.watchers.common.BoostCountersAddedFirstTimeWatcher;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public final class AxgardArtisan extends CardImpl {
|
||||||
|
|
||||||
|
public AxgardArtisan(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}");
|
||||||
|
|
||||||
|
this.subtype.add(SubType.DWARF);
|
||||||
|
this.subtype.add(SubType.ARTIFICER);
|
||||||
|
this.power = new MageInt(2);
|
||||||
|
this.toughness = new MageInt(1);
|
||||||
|
|
||||||
|
// Whenever one or more +1/+1 counters are put on Axgard Artisan for the first time each turn, create a Treasure token.
|
||||||
|
this.addAbility(new AxgardArtisanTriggeredAbility());
|
||||||
|
}
|
||||||
|
|
||||||
|
private AxgardArtisan(final AxgardArtisan card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AxgardArtisan copy() {
|
||||||
|
return new AxgardArtisan(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class AxgardArtisanTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
|
AxgardArtisanTriggeredAbility() {
|
||||||
|
super(Zone.BATTLEFIELD, new CreateTokenEffect(new TreasureToken()));
|
||||||
|
this.setTriggerPhrase("Whenever one or more +1/+1 counters are put on {this} for the first time each turn, ");
|
||||||
|
this.addWatcher(new BoostCountersAddedFirstTimeWatcher());
|
||||||
|
}
|
||||||
|
|
||||||
|
private AxgardArtisanTriggeredAbility(final AxgardArtisanTriggeredAbility ability) {
|
||||||
|
super(ability);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AxgardArtisanTriggeredAbility copy() {
|
||||||
|
return new AxgardArtisanTriggeredAbility(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == GameEvent.EventType.COUNTERS_ADDED;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
|
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||||
|
return permanent != null
|
||||||
|
&& this.getSourceId().equals(event.getTargetId())
|
||||||
|
&& event.getData().equals(CounterType.P1P1.getName())
|
||||||
|
&& BoostCountersAddedFirstTimeWatcher.checkEvent(event, permanent, game);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,7 +1,6 @@
|
||||||
package mage.cards.b;
|
package mage.cards.b;
|
||||||
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.MageObjectReference;
|
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
import mage.abilities.common.EntersBattlefieldAbility;
|
import mage.abilities.common.EntersBattlefieldAbility;
|
||||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||||
|
@ -10,16 +9,13 @@ import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.SubType;
|
import mage.constants.SubType;
|
||||||
import mage.constants.WatcherScope;
|
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.counters.CounterType;
|
import mage.counters.CounterType;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.watchers.Watcher;
|
import mage.watchers.common.BoostCountersAddedFirstTimeWatcher;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,7 +57,7 @@ class BotanicalBrawlerTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
BotanicalBrawlerTriggeredAbility() {
|
BotanicalBrawlerTriggeredAbility() {
|
||||||
super(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance()));
|
super(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance()));
|
||||||
this.addWatcher(new BotanicalBrawlerWatcher());
|
this.addWatcher(new BoostCountersAddedFirstTimeWatcher());
|
||||||
}
|
}
|
||||||
|
|
||||||
private BotanicalBrawlerTriggeredAbility(final BotanicalBrawlerTriggeredAbility ability) {
|
private BotanicalBrawlerTriggeredAbility(final BotanicalBrawlerTriggeredAbility ability) {
|
||||||
|
@ -85,7 +81,7 @@ class BotanicalBrawlerTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
&& !getSourceId().equals(event.getTargetId())
|
&& !getSourceId().equals(event.getTargetId())
|
||||||
&& isControlledBy(permanent.getControllerId())
|
&& isControlledBy(permanent.getControllerId())
|
||||||
&& event.getData().equals(CounterType.P1P1.getName())
|
&& event.getData().equals(CounterType.P1P1.getName())
|
||||||
&& BotanicalBrawlerWatcher.checkEvent(event, permanent, game);
|
&& BoostCountersAddedFirstTimeWatcher.checkEvent(event, permanent, game);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -95,39 +91,3 @@ class BotanicalBrawlerTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
"put a +1/+1 counter on {this}.";
|
"put a +1/+1 counter on {this}.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class BotanicalBrawlerWatcher extends Watcher {
|
|
||||||
|
|
||||||
private final Map<MageObjectReference, UUID> map = new HashMap<>();
|
|
||||||
|
|
||||||
BotanicalBrawlerWatcher() {
|
|
||||||
super(WatcherScope.GAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void watch(GameEvent event, Game game) {
|
|
||||||
if (event.getType() != GameEvent.EventType.COUNTERS_ADDED) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
|
||||||
if (permanent != null && event.getData().equals(CounterType.P1P1.getName())) {
|
|
||||||
map.putIfAbsent(new MageObjectReference(permanent, game), event.getId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void reset() {
|
|
||||||
super.reset();
|
|
||||||
map.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
static boolean checkEvent(GameEvent event, Permanent permanent, Game game) {
|
|
||||||
return event
|
|
||||||
.getId()
|
|
||||||
.equals(game
|
|
||||||
.getState()
|
|
||||||
.getWatcher(BotanicalBrawlerWatcher.class)
|
|
||||||
.map
|
|
||||||
.getOrDefault(new MageObjectReference(permanent, game), null));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -44,6 +44,7 @@ public final class MarchOfTheMachine extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Attentive Skywarden", 7, Rarity.COMMON, mage.cards.a.AttentiveSkywarden.class));
|
cards.add(new SetCardInfo("Attentive Skywarden", 7, Rarity.COMMON, mage.cards.a.AttentiveSkywarden.class));
|
||||||
cards.add(new SetCardInfo("Awaken the Maelstrom", 230, Rarity.RARE, mage.cards.a.AwakenTheMaelstrom.class));
|
cards.add(new SetCardInfo("Awaken the Maelstrom", 230, Rarity.RARE, mage.cards.a.AwakenTheMaelstrom.class));
|
||||||
cards.add(new SetCardInfo("Awakened Skyclave", 194, Rarity.UNCOMMON, mage.cards.a.AwakenedSkyclave.class));
|
cards.add(new SetCardInfo("Awakened Skyclave", 194, Rarity.UNCOMMON, mage.cards.a.AwakenedSkyclave.class));
|
||||||
|
cards.add(new SetCardInfo("Axgard Artisan", 332, Rarity.UNCOMMON, mage.cards.a.AxgardArtisan.class));
|
||||||
cards.add(new SetCardInfo("Ayara, Furnace Queen", 90, Rarity.RARE, mage.cards.a.AyaraFurnaceQueen.class));
|
cards.add(new SetCardInfo("Ayara, Furnace Queen", 90, Rarity.RARE, mage.cards.a.AyaraFurnaceQueen.class));
|
||||||
cards.add(new SetCardInfo("Ayara, Widow of the Realm", 90, Rarity.RARE, mage.cards.a.AyaraWidowOfTheRealm.class));
|
cards.add(new SetCardInfo("Ayara, Widow of the Realm", 90, Rarity.RARE, mage.cards.a.AyaraWidowOfTheRealm.class));
|
||||||
cards.add(new SetCardInfo("Baral and Kari Zev", 218, Rarity.RARE, mage.cards.b.BaralAndKariZev.class));
|
cards.add(new SetCardInfo("Baral and Kari Zev", 218, Rarity.RARE, mage.cards.b.BaralAndKariZev.class));
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
package mage.watchers.common;
|
||||||
|
|
||||||
|
import mage.MageObjectReference;
|
||||||
|
import mage.constants.WatcherScope;
|
||||||
|
import mage.counters.CounterType;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.watchers.Watcher;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public class BoostCountersAddedFirstTimeWatcher extends Watcher {
|
||||||
|
|
||||||
|
private final Map<MageObjectReference, UUID> map = new HashMap<>();
|
||||||
|
|
||||||
|
public BoostCountersAddedFirstTimeWatcher() {
|
||||||
|
super(WatcherScope.GAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void watch(GameEvent event, Game game) {
|
||||||
|
if (event.getType() != GameEvent.EventType.COUNTERS_ADDED) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||||
|
if (permanent != null && event.getData().equals(CounterType.P1P1.getName())) {
|
||||||
|
map.putIfAbsent(new MageObjectReference(permanent, game), event.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reset() {
|
||||||
|
super.reset();
|
||||||
|
map.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean checkEvent(GameEvent event, Permanent permanent, Game game) {
|
||||||
|
return event
|
||||||
|
.getId()
|
||||||
|
.equals(game
|
||||||
|
.getState()
|
||||||
|
.getWatcher(BoostCountersAddedFirstTimeWatcher.class)
|
||||||
|
.map
|
||||||
|
.getOrDefault(new MageObjectReference(permanent, game), null));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue