added targetedplayer as a who for most abilities and token reciever..
adjusted the way cardsacrificed events were sent added a ability which is a way to tell a targeted player, yourself, or opponent to do a set of abilities. ability$! EFFECT _ EFFECT !$ WHO the idea here is that the abilities are being added to the targeted players game...so target(player) ability$!target(<2>*|myhand) reject!$ targetedplayer this line tells the player to discard 2 cards... you can also use it without targeting by using WHO words.. controller, owner, targetcontroller, opponent, targetedplayer this ability defualts to opponent. cards coming soon...
This commit is contained in:
@@ -292,7 +292,7 @@ Spell::~Spell()
|
||||
|
||||
int Spell::resolve()
|
||||
{
|
||||
if (!source->hasType(Subtypes::TYPE_INSTANT) && !source->hasType(Subtypes::TYPE_SORCERY))
|
||||
if (!source->hasType(Subtypes::TYPE_INSTANT) && !source->hasType(Subtypes::TYPE_SORCERY) && source->name.size())
|
||||
{
|
||||
Player * p = source->controller();
|
||||
int castMethod = source->castMethod;
|
||||
|
||||
@@ -1279,11 +1279,12 @@ int AASacrificeCard::resolve()
|
||||
if (_target)
|
||||
{
|
||||
Player * p = _target->controller();
|
||||
WEvent * e = NEW WEventCardSacrifice(_target);
|
||||
game->receiveEvent(e);
|
||||
MTGCardInstance * beforeCard = _target;
|
||||
p->game->putInGraveyard(_target);
|
||||
while(_target->next)
|
||||
_target = _target->next;
|
||||
WEvent * e = NEW WEventCardSacrifice(beforeCard,_target);
|
||||
game->receiveEvent(e);
|
||||
if(andAbility)
|
||||
{
|
||||
MTGAbility * andAbilityClone = andAbility->clone();
|
||||
@@ -1619,6 +1620,7 @@ int AAFlip::resolve()
|
||||
if(flipStats.size())
|
||||
{
|
||||
MTGCard * fcard = MTGCollection()->getCardByName(flipStats);
|
||||
if(!fcard) return 0;
|
||||
MTGCardInstance * myFlip = NEW MTGCardInstance(fcard, _target->controller()->game);
|
||||
_target->name = myFlip->name;
|
||||
_target->colors = myFlip->colors;
|
||||
@@ -1629,6 +1631,7 @@ int AAFlip::resolve()
|
||||
for(unsigned int i = 0;i < _target->cardsAbilities.size();i++)
|
||||
{
|
||||
MTGAbility * a = dynamic_cast<MTGAbility *>(_target->cardsAbilities[i]);
|
||||
|
||||
if(a) game->removeObserver(a);
|
||||
}
|
||||
_target->cardsAbilities.clear();
|
||||
@@ -1714,7 +1717,7 @@ int AAFlip::testDestroy()
|
||||
const char * AAFlip::getMenuText()
|
||||
{
|
||||
string s = flipStats;
|
||||
sprintf(menuText, "Transform into %s", s.c_str());
|
||||
sprintf(menuText, "Transform:%s", s.c_str());
|
||||
return menuText;
|
||||
}
|
||||
|
||||
@@ -4307,9 +4310,10 @@ void AVanishing::Update(float dt)
|
||||
}
|
||||
if (newPhase == MTG_PHASE_UPKEEP && timeLeft <= 0 && next == 0)
|
||||
{
|
||||
WEvent * e = NEW WEventCardSacrifice(source);
|
||||
game->receiveEvent(e);
|
||||
MTGCardInstance * beforeCard = source;
|
||||
source->controller()->game->putInGraveyard(source);
|
||||
WEvent * e = NEW WEventCardSacrifice(beforeCard,source);
|
||||
game->receiveEvent(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -257,7 +257,6 @@ void CardGui::Render()
|
||||
icon = game?game->getResourceManager()->GetQuad("c_red"):WResourceManager::Instance()->GetQuad("c_red");
|
||||
else if (card->hasSubtype("island"))
|
||||
icon = game?game->getResourceManager()->GetQuad("c_blue"):WResourceManager::Instance()->GetQuad("c_blue");
|
||||
|
||||
if (icon.get())
|
||||
{
|
||||
icon->SetColor(ARGB(static_cast<unsigned char>(actA),255,255,255));
|
||||
|
||||
@@ -588,10 +588,11 @@ int SacrificeCost::doPay()
|
||||
{
|
||||
if (target)
|
||||
{
|
||||
WEvent * e = NEW WEventCardSacrifice(target);
|
||||
MTGCardInstance * beforeCard = target;
|
||||
target->controller()->game->putInGraveyard(target);
|
||||
WEvent * e = NEW WEventCardSacrifice(beforeCard,target);
|
||||
GameObserver * game = target->owner->getObserver();
|
||||
game->receiveEvent(e);
|
||||
target->controller()->game->putInGraveyard(target);
|
||||
target = NULL;
|
||||
if (tc)
|
||||
tc->initTargets();
|
||||
|
||||
@@ -810,10 +810,10 @@ void GameObserver::gameStateBasedEffects()
|
||||
{
|
||||
if (c->has(Constants::TREASON))
|
||||
{
|
||||
WEvent * e = NEW WEventCardSacrifice(c);
|
||||
receiveEvent(e);
|
||||
|
||||
MTGCardInstance * beforeCard = c;
|
||||
p->game->putInGraveyard(c);
|
||||
WEvent * e = NEW WEventCardSacrifice(beforeCard,c);
|
||||
receiveEvent(e);
|
||||
}
|
||||
if (c->has(Constants::UNEARTH))
|
||||
{
|
||||
|
||||
@@ -1009,6 +1009,15 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
s.erase(stypesStartIndex, real_end - stypesStartIndex);
|
||||
}
|
||||
|
||||
found = s.find("ability$!");
|
||||
if (found != string::npos && storedString.empty())
|
||||
{
|
||||
size_t real_end = s.find("!$", found);
|
||||
size_t sIndex = found + 9;
|
||||
storedString.append(s.substr(sIndex, real_end - sIndex).c_str());
|
||||
s.erase(sIndex, real_end - sIndex);
|
||||
}
|
||||
|
||||
vector<string> splitTrigger = parseBetween(s, "@", ":");
|
||||
if (splitTrigger.size())
|
||||
{
|
||||
@@ -1754,6 +1763,17 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
if (s.find(" owner") != string::npos)
|
||||
who = TargetChooser::OWNER;
|
||||
|
||||
//ability creator the target has to do the ability.
|
||||
if(s.find("ability$") != string::npos)
|
||||
{
|
||||
if (storedString.size())
|
||||
{
|
||||
ATargetedAbilityCreator * abl = NEW ATargetedAbilityCreator(observer, id, card,target, NULL,newName, storedString, who);
|
||||
abl->oneShot = 1;
|
||||
storedString.clear();
|
||||
return abl;
|
||||
}
|
||||
}
|
||||
//livingweapon (used for token below)
|
||||
bool aLivingWeapon = (s.find("livingweapon") != string::npos);
|
||||
|
||||
@@ -3090,7 +3110,7 @@ int AbilityFactory::getAbilities(vector<MTGAbility *> * v, Spell * spell, MTGCar
|
||||
card->life = 2;
|
||||
card->toughness = 2;
|
||||
card->setColor(0,1);
|
||||
card->name = "";
|
||||
card->name = "Morph";
|
||||
card->types.clear();
|
||||
string cre = "Creature";
|
||||
card->setType(cre.c_str());
|
||||
|
||||
@@ -1110,7 +1110,7 @@ int MTGMorphCostRule::reactToClick(MTGCardInstance * card)
|
||||
spell = game->mLayers->stackLayer()->addSpell(copy, NULL, spellCost, payResult, 0);
|
||||
spell->source->morphed = true;
|
||||
spell->source->isMorphed = true;
|
||||
spell->source->name = "";
|
||||
spell->source->name = "Morph";
|
||||
spell->source->power = 2;
|
||||
spell->source->toughness = 2;
|
||||
copy->morphed = true;
|
||||
|
||||
@@ -93,8 +93,8 @@ WEventcardDraw::WEventcardDraw(Player * player, int nb_cards) :
|
||||
{
|
||||
}
|
||||
|
||||
WEventCardSacrifice::WEventCardSacrifice(MTGCardInstance * card) :
|
||||
WEventCardUpdate(card)
|
||||
WEventCardSacrifice::WEventCardSacrifice(MTGCardInstance * card, MTGCardInstance * after) :
|
||||
WEventCardUpdate(card),cardAfter(after)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -233,7 +233,10 @@ Targetable * WEventCardAttackedAlone::getTarget(int target)
|
||||
|
||||
Targetable * WEventCardSacrifice::getTarget(int target)
|
||||
{
|
||||
if (target) return card;
|
||||
if (target)
|
||||
{
|
||||
return cardAfter;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user