- Hopefully the final fix for Nomad Mythmaker

This commit is contained in:
moomarc
2012-11-21 06:23:52 +00:00
parent 033d0c9abf
commit 3ce02181c5
4 changed files with 44 additions and 19 deletions

View File

@@ -3,9 +3,7 @@ ManaCost:2 W
Types:Creature Human Nomad Cleric Types:Creature Human Nomad Cleric
Text:no text Text:no text
PT:2/2 PT:2/2
A:AB$ ChooseCard | Cost$ W T | Defined$ You | Amount$ 1 | Choices$ Creature.YouCtrl | RememberChosen$ True | SubAbility$ MakeMyth | AILogic$ AtLeast1 | SpellDescription$ Put target Aura card from a graveyard onto the battlefield under your control attached to a creature you control. A:AB$ ChangeZone | Cost$ W T | Origin$ Graveyard | Destination$ Battlefield | ValidTgts$ Aura | GainControl$ True | AttachedTo$ Creature.CanBeEnchantedBySource+YouCtrl | SpellDescription$ Put target Aura card from a graveyard onto the battlefield under your control attached to a creature you control.
SVar:MakeMyth:DB$ ChangeZone | Origin$ Graveyard | Destination$ Battlefield | ValidTgts$ Aura | AttachedTo$ Remembered | GainControl$ True | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:Rarity:Rare SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/nomad_mythmaker.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/nomad_mythmaker.jpg
SetInfo:JUD|Rare|http://magiccards.info/scans/en/ju/15.jpg SetInfo:JUD|Rare|http://magiccards.info/scans/en/ju/15.jpg

View File

@@ -6541,6 +6541,10 @@ public class Card extends GameEntity implements Comparable<Card> {
if (!source.canBeEnchantedBy(this)) { if (!source.canBeEnchantedBy(this)) {
return false; return false;
} }
} else if (property.startsWith("CanBeEnchantedBySource")) {
if (!this.canBeEnchantedBy(source)) {
return false;
}
} else if (property.startsWith("EquippedBy")) { } else if (property.startsWith("EquippedBy")) {
if (!this.equippedBy.contains(source)) { if (!this.equippedBy.contains(source)) {
return false; return false;

View File

@@ -1226,13 +1226,17 @@ public class ChangeZoneAi extends SpellAiLogic {
} }
if (sa.hasParam("AttachedTo")) { if (sa.hasParam("AttachedTo")) {
final ArrayList<Card> list = AbilityFactory.getDefinedCards(sa.getSourceCard(), List<Card> list = AbilityFactory.getDefinedCards(sa.getSourceCard(),
sa.getParam("AttachedTo"), sa); sa.getParam("AttachedTo"), sa);
if (list.isEmpty()) {
list = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
list = CardLists.getValidCards(list, sa.getParam("AttachedTo"), c.getController(), c);
}
if (!list.isEmpty()) { if (!list.isEmpty()) {
final Card attachedTo = list.get(0); final Card attachedTo = CardFactoryUtil.getBestAI(list);
if (c.isEnchanting()) { if (c.isEnchanting()) {
// If this Card is already Enchanting something // If this Card is already Enchanting something, need
// Need to unenchant it, then clear out the commands // to unenchant it, then clear out the commands
final GameEntity oldEnchanted = c.getEnchanting(); final GameEntity oldEnchanted = c.getEnchanting();
c.removeEnchanting(oldEnchanted); c.removeEnchanting(oldEnchanted);
c.clearEnchantCommand(); c.clearEnchantCommand();

View File

@@ -15,6 +15,7 @@ import forge.Singletons;
import forge.card.abilityfactory.AbilityFactory; import forge.card.abilityfactory.AbilityFactory;
import forge.card.abilityfactory.SpellEffect; import forge.card.abilityfactory.SpellEffect;
import forge.card.abilityfactory.ai.ChangeZoneAi; import forge.card.abilityfactory.ai.ChangeZoneAi;
import forge.card.cardfactory.CardFactoryUtil;
import forge.card.spellability.AbilitySub; import forge.card.spellability.AbilitySub;
import forge.card.spellability.SpellAbility; import forge.card.spellability.SpellAbility;
import forge.card.spellability.SpellAbilityStackInstance; import forge.card.spellability.SpellAbilityStackInstance;
@@ -413,15 +414,26 @@ public class ChangeZoneEffect extends SpellEffect {
tgtC.addController(sa.getSourceCard()); tgtC.addController(sa.getSourceCard());
} }
if (sa.hasParam("AttachedTo")) { if (sa.hasParam("AttachedTo")) {
final ArrayList<Card> list = AbilityFactory.getDefinedCards(sa.getSourceCard(), List<Card> list = AbilityFactory.getDefinedCards(sa.getSourceCard(),
sa.getParam("AttachedTo"), sa); sa.getParam("AttachedTo"), sa);
if (list.isEmpty()) {
list = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
list = CardLists.getValidCards(list, sa.getParam("AttachedTo"), tgtC.getController(), tgtC);
}
if (!list.isEmpty()) { if (!list.isEmpty()) {
final Card attachedTo = list.get(0); Card attachedTo = null;
if (player.isHuman()) {
if (list.size() > 1) {
attachedTo = GuiChoose.one(tgtC + " - Select a card to attach to.", list);
} else {
attachedTo = list.get(0);
}
} else { // AI player
attachedTo = CardFactoryUtil.getBestAI(list);
}
if (tgtC.isEnchanting()) { if (tgtC.isEnchanting()) {
// If this Card is already Enchanting // If this Card is already Enchanting something, need
// something // to unenchant it, then clear out the commands
// Need to unenchant it, then clear out the
// commands
final GameEntity oldEnchanted = tgtC.getEnchanting(); final GameEntity oldEnchanted = tgtC.getEnchanting();
tgtC.removeEnchanting(oldEnchanted); tgtC.removeEnchanting(oldEnchanted);
tgtC.clearEnchantCommand(); tgtC.clearEnchantCommand();
@@ -666,16 +678,23 @@ public class ChangeZoneEffect extends SpellEffect {
} }
if (sa.hasParam("AttachedTo")) { if (sa.hasParam("AttachedTo")) {
final ArrayList<Card> list = AbilityFactory.getDefinedCards(sa.getSourceCard(), List<Card> list = AbilityFactory.getDefinedCards(sa.getSourceCard(),
sa.getParam("AttachedTo"), sa); sa.getParam("AttachedTo"), sa);
if (list.isEmpty()) {
list = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
list = CardLists.getValidCards(list, sa.getParam("AttachedTo"), c.getController(), c);
}
if (!list.isEmpty()) { if (!list.isEmpty()) {
final Card attachedTo = list.get(0); Card attachedTo = null;
if (list.size() > 1) {
attachedTo = GuiChoose.one(c + " - Select a card to attach to.", list);
} else {
attachedTo = list.get(0);
}
if (c.isEnchanting()) { if (c.isEnchanting()) {
// If this Card is already Enchanting something // If this Card is already Enchanting something, need
// Need to unenchant it, then clear out the // to unenchant it, then clear out the commands
// commands
final GameEntity oldEnchanted = c.getEnchanting(); final GameEntity oldEnchanted = c.getEnchanting();
oldEnchanted.removeEnchantedBy(c);
c.removeEnchanting(oldEnchanted); c.removeEnchanting(oldEnchanted);
c.clearEnchantCommand(); c.clearEnchantCommand();
c.clearUnEnchantCommand(); c.clearUnEnchantCommand();