mirror of
https://github.com/magefree/mage.git
synced 2025-12-27 05:52:06 -08:00
Some minor formatting.
This commit is contained in:
parent
9c5d5208b9
commit
bf4ccf185c
10 changed files with 79 additions and 61 deletions
|
|
@ -44,6 +44,7 @@ import mage.target.Targets;
|
|||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
* @param <T>
|
||||
*/
|
||||
public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements ManaCosts<T> {
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import mage.players.Player;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
* Action for drawing cards.
|
||||
|
|
@ -22,7 +23,7 @@ public class MageDrawAction extends MageAction {
|
|||
|
||||
private final Player player;
|
||||
private final int amount;
|
||||
private ArrayList<UUID> appliedEffects;
|
||||
private final ArrayList<UUID> appliedEffects;
|
||||
private List<Card> drawnCards;
|
||||
|
||||
private static final int NEGATIVE_VALUE = -1000000;
|
||||
|
|
@ -37,6 +38,7 @@ public class MageDrawAction extends MageAction {
|
|||
* Draw and set action score.
|
||||
*
|
||||
* @param game Game context.
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int doAction(Game game) {
|
||||
|
|
@ -51,7 +53,7 @@ public class MageDrawAction extends MageAction {
|
|||
score += value;
|
||||
}
|
||||
if (numDrawn > 0) {
|
||||
game.fireInformEvent(player.getName() + " draws " + Integer.toString(numDrawn) + " card" + (numDrawn > 1 ? "s" : ""));
|
||||
game.fireInformEvent(player.getName() + " draws " + CardUtil.numberToText(numDrawn, "a") + " card" + (numDrawn > 1 ? "s" : ""));
|
||||
}
|
||||
if (player.isEmptyDraw()) {
|
||||
game.doAction(new MageLoseGameAction(player, MageLoseGameAction.DRAW_REASON));
|
||||
|
|
|
|||
|
|
@ -351,8 +351,25 @@ public class CardUtil {
|
|||
* Converts an integer number to string
|
||||
* Numbers > 20 will be returned as digits
|
||||
*
|
||||
* @param number
|
||||
* @return
|
||||
*/
|
||||
public static String numberToText(int number) {
|
||||
return numberToText(number, "one");
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts an integer number to string like "one", "two", "three", ...
|
||||
* Numbers > 20 will be returned as digits
|
||||
*
|
||||
* @param number number to convert to text
|
||||
* @param forOne if the number is 1, this string will be returnedinstead of "one".
|
||||
* @return
|
||||
*/
|
||||
public static String numberToText(int number, String forOne) {
|
||||
if (number == 1 && forOne != null) {
|
||||
return forOne;
|
||||
}
|
||||
if (number >= 0 && number < 21) {
|
||||
return numberStrings[number];
|
||||
}
|
||||
|
|
@ -368,11 +385,7 @@ public class CardUtil {
|
|||
|
||||
public static String numberToText(String number, String forOne) {
|
||||
if (checkNumeric(number)) {
|
||||
int intNumber = Integer.parseInt(number);
|
||||
if (forOne != null && intNumber == 1) {
|
||||
return forOne;
|
||||
}
|
||||
return numberToText(intNumber);
|
||||
return numberToText(Integer.parseInt(number));
|
||||
}
|
||||
return number;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue