mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 11:32:00 -08:00
* Awakening of Vitu-Ghazi - fixed that it creates non legendary tokens
This commit is contained in:
parent
67f02ec5ab
commit
f7622d3c4a
2 changed files with 56 additions and 30 deletions
|
|
@ -1,19 +1,13 @@
|
||||||
|
|
||||||
package mage.abilities.effects.common.continuous;
|
package mage.abilities.effects.common.continuous;
|
||||||
|
|
||||||
import mage.MageObjectReference;
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.Mode;
|
import mage.abilities.Mode;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
import mage.constants.CardType;
|
import mage.constants.*;
|
||||||
import mage.constants.Duration;
|
|
||||||
import mage.constants.Layer;
|
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.SubLayer;
|
|
||||||
import mage.filter.FilterPermanent;
|
import mage.filter.FilterPermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.game.permanent.token.TokenImpl;
|
|
||||||
import mage.game.permanent.token.Token;
|
import mage.game.permanent.token.Token;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
@ -21,7 +15,6 @@ import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class BecomesCreatureAllEffect extends ContinuousEffectImpl {
|
public class BecomesCreatureAllEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
|
|
@ -29,13 +22,19 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl {
|
||||||
protected String theyAreStillType;
|
protected String theyAreStillType;
|
||||||
private final FilterPermanent filter;
|
private final FilterPermanent filter;
|
||||||
private boolean loseColor = true;
|
private boolean loseColor = true;
|
||||||
|
protected boolean loseName = false;
|
||||||
|
|
||||||
public BecomesCreatureAllEffect(Token token, String theyAreStillType, FilterPermanent filter, Duration duration, boolean loseColor) {
|
public BecomesCreatureAllEffect(Token token, String theyAreStillType, FilterPermanent filter, Duration duration, boolean loseColor) {
|
||||||
|
this(token, theyAreStillType, filter, duration, loseColor, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BecomesCreatureAllEffect(Token token, String theyAreStillType, FilterPermanent filter, Duration duration, boolean loseColor, boolean loseName) {
|
||||||
super(duration, Outcome.BecomeCreature);
|
super(duration, Outcome.BecomeCreature);
|
||||||
this.token = token;
|
this.token = token;
|
||||||
this.theyAreStillType = theyAreStillType;
|
this.theyAreStillType = theyAreStillType;
|
||||||
this.filter = filter;
|
this.filter = filter;
|
||||||
this.loseColor = loseColor;
|
this.loseColor = loseColor;
|
||||||
|
this.loseName = loseName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BecomesCreatureAllEffect(final BecomesCreatureAllEffect effect) {
|
public BecomesCreatureAllEffect(final BecomesCreatureAllEffect effect) {
|
||||||
|
|
@ -44,6 +43,7 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl {
|
||||||
this.theyAreStillType = effect.theyAreStillType;
|
this.theyAreStillType = effect.theyAreStillType;
|
||||||
this.filter = effect.filter.copy();
|
this.filter = effect.filter.copy();
|
||||||
this.loseColor = effect.loseColor;
|
this.loseColor = effect.loseColor;
|
||||||
|
this.loseName = effect.loseName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -65,30 +65,47 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl {
|
||||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||||
Set<Permanent> affectedPermanents = new HashSet<>();
|
Set<Permanent> affectedPermanents = new HashSet<>();
|
||||||
if (this.affectedObjectsSet) {
|
if (this.affectedObjectsSet) {
|
||||||
for(MageObjectReference ref : affectedObjectList) {
|
for (MageObjectReference ref : affectedObjectList) {
|
||||||
affectedPermanents.add(ref.getPermanent(game));
|
affectedPermanents.add(ref.getPermanent(game));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
affectedPermanents = new HashSet<>(game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game));
|
affectedPermanents = new HashSet<>(game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game));
|
||||||
}
|
}
|
||||||
|
|
||||||
for(Permanent permanent : affectedPermanents) {
|
for (Permanent permanent : affectedPermanents) {
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
switch (layer) {
|
switch (layer) {
|
||||||
|
case TextChangingEffects_3:
|
||||||
|
if (sublayer == SubLayer.NA) {
|
||||||
|
if (loseName) {
|
||||||
|
permanent.setName(token.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case TypeChangingEffects_4:
|
case TypeChangingEffects_4:
|
||||||
if (sublayer == SubLayer.NA) {
|
if (sublayer == SubLayer.NA) {
|
||||||
if (!token.getCardType().isEmpty()) {
|
if (theyAreStillType != null) {
|
||||||
for (CardType t : token.getCardType()) {
|
permanent.getSubtype(game).retainAll(SubType.getLandTypes());
|
||||||
if (!permanent.getCardType().contains(t)) {
|
permanent.getSubtype(game).addAll(token.getSubtype(game));
|
||||||
permanent.addCardType(t);
|
} else {
|
||||||
|
for (SubType t : token.getSubtype(game)) {
|
||||||
|
if (!permanent.hasSubtype(t, game)) {
|
||||||
|
permanent.getSubtype(game).add(t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (theyAreStillType == null) {
|
|
||||||
permanent.getSubtype(game).clear();
|
for (SuperType t : token.getSuperType()) {
|
||||||
|
if (!permanent.getSuperType().contains(t)) {
|
||||||
|
permanent.addSuperType(t);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!token.getSubtype(game).isEmpty()) {
|
|
||||||
permanent.getSubtype(game).addAll(token.getSubtype(game));
|
for (CardType t : token.getCardType()) {
|
||||||
|
if (!permanent.getCardType().contains(t)) {
|
||||||
|
permanent.addCardType(t);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -141,7 +158,11 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasLayer(Layer layer) {
|
public boolean hasLayer(Layer layer) {
|
||||||
return layer == Layer.PTChangingEffects_7 || layer == Layer.AbilityAddingRemovingEffects_6 || layer == Layer.ColorChangingEffects_5 || layer == Layer.TypeChangingEffects_4;
|
return layer == Layer.PTChangingEffects_7
|
||||||
|
|| layer == Layer.AbilityAddingRemovingEffects_6
|
||||||
|
|| layer == Layer.ColorChangingEffects_5
|
||||||
|
|| layer == Layer.TypeChangingEffects_4
|
||||||
|
|| layer == Layer.TextChangingEffects_3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -69,30 +69,34 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TypeChangingEffects_4:
|
case TypeChangingEffects_4:
|
||||||
if (sublayer == SubLayer.NA) {
|
if (sublayer == SubLayer.NA) {
|
||||||
if (loseAllAbilities) {
|
if (loseAllAbilities) {
|
||||||
permanent.getSubtype(game).retainAll(SubType.getLandTypes());
|
permanent.getSubtype(game).retainAll(SubType.getLandTypes());
|
||||||
permanent.getSubtype(game).addAll(token.getSubtype(game));
|
permanent.getSubtype(game).addAll(token.getSubtype(game));
|
||||||
} else {
|
} else {
|
||||||
if (!token.getSubtype(game).isEmpty()) {
|
for (SubType t : token.getSubtype(game)) {
|
||||||
for (SubType subtype : token.getSubtype(game)) {
|
if (!permanent.hasSubtype(t, game)) {
|
||||||
if (!permanent.hasSubtype(subtype, game)) {
|
permanent.getSubtype(game).add(t);
|
||||||
permanent.getSubtype(game).add(subtype);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!token.getCardType().isEmpty()) {
|
|
||||||
for (CardType t : token.getCardType()) {
|
for (SuperType t : token.getSuperType()) {
|
||||||
if (!permanent.getCardType().contains(t)) {
|
if (!permanent.getSuperType().contains(t)) {
|
||||||
permanent.addCardType(t);
|
permanent.addSuperType(t);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (CardType t : token.getCardType()) {
|
||||||
|
if (!permanent.getCardType().contains(t)) {
|
||||||
|
permanent.addCardType(t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ColorChangingEffects_5:
|
case ColorChangingEffects_5:
|
||||||
if (sublayer == SubLayer.NA) {
|
if (sublayer == SubLayer.NA) {
|
||||||
if (loseAllAbilities) {
|
if (loseAllAbilities) {
|
||||||
|
|
@ -107,6 +111,7 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AbilityAddingRemovingEffects_6:
|
case AbilityAddingRemovingEffects_6:
|
||||||
if (loseAllAbilities) {
|
if (loseAllAbilities) {
|
||||||
permanent.removeAllAbilities(source.getSourceId(), game);
|
permanent.removeAllAbilities(source.getSourceId(), game);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue