Refactored FizzleToZone

Get rid of common code
Better naming of zone (where we put spell after countering)
More generic syntax: fizzleto(X) where X in [hand, exile, librarytop]
which will give more flexibility later
This commit is contained in:
pankdm
2013-10-08 23:18:42 +00:00
parent 4341e23210
commit 0c6d77daa0
6 changed files with 63 additions and 115 deletions

View File

@@ -194,6 +194,14 @@ public:
DONT_INTERRUPT_ALL = 2
} InterruptDecision;
typedef enum
{
PUT_IN_GRAVEARD,
PUT_IN_HAND,
PUT_IN_LIBRARY_TOP,
PUT_IN_EXILE
} FizzleMode;
protected:
JQuadPtr pspIcons[8];
InterruptDecision interruptDecision[2];
@@ -216,8 +224,7 @@ public:
int getPreviousIndex(Interruptible * next, int type = 0, int state = 0 , int display = -1);
Interruptible * getNext(Interruptible * previous, int type = 0, int state = 0 , int display = -1);
int getNextIndex(Interruptible * previous, int type = 0, int state = 0 , int display = -1);
void Fizzle(Interruptible * action);
void Fizzle(Interruptible * action, int targetZone); //Overloaded fizzle (0 - 3: graveyard, hand, exile, librarytop)
void Fizzle(Interruptible * action, FizzleMode fizzleMode = PUT_IN_GRAVEARD);
Interruptible * getAt(int id);
void cancelInterruptOffer(InterruptDecision cancelMode = DONT_INTERRUPT, bool log = true);
void endOfInterruption(bool log = true);

View File

@@ -1112,23 +1112,15 @@ public:
class AAFizzler: public ActivatedAbility
{
public:
ActionStack::FizzleMode fizzleMode; // action to do after fizzling
AAFizzler(GameObserver* observer, int _id, MTGCardInstance * card, Spell * _target, ManaCost * _cost = NULL);
int resolve();
const char * getMenuText();
AAFizzler* clone() const;
};
class AAOFizzler: public AAFizzler
{
public:
AAOFizzler( GameObserver* observer, int _id, MTGCardInstance * card, Spell * _target, int tgtZone, ManaCost * _cost );
int targetZone;
int resolve();
AAOFizzler* clone() const;
};
/*
Generic classes
*/