foul-magics/Mage/src/main/java/mage/game/MageObjectAttribute.java
Evan Kranzler dacf30f4b9
Refactoring subtypes to make Maskwood Nexus work (ready for review) (#7432)
* removed and renamed SubTypeList

* updated subtype test

* refactored Changeling to be an ability that actually does something

* moved isAllCreatureTypes into SubTypes class

* renamed copyTo method to copyFrom

* added removeAllCreatureTypes where usable

* replaced some subtype methods

* replaced some more subtype methods

* replaced subtype mass add/remove methods

* updated more subtype methods

* fixed some errors

* made common shared creature type predicate

* refactored another card involving subtypes

* Added usage of object attribute in subTypes's write operations;

* Refactor: use same param styles in subtype methods

* Refactor: simplified usage of copy appliers;

* Refactor: fixed code usage in CopyApplier

Co-authored-by: Oleg Agafonov <jaydi85@gmail.com>
2021-01-26 08:52:35 -05:00

42 lines
1,000 B
Java

package mage.game;
import mage.MageObject;
import mage.ObjectColor;
import mage.util.SubTypes;
import java.io.Serializable;
/**
* This class saves changed attributes of mage objects (e.g. in command zone, graveyard, exile or
* player hands or libraries).
*
* @author LevelX2
*/
public class MageObjectAttribute implements Serializable {
protected ObjectColor color;
protected SubTypes subtype;
public MageObjectAttribute(MageObject mageObject, Game game) {
color = mageObject.getColor().copy();
subtype = new SubTypes(mageObject.getSubtype(game));
}
public MageObjectAttribute(MageObjectAttribute mageObjectAttribute) {
this.color = mageObjectAttribute.color;
this.subtype = mageObjectAttribute.subtype;
}
public MageObjectAttribute copy() {
return new MageObjectAttribute(this);
}
public ObjectColor getColor() {
return color;
}
public SubTypes getSubtype() {
return subtype;
}
}