added Capsize. added MagicPowerTargetFilter. added Legacy's Allure

master
beholder 2011-10-26 13:38:32 +02:00
parent 1c1e03718e
commit c344d515d9
5 changed files with 192 additions and 1 deletions

View File

@ -17268,3 +17268,25 @@ color=u
converted=1 converted=1
cost={U} cost={U}
timing=draw timing=draw
>Capsize
url=http://magiccards.info/tp/en/55.html
image=http://magiccards.info/scans/en/tp/55.jpg
value=3
rarity=C
type=Instant
color=u
converted=3
cost={1}{U}{U}
timing=removal
>Legacy's Allure
url=http://magiccards.info/tp/en/71.html
image=http://magiccards.info/scans/en/tp/71.jpg
value=3
rarity=U
type=Enchantment
color=u
converted=2
cost={U}{U}
timing=enchantment

View File

@ -0,0 +1,56 @@
package magic.card;
import magic.model.MagicGame;
import magic.model.MagicLocationType;
import magic.model.MagicManaCost;
import magic.model.MagicPayedCost;
import magic.model.MagicPermanent;
import magic.model.action.MagicMoveCardAction;
import magic.model.action.MagicPermanentAction;
import magic.model.action.MagicRemoveFromPlayAction;
import magic.model.choice.MagicBuybackChoice;
import magic.model.choice.MagicTargetChoice;
import magic.model.event.MagicEvent;
import magic.model.event.MagicSpellCardEvent;
import magic.model.stack.MagicCardOnStack;
import magic.model.target.MagicBounceTargetPicker;
public class Capsize {
public static final MagicSpellCardEvent S = new MagicSpellCardEvent() {
@Override
public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) {
return new MagicEvent(
cardOnStack.getCard(),
cardOnStack.getController(),
new MagicBuybackChoice(MagicTargetChoice.TARGET_PERMANENT,MagicManaCost.THREE),
MagicBounceTargetPicker.getInstance(),
new Object[]{cardOnStack},
this,
"Return target permanent$ to its owner's hand. If the " +
"buyback cost was payed$, return " + cardOnStack + " to " +
"its owner's hand as it resolves.");
}
@Override
public void executeEvent(
final MagicGame game,
final MagicEvent event,
final Object[] data,
final Object[] choiceResults) {
final MagicCardOnStack cardOnStack = (MagicCardOnStack)data[0];
event.processTargetPermanent(game,choiceResults,0,new MagicPermanentAction() {
public void doAction(final MagicPermanent permanent) {
game.doAction(new MagicRemoveFromPlayAction(permanent,MagicLocationType.OwnersHand));
}
});
if (MagicBuybackChoice.isYesChoice(choiceResults[1])) {
game.doAction(new MagicMoveCardAction(
cardOnStack.getCard(),
MagicLocationType.Stack,
MagicLocationType.OwnersHand));
} else {
game.doAction(new MagicMoveCardAction(cardOnStack));
}
}
};
}

View File

@ -0,0 +1,93 @@
package magic.card;
import magic.model.MagicCounterType;
import magic.model.MagicGame;
import magic.model.MagicPayedCost;
import magic.model.MagicPermanent;
import magic.model.MagicPlayer;
import magic.model.MagicSource;
import magic.model.action.MagicChangeCountersAction;
import magic.model.action.MagicGainControlAction;
import magic.model.action.MagicPermanentAction;
import magic.model.choice.MagicMayChoice;
import magic.model.choice.MagicTargetChoice;
import magic.model.event.MagicActivation;
import magic.model.event.MagicActivationHints;
import magic.model.event.MagicEvent;
import magic.model.event.MagicPermanentActivation;
import magic.model.event.MagicSacrificeEvent;
import magic.model.event.MagicTiming;
import magic.model.target.MagicExileTargetPicker;
import magic.model.target.MagicTargetFilter;
import magic.model.target.MagicTargetHint;
import magic.model.trigger.MagicAtUpkeepTrigger;
public class Legacy_s_Allure {
public static final MagicAtUpkeepTrigger T = new MagicAtUpkeepTrigger() {
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPlayer data) {
final MagicPlayer player = permanent.getController();
return (player == data) ?
new MagicEvent(
permanent,
player,
new MagicMayChoice(
player + " may put a treasure counter on " + permanent + "."),
new Object[]{permanent},
this,
player + " may$ put a treasure counter on " + permanent + "."):
MagicEvent.NONE;
}
@Override
public void executeEvent(
final MagicGame game,
final MagicEvent event,
final Object data[],
final Object[] choiceResults) {
if (MagicMayChoice.isYesChoice(choiceResults[0])) {
game.doAction(new MagicChangeCountersAction((MagicPermanent)data[0],MagicCounterType.Charge,1,true));
}
}
};
public static final MagicPermanentActivation A = new MagicPermanentActivation(
MagicActivation.NO_COND,
new MagicActivationHints(MagicTiming.Removal),
"Control"
) {
@Override
public MagicEvent[] getCostEvent(final MagicSource source) {
return new MagicEvent[]{new MagicSacrificeEvent((MagicPermanent)source)};
}
@Override
public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
final MagicTargetFilter targetFilter =
new MagicTargetFilter.MagicPowerTargetFilter(
MagicTargetFilter.TARGET_CREATURE,
source.getCounters(MagicCounterType.Charge));
final MagicTargetChoice targetChoice =
new MagicTargetChoice(
targetFilter,true,MagicTargetHint.Negative,"target creature to gain control of");
return new MagicEvent(
source,
source.getController(),
targetChoice,
MagicExileTargetPicker.getInstance(),
new Object[]{source.getController()},
this,
"Gain control of target creature$ with power less than or " +
"equal to the number of treasure counters on " + source + ".");
}
@Override
public void executeEvent(final MagicGame game,final MagicEvent event,final Object[] data,final Object[] choiceResults) {
event.processTargetPermanent(game,choiceResults,0,new MagicPermanentAction() {
public void doAction(final MagicPermanent creature) {
game.doAction(new MagicGainControlAction((MagicPlayer)data[0],creature));
}
});
}
};
}

View File

@ -26,7 +26,7 @@ public class Whispers_of_the_Muse {
new Object[]{cardOnStack,player}, new Object[]{cardOnStack,player},
this, this,
player + " $draws a card. If the buyback cost was payed$, " + player + " $draws a card. If the buyback cost was payed$, " +
"return " + card + " to its owners hand as it resolves."); "return " + card + " to its owner's hand as it resolves.");
} }
@Override @Override
public void executeEvent( public void executeEvent(

View File

@ -1668,6 +1668,26 @@ public interface MagicTargetFilter {
} }
}; };
public static final class MagicPowerTargetFilter implements MagicTargetFilter {
private final MagicTargetFilter targetFilter;
private final int power;
public MagicPowerTargetFilter(final MagicTargetFilter targetFilter,final int power) {
this.targetFilter = targetFilter;
this.power = power;
}
@Override
public boolean accept(final MagicGame game,final MagicPlayer player,final MagicTarget target) {
return targetFilter.accept(game,player,target) &&
((MagicPermanent)target).getPower(game) <= power;
}
@Override
public boolean acceptType(final MagicTargetType targetType) {
return targetFilter.acceptType(targetType);
}
};
public static final class CardTargetFilter implements MagicTargetFilter { public static final class CardTargetFilter implements MagicTargetFilter {
private final MagicCardDefinition cardDefinition; private final MagicCardDefinition cardDefinition;