fixed Charmbreaker Devils
parent
48419bec44
commit
942e00d389
|
@ -19,28 +19,19 @@ import magic.model.trigger.MagicWhenSpellIsPlayedTrigger;
|
|||
|
||||
|
||||
public class Charmbreaker_Devils {
|
||||
public static final MagicAtUpkeepTrigger T1 = new MagicAtUpkeepTrigger() {
|
||||
public static final MagicAtUpkeepTrigger T1 = new MagicAtUpkeepTrigger() {
|
||||
@Override
|
||||
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPlayer data) {
|
||||
final MagicPlayer player = permanent.getController();
|
||||
if (player == data) {
|
||||
final List<MagicTarget> targets =
|
||||
game.filterTargets(player,MagicTargetFilter.TARGET_INSTANT_OR_SORCERY_CARD_FROM_GRAVEYARD);
|
||||
if (targets.size() > 0) {
|
||||
final magic.MersenneTwisterFast rng =
|
||||
new magic.MersenneTwisterFast(permanent.getId() + player.getId());
|
||||
final int index = rng.nextInt(targets.size());
|
||||
final MagicCard card = (MagicCard)targets.get(index);
|
||||
return new MagicEvent(
|
||||
permanent,
|
||||
player,
|
||||
new Object[]{card},
|
||||
this,
|
||||
"Return an instant or sorcery card at random " +
|
||||
"from your graveyard to your hand.");
|
||||
}
|
||||
}
|
||||
return MagicEvent.NONE;
|
||||
return (player == data) ?
|
||||
new MagicEvent(
|
||||
permanent,
|
||||
player,
|
||||
new Object[]{player,permanent},
|
||||
this,
|
||||
"Return an instant or sorcery card at random " +
|
||||
"from your graveyard to your hand.") :
|
||||
MagicEvent.NONE;
|
||||
}
|
||||
@Override
|
||||
public void executeEvent(
|
||||
|
@ -48,9 +39,18 @@ public class Charmbreaker_Devils {
|
|||
final MagicEvent event,
|
||||
final Object data[],
|
||||
final Object[] choiceResults) {
|
||||
final MagicCard card = (MagicCard)data[0];
|
||||
game.doAction(new MagicRemoveCardAction(card,MagicLocationType.Graveyard));
|
||||
game.doAction(new MagicMoveCardAction(card,MagicLocationType.Graveyard,MagicLocationType.OwnersHand));
|
||||
final MagicPlayer player = (MagicPlayer)data[0];
|
||||
final List<MagicTarget> targets =
|
||||
game.filterTargets(player,MagicTargetFilter.TARGET_INSTANT_OR_SORCERY_CARD_FROM_GRAVEYARD);
|
||||
if (targets.size() > 0) {
|
||||
final MagicPermanent permanent = (MagicPermanent)data[1];
|
||||
final magic.MersenneTwisterFast rng =
|
||||
new magic.MersenneTwisterFast(permanent.getId() + player.getId());
|
||||
final int index = rng.nextInt(targets.size());
|
||||
final MagicCard card = (MagicCard)targets.get(index);
|
||||
game.doAction(new MagicRemoveCardAction(card,MagicLocationType.Graveyard));
|
||||
game.doAction(new MagicMoveCardAction(card,MagicLocationType.Graveyard,MagicLocationType.OwnersHand));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue