forked from External/mage
Costs Tag Tracking part 2: Tag system and X values, reworked deep copy code (#11406)
* Implement Costs Tag Map system * Use Costs Tag Map system to store X value for spells, abilities, and resolving permanents * Store Bestow without target's tags Change functions for getting tags and storing the tags of a new permanent * Create and use deep copy function in CardUtil, add Copyable<T> to many classes * Fix Hall Of the Bandit Lord infinite loop * Add additional comments * Don't store null/empty costs tags maps (saves memory) * Fix two more Watchers with Ability variable * Add check for exact collection types during deep copy * Use generics instead of pure type erasure during deep copy * convert more code to using deep copy helper, everything use Object copier, add EnumMap * fix documentation * Don't need the separate null checks anymore (handled in deepCopyObject) * Minor cleanup
This commit is contained in:
parent
72e30f1574
commit
bea33c7493
29 changed files with 458 additions and 338 deletions
|
|
@ -1,9 +1,6 @@
|
|||
package mage.game.stack;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.Mana;
|
||||
import mage.ObjectColor;
|
||||
import mage.*;
|
||||
import mage.abilities.*;
|
||||
import mage.abilities.costs.mana.ActivationManaAbilityStep;
|
||||
import mage.abilities.costs.mana.ManaCost;
|
||||
|
|
@ -336,6 +333,8 @@ public class Spell extends StackObjectImpl implements Card {
|
|||
}
|
||||
} else {
|
||||
permId = card.getId();
|
||||
MageObjectReference mor = new MageObjectReference(getSpellAbility());
|
||||
game.storePermanentCostsTags(mor, getSpellAbility());
|
||||
flag = controller.moveCards(card, Zone.BATTLEFIELD, ability, game, false, faceDown, false, null);
|
||||
}
|
||||
if (flag) {
|
||||
|
|
@ -374,6 +373,8 @@ public class Spell extends StackObjectImpl implements Card {
|
|||
}
|
||||
// Aura has no legal target and its a bestow enchantment -> Add it to battlefield as creature
|
||||
if (SpellAbilityCastMode.BESTOW.equals(this.getSpellAbility().getSpellAbilityCastMode())) {
|
||||
MageObjectReference mor = new MageObjectReference(getSpellAbility());
|
||||
game.storePermanentCostsTags(mor, getSpellAbility());
|
||||
if (controller.moveCards(card, Zone.BATTLEFIELD, ability, game, false, faceDown, false, null)) {
|
||||
Permanent permanent = game.getPermanent(card.getId());
|
||||
if (permanent instanceof PermanentCard) {
|
||||
|
|
@ -397,6 +398,8 @@ public class Spell extends StackObjectImpl implements Card {
|
|||
token.putOntoBattlefield(1, game, ability, getControllerId(), false, false, null, null, false);
|
||||
return true;
|
||||
} else {
|
||||
MageObjectReference mor = new MageObjectReference(getSpellAbility());
|
||||
game.storePermanentCostsTags(mor, getSpellAbility());
|
||||
return controller.moveCards(card, Zone.BATTLEFIELD, ability, game, false, faceDown, false, null);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue