mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 13:19:18 -08:00
[GRN] Added Venerated Loxodon.
This commit is contained in:
parent
ba8b2a609a
commit
abc0d0b68f
4 changed files with 154 additions and 1 deletions
145
Mage.Sets/src/mage/cards/v/VeneratedLoxodon.java
Normal file
145
Mage.Sets/src/mage/cards/v/VeneratedLoxodon.java
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
package mage.cards.v;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.keyword.ConvokeAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class VeneratedLoxodon extends CardImpl {
|
||||
|
||||
public VeneratedLoxodon(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{W}");
|
||||
|
||||
this.subtype.add(SubType.ELEPHANT);
|
||||
this.subtype.add(SubType.CLERIC);
|
||||
this.power = new MageInt(4);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
// Convoke
|
||||
this.addAbility(new ConvokeAbility());
|
||||
|
||||
// When Venerated Loxodon enters the battlefield, put a +1/+1 counter on each creature that convoked it.
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new VeneratedLoxodonEffect(), false), new VeneratedLoxodonWatcher());
|
||||
}
|
||||
|
||||
public VeneratedLoxodon(final VeneratedLoxodon card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VeneratedLoxodon copy() {
|
||||
return new VeneratedLoxodon(this);
|
||||
}
|
||||
}
|
||||
|
||||
class VeneratedLoxodonEffect extends OneShotEffect {
|
||||
|
||||
public VeneratedLoxodonEffect() {
|
||||
super(Outcome.BoostCreature);
|
||||
this.staticText = "put a +1/+1 counter on each creature that convoked it";
|
||||
}
|
||||
|
||||
public VeneratedLoxodonEffect(final VeneratedLoxodonEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VeneratedLoxodonEffect copy() {
|
||||
return new VeneratedLoxodonEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
VeneratedLoxodonWatcher watcher = (VeneratedLoxodonWatcher) game.getState().getWatchers().get(VeneratedLoxodonWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
MageObjectReference mor = new MageObjectReference(source.getSourceId(), source.getSourceObjectZoneChangeCounter() - 1, game); // -1 because of spell on the stack
|
||||
Set<MageObjectReference> creatures = watcher.getConvokingCreatures(mor);
|
||||
if (creatures != null) {
|
||||
for (MageObjectReference creatureMOR : creatures) {
|
||||
Permanent creature = creatureMOR.getPermanent(game);
|
||||
if (creature != null) {
|
||||
creature.addCounters(CounterType.P1P1.createInstance(), source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class VeneratedLoxodonWatcher extends Watcher {
|
||||
|
||||
private final Map<MageObjectReference, Set<MageObjectReference>> convokingCreatures = new HashMap<>();
|
||||
|
||||
public VeneratedLoxodonWatcher() {
|
||||
super(VeneratedLoxodonWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public VeneratedLoxodonWatcher(final VeneratedLoxodonWatcher watcher) {
|
||||
super(watcher);
|
||||
for (Entry<MageObjectReference, Set<MageObjectReference>> entry : watcher.convokingCreatures.entrySet()) {
|
||||
Set<MageObjectReference> creatures = new HashSet<>();
|
||||
creatures.addAll(entry.getValue());
|
||||
convokingCreatures.put(entry.getKey(), creatures);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.CONVOKED) {
|
||||
Spell spell = game.getSpell(event.getSourceId());
|
||||
Permanent tappedCreature = game.getPermanentOrLKIBattlefield(event.getTargetId());
|
||||
if (spell != null && tappedCreature != null) {
|
||||
MageObjectReference convokedSpell = new MageObjectReference(spell.getSourceId(), game);
|
||||
Set<MageObjectReference> creatures;
|
||||
if (convokingCreatures.containsKey(convokedSpell)) {
|
||||
creatures = convokingCreatures.get(convokedSpell);
|
||||
} else {
|
||||
creatures = new HashSet<>();
|
||||
convokingCreatures.put(convokedSpell, creatures);
|
||||
}
|
||||
creatures.add(new MageObjectReference(tappedCreature, game));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Set<MageObjectReference> getConvokingCreatures(MageObjectReference mor) {
|
||||
return convokingCreatures.get(mor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
convokingCreatures.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public VeneratedLoxodonWatcher copy() {
|
||||
return new VeneratedLoxodonWatcher(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -163,6 +163,7 @@ public final class GuildsOfRavnica extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Truefire Captain", 209, Rarity.UNCOMMON, mage.cards.t.TruefireCaptain.class));
|
||||
cards.add(new SetCardInfo("Underrealm Lich", 211, Rarity.MYTHIC, mage.cards.u.UnderrealmLich.class));
|
||||
cards.add(new SetCardInfo("Unexplained Disappearance", 56, Rarity.COMMON, mage.cards.u.UnexplainedDisappearance.class));
|
||||
cards.add(new SetCardInfo("Venerated Loxodon", 30, Rarity.RARE, mage.cards.v.VeneratedLoxodon.class));
|
||||
cards.add(new SetCardInfo("Vivid Revival", 148, Rarity.RARE, mage.cards.v.VividRevival.class));
|
||||
cards.add(new SetCardInfo("Vraska's Stoneglare", 272, Rarity.RARE, mage.cards.v.VraskasStoneglare.class));
|
||||
cards.add(new SetCardInfo("Vraska, Golgari Queen", 213, Rarity.MYTHIC, mage.cards.v.VraskaGolgariQueen.class));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue