mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
- Some Checkstyle fixes in SA_Restriction
This commit is contained in:
@@ -44,37 +44,44 @@ public class SpellAbility_Restriction extends SpellAbility_Variables {
|
||||
if (value.startsWith("Prowl")) {
|
||||
ArrayList<String> prowlTypes = new ArrayList<String>();
|
||||
prowlTypes.add("Rogue");
|
||||
if(value.split("Prowl").length > 1) {
|
||||
if (value.split("Prowl").length > 1) {
|
||||
prowlTypes.add(value.split("Prowl")[1]);
|
||||
}
|
||||
setProwl(prowlTypes);
|
||||
}
|
||||
}
|
||||
|
||||
if (params.containsKey("ActivationZone"))
|
||||
if (params.containsKey("ActivationZone")) {
|
||||
setZone(Zone.smartValueOf(params.get("ActivationZone")));
|
||||
}
|
||||
|
||||
if (params.containsKey("Flashback")) {
|
||||
setZone(Zone.Graveyard);
|
||||
}
|
||||
|
||||
if (params.containsKey("SorcerySpeed"))
|
||||
if (params.containsKey("SorcerySpeed")) {
|
||||
setSorcerySpeed(true);
|
||||
}
|
||||
|
||||
if (params.containsKey("PlayerTurn"))
|
||||
if (params.containsKey("PlayerTurn")) {
|
||||
setPlayerTurn(true);
|
||||
}
|
||||
|
||||
if (params.containsKey("OpponentTurn"))
|
||||
if (params.containsKey("OpponentTurn")) {
|
||||
setOpponentTurn(true);
|
||||
}
|
||||
|
||||
if (params.containsKey("AnyPlayer"))
|
||||
if (params.containsKey("AnyPlayer")) {
|
||||
setAnyPlayer(true);
|
||||
}
|
||||
|
||||
if (params.containsKey("ActivationLimit"))
|
||||
if (params.containsKey("ActivationLimit")) {
|
||||
setActivationLimit(Integer.parseInt(params.get("ActivationLimit")));
|
||||
}
|
||||
|
||||
if (params.containsKey("ActivationNumberSacrifice"))
|
||||
if (params.containsKey("ActivationNumberSacrifice")) {
|
||||
setActivationNumberSacrifice(Integer.parseInt(params.get("ActivationNumberSacrifice")));
|
||||
}
|
||||
|
||||
if (params.containsKey("ActivationPhases")) {
|
||||
String phases = params.get("ActivationPhases");
|
||||
@@ -92,18 +99,22 @@ public class SpellAbility_Restriction extends SpellAbility_Variables {
|
||||
setPhases(phases);
|
||||
}
|
||||
|
||||
if (params.containsKey("ActivationCardsInHand"))
|
||||
if (params.containsKey("ActivationCardsInHand")) {
|
||||
setActivateCardsInHand(Integer.parseInt(params.get("ActivationCardsInHand")));
|
||||
}
|
||||
|
||||
if (params.containsKey("Planeswalker"))
|
||||
if (params.containsKey("Planeswalker")) {
|
||||
setPlaneswalker(true);
|
||||
}
|
||||
|
||||
if (params.containsKey("IsPresent")) {
|
||||
setIsPresent(params.get("IsPresent"));
|
||||
if (params.containsKey("PresentCompare"))
|
||||
if (params.containsKey("PresentCompare")) {
|
||||
setPresentCompare(params.get("PresentCompare"));
|
||||
if (params.containsKey("PresentZone"))
|
||||
setPresentZone(Zone.smartValueOf(params.get("PresentZone")));
|
||||
}
|
||||
if (params.containsKey("PresentZone")) {
|
||||
setPresentZone(Zone.smartValueOf(params.get("PresentZone")));
|
||||
}
|
||||
}
|
||||
|
||||
if (params.containsKey("IsNotPresent")) {
|
||||
@@ -126,7 +137,7 @@ public class SpellAbility_Restriction extends SpellAbility_Variables {
|
||||
setSvarOperator(params.get("SVarCompare").substring(0, 2));
|
||||
setSvarOperand(params.get("SVarCompare").substring(2));
|
||||
}
|
||||
}//end setRestrictions()
|
||||
} //end setRestrictions()
|
||||
|
||||
/**
|
||||
* <p>canPlay.</p>
|
||||
@@ -137,7 +148,7 @@ public class SpellAbility_Restriction extends SpellAbility_Variables {
|
||||
*/
|
||||
public boolean canPlay(Card c, SpellAbility sa) {
|
||||
if (!AllZone.getZoneOf(c).is(zone) || c.isPhasedOut())
|
||||
return false;
|
||||
return false;
|
||||
|
||||
Player activator = sa.getActivatingPlayer();
|
||||
if (activator == null) {
|
||||
@@ -145,20 +156,25 @@ public class SpellAbility_Restriction extends SpellAbility_Variables {
|
||||
System.out.println(c.getName() + " Did not have activator set in SpellAbility_Restriction.canPlay()");
|
||||
}
|
||||
|
||||
if (bSorcerySpeed && !Phase.canCastSorcery(activator))
|
||||
if (bSorcerySpeed && !Phase.canCastSorcery(activator)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (bPlayerTurn && !AllZone.getPhase().isPlayerTurn(activator))
|
||||
if (bPlayerTurn && !AllZone.getPhase().isPlayerTurn(activator)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (bOpponentTurn && AllZone.getPhase().isPlayerTurn(activator))
|
||||
if (bOpponentTurn && AllZone.getPhase().isPlayerTurn(activator)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!bAnyPlayer && !activator.equals(c.getController()))
|
||||
if (!bAnyPlayer && !activator.equals(c.getController())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (activationLimit != -1 && numberTurnActivations >= activationLimit)
|
||||
if (activationLimit != -1 && numberTurnActivations >= activationLimit) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (phases.size() > 0) {
|
||||
boolean isPhase = false;
|
||||
@@ -170,25 +186,30 @@ public class SpellAbility_Restriction extends SpellAbility_Variables {
|
||||
}
|
||||
}
|
||||
|
||||
if (!isPhase)
|
||||
if (!isPhase) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (nCardsInHand != -1) {
|
||||
if (activator.getCardsIn(Zone.Hand).size() != nCardsInHand)
|
||||
if (activator.getCardsIn(Zone.Hand).size() != nCardsInHand) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (hellbent) {
|
||||
if (!activator.hasHellbent())
|
||||
if (!activator.hasHellbent()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (threshold) {
|
||||
if (!activator.hasThreshold())
|
||||
if (!activator.hasThreshold()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (metalcraft) {
|
||||
if (!activator.hasMetalcraft())
|
||||
if (!activator.hasMetalcraft()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (prowl != null) {
|
||||
//only true if the activating player has damaged the opponent with one of the specified types
|
||||
@@ -216,8 +237,9 @@ public class SpellAbility_Restriction extends SpellAbility_Variables {
|
||||
}
|
||||
int left = list.size();
|
||||
|
||||
if (!AllZoneUtil.compare(left, presentCompare, right))
|
||||
if (!AllZoneUtil.compare(left, presentCompare, right)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (lifeTotal != null) {
|
||||
@@ -244,14 +266,16 @@ public class SpellAbility_Restriction extends SpellAbility_Variables {
|
||||
|
||||
if (pwAbility) {
|
||||
// Planeswalker abilities can only be activated as Sorceries
|
||||
if (!Phase.canCastSorcery(activator))
|
||||
if (!Phase.canCastSorcery(activator)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (SpellAbility pwAbs : c.getSpellAbility()) {
|
||||
// check all abilities on card that have their planeswalker restriction set to confirm they haven't been activated
|
||||
SpellAbility_Restriction restrict = pwAbs.getRestrictions();
|
||||
if (restrict.getPlaneswalker() && restrict.getNumberTurnActivations() > 0)
|
||||
if (restrict.getPlaneswalker() && restrict.getNumberTurnActivations() > 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,12 +283,13 @@ public class SpellAbility_Restriction extends SpellAbility_Variables {
|
||||
int svarValue = AbilityFactory.calculateAmount(c, svarToCheck, sa);
|
||||
int operandValue = AbilityFactory.calculateAmount(c, svarOperand, sa);
|
||||
|
||||
if (!AllZoneUtil.compare(svarValue, svarOperator, operandValue))
|
||||
if (!AllZoneUtil.compare(svarValue, svarOperator, operandValue)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}//canPlay()
|
||||
} //canPlay()
|
||||
|
||||
}//end class SpellAbility_Restriction
|
||||
} //end class SpellAbility_Restriction
|
||||
|
||||
Reference in New Issue
Block a user