- refactor of MTGRules.cpp (buyback/flashback/retrace/alternative).
This change has been reviewed by myself, Wil, and Mike. The test suite passes.
More cleanup can be done, I will work on that later on.
This commit is contained in:
wagic.the.homebrew@gmail.com
2011-01-21 10:27:45 +00:00
parent b6713c02ec
commit 6d3d4c1792
6 changed files with 204 additions and 597 deletions
+1 -2
View File
@@ -45,8 +45,7 @@ class MTGCardInstance: public CardPrimitive, public MTGCard, public Damageable {
Pos* view;
int X;
int XX;
int boughtback;
int flashedback;
int alternateCostPaid[ManaCost::MANA_PAID_WITH_RETRACE + 1];
int paymenttype;
int frozen;
int sunburst;
+8 -3
View File
@@ -8,6 +8,7 @@
#include "Counters.h"
#include "WEvent.h"
#include "CardSelector.h"
#include "ManaCost.h"
class OtherAbilitiesEventReceiver: public MTGAbility
{
@@ -37,7 +38,11 @@ class MTGAlternativeCostRule: public MTGAbility
{
public:
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
int isReactingToClick(MTGCardInstance * card, ManaCost * mana, ManaCost *alternateManaCost);
int reactToClick(MTGCardInstance * card, ManaCost * alternateManaCost, int paymentType = ManaCost::MANA_PAID);
int reactToClick(MTGCardInstance * card);
int testDestroy();
virtual ostream& toString(ostream& out) const;
MTGAlternativeCostRule(int _id);
@@ -48,7 +53,7 @@ public:
virtual MTGAlternativeCostRule * clone() const;
};
class MTGBuyBackRule: public MTGAbility
class MTGBuyBackRule: public MTGAlternativeCostRule
{
public:
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
@@ -63,7 +68,7 @@ public:
virtual MTGBuyBackRule * clone() const;
};
class MTGFlashBackRule: public MTGAbility
class MTGFlashBackRule: public MTGAlternativeCostRule
{
public:
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
@@ -78,7 +83,7 @@ public:
virtual MTGFlashBackRule * clone() const;
};
class MTGRetraceRule: public MTGAbility
class MTGRetraceRule: public MTGAlternativeCostRule
{
public:
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
+1
View File
@@ -21,6 +21,7 @@ class ManaCost{
public:
enum{
MANA_UNPAID = 0,
MANA_PAID = 1,
MANA_PAID_WITH_KICKER = 2,
MANA_PAID_WITH_ALTERNATIVE = 3,