minor rearrangement (just need to get these out of files-to-commit list)

This commit is contained in:
Maxmtg
2013-05-16 06:21:15 +00:00
parent acda6157a7
commit a44f27d280
2 changed files with 14 additions and 37 deletions

View File

@@ -560,27 +560,17 @@ public class ManaPool {
this.owner.updateObservers(); this.owner.updateObservers();
} }
/**
* <p>
* accountFor.
* </p>
*
* @param sa
* a {@link forge.card.spellability.SpellAbility} object.
* @param ma
* a {@link forge.card.spellability.AbilityMana} object.
* @return a boolean.
*/
private boolean accountFor(final SpellAbility sa, final AbilityManaPart ma) { private boolean accountFor(final SpellAbility sa, final AbilityManaPart ma) {
final ArrayList<Mana> manaPaid = sa.getPayingMana(); final ArrayList<Mana> manaPaid = sa.getPayingMana();
if ((manaPaid.size() == 0) && (this.floatingMana.size() == 0)) { if ((manaPaid.size() == 0) && (this.floatingMana.size() == 0)) {
return false; return false;
} }
final ArrayList<Mana> removePaying = new ArrayList<Mana>(); final ArrayList<Mana> removePaying = new ArrayList<Mana>();
final ArrayList<Mana> removeFloating = new ArrayList<Mana>(); final ArrayList<Mana> removeFloating = new ArrayList<Mana>();
boolean manaNotAccountedFor = false; boolean manaNotAccountedFor = false;
// loop over mana produced by mana ability // loop over mana produced by mana ability
for (Mana mana : ma.getLastProduced()) { for (Mana mana : ma.getLastProduced()) {
@@ -595,13 +585,13 @@ public class ManaPool {
break; break;
} }
} }
// When is it legitimate for all the mana not to be accountable? // When is it legitimate for all the mana not to be accountable?
// Does this condition really indicate an bug in Forge? // Does this condition really indicate an bug in Forge?
if (manaNotAccountedFor) { if (manaNotAccountedFor) {
return false; return false;
} }
for (int k = 0; k < removePaying.size(); k++) { for (int k = 0; k < removePaying.size(); k++) {
this.removeManaFrom(manaPaid, removePaying.get(k)); this.removeManaFrom(manaPaid, removePaying.get(k));
} }
@@ -611,23 +601,10 @@ public class ManaPool {
return true; return true;
} }
/**
* <p>
* refundManaPaid.
* </p>
*
* @param sa
* a {@link forge.card.spellability.SpellAbility} object.
* @param untap
* a boolean.
*/
public final void refundManaPaid(final SpellAbility sa, final boolean untap) { public final void refundManaPaid(final SpellAbility sa, final boolean untap) {
// TODO having some crash in here related to undo and not tracking // TODO having some crash in here related to undo and not tracking abilities properly
// abilities properly
final List<SpellAbility> payAbs = sa.getPayingManaAbilities(); for (final SpellAbility am : sa.getPayingManaAbilities()) { // go through paidAbilities if they are undoable
// go through paidAbilities if they are undoable
for (final SpellAbility am : payAbs) {
AbilityManaPart m = am.getManaPart(); AbilityManaPart m = am.getManaPart();
if (am.isUndoable()) { if (am.isUndoable()) {
if (this.accountFor(sa, m)) { if (this.accountFor(sa, m)) {
@@ -636,7 +613,7 @@ public class ManaPool {
// else can't account let clearPay move paying back to floating // else can't account let clearPay move paying back to floating
} }
} }
// move leftover pay back to floating // move leftover pay back to floating
this.clearManaPaid(sa, true); this.clearManaPaid(sa, true);
} }

View File

@@ -19,6 +19,7 @@ package forge.card.spellability;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import forge.Card; import forge.Card;
@@ -306,10 +307,9 @@ public class AbilityManaPart implements java.io.Serializable {
return true; return true;
} }
if (this.getOrigProduced().contains("Chosen")) { if (this.getOrigProduced().contains("Chosen") && this.getSourceCard() == null ) {
if (this.getSourceCard() != null && !this.getSourceCard().getChosenColor().isEmpty() List<String> chosenCol = this.getSourceCard().getChosenColor();
&& MagicColor.toShortString(this.getSourceCard().getChosenColor().get(0)) if ( !chosenCol.isEmpty() && MagicColor.toShortString(chosenCol.get(0)).contains(s)) {
.contains(s)) {
return true; return true;
} }
} }