Fixed some primitives from issue #1085, fixed some primitives from Discord Channel, fixed "except" keyword for triggers, added "nocost" option for "totalcounteradded" event to avoid to trigger in case of counter cost (e.g. "Doubling Season"), added "removeallcolors" and "removeallsubtypes" options for "transforms" ability.

This commit is contained in:
Vittorio Alfieri
2023-07-25 17:38:25 +02:00
parent 751fda6521
commit 816c42b63b
9 changed files with 183 additions and 123 deletions

View File

@@ -1560,12 +1560,18 @@ int CounterCost::doPay()
if (!target)
return 0;
//Add counters as a cost
if (counter->nb >= 0)
{ //Add counters as a cost
{
int totalcounters = 0;
for (int i = 0; i < counter->nb; i++)
{//send no event because its a cost not an effect... for doubling season
target->counters->addCounter(counter->name.c_str(), counter->power, counter->toughness, true);
{
target->counters->addCounter(counter->name.c_str(), counter->power, counter->toughness);
totalcounters++;
}
WEvent * w = NEW WEventTotalCounters(target->counters, counter->name.c_str(), counter->power, counter->toughness, true, false, totalcounters, true, source);
dynamic_cast<WEventTotalCounters*>(w)->targetCard = target->counters->target;
target->getObserver()->receiveEvent(w);
if (tc)
tc->initTargets();
target = NULL;
@@ -1575,10 +1581,15 @@ int CounterCost::doPay()
//remove counters as a cost
if (hasCounters)
{
int totalcounters = 0;
for (int i = 0; i < -counter->nb; i++)
{
target->counters->removeCounter(counter->name.c_str(), counter->power, counter->toughness);
totalcounters++;
}
WEvent * w = NEW WEventTotalCounters(target->counters, counter->name.c_str(), counter->power, counter->toughness, false, true, totalcounters, true, source);
dynamic_cast<WEventTotalCounters*>(w)->targetCard = target->counters->target;
target->getObserver()->receiveEvent(w);
hasCounters = 0;
if (tc)
tc->initTargets();