forked from External/mage
Implemented Bellowing Elk
This commit is contained in:
parent
863112b874
commit
522ced6a5c
2 changed files with 112 additions and 0 deletions
111
Mage.Sets/src/mage/cards/b/BellowingElk.java
Normal file
111
Mage.Sets/src/mage/cards/b/BellowingElk.java
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
package mage.cards.b;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.decorator.ConditionalContinuousEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
|
||||
import mage.abilities.keyword.IndestructibleAbility;
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class BellowingElk extends CardImpl {
|
||||
|
||||
public BellowingElk(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}");
|
||||
|
||||
this.subtype.add(SubType.ELK);
|
||||
this.power = new MageInt(4);
|
||||
this.toughness = new MageInt(2);
|
||||
|
||||
// As long as you had another creature enter the battlefield under your control this turn, Bellowing Elk has trample and indestructible.
|
||||
Ability ability = new SimpleStaticAbility(new ConditionalContinuousEffect(
|
||||
new GainAbilitySourceEffect(TrampleAbility.getInstance(), Duration.WhileOnBattlefield),
|
||||
BellowingElkCondition.instance, "As long as you had another creature" +
|
||||
" enter the battlefield under your control this turn, {this} has trample"
|
||||
));
|
||||
ability.addEffect(new ConditionalContinuousEffect(
|
||||
new GainAbilitySourceEffect(IndestructibleAbility.getInstance(), Duration.WhileOnBattlefield),
|
||||
BellowingElkCondition.instance, "and indestructible"
|
||||
));
|
||||
this.addAbility(ability, new BellowingElkWatcher());
|
||||
}
|
||||
|
||||
private BellowingElk(final BellowingElk card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BellowingElk copy() {
|
||||
return new BellowingElk(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum BellowingElkCondition implements Condition {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
BellowingElkWatcher watcher = game.getState().getWatcher(BellowingElkWatcher.class);
|
||||
return watcher != null && watcher.enteredCreatureForPlayer(source.getControllerId(), source.getSourceId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "you had a creature enter the battlefield under your control this turn";
|
||||
}
|
||||
}
|
||||
|
||||
class BellowingElkWatcher extends Watcher {
|
||||
|
||||
private final Map<UUID, Set<UUID>> playerMap = new HashMap<>();
|
||||
|
||||
BellowingElkWatcher() {
|
||||
super(WatcherScope.GAME);
|
||||
}
|
||||
|
||||
private BellowingElkWatcher(final BellowingElkWatcher watcher) {
|
||||
super(watcher);
|
||||
this.playerMap.putAll(watcher.playerMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
|
||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||
if (zEvent.getToZone() == Zone.BATTLEFIELD
|
||||
&& zEvent.getTarget().isCreature()) {
|
||||
playerMap.putIfAbsent(zEvent.getTarget().getControllerId(), new HashSet<>());
|
||||
playerMap.get(zEvent.getTarget().getControllerId()).add(zEvent.getTargetId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
playerMap.clear();
|
||||
}
|
||||
|
||||
boolean enteredCreatureForPlayer(UUID playerId, UUID creatureId) {
|
||||
Set<UUID> s = playerMap.getOrDefault(playerId, null);
|
||||
return s != null && s.stream().anyMatch((UUID id) -> (id != creatureId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BellowingElkWatcher copy() {
|
||||
return new BellowingElkWatcher(this);
|
||||
}
|
||||
}
|
||||
// I'm not THAT loud...
|
||||
|
|
@ -40,6 +40,7 @@ public final class ModernHorizons extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Barren Moor", 236, Rarity.UNCOMMON, mage.cards.b.BarrenMoor.class));
|
||||
cards.add(new SetCardInfo("Battle Screech", 4, Rarity.UNCOMMON, mage.cards.b.BattleScreech.class));
|
||||
cards.add(new SetCardInfo("Bazaar Trademage", 41, Rarity.RARE, mage.cards.b.BazaarTrademage.class));
|
||||
cards.add(new SetCardInfo("Bellowing Elk", 157, Rarity.COMMON, mage.cards.b.BellowingElk.class));
|
||||
cards.add(new SetCardInfo("Birthing Boughs", 221, Rarity.UNCOMMON, mage.cards.b.BirthingBoughs.class));
|
||||
cards.add(new SetCardInfo("Bladeback Sliver", 119, Rarity.COMMON, mage.cards.b.BladebackSliver.class));
|
||||
cards.add(new SetCardInfo("Cabal Therapist", 80, Rarity.RARE, mage.cards.c.CabalTherapist.class));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue