mirror of
https://github.com/magefree/mage.git
synced 2026-01-24 20:29:19 -08:00
[ECL] Implement Lasting Tarfire
This commit is contained in:
parent
68b30daac1
commit
4278e52aaa
2 changed files with 100 additions and 0 deletions
99
Mage.Sets/src/mage/cards/l/LastingTarfire.java
Normal file
99
Mage.Sets/src/mage/cards/l/LastingTarfire.java
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
package mage.cards.l;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.effects.common.DamagePlayersEffect;
|
||||
import mage.abilities.hint.ConditionHint;
|
||||
import mage.abilities.hint.Hint;
|
||||
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class LastingTarfire extends CardImpl {
|
||||
|
||||
public LastingTarfire(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}");
|
||||
|
||||
// At the beginning of each end step, if you put a counter on a creature this turn, this enchantment deals 2 damage to each opponent.
|
||||
this.addAbility(new BeginningOfEndStepTriggeredAbility(
|
||||
TargetController.ANY, new DamagePlayersEffect(2, TargetController.OPPONENT),
|
||||
false, LastingTarfireCondition.instance
|
||||
).addHint(LastingTarfireCondition.getHint()), new LastingTarfireWatcher());
|
||||
}
|
||||
|
||||
private LastingTarfire(final LastingTarfire card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LastingTarfire copy() {
|
||||
return new LastingTarfire(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum LastingTarfireCondition implements Condition {
|
||||
instance;
|
||||
private static final Hint hint = new ConditionHint(instance);
|
||||
|
||||
public static Hint getHint() {
|
||||
return hint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return LastingTarfireWatcher.checkPlayer(source.getControllerId(), game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "you put a counter on a creature this turn";
|
||||
}
|
||||
}
|
||||
|
||||
class LastingTarfireWatcher extends Watcher {
|
||||
|
||||
private final Set<UUID> set = new HashSet<>();
|
||||
|
||||
LastingTarfireWatcher() {
|
||||
super(WatcherScope.GAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
if (event.getType() != GameEvent.EventType.COUNTER_ADDED || event.getAmount() < 1) {
|
||||
return;
|
||||
}
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
if (permanent != null && permanent.isCreature(game)) {
|
||||
set.add(event.getPlayerId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
set.clear();
|
||||
}
|
||||
|
||||
static boolean checkPlayer(UUID playerId, Game game) {
|
||||
return game
|
||||
.getState()
|
||||
.getWatcher(LastingTarfireWatcher.class)
|
||||
.set
|
||||
.contains(playerId);
|
||||
}
|
||||
}
|
||||
|
|
@ -126,6 +126,7 @@ public final class LorwynEclipsed extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Kirol, Attentive First-Year", 231, Rarity.RARE, mage.cards.k.KirolAttentiveFirstYear.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Kirol, Attentive First-Year", 374, Rarity.RARE, mage.cards.k.KirolAttentiveFirstYear.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Kulrath Mystic", 56, Rarity.COMMON, mage.cards.k.KulrathMystic.class));
|
||||
cards.add(new SetCardInfo("Lasting Tarfire", 149, Rarity.UNCOMMON, mage.cards.l.LastingTarfire.class));
|
||||
cards.add(new SetCardInfo("Lavaleaper", 150, Rarity.RARE, mage.cards.l.Lavaleaper.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Lavaleaper", 318, Rarity.RARE, mage.cards.l.Lavaleaper.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Liminal Hold", 24, Rarity.COMMON, mage.cards.l.LiminalHold.class));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue