mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
* Prossh, Skyraider of Kher - Fixed that the tokens were not created if the spell was countered (part 2).
This commit is contained in:
parent
befc3d73ef
commit
209f3bc8c8
2 changed files with 19 additions and 5 deletions
|
@ -27,9 +27,11 @@
|
|||
*/
|
||||
package mage.abilities.dynamicvalue.common;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.game.stack.StackObject;
|
||||
|
@ -45,12 +47,16 @@ public class ManaSpentToCastCount implements DynamicValue{
|
|||
|
||||
@Override
|
||||
public int calculate(Game game, Ability source, Effect effect) {
|
||||
if (!game.getStack().isEmpty()) {
|
||||
for (StackObject stackObject : game.getStack()) {
|
||||
if (stackObject instanceof Spell && ((Spell)stackObject).getSourceId().equals(source.getSourceId())) {
|
||||
return ((Spell)stackObject).getConvertedManaCost();
|
||||
Spell spell = game.getStack().getSpell(source.getSourceId());
|
||||
if (spell == null) {
|
||||
MageObject mageObject = game.getLastKnownInformation(source.getSourceId(), Zone.STACK);
|
||||
if (mageObject instanceof Spell) {
|
||||
spell = (Spell) mageObject;
|
||||
}
|
||||
}
|
||||
if (spell != null) {
|
||||
// NOT the cmc of the spell on the stack
|
||||
return spell.getSpellAbility().getManaCostsToPay().convertedManaCost() + spell.getSpellAbility().getManaCostsToPay().getX();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -2099,6 +2099,14 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
if (object != null) {
|
||||
return object.copy();
|
||||
}
|
||||
for (MageObject mageObject:lkiMap.values()) {
|
||||
if (mageObject instanceof Spell) {
|
||||
if (((Spell)mageObject).getCard().getId().equals(objectId)) {
|
||||
return mageObject;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue