Fixed Treasure token, added boast trigger event, added new keyword "hascnt" to retrieve the amount of specific counter type on a card (e.g. hascntloyalty).

This commit is contained in:
Vittorio Alfieri
2021-01-24 20:37:14 +01:00
parent f6199719fd
commit 4bdc1fdfe1
7 changed files with 127 additions and 6 deletions

View File

@@ -5707,7 +5707,7 @@ toughness=1
[/card]
[card]
name=Brass's Bounty
auto=foreach(land|mybattlefield) token(Treasure,Artifact) and!( transforms((,newability[{T}{S}:Add{W}])(,newability[{T}{S}:Add{R}])(,newability[{T}{S}:Add{G}])(,newability[{T}{S}:Add{U}])(,newability[{T}{S}:Add{B}])) forever )!
auto=foreach(land|mybattlefield) token(Treasure,Artifact Treasure) and!( transforms((,newability[{T}{S}:Add{W}])(,newability[{T}{S}:Add{R}])(,newability[{T}{S}:Add{G}])(,newability[{T}{S}:Add{U}])(,newability[{T}{S}:Add{B}])) forever )!
text=For each land you control, create a Treasure token. (Its an artifact with “{T}, Sacrifice this artifact: Add one mana of any color.”)
mana={6}{R}
type=Sorcery
@@ -12039,7 +12039,7 @@ type=Enchantment
[card]
name=Diabolical Salvation
abilities=split second
auto=token(Devil,Creature Devil,4/4,red,unreath) with((,newability ((@movedto(this|graveyard) from(battlefield):token(Treasure,Artifact) and!( transforms((,newability[{T}{S}:Add{W}])(,newability[{T}{S}:Add{R}])(,newability[{T}{S}:Add{G}])(,newability[{T}{S}:Add{U}])(,newability[{T}{S}:Add{B}])) forever )!))
auto=token(Devil,Creature Devil,4/4,red,unreath) with((,newability ((@movedto(this|graveyard) from(battlefield):token(Treasure,Artifact Treasure) and!( transforms((,newability[{T}{S}:Add{W}])(,newability[{T}{S}:Add{R}])(,newability[{T}{S}:Add{G}])(,newability[{T}{S}:Add{U}])(,newability[{T}{S}:Add{B}])) forever )!))
text=Split second Create four 4/4 red Devil creature tokens with haste and “When this creature dies, create a colorless Treasure artifact token with {T}, Sacrifice this artifact: Add one mana of any color.’” Sacrifice the Devil tokens at the beginning of the next end step.
mana={2}{R}{R}{R}{R}
type=Instant
@@ -51693,7 +51693,7 @@ auto={T}{S}:add{B}
auto={T}{S}:add{R}
auto={T}{S}:add{G}
text={T}, Sacrifice this artifact: Add one mana of any color.
type=Artifact
type=Artifact Treasure
[/card]
[card]
name=Treasure Map
@@ -51721,7 +51721,7 @@ auto={T}{S}:add{B}
auto={T}{S}:add{R}
auto={T}{S}:add{G}
text={T}, Sacrifice this artifact: Add one mana of any color.
type=Artifact
type=Artifact Treasure
[/card]
[card]
name=Treasure Sur
@@ -51731,7 +51731,7 @@ auto={T}{S}:add{B}
auto={T}{S}:add{R}
auto={T}{S}:add{G}
text={T}, Sacrifice this artifact: Add one mana of any color.
type=Artifact
type=Artifact Treasure
[/card]
[card]
name=TreasureArtifactToken
@@ -51741,7 +51741,7 @@ auto={T}{S}:add{B}
auto={T}{S}:add{R}
auto={T}{S}:add{G}
text={T}, Sacrifice this artifact: Add one mana of any color.
type=Artifact
type=Artifact Treasure
[/card]
[card]
name=Treefolk Umbra

View File

@@ -619,6 +619,33 @@ public:
}
};
class TrCardBoasted: public Trigger
{
public:
bool limitOnceATurn;
int triggeredTurn;
TrCardBoasted(GameObserver* observer, int id, MTGCardInstance * source, TargetChooser * tc,bool once = false,bool limitOnceATurn = false) :
Trigger(observer, id, source,once, tc),limitOnceATurn(limitOnceATurn)
{
}
int triggerOnEventImpl(WEvent * event)
{
WEventCardBoasted * e = dynamic_cast<WEventCardBoasted *> (event);
if (!e) return 0;
if (limitOnceATurn && triggeredTurn == game->turn)
return 0;
if (!tc->canTarget(e->card)) return 0;
triggeredTurn = game->turn;
return 1;
}
TrCardBoasted * clone() const
{
return NEW TrCardBoasted(*this);
}
};
class TrCardSurveiled: public Trigger
{
public:
@@ -3939,6 +3966,19 @@ public:
AAAlterEnergy * clone() const;
~AAAlterEnergy();
};
//Boast Event
class AABoastEvent: public ActivatedAbilityTP
{
public:
MTGCardInstance * card;
AABoastEvent(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, ManaCost * _cost = NULL,
int who = TargetChooser::UNSET);
int resolve();
const string getMenuText();
AABoastEvent * clone() const;
~AABoastEvent();
};
//Surveil Event
class AASurveilEvent: public ActivatedAbilityTP
{

View File

@@ -360,6 +360,12 @@ struct WEventplayerMonarch : public WEvent {
virtual Targetable * getTarget(Player * player);
};
//boast event
struct WEventCardBoasted : public WEventCardUpdate {
WEventCardBoasted(MTGCardInstance * card);
virtual Targetable * getTarget(int target);
};
//surveil event
struct WEventCardSurveiled : public WEventCardUpdate {
WEventCardSurveiled(MTGCardInstance * card);

View File

@@ -1061,6 +1061,42 @@ AAExploresEvent::~AAExploresEvent()
{
}
//AA Boast Event
AABoastEvent::AABoastEvent(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, ManaCost * _cost,
int who) :
ActivatedAbilityTP(observer, _id, _source, _target, _cost, who), card(_source)
{
}
int AABoastEvent::resolve()
{
Damageable * _target = (Damageable *) getTarget();
if (_target)
{
Player * pTarget = (Player*)_target;
if(pTarget)
{
WEvent * e = NEW WEventCardBoasted(card);
game->receiveEvent(e);
}
}
return 0;
}
const string AABoastEvent::getMenuText()
{
return "Boast event called";
}
AABoastEvent * AABoastEvent::clone() const
{
return NEW AABoastEvent(*this);
}
AABoastEvent::~AABoastEvent()
{
}
//AA Surveil Event
AASurveilEvent::AASurveilEvent(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, ManaCost * _cost,
int who) :

View File

@@ -1224,6 +1224,10 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string, int id, Spell
if (TargetChooser * tc = parseSimpleTC(s, "mutated", card))
return NEW TrCardMutated(observer, id, card, tc, once, limitOnceATurn);
//boast has been performed from a card
if (TargetChooser * tc = parseSimpleTC(s, "boasted", card))
return NEW TrCardBoasted(observer, id, card, tc, once, limitOnceATurn);
//Surveil has been performed from a card
if (TargetChooser * tc = parseSimpleTC(s, "surveiled", card))
return NEW TrCardSurveiled(observer, id, card, tc, once, limitOnceATurn);
@@ -3555,6 +3559,16 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
card->mutation += atoi(splitMutatedUnder[1].c_str());
}
//perform boast
found = s.find("doboast");
if (found != string::npos)
{
Targetable * t = spell ? spell->getNextTarget() : NULL;
MTGAbility * a = NEW AABoastEvent(observer, id, card, t, NULL, who);
a->oneShot = 1;
return a;
}
//perform surveil
found = s.find("surveil");
if (found != string::npos)

View File

@@ -292,6 +292,11 @@ WEventplayerMonarch::WEventplayerMonarch(Player * player) :
{
}
WEventCardBoasted::WEventCardBoasted(MTGCardInstance * card) :
WEventCardUpdate(card)
{
}
WEventCardSurveiled::WEventCardSurveiled(MTGCardInstance * card) :
WEventCardUpdate(card)
{
@@ -535,6 +540,12 @@ Targetable * WEventCardMutated::getTarget(int target)
return NULL;
}
Targetable * WEventCardBoasted::getTarget(int target)
{
if (target) return card;
return NULL;
}
Targetable * WEventCardSurveiled::getTarget(int target)
{
if (target) return card;

View File

@@ -578,6 +578,20 @@ void WParsedInt::init(string s, Spell * spell, MTGCardInstance * card)
if(Constants::MTGBasicAbilities[i] == s.substr(10))
intValue = card->basicAbilities[i];
}
else if (s.find("hascnt") != string::npos) //Return the amount of specific counters on card
{
intValue = 0;
if (card->counters){
Counters * counters = card->counters;
for(size_t i = 0; i < counters->counters.size(); ++i){
Counter * counter = counters->counters[i];
if(counter->name == s.substr(6)){
intValue = counter->nb;
break;
}
}
}
}
else if (s == "manacost") //Return the converted manacost
{
intValue = (target->currentZone == target->controller()->game->stack)?(target->myconvertedcost + target->castX):target->myconvertedcost;//X is 0 except if it's on the stack