autoformatted the spaces in MTGRules.cpp since i pretty much made it look like a mess..very pretty now :D
This commit is contained in:
+161
-161
@@ -11,7 +11,7 @@ MTGPutInPlayRule::MTGPutInPlayRule(int _id):MTGAbility(_id, NULL){
|
||||
}
|
||||
|
||||
int MTGPutInPlayRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana){
|
||||
int cardsinhand = game->players[0]->game->hand->nb_cards;
|
||||
int cardsinhand = game->players[0]->game->hand->nb_cards;
|
||||
Player * player = game->currentlyActing();
|
||||
Player * currentPlayer = game->currentPlayer;
|
||||
if (!player->game->hand->hasCard(card)) return 0;
|
||||
@@ -58,7 +58,7 @@ int MTGPutInPlayRule::reactToClick(MTGCardInstance * card){
|
||||
Player * player = game->currentlyActing();
|
||||
ManaCost * cost = card->getManaCost();
|
||||
ManaCost * playerMana = player->getManaPool();
|
||||
//this handles extra cost payments at the moment a card is played.
|
||||
//this handles extra cost payments at the moment a card is played.
|
||||
|
||||
if (cost->isExtraPaymentSet()){
|
||||
if (!game->targetListIsSet(card)){
|
||||
@@ -127,25 +127,25 @@ ostream& MTGPutInPlayRule::toString(ostream& out) const
|
||||
return MTGAbility::toString(out) << ")";
|
||||
}
|
||||
|
||||
MTGPutInPlayRule * MTGPutInPlayRule::clone() const{
|
||||
MTGPutInPlayRule * MTGPutInPlayRule::clone() const{
|
||||
MTGPutInPlayRule * a = NEW MTGPutInPlayRule(*this);
|
||||
a->isClone = 1;
|
||||
return a;
|
||||
}
|
||||
}
|
||||
//cast from anywhere possible with this??
|
||||
|
||||
//Alternative cost rules
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
MTGAlternativeCostRule::MTGAlternativeCostRule(int _id):MTGAbility(_id, NULL){
|
||||
aType=MTGAbility::ALTERNATIVE_COST;
|
||||
}
|
||||
int MTGAlternativeCostRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana){
|
||||
int cardsinhand = game->players[0]->game->hand->nb_cards;
|
||||
int cardsinhand = game->players[0]->game->hand->nb_cards;
|
||||
Player * player = game->currentlyActing();
|
||||
Player * currentPlayer = game->currentPlayer;
|
||||
if (!player->game->hand->hasCard(card)) return 0;
|
||||
@@ -181,7 +181,7 @@ int MTGAlternativeCostRule::reactToClick(MTGCardInstance * card){
|
||||
ManaCost * cost = card->getManaCost();
|
||||
ManaCost * alternative = card->getManaCost()->alternative;
|
||||
ManaCost * playerMana = player->getManaPool();
|
||||
//this handles extra cost payments at the moment a card is played.
|
||||
//this handles extra cost payments at the moment a card is played.
|
||||
if(playerMana->canAfford(alternative)){
|
||||
if (cost->alternative->isExtraPaymentSet()){
|
||||
card->paymenttype = 1;
|
||||
@@ -195,16 +195,16 @@ int MTGAlternativeCostRule::reactToClick(MTGCardInstance * card){
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------
|
||||
ManaCost * previousManaPool = NEW ManaCost(player->getManaPool());
|
||||
int payResult = player->getManaPool()->pay(card->getManaCost()->alternative);
|
||||
card->getManaCost()->alternative->doPayExtra();
|
||||
payResult = ManaCost::MANA_PAID_WITH_ALTERNATIVE;
|
||||
//if alternative has a extra payment thats set, this code pays it.the if statement is 100% needed as it would cause a crash on cards that dont have the alternative cost.
|
||||
//if alternative has a extra payment thats set, this code pays it.the if statement is 100% needed as it would cause a crash on cards that dont have the alternative cost.
|
||||
if(alternative){
|
||||
card->getManaCost()->alternative->doPayExtra();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
ManaCost * spellCost = previousManaPool->Diff(player->getManaPool());
|
||||
delete previousManaPool;
|
||||
if (card->hasType("land")){
|
||||
@@ -258,23 +258,23 @@ ostream& MTGAlternativeCostRule::toString(ostream& out) const
|
||||
out << "MTGAlternativeCostRule ::: (";
|
||||
return MTGAbility::toString(out) << ")";
|
||||
}
|
||||
MTGAlternativeCostRule * MTGAlternativeCostRule::clone() const{
|
||||
MTGAlternativeCostRule * MTGAlternativeCostRule::clone() const{
|
||||
MTGAlternativeCostRule * a = NEW MTGAlternativeCostRule(*this);
|
||||
a->isClone = 1;
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
//buyback follows its own resolving rules
|
||||
MTGBuyBackRule::MTGBuyBackRule(int _id):MTGAbility(_id, NULL){
|
||||
aType=MTGAbility::BUYBACK_COST;
|
||||
}
|
||||
int MTGBuyBackRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana){
|
||||
int cardsinhand = game->players[0]->game->hand->nb_cards;
|
||||
int cardsinhand = game->players[0]->game->hand->nb_cards;
|
||||
Player * player = game->currentlyActing();
|
||||
Player * currentPlayer = game->currentPlayer;
|
||||
if (!player->game->hand->hasCard(card)) return 0;
|
||||
@@ -310,7 +310,7 @@ int MTGBuyBackRule::reactToClick(MTGCardInstance * card){
|
||||
ManaCost * cost = card->getManaCost();
|
||||
ManaCost * BuyBack = card->getManaCost()->BuyBack;
|
||||
ManaCost * playerMana = player->getManaPool();
|
||||
//this handles extra cost payments at the moment a card is played.
|
||||
//this handles extra cost payments at the moment a card is played.
|
||||
if(playerMana->canAfford(BuyBack)){
|
||||
if (cost->BuyBack->isExtraPaymentSet()){
|
||||
card->paymenttype = 2;
|
||||
@@ -324,16 +324,16 @@ int MTGBuyBackRule::reactToClick(MTGCardInstance * card){
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------
|
||||
ManaCost * previousManaPool = NEW ManaCost(player->getManaPool());
|
||||
int payResult = player->getManaPool()->pay(card->getManaCost()->BuyBack);
|
||||
card->getManaCost()->doPayExtra();
|
||||
payResult = ManaCost::MANA_PAID_WITH_BUYBACK;
|
||||
//if BuyBack has a extra payment thats set, this code pays it.the if statement is 100% needed as it would cause a crash on cards that dont have the BuyBack cost.
|
||||
//if BuyBack has a extra payment thats set, this code pays it.the if statement is 100% needed as it would cause a crash on cards that dont have the BuyBack cost.
|
||||
if(BuyBack){
|
||||
card->getManaCost()->BuyBack->doPayExtra();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
ManaCost * spellCost = previousManaPool->Diff(player->getManaPool());
|
||||
card->boughtback = 1;
|
||||
delete previousManaPool;
|
||||
@@ -392,23 +392,23 @@ ostream& MTGBuyBackRule::toString(ostream& out) const
|
||||
out << "MTGBuyBackRule ::: (";
|
||||
return MTGAbility::toString(out) << ")";
|
||||
}
|
||||
MTGBuyBackRule * MTGBuyBackRule::clone() const{
|
||||
MTGBuyBackRule * MTGBuyBackRule::clone() const{
|
||||
MTGBuyBackRule * a = NEW MTGBuyBackRule(*this);
|
||||
a->isClone = 1;
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
//flashback follows its own resolving rules
|
||||
MTGFlashBackRule::MTGFlashBackRule(int _id):MTGAbility(_id, NULL){
|
||||
aType=MTGAbility::FLASHBACK_COST;
|
||||
}
|
||||
int MTGFlashBackRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana){
|
||||
int cardsingraveyard = game->players[0]->game->graveyard->nb_cards;
|
||||
int cardsingraveyard = game->players[0]->game->graveyard->nb_cards;
|
||||
Player * player = game->currentlyActing();
|
||||
Player * currentPlayer = game->currentPlayer;
|
||||
if (!player->game->graveyard->hasCard(card)) return 0;
|
||||
@@ -440,7 +440,7 @@ int MTGFlashBackRule::reactToClick(MTGCardInstance * card){
|
||||
ManaCost * cost = card->getManaCost();
|
||||
ManaCost * FlashBack = card->getManaCost()->FlashBack;
|
||||
ManaCost * playerMana = player->getManaPool();
|
||||
//this handles extra cost payments at the moment a card is played.
|
||||
//this handles extra cost payments at the moment a card is played.
|
||||
if(playerMana->canAfford(FlashBack)){
|
||||
if (cost->FlashBack->isExtraPaymentSet()){
|
||||
card->paymenttype = 3;
|
||||
@@ -454,16 +454,16 @@ int MTGFlashBackRule::reactToClick(MTGCardInstance * card){
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------
|
||||
ManaCost * previousManaPool = NEW ManaCost(player->getManaPool());
|
||||
int payResult = player->getManaPool()->pay(card->getManaCost()->FlashBack);
|
||||
card->getManaCost()->doPayExtra();
|
||||
payResult = ManaCost::MANA_PAID_WITH_FLASHBACK;
|
||||
//if flashBack has a extra payment thats set, this code pays it.the if statement is 100% needed as it would cause a crash on cards that dont have the flashBack cost.
|
||||
//if flashBack has a extra payment thats set, this code pays it.the if statement is 100% needed as it would cause a crash on cards that dont have the flashBack cost.
|
||||
if(FlashBack){
|
||||
card->getManaCost()->FlashBack->doPayExtra();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
ManaCost * spellCost = previousManaPool->Diff(player->getManaPool());
|
||||
card->flashedback = 1;
|
||||
delete previousManaPool;
|
||||
@@ -522,24 +522,24 @@ ostream& MTGFlashBackRule::toString(ostream& out) const
|
||||
out << "MTGFlashBackRule ::: (";
|
||||
return MTGAbility::toString(out) << ")";
|
||||
}
|
||||
MTGFlashBackRule * MTGFlashBackRule::clone() const{
|
||||
MTGFlashBackRule * MTGFlashBackRule::clone() const{
|
||||
MTGFlashBackRule * a = NEW MTGFlashBackRule(*this);
|
||||
a->isClone = 1;
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
//retrace
|
||||
//retrace
|
||||
MTGRetraceRule::MTGRetraceRule(int _id):MTGAbility(_id, NULL){
|
||||
aType=MTGAbility::RETRACE_COST;
|
||||
}
|
||||
int MTGRetraceRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana){
|
||||
int cardsingraveyard = game->players[0]->game->graveyard->nb_cards;
|
||||
int cardsingraveyard = game->players[0]->game->graveyard->nb_cards;
|
||||
Player * player = game->currentlyActing();
|
||||
Player * currentPlayer = game->currentPlayer;
|
||||
if (!player->game->graveyard->hasCard(card)) return 0;
|
||||
@@ -571,7 +571,7 @@ int MTGRetraceRule::reactToClick(MTGCardInstance * card){
|
||||
ManaCost * cost = card->getManaCost();
|
||||
ManaCost * Retrace = card->getManaCost()->Retrace;
|
||||
ManaCost * playerMana = player->getManaPool();
|
||||
//this handles extra cost payments at the moment a card is played.
|
||||
//this handles extra cost payments at the moment a card is played.
|
||||
if(playerMana->canAfford(Retrace)){
|
||||
if (cost->Retrace->isExtraPaymentSet()){
|
||||
card->paymenttype = 4;
|
||||
@@ -585,16 +585,16 @@ int MTGRetraceRule::reactToClick(MTGCardInstance * card){
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------
|
||||
ManaCost * previousManaPool = NEW ManaCost(player->getManaPool());
|
||||
int payResult = player->getManaPool()->pay(card->getManaCost()->Retrace);
|
||||
card->getManaCost()->doPayExtra();
|
||||
payResult = ManaCost::MANA_PAID_WITH_RETRACE;
|
||||
//if Retrace has a extra payment thats set, this code pays it.the if statement is 100% needed as it would cause a crash on cards that dont have the Retrace cost.
|
||||
//if Retrace has a extra payment thats set, this code pays it.the if statement is 100% needed as it would cause a crash on cards that dont have the Retrace cost.
|
||||
if(Retrace){
|
||||
card->getManaCost()->Retrace->doPayExtra();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
ManaCost * spellCost = previousManaPool->Diff(player->getManaPool());
|
||||
delete previousManaPool;
|
||||
if (card->hasType("land")){
|
||||
@@ -649,17 +649,17 @@ ostream& MTGRetraceRule::toString(ostream& out) const
|
||||
out << "MTGRetraceRule ::: (";
|
||||
return MTGAbility::toString(out) << ")";
|
||||
}
|
||||
MTGRetraceRule * MTGRetraceRule::clone() const{
|
||||
MTGRetraceRule * MTGRetraceRule::clone() const{
|
||||
MTGRetraceRule * a = NEW MTGRetraceRule(*this);
|
||||
a->isClone = 1;
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
//-----------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
//-----------------------------
|
||||
bool MTGAttackRule::select(Target* t)
|
||||
{
|
||||
if (CardView* c = dynamic_cast<CardView*>(t)) {
|
||||
@@ -727,11 +727,11 @@ ostream& MTGAttackRule::toString(ostream& out) const
|
||||
return MTGAbility::toString(out) << ")";
|
||||
}
|
||||
|
||||
MTGAttackRule * MTGAttackRule::clone() const{
|
||||
MTGAttackRule * MTGAttackRule::clone() const{
|
||||
MTGAttackRule * a = NEW MTGAttackRule(*this);
|
||||
a->isClone = 1;
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
OtherAbilitiesEventReceiver::OtherAbilitiesEventReceiver(int _id):MTGAbility(_id,NULL){
|
||||
@@ -757,11 +757,11 @@ int OtherAbilitiesEventReceiver::testDestroy(){
|
||||
return 0;
|
||||
}
|
||||
|
||||
OtherAbilitiesEventReceiver * OtherAbilitiesEventReceiver::clone() const{
|
||||
OtherAbilitiesEventReceiver * OtherAbilitiesEventReceiver::clone() const{
|
||||
OtherAbilitiesEventReceiver * a = NEW OtherAbilitiesEventReceiver(*this);
|
||||
a->isClone = 1;
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MTGBlockRule::MTGBlockRule(int _id):MTGAbility(_id,NULL){
|
||||
@@ -806,11 +806,11 @@ ostream& MTGBlockRule::toString(ostream& out) const
|
||||
return MTGAbility::toString(out) << ")";
|
||||
}
|
||||
|
||||
MTGBlockRule * MTGBlockRule::clone() const{
|
||||
MTGBlockRule * MTGBlockRule::clone() const{
|
||||
MTGBlockRule * a = NEW MTGBlockRule(*this);
|
||||
a->isClone = 1;
|
||||
return a;
|
||||
}
|
||||
}
|
||||
//
|
||||
// Attacker chooses blockers order
|
||||
//
|
||||
@@ -938,11 +938,11 @@ ostream& MTGMomirRule::toString(ostream& out) const
|
||||
}
|
||||
|
||||
|
||||
MTGMomirRule * MTGMomirRule::clone() const{
|
||||
MTGMomirRule * MTGMomirRule::clone() const{
|
||||
MTGMomirRule * a = NEW MTGMomirRule(*this);
|
||||
a->isClone = 1;
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
//HUDDisplay
|
||||
int HUDDisplay::testDestroy(){
|
||||
@@ -1034,17 +1034,17 @@ HUDDisplay::~HUDDisplay(){
|
||||
events.clear();
|
||||
}
|
||||
|
||||
HUDDisplay * HUDDisplay::clone() const{
|
||||
HUDDisplay * HUDDisplay::clone() const{
|
||||
HUDDisplay * a = NEW HUDDisplay(*this);
|
||||
a->isClone = 1;
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Persist */
|
||||
MTGPersistRule::MTGPersistRule(int _id):MTGAbility(_id,NULL){};
|
||||
/* Persist */
|
||||
MTGPersistRule::MTGPersistRule(int _id):MTGAbility(_id,NULL){};
|
||||
|
||||
int MTGPersistRule::receiveEvent(WEvent * event){
|
||||
int MTGPersistRule::receiveEvent(WEvent * event){
|
||||
if (event->type == WEvent::CHANGE_ZONE){
|
||||
WEventZoneChange * e = (WEventZoneChange *) event;
|
||||
MTGCardInstance * card = e->card->previous;
|
||||
@@ -1069,23 +1069,23 @@ HUDDisplay::~HUDDisplay(){
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
ostream& MTGPersistRule::toString(ostream& out) const
|
||||
{
|
||||
ostream& MTGPersistRule::toString(ostream& out) const
|
||||
{
|
||||
out << "MTGPersistRule ::: (";
|
||||
return MTGAbility::toString(out) << ")";
|
||||
}
|
||||
int MTGPersistRule::testDestroy(){return 0;}
|
||||
MTGPersistRule * MTGPersistRule::clone() const{
|
||||
}
|
||||
int MTGPersistRule::testDestroy(){return 0;}
|
||||
MTGPersistRule * MTGPersistRule::clone() const{
|
||||
MTGPersistRule * a = NEW MTGPersistRule(*this);
|
||||
a->isClone = 1;
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
//putting cards with restricting effects inplay
|
||||
MTGCantCasterstart::MTGCantCasterstart(int _id):MTGAbility(_id,NULL){};
|
||||
int MTGCantCasterstart::receiveEvent(WEvent * event){
|
||||
MTGCantCasterstart::MTGCantCasterstart(int _id):MTGAbility(_id,NULL){};
|
||||
int MTGCantCasterstart::receiveEvent(WEvent * event){
|
||||
if (event->type == WEvent::CHANGE_ZONE){
|
||||
WEventZoneChange * e = (WEventZoneChange *) event;
|
||||
MTGCardInstance * card = e->card->previous;
|
||||
@@ -1141,7 +1141,7 @@ HUDDisplay::~HUDDisplay(){
|
||||
card->controller()->onlyonecast = 1;
|
||||
}
|
||||
}
|
||||
//any on other side?
|
||||
//any on other side?
|
||||
for (int j = 0; j < onbcards; ++j){
|
||||
MTGCardInstance * c = y->cards[j];
|
||||
if (c->has(Constants::NOMAXHAND)){
|
||||
@@ -1169,7 +1169,7 @@ HUDDisplay::~HUDDisplay(){
|
||||
card->controller()->opponent()->castrestrictedspell = 1;
|
||||
}
|
||||
}
|
||||
//-----if a card with both*restrict* was found then the players are still restricted, if one player is still restricted he stays restricted.
|
||||
//-----if a card with both*restrict* was found then the players are still restricted, if one player is still restricted he stays restricted.
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1177,27 +1177,27 @@ HUDDisplay::~HUDDisplay(){
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
ostream& MTGCantCasterstart::toString(ostream& out) const
|
||||
{
|
||||
}
|
||||
ostream& MTGCantCasterstart::toString(ostream& out) const
|
||||
{
|
||||
out << "MTGCantCasterstart ::: (";
|
||||
return MTGAbility::toString(out) << ")";
|
||||
}
|
||||
int MTGCantCasterstart::testDestroy(){return 0;}
|
||||
MTGCantCasterstart * MTGCantCasterstart::clone() const{
|
||||
}
|
||||
int MTGCantCasterstart::testDestroy(){return 0;}
|
||||
MTGCantCasterstart * MTGCantCasterstart::clone() const{
|
||||
MTGCantCasterstart * a = NEW MTGCantCasterstart(*this);
|
||||
a->isClone = 1;
|
||||
return a;
|
||||
}
|
||||
}
|
||||
//the end of this very complex code line.
|
||||
|
||||
|
||||
|
||||
//unearth rule----------------------------------
|
||||
//if the card leaves play, exile it instead.
|
||||
MTGUnearthRule::MTGUnearthRule(int _id):MTGAbility(_id,NULL){};
|
||||
MTGUnearthRule::MTGUnearthRule(int _id):MTGAbility(_id,NULL){};
|
||||
|
||||
int MTGUnearthRule::receiveEvent(WEvent * event){
|
||||
int MTGUnearthRule::receiveEvent(WEvent * event){
|
||||
if (event->type == WEvent::CHANGE_ZONE){
|
||||
WEventZoneChange * e = (WEventZoneChange *) event;
|
||||
MTGCardInstance * card = e->card->previous;
|
||||
@@ -1218,26 +1218,26 @@ HUDDisplay::~HUDDisplay(){
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
ostream& MTGUnearthRule::toString(ostream& out) const
|
||||
{
|
||||
ostream& MTGUnearthRule::toString(ostream& out) const
|
||||
{
|
||||
out << "MTGUnearthRule ::: (";
|
||||
return MTGAbility::toString(out) << ")";
|
||||
}
|
||||
int MTGUnearthRule::testDestroy(){return 0;}
|
||||
MTGUnearthRule * MTGUnearthRule::clone() const{
|
||||
}
|
||||
int MTGUnearthRule::testDestroy(){return 0;}
|
||||
MTGUnearthRule * MTGUnearthRule::clone() const{
|
||||
MTGUnearthRule * a = NEW MTGUnearthRule(*this);
|
||||
a->isClone = 1;
|
||||
return a;
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------
|
||||
//sneakattack rule------------------------------------------------------
|
||||
//this rule also handles the exile of unearth cards at end of turn.
|
||||
|
||||
MTGSneakAttackRule::MTGSneakAttackRule(int _id):MTGAbility(_id,NULL){};
|
||||
MTGSneakAttackRule::MTGSneakAttackRule(int _id):MTGAbility(_id,NULL){};
|
||||
|
||||
int MTGSneakAttackRule::receiveEvent(WEvent *e){
|
||||
int MTGSneakAttackRule::receiveEvent(WEvent *e){
|
||||
if (WEventPhaseChange* event = dynamic_cast<WEventPhaseChange*>(e)) {
|
||||
if (Constants::MTG_PHASE_ENDOFTURN == event->from->id) {
|
||||
for (int j = 0; j < 2 ; j++){
|
||||
@@ -1253,24 +1253,24 @@ HUDDisplay::~HUDDisplay(){
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
ostream& MTGSneakAttackRule::toString(ostream& out) const
|
||||
{
|
||||
ostream& MTGSneakAttackRule::toString(ostream& out) const
|
||||
{
|
||||
out << "MTGSneakAttackRule ::: (";
|
||||
return MTGAbility::toString(out) << ")";
|
||||
}
|
||||
int MTGSneakAttackRule::testDestroy(){return 0;}
|
||||
MTGSneakAttackRule * MTGSneakAttackRule::clone() const{
|
||||
}
|
||||
int MTGSneakAttackRule::testDestroy(){return 0;}
|
||||
MTGSneakAttackRule * MTGSneakAttackRule::clone() const{
|
||||
MTGSneakAttackRule * a = NEW MTGSneakAttackRule(*this);
|
||||
a->isClone = 1;
|
||||
return a;
|
||||
}
|
||||
//Affinity rule------------------------------------------------------
|
||||
}
|
||||
//Affinity rule------------------------------------------------------
|
||||
//this rule is for Affinity cards.
|
||||
|
||||
MTGAffinityRule::MTGAffinityRule(int _id):MTGAbility(_id,NULL){};
|
||||
int MTGAffinityRule::receiveEvent(WEvent * event){
|
||||
MTGAffinityRule::MTGAffinityRule(int _id):MTGAbility(_id,NULL){};
|
||||
int MTGAffinityRule::receiveEvent(WEvent * event){
|
||||
if (event->type == WEvent::CHANGE_ZONE){
|
||||
WEventZoneChange * e = (WEventZoneChange *) event;
|
||||
MTGCardInstance * card = e->card->previous;
|
||||
@@ -1283,8 +1283,8 @@ HUDDisplay::~HUDDisplay(){
|
||||
if (e->to == p->game->hand) ok = 1;//affinity card enters hand
|
||||
if (e->to == p->game->battlefield) ok = 2;//card enters play
|
||||
if (e->to == p->game->graveyard || e->to == p->game->hand || e->to == p->game->library || e->to == p->game->exile || e->to == p->game->stack || e->to == p->opponent()->game->battlefield) ok = 3;//card leaves play
|
||||
//---------
|
||||
//when cards with affinity enter you hand from anywhere a redux is applied to them for the artifacts in play.
|
||||
//---------
|
||||
//when cards with affinity enter you hand from anywhere a redux is applied to them for the artifacts in play.
|
||||
if(ok == 1){//enters play from anywhere
|
||||
if (e->from == p->game->graveyard || e->from == p->game->hand || e->from == p->game->library || e->from == p->game->exile || e->from == p->game->stack || e->from == p->opponent()->game->battlefield || e->from == p->game->temp){
|
||||
MTGCardInstance * card = e->card->previous;
|
||||
@@ -1312,7 +1312,7 @@ HUDDisplay::~HUDDisplay(){
|
||||
}//--end of redux bracket
|
||||
}
|
||||
}//if ok == 1
|
||||
//-------------maintaining cost----------------------------------------------------------------
|
||||
//-------------maintaining cost----------------------------------------------------------------
|
||||
if(ok == 2){//enters play from anywhere
|
||||
if (e->from == p->game->graveyard || e->from == p->game->hand || e->from == p->game->library || e->from == p->game->exile || e->from == p->game->stack || e->from == p->opponent()->game->battlefield || e->from == p->game->temp){
|
||||
//--redux effect
|
||||
@@ -1340,9 +1340,9 @@ HUDDisplay::~HUDDisplay(){
|
||||
}
|
||||
}
|
||||
}//--end of redux bracket ok == 2
|
||||
//---------
|
||||
if(ok == 3){//leave play from your battlefield
|
||||
if (e->from == p->game->battlefield){
|
||||
//---------
|
||||
if(ok == 3){//leave play from your battlefield
|
||||
if (e->from == p->game->battlefield){
|
||||
int colored = 0;
|
||||
MTGGameZone * z = card->controller()->game->hand;
|
||||
int nbcards = z->nb_cards;
|
||||
@@ -1365,35 +1365,35 @@ if (e->from == p->game->battlefield){
|
||||
}
|
||||
}
|
||||
}
|
||||
//-------------------------------
|
||||
//-------------------------------
|
||||
}
|
||||
}//---ok == 3
|
||||
//----------------------------------------
|
||||
}//---ok == 3
|
||||
//----------------------------------------
|
||||
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
ostream& MTGAffinityRule::toString(ostream& out) const
|
||||
{
|
||||
}
|
||||
ostream& MTGAffinityRule::toString(ostream& out) const
|
||||
{
|
||||
out << "MTGAffinityRule ::: (";
|
||||
return MTGAbility::toString(out) << ")";
|
||||
}
|
||||
int MTGAffinityRule::testDestroy(){return 0;}
|
||||
MTGAffinityRule * MTGAffinityRule::clone() const{
|
||||
}
|
||||
int MTGAffinityRule::testDestroy(){return 0;}
|
||||
MTGAffinityRule * MTGAffinityRule::clone() const{
|
||||
MTGAffinityRule * a = NEW MTGAffinityRule(*this);
|
||||
a->isClone = 1;
|
||||
return a;
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
MTGTokensCleanup::MTGTokensCleanup(int _id):MTGAbility(_id, NULL){}
|
||||
MTGTokensCleanup::MTGTokensCleanup(int _id):MTGAbility(_id, NULL){}
|
||||
|
||||
int MTGTokensCleanup::receiveEvent(WEvent * e){
|
||||
int MTGTokensCleanup::receiveEvent(WEvent * e){
|
||||
if (WEventZoneChange* event = dynamic_cast<WEventZoneChange*>(e)){
|
||||
if (!event->card->isToken) return 0;
|
||||
if (event->to == game->players[0]->game->inPlay || event->to == game->players[1]->game->inPlay) return 0;
|
||||
@@ -1402,36 +1402,36 @@ if (e->from == p->game->battlefield){
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int MTGTokensCleanup::testDestroy(){return 0;}
|
||||
int MTGTokensCleanup::testDestroy(){return 0;}
|
||||
|
||||
void MTGTokensCleanup::Update(float dt){
|
||||
void MTGTokensCleanup::Update(float dt){
|
||||
MTGAbility::Update(dt);
|
||||
for(size_t i= 0; i < list.size(); ++i){
|
||||
MTGCardInstance * c = list[i];
|
||||
c->controller()->game->putInZone(c,c->currentZone, c->controller()->game->garbage);
|
||||
}
|
||||
list.clear();
|
||||
}
|
||||
}
|
||||
|
||||
MTGTokensCleanup * MTGTokensCleanup::clone() const{
|
||||
MTGTokensCleanup * MTGTokensCleanup::clone() const{
|
||||
MTGTokensCleanup * a = NEW MTGTokensCleanup(*this);
|
||||
a->isClone = 1;
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
/* Legend Rule */
|
||||
MTGLegendRule::MTGLegendRule(int _id):ListMaintainerAbility(_id){};
|
||||
/* Legend Rule */
|
||||
MTGLegendRule::MTGLegendRule(int _id):ListMaintainerAbility(_id){};
|
||||
|
||||
int MTGLegendRule::canBeInList(MTGCardInstance * card){
|
||||
int MTGLegendRule::canBeInList(MTGCardInstance * card){
|
||||
if (card->hasType(Subtypes::TYPE_LEGENDARY) && game->isInPlay(card)){
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int MTGLegendRule::added(MTGCardInstance * card){
|
||||
int MTGLegendRule::added(MTGCardInstance * card){
|
||||
map<MTGCardInstance *,bool>::iterator it;
|
||||
int destroy = 0;
|
||||
for ( it=cards.begin() ; it != cards.end(); it++ ){
|
||||
@@ -1445,26 +1445,26 @@ if (e->from == p->game->battlefield){
|
||||
card->owner->game->putInGraveyard(card);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
int MTGLegendRule::removed(MTGCardInstance * card){return 0;}
|
||||
int MTGLegendRule::removed(MTGCardInstance * card){return 0;}
|
||||
|
||||
int MTGLegendRule::testDestroy(){return 0;}
|
||||
int MTGLegendRule::testDestroy(){return 0;}
|
||||
|
||||
ostream& MTGLegendRule::toString(ostream& out) const
|
||||
{
|
||||
ostream& MTGLegendRule::toString(ostream& out) const
|
||||
{
|
||||
return out << "MTGLegendRule :::";
|
||||
}
|
||||
MTGLegendRule * MTGLegendRule::clone() const{
|
||||
}
|
||||
MTGLegendRule * MTGLegendRule::clone() const{
|
||||
MTGLegendRule * a = NEW MTGLegendRule(*this);
|
||||
a->isClone = 1;
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
/* Lifelink */
|
||||
MTGLifelinkRule::MTGLifelinkRule(int _id):MTGAbility(_id,NULL){};
|
||||
/* Lifelink */
|
||||
MTGLifelinkRule::MTGLifelinkRule(int _id):MTGAbility(_id,NULL){};
|
||||
|
||||
int MTGLifelinkRule::receiveEvent(WEvent * event){
|
||||
int MTGLifelinkRule::receiveEvent(WEvent * event){
|
||||
if (event->type == WEvent::DAMAGE){
|
||||
WEventDamage * e = (WEventDamage *) event;
|
||||
Damage * d = e->damage;
|
||||
@@ -1475,26 +1475,26 @@ if (e->from == p->game->battlefield){
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int MTGLifelinkRule::testDestroy(){return 0;}
|
||||
int MTGLifelinkRule::testDestroy(){return 0;}
|
||||
|
||||
ostream& MTGLifelinkRule::toString(ostream& out) const
|
||||
{
|
||||
ostream& MTGLifelinkRule::toString(ostream& out) const
|
||||
{
|
||||
out << "MTGLifelinkRule ::: (";
|
||||
return MTGAbility::toString(out) << ")";
|
||||
}
|
||||
MTGLifelinkRule * MTGLifelinkRule::clone() const{
|
||||
}
|
||||
MTGLifelinkRule * MTGLifelinkRule::clone() const{
|
||||
MTGLifelinkRule * a = NEW MTGLifelinkRule(*this);
|
||||
a->isClone = 1;
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Deathtouch */
|
||||
MTGDeathtouchRule::MTGDeathtouchRule(int _id):MTGAbility(_id,NULL){};
|
||||
/* Deathtouch */
|
||||
MTGDeathtouchRule::MTGDeathtouchRule(int _id):MTGAbility(_id,NULL){};
|
||||
|
||||
int MTGDeathtouchRule::receiveEvent(WEvent * event){
|
||||
int MTGDeathtouchRule::receiveEvent(WEvent * event){
|
||||
if (event->type == WEvent::DAMAGE){
|
||||
WEventDamage * e = (WEventDamage *) event;
|
||||
|
||||
@@ -1513,13 +1513,13 @@ if (e->from == p->game->battlefield){
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int MTGDeathtouchRule::testDestroy(){return 0;}
|
||||
int MTGDeathtouchRule::testDestroy(){return 0;}
|
||||
|
||||
|
||||
MTGDeathtouchRule * MTGDeathtouchRule::clone() const{
|
||||
MTGDeathtouchRule * MTGDeathtouchRule::clone() const{
|
||||
MTGDeathtouchRule * a = NEW MTGDeathtouchRule(*this);
|
||||
a->isClone = 1;
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user