-fixesRockslide Elemental, Welkin Hawk
-Added messages for Manapool updates
-Cleaned up ManaProducer code
This commit is contained in:
wagic.the.homebrew@gmail.com
2009-08-26 14:30:24 +00:00
parent 5e18cdb25d
commit 0dfa3f2e16
17 changed files with 165 additions and 144 deletions

View File

@@ -150,10 +150,14 @@ public:
}
int testDestroy(){
if (triggered && !game->mLayers->actionLayer()->menuObject && game->mLayers->actionLayer()->getIndexOf(mClone) ==-1){
if (triggered){
if (game->mLayers->actionLayer()->menuObject) return 0;
if (game->mLayers->actionLayer()->getIndexOf(mClone) !=-1) return 0;
if (game->mLayers->actionLayer()->getIndexOf(this) !=-1) return 0;
OutputDebugString("Destroy!\n");
return 1;
}
return 0;
}
@@ -172,11 +176,12 @@ public:
}
~MayAbility(){
if (!isClone) SAFE_DELETE(ability);
SAFE_DELETE(ability);
}
MayAbility * clone() const{
MayAbility * a = NEW MayAbility(*this);
a->ability = ability->clone();
a->isClone = 1;
return a;
}
@@ -292,8 +297,13 @@ public:
counters = 0;
}
~GenericTargetAbility(){
if (isClone) SAFE_DELETE(ability);
}
GenericTargetAbility * clone() const{
GenericTargetAbility * a = NEW GenericTargetAbility(*this);
a->ability = ability->clone();
a->isClone = 1;
return a;
}

View File

@@ -221,28 +221,18 @@ class AManaProducer: public MTGAbility{
string menutext;
float x0,y0,x1,y1,x,y;
float animation;
Player * controller;
hgeParticleSystem * mParticleSys;
public:
ManaCost * output;
int tap;
static int currentlyTapping;
AManaProducer(int id, MTGCardInstance * card, ManaCost * _output, ManaCost * _cost = NULL, int doTap = 1 );
void Update(float dt);
void Render();
int isReactingToClick(MTGCardInstance * _card, ManaCost * mana = NULL);
int resolve();
int destroy();
int reactToClick(MTGCardInstance * _card);
const char * getMenuText();
int testDestroy();
~AManaProducer();
virtual AManaProducer * clone() const;
virtual ostream& toString(ostream& out) const;
};
#include "MTGCardInstance.h"

View File

@@ -10,6 +10,7 @@ class ExtraCosts;
class ExtraCost;
class MTGAbility;
class MTGCardInstance;
class Player;
class ManaCost{
protected:
@@ -21,7 +22,7 @@ class ManaCost{
public:
ExtraCosts * extraCosts;
static ManaCost * parseManaCost(string value, ManaCost * _manacost = NULL, MTGCardInstance * c = NULL);
void init();
virtual void init();
void x();
ManaCost(int _cost[], int nb_elems = 1);
ManaCost();
@@ -66,4 +67,17 @@ class ManaCost{
std::ostream& operator<<(std::ostream& out, const ManaCost& m);
class ManaPool:public ManaCost{
protected:
Player * player;
public:
void init();
ManaPool(Player * player);
ManaPool(ManaCost * _manaCost, Player * player);
int remove (int color, int value);
int add(int color, int value, MTGCardInstance * source = NULL);
int add(ManaCost * _cost, MTGCardInstance * source = NULL);
int pay (ManaCost * _cost);
};
#endif

View File

@@ -2,17 +2,17 @@
#define _PLAYER_H_
#include "JGE.h"
#include "ManaCost.h"
#include "MTGGameZones.h"
#include "Damage.h"
#include "Targetable.h"
class MTGPlayerCards;
class MTGInPlay;
class ManaPool;
class Player: public Damageable{
protected:
ManaCost * manaPool;
ManaPool * manaPool;
public:
virtual void End();
@@ -28,7 +28,7 @@ class Player: public Damageable{
virtual ~Player();
void unTapPhase();
MTGInPlay * inPlay();
ManaCost * getManaPool();
ManaPool * getManaPool();
void cleanupPhase();
virtual int Act(float dt){return 0;};
virtual int isAI(){return 0;};

View File

@@ -6,6 +6,7 @@ class MTGGameZone;
class Damage;
class Phase;
class Targetable;
class ManaPool;
class WEvent{
public:
@@ -87,14 +88,23 @@ struct WEventCreatureBlockerRank: public WEventCardUpdate{
struct WEventEngageMana : public WEvent {
int color;
MTGCardInstance* card;
WEventEngageMana(int color, MTGCardInstance* card);
ManaPool * destination;
WEventEngageMana(int color, MTGCardInstance* card, ManaPool * destination);
};
//Event when a mana is consumed
//color : color
struct WEventConsumeMana : public WEvent {
int color;
WEventConsumeMana(int color);
ManaPool * source;
WEventConsumeMana(int color, ManaPool * source);
};
//Event when a manapool is emptied
//color : color
struct WEventEmptyManaPool : public WEvent {
ManaPool * source;
WEventEmptyManaPool(ManaPool * source);
};
#endif