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