Tokens and command objects reworked (part 1 of 2):

- fixed that copy effect doesn't restore original image after effect's end;
 - removed outdated availableImageSetCodes (all images auto-selected from tokens database now, related to #10139);
 - refactor command objects to use CommandObjectImpl;
 - refactor planes/emblems/etc objects to use MageObjectImpl, added copyable support;
 - refactor another game objects to remove some duplicated fields;
This commit is contained in:
Oleg Agafonov 2023-05-08 02:15:07 +04:00
parent 46f6593da8
commit 5f55c7c667
45 changed files with 517 additions and 477 deletions

View file

@ -61,7 +61,7 @@ public interface Ability extends Controllable, Serializable {
* @see Game#addTriggeredAbility(TriggeredAbility, GameEvent)
* @see mage.game.GameImpl#addDelayedTriggeredAbility(mage.abilities.DelayedTriggeredAbility)
*/
void newOriginalId();
void newOriginalId(); // TODO: delete newOriginalId???
/**
* Gets the {@link AbilityType} of this ability.

View file

@ -52,7 +52,7 @@ public abstract class AbilityImpl implements Ability {
private static final List<Ability> emptyAbilities = new ArrayList<>();
protected UUID id;
protected UUID originalId;
protected UUID originalId; // TODO: delete originalId???
protected AbilityType abilityType;
protected UUID controllerId;
protected UUID sourceId;

View file

@ -128,8 +128,7 @@ public class RollPlanarDieEffect extends OneShotEffect {
try {
if (plane != null && !planesVisited.contains(plane.getName())) {
foundNextPlane = true;
plane.setControllerId(controller.getId());
game.addPlane(plane, null, controller.getId());
game.addPlane(plane, controller.getId());
}
} catch (Exception ex) {
}

View file

@ -12,7 +12,6 @@ import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.costs.mana.ManaCost;
import mage.abilities.effects.common.continuous.BecomesFaceDownCreatureEffect;
import mage.abilities.effects.common.continuous.BecomesFaceDownCreatureEffect.FaceDownType;
import mage.cards.Card;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.game.Game;
@ -157,9 +156,6 @@ public class MorphAbility extends AlternativeSourceCostsImpl {
targetObject.getManaCost().clear();
Token emptyImage = new EmptyToken();
emptyImage.setOriginalExpansionSetCode("");
emptyImage.setExpansionSetCodeForImage("");
emptyImage.setOriginalCardNumber("");
// TODO: add morph image here?
if (targetObject instanceof Permanent) {