merged cards

master
melvin 2011-09-04 21:58:34 +08:00
commit 77f03850bd
6 changed files with 94 additions and 1 deletions

View File

@ -7670,6 +7670,15 @@ converted=1
cost={1}
timing=artifact
>Quicksilver Amulet
image=http://magiccards.info/scans/en/m12/214.jpg
value=4
rarity=R
type=Artifact
converted=4
cost={4}
timing=artifact
>Sylvok Lifestaff
image=http://magiccards.info/scans/en/som/209.jpg
value=2

View File

@ -0,0 +1,56 @@
package magic.card;
import magic.model.*;
import magic.model.action.MagicCardAction;
import magic.model.action.MagicPlayCardAction;
import magic.model.action.MagicRemoveCardAction;
import magic.model.choice.MagicTargetChoice;
import magic.model.condition.MagicCondition;
import magic.model.event.*;
import magic.model.target.MagicGraveyardTargetPicker;
public class Quicksilver_Amulet {
public static final MagicPermanentActivation A1 = new MagicPermanentActivation(
new MagicCondition[]{
MagicCondition.CAN_TAP_CONDITION,
MagicManaCost.FOUR.getCondition()},
new MagicActivationHints(MagicTiming.Token),
"Token") {
@Override
public MagicEvent[] getCostEvent(final MagicSource source) {
final MagicPermanent permanent=(MagicPermanent)source;
return new MagicEvent[]{
new MagicTapEvent(permanent),
new MagicPayManaCostEvent(source,source.getController(),MagicManaCost.FOUR)};
}
@Override
public MagicEvent getPermanentEvent(
final MagicPermanent source,
final MagicPayedCost payedCost) {
return new MagicEvent(
source,
source.getController(),
MagicTargetChoice.TARGET_CREATURE_CARD_FROM_HAND,
MagicGraveyardTargetPicker.getInstance(),
new Object[]{source.getController()},
this,
"Put a creature card$ from your hand onto the battlefield.");
}
@Override
public void executeEvent(
final MagicGame game,
final MagicEvent event,
final Object[] data,
final Object[] choiceResults) {
event.processTargetCard(game,choiceResults,0,new MagicCardAction() {
public void doAction(final MagicCard card) {
game.doAction(new MagicRemoveCardAction(card,MagicLocationType.OwnersHand));
game.doAction(new MagicPlayCardAction(card,(MagicPlayer)data[0],MagicPlayCardAction.NONE));
}
});
}
};
}

View File

@ -915,6 +915,15 @@ public class MagicGame {
}
}
// Cards in hand
if (targetFilter.acceptType(MagicTargetType.Hand)) {
for (final MagicCard targetCard : player.getHand()) {
if (targetFilter.accept(this,player,targetCard)) {
targets.add(targetCard);
}
}
}
return targets;
}
@ -1002,6 +1011,12 @@ public class MagicGame {
return true;
}
// Card in hand
if (targetFilter.acceptType(MagicTargetType.Hand) &&
player.getHand().contains(target)) {
return true;
}
return false;
}

View File

@ -188,6 +188,8 @@ public class MagicTargetChoice extends MagicChoice {
new MagicTargetChoice(MagicTargetFilter.TARGET_ARTIFACT_OR_CREATURE_CARD_FROM_ALL_GRAVEYARDS,false,MagicTargetHint.None,"target artifact or creature card from a graveyard");
public static final MagicTargetChoice TARGET_GOBLIN_CARD_FROM_GRAVEYARD=
new MagicTargetChoice(MagicTargetFilter.TARGET_GOBLIN_CARD_FROM_GRAVEYARD,false,MagicTargetHint.None,"target Goblin card from your graveyard");
public static final MagicTargetChoice TARGET_CREATURE_CARD_FROM_HAND =
new MagicTargetChoice(MagicTargetFilter.TARGET_CREATURE_CARD_FROM_HAND,false,MagicTargetHint.None,"target creature card from your hand");
private final String targetDescription;
private final MagicTargetFilter targetFilter;

View File

@ -883,6 +883,16 @@ public interface MagicTargetFilter {
}
};
public static final MagicTargetFilter TARGET_CREATURE_CARD_FROM_HAND = new MagicTargetFilter() {
public boolean accept(final MagicGame game,final MagicPlayer player,final MagicTarget target) {
return ((MagicCard)target).getCardDefinition().isCreature();
}
public boolean acceptType(final MagicTargetType targetType) {
return targetType == MagicTargetType.Hand;
}
};
// Permanent reference can not be used because game is copied.
public static final class MagicOtherPermanentTargetFilter implements MagicTargetFilter {

View File

@ -5,6 +5,7 @@ public enum MagicTargetType {
Permanent,
Stack,
Graveyard,
OpponentsGraveyard
OpponentsGraveyard,
Hand
;
}