Fixed some primitives with conjure and phyrexian mana, fixed a bug on "conjure" ability, improved getCardbyName method for castcard with namedcard option, for meld and for flip/turnside ability.

This commit is contained in:
Vittorio Alfieri
2023-06-24 23:01:25 +02:00
parent 20fa180864
commit 9a23c4b83b
6 changed files with 78 additions and 75 deletions
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -1,6 +1,6 @@
#Primitives Pack for Wagic the Homebrew. #Primitives Pack for Wagic the Homebrew.
#Please keep these card alphabetized, and try to have the "name=" line at the top of each card #Please keep these card alphabetized, and try to have the "name=" line at the top of each card
#I sorted this programmatically so the other comments are removed except for AUTO_DEFINE - Vitty85 23-06-2023 #I sorted this programmatically so the other comments are removed except for AUTO_DEFINE - Vitty85 24-06-2023
[card] [card]
name=Abandon Reason name=Abandon Reason
target=<upto:2>creature target=<upto:2>creature
@@ -92997,7 +92997,7 @@ type=Sorcery
[/card] [/card]
[card] [card]
name=Reckless Assault name=Reckless Assault
auto={L:2}{1}:damage:1 target(creature,player) auto={L:2}{1}:damage:1 target(player,creature)
text={1}, Pay 2 life: Reckless Assault deals 1 damage to target creature or player. text={1}, Pay 2 life: Reckless Assault deals 1 damage to target creature or player.
mana={2}{B}{R} mana={2}{B}{R}
type=Enchantment type=Enchantment
@@ -1,6 +1,6 @@
#Planeswalkers Primitives Pack for Wagic the Homebrew. #Planeswalkers Primitives Pack for Wagic the Homebrew.
#Please keep these card alphabetized, and try to have the "name=" line at the top of each card #Please keep these card alphabetized, and try to have the "name=" line at the top of each card
#We sorted this in alphabetical order - Luruz & Vitty85 23-06-2023 #We sorted this in alphabetical order - Luruz & Vitty85 24-06-2023
[card] [card]
name=Abian, Luvion Usurper name=Abian, Luvion Usurper
auto=counter(0/0,5,loyalty) auto=counter(0/0,5,loyalty)
@@ -961,7 +961,7 @@ auto=counter(0/0,4,Loyalty)
auto={C(0/0,1,Loyalty)}:name(+1: Don't untap any elf) moverandom(elf) from(myhand) to(myHand) and!( counter(1/1.1.PerpetualPT) )! auto={C(0/0,1,Loyalty)}:name(+1: Don't untap any elf) moverandom(elf) from(myhand) to(myHand) and!( counter(1/1.1.PerpetualPT) )!
auto={C(0/0,1,Loyalty)}:name(+1: Untap target elf) target(elf|mybattlefield) transforms((,newability[untap],newability[counter(1/1.1.PerpetualPT)],newability[name(Random elf perpetually gets 1/1) moverandom(elf) from(myhand) to(myHand) and!( counter(1/1.1.PerpetualPT) )!])) forever auto={C(0/0,1,Loyalty)}:name(+1: Untap target elf) target(elf|mybattlefield) transforms((,newability[untap],newability[counter(1/1.1.PerpetualPT)],newability[name(Random elf perpetually gets 1/1) moverandom(elf) from(myhand) to(myHand) and!( counter(1/1.1.PerpetualPT) )!])) forever
auto={C(0/0,-1,Loyalty)}:name(-1: Seek an Elf) moverandom(*[elf]) from(mylibrary) to(myhand) auto={C(0/0,-1,Loyalty)}:name(-1: Seek an Elf) moverandom(*[elf]) from(mylibrary) to(myhand)
auto={C(0/0,-6,Loyalty)}:name(-6: Conjure a Regal Force) conjure cards(Regal Force) zone(myreveal) and!( moveto(mybattlefield) )! auto={C(0/0,-6,Loyalty)}:name(-6: Conjure a Regal Force) conjure cards(Regal Force) zone(mybattlefield)
text=+1: Choose up to one target Elf. Untap it. It and a random Elf creature card in your hand each perpetually gets +1/+1. -- 1: Seek an Elf card. -- 6: Conjure a Regal Force card onto the battlefield. text=+1: Choose up to one target Elf. Untap it. It and a random Elf creature card in your hand each perpetually gets +1/+1. -- 1: Seek an Elf card. -- 6: Conjure a Regal Force card onto the battlefield.
mana={1}{G}{G} mana={1}{G}{G}
type=Legendary Planeswalker type=Legendary Planeswalker
@@ -1063,21 +1063,21 @@ subtype=Garruk
name=Garruk, Wrath of the Wilds name=Garruk, Wrath of the Wilds
auto=counter(0/0,3,loyalty) auto=counter(0/0,3,loyalty)
auto={C(0/0,1,Loyalty)}:name(+1: Creature perpetually gets 1/1) target(creature|myhand) transforms((,newability[counter(1/1.1.PerpetualPT) notrg],newability[changecost(colorless:-1) forcedalive])) forever auto={C(0/0,1,Loyalty)}:name(+1: Creature perpetually gets 1/1) target(creature|myhand) transforms((,newability[counter(1/1.1.PerpetualPT) notrg],newability[changecost(colorless:-1) forcedalive])) forever
auto={C(0/0,-1,Loyalty)}:name(-1: Draft Mosscoat Goriak) conjure cards(Mosscoat Goriak) zone(myreveal) and!( moveto(myBattlefield) )! auto={C(0/0,-1,Loyalty)}:name(-1: Draft Mosscoat Goriak) conjure cards(Mosscoat Goriak) zone(mybattlefield)
auto={C(0/0,-1,Loyalty)}:name(-1: Draft Sylvan Brushstrider) conjure cards(Sylvan Brushstrider) zone(myreveal) and!( moveto(myBattlefield) )! auto={C(0/0,-1,Loyalty)}:name(-1: Draft Sylvan Brushstrider) conjure cards(Sylvan Brushstrider) zone(mybattlefield)
auto={C(0/0,-1,Loyalty)}:name(-1: Draft Murasa Rootgrazer) conjure cards(Murasa Rootgrazer) zone(myreveal) and!( moveto(myBattlefield) )! auto={C(0/0,-1,Loyalty)}:name(-1: Draft Murasa Rootgrazer) conjure cards(Murasa Rootgrazer) zone(mybattlefield)
auto={C(0/0,-1,Loyalty)}:name(-1: Draft Dire Wolf Prowler) conjure cards(Dire Wolf Prowler) zone(myreveal) and!( moveto(myBattlefield) )! auto={C(0/0,-1,Loyalty)}:name(-1: Draft Dire Wolf Prowler) conjure cards(Dire Wolf Prowler) zone(mybattlefield)
auto={C(0/0,-1,Loyalty)}:name(-1: Draft Ferocious Pup) conjure cards(Ferocious Pup) zone(myreveal) and!( moveto(myBattlefield) )! auto={C(0/0,-1,Loyalty)}:name(-1: Draft Ferocious Pup) conjure cards(Ferocious Pup) zone(mybattlefield)
auto={C(0/0,-1,Loyalty)}:name(-1: Draft Pestilent Wolf) conjure cards(Pestilent Wolf) zone(myreveal) and!( moveto(myBattlefield) )! auto={C(0/0,-1,Loyalty)}:name(-1: Draft Pestilent Wolf) conjure cards(Pestilent Wolf) zone(mybattlefield)
auto={C(0/0,-1,Loyalty)}:name(-1: Draft Garruk's Uprising) conjure cards(Garruk's Uprising) zone(myreveal) and!( moveto(myBattlefield) )! auto={C(0/0,-1,Loyalty)}:name(-1: Draft Garruk's Uprising) conjure cards(Garruk's Uprising) zone(mybattlefield)
auto={C(0/0,-1,Loyalty)}:name(-1: Draft Dawntreader Elk) conjure cards(Dawntreader Elk) zone(myreveal) and!( moveto(myBattlefield) )! auto={C(0/0,-1,Loyalty)}:name(-1: Draft Dawntreader Elk) conjure cards(Dawntreader Elk) zone(mybattlefield)
auto={C(0/0,-1,Loyalty)}:name(-1: Draft Nessian Hornbeetle) conjure cards(Nessian Hornbeetle) zone(myreveal) and!( moveto(myBattlefield) )! auto={C(0/0,-1,Loyalty)}:name(-1: Draft Nessian Hornbeetle) conjure cards(Nessian Hornbeetle) zone(mybattlefield)
auto={C(0/0,-1,Loyalty)}:name(-1: Draft Territorial Scythecat) conjure cards(Territorial Scythecat) zone(myreveal) and!( moveto(myBattlefield) )! auto={C(0/0,-1,Loyalty)}:name(-1: Draft Territorial Scythecat) conjure cards(Territorial Scythecat) zone(mybattlefield)
auto={C(0/0,-1,Loyalty)}:name(-1: Draft Trufflesnout) conjure cards(Trufflesnout) zone(myreveal) and!( moveto(myBattlefield) )! auto={C(0/0,-1,Loyalty)}:name(-1: Draft Trufflesnout) conjure cards(Trufflesnout) zone(mybattlefield)
auto={C(0/0,-1,Loyalty)}:name(-1: Draft Wary Okapi) conjure cards(Wary Okapi) zone(myreveal) and!( moveto(myBattlefield) )! auto={C(0/0,-1,Loyalty)}:name(-1: Draft Wary Okapi) conjure cards(Wary Okapi) zone(mybattlefield)
auto={C(0/0,-1,Loyalty)}:name(-1: Draft Scurrid Colony) conjure cards(Scurrid Colony) zone(myreveal) and!( moveto(myBattlefield) )! auto={C(0/0,-1,Loyalty)}:name(-1: Draft Scurrid Colony) conjure cards(Scurrid Colony) zone(mybattlefield)
auto={C(0/0,-1,Loyalty)}:name(-1: Draft Barkhide Troll) conjure cards(Barkhide Troll) zone(myreveal) and!( moveto(myBattlefield) )! auto={C(0/0,-1,Loyalty)}:name(-1: Draft Barkhide Troll) conjure cards(Barkhide Troll) zone(mybattlefield)
auto={C(0/0,-1,Loyalty)}:name(-1: Draft Underdark Basilisk) conjure cards(Underdark Basilisk) zone(myreveal) and!( moveto(myBattlefield) )! auto={C(0/0,-1,Loyalty)}:name(-1: Draft Underdark Basilisk) conjure cards(Underdark Basilisk) zone(mybattlefield)
auto={C(0/0,-5,Loyalty)}:name(-3: Your creatures get 3/3) all(creature|myBattlefield) transforms((,newability[3/3],newability[trample])) ueot auto={C(0/0,-5,Loyalty)}:name(-3: Your creatures get 3/3) all(creature|myBattlefield) transforms((,newability[3/3],newability[trample])) ueot
text=+1: Choose a creature card in your hand. it perpetually gets +1/+1 and perpetually gains "This spell costs {1} less to cast." -- 1: Draft a card from Garruk, Wrath of the Wild's spellbook and put it onto the battlefield. -- 5: Until end of turn, creatures you control get +3/+3 and gain trample. text=+1: Choose a creature card in your hand. it perpetually gets +1/+1 and perpetually gains "This spell costs {1} less to cast." -- 1: Draft a card from Garruk, Wrath of the Wild's spellbook and put it onto the battlefield. -- 5: Until end of turn, creatures you control get +3/+3 and gain trample.
mana={2}{G}{G} mana={2}{G}{G}
@@ -3176,7 +3176,7 @@ name=Teyo, Aegis Adept
auto=counter(0/0,4,Loyalty) auto=counter(0/0,4,Loyalty)
auto={C(0/0,1,Loyalty)}:name(+1: Don't target any creature) donothing auto={C(0/0,1,Loyalty)}:name(+1: Don't target any creature) donothing
auto={C(0/0,1,Loyalty)}:name(+1: Creature can attack) target(creature) counter(0/0.1.PerpetualTeyoEffect) auto={C(0/0,1,Loyalty)}:name(+1: Creature can attack) target(creature) counter(0/0.1.PerpetualTeyoEffect)
auto={C(0/0,-2,Loyalty)}:name(-2: Conjure a Lumbering Lightshield) conjure cards(Lumbering Lightshield) zone(myreveal) and!( moveto(mybattlefield) )! auto={C(0/0,-2,Loyalty)}:name(-2: Conjure a Lumbering Lightshield) conjure cards(Lumbering Lightshield) zone(mybattlefield)
auto={C(0/0,-6,Loyalty)}:name(-6: Emblem Return creature) ability$!emblem transforms((,newability[@each my endofturn:name(Return white creature) name(Return white creature) target(creature[white]|mygraveyard) moveto(mybattlefield) and!( transforms((,newability[life:toughness controller])) oneshot )!])) forever dontremove!$ controller auto={C(0/0,-6,Loyalty)}:name(-6: Emblem Return creature) ability$!emblem transforms((,newability[@each my endofturn:name(Return white creature) name(Return white creature) target(creature[white]|mygraveyard) moveto(mybattlefield) and!( transforms((,newability[life:toughness controller])) oneshot )!])) forever dontremove!$ controller
auto=emblem transforms((,newability[lord(*[counter{0/0.1.PerpetualTeyoEffect}]|myzones) transforms((,setpower=t,newability[canattack]))])) forever dontremove auto=emblem transforms((,newability[lord(*[counter{0/0.1.PerpetualTeyoEffect}]|myzones) transforms((,setpower=t,newability[canattack]))])) forever dontremove
text=+1: Up to one target creature's base power perpetually becomes equal to its toughness. It perpetually gains "This creature can attack as though it didn't have defender." -- 2: Conjure a Lumbering Lightshield card onto the battlefield. 6: You get an emblem with "At the beginning of your end step, return target white creature card from your graveyard to the battlefield. You gain life equal to its toughness." text=+1: Up to one target creature's base power perpetually becomes equal to its toughness. It perpetually gains "This creature can attack as though it didn't have defender." -- 2: Conjure a Lumbering Lightshield card onto the battlefield. 6: You get an emblem with "At the beginning of your end step, return target white creature card from your graveyard to the battlefield. You gain life equal to its toughness."
+30 -11
View File
@@ -2472,7 +2472,7 @@ MTGCardInstance * AAConjure::makeCard()
newName = names.at(std::rand() % names.size()); newName = names.at(std::rand() % names.size());
} }
MTGCardInstance * card = NULL; MTGCardInstance * card = NULL;
MTGCard * cardData = MTGCollection()->getCardByName(newName); MTGCard * cardData = MTGCollection()->getCardByName(newName, source->setId);
if(!cardData) return NULL; if(!cardData) return NULL;
card = NEW MTGCardInstance(cardData, source->controller()->game); card = NEW MTGCardInstance(cardData, source->controller()->game);
card->owner = source->controller(); card->owner = source->controller();
@@ -2489,7 +2489,26 @@ int AAConjure::resolve()
if(_target->mutation && _target->parentCards.size() > 0) return 0; // Mutated down cards cannot be conjured, they will follow the fate of top-card if(_target->mutation && _target->parentCards.size() > 0) return 0; // Mutated down cards cannot be conjured, they will follow the fate of top-card
theNamedCard = makeCard(); theNamedCard = makeCard();
if(theNamedCard){ if(theNamedCard){
MTGCardInstance * copy = source->controller()->game->putInZone(theNamedCard, theNamedCard->currentZone, MTGGameZone::stringToZone(game, cardZone, theNamedCard, NULL)); Spell * spell = NULL;
MTGGameZone * targetZone = MTGGameZone::stringToZone(game, cardZone, theNamedCard, NULL);
MTGCardInstance * copy = source->controller()->game->putInZone(theNamedCard, theNamedCard->currentZone, targetZone);
if(!copy){
this->forceDestroy = true;
return 0;
}
if(targetZone == copy->controller()->game->battlefield){
copy->changeController(source->controller(), true);
if (game->targetChooser)
{
game->targetChooser->Owner = source->controller();
spell = game->mLayers->stackLayer()->addSpell(copy, game->targetChooser, NULL, 1, 0);
game->targetChooser = NULL;
}
else
{
spell = game->mLayers->stackLayer()->addSpell(copy, NULL, NULL, 1, 0);
}
}
if(andAbility) if(andAbility)
{ {
MTGAbility * andAbilityClone = andAbility->clone(); MTGAbility * andAbilityClone = andAbility->clone();
@@ -2504,9 +2523,9 @@ int AAConjure::resolve()
andAbilityClone->addToGame(); andAbilityClone->addToGame();
} }
} }
this->forceDestroy = true;
return 1;
} }
this->forceDestroy = true;
return 1;
} }
return 0; return 0;
} }
@@ -4816,7 +4835,7 @@ int AATurnSide::resolve()
if(_target->isFlipped == 0){ if(_target->isFlipped == 0){
if(_SideName == "backside" && _target->backSide != "") if(_SideName == "backside" && _target->backSide != "")
_SideName = _target->backSide; // Added to allow to turn a card on its backside. _SideName = _target->backSide; // Added to allow to turn a card on its backside.
fcard = MTGCollection()->getCardByName(_SideName); fcard = MTGCollection()->getCardByName(_SideName, _target->setId);
if(!fcard) return 0; if(!fcard) return 0;
sideCard = NEW MTGCardInstance(fcard, _target->controller()->game); sideCard = NEW MTGCardInstance(fcard, _target->controller()->game);
_target->nameOrig = _target->name; _target->nameOrig = _target->name;
@@ -4843,7 +4862,7 @@ int AATurnSide::resolve()
} }
} }
} else { } else {
fcard = MTGCollection()->getCardByName(_target->nameOrig); fcard = MTGCollection()->getCardByName(_target->nameOrig, _target->setId);
if(!fcard) return 0; if(!fcard) return 0;
_target->name = _target->nameOrig; _target->name = _target->nameOrig;
_target->setName(_target->nameOrig); _target->setName(_target->nameOrig);
@@ -4952,7 +4971,7 @@ int AAFlip::resolve()
flipStats = _target->chooseaname; // Added to allow the transformation of a card in a choosen name. flipStats = _target->chooseaname; // Added to allow the transformation of a card in a choosen name.
else if(flipStats == "backside" && _target->backSide != "") else if(flipStats == "backside" && _target->backSide != "")
flipStats = _target->backSide; // Added to allow the transformation of a card in its backside (e.g. Werewolves transformations). flipStats = _target->backSide; // Added to allow the transformation of a card in its backside (e.g. Werewolves transformations).
MTGCard * fcard = MTGCollection()->getCardByName(flipStats); MTGCard * fcard = MTGCollection()->getCardByName(flipStats, _target->setId);
if(!fcard) return 0; if(!fcard) return 0;
MTGCardInstance * myFlip = NEW MTGCardInstance(fcard, _target->controller()->game); MTGCardInstance * myFlip = NEW MTGCardInstance(fcard, _target->controller()->game);
MTGCardInstance * myParent = NULL; MTGCardInstance * myParent = NULL;
@@ -4976,7 +4995,7 @@ int AAFlip::resolve()
_target->text = myFlip->text; _target->text = myFlip->text;
_target->formattedText = myFlip->formattedText; _target->formattedText = myFlip->formattedText;
if(_target->enchanted || _target->equipment > 0){ // Try to keep auras and equipment effects on basicAbilities (issue #1065). if(_target->enchanted || _target->equipment > 0){ // Try to keep auras and equipment effects on basicAbilities (issue #1065).
MTGCardInstance * myOrig = NEW MTGCardInstance(MTGCollection()->getCardByName(nameOrig), _target->controller()->game); MTGCardInstance * myOrig = NEW MTGCardInstance(MTGCollection()->getCardByName(nameOrig, _target->setId), _target->controller()->game);
for(unsigned int i = 0; i < _target->basicAbilities.size(); i++) { for(unsigned int i = 0; i < _target->basicAbilities.size(); i++) {
if(myOrig->basicAbilities[i] == 1) if(myOrig->basicAbilities[i] == 1)
_target->basicAbilities[i] = 0; _target->basicAbilities[i] = 0;
@@ -9344,9 +9363,9 @@ void ABlink::resolveBlink()
//it is later moved to garbage by garbage collection. //it is later moved to garbage by garbage collection.
//then we build 2 seperate blinks with the 2 parts as the targets. //then we build 2 seperate blinks with the 2 parts as the targets.
vector<string> names = split(_target->MeldedFrom, '|'); vector<string> names = split(_target->MeldedFrom, '|');
MTGCard * cardone = MTGCollection()->getCardByName(names[0]); MTGCard * cardone = MTGCollection()->getCardByName(names[0], _target->setId);
MTGCardInstance * cardOne = NEW MTGCardInstance(cardone, _target->owner->game); MTGCardInstance * cardOne = NEW MTGCardInstance(cardone, _target->owner->game);
MTGCard * cardtwo = MTGCollection()->getCardByName(names[1]); MTGCard * cardtwo = MTGCollection()->getCardByName(names[1], _target->setId);
MTGCardInstance * cardTwo = NEW MTGCardInstance(cardtwo, _target->owner->game); MTGCardInstance * cardTwo = NEW MTGCardInstance(cardtwo, _target->owner->game);
_target->controller()->game->putInZone(_target, _target->currentZone, _target->controller()->game->putInZone(_target, _target->currentZone,
_target->owner->game->temp); _target->owner->game->temp);
@@ -10031,7 +10050,7 @@ int AACastCard::reactToTargetClick(Targetable * object)
MTGCardInstance * AACastCard::makeCard() MTGCardInstance * AACastCard::makeCard()
{ {
MTGCardInstance * card = NULL; MTGCardInstance * card = NULL;
MTGCard * cardData = MTGCollection()->getCardByName(cardNamed); MTGCard * cardData = MTGCollection()->getCardByName(cardNamed, source->setId);
if(!cardData) return NULL; if(!cardData) return NULL;
card = NEW MTGCardInstance(cardData, source->controller()->game); card = NEW MTGCardInstance(cardData, source->controller()->game);
card->owner = source->controller(); card->owner = source->controller();
+4 -2
View File
@@ -832,9 +832,11 @@ MTGCard * MTGAllCards::getCardByName(string nameDescriptor, int forcedSetId)
map<string, MTGCard * >::iterator cached = mtgCardByNameCache.find(nameDescriptor); map<string, MTGCard * >::iterator cached = mtgCardByNameCache.find(nameDescriptor);
if ((forcedSetId < 0) && (cached!= mtgCardByNameCache.end())) if (cached!= mtgCardByNameCache.end())
{ {
return cached->second; MTGCard* card = cached->second;
if(forcedSetId < 0 || (card && forcedSetId == card->setId))
return card;
} }
int cardnb = atoi(nameDescriptor.c_str()); int cardnb = atoi(nameDescriptor.c_str());
+2 -2
View File
@@ -684,12 +684,12 @@ MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone
if (copy->previous && copy->previous->MeldedFrom.size() && !copy->isACopier && !copy->isToken)//!copier & !token fix kiki-jiki clones crash if (copy->previous && copy->previous->MeldedFrom.size() && !copy->isACopier && !copy->isToken)//!copier & !token fix kiki-jiki clones crash
{ {
vector<string> names = split(copy->previous->MeldedFrom, '|'); vector<string> names = split(copy->previous->MeldedFrom, '|');
MTGCard * cardone = MTGCollection()->getCardByName(names[0]); MTGCard * cardone = MTGCollection()->getCardByName(names[0], copy->setId);
MTGCardInstance * cardOne = NEW MTGCardInstance(cardone, copy->owner->game); MTGCardInstance * cardOne = NEW MTGCardInstance(cardone, copy->owner->game);
to->addCard(cardOne); to->addCard(cardOne);
WEvent * e = NEW WEventZoneChange(cardOne, from, to); WEvent * e = NEW WEventZoneChange(cardOne, from, to);
g->receiveEvent(e); g->receiveEvent(e);
MTGCard * cardtwo = MTGCollection()->getCardByName(names[1]); MTGCard * cardtwo = MTGCollection()->getCardByName(names[1], copy->setId);
MTGCardInstance * cardTwo = NEW MTGCardInstance(cardtwo, copy->owner->game); MTGCardInstance * cardTwo = NEW MTGCardInstance(cardtwo, copy->owner->game);
to->addCard(cardTwo); to->addCard(cardTwo);
WEvent * e2 = NEW WEventZoneChange(cardTwo, from, to); WEvent * e2 = NEW WEventZoneChange(cardTwo, from, to);