Added new primitives from LTC set, improved "_GOAD_" macro, updated missing card by set list, added new keyword "permanent" to target permanents and nonpermanents, added "flashback" option to "castcard" ability, added new ability "unsacrificable" to forbid a player to sacrifice a card.

This commit is contained in:
Vittorio Alfieri
2023-07-07 18:22:58 +02:00
parent deec348fea
commit b791da0786
13 changed files with 787 additions and 26 deletions

View File

@@ -4404,6 +4404,7 @@ int AASacrificeCard::resolve()
MTGCardInstance * _target = (MTGCardInstance *) target;
if (_target)
{
if(_target->has(Constants::UNSACRIFICABLE)) return 0; // The card cannot be sacrified (e.g. "Hithlain Rope")
if(_target->mutation && _target->parentCards.size() > 0) return 0; // Mutated down cards cannot be sacrificed or exploited, they will follow the fate of top-card
Player * p = _target->controller();
MTGCardInstance * beforeCard = _target;
@@ -9628,7 +9629,7 @@ void ABlink::returnCardIntoPlay(MTGCardInstance* _target) {
}
}*/
//replaced with castcard(putinplay)
MTGAbility *a = NEW AACastCard(game, game->mLayers->actionLayer()->getMaxId(), Blinker, Blinker,false,false,false,"","Return to Play",false,true);
MTGAbility *a = NEW AACastCard(game, game->mLayers->actionLayer()->getMaxId(), Blinker, Blinker, false, false, false, "", "Return to Play", false, true);
a->oneShot = false;
a->canBeInterrupted = false;
a->addToGame();
@@ -10012,8 +10013,8 @@ AEquip * AEquip::clone() const
}
// casting a card for free, or casting a copy of a card.
AACastCard::AACastCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target,bool _restricted,bool _copied,bool asNormal,string _namedCard,string _name,bool _noEvent,bool putinplay,bool madness, bool alternative, int kicked, int costx, bool flipped) :
MTGAbility(observer, _id, _source),restricted(_restricted),asCopy(_copied),normal(asNormal),cardNamed(_namedCard),nameThis(_name),noEvent(_noEvent),putinplay(putinplay), asNormalMadness(madness), alternative(alternative), kicked(kicked), costx(costx), flipped(flipped)
AACastCard::AACastCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, bool _restricted, bool _copied, bool asNormal, string _namedCard, string _name, bool _noEvent, bool putinplay, bool madness, bool alternative, int kicked, int costx, bool flipped, bool flashback) :
MTGAbility(observer, _id, _source), restricted(_restricted), asCopy(_copied), normal(asNormal), cardNamed(_namedCard), nameThis(_name), noEvent(_noEvent), putinplay(putinplay), asNormalMadness(madness), alternative(alternative), kicked(kicked), costx(costx), flipped(flipped), flashback(flashback)
{
target = _target;
andAbility = NULL;
@@ -10134,12 +10135,6 @@ void AACastCard::Update(float dt)
return;
}
}
/*if(!toCheck->hasType(Subtypes::TYPE_INSTANT) && !(game->getCurrentGamePhase() == MTG_PHASE_FIRSTMAIN || game->getCurrentGamePhase() == MTG_PHASE_SECONDMAIN))
{
processed = true;
this->forceDestroy = 1;
return;
}*/
}
MTGCardInstance * toCheck = (MTGCardInstance*)target;
if(theNamedCard)
@@ -10275,7 +10270,6 @@ int AACastCard::resolveSpell()
processed = true;
return 1;
}
if(theNamedCard)
{
Spell * spell = NULL;
@@ -10318,6 +10312,8 @@ int AACastCard::resolveSpell()
copy->isToken = 1; // Fixed a bug when using copied option with namedcard option.
if(alternative)
copy->alternateCostPaid[ManaCost::MANA_PAID_WITH_ALTERNATIVE] = 1;
if(flashback)
copy->alternateCostPaid[ManaCost::MANA_PAID_WITH_FLASHBACK] = 1;
if(kicked > 0){
copy->alternateCostPaid[ManaCost::MANA_PAID_WITH_KICKER] = 1;
copy->kicked = kicked;
@@ -10372,7 +10368,6 @@ int AACastCard::resolveSpell()
processed = true;
return 1;
}
Spell * spell = NULL;
MTGCardInstance * copy = NULL;
if ((normal || asNormalMadness) || !_target->isSorceryorInstant())
@@ -10413,6 +10408,8 @@ int AACastCard::resolveSpell()
copy->isToken = 1; // Fixed a bug when using copied option for permanent.
if(alternative)
copy->alternateCostPaid[ManaCost::MANA_PAID_WITH_ALTERNATIVE] = 1;
if(flashback)
copy->alternateCostPaid[ManaCost::MANA_PAID_WITH_FLASHBACK] = 1;
if(kicked > 0){
copy->alternateCostPaid[ManaCost::MANA_PAID_WITH_KICKER] = 1;
copy->kicked = kicked;

View File

@@ -31,6 +31,7 @@ CardDescriptor::CardDescriptor()
hasFlashbackCost = 0;
hasBackSide = 0;
hasPartner = 0;
isPermanent = 0;
modified = 0;
toxicity = 0;
hasXCost = 0;
@@ -106,6 +107,11 @@ void CardDescriptor::unsecureSetHasPartner(int k)
hasPartner = k;
}
void CardDescriptor::unsecureSetIsPermanent(int k)
{
isPermanent = k;
}
void CardDescriptor::unsecureSetTapped(int i)
{
tapped = i;
@@ -383,6 +389,11 @@ MTGCardInstance * CardDescriptor::match(MTGCardInstance * card)
match = NULL;
}
if ((isPermanent == -1 && card->isPermanent()) || (isPermanent == 1 && !card->isPermanent()))
{
match = NULL;
}
if ((hasXCost == -1 && card->getManaCost()->hasX()) || (hasXCost == 1 && !card->getManaCost()->hasX()))
{
match = NULL;

View File

@@ -1594,6 +1594,18 @@ bool CardGui::FilterCard(MTGCard * _card,string filter)
cd.unsecureSetHasPartner(1);
}
}
//Is a permanent
else if (attribute.find("permanent") != string::npos)
{
if (minus)
{
cd.unsecureSetIsPermanent(-1);
}
else
{
cd.unsecureSetIsPermanent(1);
}
}
//Token
else if (attribute.find("token") != string::npos)
{

View File

@@ -4093,6 +4093,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
bool sendNoEvent = splitCastCard[1].find("noevent") != string::npos;
bool putinplay = splitCastCard[1].find("putinplay") != string::npos;
bool alternative = splitCastCard[1].find("alternative") != string::npos;
bool flashback = splitCastCard[1].find("flashback") != string::npos;
bool flipped = splitCastCard[1].find("flipped") != string::npos;
string nameCard = "";
if(splitCastCard[1].find("named!:") != string::npos)
@@ -4123,7 +4124,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
costx = val->getValue();
}
}
MTGAbility *a = NEW AACastCard(observer, id, card, target,withRestrictions,asCopy,asNormal,nameCard,newName,sendNoEvent,putinplay, asNormalMadness, alternative, kicked, costx, flipped);
MTGAbility *a = NEW AACastCard(observer, id, card, target, withRestrictions, asCopy, asNormal, nameCard, newName, sendNoEvent, putinplay, asNormalMadness, alternative, kicked, costx, flipped, flashback);
a->oneShot = false;
if(splitCastCard[1].find("trigger[to]") != string::npos)
{
@@ -4135,12 +4136,12 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
storedAndAbility.clear();
((AACastCard*)a)->andAbility = parseMagicLine(stored, id, spell, card);
}
MTGCardInstance * _target = NULL;
if (spell)
_target = spell->getNextCardTarget();
if(!_target)
_target = target;
a->target = _target;
MTGCardInstance * _target = NULL;
if (spell)
_target = spell->getNextCardTarget();
if(!_target)
_target = target;
a->target = _target;
return a;
}

View File

@@ -266,7 +266,8 @@ const char* Constants::MTGBasicAbilities[] = {
"poisoneighttoxic", // Card has toxic 8
"poisonninetoxic", // Card has toxic 9
"poisontentoxic", // Card has toxic 10
"eqpasinst" // Can equip as instant
"eqpasinst", // Can equip as instant
"unsacrificable" // The card cannot be sacrified (e.g. "Hithlain Rope").
};
map<string,int> Constants::MTGBasicAbilitiesMap;

View File

@@ -689,6 +689,18 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
cd->unsecureSetHasPartner(1);
}
}
//Is a permanent
else if (attribute.find("permanent") != string::npos)
{
if (minus)
{
cd->unsecureSetIsPermanent(-1);
}
else
{
cd->unsecureSetIsPermanent(1);
}
}
//Token
else if (attribute.find("token") != string::npos)
{