mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 02:38:02 +00:00
Clean up
This commit is contained in:
@@ -1468,7 +1468,7 @@ public class AiAttackController {
|
||||
if (artifact != null) {
|
||||
return artifact;
|
||||
}
|
||||
return null;//should never get here
|
||||
return null; //should never get here
|
||||
}
|
||||
|
||||
private void doLightmineFieldAttackLogic(List<Card> attackersLeft, int numForcedAttackers, boolean playAggro) {
|
||||
|
||||
@@ -770,7 +770,7 @@ public class ComputerUtil {
|
||||
final int considerSacThreshold = getAIPreferenceParameter(host, "CreatureEvalThreshold", source);
|
||||
|
||||
if ("OpponentOnly".equals(source.getParam("AILogic"))) {
|
||||
if(!source.getActivatingPlayer().isOpponentOf(ai)) {
|
||||
if (!source.getActivatingPlayer().isOpponentOf(ai)) {
|
||||
return sacrificed; // sacrifice none
|
||||
}
|
||||
} else if ("DesecrationDemon".equals(source.getParam("AILogic"))) {
|
||||
|
||||
@@ -72,7 +72,7 @@ public class ComputerUtilAbility {
|
||||
if (!player.getCardsIn(ZoneType.Library).isEmpty()) {
|
||||
all.add(player.getCardsIn(ZoneType.Library).get(0));
|
||||
}
|
||||
for(Player p : game.getPlayers()) {
|
||||
for (Player p : game.getPlayers()) {
|
||||
all.addAll(p.getCardsIn(ZoneType.Exile));
|
||||
all.addAll(p.getCardsIn(ZoneType.Battlefield));
|
||||
}
|
||||
|
||||
@@ -436,7 +436,7 @@ public class ComputerUtilCard {
|
||||
// For ability of Oracle en-Vec, return the first card that are going to attack next turn
|
||||
public static Card getBestCreatureToAttackNextTurnAI(final Player aiPlayer, final Iterable<Card> list) {
|
||||
AiController aic = ((PlayerControllerAi)aiPlayer.getController()).getAi();
|
||||
for(final Card card : list) {
|
||||
for (final Card card : list) {
|
||||
if (aic.getPredictedCombatNextTurn().isAttacking(card)) {
|
||||
return card;
|
||||
}
|
||||
@@ -832,7 +832,7 @@ public class ComputerUtilCard {
|
||||
}
|
||||
}
|
||||
// same for Trigger that does make Tokens
|
||||
for(Trigger t:c.getTriggers()){
|
||||
for (Trigger t :c .getTriggers()) {
|
||||
SpellAbility sa = t.ensureAbility();
|
||||
if (sa != null) {
|
||||
if (sa.getApi() != ApiType.Token || !sa.hasParam("TokenTypes")) {
|
||||
@@ -851,7 +851,7 @@ public class ComputerUtilCard {
|
||||
}
|
||||
}
|
||||
// special rule for Fabricate and Servo
|
||||
if(c.hasStartOfKeyword(Keyword.FABRICATE.toString())){
|
||||
if (c.hasStartOfKeyword(Keyword.FABRICATE.toString())) {
|
||||
Integer count = typesInDeck.get("Servo");
|
||||
if (count == null) {
|
||||
count = 0;
|
||||
@@ -1694,7 +1694,7 @@ public class ComputerUtilCard {
|
||||
pumped.addHiddenExtrinsicKeywords(timestamp, 0, hiddenKws);
|
||||
}
|
||||
Set<CounterType> types = c.getCounters().keySet();
|
||||
for(CounterType ct : types) {
|
||||
for (CounterType ct : types) {
|
||||
pumped.addCounterFireNoEvents(ct, c.getCounters(ct), ai, sa, true, null);
|
||||
}
|
||||
//Copies tap-state and extra keywords (auras, equipment, etc.)
|
||||
|
||||
@@ -671,7 +671,6 @@ public class ComputerUtilCombat {
|
||||
|
||||
int flankingMagnitude = 0;
|
||||
if (attacker.hasKeyword(Keyword.FLANKING) && !blocker.hasKeyword(Keyword.FLANKING)) {
|
||||
|
||||
flankingMagnitude = attacker.getAmountOfKeyword(Keyword.FLANKING);
|
||||
|
||||
if (flankingMagnitude >= blocker.getNetToughness()) {
|
||||
|
||||
@@ -361,8 +361,7 @@ public class PlayerControllerAi extends PlayerController {
|
||||
for (Card c: topN) {
|
||||
if (ComputerUtil.scryWillMoveCardToBottomOfLibrary(player, c)) {
|
||||
toBottom.add(c);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
toTop.add(c);
|
||||
}
|
||||
}
|
||||
@@ -525,8 +524,7 @@ public class PlayerControllerAi extends PlayerController {
|
||||
if (copySA instanceof Spell) {
|
||||
Spell spell = (Spell) copySA;
|
||||
((PlayerControllerAi) player.getController()).getAi().canPlayFromEffectAI(spell, true, true);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
getAi().canPlaySa(copySA);
|
||||
}
|
||||
}
|
||||
@@ -884,9 +882,8 @@ public class PlayerControllerAi extends PlayerController {
|
||||
byte chosenColorMask = MagicColor.fromName(c);
|
||||
if ((colors.getColor() & chosenColorMask) != 0) {
|
||||
return chosenColorMask;
|
||||
} else {
|
||||
return Iterables.getFirst(colors, (byte)0);
|
||||
}
|
||||
return Iterables.getFirst(colors, (byte)0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -905,10 +902,8 @@ public class PlayerControllerAi extends PlayerController {
|
||||
if ((colors.getColor() & chosenColorMask) != 0) {
|
||||
return chosenColorMask;
|
||||
}
|
||||
else {
|
||||
return Iterables.getFirst(colors, MagicColor.WHITE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICardFace chooseSingleCardFace(SpellAbility sa, String message,
|
||||
@@ -1370,8 +1365,7 @@ public class PlayerControllerAi extends PlayerController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int chooseNumberForKeywordCost(SpellAbility sa, Cost cost, KeywordInterface keyword, String prompt,
|
||||
int max) {
|
||||
public int chooseNumberForKeywordCost(SpellAbility sa, Cost cost, KeywordInterface keyword, String prompt, int max) {
|
||||
// TODO: improve the logic depending on the keyword and the playability of the cost-modified SA (enough targets present etc.)
|
||||
int chosenAmount = 0;
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ public class CharmAi extends SpellAbilityAi {
|
||||
} else if (ai.canGainLife() && aiLife <= 5) {
|
||||
// critical Life try to gain more
|
||||
chosenList.add(gain);
|
||||
} else if(!ai.canGainLife() && aiLife == 14 ) {
|
||||
} else if (!ai.canGainLife() && aiLife == 14 ) {
|
||||
// ai cant gain life, but try to avoid falling to 13
|
||||
// but if a opponent does control Tainted Remedy its irrelevant
|
||||
chosenList.add(oppTainted ? lose : gain);
|
||||
|
||||
@@ -419,15 +419,15 @@ public class CountersPutAi extends SpellAbilityAi {
|
||||
oa.setActivatingPlayer(ai);
|
||||
CardCollection targets = CardLists.getTargetableCards(ai.getOpponents().getCreaturesInPlay(), oa);
|
||||
|
||||
if (!targets.isEmpty()){
|
||||
if (!targets.isEmpty()) {
|
||||
boolean canSurvive = false;
|
||||
for (Card humanCreature : targets) {
|
||||
if (!FightAi.canKill(humanCreature, source, 0)){
|
||||
if (!FightAi.canKill(humanCreature, source, 0)) {
|
||||
canSurvive = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!canSurvive){
|
||||
if (!canSurvive) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ public class DamageDealAi extends DamageAiBase {
|
||||
dmg = 2;
|
||||
} else if ("OpponentHasCreatures".equals(logic)) {
|
||||
for (Player opp : ai.getOpponents()) {
|
||||
if (!opp.getCreaturesInPlay().isEmpty()){
|
||||
if (!opp.getCreaturesInPlay().isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -287,7 +287,7 @@ public class DamageDealAi extends DamageAiBase {
|
||||
}
|
||||
|
||||
if ((damage.equals("X") && sa.getSVar(damage).equals("Count$xPaid")) ||
|
||||
sourceName.equals("Crater's Claws")){
|
||||
sourceName.equals("Crater's Claws")) {
|
||||
// If I can kill my target by paying less mana, do it
|
||||
if (sa.usesTargeting() && !sa.getTargets().isTargetingAnyPlayer() && !sa.isDividedAsYouChoose()) {
|
||||
int actualPay = dmg;
|
||||
@@ -330,7 +330,6 @@ public class DamageDealAi extends DamageAiBase {
|
||||
*/
|
||||
private Card dealDamageChooseTgtC(final Player ai, final SpellAbility sa, final int d, final boolean noPrevention,
|
||||
final Player pl, final boolean mandatory) {
|
||||
|
||||
// wait until stack is empty (prevents duplicate kills)
|
||||
if (!sa.isTrigger() && !ai.getGame().getStack().isEmpty()) {
|
||||
//TODO:all removal APIs require a check to prevent duplicate kill/bounce/exile/etc.
|
||||
@@ -345,7 +344,7 @@ public class DamageDealAi extends DamageAiBase {
|
||||
final Player activator = sa.getActivatingPlayer();
|
||||
final Card source = sa.getHostCard();
|
||||
final Game game = source.getGame();
|
||||
List<Card> hPlay = getTargetableCards(ai, sa, pl, tgt, activator, source, game);
|
||||
List<Card> hPlay = getTargetableCards(mandatory ? pl : ai, sa, pl, tgt, activator, source, game);
|
||||
|
||||
// Filter MustTarget requirements
|
||||
StaticAbilityMustTarget.filterMustTargetCards(ai, hPlay, sa);
|
||||
@@ -531,7 +530,7 @@ public class DamageDealAi extends DamageAiBase {
|
||||
|
||||
if ("PowerDmg".equals(logic)) {
|
||||
// check if it is better to target the player instead, the original target is already set in PumpAi.pumpTgtAI()
|
||||
if (tgt.canTgtCreatureAndPlayer() && shouldTgtP(ai, sa, dmg, noPrevention)){
|
||||
if (tgt.canTgtCreatureAndPlayer() && shouldTgtP(ai, sa, dmg, noPrevention)) {
|
||||
sa.resetTargets();
|
||||
sa.getTargets().add(enemy);
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ public class DelayedTriggerAi extends SpellAbilityAi {
|
||||
}
|
||||
});
|
||||
|
||||
if(count == 0) {
|
||||
if (count == 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -114,7 +114,7 @@ public class RearrangeTopOfLibraryAi extends SpellAbilityAi {
|
||||
if (!top.isLand() && cmc - maxCastable >= uncastableCMCThreshold) {
|
||||
// Can't cast in the foreseeable future. Shuffle if doing it to ourselves or an ally, otherwise keep it
|
||||
return !p.isOpponentOf(player);
|
||||
} else if (top.isLand() && landsOTB <= minLandsToScryLandsAway){
|
||||
} else if (top.isLand() && landsOTB <= minLandsToScryLandsAway) {
|
||||
// We don't want to give the opponent a free land if his land count is low
|
||||
return p.isOpponentOf(player);
|
||||
}
|
||||
|
||||
@@ -52,14 +52,14 @@ public class RepeatEachAi extends SpellAbilityAi {
|
||||
}
|
||||
} else if ("OpponentHasCreatures".equals(logic)) { //TODO convert this to NeedsToPlayVar
|
||||
for (Player opp : aiPlayer.getOpponents()) {
|
||||
if (!opp.getCreaturesInPlay().isEmpty()){
|
||||
if (!opp.getCreaturesInPlay().isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} else if ("OpponentHasMultipleCreatures".equals(logic)) {
|
||||
for (Player opp : aiPlayer.getOpponents()) {
|
||||
if (opp.getCreaturesInPlay().size() > 1){
|
||||
if (opp.getCreaturesInPlay().size() > 1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public class SetStateAi extends SpellAbilityAi {
|
||||
final String logic = sa.getParamOrDefault("AILogic", "");
|
||||
final Game game = source.getGame();
|
||||
|
||||
if("Transform".equals(mode)) {
|
||||
if ("Transform".equals(mode)) {
|
||||
if (!sa.usesTargeting()) {
|
||||
// no Transform with Defined which is not Self
|
||||
if (!source.canTransform()) {
|
||||
|
||||
@@ -35,7 +35,7 @@ public class TapAi extends TapAiBase {
|
||||
// Don't tap down after blockers
|
||||
return false;
|
||||
}
|
||||
} else if (!SpellAbilityAi.playReusable(ai, sa)){
|
||||
} else if (!SpellAbilityAi.playReusable(ai, sa)) {
|
||||
// Generally don't want to tap things with an Instant during Players turn outside of combat
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class GameLogFormatter extends IGameEventVisitor.Base<GameLogEntry> {
|
||||
|
||||
@Override
|
||||
public GameLogEntry visit(GameEventGameOutcome ev) {
|
||||
for(String outcome : ev.result.getOutcomeStrings()) {
|
||||
for (String outcome : ev.result.getOutcomeStrings()) {
|
||||
log.add(GameLogEntryType.GAME_OUTCOME, outcome);
|
||||
}
|
||||
return generateSummary(ev.history);
|
||||
|
||||
@@ -2550,7 +2550,7 @@ public class AbilityUtils {
|
||||
int colorOcurrencices = 0;
|
||||
byte colorCode = ManaAtom.fromName(sq[1]);
|
||||
for (Card c0 : cards) {
|
||||
for (ManaCostShard sh : c0.getManaCost()){
|
||||
for (ManaCostShard sh : c0.getManaCost()) {
|
||||
if (sh.isColor(colorCode))
|
||||
colorOcurrencices++;
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ public enum ApiType {
|
||||
private static final Map<String, ApiType> allValues = new HashMap<>();
|
||||
|
||||
static {
|
||||
for(ApiType t : ApiType.values()) {
|
||||
for (ApiType t : ApiType.values()) {
|
||||
allValues.put(t.name().toLowerCase(), t);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public class AmassEffect extends TokenEffectBase {
|
||||
tgtCards = pc.chooseCardsForEffect(tgtCards, sa, Localizer.getInstance().getMessage("lblChooseAnArmy"), 1, 1, false, params);
|
||||
|
||||
GameEntityCounterTable table = new GameEntityCounterTable();
|
||||
for(final Card tgtCard : tgtCards) {
|
||||
for (final Card tgtCard : tgtCards) {
|
||||
tgtCard.addCounter(CounterEnumType.P1P1, amount, activator, sa, true, table);
|
||||
game.updateLastStateForCard(tgtCard);
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ public class ChangeTargetsEffect extends SpellAbilityEffect {
|
||||
SpellAbility changingTgtSA = changingTgtSI.getSpellAbility(true);
|
||||
if (changingTgtSA.usesTargeting()) {
|
||||
// random target and DefinedMagnet works on single targets
|
||||
if (sa.hasParam("RandomTarget")){
|
||||
if (sa.hasParam("RandomTarget")) {
|
||||
int div = changingTgtSA.getTotalDividedValue();
|
||||
changingTgtSA.resetTargets();
|
||||
List<GameEntity> candidates = changingTgtSA.getTargetRestrictions().getAllCandidates(changingTgtSA, true);
|
||||
@@ -116,7 +116,7 @@ public class ChangeTargetsEffect extends SpellAbilityEffect {
|
||||
|
||||
changingTgtSI.updateTarget(changingTgtSA.getTargets(), sa.getHostCard());
|
||||
}
|
||||
else if (sa.hasParam("DefinedMagnet")){
|
||||
else if (sa.hasParam("DefinedMagnet")) {
|
||||
GameObject newTarget = Iterables.getFirst(getDefinedCardsOrTargeted(sa, "DefinedMagnet"), null);
|
||||
if (newTarget != null && changingTgtSA.canTarget(newTarget)) {
|
||||
int div = changingTgtSA.getTotalDividedValue();
|
||||
|
||||
@@ -222,7 +222,7 @@ public class CharmEffect extends SpellAbilityEffect {
|
||||
});
|
||||
|
||||
for (AbilitySub sub : chosen) {
|
||||
// Clone the chosen, just in case the some subAb gets chosen multiple times
|
||||
// Clone the chosen, just in case the same subAb gets chosen multiple times
|
||||
AbilitySub clone = (AbilitySub)sub.copy();
|
||||
|
||||
// update ActivatingPlayer
|
||||
@@ -250,7 +250,6 @@ public class CharmEffect extends SpellAbilityEffect {
|
||||
// add Clone to Tail of sa
|
||||
sa.appendSubAbility(clone);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ public class ChooseCardNameEffect extends SpellAbilityEffect {
|
||||
}
|
||||
|
||||
host.setNamedCard(chosen);
|
||||
if(!randomChoice) {
|
||||
if (!randomChoice) {
|
||||
p.getGame().getAction().notifyOfValue(sa, host, Localizer.getInstance().getMessage("lblPlayerPickedChosen", p.getName(), chosen), p);
|
||||
p.setNamedCard(chosen);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public class ControlSpellEffect extends SpellAbilityEffect {
|
||||
|
||||
sb.append(newController).append(" gains control of ");
|
||||
|
||||
for(SpellAbility spell : getTargetSpells(sa)) {
|
||||
for (SpellAbility spell : getTargetSpells(sa)) {
|
||||
Card c = spell.getHostCard();
|
||||
sb.append(" ");
|
||||
if (c.isFaceDown()) {
|
||||
|
||||
@@ -160,7 +160,7 @@ public class CopySpellAbilityEffect extends SpellAbilityEffect {
|
||||
if (sa.hasParam("MayChooseTarget")) {
|
||||
copy.setMayChooseNewTargets(true);
|
||||
}
|
||||
if (sa.hasParam("RandomTarget")){
|
||||
if (sa.hasParam("RandomTarget")) {
|
||||
List<GameEntity> candidates = copy.getTargetRestrictions().getAllCandidates(chosenSA, true);
|
||||
if (sa.hasParam("RandomTargetRestriction")) {
|
||||
candidates.removeIf(new Predicate<GameEntity>() {
|
||||
|
||||
@@ -37,7 +37,7 @@ public class CountersNoteEffect extends SpellAbilityEffect {
|
||||
}
|
||||
|
||||
private void noteCounters(Card notee, Card source) {
|
||||
for(Entry<CounterType, Integer> counter : notee.getCounters().entrySet()) {
|
||||
for (Entry<CounterType, Integer> counter : notee.getCounters().entrySet()) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(NOTE_COUNTERS).append(counter.getKey().getName());
|
||||
source.setSVar(sb.toString(), counter.getValue().toString());
|
||||
@@ -45,7 +45,7 @@ public class CountersNoteEffect extends SpellAbilityEffect {
|
||||
}
|
||||
|
||||
private void loadCounters(Card notee, Card source, final Player p, final SpellAbility sa, GameEntityCounterTable table) {
|
||||
for(Entry<String, String> svar : source.getSVars().entrySet()) {
|
||||
for (Entry<String, String> svar : source.getSVars().entrySet()) {
|
||||
String key = svar.getKey();
|
||||
if (key.startsWith(NOTE_COUNTERS)) {
|
||||
notee.addCounter(
|
||||
|
||||
@@ -35,7 +35,7 @@ public class DamageAllEffect extends DamageBaseEffect {
|
||||
|
||||
if (!definedSources.isEmpty() && definedSources.get(0) != sa.getHostCard()) {
|
||||
sb.append(definedSources.get(0).toString()).append(" deals");
|
||||
} else if ("ParentTarget".equals(definedStr)){
|
||||
} else if ("ParentTarget".equals(definedStr)) {
|
||||
sb.append("Target creature deals");
|
||||
} else {
|
||||
sb.append("Deals");
|
||||
|
||||
@@ -96,7 +96,7 @@ public class DebuffEffect extends SpellAbilityEffect {
|
||||
for (final String kw : kws) {
|
||||
// Check if some of the Keywords are Protection from <color>
|
||||
if (!ProtectionFromColor && kw.startsWith("Protection from ")) {
|
||||
for(byte col : MagicColor.WUBRG) {
|
||||
for (byte col : MagicColor.WUBRG) {
|
||||
final String colString = MagicColor.toLongString(col);
|
||||
if (kw.endsWith(colString.toLowerCase())) {
|
||||
ProtectionFromColor = true;
|
||||
@@ -110,7 +110,7 @@ public class DebuffEffect extends SpellAbilityEffect {
|
||||
if (ProtectionFromColor && tgtC.hasKeyword(allColors)) {
|
||||
final List<String> allColorsProtect = Lists.newArrayList();
|
||||
|
||||
for(byte col : MagicColor.WUBRG) {
|
||||
for (byte col : MagicColor.WUBRG) {
|
||||
allColorsProtect.add("Protection from " + MagicColor.toLongString(col).toLowerCase());
|
||||
}
|
||||
allColorsProtect.removeAll(kws);
|
||||
@@ -123,7 +123,7 @@ public class DebuffEffect extends SpellAbilityEffect {
|
||||
if (ProtectionFromColor && tgtC.hasKeyword(allColors)) {
|
||||
final List<String> allColorsProtect = Lists.newArrayList();
|
||||
|
||||
for(byte col : MagicColor.WUBRG) {
|
||||
for (byte col : MagicColor.WUBRG) {
|
||||
final String colString = MagicColor.toLongString(col);
|
||||
if (!kws.contains("Protection from " + colString)) {
|
||||
allColorsProtect.add(
|
||||
|
||||
@@ -330,7 +330,7 @@ public class EffectEffect extends SpellAbilityEffect {
|
||||
}
|
||||
|
||||
private void noteCounters(Card notee, Card source) {
|
||||
for(Map.Entry<CounterType, Integer> counter : notee.getCounters().entrySet()) {
|
||||
for (Map.Entry<CounterType, Integer> counter : notee.getCounters().entrySet()) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("NoteCounters").append(counter.getKey().getName());
|
||||
source.setSVar(sb.toString(), counter.getValue().toString());
|
||||
|
||||
@@ -50,7 +50,7 @@ public class PeekAndRevealEffect extends SpellAbilityEffect {
|
||||
numPeek = Math.min(numPeek, library.size());
|
||||
|
||||
CardCollection peekCards = new CardCollection();
|
||||
for(int i = 0; i < numPeek; i++) {
|
||||
for (int i = 0; i < numPeek; i++) {
|
||||
peekCards.add(library.get(i));
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public class PeekAndRevealEffect extends SpellAbilityEffect {
|
||||
}
|
||||
if (imprintRevealed) {
|
||||
Map<Integer, Card> cachedMap = Maps.newHashMap();
|
||||
for(Card c : revealableCards) {
|
||||
for (Card c : revealableCards) {
|
||||
source.addImprintedCard(CardUtil.getLKICopy(c, cachedMap));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ public class PlaneswalkEffect extends SpellAbilityEffect {
|
||||
public void resolve(SpellAbility sa) {
|
||||
Game game = sa.getActivatingPlayer().getGame();
|
||||
|
||||
for(Player p : game.getPlayers()) {
|
||||
for (Player p : game.getPlayers()) {
|
||||
p.leaveCurrentPlane();
|
||||
}
|
||||
if (sa.hasParam("Defined")) {
|
||||
|
||||
@@ -103,7 +103,7 @@ public class PlayEffect extends SpellAbilityEffect {
|
||||
} else if (sa.hasParam("AnySupportedCard")) {
|
||||
final String valid = sa.getParam("AnySupportedCard");
|
||||
List<PaperCard> cards = null;
|
||||
if (valid.startsWith("Names:")){
|
||||
if (valid.startsWith("Names:")) {
|
||||
cards = new ArrayList<>();
|
||||
for (String name : valid.substring(6).split(",")) {
|
||||
name = name.replace(";", ",");
|
||||
|
||||
@@ -66,7 +66,7 @@ public class ProtectAllEffect extends SpellAbilityEffect {
|
||||
} else if (sa.getParam("Gains").equals("TargetedCardColor")) {
|
||||
for (final Card c : sa.getSATargetingCard().getTargets().getTargetCards()) {
|
||||
ColorSet cs = CardUtil.getColors(c);
|
||||
for(byte col : MagicColor.WUBRG) {
|
||||
for (byte col : MagicColor.WUBRG) {
|
||||
if (cs.hasAnyColor(col))
|
||||
gains.add(MagicColor.toLongString(col).toLowerCase());
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ public class TwoPilesEffect extends SpellAbilityEffect {
|
||||
}
|
||||
|
||||
String title;
|
||||
if("One".equals(sa.getParamOrDefault("FaceDown", "False"))) {
|
||||
if ("One".equals(sa.getParamOrDefault("FaceDown", "False"))) {
|
||||
title = Localizer.getInstance().getMessage("lblSelectCardForFaceDownPile");
|
||||
} else if (isLeftRightPile) {
|
||||
title = Localizer.getInstance().getMessage("lblSelectCardForLeftPile");
|
||||
|
||||
@@ -2084,7 +2084,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
|| keyword.equals("Foretell") // for the ones without cost
|
||||
|| keyword.equals("Hideaway") || keyword.equals("Ascend")
|
||||
|| keyword.equals("Totem armor") || keyword.equals("Battle cry")
|
||||
|| keyword.equals("Devoid") || keyword.equals("Riot")){
|
||||
|| keyword.equals("Devoid") || keyword.equals("Riot")) {
|
||||
sbLong.append(keyword).append(" (").append(inst.getReminderText()).append(")");
|
||||
} else if (keyword.startsWith("Partner:")) {
|
||||
final String[] k = keyword.split(":");
|
||||
@@ -3580,10 +3580,6 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
return changed;
|
||||
}
|
||||
|
||||
public boolean clearChangedCardKeywords() {
|
||||
return clearChangedCardKeywords(false);
|
||||
}
|
||||
|
||||
public boolean clearChangedCardColors() {
|
||||
boolean changed = false;
|
||||
|
||||
@@ -3981,7 +3977,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
this.tempBoost = 0;
|
||||
this.bonusFromCounters = 0;
|
||||
}
|
||||
public StatBreakdown(int currentValue, int tempBoost, int bonusFromCounters){
|
||||
public StatBreakdown(int currentValue, int tempBoost, int bonusFromCounters) {
|
||||
this.currentValue = currentValue;
|
||||
this.tempBoost = tempBoost;
|
||||
this.bonusFromCounters = bonusFromCounters;
|
||||
@@ -4268,6 +4264,9 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
return change;
|
||||
}
|
||||
|
||||
public boolean clearChangedCardKeywords() {
|
||||
return clearChangedCardKeywords(false);
|
||||
}
|
||||
public final boolean clearChangedCardKeywords(final boolean updateView) {
|
||||
if (changedCardKeywords.isEmpty()) {
|
||||
return false;
|
||||
|
||||
@@ -270,7 +270,7 @@ public class CardFactory {
|
||||
original.addNonManaAbilities(card.getCurrentState().getNonManaAbilities());
|
||||
original.addIntrinsicKeywords(card.getCurrentState().getIntrinsicKeywords()); // Copy 'Fuse' to original side
|
||||
original.getSVars().putAll(card.getCurrentState().getSVars()); // Unfortunately need to copy these to (Effect looks for sVars on execute)
|
||||
} else if (state != CardStateName.Original){
|
||||
} else if (state != CardStateName.Original) {
|
||||
CardFactoryUtil.setupKeywordedAbilities(card);
|
||||
}
|
||||
if (state == CardStateName.Adventure) {
|
||||
|
||||
@@ -538,7 +538,7 @@ public class CardFactoryUtil {
|
||||
landkw.add(k);
|
||||
} else if (k.startsWith("Protection")) {
|
||||
protectionkw.add(k);
|
||||
for(byte col : MagicColor.WUBRG) {
|
||||
for (byte col : MagicColor.WUBRG) {
|
||||
final String colString = "Protection from " + MagicColor.toLongString(col).toLowerCase();
|
||||
if (k.contains(colString)) {
|
||||
protectionColorkw.add(colString);
|
||||
@@ -896,7 +896,7 @@ public class CardFactoryUtil {
|
||||
cascadeTrigger.setOverridingAbility(dig);
|
||||
|
||||
inst.addTrigger(cascadeTrigger);
|
||||
} else if (keyword.startsWith("Champion")){
|
||||
} else if (keyword.startsWith("Champion")) {
|
||||
final String[] k = keyword.split(":");
|
||||
final String[] valid = k[1].split(",");
|
||||
String desc = Lang.joinHomogenous(Lists.newArrayList(valid), null, "or");
|
||||
@@ -1688,7 +1688,7 @@ public class CardFactoryUtil {
|
||||
|
||||
int idx = 0;
|
||||
int skipId = 0;
|
||||
for(String ab : abs) {
|
||||
for (String ab : abs) {
|
||||
idx += 1;
|
||||
if (idx <= skipId) {
|
||||
continue;
|
||||
@@ -1898,7 +1898,7 @@ public class CardFactoryUtil {
|
||||
final List<String> abs = Arrays.asList(keyword.substring("Dungeon:".length()).split(","));
|
||||
final Map<String, SpellAbility> saMap = new LinkedHashMap<>();
|
||||
|
||||
for(String ab : abs) {
|
||||
for (String ab : abs) {
|
||||
saMap.put(ab, AbilityFactory.getAbility(card, ab));
|
||||
}
|
||||
for (SpellAbility sa : saMap.values()) {
|
||||
@@ -2956,7 +2956,7 @@ public class CardFactoryUtil {
|
||||
|
||||
inst.addSpellAbility(abilityMorphDown(card));
|
||||
inst.addSpellAbility(abilityMorphUp(card, k[1], false));
|
||||
} else if (keyword.startsWith("Megamorph")){
|
||||
} else if (keyword.startsWith("Megamorph")) {
|
||||
final String[] k = keyword.split(":");
|
||||
|
||||
inst.addSpellAbility(abilityMorphDown(card));
|
||||
|
||||
@@ -354,7 +354,7 @@ public final class CardUtil {
|
||||
if ((combinedColor & color) == 0) {
|
||||
continue;
|
||||
}
|
||||
for(final Card c : game.getColoredCardsInPlay(MagicColor.toLongString(color))) {
|
||||
for (final Card c : game.getColoredCardsInPlay(MagicColor.toLongString(color))) {
|
||||
if (!res.contains(c) && !tgts.contains(c) && c.isValid(valid, source.getController(), source, targetSA)) {
|
||||
res.add(c);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public class AttackingBand {
|
||||
String[] validString = { "Legendary.Creature", "Creature.namedWolves of the Hunt", "Dinosaur" };
|
||||
|
||||
Card source = band.get(0);
|
||||
for(int i = 0; i < bandsWithString.length; i++) {
|
||||
for (int i = 0; i < bandsWithString.length; i++) {
|
||||
String keyword = bandsWithString[i];
|
||||
String valid = validString[i];
|
||||
|
||||
|
||||
@@ -807,7 +807,7 @@ public class Combat {
|
||||
if (defender instanceof Player && defender.hasKeyword("You assign combat damage of each creature attacking you.")) {
|
||||
assigningPlayer = (Player)defender;
|
||||
}
|
||||
else if (AttackingBand.isValidBand(orderedBlockers, true)){
|
||||
else if (AttackingBand.isValidBand(orderedBlockers, true)) {
|
||||
assigningPlayer = orderedBlockers.get(0).getController();
|
||||
}
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@ public class CostPutCounter extends CostPartWithList {
|
||||
* @see forge.card.cost.CostPartWithList#executePayment(forge.card.spellability.SpellAbility, forge.Card)
|
||||
*/
|
||||
@Override
|
||||
protected Card doPayment(SpellAbility ability, Card targetCard){
|
||||
protected Card doPayment(SpellAbility ability, Card targetCard) {
|
||||
final Integer i = this.convertAmount();
|
||||
targetCard.addCounter(this.getCounter(), i, ability.getActivatingPlayer(), null, ability.getRootAbility().isTrigger(), counterTable);
|
||||
return targetCard;
|
||||
|
||||
@@ -394,7 +394,7 @@ public class PhaseHandler implements java.io.Serializable {
|
||||
final CardZoneTable table = new CardZoneTable();
|
||||
final CardCollection discarded = new CardCollection();
|
||||
boolean firstDiscarded = playerTurn.getNumDiscardedThisTurn() == 0;
|
||||
for (Card c : playerTurn.getController().chooseCardsToDiscardToMaximumHandSize(numDiscard)){
|
||||
for (Card c : playerTurn.getController().chooseCardsToDiscardToMaximumHandSize(numDiscard)) {
|
||||
if (playerTurn.discard(c, null, table) != null) {
|
||||
discarded.add(c);
|
||||
}
|
||||
@@ -590,7 +590,7 @@ public class PhaseHandler implements java.io.Serializable {
|
||||
"You may exert CARDNAME as it attacks.");
|
||||
|
||||
if (!possibleExerters.isEmpty()) {
|
||||
for(Card exerter : whoDeclares.getController().exertAttackers(possibleExerters)) {
|
||||
for (Card exerter : whoDeclares.getController().exertAttackers(possibleExerters)) {
|
||||
exerter.exert();
|
||||
}
|
||||
}
|
||||
@@ -1087,7 +1087,7 @@ public class PhaseHandler implements java.io.Serializable {
|
||||
sw.reset();
|
||||
}
|
||||
}
|
||||
else if (DEBUG_PHASES){
|
||||
else if (DEBUG_PHASES) {
|
||||
System.out.print(" >> (no priority given to " + getPriorityPlayer() + ")\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -483,7 +483,7 @@ public class PlayerView extends GameEntityView {
|
||||
if (cards == null)
|
||||
return 0;
|
||||
|
||||
for(CardView c : cards) {
|
||||
for (CardView c : cards) {
|
||||
types.addAll((Collection<? extends CardType.CoreType>) c.getCurrentState().getType().getCoreTypes());
|
||||
}
|
||||
|
||||
|
||||
@@ -2190,7 +2190,7 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
|
||||
@Override
|
||||
public int compareTo(SpellAbility ab) {
|
||||
if (this.isManaAbility() && ab.isManaAbility()){
|
||||
if (this.isManaAbility() && ab.isManaAbility()) {
|
||||
return this.calculateScoreForManaAbility() - ab.calculateScoreForManaAbility();
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -318,7 +318,7 @@ public class SpellAbilityStackInstance implements IIdentifiable, IHasCardView {
|
||||
SpellAbility compare = sa;
|
||||
SpellAbilityStackInstance sub = this;
|
||||
|
||||
if (!compare.equals(sub.ability)){
|
||||
if (!compare.equals(sub.ability)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user