Merge branch 'master' into minmax

This commit is contained in:
xawotihs
2013-11-30 23:10:24 +01:00
114 changed files with 1110 additions and 973 deletions
+16 -1
View File
@@ -1,2 +1,17 @@
language: cpp language: cpp
script: "qmake projects/mtg/wagic-qt.pro CONFIG+=console CONFIG+=debug && make -j 8 && ./wagic" before_install:
- export PSPDEV="$TRAVIS_BUILD_DIR/opt/pspsdk"
- export PSPSDK="$PSPDEV/psp/sdk"
- export PATH="$PATH:$PSPDEV/bin:$PSPSDK/bin"
- export ANDROID="android-sdk-linux/tools/android"
install:
- sudo apt-get update -qq
- if [ `uname -m` = x86_64 ]; then sudo apt-get install -qq --force-yes libgd2-xpm ia32-libs ia32-libs-multiarch; fi
- wget -O sdk.lzma http://sourceforge.net/projects/minpspw/files/SDK%20%2B%20devpak/pspsdk%200.11.2/minpspw_0.11.2-amd64.tar.lzma/download
- tar -x --xz -f sdk.lzma
- wget http://dl.google.com/android/ndk/android-ndk-r9-linux-x86_64.tar.bz2 -nv
- wget http://dl.google.com/android/android-sdk_r22-linux.tgz -nv
- tar --absolute-names -jxf android-ndk-r9-linux-x86_64.tar.bz2
- tar -zxf android-sdk_r22-linux.tgz
- echo yes | $ANDROID update sdk --filter 1,2,3,8 --no-ui --force > log.txt
script: "./travis-script.sh"
+3 -3
View File
@@ -73,7 +73,7 @@
<Optimization>MaxSpeed</Optimization> <Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>src/zipFS;Dependencies/SDL/include;Dependencies/include;$(JGEEXTRAS);../Boost;../projects/mtg/include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>src/zipFS;Dependencies/SDL/include;Dependencies/include;$(JGEEXTRAS);../Boost;../projects/mtg/include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>SDL_CONFIG;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>TIXML_USE_STL; SDL_CONFIG;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
@@ -101,7 +101,7 @@
<ClCompile> <ClCompile>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>src/zipFS;Dependencies/SDL/include;Dependencies/include;$(JGEEXTRAS);../Boost;../projects/mtg/include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>src/zipFS;Dependencies/SDL/include;Dependencies/include;$(JGEEXTRAS);../Boost;../projects/mtg/include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>SDL_CONFIG;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>TIXML_USE_STL; SDL_CONFIG;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader> <PrecompiledHeader>
@@ -129,7 +129,7 @@
<Optimization>Full</Optimization> <Optimization>Full</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>src/zipFS;Dependencies/SDL/include;Dependencies/include;$(JGEEXTRAS);../Boost;../projects/mtg/include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>src/zipFS;Dependencies/SDL/include;Dependencies/include;$(JGEEXTRAS);../Boost;../projects/mtg/include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>SDL_CONFIG;WIN32;NDEBUG;_LIB;_SECURE_SCL=0;_HAS_ITERATOR_DEBBUGING=0;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>TIXML_USE_STL; SDL_CONFIG;WIN32;NDEBUG;_LIB;_SECURE_SCL=0;_HAS_ITERATOR_DEBBUGING=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
+1
View File
@@ -31,6 +31,7 @@ HGE_OBJS = src/hge/hgecolor.o src/hge/hgeparticle.o \
CXXFLAGS = -W -Wall -Werror -Wno-unused CXXFLAGS = -W -Wall -Werror -Wno-unused
CXXFLAGS += -DTIXML_USE_STL
ifdef DEBUG ifdef DEBUG
CXXFLAGS += -ggdb3 CXXFLAGS += -ggdb3
+13
View File
@@ -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) \
{ \
std::ostringstream stream; \
stream << inString; \
OutputCapturer::add(stream.str()); \
}
#else // CAPTURE_STDERR
#define DebugTrace(inString) \ #define DebugTrace(inString) \
{ \ { \
std::ostringstream stream; \ std::ostringstream stream; \
stream << inString; \ stream << inString; \
qDebug("%s", stream.str().c_str()); \ 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) \
+11
View File
@@ -44,6 +44,17 @@ typedef WPARAM LocalKeySym;
#include <X11/keysym.h> #include <X11/keysym.h>
typedef KeySym LocalKeySym; typedef KeySym LocalKeySym;
#define LOCAL_KEY_NONE XK_VoidSymbol #define LOCAL_KEY_NONE XK_VoidSymbol
#undef Status
#undef Bool
#undef None
#undef CursorShape
#undef KeyPress
#undef KeyRelease
#undef FocusIn
#undef FocusOut
#undef FontChange
#undef Unsorted
#undef GrayScale
#elif defined(ANDROID) // This is temporary until we understand how to send real key events from Java #elif defined(ANDROID) // This is temporary until we understand how to send real key events from Java
typedef long unsigned int LocalKeySym; typedef long unsigned int LocalKeySym;
+3 -4
View File
@@ -124,8 +124,9 @@ typedef uint32_t u32;
#define PIXEL_TYPE DWORD #define PIXEL_TYPE DWORD
#define ARGB(a, r, g, b) ((PIXEL_TYPE)((a) << 24) | ((r) << 16) | ((g) << 8) | (b)) #define ARGB(a, r, g, b) ((PIXEL_TYPE)((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
#define RGBA(r, g, b, a) ((PIXEL_TYPE)((a) << 24) | ((b) << 16) | ((g) << 8) | (r)) #define RGBA(r, g, b, a) ((PIXEL_TYPE)((a) << 24) | ((b) << 16) | ((g) << 8) | (r))
#ifndef PSP
#define TEXTURE_FORMAT 0 #define TEXTURE_FORMAT 0
#endif //PSP
#ifndef CONSOLE_CONFIG #ifndef CONSOLE_CONFIG
@@ -143,7 +144,7 @@ typedef uint32_t u32;
#include <GL/glu.h> #include <GL/glu.h>
#endif #endif
#else #else
# include <QtOpenGL> #include <QtOpenGL>
#endif #endif
#if (defined FORCE_GLES) #if (defined FORCE_GLES)
@@ -157,14 +158,12 @@ typedef uint32_t u32;
#endif #endif
#if defined (PSP) #if defined (PSP)
#ifndef ABGR8888 #ifndef ABGR8888
#define ABGR8888 #define ABGR8888
#endif #endif
#if defined (ABGR8888) #if defined (ABGR8888)
#define PIXEL_TYPE u32
#ifndef ARGB #ifndef ARGB
#define ARGB(a, r, g, b) (PIXEL_TYPE)((a << 24) | (b << 16) | (g << 8) | r) // macro to assemble pixels in correct format #define ARGB(a, r, g, b) (PIXEL_TYPE)((a << 24) | (b << 16) | (g << 8) | r) // macro to assemble pixels in correct format
#endif #endif
+23
View File
@@ -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
-1
View File
@@ -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
+1 -10
View File
@@ -3,15 +3,6 @@
#include <math.h> #include <math.h>
/*************************** Macros and constants ***************************/
// returns a number ranging from -1.0 to 1.0
#define FRAND (((float)rand()-(float)rand())/RAND_MAX)
#define Clamp(x, min, max) x = (x<min ? min : x<max ? x : max);
#define SQUARE(x) (x)*(x)
struct Vector3D struct Vector3D
{ {
Vector3D(float x, float y, float z) : x(x), y(y), z(z) {} Vector3D(float x, float y, float z) : x(x), y(y), z(z) {}
@@ -63,7 +54,7 @@ struct Vector3D
float Length() float Length()
{ {
float length = (float)sqrt(SQUARE(x) + SQUARE(y) + SQUARE(z)); float length = sqrt(x*x + y*y + z*z);
return (length != 0.0f) ? length : 1.0f; return (length != 0.0f) ? length : 1.0f;
} }
+3 -3
View File
@@ -67,7 +67,7 @@ bool JAnimator::Load(const char* scriptFile)
element = script->ToElement(); element = script->ToElement();
printf("---- Loading %s:%s\n", element->Value(), element->Attribute("name")); printf("---- Loading %s:%s\n", element->Value(), element->Attribute("name"));
const char *type[] = string type[] =
{ {
"ANIMATION_TYPE_LOOPING", "ANIMATION_TYPE_LOOPING",
"ANIMATION_TYPE_ONCE_AND_STAY", "ANIMATION_TYPE_ONCE_AND_STAY",
@@ -78,7 +78,7 @@ bool JAnimator::Load(const char* scriptFile)
const char* aniType = element->Attribute("type"); const char* aniType = element->Attribute("type");
for (int i=0;i<5;i++) for (int i=0;i<5;i++)
if (strcmp(type[i], aniType)==0) if (type[i] == aniType)
{ {
SetAnimationType(i); SetAnimationType(i);
break; break;
@@ -108,7 +108,7 @@ bool JAnimator::Load(const char* scriptFile)
element = param->ToElement(); element = param->ToElement();
if (element != NULL) if (element != NULL)
{ {
if (strcmp(element->Value(), "settings")==0) if (element->ValueStr() == "settings")
{ {
const char* quadName = element->Attribute("quad"); const char* quadName = element->Attribute("quad");
JQuad* quad = mResource->GetQuad(quadName); JQuad* quad = mResource->GetQuad(quadName);
+2
View File
@@ -16,7 +16,9 @@ User folder is the only one that is really needed to guarantee both read and wri
The content that users should not be touching. The content that users should not be touching.
*/ */
#ifndef PSP
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#endif //PSP
#ifdef WIN32 #ifdef WIN32
#pragma warning(disable : 4786) #pragma warning(disable : 4786)
+1 -3
View File
@@ -65,7 +65,7 @@ void JQuad::SetHotSpot(float x, float y)
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
JTexture::JTexture() : mBuffer(NULL) JTexture::JTexture() : mWidth(0), mHeight(0), mBuffer(NULL)
{ {
mTexId = -1; mTexId = -1;
} }
@@ -305,14 +305,12 @@ void JRenderer::TransferTextureToGLContext(JTexture& inTexture)
JTexture* JRenderer::CreateTexture(int width, int height, int mode __attribute__((unused))) JTexture* JRenderer::CreateTexture(int width, int height, int mode __attribute__((unused)))
{ {
JTexture *tex = new JTexture(); JTexture *tex = new JTexture();
return tex; return tex;
} }
JTexture* JRenderer::LoadTexture(const char* filename, int mode, int textureFormat) JTexture* JRenderer::LoadTexture(const char* filename, int mode, int textureFormat)
{ {
JTexture *tex = new JTexture(); JTexture *tex = new JTexture();
return tex; return tex;
} }
+4 -4
View File
@@ -89,16 +89,16 @@ bool JOBJModel::Load(const char *modelName, const char *textureName)
if (count == 4) if (count == 4)
{ {
if (strcmp(s1, "vn") == 0) if (string("vn") == s1)
normalList.push_back(vert); normalList.push_back(vert);
else if (strcmp(s1, "vt") == 0) else if (string("vt") == s1)
texList.push_back(vert); texList.push_back(vert);
else if (strcmp(s1, "v") == 0) else if (string("v") == s1)
vertList.push_back(vert); vertList.push_back(vert);
} }
else if (count == 3) else if (count == 3)
{ {
if (strcmp(s1, "vt") == 0) if (string("vt") == s1)
texList.push_back(vert); texList.push_back(vert);
} }
+16 -16
View File
@@ -90,7 +90,7 @@ bool JParticleEffect::Load(const char* filename)
// FIELD_COUNT // FIELD_COUNT
// }; // };
const char* lifeValues[] = const string lifeValues[] =
{ {
"speed", "speed",
"size", "size",
@@ -104,7 +104,7 @@ bool JParticleEffect::Load(const char* filename)
"gravity" "gravity"
}; };
const char* typeNames[] = const string typeNames[] =
{ {
"POINT", "POINT",
"AREA", "AREA",
@@ -113,7 +113,7 @@ bool JParticleEffect::Load(const char* filename)
"CIRCLE" "CIRCLE"
}; };
const char* modeNames[] = const string modeNames[] =
{ {
"REPEAT", "REPEAT",
"ONCE", "ONCE",
@@ -149,32 +149,32 @@ bool JParticleEffect::Load(const char* filename)
{ {
element = param->ToElement(); element = param->ToElement();
if (strcmp(element->Attribute("name"), "settings")==0) if (string("settings") == element->Attribute("name"))
{ {
if (strcmp(element->Attribute("blend"), "NORMAL")==0) if (string("NORMAL") == element->Attribute("blend"))
mParticleEmitters[mEmitterCount]->SetBlending(BLEND_SRC_ALPHA, BLEND_ONE_MINUS_SRC_ALPHA); mParticleEmitters[mEmitterCount]->SetBlending(BLEND_SRC_ALPHA, BLEND_ONE_MINUS_SRC_ALPHA);
else if (strcmp(element->Attribute("blend"), "ADDITIVE")==0) else if (string("ADDITIVE") == element->Attribute("blend"))
mParticleEmitters[mEmitterCount]->SetBlending(BLEND_SRC_ALPHA, BLEND_ONE); mParticleEmitters[mEmitterCount]->SetBlending(BLEND_SRC_ALPHA, BLEND_ONE);
for (unsigned int i=0;i<sizeof(modeNames)/sizeof(char*);i++) for (unsigned int i=0;i<sizeof(modeNames)/sizeof(char*);i++)
{ {
if (strcmp(element->Attribute("mode"), modeNames[i])==0) if (modeNames[i] == element->Attribute("mode"))
{ {
mParticleEmitters[mEmitterCount]->mEmitterMode = i; mParticleEmitters[mEmitterCount]->mEmitterMode = i;
#if defined (_DEBUG) #if defined (_DEBUG)
printf("emitter mode:%s\n", modeNames[i]); printf("emitter mode:%s\n", modeNames[i].c_str());
#endif #endif
break; break;
} }
} }
for (unsigned i=0;i<sizeof(typeNames)/sizeof(char*);i++) for (unsigned i=0;i<sizeof(typeNames)/sizeof(char*);i++)
{ {
if (strcmp(element->Attribute("type"), typeNames[i])==0) if (typeNames[i] == element->Attribute("type"))
{ {
mParticleEmitters[mEmitterCount]->mType = i; mParticleEmitters[mEmitterCount]->mType = i;
#if defined (_DEBUG) #if defined (_DEBUG)
printf("emitter type:%s\n", typeNames[i]); printf("emitter type:%s\n", typeNames[i].c_str());
#endif #endif
break; break;
} }
@@ -213,7 +213,7 @@ bool JParticleEffect::Load(const char* filename)
} }
} }
else if (strcmp(element->Attribute("name"), "quantity")==0) else if (string("quantity") == element->Attribute("name"))
{ {
for (key = param->FirstChild(); key; key = key->NextSibling()) for (key = param->FirstChild(); key; key = key->NextSibling())
{ {
@@ -227,7 +227,7 @@ bool JParticleEffect::Load(const char* filename)
} }
} }
else if (strcmp(element->Attribute("name"), "lifex")==0) else if (string("lifex") == element->Attribute("name"))
{ {
if (element->QueryFloatAttribute("base", &baseValue) == TIXML_SUCCESS && if (element->QueryFloatAttribute("base", &baseValue) == TIXML_SUCCESS &&
element->QueryFloatAttribute("max", &value) == TIXML_SUCCESS) element->QueryFloatAttribute("max", &value) == TIXML_SUCCESS)
@@ -236,7 +236,7 @@ bool JParticleEffect::Load(const char* filename)
mParticleEmitters[mEmitterCount]->mLifeMax= value; mParticleEmitters[mEmitterCount]->mLifeMax= value;
} }
} }
else if (strcmp(element->Attribute("name"), "anglex")==0) else if (string("anglex") == element->Attribute("name"))
{ {
if (element->QueryFloatAttribute("base", &baseValue) == TIXML_SUCCESS && if (element->QueryFloatAttribute("base", &baseValue) == TIXML_SUCCESS &&
element->QueryFloatAttribute("max", &value) == TIXML_SUCCESS) element->QueryFloatAttribute("max", &value) == TIXML_SUCCESS)
@@ -245,7 +245,7 @@ bool JParticleEffect::Load(const char* filename)
mParticleEmitters[mEmitterCount]->mAngleMax= value*DEG2RAD; mParticleEmitters[mEmitterCount]->mAngleMax= value*DEG2RAD;
} }
} }
else if (strcmp(element->Attribute("name"), "speedx")==0) else if (string("speedx") == element->Attribute("name"))
{ {
if (element->QueryFloatAttribute("base", &baseValue) == TIXML_SUCCESS && if (element->QueryFloatAttribute("base", &baseValue) == TIXML_SUCCESS &&
element->QueryFloatAttribute("max", &value) == TIXML_SUCCESS) element->QueryFloatAttribute("max", &value) == TIXML_SUCCESS)
@@ -254,7 +254,7 @@ bool JParticleEffect::Load(const char* filename)
mParticleEmitters[mEmitterCount]->mSpeedMax= value; mParticleEmitters[mEmitterCount]->mSpeedMax= value;
} }
} }
else if (strcmp(element->Attribute("name"), "sizex")==0) else if (string("sizex") == element->Attribute("name"))
{ {
if (element->QueryFloatAttribute("base", &baseValue) == TIXML_SUCCESS && if (element->QueryFloatAttribute("base", &baseValue) == TIXML_SUCCESS &&
element->QueryFloatAttribute("max", &value) == TIXML_SUCCESS) element->QueryFloatAttribute("max", &value) == TIXML_SUCCESS)
@@ -267,7 +267,7 @@ bool JParticleEffect::Load(const char* filename)
{ {
for (int i=0;i<FIELD_COUNT;i++) for (int i=0;i<FIELD_COUNT;i++)
{ {
if (strcmp(element->Attribute("name"), lifeValues[i])==0) if (lifeValues[i] == element->Attribute("name"))
{ {
for (key = param->FirstChild(); key; key = key->NextSibling()) for (key = param->FirstChild(); key; key = key->NextSibling())
{ {
+3 -3
View File
@@ -119,11 +119,11 @@ bool JResourceManager::LoadResource(const string& resourceName)
element = node->ToElement(); element = node->ToElement();
if (element != NULL) if (element != NULL)
{ {
if (strcmp(element->Value(), "texture")==0) if (element->ValueStr() == "texture")
{ {
CreateTexture(element->Attribute("name")); CreateTexture(element->Attribute("name"));
} }
else if (strcmp(element->Value(), "quad")==0) else if (element->ValueStr() == "quad")
{ {
string quadName = element->Attribute("name"); string quadName = element->Attribute("name");
string textureName = element->Attribute("texture"); string textureName = element->Attribute("texture");
@@ -170,7 +170,7 @@ bool JResourceManager::LoadResource(const string& resourceName)
GetQuad(id)->SetHotSpot(hotspotX, hotspotY); GetQuad(id)->SetHotSpot(hotspotX, hotspotY);
} }
} }
else if (strcmp(element->Value(), "font")==0) else if (element->ValueStr() == "font")
{ {
} }
+22
View File
@@ -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("");
}
+5 -1
View File
@@ -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 -1
View File
@@ -69,7 +69,7 @@ int main(int argc, char* argv[])
#endif //QT_WIDGET #endif //QT_WIDGET
if(argc >= 2 && strcmp(argv[1], "testsuite")==0) if(argc >= 2 && string(argv[1]) == "testsuite")
{ {
int result = 0; int result = 0;
result += WagicCore::runTestSuite(); result += WagicCore::runTestSuite();
+1 -1
View File
@@ -343,7 +343,7 @@ void JQuad::SetHotSpot(float x, float y)
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
JTexture::JTexture() : mBuffer(NULL) JTexture::JTexture() : mWidth(0), mHeight(0), mBuffer(NULL)
{ {
mTexId = -1; mTexId = -1;
} }
+1
View File
@@ -1,2 +1,3 @@
/gen /gen
/bin
+1 -1
View File
@@ -14,5 +14,5 @@
<activity android:configChanges="keyboard|keyboardHidden|orientation" android:name="com.google.ads.AdActivity" android:screenOrientation="sensorLandscape"/> <activity android:configChanges="keyboard|keyboardHidden|orientation" android:name="com.google.ads.AdActivity" android:screenOrientation="sensorLandscape"/>
</application> </application>
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="9"/> <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="10"/>
</manifest> </manifest>
-10
View File
@@ -1,10 +0,0 @@
/Volumes/data/home/mnguyen/Projects/eclipse-workspace/wagic/projects/mtg/Android/gen/net/wagic/app/R.java \
: /Volumes/data/home/mnguyen/Projects/eclipse-workspace/wagic/projects/mtg/Android/res/drawable-hdpi/icon.png \
/Volumes/data/home/mnguyen/Projects/eclipse-workspace/wagic/projects/mtg/Android/res/drawable-ldpi/icon.png \
/Volumes/data/home/mnguyen/Projects/eclipse-workspace/wagic/projects/mtg/Android/res/drawable-mdpi/icon.png \
/Volumes/data/home/mnguyen/Projects/eclipse-workspace/wagic/projects/mtg/Android/res/layout/main.xml \
/Volumes/data/home/mnguyen/Projects/eclipse-workspace/wagic/projects/mtg/Android/res/values/strings.xml \
/Volumes/data/home/mnguyen/Projects/eclipse-workspace/wagic/projects/mtg/Android/bin/res/drawable-hdpi/icon.png \
/Volumes/data/home/mnguyen/Projects/eclipse-workspace/wagic/projects/mtg/Android/bin/res/drawable-ldpi/icon.png \
/Volumes/data/home/mnguyen/Projects/eclipse-workspace/wagic/projects/mtg/Android/bin/res/drawable-mdpi/icon.png \
/Volumes/data/home/mnguyen/Projects/eclipse-workspace/wagic/projects/mtg/Android/bin/AndroidManifest.xml \
@@ -1,6 +0,0 @@
/** Automatically generated file. DO NOT MODIFY */
package net.wagic.app;
public final class BuildConfig {
public final static boolean DEBUG = true;
}
@@ -1,27 +0,0 @@
/* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package net.wagic.app;
public final class R {
public static final class attr {
}
public static final class drawable {
public static final int icon=0x7f020000;
}
public static final class id {
public static final int mainLayout=0x7f050000;
}
public static final class layout {
public static final int main=0x7f030000;
}
public static final class string {
public static final int app_name=0x7f040000;
public static final int app_version=0x7f040001;
public static final int info_text=0x7f040002;
}
}
+1 -2
View File
@@ -14,7 +14,7 @@ PNG_PATH := $(JGE_PATH)/Dependencies/libpng
DEBUG ?= DEBUG DEBUG ?= DEBUG
LOCAL_CFLAGS += -DLINUX -DANDROID -DSDL_CONFIG -D_$(DEBUG) LOCAL_CFLAGS += -DLINUX -DANDROID -DSDL_CONFIG -D_$(DEBUG)
LOCAL_CFLAGS += -D_STLP_USE_SIMPLE_NODE_ALLOC LOCAL_CFLAGS += -D_STLP_USE_SIMPLE_NODE_ALLOC -DTIXML_USE_STL
LOCAL_CFLAGS += -D__arm__ -D_REENTRANT -D_GLIBCXX__PTHREADS LOCAL_CFLAGS += -D__arm__ -D_REENTRANT -D_GLIBCXX__PTHREADS
LOCAL_STATIC_LIBRARIES := libpng libjpeg LOCAL_STATIC_LIBRARIES := libpng libjpeg
LOCAL_SHARED_LIBRARIES := SDL LOCAL_SHARED_LIBRARIES := SDL
@@ -41,7 +41,6 @@ LOCAL_SRC_FILES := $(SDL_PATH)/src/main/android/SDL_android_main.cpp \
$(MTG_PATH)/src/AllAbilities.cpp \ $(MTG_PATH)/src/AllAbilities.cpp \
$(MTG_PATH)/src/CardDescriptor.cpp \ $(MTG_PATH)/src/CardDescriptor.cpp \
$(MTG_PATH)/src/CardDisplay.cpp \ $(MTG_PATH)/src/CardDisplay.cpp \
$(MTG_PATH)/src/CardEffect.cpp \
$(MTG_PATH)/src/CardGui.cpp \ $(MTG_PATH)/src/CardGui.cpp \
$(MTG_PATH)/src/CardPrimitive.cpp \ $(MTG_PATH)/src/CardPrimitive.cpp \
$(MTG_PATH)/src/CardSelector.cpp \ $(MTG_PATH)/src/CardSelector.cpp \
@@ -54,10 +54,6 @@ import android.view.View.OnKeyListener;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.FrameLayout.LayoutParams; import android.widget.FrameLayout.LayoutParams;
import com.google.ads.AdRequest;
import com.google.ads.AdSize;
import com.google.ads.AdView;
/** /**
* SDL Activity * SDL Activity
*/ */
@@ -68,7 +64,6 @@ public class SDLActivity extends Activity implements OnKeyListener
public static String TAG = Activity.class.getCanonicalName(); public static String TAG = Activity.class.getCanonicalName();
// Main components // Main components
private static AdView mAdView;
private static SDLActivity mSingleton; private static SDLActivity mSingleton;
private static SDLSurface mSurface; private static SDLSurface mSurface;
@@ -422,25 +417,12 @@ public class SDLActivity extends Activity implements OnKeyListener
SurfaceHolder holder = mSurface.getHolder(); SurfaceHolder holder = mSurface.getHolder();
holder.setType(SurfaceHolder.SURFACE_TYPE_GPU); holder.setType(SurfaceHolder.SURFACE_TYPE_GPU);
// Create the adView
mAdView = new AdView(this, AdSize.BANNER, "a14e9009f88864f"); // "a14dc0ab7b27413" <-- for the alpha);
_videoLayout.addView(mSurface, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); _videoLayout.addView(mSurface, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
_videoLayout.addView(mAdView, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, Gravity.BOTTOM + Gravity.CENTER_HORIZONTAL));
// mGLView.setFocusableInTouchMode(true); // mGLView.setFocusableInTouchMode(true);
// mGLView.setFocusable(true); // mGLView.setFocusable(true);
// adView.requestFreshAd(); // adView.requestFreshAd();
setContentView(_videoLayout, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); setContentView(_videoLayout, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
mSurface.requestFocus(); mSurface.requestFocus();
AdRequest request = new AdRequest();
request.addTestDevice(AdRequest.TEST_EMULATOR);
request.addTestDevice("1DA1E070BC7D4ABE8BA77EB73C2CB0AA"); // wololo's phone
request.addTestDevice("C386F3830A9789C649098A817BF54C04"); // xawotihs's tablet
// Initiate a generic request to load it with an ad
mAdView.loadAd(request);
} }
// Setup // Setup
@@ -512,14 +494,6 @@ public class SDLActivity extends Activity implements OnKeyListener
{ {
return; return;
} }
if ((command.compareTo("entergamestate:menu") == 0) || (command.compareTo("enterduelphase:end") == 0))
{
mAdView.setVisibility(View.VISIBLE);
} else if (command.compareTo("leavegamestate:menu") == 0)
{
mAdView.setVisibility(View.INVISIBLE);
}
} }
// Messages from the SDLMain thread // Messages from the SDLMain thread
+31 -2
View File
@@ -1,4 +1,33 @@
OBJS = objs/InteractiveButton.o objs/AbilityParser.o objs/ActionElement.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/CardGui.o objs/CardDescriptor.o objs/CardDisplay.o objs/CardEffect.o objs/CardPrimitive.o objs/CardSelector.o objs/CardSelectorSingleton.o objs/Counters.o objs/Credits.o objs/Damage.o objs/DamagerDamaged.o objs/DeckDataWrapper.o objs/DeckEditorMenu.o objs/DeckMenu.o objs/DeckMenuItem.o objs/DeckMetaData.o objs/DeckStats.o objs/DuelLayers.o objs/Effects.o objs/ExtraCost.o objs/GameApp.o objs/GameLauncher.o objs/GameObserver.o objs/GameOptions.o objs/GameState.o objs/GameStateAwards.o objs/GameStateDeckViewer.o objs/GameStateDuel.o objs/DeckManager.o objs/GameStateMenu.o objs/GameStateOptions.o objs/GameStateShop.o objs/GameStateStory.o objs/GameStateTransitions.o objs/GuiAvatars.o objs/GuiBackground.o objs/GuiCardsController.o objs/GuiCombat.o objs/GuiFrame.o objs/GuiHand.o objs/GuiLayers.o objs/GuiMana.o objs/GuiPhaseBar.o objs/GuiPlay.o objs/GuiStatic.o objs/IconButton.o objs/ManaCost.o objs/ManaCostHybrid.o objs/MenuItem.o objs/ModRules.o objs/MTGAbility.o objs/MTGCardInstance.o objs/MTGCard.o objs/MTGDeck.o objs/MTGDefinitions.o objs/MTGGamePhase.o objs/MTGGameZones.o objs/MTGPack.o objs/MTGRules.o objs/Navigator.o objs/ObjectAnalytics.o objs/OptionItem.o objs/PhaseRing.o objs/Player.o objs/PlayerData.o objs/PlayGuiObjectController.o objs/PlayGuiObject.o objs/PlayRestrictions.o objs/Pos.o objs/PrecompiledHeader.o objs/PriceList.o objs/ReplacementEffects.o objs/Rules.o objs/SimpleMenu.o objs/SimpleButton.o objs/SimpleMenuItem.o objs/SimplePad.o objs/SimplePopup.o objs/StoryFlow.o objs/StyleManager.o objs/Subtypes.o objs/TargetChooser.o objs/TargetsList.o objs/TextScroller.o objs/ThisDescriptor.o objs/Token.o objs/Translate.o objs/TranslateKeys.o objs/Trash.o objs/utils.o objs/WEvent.o objs/WResourceManager.o objs/WCachedResource.o objs/WDataSrc.o objs/WGui.o objs/WFilter.o objs/Tasks.o objs/WFont.o OBJS = objs/InteractiveButton.o objs/AbilityParser.o objs/ActionElement.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/CardGui.o objs/CardDescriptor.o objs/CardDisplay.o\
objs/CardPrimitive.o objs/CardSelector.o objs/CardSelectorSingleton.o\
objs/Counters.o objs/Credits.o objs/Damage.o objs/DamagerDamaged.o\
objs/DeckDataWrapper.o objs/DeckEditorMenu.o objs/DeckMenu.o\
objs/DeckMenuItem.o objs/DeckMetaData.o objs/DeckStats.o objs/DuelLayers.o\
objs/Effects.o objs/ExtraCost.o objs/GameApp.o objs/GameLauncher.o\
objs/GameObserver.o objs/GameOptions.o objs/GameState.o\
objs/GameStateAwards.o objs/GameStateDeckViewer.o objs/GameStateDuel.o\
objs/DeckManager.o objs/GameStateMenu.o objs/GameStateOptions.o\
objs/GameStateShop.o objs/GameStateStory.o objs/GameStateTransitions.o\
objs/GuiAvatars.o objs/GuiBackground.o objs/GuiCardsController.o\
objs/GuiCombat.o objs/GuiFrame.o objs/GuiHand.o objs/GuiLayers.o\
objs/GuiMana.o objs/GuiPhaseBar.o objs/GuiPlay.o objs/GuiStatic.o\
objs/IconButton.o objs/ManaCost.o objs/ManaCostHybrid.o objs/MenuItem.o\
objs/ModRules.o objs/MTGAbility.o objs/MTGCardInstance.o objs/MTGCard.o\
objs/MTGDeck.o objs/MTGDefinitions.o objs/MTGGamePhase.o objs/MTGGameZones.o\
objs/MTGPack.o objs/MTGRules.o objs/Navigator.o objs/ObjectAnalytics.o\
objs/OptionItem.o objs/PhaseRing.o objs/Player.o objs/PlayerData.o\
objs/PlayGuiObjectController.o objs/PlayGuiObject.o objs/PlayRestrictions.o\
objs/Pos.o objs/PrecompiledHeader.o objs/PriceList.o objs/ReplacementEffects.o\
objs/Rules.o objs/SimpleMenu.o objs/SimpleButton.o objs/SimpleMenuItem.o\
objs/SimplePad.o objs/SimplePopup.o objs/StoryFlow.o objs/StyleManager.o\
objs/Subtypes.o objs/TargetChooser.o objs/TargetsList.o objs/TextScroller.o\
objs/ThisDescriptor.o objs/Token.o objs/Translate.o objs/TranslateKeys.o\
objs/Trash.o objs/utils.o objs/WEvent.o objs/WResourceManager.o\
objs/WCachedResource.o objs/WDataSrc.o objs/WGui.o objs/WFilter.o objs/Tasks.o\
objs/WFont.o
DEPS = $(patsubst objs/%.o, deps/%.d, $(OBJS)) DEPS = $(patsubst objs/%.o, deps/%.d, $(OBJS))
RESULT = $(shell psp-config --psp-prefix 2> Makefile.cache) RESULT = $(shell psp-config --psp-prefix 2> Makefile.cache)
@@ -44,7 +73,7 @@ PSP_EBOOT_UNKPNG = pic0.png
PSP_EBOOT_PIC1 = pic1.png PSP_EBOOT_PIC1 = pic1.png
INCDIR = ../../JGE/include ../../JGE/src/zipFS ../../JGE/include/psp ../../JGE/include/psp/freetype2 ../../JGE/src ../../projects/mtg/include ../../Boost INCDIR = ../../JGE/include ../../JGE/src/zipFS ../../JGE/include/psp ../../JGE/include/psp/freetype2 ../../JGE/src ../../projects/mtg/include ../../Boost
LIBDIR = ../../JGE/lib/psp LIBDIR = ../../JGE/lib/psp
CFLAGS = -O2 -G0 -DPSPFW3XX -DDEVHOOK -DUSE_PRECOMPILED_HEADERS=1 -DPSP CFLAGS = -O2 -G0 -DPSPFW3XX -DDEVHOOK -DUSE_PRECOMPILED_HEADERS=1 -DPSP -DTIXML_USE_STL
else else
OBJS += objs/TestSuiteAI.o OBJS += objs/TestSuiteAI.o
INCDIR = -I../../JGE/include -I../../JGE/src -I/usr/X11/include -I../../projects/mtg/include -I../../Boost -I../../JGE/src/zipFS INCDIR = -I../../JGE/include -I../../JGE/src -I/usr/X11/include -I../../projects/mtg/include -I../../Boost -I../../JGE/src/zipFS
+106
View File
@@ -0,0 +1,106 @@
[meta]
author=Wagic Team
name=From the Vault: Twenty
block=Vault
year=2013
[/meta]
[card]
primitive=Akroma's Vengeance
id=373328
rarity=M
[/card]
[card]
primitive=Chainer's Edict
id=373317
rarity=M
[/card]
[card]
primitive=Chameleon Colossus
id=373321
rarity=M
[/card]
[card]
primitive=Char
id=373332
rarity=M
[/card]
[card]
primitive=Cruel Ultimatum
id=373318
rarity=M
[/card]
[card]
primitive=Dark Ritual
id=373329
rarity=M
[/card]
[card]
primitive=Fact or Fiction
id=373325
rarity=M
[/card]
[card]
primitive=Fyndhorn Elves
id=373320
rarity=M
[/card]
[card]
primitive=Gilded Lotus
id=373335
rarity=M
[/card]
[card]
primitive=Green Sun's Zenith
id=373333
rarity=M
[/card]
[card]
primitive=Hymn to Tourach
id=373324
rarity=M
[/card]
[card]
primitive=Impulse
id=373330
rarity=M
[/card]
[card]
primitive=Ink-Eyes, Servant of Oni
id=373327
rarity=M
[/card]
[card]
primitive=Jace, the Mind Sculptor
id=373316
rarity=M
[/card]
[card]
primitive=Kessig Wolf Run
id=373323
rarity=M
[/card]
[card]
primitive=Swords to Plowshares
id=373334
rarity=M
[/card]
[card]
primitive=Tangle Wire
id=373322
rarity=M
[/card]
[card]
primitive=Thran Dynamo
id=373331
rarity=M
[/card]
[card]
primitive=Venser, Shaper Savant
id=373326
rarity=M
[/card]
[card]
primitive=Wall of Blossoms
id=373319
rarity=M
[/card]
+18 -6
View File
@@ -17432,7 +17432,7 @@ toughness=4
[card] [card]
name=Cranial Plating name=Cranial Plating
auto=foreach(artifact|mybattlefield) 1/0 auto=foreach(artifact|mybattlefield) 1/0
auto={B}{B}:attach auto={B}{B}:name(attach) retarget target(creature|mybattlefield)
auto={1}:equip auto={1}:equip
text=Equipped creature gets +1/+0 for each artifact you control. -- {B}{B}: Attach Cranial Plating to target creature you control. -- Equip {1} ({1}: Attach to target creature you control. Equip only as a sorcery.) text=Equipped creature gets +1/+0 for each artifact you control. -- {B}{B}: Attach Cranial Plating to target creature you control. -- Equip {1} ({1}: Attach to target creature you control. Equip only as a sorcery.)
mana={2} mana={2}
@@ -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}
@@ -39826,7 +39826,7 @@ name=Healer's Headdress
auto={1}:equip auto={1}:equip
auto=0/2 auto=0/2
auto=teach(creature) {T}:prevent:1 target(creature,player) auto=teach(creature) {T}:prevent:1 target(creature,player)
auto={W}{W}:attach auto={W}{W}:name(attach) retarget target(creature|mybattlefield)
text=Equipped creature gets +0/+2 and has "{T}: Prevent the next 1 damage that would be dealt to target creature or player this turn." -- {W}{W}: Attach Healer's Headdress to target creature you control. -- Equip {1} ({1}: Attach to target creature you control. Equip only as a sorcery.) text=Equipped creature gets +0/+2 and has "{T}: Prevent the next 1 damage that would be dealt to target creature or player this turn." -- {W}{W}: Attach Healer's Headdress to target creature you control. -- Equip {1} ({1}: Attach to target creature you control. Equip only as a sorcery.)
mana={2} mana={2}
type=Artifact type=Artifact
@@ -41596,7 +41596,7 @@ toughness=2
name=Horned Helm name=Horned Helm
auto=1/1 auto=1/1
auto=trample auto=trample
auto={G}{G}:attach auto={G}{G}:name(attach) retarget target(creature|mybattlefield)
auto={1}:equip auto={1}:equip
text=Equipped creature gets +1/+1 and has trample. -- {G}{G}: Attach Horned Helm to target creature you control. -- Equip {1} ({1}: Attach to target creature you control. Equip only as a sorcery.) text=Equipped creature gets +1/+1 and has trample. -- {G}{G}: Attach Horned Helm to target creature you control. -- Equip {1} ({1}: Attach to target creature you control. Equip only as a sorcery.)
mana={2} mana={2}
@@ -54155,6 +54155,18 @@ power=2
toughness=2 toughness=2
[/card] [/card]
[card] [card]
name=Master of Waves
abilities=protection from red
auto=lord(Elemental|mybattlefield) 1/1
auto=token(Elemental,Creature Elemental,1/0)*type:manaU
text=Protection from red. -- Elemental creatures you control get +1/+1. -- When Master of Waves enters the battlefield, put a number of 1/0 blue Elemental creature tokens onto the battlefield equal to your devotion to blue. (Each {U} in the mana costs of permanents you control counts toward your devotion to blue.)
mana={3}{U}
type=Creature
subtype=Merfolk Wizard
power=2
toughness=1
[/card]
[card]
name=Master Splicer name=Master Splicer
auto=token(Golem,Artifact Creature Golem,3/3) auto=token(Golem,Artifact Creature Golem,3/3)
auto=lord(golem|mybattlefield) 1/1 auto=lord(golem|mybattlefield) 1/1
@@ -59971,7 +59983,7 @@ toughness=2
[card] [card]
name=Neurok Stealthsuit name=Neurok Stealthsuit
auto=teach(creature) shroud auto=teach(creature) shroud
auto={U}{U}:attach auto={U}{U}:name(attach) retarget target(creature|mybattlefield)
auto={1}:equip auto={1}:equip
text=Equipped creature has shroud. (It can't be the target of spells or abilities.) -- {U}{U}: Attach Neurok Stealthsuit to target creature you control. -- Equip {1} ({1}: Attach to target creature you control. Equip only as a sorcery.) text=Equipped creature has shroud. (It can't be the target of spells or abilities.) -- {U}{U}: Attach Neurok Stealthsuit to target creature you control. -- Equip {1} ({1}: Attach to target creature you control. Equip only as a sorcery.)
mana={2} mana={2}
@@ -83425,7 +83437,7 @@ toughness=3
[card] [card]
name=Sparring Collar name=Sparring Collar
auto=first strike auto=first strike
auto={R}{R}:attach auto={R}{R}:name(attach) retarget target(creature|mybattlefield)
auto={1}:equip auto={1}:equip
text=Equipped creature has first strike. -- {R}{R}: Attach Sparring Collar to target creature you control. -- Equip {1} ({1}: Attach to target creature you control. Equip only as a sorcery.) text=Equipped creature has first strike. -- {R}{R}: Attach Sparring Collar to target creature you control. -- Equip {1} ({1}: Attach to target creature you control. Equip only as a sorcery.)
mana={2} mana={2}
+1
View File
@@ -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]
+10 -17
View File
@@ -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 string getMenuText()
virtual const char * getMenuText()
{ {
return "Ability"; return "Ability";
} }
;
virtual ActionElement * clone() const = 0; virtual ActionElement * clone() const = 0;
}; };
+6 -8
View File
@@ -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;
+100 -188
View File
@@ -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;
@@ -1081,7 +1081,7 @@ public:
ManaCost * cost = NULL); ManaCost * cost = NULL);
int resolve(); int resolve();
const char* getMenuText(); const string getMenuText();
AACounter * clone() const; AACounter * clone() const;
}; };
@@ -1100,7 +1100,7 @@ public:
bool all,ManaCost * cost = NULL); bool all,ManaCost * cost = NULL);
int resolve(); int resolve();
const char* getMenuText(); const string getMenuText();
AARemoveAllCounter * clone() const; AARemoveAllCounter * clone() const;
}; };
@@ -1110,7 +1110,7 @@ class AAResetDamage: public ActivatedAbility
public: public:
AAResetDamage(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, ManaCost * cost = NULL); AAResetDamage(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, ManaCost * cost = NULL);
int resolve(); int resolve();
const char* getMenuText(); const string getMenuText();
AAResetDamage * clone() const; AAResetDamage * clone() const;
}; };
@@ -1120,7 +1120,7 @@ public:
string named; string named;
AAFakeAbility(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target,string _newName, ManaCost * cost = NULL); AAFakeAbility(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target,string _newName, ManaCost * cost = NULL);
int resolve(); int resolve();
const char* getMenuText(); const string getMenuText();
AAFakeAbility * clone() const; AAFakeAbility * clone() const;
}; };
@@ -1131,7 +1131,7 @@ public:
AAFizzler(GameObserver* observer, int _id, MTGCardInstance * card, Spell * _target, ManaCost * _cost = NULL); AAFizzler(GameObserver* observer, int _id, MTGCardInstance * card, Spell * _target, ManaCost * _cost = NULL);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AAFizzler* clone() const; AAFizzler* clone() const;
}; };
@@ -1160,7 +1160,7 @@ public:
string Cond; string Cond;
IfThenAbility(GameObserver* observer, int _id,MTGAbility * delayedAbility = NULL,MTGAbility * delayedElseAbility = NULL, MTGCardInstance * _source=NULL, Targetable * target = NULL, int type = 1,string Cond = ""); IfThenAbility(GameObserver* observer, int _id,MTGAbility * delayedAbility = NULL,MTGAbility * delayedElseAbility = NULL, MTGCardInstance * _source=NULL, Targetable * target = NULL, int type = 1,string Cond = "");
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
IfThenAbility * clone() const; IfThenAbility * clone() const;
~IfThenAbility(); ~IfThenAbility();
}; };
@@ -1179,7 +1179,7 @@ public:
void Update(float dt); void Update(float dt);
const char * getMenuText(); const string getMenuText();
int testDestroy(); int testDestroy();
int isReactingToTargetClick(Targetable * card); int isReactingToTargetClick(Targetable * card);
@@ -1209,7 +1209,7 @@ public:
bool CheckUserInput(JButton key); bool CheckUserInput(JButton key);
void Update(float dt); void Update(float dt);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
int testDestroy(); int testDestroy();
int isReactingToTargetClick(Targetable * card); int isReactingToTargetClick(Targetable * card);
int reactToTargetClick(Targetable * object); int reactToTargetClick(Targetable * object);
@@ -1225,7 +1225,7 @@ class AAProliferate: public ActivatedAbility
public: public:
AAProliferate(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target,ManaCost * cost = NULL); AAProliferate(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target,ManaCost * cost = NULL);
int resolve(); int resolve();
const char* getMenuText(); const string getMenuText();
AAProliferate * clone() const; AAProliferate * clone() const;
~AAProliferate(); ~AAProliferate();
}; };
@@ -1243,7 +1243,7 @@ public:
int resolve(); int resolve();
int addToGame(); int addToGame();
int destroy(); int destroy();
const char * getMenuText(); const string getMenuText();
MultiAbility * clone() const; MultiAbility * clone() const;
~MultiAbility(); ~MultiAbility();
}; };
@@ -1258,8 +1258,9 @@ public:
GenericActivatedAbility(GameObserver* observer, string newName,string castRestriction,int _id, MTGCardInstance * card, MTGAbility * a, ManaCost * _cost, string limit = "",MTGAbility * sideEffects = NULL,string usesBeforeSideEffects = "", GenericActivatedAbility(GameObserver* observer, string newName,string castRestriction,int _id, MTGCardInstance * card, MTGAbility * a, ManaCost * _cost, string limit = "",MTGAbility * sideEffects = NULL,string usesBeforeSideEffects = "",
int restrictions = 0, MTGGameZone * dest = NULL); int restrictions = 0, MTGGameZone * dest = NULL);
GenericActivatedAbility(const GenericActivatedAbility& other);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL); int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
void Update(float dt); void Update(float dt);
int testDestroy(); int testDestroy();
@@ -1274,7 +1275,7 @@ class AALibraryBottom: public ActivatedAbility
public: public:
AALibraryBottom(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL); AALibraryBottom(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AALibraryBottom * clone() const; AALibraryBottom * clone() const;
}; };
@@ -1284,7 +1285,7 @@ class AACopier: public ActivatedAbility
public: public:
AACopier(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL); AACopier(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AACopier * clone() const; AACopier * clone() const;
}; };
//imprint //imprint
@@ -1293,7 +1294,7 @@ class AAPhaseOut: public ActivatedAbility
public: public:
AAPhaseOut(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL); AAPhaseOut(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AAPhaseOut * clone() const; AAPhaseOut * clone() const;
}; };
//cloning...this makes a token thats a copy of the target. //cloning...this makes a token thats a copy of the target.
@@ -1310,7 +1311,7 @@ public:
AACloner(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL, int who = 0, AACloner(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL, int who = 0,
string abilitiesStringList = "",string typeslist = ""); string abilitiesStringList = "",string typeslist = "");
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
AACloner * clone() const; AACloner * clone() const;
~AACloner(); ~AACloner();
@@ -1326,7 +1327,7 @@ public:
AAMover(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, string dest,string _name, ManaCost * _cost = NULL); AAMover(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, string dest,string _name, ManaCost * _cost = NULL);
MTGGameZone * destinationZone(Targetable * target = NULL); MTGGameZone * destinationZone(Targetable * target = NULL);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
const char * getMenuText(TargetChooser * fromTc); const char * getMenuText(TargetChooser * fromTc);
AAMover * clone() const; AAMover * clone() const;
~AAMover(); ~AAMover();
@@ -1342,7 +1343,7 @@ public:
AARandomMover(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, string tcs, string from, string to); AARandomMover(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, string tcs, string from, string to);
MTGGameZone * destinationZone(Targetable * target = NULL,string zone = ""); MTGGameZone * destinationZone(Targetable * target = NULL,string zone = "");
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AARandomMover * clone() const; AARandomMover * clone() const;
~AARandomMover(); ~AARandomMover();
}; };
@@ -1356,7 +1357,7 @@ public:
string menu; string menu;
AABuryCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target); AABuryCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AABuryCard * clone() const; AABuryCard * clone() const;
~AABuryCard(); ~AABuryCard();
}; };
@@ -1367,7 +1368,7 @@ public:
MTGAbility * andAbility; MTGAbility * andAbility;
AADestroyCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target); AADestroyCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AADestroyCard * clone() const; AADestroyCard * clone() const;
~AADestroyCard(); ~AADestroyCard();
}; };
@@ -1378,7 +1379,7 @@ public:
MTGAbility * andAbility; MTGAbility * andAbility;
AASacrificeCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target); AASacrificeCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AASacrificeCard * clone() const; AASacrificeCard * clone() const;
~AASacrificeCard(); ~AASacrificeCard();
}; };
@@ -1389,7 +1390,7 @@ public:
MTGAbility * andAbility; MTGAbility * andAbility;
AADiscardCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target); AADiscardCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AADiscardCard * clone() const; AADiscardCard * clone() const;
~AADiscardCard(); ~AADiscardCard();
}; };
@@ -1409,7 +1410,7 @@ public:
string tcString; string tcString;
GenericTargetAbility(GameObserver* observer, string newName, string castRestriction, int _id, MTGCardInstance * _source, TargetChooser * _tc, MTGAbility * a, ManaCost * _cost = NULL, string limit = "",MTGAbility * sideEffects = NULL,string usesBeforeSideEffects = "", int restrictions = 0, MTGGameZone * dest = NULL,string tcString =""); GenericTargetAbility(GameObserver* observer, string newName, string castRestriction, int _id, MTGCardInstance * _source, TargetChooser * _tc, MTGAbility * a, ManaCost * _cost = NULL, string limit = "",MTGAbility * sideEffects = NULL,string usesBeforeSideEffects = "", int restrictions = 0, MTGGameZone * dest = NULL,string tcString ="");
const char * getMenuText(); const string getMenuText();
~GenericTargetAbility(); ~GenericTargetAbility();
GenericTargetAbility * clone() const; GenericTargetAbility * clone() const;
int resolve(); int resolve();
@@ -1447,7 +1448,7 @@ public:
return 1; return 1;
} }
const char * getMenuText() const string getMenuText()
{ {
return "Ninjutsu"; return "Ninjutsu";
} }
@@ -1479,7 +1480,7 @@ public:
return 1; return 1;
} }
const char * getMenuText() const string getMenuText()
{ {
return "Remove From Combat"; return "Remove From Combat";
} }
@@ -1501,7 +1502,7 @@ public:
AADrawer(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost,string nbcardsStr, int who = AADrawer(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost,string nbcardsStr, int who =
TargetChooser::UNSET,bool noReplace = false); TargetChooser::UNSET,bool noReplace = false);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AADrawer * clone() const; AADrawer * clone() const;
int getNumCards(); int getNumCards();
}; };
@@ -1521,7 +1522,7 @@ public:
ACastRestriction(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, TargetChooser * _restrictionsScope, WParsedInt * _value, bool _modifyExisting, int _zoneId, int who = TargetChooser::UNSET); ACastRestriction(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, TargetChooser * _restrictionsScope, WParsedInt * _value, bool _modifyExisting, int _zoneId, int who = TargetChooser::UNSET);
int addToGame(); int addToGame();
int destroy(); int destroy();
const char * getMenuText(); const string getMenuText();
ACastRestriction * clone() const; ACastRestriction * clone() const;
~ACastRestriction(); ~ACastRestriction();
@@ -1536,7 +1537,7 @@ public:
AInstantCastRestrictionUEOT(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, TargetChooser * _restrictionsScope, WParsedInt * _value, bool _modifyExisting, int _zoneId, int who = TargetChooser::UNSET); AInstantCastRestrictionUEOT(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, TargetChooser * _restrictionsScope, WParsedInt * _value, bool _modifyExisting, int _zoneId, int who = TargetChooser::UNSET);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AInstantCastRestrictionUEOT * clone() const; AInstantCastRestrictionUEOT * clone() const;
~AInstantCastRestrictionUEOT(); ~AInstantCastRestrictionUEOT();
}; };
@@ -1549,7 +1550,7 @@ public:
AALifer(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target,string life_s, ManaCost * _cost = NULL, AALifer(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target,string life_s, ManaCost * _cost = NULL,
int who = TargetChooser::UNSET); int who = TargetChooser::UNSET);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AALifer * clone() const; AALifer * clone() const;
int getLife(); int getLife();
@@ -1562,7 +1563,7 @@ public:
AAWinGame(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost = NULL, int who = AAWinGame(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost = NULL, int who =
TargetChooser::UNSET); TargetChooser::UNSET);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AAWinGame * clone() const; AAWinGame * clone() const;
}; };
@@ -1603,7 +1604,7 @@ public:
return 1; return 1;
} }
const char * getMenuText() const string getMenuText()
{ {
return Constants::MTGBasicAbilities[ability]; return Constants::MTGBasicAbilities[ability];
} }
@@ -1645,7 +1646,7 @@ public:
return InstantAbility::addToGame(); return InstantAbility::addToGame();
} }
const char * getMenuText() const string getMenuText()
{ {
return Constants::MTGBasicAbilities[ability]; return Constants::MTGBasicAbilities[ability];
} }
@@ -1706,7 +1707,7 @@ public:
return ActivatedAbility::addToGame(); return ActivatedAbility::addToGame();
} }
const char * getMenuText() const string getMenuText()
{ {
return ability->getMenuText(); return ability->getMenuText();
} }
@@ -1862,7 +1863,7 @@ public:
return 1; return 1;
} }
const char * getMenuText() const string getMenuText()
{ {
sprintf(menuText,"Protection from %s",tcstr.c_str()); sprintf(menuText,"Protection from %s",tcstr.c_str());
return menuText; return menuText;
@@ -2054,7 +2055,7 @@ public:
((MTGCardInstance *) target)->addToToughness(-wppt->toughness.getValue()); ((MTGCardInstance *) target)->addToToughness(-wppt->toughness.getValue());
return 1; return 1;
} }
const char * getMenuText() const string getMenuText()
{ {
if(PT.size()) if(PT.size())
{ {
@@ -2147,7 +2148,7 @@ public:
return 1; return 1;
} }
const char * getMenuText() const string getMenuText()
{ {
return ability->getMenuText(); return ability->getMenuText();
} }
@@ -2189,7 +2190,7 @@ public:
return toAdd->addToGame(); return toAdd->addToGame();
} }
const char * getMenuText() const string getMenuText()
{ {
return ability->getMenuText(); return ability->getMenuText();
} }
@@ -2287,7 +2288,7 @@ public:
return 1; return 1;
} }
const char * getMenuText() const string getMenuText()
{ {
return "Regenerate"; return "Regenerate";
} }
@@ -2494,7 +2495,7 @@ public:
SAFE_DELETE(ability); SAFE_DELETE(ability);
} }
const char * getMenuText() const string getMenuText()
{ {
if(ability) if(ability)
{ {
@@ -2577,7 +2578,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;
} }
@@ -2620,7 +2621,7 @@ public:
SAFE_DELETE(ability); SAFE_DELETE(ability);
} }
const char * getMenuText() const string getMenuText()
{ {
//Special case for move //Special case for move
if (AAMover * move = dynamic_cast<AAMover *>(ability)) if (AAMover * move = dynamic_cast<AAMover *>(ability))
@@ -2725,7 +2726,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;
} }
@@ -2794,113 +2795,24 @@ public:
//equipment //equipment
class AEquip: public TargetAbility class AEquip: public TargetAbility
{ {
public: private:
bool isAttach;
vector<MTGAbility *> currentAbilities; vector<MTGAbility *> currentAbilities;
AEquip(GameObserver* observer, int _id, MTGCardInstance * _source, ManaCost * _cost = NULL, int restrictions =
ActivatedAbility::AS_SORCERY) :
TargetAbility(observer, _id, _source, NULL, _cost, restrictions)
{
aType = MTGAbility::STANDARD_EQUIP;
}
int unequip() public:
{ AEquip(GameObserver* observer, int _id, MTGCardInstance * _source, ManaCost * _cost = NULL,
if (source->target) int restrictions = ActivatedAbility::AS_SORCERY);
{
source->target->equipment -= 1;
source->parentCards.clear();
for(unsigned int w = 0;w < source->target->childrenCards.size();w++)
{
MTGCardInstance * child = source->target->childrenCards[w];
if(child == source)
source->target->childrenCards.erase(source->target->childrenCards.begin() + w);
}
}
source->target = NULL;
for (size_t i = 0; i < currentAbilities.size(); ++i)
{
MTGAbility * a = currentAbilities[i];
if (dynamic_cast<AEquip *> (a) || dynamic_cast<ATeach *> (a) || dynamic_cast<AAConnect *> (a) || (a->aType == MTGAbility::STANDARD_TOKENCREATOR && a->oneShot))
{
SAFE_DELETE(a);
continue;
}
game->removeObserver(currentAbilities[i]);
}
currentAbilities.clear();
return 1;
}
int equip(MTGCardInstance * equipped) int unequip();
{ int equip(MTGCardInstance * equipped);
source->target = equipped;
source->target->equipment += 1;
source->parentCards.push_back(equipped);
source->target->childrenCards.push_back((MTGCardInstance*)source);
AbilityFactory af(game);
af.getAbilities(&currentAbilities, NULL, source);
for (size_t i = 0; i < currentAbilities.size(); ++i)
{
MTGAbility * a = currentAbilities[i];
if (dynamic_cast<AEquip *> (a)) continue;
if (dynamic_cast<ATeach *> (a)) continue;
if (dynamic_cast<AAConnect *> (a)) continue;
if (a->aType == MTGAbility::STANDARD_TOKENCREATOR && a->oneShot)
{
a->forceDestroy = 1;
continue;
}
if (dynamic_cast<AACopier *> (af.getCoreAbility(a)))
{
a->forceDestroy = 1;
continue;
}
//we generally dont want to pass oneShot tokencreators to the cards
//we equip...
a->addToGame();
}
return 1;
} int resolve();
const string getMenuText();
int resolve() int testDestroy();
{ int destroy();
MTGCardInstance * mTarget = tc->getNextCardTarget();
if (!mTarget) return 0;
if (mTarget == source) return 0;
unequip();
equip(mTarget);
return 1;
}
const char * getMenuText()
{
return "Equip";
}
int testDestroy()
{
if (source->target && !game->isInPlay(source->target))
unequip();
if(!game->connectRule)
{
if (source->target && TargetAbility::tc && !TargetAbility::tc->canTarget((Targetable *)source->target,true))
unequip();
}
return TargetAbility::testDestroy();
}
int destroy()
{
unequip();
return TargetAbility::destroy();
}
AEquip * clone() const
{
return NEW AEquip(*this);
}
AEquip * clone() const;
}; };
class ATokenCreator: public ActivatedAbility class ATokenCreator: public ActivatedAbility
@@ -3123,7 +3035,7 @@ public:
card->setAttacker(1); card->setAttacker(1);
} }
const char * getMenuText() const string getMenuText()
{ {
sprintf(menuText, "Create %s", name.c_str()); sprintf(menuText, "Create %s", name.c_str());
return menuText; return menuText;
@@ -3224,7 +3136,7 @@ public:
} }
} }
const char * getMenuText() const string getMenuText()
{ {
if(name.size()) if(name.size())
return name.c_str(); return name.c_str();
@@ -3397,7 +3309,7 @@ public:
return 0; return 0;
} }
const char * getMenuText() const string getMenuText()
{ {
return ability->getMenuText(); return ability->getMenuText();
} }
@@ -3609,7 +3521,7 @@ public:
} }
} }
const char * getMenuText() const string getMenuText()
{ {
return ability->getMenuText(); return ability->getMenuText();
} }
@@ -3632,7 +3544,7 @@ public:
AASetHand(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, int hand, ManaCost * _cost = NULL, AASetHand(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, int hand, ManaCost * _cost = NULL,
int who = TargetChooser::UNSET); int who = TargetChooser::UNSET);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AASetHand * clone() const; AASetHand * clone() const;
}; };
@@ -3646,7 +3558,7 @@ public:
AALifeSet(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, WParsedInt * life, ManaCost * _cost = NULL, AALifeSet(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, WParsedInt * life, ManaCost * _cost = NULL,
int who = TargetChooser::UNSET); int who = TargetChooser::UNSET);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AALifeSet * clone() const; AALifeSet * clone() const;
~AALifeSet(); ~AALifeSet();
@@ -3663,7 +3575,7 @@ public:
AADamager(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, string d, ManaCost * _cost = NULL, AADamager(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, string d, ManaCost * _cost = NULL,
int who = TargetChooser::UNSET); int who = TargetChooser::UNSET);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
int getDamage(); int getDamage();
AADamager * clone() const; AADamager * clone() const;
@@ -3677,7 +3589,7 @@ public:
AADamagePrevent(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, int preventing, ManaCost * _cost = NULL, int who = TargetChooser::UNSET); AADamagePrevent(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, int preventing, ManaCost * _cost = NULL, int who = TargetChooser::UNSET);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AADamagePrevent * clone() const; AADamagePrevent * clone() const;
~AADamagePrevent(); ~AADamagePrevent();
}; };
@@ -3691,7 +3603,7 @@ public:
AAAlterPoison(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, int poison, ManaCost * _cost = NULL, AAAlterPoison(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, int poison, ManaCost * _cost = NULL,
int who = TargetChooser::UNSET); int who = TargetChooser::UNSET);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AAAlterPoison * clone() const; AAAlterPoison * clone() const;
~AAAlterPoison(); ~AAAlterPoison();
}; };
@@ -3719,7 +3631,7 @@ class AATapper: public ActivatedAbility
public: public:
AATapper(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL); AATapper(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AATapper * clone() const; AATapper * clone() const;
}; };
@@ -3729,7 +3641,7 @@ class AAUntapper: public ActivatedAbility
public: public:
AAUntapper(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL); AAUntapper(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AAUntapper * clone() const; AAUntapper * clone() const;
}; };
@@ -3750,7 +3662,7 @@ class AAFrozen: public ActivatedAbility
public: public:
AAFrozen(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL); AAFrozen(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AAFrozen * clone() const; AAFrozen * clone() const;
}; };
/* ghetto new target*/ /* ghetto new target*/
@@ -3760,7 +3672,7 @@ public:
bool retarget; bool retarget;
AANewTarget(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target,bool retarget = false, ManaCost * _cost = NULL); AANewTarget(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target,bool retarget = false, ManaCost * _cost = NULL);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AANewTarget * clone() const; AANewTarget * clone() const;
}; };
/* morph*/ /* morph*/
@@ -3771,7 +3683,7 @@ public:
AAMorph(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL); AAMorph(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL);
int resolve(); int resolve();
int testDestroy(); int testDestroy();
const char * getMenuText(); const string getMenuText();
AAMorph * clone() const; AAMorph * clone() const;
}; };
/* flip*/ /* flip*/
@@ -3783,7 +3695,7 @@ public:
AAFlip(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target,string flipStats); AAFlip(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target,string flipStats);
int resolve(); int resolve();
int testDestroy(); int testDestroy();
const char * getMenuText(); const string getMenuText();
AAFlip * clone() const; AAFlip * clone() const;
}; };
/* dynamic ability build*/ /* dynamic ability build*/
@@ -3848,7 +3760,7 @@ string menu;
int resolve(); int resolve();
int activateMainAbility(MTGAbility * toActivate,MTGCardInstance * source , Damageable * target); int activateMainAbility(MTGAbility * toActivate,MTGCardInstance * source , Damageable * target);
int activateStored(); int activateStored();
const char * getMenuText(); const string getMenuText();
AADynamic * clone() const; AADynamic * clone() const;
~AADynamic(); ~AADynamic();
}; };
@@ -3901,7 +3813,7 @@ public:
return 1; return 1;
} }
const char * getMenuText() const string getMenuText()
{ {
return "Swap power and toughness"; return "Swap power and toughness";
} }
@@ -3917,7 +3829,7 @@ public:
AAExchangeLife(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, ManaCost * _cost = NULL, AAExchangeLife(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, ManaCost * _cost = NULL,
int who = TargetChooser::UNSET); int who = TargetChooser::UNSET);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AAExchangeLife * clone() const; AAExchangeLife * clone() const;
}; };
@@ -4153,7 +4065,7 @@ public:
int reapplyCountersBonus(MTGCardInstance * rtarget= NULL,bool powerapplied=false,bool toughnessapplied=false); int reapplyCountersBonus(MTGCardInstance * rtarget= NULL,bool powerapplied=false,bool toughnessapplied=false);
int testDestroy(); int testDestroy();
int destroy(); int destroy();
const char * getMenuText(); const string getMenuText();
ATransformer * clone() const; ATransformer * clone() const;
~ATransformer(); ~ATransformer();
}; };
@@ -4176,7 +4088,7 @@ public:
ATransformerInstant(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, string types = "", string abilities = "",string newpower = "",bool newpowerfound = false,string newtoughness = "",bool newtoughnessfound = false,vector<string>newAbilitiesList = vector<string>(),bool newAbilityFound = false,bool aForever = false, bool UYNT = false,string menutext = ""); ATransformerInstant(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, string types = "", string abilities = "",string newpower = "",bool newpowerfound = false,string newtoughness = "",bool newtoughnessfound = false,vector<string>newAbilitiesList = vector<string>(),bool newAbilityFound = false,bool aForever = false, bool UYNT = false,string menutext = "");
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
ATransformerInstant * clone() const; ATransformerInstant * clone() const;
~ATransformerInstant(); ~ATransformerInstant();
}; };
@@ -4192,7 +4104,7 @@ public:
WParsedPT * newWppt; WParsedPT * newWppt;
PTInstant(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, WParsedPT * wppt,string s = "",bool nonstatic = false); PTInstant(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, WParsedPT * wppt,string s = "",bool nonstatic = false);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
PTInstant * clone() const; PTInstant * clone() const;
~PTInstant(); ~PTInstant();
}; };
@@ -4251,7 +4163,7 @@ public:
return 1; return 1;
} }
const char * getMenuText() const string getMenuText()
{ {
return "Exalted"; return "Exalted";
} }
@@ -4269,7 +4181,7 @@ public:
ASwapPT * ability; ASwapPT * ability;
ASwapPTUEOT(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target); ASwapPTUEOT(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
ASwapPTUEOT * clone() const; ASwapPTUEOT * clone() const;
~ASwapPTUEOT(); ~ASwapPTUEOT();
}; };
@@ -4346,7 +4258,7 @@ public:
APreventDamageTypesUEOT(GameObserver* observer, int id, MTGCardInstance * source, string to, string from, int type = 0); APreventDamageTypesUEOT(GameObserver* observer, int id, MTGCardInstance * source, string to, string from, int type = 0);
int resolve(); int resolve();
int destroy(); int destroy();
const char * getMenuText(); const string getMenuText();
APreventDamageTypesUEOT * clone() const; APreventDamageTypesUEOT * clone() const;
~APreventDamageTypesUEOT(); ~APreventDamageTypesUEOT();
}; };
@@ -4363,7 +4275,7 @@ public:
AVanishing(GameObserver* observer, int _id, MTGCardInstance * card, ManaCost * _cost, int restrictions = 0,int amount = 0,string counterName = ""); AVanishing(GameObserver* observer, int _id, MTGCardInstance * card, ManaCost * _cost, int restrictions = 0,int amount = 0,string counterName = "");
void Update(float dt); void Update(float dt);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AVanishing * clone() const; AVanishing * clone() const;
~AVanishing(); ~AVanishing();
}; };
@@ -4385,7 +4297,7 @@ public:
void Update(float dt); void Update(float dt);
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL); int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
AUpkeep * clone() const; AUpkeep * clone() const;
~AUpkeep(); ~AUpkeep();
@@ -4411,7 +4323,7 @@ public:
MTG_PHASE_UPKEEP,bool forcedestroy = false,bool next = true,bool myturn = true,bool opponentturn = true,bool once = false); MTG_PHASE_UPKEEP,bool forcedestroy = false,bool next = true,bool myturn = true,bool opponentturn = true,bool once = false);
void Update(float dt); void Update(float dt);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
APhaseAction * clone() const; APhaseAction * clone() const;
~APhaseAction(); ~APhaseAction();
}; };
@@ -4425,7 +4337,7 @@ public:
APhaseActionGeneric(GameObserver* observer, int _id, MTGCardInstance * card, MTGCardInstance * target, string sAbility, int restrictions = 0, int _phase = APhaseActionGeneric(GameObserver* observer, int _id, MTGCardInstance * card, MTGCardInstance * target, string sAbility, int restrictions = 0, int _phase =
MTG_PHASE_UPKEEP,bool forcedestroy = false,bool next = true,bool myturn = false,bool opponentturn = false,bool once = false); MTG_PHASE_UPKEEP,bool forcedestroy = false,bool next = true,bool myturn = false,bool opponentturn = false,bool once = false);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
APhaseActionGeneric * clone() const; APhaseActionGeneric * clone() const;
~APhaseActionGeneric(); ~APhaseActionGeneric();
@@ -4445,7 +4357,7 @@ public:
void Update(float dt); void Update(float dt);
void resolveBlink(); void resolveBlink();
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
ABlink * clone() const; ABlink * clone() const;
~ABlink(); ~ABlink();
private: private:
@@ -4463,7 +4375,7 @@ public:
MTGAbility * stored; MTGAbility * stored;
ABlinkGeneric(GameObserver* observer, int _id, MTGCardInstance * card, MTGCardInstance * _target,bool blinkueot=false,bool blinkForSource = false,bool blinkhand = false,MTGAbility * stored = NULL); ABlinkGeneric(GameObserver* observer, int _id, MTGCardInstance * card, MTGCardInstance * _target,bool blinkueot=false,bool blinkForSource = false,bool blinkhand = false,MTGAbility * stored = NULL);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
ABlinkGeneric * clone() const; ABlinkGeneric * clone() const;
~ABlinkGeneric(); ~ABlinkGeneric();
@@ -5369,7 +5281,7 @@ public:
return 1; return 1;
} }
const char * getMenuText() const string getMenuText()
{ {
return "phase alter"; return "phase alter";
} }
@@ -5388,7 +5300,7 @@ public:
AADepleter(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target,string nbcardsStr, ManaCost * _cost = NULL, AADepleter(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target,string nbcardsStr, ManaCost * _cost = NULL,
int who = TargetChooser::UNSET); int who = TargetChooser::UNSET);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AADepleter * clone() const; AADepleter * clone() const;
}; };
@@ -5401,7 +5313,7 @@ public:
AAModTurn(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target,string nbTurnStr, ManaCost * _cost = NULL, AAModTurn(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target,string nbTurnStr, ManaCost * _cost = NULL,
int who = TargetChooser::UNSET); int who = TargetChooser::UNSET);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AAModTurn * clone() const; AAModTurn * clone() const;
}; };
@@ -5412,7 +5324,7 @@ public:
AAShuffle(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost = NULL, int who = AAShuffle(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost = NULL, int who =
TargetChooser::UNSET); TargetChooser::UNSET);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AAShuffle * clone() const; AAShuffle * clone() const;
}; };
@@ -5425,7 +5337,7 @@ public:
AARemoveMana(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, string ManaDesc, int who = TargetChooser::UNSET); AARemoveMana(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, string ManaDesc, int who = TargetChooser::UNSET);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AARemoveMana * clone() const; AARemoveMana * clone() const;
~AARemoveMana(); ~AARemoveMana();
@@ -5440,7 +5352,7 @@ public:
AARandomDiscarder(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target,string nbcardsStr, ManaCost * _cost = NULL, AARandomDiscarder(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target,string nbcardsStr, ManaCost * _cost = NULL,
int who = TargetChooser::UNSET); int who = TargetChooser::UNSET);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AARandomDiscarder * clone() const; AARandomDiscarder * clone() const;
}; };
@@ -5612,7 +5524,7 @@ public:
int testDestroy(){return 0;}; int testDestroy(){return 0;};
void Update(float dt); void Update(float dt);
const char * getMenuText(); const string getMenuText();
int isReactingToTargetClick(Targetable * card); int isReactingToTargetClick(Targetable * card);
int reactToTargetClick(Targetable * object); int reactToTargetClick(Targetable * object);
MTGCardInstance * makeCard(); MTGCardInstance * makeCard();
@@ -5638,7 +5550,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))
@@ -5729,7 +5641,7 @@ public:
MTGAbility * abilityAltered; MTGAbility * abilityAltered;
AASetColorChosen(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, int _color = 0 ,string toAdd = ""); AASetColorChosen(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, int _color = 0 ,string toAdd = "");
int resolve(); int resolve();
const char* getMenuText(); const string getMenuText();
AASetColorChosen * clone() const; AASetColorChosen * clone() const;
~AASetColorChosen(); ~AASetColorChosen();
}; };
@@ -5742,7 +5654,7 @@ public:
MTGAbility * abilityAltered; MTGAbility * abilityAltered;
AASetTypeChosen(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, int _type = 0,string menu = "error" ,string toAdd = ""); AASetTypeChosen(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, int _type = 0,string menu = "error" ,string toAdd = "");
int resolve(); int resolve();
const char* getMenuText(); const string getMenuText();
AASetTypeChosen * clone() const; AASetTypeChosen * clone() const;
~AASetTypeChosen(); ~AASetTypeChosen();
}; };
@@ -5756,7 +5668,7 @@ public:
bool ANonWall; bool ANonWall;
GenericChooseTypeColor(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target, string toAdd = "",bool chooseColor = false,bool nonwall = false, ManaCost * cost = NULL); GenericChooseTypeColor(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target, string toAdd = "",bool chooseColor = false,bool nonwall = false, ManaCost * cost = NULL);
int resolve(); int resolve();
const char* getMenuText(); const string getMenuText();
GenericChooseTypeColor * clone() const; GenericChooseTypeColor * clone() const;
~GenericChooseTypeColor(); ~GenericChooseTypeColor();
@@ -5773,7 +5685,7 @@ public:
MTGAbility * abilityAltered; MTGAbility * abilityAltered;
AASetCoin(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, int side = -1,string toAdd = ""); AASetCoin(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, int side = -1,string toAdd = "");
int resolve(); int resolve();
const char* getMenuText(); const string getMenuText();
AASetCoin * clone() const; AASetCoin * clone() const;
~AASetCoin(); ~AASetCoin();
}; };
@@ -5784,7 +5696,7 @@ public:
AASetCoin * setCoin; AASetCoin * setCoin;
GenericFlipACoin(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target, string toAdd = "", ManaCost * cost = NULL); GenericFlipACoin(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target, string toAdd = "", ManaCost * cost = NULL);
int resolve(); int resolve();
const char* getMenuText(); const string getMenuText();
GenericFlipACoin * clone() const; GenericFlipACoin * clone() const;
~GenericFlipACoin(); ~GenericFlipACoin();
@@ -5803,7 +5715,7 @@ public:
GenericPaidAbility(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target,string _newName,string _castRestriction,string _mayCost, string toAdd, ManaCost * cost = NULL); GenericPaidAbility(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target,string _newName,string _castRestriction,string _mayCost, string toAdd, ManaCost * cost = NULL);
int resolve(); int resolve();
const char* getMenuText(); const string getMenuText();
GenericPaidAbility * clone() const; GenericPaidAbility * clone() const;
~GenericPaidAbility(); ~GenericPaidAbility();
+5
View File
@@ -1,3 +1,6 @@
#ifndef _CACHE_ENGINE_H_
#define _CACHE_ENGINE_H_
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "Threading.h" #include "Threading.h"
@@ -208,3 +211,5 @@ public:
CardRetrieverBase* CacheEngine::sInstance = NULL; CardRetrieverBase* CacheEngine::sInstance = NULL;
bool CacheEngine::sIsThreaded = false; bool CacheEngine::sIsThreaded = false;
#endif //_CACHE_ENGINE_H_
+6 -4
View File
@@ -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;
-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_
+1 -2
View File
@@ -101,10 +101,9 @@ public:
int removeType(string value, int removeAll = 0); int removeType(string value, int removeAll = 0);
int removeType(int value, int removeAll = 0); int removeType(int value, int removeAll = 0);
bool hasSubtype(int _subtype); bool hasSubtype(int _subtype);
bool hasSubtype(const char * _subtype);
bool hasSubtype(const string& _subtype); bool hasSubtype(const string& _subtype);
bool hasType(int _type); bool hasType(int _type);
bool hasType(const char * type); bool hasType(const string& type);
void setManaCost(const string& value); void setManaCost(const string& value);
ManaCost * getManaCost(); ManaCost * getManaCost();
+22 -16
View File
@@ -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
+4 -1
View File
@@ -1,3 +1,5 @@
#ifndef _DECK_EDITOR_MENU_H
#define _DECK_EDITOR_MENU_H
#pragma once #pragma once
#include "DeckMenu.h" #include "DeckMenu.h"
#include "DeckDataWrapper.h" #include "DeckDataWrapper.h"
@@ -15,7 +17,8 @@ private:
StatsWrapper *stw; StatsWrapper *stw;
public: public:
DeckEditorMenu(int id, JGuiListener* listener = NULL, int fontId = 1, const char * _title = "", DeckDataWrapper *selectedDeck = NULL, StatsWrapper *stats = NULL); DeckEditorMenu(int id, JGuiListener* listener = NULL, int fontId = 1, const string& _title = "", DeckDataWrapper *selectedDeck = NULL, StatsWrapper *stats = NULL);
void Render(); void Render();
virtual ~DeckEditorMenu(); virtual ~DeckEditorMenu();
}; };
#endif //_DECK_EDITOR_MENU_H
+5
View File
@@ -1,3 +1,6 @@
#ifndef _DECK_MANAGER_H
#define _DECK_MANAGER_H
#include <string> #include <string>
#include <vector> #include <vector>
@@ -43,3 +46,5 @@ public:
~DeckManager(); ~DeckManager();
}; };
#endif //_DECK_MANAGER_H
+1 -1
View File
@@ -79,7 +79,7 @@ public:
virtual void Render(); virtual void Render();
virtual void Update(float dt); virtual void Update(float dt);
using JGuiController::Add; using JGuiController::Add;
virtual void Add(int id, const char * Text, string desc = "", bool forceFocus = false, DeckMetaData *deckMetaData = NULL); virtual void Add(int id, const string& Text, const string& desc = "", bool forceFocus = false, DeckMetaData *deckMetaData = NULL);
virtual void Close(); virtual void Close();
void updateScroller(); void updateScroller();
void RenderBackground(); void RenderBackground();
+1 -3
View File
@@ -77,9 +77,7 @@ public:
} }
// Setters // Setters
void setDescription( const string description ) { mDescription = description; }; void setDescription( const string& description ) { mDescription = description; }
;
}; };
#endif #endif
+1 -1
View File
@@ -98,7 +98,7 @@ public:
string getManaColorIndex(); string getManaColorIndex();
void updateStats(string filename, MTGAllCards * collection); void updateStats(string filename, MTGAllCards * collection);
void updateStats(DeckDataWrapper *mtgDeck); void updateStats(DeckDataWrapper *mtgDeck);
int countCardsByType(const char * _type, DeckDataWrapper * myDeck); int countCardsByType(const string& _type, DeckDataWrapper * myDeck);
float noLuck(int n, int a, int x); float noLuck(int n, int a, int x);
vector<string> aiDeckNames; vector<string> aiDeckNames;
-2
View File
@@ -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;
+2 -2
View File
@@ -98,8 +98,8 @@ class GameObserver{
int cardClick(MTGCardInstance * card,Targetable * _object = NULL, bool log = true); int cardClick(MTGCardInstance * card,Targetable * _object = NULL, bool log = true);
GamePhase getCurrentGamePhase(); GamePhase getCurrentGamePhase();
void setCurrentGamePhase(GamePhase phase) { mCurrentGamePhase = phase; }; void setCurrentGamePhase(GamePhase phase) { mCurrentGamePhase = phase; };
const char * getCurrentGamePhaseName(); const string& getCurrentGamePhaseName();
const char * getNextGamePhaseName(); const string& getNextGamePhaseName();
void nextCombatStep(); void nextCombatStep();
void userRequestNextGamePhase(bool allowInterrupt = true, bool log = true); void userRequestNextGamePhase(bool allowInterrupt = true, bool log = true);
void cleanupPhase(); void cleanupPhase();
+5
View File
@@ -1,3 +1,6 @@
#ifndef _GUI_MANA_H
#define _GUI_MANA_H
#include "string.h" #include "string.h"
#include <vector> #include <vector>
#include <hge/hgeparticle.h> #include <hge/hgeparticle.h>
@@ -51,3 +54,5 @@ public:
virtual int receiveEventPlus(WEvent * e); virtual int receiveEventPlus(WEvent * e);
virtual int receiveEventMinus(WEvent * e); virtual int receiveEventMinus(WEvent * e);
}; };
#endif //_GUI_MANA_H
+3 -3
View File
@@ -317,7 +317,7 @@ public:
virtual TargetAbility* clone() const = 0; virtual TargetAbility* clone() const = 0;
virtual void Render(); virtual void Render();
virtual int resolve(); virtual int resolve();
virtual const char * getMenuText(); virtual const string getMenuText();
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
}; };
@@ -436,7 +436,7 @@ public:
void Update(float dt); void Update(float dt);
virtual GenericTriggeredAbility* clone() const; virtual GenericTriggeredAbility* clone() const;
const char * getMenuText(); const string getMenuText();
~GenericTriggeredAbility(); ~GenericTriggeredAbility();
}; };
@@ -525,7 +525,7 @@ public:
int isReactingToClick(MTGCardInstance * _card, ManaCost * mana = NULL); int isReactingToClick(MTGCardInstance * _card, ManaCost * mana = NULL);
int resolve(); int resolve();
int reactToClick(MTGCardInstance* _card); int reactToClick(MTGCardInstance* _card);
const char * getMenuText(); const string getMenuText();
~AManaProducer(); ~AManaProducer();
virtual AManaProducer * clone() const; virtual AManaProducer * clone() const;
}; };
+4 -4
View File
@@ -129,11 +129,11 @@ public:
//types //types
void addType(char * type_text); void addType(const string& type_text);
virtual void addType(int id); virtual void addType(int id);
void setType(const char * type_text); void setType(const string& type_text);
void setSubtype( string value); void setSubtype(const string &value);
int removeType(string value, int removeAll = 0); int removeType(const string &value, int removeAll = 0);
int removeType(int value, int removeAll = 0); int removeType(int value, int removeAll = 0);
//dangerranking is a hint to Ai which creatures are the ones it should be targetting for effects. //dangerranking is a hint to Ai which creatures are the ones it should be targetting for effects.
+8 -6
View File
@@ -19,7 +19,7 @@ class MTGPack;
class MTGSetInfo class MTGSetInfo
{ {
public: public:
MTGSetInfo(string _id); MTGSetInfo(const string& _id);
~MTGSetInfo(); ~MTGSetInfo();
string id; //Short name: 10E, RAV, etc. Automatic from folder. string id; //Short name: 10E, RAV, etc. Automatic from folder.
string author; //Author of set, for crediting mod makers, etc. string author; //Author of set, for crediting mod makers, etc.
@@ -70,7 +70,7 @@ public:
MTGSets(); MTGSets();
~MTGSets(); ~MTGSets();
int Add(const char * subtype); int Add(const string& subtype);
int findSet(string value); int findSet(string value);
int findBlock(string s); int findBlock(string s);
int size(); int size();
@@ -127,8 +127,10 @@ public:
MTGCard * getCardByName(string name); MTGCard * getCardByName(string name);
void loadFolder(const string& folder, const string& filename="" ); void loadFolder(const string& folder, const string& filename="" );
int load(const char * config_file, const char * setName = NULL, int autoload = 1); int load(const string& config_file);
int countByType(const char * _type); int load(const string& config_file, const string& setName);
int load(const string& config_file, int set_id);
int countByType(const string& _type);
int countByColor(int color); int countByColor(int color);
int countBySet(int setId); int countBySet(int setId);
int totalCards(); int totalCards();
@@ -218,8 +220,8 @@ public:
int totalCards(); int totalCards();
int totalPrice(); int totalPrice();
MTGDeck(MTGAllCards * _allcards); MTGDeck(MTGAllCards * _allcards);
MTGDeck(const char * config_file, MTGAllCards * _allcards, int meta_only = 0,int difficultySetting = 0); MTGDeck(const string& config_file, MTGAllCards * _allcards, int meta_only = 0,int difficultySetting = 0);
int addRandomCards(int howmany, int * setIds = NULL, int nbSets = 0, int rarity = -1, const char * subtype = NULL, int addRandomCards(int howmany, int * setIds = NULL, int nbSets = 0, int rarity = -1, const string& subtype = "",
int * colors = NULL, int nbcolors = 0); int * colors = NULL, int nbcolors = 0);
int add(int cardid); int add(int cardid);
int add(MTGDeck * deck); // adds the contents of "deck" into myself int add(MTGDeck * deck); // adds the contents of "deck" into myself
+1 -1
View File
@@ -293,7 +293,7 @@ class Constants
static map<string,int> MTGBasicAbilitiesMap; static map<string,int> MTGBasicAbilitiesMap;
static const char* MTGBasicAbilities[]; static const char* MTGBasicAbilities[];
static const char* MTGPhaseNames[]; static const string MTGPhaseNames[];
static const char* MTGPhaseCodeNames[]; static const char* MTGPhaseCodeNames[];
static int GetBasicAbilityIndex(string mtgAbility); static int GetBasicAbilityIndex(string mtgAbility);
+1 -1
View File
@@ -95,7 +95,7 @@ class MTGGameZone {
void cleanupPhase(); void cleanupPhase();
void beforeBeginPhase(); void beforeBeginPhase();
unsigned int countByType(const char * value); unsigned int countByType(const string &value);
unsigned int countByCanTarget(TargetChooser * tc); unsigned int countByCanTarget(TargetChooser * tc);
unsigned int countTotalManaSymbols(TargetChooser * tc, int color); unsigned int countTotalManaSymbols(TargetChooser * tc, int color);
MTGCardInstance * findByName(string name); MTGCardInstance * findByName(string name);
+1 -1
View File
@@ -1,4 +1,4 @@
#ifndef _MTGPACCK_H_ #ifndef _MTGPACK_H_
#define _MTGPACK_H_ #define _MTGPACK_H_
class ShopBooster; class ShopBooster;
+16 -16
View File
@@ -73,7 +73,7 @@ public:
int reactToClick(MTGCardInstance * card); int reactToClick(MTGCardInstance * card);
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
MTGPutInPlayRule(GameObserver* observer, int _id); MTGPutInPlayRule(GameObserver* observer, int _id);
const char * getMenuText() const string getMenuText()
{ {
return "cast card normally"; return "cast card normally";
} }
@@ -87,7 +87,7 @@ public:
int reactToClick(MTGCardInstance * card); int reactToClick(MTGCardInstance * card);
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
MTGKickerRule(GameObserver* observer, int _id); MTGKickerRule(GameObserver* observer, int _id);
const char * getMenuText() const string getMenuText()
{ {
return "pay kicker"; return "pay kicker";
} }
@@ -105,7 +105,7 @@ public:
int reactToClick(MTGCardInstance * card); int reactToClick(MTGCardInstance * card);
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
MTGAlternativeCostRule(GameObserver* observer, int _id); MTGAlternativeCostRule(GameObserver* observer, int _id);
const char * getMenuText() const string getMenuText()
{ {
if(alternativeName.size()) if(alternativeName.size())
return alternativeName.c_str(); return alternativeName.c_str();
@@ -121,7 +121,7 @@ public:
int reactToClick(MTGCardInstance * card); int reactToClick(MTGCardInstance * card);
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
MTGBuyBackRule(GameObserver* observer, int _id); MTGBuyBackRule(GameObserver* observer, int _id);
const char * getMenuText() const string getMenuText()
{ {
return "cast and buy back"; return "cast and buy back";
} }
@@ -136,7 +136,7 @@ public:
int reactToClick(MTGCardInstance * card); int reactToClick(MTGCardInstance * card);
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
MTGFlashBackRule(GameObserver* observer, int _id); MTGFlashBackRule(GameObserver* observer, int _id);
const char * getMenuText() const string getMenuText()
{ {
return "flash back"; return "flash back";
} }
@@ -150,7 +150,7 @@ public:
int reactToClick(MTGCardInstance * card); int reactToClick(MTGCardInstance * card);
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
MTGRetraceRule(GameObserver* observer, int _id); MTGRetraceRule(GameObserver* observer, int _id);
const char * getMenuText() const string getMenuText()
{ {
return "retrace"; return "retrace";
} }
@@ -165,7 +165,7 @@ public:
int reactToClick(MTGCardInstance * card); int reactToClick(MTGCardInstance * card);
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
MTGMorphCostRule(GameObserver* observer, int _id); MTGMorphCostRule(GameObserver* observer, int _id);
const char * getMenuText() const string getMenuText()
{ {
return "play morphed"; return "play morphed";
} }
@@ -181,7 +181,7 @@ public:
string suspendmenu; string suspendmenu;
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
MTGSuspendRule(GameObserver* observer, int _id); MTGSuspendRule(GameObserver* observer, int _id);
const char * getMenuText(); const string getMenuText();
virtual MTGSuspendRule * clone() const; virtual MTGSuspendRule * clone() const;
}; };
@@ -195,7 +195,7 @@ public:
int reactToClick(MTGCardInstance * card); int reactToClick(MTGCardInstance * card);
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
MTGAttackRule(GameObserver* observer, int _id); MTGAttackRule(GameObserver* observer, int _id);
const char * getMenuText() const string getMenuText()
{ {
return "Attacker"; return "Attacker";
} }
@@ -213,7 +213,7 @@ public:
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL); int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
int reactToClick(MTGCardInstance * card); int reactToClick(MTGCardInstance * card);
MTGPlaneswalkerAttackRule(GameObserver* observer, int _id); MTGPlaneswalkerAttackRule(GameObserver* observer, int _id);
const char * getMenuText() const string getMenuText()
{ {
return "Attack Planeswalker"; return "Attack Planeswalker";
} }
@@ -226,7 +226,7 @@ public:
MTGCardInstance* attacker; MTGCardInstance* attacker;
AAPlaneswalkerAttacked(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target); AAPlaneswalkerAttacked(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target);
int resolve(); int resolve();
const char* getMenuText(); const string getMenuText();
AAPlaneswalkerAttacked * clone() const; AAPlaneswalkerAttacked * clone() const;
~AAPlaneswalkerAttacked(); ~AAPlaneswalkerAttacked();
}; };
@@ -252,7 +252,7 @@ public:
int reactToClick(MTGCardInstance * card); int reactToClick(MTGCardInstance * card);
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
MTGBlockRule(GameObserver* observer, int _id); MTGBlockRule(GameObserver* observer, int _id);
const char * getMenuText(); const string getMenuText();
virtual MTGBlockRule * clone() const; virtual MTGBlockRule * clone() const;
~MTGBlockRule(); ~MTGBlockRule();
}; };
@@ -386,7 +386,7 @@ public:
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL); int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
int reactToClick(MTGCardInstance * card); int reactToClick(MTGCardInstance * card);
int reactToClick(MTGCardInstance * card, int id); int reactToClick(MTGCardInstance * card, int id);
const char * getMenuText() const string getMenuText()
{ {
return "Momir"; return "Momir";
} }
@@ -406,7 +406,7 @@ public:
MTGCardInstance * genEquip(int id); MTGCardInstance * genEquip(int id);
MTGStoneHewerRule(GameObserver* observer, int _id, MTGAllCards * _collection); MTGStoneHewerRule(GameObserver* observer, int _id, MTGAllCards * _collection);
int receiveEvent(WEvent * event); int receiveEvent(WEvent * event);
const char * getMenuText() const string getMenuText()
{ {
return "Stone Hewer"; return "Stone Hewer";
} }
@@ -419,7 +419,7 @@ class MTGHermitRule: public PermanentAbility
public: public:
MTGHermitRule(GameObserver* observer, int _id); MTGHermitRule(GameObserver* observer, int _id);
int receiveEvent(WEvent * event); int receiveEvent(WEvent * event);
const char * getMenuText() const string getMenuText()
{ {
return "Hermit"; return "Hermit";
} }
@@ -447,7 +447,7 @@ public:
int receiveEvent(WEvent * event); int receiveEvent(WEvent * event);
const char * getMenuText() const string getMenuText()
{ {
return "Deathtouch"; return "Deathtouch";
} }
-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
+1 -1
View File
@@ -62,7 +62,7 @@ public:
int addCombatAfter(Player* player, int after_id, bool withMain = false); int addCombatAfter(Player* player, int after_id, bool withMain = false);
int addPhaseAfter(GamePhase id, Player* player, int after_id); int addPhaseAfter(GamePhase id, Player* player, int after_id);
int removePhase(int id); int removePhase(int id);
const char * phaseName(int id); const string& phaseName(int id);
static GamePhase phaseStrToInt(string s); static GamePhase phaseStrToInt(string s);
static string phaseIntToStr(int id); static string phaseIntToStr(int id);
+3 -2
View File
@@ -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();
}; };
+1 -1
View File
@@ -43,7 +43,7 @@ public:
virtual bool CheckUserInput(JButton key); virtual bool CheckUserInput(JButton key);
virtual void Update(float dt); virtual void Update(float dt);
using JGuiController::Add; using JGuiController::Add;
virtual void Add(int id, const char * Text, string desc = "", bool forceFocus = false); virtual void Add(int id, const string &Text, string desc = "", bool forceFocus = false);
int getmCurr(){return mCurr;} int getmCurr(){return mCurr;}
float getWidth(){return mWidth; } float getWidth(){return mWidth; }
virtual void Close(); virtual void Close();
+5
View File
@@ -1,3 +1,6 @@
#ifndef _STYLE_MANAGER_H_
#define _STYLE_MANAGER_H_
class WStyle class WStyle
{ {
public: public:
@@ -34,3 +37,5 @@ protected:
string activeStyle; string activeStyle;
map<string, WStyle*> styles; map<string, WStyle*> styles;
}; };
#endif //_STYLE_MANAGER_H_
+16
View File
@@ -140,4 +140,20 @@ template <class T> istream& operator>>(istream& in, T& p)
/* replace_all ... replacement to avoid depending on boost for that */ /* replace_all ... replacement to avoid depending on boost for that */
void ReplaceString(std::string& subject, const std::string& search, const std::string& replace); void ReplaceString(std::string& subject, const std::string& search, const std::string& replace);
/*! \brief Returns true if base starts with start, otherwise false
*
* Compares the first strlen(start) characters of base with start and
* returns true if both match.
*/
bool StartsWith(const std::string& base, const char *start);
/*! \brief Returns true if base starts with start, otherwise false
*
* This version is slightly more efficient as strlen does not need to
* get called. Otherwise, it behaves exactly like
* StartsWith(const std::string& base, const char *start)
*
* \see StartsWith(const std::string& base, const char *start)
*/
bool StartsWith(const std::string& base, const std::string& start);
#endif #endif
+5 -7
View File
@@ -76,8 +76,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);
} }
@@ -309,14 +308,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;
for(unsigned int i = 0; i < hints.size();i++)
{
int comboPartsHold = 0; int comboPartsHold = 0;
int comboPartsUntil = 0; int comboPartsUntil = 0;
int comboPartsRestriction = 0; int comboPartsRestriction = 0;
for(unsigned int i = 0; i < hints.size();i++)
{
comboPartsHold = 0;
comboPartsUntil = 0;
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())
+2 -6
View File
@@ -92,13 +92,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);
@@ -108,7 +107,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))
{ {
@@ -120,15 +119,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();
+2 -2
View File
@@ -122,7 +122,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.
@@ -219,7 +219,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());
+10 -22
View File
@@ -135,10 +135,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;
@@ -153,12 +152,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;
@@ -589,8 +586,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;
@@ -979,11 +975,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
@@ -1047,7 +1042,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)
@@ -1062,7 +1056,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
@@ -1298,12 +1291,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))
{ {
@@ -1403,7 +1394,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())
@@ -1411,10 +1401,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]);
@@ -1526,7 +1515,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
@@ -1906,12 +1895,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++)
{ {
+5 -5
View File
@@ -27,7 +27,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;
@@ -50,7 +50,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()))
@@ -118,7 +118,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;
@@ -138,7 +138,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)
@@ -177,7 +177,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)
+2 -8
View File
@@ -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))
+4 -7
View File
@@ -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);
} }
+4 -3
View File
@@ -57,7 +57,7 @@ void NextGamePhase::Render()
if (observer->currentActionPlayer == observer->players[1]) if (observer->currentActionPlayer == observer->players[1])
playerId = 2; playerId = 2;
sprintf(buffer, "%s %i : %s", _("Player").c_str(), playerId, observer->getNextGamePhaseName()); sprintf(buffer, "%s %i : %s", _("Player").c_str(), playerId, observer->getNextGamePhaseName().c_str());
mFont->DrawString(buffer, x + 15, y+10, JGETEXT_LEFT); mFont->DrawString(buffer, x + 15, y+10, JGETEXT_LEFT);
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE); mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
@@ -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;
} }
@@ -675,6 +675,7 @@ ActionStack::ActionStack(GameObserver* game)
currentState = -1; currentState = -1;
mode = ACTIONSTACK_STANDARD; mode = ACTIONSTACK_STANDARD;
checked = 0; checked = 0;
lastActionController = NULL;
if(!observer->getResourceManager()) return; if(!observer->getResourceManager()) return;
for (int i = 0; i < 8; ++i) for (int i = 0; i < 8; ++i)
+187 -70
View File
@@ -55,6 +55,12 @@ GenericActivatedAbility::GenericActivatedAbility(GameObserver* observer, string
target = ability->target; target = ability->target;
} }
GenericActivatedAbility::GenericActivatedAbility(const GenericActivatedAbility &other):
ActivatedAbility(other), NestedAbility(other), activeZone(other.activeZone), newName(other.newName)
{
}
int GenericActivatedAbility::resolve() int GenericActivatedAbility::resolve()
{ {
//Note: I've seen a similar block in some other MTGAbility, can this be refactored . //Note: I've seen a similar block in some other MTGAbility, can this be refactored .
@@ -71,7 +77,7 @@ int GenericActivatedAbility::resolve()
return 0; return 0;
} }
const char * GenericActivatedAbility::getMenuText() const string GenericActivatedAbility::getMenuText()
{ {
if(newName.size()) if(newName.size())
return newName.c_str(); return newName.c_str();
@@ -105,6 +111,7 @@ int GenericActivatedAbility::testDestroy()
GenericActivatedAbility * GenericActivatedAbility::clone() const GenericActivatedAbility * GenericActivatedAbility::clone() const
{ {
GenericActivatedAbility * a = NEW GenericActivatedAbility(*this); GenericActivatedAbility * a = NEW GenericActivatedAbility(*this);
a->ability = ability->clone(); a->ability = ability->clone();
return a; return a;
} }
@@ -133,7 +140,7 @@ int AAAlterPoison::resolve()
return 0; return 0;
} }
const char * AAAlterPoison::getMenuText() const string AAAlterPoison::getMenuText()
{ {
return "Poison"; return "Poison";
} }
@@ -165,7 +172,7 @@ int AADamagePrevent::resolve()
return 0; return 0;
} }
const char * AADamagePrevent::getMenuText() const string AADamagePrevent::getMenuText()
{ {
return "Prevent Damage"; return "Prevent Damage";
} }
@@ -237,7 +244,7 @@ AADamager::AADamager(GameObserver* observer, int _id, MTGCardInstance * _source,
return damage.getValue(); return damage.getValue();
} }
const char * AADamager::getMenuText() const string AADamager::getMenuText()
{ {
MTGCardInstance * _target = dynamic_cast<MTGCardInstance*>(target); MTGCardInstance * _target = dynamic_cast<MTGCardInstance*>(target);
if(_target && _target->hasType(Subtypes::TYPE_PLANESWALKER)) if(_target && _target->hasType(Subtypes::TYPE_PLANESWALKER))
@@ -276,7 +283,7 @@ AADepleter::AADepleter(GameObserver* observer, int _id, MTGCardInstance * card,
return 1; return 1;
} }
const char * AADepleter::getMenuText() const string AADepleter::getMenuText()
{ {
return "Deplete"; return "Deplete";
} }
@@ -311,7 +318,7 @@ AAModTurn::AAModTurn(GameObserver* observer, int _id, MTGCardInstance * card, Ta
return 1; return 1;
} }
const char * AAModTurn::getMenuText() const string AAModTurn::getMenuText()
{ {
WParsedInt numTurns(nbTurnStr, NULL, source); WParsedInt numTurns(nbTurnStr, NULL, source);
if(numTurns.getValue() > 0) if(numTurns.getValue() > 0)
@@ -354,7 +361,7 @@ int AALibraryBottom::resolve()
return 0; return 0;
} }
const char * AALibraryBottom::getMenuText() const string AALibraryBottom::getMenuText()
{ {
return "Bottom Of Library"; return "Bottom Of Library";
} }
@@ -382,7 +389,7 @@ int AACopier::resolve()
return 0; return 0;
} }
const char * AACopier::getMenuText() const string AACopier::getMenuText()
{ {
return "Copy"; return "Copy";
} }
@@ -415,7 +422,7 @@ int AAPhaseOut::resolve()
return 0; return 0;
} }
const char * AAPhaseOut::getMenuText() const string AAPhaseOut::getMenuText()
{ {
return "Phase Out"; return "Phase Out";
} }
@@ -506,7 +513,7 @@ AACounter::AACounter(GameObserver* observer, int id, MTGCardInstance * source, M
return 0; return 0;
} }
const char* AACounter::getMenuText() const string AACounter::getMenuText()
{ {
if (menu.size()) if (menu.size())
{ {
@@ -695,7 +702,7 @@ int AARemoveAllCounter::resolve()
return nb; return nb;
} }
const char* AARemoveAllCounter::getMenuText() const string AARemoveAllCounter::getMenuText()
{ {
if (menu.size()) if (menu.size())
{ {
@@ -773,7 +780,7 @@ int AAProliferate::resolve()
} }
const char* AAProliferate::getMenuText() const string AAProliferate::getMenuText()
{ {
return "Proliferate"; return "Proliferate";
} }
@@ -816,7 +823,7 @@ int GenericChooseTypeColor::resolve()
for (size_t i = 0; i < values.size(); ++i) for (size_t i = 0; i < values.size(); ++i)
{ {
string menu = values[i]; string menu = values[i];
if(!ANonWall || (menu != "wall" && menu != "Wall")) if (!ANonWall || (menu != "wall" && menu != "Wall"))
{ {
setType = NEW AASetTypeChosen(game, game->mLayers->actionLayer()->getMaxId(), source,(MTGCardInstance*)target, i,menu,baseAbility); setType = NEW AASetTypeChosen(game, game->mLayers->actionLayer()->getMaxId(), source,(MTGCardInstance*)target, i,menu,baseAbility);
MTGAbility * set = setType->clone(); MTGAbility * set = setType->clone();
@@ -837,7 +844,7 @@ int GenericChooseTypeColor::resolve()
} }
const char* GenericChooseTypeColor::getMenuText() const string GenericChooseTypeColor::getMenuText()
{ {
if(chooseColor) if(chooseColor)
return "Choose a color"; return "Choose a color";
@@ -899,7 +906,7 @@ int AASetColorChosen::resolve()
return 1; return 1;
} }
const char* AASetColorChosen::getMenuText() const string AASetColorChosen::getMenuText()
{ {
return Constants::MTGColorStrings[color]; return Constants::MTGColorStrings[color];
} }
@@ -956,7 +963,7 @@ int AASetTypeChosen::resolve()
return 1; return 1;
} }
const char* AASetTypeChosen::getMenuText() const string AASetTypeChosen::getMenuText()
{ {
return menutext.c_str(); return menutext.c_str();
} }
@@ -1003,7 +1010,7 @@ int GenericFlipACoin::resolve()
} }
const char* GenericFlipACoin::getMenuText() const string GenericFlipACoin::getMenuText()
{ {
return "Flip A Coin"; return "Flip A Coin";
} }
@@ -1095,7 +1102,7 @@ int AASetCoin::resolve()
return 1; return 1;
} }
const char* AASetCoin::getMenuText() const string AASetCoin::getMenuText()
{ {
if(side == 1) if(side == 1)
return "Tails"; return "Tails";
@@ -1186,7 +1193,7 @@ int GenericPaidAbility::resolve()
return 1; return 1;
} }
const char* GenericPaidAbility::getMenuText() const string GenericPaidAbility::getMenuText()
{ {
if (newName.size()) if (newName.size())
return newName.c_str(); return newName.c_str();
@@ -1288,7 +1295,7 @@ int AAResetDamage::resolve()
return 1; return 1;
} }
const char* AAResetDamage::getMenuText() const string AAResetDamage::getMenuText()
{ {
return "Reset Damages"; return "Reset Damages";
} }
@@ -1309,7 +1316,7 @@ int AAFakeAbility::resolve()
return 1; return 1;
} }
const char* AAFakeAbility::getMenuText() const string AAFakeAbility::getMenuText()
{ {
if(named.size()) if(named.size())
return named.c_str(); return named.c_str();
@@ -1356,7 +1363,7 @@ int AAFizzler::resolve()
return 1; return 1;
} }
const char * AAFizzler::getMenuText() const string AAFizzler::getMenuText()
{ {
return "Fizzle"; return "Fizzle";
} }
@@ -1403,7 +1410,7 @@ int AABuryCard::resolve()
return 0; return 0;
} }
const char * AABuryCard::getMenuText() const string AABuryCard::getMenuText()
{ {
if(menu.size()) if(menu.size())
return menu.c_str(); return menu.c_str();
@@ -1459,7 +1466,7 @@ int AADestroyCard::resolve()
return 0; return 0;
} }
const char * AADestroyCard::getMenuText() const string AADestroyCard::getMenuText()
{ {
return "Destroy"; return "Destroy";
} }
@@ -1515,7 +1522,7 @@ int AASacrificeCard::resolve()
return 0; return 0;
} }
const char * AASacrificeCard::getMenuText() const string AASacrificeCard::getMenuText()
{ {
return "Sacrifice"; return "Sacrifice";
} }
@@ -1570,7 +1577,7 @@ int AADiscardCard::resolve()
return 0; return 0;
} }
const char * AADiscardCard::getMenuText() const string AADiscardCard::getMenuText()
{ {
return "Discard"; return "Discard";
} }
@@ -1634,7 +1641,7 @@ AADrawer::AADrawer(GameObserver* observer, int _id, MTGCardInstance * card, Targ
return numCards.getValue(); return numCards.getValue();
} }
const char * AADrawer::getMenuText() const string AADrawer::getMenuText()
{ {
return "Draw"; return "Draw";
} }
@@ -1663,7 +1670,7 @@ int AAFrozen::resolve()
return 1; return 1;
} }
const char * AAFrozen::getMenuText() const string AAFrozen::getMenuText()
{ {
return "Freeze"; return "Freeze";
} }
@@ -1728,7 +1735,7 @@ int AANewTarget::resolve()
return 1; return 1;
} }
const char * AANewTarget::getMenuText() const string AANewTarget::getMenuText()
{ {
return "New Target"; return "New Target";
} }
@@ -1809,7 +1816,7 @@ int AAMorph::testDestroy()
return 0; return 0;
} }
const char * AAMorph::getMenuText() const string AAMorph::getMenuText()
{ {
return "Morph"; return "Morph";
} }
@@ -1946,7 +1953,7 @@ int AAFlip::testDestroy()
return 0; return 0;
} }
const char * AAFlip::getMenuText() const string AAFlip::getMenuText()
{ {
string s = flipStats; string s = flipStats;
sprintf(menuText, "Transform:%s", s.c_str()); sprintf(menuText, "Transform:%s", s.c_str());
@@ -2252,7 +2259,7 @@ int AADynamic::activateStored()
return 1; return 1;
} }
const char * AADynamic::getMenuText() const string AADynamic::getMenuText()
{ {
if (menu.size()) if (menu.size())
{ {
@@ -2351,7 +2358,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();
} }
@@ -2367,7 +2374,7 @@ int AALifer::getLife()
return life.getValue(); return life.getValue();
} }
const char * AALifer::getMenuText() const string AALifer::getMenuText()
{ {
if(getLife() < 0) if(getLife() < 0)
return "Life Loss"; return "Life Loss";
@@ -2400,7 +2407,7 @@ int AASetHand::resolve()
return 1; return 1;
} }
const char * AASetHand::getMenuText() const string AASetHand::getMenuText()
{ {
return "Set Hand Size"; return "Set Hand Size";
} }
@@ -2431,7 +2438,7 @@ int AALifeSet::resolve()
return 1; return 1;
} }
const char * AALifeSet::getMenuText() const string AALifeSet::getMenuText()
{ {
return "Set Life"; return "Set Life";
} }
@@ -2513,7 +2520,7 @@ int AACloner::resolve()
} }
const char * AACloner::getMenuText() const string AACloner::getMenuText()
{ {
if (who == 1) if (who == 1)
return "Clone For Opponent"; return "Clone For Opponent";
@@ -2588,7 +2595,7 @@ int ACastRestriction::destroy()
return 1; return 1;
} }
const char * ACastRestriction::getMenuText() const string ACastRestriction::getMenuText()
{ {
if (modifyExisting) if (modifyExisting)
return "Additional Lands"; //hardoced because only the lands rule allows to modify existing rule for now return "Additional Lands"; //hardoced because only the lands rule allows to modify existing rule for now
@@ -2623,7 +2630,7 @@ int AInstantCastRestrictionUEOT::resolve()
wrapper->addToGame(); wrapper->addToGame();
return 1; return 1;
} }
const char * AInstantCastRestrictionUEOT::getMenuText() const string AInstantCastRestrictionUEOT::getMenuText()
{ {
return ability->getMenuText(); return ability->getMenuText();
} }
@@ -2717,14 +2724,14 @@ int AAMover::resolve()
return 0; return 0;
} }
const char * AAMover::getMenuText() const string AAMover::getMenuText()
{ {
if(named.size()) if(named.size())
return named.c_str(); return named.c_str();
return "Move"; return "Move";
} }
const char * AAMover::getMenuText(TargetChooser * tc) const char* AAMover::getMenuText(TargetChooser * tc)
{ {
if(named.size()) if(named.size())
return named.c_str(); return named.c_str();
@@ -2864,7 +2871,7 @@ int AARandomMover::resolve()
return 0; return 0;
} }
const char * AARandomMover::getMenuText() const string AARandomMover::getMenuText()
{ {
return "Dig"; return "Dig";
} }
@@ -2902,7 +2909,7 @@ int AARandomDiscarder::resolve()
return 1; return 1;
} }
const char * AARandomDiscarder::getMenuText() const string AARandomDiscarder::getMenuText()
{ {
return "Discard Random"; return "Discard Random";
} }
@@ -2929,7 +2936,7 @@ int AAShuffle::resolve()
return 1; return 1;
} }
const char * AAShuffle::getMenuText() const string AAShuffle::getMenuText()
{ {
return "Shuffle"; return "Shuffle";
} }
@@ -3027,7 +3034,7 @@ int AARemoveMana::resolve()
return 1; return 1;
} }
const char * AARemoveMana::getMenuText() const string AARemoveMana::getMenuText()
{ {
if (mRemoveAll && !mManaDesc) if (mRemoveAll && !mManaDesc)
return "Empty Manapool"; return "Empty Manapool";
@@ -3066,7 +3073,7 @@ int AATapper::resolve()
return 1; return 1;
} }
const char * AATapper::getMenuText() const string AATapper::getMenuText()
{ {
return "Tap"; return "Tap";
} }
@@ -3096,7 +3103,7 @@ int AAUntapper::resolve()
return 1; return 1;
} }
const char * AAUntapper::getMenuText() const string AAUntapper::getMenuText()
{ {
return "Untap"; return "Untap";
} }
@@ -3177,7 +3184,7 @@ int AAWinGame::resolve()
return 1; return 1;
} }
const char * AAWinGame::getMenuText() const string AAWinGame::getMenuText()
{ {
return "Win Game"; return "Win Game";
} }
@@ -3268,7 +3275,7 @@ int IfThenAbility::resolve()
return 0; return 0;
} }
const char * IfThenAbility::getMenuText() const string IfThenAbility::getMenuText()
{ {
return ""; return "";
} }
@@ -3320,7 +3327,7 @@ void MayAbility::Update(float dt)
} }
} }
const char * MayAbility::getMenuText() const string MayAbility::getMenuText()
{ {
return ability->getMenuText(); return ability->getMenuText();
} }
@@ -3456,7 +3463,7 @@ int MenuAbility::resolve()
return a->addToGame(); return a->addToGame();
} }
const char * MenuAbility::getMenuText() const string MenuAbility::getMenuText()
{ {
if((abilities.size() > 1 && must)||(abilities.size() > 2 && !must)) if((abilities.size() > 1 && must)||(abilities.size() > 2 && !must))
return "choose one"; return "choose one";
@@ -3657,7 +3664,7 @@ int MultiAbility::destroy()
return ActivatedAbility::destroy(); return ActivatedAbility::destroy();
} }
const char * MultiAbility::getMenuText() const string MultiAbility::getMenuText()
{ {
if (abilities.size() && abilities[0]) if (abilities.size() && abilities[0])
return abilities[0]->getMenuText(); return abilities[0]->getMenuText();
@@ -3696,7 +3703,7 @@ GenericTargetAbility::GenericTargetAbility(GameObserver* observer, string newNam
counters = 0; counters = 0;
} }
const char * GenericTargetAbility::getMenuText() const string GenericTargetAbility::getMenuText()
{ {
if (!ability) if (!ability)
return "Error"; return "Error";
@@ -4249,7 +4256,7 @@ int ATransformer::destroy()
return 1; return 1;
} }
const char * ATransformer::getMenuText() const string ATransformer::getMenuText()
{ {
if(menutext.size()) if(menutext.size())
return menutext.c_str(); return menutext.c_str();
@@ -4282,7 +4289,7 @@ int ATransformerInstant::resolve()
wrapper->addToGame(); wrapper->addToGame();
return 1; return 1;
} }
const char * ATransformerInstant::getMenuText() const string ATransformerInstant::getMenuText()
{ {
if(menu.size()) if(menu.size())
return menu.c_str(); return menu.c_str();
@@ -4316,7 +4323,7 @@ int PTInstant::resolve()
wrapper->addToGame(); wrapper->addToGame();
return 1; return 1;
} }
const char * PTInstant::getMenuText() const string PTInstant::getMenuText()
{ {
return ability->getMenuText(); return ability->getMenuText();
} }
@@ -4347,7 +4354,7 @@ int ASwapPTUEOT::resolve()
return 1; return 1;
} }
const char * ASwapPTUEOT::getMenuText() const string ASwapPTUEOT::getMenuText()
{ {
return ability->getMenuText(); return ability->getMenuText();
} }
@@ -4380,7 +4387,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);
@@ -4417,7 +4424,7 @@ int AAExchangeLife::resolve()
return 0; return 0;
} }
const char * AAExchangeLife::getMenuText() const string AAExchangeLife::getMenuText()
{ {
return "Exchange life"; return "Exchange life";
} }
@@ -4597,15 +4604,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();
@@ -4655,7 +4662,7 @@ int APreventDamageTypesUEOT::destroy()
return 1; return 1;
} }
const char * APreventDamageTypesUEOT::getMenuText() const string APreventDamageTypesUEOT::getMenuText()
{ {
return ability->getMenuText(); return ability->getMenuText();
} }
@@ -4725,7 +4732,7 @@ int AVanishing::resolve()
return 1; return 1;
} }
const char * AVanishing::getMenuText() const string AVanishing::getMenuText()
{ {
if(counterName.find("fade") != string::npos) if(counterName.find("fade") != string::npos)
return "Fading"; return "Fading";
@@ -4821,7 +4828,7 @@ int AUpkeep::resolve()
return 1; return 1;
} }
const char * AUpkeep::getMenuText() const string AUpkeep::getMenuText()
{ {
return "Upkeep"; return "Upkeep";
} }
@@ -4921,7 +4928,7 @@ int APhaseAction::resolve()
return 0; return 0;
} }
const char * APhaseAction::getMenuText() const string APhaseAction::getMenuText()
{ {
if(psMenuText.size()) if(psMenuText.size())
return psMenuText.c_str(); return psMenuText.c_str();
@@ -4958,7 +4965,7 @@ int APhaseActionGeneric::resolve()
return 1; return 1;
} }
const char * APhaseActionGeneric::getMenuText() const string APhaseActionGeneric::getMenuText()
{ {
return ability->getMenuText(); return ability->getMenuText();
} }
@@ -5116,7 +5123,7 @@ int ABlink::resolve()
{ {
return 0; return 0;
} }
const char * ABlink::getMenuText() const string ABlink::getMenuText()
{ {
return "Blink"; return "Blink";
} }
@@ -5147,7 +5154,7 @@ int ABlinkGeneric::resolve()
return 1; return 1;
} }
const char * ABlinkGeneric::getMenuText() const string ABlinkGeneric::getMenuText()
{ {
return "Blink"; return "Blink";
} }
@@ -5291,6 +5298,116 @@ AAConnect * AAConnect::clone() const
return NEW AAConnect(*this); return NEW AAConnect(*this);
} }
AEquip::AEquip(GameObserver* observer, int _id, MTGCardInstance * _source, ManaCost * _cost, int restrictions) :
TargetAbility(observer, _id, _source, NULL, _cost, restrictions)
{
aType = MTGAbility::STANDARD_EQUIP;
isAttach = restrictions != ActivatedAbility::AS_SORCERY;
}
int AEquip::unequip()
{
if (source->target)
{
source->target->equipment -= 1;
source->parentCards.clear();
for (unsigned int w = 0; w < source->target->childrenCards.size(); w++)
{
MTGCardInstance * child = source->target->childrenCards[w];
if (child == source)
source->target->childrenCards.erase(source->target->childrenCards.begin() + w);
}
}
source->target = NULL;
for (size_t i = 0; i < currentAbilities.size(); ++i)
{
MTGAbility * a = currentAbilities[i];
if (dynamic_cast<AEquip *> (a) || dynamic_cast<ATeach *> (a) || dynamic_cast<AAConnect *> (a)
|| dynamic_cast<AANewTarget *> (AbilityFactory::getCoreAbility(a))
|| (a->aType == MTGAbility::STANDARD_TOKENCREATOR && a->oneShot))
{
SAFE_DELETE(a);
continue;
}
game->removeObserver(currentAbilities[i]);
}
currentAbilities.clear();
return 1;
}
int AEquip::equip(MTGCardInstance * equipped)
{
source->target = equipped;
source->target->equipment += 1;
source->parentCards.push_back(equipped);
source->target->childrenCards.push_back((MTGCardInstance*)source);
AbilityFactory af(game);
af.getAbilities(&currentAbilities, NULL, source);
for (size_t i = 0; i < currentAbilities.size(); ++i)
{
MTGAbility * a = currentAbilities[i];
if (dynamic_cast<AEquip *> (a)) continue;
if (dynamic_cast<ATeach *> (a)) continue;
if (dynamic_cast<AAConnect *> (a)) continue;
if (dynamic_cast<AANewTarget *> (af.getCoreAbility(a))) continue;
if (a->aType == MTGAbility::STANDARD_TOKENCREATOR && a->oneShot)
{
a->forceDestroy = 1;
continue;
}
if (dynamic_cast<AACopier *> (af.getCoreAbility(a)))
{
a->forceDestroy = 1;
continue;
}
//we generally dont want to pass oneShot tokencreators to the cards
//we equip...
a->addToGame();
}
return 1;
}
int AEquip::resolve()
{
MTGCardInstance * mTarget = tc->getNextCardTarget();
if (!mTarget) return 0;
if (mTarget == source) return 0;
unequip();
equip(mTarget);
return 1;
}
const string AEquip::getMenuText()
{
if (isAttach)
return "Attach";
else
return "Equip";
}
int AEquip::testDestroy()
{
if (source->target && !game->isInPlay(source->target))
unequip();
if (!game->connectRule)
{
if (source->target && TargetAbility::tc && !TargetAbility::tc->canTarget((Targetable *)source->target,true))
unequip();
}
return TargetAbility::testDestroy();
}
int AEquip::destroy()
{
unequip();
return TargetAbility::destroy();
}
AEquip * AEquip::clone() const
{
return NEW AEquip(*this);
}
// casting a card for free, or casting a copy of a card. // casting a card for free, or casting a copy of a card.
AACastCard::AACastCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target,bool _restricted,bool _copied,bool asNormal,string _namedCard,string _name,bool _noEvent) : AACastCard::AACastCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target,bool _restricted,bool _copied,bool asNormal,string _namedCard,string _name,bool _noEvent) :
MTGAbility(observer, _id, _source),restricted(_restricted),asCopy(_copied),normal(asNormal),cardNamed(_namedCard),nameThis(_name),noEvent(_noEvent) MTGAbility(observer, _id, _source),restricted(_restricted),asCopy(_copied),normal(asNormal),cardNamed(_namedCard),nameThis(_name),noEvent(_noEvent)
@@ -5474,7 +5591,7 @@ int AACastCard::resolveSpell()
return 0; return 0;
} }
const char * AACastCard::getMenuText() const string AACastCard::getMenuText()
{ {
if(nameThis.size()) if(nameThis.size())
return nameThis.c_str(); return nameThis.c_str();
+2 -1
View File
@@ -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;
} }
-20
View File
@@ -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;
}
+5 -5
View File
@@ -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);
} }
+7 -7
View File
@@ -84,6 +84,9 @@ int CardPrimitive::init()
alias = 0; alias = 0;
restrictions = NULL; restrictions = NULL;
dredgeAmount = 0; dredgeAmount = 0;
power = 0;
toughness = 0;
return 1; return 1;
} }
@@ -225,6 +228,9 @@ void CardPrimitive::setSubtype(const string& value)
} }
} }
// "Artifact Creature" should have "Creature" as parent type
if (parentType == Subtypes::TYPE_ARTIFACT && isCreature())
parentType = Subtypes::TYPE_CREATURE;
int id = MTGAllCards::add(value, parentType); int id = MTGAllCards::add(value, parentType);
addType(id); addType(id);
@@ -344,18 +350,12 @@ bool CardPrimitive::hasSubtype(int _subtype)
return hasType(_subtype); return hasType(_subtype);
} }
bool CardPrimitive::hasType(const char * _type) bool CardPrimitive::hasType(const string& _type)
{ {
int id = MTGAllCards::findType(_type); int id = MTGAllCards::findType(_type);
return hasType(id); return hasType(id);
} }
bool CardPrimitive::hasSubtype(const char * _subtype)
{
int id = MTGAllCards::findType(_subtype);
return hasType(id);
}
bool CardPrimitive::hasSubtype(const string& _subtype) bool CardPrimitive::hasSubtype(const string& _subtype)
{ {
int id = MTGAllCards::findType(_subtype); int id = MTGAllCards::findType(_subtype);
+14 -14
View File
@@ -7,42 +7,42 @@
#include "Closest.cpp" #include "Closest.cpp"
#include "GameObserver.h" #include "GameObserver.h"
struct Left: public Exp struct CardSelectorLeft: public Exp
{ {
static inline bool test(CardSelector::Target* ref, CardSelector::Target* test) static inline bool test(CardSelector::Target* ref, CardSelector::Target* test)
{ {
return ref->x - test->x > fabs(ref->y - test->y); return ref->x - test->x > fabs(ref->y - test->y);
} }
}; };
struct Right: public Exp struct CardSelectorRight: public Exp
{ {
static inline bool test(CardSelector::Target* ref, CardSelector::Target* test) static inline bool test(CardSelector::Target* ref, CardSelector::Target* test)
{ {
return test->x - ref->x > fabs(ref->y - test->y); return test->x - ref->x > fabs(ref->y - test->y);
} }
}; };
struct Up: public Exp struct CardSelectorUp: public Exp
{ {
static inline bool test(CardSelector::Target* ref, CardSelector::Target* test) static inline bool test(CardSelector::Target* ref, CardSelector::Target* test)
{ {
return ref->y - test->y > fabs(ref->x - test->x); return ref->y - test->y > fabs(ref->x - test->x);
} }
}; };
struct Down: public Exp struct CardSelectorDown: public Exp
{ {
static inline bool test(CardSelector::Target* ref, CardSelector::Target* test) static inline bool test(CardSelector::Target* ref, CardSelector::Target* test)
{ {
return test->y - ref->y > fabs(ref->x - test->x); return test->y - ref->y > fabs(ref->x - test->x);
} }
}; };
struct Diff: public Exp struct CardSelectorDiff: public Exp
{ {
static inline bool test(CardSelector::Target* ref, CardSelector::Target* test) static inline bool test(CardSelector::Target* ref, CardSelector::Target* test)
{ {
return ref != test; return ref != test;
} }
}; };
struct True: public Exp struct CardSelectorTrue: public Exp
{ {
static inline bool test(CardSelector::Target*, CardSelector::Target*) static inline bool test(CardSelector::Target*, CardSelector::Target*)
{ {
@@ -66,7 +66,7 @@ CardSelector::SelectorMemory::SelectorMemory()
} }
CardSelector::CardSelector(GameObserver *observer, DuelLayers* duel) : CardSelector::CardSelector(GameObserver *observer, DuelLayers* duel) :
CardSelectorBase(observer), active(NULL), duel(duel), limitor(NULL), bigpos(300, 145, 1.0, 0.0, 220) CardSelectorBase(observer), active(NULL), duel(duel), limitor(NULL), bigpos(300, 145, 1.0, 0.0, 220), timer(0.0f)
{ {
} }
@@ -94,7 +94,7 @@ void CardSelector::Remove(CardSelector::Target* card)
CardView* c = dynamic_cast<CardView*> (active); CardView* c = dynamic_cast<CardView*> (active);
if (c) if (c)
c->zoom = 1.0f; c->zoom = 1.0f;
active = closest<Diff> (cards, limitor, active); active = closest<CardSelectorDiff> (cards, limitor, active);
c = dynamic_cast<CardView*> (active); c = dynamic_cast<CardView*> (active);
if (c) if (c)
c->zoom = 1.4f; c->zoom = 1.4f;
@@ -120,7 +120,7 @@ CardSelector::Target* CardSelector::fetchMemory(SelectorMemory& memory)
} }
// We come here if the card is not in the selector any more, or if // We come here if the card is not in the selector any more, or if
// it is there but it is now refused by the limitor. // it is there but it is now refused by the limitor.
return closest<True> (cards, limitor, memory.x, memory.y); return closest<CardSelectorTrue> (cards, limitor, memory.x, memory.y);
} }
void CardSelector::Push() void CardSelector::Push()
@@ -182,7 +182,7 @@ bool CardSelector::CheckUserInput(JButton key)
if(!jge) return false; if(!jge) return false;
if(jge->GetLeftClickCoordinates(x, y)) if(jge->GetLeftClickCoordinates(x, y))
{ {
active = closest<True> (cards, limitor, static_cast<float> (x), static_cast<float> (y)); active = closest<CardSelectorTrue> (cards, limitor, static_cast<float> (x), static_cast<float> (y));
} }
switch (key) switch (key)
@@ -196,16 +196,16 @@ bool CardSelector::CheckUserInput(JButton key)
goto switch_active; goto switch_active;
break; break;
case JGE_BTN_LEFT: case JGE_BTN_LEFT:
active = closest<Left> (cards, limitor, active); active = closest<CardSelectorLeft> (cards, limitor, active);
break; break;
case JGE_BTN_RIGHT: case JGE_BTN_RIGHT:
active = closest<Right> (cards, limitor, active); active = closest<CardSelectorRight> (cards, limitor, active);
break; break;
case JGE_BTN_UP: case JGE_BTN_UP:
active = closest<Up> (cards, limitor, active); active = closest<CardSelectorUp> (cards, limitor, active);
break; break;
case JGE_BTN_DOWN: case JGE_BTN_DOWN:
active = closest<Down> (cards, limitor, active); active = closest<CardSelectorDown> (cards, limitor, active);
break; break;
case JGE_BTN_CANCEL: case JGE_BTN_CANCEL:
mDrawMode = (mDrawMode + 1) % DrawMode::kNumDrawModes; mDrawMode = (mDrawMode + 1) % DrawMode::kNumDrawModes;
+15 -25
View File
@@ -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);
} }
+1 -1
View File
@@ -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;
} }
+1 -1
View File
@@ -7,7 +7,7 @@
#include <iomanip> #include <iomanip>
#include "Translate.h" #include "Translate.h"
DeckEditorMenu::DeckEditorMenu(int id, JGuiListener* listener, int fontId, const char * _title, DeckDataWrapper *_selectedDeck, StatsWrapper *stats) : DeckEditorMenu::DeckEditorMenu(int id, JGuiListener* listener, int fontId, const string& _title, DeckDataWrapper *_selectedDeck, StatsWrapper *stats) :
DeckMenu(id, listener, fontId, _title), selectedDeck(_selectedDeck), stw(stats) DeckMenu(id, listener, fontId, _title), selectedDeck(_selectedDeck), stw(stats)
{ {
backgroundName = "DeckEditorMenuBackdrop"; backgroundName = "DeckEditorMenuBackdrop";
+19 -17
View File
@@ -13,7 +13,7 @@
#include <iomanip> #include <iomanip>
namespace namespace DeckMenuConst
{ {
const float kVerticalMargin = 16; const float kVerticalMargin = 16;
const float kHorizontalMargin = 20; const float kHorizontalMargin = 20;
@@ -52,8 +52,8 @@ JGuiController(JGE::GetInstance(), id, listener), fontId(fontId), mShowDetailsSc
titleY = 15; titleY = 15;
titleWidth = 180; // width of inner box of title titleWidth = 180; // width of inner box of title
descX = 260 + kDescriptionHorizontalBoxPadding; descX = 260 + DeckMenuConst::kDescriptionHorizontalBoxPadding;
descY = 100 + kDescriptionVerticalBoxPadding; descY = 100 + DeckMenuConst::kDescriptionVerticalBoxPadding;
descHeight = 145; descHeight = 145;
descWidth = 195; descWidth = 195;
@@ -73,11 +73,11 @@ JGuiController(JGE::GetInstance(), id, listener), fontId(fontId), mShowDetailsSc
float scrollerWidth = 200.0f; float scrollerWidth = 200.0f;
float scrollerHeight = 28.0f; float scrollerHeight = 28.0f;
mScroller = NEW VerticalTextScroller(Fonts::MAIN_FONT, 14, 235, scrollerWidth, scrollerHeight, kVerticalScrollSpeed); mScroller = NEW VerticalTextScroller(Fonts::MAIN_FONT, 14, 235, scrollerWidth, scrollerHeight, DeckMenuConst::kVerticalScrollSpeed);
mAutoTranslate = true; mAutoTranslate = true;
maxItems = 6; maxItems = 6;
mHeight = 2 * kVerticalMargin + (maxItems * kLineHeight); mHeight = 2 * DeckMenuConst::kVerticalMargin + (maxItems * DeckMenuConst::kLineHeight);
// we want to cap the deck titles to 15 characters to avoid overflowing deck names // we want to cap the deck titles to 15 characters to avoid overflowing deck names
title = _(_title); title = _(_title);
@@ -94,7 +94,7 @@ JGuiController(JGE::GetInstance(), id, listener), fontId(fontId), mShowDetailsSc
else else
titleFontScale = SCALE_NORMAL; titleFontScale = SCALE_NORMAL;
mSelectionTargetY = selectionY = kVerticalMargin; mSelectionTargetY = selectionY = DeckMenuConst::kVerticalMargin;
if (NULL == stars) if (NULL == stars)
stars = NEW hgeParticleSystem(WResourceManager::Instance()->RetrievePSI("stars.psi", WResourceManager::Instance()->GetQuad("stars").get())); stars = NEW hgeParticleSystem(WResourceManager::Instance()->RetrievePSI("stars.psi", WResourceManager::Instance()->GetQuad("stars").get()));
@@ -106,7 +106,7 @@ JGuiController(JGE::GetInstance(), id, listener), fontId(fontId), mShowDetailsSc
float stringWidth = descriptionFont->GetStringWidth(detailedInfoString.c_str()); float stringWidth = descriptionFont->GetStringWidth(detailedInfoString.c_str());
float boxStartX = detailedInfoBoxX - stringWidth / 2 + 20; float boxStartX = detailedInfoBoxX - stringWidth / 2 + 20;
dismissButton = NEW InteractiveButton( this, kDetailedInfoButtonId, Fonts::MAIN_FONT, detailedInfoString, boxStartX, detailedInfoBoxY, JGE_BTN_CANCEL); dismissButton = NEW InteractiveButton( this, DeckMenuConst::kDetailedInfoButtonId, Fonts::MAIN_FONT, detailedInfoString, boxStartX, detailedInfoBoxY, JGE_BTN_CANCEL);
JGuiController::Add(dismissButton, true); JGuiController::Add(dismissButton, true);
updateScroller(); updateScroller();
@@ -181,7 +181,7 @@ bool DeckMenu::showDetailsScreen()
if (currentMenuItem) if (currentMenuItem)
{ {
if (mAlwaysShowDetailsButton) return true; if (mAlwaysShowDetailsButton) return true;
if (mShowDetailsScreen && currentMenuItem->getVictories() > DETAILED_INFO_THRESHOLD) return true; if (mShowDetailsScreen && currentMenuItem->getVictories() > DeckMenuConst::DETAILED_INFO_THRESHOLD) return true;
} }
return false; return false;
@@ -189,10 +189,10 @@ bool DeckMenu::showDetailsScreen()
void DeckMenu::initMenuItems() void DeckMenu::initMenuItems()
{ {
float sY = mY + kVerticalMargin; float sY = mY + DeckMenuConst::kVerticalMargin;
for (int i = startId; i < mCount; ++i) for (int i = startId; i < mCount; ++i)
{ {
float y = mY + kVerticalMargin + i * kLineHeight; float y = mY + DeckMenuConst::kVerticalMargin + i * DeckMenuConst::kLineHeight;
DeckMenuItem * currentMenuItem = static_cast<DeckMenuItem*> (mObjects[i]); DeckMenuItem * currentMenuItem = static_cast<DeckMenuItem*> (mObjects[i]);
currentMenuItem->Relocate(mX, y); currentMenuItem->Relocate(mX, y);
if (currentMenuItem->hasFocus()) sY = y; if (currentMenuItem->hasFocus()) sY = y;
@@ -248,7 +248,7 @@ void DeckMenu::Render()
{ {
if (i > mCount - 1) break; if (i > mCount - 1) break;
DeckMenuItem *currentMenuItem = static_cast<DeckMenuItem*> (mObjects[i]); DeckMenuItem *currentMenuItem = static_cast<DeckMenuItem*> (mObjects[i]);
if (currentMenuItem->getY() - kLineHeight * startId < mY + height - kLineHeight + 7) if (currentMenuItem->getY() - DeckMenuConst::kLineHeight * startId < mY + height - DeckMenuConst::kLineHeight + 7)
{ {
// only load stats for visible items in the list // only load stats for visible items in the list
DeckMetaData* metaData = currentMenuItem->getMetaData(); DeckMetaData* metaData = currentMenuItem->getMetaData();
@@ -293,6 +293,7 @@ void DeckMenu::Render()
// fill in the description part of the screen // fill in the description part of the screen
string text = wordWrap(_(currentMenuItem->getDescription()), descWidth, descriptionFont->mFontID ); string text = wordWrap(_(currentMenuItem->getDescription()), descWidth, descriptionFont->mFontID );
descriptionFont->SetColor(ARGB(255,255,255,255));
descriptionFont->DrawString(text.c_str(), descX, descY); descriptionFont->DrawString(text.c_str(), descX, descY);
// fill in the statistical portion // fill in the statistical portion
@@ -301,6 +302,7 @@ void DeckMenu::Render()
ostringstream oss; ostringstream oss;
oss << _("Deck: ") << currentMenuItem->getDeckName() << endl; oss << _("Deck: ") << currentMenuItem->getDeckName() << endl;
oss << currentMenuItem->getDeckStatsSummary(); oss << currentMenuItem->getDeckStatsSummary();
descriptionFont->SetColor(ARGB(255,255,255,255));
descriptionFont->DrawString(oss.str(), statsX, statsY); descriptionFont->DrawString(oss.str(), statsX, statsY);
} }
@@ -309,7 +311,7 @@ void DeckMenu::Render()
} }
else // reset the font color to be slightly muted else // reset the font color to be slightly muted
mFont->SetColor(ARGB(150,255,255,255)); mFont->SetColor(ARGB(150,255,255,255));
currentMenuItem->RenderWithOffset(-kLineHeight * startId); currentMenuItem->RenderWithOffset(-DeckMenuConst::kLineHeight * startId);
} }
} }
@@ -342,8 +344,8 @@ void DeckMenu::Update(float dt)
selectionT += 3 * dt; selectionT += 3 * dt;
selectionY += (mSelectionTargetY - selectionY) * 8 * dt; selectionY += (mSelectionTargetY - selectionY) * 8 * dt;
float starsX = starsOffsetX + ((mWidth - 2 * kHorizontalMargin) * (1 + cos(selectionT)) / 2); float starsX = starsOffsetX + ((mWidth - 2 * DeckMenuConst::kHorizontalMargin) * (1 + cos(selectionT)) / 2);
float starsY = selectionY + 5 * cos(selectionT * 2.35f) + kLineHeight / 2 - kLineHeight * startId; float starsY = selectionY + 5 * cos(selectionT * 2.35f) + DeckMenuConst::kLineHeight / 2 - DeckMenuConst::kLineHeight * startId;
stars->MoveTo(starsX, starsY); stars->MoveTo(starsX, starsY);
// //
@@ -368,10 +370,10 @@ void DeckMenu::Update(float dt)
} }
void DeckMenu::Add(int id, const char * text, string desc, bool forceFocus, DeckMetaData * deckMetaData) void DeckMenu::Add(int id, const string& text, const string& desc, bool forceFocus, DeckMetaData * deckMetaData)
{ {
DeckMenuItem * menuItem = NEW DeckMenuItem(this, id, fontId, text, 0, DeckMenuItem * menuItem = NEW DeckMenuItem(this, id, fontId, text, 0,
mY + kVerticalMargin + mCount * kLineHeight, (mCount == 0), mAutoTranslate, deckMetaData); mY + DeckMenuConst::kVerticalMargin + mCount * DeckMenuConst::kLineHeight, (mCount == 0), mAutoTranslate, deckMetaData);
Translator * t = Translator::GetInstance(); Translator * t = Translator::GetInstance();
map<string, string>::iterator it = t->deckValues.find(text); map<string, string>::iterator it = t->deckValues.find(text);
string deckDescription = ""; string deckDescription = "";
@@ -384,7 +386,7 @@ void DeckMenu::Add(int id, const char * text, string desc, bool forceFocus, Deck
menuItem->setDescription(deckDescription); menuItem->setDescription(deckDescription);
JGuiController::Add(menuItem); JGuiController::Add(menuItem);
if (mCount <= maxItems) mHeight += kLineHeight; if (mCount <= maxItems) mHeight += DeckMenuConst::kLineHeight;
if (forceFocus) if (forceFocus)
{ {
+18 -17
View File
@@ -271,22 +271,6 @@ void DeckStats::EndInstance()
// StatsWrapper // StatsWrapper
float noLandsProbInTurn[Constants::STATS_FOR_TURNS] = {0.0f};
float noCreaturesProbInTurn[Constants::STATS_FOR_TURNS] = {0.0f};
int countCardsPerCostAndColor[Constants::STATS_MAX_MANA_COST + 1][Constants::MTG_NB_COLORS + 1] = {{0,0}};
int countCreaturesPerCostAndColor[Constants::STATS_MAX_MANA_COST + 1][Constants::MTG_NB_COLORS + 1] = {{0,0}};
int countSpellsPerCostAndColor[Constants::STATS_MAX_MANA_COST + 1][Constants::MTG_NB_COLORS + 1] = {{0,0}};
int countCardsPerCost[Constants::STATS_MAX_MANA_COST + 1] = {0};
int countCreaturesPerCost[Constants::STATS_MAX_MANA_COST + 1] = {0};
int countSpellsPerCost[Constants::STATS_MAX_MANA_COST + 1] = {0};
int countLandsPerColor[Constants::MTG_NB_COLORS + 1] = {0};
int countBasicLandsPerColor[Constants::MTG_NB_COLORS + 1] = {0};
int countNonLandProducersPerColor[Constants::MTG_NB_COLORS + 1] = {0};
int totalCostPerColor[Constants::MTG_NB_COLORS + 1] = {0};
void StatsWrapper::initValues() void StatsWrapper::initValues()
{ {
// initilize all member values to 0 // initilize all member values to 0
@@ -302,6 +286,23 @@ void StatsWrapper::initValues()
countCreatures = countSpells = countInstants = countEnchantments = countSorceries = countArtifacts = 0; countCreatures = countSpells = countInstants = countEnchantments = countSorceries = countArtifacts = 0;
//this works only with 0.0f on floats
memset(noLandsProbInTurn, (int)0.0f, sizeof(float) * Constants::STATS_FOR_TURNS);
memset(noCreaturesProbInTurn, (int)0.0f, sizeof(float) * Constants::STATS_FOR_TURNS);
memset(countCardsPerCost, 0, sizeof(int) * (Constants::STATS_MAX_MANA_COST + 1));
memset(countCreaturesPerCost, 0, sizeof(int) * (Constants::STATS_MAX_MANA_COST + 1));
memset(countSpellsPerCost, 0, sizeof(int) * (Constants::STATS_MAX_MANA_COST + 1));
memset(countCardsPerCostAndColor, 0, sizeof(int) * (Constants::STATS_MAX_MANA_COST + 1)*(Constants::MTG_NB_COLORS + 1));
memset(countCreaturesPerCostAndColor, 0, sizeof(int) * (Constants::STATS_MAX_MANA_COST + 1)*(Constants::MTG_NB_COLORS + 1));
memset(countSpellsPerCostAndColor, 0, sizeof(int) * (Constants::STATS_MAX_MANA_COST + 1)*(Constants::MTG_NB_COLORS + 1));
memset(countLandsPerColor, 0, sizeof(int) * (Constants::MTG_NB_COLORS + 1));
memset(countBasicLandsPerColor, 0, sizeof(int) * (Constants::MTG_NB_COLORS + 1));
memset(countNonLandProducersPerColor, 0, sizeof(int) * (Constants::MTG_NB_COLORS + 1));
memset(totalCostPerColor, 0, sizeof(int) * (Constants::MTG_NB_COLORS + 1));
} }
StatsWrapper::StatsWrapper(int deckId) StatsWrapper::StatsWrapper(int deckId)
@@ -586,7 +587,7 @@ void StatsWrapper::updateStats(DeckDataWrapper *myDeck)
// This should probably be cached in DeckDataWrapper // This should probably be cached in DeckDataWrapper
// or at least be calculated for all common types in one go // or at least be calculated for all common types in one go
int StatsWrapper::countCardsByType(const char * _type, DeckDataWrapper * myDeck) int StatsWrapper::countCardsByType(const string& _type, DeckDataWrapper * myDeck)
{ {
int result = 0; int result = 0;
for (int i = 0; i < myDeck->Size(true); i++) for (int i = 0; i < myDeck->Size(true); i++)
+3 -3
View File
@@ -110,12 +110,12 @@ GamePhase GameObserver::getCurrentGamePhase()
return mCurrentGamePhase; return mCurrentGamePhase;
} }
const char* GameObserver::getCurrentGamePhaseName() const string& GameObserver::getCurrentGamePhaseName()
{ {
return phaseRing->phaseName(mCurrentGamePhase); return phaseRing->phaseName(mCurrentGamePhase);
} }
const char* GameObserver::getNextGamePhaseName() const string& GameObserver::getNextGamePhaseName()
{ {
return phaseRing->phaseName((mCurrentGamePhase + 1) % MTG_PHASE_CLEANUP); return phaseRing->phaseName((mCurrentGamePhase + 1) % MTG_PHASE_CLEANUP);
} }
@@ -1042,7 +1042,7 @@ void GameObserver::Affinity()
} }
else else
{ {
reduce = card->controller()->game->battlefield->countByType(type.c_str()); reduce = card->controller()->game->battlefield->countByType(type);
} }
for(int i = 0; i < reduce;i++) for(int i = 0; i < reduce;i++)
{ {
+8 -7
View File
@@ -818,9 +818,9 @@ void GameSettings::createUsersFirstDeck(int setId)
mCollection->addRandomCards(10, 0, 0, Constants::RARITY_L, "Island"); mCollection->addRandomCards(10, 0, 0, Constants::RARITY_L, "Island");
//Starter Deck //Starter Deck
mCollection->addRandomCards(3, sets, 1, Constants::RARITY_R, NULL); mCollection->addRandomCards(3, sets, 1, Constants::RARITY_R);
mCollection->addRandomCards(9, sets, 1, Constants::RARITY_U, NULL); mCollection->addRandomCards(9, sets, 1, Constants::RARITY_U);
mCollection->addRandomCards(48, sets, 1, Constants::RARITY_C, NULL); mCollection->addRandomCards(48, sets, 1, Constants::RARITY_C);
//Boosters //Boosters
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
@@ -956,7 +956,7 @@ OptionMaxGrade::OptionMaxGrade()
// MARK: OptionASkipPhase // MARK: OptionASkipPhase
OptionASkipPhase OptionASkipPhase::mDef; OptionASkipPhase OptionASkipPhase::mDef = OptionASkipPhase();
OptionASkipPhase::OptionASkipPhase() OptionASkipPhase::OptionASkipPhase()
{ {
mDef.values.push_back(EnumDefinition::assoc(Constants::ASKIP_NONE, "Off")); mDef.values.push_back(EnumDefinition::assoc(Constants::ASKIP_NONE, "Off"));
@@ -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)));
+1 -1
View File
@@ -134,7 +134,7 @@ void GameState::renderDeckMenu(DeckMenu * _menu, const vector<DeckMetaData *>& d
// deck sorting routines // deck sorting routines
bool sortByName(DeckMetaData * d1, DeckMetaData * d2) bool sortByName(DeckMetaData * d1, DeckMetaData * d2)
{ {
return strcmp(d1->getName().c_str(), d2->getName().c_str()) < 0; return d1->getName() < d2->getName();
} }
+5 -5
View File
@@ -21,7 +21,7 @@ enum ENUM_AWARDS_STATE
}; };
namespace namespace GameStateAwardsConst
{ {
const int kBackToTrophiesID = 2; const int kBackToTrophiesID = 2;
const int kBackToMainMenuID = 1; const int kBackToMainMenuID = 1;
@@ -186,8 +186,8 @@ void GameStateAwards::Update(float dt)
SAFE_DELETE(menu); SAFE_DELETE(menu);
menu = NEW SimpleMenu(JGE::GetInstance(), WResourceManager::Instance(), EXIT_AWARDS_MENU, this, Fonts::MENU_FONT, 50, 170); menu = NEW SimpleMenu(JGE::GetInstance(), WResourceManager::Instance(), EXIT_AWARDS_MENU, this, Fonts::MENU_FONT, 50, 170);
if (mState == STATE_DETAILS) if (mState == STATE_DETAILS)
menu->Add(kBackToTrophiesID, "Back to Trophies"); menu->Add(GameStateAwardsConst::kBackToTrophiesID, "Back to Trophies");
menu->Add(kBackToMainMenuID, "Back to Main Menu"); menu->Add(GameStateAwardsConst::kBackToMainMenuID, "Back to Main Menu");
menu->Add(kCancelMenuID, "Cancel"); menu->Add(kCancelMenuID, "Cancel");
break; break;
case JGE_BTN_PREV: case JGE_BTN_PREV:
@@ -359,11 +359,11 @@ void GameStateAwards::ButtonPressed(int controllerId, int controlId)
if (controllerId == EXIT_AWARDS_MENU) if (controllerId == EXIT_AWARDS_MENU)
switch (controlId) switch (controlId)
{ {
case kBackToMainMenuID: case GameStateAwardsConst::kBackToMainMenuID:
mParent->DoTransition(TRANSITION_FADE, GAME_STATE_MENU); mParent->DoTransition(TRANSITION_FADE, GAME_STATE_MENU);
showMenu = false; showMenu = false;
break; break;
case kBackToTrophiesID: case GameStateAwardsConst::kBackToTrophiesID:
mState = STATE_LISTVIEW; mState = STATE_LISTVIEW;
SAFE_DELETE(detailview); SAFE_DELETE(detailview);
showMenu = false; showMenu = false;
-16
View File
@@ -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")
{ {
+1
View File
@@ -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()
+8 -9
View File
@@ -7,13 +7,12 @@
#include "SimplePad.h" #include "SimplePad.h"
#include "Translate.h" #include "Translate.h"
namespace namespace GameStateOptionsConst
{ {
const int kSaveAndBackToMainMenuID = 1; const int kSaveAndBackToMainMenuID = 1;
const int kBackToMainMenuID = 2; const int kBackToMainMenuID = 2;
const int kNewProfileID = 4; const int kNewProfileID = 4;
const int kReloadID = 5; const int kReloadID = 5;
} }
GameStateOptions::GameStateOptions(GameApp* parent) : GameStateOptions::GameStateOptions(GameApp* parent) :
@@ -78,7 +77,7 @@ void GameStateOptions::Start()
optionsList->Add(NEW WGuiSplit(cPrf, cThm)); optionsList->Add(NEW WGuiSplit(cPrf, cThm));
optionsList->Add(cStyle); optionsList->Add(cStyle);
optionsList->Add(NEW WGuiButton(NEW WGuiHeader("New Profile"), -102, kNewProfileID, this)); optionsList->Add(NEW WGuiButton(NEW WGuiHeader("New Profile"), -102, GameStateOptionsConst::kNewProfileID, this));
optionsList->Add(NEW WDecoCheat(NEW OptionInteger(Options::CHEATMODE, "Enable Cheat Mode"))); optionsList->Add(NEW WDecoCheat(NEW OptionInteger(Options::CHEATMODE, "Enable Cheat Mode")));
optionsList->Add(NEW WDecoCheat(NEW OptionInteger(Options::OPTIMIZE_HAND, "Optimize Starting Hand"))); optionsList->Add(NEW WDecoCheat(NEW OptionInteger(Options::OPTIMIZE_HAND, "Optimize Starting Hand")));
@@ -118,8 +117,8 @@ void GameStateOptions::Start()
optionsTabs->Add(optionsList); optionsTabs->Add(optionsList);
optionsMenu = NEW SimpleMenu(JGE::GetInstance(), WResourceManager::Instance(), -102, this, Fonts::MAIN_FONT, 50, 170); optionsMenu = NEW SimpleMenu(JGE::GetInstance(), WResourceManager::Instance(), -102, this, Fonts::MAIN_FONT, 50, 170);
optionsMenu->Add(kBackToMainMenuID, "Back to Main Menu"); optionsMenu->Add(GameStateOptionsConst::kBackToMainMenuID, "Back to Main Menu");
optionsMenu->Add(kSaveAndBackToMainMenuID, "Save And Exit"); optionsMenu->Add(GameStateOptionsConst::kSaveAndBackToMainMenuID, "Save And Exit");
optionsMenu->Add(kCancelMenuID, "Cancel"); optionsMenu->Add(kCancelMenuID, "Cancel");
optionsTabs->Entering(JGE_BTN_NONE); optionsTabs->Entering(JGE_BTN_NONE);
@@ -285,21 +284,21 @@ void GameStateOptions::ButtonPressed(int controllerId, int controlId)
if (controllerId == -102) if (controllerId == -102)
switch (controlId) switch (controlId)
{ {
case kSaveAndBackToMainMenuID: case GameStateOptionsConst::kSaveAndBackToMainMenuID:
mState = SAVE; mState = SAVE;
break; break;
//Set Audio volume //Set Audio volume
case kBackToMainMenuID: case GameStateOptionsConst::kBackToMainMenuID:
mParent->DoTransition(TRANSITION_FADE, GAME_STATE_MENU); mParent->DoTransition(TRANSITION_FADE, GAME_STATE_MENU);
break; break;
case kCancelMenuID: case kCancelMenuID:
mState = SHOW_OPTIONS; mState = SHOW_OPTIONS;
break; break;
case kNewProfileID: case GameStateOptionsConst::kNewProfileID:
options.keypadStart("", &newProfile); options.keypadStart("", &newProfile);
options.keypadTitle("New Profile"); options.keypadTitle("New Profile");
break; break;
case kReloadID: case GameStateOptionsConst::kReloadID:
mReload = true; mReload = true;
break; break;
} }
+1 -1
View File
@@ -65,7 +65,7 @@ void GameStateStory::Update(float dt)
if (!menu && mEngine->GetButtonClick(JGE_BTN_MENU)) if (!menu && mEngine->GetButtonClick(JGE_BTN_MENU))
{ {
menu = NEW SimpleMenu(JGE::GetInstance(), WResourceManager::Instance(), 100, this, Fonts::MENU_FONT, SCREEN_WIDTH / 2 - 100, 25); menu = NEW SimpleMenu(JGE::GetInstance(), WResourceManager::Instance(), 100, this, Fonts::MENU_FONT, SCREEN_WIDTH / 2 - 100, 25);
menu->Add(0, "Back to main menu"); menu->Add(0, string("Back to main menu"));
menu->Add(kCancelMenuID, "Cancel"); menu->Add(kCancelMenuID, "Cancel");
} }
if (menu) if (menu)
+9 -9
View File
@@ -16,21 +16,21 @@ const float kZoom_level1 = 1.4f;
const float kZoom_level2 = 2.2f; const float kZoom_level2 = 2.2f;
const float kZoom_level3 = 2.7f; const float kZoom_level3 = 2.7f;
struct True: public Exp struct GuiCombatTrue: public Exp
{ {
static inline bool test(DamagerDamaged*, DamagerDamaged*) static inline bool test(DamagerDamaged*, DamagerDamaged*)
{ {
return true; return true;
} }
}; };
struct Left: public Exp struct GuiCombatLeft: public Exp
{ {
static inline bool test(DamagerDamaged* ref, DamagerDamaged* test) static inline bool test(DamagerDamaged* ref, DamagerDamaged* test)
{ {
return ref->y == test->y && ref->x > test->x && test->show; return ref->y == test->y && ref->x > test->x && test->show;
} }
}; };
struct Right: public Exp struct GuiCombatRight: public Exp
{ {
static inline bool test(DamagerDamaged* ref, DamagerDamaged* test) static inline bool test(DamagerDamaged* ref, DamagerDamaged* test)
{ {
@@ -217,7 +217,7 @@ void GuiCombat::shiftLeft()
case ATK: case ATK:
{ {
DamagerDamaged* old = active; DamagerDamaged* old = active;
active = closest<Left> (attackers, NULL, static_cast<AttackerDamaged*> (active)); active = closest<GuiCombatLeft> (attackers, NULL, static_cast<AttackerDamaged*> (active));
activeAtk = static_cast<AttackerDamaged*> (active); activeAtk = static_cast<AttackerDamaged*> (active);
if (old != active) if (old != active)
{ {
@@ -231,7 +231,7 @@ void GuiCombat::shiftLeft()
case BLK: case BLK:
{ {
DamagerDamaged* old = active; DamagerDamaged* old = active;
active = closest<Left> (activeAtk->blockers, NULL, static_cast<DefenserDamaged*> (active)); active = closest<GuiCombatLeft> (activeAtk->blockers, NULL, static_cast<DefenserDamaged*> (active));
if (old != active) if (old != active)
{ {
if (old) if (old)
@@ -255,7 +255,7 @@ void GuiCombat::shiftRight( DamagerDamaged* oldActive )
case BLK: case BLK:
{ {
DamagerDamaged* old = active; DamagerDamaged* old = active;
active = closest<Right> (activeAtk->blockers, NULL, static_cast<DefenserDamaged*> (active)); active = closest<GuiCombatRight> (activeAtk->blockers, NULL, static_cast<DefenserDamaged*> (active));
if (old != active) if (old != active)
{ {
if (old) if (old)
@@ -268,7 +268,7 @@ void GuiCombat::shiftRight( DamagerDamaged* oldActive )
case ATK: case ATK:
{ {
DamagerDamaged* old = active; DamagerDamaged* old = active;
active = closest<Right> (attackers, NULL, static_cast<AttackerDamaged*> (active)); active = closest<GuiCombatRight> (attackers, NULL, static_cast<AttackerDamaged*> (active));
if (active == oldActive) if (active == oldActive)
{ {
active = activeAtk = NULL; active = activeAtk = NULL;
@@ -321,7 +321,7 @@ bool GuiCombat::CheckUserInput(JButton key)
// position selected card // position selected card
if (BLK == cursor_pos) if (BLK == cursor_pos)
{ {
DamagerDamaged* selectedCard = closest<True> (activeAtk->blockers, NULL, static_cast<float> (x), static_cast<float> (y)); DamagerDamaged* selectedCard = closest<GuiCombatTrue> (activeAtk->blockers, NULL, static_cast<float> (x), static_cast<float> (y));
// find the index into the vector where the current selected card is. // find the index into the vector where the current selected card is.
int c1 = 0, c2 = 0; int c1 = 0, c2 = 0;
int i = 0; int i = 0;
@@ -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));
-56
View File
@@ -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;
}
+9 -5
View File
@@ -1145,7 +1145,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
} }
if(strncmp(s.c_str(), "chooseacolor ", strlen("chooseacolor ")) == 0 || strncmp(s.c_str(), "chooseatype ", strlen("chooseatype ")) == 0) if (StartsWith(s, "chooseacolor ") || StartsWith(s, "chooseatype "))
{ {
MTGAbility * choose = parseChooseActionAbility(s,card,spell,target,0,id); MTGAbility * choose = parseChooseActionAbility(s,card,spell,target,0,id);
choose = NEW GenericActivatedAbility(observer, "","",id, card,choose,NULL); choose = NEW GenericActivatedAbility(observer, "","",id, card,choose,NULL);
@@ -2163,6 +2163,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
return NEW AEquip(observer, id, card); return NEW AEquip(observer, id, card);
} }
// TODO: deprecate this ability in favor of retarget
//Equipment (attach) //Equipment (attach)
found = s.find("attach"); found = s.find("attach");
if (found != string::npos) if (found != string::npos)
@@ -4367,6 +4368,7 @@ MTGAbility::MTGAbility(GameObserver* observer, int id, MTGCardInstance * card) :
aType = MTGAbility::UNKNOWN; aType = MTGAbility::UNKNOWN;
mCost = NULL; mCost = NULL;
forceDestroy = 0; forceDestroy = 0;
forcedAlive = 0;
oneShot = 0; oneShot = 0;
canBeInterrupted = true; canBeInterrupted = true;
} }
@@ -4380,6 +4382,7 @@ MTGAbility::MTGAbility(GameObserver* observer, int id, MTGCardInstance * _source
aType = MTGAbility::UNKNOWN; aType = MTGAbility::UNKNOWN;
mCost = NULL; mCost = NULL;
forceDestroy = 0; forceDestroy = 0;
forcedAlive = 0;
oneShot = 0; oneShot = 0;
canBeInterrupted = true; canBeInterrupted = true;
} }
@@ -4476,7 +4479,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;
@@ -4892,7 +4895,7 @@ int TargetAbility::resolve()
return 0; return 0;
} }
const char * TargetAbility::getMenuText() const string TargetAbility::getMenuText()
{ {
if (ability) if (ability)
return ability->getMenuText(); return ability->getMenuText();
@@ -5422,7 +5425,7 @@ GenericTriggeredAbility::~GenericTriggeredAbility()
SAFE_DELETE(destroyCondition); SAFE_DELETE(destroyCondition);
} }
const char * GenericTriggeredAbility::getMenuText() const string GenericTriggeredAbility::getMenuText()
{ {
return ability->getMenuText(); return ability->getMenuText();
} }
@@ -5450,6 +5453,7 @@ AManaProducer::AManaProducer(GameObserver* observer, int id, MTGCardInstance * c
aType = MTGAbility::MANA_PRODUCER; aType = MTGAbility::MANA_PRODUCER;
setCost(_cost); setCost(_cost);
output = _output; output = _output;
tap = 0;
Producing = producing; Producing = producing;
menutext = ""; menutext = "";
DoesntEmpty = doesntEmpty; DoesntEmpty = doesntEmpty;
@@ -5515,7 +5519,7 @@ int AManaProducer::reactToClick(MTGCardInstance * _card)
return ActivatedAbility::activateAbility(); return ActivatedAbility::activateAbility();
} }
const char * AManaProducer::getMenuText() const string AManaProducer::getMenuText()
{ {
if (menutext.size()) if (menutext.size())
return menutext.c_str(); return menutext.c_str();
+7 -4
View File
@@ -125,6 +125,7 @@ int MTGCardInstance::init()
void MTGCardInstance::initMTGCI() void MTGCardInstance::initMTGCI()
{ {
X = 0;
sample = ""; sample = "";
model = NULL; model = NULL;
isToken = false; isToken = false;
@@ -195,6 +196,8 @@ void MTGCardInstance::initMTGCI()
lastController = NULL; lastController = NULL;
regenerateTokens = 0; regenerateTokens = 0;
blocked = false; blocked = false;
graveEffects = false;
exileEffects = false;
currentZone = NULL; currentZone = NULL;
cardsAbilities = vector<MTGAbility *>(); cardsAbilities = vector<MTGAbility *>();
data = this; //an MTGCardInstance point to itself for data, allows to update it without killing the underlying database item data = this; //an MTGCardInstance point to itself for data, allows to update it without killing the underlying database item
@@ -254,22 +257,22 @@ void MTGCardInstance::addType(int type)
SAFE_DELETE(e); SAFE_DELETE(e);
} }
void MTGCardInstance::addType(char * type_text) void MTGCardInstance::addType(const string& type_text)
{ {
setSubtype(type_text); setSubtype(type_text);
} }
void MTGCardInstance::setType(const char * type_text) void MTGCardInstance::setType(const string& type_text)
{ {
setSubtype(type_text); setSubtype(type_text);
} }
void MTGCardInstance::setSubtype(string value) void MTGCardInstance::setSubtype(const string& value)
{ {
int id = MTGAllCards::findType(value); int id = MTGAllCards::findType(value);
addType(id); addType(id);
} }
int MTGCardInstance::removeType(string value, int removeAll) int MTGCardInstance::removeType(const string& value, int removeAll)
{ {
int id = MTGAllCards::findType(value); int id = MTGAllCards::findType(value);
return removeType(id, removeAll); return removeType(id, removeAll);
+46 -34
View File
@@ -47,33 +47,33 @@ static inline int getGrade(int v)
int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primitive) int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primitive)
{ {
if ('#' == s[0]) return 1; // a comment shouldn't be treated as an error condition if ('#' == s[0]) return 1; // a comment shouldn't be treated as an error condition
size_t i = s.find_first_of('='); size_t del_pos = s.find_first_of('=');
if (i == string::npos || 0 == i) if (del_pos == string::npos || 0 == del_pos)
return 0; return 0;
char* key = const_cast<char*> (s.c_str()); // I know what I'm doing, let me do it s[del_pos] = '\0';
key[i] = 0; const string key = s.substr(0, del_pos);
char* val = key + i + 1; const string val = s.substr(del_pos + 1);
switch (key[0]) switch (key[0])
{ {
case 'a': case 'a':
if (0 == strcmp("auto", key)) if (key == "auto")
{ {
if (!primitive) primitive = NEW CardPrimitive(); if (!primitive) primitive = NEW CardPrimitive();
primitive->addMagicText(val); primitive->addMagicText(val);
} }
else if (0 == strncmp("auto", key, 4)) else if (StartsWith(key, "auto"))
{ {
if (!primitive) primitive = NEW CardPrimitive(); if (!primitive) primitive = NEW CardPrimitive();
primitive->addMagicText(val, key + 4); primitive->addMagicText(val, key.substr(4));
} }
else if (0 == strcmp("alias", key)) else if (key == "alias")
{ {
if (!primitive) primitive = NEW CardPrimitive(); if (!primitive) primitive = NEW CardPrimitive();
primitive->alias = atoi(val); primitive->alias = atoi(val.c_str());
} }
else if (0 == strcmp("abilities", key)) else if (key == "abilities")
{ {
if (!primitive) primitive = NEW CardPrimitive(); if (!primitive) primitive = NEW CardPrimitive();
string value = val; string value = val;
@@ -152,12 +152,12 @@ int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primi
} }
case 'g': //grade case 'g': //grade
if (s.size() - i - 1 > 2) currentGrade = getGrade(val[2]); if (s.size() - del_pos - 1 > 2) currentGrade = getGrade(val[2]);
break; break;
case 'i': //id case 'i': //id
if (!card) card = NEW MTGCard(); if (!card) card = NEW MTGCard();
card->setMTGId(atoi(val)); card->setMTGId(atoi(val.c_str()));
break; break;
case 'k': //kicker case 'k': //kicker
@@ -222,7 +222,7 @@ int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primi
break; break;
case 'p': case 'p':
if ('r' == key[1]) if (key[1] == 'r')
{ // primitive { // primitive
if (!card) card = NEW MTGCard(); if (!card) card = NEW MTGCard();
map<string, CardPrimitive*>::iterator it = primitives.find(val); map<string, CardPrimitive*>::iterator it = primitives.find(val);
@@ -231,18 +231,18 @@ int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primi
else else
{ //power { //power
if (!primitive) primitive = NEW CardPrimitive(); if (!primitive) primitive = NEW CardPrimitive();
primitive->setPower(atoi(val)); primitive->setPower(atoi(val.c_str()));
} }
break; break;
case 'r': //retrace/rarity//restrictions case 'r': //retrace/rarity//restrictions
if('s' == key[2] && 't' == key[3])//restrictions if(key[2] == 's' && key[3] == 't')//restrictions
{ {
if (!primitive) primitive = NEW CardPrimitive(); if (!primitive) primitive = NEW CardPrimitive();
string value = val; string value = val;
primitive->setRestrictions(value); primitive->setRestrictions(value);
} }
else if ('e' == key[1] && 't' == key[2]) else if (key[1] == 'e' && key[2] == 't')
{ //retrace { //retrace
if (!primitive) primitive = NEW CardPrimitive(); if (!primitive) primitive = NEW CardPrimitive();
if (ManaCost * cost = primitive->getManaCost()) if (ManaCost * cost = primitive->getManaCost())
@@ -279,7 +279,7 @@ int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primi
else else
{ {
if (!primitive) primitive = NEW CardPrimitive(); if (!primitive) primitive = NEW CardPrimitive();
vector<string> values = split(val, ' '); vector<string> values = split(val.c_str(), ' ');
for (size_t values_i = 0; values_i < values.size(); ++values_i) for (size_t values_i = 0; values_i < values.size(); ++values_i)
primitive->setSubtype(values[values_i]); primitive->setSubtype(values[values_i]);
} }
@@ -288,21 +288,21 @@ int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primi
case 't': case 't':
if (!primitive) primitive = NEW CardPrimitive(); if (!primitive) primitive = NEW CardPrimitive();
if (0 == strcmp("target", key)) if (key == "target")
{ {
string value = val; string value = val;
std::transform(value.begin(), value.end(), value.begin(), ::tolower); std::transform(value.begin(), value.end(), value.begin(), ::tolower);
primitive->spellTargetType = value; primitive->spellTargetType = value;
} }
else if (0 == strcmp("text", key)) else if (key == "text")
primitive->setText(val); primitive->setText(val);
else if (0 == strcmp("type", key)) else if (key == "type")
{ {
vector<string> values = split(val, ' '); vector<string> values = split(val, ' ');
for (size_t values_i = 0; values_i < values.size(); ++values_i) for (size_t values_i = 0; values_i < values.size(); ++values_i)
primitive->setType(values[values_i]); primitive->setType(values[values_i]);
} }
else if (0 == strcmp("toughness", key)) primitive->setToughness(atoi(val)); else if (key == "toughness") primitive->setToughness(atoi(val.c_str()));
break; break;
default: default:
@@ -317,7 +317,7 @@ int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primi
tempPrimitive = primitive; tempPrimitive = primitive;
tempCard = card; tempCard = card;
return i; return del_pos;
} }
@@ -381,10 +381,20 @@ void MTGAllCards::loadFolder(const string& infolder, const string& filename )
} }
} }
int MTGAllCards::load(const char * config_file, const char * set_name, int) int MTGAllCards::load(const string &config_file)
{
return load(config_file, MTGSets::INTERNAL_SET);
}
int MTGAllCards::load(const string& config_file, const string &set_name)
{
const int set_id = setlist.Add(set_name);
return load(config_file, set_id);
}
int MTGAllCards::load(const string &config_file, int set_id)
{ {
conf_read_mode = 0; conf_read_mode = 0;
const int set_id = set_name ? setlist.Add(set_name) : MTGSets::INTERNAL_SET;
MTGSetInfo *si = setlist.getInfo(set_id); MTGSetInfo *si = setlist.getInfo(set_id);
int lineNumber = 0; int lineNumber = 0;
@@ -532,14 +542,16 @@ int MTGAllCards::countBySet(int setId)
} }
//TODO more efficient way ? //TODO more efficient way ?
int MTGAllCards::countByType(const char * _type) int MTGAllCards::countByType(const string &_type)
{ {
int type_id = findType(_type);
int result = 0; int result = 0;
map<int, MTGCard *>::iterator it; map<int, MTGCard *>::iterator it;
for (it = collection.begin(); it != collection.end(); it++) for (it = collection.begin(); it != collection.end(); it++)
{ {
MTGCard * c = it->second; MTGCard * c = it->second;
if (c->data->hasType(_type)) if (c->data->hasType(type_id))
{ {
result++; result++;
} }
@@ -772,7 +784,7 @@ int MTGDeck::totalPrice()
return total; return total;
} }
MTGDeck::MTGDeck(const char * config_file, MTGAllCards * _allcards, int meta_only,int difficultyRating) MTGDeck::MTGDeck(const string& config_file, MTGAllCards * _allcards, int meta_only, int difficultyRating)
{ {
total_cards = 0; total_cards = 0;
database = _allcards; database = _allcards;
@@ -879,7 +891,7 @@ MTGCard * MTGDeck::getCardById(int mtgId)
return database->getCardById(mtgId); return database->getCardById(mtgId);
} }
int MTGDeck::addRandomCards(int howmany, int * setIds, int nbSets, int rarity, const char * _subtype, int * colors, int nbcolors) int MTGDeck::addRandomCards(int howmany, int * setIds, int nbSets, int rarity, const string &_subtype, int * colors, int nbcolors)
{ {
if (howmany <= 0) return 1; if (howmany <= 0) return 1;
@@ -900,8 +912,8 @@ int MTGDeck::addRandomCards(int howmany, int * setIds, int nbSets, int rarity, c
int collectionTotal = database->totalCards(); int collectionTotal = database->totalCards();
if (!collectionTotal) return 0; if (!collectionTotal) return 0;
char subtype[4096]; string subtype;
if (_subtype) sprintf(subtype, "%s", _subtype); if (_subtype.size()) subtype = _subtype;
vector<int> subcollection; vector<int> subcollection;
int subtotal = 0; int subtotal = 0;
@@ -911,7 +923,7 @@ int MTGDeck::addRandomCards(int howmany, int * setIds, int nbSets, int rarity, c
int r = card->getRarity(); int r = card->getRarity();
if (r != Constants::RARITY_T && (rarity == -1 || r == rarity) && // remove tokens if (r != Constants::RARITY_T && (rarity == -1 || r == rarity) && // remove tokens
card->setId != MTGSets::INTERNAL_SET && //remove cards that are defined in primitives. Those are workarounds (usually tokens) and should only be used internally card->setId != MTGSets::INTERNAL_SET && //remove cards that are defined in primitives. Those are workarounds (usually tokens) and should only be used internally
(!_subtype || card->data->hasSubtype(subtype))) (!_subtype.size() || card->data->hasSubtype(subtype)))
{ {
int ok = 0; int ok = 0;
@@ -1265,7 +1277,7 @@ MTGSetInfo* MTGSets::randomSet(int blockId, int atleast)
int blockSize(int blockId); int blockSize(int blockId);
int MTGSets::Add(const char * name) int MTGSets::Add(const string& name)
{ {
int setid = findSet(name); int setid = findSet(name);
if (setid != -1) return setid; if (setid != -1) return setid;
@@ -1344,7 +1356,7 @@ MTGSetInfo::~MTGSetInfo()
SAFE_DELETE(mPack); SAFE_DELETE(mPack);
} }
MTGSetInfo::MTGSetInfo(string _id) MTGSetInfo::MTGSetInfo(const string& _id)
{ {
string whitespaces(" \t\f\v\n\r"); string whitespaces(" \t\f\v\n\r");
id = _id; id = _id;
+1 -1
View File
@@ -162,7 +162,7 @@ int Constants::GetColorStringIndex(string mtgColor)
return -1; return -1;
} }
const char* Constants::MTGPhaseNames[] = const string Constants::MTGPhaseNames[] =
{ {
"---", "---",
"Untap", "Untap",
+4 -4
View File
@@ -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;
} }
+2 -2
View File
@@ -529,7 +529,7 @@ size_t MTGGameZone::getIndex(MTGCardInstance * card)
} }
unsigned int MTGGameZone::countByType(const char * value) unsigned int MTGGameZone::countByType(const string &value)
{ {
int result = 0; int result = 0;
int subTypeId = MTGAllCards::findType(value); int subTypeId = MTGAllCards::findType(value);
@@ -539,7 +539,7 @@ unsigned int MTGGameZone::countByType(const char * value)
{ {
result++; result++;
} }
else if(strcmp(value, "token") == 0 && cards[i]->isToken) else if(value == "token" && cards[i]->isToken)
result++; result++;
} }
return result; return result;
+1 -1
View File
@@ -293,7 +293,7 @@ void MTGPacks::loadAll()
sprintf(myFilename, "packs/%s",relative.c_str()); sprintf(myFilename, "packs/%s",relative.c_str());
if (relative[0] == '.') if (relative[0] == '.')
continue; continue;
if (!strcmp(relative.c_str(), "default_booster.txt")) if (relative == "default_booster.txt")
continue; continue;
MTGPack * p = NEW MTGPack(myFilename); MTGPack * p = NEW MTGPack(myFilename);
if (!p->isValid()) if (!p->isValid())
+7 -7
View File
@@ -997,9 +997,9 @@ int MTGSuspendRule::reactToClick(MTGCardInstance * card)
return 1; return 1;
} }
const char * MTGSuspendRule::getMenuText() const string MTGSuspendRule::getMenuText()
{ {
return suspendmenu.c_str(); return suspendmenu;
} }
ostream& MTGSuspendRule::toString(ostream& out) const ostream& MTGSuspendRule::toString(ostream& out) const
@@ -1333,9 +1333,9 @@ int AAPlaneswalkerAttacked::resolve()
return 1; return 1;
} }
const char* AAPlaneswalkerAttacked::getMenuText() const string AAPlaneswalkerAttacked::getMenuText()
{ {
return menuText.c_str(); return menuText;
} }
AAPlaneswalkerAttacked * AAPlaneswalkerAttacked::clone() const AAPlaneswalkerAttacked * AAPlaneswalkerAttacked::clone() const
@@ -1597,9 +1597,9 @@ int MTGBlockRule::reactToClick(MTGCardInstance * card)
return 1; return 1;
} }
const char * MTGBlockRule::getMenuText() const string MTGBlockRule::getMenuText()
{ {
return blockmenu.c_str(); return blockmenu;
} }
ostream& MTGBlockRule::toString(ostream& out) const ostream& MTGBlockRule::toString(ostream& out) const
@@ -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);
-22
View File
@@ -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);
}
+5 -5
View File
@@ -25,23 +25,23 @@ bool ModRules::load(string filename)
TiXmlElement* element = node->ToElement(); TiXmlElement* element = node->ToElement();
if (element != NULL) if (element != NULL)
{ {
if (strcmp(element->Value(), "menu") == 0) if (element->ValueStr() == "menu")
{ {
menu.parse(element); menu.parse(element);
} }
else if (strcmp(element->Value(), "general") == 0) else if (element->ValueStr() == "general")
{ {
general.parse(element); general.parse(element);
} }
else if (strcmp(element->Value(), "cards") == 0) else if (element->ValueStr() == "cards")
{ {
cards.parse(element); cards.parse(element);
} }
else if (strcmp(element->Value(), "game") == 0) else if (element->ValueStr() == "game")
{ {
game.parse(element); game.parse(element);
} }
else if (strcmp(element->Value(), "cardgui") == 0) else if (element->ValueStr() == "cardgui")
{ {
cardgui.parse(element); cardgui.parse(element);
} }

Some files were not shown because too many files have changed in this diff Show More