mirror of
https://github.com/correl/mage.git
synced 2024-11-24 19:19:56 +00:00
[LTR] Implement Gimli, Mournful Avenger
This commit is contained in:
parent
38b7f9e5f5
commit
01e0780f85
3 changed files with 151 additions and 1 deletions
149
Mage.Sets/src/mage/cards/g/GimliMournfulAvenger.java
Normal file
149
Mage.Sets/src/mage/cards/g/GimliMournfulAvenger.java
Normal file
|
@ -0,0 +1,149 @@
|
||||||
|
package mage.cards.g;
|
||||||
|
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.common.DiesCreatureTriggeredAbility;
|
||||||
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
import mage.abilities.common.delayed.ReflexiveTriggeredAbility;
|
||||||
|
import mage.abilities.condition.Condition;
|
||||||
|
import mage.abilities.decorator.ConditionalContinuousEffect;
|
||||||
|
import mage.abilities.dynamicvalue.DynamicValue;
|
||||||
|
import mage.abilities.effects.Effect;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.abilities.effects.common.FightTargetSourceEffect;
|
||||||
|
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
|
||||||
|
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||||
|
import mage.abilities.hint.Hint;
|
||||||
|
import mage.abilities.hint.ValueHint;
|
||||||
|
import mage.abilities.keyword.IndestructibleAbility;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.*;
|
||||||
|
import mage.counters.CounterType;
|
||||||
|
import mage.filter.FilterPermanent;
|
||||||
|
import mage.filter.StaticFilters;
|
||||||
|
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||||
|
import mage.filter.predicate.mageobject.AnotherPredicate;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.target.TargetPermanent;
|
||||||
|
import mage.watchers.common.AbilityResolvedWatcher;
|
||||||
|
import mage.watchers.common.CreaturesDiedWatcher;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public final class GimliMournfulAvenger extends CardImpl {
|
||||||
|
|
||||||
|
private static final FilterPermanent filter = new FilterControlledCreaturePermanent("another creature you control");
|
||||||
|
|
||||||
|
static {
|
||||||
|
filter.add(AnotherPredicate.instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Hint hint = new ValueHint(
|
||||||
|
"Creatures that died under your control this turn", GimliMournfulAvengerValue.instance
|
||||||
|
);
|
||||||
|
|
||||||
|
public GimliMournfulAvenger(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}{G}");
|
||||||
|
|
||||||
|
this.supertype.add(SuperType.LEGENDARY);
|
||||||
|
this.subtype.add(SubType.DWARF);
|
||||||
|
this.subtype.add(SubType.WARRIOR);
|
||||||
|
this.power = new MageInt(3);
|
||||||
|
this.toughness = new MageInt(2);
|
||||||
|
|
||||||
|
// Gimli, Mournful Avenger has indestructible as long as two or more creatures died under your control this turn.
|
||||||
|
this.addAbility(new SimpleStaticAbility(new ConditionalContinuousEffect(
|
||||||
|
new GainAbilitySourceEffect(IndestructibleAbility.getInstance(), Duration.WhileOnBattlefield),
|
||||||
|
GimliMournfulAvengerCondition.instance, "{this} has indestructible as long as " +
|
||||||
|
"two or more creatures died under your control this turn"
|
||||||
|
)).addHint(hint));
|
||||||
|
|
||||||
|
// Whenever another creature you control dies, put a +1/+1 counter on Gimli. When this ability resolves for the third time this turn, Gimli fights up to one target creature you don't control.
|
||||||
|
Ability ability = new DiesCreatureTriggeredAbility(
|
||||||
|
new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false, filter
|
||||||
|
);
|
||||||
|
ability.addEffect(new GimliMournfulAvengerEffect());
|
||||||
|
this.addAbility(ability);
|
||||||
|
}
|
||||||
|
|
||||||
|
private GimliMournfulAvenger(final GimliMournfulAvenger card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GimliMournfulAvenger copy() {
|
||||||
|
return new GimliMournfulAvenger(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum GimliMournfulAvengerCondition implements Condition {
|
||||||
|
instance;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
return game
|
||||||
|
.getState()
|
||||||
|
.getWatcher(CreaturesDiedWatcher.class)
|
||||||
|
.getAmountOfCreaturesDiedThisTurnByOwner(source.getControllerId()) >= 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum GimliMournfulAvengerValue implements DynamicValue {
|
||||||
|
instance;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||||
|
return game
|
||||||
|
.getState()
|
||||||
|
.getWatcher(CreaturesDiedWatcher.class)
|
||||||
|
.getAmountOfCreaturesDiedThisTurnByOwner(sourceAbility.getControllerId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GimliMournfulAvengerValue copy() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMessage() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "1";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class GimliMournfulAvengerEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
GimliMournfulAvengerEffect() {
|
||||||
|
super(Outcome.Benefit);
|
||||||
|
staticText = "when this ability resolves for the third time this turn, " +
|
||||||
|
"{this} fights up to one target creature you don't control.";
|
||||||
|
}
|
||||||
|
|
||||||
|
private GimliMournfulAvengerEffect(final GimliMournfulAvengerEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GimliMournfulAvengerEffect copy() {
|
||||||
|
return new GimliMournfulAvengerEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
if (AbilityResolvedWatcher.getResolutionCount(game, source) != 3) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility(new FightTargetSourceEffect(), false);
|
||||||
|
ability.addTarget(new TargetPermanent(0, 1, StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL));
|
||||||
|
game.fireReflexiveTriggeredAbility(ability, source);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -94,6 +94,7 @@ public final class TheLordOfTheRingsTalesOfMiddleEarth extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Gift of Strands", 170, Rarity.UNCOMMON, mage.cards.g.GiftOfStrands.class));
|
cards.add(new SetCardInfo("Gift of Strands", 170, Rarity.UNCOMMON, mage.cards.g.GiftOfStrands.class));
|
||||||
cards.add(new SetCardInfo("Gimli's Axe", 130, Rarity.COMMON, mage.cards.g.GimlisAxe.class));
|
cards.add(new SetCardInfo("Gimli's Axe", 130, Rarity.COMMON, mage.cards.g.GimlisAxe.class));
|
||||||
cards.add(new SetCardInfo("Gimli's Fury", 131, Rarity.COMMON, mage.cards.g.GimlisFury.class));
|
cards.add(new SetCardInfo("Gimli's Fury", 131, Rarity.COMMON, mage.cards.g.GimlisFury.class));
|
||||||
|
cards.add(new SetCardInfo("Gimli, Mournful Avenger", 209, Rarity.RARE, mage.cards.g.GimliMournfulAvenger.class));
|
||||||
cards.add(new SetCardInfo("Gloin, Dwarf Emissary", 132, Rarity.RARE, mage.cards.g.GloinDwarfEmissary.class));
|
cards.add(new SetCardInfo("Gloin, Dwarf Emissary", 132, Rarity.RARE, mage.cards.g.GloinDwarfEmissary.class));
|
||||||
cards.add(new SetCardInfo("Glorious Gale", 51, Rarity.COMMON, mage.cards.g.GloriousGale.class));
|
cards.add(new SetCardInfo("Glorious Gale", 51, Rarity.COMMON, mage.cards.g.GloriousGale.class));
|
||||||
cards.add(new SetCardInfo("Goblin Assailant", 295, Rarity.COMMON, mage.cards.g.GoblinAssailant.class));
|
cards.add(new SetCardInfo("Goblin Assailant", 295, Rarity.COMMON, mage.cards.g.GoblinAssailant.class));
|
||||||
|
|
|
@ -25,7 +25,7 @@ public enum CreatureDiedControlledCondition implements Condition {
|
||||||
return game
|
return game
|
||||||
.getState()
|
.getState()
|
||||||
.getWatcher(CreaturesDiedWatcher.class)
|
.getWatcher(CreaturesDiedWatcher.class)
|
||||||
.getAmountOfCreaturesDiedThisTurnByOwner(source.getControllerId()) > 0;
|
.getAmountOfCreaturesDiedThisTurnByController(source.getControllerId()) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue