mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
Checkstyle
This commit is contained in:
@@ -61,8 +61,9 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
|
||||
/**
|
||||
* Sets the state.
|
||||
*
|
||||
* @param state the state
|
||||
*
|
||||
* @param state
|
||||
* the state
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean setState(final String state) {
|
||||
@@ -85,7 +86,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
|
||||
/**
|
||||
* Gets the states.
|
||||
*
|
||||
*
|
||||
* @return the states
|
||||
*/
|
||||
public Set<String> getStates() {
|
||||
@@ -94,7 +95,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
|
||||
/**
|
||||
* Gets the cur state.
|
||||
*
|
||||
*
|
||||
* @return the cur state
|
||||
*/
|
||||
public String getCurState() {
|
||||
@@ -103,9 +104,11 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
|
||||
/**
|
||||
* Switch states.
|
||||
*
|
||||
* @param from the from
|
||||
* @param to the to
|
||||
*
|
||||
* @param from
|
||||
* the from
|
||||
* @param to
|
||||
* the to
|
||||
*/
|
||||
public void switchStates(final String from, final String to) {
|
||||
final CardCharacteristics tmp = this.characteristicsMap.get(from);
|
||||
@@ -115,8 +118,9 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
|
||||
/**
|
||||
* Clear states.
|
||||
*
|
||||
* @param state the state
|
||||
*
|
||||
* @param state
|
||||
* the state
|
||||
*/
|
||||
public void clearStates(final String state) {
|
||||
this.characteristicsMap.remove(state);
|
||||
@@ -124,30 +128,34 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
|
||||
/**
|
||||
* Turn face down.
|
||||
*
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean turnFaceDown() {
|
||||
if (!this.isDoubleFaced) {
|
||||
this.preTFDCharacteristic = this.curCharacteristics;
|
||||
return this.setState("FaceDown");
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turn face up.
|
||||
*
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean turnFaceUp() {
|
||||
if (this.curCharacteristics.equals("FaceDown")) {
|
||||
return this.setState(this.preTFDCharacteristic);
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is cloned.
|
||||
*
|
||||
*
|
||||
* @return true, if is cloned
|
||||
*/
|
||||
public boolean isCloned() {
|
||||
@@ -161,8 +169,9 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
|
||||
/**
|
||||
* Gets the state.
|
||||
*
|
||||
* @param state the state
|
||||
*
|
||||
* @param state
|
||||
* the state
|
||||
* @return the state
|
||||
*/
|
||||
public CardCharacteristics getState(final String state) {
|
||||
@@ -180,8 +189,9 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
|
||||
/**
|
||||
* addAlternateState.
|
||||
*
|
||||
* @param state the state
|
||||
*
|
||||
* @param state
|
||||
* the state
|
||||
*/
|
||||
public final void addAlternateState(final String state) {
|
||||
this.characteristicsMap.put(state, new CardCharacteristics());
|
||||
@@ -2901,7 +2911,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
|
||||
/**
|
||||
* Gets the regenerated this turn.
|
||||
*
|
||||
*
|
||||
* @return the regenerated this turn
|
||||
*/
|
||||
public final int getRegeneratedThisTurn() {
|
||||
@@ -2910,8 +2920,9 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
|
||||
/**
|
||||
* Sets the regenerated this turn.
|
||||
*
|
||||
* @param n the new regenerated this turn
|
||||
*
|
||||
* @param n
|
||||
* the new regenerated this turn
|
||||
*/
|
||||
public final void setRegeneratedThisTurn(final int n) {
|
||||
this.regeneratedThisTurn = n;
|
||||
@@ -8089,7 +8100,9 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
this.getCharacteristics().setCardColorsOverridden(cardColorsOverridden0);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see forge.GameEntity#hasProtectionFrom(forge.Card)
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -342,7 +342,7 @@ public class ComputerUtilAttack {
|
||||
remainingAttackers.remove(blockableAttackers.get(i));
|
||||
}
|
||||
|
||||
if ((CombatUtil.sumDamageIfUnblocked(remainingAttackers, human) > human.getLife())
|
||||
if ((CombatUtil.sumDamageIfUnblocked(remainingAttackers, human) > human.getLife())
|
||||
&& AllZone.getHumanPlayer().canLoseLife()
|
||||
&& !((human.cantLoseForZeroOrLessLife() || human.cantLose() || computer.cantWin()) && human.getLife() < 1)) {
|
||||
return true;
|
||||
|
||||
@@ -186,8 +186,8 @@ public class AbilityFactorySetState {
|
||||
tgtCards = AbilityFactory.getDefinedCards(abilityFactory.getHostCard(),
|
||||
abilityFactory.getMapParams().get("Defined"), sa);
|
||||
}
|
||||
|
||||
boolean remChanged = abilityFactory.getMapParams().containsKey("RememberChanged");
|
||||
|
||||
final boolean remChanged = abilityFactory.getMapParams().containsKey("RememberChanged");
|
||||
|
||||
for (final Card tgt : tgtCards) {
|
||||
if (abilityFactory.getAbTgt() != null) {
|
||||
@@ -195,48 +195,43 @@ public class AbilityFactorySetState {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
String mode = abilityFactory.getMapParams().get("Mode");
|
||||
final String mode = abilityFactory.getMapParams().get("Mode");
|
||||
if (mode != null) {
|
||||
if(mode.equals("Transform")) {
|
||||
if(tgt.isDoubleFaced()) {
|
||||
if(tgt.getCurState().equals("Original")) {
|
||||
if(tgt.setState("Transformed") && remChanged) {
|
||||
if (mode.equals("Transform")) {
|
||||
if (tgt.isDoubleFaced()) {
|
||||
if (tgt.getCurState().equals("Original")) {
|
||||
if (tgt.setState("Transformed") && remChanged) {
|
||||
abilityFactory.getHostCard().addRemembered(tgt);
|
||||
}
|
||||
}
|
||||
else if(tgt.getCurState().equals("Transformed")) {
|
||||
if(tgt.setState("Original") && remChanged) {
|
||||
} else if (tgt.getCurState().equals("Transformed")) {
|
||||
if (tgt.setState("Original") && remChanged) {
|
||||
abilityFactory.getHostCard().addRemembered(tgt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(mode.equals("Flip")) {
|
||||
if(tgt.isFlip()) {
|
||||
if(tgt.getCurState().equals("Original")) {
|
||||
if(tgt.setState("Flipped") && remChanged) {
|
||||
} else if (mode.equals("Flip")) {
|
||||
if (tgt.isFlip()) {
|
||||
if (tgt.getCurState().equals("Original")) {
|
||||
if (tgt.setState("Flipped") && remChanged) {
|
||||
abilityFactory.getHostCard().addRemembered(tgt);
|
||||
}
|
||||
}
|
||||
else if(tgt.getCurState().equals("Flipped")) {
|
||||
if(tgt.setState("Original") && remChanged) {
|
||||
} else if (tgt.getCurState().equals("Flipped")) {
|
||||
if (tgt.setState("Original") && remChanged) {
|
||||
abilityFactory.getHostCard().addRemembered(tgt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(mode.equals("TurnFace")) {
|
||||
if(tgt.getCurState().equals("Original")) {
|
||||
if(tgt.turnFaceDown() && remChanged) {
|
||||
} else if (mode.equals("TurnFace")) {
|
||||
if (tgt.getCurState().equals("Original")) {
|
||||
if (tgt.turnFaceDown() && remChanged) {
|
||||
abilityFactory.getHostCard().addRemembered(tgt);
|
||||
}
|
||||
} else if (tgt.getCurState().equals("FaceDown")) {
|
||||
if (tgt.turnFaceUp() && remChanged) {
|
||||
abilityFactory.getHostCard().addRemembered(tgt);
|
||||
}
|
||||
}
|
||||
else if(tgt.getCurState().equals("FaceDown")) {
|
||||
if(tgt.turnFaceUp() && remChanged) {
|
||||
abilityFactory.getHostCard().addRemembered(tgt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tgt.setState(abilityFactory.getMapParams().get("NewState"));
|
||||
}
|
||||
@@ -384,48 +379,43 @@ public class AbilityFactorySetState {
|
||||
}
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
String mode = abilityFactory.getMapParams().get("Mode");
|
||||
final String mode = abilityFactory.getMapParams().get("Mode");
|
||||
if (mode != null) {
|
||||
if(mode.equals("Transform")) {
|
||||
if(list.get(i).isDoubleFaced()) {
|
||||
if(list.get(i).getCurState().equals("Original")) {
|
||||
if(list.get(i).setState("Transformed") && remChanged) {
|
||||
if (mode.equals("Transform")) {
|
||||
if (list.get(i).isDoubleFaced()) {
|
||||
if (list.get(i).getCurState().equals("Original")) {
|
||||
if (list.get(i).setState("Transformed") && remChanged) {
|
||||
abilityFactory.getHostCard().addRemembered(tgt);
|
||||
}
|
||||
}
|
||||
else if(list.get(i).getCurState().equals("Transformed")) {
|
||||
if(list.get(i).setState("Original") && remChanged) {
|
||||
} else if (list.get(i).getCurState().equals("Transformed")) {
|
||||
if (list.get(i).setState("Original") && remChanged) {
|
||||
abilityFactory.getHostCard().addRemembered(tgt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(mode.equals("Flip")) {
|
||||
if(list.get(i).isFlip()) {
|
||||
if(list.get(i).getCurState().equals("Original")) {
|
||||
if(list.get(i).setState("Flipped") && remChanged) {
|
||||
} else if (mode.equals("Flip")) {
|
||||
if (list.get(i).isFlip()) {
|
||||
if (list.get(i).getCurState().equals("Original")) {
|
||||
if (list.get(i).setState("Flipped") && remChanged) {
|
||||
abilityFactory.getHostCard().addRemembered(tgt);
|
||||
}
|
||||
}
|
||||
else if(list.get(i).getCurState().equals("Flipped")) {
|
||||
if(list.get(i).setState("Original") && remChanged) {
|
||||
} else if (list.get(i).getCurState().equals("Flipped")) {
|
||||
if (list.get(i).setState("Original") && remChanged) {
|
||||
abilityFactory.getHostCard().addRemembered(tgt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(mode.equals("TurnFace")) {
|
||||
if(list.get(i).getCurState().equals("Original")) {
|
||||
if(list.get(i).turnFaceDown() && remChanged) {
|
||||
} else if (mode.equals("TurnFace")) {
|
||||
if (list.get(i).getCurState().equals("Original")) {
|
||||
if (list.get(i).turnFaceDown() && remChanged) {
|
||||
abilityFactory.getHostCard().addRemembered(tgt);
|
||||
}
|
||||
} else if (list.get(i).getCurState().equals("FaceDown")) {
|
||||
if (list.get(i).turnFaceUp() && remChanged) {
|
||||
abilityFactory.getHostCard().addRemembered(tgt);
|
||||
}
|
||||
}
|
||||
else if(list.get(i).getCurState().equals("FaceDown")) {
|
||||
if(list.get(i).turnFaceUp() && remChanged) {
|
||||
abilityFactory.getHostCard().addRemembered(tgt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
list.get(i).setState(abilityFactory.getMapParams().get("NewState"));
|
||||
}
|
||||
@@ -447,8 +437,7 @@ public class AbilityFactorySetState {
|
||||
|
||||
if (params.containsKey("Mode")) {
|
||||
sb.append(params.get("Mode"));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
sb.append(params.get("NewState"));
|
||||
}
|
||||
|
||||
|
||||
@@ -1156,7 +1156,7 @@ public class AbilityFactoryZoneAffecting {
|
||||
p.discard(c, sa);
|
||||
discarded.add(c);
|
||||
}
|
||||
} else if (mode.equals("RevealYouChoose") || mode.equals("RevealOppChoose")
|
||||
} else if (mode.equals("RevealYouChoose") || mode.equals("RevealOppChoose")
|
||||
|| mode.equals("TgtChoose")) {
|
||||
// Is Reveal you choose right? I think the wrong player is
|
||||
// being used?
|
||||
@@ -1173,7 +1173,7 @@ public class AbilityFactoryZoneAffecting {
|
||||
Player chooser = p;
|
||||
if (mode.equals("RevealYouChoose")) {
|
||||
chooser = source.getController();
|
||||
} else if (mode.equals("RevealOppChoose")){
|
||||
} else if (mode.equals("RevealOppChoose")) {
|
||||
chooser = source.getController().getOpponent();
|
||||
}
|
||||
|
||||
@@ -1200,7 +1200,7 @@ public class AbilityFactoryZoneAffecting {
|
||||
|
||||
final Card dC = dChoices.get(CardUtil.getRandomIndex(dChoices));
|
||||
dPChHand.remove(dC);
|
||||
|
||||
|
||||
if (mode.startsWith("Reveal")) {
|
||||
final CardList dCs = new CardList();
|
||||
dCs.add(dC);
|
||||
|
||||
@@ -493,7 +493,7 @@ public abstract class AbstractCardFactory implements CardFactoryInterface {
|
||||
CardFactoryUtil.parseKeywords(card, cardName);
|
||||
|
||||
for (final String state : card.getStates()) {
|
||||
if(card.isDoubleFaced() && state.equals("FaceDown")) {
|
||||
if (card.isDoubleFaced() && state.equals("FaceDown")) {
|
||||
continue; //Ignore FaceDown for DFC since they have none.
|
||||
}
|
||||
card.setState(state);
|
||||
|
||||
@@ -4172,7 +4172,7 @@ public class CardFactoryUtil {
|
||||
public static Card copyStats(final Object o) {
|
||||
final Card sim = (Card) o;
|
||||
final Card c = new Card();
|
||||
|
||||
|
||||
c.setFlip(sim.isFlip());
|
||||
c.setDoubleFaced(sim.isDoubleFaced());
|
||||
c.setCurSetCode(sim.getCurSetCode());
|
||||
@@ -4186,7 +4186,7 @@ public class CardFactoryUtil {
|
||||
}
|
||||
|
||||
sim.setState(origState);
|
||||
c.setState(origState);
|
||||
c.setState(origState);
|
||||
|
||||
return c;
|
||||
} // copyStats()
|
||||
|
||||
@@ -82,7 +82,7 @@ public class TriggerHandler {
|
||||
* </p>
|
||||
*/
|
||||
public final void clearDelayedTrigger() {
|
||||
delayedTriggers.clear();
|
||||
this.delayedTriggers.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -291,16 +291,16 @@ public class TriggerHandler {
|
||||
// triggers are running.
|
||||
final ArrayList<Trigger> delayedTriggersWorkingCopy = new ArrayList<Trigger>(this.delayedTriggers);
|
||||
CardList allCards = AllZoneUtil.getCardsInGame();
|
||||
|
||||
//Static triggers
|
||||
for(final Card c : allCards) {
|
||||
for(final Trigger t : c.getTriggers()) {
|
||||
if(t.getMapParams().containsKey("Static")) {
|
||||
this.runSingleTrigger(t, mode, runParams);
|
||||
|
||||
// Static triggers
|
||||
for (final Card c : allCards) {
|
||||
for (final Trigger t : c.getTriggers()) {
|
||||
if (t.getMapParams().containsKey("Static")) {
|
||||
this.runSingleTrigger(t, mode, runParams);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.suppressMode("Always");
|
||||
AllZone.getGameAction().checkStateEffects(true);
|
||||
this.clearSuppression("Always");
|
||||
@@ -310,8 +310,8 @@ public class TriggerHandler {
|
||||
allCards.addAll(AllZoneUtil.getCardsIn(Constant.Zone.Stack).getController(playerAP));
|
||||
for (final Card c : allCards) {
|
||||
for (final Trigger t : c.getTriggers()) {
|
||||
if(!t.getMapParams().containsKey("Static")) {
|
||||
this.runSingleTrigger(t, mode, runParams);
|
||||
if (!t.getMapParams().containsKey("Static")) {
|
||||
this.runSingleTrigger(t, mode, runParams);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -331,8 +331,8 @@ public class TriggerHandler {
|
||||
allCards.addAll(AllZoneUtil.getCardsIn(Constant.Zone.Stack).getController(playerAP.getOpponent()));
|
||||
for (final Card c : allCards) {
|
||||
for (final Trigger t : c.getTriggers()) {
|
||||
if(!t.getMapParams().containsKey("Static")) {
|
||||
this.runSingleTrigger(t, mode, runParams);
|
||||
if (!t.getMapParams().containsKey("Static")) {
|
||||
this.runSingleTrigger(t, mode, runParams);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user