Draining Whelk

All additions requested or suggested to improve the card coding language.
Locked
kevlahnota
Posts: 619
Joined: Tue Feb 08, 2011 3:00 pm
Location: Philippines
Contact:

Draining Whelk

Post by kevlahnota »

primitive:

Code: Select all

[card]
name=Draining Whelk
abilities=flash,flying
auto=target(*|stack) fizzle
alias=111057
text=Flash (You may cast this spell any time you could cast an instant.) -- Flying -- When Draining Whelk enters the battlefield, counter target spell. Put X +1/+1 counters on Draining Whelk, where X is that spell's converted mana cost.
mana={4}{U}{U}
type=Creature
subtype=Illusion
power=1
toughness=1
[/card]
AllAbilities.cpp - AAFizzler resolve block add the highlighted code then compile:
  • int AAFizzler::resolve()
    {
    ActionStack * stack = game->mLayers->stackLayer();
    //the next section helps Ai correctly recieve its targets for this effect
    if (!target && source->target)
    {
    //ai is casting a spell from its hand to fizzle.
    target = stack->getActionElementFromCard(source->target);
    }
    else if(MTGCardInstance * cTarget = dynamic_cast<MTGCardInstance *>(target))
    {
    //ai targeted using an ability on a card to fizzle.
    target = stack->getActionElementFromCard(cTarget);
    }
    Spell * sTarget = (Spell *) target;
    MTGCardInstance* sCard = NULL;
    if (sTarget)
    sCard = sTarget->source;
    if (!sCard || !sTarget || sCard->has(Constants::NOFIZZLE))
    return 0;
    if (source->alias == 111057 && sTarget)//Draining Whelk
    {
    for (int j = sTarget->cost->getConvertedCost(); j > 0; j--)
    {
    source->counters->addCounter(1,1);
    }
    }

    stack->Fizzle(sTarget, fizzleMode);
    return 1;
    }
Locked