forked from External/mage
Implemented Darkblade Agent
This commit is contained in:
parent
2f55ae1d4b
commit
ff2142ef77
2 changed files with 124 additions and 0 deletions
123
Mage.Sets/src/mage/cards/d/DarkbladeAgent.java
Normal file
123
Mage.Sets/src/mage/cards/d/DarkbladeAgent.java
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
package mage.cards.d;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.decorator.ConditionalContinuousEffect;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
|
||||
import mage.abilities.keyword.DeathtouchAbility;
|
||||
import mage.constants.SubType;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.watchers.Watcher;
|
||||
import mage.watchers.common.SpellsCastWatcher;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class DarkbladeAgent extends CardImpl {
|
||||
|
||||
public DarkbladeAgent(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}{B}");
|
||||
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.ASSASSIN);
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(3);
|
||||
|
||||
// As long as you've surveilled this turn, Darkblade Agent has deathtouch and "Whenever this creature deals combat damage to a player, draw a card."
|
||||
Ability ability = new SimpleStaticAbility(
|
||||
Zone.BATTLEFIELD,
|
||||
new ConditionalContinuousEffect(
|
||||
new GainAbilitySourceEffect(
|
||||
DeathtouchAbility.getInstance(),
|
||||
Duration.WhileOnBattlefield
|
||||
), DarkbladeAgentCondition.instance,
|
||||
"As long as you've surveilled this turn, "
|
||||
+ "{this} has deathtouch"
|
||||
)
|
||||
);
|
||||
ability.addEffect(new ConditionalContinuousEffect(
|
||||
new GainAbilitySourceEffect(
|
||||
new DealsCombatDamageToAPlayerTriggeredAbility(
|
||||
new DrawCardSourceControllerEffect(1), false
|
||||
), Duration.WhileOnBattlefield
|
||||
), DarkbladeAgentCondition.instance,
|
||||
"and \"Whenever this creature deals "
|
||||
+ "combat damage to a player, draw a card.\""
|
||||
));
|
||||
this.addAbility(ability, new SpellsCastWatcher());
|
||||
}
|
||||
|
||||
public DarkbladeAgent(final DarkbladeAgent card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DarkbladeAgent copy() {
|
||||
return new DarkbladeAgent(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum DarkbladeAgentCondition implements Condition {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
DarkbladeAgentWatcher watcher
|
||||
= (DarkbladeAgentWatcher) game.getState().getWatchers().get(
|
||||
DarkbladeAgentWatcher.class.getSimpleName()
|
||||
);
|
||||
return watcher != null
|
||||
&& watcher.getSurveiledThisTurn(source.getControllerId());
|
||||
}
|
||||
}
|
||||
|
||||
class DarkbladeAgentWatcher extends Watcher {
|
||||
|
||||
private final Set<UUID> surveiledThisTurn = new HashSet();
|
||||
|
||||
public DarkbladeAgentWatcher() {
|
||||
super(DarkbladeAgentWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public DarkbladeAgentWatcher(final DarkbladeAgentWatcher watcher) {
|
||||
super(watcher);
|
||||
this.surveiledThisTurn.addAll(watcher.surveiledThisTurn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DarkbladeAgentWatcher copy() {
|
||||
return new DarkbladeAgentWatcher(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.SURVEIL) {
|
||||
this.surveiledThisTurn.add(event.getPlayerId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
this.surveiledThisTurn.clear();
|
||||
}
|
||||
|
||||
public boolean getSurveiledThisTurn(UUID playerId) {
|
||||
return this.surveiledThisTurn.contains(playerId);
|
||||
}
|
||||
}
|
||||
|
|
@ -40,6 +40,7 @@ public final class GuildsOfRavnica extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Citywatch Sphinx", 33, Rarity.UNCOMMON, mage.cards.c.CitywatchSphinx.class));
|
||||
cards.add(new SetCardInfo("Conclave Guildmage", 162, Rarity.UNCOMMON, mage.cards.c.ConclaveGuildmage.class));
|
||||
cards.add(new SetCardInfo("Conclave Tribunal", 6, Rarity.UNCOMMON, mage.cards.c.ConclaveTribunal.class));
|
||||
cards.add(new SetCardInfo("Darkblade Agent", 164, Rarity.COMMON, mage.cards.d.DarkbladeAgent.class));
|
||||
cards.add(new SetCardInfo("Deadly Visit", 68, Rarity.COMMON, mage.cards.d.DeadlyVisit.class));
|
||||
cards.add(new SetCardInfo("Deafening Clarion", 165, Rarity.RARE, mage.cards.d.DeafeningClarion.class));
|
||||
cards.add(new SetCardInfo("Dimir Guildgate", 245, Rarity.COMMON, mage.cards.d.DimirGuildgate.class));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue