Merged Master branch into wp8

This commit is contained in:
xawotihs
2013-11-22 17:21:25 +01:00
48 changed files with 240 additions and 332 deletions
+9 -16
View File
@@ -9,10 +9,6 @@
#include <JGui.h>
#include "MTGDefinitions.h"
#define INACTIVE 0
#define ACTION_REQUESTED 1
#define ACTIVE 2
class MTGCardInstance;
class ManaCost;
class Targetable;
@@ -22,31 +18,33 @@ class WEvent;
class ActionElement: public JGuiObject
{
protected:
int activeState;
enum Activity{
Inactive,
ActionRequested,
Active
};
Activity activity;
TargetChooser * tc;
public:
GamePhase currentPhase;
GamePhase newPhase;
int modal;
int waitingForAnswer;
int getActivity();
virtual void Update(float){};
virtual void Render(){};
virtual void Update(float){}
virtual void Render(){}
virtual int testDestroy()
{
return 0;
}
;
virtual int destroy()
{
return 0;
}
;
virtual bool CheckUserInput(JButton)
{
return false;
}
;
ActionElement(int id);
ActionElement(const ActionElement& copyFromMe);
TargetChooser * getActionTc(){return tc;}
@@ -62,27 +60,22 @@ public:
{
return 0;
}
;
virtual int stillInUse(MTGCardInstance *)
{
return 0;
}
;
virtual int receiveEvent(WEvent *)
{
return 0;
}
;
virtual int reactToClick(MTGCardInstance *)
{
return 0;
}
;
virtual const char * getMenuText()
{
return "Ability";
}
;
virtual ActionElement * clone() const = 0;
};
+6 -8
View File
@@ -41,16 +41,9 @@ class DamageStack;
class ManaCost;
class TargetChooser;
#define ACTIONSTACK_STANDARD 0
#define ACTIONSTACK_TARGET 1
class Interruptible: public PlayGuiObject, public Targetable
{
public:
//TODO : remove these when they are back in PlayGuiObject
float x, y;
int state, display;
MTGCardInstance * source;
virtual void Entering()
@@ -186,6 +179,11 @@ public:
class ActionStack :public GuiLayer
{
public:
enum ActionStackMode{
ACTIONSTACK_STANDARD = 0,
ACTIONSTACK_TARGET = 1
};
typedef enum
{
NOT_DECIDED = 0,
@@ -207,7 +205,7 @@ protected:
InterruptDecision interruptDecision[2];
float timer;
int currentState;
int mode;
ActionStackMode mode;
int checked;
ATutorialMessage* currentTutorial;
int interruptBtnXOffset, noBtnXOffset, noToAllBtnXOffset, interruptDialogWidth;
+5 -5
View File
@@ -873,8 +873,8 @@ public:
return 0;
if (!tc->canTarget(e->damage->target)) return 0;
if (fromTc && !fromTc->canTarget(e->damage->source)) return 0;
if (type == 1 && e->damage->typeOfDamage != DAMAGE_COMBAT) return 0;
if (type == 2 && e->damage->typeOfDamage == DAMAGE_COMBAT) return 0;
if (type == 1 && e->damage->typeOfDamage != Damage::DAMAGE_COMBAT) return 0;
if (type == 2 && e->damage->typeOfDamage == Damage::DAMAGE_COMBAT) return 0;
e->damage->target->thatmuch = e->damage->damage;
e->damage->source->thatmuch = e->damage->damage;
this->source->thatmuch = e->damage->damage;
@@ -2577,7 +2577,7 @@ public:
}
else
{
if (d->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE)
if (d->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE)
{
a->source = (MTGCardInstance *) d;
}
@@ -2725,7 +2725,7 @@ public:
}
else
{
if (d->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE)
if (d->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE)
{
a->source = (MTGCardInstance *) d;
}
@@ -5549,7 +5549,7 @@ public:
{
WEventDamage * e = (WEventDamage *) event;
Damage * d = e->damage;
if (combatonly && e->damage->typeOfDamage != DAMAGE_COMBAT)
if (combatonly && e->damage->typeOfDamage != Damage::DAMAGE_COMBAT)
return 0;
MTGCardInstance * card = d->source;
if (d->damage > 0 && card && (card == source || card == source->target))
+6 -4
View File
@@ -9,9 +9,6 @@
#include "MTGGameZones.h"
#include "Counters.h"
#define CD_OR 1
#define CD_AND 2
enum ENUM_COMPARISON_MODES
{
COMPARISON_NONE = 0, // Needs to remain 0 for quick if(comparison_mode) checks
@@ -31,7 +28,12 @@ class CardDescriptor: public MTGCardInstance
MTGCardInstance * match_not(MTGCardInstance * card);
bool valueInRange(int comparisonMode, int value, int criterion);
public:
int mode;
enum Operator{
CD_OR = 1,
CD_AND = 2
};
Operator mode;
int powerComparisonMode;
int toughnessComparisonMode;
int manacostComparisonMode;
-21
View File
@@ -1,21 +0,0 @@
#ifndef _CARDEFFECT_H_
#define _CARDEFFECT_H_
#include <JGE.h>
#include "Effects.h"
struct CardGui;
class CardEffect: public Effect
{
public:
CardEffect(CardGui* target);
~CardEffect();
private:
CardGui* target;
public:
virtual void Render();
};
#endif // _CARDEFFECT_H_
+22 -16
View File
@@ -11,17 +11,15 @@ 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:
enum DamageableType{
DAMAGEABLE_MTGCARDINSTANCE = 0,
DAMAGEABLE_PLAYER
};
int life;
int handsize;
int poisonCount;
@@ -29,12 +27,14 @@ public:
int preventable;
int thatmuch;
int lifeLostThisTurn;
int type_as_damageable;
DamageableType type_as_damageable;
Damageable(GameObserver* observer, int _life)
: Targetable(observer)
{life=_life;lifeLostThisTurn = 0;};
int getLife(){return life;};
virtual int dealDamage(int damage){life-=damage;return life;};
: Targetable(observer), life(_life), handsize(0),
poisonCount(0), damageCount(0), preventable(0), thatmuch(0),
lifeLostThisTurn(0), type_as_damageable(DAMAGEABLE_MTGCARDINSTANCE)
{}
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;}
@@ -47,17 +47,23 @@ public:
class Damage: public Interruptible
{
protected:
void init(MTGCardInstance * source, Damageable * target, int damage, int typeOfDamage);
public:
enum DamageType{
DAMAGE_ALL_TYPES = 0,
DAMAGE_COMBAT,
DAMAGE_OTHER
};
Damageable * target;
int typeOfDamage;
DamageType typeOfDamage;
int damage;
void Render();
Damage(GameObserver* observer, MTGCardInstance* source, Damageable * target);
Damage(GameObserver* observer, MTGCardInstance* source, Damageable * target, int damage, int typeOfDamage = DAMAGE_OTHER);
Damage(GameObserver* observer, MTGCardInstance* source, Damageable * target, int damage, DamageType typeOfDamage = DAMAGE_OTHER);
int resolve();
virtual ostream& toString(ostream& out) const;
protected:
void init(MTGCardInstance * source, Damageable * target, int damage, DamageType typeOfDamage);
};
class DamageStack : public GuiLayer, public Interruptible
-2
View File
@@ -20,7 +20,6 @@
#include "MTGCard.h"
#include "MTGGameZones.h"
#include "CardEffect.h"
#ifdef NETWORK_SUPPORT
#include "JNetwork.h"
#endif //NETWORK_SUPPORT
@@ -49,7 +48,6 @@ public:
GameType gameType;
Rules * rules;
CardEffect *effect;
#ifdef NETWORK_SUPPORT
string mServerAddress;
JNetwork* mpNetwork;
-11
View File
@@ -1,11 +0,0 @@
#ifndef _OSD_H_
#define _OSD_H_
class OSDLayer: public PlayGuiObjectController
{
virtual void Update(float dt);
virtual bool CheckUserInput(JButton key);
virtual void Render();
};
#endif
+3 -2
View File
@@ -29,9 +29,10 @@ protected:
TargetChooser * tcTarget;
int damage;
bool oneShot;
int typeOfDamage;
Damage::DamageType typeOfDamage;
public:
REDamagePrevention(MTGAbility * _source, TargetChooser *_tcSource = NULL, TargetChooser *_tcTarget = NULL, int _damage = -1, bool _oneShot = true, int typeOfDamage = DAMAGE_ALL_TYPES);
REDamagePrevention(MTGAbility * _source, TargetChooser *_tcSource = NULL, TargetChooser *_tcTarget = NULL,
int _damage = -1, bool _oneShot = true, Damage::DamageType typeOfDamage = Damage::DAMAGE_ALL_TYPES);
WEvent * replace(WEvent *e);
~REDamagePrevention();
};