foul-magics/Mage.Sets/src/mage/cards/t/ThunderDrake.java
2019-04-18 20:03:39 -04:00

84 lines
2.5 KiB
Java

package mage.cards.t;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.FlyingAbility;
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.watchers.common.CastSpellLastTurnWatcher;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class ThunderDrake extends CardImpl {
public ThunderDrake(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}");
this.subtype.add(SubType.ELEMENTAL);
this.subtype.add(SubType.DRAKE);
this.power = new MageInt(2);
this.toughness = new MageInt(3);
// Flying
this.addAbility(FlyingAbility.getInstance());
// Whenever you cast you cast your second spell each turn, put a +1/+1 counter on Thunder Drake.
this.addAbility(new ThunderDrakeTriggeredAbility(), new CastSpellLastTurnWatcher());
}
private ThunderDrake(final ThunderDrake card) {
super(card);
}
@Override
public ThunderDrake copy() {
return new ThunderDrake(this);
}
}
class ThunderDrakeTriggeredAbility extends TriggeredAbilityImpl {
ThunderDrakeTriggeredAbility() {
super(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance()));
}
private ThunderDrakeTriggeredAbility(final ThunderDrakeTriggeredAbility ability) {
super(ability);
}
@Override
public ThunderDrakeTriggeredAbility copy() {
return new ThunderDrakeTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.SPELL_CAST;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getPlayerId().equals(controllerId)) {
CastSpellLastTurnWatcher watcher = game.getState().getWatcher(CastSpellLastTurnWatcher.class);
if (watcher != null && watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(event.getPlayerId()) == 2) {
return true;
}
}
return false;
}
@Override
public String getRule() {
return "Whenever you cast your second spell each turn, put a +1/+1 counter on {this}";
}
}