This btw points out another circular dependancy between the texture and the JQuad - a texture owns a bunch of JQuads, yet the renderer uses JQuads and always assumes that the texture is valid. We're going to need to add more defensiveness to JGE to protect against this. Other changes in this check-in: WResourceManager doesn't derive from JResourceManager anymore. It actually didn't require anything from the base, so I killed the dependency. Also cleaned up the notion of a WTrackedQuad in the WCachedResource - it didn't need a separate class, just a better container. I've build this & tested against PSP, win, linux, QT (linux). I haven't tried against iOS and QT Win, or Maemo. If these other platforms are broken, I apologize in advance! - I'm hoping it should be fairly simple to put them back into play.
71 lines
1.6 KiB
C++
71 lines
1.6 KiB
C++
#ifndef _DAMAGE_H_
|
|
#define _DAMAGE_H_
|
|
|
|
#include <JGui.h>
|
|
#include "GuiLayers.h"
|
|
#include "ActionStack.h"
|
|
#include "WResource_Fwd.h"
|
|
|
|
class GuiLayer;
|
|
class JGuiObject;
|
|
class MTGCardInstance;
|
|
class GameObserver;
|
|
|
|
#define DAMAGEABLE_MTGCARDINSTANCE 0
|
|
#define DAMAGEABLE_PLAYER 1
|
|
|
|
#define DAMAGE_ALL_TYPES 0
|
|
#define DAMAGE_COMBAT 1
|
|
#define DAMAGE_OTHER 2
|
|
|
|
class Damageable:public Targetable
|
|
{
|
|
protected:
|
|
public:
|
|
int life;
|
|
int poisonCount;
|
|
int damageCount;
|
|
int preventable;
|
|
int thatmuch;
|
|
int lifeLostThisTurn;
|
|
int type_as_damageable;
|
|
Damageable(int _life){life=_life;lifeLostThisTurn = 0;};
|
|
int getLife(){return life;};
|
|
virtual int dealDamage(int damage){life-=damage;return life;};
|
|
virtual int afterDamage(){return 0;}
|
|
virtual int poisoned(){return 0;}
|
|
virtual int prevented(){return 0;}
|
|
virtual JQuadPtr getIcon(){return JQuadPtr();}
|
|
};
|
|
|
|
class Damage: public Interruptible
|
|
{
|
|
protected:
|
|
void init(MTGCardInstance * source, Damageable * target, int damage, int typeOfDamage);
|
|
public:
|
|
Damageable * target;
|
|
int typeOfDamage;
|
|
int damage;
|
|
void Render();
|
|
Damage(MTGCardInstance* source, Damageable * target);
|
|
Damage(MTGCardInstance* source, Damageable * target, int damage, int typeOfDamage = DAMAGE_OTHER);
|
|
int resolve();
|
|
virtual ostream& toString(ostream& out) const;
|
|
};
|
|
|
|
class DamageStack : public GuiLayer, public Interruptible
|
|
{
|
|
protected:
|
|
int currentState;
|
|
GameObserver* game;
|
|
|
|
public:
|
|
int receiveEvent(WEvent * event);
|
|
int resolve();
|
|
void Render();
|
|
virtual ostream& toString(ostream& out) const;
|
|
DamageStack();
|
|
};
|
|
|
|
#endif
|