re-attempt Ancestral Memories

master
ShawnieBoy 2016-02-06 06:00:14 +00:00
parent 4021c11e7f
commit 834e245acc
1 changed files with 36 additions and 54 deletions

View File

@ -1,69 +1,51 @@
def DrawTwo = { def TakeTwo = {
final MagicGame game, final MagicEvent event -> final MagicGame game, final MagicEvent event ->
event.processChosenCards(game, { event.processChosenCards(game, {
final MagicCard card -> final MagicCard chosen ->
game.doAction(new MagicRemoveCardAction(card,MagicLocationType.OwnersLibrary)); final MagicPlayer player = event.getPlayer();
game.doAction(new MagicMoveCardAction(card,MagicLocationType.OwnersLibrary,MagicLocationType.OwnersHand)); final MagicCardList top = new MagicCardList(player.getLibrary().getCardsFromTop(7));
}); for (final MagicCard card : top) {
}; if (card == chosen) {
game.doAction(new ShiftCardAction(
def DiscardRest = { card,
final MagicGame game, final MagicEvent event -> MagicLocationType.OwnersLibrary,
final MagicPlayer player = event.getPlayer(); MagicLocationType.OwnersHand
final int amount = (player.getLibrary().size() < 6) ? player.getLibrary().size() : 5; ));
for(int i = 0; i < amount; i++) { game.logAppendMessage(player, "A card is put into ${player.getName()}'s hand.");
game.doAction(new MagicMillLibraryAction(player,1)); } else {
} game.doAction(new ShiftCardAction(
}; card,
MagicLocationType.OwnersLibrary,
MagicLocationType.Graveyard
));
}
}
});
}
[ [
new MagicSpellCardEvent() { new MagicSpellCardEvent() {
@Override @Override
public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) { public MagicEvent getEvent(final MagicCardOnStack cardOnStack, final MagicPayedCost payedCost) {
return new MagicEvent( return new MagicEvent(
cardOnStack, cardOnStack,
this, this,
"PN looks at the top seven cards of his or her library. Then PN puts two of them into your hand and the rest into his or her graveyard." "PN looks at the top seven cards of his or her library. " +
"PN puts two of them into his or her hand and the rest into his or her graveyard."
); );
} }
@Override @Override
public void executeEvent(final MagicGame game, final MagicEvent event) { public void executeEvent(final MagicGame game, final MagicEvent event) {
final MagicCardList choiceList = new MagicCardList(); final MagicCardList topCards = event.getPlayer().getLibrary().getCardsFromTop(7);
final int size = event.getPlayer().getLibrary().size(); game.addEvent(new MagicEvent(
if (size == 1) game.doAction(new MagicDrawAction(event.getPlayer(),1)); event.getSource(),
else if (size == 2) game.doAction(new MagicDrawAction(event.getPlayer(),2)); //truth to be told: "index out of bounds" is something to be hated naturally new MagicFromCardListChoice(topCards, 2),
else if (8 > size && size > 2) { MagicGraveyardTargetPicker.ReturnToHand,
for(int i = 1; i <= size; i++) { TakeTwo,
choiceList.add(event.getPlayer().getLibrary().get(size-i)); ""
} ));
game.addEvent(new MagicEvent(
event.getSource(),
new MagicFromCardListChoice(choiceList,2),
DrawTwo,
"\$"
));
game.addEvent(new MagicEvent(
event.getSource(),
DiscardRest,
""
));
} else if (size > 7) {
for(int i = 0; i < 7; i++) {
choiceList.add(event.getPlayer().getLibrary().get(7-i));
}
game.addEvent(new MagicEvent(
event.getSource(),
new MagicFromCardListChoice(choiceList,2),
DrawTwo,
"\$"
));
game.addEvent(new MagicEvent(
event.getSource(),
DiscardRest,
""
));
}
} }
} }
] ]
//Only processes the first card chosen