Fixed issues #1049 and #1050 opened by @ranger7271, improved imprint keywords, improved boast ability, added a new "hasability" keyword to check if a card has an ability or not.

This commit is contained in:
Vittorio Alfieri
2021-01-24 15:53:49 +01:00
parent 2b7baf7fc8
commit f6199719fd
8 changed files with 54 additions and 9 deletions
@@ -9625,7 +9625,7 @@ type=Land
[card]
name=Corsair Captain
auto=token(Treasure Sur)
auto=all(other creature[pirate]|mybattlefield) 1/1
auto=lord(other creature[pirate]|mybattlefield) 1/1
text=When Corsair Captain enters the battlefield, create a Treasure token. (It's an artifact with " {T}, Sacrifice this artifact: Add one mana of any color.") -- Other Pirates you control get +1/+1.
mana={2}{U}
type=Creature
@@ -47601,7 +47601,8 @@ toughness=2
[card]
name=Stormsurge Kraken
abilities=opponentshroud
#wagic doesnt have commander zone
auto=aslongas(*[iscommander]|mybattlefield) 2/2 >0
auto=@combat(blocked) source(this) restriction{type(*[iscommander]|myBattlefield)~morethan~0}:may name(Draw 2 cards) draw:2 controller
text=Hexproof -- Lieutenant — As long as you control your commander, Stormsurge Kraken gets +2/+2 and has "Whenever Stormsurge Kraken becomes blocked, you may draw two cards."
mana={3}{U}{U}
type=Creature
@@ -53445,9 +53446,7 @@ type=Instant
[/card]
[card]
name=Vanquisher's Banner
auto=choseatype
auto=@movedTo(creature[chosentype]|mystack):draw:1 controller
auto=lord(creature[chosentype]|mybattlefield) 1/1
auto=chooseatype all(this) transforms((,newability[lord(creature[chosentype]|mybattlefield) 1/1],newability[@movedTo(creature[chosentype]|mystack):draw:1 controller])) forever chooseend
text=As Vanquisher's Banner enters the battlefield, choose a creature type. -- Creatures you control of the chosen type get +1/+1. -- Whenever you cast a creature spell of the chosen type, draw a card.
mana={5}
type=Artifact
+1
View File
@@ -1399,6 +1399,7 @@ public:
class AAImprint: public ActivatedAbility
{
public:
MTGAbility * andAbility;
AAImprint(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL);
int resolve();
const string getMenuText();
+2 -1
View File
@@ -301,7 +301,8 @@ class Constants
FORETELL = 174,
ANYTYPEOFMANAABILITY = 175,
BOAST = 176,
NB_BASIC_ABILITIES = 177,
TWOBOAST = 177,
NB_BASIC_ABILITIES = 178,
RARITY_S = 'S', //Special Rarity
RARITY_M = 'M', //Mythics
+15
View File
@@ -2048,6 +2048,7 @@ AAImprint::AAImprint(GameObserver* observer, int _id, MTGCardInstance * _source,
ActivatedAbility(observer, _id, _source, _cost, 0)
{
target = _target;
andAbility = NULL;
}
int AAImprint::resolve()
@@ -2083,6 +2084,20 @@ int AAImprint::resolve()
source->imprintedNames.push_back(source->imprintedCards.back()->getName());
}
}
if(andAbility)
{
MTGAbility * andAbilityClone = andAbility->clone();
andAbilityClone->target = _target;
if(andAbility->oneShot)
{
andAbilityClone->resolve();
SAFE_DELETE(andAbilityClone);
}
else
{
andAbilityClone->addToGame();
}
}
return 1;
}
return 0;
+7
View File
@@ -3165,6 +3165,13 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
{
MTGAbility * a = NEW AAImprint(observer, id, card, target);
a->oneShot = 1;
//andability
if(storedAndAbility.size())
{
string stored = storedAndAbility;
storedAndAbility.clear();
((AAImprint*)a)->andAbility = parseMagicLine(stored, id, spell, card);
}
return a;
}
}
+2 -1
View File
@@ -207,7 +207,8 @@ const char* Constants::MTGBasicAbilities[] = {
"cycling", //It has cycling ability
"foretell", //It has foretell cost
"anytypeofmanaability", //It allows to spend mana as it were of any color to activate abilities.
"boast" //It has boast ability
"boast", //It has boast ability
"twoboast" //It has boast twice ability (e.g. Birgi, God of Storytelling)
};
map<string,int> Constants::MTGBasicAbilitiesMap;
+10
View File
@@ -953,6 +953,16 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
}
}
if (attribute.find("evictname") != string::npos && card->imprintedCards.size())
{
attributefound = 1;
cd->compareName = card->currentimprintName;
if (minus)
cd->nameComparisonMode = COMPARISON_UNEQUAL;
else
cd->nameComparisonMode = COMPARISON_EQUAL;
}
if (!attributefound)
{
//Abilities
+13 -2
View File
@@ -438,6 +438,14 @@ void WParsedInt::init(string s, Spell * spell, MTGCardInstance * card)
{
intValue = (s == "pnumofcommandcast")?card->controller()->numOfCommandCast:card->controller()->opponent()->numOfCommandCast;
}
else if (s == "isflipped" || s == "iscopied") // Return 1 if card has been flipped -- Return 1 if card has copied another card
{
intValue = (s == "isflipped")?card->isFlipped:card->isACopier;
}
else if (s == "evictmc" || s == "hasevict")
{
if(card->imprintedCards.size() > 0) intValue = (s == "evictmc")?card->imprintedCards.back()->getManaCost()->getConvertedCost():card->imprintedCards.size();
}
else if (s == "evictpw" || s == "evictth")
{
if(card->imprintedCards.size() > 0) intValue = (s == "evictpw")?card->imprintedCards.back()->getPower():card->imprintedCards.back()->getToughness();
@@ -563,9 +571,12 @@ void WParsedInt::init(string s, Spell * spell, MTGCardInstance * card)
{
intValue = (target->foretellTurn < 0)?0:(target->getObserver()->turn-target->foretellTurn); // Check if you can use the foretell cost from exile (CurrentTurn > ForetellTurn).
}
else if (s == "isflipped") // Return 1 if card has been flipped
else if (s.find("hasability") != string::npos) //Return 1 if card has the specified ability
{
intValue = card->isFlipped;
intValue = 0;
for(size_t i = 0; i < Constants::NB_BASIC_ABILITIES; i++)
if(Constants::MTGBasicAbilities[i] == s.substr(10))
intValue = card->basicAbilities[i];
}
else if (s == "manacost") //Return the converted manacost
{