Added/fixed primitives, updated the "missing_cards_by_sets" folder, improved all cards with replicate (now they use a special version of multikicker but they don't count as kicked spell), improved all cards with "fizzle" and "fizzleto" ability and improved engine for "fizzle" and "nofizzle" ability (e.g. now it's possible to grant a card the nofizzle ability on stack), added new keyword "mycolnum" to count the number colors of a card.
This commit is contained in:
@@ -1377,7 +1377,21 @@ void ActionStack::Fizzle(Interruptible * action, FizzleMode fizzleMode)
|
||||
spell->source->controller()->game->putInExile(spell->source);
|
||||
break;
|
||||
case PUT_IN_LIBRARY_TOP:
|
||||
spell->source->controller()->game->putInLibrary(spell->source);
|
||||
case PUT_IN_LIBRARY_BOTTOM:
|
||||
MTGCardInstance * _target = spell->source->controller()->game->putInLibrary(spell->source);
|
||||
if (_target && fizzleMode == PUT_IN_LIBRARY_BOTTOM){
|
||||
MTGLibrary * library = _target->owner->game->library;
|
||||
vector<MTGCardInstance *>oldOrder = library->cards;
|
||||
vector<MTGCardInstance *>newOrder;
|
||||
newOrder.push_back(_target);
|
||||
for(unsigned int k = 0;k < oldOrder.size();++k)
|
||||
{
|
||||
MTGCardInstance * rearranged = oldOrder[k];
|
||||
if(rearranged != _target)
|
||||
newOrder.push_back(rearranged);
|
||||
}
|
||||
library->cards = newOrder;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ MTGCardInstance * CardDescriptor::match_or(MTGCardInstance * card)
|
||||
// Quantified restrictions are always AND-ed:
|
||||
if (foretoldComparisonMode && !valueInRange(foretoldComparisonMode, card->foretellTurn, foretellTurn))
|
||||
return NULL;
|
||||
if (kickedComparisonMode && !valueInRange(kickedComparisonMode, card->kicked, kicked))
|
||||
if (kickedComparisonMode && (!valueInRange(kickedComparisonMode, card->kicked, kicked) || card->has(Constants::HASREPLICATE)))
|
||||
return NULL;
|
||||
if (powerComparisonMode && !valueInRange(powerComparisonMode, card->getPower(), power))
|
||||
return NULL;
|
||||
@@ -213,7 +213,7 @@ MTGCardInstance * CardDescriptor::match_and(MTGCardInstance * card)
|
||||
|
||||
if (foretoldComparisonMode && !valueInRange(foretoldComparisonMode, card->foretellTurn, foretellTurn))
|
||||
match = NULL;
|
||||
if (kickedComparisonMode && !valueInRange(kickedComparisonMode, card->kicked, kicked))
|
||||
if (kickedComparisonMode && (!valueInRange(kickedComparisonMode, card->kicked, kicked) || card->has(Constants::HASREPLICATE)))
|
||||
match = NULL;
|
||||
if (powerComparisonMode && !valueInRange(powerComparisonMode, card->getPower(), power))
|
||||
match = NULL;
|
||||
|
||||
@@ -2963,6 +2963,9 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
} else if (zone == "librarytop")
|
||||
{
|
||||
fizzleMode = ActionStack::PUT_IN_LIBRARY_TOP;
|
||||
} else if (zone == "librarybottom")
|
||||
{
|
||||
fizzleMode = ActionStack::PUT_IN_LIBRARY_BOTTOM;
|
||||
}
|
||||
Spell * starget = NULL;
|
||||
if (spell)
|
||||
@@ -2975,7 +2978,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
|
||||
//Fizzle (counterspell...)
|
||||
found = s.find("fizzle");
|
||||
if (found != string::npos)
|
||||
if (found != string::npos && s.find("nofizzle") == string::npos) //Fix to allow adding nofizzle ability to cards which originally have not (e.g. with transforms or lord keywords)
|
||||
{
|
||||
Spell * starget = NULL;
|
||||
if (spell)
|
||||
|
||||
@@ -227,7 +227,8 @@ const char* Constants::MTGBasicAbilities[] = {
|
||||
"nomovetrigger", //no trigger when playing these cards (e.g. fake ability cards such as Davriel Conditions, Davriel Offers, Annihilation Rooms)
|
||||
"wascommander", //It was the current commander (e.g. after it flipped or morphed)
|
||||
"showopponenthand", //opponent plays with his hand revealed.
|
||||
"showcontrollerhand" //controller plays with his hand revealed.
|
||||
"showcontrollerhand", //controller plays with his hand revealed.
|
||||
"hasreplicate" //Kicker cost is a replicate cost (eg. "Vacuumelt")
|
||||
};
|
||||
|
||||
map<string,int> Constants::MTGBasicAbilitiesMap;
|
||||
|
||||
@@ -526,7 +526,7 @@ int MTGPutInPlayRule::reactToClick(MTGCardInstance * card)
|
||||
while(previousManaPool->canAfford(withKickerCost,card->has(Constants::ANYTYPEOFMANA)))
|
||||
{
|
||||
withKickerCost->add(withKickerCost->getKicker());
|
||||
if(!card->basicAbilities[Constants::HASNOKICKER]) card->kicked += 1; //Some kicker costs are not a real kicker (e.g. Fuse cost).
|
||||
if(!card->basicAbilities[Constants::HASNOKICKER] || card->basicAbilities[Constants::HASREPLICATE]) card->kicked += 1; //Some kicker costs are not a real kicker (e.g. Fuse cost) or they are a replicate cost (eg. "Vacuumelt").
|
||||
}
|
||||
for(int i = 0;i < card->kicked;i++)
|
||||
player->getManaPool()->pay(card->getManaCost()->getKicker());
|
||||
@@ -537,7 +537,7 @@ int MTGPutInPlayRule::reactToClick(MTGCardInstance * card)
|
||||
{
|
||||
player->getManaPool()->pay(card->getManaCost()->getKicker());
|
||||
payResult = ManaCost::MANA_PAID_WITH_KICKER;
|
||||
if(!card->basicAbilities[Constants::HASNOKICKER]) card->kicked = 1; //Some kicker costs are not a real kicker (e.g. Fuse cost).
|
||||
if(!card->basicAbilities[Constants::HASNOKICKER] || card->basicAbilities[Constants::HASREPLICATE]) card->kicked = 1; //Some kicker costs are not a real kicker (e.g. Fuse cost) or they are a replicate cost (eg. "Vacuumelt").
|
||||
card->alternateCostPaid[ManaCost::MANA_PAID_WITH_KICKER] = 1;
|
||||
}
|
||||
delete withKickerCost;
|
||||
@@ -681,7 +681,7 @@ int MTGKickerRule::reactToClick(MTGCardInstance * card)
|
||||
{
|
||||
if (!game->targetListIsSet(card))
|
||||
{
|
||||
if(!card->basicAbilities[Constants::HASNOKICKER]) card->kicked = 1; //Some kicker costs are not a real kicker (e.g. Fuse cost).
|
||||
if(!card->basicAbilities[Constants::HASNOKICKER] || card->basicAbilities[Constants::HASREPLICATE]) card->kicked = 1; //Some kicker costs are not a real kicker (e.g. Fuse cost) or they are a replicate cost (eg. "Vacuumelt").
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -704,7 +704,7 @@ int MTGKickerRule::reactToClick(MTGCardInstance * card)
|
||||
while(previousManaPool->canAfford(withKickerCost,card->has(Constants::ANYTYPEOFMANA)))
|
||||
{
|
||||
withKickerCost->add(withKickerCost->getKicker());
|
||||
if(!card->basicAbilities[Constants::HASNOKICKER]) card->kicked += 1; //Some kicker costs are not a real kicker (e.g. Fuse cost).
|
||||
if(!card->basicAbilities[Constants::HASNOKICKER] || card->basicAbilities[Constants::HASREPLICATE]) card->kicked += 1; //Some kicker costs are not a real kicker (e.g. Fuse cost) or they are a replicate cost (eg. "Vacuumelt").
|
||||
}
|
||||
for(int i = 0;i < card->kicked;i++)
|
||||
player->getManaPool()->pay(card->getManaCost()->getKicker());
|
||||
@@ -715,7 +715,7 @@ int MTGKickerRule::reactToClick(MTGCardInstance * card)
|
||||
{
|
||||
player->getManaPool()->pay(card->getManaCost()->getKicker());
|
||||
payResult = ManaCost::MANA_PAID_WITH_KICKER;
|
||||
if(!card->basicAbilities[Constants::HASNOKICKER]) card->kicked = 1; //Some kicker costs are not a real kicker (e.g. Fuse cost).
|
||||
if(!card->basicAbilities[Constants::HASNOKICKER] || card->basicAbilities[Constants::HASREPLICATE]) card->kicked = 1; //Some kicker costs are not a real kicker (e.g. Fuse cost) or they are a replicate cost (eg. "Vacuumelt").
|
||||
card->alternateCostPaid[ManaCost::MANA_PAID_WITH_KICKER] = 1;
|
||||
}
|
||||
delete withKickerCost;
|
||||
|
||||
@@ -1295,9 +1295,17 @@ void WParsedInt::extendedParse(string s, Spell * spell, MTGCardInstance * card)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (s == "ishuman")//return if controller is Human or AI
|
||||
else if (s == "ishuman" || s == "mycolnum")//return if controller is Human or AI - return the number of colors of a card.
|
||||
{
|
||||
intValue = (card->controller()->isAI())?0:1;
|
||||
intValue = 0;
|
||||
if (s == "ishuman")
|
||||
intValue = (card->controller()->isAI())?0:1;
|
||||
else if (s == "mycolnum") {
|
||||
for (int i = Constants::MTG_COLOR_GREEN; i <= Constants::MTG_COLOR_WHITE; ++i){
|
||||
if(card->hasColor(i))
|
||||
intValue +=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (s == "pexperience" || s == "oexperience")
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user