CopyPermanentEffect: add missing SetColor, move the remove Static Abilties into later code and check them for Embalm and Eternalize too

This commit is contained in:
Hanmac
2017-06-25 23:59:07 +00:00
parent e59993dfe0
commit 9e84472d4c

View File

@@ -202,6 +202,11 @@ public class CopyPermanentEffect extends SpellAbilityEffect {
copy.setType(CardType.parse(newType.toString())); copy.setType(CardType.parse(newType.toString()));
} }
if (sa.hasParam("SetColor")) {
copy.setColor(sa.getParam("SetColor"));
}
for (final String type : types) { for (final String type : types) {
copy.addType(type); copy.addType(type);
} }
@@ -230,11 +235,6 @@ public class CopyPermanentEffect extends SpellAbilityEffect {
} catch (final NumberFormatException e) { } catch (final NumberFormatException e) {
power = CardFactoryUtil.xCount(copy, copy.getSVar(rhs)); power = CardFactoryUtil.xCount(copy, copy.getSVar(rhs));
} }
for (StaticAbility sta : copy.getStaticAbilities()) {
Map<String, String> params = sta.getMapParams();
if (params.containsKey("CharacteristicDefining") && params.containsKey("SetPower"))
copy.removeStaticAbility(sta);
}
copy.setBasePower(power); copy.setBasePower(power);
} }
@@ -247,11 +247,6 @@ public class CopyPermanentEffect extends SpellAbilityEffect {
} catch (final NumberFormatException e) { } catch (final NumberFormatException e) {
toughness = CardFactoryUtil.xCount(copy, copy.getSVar(rhs)); toughness = CardFactoryUtil.xCount(copy, copy.getSVar(rhs));
} }
for (StaticAbility sta : copy.getStaticAbilities()) {
Map<String, String> params = sta.getMapParams();
if (params.containsKey("CharacteristicDefining") && params.containsKey("SetToughness"))
copy.removeStaticAbility(sta);
}
copy.setBaseToughness(toughness); copy.setBaseToughness(toughness);
} }
@@ -280,6 +275,37 @@ public class CopyPermanentEffect extends SpellAbilityEffect {
copy.setImageKey(ImageKeys.getTokenKey("eternalize_" + name)); copy.setImageKey(ImageKeys.getTokenKey("eternalize_" + name));
} }
// remove some characteristic static abilties
if (sa.hasParam("SetPower") || sa.hasParam("Eternalize")) {
for (StaticAbility sta : copy.getStaticAbilities()) {
Map<String, String> params = sta.getMapParams();
if (params.containsKey("CharacteristicDefining") && params.containsKey("SetPower"))
copy.removeStaticAbility(sta);
}
}
if (sa.hasParam("SetToughness") || sa.hasParam("Eternalize")) {
for (StaticAbility sta : copy.getStaticAbilities()) {
Map<String, String> params = sta.getMapParams();
if (params.containsKey("CharacteristicDefining") && params.containsKey("SetToughness"))
copy.removeStaticAbility(sta);
}
}
if (sa.hasParam("SetCreatureTypes")) {
for (StaticAbility sta : copy.getStaticAbilities()) {
Map<String, String> params = sta.getMapParams();
if (params.containsKey("CharacteristicDefining") && params.containsKey("AddType"))
copy.removeStaticAbility(sta);
}
copy.removeIntrinsicKeyword("Changeling");
}
if (sa.hasParam("SetColor") || sa.hasParam("Embalm") || sa.hasParam("Eternalize")) {
// there is currently no characteristic static ability, but remove Devoid keyword
copy.removeIntrinsicKeyword("Devoid");
}
copy.updateStateForView(); copy.updateStateForView();
// Temporarily register triggers of an object created with CopyPermanent // Temporarily register triggers of an object created with CopyPermanent