Merge branch 'flingCopyFix' into 'master'

SpellAbility: do not reset the PaidHash for copied spells

Closes #526

See merge request core-developers/forge!663
This commit is contained in:
Michael Kamensky
2018-06-22 07:21:49 +00:00
6 changed files with 19 additions and 11 deletions

View File

@@ -95,7 +95,9 @@ public class ComputerUtil {
sa.setHostCard(game.getAction().moveToStack(source, sa));
}
sa.resetPaidHash();
if (sa.isCopied()) {
sa.resetPaidHash();
}
if (sa.getApi() == ApiType.Charm && !sa.isWrapper()) {
CharmEffect.makeChoices(sa);

View File

@@ -213,7 +213,7 @@ public class CardFactory {
c.setMadness(original.isMadness());
final SpellAbilityStackInstance si = controller.getGame().getStack().getInstanceFromSpellAbility(sa);
if (si != null) {
if (si != null) {
c.setXManaCostPaid(si.getXManaPaid());
}
}

View File

@@ -471,11 +471,11 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
}
// Combined PaidLists
public HashMap<String, CardCollection> getPaidHash() {
public Map<String, CardCollection> getPaidHash() {
return paidLists;
}
public void setPaidHash(final HashMap<String, CardCollection> hash) {
paidLists = hash;
public void setPaidHash(final Map<String, CardCollection> hash) {
paidLists = Maps.newHashMap(hash);
}
public CardCollection getPaidList(final String str) {
@@ -667,8 +667,13 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
if (node != this) {
sb.append(" ");
}
String desc = node.getDescription();
if (node.getHostCard() != null) {
sb.append(TextUtil.fastReplace(node.getDescription(), "CARDNAME", node.getHostCard().getName()));
desc = TextUtil.fastReplace(desc, "CARDNAME", node.getHostCard().getName());
if (node.getOriginalHost() != null) {
desc = TextUtil.fastReplace(desc, "ORIGINALHOST", node.getOriginalHost().getName());
}
sb.append(desc);
}
node = node.getSubAbility();
}

View File

@@ -198,8 +198,7 @@ public class SpellAbilityStackInstance implements IIdentifiable, IHasCardView {
}
// Set Cost specific things here
ability.resetPaidHash();
ability.setPaidHash(new HashMap<String, CardCollection>(paidHash));
ability.setPaidHash(paidHash);
ability.setSplicedCards(splicedCards);
ability.getHostCard().setXManaCostPaid(xManaPaid);

View File

@@ -81,12 +81,12 @@ public class WrappedAbility extends Ability {
}
@Override
public void setPaidHash(final HashMap<String, CardCollection> hash) {
public void setPaidHash(final Map<String, CardCollection> hash) {
sa.setPaidHash(hash);
}
@Override
public HashMap<String, CardCollection> getPaidHash() {
public Map<String, CardCollection> getPaidHash() {
return sa.getPaidHash();
}

View File

@@ -118,7 +118,9 @@ public class HumanPlaySpellAbility {
ability.setHostCard(game.getAction().moveToStack(c, null));
}
ability.resetPaidHash();
if (!ability.isCopied()) {
ability.resetPaidHash();
}
if (manaTypeConversion) {
AbilityUtils.applyManaColorConversion(human, MagicColor.Constant.ANY_TYPE_CONVERSION);