mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 02:08:00 +00:00
Merge branch 'cleanup' into 'master'
Code cleanup See merge request core-developers/forge!4248
This commit is contained in:
@@ -1120,9 +1120,8 @@ public class AiController {
|
|||||||
CardCollection discards = CardLists.filter(player.getCardsIn(ZoneType.Hand), CardPredicates.hasCMC(cmc));
|
CardCollection discards = CardLists.filter(player.getCardsIn(ZoneType.Hand), CardPredicates.hasCMC(cmc));
|
||||||
if (discards.isEmpty()) {
|
if (discards.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
|
||||||
return new CardCollection(ComputerUtilCard.getWorstAI(discards));
|
|
||||||
}
|
}
|
||||||
|
return new CardCollection(ComputerUtilCard.getWorstAI(discards));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sa.hasParam("AnyNumber")) {
|
if (sa.hasParam("AnyNumber")) {
|
||||||
|
|||||||
@@ -2929,9 +2929,8 @@ public class ComputerUtil {
|
|||||||
}
|
}
|
||||||
if (targetSpellCard == null) {
|
if (targetSpellCard == null) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
|
||||||
sa.getTargets().add(targetSpellCard);
|
|
||||||
}
|
}
|
||||||
|
sa.getTargets().add(targetSpellCard);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1214,10 +1214,9 @@ public class ComputerUtilCard {
|
|||||||
final float valueNow = Math.max(valueTempo, threat);
|
final float valueNow = Math.max(valueTempo, threat);
|
||||||
if (valueNow < 0.2) { //hard floor to reduce ridiculous odds for instants over time
|
if (valueNow < 0.2) { //hard floor to reduce ridiculous odds for instants over time
|
||||||
return false;
|
return false;
|
||||||
} else {
|
|
||||||
final float chance = MyRandom.getRandom().nextFloat();
|
|
||||||
return chance < valueNow;
|
|
||||||
}
|
}
|
||||||
|
final float chance = MyRandom.getRandom().nextFloat();
|
||||||
|
return chance < valueNow;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -162,10 +162,9 @@ public class ComputerUtilCost {
|
|||||||
Card pref = ComputerUtil.getCardPreference(ai, source, "DiscardCost", typeList);
|
Card pref = ComputerUtil.getCardPreference(ai, source, "DiscardCost", typeList);
|
||||||
if (pref == null) {
|
if (pref == null) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
|
||||||
typeList.remove(pref);
|
|
||||||
hand.remove(pref);
|
|
||||||
}
|
}
|
||||||
|
typeList.remove(pref);
|
||||||
|
hand.remove(pref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,9 +108,7 @@ public class PlayerControllerAi extends PlayerController {
|
|||||||
if (abilities.size() == 0) {
|
if (abilities.size() == 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
else {
|
return abilities.get(0);
|
||||||
return abilities.get(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public AiController getAi() {
|
public AiController getAi() {
|
||||||
|
|||||||
@@ -30,40 +30,38 @@ public class AmassAi extends SpellAbilityAi {
|
|||||||
|
|
||||||
if (!aiArmies.isEmpty()) {
|
if (!aiArmies.isEmpty()) {
|
||||||
return CardLists.count(aiArmies, CardPredicates.canReceiveCounters(CounterEnumType.P1P1)) > 0;
|
return CardLists.count(aiArmies, CardPredicates.canReceiveCounters(CounterEnumType.P1P1)) > 0;
|
||||||
} else {
|
}
|
||||||
final String tokenScript = "b_0_0_zombie_army";
|
final String tokenScript = "b_0_0_zombie_army";
|
||||||
final int amount = AbilityUtils.calculateAmount(host, sa.getParamOrDefault("Num", "1"), sa);
|
final int amount = AbilityUtils.calculateAmount(host, sa.getParamOrDefault("Num", "1"), sa);
|
||||||
|
|
||||||
Card token = TokenInfo.getProtoType(tokenScript, sa, false);
|
Card token = TokenInfo.getProtoType(tokenScript, sa, false);
|
||||||
|
|
||||||
if (token == null) {
|
if (token == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
token.setController(ai, 0);
|
|
||||||
token.setLastKnownZone(ai.getZone(ZoneType.Battlefield));
|
|
||||||
|
|
||||||
boolean result = true;
|
|
||||||
|
|
||||||
// need to check what the cards would be on the battlefield
|
|
||||||
// do not attach yet, that would cause Events
|
|
||||||
CardCollection preList = new CardCollection(token);
|
|
||||||
game.getAction().checkStaticAbilities(false, Sets.newHashSet(token), preList);
|
|
||||||
|
|
||||||
if (token.canReceiveCounters(CounterEnumType.P1P1)) {
|
|
||||||
token.setCounters(CounterEnumType.P1P1, amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (token.isCreature() && token.getNetToughness() < 1) {
|
|
||||||
result = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//reset static abilities
|
|
||||||
game.getAction().checkStaticAbilities(false);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
token.setController(ai, 0);
|
||||||
|
token.setLastKnownZone(ai.getZone(ZoneType.Battlefield));
|
||||||
|
|
||||||
|
boolean result = true;
|
||||||
|
|
||||||
|
// need to check what the cards would be on the battlefield
|
||||||
|
// do not attach yet, that would cause Events
|
||||||
|
CardCollection preList = new CardCollection(token);
|
||||||
|
game.getAction().checkStaticAbilities(false, Sets.newHashSet(token), preList);
|
||||||
|
|
||||||
|
if (token.canReceiveCounters(CounterEnumType.P1P1)) {
|
||||||
|
token.setCounters(CounterEnumType.P1P1, amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (token.isCreature() && token.getNetToughness() < 1) {
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//reset static abilities
|
||||||
|
game.getAction().checkStaticAbilities(false);
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1452,12 +1452,11 @@ public class ChangeZoneAi extends SpellAbilityAi {
|
|||||||
if (sa.getTargets().size() == 0 || sa.getTargets().size() < tgt.getMinTargets(sa.getHostCard(), sa)) {
|
if (sa.getTargets().size() == 0 || sa.getTargets().size() < tgt.getMinTargets(sa.getHostCard(), sa)) {
|
||||||
sa.resetTargets();
|
sa.resetTargets();
|
||||||
return false;
|
return false;
|
||||||
} else {
|
|
||||||
if (!ComputerUtil.shouldCastLessThanMax(ai, source)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
if (!ComputerUtil.shouldCastLessThanMax(ai, source)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
list.remove(choice);
|
list.remove(choice);
|
||||||
@@ -1958,9 +1957,8 @@ public class ChangeZoneAi extends SpellAbilityAi {
|
|||||||
if (choice != null) {
|
if (choice != null) {
|
||||||
sa.getTargets().add(choice);
|
sa.getTargets().add(choice);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static CardCollection getSafeTargetsIfUnlessCostPaid(Player ai, SpellAbility sa, Iterable<Card> potentialTgts) {
|
private static CardCollection getSafeTargetsIfUnlessCostPaid(Player ai, SpellAbility sa, Iterable<Card> potentialTgts) {
|
||||||
|
|||||||
@@ -141,27 +141,26 @@ public class ChooseSourceAi extends SpellAbilityAi {
|
|||||||
Card bestCreature = ComputerUtilCard.getBestCreatureAI(permanentSources);
|
Card bestCreature = ComputerUtilCard.getBestCreatureAI(permanentSources);
|
||||||
if (bestCreature != null) {
|
if (bestCreature != null) {
|
||||||
return bestCreature;
|
return bestCreature;
|
||||||
} else {
|
}
|
||||||
// No optimal creature was found above, so try to broaden the choice.
|
// No optimal creature was found above, so try to broaden the choice.
|
||||||
if (!Iterables.isEmpty(options)) {
|
if (!Iterables.isEmpty(options)) {
|
||||||
List<Card> oppCreatures = CardLists.filter(options, Predicates.and(CardPredicates.Presets.CREATURES,
|
List<Card> oppCreatures = CardLists.filter(options, Predicates.and(CardPredicates.Presets.CREATURES,
|
||||||
Predicates.not(CardPredicates.isOwner(aiChoser))));
|
Predicates.not(CardPredicates.isOwner(aiChoser))));
|
||||||
List<Card> aiNonCreatures = CardLists.filter(options, Predicates.and(Predicates.not(CardPredicates.Presets.CREATURES),
|
List<Card> aiNonCreatures = CardLists.filter(options, Predicates.and(Predicates.not(CardPredicates.Presets.CREATURES),
|
||||||
CardPredicates.Presets.PERMANENTS, CardPredicates.isOwner(aiChoser)));
|
CardPredicates.Presets.PERMANENTS, CardPredicates.isOwner(aiChoser)));
|
||||||
|
|
||||||
if (!oppCreatures.isEmpty()) {
|
if (!oppCreatures.isEmpty()) {
|
||||||
return ComputerUtilCard.getBestCreatureAI(oppCreatures);
|
return ComputerUtilCard.getBestCreatureAI(oppCreatures);
|
||||||
} else if (!aiNonCreatures.isEmpty()) {
|
} else if (!aiNonCreatures.isEmpty()) {
|
||||||
return Aggregates.random(aiNonCreatures);
|
return Aggregates.random(aiNonCreatures);
|
||||||
} else {
|
} else {
|
||||||
return Aggregates.random(options);
|
return Aggregates.random(options);
|
||||||
}
|
|
||||||
} else if (!game.getStack().isEmpty()) {
|
|
||||||
// No permanent for the AI to choose. Should normally not happen unless using dev mode or something,
|
|
||||||
// but when it does happen, choose the top card on stack if possible (generally it'll be the SA
|
|
||||||
// source) in order to choose at least something, or the game will hang.
|
|
||||||
return game.getStack().peekAbility().getHostCard();
|
|
||||||
}
|
}
|
||||||
|
} else if (!game.getStack().isEmpty()) {
|
||||||
|
// No permanent for the AI to choose. Should normally not happen unless using dev mode or something,
|
||||||
|
// but when it does happen, choose the top card on stack if possible (generally it'll be the SA
|
||||||
|
// source) in order to choose at least something, or the game will hang.
|
||||||
|
return game.getStack().peekAbility().getHostCard();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Should never get here
|
// Should never get here
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ public class ControlExchangeAi extends SpellAbilityAi {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aiWorst != null && aiWorst != bestFirstTgt) {
|
if (aiWorst != bestFirstTgt) {
|
||||||
if (bestFirstTgt.isCreature() && aiWorst.isCreature()) {
|
if (bestFirstTgt.isCreature() && aiWorst.isCreature()) {
|
||||||
if ((ComputerUtilCard.evaluateCreature(bestFirstTgt) > ComputerUtilCard.evaluateCreature(aiWorst) + creatureThreshold) || sa.isMandatory()) {
|
if ((ComputerUtilCard.evaluateCreature(bestFirstTgt) > ComputerUtilCard.evaluateCreature(aiWorst) + creatureThreshold) || sa.isMandatory()) {
|
||||||
sa.getTargets().add(aiWorst);
|
sa.getTargets().add(aiWorst);
|
||||||
|
|||||||
@@ -268,9 +268,8 @@ public class ControlGainAi extends SpellAbilityAi {
|
|||||||
List<Card> list = CardLists.getTargetableCards(ai.getCardsIn(ZoneType.Battlefield), sa);
|
List<Card> list = CardLists.getTargetableCards(ai.getCardsIn(ZoneType.Battlefield), sa);
|
||||||
if (list.isEmpty()) {
|
if (list.isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
|
||||||
sa.getTargets().add(ComputerUtilCard.getWorstAI(list));
|
|
||||||
}
|
}
|
||||||
|
sa.getTargets().add(ComputerUtilCard.getWorstAI(list));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public class CopySpellAbilityAi extends SpellAbilityAi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (top.isWrapper() || !(top instanceof SpellAbility || top.isActivatedAbility())) {
|
if (top.isWrapper() || top.isActivatedAbility()) {
|
||||||
// Shouldn't even try with triggered or wrapped abilities at this time, will crash
|
// Shouldn't even try with triggered or wrapped abilities at this time, will crash
|
||||||
return false;
|
return false;
|
||||||
} else if (top.getApi() == ApiType.CopySpellAbility) {
|
} else if (top.getApi() == ApiType.CopySpellAbility) {
|
||||||
|
|||||||
@@ -642,10 +642,10 @@ public class BoosterGenerator {
|
|||||||
|
|
||||||
if (toAdd == null) {
|
if (toAdd == null) {
|
||||||
continue;
|
continue;
|
||||||
} else {
|
|
||||||
itOp.remove();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
itOp.remove();
|
||||||
|
|
||||||
if (invert) {
|
if (invert) {
|
||||||
toAdd = Predicates.not(toAdd);
|
toAdd = Predicates.not(toAdd);
|
||||||
}
|
}
|
||||||
@@ -658,8 +658,6 @@ public class BoosterGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return Predicates.and(conditions);
|
return Predicates.and(conditions);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ public class GameLogFormatter extends IGameEventVisitor.Base<GameLogEntry> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GameLogEntry visit(GameEventTurnBegan event) {
|
public GameLogEntry visit(GameEventTurnBegan event) {
|
||||||
String message = Localizer.getInstance().getMessage("lblLogTurnNOwnerByPlayer", String.valueOf(event.turnNumber), event.turnOwner.toString());;
|
String message = Localizer.getInstance().getMessage("lblLogTurnNOwnerByPlayer", String.valueOf(event.turnNumber), event.turnOwner.toString());
|
||||||
return new GameLogEntry(GameLogEntryType.TURN, message);
|
return new GameLogEntry(GameLogEntryType.TURN, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -558,7 +558,7 @@ public class AbilityUtils {
|
|||||||
else if (hType.startsWith("Property") && ability instanceof SpellAbility) {
|
else if (hType.startsWith("Property") && ability instanceof SpellAbility) {
|
||||||
String defined = hType.split("Property")[1];
|
String defined = hType.split("Property")[1];
|
||||||
for (Player p : game.getPlayersInTurnOrder()) {
|
for (Player p : game.getPlayersInTurnOrder()) {
|
||||||
if (p.hasProperty(defined, ((SpellAbility) ability).getActivatingPlayer(), ability.getHostCard(), (SpellAbility) ability)) {
|
if (p.hasProperty(defined, ((SpellAbility) ability).getActivatingPlayer(), ability.getHostCard(), ability)) {
|
||||||
players.add(p);
|
players.add(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1105,7 +1105,7 @@ public class AbilityUtils {
|
|||||||
}
|
}
|
||||||
// For merged permanent
|
// For merged permanent
|
||||||
if (c instanceof CardCollection) {
|
if (c instanceof CardCollection) {
|
||||||
o = ((CardCollection) c).get(0).getController().getOpponents();;
|
o = ((CardCollection) c).get(0).getController().getOpponents();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (defParsed.endsWith("Owner")) {
|
else if (defParsed.endsWith("Owner")) {
|
||||||
@@ -1828,13 +1828,11 @@ public class AbilityUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctb instanceof CardTraitBase) {
|
if (l[0].startsWith("CountersAddedThisTurn")) {
|
||||||
if (l[0].startsWith("CountersAddedThisTurn")) {
|
final String[] parts = l[0].split(" ");
|
||||||
final String[] parts = l[0].split(" ");
|
CounterType cType = CounterType.getType(parts[1]);
|
||||||
CounterType cType = CounterType.getType(parts[1]);
|
|
||||||
|
|
||||||
return CardFactoryUtil.doXMath(game.getCounterAddedThisTurn(cType, parts[2], parts[3], c, player, ctb), expr, c);
|
return CardFactoryUtil.doXMath(game.getCounterAddedThisTurn(cType, parts[2], parts[3], c, player, ctb), expr, c);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return CardFactoryUtil.xCount(c, s2);
|
return CardFactoryUtil.xCount(c, s2);
|
||||||
|
|||||||
@@ -54,10 +54,9 @@ public class AttachEffect extends SpellAbilityEffect {
|
|||||||
|
|
||||||
if (targets.isEmpty()) {
|
if (targets.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
} else {
|
|
||||||
attachTo = targets.get(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
attachTo = targets.get(0);
|
||||||
String attachToName = null;
|
String attachToName = null;
|
||||||
if (attachTo instanceof Card) {
|
if (attachTo instanceof Card) {
|
||||||
attachToName = CardTranslation.getTranslatedName(((Card)attachTo).getName());
|
attachToName = CardTranslation.getTranslatedName(((Card)attachTo).getName());
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ public class CountersMoveEffect extends SpellAbilityEffect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (final Card dest : tgtCards) {
|
for (final Card dest : tgtCards) {
|
||||||
if (null != source && null != dest) {
|
if (null != dest) {
|
||||||
// rule 121.5: If the first and second objects are the same object, nothing
|
// rule 121.5: If the first and second objects are the same object, nothing
|
||||||
// happens
|
// happens
|
||||||
if (source.equals(dest)) {
|
if (source.equals(dest)) {
|
||||||
|
|||||||
@@ -160,10 +160,9 @@ public abstract class TokenEffectBase extends SpellAbilityEffect {
|
|||||||
|
|
||||||
tok.attachToEntity(ge);
|
tok.attachToEntity(ge);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
|
||||||
// not a GameEntity, cant be attach
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
// not a GameEntity, cant be attach
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addPumpUntil(SpellAbility sa, final Card c, long timestamp) {
|
protected void addPumpUntil(SpellAbility sa, final Card c, long timestamp) {
|
||||||
|
|||||||
@@ -3565,7 +3565,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
|||||||
|
|
||||||
// values that are printed on card
|
// values that are printed on card
|
||||||
public final void setBasePowerString(final String s) {
|
public final void setBasePowerString(final String s) {
|
||||||
currentState.setBasePowerString(s);;
|
currentState.setBasePowerString(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void setBaseToughnessString(final String s) {
|
public final void setBaseToughnessString(final String s) {
|
||||||
|
|||||||
@@ -1508,14 +1508,14 @@ public class CardProperty {
|
|||||||
String what = property.substring("blocking".length());
|
String what = property.substring("blocking".length());
|
||||||
|
|
||||||
if (StringUtils.isEmpty(what)) return combat.isBlocking(card);
|
if (StringUtils.isEmpty(what)) return combat.isBlocking(card);
|
||||||
if (what.startsWith("Source")) return combat.isBlocking(card, source) ;
|
if (what.startsWith("Source")) return combat.isBlocking(card, source);
|
||||||
if (what.startsWith("CreatureYouCtrl")) {
|
if (what.startsWith("CreatureYouCtrl")) {
|
||||||
for (final Card c : CardLists.filter(sourceController.getCardsIn(ZoneType.Battlefield), Presets.CREATURES))
|
for (final Card c : CardLists.filter(sourceController.getCardsIn(ZoneType.Battlefield), Presets.CREATURES))
|
||||||
if (combat.isBlocking(card, c))
|
if (combat.isBlocking(card, c))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
for(Card c : AbilityUtils.getDefinedCards(source, what, spellAbility)) {
|
for (Card c : AbilityUtils.getDefinedCards(source, what, spellAbility)) {
|
||||||
if (combat.isBlocking(card, c)) {
|
if (combat.isBlocking(card, c)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,22 +89,20 @@ public class CostReveal extends CostPartWithList {
|
|||||||
} else if (this.getType().equals("SameColor")) {
|
} else if (this.getType().equals("SameColor")) {
|
||||||
if (amount == null) {
|
if (amount == null) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
|
||||||
for (final Card card : handList) {
|
|
||||||
if (CardLists.filter(handList, new Predicate<Card>() {
|
|
||||||
@Override
|
|
||||||
public boolean apply(final Card c) {
|
|
||||||
return c.sharesColorWith(card);
|
|
||||||
}
|
|
||||||
}).size() >= amount) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
for (final Card card : handList) {
|
||||||
|
if (CardLists.filter(handList, new Predicate<Card>() {
|
||||||
|
@Override
|
||||||
|
public boolean apply(final Card c) {
|
||||||
|
return c.sharesColorWith(card);
|
||||||
|
}
|
||||||
|
}).size() >= amount) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return (amount == null) || (amount <= getMaxAmountX(ability, payer));
|
return (amount == null) || (amount <= getMaxAmountX(ability, payer));
|
||||||
//System.out.println("revealcost - " + amount + type + handList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ public class Player extends GameEntity implements Comparable<Player> {
|
|||||||
private final Map<ZoneType, PlayerZone> zones = Maps.newEnumMap(ZoneType.class);
|
private final Map<ZoneType, PlayerZone> zones = Maps.newEnumMap(ZoneType.class);
|
||||||
private final Map<Long, Integer> adjustLandPlays = Maps.newHashMap();
|
private final Map<Long, Integer> adjustLandPlays = Maps.newHashMap();
|
||||||
private final Set<Long> adjustLandPlaysInfinite = Sets.newHashSet();
|
private final Set<Long> adjustLandPlaysInfinite = Sets.newHashSet();
|
||||||
private Map<Card, Card> maingameCardsMap = Maps.newHashMap();;
|
private Map<Card, Card> maingameCardsMap = Maps.newHashMap();
|
||||||
|
|
||||||
private CardCollection currentPlanes = new CardCollection();
|
private CardCollection currentPlanes = new CardCollection();
|
||||||
private Set<String> prowl = Sets.newHashSet();
|
private Set<String> prowl = Sets.newHashSet();
|
||||||
@@ -3448,10 +3448,11 @@ public class Player extends GameEntity implements Comparable<Player> {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.hasKeyword("CantSearchLibrary")) {
|
if (hasKeyword("CantSearchLibrary")) {
|
||||||
return false;
|
return false;
|
||||||
} else return targetPlayer == null || !targetPlayer.equals(sa.getActivatingPlayer())
|
}
|
||||||
|| !hasKeyword("Spells and abilities you control can't cause you to search your library.");
|
return targetPlayer == null || !targetPlayer.equals(sa.getActivatingPlayer())
|
||||||
|
|| !hasKeyword("Spells and abilities you control can't cause you to search your library.");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ public abstract class Spell extends SpellAbility implements java.io.Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
// do performanceMode only for cases where the activator is different than controller
|
// do performanceMode only for cases where the activator is different than controller
|
||||||
if (!Spell.performanceMode && activator != null && !card.getController().equals(activator)) {
|
if (!Spell.performanceMode && !card.getController().equals(activator)) {
|
||||||
// always make a lki copy in this case?
|
// always make a lki copy in this case?
|
||||||
card = CardUtil.getLKICopy(card);
|
card = CardUtil.getLKICopy(card);
|
||||||
card.setController(activator, 0);
|
card.setController(activator, 0);
|
||||||
|
|||||||
@@ -290,12 +290,11 @@ public class SpellAbilityCondition extends SpellAbilityVariables {
|
|||||||
Card first = Iterables.getFirst(tgts, null);
|
Card first = Iterables.getFirst(tgts, null);
|
||||||
if (first == null) {
|
if (first == null) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
}
|
||||||
byte firstColor = CardUtil.getColors(first).getColor();
|
byte firstColor = CardUtil.getColors(first).getColor();
|
||||||
for (Card c : tgts) {
|
for (Card c : tgts) {
|
||||||
if (CardUtil.getColors(c).getColor() != firstColor) {
|
if (CardUtil.getColors(c).getColor() != firstColor) {
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -489,19 +489,18 @@ public class TargetRestrictions {
|
|||||||
if (this.tgtZone.contains(ZoneType.Stack)) {
|
if (this.tgtZone.contains(ZoneType.Stack)) {
|
||||||
// Stack Zone targets are considered later
|
// Stack Zone targets are considered later
|
||||||
return true;
|
return true;
|
||||||
} else {
|
}
|
||||||
for (final Card c : game.getCardsIn(this.tgtZone)) {
|
for (final Card c : game.getCardsIn(this.tgtZone)) {
|
||||||
if (!c.isValid(this.validTgts, sa.getActivatingPlayer(), srcCard, sa)) {
|
if (!c.isValid(this.validTgts, sa.getActivatingPlayer(), srcCard, sa)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
if (isTargeted && !sa.canTarget(c)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (sa.getTargets().contains(c)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
if (isTargeted && !sa.canTarget(c)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (sa.getTargets().contains(c)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -283,13 +283,12 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
|
|||||||
// AbilityStatic should do nothing below
|
// AbilityStatic should do nothing below
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
for (OptionalCost s : sp.getOptionalCosts()) {
|
for (OptionalCost s : sp.getOptionalCosts()) {
|
||||||
source.addOptionalCostPaid(s);
|
source.addOptionalCostPaid(s);
|
||||||
}
|
|
||||||
// The ability is added to stack HERE
|
|
||||||
si = push(sp);
|
|
||||||
}
|
}
|
||||||
|
// The ability is added to stack HERE
|
||||||
|
si = push(sp);
|
||||||
|
|
||||||
// Copied spells aren't cast per se so triggers shouldn't run for them.
|
// Copied spells aren't cast per se so triggers shouldn't run for them.
|
||||||
Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||||
|
|||||||
@@ -766,22 +766,28 @@ public class FDeckChooser extends JPanel implements IDecksComboBoxListener {
|
|||||||
if (deckType.startsWith(NetDeckCategory.PREFIX)) {
|
if (deckType.startsWith(NetDeckCategory.PREFIX)) {
|
||||||
netDeckCategory = NetDeckCategory.selectAndLoad(lstDecks.getGameType(), deckType.substring(NetDeckCategory.PREFIX.length()));
|
netDeckCategory = NetDeckCategory.selectAndLoad(lstDecks.getGameType(), deckType.substring(NetDeckCategory.PREFIX.length()));
|
||||||
return DeckType.NET_DECK;
|
return DeckType.NET_DECK;
|
||||||
} else if (deckType.startsWith(NetDeckArchiveStandard.PREFIX)) {
|
}
|
||||||
|
if (deckType.startsWith(NetDeckArchiveStandard.PREFIX)) {
|
||||||
NetDeckArchiveStandard = NetDeckArchiveStandard.selectAndLoad(lstDecks.getGameType(), deckType.substring(NetDeckArchiveStandard.PREFIX.length()));
|
NetDeckArchiveStandard = NetDeckArchiveStandard.selectAndLoad(lstDecks.getGameType(), deckType.substring(NetDeckArchiveStandard.PREFIX.length()));
|
||||||
return DeckType.NET_ARCHIVE_STANDARD_DECK;
|
return DeckType.NET_ARCHIVE_STANDARD_DECK;
|
||||||
} else if (deckType.startsWith(NetDeckArchivePioneer.PREFIX)) {
|
}
|
||||||
|
if (deckType.startsWith(NetDeckArchivePioneer.PREFIX)) {
|
||||||
NetDeckArchivePioneer = NetDeckArchivePioneer.selectAndLoad(lstDecks.getGameType(), deckType.substring(NetDeckArchivePioneer.PREFIX.length()));
|
NetDeckArchivePioneer = NetDeckArchivePioneer.selectAndLoad(lstDecks.getGameType(), deckType.substring(NetDeckArchivePioneer.PREFIX.length()));
|
||||||
return DeckType.NET_ARCHIVE_PIONEER_DECK;
|
return DeckType.NET_ARCHIVE_PIONEER_DECK;
|
||||||
} else if (deckType.startsWith(NetDeckArchiveModern.PREFIX)) {
|
}
|
||||||
|
if (deckType.startsWith(NetDeckArchiveModern.PREFIX)) {
|
||||||
NetDeckArchiveModern = NetDeckArchiveModern.selectAndLoad(lstDecks.getGameType(), deckType.substring(NetDeckArchiveModern.PREFIX.length()));
|
NetDeckArchiveModern = NetDeckArchiveModern.selectAndLoad(lstDecks.getGameType(), deckType.substring(NetDeckArchiveModern.PREFIX.length()));
|
||||||
return DeckType.NET_ARCHIVE_MODERN_DECK;
|
return DeckType.NET_ARCHIVE_MODERN_DECK;
|
||||||
} else if (deckType.startsWith(NetDeckArchiveLegacy.PREFIX)) {
|
}
|
||||||
|
if (deckType.startsWith(NetDeckArchiveLegacy.PREFIX)) {
|
||||||
NetDeckArchiveLegacy = NetDeckArchiveLegacy.selectAndLoad(lstDecks.getGameType(), deckType.substring(NetDeckArchiveLegacy.PREFIX.length()));
|
NetDeckArchiveLegacy = NetDeckArchiveLegacy.selectAndLoad(lstDecks.getGameType(), deckType.substring(NetDeckArchiveLegacy.PREFIX.length()));
|
||||||
return DeckType.NET_ARCHIVE_LEGACY_DECK;
|
return DeckType.NET_ARCHIVE_LEGACY_DECK;
|
||||||
} else if (deckType.startsWith(NetDeckArchiveVintage.PREFIX)) {
|
}
|
||||||
|
if (deckType.startsWith(NetDeckArchiveVintage.PREFIX)) {
|
||||||
NetDeckArchiveVintage = NetDeckArchiveVintage.selectAndLoad(lstDecks.getGameType(), deckType.substring(NetDeckArchiveVintage.PREFIX.length()));
|
NetDeckArchiveVintage = NetDeckArchiveVintage.selectAndLoad(lstDecks.getGameType(), deckType.substring(NetDeckArchiveVintage.PREFIX.length()));
|
||||||
return DeckType.NET_ARCHIVE_VINTAGE_DECK;
|
return DeckType.NET_ARCHIVE_VINTAGE_DECK;
|
||||||
} else if (deckType.startsWith(NetDeckArchiveBlock.PREFIX)) {
|
}
|
||||||
|
if (deckType.startsWith(NetDeckArchiveBlock.PREFIX)) {
|
||||||
NetDeckArchiveBlock = NetDeckArchiveBlock.selectAndLoad(lstDecks.getGameType(), deckType.substring(NetDeckArchiveBlock.PREFIX.length()));
|
NetDeckArchiveBlock = NetDeckArchiveBlock.selectAndLoad(lstDecks.getGameType(), deckType.substring(NetDeckArchiveBlock.PREFIX.length()));
|
||||||
return DeckType.NET_ARCHIVE_BLOCK_DECK;
|
return DeckType.NET_ARCHIVE_BLOCK_DECK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -715,15 +715,14 @@ public class VLobby implements ILobbyView {
|
|||||||
|
|
||||||
if (sel == null) {
|
if (sel == null) {
|
||||||
return;
|
return;
|
||||||
} else {
|
}
|
||||||
if (sel.contains("Use deck's default avatar") && deck != null && deck.has(DeckSection.Avatar)) {
|
if (sel.contains("Use deck's default avatar") && deck != null && deck.has(DeckSection.Avatar)) {
|
||||||
vanguardAvatar = deck.get(DeckSection.Avatar).get(0);
|
vanguardAvatar = deck.get(DeckSection.Avatar).get(0);
|
||||||
} else { //Only other string is "Random"
|
} else { //Only other string is "Random"
|
||||||
if (playerPanels.get(playerIndex).isAi()) { //AI
|
if (playerPanels.get(playerIndex).isAi()) { //AI
|
||||||
vanguardAvatar = Aggregates.random(getNonRandomAiAvatars());
|
vanguardAvatar = Aggregates.random(getNonRandomAiAvatars());
|
||||||
} else { //Human
|
} else { //Human
|
||||||
vanguardAvatar = Aggregates.random(getNonRandomHumanAvatars());
|
vanguardAvatar = Aggregates.random(getNonRandomHumanAvatars());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,9 +126,7 @@ public class QuickGauntletLister extends JPanel {
|
|||||||
if (previousSelect == null) {
|
if (previousSelect == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
else {
|
return GauntletIO.getGauntletFile(previousSelect.getGauntletData());
|
||||||
return GauntletIO.getGauntletFile(previousSelect.getGauntletData());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DeleteButton extends SkinnedButton {
|
private class DeleteButton extends SkinnedButton {
|
||||||
|
|||||||
@@ -1357,24 +1357,23 @@ public final class CMatchUI
|
|||||||
private List<GameEntityView> getTargets(SpellAbilityStackInstance si, List<GameEntityView> result){
|
private List<GameEntityView> getTargets(SpellAbilityStackInstance si, List<GameEntityView> result){
|
||||||
if(si == null) {
|
if(si == null) {
|
||||||
return result;
|
return result;
|
||||||
} else {
|
|
||||||
FCollectionView<CardView> targetCards = CardView.getCollection(si.getTargetChoices().getTargetCards());
|
|
||||||
for(CardView currCardView: targetCards) {
|
|
||||||
result.add(currCardView);
|
|
||||||
}
|
|
||||||
|
|
||||||
for(SpellAbility currSA : si.getTargetChoices().getTargetSpells()) {
|
|
||||||
CardView currCardView = currSA.getCardView();
|
|
||||||
result.add(currCardView);
|
|
||||||
}
|
|
||||||
|
|
||||||
FCollectionView<PlayerView> targetPlayers = PlayerView.getCollection(si.getTargetChoices().getTargetPlayers());
|
|
||||||
for(PlayerView currPlayerView : targetPlayers) {
|
|
||||||
result.add(currPlayerView);
|
|
||||||
}
|
|
||||||
|
|
||||||
return getTargets(si.getSubInstance(),result);
|
|
||||||
}
|
}
|
||||||
|
FCollectionView<CardView> targetCards = CardView.getCollection(si.getTargetChoices().getTargetCards());
|
||||||
|
for(CardView currCardView: targetCards) {
|
||||||
|
result.add(currCardView);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(SpellAbility currSA : si.getTargetChoices().getTargetSpells()) {
|
||||||
|
CardView currCardView = currSA.getCardView();
|
||||||
|
result.add(currCardView);
|
||||||
|
}
|
||||||
|
|
||||||
|
FCollectionView<PlayerView> targetPlayers = PlayerView.getCollection(si.getTargetChoices().getTargetPlayers());
|
||||||
|
for(PlayerView currPlayerView : targetPlayers) {
|
||||||
|
result.add(currPlayerView);
|
||||||
|
}
|
||||||
|
|
||||||
|
return getTargets(si.getSubInstance(),result);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addBigImageToStackModalPanel(JPanel mainPanel, SpellAbilityStackInstance si) {
|
private void addBigImageToStackModalPanel(JPanel mainPanel, SpellAbilityStackInstance si) {
|
||||||
|
|||||||
@@ -90,9 +90,8 @@ public class AutoUpdater {
|
|||||||
int option = SOptionPane.showOptionDialog(message, localizer.getMessage("lblManualCheck"), null, options, 0);
|
int option = SOptionPane.showOptionDialog(message, localizer.getMessage("lblManualCheck"), null, options, 0);
|
||||||
if (option < 1) {
|
if (option < 1) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
|
||||||
updateChannel = options.get(option);
|
|
||||||
}
|
}
|
||||||
|
updateChannel = options.get(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buildVersion.contains("SNAPSHOT")) {
|
if (buildVersion.contains("SNAPSHOT")) {
|
||||||
|
|||||||
@@ -327,17 +327,15 @@ public abstract class AbstractGuiGame implements IGuiGame, IMayViewCards {
|
|||||||
// Don't immediately close, wait for win/lose screen
|
// Don't immediately close, wait for win/lose screen
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else {
|
// since the nextGameDecision might come from somewhere else it will try and concede too
|
||||||
// since the nextGameDecision might come from somewhere else it will try and concede too
|
ignoreConcedeChain = true;
|
||||||
ignoreConcedeChain = true;
|
for (PlayerView player : getLocalPlayers()) {
|
||||||
for (PlayerView player : getLocalPlayers()) {
|
if (!player.isAI()) {
|
||||||
if (!player.isAI()) {
|
getGameController(player).nextGameDecision(NextGameDecision.QUIT);
|
||||||
getGameController(player).nextGameDecision(NextGameDecision.QUIT);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ignoreConcedeChain = false;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
ignoreConcedeChain = false;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
else if (spectator == null) {
|
else if (spectator == null) {
|
||||||
return true; //if no local players or spectator, just quit
|
return true; //if no local players or spectator, just quit
|
||||||
|
|||||||
@@ -28,21 +28,20 @@ public class CompatibleObjectDecoder extends LengthFieldBasedFrameDecoder {
|
|||||||
ByteBuf frame = (ByteBuf)super.decode(ctx, in);
|
ByteBuf frame = (ByteBuf)super.decode(ctx, in);
|
||||||
if (frame == null) {
|
if (frame == null) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
}
|
||||||
ObjectInputStream ois = GuiBase.hasPropertyConfig() ?
|
ObjectInputStream ois = GuiBase.hasPropertyConfig() ?
|
||||||
new ObjectInputStream(new LZ4BlockInputStream(new ByteBufInputStream(frame, true))):
|
new ObjectInputStream(new LZ4BlockInputStream(new ByteBufInputStream(frame, true))):
|
||||||
new CObjectInputStream(new LZ4BlockInputStream(new ByteBufInputStream(frame, true)),this.classResolver);
|
new CObjectInputStream(new LZ4BlockInputStream(new ByteBufInputStream(frame, true)),this.classResolver);
|
||||||
|
|
||||||
Object var5 = null;
|
Object var5 = null;
|
||||||
try {
|
try {
|
||||||
var5 = ois.readObject();
|
var5 = ois.readObject();
|
||||||
} catch (StreamCorruptedException e) {
|
} catch (StreamCorruptedException e) {
|
||||||
System.err.println(String.format("Version Mismatch: %s", e.getMessage()));
|
System.err.println(String.format("Version Mismatch: %s", e.getMessage()));
|
||||||
} finally {
|
} finally {
|
||||||
ois.close();
|
ois.close();
|
||||||
}
|
|
||||||
|
|
||||||
return var5;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return var5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -352,7 +352,7 @@ public class FControlGameEventHandler extends IGameEventVisitor.Base<Void> {
|
|||||||
@Override
|
@Override
|
||||||
public Void visit(final GameEventCardAttachment event) {
|
public Void visit(final GameEventCardAttachment event) {
|
||||||
final Game game = event.equipment.getGame();
|
final Game game = event.equipment.getGame();
|
||||||
final Zone zEq = (Zone)game.getZoneOf(event.equipment);
|
final Zone zEq = game.getZoneOf(event.equipment);
|
||||||
if (event.oldEntiy instanceof Card) {
|
if (event.oldEntiy instanceof Card) {
|
||||||
updateZone(game.getZoneOf((Card)event.oldEntiy));
|
updateZone(game.getZoneOf((Card)event.oldEntiy));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -393,14 +393,13 @@ public abstract class GuiDownloadService implements Runnable {
|
|||||||
protected Proxy getProxy() {
|
protected Proxy getProxy() {
|
||||||
if (type == 0) {
|
if (type == 0) {
|
||||||
return Proxy.NO_PROXY;
|
return Proxy.NO_PROXY;
|
||||||
} else {
|
}
|
||||||
try {
|
try {
|
||||||
return new Proxy(TYPES[type], new InetSocketAddress(txtAddress.getText(), Integer.parseInt(txtPort.getText())));
|
return new Proxy(TYPES[type], new InetSocketAddress(txtAddress.getText(), Integer.parseInt(txtPort.getText())));
|
||||||
} catch (final Exception ex) {
|
} catch (final Exception ex) {
|
||||||
BugReporter.reportException(ex,
|
BugReporter.reportException(ex,
|
||||||
"Proxy connection could not be established!\nProxy address: %s\nProxy port: %s",
|
"Proxy connection could not be established!\nProxy address: %s\nProxy port: %s",
|
||||||
txtAddress.getText(), txtPort.getText());
|
txtAddress.getText(), txtPort.getText());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -725,17 +725,15 @@ public class HumanPlay {
|
|||||||
if (ability.getSacrificedAsOffering() == null) {
|
if (ability.getSacrificedAsOffering() == null) {
|
||||||
System.out.println("Sacrifice input for Offering cancelled");
|
System.out.println("Sacrifice input for Offering cancelled");
|
||||||
return false;
|
return false;
|
||||||
} else {
|
|
||||||
offering = ability.getSacrificedAsOffering();
|
|
||||||
}
|
}
|
||||||
|
offering = ability.getSacrificedAsOffering();
|
||||||
}
|
}
|
||||||
if (ability.isEmerge()) {
|
if (ability.isEmerge()) {
|
||||||
if (ability.getSacrificedAsEmerge() == null) {
|
if (ability.getSacrificedAsEmerge() == null) {
|
||||||
System.out.println("Sacrifice input for Emerge cancelled");
|
System.out.println("Sacrifice input for Emerge cancelled");
|
||||||
return false;
|
return false;
|
||||||
} else {
|
|
||||||
emerge = ability.getSacrificedAsEmerge();
|
|
||||||
}
|
}
|
||||||
|
emerge = ability.getSacrificedAsEmerge();
|
||||||
}
|
}
|
||||||
if (!toPay.isPaid()) {
|
if (!toPay.isPaid()) {
|
||||||
// Input is somehow clearing out the offering card?
|
// Input is somehow clearing out the offering card?
|
||||||
|
|||||||
@@ -694,12 +694,10 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (sa != null) {
|
tempShowCard(show);
|
||||||
tempShowCard(show);
|
boolean result = InputConfirm.confirm(this, ((Card) sa.getHostCard().getFirstRemembered()).getView(), message);
|
||||||
boolean result = InputConfirm.confirm(this, ((Card) sa.getHostCard().getFirstRemembered()).getView(), message);
|
endTempShowCards();
|
||||||
endTempShowCards();
|
return result;
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The general case: display the source of the SA in the prompt on mouse over
|
// The general case: display the source of the SA in the prompt on mouse over
|
||||||
|
|||||||
@@ -318,17 +318,15 @@ public class TargetSelection {
|
|||||||
// Not enough targets, cancel targeting
|
// Not enough targets, cancel targeting
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else {
|
Object madeChoice = mandatory ? controller.getGui().one(message, selectOptions) : controller.getGui().oneOrNone(message, selectOptions);
|
||||||
Object madeChoice = mandatory ? controller.getGui().one(message, selectOptions) : controller.getGui().oneOrNone(message, selectOptions);
|
if (madeChoice == null) {
|
||||||
if (madeChoice == null) {
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
if (madeChoice instanceof StackItemView) {
|
||||||
if (madeChoice instanceof StackItemView) {
|
ability.getTargets().add(stackItemViewCache.get(madeChoice).getSpellAbility(true));
|
||||||
ability.getTargets().add(stackItemViewCache.get(madeChoice).getSpellAbility(true));
|
}
|
||||||
}
|
else {// 'FINISH TARGETING' chosen
|
||||||
else {// 'FINISH TARGETING' chosen
|
bTargetingDone = true;
|
||||||
bTargetingDone = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user