- Fixed Bronze Horse

- Fixed a crash when Precursor Golem is targeted with an Electrolyze
This commit is contained in:
swordshine
2014-05-08 04:56:36 +00:00
parent e03b435154
commit ae382760d0
4 changed files with 13 additions and 4 deletions

View File

@@ -101,7 +101,7 @@ public class CopySpellAbilityEffect extends SpellAbilityEffect {
mayChoseNewTargets = false;
for (GameObject o : candidates) {
SpellAbility copy = CardFactory.copySpellAbilityAndSrcCard(card, chosenSA.getHostCard(), chosenSA, true);
copy.resetFirstTarget(o);
copy.resetFirstTarget(o, chosenSA);
copies.add(copy);
}
} else {// Precursor Golem, Ink-Treader Nephilim
@@ -118,7 +118,7 @@ public class CopySpellAbilityEffect extends SpellAbilityEffect {
mayChoseNewTargets = false;
for (Card c : valid) {
SpellAbility copy = CardFactory.copySpellAbilityAndSrcCard(card, chosenSA.getHostCard(), chosenSA, true);
copy.resetFirstTarget(c);
copy.resetFirstTarget(c, chosenSA);
copies.add(copy);
}
}

View File

@@ -1409,12 +1409,16 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
* Reset the first target.
*
*/
public void resetFirstTarget(GameObject c) {
public void resetFirstTarget(GameObject c, SpellAbility originalSA) {
SpellAbility sa = this;
while (sa != null) {
if (sa.targetRestricions != null) {
sa.targetChosen = new TargetChoices();
sa.targetChosen.add(c);
if (!originalSA.targetRestricions.getDividedMap().isEmpty()) {
sa.targetRestricions.addDividedAllocation(c,
Iterables.getFirst(originalSA.targetRestricions.getDividedMap().values(), null));
}
break;
}
sa = sa.subAbility;

View File

@@ -709,4 +709,9 @@ public class TargetRestrictions {
public int getDividedValue(Object tgt) {
return this.dividedMap.get(tgt);
}
public HashMap<Object, Integer> getDividedMap() {
return this.dividedMap;
}
}