Merge remote-tracking branch 'refs/remotes/WagicProject/master'

This commit is contained in:
Anthony Calosa
2016-07-08 08:37:09 +08:00
8 changed files with 15 additions and 8 deletions
+4 -1
View File
@@ -1159,6 +1159,8 @@ public:
{ {
WEventCardTap * e = dynamic_cast<WEventCardTap *> (event); WEventCardTap * e = dynamic_cast<WEventCardTap *> (event);
if (!e) return 0; if (!e) return 0;
if (e->noTrigger)
return 0;
if (e->before == e->after) return 0; if (e->before == e->after) return 0;
if (e->after != tap) return 0; if (e->after != tap) return 0;
if (!tc->canTarget(e->card)) return 0; if (!tc->canTarget(e->card)) return 0;
@@ -4361,7 +4363,8 @@ public:
class AATapper: public ActivatedAbility class AATapper: public ActivatedAbility
{ {
public: public:
AATapper(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL); bool _sendNoEvent;
AATapper(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL, bool _sendNoEvent = true);
int resolve(); int resolve();
const string getMenuText(); const string getMenuText();
AATapper * clone() const; AATapper * clone() const;
+1 -1
View File
@@ -222,7 +222,7 @@ public:
int isUntapping(); int isUntapping();
int isTapped(); int isTapped();
void untap(); void untap();
void tap(); void tap(bool sendNoEvent = false);
void attemptUntap(); void attemptUntap();
//cda and other func //cda and other func
+1
View File
@@ -127,6 +127,7 @@ struct WEventCardChangeType : public WEventCardUpdate {
struct WEventCardTap : public WEventCardUpdate { struct WEventCardTap : public WEventCardUpdate {
bool before; bool before;
bool after; bool after;
bool noTrigger;
WEventCardTap(MTGCardInstance * card, bool before, bool after); WEventCardTap(MTGCardInstance * card, bool before, bool after);
virtual Targetable * getTarget(int target); virtual Targetable * getTarget(int target);
}; };
+3 -3
View File
@@ -4334,8 +4334,8 @@ ABestow * ABestow::clone() const
} }
//Tapper //Tapper
AATapper::AATapper(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost) : AATapper::AATapper(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost, bool sendNoEvent) :
ActivatedAbility(observer, id, card, _cost, 0) ActivatedAbility(observer, id, card, _cost, 0),_sendNoEvent(sendNoEvent)
{ {
target = _target; target = _target;
aType = MTGAbility::TAPPER; aType = MTGAbility::TAPPER;
@@ -4348,7 +4348,7 @@ int AATapper::resolve()
{ {
while (_target->next) while (_target->next)
_target = _target->next; //This is for cards such as rampant growth _target = _target->next; //This is for cards such as rampant growth
_target->tap(); _target->tap(_sendNoEvent);
} }
return 1; return 1;
} }
+1 -1
View File
@@ -3575,7 +3575,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
found = s.find("tap"); found = s.find("tap");
if (found != string::npos) if (found != string::npos)
{ {
MTGAbility * a = NEW AATapper(observer, id, card, target); MTGAbility * a = NEW AATapper(observer, id, card, target, NULL, bool(s.find("tap(noevent)") != string::npos));
a->oneShot = 1; a->oneShot = 1;
return a; return a;
} }
+3 -1
View File
@@ -467,12 +467,14 @@ void MTGCardInstance::eventblocked(MTGCardInstance * opponent)
} }
//Taps the card //Taps the card
void MTGCardInstance::tap() void MTGCardInstance::tap(bool sendNoEvent)
{ {
if (tapped) if (tapped)
return; return;
tapped = 1; tapped = 1;
WEvent * e = NEW WEventCardTap(this, 0, 1); WEvent * e = NEW WEventCardTap(this, 0, 1);
if (sendNoEvent)
dynamic_cast<WEventCardTap*>(e)->noTrigger = true;
observer->receiveEvent(e); observer->receiveEvent(e);
} }
+1 -1
View File
@@ -364,7 +364,7 @@ MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone
to = g->players[i]->game->exile; to = g->players[i]->game->exile;
} }
//close the currently open MAIN display.
if (from == g->players[i]->game->library || from == g->players[i]->game->graveyard || from == g->players[i]->game->exile) if (from == g->players[i]->game->library || from == g->players[i]->game->graveyard || from == g->players[i]->game->exile)
{ {
if (g->guiOpenDisplay) if (g->guiOpenDisplay)
+1
View File
@@ -56,6 +56,7 @@ WEvent(CHANGE_PHASE), from(from), to(to)
WEventCardTap::WEventCardTap(MTGCardInstance * card, bool before, bool after) : WEventCardTap::WEventCardTap(MTGCardInstance * card, bool before, bool after) :
WEventCardUpdate(card), before(before), after(after) WEventCardUpdate(card), before(before), after(after)
{ {
noTrigger = false;
} }
WEventCardTappedForMana::WEventCardTappedForMana(MTGCardInstance * card, bool before, bool after) : WEventCardTappedForMana::WEventCardTappedForMana(MTGCardInstance * card, bool before, bool after) :