mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
- CheckStyle.
This commit is contained in:
@@ -145,7 +145,6 @@ public class Cost {
|
||||
private static final String RETURN_STR = "Return<";
|
||||
private static final String REVEAL_STR = "Reveal<";
|
||||
|
||||
|
||||
public Cost(final Card card, CardManaCost cost, final boolean bAbility) {
|
||||
this(card, cost.toString(), bAbility);
|
||||
}
|
||||
|
||||
@@ -61,11 +61,12 @@ public class ManaCost {
|
||||
|
||||
final CardManaCost manaCost = new CardManaCost(new ManaCostParser(sCost));
|
||||
for (ManaCostShard shard : manaCost.getShards()) {
|
||||
if ( shard == ManaCostShard.X )
|
||||
if (shard == ManaCostShard.X) {
|
||||
cntX++;
|
||||
else
|
||||
} else {
|
||||
increaseShard(shard, 1);
|
||||
}
|
||||
}
|
||||
increaseColorlessMana(manaCost.getGenericCost());
|
||||
}
|
||||
|
||||
@@ -120,12 +121,15 @@ public class ManaCost {
|
||||
*/
|
||||
private List<ManaCostShard> getUnpaidPhyrexianMana() {
|
||||
ArrayList<ManaCostShard> res = new ArrayList<ManaCostShard>();
|
||||
for(final Entry<ManaCostShard, Integer> part : this.unpaidShards.entrySet() )
|
||||
{
|
||||
if( !part.getKey().isPhyrexian() ) continue;
|
||||
for(int i = 0; i < part.getValue(); i++)
|
||||
for (final Entry<ManaCostShard, Integer> part : this.unpaidShards.entrySet()) {
|
||||
|
||||
if (!part.getKey().isPhyrexian()) {
|
||||
continue;
|
||||
}
|
||||
for (int i = 0; i < part.getValue(); i++) {
|
||||
res.add(part.getKey());
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -138,7 +142,9 @@ public class ManaCost {
|
||||
*/
|
||||
public final boolean containsPhyrexianMana() {
|
||||
for (ManaCostShard shard : unpaidShards.keySet()) {
|
||||
if ( shard.isPhyrexian() ) return true;
|
||||
if (shard.isPhyrexian()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -155,8 +161,11 @@ public class ManaCost {
|
||||
|
||||
if (phy.size() > 0) {
|
||||
Integer cnt = unpaidShards.get(phy.get(0));
|
||||
if( cnt <= 1 ) unpaidShards.remove(phy.get(0));
|
||||
else unpaidShards.put(phy.get(0), Integer.valueOf(cnt - 1));
|
||||
if (cnt <= 1) {
|
||||
unpaidShards.remove(phy.get(0));
|
||||
} else {
|
||||
unpaidShards.put(phy.get(0), Integer.valueOf(cnt - 1));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -177,14 +186,17 @@ public class ManaCost {
|
||||
*/
|
||||
public final boolean isColor(final String color) {
|
||||
//if ( "1".equals(color) ) return getColorlessManaAmount() > 0;
|
||||
if ( color.matches("^\\d+$") ) return getColorlessManaAmount() > 0;
|
||||
if (color.matches("^\\d+$")) {
|
||||
return getColorlessManaAmount() > 0;
|
||||
}
|
||||
|
||||
for (ManaCostShard shard : unpaidShards.keySet()) {
|
||||
|
||||
for(ManaCostShard shard : unpaidShards.keySet())
|
||||
{
|
||||
String ss = shard.toString();
|
||||
if (ss.contains(color))
|
||||
if (ss.contains(color)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -304,7 +316,6 @@ public class ManaCost {
|
||||
unpaidShards.put(shard, Integer.valueOf(cnt == null || cnt == 0 ? toAdd : toAdd + cnt));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* decreaseColorlessMana
|
||||
@@ -319,19 +330,18 @@ public class ManaCost {
|
||||
decreaseShard(ManaCostShard.COLORLESS, manaToSubtract);
|
||||
}
|
||||
|
||||
|
||||
public final void decreaseShard(final ManaCostShard shard, final int manaToSubtract) {
|
||||
if (manaToSubtract <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Integer genericCnt = unpaidShards.get(shard);
|
||||
if( null == genericCnt || genericCnt - manaToSubtract <= 0 )
|
||||
if (null == genericCnt || genericCnt - manaToSubtract <= 0) {
|
||||
unpaidShards.remove(shard);
|
||||
else
|
||||
} else {
|
||||
unpaidShards.put(shard, Integer.valueOf(genericCnt - manaToSubtract));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -363,8 +373,7 @@ public class ManaCost {
|
||||
}
|
||||
|
||||
ManaCostShard choice = null;
|
||||
for(ManaCostShard toPay : unpaidShards.keySet())
|
||||
{
|
||||
for (ManaCostShard toPay : unpaidShards.keySet()) {
|
||||
if (canBePaidWith(toPay, mana)) {
|
||||
// if m is a better to pay than choice
|
||||
if (choice == null) {
|
||||
@@ -396,11 +405,17 @@ public class ManaCost {
|
||||
}
|
||||
|
||||
private int getPayPriority(ManaCostShard s1) {
|
||||
if ( s1 == ManaCostShard.COLORLESS ) return 0;
|
||||
if (s1 == ManaCostShard.COLORLESS) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (s1.isMonoColor()) {
|
||||
if ( s1.isOr2Colorless() ) return 9;
|
||||
if ( !s1.isPhyrexian() ) return 10;
|
||||
if (s1.isOr2Colorless()) {
|
||||
return 9;
|
||||
}
|
||||
if (!s1.isPhyrexian()) {
|
||||
return 10;
|
||||
}
|
||||
return 8;
|
||||
}
|
||||
|
||||
@@ -436,8 +451,7 @@ public class ManaCost {
|
||||
}
|
||||
|
||||
ManaCostShard choice = null;
|
||||
for(ManaCostShard toPay : unpaidShards.keySet())
|
||||
{
|
||||
for (ManaCostShard toPay : unpaidShards.keySet()) {
|
||||
if (canBePaidWith(toPay, mana)) {
|
||||
// if m is a better to pay than choice
|
||||
if (choice == null) {
|
||||
@@ -476,11 +490,12 @@ public class ManaCost {
|
||||
public final void combineManaCost(final String extra) {
|
||||
final CardManaCost manaCost = new CardManaCost(new ManaCostParser(extra));
|
||||
for (ManaCostShard shard : manaCost.getShards()) {
|
||||
if ( shard == ManaCostShard.X )
|
||||
if (shard == ManaCostShard.X) {
|
||||
cntX++;
|
||||
else
|
||||
} else {
|
||||
increaseShard(shard, 1);
|
||||
}
|
||||
}
|
||||
increaseColorlessMana(manaCost.getGenericCost());
|
||||
}
|
||||
|
||||
@@ -502,11 +517,14 @@ public class ManaCost {
|
||||
}
|
||||
|
||||
int nGeneric = getColorlessManaAmount();
|
||||
if( nGeneric > 0 )
|
||||
if (nGeneric > 0) {
|
||||
sb.append(nGeneric).append(" ");
|
||||
}
|
||||
|
||||
for (Entry<ManaCostShard, Integer> s : unpaidShards.entrySet()) {
|
||||
if ( s.getKey() == ManaCostShard.COLORLESS) continue;
|
||||
if (s.getKey() == ManaCostShard.COLORLESS) {
|
||||
continue;
|
||||
}
|
||||
for (int i = 0; i < s.getValue(); i++) {
|
||||
sb.append(s.getKey().toString()).append(" ");
|
||||
}
|
||||
@@ -550,7 +568,9 @@ public class ManaCost {
|
||||
*
|
||||
* @return a int.
|
||||
*/
|
||||
public final int getXcounter() { return cntX; }
|
||||
public final int getXcounter() {
|
||||
return cntX;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
||||
Reference in New Issue
Block a user