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>
This commit is contained in:
Evan Kranzler 2021-01-26 08:52:35 -05:00 committed by GitHub
parent 6f42b90305
commit dacf30f4b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
259 changed files with 1857 additions and 1922 deletions

View file

@ -66,7 +66,7 @@ import mage.util.CardUtil;
import mage.util.GameLog;
import mage.util.MessageToClient;
import mage.util.RandomUtil;
import mage.util.functions.ApplyToPermanent;
import mage.util.functions.CopyApplier;
import mage.watchers.common.*;
import org.apache.log4j.Logger;
@ -1651,12 +1651,12 @@ public abstract class GameImpl implements Game, Serializable {
}
@Override
public Permanent copyPermanent(Permanent copyFromPermanent, UUID copyToPermanentId, Ability source, ApplyToPermanent applier) {
public Permanent copyPermanent(Permanent copyFromPermanent, UUID copyToPermanentId, Ability source, CopyApplier applier) {
return copyPermanent(Duration.Custom, copyFromPermanent, copyToPermanentId, source, applier);
}
@Override
public Permanent copyPermanent(Duration duration, Permanent copyFromPermanent, UUID copyToPermanentId, Ability source, ApplyToPermanent applier) {
public Permanent copyPermanent(Duration duration, Permanent copyFromPermanent, UUID copyToPermanentId, Ability source, CopyApplier applier) {
Permanent newBluePrint = null;
// handle copies of copies
for (Effect effect : getState().getContinuousEffects().getLayeredEffects(this)) {
@ -2231,9 +2231,9 @@ public abstract class GameImpl implements Game, Serializable {
Permanent attachment = getPermanent(attachmentId);
if (attachment != null
&& (attachment.isCreature()
|| !(attachment.getSubtype(this).contains(SubType.AURA)
|| attachment.getSubtype(this).contains(SubType.EQUIPMENT)
|| attachment.getSubtype(this).contains(SubType.FORTIFICATION)))) {
|| !(attachment.hasSubtype(SubType.AURA, this)
|| attachment.hasSubtype(SubType.EQUIPMENT, this)
|| attachment.hasSubtype(SubType.FORTIFICATION, this)))) {
if (perm.removeAttachment(attachment.getId(), null, this)) {
somethingHappened = true;
break;