mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
- CheckStyle.
This commit is contained in:
@@ -71,12 +71,14 @@ public final class CardUtil {
|
||||
* @return a {@link forge.Card} object.
|
||||
*/
|
||||
public static <T> T getRandom(final T[] o) {
|
||||
if ( o == null ) throw new IllegalArgumentException("CardUtil : getRandom(T) recieved null instead of array.");
|
||||
if (o == null) {
|
||||
throw new IllegalArgumentException("CardUtil : getRandom(T) recieved null instead of array.");
|
||||
}
|
||||
int len = o.length;
|
||||
switch(len) {
|
||||
case 0: throw new IllegalArgumentException("CardUtil : getRandom(T) recieved an empty array.");
|
||||
switch(len) {
|
||||
case 0: throw new IllegalArgumentException("CardUtil : getRandom(T) recieved an empty array.");
|
||||
case 1: return o[0];
|
||||
default: return o[CardUtil.RANDOM.nextInt(len)];
|
||||
default: return o[CardUtil.RANDOM.nextInt(len)];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -941,7 +941,7 @@ public class Combat {
|
||||
*/
|
||||
public final List<Card> getUnblockedAttackers() {
|
||||
final List<Card> out = new ArrayList<Card>();
|
||||
for(Card c : this.unblockedMap.keySet()) {
|
||||
for (Card c : this.unblockedMap.keySet()) {
|
||||
if (!c.hasFirstStrike()) {
|
||||
out.add(c);
|
||||
}
|
||||
@@ -958,7 +958,7 @@ public class Combat {
|
||||
*/
|
||||
public final List<Card> getUnblockedFirstStrikeAttackers() {
|
||||
final List<Card> out = new ArrayList<Card>();
|
||||
for(Card c : this.unblockedMap.keySet()) { // only add creatures without firstStrike to this
|
||||
for (Card c : this.unblockedMap.keySet()) { // only add creatures without firstStrike to this
|
||||
if (c.hasFirstStrike() || c.hasDoubleStrike()) {
|
||||
out.add(c);
|
||||
}
|
||||
|
||||
@@ -714,7 +714,7 @@ public class CombatUtil {
|
||||
int cntAttackers = combat.getAttackers().size();
|
||||
for (final Card card : AllZoneUtil.getCardsIn(Constant.Zone.Battlefield)) {
|
||||
for (final String keyword : card.getKeyword()) {
|
||||
if (keyword.equals("No more than one creature can attack each combat.") && cntAttackers > 0 ) {
|
||||
if (keyword.equals("No more than one creature can attack each combat.") && cntAttackers > 0) {
|
||||
return false;
|
||||
}
|
||||
if (keyword.equals("No more than two creatures can attack each combat.") && cntAttackers > 1) {
|
||||
|
||||
@@ -227,7 +227,7 @@ public class ComputerAIGeneral implements Computer {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the spellAbilities from the card list
|
||||
* Returns the spellAbilities from the card list.
|
||||
*
|
||||
* @param l
|
||||
* a {@link forge.CardList} object.
|
||||
|
||||
@@ -199,9 +199,10 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
|
||||
@Override
|
||||
public final void setCards(final Iterable<Card> cards) {
|
||||
List<Card> toSet = new ArrayList<Card>();
|
||||
for(Card c : cards)
|
||||
for (Card c : cards) {
|
||||
toSet.add(c);
|
||||
this.setCardList( toSet );
|
||||
}
|
||||
this.setCardList(toSet);
|
||||
this.update();
|
||||
}
|
||||
|
||||
@@ -313,7 +314,7 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
|
||||
* @return an array of {@link forge.Card} objects.
|
||||
*/
|
||||
@Override
|
||||
public final List<Card>getCards() {
|
||||
public final List<Card> getCards() {
|
||||
return this.getCards(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -353,12 +353,13 @@ public class PlayerZoneComesIntoPlay extends DefaultPlayerZone {
|
||||
// Battlefield filters out Phased Out cards by default. Needs to call
|
||||
// getCards(false) to get Phased Out cards
|
||||
|
||||
if (!filter)
|
||||
if (!filter) {
|
||||
return new ArrayList<Card>(this.getCardList());
|
||||
}
|
||||
|
||||
final ArrayList<Card> list = new ArrayList<Card>();
|
||||
for(Card crd : this.getCardList())
|
||||
{
|
||||
for (Card crd : this.getCardList()) {
|
||||
|
||||
if (!crd.isPhasedOut()) {
|
||||
list.add(crd);
|
||||
}
|
||||
|
||||
@@ -282,7 +282,7 @@ public class SpellPermanent extends Spell {
|
||||
if (card.getSVar("PlayMain1").equals("TRUE")) {
|
||||
wait = false;
|
||||
}
|
||||
if ((card.isCreature() && (ComputerAIGeneral.hasACardGivingHaste()
|
||||
if ((card.isCreature() && (ComputerAIGeneral.hasACardGivingHaste()
|
||||
|| card.hasKeyword("Haste"))) || card.hasKeyword("Exalted")) {
|
||||
wait = false;
|
||||
}
|
||||
@@ -348,7 +348,7 @@ public class SpellPermanent extends Spell {
|
||||
|
||||
return canPlayFromEffectAI(false, true);
|
||||
} // canPlayAI()
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public boolean canPlayFromEffectAI(final boolean mandatory, final boolean withOutManaCost) {
|
||||
|
||||
Reference in New Issue
Block a user