Merged Master branch into wp8
This commit is contained in:
@@ -4,6 +4,8 @@
|
|||||||
// dirty, but I get OS header includes this way
|
// dirty, but I get OS header includes this way
|
||||||
#include "JGE.h"
|
#include "JGE.h"
|
||||||
|
|
||||||
|
#include "OutputCapturer.h"
|
||||||
|
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
@@ -29,12 +31,23 @@ std::string ToHex(T* pointer)
|
|||||||
#if defined (WIN32) || defined (LINUX)
|
#if defined (WIN32) || defined (LINUX)
|
||||||
|
|
||||||
#ifdef QT_CONFIG
|
#ifdef QT_CONFIG
|
||||||
|
|
||||||
|
#ifdef CAPTURE_STDERR
|
||||||
#define DebugTrace(inString) \
|
#define DebugTrace(inString) \
|
||||||
{ \
|
{ \
|
||||||
std::ostringstream stream; \
|
std::ostringstream stream; \
|
||||||
stream << inString << std::endl; \
|
stream << inString; \
|
||||||
qDebug("%s", stream.str().c_str()); \
|
OutputCapturer::add(stream.str()); \
|
||||||
}
|
}
|
||||||
|
#else // CAPTURE_STDERR
|
||||||
|
#define DebugTrace(inString) \
|
||||||
|
{ \
|
||||||
|
std::ostringstream stream; \
|
||||||
|
stream << inString; \
|
||||||
|
qDebug("%s", stream.str().c_str()); \
|
||||||
|
}
|
||||||
|
#endif // CAPTURE_STDERR
|
||||||
|
|
||||||
#elif defined (ANDROID)
|
#elif defined (ANDROID)
|
||||||
#include <android/log.h>
|
#include <android/log.h>
|
||||||
#define DebugTrace(inString) \
|
#define DebugTrace(inString) \
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
#ifndef OUTPUTCAPTURER_H
|
||||||
|
#define OUTPUTCAPTURER_H
|
||||||
|
|
||||||
|
#if defined(QT_CONFIG)
|
||||||
|
#include <Qt>
|
||||||
|
#include <string>
|
||||||
|
#include <sstream>
|
||||||
|
#include "Threading.h"
|
||||||
|
|
||||||
|
class OutputCapturer
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
static std::ostringstream stream;
|
||||||
|
static boost::mutex mMutex;
|
||||||
|
|
||||||
|
public:
|
||||||
|
static void add(const std::string& s);
|
||||||
|
static void debugAndClear();
|
||||||
|
static void clear();
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // OUTPUTCAPTURER_H
|
||||||
@@ -315,7 +315,6 @@ namespace boost
|
|||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
|
|
||||||
#include "../include/DebugRoutines.h"
|
|
||||||
#include "../include/JLogger.h"
|
#include "../include/JLogger.h"
|
||||||
|
|
||||||
namespace boost
|
namespace boost
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
#include "../include/OutputCapturer.h"
|
||||||
|
|
||||||
|
std::ostringstream OutputCapturer::stream;
|
||||||
|
boost::mutex OutputCapturer::mMutex;
|
||||||
|
|
||||||
|
void OutputCapturer::add(const std::string& s)
|
||||||
|
{
|
||||||
|
boost::mutex::scoped_lock lock(mMutex);
|
||||||
|
stream << s << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
void OutputCapturer::debugAndClear()
|
||||||
|
{
|
||||||
|
stream.flush();
|
||||||
|
qDebug("%s", stream.str().c_str());
|
||||||
|
stream.str("");
|
||||||
|
}
|
||||||
|
|
||||||
|
void OutputCapturer::clear()
|
||||||
|
{
|
||||||
|
stream.str("");
|
||||||
|
}
|
||||||
@@ -96,7 +96,11 @@ int main(int argc, char* argv[])
|
|||||||
options.reloadProfile();
|
options.reloadProfile();
|
||||||
TestSuite testSuite("test/_tests.txt");
|
TestSuite testSuite("test/_tests.txt");
|
||||||
result = testSuite.run();
|
result = testSuite.run();
|
||||||
|
int totalTests = testSuite.nbTests + testSuite.nbAITests;
|
||||||
delete wagicCore;
|
delete wagicCore;
|
||||||
DebugTrace("TestSuite done: failed test: " << result);
|
DebugTrace("TestSuite done: failed test: " << result << " out of " << totalTests << " total");
|
||||||
|
#ifdef CAPTURE_STDERR
|
||||||
|
OutputCapturer::debugAndClear();
|
||||||
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
OBJS = objs/InteractiveButton.o objs/AbilityParser.o objs/ActionElement.o\
|
OBJS = objs/InteractiveButton.o objs/AbilityParser.o objs/ActionElement.o\
|
||||||
objs/ActionLayer.o objs/ActionStack.o objs/AIHints.o objs/AIMomirPlayer.o\
|
objs/ActionLayer.o objs/ActionStack.o objs/AIHints.o objs/AIMomirPlayer.o\
|
||||||
objs/AIPlayer.o objs/AIPlayerBaka.o objs/AIStats.o objs/AllAbilities.o\
|
objs/AIPlayer.o objs/AIPlayerBaka.o objs/AIStats.o objs/AllAbilities.o\
|
||||||
objs/CardGui.o objs/CardDescriptor.o objs/CardDisplay.o objs/CardEffect.o\
|
objs/CardGui.o objs/CardDescriptor.o objs/CardDisplay.o\
|
||||||
objs/CardPrimitive.o objs/CardSelector.o objs/CardSelectorSingleton.o\
|
objs/CardPrimitive.o objs/CardSelector.o objs/CardSelectorSingleton.o\
|
||||||
objs/Counters.o objs/Credits.o objs/Damage.o objs/DamagerDamaged.o\
|
objs/Counters.o objs/Credits.o objs/Damage.o objs/DamagerDamaged.o\
|
||||||
objs/DeckDataWrapper.o objs/DeckEditorMenu.o objs/DeckMenu.o\
|
objs/DeckDataWrapper.o objs/DeckEditorMenu.o objs/DeckMenu.o\
|
||||||
|
|||||||
@@ -23286,7 +23286,7 @@ type=Sorcery
|
|||||||
[/card]
|
[/card]
|
||||||
[card]
|
[card]
|
||||||
name=Dragon Hatchling
|
name=Dragon Hatchling
|
||||||
auto={1}{R}:1/0
|
auto={R}:1/0
|
||||||
abilities=flying
|
abilities=flying
|
||||||
text=Flying -- {R}: Dragon Hatchling gets +1/+0 until end of turn.
|
text=Flying -- {R}: Dragon Hatchling gets +1/+0 until end of turn.
|
||||||
mana={1}{R}
|
mana={1}{R}
|
||||||
|
|||||||
@@ -226,6 +226,7 @@ colossus_of_sardia1.txt
|
|||||||
colossus_of_sardia2.txt
|
colossus_of_sardia2.txt
|
||||||
composite_golem.txt
|
composite_golem.txt
|
||||||
conservator.txt
|
conservator.txt
|
||||||
|
consign_to_dream.txt
|
||||||
Contagion_Clasp.txt
|
Contagion_Clasp.txt
|
||||||
control_magic.txt
|
control_magic.txt
|
||||||
control_magic2.txt
|
control_magic2.txt
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
# Test TargetChooser based on negation of two colors
|
||||||
|
# Grizzly bear should be put on top of library
|
||||||
|
|
||||||
|
# name=Consign to Dream
|
||||||
|
# Return target permanent to its owner's hand.
|
||||||
|
# If that permanent is red or green, put it on top of its owner's library
|
||||||
|
|
||||||
|
[INIT]
|
||||||
|
FIRSTMAIN
|
||||||
|
[PLAYER1]
|
||||||
|
hand:Consign to Dream
|
||||||
|
manapool:{2}{U}
|
||||||
|
inplay:grizzly bears
|
||||||
|
[PLAYER2]
|
||||||
|
[DO]
|
||||||
|
Consign to Dream
|
||||||
|
grizzly bears
|
||||||
|
endinterruption
|
||||||
|
[ASSERT]
|
||||||
|
FIRSTMAIN
|
||||||
|
[PLAYER1]
|
||||||
|
graveyard:Consign to Dream
|
||||||
|
library:grizzly bears
|
||||||
|
[PLAYER2]
|
||||||
|
[END]
|
||||||
@@ -9,10 +9,6 @@
|
|||||||
#include <JGui.h>
|
#include <JGui.h>
|
||||||
#include "MTGDefinitions.h"
|
#include "MTGDefinitions.h"
|
||||||
|
|
||||||
#define INACTIVE 0
|
|
||||||
#define ACTION_REQUESTED 1
|
|
||||||
#define ACTIVE 2
|
|
||||||
|
|
||||||
class MTGCardInstance;
|
class MTGCardInstance;
|
||||||
class ManaCost;
|
class ManaCost;
|
||||||
class Targetable;
|
class Targetable;
|
||||||
@@ -22,31 +18,33 @@ class WEvent;
|
|||||||
class ActionElement: public JGuiObject
|
class ActionElement: public JGuiObject
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
int activeState;
|
enum Activity{
|
||||||
|
Inactive,
|
||||||
|
ActionRequested,
|
||||||
|
Active
|
||||||
|
};
|
||||||
|
|
||||||
|
Activity activity;
|
||||||
TargetChooser * tc;
|
TargetChooser * tc;
|
||||||
public:
|
public:
|
||||||
GamePhase currentPhase;
|
GamePhase currentPhase;
|
||||||
GamePhase newPhase;
|
GamePhase newPhase;
|
||||||
int modal;
|
int modal;
|
||||||
int waitingForAnswer;
|
int waitingForAnswer;
|
||||||
int getActivity();
|
virtual void Update(float){}
|
||||||
virtual void Update(float){};
|
virtual void Render(){}
|
||||||
virtual void Render(){};
|
|
||||||
virtual int testDestroy()
|
virtual int testDestroy()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
;
|
|
||||||
virtual int destroy()
|
virtual int destroy()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
;
|
|
||||||
virtual bool CheckUserInput(JButton)
|
virtual bool CheckUserInput(JButton)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
;
|
|
||||||
ActionElement(int id);
|
ActionElement(int id);
|
||||||
ActionElement(const ActionElement& copyFromMe);
|
ActionElement(const ActionElement& copyFromMe);
|
||||||
TargetChooser * getActionTc(){return tc;}
|
TargetChooser * getActionTc(){return tc;}
|
||||||
@@ -62,27 +60,22 @@ public:
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
;
|
|
||||||
virtual int stillInUse(MTGCardInstance *)
|
virtual int stillInUse(MTGCardInstance *)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
;
|
|
||||||
virtual int receiveEvent(WEvent *)
|
virtual int receiveEvent(WEvent *)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
;
|
|
||||||
virtual int reactToClick(MTGCardInstance *)
|
virtual int reactToClick(MTGCardInstance *)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
;
|
|
||||||
virtual const char * getMenuText()
|
virtual const char * getMenuText()
|
||||||
{
|
{
|
||||||
return "Ability";
|
return "Ability";
|
||||||
}
|
}
|
||||||
;
|
|
||||||
virtual ActionElement * clone() const = 0;
|
virtual ActionElement * clone() const = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -41,16 +41,9 @@ class DamageStack;
|
|||||||
class ManaCost;
|
class ManaCost;
|
||||||
class TargetChooser;
|
class TargetChooser;
|
||||||
|
|
||||||
|
|
||||||
#define ACTIONSTACK_STANDARD 0
|
|
||||||
#define ACTIONSTACK_TARGET 1
|
|
||||||
|
|
||||||
class Interruptible: public PlayGuiObject, public Targetable
|
class Interruptible: public PlayGuiObject, public Targetable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//TODO : remove these when they are back in PlayGuiObject
|
|
||||||
float x, y;
|
|
||||||
|
|
||||||
int state, display;
|
int state, display;
|
||||||
MTGCardInstance * source;
|
MTGCardInstance * source;
|
||||||
virtual void Entering()
|
virtual void Entering()
|
||||||
@@ -186,6 +179,11 @@ public:
|
|||||||
class ActionStack :public GuiLayer
|
class ActionStack :public GuiLayer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
enum ActionStackMode{
|
||||||
|
ACTIONSTACK_STANDARD = 0,
|
||||||
|
ACTIONSTACK_TARGET = 1
|
||||||
|
};
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
NOT_DECIDED = 0,
|
NOT_DECIDED = 0,
|
||||||
@@ -207,7 +205,7 @@ protected:
|
|||||||
InterruptDecision interruptDecision[2];
|
InterruptDecision interruptDecision[2];
|
||||||
float timer;
|
float timer;
|
||||||
int currentState;
|
int currentState;
|
||||||
int mode;
|
ActionStackMode mode;
|
||||||
int checked;
|
int checked;
|
||||||
ATutorialMessage* currentTutorial;
|
ATutorialMessage* currentTutorial;
|
||||||
int interruptBtnXOffset, noBtnXOffset, noToAllBtnXOffset, interruptDialogWidth;
|
int interruptBtnXOffset, noBtnXOffset, noToAllBtnXOffset, interruptDialogWidth;
|
||||||
|
|||||||
@@ -873,8 +873,8 @@ public:
|
|||||||
return 0;
|
return 0;
|
||||||
if (!tc->canTarget(e->damage->target)) return 0;
|
if (!tc->canTarget(e->damage->target)) return 0;
|
||||||
if (fromTc && !fromTc->canTarget(e->damage->source)) return 0;
|
if (fromTc && !fromTc->canTarget(e->damage->source)) return 0;
|
||||||
if (type == 1 && 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_COMBAT) return 0;
|
if (type == 2 && e->damage->typeOfDamage == Damage::DAMAGE_COMBAT) return 0;
|
||||||
e->damage->target->thatmuch = e->damage->damage;
|
e->damage->target->thatmuch = e->damage->damage;
|
||||||
e->damage->source->thatmuch = e->damage->damage;
|
e->damage->source->thatmuch = e->damage->damage;
|
||||||
this->source->thatmuch = e->damage->damage;
|
this->source->thatmuch = e->damage->damage;
|
||||||
@@ -2577,7 +2577,7 @@ public:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (d->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE)
|
if (d->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE)
|
||||||
{
|
{
|
||||||
a->source = (MTGCardInstance *) d;
|
a->source = (MTGCardInstance *) d;
|
||||||
}
|
}
|
||||||
@@ -2725,7 +2725,7 @@ public:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (d->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE)
|
if (d->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE)
|
||||||
{
|
{
|
||||||
a->source = (MTGCardInstance *) d;
|
a->source = (MTGCardInstance *) d;
|
||||||
}
|
}
|
||||||
@@ -5549,7 +5549,7 @@ public:
|
|||||||
{
|
{
|
||||||
WEventDamage * e = (WEventDamage *) event;
|
WEventDamage * e = (WEventDamage *) event;
|
||||||
Damage * d = e->damage;
|
Damage * d = e->damage;
|
||||||
if (combatonly && e->damage->typeOfDamage != DAMAGE_COMBAT)
|
if (combatonly && e->damage->typeOfDamage != Damage::DAMAGE_COMBAT)
|
||||||
return 0;
|
return 0;
|
||||||
MTGCardInstance * card = d->source;
|
MTGCardInstance * card = d->source;
|
||||||
if (d->damage > 0 && card && (card == source || card == source->target))
|
if (d->damage > 0 && card && (card == source || card == source->target))
|
||||||
|
|||||||
@@ -9,9 +9,6 @@
|
|||||||
#include "MTGGameZones.h"
|
#include "MTGGameZones.h"
|
||||||
#include "Counters.h"
|
#include "Counters.h"
|
||||||
|
|
||||||
#define CD_OR 1
|
|
||||||
#define CD_AND 2
|
|
||||||
|
|
||||||
enum ENUM_COMPARISON_MODES
|
enum ENUM_COMPARISON_MODES
|
||||||
{
|
{
|
||||||
COMPARISON_NONE = 0, // Needs to remain 0 for quick if(comparison_mode) checks
|
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);
|
MTGCardInstance * match_not(MTGCardInstance * card);
|
||||||
bool valueInRange(int comparisonMode, int value, int criterion);
|
bool valueInRange(int comparisonMode, int value, int criterion);
|
||||||
public:
|
public:
|
||||||
int mode;
|
enum Operator{
|
||||||
|
CD_OR = 1,
|
||||||
|
CD_AND = 2
|
||||||
|
};
|
||||||
|
|
||||||
|
Operator mode;
|
||||||
int powerComparisonMode;
|
int powerComparisonMode;
|
||||||
int toughnessComparisonMode;
|
int toughnessComparisonMode;
|
||||||
int manacostComparisonMode;
|
int manacostComparisonMode;
|
||||||
|
|||||||
@@ -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_
|
|
||||||
@@ -11,17 +11,15 @@ class JGuiObject;
|
|||||||
class MTGCardInstance;
|
class MTGCardInstance;
|
||||||
class GameObserver;
|
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
|
class Damageable:public Targetable
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
public:
|
public:
|
||||||
|
enum DamageableType{
|
||||||
|
DAMAGEABLE_MTGCARDINSTANCE = 0,
|
||||||
|
DAMAGEABLE_PLAYER
|
||||||
|
};
|
||||||
|
|
||||||
int life;
|
int life;
|
||||||
int handsize;
|
int handsize;
|
||||||
int poisonCount;
|
int poisonCount;
|
||||||
@@ -29,12 +27,14 @@ public:
|
|||||||
int preventable;
|
int preventable;
|
||||||
int thatmuch;
|
int thatmuch;
|
||||||
int lifeLostThisTurn;
|
int lifeLostThisTurn;
|
||||||
int type_as_damageable;
|
DamageableType type_as_damageable;
|
||||||
Damageable(GameObserver* observer, int _life)
|
Damageable(GameObserver* observer, int _life)
|
||||||
: Targetable(observer)
|
: Targetable(observer), life(_life), handsize(0),
|
||||||
{life=_life;lifeLostThisTurn = 0;};
|
poisonCount(0), damageCount(0), preventable(0), thatmuch(0),
|
||||||
int getLife(){return life;};
|
lifeLostThisTurn(0), type_as_damageable(DAMAGEABLE_MTGCARDINSTANCE)
|
||||||
virtual int dealDamage(int damage){life-=damage;return life;};
|
{}
|
||||||
|
int getLife(){return life;}
|
||||||
|
virtual int dealDamage(int damage){life-=damage;return life;}
|
||||||
virtual int afterDamage(){return 0;}
|
virtual int afterDamage(){return 0;}
|
||||||
virtual int poisoned(){return 0;}
|
virtual int poisoned(){return 0;}
|
||||||
virtual int prevented(){return 0;}
|
virtual int prevented(){return 0;}
|
||||||
@@ -47,17 +47,23 @@ public:
|
|||||||
|
|
||||||
class Damage: public Interruptible
|
class Damage: public Interruptible
|
||||||
{
|
{
|
||||||
protected:
|
|
||||||
void init(MTGCardInstance * source, Damageable * target, int damage, int typeOfDamage);
|
|
||||||
public:
|
public:
|
||||||
|
enum DamageType{
|
||||||
|
DAMAGE_ALL_TYPES = 0,
|
||||||
|
DAMAGE_COMBAT,
|
||||||
|
DAMAGE_OTHER
|
||||||
|
};
|
||||||
|
|
||||||
Damageable * target;
|
Damageable * target;
|
||||||
int typeOfDamage;
|
DamageType typeOfDamage;
|
||||||
int damage;
|
int damage;
|
||||||
void Render();
|
void Render();
|
||||||
Damage(GameObserver* observer, MTGCardInstance* source, Damageable * target);
|
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();
|
int resolve();
|
||||||
virtual ostream& toString(ostream& out) const;
|
virtual ostream& toString(ostream& out) const;
|
||||||
|
protected:
|
||||||
|
void init(MTGCardInstance * source, Damageable * target, int damage, DamageType typeOfDamage);
|
||||||
};
|
};
|
||||||
|
|
||||||
class DamageStack : public GuiLayer, public Interruptible
|
class DamageStack : public GuiLayer, public Interruptible
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
#include "MTGCard.h"
|
#include "MTGCard.h"
|
||||||
#include "MTGGameZones.h"
|
#include "MTGGameZones.h"
|
||||||
|
|
||||||
#include "CardEffect.h"
|
|
||||||
#ifdef NETWORK_SUPPORT
|
#ifdef NETWORK_SUPPORT
|
||||||
#include "JNetwork.h"
|
#include "JNetwork.h"
|
||||||
#endif //NETWORK_SUPPORT
|
#endif //NETWORK_SUPPORT
|
||||||
@@ -49,7 +48,6 @@ public:
|
|||||||
|
|
||||||
GameType gameType;
|
GameType gameType;
|
||||||
Rules * rules;
|
Rules * rules;
|
||||||
CardEffect *effect;
|
|
||||||
#ifdef NETWORK_SUPPORT
|
#ifdef NETWORK_SUPPORT
|
||||||
string mServerAddress;
|
string mServerAddress;
|
||||||
JNetwork* mpNetwork;
|
JNetwork* mpNetwork;
|
||||||
|
|||||||
@@ -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
|
|
||||||
@@ -29,9 +29,10 @@ protected:
|
|||||||
TargetChooser * tcTarget;
|
TargetChooser * tcTarget;
|
||||||
int damage;
|
int damage;
|
||||||
bool oneShot;
|
bool oneShot;
|
||||||
int typeOfDamage;
|
Damage::DamageType typeOfDamage;
|
||||||
public:
|
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);
|
WEvent * replace(WEvent *e);
|
||||||
~REDamagePrevention();
|
~REDamagePrevention();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -74,8 +74,7 @@ AIHint::AIHint(string _line)
|
|||||||
|
|
||||||
if(action.find( "combo ") != string::npos)
|
if(action.find( "combo ") != string::npos)
|
||||||
{
|
{
|
||||||
string Combo = "";
|
string Combo = action.c_str() + 6;
|
||||||
Combo = action.c_str() + 6;
|
|
||||||
combos.push_back(Combo);
|
combos.push_back(Combo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,14 +306,13 @@ bool AIHints::canWeCombo(GameObserver* observer,MTGCardInstance * card,AIPlayerB
|
|||||||
TargetChooserFactory tfc(observer);
|
TargetChooserFactory tfc(observer);
|
||||||
TargetChooser * hintTc = NULL;
|
TargetChooser * hintTc = NULL;
|
||||||
bool gotCombo = false;
|
bool gotCombo = false;
|
||||||
int comboPartsHold = 0;
|
|
||||||
int comboPartsUntil = 0;
|
|
||||||
int comboPartsRestriction = 0;
|
|
||||||
for(unsigned int i = 0; i < hints.size();i++)
|
for(unsigned int i = 0; i < hints.size();i++)
|
||||||
{
|
{
|
||||||
comboPartsHold = 0;
|
int comboPartsHold = 0;
|
||||||
comboPartsUntil = 0;
|
int comboPartsUntil = 0;
|
||||||
comboPartsRestriction = 0;
|
int comboPartsRestriction = 0;
|
||||||
|
|
||||||
if(gotCombo)
|
if(gotCombo)
|
||||||
return gotCombo;//because more then one might be possible at any time.
|
return gotCombo;//because more then one might be possible at any time.
|
||||||
if (hints[i]->hold.size())
|
if (hints[i]->hold.size())
|
||||||
|
|||||||
@@ -90,13 +90,12 @@ int AIMomirPlayer::computeActions()
|
|||||||
}
|
}
|
||||||
else if (p == this && observer->mLayers->stackLayer()->count(0, NOT_RESOLVED) == 0)
|
else if (p == this && observer->mLayers->stackLayer()->count(0, NOT_RESOLVED) == 0)
|
||||||
{ //standard actions
|
{ //standard actions
|
||||||
CardDescriptor cd;
|
|
||||||
MTGCardInstance * card = NULL;
|
|
||||||
|
|
||||||
switch (currentGamePhase)
|
switch (currentGamePhase)
|
||||||
{
|
{
|
||||||
case MTG_PHASE_FIRSTMAIN:
|
case MTG_PHASE_FIRSTMAIN:
|
||||||
{
|
{
|
||||||
|
CardDescriptor cd;
|
||||||
ManaCost * potentialMana = getPotentialMana();
|
ManaCost * potentialMana = getPotentialMana();
|
||||||
int converted = potentialMana->getConvertedCost();
|
int converted = potentialMana->getConvertedCost();
|
||||||
SAFE_DELETE(potentialMana);
|
SAFE_DELETE(potentialMana);
|
||||||
@@ -106,7 +105,7 @@ int AIMomirPlayer::computeActions()
|
|||||||
//Attempt to put land into play
|
//Attempt to put land into play
|
||||||
cd.init();
|
cd.init();
|
||||||
cd.setColor(Constants::MTG_COLOR_LAND);
|
cd.setColor(Constants::MTG_COLOR_LAND);
|
||||||
card = cd.match(game->hand);
|
MTGCardInstance *card = cd.match(game->hand);
|
||||||
int canPutLandsIntoPlay = game->playRestrictions->canPutIntoZone(card, game->inPlay);
|
int canPutLandsIntoPlay = game->playRestrictions->canPutIntoZone(card, game->inPlay);
|
||||||
if (card && (canPutLandsIntoPlay == PlayRestriction::CAN_PLAY))
|
if (card && (canPutLandsIntoPlay == PlayRestriction::CAN_PLAY))
|
||||||
{
|
{
|
||||||
@@ -118,15 +117,12 @@ int AIMomirPlayer::computeActions()
|
|||||||
}
|
}
|
||||||
momir();
|
momir();
|
||||||
return 1;
|
return 1;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case MTG_PHASE_SECONDMAIN:
|
case MTG_PHASE_SECONDMAIN:
|
||||||
selectAbility();
|
selectAbility();
|
||||||
return 1;
|
return 1;
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
return AIPlayerBaka::computeActions();
|
return AIPlayerBaka::computeActions();
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return AIPlayerBaka::computeActions();
|
return AIPlayerBaka::computeActions();
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ int AIAction::clickMultiAct(vector<Targetable*>& actionTargets)
|
|||||||
ite = actionTargets.erase(ite);
|
ite = actionTargets.erase(ite);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ite++;
|
++ite;
|
||||||
}
|
}
|
||||||
|
|
||||||
//shuffle to make it less predictable, otherwise ai will always seem to target from right to left. making it very obvious.
|
//shuffle to make it less predictable, otherwise ai will always seem to target from right to left. making it very obvious.
|
||||||
@@ -167,7 +167,7 @@ int AIPlayer::clickMultiTarget(TargetChooser * tc, vector<Targetable*>& potentia
|
|||||||
ite = potentialTargets.erase(ite);
|
ite = potentialTargets.erase(ite);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ite++;
|
++ite;
|
||||||
}
|
}
|
||||||
|
|
||||||
randomGenerator.random_shuffle(potentialTargets.begin(), potentialTargets.end());
|
randomGenerator.random_shuffle(potentialTargets.begin(), potentialTargets.end());
|
||||||
|
|||||||
@@ -134,10 +134,9 @@ int OrderedAIAction::getEfficiency()
|
|||||||
if (!target)
|
if (!target)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
bool NeedPreventing;
|
|
||||||
NeedPreventing = false;
|
|
||||||
if (currentPhase == MTG_PHASE_COMBATBLOCKERS)
|
if (currentPhase == MTG_PHASE_COMBATBLOCKERS)
|
||||||
{
|
{
|
||||||
|
bool NeedPreventing = false;
|
||||||
MTGCardInstance * nextOpponent = target->getNextOpponent();
|
MTGCardInstance * nextOpponent = target->getNextOpponent();
|
||||||
if(!nextOpponent)
|
if(!nextOpponent)
|
||||||
break;
|
break;
|
||||||
@@ -152,12 +151,10 @@ int OrderedAIAction::getEfficiency()
|
|||||||
//small bonus added for the poor 1/1s, if we can save them, we will unless something else took precidence.
|
//small bonus added for the poor 1/1s, if we can save them, we will unless something else took precidence.
|
||||||
//note is the target is being blocked or blocking a creature with wither or deathtouch, it is not even considered for preventing as it is a waste.
|
//note is the target is being blocked or blocking a creature with wither or deathtouch, it is not even considered for preventing as it is a waste.
|
||||||
//if its combat blockers, it is being blocked or blocking, and has less prevents the the amount of damage it will be taking, the effeincy is increased slightly and totalled by the danger rank multiplier for final result.
|
//if its combat blockers, it is being blocked or blocking, and has less prevents the the amount of damage it will be taking, the effeincy is increased slightly and totalled by the danger rank multiplier for final result.
|
||||||
int calculateAfterDamage = 0;
|
|
||||||
int damages = 0;
|
|
||||||
if((target->defenser || target->blockers.size()) && target->controller() == p)
|
if((target->defenser || target->blockers.size()) && target->controller() == p)
|
||||||
{
|
{
|
||||||
damages = nextOpponent->power;
|
int damages = nextOpponent->power;
|
||||||
calculateAfterDamage = int(target->toughness - damages);
|
int calculateAfterDamage = target->toughness - damages;
|
||||||
if((calculateAfterDamage + target->preventable) > 0)
|
if((calculateAfterDamage + target->preventable) > 0)
|
||||||
{
|
{
|
||||||
efficiency = 0;
|
efficiency = 0;
|
||||||
@@ -588,8 +585,7 @@ int OrderedAIAction::getEfficiency()
|
|||||||
efficiency = 80;
|
efficiency = 80;
|
||||||
if(atc->name.length() && atc->sabilities.length() && atc->types.size() && p->game->inPlay->findByName(atc->name))
|
if(atc->name.length() && atc->sabilities.length() && atc->types.size() && p->game->inPlay->findByName(atc->name))
|
||||||
{
|
{
|
||||||
list<int>::iterator it;
|
for (list<int>::const_iterator it = atc->types.begin(); it != atc->types.end(); ++it)
|
||||||
for (it = atc->types.begin(); it != atc->types.end(); it++)
|
|
||||||
{
|
{
|
||||||
if(*it == Subtypes::TYPE_LEGENDARY)//ai please stop killing voja!!! :P
|
if(*it == Subtypes::TYPE_LEGENDARY)//ai please stop killing voja!!! :P
|
||||||
efficiency = 0;
|
efficiency = 0;
|
||||||
@@ -978,11 +974,10 @@ vector<MTGAbility*> AIPlayerBaka::canPayMana(MTGCardInstance * target,ManaCost *
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ManaCostHybrid * hybridCost;
|
ManaCostHybrid * hybridCost;
|
||||||
int hyb;
|
|
||||||
hyb = 0;
|
|
||||||
hybridCost = cost->getHybridCost(0);
|
hybridCost = cost->getHybridCost(0);
|
||||||
if(hybridCost)
|
if(hybridCost)
|
||||||
{
|
{
|
||||||
|
int hyb = 0;
|
||||||
while ((hybridCost = cost->getHybridCost(hyb)) != NULL)
|
while ((hybridCost = cost->getHybridCost(hyb)) != NULL)
|
||||||
{
|
{
|
||||||
//here we try to find one of the colors in the hybrid cost, it is done 1 at a time unfortunately
|
//here we try to find one of the colors in the hybrid cost, it is done 1 at a time unfortunately
|
||||||
@@ -1046,7 +1041,6 @@ vector<MTGAbility*> AIPlayerBaka::canPayMana(MTGCardInstance * target,ManaCost *
|
|||||||
{
|
{
|
||||||
|
|
||||||
ManaCost * withKickerCost= NEW ManaCost(cost->getKicker());
|
ManaCost * withKickerCost= NEW ManaCost(cost->getKicker());
|
||||||
int canKick = 0;
|
|
||||||
vector<MTGAbility*>kickerPayment;
|
vector<MTGAbility*>kickerPayment;
|
||||||
bool keepLooking = true;
|
bool keepLooking = true;
|
||||||
while(keepLooking)
|
while(keepLooking)
|
||||||
@@ -1061,7 +1055,6 @@ vector<MTGAbility*> AIPlayerBaka::canPayMana(MTGCardInstance * target,ManaCost *
|
|||||||
payments.push_back(kickerPayment[w]);
|
payments.push_back(kickerPayment[w]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
canKick += 1;
|
|
||||||
keepLooking = cost->getKicker()->isMulti;
|
keepLooking = cost->getKicker()->isMulti;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1297,12 +1290,10 @@ int AIPlayerBaka::createAbilityTargets(MTGAbility * a, MTGCardInstance * c, Rank
|
|||||||
|
|
||||||
TargetChooser * AIPlayerBaka::GetComboTc( GameObserver * observer,TargetChooser * tc)
|
TargetChooser * AIPlayerBaka::GetComboTc( GameObserver * observer,TargetChooser * tc)
|
||||||
{
|
{
|
||||||
TargetChooser * gathertc = NULL;
|
|
||||||
TargetChooserFactory tcf(observer);
|
TargetChooserFactory tcf(observer);
|
||||||
map<string, string>::iterator it = comboHint->cardTargets.begin();
|
for(map<string, string>::iterator it = comboHint->cardTargets.begin();it != comboHint->cardTargets.end();++it)
|
||||||
for(map<string, string>::iterator it = comboHint->cardTargets.begin();it != comboHint->cardTargets.end();it++)
|
|
||||||
{
|
{
|
||||||
gathertc = tcf.createTargetChooser(it->first.c_str(),tc->source);
|
TargetChooser *gathertc = tcf.createTargetChooser(it->first.c_str(),tc->source);
|
||||||
gathertc->setAllZones();
|
gathertc->setAllZones();
|
||||||
if(gathertc->canTarget(tc->source))
|
if(gathertc->canTarget(tc->source))
|
||||||
{
|
{
|
||||||
@@ -1402,7 +1393,6 @@ int AIPlayerBaka::selectAbility()
|
|||||||
MTGCardInstance * card = game->inPlay->cards[j];
|
MTGCardInstance * card = game->inPlay->cards[j];
|
||||||
if(a->getCost() && !a->isReactingToClick(card, totalPotentialMana))//for performance reason only look for specific mana if the payment couldnt be made with potential.
|
if(a->getCost() && !a->isReactingToClick(card, totalPotentialMana))//for performance reason only look for specific mana if the payment couldnt be made with potential.
|
||||||
{
|
{
|
||||||
abilityPayment = vector<MTGAbility*>();
|
|
||||||
abilityPayment = canPayMana(card,a->getCost());
|
abilityPayment = canPayMana(card,a->getCost());
|
||||||
}
|
}
|
||||||
if (a->isReactingToClick(card, totalPotentialMana) || abilityPayment.size())
|
if (a->isReactingToClick(card, totalPotentialMana) || abilityPayment.size())
|
||||||
@@ -1410,10 +1400,9 @@ int AIPlayerBaka::selectAbility()
|
|||||||
if(a->getCost() && a->getCost()->hasX() && totalPotentialMana->getConvertedCost() < a->getCost()->getConvertedCost()+1)
|
if(a->getCost() && a->getCost()->hasX() && totalPotentialMana->getConvertedCost() < a->getCost()->getConvertedCost()+1)
|
||||||
continue;
|
continue;
|
||||||
//don't even bother to play an ability with {x} if you can't even afford x=1.
|
//don't even bother to play an ability with {x} if you can't even afford x=1.
|
||||||
ManaCost * fullPayment = NULL;
|
|
||||||
if (abilityPayment.size())
|
if (abilityPayment.size())
|
||||||
{
|
{
|
||||||
fullPayment = NEW ManaCost();
|
ManaCost *fullPayment = NEW ManaCost();
|
||||||
for(int ch = 0; ch < int(abilityPayment.size());ch++)
|
for(int ch = 0; ch < int(abilityPayment.size());ch++)
|
||||||
{
|
{
|
||||||
AManaProducer * ampp = dynamic_cast<AManaProducer*> (abilityPayment[ch]);
|
AManaProducer * ampp = dynamic_cast<AManaProducer*> (abilityPayment[ch]);
|
||||||
@@ -1525,7 +1514,7 @@ int AIPlayerBaka::chooseTarget(TargetChooser * _tc, Player * forceTarget,MTGCard
|
|||||||
}
|
}
|
||||||
//Make sure we own the decision to choose the targets
|
//Make sure we own the decision to choose the targets
|
||||||
assert(tc->Owner == observer->currentlyActing());
|
assert(tc->Owner == observer->currentlyActing());
|
||||||
if (tc && tc->Owner != observer->currentlyActing())
|
if (tc->Owner != observer->currentlyActing())
|
||||||
{
|
{
|
||||||
observer->currentActionPlayer = tc->Owner;
|
observer->currentActionPlayer = tc->Owner;
|
||||||
//this is a hack, but if we hit this condition we are locked in a infinate loop
|
//this is a hack, but if we hit this condition we are locked in a infinate loop
|
||||||
@@ -1905,12 +1894,11 @@ MTGCardInstance * AIPlayerBaka::activateCombo()
|
|||||||
{
|
{
|
||||||
if(!comboHint)
|
if(!comboHint)
|
||||||
return NULL;
|
return NULL;
|
||||||
TargetChooser * hintTc = NULL;
|
|
||||||
TargetChooserFactory tfc(observer);
|
TargetChooserFactory tfc(observer);
|
||||||
ManaCost * totalCost = ManaCost::parseManaCost(comboHint->manaNeeded);
|
ManaCost * totalCost = ManaCost::parseManaCost(comboHint->manaNeeded);
|
||||||
for(unsigned int k = 0;k < comboHint->casting.size(); k++)
|
for(unsigned int k = 0;k < comboHint->casting.size(); k++)
|
||||||
{
|
{
|
||||||
hintTc = tfc.createTargetChooser(comboHint->casting[k],nextCardToPlay);
|
TargetChooser *hintTc = tfc.createTargetChooser(comboHint->casting[k],nextCardToPlay);
|
||||||
int combohand = game->hand->cards.size();
|
int combohand = game->hand->cards.size();
|
||||||
for(int j = 0; j < combohand;j++)
|
for(int j = 0; j < combohand;j++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ AIStats::AIStats(Player * _player, char * _filename)
|
|||||||
AIStats::~AIStats()
|
AIStats::~AIStats()
|
||||||
{
|
{
|
||||||
list<AIStat *>::iterator it;
|
list<AIStat *>::iterator it;
|
||||||
for (it = stats.begin(); it != stats.end(); it++)
|
for (it = stats.begin(); it != stats.end(); ++it)
|
||||||
{
|
{
|
||||||
AIStat * stat = *it;
|
AIStat * stat = *it;
|
||||||
delete stat;
|
delete stat;
|
||||||
@@ -47,7 +47,7 @@ void AIStats::updateStatsCard(MTGCardInstance * cardInstance, Damage * damage, f
|
|||||||
{
|
{
|
||||||
stat->value += static_cast<int>(multiplier * STATS_PLAYER_MULTIPLIER * damage->damage);
|
stat->value += static_cast<int>(multiplier * STATS_PLAYER_MULTIPLIER * damage->damage);
|
||||||
}
|
}
|
||||||
else if (damage->target->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE)
|
else if (damage->target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE)
|
||||||
{
|
{
|
||||||
MTGCardInstance * target = (MTGCardInstance *) damage->target;
|
MTGCardInstance * target = (MTGCardInstance *) damage->target;
|
||||||
if (target->controller() == player && !target->isInPlay(player->getObserver()))
|
if (target->controller() == player && !target->isInPlay(player->getObserver()))
|
||||||
@@ -115,7 +115,7 @@ bool AIStats::isInTop(MTGCardInstance * card, unsigned int max, bool tooSmallCou
|
|||||||
MTGCard * source = card->model;
|
MTGCard * source = card->model;
|
||||||
int id = source->getMTGId();
|
int id = source->getMTGId();
|
||||||
list<AIStat *>::iterator it;
|
list<AIStat *>::iterator it;
|
||||||
for (it = stats.begin(); it != stats.end(); it++)
|
for (it = stats.begin(); it != stats.end(); ++it)
|
||||||
{
|
{
|
||||||
if (n >= max)
|
if (n >= max)
|
||||||
return false;
|
return false;
|
||||||
@@ -135,7 +135,7 @@ AIStat * AIStats::find(MTGCard * source)
|
|||||||
{
|
{
|
||||||
int id = source->getMTGId();
|
int id = source->getMTGId();
|
||||||
list<AIStat *>::iterator it;
|
list<AIStat *>::iterator it;
|
||||||
for (it = stats.begin(); it != stats.end(); it++)
|
for (it = stats.begin(); it != stats.end(); ++it)
|
||||||
{
|
{
|
||||||
AIStat * stat = *it;
|
AIStat * stat = *it;
|
||||||
if (stat->source == id)
|
if (stat->source == id)
|
||||||
@@ -174,7 +174,7 @@ void AIStats::save()
|
|||||||
{
|
{
|
||||||
char writer[128];
|
char writer[128];
|
||||||
list<AIStat *>::iterator it;
|
list<AIStat *>::iterator it;
|
||||||
for (it = stats.begin(); it != stats.end(); it++)
|
for (it = stats.begin(); it != stats.end(); ++it)
|
||||||
{
|
{
|
||||||
AIStat * stat = *it;
|
AIStat * stat = *it;
|
||||||
if (stat->value > 0)
|
if (stat->value > 0)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
ActionElement::ActionElement(int id) :
|
ActionElement::ActionElement(int id) :
|
||||||
JGuiObject(id)
|
JGuiObject(id)
|
||||||
{
|
{
|
||||||
activeState = INACTIVE;
|
activity = Inactive;
|
||||||
modal = 0;
|
modal = 0;
|
||||||
waitingForAnswer = 0;
|
waitingForAnswer = 0;
|
||||||
currentPhase = MTG_PHASE_INVALID;
|
currentPhase = MTG_PHASE_INVALID;
|
||||||
@@ -18,7 +18,7 @@ ActionElement::ActionElement(int id) :
|
|||||||
|
|
||||||
ActionElement::ActionElement(const ActionElement& a): JGuiObject(a)
|
ActionElement::ActionElement(const ActionElement& a): JGuiObject(a)
|
||||||
{
|
{
|
||||||
activeState = a.activeState;
|
activity = a.activity;
|
||||||
tc = a.tc ? a.tc->clone() : NULL;
|
tc = a.tc ? a.tc->clone() : NULL;
|
||||||
currentPhase = a.currentPhase;
|
currentPhase = a.currentPhase;
|
||||||
newPhase = a.newPhase;
|
newPhase = a.newPhase;
|
||||||
@@ -31,12 +31,6 @@ ActionElement::~ActionElement()
|
|||||||
SAFE_DELETE(tc);
|
SAFE_DELETE(tc);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ActionElement::getActivity()
|
|
||||||
{
|
|
||||||
|
|
||||||
return activeState;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ActionElement::isReactingToTargetClick(Targetable * object)
|
int ActionElement::isReactingToTargetClick(Targetable * object)
|
||||||
{
|
{
|
||||||
if (MTGCardInstance * cObject = dynamic_cast<MTGCardInstance *>(object))
|
if (MTGCardInstance * cObject = dynamic_cast<MTGCardInstance *>(object))
|
||||||
|
|||||||
@@ -165,8 +165,6 @@ void ActionLayer::Update(float dt)
|
|||||||
if (cantCancel)
|
if (cantCancel)
|
||||||
{
|
{
|
||||||
ActionElement * ae = isWaitingForAnswer();
|
ActionElement * ae = isWaitingForAnswer();
|
||||||
int countTargets = 0;
|
|
||||||
int maxTargets = 0;
|
|
||||||
if(ae && ae->getActionTc())
|
if(ae && ae->getActionTc())
|
||||||
{
|
{
|
||||||
if (!ae->getActionTc()->validTargetsExist())
|
if (!ae->getActionTc()->validTargetsExist())
|
||||||
@@ -175,8 +173,8 @@ void ActionLayer::Update(float dt)
|
|||||||
cancelCurrentAction();
|
cancelCurrentAction();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
countTargets = ae->getActionTc()->countValidTargets();
|
int countTargets = ae->getActionTc()->countValidTargets();
|
||||||
maxTargets = ae->getActionTc()->maxtargets;
|
int maxTargets = ae->getActionTc()->maxtargets;
|
||||||
if (countTargets < maxTargets)
|
if (countTargets < maxTargets)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@@ -266,7 +264,7 @@ int ActionLayer::receiveEventPlus(WEvent * event)
|
|||||||
ActionElement * currentAction = (ActionElement *) mObjects[i];
|
ActionElement * currentAction = (ActionElement *) mObjects[i];
|
||||||
result += currentAction->receiveEvent(event);
|
result += currentAction->receiveEvent(event);
|
||||||
}
|
}
|
||||||
return 0;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ActionLayer::isReactingToTargetClick(Targetable * card)
|
int ActionLayer::isReactingToTargetClick(Targetable * card)
|
||||||
@@ -440,10 +438,9 @@ void ActionLayer::setCustomMenuObject(Targetable * object, bool must,vector<MTGA
|
|||||||
if(abilities.size())
|
if(abilities.size())
|
||||||
{
|
{
|
||||||
abilitiesMenu->isMultipleChoice = true;
|
abilitiesMenu->isMultipleChoice = true;
|
||||||
ActionElement * currentAction = NULL;
|
|
||||||
for(int w = 0; w < int(abilities.size());w++)
|
for(int w = 0; w < int(abilities.size());w++)
|
||||||
{
|
{
|
||||||
currentAction = (ActionElement*)abilities[w];
|
ActionElement* currentAction = (ActionElement*)abilities[w];
|
||||||
currentActionCard = (MTGCardInstance*)abilities[0]->target;
|
currentActionCard = (MTGCardInstance*)abilities[0]->target;
|
||||||
abilitiesMenu->Add(mObjects.size()-1, currentAction->getMenuText(),"",false);
|
abilitiesMenu->Add(mObjects.size()-1, currentAction->getMenuText(),"",false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ void StackAbility::Render()
|
|||||||
if (target)
|
if (target)
|
||||||
{
|
{
|
||||||
quad = target->getIcon();
|
quad = target->getIcon();
|
||||||
if (target->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE)
|
if (target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE)
|
||||||
{
|
{
|
||||||
alt2 = ((MTGCardInstance *) target)->name;
|
alt2 = ((MTGCardInstance *) target)->name;
|
||||||
}
|
}
|
||||||
@@ -400,7 +400,7 @@ void Spell::Render()
|
|||||||
if (target)
|
if (target)
|
||||||
{
|
{
|
||||||
quad = target->getIcon();
|
quad = target->getIcon();
|
||||||
if (target->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE)
|
if (target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE)
|
||||||
{
|
{
|
||||||
alt2 = ((MTGCardInstance *) target)->name;
|
alt2 = ((MTGCardInstance *) target)->name;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2351,7 +2351,7 @@ int AALifer::resolve()
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
WParsedInt life(life_s, NULL, source);
|
WParsedInt life(life_s, NULL, source);
|
||||||
if (_target->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE)
|
if (_target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE)
|
||||||
{
|
{
|
||||||
_target = ((MTGCardInstance *) _target)->controller();
|
_target = ((MTGCardInstance *) _target)->controller();
|
||||||
}
|
}
|
||||||
@@ -4380,7 +4380,7 @@ int AAExchangeLife::resolve()
|
|||||||
int oldlife = player->getLife();
|
int oldlife = player->getLife();
|
||||||
int targetOldLife = _target->getLife();
|
int targetOldLife = _target->getLife();
|
||||||
int modifier = oldlife > targetOldLife? oldlife - targetOldLife:targetOldLife - oldlife;
|
int modifier = oldlife > targetOldLife? oldlife - targetOldLife:targetOldLife - oldlife;
|
||||||
if (_target->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE)
|
if (_target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE)
|
||||||
{
|
{
|
||||||
int increaser = 0;
|
int increaser = 0;
|
||||||
MTGCardInstance * card = ((MTGCardInstance*)_target);
|
MTGCardInstance * card = ((MTGCardInstance*)_target);
|
||||||
@@ -4597,15 +4597,15 @@ int APreventDamageTypes::addToGame()
|
|||||||
fromTc->targetter = NULL;
|
fromTc->targetter = NULL;
|
||||||
if (type != 1 && type != 2)
|
if (type != 1 && type != 2)
|
||||||
{//not adding this creates a memory leak.
|
{//not adding this creates a memory leak.
|
||||||
re = NEW REDamagePrevention(this, fromTc, toTc, -1, false, DAMAGE_COMBAT);
|
re = NEW REDamagePrevention(this, fromTc, toTc, -1, false, Damage::DAMAGE_COMBAT);
|
||||||
}
|
}
|
||||||
else if (type == 1)
|
else if (type == 1)
|
||||||
{
|
{
|
||||||
re = NEW REDamagePrevention(this, fromTc, toTc, -1, false, DAMAGE_ALL_TYPES);
|
re = NEW REDamagePrevention(this, fromTc, toTc, -1, false, Damage::DAMAGE_ALL_TYPES);
|
||||||
}
|
}
|
||||||
else if (type == 2)
|
else if (type == 2)
|
||||||
{
|
{
|
||||||
re = NEW REDamagePrevention(this, fromTc, toTc, -1, false, DAMAGE_OTHER);
|
re = NEW REDamagePrevention(this, fromTc, toTc, -1, false, Damage::DAMAGE_OTHER);
|
||||||
}
|
}
|
||||||
game->replacementEffects->add(re);
|
game->replacementEffects->add(re);
|
||||||
return MTGAbility::addToGame();
|
return MTGAbility::addToGame();
|
||||||
|
|||||||
@@ -160,7 +160,8 @@ MTGCardInstance * CardDescriptor::match_and(MTGCardInstance * card)
|
|||||||
|
|
||||||
if (mColorExclusions)
|
if (mColorExclusions)
|
||||||
{
|
{
|
||||||
if ((mColorExclusions & card->colors) == mColorExclusions)
|
// if any of forbidden colors intersect with card colors
|
||||||
|
if ((mColorExclusions & card->colors) != 0)
|
||||||
match = NULL;
|
match = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
#include "../include/GameApp.h"
|
|
||||||
#include "../include/MTGCard.h"
|
|
||||||
#include "../include/GameOptions.h"
|
|
||||||
#include "../include/CardEffect.h"
|
|
||||||
|
|
||||||
CardEffect::CardEffect(CardGui* target) :
|
|
||||||
target(target)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
CardEffect::~CardEffect()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void CardEffect::Render()
|
|
||||||
{
|
|
||||||
// std::cout << "Rendering effect" << std::endl;
|
|
||||||
}
|
|
||||||
@@ -1013,7 +1013,7 @@ bool CardGui::FilterCard(MTGCard * _card,string filter)
|
|||||||
CardDescriptor cd;
|
CardDescriptor cd;
|
||||||
MTGCardInstance * card = (MTGCardInstance*) _card->data;
|
MTGCardInstance * card = (MTGCardInstance*) _card->data;
|
||||||
cd.init();
|
cd.init();
|
||||||
cd.mode = CD_OR;
|
cd.mode = CardDescriptor::CD_OR;
|
||||||
while (filter.size())
|
while (filter.size())
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -1033,13 +1033,13 @@ bool CardGui::FilterCard(MTGCard * _card,string filter)
|
|||||||
string attribute;
|
string attribute;
|
||||||
if (found2 != string::npos)
|
if (found2 != string::npos)
|
||||||
{
|
{
|
||||||
cd.mode = CD_OR;
|
cd.mode = CardDescriptor::CD_OR;
|
||||||
attribute = attributes.substr(0, found2);
|
attribute = attributes.substr(0, found2);
|
||||||
attributes = attributes.substr(found2 + 1);
|
attributes = attributes.substr(found2 + 1);
|
||||||
}
|
}
|
||||||
else if (foundAnd != string::npos)
|
else if (foundAnd != string::npos)
|
||||||
{
|
{
|
||||||
cd.mode = CD_AND;
|
cd.mode = CardDescriptor::CD_AND;
|
||||||
attribute = attributes.substr(0, foundAnd);
|
attribute = attributes.substr(0, foundAnd);
|
||||||
attributes = attributes.substr(foundAnd + 1);
|
attributes = attributes.substr(foundAnd + 1);
|
||||||
}
|
}
|
||||||
@@ -1302,7 +1302,7 @@ bool CardGui::FilterCard(MTGCard * _card,string filter)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (nbminuses)
|
if (nbminuses)
|
||||||
cd.mode = CD_AND;
|
cd.mode = CardDescriptor::CD_AND;
|
||||||
filter = filter.substr(0, found);
|
filter = filter.substr(0, found);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1312,7 +1312,7 @@ bool CardGui::FilterCard(MTGCard * _card,string filter)
|
|||||||
|
|
||||||
if (found != string::npos)
|
if (found != string::npos)
|
||||||
{
|
{
|
||||||
cd.mode = CD_OR;
|
cd.mode = CardDescriptor::CD_OR;
|
||||||
typeName = filter.substr(0, found);
|
typeName = filter.substr(0, found);
|
||||||
filter = filter.substr(found + 1);
|
filter = filter.substr(found + 1);
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-25
@@ -14,13 +14,13 @@ Damage::Damage(GameObserver* observer, MTGCardInstance * source, Damageable * ta
|
|||||||
init(source, target, source->getPower(), DAMAGE_OTHER);
|
init(source, target, source->getPower(), DAMAGE_OTHER);
|
||||||
}
|
}
|
||||||
|
|
||||||
Damage::Damage(GameObserver* observer, MTGCardInstance * source, Damageable * target, int damage, int _typeOfDamage)
|
Damage::Damage(GameObserver* observer, MTGCardInstance * source, Damageable * target, int damage, DamageType _typeOfDamage)
|
||||||
: Interruptible(observer)
|
: Interruptible(observer)
|
||||||
{
|
{
|
||||||
init(source, target, damage, _typeOfDamage);
|
init(source, target, damage, _typeOfDamage);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Damage::init(MTGCardInstance * _source, Damageable * _target, int _damage, int _typeOfDamage)
|
void Damage::init(MTGCardInstance * _source, Damageable * _target, int _damage, DamageType _typeOfDamage)
|
||||||
{
|
{
|
||||||
typeOfDamage = _typeOfDamage;
|
typeOfDamage = _typeOfDamage;
|
||||||
target = _target;
|
target = _target;
|
||||||
@@ -59,29 +59,19 @@ int Damage::resolve()
|
|||||||
//reserved for culmulitive absorb ability coding
|
//reserved for culmulitive absorb ability coding
|
||||||
|
|
||||||
//prevent next damage-----------------------------
|
//prevent next damage-----------------------------
|
||||||
if ((target)->preventable >= 1)
|
if (target->preventable > 0)
|
||||||
{
|
{
|
||||||
int preventing = (target)->preventable;
|
int preventing = MIN(target->preventable, damage);
|
||||||
for (int k = preventing; k > 0; k--)
|
damage -= preventing;
|
||||||
{
|
target->preventable -= preventing;
|
||||||
//the following keeps preventable from ADDING toughness/life if damage was less then preventable amount.
|
|
||||||
for (int i = damage; i >= 1; i--)
|
|
||||||
{
|
|
||||||
(target)->preventable -= 1;
|
|
||||||
damage -= 1;
|
|
||||||
break;//does the redux of damage 1 time, breaks the loop to deincrement preventing and start the loop over.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
//set prevent next damage back to 0 if it is equal to less then 0
|
|
||||||
if ((target)->preventable < 0)
|
|
||||||
{
|
{
|
||||||
(target)->preventable = 0;
|
target->preventable = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
if (target->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE)
|
if (target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE)
|
||||||
{
|
{
|
||||||
MTGCardInstance * _target = (MTGCardInstance *) target;
|
MTGCardInstance * _target = (MTGCardInstance *) target;
|
||||||
if ((_target)->protectedAgainst(source))
|
if ((_target)->protectedAgainst(source))
|
||||||
@@ -134,7 +124,7 @@ int Damage::resolve()
|
|||||||
|
|
||||||
int a = damage;
|
int a = damage;
|
||||||
|
|
||||||
if (target->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE && (source->has(Constants::WITHER) || source->has(
|
if (target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE && (source->has(Constants::WITHER) || source->has(
|
||||||
Constants::INFECT)))
|
Constants::INFECT)))
|
||||||
{
|
{
|
||||||
// Damage for WITHER or poison on creatures. This should probably go in replacement effects
|
// Damage for WITHER or poison on creatures. This should probably go in replacement effects
|
||||||
@@ -146,7 +136,7 @@ int Damage::resolve()
|
|||||||
if(_target->toughness <= 0 && _target->has(Constants::INDESTRUCTIBLE))
|
if(_target->toughness <= 0 && _target->has(Constants::INDESTRUCTIBLE))
|
||||||
_target->controller()->game->putInGraveyard(_target);
|
_target->controller()->game->putInGraveyard(_target);
|
||||||
}
|
}
|
||||||
else if (target->type_as_damageable == DAMAGEABLE_PLAYER && (source->has(Constants::INFECT)||source->has(Constants::POISONDAMAGER)))
|
else if (target->type_as_damageable == Damageable::DAMAGEABLE_PLAYER && (source->has(Constants::INFECT)||source->has(Constants::POISONDAMAGER)))
|
||||||
{
|
{
|
||||||
// Poison on player
|
// Poison on player
|
||||||
Player * _target = (Player *) target;
|
Player * _target = (Player *) target;
|
||||||
@@ -163,7 +153,7 @@ int Damage::resolve()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (target->type_as_damageable == DAMAGEABLE_PLAYER && (source->has(Constants::POISONTOXIC) ||
|
else if (target->type_as_damageable == Damageable::DAMAGEABLE_PLAYER && (source->has(Constants::POISONTOXIC) ||
|
||||||
source->has(Constants::POISONTWOTOXIC) || source->has(Constants::POISONTHREETOXIC)))
|
source->has(Constants::POISONTWOTOXIC) || source->has(Constants::POISONTHREETOXIC)))
|
||||||
{
|
{
|
||||||
//Damage + 1, 2, or 3 poison counters on player
|
//Damage + 1, 2, or 3 poison counters on player
|
||||||
@@ -202,9 +192,9 @@ int Damage::resolve()
|
|||||||
//return the left over amount after effects have been applied to them.
|
//return the left over amount after effects have been applied to them.
|
||||||
a = target->dealDamage(damage);
|
a = target->dealDamage(damage);
|
||||||
target->damageCount += damage;//the amount must be the actual damage so i changed this from 1 to damage, this fixes pdcount and odcount
|
target->damageCount += damage;//the amount must be the actual damage so i changed this from 1 to damage, this fixes pdcount and odcount
|
||||||
if (target->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE)
|
if (target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE)
|
||||||
((MTGCardInstance*)target)->wasDealtDamage = true;
|
((MTGCardInstance*)target)->wasDealtDamage = true;
|
||||||
if (target->type_as_damageable == DAMAGEABLE_PLAYER)
|
if (target->type_as_damageable == Damageable::DAMAGEABLE_PLAYER)
|
||||||
{
|
{
|
||||||
if(target == source->controller())
|
if(target == source->controller())
|
||||||
{
|
{
|
||||||
@@ -260,7 +250,7 @@ void Damage::Render()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (target->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE)
|
if (target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE)
|
||||||
mFont->DrawString(_(((MTGCardInstance *) target)->getName()).c_str(), x + 120, y);
|
mFont->DrawString(_(((MTGCardInstance *) target)->getName()).c_str(), x + 120, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ void DamagerDamaged::addDamage(int damage, DamagerDamaged* source)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (0 < damage)
|
if (0 < damage)
|
||||||
damages.push_back(Damage(card->getObserver(), source->card, card, damage, DAMAGE_COMBAT));
|
damages.push_back(Damage(card->getObserver(), source->card, card, damage, Damage::DAMAGE_COMBAT));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1188,10 +1188,11 @@ bool GameOptionKeyBindings::read(string input)
|
|||||||
iss.get(*(s.rdbuf()), ',');
|
iss.get(*(s.rdbuf()), ',');
|
||||||
iss.get();
|
iss.get();
|
||||||
|
|
||||||
LocalKeySym local;
|
LocalKeySym local = 0;
|
||||||
char sep;
|
char sep = 0;
|
||||||
u32 button;
|
u32 button = 0;
|
||||||
s >> local >> sep >> button;
|
s >> local >> sep >> button;
|
||||||
|
|
||||||
if (':' != sep)
|
if (':' != sep)
|
||||||
return false;
|
return false;
|
||||||
assoc.push_back(make_pair(local, u32_to_button(button)));
|
assoc.push_back(make_pair(local, u32_to_button(button)));
|
||||||
|
|||||||
@@ -23,22 +23,6 @@
|
|||||||
#include "AIPlayer.h"
|
#include "AIPlayer.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//!! helper function; this is probably handled somewhere in the code already.
|
|
||||||
// If not, should be placed in general library
|
|
||||||
void StringExplode(string str, string separator, vector<string>* results)
|
|
||||||
{
|
|
||||||
size_t found;
|
|
||||||
found = str.find_first_of(separator);
|
|
||||||
while (found != string::npos)
|
|
||||||
{
|
|
||||||
if (found > 0) results->push_back(str.substr(0, found));
|
|
||||||
str = str.substr(found + 1);
|
|
||||||
found = str.find_first_of(separator);
|
|
||||||
}
|
|
||||||
if (str.length() > 0) results->push_back(str);
|
|
||||||
}
|
|
||||||
|
|
||||||
GameStateDeckViewer::GameStateDeckViewer(GameApp* parent) :
|
GameStateDeckViewer::GameStateDeckViewer(GameApp* parent) :
|
||||||
GameState(parent, "deckeditor")
|
GameState(parent, "deckeditor")
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ GameStateMenu::GameStateMenu(GameApp* parent) :
|
|||||||
scroller = NULL;
|
scroller = NULL;
|
||||||
langChoices = false;
|
langChoices = false;
|
||||||
primitivesLoadCounter = -1;
|
primitivesLoadCounter = -1;
|
||||||
|
bgTexture = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameStateMenu::~GameStateMenu()
|
GameStateMenu::~GameStateMenu()
|
||||||
|
|||||||
@@ -526,7 +526,7 @@ int GuiCombat::resolve() // Returns the number of damage objects dealt this turn
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (dmg > 0 && ((!attacker->isBlocked()) || attacker->has(Constants::TRAMPLE)))
|
if (dmg > 0 && ((!attacker->isBlocked()) || attacker->has(Constants::TRAMPLE)))
|
||||||
stack->Add(NEW Damage(observer, (*it)->card, (Damageable*)attacker->isAttacking?(Damageable*)attacker->isAttacking:observer->opponent(), dmg, DAMAGE_COMBAT));
|
stack->Add(NEW Damage(observer, (*it)->card, (Damageable*)attacker->isAttacking?(Damageable*)attacker->isAttacking:observer->opponent(), dmg, Damage::DAMAGE_COMBAT));
|
||||||
|
|
||||||
for (vector<Damage>::iterator d = (*it)->damages.begin(); d != (*it)->damages.end(); ++d)
|
for (vector<Damage>::iterator d = (*it)->damages.begin(); d != (*it)->damages.end(); ++d)
|
||||||
stack->Add(NEW Damage(*d));
|
stack->Add(NEW Damage(*d));
|
||||||
|
|||||||
@@ -1,56 +0,0 @@
|
|||||||
#include "GuiMessageBox.h"
|
|
||||||
|
|
||||||
bool GuiMessageBox::CheckUserInput(JButton key)
|
|
||||||
{
|
|
||||||
if (mActionButton == key)
|
|
||||||
{
|
|
||||||
if (mObjects[mCurr] != NULL && mObjects[mCurr]->ButtonPressed())
|
|
||||||
{
|
|
||||||
if (mListener != NULL)
|
|
||||||
{
|
|
||||||
mListener->ButtonPressed(mId, mObjects[mCurr]->GetId());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((PSP_CTRL_LEFT == key) || (PSP_CTRL_UP == key)) // || mEngine->GetAnalogY()<64)
|
|
||||||
{
|
|
||||||
int n = mCurr;
|
|
||||||
n--;
|
|
||||||
if (n < 0)
|
|
||||||
{
|
|
||||||
if ((mStyle & JGUI_STYLE_WRAPPING))
|
|
||||||
n = mCount - 1;
|
|
||||||
else
|
|
||||||
n = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (n != mCurr && mObjects[mCurr] != NULL && mObjects[mCurr]->Leaving(PSP_CTRL_UP))
|
|
||||||
{
|
|
||||||
mCurr = n;
|
|
||||||
mObjects[mCurr]->Entering();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if ((PSP_CTRL_RIGHT == key) || (PSP_CTRL_DOWN == key)) // || mEngine->GetAnalogY()>192)
|
|
||||||
{
|
|
||||||
int n = mCurr;
|
|
||||||
n++;
|
|
||||||
if (n > mCount - 1)
|
|
||||||
{
|
|
||||||
if ((mStyle & JGUI_STYLE_WRAPPING))
|
|
||||||
n = 0;
|
|
||||||
else
|
|
||||||
n = mCount - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (n != mCurr && mObjects[mCurr] != NULL && mObjects[mCurr]->Leaving(PSP_CTRL_DOWN))
|
|
||||||
{
|
|
||||||
mCurr = n;
|
|
||||||
mObjects[mCurr]->Entering();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
@@ -4477,7 +4477,7 @@ Player * MTGAbility::getPlayerFromDamageable(Damageable * target)
|
|||||||
if (!target)
|
if (!target)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (target->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE)
|
if (target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE)
|
||||||
return ((MTGCardInstance *) target)->controller();
|
return ((MTGCardInstance *) target)->controller();
|
||||||
|
|
||||||
return (Player *) target;
|
return (Player *) target;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ void MTGGamePhase::Update(float)
|
|||||||
int newState = observer->getCurrentGamePhase();
|
int newState = observer->getCurrentGamePhase();
|
||||||
if (newState != currentState)
|
if (newState != currentState)
|
||||||
{
|
{
|
||||||
activeState = ACTIVE;
|
activity = Active;
|
||||||
animation = 4;
|
animation = 4;
|
||||||
currentState = newState;
|
currentState = newState;
|
||||||
}
|
}
|
||||||
@@ -28,18 +28,18 @@ void MTGGamePhase::Update(float)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
activeState = INACTIVE;
|
activity = Inactive;
|
||||||
animation = 0;
|
animation = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MTGGamePhase::NextGamePhase()
|
bool MTGGamePhase::NextGamePhase()
|
||||||
{
|
{
|
||||||
if (activeState == INACTIVE)
|
if (activity == Inactive)
|
||||||
{
|
{
|
||||||
if (observer->currentActionPlayer == observer->currentlyActing())
|
if (observer->currentActionPlayer == observer->currentlyActing())
|
||||||
{
|
{
|
||||||
activeState = ACTIVE;
|
activity = Active;
|
||||||
observer->userRequestNextGamePhase();
|
observer->userRequestNextGamePhase();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2700,7 +2700,7 @@ int MTGDeathtouchRule::receiveEvent(WEvent * event)
|
|||||||
if (!card)
|
if (!card)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (d->target->type_as_damageable != DAMAGEABLE_MTGCARDINSTANCE)
|
if (d->target->type_as_damageable != Damageable::DAMAGEABLE_MTGCARDINSTANCE)
|
||||||
return 0;
|
return 0;
|
||||||
MTGCardInstance * _target = (MTGCardInstance *) (d->target);
|
MTGCardInstance * _target = (MTGCardInstance *) (d->target);
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
#include "MTGSpellStack.h"
|
|
||||||
|
|
||||||
MTGSpellStack::MTGSpellStack()
|
|
||||||
{
|
|
||||||
cursor = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MTGSpellStack::addSpell(Ability * ability)
|
|
||||||
{
|
|
||||||
cursor++;
|
|
||||||
spellStack[cursor] ability;
|
|
||||||
}
|
|
||||||
|
|
||||||
int MTGSpellStack::resolve()
|
|
||||||
{
|
|
||||||
if (cursor < 0)
|
|
||||||
return 0;
|
|
||||||
int result = cursor;
|
|
||||||
cursor--;
|
|
||||||
(spellStack[cursor + 1])->resolve();
|
|
||||||
return (result + 1);
|
|
||||||
}
|
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
#include "AllAbilities.h"
|
#include "AllAbilities.h"
|
||||||
|
|
||||||
REDamagePrevention::REDamagePrevention(MTGAbility * source, TargetChooser *tcSource, TargetChooser *tcTarget, int damage,
|
REDamagePrevention::REDamagePrevention(MTGAbility * source, TargetChooser *tcSource, TargetChooser *tcTarget, int damage,
|
||||||
bool oneShot, int typeOfDamage) :
|
bool oneShot, Damage::DamageType typeOfDamage) :
|
||||||
source(source), tcSource(tcSource), tcTarget(tcTarget), damage(damage), oneShot(oneShot), typeOfDamage(typeOfDamage)
|
source(source), tcSource(tcSource), tcTarget(tcTarget), damage(damage), oneShot(oneShot), typeOfDamage(typeOfDamage)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -18,7 +18,7 @@ WEvent * REDamagePrevention::replace(WEvent *event)
|
|||||||
WEventDamage * e = dynamic_cast<WEventDamage*> (event);
|
WEventDamage * e = dynamic_cast<WEventDamage*> (event);
|
||||||
if (!e) return event;
|
if (!e) return event;
|
||||||
Damage *d = e->damage;
|
Damage *d = e->damage;
|
||||||
if (d->typeOfDamage != typeOfDamage && typeOfDamage != DAMAGE_ALL_TYPES) return event;
|
if (d->typeOfDamage != typeOfDamage && typeOfDamage != Damage::DAMAGE_ALL_TYPES) return event;
|
||||||
if ((!tcSource || tcSource->canTarget(d->source)) && (!tcTarget || tcTarget->canTarget(d->target)))
|
if ((!tcSource || tcSource->canTarget(d->source)) && (!tcTarget || tcTarget->canTarget(d->target)))
|
||||||
{
|
{
|
||||||
if (damage == -1)
|
if (damage == -1)
|
||||||
|
|||||||
@@ -294,13 +294,13 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
|||||||
string attribute;
|
string attribute;
|
||||||
if (found2 != string::npos)
|
if (found2 != string::npos)
|
||||||
{
|
{
|
||||||
cd->mode = CD_OR;
|
cd->mode = CardDescriptor::CD_OR;
|
||||||
attribute = attributes.substr(0, found2);
|
attribute = attributes.substr(0, found2);
|
||||||
attributes = attributes.substr(found2 + 1);
|
attributes = attributes.substr(found2 + 1);
|
||||||
}
|
}
|
||||||
else if (foundAnd != string::npos)
|
else if (foundAnd != string::npos)
|
||||||
{
|
{
|
||||||
cd->mode = CD_AND;
|
cd->mode = CardDescriptor::CD_AND;
|
||||||
attribute = attributes.substr(0, foundAnd);
|
attribute = attributes.substr(0, foundAnd);
|
||||||
attributes = attributes.substr(foundAnd + 1);
|
attributes = attributes.substr(foundAnd + 1);
|
||||||
}
|
}
|
||||||
@@ -550,7 +550,7 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
|||||||
else
|
else
|
||||||
cd->colors = card->colors;
|
cd->colors = card->colors;
|
||||||
|
|
||||||
cd->mode = CD_OR;
|
cd->mode = CardDescriptor::CD_OR;
|
||||||
}
|
}
|
||||||
else if( CDtype.find("types") != string::npos )
|
else if( CDtype.find("types") != string::npos )
|
||||||
{
|
{
|
||||||
@@ -572,7 +572,7 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
|||||||
cd->removeType("creature");
|
cd->removeType("creature");
|
||||||
cd->removeType("planeswalker");
|
cd->removeType("planeswalker");
|
||||||
cd->removeType("tribal");
|
cd->removeType("tribal");
|
||||||
cd->mode = CD_OR;
|
cd->mode = CardDescriptor::CD_OR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (attribute.find("counter") != string::npos)
|
else if (attribute.find("counter") != string::npos)
|
||||||
@@ -629,7 +629,7 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
|||||||
{
|
{
|
||||||
cd->SetExclusionColor(cid);
|
cd->SetExclusionColor(cid);
|
||||||
}
|
}
|
||||||
cd->mode = CD_OR;
|
cd->mode = CardDescriptor::CD_OR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attribute.find("chosencolor") != string::npos)
|
if (attribute.find("chosencolor") != string::npos)
|
||||||
@@ -685,7 +685,7 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (nbminuses)
|
if (nbminuses)
|
||||||
cd->mode = CD_AND;
|
cd->mode = CardDescriptor::CD_AND;
|
||||||
typeName = typeName.substr(0, found);
|
typeName = typeName.substr(0, found);
|
||||||
}
|
}
|
||||||
if (cd)
|
if (cd)
|
||||||
|
|||||||
@@ -433,6 +433,15 @@ void TestSuiteGame::assertGame()
|
|||||||
Log("<span class=\"success\">==Test Succesful !==</span>");
|
Log("<span class=\"success\">==Test Succesful !==</span>");
|
||||||
else
|
else
|
||||||
Log("<span class=\"error\">==Test Failed !==</span>");
|
Log("<span class=\"error\">==Test Failed !==</span>");
|
||||||
|
#ifdef CAPTURE_STDERR
|
||||||
|
if (error)
|
||||||
|
{
|
||||||
|
OutputCapturer::debugAndClear();
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
OutputCapturer::clear();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
mMutex.unlock();
|
mMutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -585,6 +594,9 @@ void TestSuite::ThreadProc(void* inParam)
|
|||||||
{
|
{
|
||||||
LOG("Entering TestSuite::ThreadProc");
|
LOG("Entering TestSuite::ThreadProc");
|
||||||
TestSuite* instance = reinterpret_cast<TestSuite*>(inParam);
|
TestSuite* instance = reinterpret_cast<TestSuite*>(inParam);
|
||||||
|
#ifdef CAPTURE_STDERR
|
||||||
|
OutputCapturer::debugAndClear();
|
||||||
|
#endif
|
||||||
if (instance)
|
if (instance)
|
||||||
{
|
{
|
||||||
string filename;
|
string filename;
|
||||||
|
|||||||
@@ -455,7 +455,6 @@
|
|||||||
<ClInclude Include="include\CacheEngine.h" />
|
<ClInclude Include="include\CacheEngine.h" />
|
||||||
<ClInclude Include="include\CardDescriptor.h" />
|
<ClInclude Include="include\CardDescriptor.h" />
|
||||||
<ClInclude Include="include\CardDisplay.h" />
|
<ClInclude Include="include\CardDisplay.h" />
|
||||||
<ClInclude Include="include\CardEffect.h" />
|
|
||||||
<ClInclude Include="include\CardGui.h" />
|
<ClInclude Include="include\CardGui.h" />
|
||||||
<ClInclude Include="include\CardPrimitive.h" />
|
<ClInclude Include="include\CardPrimitive.h" />
|
||||||
<ClInclude Include="include\CardSelector.h" />
|
<ClInclude Include="include\CardSelector.h" />
|
||||||
@@ -517,7 +516,6 @@
|
|||||||
<ClInclude Include="include\NetworkPlayer.h" />
|
<ClInclude Include="include\NetworkPlayer.h" />
|
||||||
<ClInclude Include="include\ObjectAnalytics.h" />
|
<ClInclude Include="include\ObjectAnalytics.h" />
|
||||||
<ClInclude Include="include\OptionItem.h" />
|
<ClInclude Include="include\OptionItem.h" />
|
||||||
<ClInclude Include="include\OSD.h" />
|
|
||||||
<ClInclude Include="include\PhaseRing.h" />
|
<ClInclude Include="include\PhaseRing.h" />
|
||||||
<ClInclude Include="include\Player.h" />
|
<ClInclude Include="include\Player.h" />
|
||||||
<ClInclude Include="include\PlayerData.h" />
|
<ClInclude Include="include\PlayerData.h" />
|
||||||
|
|||||||
@@ -363,9 +363,6 @@
|
|||||||
<ClInclude Include="include\CardDisplay.h">
|
<ClInclude Include="include\CardDisplay.h">
|
||||||
<Filter>inc</Filter>
|
<Filter>inc</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\CardEffect.h">
|
|
||||||
<Filter>inc</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="include\CardGui.h">
|
<ClInclude Include="include\CardGui.h">
|
||||||
<Filter>inc</Filter>
|
<Filter>inc</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@@ -528,9 +525,6 @@
|
|||||||
<ClInclude Include="include\OptionItem.h">
|
<ClInclude Include="include\OptionItem.h">
|
||||||
<Filter>inc</Filter>
|
<Filter>inc</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\OSD.h">
|
|
||||||
<Filter>inc</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="include\PhaseRing.h">
|
<ClInclude Include="include\PhaseRing.h">
|
||||||
<Filter>inc</Filter>
|
<Filter>inc</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|||||||
@@ -89,7 +89,6 @@ SOURCES += \
|
|||||||
src/AllAbilities.cpp\
|
src/AllAbilities.cpp\
|
||||||
src/CardDescriptor.cpp\
|
src/CardDescriptor.cpp\
|
||||||
src/CardDisplay.cpp\
|
src/CardDisplay.cpp\
|
||||||
src/CardEffect.cpp\
|
|
||||||
src/CardGui.cpp\
|
src/CardGui.cpp\
|
||||||
src/CardPrimitive.cpp\
|
src/CardPrimitive.cpp\
|
||||||
src/CardSelector.cpp\
|
src/CardSelector.cpp\
|
||||||
@@ -243,7 +242,6 @@ HEADERS += \
|
|||||||
include/GameStateShop.h\
|
include/GameStateShop.h\
|
||||||
include/MTGPack.h\
|
include/MTGPack.h\
|
||||||
include/TextScroller.h\
|
include/TextScroller.h\
|
||||||
include/CardEffect.h\
|
|
||||||
include/GameStateStory.h\
|
include/GameStateStory.h\
|
||||||
include/MTGRules.h\
|
include/MTGRules.h\
|
||||||
include/ThisDescriptor.h\
|
include/ThisDescriptor.h\
|
||||||
@@ -254,7 +252,6 @@ HEADERS += \
|
|||||||
include/Token.h\
|
include/Token.h\
|
||||||
include/CardPrimitive.h\
|
include/CardPrimitive.h\
|
||||||
include/GuiAvatars.h\
|
include/GuiAvatars.h\
|
||||||
include/OSD.h\
|
|
||||||
include/Translate.h\
|
include/Translate.h\
|
||||||
include/CardSelector.h\
|
include/CardSelector.h\
|
||||||
include/GuiBackground.h\
|
include/GuiBackground.h\
|
||||||
@@ -327,6 +324,7 @@ SOURCES += \
|
|||||||
../../JGE/src/pc/JSocket.cpp\
|
../../JGE/src/pc/JSocket.cpp\
|
||||||
../../JGE/src/JNetwork.cpp\
|
../../JGE/src/JNetwork.cpp\
|
||||||
../../JGE/src/JSprite.cpp\
|
../../JGE/src/JSprite.cpp\
|
||||||
|
../../JGE/src/OutputCapturer.cpp\
|
||||||
../../JGE/src/Vector2D.cpp\
|
../../JGE/src/Vector2D.cpp\
|
||||||
../../JGE/src/tinyxml/tinystr.cpp\
|
../../JGE/src/tinyxml/tinystr.cpp\
|
||||||
../../JGE/src/tinyxml/tinyxml.cpp\
|
../../JGE/src/tinyxml/tinyxml.cpp\
|
||||||
@@ -395,6 +393,7 @@ HEADERS += \
|
|||||||
../../JGE/include/JSpline.h\
|
../../JGE/include/JSpline.h\
|
||||||
../../JGE/include/JSprite.h\
|
../../JGE/include/JSprite.h\
|
||||||
../../JGE/include/JTypes.h\
|
../../JGE/include/JTypes.h\
|
||||||
|
../../JGE/include/OutputCapturer.h\
|
||||||
../../JGE/include/Vector2D.h\
|
../../JGE/include/Vector2D.h\
|
||||||
../../JGE/include/Vector3D.h\
|
../../JGE/include/Vector3D.h\
|
||||||
../../JGE/include/vram.h\
|
../../JGE/include/vram.h\
|
||||||
|
|||||||
+1
-1
@@ -10,7 +10,7 @@ make -j 8
|
|||||||
|
|
||||||
# let's try an Intel linux binary
|
# let's try an Intel linux binary
|
||||||
cd ../..
|
cd ../..
|
||||||
qmake projects/mtg/wagic-qt.pro CONFIG+=console CONFIG+=debug
|
qmake projects/mtg/wagic-qt.pro CONFIG+=console CONFIG+=debug DEFINES+=CAPTURE_STDERR
|
||||||
make -j 8
|
make -j 8
|
||||||
|
|
||||||
# and finish by running the testsuite
|
# and finish by running the testsuite
|
||||||
|
|||||||
Reference in New Issue
Block a user