C17 Added Alms Collector.

This commit is contained in:
LevelX2 2017-08-28 12:44:08 +02:00
parent eb0ad63eca
commit 5660348f98
4 changed files with 259 additions and 129 deletions

View file

@ -1,5 +1,8 @@
package mage.actions;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.actions.impl.MageAction;
import mage.actions.score.ArtificialScoringSystem;
import mage.cards.Card;
@ -9,10 +12,6 @@ import mage.game.events.GameEvent;
import mage.players.Player;
import mage.util.CardUtil;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/**
* Action for drawing cards.
*
@ -20,12 +19,13 @@ import java.util.UUID;
*/
public class MageDrawAction extends MageAction {
private static final int NEGATIVE_VALUE = -1000000;
private final Player player;
private final int amount;
private final List<UUID> appliedEffects;
private final List<Card> drawnCards;
private static final int NEGATIVE_VALUE = -1000000;
private int amount;
public MageDrawAction(Player player, int amount, List<UUID> appliedEffects) {
this.player = player;
@ -44,27 +44,31 @@ public class MageDrawAction extends MageAction {
public int doAction(Game game) {
int numDrawn = 0;
int score = 0;
for (int i = 0; i < amount; i++) {
int value = drawCard(game);
if (value == NEGATIVE_VALUE) {
continue;
GameEvent event = GameEvent.getEvent(GameEvent.EventType.DRAW_CARDS, player.getId(), null, player.getId(), null, amount);
event.addAppliedEffects(appliedEffects);
if (amount < 2 || !game.replaceEvent(event)) {
amount = event.getAmount();
for (int i = 0; i < amount; i++) {
int value = drawCard(game);
if (value == NEGATIVE_VALUE) {
continue;
}
numDrawn++;
score += value;
}
numDrawn++;
score += value;
}
if (!player.isTopCardRevealed() && numDrawn > 0) {
game.fireInformEvent(player.getLogName() + " draws " + CardUtil.numberToText(numDrawn, "a") + " card" + (numDrawn > 1 ? "s" : ""));
}
if (player.isEmptyDraw()) {
GameEvent event = GameEvent.getEvent(GameEvent.EventType.EMPTY_DRAW, player.getId(), player.getId());
if (!game.replaceEvent(event)) {
game.doAction(new MageLoseGameAction(player, MageLoseGameAction.DRAW_REASON));
if (!player.isTopCardRevealed() && numDrawn > 0) {
game.fireInformEvent(player.getLogName() + " draws " + CardUtil.numberToText(numDrawn, "a") + " card" + (numDrawn > 1 ? "s" : ""));
}
if (player.isEmptyDraw()) {
event = GameEvent.getEvent(GameEvent.EventType.EMPTY_DRAW, player.getId(), player.getId());
if (!game.replaceEvent(event)) {
game.doAction(new MageLoseGameAction(player, MageLoseGameAction.DRAW_REASON));
}
}
setScore(player, score);
game.setStateCheckRequired();
}
setScore(player, score);
game.setStateCheckRequired();
return numDrawn;
}

View file

@ -27,12 +27,11 @@
*/
package mage.game.events;
import mage.constants.Zone;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.constants.Zone;
/**
*
@ -90,6 +89,7 @@ public class GameEvent implements Serializable {
ZONE_CHANGE,
ZONE_CHANGE_GROUP,
EMPTY_DRAW,
DRAW_CARDS, // applies to an instruction to draw more than one card before any replacement effects apply to individual cards drawn
DRAW_CARD, DREW_CARD,
MIRACLE_CARD_REVEALED,
MADNESS_CARD_EXILED,