- tap/untap of a card now sends an event
This commit is contained in:
wagic.the.homebrew@gmail.com
2009-06-25 14:23:21 +00:00
parent 3d414f74b3
commit 630a239f31
14 changed files with 97 additions and 60 deletions
+18 -18
View File
@@ -700,7 +700,7 @@ class AUnBlocker:public MTGAbility{
int reactToClick(MTGCardInstance * _card){ int reactToClick(MTGCardInstance * _card){
if (!isReactingToClick( _card)) return 0; if (!isReactingToClick( _card)) return 0;
game->currentlyActing()->getManaPool()->pay(cost); game->currentlyActing()->getManaPool()->pay(cost);
_card->untap(); _card->attemptUntap();
return 1; return 1;
} }
@@ -1090,7 +1090,7 @@ class ARegularLifeModifierAura:public MTGAbility{
void Update(float dt){ void Update(float dt){
if (newPhase !=currentPhase && newPhase==phase && game->currentPlayer==((MTGCardInstance *)target)->controller()){ if (newPhase !=currentPhase && newPhase==phase && game->currentPlayer==((MTGCardInstance *)target)->controller()){
if (!onlyIfTargetTapped || ((MTGCardInstance *)target)->tapped){ if (!onlyIfTargetTapped || ((MTGCardInstance *)target)->isTapped()){
if (life > 0){ if (life > 0){
game->currentPlayer->life+=life; game->currentPlayer->life+=life;
}else{ }else{
@@ -1432,7 +1432,7 @@ class ATapper:public TargetAbility{
int resolve(){ int resolve(){
MTGCardInstance * _target = tc->getNextCardTarget(); MTGCardInstance * _target = tc->getNextCardTarget();
if (_target){ if (_target){
_target->tapped = true; _target->tap();
} }
return 1; return 1;
} }
@@ -1458,7 +1458,7 @@ class AUntaper:public TargetAbility{
int resolve(){ int resolve(){
MTGCardInstance * _target = tc->getNextCardTarget(); MTGCardInstance * _target = tc->getNextCardTarget();
if (_target){ if (_target){
_target->tapped = 0; _target->untap();
} }
return 1; return 1;
} }
@@ -1539,7 +1539,7 @@ class AStrongLandLinkCreature: public MTGAbility{
if (source->isAttacker()){ if (source->isAttacker()){
if (!game->opponent()->game->inPlay->hasType(land)){ if (!game->opponent()->game->inPlay->hasType(land)){
source->attacker=0; source->attacker=0;
source->tapped = 0; source->untap();
//TODO Improve, there can be race conditions here //TODO Improve, there can be race conditions here
} }
} }
@@ -1702,7 +1702,7 @@ class AAladdinsLamp: public TargetAbility{
int fireAbility(){ int fireAbility(){
source->tapped = 1; source->tap();
MTGLibrary * library = game->currentlyActing()->game->library; MTGLibrary * library = game->currentlyActing()->game->library;
MTGCardInstance * card = library->removeCard(tc->getNextCardTarget()); MTGCardInstance * card = library->removeCard(tc->getNextCardTarget());
library->shuffleTopToBottom(nbcards - 1 ); library->shuffleTopToBottom(nbcards - 1 );
@@ -1879,7 +1879,7 @@ class AClockworkBeast:public MTGAbility{
game->currentlyActing()->getManaPool()->pay(& cost); game->currentlyActing()->getManaPool()->pay(& cost);
counters ++; counters ++;
((MTGCardInstance *)target)->power++; ((MTGCardInstance *)target)->power++;
((MTGCardInstance *)target)->tapped = 1; ((MTGCardInstance *)target)->tap();
return 1; return 1;
} }
@@ -1951,7 +1951,7 @@ class AConservator: public MTGAbility{
int reactToClick(MTGCardInstance * _card){ int reactToClick(MTGCardInstance * _card){
if (!isReactingToClick( _card)) return 0; if (!isReactingToClick( _card)) return 0;
game->currentlyActing()->getManaPool()->pay(& cost); game->currentlyActing()->getManaPool()->pay(& cost);
source->tapped = 1; source->tap();
canprevent = 2; canprevent = 2;
alterDamage(); alterDamage();
return 1; return 1;
@@ -2169,7 +2169,7 @@ class AGlassesOfUrza:public MTGAbility{
int reactToClick(MTGCardInstance * card){ int reactToClick(MTGCardInstance * card){
if (!isReactingToClick(card)) return 0; if (!isReactingToClick(card)) return 0;
source->tapped = 1; source->tap();
isActive = true; isActive = true;
return 1; return 1;
} }
@@ -2189,7 +2189,7 @@ class AHowlingMine:public MTGAbility{
AHowlingMine(int _id, MTGCardInstance * _source):MTGAbility(_id, _source){} AHowlingMine(int _id, MTGCardInstance * _source):MTGAbility(_id, _source){}
void Update(float dt){ void Update(float dt){
if (newPhase != currentPhase && newPhase == Constants::MTG_PHASE_DRAW && !source->tapped){ if (newPhase != currentPhase && newPhase == Constants::MTG_PHASE_DRAW && !source->isTapped()){
game->mLayers->stackLayer()->addDraw(game->currentPlayer); game->mLayers->stackLayer()->addDraw(game->currentPlayer);
} }
} }
@@ -2493,13 +2493,13 @@ class AKudzu: public TargetAbility{
tc->toggleTarget(_target); tc->toggleTarget(_target);
target = _target; target = _target;
previouslyTapped = 0; previouslyTapped = 0;
if (_target->tapped) previouslyTapped = 1; if (_target->isTapped()) previouslyTapped = 1;
} }
void Update(float dt){ void Update(float dt){
MTGCardInstance * _target = (MTGCardInstance *)target; MTGCardInstance * _target = (MTGCardInstance *)target;
if (_target && !_target->tapped){ if (_target && !_target->isTapped()){
previouslyTapped = 0; previouslyTapped = 0;
}else if (!previouslyTapped){ }else if (!previouslyTapped){
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
@@ -2528,7 +2528,7 @@ class AKudzu: public TargetAbility{
target = tc->getNextCardTarget(); target = tc->getNextCardTarget();
source->target = (MTGCardInstance *) target; source->target = (MTGCardInstance *) target;
previouslyTapped = 0; previouslyTapped = 0;
if (source->target && source->target->tapped) previouslyTapped = 1; if (source->target && source->target->isTapped()) previouslyTapped = 1;
return 1; return 1;
} }
@@ -2661,7 +2661,7 @@ class APowerSurge:public TriggeredAbility{
MTGInPlay * inPlay = game->opponent()->game->inPlay; MTGInPlay * inPlay = game->opponent()->game->inPlay;
for (int i = 0; i < inPlay->nb_cards; i++){ for (int i = 0; i < inPlay->nb_cards; i++){
MTGCardInstance * card = inPlay->cards[i]; MTGCardInstance * card = inPlay->cards[i];
if (!card->tapped && card->hasType("land")){ if (!card->isTapped() && card->hasType("land")){
totalLands++; totalLands++;
} }
} }
@@ -2752,7 +2752,7 @@ class APsychicVenom:public MTGAbility{
public: public:
int tapped; int tapped;
APsychicVenom(int _id, MTGCardInstance * _source, MTGCardInstance * _target):MTGAbility(_id, _source,_target){ APsychicVenom(int _id, MTGCardInstance * _source, MTGCardInstance * _target):MTGAbility(_id, _source,_target){
tapped = _target->tapped; tapped = _target->isTapped();
} }
void Update(float dt){ void Update(float dt){
@@ -3354,7 +3354,7 @@ class AGiveLifeForTappedType:public MTGAbility{
MTGInPlay * inplay = source->controller()->opponent()->game->inPlay; MTGInPlay * inplay = source->controller()->opponent()->game->inPlay;
for (int i = 0; i < inplay->nb_cards; i++){ for (int i = 0; i < inplay->nb_cards; i++){
MTGCardInstance * card = inplay->cards[i]; MTGCardInstance * card = inplay->cards[i];
if (card->tapped && card->hasType(type)) result++; if (card->isTapped() && card->hasType(type)) result++;
} }
return result; return result;
} }
@@ -3396,7 +3396,7 @@ class AMinionofLeshrac: public TargetAbility{
paidThisTurn = 0; paidThisTurn = 0;
}else if( newPhase == Constants::MTG_PHASE_UPKEEP + 1 && !paidThisTurn){ }else if( newPhase == Constants::MTG_PHASE_UPKEEP + 1 && !paidThisTurn){
game->mLayers->stackLayer()->addDamage(source,source->controller(), 5); game->mLayers->stackLayer()->addDamage(source,source->controller(), 5);
source->tapped = 1; source->tap();
} }
} }
TargetAbility::Update(dt); TargetAbility::Update(dt);
@@ -3551,7 +3551,7 @@ class ASeedbornMuse: public TriggeredAbility{
int resolve(){ int resolve(){
for (int j = source->controller()->game->inPlay->nb_cards-1; j >=0 ; j--){ for (int j = source->controller()->game->inPlay->nb_cards-1; j >=0 ; j--){
MTGCardInstance * current = source->controller()->game->inPlay->cards[j]; MTGCardInstance * current = source->controller()->game->inPlay->cards[j];
current->tapped = 0; current->untap();
} }
return 1; return 1;
} }
+1
View File
@@ -19,6 +19,7 @@ class CardDescriptor: public MTGCardInstance{
int mode; int mode;
int init(); int init();
CardDescriptor(); CardDescriptor();
void unsecureSetTapped(int i);
void setNegativeSubtype( string value); void setNegativeSubtype( string value);
MTGCardInstance * match(MTGCardInstance * card); MTGCardInstance * match(MTGCardInstance * card);
MTGCardInstance * match(MTGGameZone * zone); MTGCardInstance * match(MTGGameZone * zone);
+7 -3
View File
@@ -28,6 +28,7 @@ class MTGCardInstance: public MTGCard, public Damageable {
int untapping; int untapping;
int nb_damages; int nb_damages;
string sample; string sample;
int tapped;
int lifeOrig; int lifeOrig;
Blockers * blockers; Blockers * blockers;
@@ -58,14 +59,12 @@ class MTGCardInstance: public MTGCard, public Damageable {
int attacker; int attacker;
MTGCardInstance * banding; // If belongs to a band when attacking MTGCardInstance * banding; // If belongs to a band when attacking
MTGCardInstance * target; MTGCardInstance * target;
int tapped;
void addType(int type); void addType(int type);
int canBlock(); int canBlock();
int canBlock(MTGCardInstance * opponent); int canBlock(MTGCardInstance * opponent);
int canAttack(); int canAttack();
int afterDamage(); int afterDamage();
void setUntapping();
int isUntapping();
int has(int ability); int has(int ability);
int cleanup(); int cleanup();
int reset(); int reset();
@@ -99,9 +98,14 @@ class MTGCardInstance: public MTGCard, public Damageable {
int protectedAgainst(MTGCardInstance * card); int protectedAgainst(MTGCardInstance * card);
void copy(MTGCardInstance * card); void copy(MTGCardInstance * card);
// in game // in game
void setUntapping();
int isUntapping();
int isTapped(); int isTapped();
void untap(); void untap();
void tap(); void tap();
void attemptUntap();
int isInPlay(); int isInPlay();
void resetAllDamage(); void resetAllDamage();
JSample * getSample(); JSample * getSample();
+10 -1
View File
@@ -9,12 +9,13 @@ class Phase;
class WEvent{ class WEvent{
public: public:
enum{ enum{
NOT_SPECIFIED = 0,
CHANGE_ZONE = 1, CHANGE_ZONE = 1,
DAMAGE = 2, DAMAGE = 2,
CHANGE_PHASE = 3, CHANGE_PHASE = 3,
}; };
int type; int type;
WEvent(int _type); WEvent(int _type = NOT_SPECIFIED);
virtual ~WEvent() {}; virtual ~WEvent() {};
}; };
@@ -41,4 +42,12 @@ public:
WEventPhaseChange(Phase * _from, Phase * _to); WEventPhaseChange(Phase * _from, Phase * _to);
}; };
class WEventCardTap: public WEvent{
public:
MTGCardInstance * card;
int before;
int after;
WEventCardTap(MTGCardInstance * card, int before, int after);
};
#endif #endif
+4 -4
View File
@@ -71,7 +71,7 @@ void AIPlayer::tapLandsForMana(ManaCost * potentialMana, ManaCost * cost){
GameObserver * gameObs = GameObserver::GetInstance(); GameObserver * gameObs = GameObserver::GetInstance();
CardDescriptor cd; CardDescriptor cd;
cd.setColor(Constants::MTG_COLOR_LAND); cd.setColor(Constants::MTG_COLOR_LAND);
cd.tapped = -1; cd.unsecureSetTapped(-1);
MTGCardInstance * card = NULL; MTGCardInstance * card = NULL;
while((card = cd.nextmatch(game->inPlay, card))){ while((card = cd.nextmatch(game->inPlay, card))){
@@ -99,7 +99,7 @@ ManaCost * AIPlayer::getPotentialMana(){
potentialMana = NEW ManaCost(); potentialMana = NEW ManaCost();
CardDescriptor cd; CardDescriptor cd;
cd.setColor(Constants::MTG_COLOR_LAND); cd.setColor(Constants::MTG_COLOR_LAND);
cd.tapped = -1; cd.unsecureSetTapped(-1);
MTGCardInstance * card = NULL; MTGCardInstance * card = NULL;
while((card = cd.nextmatch(game->inPlay, card))){ while((card = cd.nextmatch(game->inPlay, card))){
@@ -353,7 +353,7 @@ int AIPlayer::getCreaturesInfo(Player * player, int neededInfo , int untapMode,
CardDescriptor cd; CardDescriptor cd;
cd.init(); cd.init();
cd.setType("Creature"); cd.setType("Creature");
cd.tapped = untapMode; cd.unsecureSetTapped(untapMode);
MTGCardInstance * card = NULL; MTGCardInstance * card = NULL;
while((card = cd.nextmatch(player->game->inPlay, card))){ while((card = cd.nextmatch(player->game->inPlay, card))){
if (!canAttack || card->canAttack()){ if (!canAttack || card->canAttack()){
@@ -414,7 +414,7 @@ int AIPlayer::chooseBlockers(){
CardDescriptor cd; CardDescriptor cd;
cd.init(); cd.init();
cd.setType("Creature"); cd.setType("Creature");
cd.tapped = -1; cd.unsecureSetTapped(-1);
MTGCardInstance * card = NULL; MTGCardInstance * card = NULL;
GameObserver * g = GameObserver::GetInstance(); GameObserver * g = GameObserver::GetInstance();
MTGAbility * a = g->mLayers->actionLayer()->getAbility(MTGAbility::MTG_BLOCK_RULE); MTGAbility * a = g->mLayers->actionLayer()->getAbility(MTGAbility::MTG_BLOCK_RULE);
+4
View File
@@ -13,6 +13,10 @@ int CardDescriptor::init(){
return result; return result;
} }
void CardDescriptor::unsecureSetTapped(int i){
tapped = i;
}
void CardDescriptor::setNegativeSubtype( string value){ void CardDescriptor::setNegativeSubtype( string value){
int id = Subtypes::subtypesList->Add(value); int id = Subtypes::subtypesList->Add(value);
addType(-id); addType(-id);
+1 -1
View File
@@ -34,7 +34,7 @@ int ConstraintResolver::untap(GameObserver * game, MTGCardInstance * card){
if (ok) { if (ok) {
player->getManaPool()->pay(untapManaCost); player->getManaPool()->pay(untapManaCost);
card->untap(); card->attemptUntap();
} }
delete untapManaCost; delete untapManaCost;
return ok; return ok;
+10 -10
View File
@@ -94,7 +94,7 @@ int AbilityFactory::TapAll(TargetChooser * tc){
for (int j = g->players[i]->game->inPlay->nb_cards-1; j >=0 ; j--){ for (int j = g->players[i]->game->inPlay->nb_cards-1; j >=0 ; j--){
MTGCardInstance * current = g->players[i]->game->inPlay->cards[j]; MTGCardInstance * current = g->players[i]->game->inPlay->cards[j];
if (tc->canTarget(current)){ if (tc->canTarget(current)){
current->tapped = 1; current->tap();
} }
} }
} }
@@ -110,7 +110,7 @@ int AbilityFactory::UntapAll(TargetChooser * tc){
for (int j = g->players[i]->game->inPlay->nb_cards-1; j >=0 ; j--){ for (int j = g->players[i]->game->inPlay->nb_cards-1; j >=0 ; j--){
MTGCardInstance * current = g->players[i]->game->inPlay->cards[j]; MTGCardInstance * current = g->players[i]->game->inPlay->cards[j];
if (tc->canTarget(current)){ if (tc->canTarget(current)){
current->tapped = 0; current->untap();
} }
} }
} }
@@ -390,7 +390,7 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){
if (cost){ if (cost){
game->addObserver(NEW AUntapManaBlocker(id, card, cost)); game->addObserver(NEW AUntapManaBlocker(id, card, cost));
}else{ }else{
target->tapped = 0; target->untap();
} }
} }
result++; result++;
@@ -1011,7 +1011,7 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){
game->addObserver(NEW ATapper(id, card, cost, tc)); game->addObserver(NEW ATapper(id, card, cost, tc));
} }
}else{ }else{
target->tapped = 1; target->tap();
} }
result++; result++;
continue; continue;
@@ -1447,7 +1447,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
MTGInPlay * inplay = player->game->inPlay; MTGInPlay * inplay = player->game->inPlay;
for (int i = 0; i < inplay->nb_cards; i++){ for (int i = 0; i < inplay->nb_cards; i++){
MTGCardInstance * current = inplay->cards[i]; MTGCardInstance * current = inplay->cards[i];
if (current->hasType("land")) current->tapped = 1; if (current->hasType("land")) current->tap();
} }
player->getManaPool()->init(); player->getManaPool()->init();
} }
@@ -1465,7 +1465,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
{ {
int cost[] = {Constants::MTG_COLOR_ARTIFACT, 4}; int cost[] = {Constants::MTG_COLOR_ARTIFACT, 4};
game->addObserver(NEW AUntapManaBlocker(_id, card,card->target, NEW ManaCost(cost,1))); game->addObserver(NEW AUntapManaBlocker(_id, card,card->target, NEW ManaCost(cost,1)));
card->target->tapped = 1; card->target->tap();
break; break;
} }
case 1172: //Pestilence case 1172: //Pestilence
@@ -1784,7 +1784,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
} }
case 1480: //Energy Tap case 1480: //Energy Tap
{ {
card->target->tapped = 1; card->target->tap();
int mana = card->target->getManaCost()->getConvertedCost(); int mana = card->target->getManaCost()->getConvertedCost();
game->currentlyActing()->getManaPool()->add(Constants::MTG_COLOR_ARTIFACT, mana); game->currentlyActing()->getManaPool()->add(Constants::MTG_COLOR_ARTIFACT, mana);
} }
@@ -2360,7 +2360,7 @@ int ActivatedAbility::reactToClick(MTGCardInstance * card){
game->currentlyActing()->getManaPool()->pay(cost); game->currentlyActing()->getManaPool()->pay(cost);
cost->doPayExtra(); cost->doPayExtra();
} }
if (needsTapping) source->tapped = 1; if (needsTapping) source->tap();
fireAbility(); fireAbility();
return 1; return 1;
@@ -2369,7 +2369,7 @@ int ActivatedAbility::reactToClick(MTGCardInstance * card){
int ActivatedAbility::reactToTargetClick(Targetable * object){ int ActivatedAbility::reactToTargetClick(Targetable * object){
if (!isReactingToTargetClick(object)) return 0; if (!isReactingToTargetClick(object)) return 0;
if (needsTapping) source->tapped = 1; if (needsTapping) source->tap();
if (cost){ if (cost){
if (object->typeAsTarget() == TARGET_CARD) cost->setExtraCostsAction(this, (MTGCardInstance *) object); if (object->typeAsTarget() == TARGET_CARD) cost->setExtraCostsAction(this, (MTGCardInstance *) object);
OutputDebugString("React To click 2\n"); OutputDebugString("React To click 2\n");
@@ -2819,7 +2819,7 @@ other solutions need to be provided for abilities that add mana (ex: mana flare)
GameObserver::GetInstance()->currentlyActing()->getManaPool()->pay(cost); GameObserver::GetInstance()->currentlyActing()->getManaPool()->pay(cost);
cost->doPayExtra(); cost->doPayExtra();
} }
if (tap) source->tapped = 1; if (tap) source->tap();
currentlyTapping++; currentlyTapping++;
animation = 1.f; animation = 1.f;
+22 -7
View File
@@ -172,9 +172,24 @@ int MTGCardInstance::has(int basicAbility){
//Taps the card //Taps the card
void MTGCardInstance::tap(){ void MTGCardInstance::tap(){
if (tapped) return;
tapped = 1; tapped = 1;
WEvent * e = NEW WEventCardTap(this, 0, 1);
GameObserver * game = GameObserver::GetInstance();
game->receiveEvent(e);
delete e;
} }
void MTGCardInstance::untap(){
if (!tapped) return;
tapped = 0;
WEvent * e = NEW WEventCardTap(this, 1, 0);
GameObserver * game = GameObserver::GetInstance();
game->receiveEvent(e);
delete e;
}
void MTGCardInstance::setUntapping(){ void MTGCardInstance::setUntapping(){
untapping = 1; untapping = 1;
} }
@@ -183,10 +198,10 @@ int MTGCardInstance::isUntapping(){
return untapping; return untapping;
} }
//Untaps the card //Tries to Untap the card
void MTGCardInstance::untap(){ void MTGCardInstance::attemptUntap(){
if (untapping){ if (untapping){
tapped = 0; untap();
untapping = 0; untapping = 0;
} }
} }
@@ -210,7 +225,7 @@ int MTGCardInstance::regenerate(){
int MTGCardInstance::triggerRegenerate(){ int MTGCardInstance::triggerRegenerate(){
if (! regenerateTokens) return 0; if (! regenerateTokens) return 0;
regenerateTokens--; regenerateTokens--;
tapped = 1; tap();
life = toughness; life = toughness;
initAttackersDefensers(); initAttackersDefensers();
return 1; return 1;
@@ -269,7 +284,7 @@ MTGCardInstance * MTGCardInstance::changeController(Player * newController){
//Reset the card parameters //Reset the card parameters
int MTGCardInstance::reset(){ int MTGCardInstance::reset(){
cleanup(); cleanup();
tapped=0; untap();
SAFE_DELETE(counters); SAFE_DELETE(counters);
counters = NEW Counters(this); counters = NEW Counters(this);
return 1; return 1;
@@ -383,7 +398,7 @@ int MTGCardInstance::toggleAttacker(){
if (canAttack()){ if (canAttack()){
if (!attacker){ if (!attacker){
attacker = 1; attacker = 1;
tapped = 1; tap();
return 1; return 1;
}else{ }else{
MTGCardInstance * bandingPartner = getNextPartner(); MTGCardInstance * bandingPartner = getNextPartner();
@@ -394,7 +409,7 @@ int MTGCardInstance::toggleAttacker(){
return 1; return 1;
}else{ }else{
attacker = 0; attacker = 0;
tapped = 0; untap();
return 1; return 1;
} }
} }
+1 -1
View File
@@ -372,7 +372,7 @@ void MTGInPlay::untapAll(){
sprintf(buf, "Can untap %s\n", cards[i]->getName()); sprintf(buf, "Can untap %s\n", cards[i]->getName());
OutputDebugString(buf); OutputDebugString(buf);
#endif #endif
cards[i]->untap(); cards[i]->attemptUntap();
} }
} }
} }
+1 -4
View File
@@ -199,9 +199,8 @@ void MTGGuiPlay::forceUpdateCards(){
} }
int MTGGuiPlay::receiveEvent(WEvent *event){ int MTGGuiPlay::receiveEvent(WEvent *event){
if (event->type == WEvent::CHANGE_ZONE){
WEventZoneChange * e = dynamic_cast<WEventZoneChange*>(event); WEventZoneChange * e = dynamic_cast<WEventZoneChange*>(event);
if (!event) return 0; if (!e) return 0;
int ok = 0; int ok = 0;
for (int i = 0; i < 2 ; i++){ for (int i = 0; i < 2 ; i++){
Player * p = game->players[i]; Player * p = game->players[i];
@@ -211,8 +210,6 @@ int MTGGuiPlay::receiveEvent(WEvent *event){
forceUpdateCards(); forceUpdateCards();
return 1; return 1;
} }
return 0;
}
void MTGGuiPlay::updateCards(){ void MTGGuiPlay::updateCards(){
GameObserver * game = GameObserver::GetInstance(); GameObserver * game = GameObserver::GetInstance();
+1 -1
View File
@@ -110,7 +110,7 @@ void MTGAttackRule::Update(float dt){
int MTGAttackRule::reactToClick(MTGCardInstance * card){ int MTGAttackRule::reactToClick(MTGCardInstance * card){
if (!isReactingToClick(card)) return 0; if (!isReactingToClick(card)) return 0;
card->attacker = 1; card->attacker = 1;
if (!card->basicAbilities[Constants::VIGILANCE]) card->tapped = 1; if (!card->basicAbilities[Constants::VIGILANCE]) card->tap();
return 1; return 1;
} }
+2 -2
View File
@@ -138,9 +138,9 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
//Tapped, untapped //Tapped, untapped
}else if (attribute.find("tapped") != string::npos){ }else if (attribute.find("tapped") != string::npos){
if (minus){ if (minus){
cd->tapped = -1; cd->unsecureSetTapped(-1);
}else{ }else{
cd->tapped = 1; cd->unsecureSetTapped(1);
} }
}else{ }else{
int attributefound = 0; int attributefound = 0;
+7
View File
@@ -4,6 +4,7 @@
#include "../include/Damage.h" #include "../include/Damage.h"
#include "../include/PhaseRing.h" #include "../include/PhaseRing.h"
WEvent::WEvent(int _type){ WEvent::WEvent(int _type){
type=_type; type=_type;
} }
@@ -22,3 +23,9 @@ WEventPhaseChange::WEventPhaseChange(Phase * _from, Phase * _to):WEvent(CHANGE_P
from = _from; from = _from;
to = _to; to = _to;
} }
WEventCardTap::WEventCardTap(MTGCardInstance * _card, int _before, int _after):WEvent(){
card = _card;
before = _before;
after = _after;
}