added Abyssal Nightstalker. added condition for AEther Vial

master
beholder 2011-10-29 07:50:26 +02:00
parent ae93db65ad
commit fe2cbde20b
4 changed files with 78 additions and 1 deletions

View File

@ -17634,3 +17634,16 @@ converted=3
cost={1}{W}{W}
pt=3/3
timing=main
>Abyssal Nightstalker
url=http://magiccards.info/po2/en/1.html
image=http://magiccards.info/scans/en/po2/1.jpg
value=2
rarity=U
type=Creature
subtype=Nightstalker
color=b
converted=4
cost={3}{B}
pt=2/2
timing=main

View File

@ -54,7 +54,10 @@ public class AEther_Vial {
};
public static final MagicPermanentActivation A = new MagicPermanentActivation(
new MagicCondition[]{MagicCondition.CAN_TAP_CONDITION},
new MagicCondition[]{
MagicCondition.CAN_TAP_CONDITION,
MagicCondition.HAS_CREATURE_WITH_CMC_CONDITION
},
new MagicActivationHints(MagicTiming.Token),
"Token"
) {

View File

@ -0,0 +1,41 @@
package magic.card;
import magic.model.MagicDamage;
import magic.model.MagicGame;
import magic.model.MagicPermanent;
import magic.model.MagicPlayer;
import magic.model.event.MagicDiscardEvent;
import magic.model.event.MagicEvent;
import magic.model.trigger.MagicIfDamageWouldBeDealtTrigger;
public class Abyssal_Nightstalker {
public static final MagicIfDamageWouldBeDealtTrigger T = new MagicIfDamageWouldBeDealtTrigger(1) {
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicDamage damage) {
return (damage.getSource() == permanent &&
damage.isCombat() &&
damage.getTarget().isPlayer() &&
!permanent.isBlocked()) ?
new MagicEvent(
permanent,
permanent.getController(),
new Object[]{permanent,damage.getTarget()},
this,
damage.getTarget() + " discards a card.") :
MagicEvent.NONE;
}
@Override
public void executeEvent(
final MagicGame game,
final MagicEvent event,
final Object data[],
final Object[] choiceResults) {
game.addEvent(new MagicDiscardEvent(
(MagicPermanent)data[0],
(MagicPlayer)data[1],
1,
false));
}
};
}

View File

@ -1,15 +1,20 @@
package magic.model.condition;
import java.util.Collection;
import magic.model.MagicAbility;
import magic.model.MagicCard;
import magic.model.MagicCardDefinition;
import magic.model.MagicCounterType;
import magic.model.MagicGame;
import magic.model.MagicPermanent;
import magic.model.MagicPlayer;
import magic.model.MagicSource;
import magic.model.MagicSubType;
import magic.model.MagicType;
import magic.model.phase.MagicPhaseType;
import magic.model.target.MagicTarget;
import magic.model.target.MagicTargetFilter;
public interface MagicCondition {
@ -248,6 +253,21 @@ public interface MagicCondition {
return permanent.getPower(game) >= 4;
}
};
MagicCondition HAS_CREATURE_WITH_CMC_CONDITION = new MagicCondition() {
public boolean accept(final MagicGame game,final MagicSource source) {
final MagicPlayer player = source.getController();
final int charges = ((MagicPermanent) source).getCounters(MagicCounterType.Charge);
final Collection<MagicTarget> targets =
game.filterTargets(player,MagicTargetFilter.TARGET_CREATURE_CARD_FROM_HAND);
for (final MagicTarget target : targets) {
if (((MagicCard)target).getCardDefinition().hasConvertedCost(charges)) {
return true;
}
}
return false;
}
};
boolean accept(final MagicGame game,final MagicSource source);
}