mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
sending CField updates to a propper thread.
minor optimizations for the rest
This commit is contained in:
@@ -376,6 +376,7 @@ public class Cost {
|
|||||||
|
|
||||||
public final Cost copyWithNoMana() {
|
public final Cost copyWithNoMana() {
|
||||||
Cost toRet = new Cost(0);
|
Cost toRet = new Cost(0);
|
||||||
|
toRet.isAbility = this.isAbility;
|
||||||
for(CostPart cp : this.costParts) {
|
for(CostPart cp : this.costParts) {
|
||||||
if (!(cp instanceof CostPartMana))
|
if (!(cp instanceof CostPartMana))
|
||||||
toRet.costParts.add(cp);
|
toRet.costParts.add(cp);
|
||||||
|
|||||||
@@ -59,7 +59,6 @@ public abstract class SpellAbility implements ISpellAbility {
|
|||||||
|
|
||||||
private String type = "Intrinsic"; // set to Intrinsic by default
|
private String type = "Intrinsic"; // set to Intrinsic by default
|
||||||
|
|
||||||
private Card targetCard;
|
|
||||||
private Card sourceCard;
|
private Card sourceCard;
|
||||||
private Card originalHost = null;
|
private Card originalHost = null;
|
||||||
|
|
||||||
@@ -78,12 +77,12 @@ public abstract class SpellAbility implements ISpellAbility {
|
|||||||
private boolean cycling = false;
|
private boolean cycling = false;
|
||||||
private boolean delve = false;
|
private boolean delve = false;
|
||||||
|
|
||||||
/** The pay costs. */
|
private Card targetCard;
|
||||||
private Cost payCosts = null;
|
|
||||||
|
|
||||||
/** The chosen target. */
|
/** The chosen target. */
|
||||||
private Target chosenTarget = null;
|
private Target chosenTarget = null;
|
||||||
|
|
||||||
|
/** The pay costs. */
|
||||||
|
private Cost payCosts = null;
|
||||||
private SpellAbilityRestriction restrictions = new SpellAbilityRestriction();
|
private SpellAbilityRestriction restrictions = new SpellAbilityRestriction();
|
||||||
private SpellAbilityCondition conditions = new SpellAbilityCondition();
|
private SpellAbilityCondition conditions = new SpellAbilityCondition();
|
||||||
private AbilitySub subAbility = null;
|
private AbilitySub subAbility = null;
|
||||||
@@ -176,10 +175,6 @@ public abstract class SpellAbility implements ISpellAbility {
|
|||||||
this.payCosts = toPay;
|
this.payCosts = toPay;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SpellAbility(final Card iSourceCard ) {
|
|
||||||
this(iSourceCard, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Spell, and Ability, and other Ability objects override this method
|
// Spell, and Ability, and other Ability objects override this method
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
|
|
||||||
import forge.Card;
|
import forge.Card;
|
||||||
@@ -80,11 +82,9 @@ public class SpellPermanent extends Spell {
|
|||||||
|
|
||||||
this.setDescription(this.getStackDescription());
|
this.setDescription(this.getStackDescription());
|
||||||
|
|
||||||
if (this.getPayCosts().getTotalMana().countX() > 0) {
|
if (this.getPayCosts().getTotalMana().countX() > 0 && StringUtils.isNotBlank(getSourceCard().getSVar("X"))) {
|
||||||
if (!this.getSourceCard().getSVar("X").equals("")) {
|
|
||||||
this.setSVar("X", this.getSourceCard().getSVar("X"));
|
this.setSVar("X", this.getSourceCard().getSVar("X"));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
} // Spell_Permanent()
|
} // Spell_Permanent()
|
||||||
|
|
||||||
|
|||||||
@@ -129,15 +129,17 @@ public class CField implements ICDoc {
|
|||||||
private final Observer observerZones = new Observer() {
|
private final Observer observerZones = new Observer() {
|
||||||
@Override
|
@Override
|
||||||
public void update(final Observable a, final Object b) {
|
public void update(final Observable a, final Object b) {
|
||||||
CField.this.view.updateZones(CField.this.player);
|
FThreads.invokeInEdtNowOrLater(updateZonesRunnable);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
private final Runnable updateZonesRunnable = new Runnable() { @Override public void run() { CField.this.view.updateZones(CField.this.player); } };
|
||||||
|
private final Runnable updateDetailsRunnable = new Runnable() { @Override public void run() { CField.this.view.updateDetails(CField.this.player); } };
|
||||||
|
|
||||||
// Life total, poison total, and keywords, attached directly to Player.
|
// Life total, poison total, and keywords, attached directly to Player.
|
||||||
private final Observer observerDetails = new Observer() {
|
private final Observer observerDetails = new Observer() {
|
||||||
@Override
|
@Override
|
||||||
public void update(final Observable a, final Object b) {
|
public void update(final Observable a, final Object b) {
|
||||||
CField.this.view.updateDetails(CField.this.player);
|
FThreads.invokeInEdtNowOrLater(updateDetailsRunnable);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user