Compare commits
163 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 292bf7b1d2 | |||
| 4041fe690b | |||
| cb73e2b90d | |||
| a1fa36a934 | |||
| bdd0e6c042 | |||
| ee217e94a8 | |||
| 38e19f7d35 | |||
| 0bbfd00d15 | |||
| aaceb3c038 | |||
| 5efa7e10bd | |||
| 14c164364e | |||
| 4514725aba | |||
| 2b0f50bb88 | |||
| a65fc0c0f0 | |||
| 99db363253 | |||
| c25dfec67e | |||
| dd7210d187 | |||
| 904b7a6d86 | |||
| 31b353c5ec | |||
| 0d350af1b6 | |||
| 3bc9c93bab | |||
| 2002bb4e16 | |||
| 7e9c4ddbdd | |||
| 12b71de63c | |||
| 15011961f4 | |||
| b851103711 | |||
| 67b8af8d15 | |||
| 8100e390b1 | |||
| 72e6876001 | |||
| 96aeaffa1b | |||
| 74faa35b91 | |||
| 8bb58ca3b1 | |||
| 93d1a637b6 | |||
| 30e86ffcd8 | |||
| cbe6c0c842 | |||
| 77eb7f2777 | |||
| 077ab10c05 | |||
| 1194463349 | |||
| 8de50532f2 | |||
| 334454655d | |||
| d8d52e185d | |||
| 9f1d225259 | |||
| 0c72bfd4c4 | |||
| 55e0366f19 | |||
| 667b95f2b8 | |||
| e90f6fe224 | |||
| 2289fffb8d | |||
| 826403a512 | |||
| 35fec3d9a0 | |||
| e9eb86488e | |||
| ae97abbf96 | |||
| a8391112b0 | |||
| 4257592568 | |||
| 657479e0e4 | |||
| 9e969881fd | |||
| 2b434a7182 | |||
| d2e41f98c3 | |||
| 318fc98a39 | |||
| b7a4b7f6b9 | |||
| ed03fb744d | |||
| 02be213d1e | |||
| 0d4db9ee54 | |||
| ae927576c5 | |||
| f08ddac77b | |||
| 9effa7c975 | |||
| a70259b5ba | |||
| bf0a0a1580 | |||
| eb8b22b2d5 | |||
| 4095676b6b | |||
| bedd1e8da8 | |||
| 965d4f6d45 | |||
| 0db2925e7a | |||
| 031f2dbffb | |||
| dbece750f8 | |||
| 6699902c24 | |||
| e8407caa2a | |||
| 69c6745f53 | |||
| 6f083389c2 | |||
| 9ee44ca091 | |||
| 3f0dd987f0 | |||
| 672b0be7bd | |||
| 9d5a83d588 | |||
| 5d0d130587 | |||
| c85d857604 | |||
| f68568cc1e | |||
| 89206b3a6b | |||
| dc118c64b8 | |||
| a43854420d | |||
| a695323bc7 | |||
| 02a65ecd82 | |||
| 9ff087ecde | |||
| 47685f4892 | |||
| 7aaebdc661 | |||
| 8aa0b8cea0 | |||
| fac44c4b48 | |||
| 9889186eab | |||
| 73f9319b92 | |||
| fd6bc95539 | |||
| 0bb211a581 | |||
| e0428ac7b0 | |||
| 3e94de985f | |||
| 9f0b70d1c9 | |||
| 1e8fc81aa3 | |||
| 352e3c2daa | |||
| 678a4734bb | |||
| 052e3abdb8 | |||
| 73c2d17080 | |||
| ffbb228d2d | |||
| 306765c6b6 | |||
| 3cee80e3bc | |||
| 8209716fc9 | |||
| e76c57d747 | |||
| 9c282aeb56 | |||
| bbc310dec7 | |||
| a37af1776a | |||
| 35697a65b4 | |||
| 6bed1666be | |||
| f021866368 | |||
| d7e527166c | |||
| 071a487100 | |||
| f370899a8a | |||
| 331e126787 | |||
| 6c41e5c92c | |||
| 82e3ab3977 | |||
| f2314ca673 | |||
| 94c3ac9ad9 | |||
| 5419d87e4e | |||
| e1213d1c1f | |||
| 446ed20758 | |||
| 7a48c5e087 | |||
| 3ca2f1c1ed | |||
| 146872797b | |||
| c6dc51c7d3 | |||
| 0ef92d154a | |||
| 2835bdf767 | |||
| afc903e31b | |||
| 6294bb1eed | |||
| 9f16b2208d | |||
| 0a765b702b | |||
| 82de6f2840 | |||
| 90652fa73d | |||
| e8c73aaf9d | |||
| f95094a429 | |||
| 7a57de6608 | |||
| 14c2d522c2 | |||
| 6bf2147d94 | |||
| fea5b04a77 | |||
| ea98b769a7 | |||
| 017f6dd1ed | |||
| 784d127a6e | |||
| f6c47b85e3 | |||
| dac31994b6 | |||
| 74280aef1d | |||
| 8013d09e4f | |||
| 6bbe290762 | |||
| 57c9940244 | |||
| db1c552321 | |||
| f08f0ad3b9 | |||
| a3a1bc2b79 | |||
| 9037699281 | |||
| 8d66f82179 | |||
| b17d9d3f85 | |||
| c5190a62cd |
+23
-1
@@ -1,2 +1,24 @@
|
||||
language: cpp
|
||||
script: "qmake projects/mtg/wagic-qt.pro CONFIG+=testsuite CONFIG+=debug && make -j 8"
|
||||
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 jq; 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
|
||||
- $ANDROID list sdk -a
|
||||
- echo yes | $ANDROID update sdk -a --filter 1,2,4,18 --no-ui --force > log.txt
|
||||
- sudo pip install pyjavaproperties
|
||||
script: ./travis-script.sh
|
||||
env:
|
||||
global:
|
||||
secure: YocijVYZa1oDPviFubPIpmBmXyw0gQ7D0YA6tC01wExXvY+8tGUh1HQ5uXn8LotRZ+Ob5HLHDaCzkKWF8+57ILSMeHrnf6tcRyyeO7wjNY9P7WvSZyCjvqnWzsUN9tiMmsEzhTz2MaUgsY6ocB/4nbWZwfQvL7z+s7z41R4J1I4=
|
||||
script: "./travis-script.sh"
|
||||
after_success: ./upload-binaries.sh
|
||||
|
||||
Binary file not shown.
Binary file not shown.
+3
-3
@@ -73,7 +73,7 @@
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<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>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
@@ -101,7 +101,7 @@
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<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>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
@@ -129,7 +129,7 @@
|
||||
<Optimization>Full</Optimization>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<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>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
|
||||
@@ -31,6 +31,7 @@ HGE_OBJS = src/hge/hgecolor.o src/hge/hgeparticle.o \
|
||||
|
||||
|
||||
CXXFLAGS = -W -Wall -Werror -Wno-unused
|
||||
CXXFLAGS += -DTIXML_USE_STL
|
||||
|
||||
ifdef DEBUG
|
||||
CXXFLAGS += -ggdb3
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
// dirty, but I get OS header includes this way
|
||||
#include "JGE.h"
|
||||
|
||||
#include "OutputCapturer.h"
|
||||
|
||||
#include <ostream>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
@@ -29,12 +31,23 @@ std::string ToHex(T* pointer)
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
|
||||
#ifdef QT_CONFIG
|
||||
|
||||
#ifdef CAPTURE_STDERR
|
||||
#define DebugTrace(inString) \
|
||||
{ \
|
||||
std::ostringstream stream; \
|
||||
stream << inString << std::endl; \
|
||||
qDebug("%s", stream.str().c_str()); \
|
||||
stream << inString; \
|
||||
OutputCapturer::add(stream.str()); \
|
||||
}
|
||||
#else // CAPTURE_STDERR
|
||||
#define DebugTrace(inString) \
|
||||
{ \
|
||||
std::ostringstream stream; \
|
||||
stream << inString; \
|
||||
qDebug("%s", stream.str().c_str()); \
|
||||
}
|
||||
#endif // CAPTURE_STDERR
|
||||
|
||||
#elif defined (ANDROID)
|
||||
#include <android/log.h>
|
||||
#define DebugTrace(inString) \
|
||||
@@ -48,7 +61,7 @@ std::string ToHex(T* pointer)
|
||||
{ \
|
||||
std::ostringstream stream; \
|
||||
stream << inString << std::endl; \
|
||||
OutputDebugString(stream.str().c_str()); \
|
||||
OutputDebugStringA(stream.str().c_str()); \
|
||||
}
|
||||
#endif // QT_CONFIG
|
||||
#endif // Win32, Linux
|
||||
|
||||
@@ -44,6 +44,17 @@ typedef WPARAM LocalKeySym;
|
||||
#include <X11/keysym.h>
|
||||
typedef KeySym LocalKeySym;
|
||||
#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
|
||||
typedef long unsigned int LocalKeySym;
|
||||
|
||||
@@ -578,7 +578,7 @@ private:
|
||||
#if (!defined PSP)
|
||||
|
||||
GLuint mCurrentTex;
|
||||
#if (defined GL_ES_VERSION_2_0) || (defined GL_VERSION_2_0) || (defined WIN32)
|
||||
#if ((defined GL_ES_VERSION_2_0) || (defined GL_VERSION_2_0) || (defined WIN32)) && (!defined CONSOLE_CONFIG)
|
||||
// MVP matrix
|
||||
ESMatrix theMvpMatrix;
|
||||
|
||||
|
||||
@@ -25,8 +25,7 @@
|
||||
#elif defined USE_PHONON
|
||||
#include <phonon/AudioOutput>
|
||||
#include <phonon/MediaObject>
|
||||
#else
|
||||
#ifdef WIN32
|
||||
#elif defined WIN32
|
||||
#include <windows.h>
|
||||
#define WITH_FMOD
|
||||
#elif defined (PSP)
|
||||
@@ -43,10 +42,10 @@
|
||||
#include "JAudio.h"
|
||||
#include "JMP3.h"
|
||||
#endif
|
||||
|
||||
#ifdef WITH_FMOD
|
||||
#include "../Dependencies/include/fmod.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
using namespace std;
|
||||
|
||||
+64
-47
@@ -75,6 +75,23 @@ enum {
|
||||
#define SCREEN_HEIGHT_F 272.0f
|
||||
|
||||
|
||||
#ifdef CONSOLE_CONFIG
|
||||
#define DEFAULT_BLEND 0
|
||||
#define BLEND_OPTION_ADD 0
|
||||
#define BLEND_OPTION_BLEND 0
|
||||
#define BLEND_ZERO 0
|
||||
#define BLEND_ONE 0
|
||||
#define BLEND_SRC_COLOR 0
|
||||
#define BLEND_ONE_MINUS_SRC_COLOR 0
|
||||
#define BLEND_SRC_ALPHA 0
|
||||
#define BLEND_ONE_MINUS_SRC_ALPHA 0
|
||||
#define BLEND_DST_ALPHA 0
|
||||
#define BLEND_ONE_MINUS_DST_ALPHA 0
|
||||
#define BLEND_DST_COLOR 0
|
||||
#define BLEND_ONE_MINUS_DST_COLOR 0
|
||||
#define BLEND_SRC_ALPHA_SATURATE 0
|
||||
#define GU_PSM_5551 0
|
||||
#else
|
||||
#ifdef WIN32
|
||||
// #define DEFAULT_BLEND BLEND_DEFAULT
|
||||
// #define BLEND_OPTION_ADD BLEND_COLORADD
|
||||
@@ -84,9 +101,10 @@ enum {
|
||||
#define BLEND_OPTION_ADD GU_TFX_ADD
|
||||
#define BLEND_OPTION_BLEND GU_TFX_BLEND
|
||||
#endif
|
||||
#endif // CONSOLE_CONFIG
|
||||
|
||||
#if (defined WIN32) && (!defined LINUX)
|
||||
#include <windows.h>
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#if defined(LINUX) && (!defined WIN32) || defined(IOS) || defined (ANDROID)
|
||||
typedef uint8_t byte;
|
||||
@@ -97,8 +115,21 @@ typedef bool BOOL;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef int8_t s8;
|
||||
typedef int16_t s16;
|
||||
typedef int32_t s32;
|
||||
typedef uint8_t u8;
|
||||
typedef uint16_t u16;
|
||||
typedef uint32_t u32;
|
||||
#define PIXEL_TYPE DWORD
|
||||
#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))
|
||||
#ifndef PSP
|
||||
#define TEXTURE_FORMAT 0
|
||||
#endif //PSP
|
||||
|
||||
|
||||
#ifndef CONSOLE_CONFIG
|
||||
#ifndef QT_CONFIG
|
||||
#if defined (IOS)
|
||||
#import <OpenGLES/ES2/gl.h>
|
||||
@@ -113,7 +144,7 @@ typedef bool BOOL;
|
||||
#include <GL/glu.h>
|
||||
#endif
|
||||
#else
|
||||
# include <QtOpenGL>
|
||||
#include <QtOpenGL>
|
||||
#endif
|
||||
|
||||
#if (defined FORCE_GLES)
|
||||
@@ -127,14 +158,12 @@ typedef bool BOOL;
|
||||
#endif
|
||||
|
||||
#if defined (PSP)
|
||||
|
||||
#ifndef ABGR8888
|
||||
#define ABGR8888
|
||||
#endif
|
||||
|
||||
|
||||
#if defined (ABGR8888)
|
||||
#define PIXEL_TYPE u32
|
||||
#ifndef ARGB
|
||||
#define ARGB(a, r, g, b) (PIXEL_TYPE)((a << 24) | (b << 16) | (g << 8) | r) // macro to assemble pixels in correct format
|
||||
#endif
|
||||
@@ -215,13 +244,6 @@ typedef struct
|
||||
|
||||
#else //non PSP
|
||||
|
||||
typedef int8_t s8;
|
||||
typedef int16_t s16;
|
||||
typedef int32_t s32;
|
||||
typedef uint8_t u8;
|
||||
typedef uint16_t u16;
|
||||
typedef uint32_t u32;
|
||||
|
||||
|
||||
#define BLEND_ZERO GL_ZERO
|
||||
#define BLEND_ONE GL_ONE
|
||||
@@ -235,44 +257,16 @@ typedef uint32_t u32;
|
||||
#define BLEND_ONE_MINUS_DST_COLOR GL_ONE_MINUS_DST_COLOR
|
||||
#define BLEND_SRC_ALPHA_SATURATE GL_SRC_ALPHA_SATURATE
|
||||
|
||||
#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 TEXTURE_FORMAT 0
|
||||
#define GU_PSM_8888 0
|
||||
#define GU_PSM_5551 0
|
||||
#define GU_PSM_4444 0
|
||||
#define GU_PSM_5650 0
|
||||
#define PIXEL_TYPE DWORD
|
||||
#define GU_PSM_8888 0
|
||||
#define GU_PSM_5551 0
|
||||
#define GU_PSM_4444 0
|
||||
#define GU_PSM_5650 0
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
typedef enum Buttons
|
||||
{
|
||||
JGE_BTN_NONE = 0, // No button pressed
|
||||
JGE_BTN_QUIT, // Home on PSP
|
||||
JGE_BTN_MENU, // Start on PSP
|
||||
JGE_BTN_CTRL, // Select
|
||||
JGE_BTN_POWER, // Hold
|
||||
JGE_BTN_SOUND, // Music note
|
||||
JGE_BTN_RIGHT,
|
||||
JGE_BTN_LEFT,
|
||||
JGE_BTN_UP,
|
||||
JGE_BTN_DOWN,
|
||||
JGE_BTN_OK, // Circle in Japan, Cross in Europe
|
||||
JGE_BTN_CANCEL, // Triangle
|
||||
JGE_BTN_PRI, // Square (primary)
|
||||
JGE_BTN_SEC, // Cross or Circle (secondary)
|
||||
JGE_BTN_PREV, // Left trigger
|
||||
JGE_BTN_NEXT, // Right trigger
|
||||
JGE_BTN_FULLSCREEN, // Switch to fullscreen (obviously, PC only)
|
||||
|
||||
JGE_BTN_MAX = JGE_BTN_FULLSCREEN + 1
|
||||
} JButton;
|
||||
|
||||
|
||||
#else
|
||||
typedef uint32_t GLuint;
|
||||
typedef float GLfloat;
|
||||
#endif //CONSOLE_CONFIG
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
struct Vertex
|
||||
@@ -542,5 +536,28 @@ public:
|
||||
};
|
||||
|
||||
|
||||
typedef enum Buttons
|
||||
{
|
||||
JGE_BTN_NONE = 0, // No button pressed
|
||||
JGE_BTN_QUIT, // Home on PSP
|
||||
JGE_BTN_MENU, // Start on PSP
|
||||
JGE_BTN_CTRL, // Select
|
||||
JGE_BTN_POWER, // Hold
|
||||
JGE_BTN_SOUND, // Music note
|
||||
JGE_BTN_RIGHT,
|
||||
JGE_BTN_LEFT,
|
||||
JGE_BTN_UP,
|
||||
JGE_BTN_DOWN,
|
||||
JGE_BTN_OK, // Circle in Japan, Cross in Europe
|
||||
JGE_BTN_CANCEL, // Triangle
|
||||
JGE_BTN_PRI, // Square (primary)
|
||||
JGE_BTN_SEC, // Cross or Circle (secondary)
|
||||
JGE_BTN_PREV, // Left trigger
|
||||
JGE_BTN_NEXT, // Right trigger
|
||||
JGE_BTN_FULLSCREEN, // Switch to fullscreen (obviously, PC only)
|
||||
|
||||
JGE_BTN_MAX = JGE_BTN_FULLSCREEN + 1
|
||||
} JButton;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef OUTPUTCAPTURER_H
|
||||
#define OUTPUTCAPTURER_H
|
||||
|
||||
#if defined(QT_CONFIG)
|
||||
#include <Qt>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include "Threading.h"
|
||||
|
||||
class OutputCapturer
|
||||
{
|
||||
private:
|
||||
static std::ostringstream stream;
|
||||
static boost::mutex mMutex;
|
||||
|
||||
public:
|
||||
static void add(const std::string& s);
|
||||
static void debugAndClear();
|
||||
static void clear();
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // OUTPUTCAPTURER_H
|
||||
@@ -315,7 +315,6 @@ namespace boost
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include "../include/DebugRoutines.h"
|
||||
#include "../include/JLogger.h"
|
||||
|
||||
namespace boost
|
||||
|
||||
+1
-10
@@ -3,15 +3,6 @@
|
||||
|
||||
#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
|
||||
{
|
||||
Vector3D(float x, float y, float z) : x(x), y(y), z(z) {}
|
||||
@@ -63,7 +54,7 @@ struct Vector3D
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ bool JAnimator::Load(const char* scriptFile)
|
||||
element = script->ToElement();
|
||||
printf("---- Loading %s:%s\n", element->Value(), element->Attribute("name"));
|
||||
|
||||
const char *type[] =
|
||||
string type[] =
|
||||
{
|
||||
"ANIMATION_TYPE_LOOPING",
|
||||
"ANIMATION_TYPE_ONCE_AND_STAY",
|
||||
@@ -78,7 +78,7 @@ bool JAnimator::Load(const char* scriptFile)
|
||||
|
||||
const char* aniType = element->Attribute("type");
|
||||
for (int i=0;i<5;i++)
|
||||
if (strcmp(type[i], aniType)==0)
|
||||
if (type[i] == aniType)
|
||||
{
|
||||
SetAnimationType(i);
|
||||
break;
|
||||
@@ -108,7 +108,7 @@ bool JAnimator::Load(const char* scriptFile)
|
||||
element = param->ToElement();
|
||||
if (element != NULL)
|
||||
{
|
||||
if (strcmp(element->Value(), "settings")==0)
|
||||
if (element->ValueStr() == "settings")
|
||||
{
|
||||
const char* quadName = element->Attribute("quad");
|
||||
JQuad* quad = mResource->GetQuad(quadName);
|
||||
|
||||
+15
-6
@@ -16,9 +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.
|
||||
*/
|
||||
|
||||
#if defined(ANDROID)
|
||||
#include "../../include/PrecompiledHeader.h"
|
||||
#endif
|
||||
#ifndef PSP
|
||||
#include "PrecompiledHeader.h"
|
||||
#endif //PSP
|
||||
|
||||
#ifdef WIN32
|
||||
#pragma warning(disable : 4786)
|
||||
@@ -34,6 +34,10 @@ The content that users should not be touching.
|
||||
#include "../include/JLogger.h"
|
||||
#include <dirent.h>
|
||||
|
||||
#ifdef QT_CONFIG
|
||||
#include <QDir>
|
||||
#endif
|
||||
|
||||
JFileSystem* JFileSystem::mInstance = NULL;
|
||||
|
||||
JZipCache::JZipCache()
|
||||
@@ -121,13 +125,18 @@ JFileSystem::JFileSystem(const string & _userPath, const string & _systemPath)
|
||||
|
||||
DebugTrace("User path " << userPath);
|
||||
#elif defined (QT_CONFIG)
|
||||
QDir dir(QDir::homePath());
|
||||
dir.cd(USERDIR);
|
||||
|
||||
QDir sysDir("projects/mtg/bin/Res");
|
||||
QDir sysDir(RESDIR);
|
||||
QDir dir(QDir::homePath());
|
||||
dir.mkdir(USERDIR);
|
||||
dir.cd(USERDIR);
|
||||
|
||||
userPath = QDir::toNativeSeparators(dir.absolutePath()).toStdString();
|
||||
systemPath = QDir::toNativeSeparators(sysDir.absolutePath()).toStdString();
|
||||
|
||||
DebugTrace("User path " << userPath);
|
||||
DebugTrace("System path " << systemPath);
|
||||
DebugTrace("Current path " << QDir::currentPath().toStdString());
|
||||
#else
|
||||
//Find the Res.txt file and matching Res folders for backwards compatibility
|
||||
ifstream mfile("Res.txt");
|
||||
|
||||
@@ -0,0 +1,506 @@
|
||||
//-------------------------------------------------------------------------------------
|
||||
//
|
||||
// JGE++ is a hardware accelerated 2D game SDK for PSP/Windows.
|
||||
#include "../../include/JGE.h"
|
||||
#include "../../include/JRenderer.h"
|
||||
#include "../../include/JResourceManager.h"
|
||||
#include "../../include/JFileSystem.h"
|
||||
#include "../../include/JAssert.h"
|
||||
|
||||
JQuad::JQuad(JTexture *tex, float x, float y, float width, float height)
|
||||
:mTex(tex), mX(x), mY(y), mWidth(width), mHeight(height)
|
||||
{
|
||||
JASSERT(tex != NULL);
|
||||
JRenderer::GetInstance()->TransferTextureToGLContext(*tex);
|
||||
|
||||
mHotSpotX = 0.0f;
|
||||
mHotSpotY = 0.0f;
|
||||
//mBlend = BLEND_DEFAULT;
|
||||
for (int i=0;i<4;i++)
|
||||
mColor[i].color = 0xFFFFFFFF;
|
||||
|
||||
mHFlipped = false;
|
||||
mVFlipped = false;
|
||||
|
||||
SetTextureRect(x, y, width, height);
|
||||
}
|
||||
|
||||
void JQuad::SetTextureRect(float x, float y, float w, float h)
|
||||
{
|
||||
mX = x;
|
||||
mY = y;
|
||||
mWidth = w;
|
||||
mHeight = h;
|
||||
|
||||
if(mTex)
|
||||
{
|
||||
mTX0 = x/mTex->mTexWidth;
|
||||
mTY0 = y/mTex->mTexHeight;
|
||||
mTX1 = (x+w)/mTex->mTexWidth;
|
||||
mTY1 = (y+h)/mTex->mTexHeight;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void JQuad::GetTextureRect(float *x, float *y, float *w, float *h)
|
||||
{
|
||||
*x=mX; *y=mY; *w=mWidth; *h=mHeight;
|
||||
}
|
||||
|
||||
|
||||
void JQuad::SetColor(PIXEL_TYPE color)
|
||||
{
|
||||
for (int i=0;i<4;i++)
|
||||
mColor[i].color = color;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void JQuad::SetHotSpot(float x, float y)
|
||||
{
|
||||
mHotSpotX = x;
|
||||
mHotSpotY = y;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
JTexture::JTexture() : mWidth(0), mHeight(0), mBuffer(NULL)
|
||||
{
|
||||
mTexId = -1;
|
||||
}
|
||||
|
||||
JTexture::~JTexture()
|
||||
{
|
||||
if (mBuffer)
|
||||
{
|
||||
delete [] mBuffer;
|
||||
mBuffer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void JTexture::UpdateBits(int x, int y, int width, int height, PIXEL_TYPE* bits)
|
||||
{
|
||||
JRenderer::GetInstance()->BindTexture(this);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
JRenderer* JRenderer::mInstance = NULL;
|
||||
bool JRenderer::m3DEnabled = false;
|
||||
|
||||
void JRenderer::Set3DFlag(bool flag) { m3DEnabled = flag; }
|
||||
|
||||
JRenderer* JRenderer::GetInstance()
|
||||
{
|
||||
if (mInstance == NULL)
|
||||
{
|
||||
mInstance = new JRenderer();
|
||||
|
||||
JASSERT(mInstance != NULL);
|
||||
|
||||
mInstance->InitRenderer();
|
||||
}
|
||||
|
||||
return mInstance;
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::Destroy()
|
||||
{
|
||||
if (mInstance)
|
||||
{
|
||||
mInstance->DestroyRenderer();
|
||||
delete mInstance;
|
||||
mInstance = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
JRenderer::JRenderer() : mActualWidth(SCREEN_WIDTH_F), mActualHeight(SCREEN_HEIGHT_F)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
JRenderer::~JRenderer()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void JRenderer::InitRenderer()
|
||||
{
|
||||
mCurrentTextureFilter = TEX_FILTER_NONE;
|
||||
mImageFilter = NULL;
|
||||
|
||||
mCurrTexBlendSrc = BLEND_SRC_ALPHA;
|
||||
mCurrTexBlendDest = BLEND_ONE_MINUS_SRC_ALPHA;
|
||||
|
||||
// mLineWidth = 1.0f;
|
||||
mCurrentTex = -1;
|
||||
mFOV = 75.0f;
|
||||
|
||||
#ifdef USING_MATH_TABLE
|
||||
for (int i=0;i<360;i++)
|
||||
{
|
||||
mSinTable[i] = sinf(i*DEG2RAD);
|
||||
mCosTable[i] = cosf(i*DEG2RAD);
|
||||
}
|
||||
#endif
|
||||
|
||||
mCurrentRenderMode = MODE_UNKNOWN;
|
||||
}
|
||||
|
||||
void JRenderer::DestroyRenderer()
|
||||
{
|
||||
}
|
||||
|
||||
void JRenderer::BeginScene()
|
||||
{
|
||||
}
|
||||
|
||||
void JRenderer::EndScene()
|
||||
{
|
||||
}
|
||||
|
||||
void JRenderer::BindTexture(JTexture *tex)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::EnableTextureFilter(bool flag)
|
||||
{
|
||||
if (flag)
|
||||
mCurrentTextureFilter = TEX_FILTER_LINEAR;
|
||||
else
|
||||
mCurrentTextureFilter = TEX_FILTER_NEAREST;
|
||||
|
||||
mCurrentTex = -1;
|
||||
}
|
||||
|
||||
void Swap(float *a, float *b)
|
||||
{
|
||||
float n=*a;
|
||||
*a = *b;
|
||||
*b = n;
|
||||
}
|
||||
|
||||
void JRenderer::RenderQuad(JQuad* quad, float xo, float yo, float angle, float xScale, float yScale)
|
||||
{
|
||||
//yo = SCREEN_HEIGHT-yo-1;//-(quad->mHeight);
|
||||
float width = quad->mWidth;
|
||||
float height = quad->mHeight;
|
||||
float x = -quad->mHotSpotX;
|
||||
float y = quad->mHotSpotY;
|
||||
|
||||
Vector2D pt[4];
|
||||
pt[3] = Vector2D(x, y);
|
||||
pt[2] = Vector2D(x+width, y);
|
||||
pt[1] = Vector2D(x+width, y-height);
|
||||
pt[0] = Vector2D(x, y-height);
|
||||
|
||||
|
||||
Vector2D uv[4];
|
||||
uv[0] = Vector2D(quad->mTX0, quad->mTY1);
|
||||
uv[1] = Vector2D(quad->mTX1, quad->mTY1);
|
||||
uv[2] = Vector2D(quad->mTX1, quad->mTY0);
|
||||
uv[3] = Vector2D(quad->mTX0, quad->mTY0);
|
||||
|
||||
if (quad->mHFlipped)
|
||||
{
|
||||
Swap(&uv[0].x, &uv[1].x);
|
||||
Swap(&uv[2].x, &uv[3].x);
|
||||
}
|
||||
|
||||
if (quad->mVFlipped)
|
||||
{
|
||||
Swap(&uv[0].y, &uv[2].y);
|
||||
Swap(&uv[1].y, &uv[3].y);
|
||||
}
|
||||
|
||||
BindTexture(quad->mTex);
|
||||
|
||||
yo = SCREEN_HEIGHT_F - yo;
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::RenderQuad(JQuad* quad, VertexColor* pt)
|
||||
{
|
||||
for (int i=0;i<4;i++)
|
||||
{
|
||||
pt[i].y = SCREEN_HEIGHT_F - pt[i].y;
|
||||
quad->mColor[i].color = pt[i].color;
|
||||
}
|
||||
|
||||
Vector2D uv[4];
|
||||
uv[0] = Vector2D(quad->mTX0, quad->mTY1);
|
||||
uv[1] = Vector2D(quad->mTX1, quad->mTY1);
|
||||
uv[2] = Vector2D(quad->mTX1, quad->mTY0);
|
||||
uv[3] = Vector2D(quad->mTX0, quad->mTY0);
|
||||
|
||||
BindTexture(quad->mTex);
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::FillRect(float x, float y, float width, float height, PIXEL_TYPE color)
|
||||
{
|
||||
y = SCREEN_HEIGHT_F - y - height;
|
||||
|
||||
JColor col;
|
||||
col.color = color;
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::DrawRect(float x, float y, float width, float height, PIXEL_TYPE color)
|
||||
{
|
||||
y = SCREEN_HEIGHT_F - y - height;
|
||||
|
||||
JColor col;
|
||||
col.color = color;
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::FillRect(float x, float y, float width, float height, PIXEL_TYPE* colors)
|
||||
{
|
||||
JColor col[4];
|
||||
for (int i=0;i<4;i++)
|
||||
col[i].color = colors[i];
|
||||
|
||||
FillRect(x, y, width, height, col);
|
||||
}
|
||||
|
||||
void JRenderer::FillRect(float x, float y, float width, float height, JColor* colors)
|
||||
{
|
||||
y = SCREEN_HEIGHT_F - y - height;
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::DrawLine(float x1, float y1, float x2, float y2, PIXEL_TYPE color)
|
||||
{
|
||||
// glLineWidth (mLineWidth);
|
||||
JColor col;
|
||||
col.color = color;
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::Plot(float x, float y, PIXEL_TYPE color)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::PlotArray(float *x, float *y, int count, PIXEL_TYPE color)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
void JRenderer::ScreenShot(const char* filename __attribute__((unused)))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void JRenderer::TransferTextureToGLContext(JTexture& inTexture)
|
||||
{
|
||||
}
|
||||
|
||||
JTexture* JRenderer::CreateTexture(int width, int height, int mode __attribute__((unused)))
|
||||
{
|
||||
JTexture *tex = new JTexture();
|
||||
return tex;
|
||||
}
|
||||
|
||||
JTexture* JRenderer::LoadTexture(const char* filename, int mode, int textureFormat)
|
||||
{
|
||||
JTexture *tex = new JTexture();
|
||||
return tex;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void JRenderer::EnableVSync(bool flag __attribute__((unused)))
|
||||
{
|
||||
// if (flag)
|
||||
// hge->System_SetState(HGE_FPS, 60); // HGEFPS_VSYNC
|
||||
// else
|
||||
// hge->System_SetState(HGE_FPS, HGEFPS_UNLIMITED);
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::ClearScreen(PIXEL_TYPE color)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::SetTexBlend(int src, int dest)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::SetTexBlendSrc(int src)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::SetTexBlendDest(int dest)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::Enable2D()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::Enable3D()
|
||||
{ /* NOT USED
|
||||
if (!m3DEnabled)
|
||||
return;
|
||||
|
||||
if (mCurrentRenderMode == MODE_3D)
|
||||
return;
|
||||
|
||||
mCurrentRenderMode = MODE_3D;
|
||||
|
||||
glViewport (0, 0, (GLsizei)SCREEN_WIDTH, (GLsizei)SCREEN_HEIGHT); // Reset The Current Viewport
|
||||
glMatrixMode (GL_PROJECTION); // Select The Projection Matrix
|
||||
glLoadIdentity (); // Reset The Projection Matrix
|
||||
gluPerspective (mFOV, (GLfloat)SCREEN_WIDTH/(GLfloat)SCREEN_HEIGHT, // Calculate The Aspect Ratio Of The Window
|
||||
0.5f, 1000.0f);
|
||||
glMatrixMode (GL_MODELVIEW); // Select The Modelview Matrix
|
||||
glLoadIdentity (); // Reset The Modelview Matrix
|
||||
|
||||
glEnable (GL_DEPTH_TEST); */
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::SetClip(int, int, int, int)
|
||||
{// NOT USED
|
||||
//glScissor(x, y, width, height);
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::LoadIdentity()
|
||||
{// NOT USED
|
||||
//glLoadIdentity();
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::Translate(float, float, float)
|
||||
{// NOT USED
|
||||
//glTranslatef(x, y, z);
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::RotateX(float)
|
||||
{// NOT USED
|
||||
//glRotatef(angle*RAD2DEG, 1.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::RotateY(float)
|
||||
{// NOT USED
|
||||
//glRotatef(angle*RAD2DEG, 0.0f, 1.0f, 0.0f);
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::RotateZ(float)
|
||||
{// NOT USED
|
||||
//glRotatef(angle*RAD2DEG, 0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::PushMatrix()
|
||||
{// NOT USED
|
||||
//glPushMatrix();
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::PopMatrix()
|
||||
{// NOT USED
|
||||
//glPopMatrix();
|
||||
}
|
||||
|
||||
void JRenderer::RenderTriangles(JTexture* texture, Vertex3D *vertices, int start, int count)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::SetFOV(float fov)
|
||||
{
|
||||
mFOV = fov;
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::FillPolygon(float* x, float* y, int count, PIXEL_TYPE color)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::DrawPolygon(float* x, float* y, int count, PIXEL_TYPE color)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::DrawLine(float x1, float y1, float x2, float y2, float lineWidth, PIXEL_TYPE color)
|
||||
{
|
||||
float dy=y2-y1;
|
||||
float dx=x2-x1;
|
||||
if(dy==0 && dx==0)
|
||||
return;
|
||||
|
||||
float l=(float)hypot(dx,dy);
|
||||
|
||||
float x[4];
|
||||
float y[4];
|
||||
|
||||
x[0]=x1+lineWidth*(y2-y1)/l;
|
||||
y[0]=y1-lineWidth*(x2-x1)/l;
|
||||
|
||||
x[1]=x1-lineWidth*(y2-y1)/l;
|
||||
y[1]=y1+lineWidth*(x2-x1)/l;
|
||||
|
||||
x[2]=x2-lineWidth*(y2-y1)/l;
|
||||
y[2]=y2+lineWidth*(x2-x1)/l;
|
||||
|
||||
x[3]=x2+lineWidth*(y2-y1)/l;
|
||||
y[3]=y2-lineWidth*(x2-x1)/l;
|
||||
|
||||
FillPolygon(x, y, 4, color);
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::DrawCircle(float x, float y, float radius, PIXEL_TYPE color)
|
||||
{
|
||||
}
|
||||
|
||||
void JRenderer::FillCircle(float x, float y, float radius, PIXEL_TYPE color)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::DrawPolygon(float x, float y, float size, int count, float startingAngle, PIXEL_TYPE color)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::FillPolygon(float x, float y, float size, int count, float startingAngle, PIXEL_TYPE color)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::SetImageFilter(JImageFilter* imageFilter)
|
||||
{
|
||||
mImageFilter = imageFilter;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void JRenderer::DrawRoundRect(float x, float y, float w, float h, float radius, PIXEL_TYPE color)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
void JRenderer::FillRoundRect(float x, float y, float w, float h, float radius, PIXEL_TYPE color)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -75,10 +75,10 @@ bool JOBJModel::Load(const char *modelName, const char *textureName)
|
||||
|
||||
int count;
|
||||
|
||||
while (filePtr < size)
|
||||
{
|
||||
while (filePtr < size)
|
||||
{
|
||||
filePtr = ReadLine(tmpLine, buffer, filePtr, size);
|
||||
{
|
||||
{
|
||||
|
||||
if ((tmpLine[0] == '#') || (strlen(tmpLine) < 3))
|
||||
{
|
||||
@@ -89,16 +89,16 @@ bool JOBJModel::Load(const char *modelName, const char *textureName)
|
||||
|
||||
if (count == 4)
|
||||
{
|
||||
if (strcmp(s1, "vn") == 0)
|
||||
if (string("vn") == s1)
|
||||
normalList.push_back(vert);
|
||||
else if (strcmp(s1, "vt") == 0)
|
||||
else if (string("vt") == s1)
|
||||
texList.push_back(vert);
|
||||
else if (strcmp(s1, "v") == 0)
|
||||
else if (string("v") == s1)
|
||||
vertList.push_back(vert);
|
||||
}
|
||||
else if (count == 3)
|
||||
{
|
||||
if (strcmp(s1, "vt") == 0)
|
||||
if (string("vt") == s1)
|
||||
texList.push_back(vert);
|
||||
}
|
||||
|
||||
@@ -211,7 +211,7 @@ bool JOBJModel::Load(const char *modelName, const char *textureName)
|
||||
if (textureName != NULL)
|
||||
mTexture = JRenderer::GetInstance()->LoadTexture(textureName);
|
||||
|
||||
return true;
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
+16
-16
@@ -90,7 +90,7 @@ bool JParticleEffect::Load(const char* filename)
|
||||
// FIELD_COUNT
|
||||
// };
|
||||
|
||||
const char* lifeValues[] =
|
||||
const string lifeValues[] =
|
||||
{
|
||||
"speed",
|
||||
"size",
|
||||
@@ -104,7 +104,7 @@ bool JParticleEffect::Load(const char* filename)
|
||||
"gravity"
|
||||
};
|
||||
|
||||
const char* typeNames[] =
|
||||
const string typeNames[] =
|
||||
{
|
||||
"POINT",
|
||||
"AREA",
|
||||
@@ -113,7 +113,7 @@ bool JParticleEffect::Load(const char* filename)
|
||||
"CIRCLE"
|
||||
};
|
||||
|
||||
const char* modeNames[] =
|
||||
const string modeNames[] =
|
||||
{
|
||||
"REPEAT",
|
||||
"ONCE",
|
||||
@@ -149,32 +149,32 @@ bool JParticleEffect::Load(const char* filename)
|
||||
{
|
||||
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);
|
||||
else if (strcmp(element->Attribute("blend"), "ADDITIVE")==0)
|
||||
else if (string("ADDITIVE") == element->Attribute("blend"))
|
||||
mParticleEmitters[mEmitterCount]->SetBlending(BLEND_SRC_ALPHA, BLEND_ONE);
|
||||
|
||||
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;
|
||||
#if defined (_DEBUG)
|
||||
printf("emitter mode:%s\n", modeNames[i]);
|
||||
printf("emitter mode:%s\n", modeNames[i].c_str());
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
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;
|
||||
#if defined (_DEBUG)
|
||||
printf("emitter type:%s\n", typeNames[i]);
|
||||
printf("emitter type:%s\n", typeNames[i].c_str());
|
||||
#endif
|
||||
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())
|
||||
{
|
||||
@@ -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 &&
|
||||
element->QueryFloatAttribute("max", &value) == TIXML_SUCCESS)
|
||||
@@ -236,7 +236,7 @@ bool JParticleEffect::Load(const char* filename)
|
||||
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 &&
|
||||
element->QueryFloatAttribute("max", &value) == TIXML_SUCCESS)
|
||||
@@ -245,7 +245,7 @@ bool JParticleEffect::Load(const char* filename)
|
||||
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 &&
|
||||
element->QueryFloatAttribute("max", &value) == TIXML_SUCCESS)
|
||||
@@ -254,7 +254,7 @@ bool JParticleEffect::Load(const char* filename)
|
||||
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 &&
|
||||
element->QueryFloatAttribute("max", &value) == TIXML_SUCCESS)
|
||||
@@ -267,7 +267,7 @@ bool JParticleEffect::Load(const char* filename)
|
||||
{
|
||||
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())
|
||||
{
|
||||
|
||||
@@ -119,11 +119,11 @@ bool JResourceManager::LoadResource(const string& resourceName)
|
||||
element = node->ToElement();
|
||||
if (element != NULL)
|
||||
{
|
||||
if (strcmp(element->Value(), "texture")==0)
|
||||
if (element->ValueStr() == "texture")
|
||||
{
|
||||
CreateTexture(element->Attribute("name"));
|
||||
}
|
||||
else if (strcmp(element->Value(), "quad")==0)
|
||||
else if (element->ValueStr() == "quad")
|
||||
{
|
||||
string quadName = element->Attribute("name");
|
||||
string textureName = element->Attribute("texture");
|
||||
@@ -170,7 +170,7 @@ bool JResourceManager::LoadResource(const string& resourceName)
|
||||
GetQuad(id)->SetHotSpot(hotspotX, hotspotY);
|
||||
}
|
||||
}
|
||||
else if (strcmp(element->Value(), "font")==0)
|
||||
else if (element->ValueStr() == "font")
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -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("");
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
#include "../include/JGE.h"
|
||||
#include "../include/JTypes.h"
|
||||
#include "../include/JApp.h"
|
||||
#include "../include/JFileSystem.h"
|
||||
#include "../include/JRenderer.h"
|
||||
#include "../include/JGameLauncher.h"
|
||||
|
||||
#include "TestSuiteAI.h"
|
||||
#include "GameOptions.h"
|
||||
#include "MTGDeck.h"
|
||||
#include "DebugRoutines.h"
|
||||
#include <QCoreApplication>
|
||||
#include <QElapsedTimer>
|
||||
|
||||
class WagicWrapper
|
||||
{
|
||||
public:
|
||||
WagicWrapper();
|
||||
virtual ~WagicWrapper();
|
||||
|
||||
public:
|
||||
// used mainly to mesure the delta between 2 updates
|
||||
static QElapsedTimer g_startTimer;
|
||||
|
||||
private:
|
||||
JGE* m_engine;
|
||||
JApp* m_app;
|
||||
JGameLauncher* m_launcher;
|
||||
};
|
||||
|
||||
QElapsedTimer WagicWrapper::g_startTimer;
|
||||
|
||||
int JGEGetTime()
|
||||
{
|
||||
return (int)WagicWrapper::g_startTimer.elapsed();
|
||||
}
|
||||
|
||||
bool JGEToggleFullscreen()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void JGECreateDefaultBindings()
|
||||
{
|
||||
}
|
||||
|
||||
WagicWrapper::WagicWrapper()
|
||||
{
|
||||
m_launcher = new JGameLauncher();
|
||||
u32 flags = m_launcher->GetInitFlags();
|
||||
if ((flags&JINIT_FLAG_ENABLE3D)!=0)
|
||||
{
|
||||
JRenderer::Set3DFlag(true);
|
||||
}
|
||||
|
||||
JGECreateDefaultBindings();
|
||||
|
||||
m_engine = JGE::GetInstance();
|
||||
m_app = m_launcher->GetGameApp();
|
||||
m_app->Create();
|
||||
m_engine->SetApp(m_app);
|
||||
JRenderer::GetInstance()->Enable2D();
|
||||
g_startTimer.restart();
|
||||
}
|
||||
|
||||
WagicWrapper::~WagicWrapper()
|
||||
{
|
||||
if(m_launcher)
|
||||
{
|
||||
delete m_launcher;
|
||||
m_launcher = NULL;
|
||||
}
|
||||
|
||||
if(m_engine)
|
||||
m_engine->SetApp(NULL);
|
||||
|
||||
if (m_app)
|
||||
{
|
||||
m_app->Destroy();
|
||||
delete m_app;
|
||||
m_app = NULL;
|
||||
}
|
||||
|
||||
JGE::Destroy();
|
||||
m_engine = NULL;
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
QCoreApplication a(argc, argv);
|
||||
|
||||
int result = 0;
|
||||
WagicWrapper* wagicCore = new WagicWrapper();
|
||||
MTGCollection()->loadFolder("sets/primitives/");
|
||||
MTGCollection()->loadFolder("sets/", "_cards.dat");
|
||||
options.reloadProfile();
|
||||
TestSuite testSuite("test/_tests.txt");
|
||||
result = testSuite.run();
|
||||
delete wagicCore;
|
||||
DebugTrace("TestSuite done: failed test: " << result << " out of " << testSuite.nbTests + testSuite.nbAITests << " total");
|
||||
#ifdef CAPTURE_STDERR
|
||||
OutputCapturer::debugAndClear();
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
+1
-1
@@ -69,7 +69,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
#endif //QT_WIDGET
|
||||
|
||||
if(argc >= 2 && strcmp(argv[1], "testsuite")==0)
|
||||
if(argc >= 2 && string(argv[1]) == "testsuite")
|
||||
{
|
||||
int result = 0;
|
||||
result += WagicCore::runTestSuite();
|
||||
|
||||
+3
-3
@@ -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;
|
||||
}
|
||||
@@ -823,7 +823,7 @@ void JRenderer::BeginScene()
|
||||
esMatrixLoadIdentity(&theMvpMatrix);
|
||||
esOrtho(&theMvpMatrix, 0.0f, SCREEN_WIDTH_F, 0.0f, SCREEN_HEIGHT_F-1.0f,-1.0f, 1.0f);
|
||||
#endif //(!defined GL_ES_VERSION_2_0) && (!defined GL_VERSION_2_0)
|
||||
#if (defined WIN32) || ((defined GL_VERSION_ES_CM_1_1) && (!defined IOS))
|
||||
#if (defined WIN32 && !defined GL_ES_VERSION_2_0) || ((defined GL_VERSION_ES_CM_1_1) && (!defined IOS))
|
||||
float scaleH = mActualHeight/SCREEN_HEIGHT_F;
|
||||
float scaleW = mActualWidth/SCREEN_WIDTH_F;
|
||||
if (scaleH != 1.0f || scaleW != 1.0f)
|
||||
@@ -2486,7 +2486,7 @@ void JRenderer::Enable2D()
|
||||
#if (defined GL_VERSION_ES_CM_1_1) || (defined GL_OES_VERSION_1_1)
|
||||
glOrthof(0.0f, SCREEN_WIDTH_F, 0.0f, SCREEN_HEIGHT_F-1.0f, -1.0f, 1.0f);
|
||||
#else
|
||||
gluOrtho2D(0.0f, SCREEN_WIDTH_F, 0.0f, SCREEN_HEIGHT_F-1.0f);
|
||||
glOrtho(0.0f, SCREEN_WIDTH_F, 0.0f, SCREEN_HEIGHT_F-1.0f, -1.0f, 1.0f);
|
||||
#endif
|
||||
|
||||
glMatrixMode (GL_MODELVIEW); // Select The Modelview Matrix
|
||||
|
||||
@@ -335,7 +335,7 @@ void WagicCore::resizeGL(int width, int height)
|
||||
#if (defined GL_VERSION_ES_CM_1_1 || defined GL_OES_VERSION_1_1)
|
||||
glOrthof(0.0f, (float) (m_viewPort.right()-m_viewPort.left())-1.0f, 0.0f, (float) (m_viewPort.bottom()-m_viewPort.top())-1.0f, -1.0f, 1.0f);
|
||||
#else
|
||||
gluOrtho2D(0.0f, (float) (m_viewPort.right()-m_viewPort.left())-1.0f, 0.0f, (float) (m_viewPort.bottom()-m_viewPort.top())-1.0f);
|
||||
glOrtho(0.0f, (float) (m_viewPort.right()-m_viewPort.left())-1.0f, 0.0f, (float) (m_viewPort.bottom()-m_viewPort.top())-1.0f, -1.0f, 1.0f);
|
||||
#endif
|
||||
|
||||
glMatrixMode (GL_MODELVIEW); // Select The Modelview Matrix
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
/gen
|
||||
/bin
|
||||
|
||||
|
||||
@@ -14,5 +14,5 @@
|
||||
|
||||
<activity android:configChanges="keyboard|keyboardHidden|orientation" android:name="com.google.ads.AdActivity" android:screenOrientation="sensorLandscape"/>
|
||||
</application>
|
||||
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="9"/>
|
||||
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="10"/>
|
||||
</manifest>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ PNG_PATH := $(JGE_PATH)/Dependencies/libpng
|
||||
DEBUG ?= 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_STATIC_LIBRARIES := libpng libjpeg
|
||||
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/CardDescriptor.cpp \
|
||||
$(MTG_PATH)/src/CardDisplay.cpp \
|
||||
$(MTG_PATH)/src/CardEffect.cpp \
|
||||
$(MTG_PATH)/src/CardGui.cpp \
|
||||
$(MTG_PATH)/src/CardPrimitive.cpp \
|
||||
$(MTG_PATH)/src/CardSelector.cpp \
|
||||
@@ -137,6 +136,9 @@ LOCAL_SRC_FILES := $(SDL_PATH)/src/main/android/SDL_android_main.cpp \
|
||||
$(MTG_PATH)/src/WFont.cpp \
|
||||
$(MTG_PATH)/src/WGui.cpp \
|
||||
$(MTG_PATH)/src/WResourceManager.cpp \
|
||||
$(MTG_PATH)/src/DeckView.cpp \
|
||||
$(MTG_PATH)/src/CarouselDeckView.cpp \
|
||||
$(MTG_PATH)/src/GridDeckView.cpp \
|
||||
$(JGE_PATH)/src/SDLmain.cpp \
|
||||
$(JGE_PATH)/src/Encoding.cpp \
|
||||
$(JGE_PATH)/src/JAnimator.cpp \
|
||||
|
||||
Binary file not shown.
@@ -54,10 +54,6 @@ import android.view.View.OnKeyListener;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.FrameLayout.LayoutParams;
|
||||
|
||||
import com.google.ads.AdRequest;
|
||||
import com.google.ads.AdSize;
|
||||
import com.google.ads.AdView;
|
||||
|
||||
/**
|
||||
* SDL Activity
|
||||
*/
|
||||
@@ -68,7 +64,6 @@ public class SDLActivity extends Activity implements OnKeyListener
|
||||
public static String TAG = Activity.class.getCanonicalName();
|
||||
|
||||
// Main components
|
||||
private static AdView mAdView;
|
||||
private static SDLActivity mSingleton;
|
||||
private static SDLSurface mSurface;
|
||||
|
||||
@@ -422,25 +417,12 @@ public class SDLActivity extends Activity implements OnKeyListener
|
||||
SurfaceHolder holder = mSurface.getHolder();
|
||||
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(mAdView, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, Gravity.BOTTOM + Gravity.CENTER_HORIZONTAL));
|
||||
// mGLView.setFocusableInTouchMode(true);
|
||||
// mGLView.setFocusable(true);
|
||||
// adView.requestFreshAd();
|
||||
setContentView(_videoLayout, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
|
||||
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
|
||||
@@ -512,14 +494,6 @@ public class SDLActivity extends Activity implements OnKeyListener
|
||||
{
|
||||
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
|
||||
|
||||
+31
-2
@@ -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 objs/CarouselDeckView.o objs/GridDeckView.o objs/DeckView.o
|
||||
DEPS = $(patsubst objs/%.o, deps/%.d, $(OBJS))
|
||||
|
||||
RESULT = $(shell psp-config --psp-prefix 2> Makefile.cache)
|
||||
@@ -44,7 +73,7 @@ PSP_EBOOT_UNKPNG = pic0.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
|
||||
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
|
||||
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
|
||||
|
||||
@@ -16,6 +16,7 @@ auto=flashbackrule
|
||||
auto=retracerule
|
||||
auto=suspendrule
|
||||
auto=morphrule
|
||||
auto=playfromgraveyardrule
|
||||
auto=attackrule
|
||||
auto=blockrule
|
||||
auto=combattriggerrule
|
||||
|
||||
@@ -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]
|
||||
@@ -17432,7 +17432,7 @@ toughness=4
|
||||
[card]
|
||||
name=Cranial Plating
|
||||
auto=foreach(artifact|mybattlefield) 1/0
|
||||
auto={B}{B}:attach
|
||||
auto={B}{B}:name(attach) retarget target(creature|mybattlefield)
|
||||
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.)
|
||||
mana={2}
|
||||
@@ -18104,6 +18104,13 @@ mana={3}{R}
|
||||
type=Enchantment
|
||||
[/card]
|
||||
[card]
|
||||
name=Crucible of Worlds
|
||||
auto=lord(land|mygraveyard) CanPlayFromGraveyard
|
||||
text=You may play land cards from your graveyard.
|
||||
mana={3}
|
||||
type=Artifact
|
||||
[/card]
|
||||
[card]
|
||||
name=Crude Rampart
|
||||
abilities=defender
|
||||
facedown={3}
|
||||
@@ -23286,7 +23293,7 @@ type=Sorcery
|
||||
[/card]
|
||||
[card]
|
||||
name=Dragon Hatchling
|
||||
auto={1}{R}:1/0
|
||||
auto={R}:1/0
|
||||
abilities=flying
|
||||
text=Flying -- {R}: Dragon Hatchling gets +1/+0 until end of turn.
|
||||
mana={1}{R}
|
||||
@@ -39826,7 +39833,7 @@ name=Healer's Headdress
|
||||
auto={1}:equip
|
||||
auto=0/2
|
||||
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.)
|
||||
mana={2}
|
||||
type=Artifact
|
||||
@@ -41596,7 +41603,7 @@ toughness=2
|
||||
name=Horned Helm
|
||||
auto=1/1
|
||||
auto=trample
|
||||
auto={G}{G}:attach
|
||||
auto={G}{G}:name(attach) retarget target(creature|mybattlefield)
|
||||
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.)
|
||||
mana={2}
|
||||
@@ -54155,6 +54162,18 @@ power=2
|
||||
toughness=2
|
||||
[/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
|
||||
auto=token(Golem,Artifact Creature Golem,3/3)
|
||||
auto=lord(golem|mybattlefield) 1/1
|
||||
@@ -59971,7 +59990,7 @@ toughness=2
|
||||
[card]
|
||||
name=Neurok Stealthsuit
|
||||
auto=teach(creature) shroud
|
||||
auto={U}{U}:attach
|
||||
auto={U}{U}:name(attach) retarget target(creature|mybattlefield)
|
||||
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.)
|
||||
mana={2}
|
||||
@@ -83425,7 +83444,7 @@ toughness=3
|
||||
[card]
|
||||
name=Sparring Collar
|
||||
auto=first strike
|
||||
auto={R}{R}:attach
|
||||
auto={R}{R}:name(attach) retarget target(creature|mybattlefield)
|
||||
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.)
|
||||
mana={2}
|
||||
@@ -83704,7 +83723,7 @@ type=Instant
|
||||
[card]
|
||||
name=Spell Rupture
|
||||
target=*|stack
|
||||
auto=if cantargetcard(*|opponentstack) then transforms((,newability[pay[[{value:power:highest:creature:opponentbattlefield}]] name(pay {value} mana) donothing?fizzle])) forever else transforms((,newability[pay[[{value:power:highest:creature:mybattlefield.}]] name(pay {value} mana) donothing?fizzle])) forever
|
||||
auto=if cantargetcard(*|opponentstack) then transforms((,newability[pay[[{value:power:highest:creature:opponentbattlefield}]] name(pay {value} mana) donothing?fizzle])) forever else transforms((,newability[pay[[{value:power:highest:creature:mybattlefield}]] name(pay {value} mana) donothing?fizzle])) forever
|
||||
text=Counter target spell unless its controller pays {X}, where X is the greatest power among creatures you control.
|
||||
mana={1}{U}
|
||||
type=Instant
|
||||
@@ -88480,7 +88499,7 @@ toughness=3
|
||||
[card]
|
||||
name=Syncopate
|
||||
target=*|stack
|
||||
auto=transforms((,newability[pay[[{x}]] name(pay {value} mana) donothing?fizzleto(exile)])) forever
|
||||
auto=transforms((,newability[pay[[{value:storedx}]] name(pay {value} mana) donothing?fizzleto(exile)])) forever
|
||||
text=Counter target spell unless its controller pays {X}. If that spell is countered this way, exile it instead of putting it into its owner's graveyard.
|
||||
mana={X}{U}
|
||||
type=Instant
|
||||
@@ -103456,6 +103475,15 @@ mana={1}{B}
|
||||
type=Enchantment
|
||||
[/card]
|
||||
[card]
|
||||
name=Yawgmoth's Will
|
||||
auto=lord(*|mygraveyard) canPlayFromGraveyard
|
||||
auto=emblem transforms((,newability[@movedTo(*|mygraveyard):all(trigger[to]) moveTo(exile)])) ueot
|
||||
auto=moveTo(exile)
|
||||
text=Until end of turn, you may play cards from your graveyard. -- If a card would be put into your graveyard from anywhere this turn, exile that card instead.
|
||||
mana={2}{B}
|
||||
type=Sorcery
|
||||
[/card]
|
||||
[card]
|
||||
name=Yawning Fissure
|
||||
auto=ability$!name(sacrifice land) notatarget(land|mybattlefield) sacrifice!$ opponent
|
||||
text=Each opponent sacrifices a land.
|
||||
|
||||
@@ -3187,19 +3187,6 @@ mana={2}
|
||||
type=Artifact
|
||||
[/card]
|
||||
[card]
|
||||
name=Crucible of Worlds
|
||||
auto={0}:may moveTo(myBattlefield) target(land|mygraveyard) limit:1 myTurnOnly
|
||||
# Above line does not work: "May moveto" from graveyards does
|
||||
# not work due to interface issues. The "limit:1" doesn't work
|
||||
# here either. Even if both worked, then the card would allow
|
||||
# you to play lands *in addition* to the 1 land you can play per
|
||||
# turn. Instead it should just give you the option to play this
|
||||
# 1 land from your hand or your graveyard.
|
||||
text=You may play land cards from your graveyard.
|
||||
mana={3}
|
||||
type=Artifact
|
||||
[/card]
|
||||
[card]
|
||||
name=Cruel Deceiver
|
||||
text={1}: Look at the top card of your library. -- {2}: Reveal the top card of your library. If it's a land card, Cruel Deceiver gains "Whenever Cruel Deceiver deals damage to a creature, destroy that creature" until end of turn. Activate this ability only once each turn.
|
||||
mana={1}{B}
|
||||
|
||||
@@ -226,6 +226,7 @@ colossus_of_sardia1.txt
|
||||
colossus_of_sardia2.txt
|
||||
composite_golem.txt
|
||||
conservator.txt
|
||||
consign_to_dream.txt
|
||||
Contagion_Clasp.txt
|
||||
control_magic.txt
|
||||
control_magic2.txt
|
||||
@@ -238,7 +239,7 @@ counterspell.txt
|
||||
counterspell2.txt
|
||||
counterspell3.txt
|
||||
counterspell4.txt
|
||||
counter_unless_pay.txt
|
||||
counter_unless_pay_x.txt
|
||||
Covetous_Dragon_ASLONGAS_3.txt
|
||||
Covetous_Dragon_ASLONGAS_4.txt
|
||||
cranial_plating.txt
|
||||
@@ -248,6 +249,7 @@ curiosity2_i217.txt
|
||||
crimson_kobolds.txt
|
||||
crosis_s_catacombs_1.txt
|
||||
crosis_s_catacombs_2.txt
|
||||
crucible_of_worlds.txt
|
||||
crumble.txt
|
||||
crystal_rod_i172.txt
|
||||
cursed_land1_i188.txt
|
||||
@@ -614,6 +616,8 @@ souls_attendant_i489.txt
|
||||
soul's grace_POWERLIFEGAIN.txt
|
||||
spark_elemental.txt
|
||||
spectral_shield_CANTBETARGETOF.txt
|
||||
spell_rupture.txt
|
||||
spell_rupture_2.txt
|
||||
sphinx_summoner.txt
|
||||
spirit_link.txt
|
||||
spirit_link_i173.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]
|
||||
@@ -0,0 +1,27 @@
|
||||
#Testing Counter unless pay {X} mechanic
|
||||
#P1 casts Think Twice with {5} left in his mana pool and P2 counters with Syncopate using X = 3. P1 chooses to pay {3} and Think Twice resolves with {2} left in his mana pool.
|
||||
[INIT]
|
||||
firstmain
|
||||
[PLAYER1]
|
||||
hand:think twice
|
||||
manapool:{1}{U}{5}
|
||||
library:counterspell
|
||||
[PLAYER2]
|
||||
hand:syncopate
|
||||
manapool:{3}{U}
|
||||
[DO]
|
||||
think twice
|
||||
no
|
||||
yes
|
||||
syncopate
|
||||
think twice
|
||||
choice 0
|
||||
[ASSERT]
|
||||
firstmain
|
||||
[PLAYER1]
|
||||
hand:counterspell
|
||||
graveyard:think twice
|
||||
manapool:{2}
|
||||
[PLAYER2]
|
||||
graveyard:syncopate
|
||||
[END]
|
||||
@@ -0,0 +1,26 @@
|
||||
# Testing crucible of worlds (keyword: CANPLAYFROMGRAVEYARD)
|
||||
|
||||
# name=Crucible of Worlds
|
||||
# text=You may play land cards from your graveyard.
|
||||
|
||||
[INIT]
|
||||
FIRSTMAIN
|
||||
[PLAYER1]
|
||||
hand:island,plains
|
||||
inplay:crucible of worlds
|
||||
graveyard:forest,mountain
|
||||
[PLAYER2]
|
||||
[DO]
|
||||
forest
|
||||
# all next lands shouldn't be played
|
||||
island
|
||||
mountain
|
||||
plains
|
||||
[ASSERT]
|
||||
FIRSTMAIN
|
||||
[PLAYER1]
|
||||
inplay:crucible of worlds,forest
|
||||
hand:island,plains
|
||||
graveyard:mountain
|
||||
[PLAYER2]
|
||||
[END]
|
||||
@@ -0,0 +1,29 @@
|
||||
# Testing spell rupture (expression: "pay[[{value:WParsedInt}]]")
|
||||
# counter opponent spell
|
||||
[INIT]
|
||||
firstmain
|
||||
[PLAYER1]
|
||||
hand:bad moon
|
||||
manapool:{1}{B}{4}
|
||||
inplay:raging goblin
|
||||
[PLAYER2]
|
||||
inplay:grizzly bears
|
||||
hand:spell rupture
|
||||
manapool:{1}{U}
|
||||
[DO]
|
||||
bad moon
|
||||
no
|
||||
yes
|
||||
spell rupture
|
||||
bad moon
|
||||
choice 0
|
||||
[ASSERT]
|
||||
firstmain
|
||||
[PLAYER1]
|
||||
manapool:{2}
|
||||
inplay:raging goblin,bad moon
|
||||
[PLAYER2]
|
||||
graveyard:spell rupture
|
||||
manapool:{0}
|
||||
inplay:grizzly bears
|
||||
[END]
|
||||
@@ -0,0 +1,25 @@
|
||||
# Testing spell rupture (expression: "pay[[{value:WParsedInt}]]")
|
||||
# counter own spell
|
||||
[INIT]
|
||||
firstmain
|
||||
[PLAYER1]
|
||||
hand:bad moon,spell rupture
|
||||
manapool:{1}{B}{1}{U}{4}
|
||||
inplay:raging goblin
|
||||
[PLAYER2]
|
||||
inplay:grizzly bears
|
||||
[DO]
|
||||
bad moon
|
||||
yes
|
||||
spell rupture
|
||||
bad moon
|
||||
choice 0
|
||||
[ASSERT]
|
||||
firstmain
|
||||
[PLAYER1]
|
||||
graveyard:spell rupture
|
||||
manapool:{3}
|
||||
inplay:raging goblin,bad moon
|
||||
[PLAYER2]
|
||||
inplay:grizzly bears
|
||||
[END]
|
||||
@@ -2,6 +2,7 @@
|
||||
<!-- build.properties should contain the values for major, minor and point -->
|
||||
<property file="build.properties" />
|
||||
<property file="build.number.properties" />
|
||||
<property environment="env"/>
|
||||
|
||||
<path id="groovy.class.path" >
|
||||
<fileset dir="${groovy.dir}" />
|
||||
@@ -76,15 +77,16 @@ Author: Michael Nguyen
|
||||
#define WAGIC_VERSION_MAJOR ${build.major}
|
||||
#define WAGIC_VERSION_MEDIUM ${build.minor}
|
||||
#define WAGIC_VERSION_MINOR ${build.point}
|
||||
#define WAGIC_VERSION_REVISION ${env.TRAVIS_BUILD_NUMBER}
|
||||
|
||||
#define VERSION_DOT(a, b, c) a ##.## b ##.## c
|
||||
#define VERSION_DOT(a, b, c, d) a ##.## b ##.## c ##.## d
|
||||
#define VERSION_WITHOUT_DOT(a, b, c) a ## b ## c
|
||||
#define VERSION_GAME(a, b, c) VERSION_DOT(a, b, c)
|
||||
#define VERSION_GAME(a, b, c, d) VERSION_DOT(a, b, c, d)
|
||||
#define VERSION_FILE(a, b, c) VERSION_WITHOUT_DOT(a, b, c)
|
||||
#define VERSION_TOSTRING(a) #a
|
||||
#define VERSION_STRINGIFY(a) VERSION_TOSTRING(a)
|
||||
|
||||
#define WAGIC_VERSION VERSION_GAME(WAGIC_VERSION_MAJOR, WAGIC_VERSION_MEDIUM, WAGIC_VERSION_MINOR)
|
||||
#define WAGIC_VERSION VERSION_GAME(WAGIC_VERSION_MAJOR, WAGIC_VERSION_MEDIUM, WAGIC_VERSION_MINOR, WAGIC_VERSION_REVISION)
|
||||
#define WAGIC_RESOURCE_VERSION VERSION_FILE(WAGIC_VERSION_MAJOR, WAGIC_VERSION_MEDIUM, WAGIC_VERSION_MINOR)
|
||||
#define WAGIC_VERSION_STRING VERSION_STRINGIFY(WAGIC_VERSION)
|
||||
#define WAGIC_CORE_VERSION_STRING "core_" VERSION_STRINGIFY(WAGIC_RESOURCE_VERSION)
|
||||
|
||||
@@ -9,10 +9,6 @@
|
||||
#include <JGui.h>
|
||||
#include "MTGDefinitions.h"
|
||||
|
||||
#define INACTIVE 0
|
||||
#define ACTION_REQUESTED 1
|
||||
#define ACTIVE 2
|
||||
|
||||
class MTGCardInstance;
|
||||
class ManaCost;
|
||||
class Targetable;
|
||||
@@ -22,31 +18,33 @@ class WEvent;
|
||||
class ActionElement: public JGuiObject
|
||||
{
|
||||
protected:
|
||||
int activeState;
|
||||
enum Activity{
|
||||
Inactive,
|
||||
ActionRequested,
|
||||
Active
|
||||
};
|
||||
|
||||
Activity activity;
|
||||
TargetChooser * tc;
|
||||
public:
|
||||
GamePhase currentPhase;
|
||||
GamePhase newPhase;
|
||||
int modal;
|
||||
int waitingForAnswer;
|
||||
int getActivity();
|
||||
virtual void Update(float){};
|
||||
virtual void Render(){};
|
||||
virtual void Update(float){}
|
||||
virtual void Render(){}
|
||||
virtual int testDestroy()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
virtual int destroy()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
virtual bool CheckUserInput(JButton)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
;
|
||||
ActionElement(int id);
|
||||
ActionElement(const ActionElement& copyFromMe);
|
||||
TargetChooser * getActionTc(){return tc;}
|
||||
@@ -62,27 +60,22 @@ public:
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
virtual int stillInUse(MTGCardInstance *)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
virtual int receiveEvent(WEvent *)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
virtual int reactToClick(MTGCardInstance *)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
virtual const char * getMenuText()
|
||||
virtual const string getMenuText()
|
||||
{
|
||||
return "Ability";
|
||||
}
|
||||
;
|
||||
virtual ActionElement * clone() const = 0;
|
||||
|
||||
};
|
||||
|
||||
@@ -41,16 +41,9 @@ class DamageStack;
|
||||
class ManaCost;
|
||||
class TargetChooser;
|
||||
|
||||
|
||||
#define ACTIONSTACK_STANDARD 0
|
||||
#define ACTIONSTACK_TARGET 1
|
||||
|
||||
class Interruptible: public PlayGuiObject, public Targetable
|
||||
{
|
||||
public:
|
||||
//TODO : remove these when they are back in PlayGuiObject
|
||||
float x, y;
|
||||
|
||||
int state, display;
|
||||
MTGCardInstance * source;
|
||||
virtual void Entering()
|
||||
@@ -186,6 +179,11 @@ public:
|
||||
class ActionStack :public GuiLayer
|
||||
{
|
||||
public:
|
||||
enum ActionStackMode{
|
||||
ACTIONSTACK_STANDARD = 0,
|
||||
ACTIONSTACK_TARGET = 1
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
NOT_DECIDED = 0,
|
||||
@@ -207,7 +205,7 @@ protected:
|
||||
InterruptDecision interruptDecision[2];
|
||||
float timer;
|
||||
int currentState;
|
||||
int mode;
|
||||
ActionStackMode mode;
|
||||
int checked;
|
||||
ATutorialMessage* currentTutorial;
|
||||
int interruptBtnXOffset, noBtnXOffset, noToAllBtnXOffset, interruptDialogWidth;
|
||||
|
||||
+109
-197
@@ -873,8 +873,8 @@ public:
|
||||
return 0;
|
||||
if (!tc->canTarget(e->damage->target)) return 0;
|
||||
if (fromTc && !fromTc->canTarget(e->damage->source)) return 0;
|
||||
if (type == 1 && e->damage->typeOfDamage != DAMAGE_COMBAT) return 0;
|
||||
if (type == 2 && e->damage->typeOfDamage == DAMAGE_COMBAT) return 0;
|
||||
if (type == 1 && e->damage->typeOfDamage != Damage::DAMAGE_COMBAT) return 0;
|
||||
if (type == 2 && e->damage->typeOfDamage == Damage::DAMAGE_COMBAT) return 0;
|
||||
e->damage->target->thatmuch = e->damage->damage;
|
||||
e->damage->source->thatmuch = e->damage->damage;
|
||||
this->source->thatmuch = e->damage->damage;
|
||||
@@ -1081,7 +1081,7 @@ public:
|
||||
ManaCost * cost = NULL);
|
||||
|
||||
int resolve();
|
||||
const char* getMenuText();
|
||||
const string getMenuText();
|
||||
AACounter * clone() const;
|
||||
};
|
||||
|
||||
@@ -1100,7 +1100,7 @@ public:
|
||||
bool all,ManaCost * cost = NULL);
|
||||
|
||||
int resolve();
|
||||
const char* getMenuText();
|
||||
const string getMenuText();
|
||||
AARemoveAllCounter * clone() const;
|
||||
};
|
||||
|
||||
@@ -1110,7 +1110,7 @@ class AAResetDamage: public ActivatedAbility
|
||||
public:
|
||||
AAResetDamage(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, ManaCost * cost = NULL);
|
||||
int resolve();
|
||||
const char* getMenuText();
|
||||
const string getMenuText();
|
||||
AAResetDamage * clone() const;
|
||||
};
|
||||
|
||||
@@ -1120,7 +1120,7 @@ public:
|
||||
string named;
|
||||
AAFakeAbility(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target,string _newName, ManaCost * cost = NULL);
|
||||
int resolve();
|
||||
const char* getMenuText();
|
||||
const string getMenuText();
|
||||
AAFakeAbility * clone() const;
|
||||
};
|
||||
|
||||
@@ -1131,7 +1131,7 @@ public:
|
||||
|
||||
AAFizzler(GameObserver* observer, int _id, MTGCardInstance * card, Spell * _target, ManaCost * _cost = NULL);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AAFizzler* clone() const;
|
||||
};
|
||||
|
||||
@@ -1160,7 +1160,7 @@ public:
|
||||
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();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
IfThenAbility * clone() const;
|
||||
~IfThenAbility();
|
||||
};
|
||||
@@ -1179,7 +1179,7 @@ public:
|
||||
|
||||
void Update(float dt);
|
||||
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
int testDestroy();
|
||||
|
||||
int isReactingToTargetClick(Targetable * card);
|
||||
@@ -1209,7 +1209,7 @@ public:
|
||||
bool CheckUserInput(JButton key);
|
||||
void Update(float dt);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
int testDestroy();
|
||||
int isReactingToTargetClick(Targetable * card);
|
||||
int reactToTargetClick(Targetable * object);
|
||||
@@ -1225,7 +1225,7 @@ class AAProliferate: public ActivatedAbility
|
||||
public:
|
||||
AAProliferate(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target,ManaCost * cost = NULL);
|
||||
int resolve();
|
||||
const char* getMenuText();
|
||||
const string getMenuText();
|
||||
AAProliferate * clone() const;
|
||||
~AAProliferate();
|
||||
};
|
||||
@@ -1243,7 +1243,7 @@ public:
|
||||
int resolve();
|
||||
int addToGame();
|
||||
int destroy();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
MultiAbility * clone() const;
|
||||
~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 = "",
|
||||
int restrictions = 0, MTGGameZone * dest = NULL);
|
||||
GenericActivatedAbility(const GenericActivatedAbility& other);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
|
||||
void Update(float dt);
|
||||
int testDestroy();
|
||||
@@ -1274,7 +1275,7 @@ class AALibraryBottom: public ActivatedAbility
|
||||
public:
|
||||
AALibraryBottom(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AALibraryBottom * clone() const;
|
||||
};
|
||||
|
||||
@@ -1284,7 +1285,7 @@ class AACopier: public ActivatedAbility
|
||||
public:
|
||||
AACopier(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AACopier * clone() const;
|
||||
};
|
||||
//imprint
|
||||
@@ -1293,7 +1294,7 @@ class AAPhaseOut: public ActivatedAbility
|
||||
public:
|
||||
AAPhaseOut(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AAPhaseOut * clone() const;
|
||||
};
|
||||
//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,
|
||||
string abilitiesStringList = "",string typeslist = "");
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
AACloner * clone() const;
|
||||
~AACloner();
|
||||
@@ -1326,7 +1327,7 @@ public:
|
||||
AAMover(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, string dest,string _name, ManaCost * _cost = NULL);
|
||||
MTGGameZone * destinationZone(Targetable * target = NULL);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
const char * getMenuText(TargetChooser * fromTc);
|
||||
AAMover * clone() const;
|
||||
~AAMover();
|
||||
@@ -1342,7 +1343,7 @@ public:
|
||||
AARandomMover(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, string tcs, string from, string to);
|
||||
MTGGameZone * destinationZone(Targetable * target = NULL,string zone = "");
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AARandomMover * clone() const;
|
||||
~AARandomMover();
|
||||
};
|
||||
@@ -1356,7 +1357,7 @@ public:
|
||||
string menu;
|
||||
AABuryCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AABuryCard * clone() const;
|
||||
~AABuryCard();
|
||||
};
|
||||
@@ -1367,7 +1368,7 @@ public:
|
||||
MTGAbility * andAbility;
|
||||
AADestroyCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AADestroyCard * clone() const;
|
||||
~AADestroyCard();
|
||||
};
|
||||
@@ -1378,7 +1379,7 @@ public:
|
||||
MTGAbility * andAbility;
|
||||
AASacrificeCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AASacrificeCard * clone() const;
|
||||
~AASacrificeCard();
|
||||
};
|
||||
@@ -1389,7 +1390,7 @@ public:
|
||||
MTGAbility * andAbility;
|
||||
AADiscardCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AADiscardCard * clone() const;
|
||||
~AADiscardCard();
|
||||
};
|
||||
@@ -1409,7 +1410,7 @@ public:
|
||||
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 * clone() const;
|
||||
int resolve();
|
||||
@@ -1447,7 +1448,7 @@ public:
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "Ninjutsu";
|
||||
}
|
||||
@@ -1479,7 +1480,7 @@ public:
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "Remove From Combat";
|
||||
}
|
||||
@@ -1501,7 +1502,7 @@ public:
|
||||
AADrawer(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost,string nbcardsStr, int who =
|
||||
TargetChooser::UNSET,bool noReplace = false);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AADrawer * clone() const;
|
||||
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);
|
||||
int addToGame();
|
||||
int destroy();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
ACastRestriction * clone() const;
|
||||
~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);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AInstantCastRestrictionUEOT * clone() const;
|
||||
~AInstantCastRestrictionUEOT();
|
||||
};
|
||||
@@ -1549,7 +1550,7 @@ public:
|
||||
AALifer(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target,string life_s, ManaCost * _cost = NULL,
|
||||
int who = TargetChooser::UNSET);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AALifer * clone() const;
|
||||
int getLife();
|
||||
|
||||
@@ -1562,7 +1563,7 @@ public:
|
||||
AAWinGame(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost = NULL, int who =
|
||||
TargetChooser::UNSET);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AAWinGame * clone() const;
|
||||
};
|
||||
|
||||
@@ -1603,7 +1604,7 @@ public:
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return Constants::MTGBasicAbilities[ability];
|
||||
}
|
||||
@@ -1645,7 +1646,7 @@ public:
|
||||
return InstantAbility::addToGame();
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return Constants::MTGBasicAbilities[ability];
|
||||
}
|
||||
@@ -1706,7 +1707,7 @@ public:
|
||||
return ActivatedAbility::addToGame();
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return ability->getMenuText();
|
||||
}
|
||||
@@ -1862,7 +1863,7 @@ public:
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
sprintf(menuText,"Protection from %s",tcstr.c_str());
|
||||
return menuText;
|
||||
@@ -2054,7 +2055,7 @@ public:
|
||||
((MTGCardInstance *) target)->addToToughness(-wppt->toughness.getValue());
|
||||
return 1;
|
||||
}
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
if(PT.size())
|
||||
{
|
||||
@@ -2147,7 +2148,7 @@ public:
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return ability->getMenuText();
|
||||
}
|
||||
@@ -2189,7 +2190,7 @@ public:
|
||||
return toAdd->addToGame();
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return ability->getMenuText();
|
||||
}
|
||||
@@ -2287,7 +2288,7 @@ public:
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "Regenerate";
|
||||
}
|
||||
@@ -2494,7 +2495,7 @@ public:
|
||||
SAFE_DELETE(ability);
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
if(ability)
|
||||
{
|
||||
@@ -2523,13 +2524,13 @@ public:
|
||||
|
||||
ALord(GameObserver* observer, int _id, MTGCardInstance * card, TargetChooser * _tc, int _includeSelf, MTGAbility * a) :
|
||||
ListMaintainerAbility(observer, _id, card), NestedAbility(a)
|
||||
{
|
||||
tc = _tc;
|
||||
tc->targetter = NULL;
|
||||
includeSelf = _includeSelf;
|
||||
if(ability->aType == MTGAbility::STANDARD_PREVENT)
|
||||
aType = MTGAbility::STANDARD_PREVENT;
|
||||
}
|
||||
{
|
||||
tc = _tc;
|
||||
tc->targetter = NULL;
|
||||
includeSelf = _includeSelf;
|
||||
if(ability->aType == MTGAbility::STANDARD_PREVENT)
|
||||
aType = MTGAbility::STANDARD_PREVENT;
|
||||
}
|
||||
|
||||
//returns true if it is me who created ability a attached to Damageable d
|
||||
bool isParentOf(Damageable * d, MTGAbility * a)
|
||||
@@ -2577,7 +2578,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
if (d->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE)
|
||||
if (d->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE)
|
||||
{
|
||||
a->source = (MTGCardInstance *) d;
|
||||
}
|
||||
@@ -2607,7 +2608,8 @@ public:
|
||||
|
||||
int removed(MTGCardInstance * card)
|
||||
{
|
||||
if (abilities.find(card) != abilities.end() && !(forceDestroy == -1 && forcedAlive == 1))//only embelms have forcedestroy = -1 and forcedalive = 1
|
||||
if (abilities.find(card) != abilities.end()
|
||||
&& !(forceDestroy == -1 && forcedAlive == 1)) //only embelms have forcedestroy = -1 and forcedalive = 1
|
||||
{
|
||||
game->removeObserver(abilities[card]);
|
||||
abilities.erase(card);
|
||||
@@ -2620,7 +2622,7 @@ public:
|
||||
SAFE_DELETE(ability);
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
//Special case for move
|
||||
if (AAMover * move = dynamic_cast<AAMover *>(ability))
|
||||
@@ -2725,7 +2727,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
if (d->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE)
|
||||
if (d->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE)
|
||||
{
|
||||
a->source = (MTGCardInstance *) d;
|
||||
}
|
||||
@@ -2794,113 +2796,24 @@ public:
|
||||
//equipment
|
||||
class AEquip: public TargetAbility
|
||||
{
|
||||
public:
|
||||
private:
|
||||
bool isAttach;
|
||||
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()
|
||||
{
|
||||
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) || (a->aType == MTGAbility::STANDARD_TOKENCREATOR && a->oneShot))
|
||||
{
|
||||
SAFE_DELETE(a);
|
||||
continue;
|
||||
}
|
||||
game->removeObserver(currentAbilities[i]);
|
||||
}
|
||||
currentAbilities.clear();
|
||||
return 1;
|
||||
}
|
||||
public:
|
||||
AEquip(GameObserver* observer, int _id, MTGCardInstance * _source, ManaCost * _cost = NULL,
|
||||
int restrictions = ActivatedAbility::AS_SORCERY);
|
||||
|
||||
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(¤tAbilities, 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 unequip();
|
||||
int equip(MTGCardInstance * equipped);
|
||||
|
||||
}
|
||||
int resolve();
|
||||
const string getMenuText();
|
||||
|
||||
int resolve()
|
||||
{
|
||||
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);
|
||||
}
|
||||
int testDestroy();
|
||||
int destroy();
|
||||
|
||||
AEquip * clone() const;
|
||||
};
|
||||
|
||||
class ATokenCreator: public ActivatedAbility
|
||||
@@ -3123,7 +3036,7 @@ public:
|
||||
card->setAttacker(1);
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
sprintf(menuText, "Create %s", name.c_str());
|
||||
return menuText;
|
||||
@@ -3224,7 +3137,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
if(name.size())
|
||||
return name.c_str();
|
||||
@@ -3397,7 +3310,7 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return ability->getMenuText();
|
||||
}
|
||||
@@ -3609,7 +3522,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return ability->getMenuText();
|
||||
}
|
||||
@@ -3632,7 +3545,7 @@ public:
|
||||
AASetHand(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, int hand, ManaCost * _cost = NULL,
|
||||
int who = TargetChooser::UNSET);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AASetHand * clone() const;
|
||||
|
||||
};
|
||||
@@ -3646,7 +3559,7 @@ public:
|
||||
AALifeSet(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, WParsedInt * life, ManaCost * _cost = NULL,
|
||||
int who = TargetChooser::UNSET);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AALifeSet * clone() const;
|
||||
~AALifeSet();
|
||||
|
||||
@@ -3663,7 +3576,7 @@ public:
|
||||
AADamager(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, string d, ManaCost * _cost = NULL,
|
||||
int who = TargetChooser::UNSET);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
int getDamage();
|
||||
AADamager * clone() const;
|
||||
|
||||
@@ -3677,7 +3590,7 @@ public:
|
||||
|
||||
AADamagePrevent(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, int preventing, ManaCost * _cost = NULL, int who = TargetChooser::UNSET);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AADamagePrevent * clone() const;
|
||||
~AADamagePrevent();
|
||||
};
|
||||
@@ -3691,7 +3604,7 @@ public:
|
||||
AAAlterPoison(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, int poison, ManaCost * _cost = NULL,
|
||||
int who = TargetChooser::UNSET);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AAAlterPoison * clone() const;
|
||||
~AAAlterPoison();
|
||||
};
|
||||
@@ -3719,7 +3632,7 @@ class AATapper: public ActivatedAbility
|
||||
public:
|
||||
AATapper(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AATapper * clone() const;
|
||||
};
|
||||
|
||||
@@ -3729,7 +3642,7 @@ class AAUntapper: public ActivatedAbility
|
||||
public:
|
||||
AAUntapper(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AAUntapper * clone() const;
|
||||
};
|
||||
|
||||
@@ -3750,7 +3663,7 @@ class AAFrozen: public ActivatedAbility
|
||||
public:
|
||||
AAFrozen(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AAFrozen * clone() const;
|
||||
};
|
||||
/* ghetto new target*/
|
||||
@@ -3760,7 +3673,7 @@ public:
|
||||
bool retarget;
|
||||
AANewTarget(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target,bool retarget = false, ManaCost * _cost = NULL);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AANewTarget * clone() const;
|
||||
};
|
||||
/* morph*/
|
||||
@@ -3771,7 +3684,7 @@ public:
|
||||
AAMorph(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL);
|
||||
int resolve();
|
||||
int testDestroy();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AAMorph * clone() const;
|
||||
};
|
||||
/* flip*/
|
||||
@@ -3783,7 +3696,7 @@ public:
|
||||
AAFlip(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target,string flipStats);
|
||||
int resolve();
|
||||
int testDestroy();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AAFlip * clone() const;
|
||||
};
|
||||
/* dynamic ability build*/
|
||||
@@ -3848,7 +3761,7 @@ string menu;
|
||||
int resolve();
|
||||
int activateMainAbility(MTGAbility * toActivate,MTGCardInstance * source , Damageable * target);
|
||||
int activateStored();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AADynamic * clone() const;
|
||||
~AADynamic();
|
||||
};
|
||||
@@ -3901,7 +3814,7 @@ public:
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "Swap power and toughness";
|
||||
}
|
||||
@@ -3917,7 +3830,7 @@ public:
|
||||
AAExchangeLife(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, ManaCost * _cost = NULL,
|
||||
int who = TargetChooser::UNSET);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AAExchangeLife * clone() const;
|
||||
|
||||
};
|
||||
@@ -4153,7 +4066,7 @@ public:
|
||||
int reapplyCountersBonus(MTGCardInstance * rtarget= NULL,bool powerapplied=false,bool toughnessapplied=false);
|
||||
int testDestroy();
|
||||
int destroy();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
ATransformer * clone() const;
|
||||
~ATransformer();
|
||||
};
|
||||
@@ -4176,7 +4089,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 = "");
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
ATransformerInstant * clone() const;
|
||||
~ATransformerInstant();
|
||||
};
|
||||
@@ -4192,7 +4105,7 @@ public:
|
||||
WParsedPT * newWppt;
|
||||
PTInstant(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, WParsedPT * wppt,string s = "",bool nonstatic = false);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
PTInstant * clone() const;
|
||||
~PTInstant();
|
||||
};
|
||||
@@ -4251,7 +4164,7 @@ public:
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "Exalted";
|
||||
}
|
||||
@@ -4269,7 +4182,7 @@ public:
|
||||
ASwapPT * ability;
|
||||
ASwapPTUEOT(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
ASwapPTUEOT * clone() const;
|
||||
~ASwapPTUEOT();
|
||||
};
|
||||
@@ -4346,7 +4259,7 @@ public:
|
||||
APreventDamageTypesUEOT(GameObserver* observer, int id, MTGCardInstance * source, string to, string from, int type = 0);
|
||||
int resolve();
|
||||
int destroy();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
APreventDamageTypesUEOT * clone() const;
|
||||
~APreventDamageTypesUEOT();
|
||||
};
|
||||
@@ -4363,7 +4276,7 @@ public:
|
||||
AVanishing(GameObserver* observer, int _id, MTGCardInstance * card, ManaCost * _cost, int restrictions = 0,int amount = 0,string counterName = "");
|
||||
void Update(float dt);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AVanishing * clone() const;
|
||||
~AVanishing();
|
||||
};
|
||||
@@ -4385,7 +4298,7 @@ public:
|
||||
void Update(float dt);
|
||||
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
AUpkeep * clone() const;
|
||||
~AUpkeep();
|
||||
@@ -4411,7 +4324,7 @@ public:
|
||||
MTG_PHASE_UPKEEP,bool forcedestroy = false,bool next = true,bool myturn = true,bool opponentturn = true,bool once = false);
|
||||
void Update(float dt);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
APhaseAction * clone() const;
|
||||
~APhaseAction();
|
||||
};
|
||||
@@ -4425,7 +4338,7 @@ public:
|
||||
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);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
APhaseActionGeneric * clone() const;
|
||||
~APhaseActionGeneric();
|
||||
|
||||
@@ -4445,7 +4358,7 @@ public:
|
||||
void Update(float dt);
|
||||
void resolveBlink();
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
ABlink * clone() const;
|
||||
~ABlink();
|
||||
private:
|
||||
@@ -4463,7 +4376,7 @@ public:
|
||||
MTGAbility * stored;
|
||||
ABlinkGeneric(GameObserver* observer, int _id, MTGCardInstance * card, MTGCardInstance * _target,bool blinkueot=false,bool blinkForSource = false,bool blinkhand = false,MTGAbility * stored = NULL);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
ABlinkGeneric * clone() const;
|
||||
~ABlinkGeneric();
|
||||
|
||||
@@ -5369,7 +5282,7 @@ public:
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "phase alter";
|
||||
}
|
||||
@@ -5388,7 +5301,7 @@ public:
|
||||
AADepleter(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target,string nbcardsStr, ManaCost * _cost = NULL,
|
||||
int who = TargetChooser::UNSET);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AADepleter * clone() const;
|
||||
};
|
||||
|
||||
@@ -5401,7 +5314,7 @@ public:
|
||||
AAModTurn(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target,string nbTurnStr, ManaCost * _cost = NULL,
|
||||
int who = TargetChooser::UNSET);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AAModTurn * clone() const;
|
||||
};
|
||||
|
||||
@@ -5412,7 +5325,7 @@ public:
|
||||
AAShuffle(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost = NULL, int who =
|
||||
TargetChooser::UNSET);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AAShuffle * clone() const;
|
||||
};
|
||||
|
||||
@@ -5425,7 +5338,7 @@ public:
|
||||
|
||||
AARemoveMana(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, string ManaDesc, int who = TargetChooser::UNSET);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AARemoveMana * clone() const;
|
||||
~AARemoveMana();
|
||||
|
||||
@@ -5440,7 +5353,7 @@ public:
|
||||
AARandomDiscarder(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target,string nbcardsStr, ManaCost * _cost = NULL,
|
||||
int who = TargetChooser::UNSET);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AARandomDiscarder * clone() const;
|
||||
};
|
||||
|
||||
@@ -5612,7 +5525,7 @@ public:
|
||||
|
||||
int testDestroy(){return 0;};
|
||||
void Update(float dt);
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
int isReactingToTargetClick(Targetable * card);
|
||||
int reactToTargetClick(Targetable * object);
|
||||
MTGCardInstance * makeCard();
|
||||
@@ -5638,7 +5551,7 @@ public:
|
||||
{
|
||||
WEventDamage * e = (WEventDamage *) event;
|
||||
Damage * d = e->damage;
|
||||
if (combatonly && e->damage->typeOfDamage != DAMAGE_COMBAT)
|
||||
if (combatonly && e->damage->typeOfDamage != Damage::DAMAGE_COMBAT)
|
||||
return 0;
|
||||
MTGCardInstance * card = d->source;
|
||||
if (d->damage > 0 && card && (card == source || card == source->target))
|
||||
@@ -5729,7 +5642,7 @@ public:
|
||||
MTGAbility * abilityAltered;
|
||||
AASetColorChosen(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, int _color = 0 ,string toAdd = "");
|
||||
int resolve();
|
||||
const char* getMenuText();
|
||||
const string getMenuText();
|
||||
AASetColorChosen * clone() const;
|
||||
~AASetColorChosen();
|
||||
};
|
||||
@@ -5742,7 +5655,7 @@ public:
|
||||
MTGAbility * abilityAltered;
|
||||
AASetTypeChosen(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, int _type = 0,string menu = "error" ,string toAdd = "");
|
||||
int resolve();
|
||||
const char* getMenuText();
|
||||
const string getMenuText();
|
||||
AASetTypeChosen * clone() const;
|
||||
~AASetTypeChosen();
|
||||
};
|
||||
@@ -5756,7 +5669,7 @@ public:
|
||||
bool ANonWall;
|
||||
GenericChooseTypeColor(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target, string toAdd = "",bool chooseColor = false,bool nonwall = false, ManaCost * cost = NULL);
|
||||
int resolve();
|
||||
const char* getMenuText();
|
||||
const string getMenuText();
|
||||
GenericChooseTypeColor * clone() const;
|
||||
~GenericChooseTypeColor();
|
||||
|
||||
@@ -5773,7 +5686,7 @@ public:
|
||||
MTGAbility * abilityAltered;
|
||||
AASetCoin(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, int side = -1,string toAdd = "");
|
||||
int resolve();
|
||||
const char* getMenuText();
|
||||
const string getMenuText();
|
||||
AASetCoin * clone() const;
|
||||
~AASetCoin();
|
||||
};
|
||||
@@ -5781,11 +5694,10 @@ class GenericFlipACoin: public ActivatedAbility
|
||||
{
|
||||
public:
|
||||
string baseAbility;
|
||||
bool chooseColor;
|
||||
AASetCoin * setCoin;
|
||||
GenericFlipACoin(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target, string toAdd = "", ManaCost * cost = NULL);
|
||||
int resolve();
|
||||
const char* getMenuText();
|
||||
const string getMenuText();
|
||||
GenericFlipACoin * clone() const;
|
||||
~GenericFlipACoin();
|
||||
|
||||
@@ -5804,7 +5716,7 @@ public:
|
||||
|
||||
GenericPaidAbility(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target,string _newName,string _castRestriction,string _mayCost, string toAdd, ManaCost * cost = NULL);
|
||||
int resolve();
|
||||
const char* getMenuText();
|
||||
const string getMenuText();
|
||||
GenericPaidAbility * clone() const;
|
||||
~GenericPaidAbility();
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#ifndef _CACHE_ENGINE_H_
|
||||
#define _CACHE_ENGINE_H_
|
||||
|
||||
#include "PrecompiledHeader.h"
|
||||
|
||||
#include "Threading.h"
|
||||
@@ -208,3 +211,5 @@ public:
|
||||
|
||||
CardRetrieverBase* CacheEngine::sInstance = NULL;
|
||||
bool CacheEngine::sIsThreaded = false;
|
||||
|
||||
#endif //_CACHE_ENGINE_H_
|
||||
|
||||
@@ -9,9 +9,6 @@
|
||||
#include "MTGGameZones.h"
|
||||
#include "Counters.h"
|
||||
|
||||
#define CD_OR 1
|
||||
#define CD_AND 2
|
||||
|
||||
enum ENUM_COMPARISON_MODES
|
||||
{
|
||||
COMPARISON_NONE = 0, // Needs to remain 0 for quick if(comparison_mode) checks
|
||||
@@ -31,7 +28,12 @@ class CardDescriptor: public MTGCardInstance
|
||||
MTGCardInstance * match_not(MTGCardInstance * card);
|
||||
bool valueInRange(int comparisonMode, int value, int criterion);
|
||||
public:
|
||||
int mode;
|
||||
enum Operator{
|
||||
CD_OR = 1,
|
||||
CD_AND = 2
|
||||
};
|
||||
|
||||
Operator mode;
|
||||
int powerComparisonMode;
|
||||
int toughnessComparisonMode;
|
||||
int manacostComparisonMode;
|
||||
|
||||
@@ -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_
|
||||
@@ -33,7 +33,7 @@ protected:
|
||||
/*
|
||||
** Tries to render the Big version of a card picture, backups to text version in case of failure
|
||||
*/
|
||||
static void RenderBig(MTGCard * card, const Pos& pos);
|
||||
static void RenderBig(MTGCard * card, const Pos& pos, bool thumb = false);
|
||||
|
||||
static void RenderCountersBig(MTGCard * card, const Pos& pos, int drawMode = DrawMode::kNormal);
|
||||
static void AlternateRender(MTGCard * card, const Pos& pos);
|
||||
@@ -55,8 +55,8 @@ public:
|
||||
virtual void Render();
|
||||
virtual void Update(float dt);
|
||||
|
||||
void DrawCard(const Pos& inPosition, int inMode = DrawMode::kNormal);
|
||||
static void DrawCard(MTGCard* inCard, const Pos& inPosition, int inMode = DrawMode::kNormal);
|
||||
void DrawCard(const Pos& inPosition, int inMode = DrawMode::kNormal, bool thumb = false);
|
||||
static void DrawCard(MTGCard* inCard, const Pos& inPosition, int inMode = DrawMode::kNormal, bool thumb = false);
|
||||
|
||||
static JQuadPtr AlternateThumbQuad(MTGCard * card);
|
||||
virtual ostream& toString(ostream&) const;
|
||||
|
||||
@@ -101,10 +101,9 @@ public:
|
||||
int removeType(string value, int removeAll = 0);
|
||||
int removeType(int value, int removeAll = 0);
|
||||
bool hasSubtype(int _subtype);
|
||||
bool hasSubtype(const char * _subtype);
|
||||
bool hasSubtype(const string& _subtype);
|
||||
bool hasType(int _type);
|
||||
bool hasType(const char * type);
|
||||
bool hasType(const string& type);
|
||||
|
||||
void setManaCost(const string& value);
|
||||
ManaCost * getManaCost();
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
#ifndef _CAROUSEL_DECK_VIEW_H_
|
||||
#define _CAROUSEL_DECK_VIEW_H_
|
||||
|
||||
#include "DeckView.h"
|
||||
#include "Easing.h"
|
||||
|
||||
class CarouselDeckView : public DeckView
|
||||
{
|
||||
private:
|
||||
static const float max_scale;
|
||||
static const float x_center;
|
||||
static const float right_border;
|
||||
static const float slide_animation_duration;
|
||||
|
||||
public:
|
||||
CarouselDeckView();
|
||||
virtual ~CarouselDeckView();
|
||||
void Reset();
|
||||
|
||||
void UpdateViewState(float dt);
|
||||
void UpdateCardPosition(CardRep &rep, int index);
|
||||
void renderCard(int index)
|
||||
{
|
||||
int alpha = (int) (255 * (getCardRep(index).scale + 1.0 - max_scale));
|
||||
DeckView::renderCard(index, alpha);
|
||||
}
|
||||
|
||||
void Render();
|
||||
|
||||
MTGCard * Click(int x, int y);
|
||||
|
||||
void changePosition(int offset);
|
||||
void changeFilter(int offset);
|
||||
|
||||
MTGCard *getActiveCard();
|
||||
private:
|
||||
float mScrollOffset, mSlideOffset;
|
||||
InOutQuadEasing mScrollEasing;
|
||||
InOutQuadEasing mSlideEasing;
|
||||
};
|
||||
|
||||
#endif //_CAROUSEL_DECK_VIEW_H_
|
||||
@@ -11,17 +11,15 @@ class JGuiObject;
|
||||
class MTGCardInstance;
|
||||
class GameObserver;
|
||||
|
||||
#define DAMAGEABLE_MTGCARDINSTANCE 0
|
||||
#define DAMAGEABLE_PLAYER 1
|
||||
|
||||
#define DAMAGE_ALL_TYPES 0
|
||||
#define DAMAGE_COMBAT 1
|
||||
#define DAMAGE_OTHER 2
|
||||
|
||||
class Damageable:public Targetable
|
||||
{
|
||||
protected:
|
||||
public:
|
||||
enum DamageableType{
|
||||
DAMAGEABLE_MTGCARDINSTANCE = 0,
|
||||
DAMAGEABLE_PLAYER
|
||||
};
|
||||
|
||||
int life;
|
||||
int handsize;
|
||||
int poisonCount;
|
||||
@@ -29,12 +27,14 @@ public:
|
||||
int preventable;
|
||||
int thatmuch;
|
||||
int lifeLostThisTurn;
|
||||
int type_as_damageable;
|
||||
DamageableType type_as_damageable;
|
||||
Damageable(GameObserver* observer, int _life)
|
||||
: Targetable(observer)
|
||||
{life=_life;lifeLostThisTurn = 0;};
|
||||
int getLife(){return life;};
|
||||
virtual int dealDamage(int damage){life-=damage;return life;};
|
||||
: Targetable(observer), life(_life), handsize(0),
|
||||
poisonCount(0), damageCount(0), preventable(0), thatmuch(0),
|
||||
lifeLostThisTurn(0), type_as_damageable(DAMAGEABLE_MTGCARDINSTANCE)
|
||||
{}
|
||||
int getLife(){return life;}
|
||||
virtual int dealDamage(int damage){life-=damage;return life;}
|
||||
virtual int afterDamage(){return 0;}
|
||||
virtual int poisoned(){return 0;}
|
||||
virtual int prevented(){return 0;}
|
||||
@@ -47,17 +47,23 @@ public:
|
||||
|
||||
class Damage: public Interruptible
|
||||
{
|
||||
protected:
|
||||
void init(MTGCardInstance * source, Damageable * target, int damage, int typeOfDamage);
|
||||
public:
|
||||
enum DamageType{
|
||||
DAMAGE_ALL_TYPES = 0,
|
||||
DAMAGE_COMBAT,
|
||||
DAMAGE_OTHER
|
||||
};
|
||||
|
||||
Damageable * target;
|
||||
int typeOfDamage;
|
||||
DamageType typeOfDamage;
|
||||
int damage;
|
||||
void Render();
|
||||
Damage(GameObserver* observer, MTGCardInstance* source, Damageable * target);
|
||||
Damage(GameObserver* observer, MTGCardInstance* source, Damageable * target, int damage, int typeOfDamage = DAMAGE_OTHER);
|
||||
Damage(GameObserver* observer, MTGCardInstance* source, Damageable * target, int damage, DamageType typeOfDamage = DAMAGE_OTHER);
|
||||
int resolve();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
protected:
|
||||
void init(MTGCardInstance * source, Damageable * target, int damage, DamageType typeOfDamage);
|
||||
};
|
||||
|
||||
class DamageStack : public GuiLayer, public Interruptible
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#ifndef _DECK_EDITOR_MENU_H
|
||||
#define _DECK_EDITOR_MENU_H
|
||||
#pragma once
|
||||
#include "DeckMenu.h"
|
||||
#include "DeckDataWrapper.h"
|
||||
@@ -15,7 +17,8 @@ private:
|
||||
StatsWrapper *stw;
|
||||
|
||||
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();
|
||||
virtual ~DeckEditorMenu();
|
||||
};
|
||||
#endif //_DECK_EDITOR_MENU_H
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#ifndef _DECK_MANAGER_H
|
||||
#define _DECK_MANAGER_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -43,3 +46,5 @@ public:
|
||||
~DeckManager();
|
||||
|
||||
};
|
||||
|
||||
#endif //_DECK_MANAGER_H
|
||||
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
virtual void Render();
|
||||
virtual void Update(float dt);
|
||||
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();
|
||||
void updateScroller();
|
||||
void RenderBackground();
|
||||
|
||||
@@ -77,9 +77,7 @@ public:
|
||||
}
|
||||
|
||||
// Setters
|
||||
void setDescription( const string description ) { mDescription = description; };
|
||||
|
||||
;
|
||||
void setDescription( const string& description ) { mDescription = description; }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -98,7 +98,7 @@ public:
|
||||
string getManaColorIndex();
|
||||
void updateStats(string filename, MTGAllCards * collection);
|
||||
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);
|
||||
|
||||
vector<string> aiDeckNames;
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
#ifndef _DECK_VIEW_H_
|
||||
#define _DECK_VIEW_H_
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "MTGCard.h"
|
||||
#include "DeckDataWrapper.h"
|
||||
#include "WFont.h"
|
||||
#include "WResourceManager.h"
|
||||
#include "Pos.h"
|
||||
|
||||
|
||||
class DeckView
|
||||
{
|
||||
protected:
|
||||
static const float no_user_activity_show_card_delay;
|
||||
|
||||
public:
|
||||
struct CardRep{
|
||||
float x;
|
||||
float y;
|
||||
float scale;
|
||||
MTGCard * card;
|
||||
};
|
||||
|
||||
bool dirtyFilters;
|
||||
bool dirtyCardPos;
|
||||
|
||||
DeckView(int numberOfCards);
|
||||
virtual ~DeckView();
|
||||
virtual void Reset();
|
||||
|
||||
//advances the view and card representations
|
||||
void Update(float dt);
|
||||
virtual void SetDeck(DeckDataWrapper *toShow);
|
||||
DeckDataWrapper *deck();
|
||||
void SwitchFilter(int delta);
|
||||
void SwitchPosition(int delta);
|
||||
int filter();
|
||||
void reloadIndexes();
|
||||
int getPosition();
|
||||
|
||||
virtual void Render() = 0;
|
||||
virtual MTGCard * Click(int x, int y) = 0;
|
||||
bool ButtonPressed(Buttons button);
|
||||
virtual MTGCard *getActiveCard() = 0;
|
||||
virtual void changePosition(int offset) = 0;
|
||||
virtual void changeFilter(int offset) = 0;
|
||||
protected:
|
||||
float last_user_activity;
|
||||
int mFilter;
|
||||
DeckDataWrapper *mCurrentDeck;
|
||||
vector<CardRep> mCards;
|
||||
|
||||
CardRep& getCardRep(unsigned int index);
|
||||
void renderCard(int index, int alpha, bool asThumbnail = false);
|
||||
int getCardIndexNextTo(int x, int y);
|
||||
private:
|
||||
virtual void UpdateViewState(float dt) = 0;
|
||||
virtual void UpdateCardPosition(CardRep& rep, int index) = 0;
|
||||
};
|
||||
|
||||
#endif // _DECK_VIEW_H_
|
||||
@@ -0,0 +1,201 @@
|
||||
#ifndef _EASING_H_
|
||||
#define _EASING_H_
|
||||
|
||||
/*! \brief A class for eased floats for use in animations
|
||||
*
|
||||
* Animations often defines values a floating point variable
|
||||
* should have at given times and interpolates between them to
|
||||
* calculate the value of that variable at any given intermediate
|
||||
* time step.
|
||||
*
|
||||
* The simplest case would be linear interpolation:
|
||||
* Suppose a float "position" should be a at time = 0 and
|
||||
* b at time = x. If the current time is y, the value of
|
||||
* "position" is then a + (b-a)*y/x.
|
||||
*
|
||||
* This class defines the interface needed to implement different
|
||||
* kind of interpolations with a common interface. See
|
||||
* http://www.gizma.com/easing/ for more information for a few
|
||||
* examples.
|
||||
*/
|
||||
class Easing
|
||||
{
|
||||
public:
|
||||
/*! \brief The value at the start of an animation.
|
||||
*
|
||||
* start_value is undefined if no animation is running.
|
||||
*/
|
||||
float start_value;
|
||||
|
||||
/*! \brief The amount the value should change during the animation.
|
||||
*
|
||||
* delta_value is undefined if no animation is running.
|
||||
*/
|
||||
float delta_value;
|
||||
|
||||
/*! \brief The current value.
|
||||
*
|
||||
* Use this member to read the value or to write the value without
|
||||
* to animate intermediate values and. Make sure that the easing
|
||||
* is not used once value is deleted.
|
||||
*/
|
||||
float& value;
|
||||
|
||||
/*! \brief The duration the animation should take
|
||||
*
|
||||
* It is not relevant which unit is used. This value is undefined
|
||||
* if no animation is running.
|
||||
*/
|
||||
float duration;
|
||||
|
||||
/*! \brief The accumulated time the animation did run until now.
|
||||
*
|
||||
* It is not relevant which unit is used. This values is undefined
|
||||
* if no animation is running.
|
||||
*/
|
||||
float time_acc;
|
||||
|
||||
/*! \brief Sets Easing::float to val and sets the animation as not running.
|
||||
*
|
||||
* Make sure that the easing is not used once value is deleted.
|
||||
*
|
||||
* \param val The value to ease
|
||||
*/
|
||||
Easing(float& val): start_value(val), delta_value(0), value(val), duration(0), time_acc(0)
|
||||
{
|
||||
}
|
||||
|
||||
/*! \brief Resets the animation to its initial value
|
||||
*
|
||||
* This method does set the value to the start value and sets the passed time to 0.
|
||||
* If there is no animation animation running, the resulting value is undefined.
|
||||
*/
|
||||
void reset()
|
||||
{
|
||||
value = start_value;
|
||||
time_acc = 0;
|
||||
}
|
||||
|
||||
/*! \brief Finishes the animation immediately
|
||||
*
|
||||
* Sets the value to the animations target value and the passed time to the
|
||||
* animations duration. If there is no animation running, the behaviour is undefined.
|
||||
*/
|
||||
void finish()
|
||||
{
|
||||
value = start_value + delta_value;
|
||||
time_acc = duration;
|
||||
}
|
||||
|
||||
/*! \brief Lets dt time pass
|
||||
*
|
||||
* Advances the animation by dt time units and updates the value accordingly.
|
||||
*
|
||||
* \val dt The amount of time to jump forward
|
||||
*/
|
||||
void update(float dt)
|
||||
{
|
||||
if(duration > 0)
|
||||
{
|
||||
time_acc += dt;
|
||||
|
||||
if(time_acc > duration)
|
||||
{
|
||||
time_acc = duration;
|
||||
value = start_value + delta_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
updateValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*! \brief Calculates the value from all other members.
|
||||
*
|
||||
* This method gets implemented by all specific easing classes.
|
||||
*/
|
||||
virtual void updateValue() = 0;
|
||||
|
||||
/*! \brief Starts the animation.
|
||||
*
|
||||
* Starts the interpolation from the current value (now) to
|
||||
* targetValue (in now + _duration).
|
||||
*
|
||||
* If the animation is currently running, it gets replaced.
|
||||
*
|
||||
* \param targetValue The value to interpolate to
|
||||
* \param _duration The duration the interpolation should take
|
||||
*/
|
||||
void start(float targetValue, float _duration)
|
||||
{
|
||||
start_value = value;
|
||||
delta_value = targetValue - start_value;
|
||||
time_acc = 0;
|
||||
duration = _duration;
|
||||
}
|
||||
|
||||
/*! \brief Translates the current value and the target value by delta_value
|
||||
*
|
||||
* This method is mainly used for trickery. Suppose there is one object in the
|
||||
* middle of the screen that should move to the top until it is outside of the
|
||||
* screen and gets replaced by a second one entering the screen from the lower
|
||||
* side once the first one disappeared. This method can be used to simulate this
|
||||
* effect with one animation by translating (i.e. moving) the animation from the
|
||||
* top to the bottom:
|
||||
*
|
||||
* Object1 and object2 are the same object: object1 whose y position is bound to value
|
||||
* To start the transition, use start(SCREEN_HEIGHT, desired time); Once the first
|
||||
* object left the screen (i.e. object.y < 0), change objects appearance to object2
|
||||
* and translate the easing by (SCREEN_HEIGHT).
|
||||
*
|
||||
* \param delta_value The change in start_value and value
|
||||
*/
|
||||
void translate(float delta_value)
|
||||
{
|
||||
start_value += delta_value;
|
||||
value += delta_value;
|
||||
}
|
||||
|
||||
/*! \brief Returns if the passed time exceeds duration.
|
||||
*
|
||||
* If ther is no animation running, it is ensured that this is true.
|
||||
*/
|
||||
bool finished()
|
||||
{
|
||||
return time_acc >= duration;
|
||||
}
|
||||
};
|
||||
|
||||
/*! \brief This class defines an easing with quadratic acceleration and decceleration.
|
||||
*/
|
||||
class InOutQuadEasing : public Easing
|
||||
{
|
||||
public:
|
||||
/*! \brief Calls Easing::Easing(val).
|
||||
*
|
||||
* \see Easing::Easing(float& val)
|
||||
*/
|
||||
InOutQuadEasing(float& val): Easing(val) {}
|
||||
|
||||
/*! \brief Implements the value calculation.
|
||||
*
|
||||
* \see Easing::updateValue()
|
||||
*/
|
||||
void updateValue()
|
||||
{
|
||||
float time_tmp = (time_acc * 2) / duration;
|
||||
if (time_tmp < 1)
|
||||
{
|
||||
value = (float)(delta_value * 0.5 * time_tmp * time_tmp + start_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
time_tmp -= 1;
|
||||
value = (float)(- delta_value * 0.5 * (time_tmp * (time_tmp - 2) - 1) + start_value);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif //_EASING_H_
|
||||
@@ -20,7 +20,6 @@
|
||||
#include "MTGCard.h"
|
||||
#include "MTGGameZones.h"
|
||||
|
||||
#include "CardEffect.h"
|
||||
#ifdef NETWORK_SUPPORT
|
||||
#include "JNetwork.h"
|
||||
#endif //NETWORK_SUPPORT
|
||||
@@ -49,7 +48,6 @@ public:
|
||||
|
||||
GameType gameType;
|
||||
Rules * rules;
|
||||
CardEffect *effect;
|
||||
#ifdef NETWORK_SUPPORT
|
||||
string mServerAddress;
|
||||
JNetwork* mpNetwork;
|
||||
|
||||
@@ -98,8 +98,8 @@ class GameObserver{
|
||||
int cardClick(MTGCardInstance * card,Targetable * _object = NULL, bool log = true);
|
||||
GamePhase getCurrentGamePhase();
|
||||
void setCurrentGamePhase(GamePhase phase) { mCurrentGamePhase = phase; };
|
||||
const char * getCurrentGamePhaseName();
|
||||
const char * getNextGamePhaseName();
|
||||
const string& getCurrentGamePhaseName();
|
||||
const string& getNextGamePhaseName();
|
||||
void nextCombatStep();
|
||||
void userRequestNextGamePhase(bool allowInterrupt = true, bool log = true);
|
||||
void cleanupPhase();
|
||||
|
||||
@@ -19,22 +19,7 @@
|
||||
#include "WGui.h"
|
||||
#include "InteractiveButton.h"
|
||||
|
||||
#define NO_USER_ACTIVITY_HELP_DELAY 10
|
||||
#define NO_USER_ACTIVITY_SHOWCARD_DELAY 0.1
|
||||
|
||||
enum
|
||||
{
|
||||
STAGE_TRANSITION_RIGHT = 0,
|
||||
STAGE_TRANSITION_LEFT = 1,
|
||||
STAGE_WAITING = 2,
|
||||
STAGE_TRANSITION_UP = 3,
|
||||
STAGE_TRANSITION_DOWN = 4,
|
||||
STAGE_ONSCREEN_MENU = 5,
|
||||
STAGE_WELCOME = 6,
|
||||
STAGE_MENU = 7,
|
||||
STAGE_FILTERS = 8,
|
||||
STAGE_TRANSITION_SELECTED = 9
|
||||
};
|
||||
class DeckView;
|
||||
|
||||
// TODO: need a better name for MENU_FIRST_MENU, this is reused for the 1st submenu of
|
||||
// available options in the duel menu
|
||||
@@ -44,7 +29,7 @@ enum
|
||||
MENU_DECK_SELECTION = 10,
|
||||
MENU_DECK_BUILDER = 11,
|
||||
MENU_FIRST_DUEL_SUBMENU = 102,
|
||||
MENU_LANGUAGE_SELECTION = 103,
|
||||
MENU_LANGUAGE_SELECTION = 103
|
||||
};
|
||||
|
||||
// enums for menu options
|
||||
@@ -64,79 +49,69 @@ enum DECK_VIEWER_MENU_ITEMS
|
||||
MENU_ITEM_NO = 21,
|
||||
MENU_ITEM_FILTER_BY = 22,
|
||||
MENUITEM_MORE_INFO = kInfoMenuID
|
||||
|
||||
};
|
||||
|
||||
#define ALL_COLORS -1
|
||||
|
||||
#define ROTATE_LEFT 1;
|
||||
#define ROTATE_RIGHT 0;
|
||||
|
||||
#define HIGH_SPEED 15.0
|
||||
#define MED_SPEED 5.0f
|
||||
#define LOW_SPEED 1.5
|
||||
|
||||
#define MAX_SAVED_FILTERS Constants::NB_Colors + 1
|
||||
#define CARDS_DISPLAYED 10
|
||||
|
||||
class GameStateDeckViewer: public GameState, public JGuiListener
|
||||
{
|
||||
private:
|
||||
enum DeckViewerStages
|
||||
{
|
||||
STAGE_WAITING = 0,
|
||||
STAGE_ONSCREEN_MENU,
|
||||
STAGE_WELCOME,
|
||||
STAGE_MENU,
|
||||
STAGE_FILTERS
|
||||
};
|
||||
|
||||
vector<JQuadPtr> mIcons;
|
||||
JQuadPtr pspIcons[8];
|
||||
JTexture * pspIconsTexture;
|
||||
float last_user_activity;
|
||||
float onScreenTransition;
|
||||
float mRotation;
|
||||
float mSlide;
|
||||
int mAlpha;
|
||||
int mStage;
|
||||
int useFilter;
|
||||
DeckViewerStages mStage;
|
||||
JMusic * bgMusic;
|
||||
int lastPos;
|
||||
int lastTotal;
|
||||
int mSelected;
|
||||
|
||||
InteractiveButton *toggleDeckButton, *sellCardButton, *statsPrevButton, *filterButton;
|
||||
InteractiveButton *toggleDeckButton, *sellCardButton, *statsPrevButton, *filterButton, *toggleViewButton;
|
||||
|
||||
WGuiFilters * filterMenu;
|
||||
WSrcDeckViewer * source;
|
||||
|
||||
DeckEditorMenu * welcome_menu;
|
||||
SimpleMenu * subMenu;
|
||||
DeckEditorMenu * menu;
|
||||
DeckEditorMenu * deckMenu;
|
||||
PriceList* pricelist;
|
||||
PlayerData * playerdata;
|
||||
int price;
|
||||
DeckDataWrapper * displayed_deck;
|
||||
DeckDataWrapper * myDeck;
|
||||
DeckDataWrapper * myCollection;
|
||||
MTGCard * cardIndex[CARDS_DISPLAYED];
|
||||
StatsWrapper *stw;
|
||||
StatsWrapper * mStatsWrapper;
|
||||
|
||||
int hudAlpha;
|
||||
string newDeckname;
|
||||
bool isAIDeckSave;
|
||||
bool mSwitching;
|
||||
|
||||
enum AvailableView{
|
||||
CAROUSEL_VIEW,
|
||||
GRID_VIEW
|
||||
};
|
||||
DeckView* mView;
|
||||
AvailableView mCurrentView;
|
||||
|
||||
void saveDeck(); //Saves the deck and additional necessary information
|
||||
void saveAsAIDeck(string deckName); // saves deck as an AI Deck
|
||||
int getCurrentPos();
|
||||
void sellCard();
|
||||
void setButtonState(bool state);
|
||||
bool userPressedButton();
|
||||
void RenderButtons();
|
||||
|
||||
pair<float, float> cardsCoordinates[CARDS_DISPLAYED];
|
||||
|
||||
void setupView(AvailableView view, DeckDataWrapper *deck);
|
||||
void toggleView();
|
||||
public:
|
||||
GameStateDeckViewer(GameApp* parent);
|
||||
virtual ~GameStateDeckViewer();
|
||||
void updateDecks();
|
||||
void rotateCards(int direction);
|
||||
void loadIndexes();
|
||||
void updateFilters();
|
||||
void rebuildFilters();
|
||||
void switchDisplay();
|
||||
void toggleCollection();
|
||||
void Start();
|
||||
virtual void End();
|
||||
void addRemove(MTGCard * card);
|
||||
@@ -145,11 +120,8 @@ public:
|
||||
void renderSlideBar();
|
||||
void renderDeckBackground();
|
||||
void renderOnScreenMenu();
|
||||
virtual void renderCard(int id, float rotation);
|
||||
virtual void renderCard(int id);
|
||||
virtual void Render();
|
||||
int loadDeck(int deckid);
|
||||
void LoadDeckStatistics(int deckId);
|
||||
|
||||
void OnScroll(int inXVelocity, int inYVelocity);
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
#ifndef _GRID_DECK_VIEW_H
|
||||
#define _GRID_DECK_VIEW_H
|
||||
|
||||
#include "DeckView.h"
|
||||
#include "Easing.h"
|
||||
|
||||
class GridDeckView : public DeckView
|
||||
{
|
||||
private:
|
||||
static const float scroll_animation_duration;
|
||||
static const float slide_animation_duration;
|
||||
static const float card_scale_small;
|
||||
static const float card_scale_big;
|
||||
public:
|
||||
GridDeckView();
|
||||
virtual ~GridDeckView();
|
||||
void Reset();
|
||||
|
||||
void UpdateViewState(float dt);
|
||||
void UpdateCardPosition(CardRep &rep, int index);
|
||||
|
||||
void Render();
|
||||
MTGCard * Click(int x, int y);
|
||||
|
||||
void changePosition(int offset);
|
||||
void changeFilter(int offset);
|
||||
|
||||
MTGCard *getActiveCard();
|
||||
private:
|
||||
int mCols;
|
||||
int mRows;
|
||||
float mScrollOffset, mSlideOffset;
|
||||
InOutQuadEasing mScrollEasing;
|
||||
InOutQuadEasing mSlideEasing;
|
||||
int mCurrentSelection;
|
||||
};
|
||||
|
||||
#endif //_GRID_DECK_VIEW_H
|
||||
@@ -1,10 +1,14 @@
|
||||
#ifndef _GUI_MANA_H
|
||||
#define _GUI_MANA_H
|
||||
|
||||
#include "string.h"
|
||||
#include <vector>
|
||||
#include <hge/hgeparticle.h>
|
||||
#include "JGE.h"
|
||||
#include "MTGDefinitions.h"
|
||||
#include "GameApp.h"
|
||||
#include "Pos.h"
|
||||
#include "GuiLayers.h"
|
||||
#include "WResource_Fwd.h"
|
||||
|
||||
class ManaIcon : public Pos
|
||||
{
|
||||
@@ -51,3 +55,5 @@ public:
|
||||
virtual int receiveEventPlus(WEvent * e);
|
||||
virtual int receiveEventMinus(WEvent * e);
|
||||
};
|
||||
|
||||
#endif //_GUI_MANA_H
|
||||
|
||||
@@ -28,6 +28,7 @@ const int kNextStatsButtonId = 10005;
|
||||
const int kPrevStatsButtonId = 10006;
|
||||
const int kCycleCardsButtonId = 10007;
|
||||
const int kShowCardListButtonId = 10008;
|
||||
const int kSwitchViewButton = 10009;
|
||||
|
||||
class InteractiveButton: public SimpleButton
|
||||
{
|
||||
|
||||
@@ -317,7 +317,7 @@ public:
|
||||
virtual TargetAbility* clone() const = 0;
|
||||
virtual void Render();
|
||||
virtual int resolve();
|
||||
virtual const char * getMenuText();
|
||||
virtual const string getMenuText();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
@@ -436,7 +436,7 @@ public:
|
||||
|
||||
void Update(float dt);
|
||||
virtual GenericTriggeredAbility* clone() const;
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
~GenericTriggeredAbility();
|
||||
};
|
||||
|
||||
@@ -525,7 +525,7 @@ public:
|
||||
int isReactingToClick(MTGCardInstance * _card, ManaCost * mana = NULL);
|
||||
int resolve();
|
||||
int reactToClick(MTGCardInstance* _card);
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
~AManaProducer();
|
||||
virtual AManaProducer * clone() const;
|
||||
};
|
||||
|
||||
@@ -129,11 +129,11 @@ public:
|
||||
|
||||
|
||||
//types
|
||||
void addType(char * type_text);
|
||||
void addType(const string& type_text);
|
||||
virtual void addType(int id);
|
||||
void setType(const char * type_text);
|
||||
void setSubtype( string value);
|
||||
int removeType(string value, int removeAll = 0);
|
||||
void setType(const string& type_text);
|
||||
void setSubtype(const string &value);
|
||||
int removeType(const string &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.
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#define MTG_ERROR -1
|
||||
|
||||
#include "MTGDefinitions.h"
|
||||
#include "GameApp.h"
|
||||
#include "WResourceManager.h"
|
||||
#include <dirent.h>
|
||||
#include <Threading.h>
|
||||
@@ -19,7 +18,7 @@ class MTGPack;
|
||||
class MTGSetInfo
|
||||
{
|
||||
public:
|
||||
MTGSetInfo(string _id);
|
||||
MTGSetInfo(const string& _id);
|
||||
~MTGSetInfo();
|
||||
string id; //Short name: 10E, RAV, etc. Automatic from folder.
|
||||
string author; //Author of set, for crediting mod makers, etc.
|
||||
@@ -70,7 +69,7 @@ public:
|
||||
MTGSets();
|
||||
~MTGSets();
|
||||
|
||||
int Add(const char * subtype);
|
||||
int Add(const string& subtype);
|
||||
int findSet(string value);
|
||||
int findBlock(string s);
|
||||
int size();
|
||||
@@ -127,8 +126,10 @@ public:
|
||||
MTGCard * getCardByName(string name);
|
||||
void loadFolder(const string& folder, const string& filename="" );
|
||||
|
||||
int load(const char * config_file, const char * setName = NULL, int autoload = 1);
|
||||
int countByType(const char * _type);
|
||||
int load(const string& config_file);
|
||||
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 countBySet(int setId);
|
||||
int totalCards();
|
||||
@@ -136,7 +137,7 @@ public:
|
||||
|
||||
static int findType(string subtype, bool forceAdd = true) {
|
||||
boost::mutex::scoped_lock lock(instance->mMutex);
|
||||
int result = instance->subtypesList.find(subtype, forceAdd);
|
||||
int result = instance->subtypesList.find(subtype, forceAdd);
|
||||
return result;
|
||||
};
|
||||
static int add(string value, unsigned int parentType) {
|
||||
@@ -218,8 +219,8 @@ public:
|
||||
int totalCards();
|
||||
int totalPrice();
|
||||
MTGDeck(MTGAllCards * _allcards);
|
||||
MTGDeck(const char * 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,
|
||||
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 string& subtype = "",
|
||||
int * colors = NULL, int nbcolors = 0);
|
||||
int add(int cardid);
|
||||
int add(MTGDeck * deck); // adds the contents of "deck" into myself
|
||||
|
||||
@@ -218,7 +218,8 @@ class Constants
|
||||
soulbond = 100,
|
||||
LURE = 101,
|
||||
NOLEGEND = 102,
|
||||
NB_BASIC_ABILITIES = 103,
|
||||
CANPLAYFROMGRAVEYARD = 103,
|
||||
NB_BASIC_ABILITIES = 104,
|
||||
|
||||
|
||||
RARITY_S = 'S', //Special Rarity
|
||||
@@ -293,7 +294,7 @@ class Constants
|
||||
|
||||
static map<string,int> MTGBasicAbilitiesMap;
|
||||
static const char* MTGBasicAbilities[];
|
||||
static const char* MTGPhaseNames[];
|
||||
static const string MTGPhaseNames[];
|
||||
static const char* MTGPhaseCodeNames[];
|
||||
|
||||
static int GetBasicAbilityIndex(string mtgAbility);
|
||||
|
||||
@@ -95,7 +95,7 @@ class MTGGameZone {
|
||||
void cleanupPhase();
|
||||
void beforeBeginPhase();
|
||||
|
||||
unsigned int countByType(const char * value);
|
||||
unsigned int countByType(const string &value);
|
||||
unsigned int countByCanTarget(TargetChooser * tc);
|
||||
unsigned int countTotalManaSymbols(TargetChooser * tc, int color);
|
||||
MTGCardInstance * findByName(string name);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#ifndef _MTGPACCK_H_
|
||||
#ifndef _MTGPACK_H_
|
||||
#define _MTGPACK_H_
|
||||
|
||||
class ShopBooster;
|
||||
|
||||
@@ -66,6 +66,7 @@ public:
|
||||
MTGEventBonus(GameObserver* observer, int _id);
|
||||
virtual MTGEventBonus * clone() const;
|
||||
};
|
||||
|
||||
class MTGPutInPlayRule: public PermanentAbility
|
||||
{
|
||||
public:
|
||||
@@ -73,7 +74,7 @@ public:
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
MTGPutInPlayRule(GameObserver* observer, int _id);
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "cast card normally";
|
||||
}
|
||||
@@ -87,7 +88,7 @@ public:
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
MTGKickerRule(GameObserver* observer, int _id);
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "pay kicker";
|
||||
}
|
||||
@@ -105,7 +106,7 @@ public:
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
MTGAlternativeCostRule(GameObserver* observer, int _id);
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
if(alternativeName.size())
|
||||
return alternativeName.c_str();
|
||||
@@ -121,7 +122,7 @@ public:
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
MTGBuyBackRule(GameObserver* observer, int _id);
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "cast and buy back";
|
||||
}
|
||||
@@ -136,7 +137,7 @@ public:
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
MTGFlashBackRule(GameObserver* observer, int _id);
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "flash back";
|
||||
}
|
||||
@@ -150,7 +151,7 @@ public:
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
MTGRetraceRule(GameObserver* observer, int _id);
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "retrace";
|
||||
}
|
||||
@@ -165,13 +166,28 @@ public:
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
MTGMorphCostRule(GameObserver* observer, int _id);
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "play morphed";
|
||||
}
|
||||
virtual MTGMorphCostRule * clone() const;
|
||||
};
|
||||
|
||||
class MTGPlayFromGraveyardRule: public MTGAlternativeCostRule
|
||||
{
|
||||
public:
|
||||
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
MTGPlayFromGraveyardRule(GameObserver* observer, int _id);
|
||||
const string getMenuText()
|
||||
{
|
||||
return "cast card from graveyard";
|
||||
}
|
||||
virtual MTGPlayFromGraveyardRule * clone() const;
|
||||
};
|
||||
|
||||
|
||||
class MTGSuspendRule: public MTGAlternativeCostRule
|
||||
{
|
||||
public:
|
||||
@@ -181,7 +197,7 @@ public:
|
||||
string suspendmenu;
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
MTGSuspendRule(GameObserver* observer, int _id);
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
virtual MTGSuspendRule * clone() const;
|
||||
};
|
||||
|
||||
@@ -195,7 +211,7 @@ public:
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
MTGAttackRule(GameObserver* observer, int _id);
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "Attacker";
|
||||
}
|
||||
@@ -213,7 +229,7 @@ public:
|
||||
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
MTGPlaneswalkerAttackRule(GameObserver* observer, int _id);
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "Attack Planeswalker";
|
||||
}
|
||||
@@ -226,7 +242,7 @@ public:
|
||||
MTGCardInstance* attacker;
|
||||
AAPlaneswalkerAttacked(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target);
|
||||
int resolve();
|
||||
const char* getMenuText();
|
||||
const string getMenuText();
|
||||
AAPlaneswalkerAttacked * clone() const;
|
||||
~AAPlaneswalkerAttacked();
|
||||
};
|
||||
@@ -252,7 +268,7 @@ public:
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
MTGBlockRule(GameObserver* observer, int _id);
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
virtual MTGBlockRule * clone() const;
|
||||
~MTGBlockRule();
|
||||
};
|
||||
@@ -386,7 +402,7 @@ public:
|
||||
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
int reactToClick(MTGCardInstance * card, int id);
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "Momir";
|
||||
}
|
||||
@@ -406,7 +422,7 @@ public:
|
||||
MTGCardInstance * genEquip(int id);
|
||||
MTGStoneHewerRule(GameObserver* observer, int _id, MTGAllCards * _collection);
|
||||
int receiveEvent(WEvent * event);
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "Stone Hewer";
|
||||
}
|
||||
@@ -419,7 +435,7 @@ class MTGHermitRule: public PermanentAbility
|
||||
public:
|
||||
MTGHermitRule(GameObserver* observer, int _id);
|
||||
int receiveEvent(WEvent * event);
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "Hermit";
|
||||
}
|
||||
@@ -447,7 +463,7 @@ public:
|
||||
|
||||
int receiveEvent(WEvent * event);
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "Deathtouch";
|
||||
}
|
||||
|
||||
@@ -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,6 +1,8 @@
|
||||
#ifndef OBJECTANALYTICS_H
|
||||
#define OBJECTANALYTICS_H
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define TRACK_OBJECT_USAGE
|
||||
#endif
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include <JGui.h>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include "GameApp.h"
|
||||
#include "GameStateOptions.h"
|
||||
#include "WFilter.h"
|
||||
#include "WDataSrc.h"
|
||||
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
int addCombatAfter(Player* player, int after_id, bool withMain = false);
|
||||
int addPhaseAfter(GamePhase id, Player* player, int after_id);
|
||||
int removePhase(int id);
|
||||
const char * phaseName(int id);
|
||||
const string& phaseName(int id);
|
||||
static GamePhase phaseStrToInt(string s);
|
||||
static string phaseIntToStr(int id);
|
||||
|
||||
|
||||
@@ -20,16 +20,18 @@ public:
|
||||
~PriceList();
|
||||
int save();
|
||||
int getSellPrice(int cardid);
|
||||
int getSellPrice(MTGCard* card);
|
||||
int getPurchasePrice(int cardid);
|
||||
int getPrice(MTGCard *card);
|
||||
int getPrice(int cardId);
|
||||
int setPrice(int cardId, int price);
|
||||
int setPrice(MTGCard *card, int price);
|
||||
int getOtherPrice(int amt);
|
||||
static float difficultyScalar(float price, int cardid = 0);
|
||||
static void updateKey()
|
||||
{
|
||||
randomKey = rand();
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -29,9 +29,10 @@ protected:
|
||||
TargetChooser * tcTarget;
|
||||
int damage;
|
||||
bool oneShot;
|
||||
int typeOfDamage;
|
||||
Damage::DamageType typeOfDamage;
|
||||
public:
|
||||
REDamagePrevention(MTGAbility * _source, TargetChooser *_tcSource = NULL, TargetChooser *_tcTarget = NULL, int _damage = -1, bool _oneShot = true, int typeOfDamage = DAMAGE_ALL_TYPES);
|
||||
REDamagePrevention(MTGAbility * _source, TargetChooser *_tcSource = NULL, TargetChooser *_tcTarget = NULL,
|
||||
int _damage = -1, bool _oneShot = true, Damage::DamageType typeOfDamage = Damage::DAMAGE_ALL_TYPES);
|
||||
WEvent * replace(WEvent *e);
|
||||
~REDamagePrevention();
|
||||
};
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
virtual bool CheckUserInput(JButton key);
|
||||
virtual void Update(float dt);
|
||||
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;}
|
||||
float getWidth(){return mWidth; }
|
||||
virtual void Close();
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#ifndef _STYLE_MANAGER_H_
|
||||
#define _STYLE_MANAGER_H_
|
||||
|
||||
class WStyle
|
||||
{
|
||||
public:
|
||||
@@ -34,3 +37,5 @@ protected:
|
||||
string activeStyle;
|
||||
map<string, WStyle*> styles;
|
||||
};
|
||||
|
||||
#endif //_STYLE_MANAGER_H_
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
class GameObserver;
|
||||
|
||||
// Task type constant
|
||||
|
||||
#define TASK_BASIC 'B'
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#include "MTGDeck.h"
|
||||
|
||||
#ifndef _WFILTER_H_
|
||||
#define _WFILTER_H_
|
||||
/**
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
class hgeDistortionMesh;
|
||||
class GameStateOptions;
|
||||
class SimpleMenu;
|
||||
|
||||
/**
|
||||
@defgroup WGui Basic Gui
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef _DEBUG_H_
|
||||
#define _DEBUG_H_
|
||||
|
||||
#if ((defined WIN32) || (defined WP8)) && (!defined QT_CONFIG)
|
||||
#if ((defined WIN32) || (defined WP8))
|
||||
#define snprintf sprintf_s
|
||||
#endif
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <stdlib.h>
|
||||
#include <list>
|
||||
|
||||
#include "DebugRoutines.h"
|
||||
|
||||
@@ -140,4 +141,20 @@ template <class T> istream& operator>>(istream& in, T& p)
|
||||
/* replace_all ... replacement to avoid depending on boost for that */
|
||||
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
|
||||
|
||||
@@ -74,8 +74,7 @@ AIHint::AIHint(string _line)
|
||||
|
||||
if(action.find( "combo ") != string::npos)
|
||||
{
|
||||
string Combo = "";
|
||||
Combo = action.c_str() + 6;
|
||||
string Combo = action.c_str() + 6;
|
||||
combos.push_back(Combo);
|
||||
}
|
||||
|
||||
@@ -307,14 +306,13 @@ bool AIHints::canWeCombo(GameObserver* observer,MTGCardInstance * card,AIPlayerB
|
||||
TargetChooserFactory tfc(observer);
|
||||
TargetChooser * hintTc = NULL;
|
||||
bool gotCombo = false;
|
||||
int comboPartsHold = 0;
|
||||
int comboPartsUntil = 0;
|
||||
int comboPartsRestriction = 0;
|
||||
|
||||
for(unsigned int i = 0; i < hints.size();i++)
|
||||
{
|
||||
comboPartsHold = 0;
|
||||
comboPartsUntil = 0;
|
||||
comboPartsRestriction = 0;
|
||||
int comboPartsHold = 0;
|
||||
int comboPartsUntil = 0;
|
||||
int comboPartsRestriction = 0;
|
||||
|
||||
if(gotCombo)
|
||||
return gotCombo;//because more then one might be possible at any time.
|
||||
if (hints[i]->hold.size())
|
||||
|
||||
@@ -90,13 +90,12 @@ int AIMomirPlayer::computeActions()
|
||||
}
|
||||
else if (p == this && observer->mLayers->stackLayer()->count(0, NOT_RESOLVED) == 0)
|
||||
{ //standard actions
|
||||
CardDescriptor cd;
|
||||
MTGCardInstance * card = NULL;
|
||||
|
||||
switch (currentGamePhase)
|
||||
{
|
||||
case MTG_PHASE_FIRSTMAIN:
|
||||
{
|
||||
CardDescriptor cd;
|
||||
ManaCost * potentialMana = getPotentialMana();
|
||||
int converted = potentialMana->getConvertedCost();
|
||||
SAFE_DELETE(potentialMana);
|
||||
@@ -106,7 +105,7 @@ int AIMomirPlayer::computeActions()
|
||||
//Attempt to put land into play
|
||||
cd.init();
|
||||
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);
|
||||
if (card && (canPutLandsIntoPlay == PlayRestriction::CAN_PLAY))
|
||||
{
|
||||
@@ -118,15 +117,12 @@ int AIMomirPlayer::computeActions()
|
||||
}
|
||||
momir();
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
case MTG_PHASE_SECONDMAIN:
|
||||
selectAbility();
|
||||
return 1;
|
||||
break;
|
||||
default:
|
||||
return AIPlayerBaka::computeActions();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return AIPlayerBaka::computeActions();
|
||||
|
||||
@@ -97,7 +97,7 @@ int AIAction::clickMultiAct(vector<Targetable*>& actionTargets)
|
||||
ite = actionTargets.erase(ite);
|
||||
continue;
|
||||
}
|
||||
ite++;
|
||||
++ite;
|
||||
}
|
||||
|
||||
//shuffle to make it less predictable, otherwise ai will always seem to target from right to left. making it very obvious.
|
||||
@@ -167,7 +167,7 @@ int AIPlayer::clickMultiTarget(TargetChooser * tc, vector<Targetable*>& potentia
|
||||
ite = potentialTargets.erase(ite);
|
||||
continue;
|
||||
}
|
||||
ite++;
|
||||
++ite;
|
||||
}
|
||||
|
||||
randomGenerator.random_shuffle(potentialTargets.begin(), potentialTargets.end());
|
||||
|
||||
@@ -134,10 +134,9 @@ int OrderedAIAction::getEfficiency()
|
||||
if (!target)
|
||||
break;
|
||||
|
||||
bool NeedPreventing;
|
||||
NeedPreventing = false;
|
||||
if (currentPhase == MTG_PHASE_COMBATBLOCKERS)
|
||||
{
|
||||
bool NeedPreventing = false;
|
||||
MTGCardInstance * nextOpponent = target->getNextOpponent();
|
||||
if(!nextOpponent)
|
||||
break;
|
||||
@@ -152,12 +151,10 @@ int OrderedAIAction::getEfficiency()
|
||||
//small bonus added for the poor 1/1s, if we can save them, we will unless something else took precidence.
|
||||
//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.
|
||||
int calculateAfterDamage = 0;
|
||||
int damages = 0;
|
||||
if((target->defenser || target->blockers.size()) && target->controller() == p)
|
||||
{
|
||||
damages = nextOpponent->power;
|
||||
calculateAfterDamage = int(target->toughness - damages);
|
||||
int damages = nextOpponent->power;
|
||||
int calculateAfterDamage = target->toughness - damages;
|
||||
if((calculateAfterDamage + target->preventable) > 0)
|
||||
{
|
||||
efficiency = 0;
|
||||
@@ -588,8 +585,7 @@ int OrderedAIAction::getEfficiency()
|
||||
efficiency = 80;
|
||||
if(atc->name.length() && atc->sabilities.length() && atc->types.size() && p->game->inPlay->findByName(atc->name))
|
||||
{
|
||||
list<int>::iterator it;
|
||||
for (it = atc->types.begin(); it != atc->types.end(); it++)
|
||||
for (list<int>::const_iterator it = atc->types.begin(); it != atc->types.end(); ++it)
|
||||
{
|
||||
if(*it == Subtypes::TYPE_LEGENDARY)//ai please stop killing voja!!! :P
|
||||
efficiency = 0;
|
||||
@@ -978,11 +974,10 @@ vector<MTGAbility*> AIPlayerBaka::canPayMana(MTGCardInstance * target,ManaCost *
|
||||
}
|
||||
}
|
||||
ManaCostHybrid * hybridCost;
|
||||
int hyb;
|
||||
hyb = 0;
|
||||
hybridCost = cost->getHybridCost(0);
|
||||
if(hybridCost)
|
||||
{
|
||||
int hyb = 0;
|
||||
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
|
||||
@@ -1046,7 +1041,6 @@ vector<MTGAbility*> AIPlayerBaka::canPayMana(MTGCardInstance * target,ManaCost *
|
||||
{
|
||||
|
||||
ManaCost * withKickerCost= NEW ManaCost(cost->getKicker());
|
||||
int canKick = 0;
|
||||
vector<MTGAbility*>kickerPayment;
|
||||
bool keepLooking = true;
|
||||
while(keepLooking)
|
||||
@@ -1061,7 +1055,6 @@ vector<MTGAbility*> AIPlayerBaka::canPayMana(MTGCardInstance * target,ManaCost *
|
||||
payments.push_back(kickerPayment[w]);
|
||||
}
|
||||
}
|
||||
canKick += 1;
|
||||
keepLooking = cost->getKicker()->isMulti;
|
||||
}
|
||||
else
|
||||
@@ -1297,12 +1290,10 @@ int AIPlayerBaka::createAbilityTargets(MTGAbility * a, MTGCardInstance * c, Rank
|
||||
|
||||
TargetChooser * AIPlayerBaka::GetComboTc( GameObserver * observer,TargetChooser * tc)
|
||||
{
|
||||
TargetChooser * gathertc = NULL;
|
||||
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();
|
||||
if(gathertc->canTarget(tc->source))
|
||||
{
|
||||
@@ -1402,7 +1393,6 @@ int AIPlayerBaka::selectAbility()
|
||||
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.
|
||||
{
|
||||
abilityPayment = vector<MTGAbility*>();
|
||||
abilityPayment = canPayMana(card,a->getCost());
|
||||
}
|
||||
if (a->isReactingToClick(card, totalPotentialMana) || abilityPayment.size())
|
||||
@@ -1410,10 +1400,9 @@ int AIPlayerBaka::selectAbility()
|
||||
if(a->getCost() && a->getCost()->hasX() && totalPotentialMana->getConvertedCost() < a->getCost()->getConvertedCost()+1)
|
||||
continue;
|
||||
//don't even bother to play an ability with {x} if you can't even afford x=1.
|
||||
ManaCost * fullPayment = NULL;
|
||||
if (abilityPayment.size())
|
||||
{
|
||||
fullPayment = NEW ManaCost();
|
||||
ManaCost *fullPayment = NEW ManaCost();
|
||||
for(int ch = 0; ch < int(abilityPayment.size());ch++)
|
||||
{
|
||||
AManaProducer * ampp = dynamic_cast<AManaProducer*> (abilityPayment[ch]);
|
||||
@@ -1525,7 +1514,7 @@ int AIPlayerBaka::chooseTarget(TargetChooser * _tc, Player * forceTarget,MTGCard
|
||||
}
|
||||
//Make sure we own the decision to choose the targets
|
||||
assert(tc->Owner == observer->currentlyActing());
|
||||
if (tc && tc->Owner != observer->currentlyActing())
|
||||
if (tc->Owner != observer->currentlyActing())
|
||||
{
|
||||
observer->currentActionPlayer = tc->Owner;
|
||||
//this is a hack, but if we hit this condition we are locked in a infinate loop
|
||||
@@ -1905,12 +1894,11 @@ MTGCardInstance * AIPlayerBaka::activateCombo()
|
||||
{
|
||||
if(!comboHint)
|
||||
return NULL;
|
||||
TargetChooser * hintTc = NULL;
|
||||
TargetChooserFactory tfc(observer);
|
||||
ManaCost * totalCost = ManaCost::parseManaCost(comboHint->manaNeeded);
|
||||
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();
|
||||
for(int j = 0; j < combohand;j++)
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ AIStats::AIStats(Player * _player, char * _filename)
|
||||
AIStats::~AIStats()
|
||||
{
|
||||
list<AIStat *>::iterator it;
|
||||
for (it = stats.begin(); it != stats.end(); it++)
|
||||
for (it = stats.begin(); it != stats.end(); ++it)
|
||||
{
|
||||
AIStat * stat = *it;
|
||||
delete stat;
|
||||
@@ -47,7 +47,7 @@ void AIStats::updateStatsCard(MTGCardInstance * cardInstance, Damage * damage, f
|
||||
{
|
||||
stat->value += static_cast<int>(multiplier * STATS_PLAYER_MULTIPLIER * damage->damage);
|
||||
}
|
||||
else if (damage->target->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE)
|
||||
else if (damage->target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE)
|
||||
{
|
||||
MTGCardInstance * target = (MTGCardInstance *) damage->target;
|
||||
if (target->controller() == player && !target->isInPlay(player->getObserver()))
|
||||
@@ -115,7 +115,7 @@ bool AIStats::isInTop(MTGCardInstance * card, unsigned int max, bool tooSmallCou
|
||||
MTGCard * source = card->model;
|
||||
int id = source->getMTGId();
|
||||
list<AIStat *>::iterator it;
|
||||
for (it = stats.begin(); it != stats.end(); it++)
|
||||
for (it = stats.begin(); it != stats.end(); ++it)
|
||||
{
|
||||
if (n >= max)
|
||||
return false;
|
||||
@@ -135,7 +135,7 @@ AIStat * AIStats::find(MTGCard * source)
|
||||
{
|
||||
int id = source->getMTGId();
|
||||
list<AIStat *>::iterator it;
|
||||
for (it = stats.begin(); it != stats.end(); it++)
|
||||
for (it = stats.begin(); it != stats.end(); ++it)
|
||||
{
|
||||
AIStat * stat = *it;
|
||||
if (stat->source == id)
|
||||
@@ -174,7 +174,7 @@ void AIStats::save()
|
||||
{
|
||||
char writer[128];
|
||||
list<AIStat *>::iterator it;
|
||||
for (it = stats.begin(); it != stats.end(); it++)
|
||||
for (it = stats.begin(); it != stats.end(); ++it)
|
||||
{
|
||||
AIStat * stat = *it;
|
||||
if (stat->value > 0)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
ActionElement::ActionElement(int id) :
|
||||
JGuiObject(id)
|
||||
{
|
||||
activeState = INACTIVE;
|
||||
activity = Inactive;
|
||||
modal = 0;
|
||||
waitingForAnswer = 0;
|
||||
currentPhase = MTG_PHASE_INVALID;
|
||||
@@ -18,7 +18,7 @@ ActionElement::ActionElement(int id) :
|
||||
|
||||
ActionElement::ActionElement(const ActionElement& a): JGuiObject(a)
|
||||
{
|
||||
activeState = a.activeState;
|
||||
activity = a.activity;
|
||||
tc = a.tc ? a.tc->clone() : NULL;
|
||||
currentPhase = a.currentPhase;
|
||||
newPhase = a.newPhase;
|
||||
@@ -31,12 +31,6 @@ ActionElement::~ActionElement()
|
||||
SAFE_DELETE(tc);
|
||||
}
|
||||
|
||||
int ActionElement::getActivity()
|
||||
{
|
||||
|
||||
return activeState;
|
||||
}
|
||||
|
||||
int ActionElement::isReactingToTargetClick(Targetable * object)
|
||||
{
|
||||
if (MTGCardInstance * cObject = dynamic_cast<MTGCardInstance *>(object))
|
||||
|
||||
@@ -165,8 +165,6 @@ void ActionLayer::Update(float dt)
|
||||
if (cantCancel)
|
||||
{
|
||||
ActionElement * ae = isWaitingForAnswer();
|
||||
int countTargets = 0;
|
||||
int maxTargets = 0;
|
||||
if(ae && ae->getActionTc())
|
||||
{
|
||||
if (!ae->getActionTc()->validTargetsExist())
|
||||
@@ -175,8 +173,8 @@ void ActionLayer::Update(float dt)
|
||||
cancelCurrentAction();
|
||||
return;
|
||||
}
|
||||
countTargets = ae->getActionTc()->countValidTargets();
|
||||
maxTargets = ae->getActionTc()->maxtargets;
|
||||
int countTargets = ae->getActionTc()->countValidTargets();
|
||||
int maxTargets = ae->getActionTc()->maxtargets;
|
||||
if (countTargets < maxTargets)
|
||||
{
|
||||
/*
|
||||
@@ -266,7 +264,7 @@ int ActionLayer::receiveEventPlus(WEvent * event)
|
||||
ActionElement * currentAction = (ActionElement *) mObjects[i];
|
||||
result += currentAction->receiveEvent(event);
|
||||
}
|
||||
return 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
int ActionLayer::isReactingToTargetClick(Targetable * card)
|
||||
@@ -440,10 +438,9 @@ void ActionLayer::setCustomMenuObject(Targetable * object, bool must,vector<MTGA
|
||||
if(abilities.size())
|
||||
{
|
||||
abilitiesMenu->isMultipleChoice = true;
|
||||
ActionElement * currentAction = NULL;
|
||||
for(int w = 0; w < int(abilities.size());w++)
|
||||
{
|
||||
currentAction = (ActionElement*)abilities[w];
|
||||
ActionElement* currentAction = (ActionElement*)abilities[w];
|
||||
currentActionCard = (MTGCardInstance*)abilities[0]->target;
|
||||
abilitiesMenu->Add(mObjects.size()-1, currentAction->getMenuText(),"",false);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ void NextGamePhase::Render()
|
||||
if (observer->currentActionPlayer == observer->players[1])
|
||||
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->SetScale(DEFAULT_MAIN_FONT_SCALE);
|
||||
@@ -161,7 +161,7 @@ void StackAbility::Render()
|
||||
if (target)
|
||||
{
|
||||
quad = target->getIcon();
|
||||
if (target->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE)
|
||||
if (target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE)
|
||||
{
|
||||
alt2 = ((MTGCardInstance *) target)->name;
|
||||
}
|
||||
@@ -400,7 +400,7 @@ void Spell::Render()
|
||||
if (target)
|
||||
{
|
||||
quad = target->getIcon();
|
||||
if (target->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE)
|
||||
if (target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE)
|
||||
{
|
||||
alt2 = ((MTGCardInstance *) target)->name;
|
||||
}
|
||||
@@ -675,6 +675,7 @@ ActionStack::ActionStack(GameObserver* game)
|
||||
currentState = -1;
|
||||
mode = ACTIONSTACK_STANDARD;
|
||||
checked = 0;
|
||||
lastActionController = NULL;
|
||||
|
||||
if(!observer->getResourceManager()) return;
|
||||
for (int i = 0; i < 8; ++i)
|
||||
|
||||
+257
-143
@@ -55,6 +55,12 @@ GenericActivatedAbility::GenericActivatedAbility(GameObserver* observer, string
|
||||
target = ability->target;
|
||||
}
|
||||
|
||||
GenericActivatedAbility::GenericActivatedAbility(const GenericActivatedAbility &other):
|
||||
ActivatedAbility(other), NestedAbility(other), activeZone(other.activeZone), newName(other.newName)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int GenericActivatedAbility::resolve()
|
||||
{
|
||||
//Note: I've seen a similar block in some other MTGAbility, can this be refactored .
|
||||
@@ -71,7 +77,7 @@ int GenericActivatedAbility::resolve()
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char * GenericActivatedAbility::getMenuText()
|
||||
const string GenericActivatedAbility::getMenuText()
|
||||
{
|
||||
if(newName.size())
|
||||
return newName.c_str();
|
||||
@@ -105,6 +111,7 @@ int GenericActivatedAbility::testDestroy()
|
||||
GenericActivatedAbility * GenericActivatedAbility::clone() const
|
||||
{
|
||||
GenericActivatedAbility * a = NEW GenericActivatedAbility(*this);
|
||||
|
||||
a->ability = ability->clone();
|
||||
return a;
|
||||
}
|
||||
@@ -133,7 +140,7 @@ int AAAlterPoison::resolve()
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char * AAAlterPoison::getMenuText()
|
||||
const string AAAlterPoison::getMenuText()
|
||||
{
|
||||
return "Poison";
|
||||
}
|
||||
@@ -165,7 +172,7 @@ int AADamagePrevent::resolve()
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char * AADamagePrevent::getMenuText()
|
||||
const string AADamagePrevent::getMenuText()
|
||||
{
|
||||
return "Prevent Damage";
|
||||
}
|
||||
@@ -237,7 +244,7 @@ AADamager::AADamager(GameObserver* observer, int _id, MTGCardInstance * _source,
|
||||
return damage.getValue();
|
||||
}
|
||||
|
||||
const char * AADamager::getMenuText()
|
||||
const string AADamager::getMenuText()
|
||||
{
|
||||
MTGCardInstance * _target = dynamic_cast<MTGCardInstance*>(target);
|
||||
if(_target && _target->hasType(Subtypes::TYPE_PLANESWALKER))
|
||||
@@ -276,7 +283,7 @@ AADepleter::AADepleter(GameObserver* observer, int _id, MTGCardInstance * card,
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * AADepleter::getMenuText()
|
||||
const string AADepleter::getMenuText()
|
||||
{
|
||||
return "Deplete";
|
||||
}
|
||||
@@ -311,7 +318,7 @@ AAModTurn::AAModTurn(GameObserver* observer, int _id, MTGCardInstance * card, Ta
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * AAModTurn::getMenuText()
|
||||
const string AAModTurn::getMenuText()
|
||||
{
|
||||
WParsedInt numTurns(nbTurnStr, NULL, source);
|
||||
if(numTurns.getValue() > 0)
|
||||
@@ -354,7 +361,7 @@ int AALibraryBottom::resolve()
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char * AALibraryBottom::getMenuText()
|
||||
const string AALibraryBottom::getMenuText()
|
||||
{
|
||||
return "Bottom Of Library";
|
||||
}
|
||||
@@ -382,7 +389,7 @@ int AACopier::resolve()
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char * AACopier::getMenuText()
|
||||
const string AACopier::getMenuText()
|
||||
{
|
||||
return "Copy";
|
||||
}
|
||||
@@ -415,7 +422,7 @@ int AAPhaseOut::resolve()
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char * AAPhaseOut::getMenuText()
|
||||
const string AAPhaseOut::getMenuText()
|
||||
{
|
||||
return "Phase Out";
|
||||
}
|
||||
@@ -506,7 +513,7 @@ AACounter::AACounter(GameObserver* observer, int id, MTGCardInstance * source, M
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char* AACounter::getMenuText()
|
||||
const string AACounter::getMenuText()
|
||||
{
|
||||
if (menu.size())
|
||||
{
|
||||
@@ -695,7 +702,7 @@ int AARemoveAllCounter::resolve()
|
||||
return nb;
|
||||
}
|
||||
|
||||
const char* AARemoveAllCounter::getMenuText()
|
||||
const string AARemoveAllCounter::getMenuText()
|
||||
{
|
||||
if (menu.size())
|
||||
{
|
||||
@@ -773,7 +780,7 @@ int AAProliferate::resolve()
|
||||
|
||||
}
|
||||
|
||||
const char* AAProliferate::getMenuText()
|
||||
const string AAProliferate::getMenuText()
|
||||
{
|
||||
return "Proliferate";
|
||||
}
|
||||
@@ -816,13 +823,13 @@ int GenericChooseTypeColor::resolve()
|
||||
for (size_t i = 0; i < values.size(); ++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);
|
||||
MTGAbility * set = setType->clone();
|
||||
set->oneShot = true;
|
||||
selection.push_back(set);
|
||||
SAFE_DELETE(setType);
|
||||
setType = NEW AASetTypeChosen(game, game->mLayers->actionLayer()->getMaxId(), source,(MTGCardInstance*)target, i,menu,baseAbility);
|
||||
MTGAbility * set = setType->clone();
|
||||
set->oneShot = true;
|
||||
selection.push_back(set);
|
||||
SAFE_DELETE(setType);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -837,7 +844,7 @@ int GenericChooseTypeColor::resolve()
|
||||
|
||||
}
|
||||
|
||||
const char* GenericChooseTypeColor::getMenuText()
|
||||
const string GenericChooseTypeColor::getMenuText()
|
||||
{
|
||||
if(chooseColor)
|
||||
return "Choose a color";
|
||||
@@ -899,7 +906,7 @@ int AASetColorChosen::resolve()
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char* AASetColorChosen::getMenuText()
|
||||
const string AASetColorChosen::getMenuText()
|
||||
{
|
||||
return Constants::MTGColorStrings[color];
|
||||
}
|
||||
@@ -956,7 +963,7 @@ int AASetTypeChosen::resolve()
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char* AASetTypeChosen::getMenuText()
|
||||
const string AASetTypeChosen::getMenuText()
|
||||
{
|
||||
return menutext.c_str();
|
||||
}
|
||||
@@ -973,7 +980,7 @@ AASetTypeChosen::~AASetTypeChosen()
|
||||
//
|
||||
//choosing a type or color
|
||||
GenericFlipACoin::GenericFlipACoin(GameObserver* observer, int id, MTGCardInstance * source, Targetable *,string _toAdd, ManaCost * cost) :
|
||||
ActivatedAbility(observer, id, source, cost, 0), baseAbility(_toAdd),chooseColor(chooseColor)
|
||||
ActivatedAbility(observer, id, source, cost, 0), baseAbility(_toAdd)
|
||||
{
|
||||
this->GetId();
|
||||
setCoin = NULL;
|
||||
@@ -1003,7 +1010,7 @@ int GenericFlipACoin::resolve()
|
||||
|
||||
}
|
||||
|
||||
const char* GenericFlipACoin::getMenuText()
|
||||
const string GenericFlipACoin::getMenuText()
|
||||
{
|
||||
return "Flip A Coin";
|
||||
}
|
||||
@@ -1095,7 +1102,7 @@ int AASetCoin::resolve()
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char* AASetCoin::getMenuText()
|
||||
const string AASetCoin::getMenuText()
|
||||
{
|
||||
if(side == 1)
|
||||
return "Tails";
|
||||
@@ -1144,9 +1151,6 @@ int GenericPaidAbility::resolve()
|
||||
baseAbility = Af.parseMagicLine(baseAbilityStrSplit[0], this->GetId(), NULL, source);
|
||||
baseAbility->target = target;
|
||||
optionalCost = ManaCost::parseManaCost(baseCost, NULL, source);
|
||||
if (optionalCost->hasX()) {
|
||||
optionalCost->add(Constants::MTG_COLOR_ARTIFACT, source->storedSourceCard->X);
|
||||
}
|
||||
|
||||
// hacky way to produce better MenuText
|
||||
AAFakeAbility* isFake = dynamic_cast< AAFakeAbility* >( baseAbility );
|
||||
@@ -1189,7 +1193,7 @@ int GenericPaidAbility::resolve()
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char* GenericPaidAbility::getMenuText()
|
||||
const string GenericPaidAbility::getMenuText()
|
||||
{
|
||||
if (newName.size())
|
||||
return newName.c_str();
|
||||
@@ -1291,7 +1295,7 @@ int AAResetDamage::resolve()
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char* AAResetDamage::getMenuText()
|
||||
const string AAResetDamage::getMenuText()
|
||||
{
|
||||
return "Reset Damages";
|
||||
}
|
||||
@@ -1312,7 +1316,7 @@ int AAFakeAbility::resolve()
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char* AAFakeAbility::getMenuText()
|
||||
const string AAFakeAbility::getMenuText()
|
||||
{
|
||||
if(named.size())
|
||||
return named.c_str();
|
||||
@@ -1359,7 +1363,7 @@ int AAFizzler::resolve()
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * AAFizzler::getMenuText()
|
||||
const string AAFizzler::getMenuText()
|
||||
{
|
||||
return "Fizzle";
|
||||
}
|
||||
@@ -1406,7 +1410,7 @@ int AABuryCard::resolve()
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char * AABuryCard::getMenuText()
|
||||
const string AABuryCard::getMenuText()
|
||||
{
|
||||
if(menu.size())
|
||||
return menu.c_str();
|
||||
@@ -1462,7 +1466,7 @@ int AADestroyCard::resolve()
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char * AADestroyCard::getMenuText()
|
||||
const string AADestroyCard::getMenuText()
|
||||
{
|
||||
return "Destroy";
|
||||
}
|
||||
@@ -1518,7 +1522,7 @@ int AASacrificeCard::resolve()
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char * AASacrificeCard::getMenuText()
|
||||
const string AASacrificeCard::getMenuText()
|
||||
{
|
||||
return "Sacrifice";
|
||||
}
|
||||
@@ -1573,7 +1577,7 @@ int AADiscardCard::resolve()
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char * AADiscardCard::getMenuText()
|
||||
const string AADiscardCard::getMenuText()
|
||||
{
|
||||
return "Discard";
|
||||
}
|
||||
@@ -1637,7 +1641,7 @@ AADrawer::AADrawer(GameObserver* observer, int _id, MTGCardInstance * card, Targ
|
||||
return numCards.getValue();
|
||||
}
|
||||
|
||||
const char * AADrawer::getMenuText()
|
||||
const string AADrawer::getMenuText()
|
||||
{
|
||||
return "Draw";
|
||||
}
|
||||
@@ -1666,7 +1670,7 @@ int AAFrozen::resolve()
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * AAFrozen::getMenuText()
|
||||
const string AAFrozen::getMenuText()
|
||||
{
|
||||
return "Freeze";
|
||||
}
|
||||
@@ -1731,7 +1735,7 @@ int AANewTarget::resolve()
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * AANewTarget::getMenuText()
|
||||
const string AANewTarget::getMenuText()
|
||||
{
|
||||
return "New Target";
|
||||
}
|
||||
@@ -1812,7 +1816,7 @@ int AAMorph::testDestroy()
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char * AAMorph::getMenuText()
|
||||
const string AAMorph::getMenuText()
|
||||
{
|
||||
return "Morph";
|
||||
}
|
||||
@@ -1949,7 +1953,7 @@ int AAFlip::testDestroy()
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char * AAFlip::getMenuText()
|
||||
const string AAFlip::getMenuText()
|
||||
{
|
||||
string s = flipStats;
|
||||
sprintf(menuText, "Transform:%s", s.c_str());
|
||||
@@ -2255,7 +2259,7 @@ int AADynamic::activateStored()
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * AADynamic::getMenuText()
|
||||
const string AADynamic::getMenuText()
|
||||
{
|
||||
if (menu.size())
|
||||
{
|
||||
@@ -2354,7 +2358,7 @@ int AALifer::resolve()
|
||||
return 0;
|
||||
|
||||
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();
|
||||
}
|
||||
@@ -2370,7 +2374,7 @@ int AALifer::getLife()
|
||||
return life.getValue();
|
||||
}
|
||||
|
||||
const char * AALifer::getMenuText()
|
||||
const string AALifer::getMenuText()
|
||||
{
|
||||
if(getLife() < 0)
|
||||
return "Life Loss";
|
||||
@@ -2403,7 +2407,7 @@ int AASetHand::resolve()
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * AASetHand::getMenuText()
|
||||
const string AASetHand::getMenuText()
|
||||
{
|
||||
return "Set Hand Size";
|
||||
}
|
||||
@@ -2434,7 +2438,7 @@ int AALifeSet::resolve()
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * AALifeSet::getMenuText()
|
||||
const string AALifeSet::getMenuText()
|
||||
{
|
||||
return "Set Life";
|
||||
}
|
||||
@@ -2516,7 +2520,7 @@ int AACloner::resolve()
|
||||
|
||||
}
|
||||
|
||||
const char * AACloner::getMenuText()
|
||||
const string AACloner::getMenuText()
|
||||
{
|
||||
if (who == 1)
|
||||
return "Clone For Opponent";
|
||||
@@ -2591,7 +2595,7 @@ int ACastRestriction::destroy()
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * ACastRestriction::getMenuText()
|
||||
const string ACastRestriction::getMenuText()
|
||||
{
|
||||
if (modifyExisting)
|
||||
return "Additional Lands"; //hardoced because only the lands rule allows to modify existing rule for now
|
||||
@@ -2626,7 +2630,7 @@ int AInstantCastRestrictionUEOT::resolve()
|
||||
wrapper->addToGame();
|
||||
return 1;
|
||||
}
|
||||
const char * AInstantCastRestrictionUEOT::getMenuText()
|
||||
const string AInstantCastRestrictionUEOT::getMenuText()
|
||||
{
|
||||
return ability->getMenuText();
|
||||
}
|
||||
@@ -2720,14 +2724,14 @@ int AAMover::resolve()
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char * AAMover::getMenuText()
|
||||
const string AAMover::getMenuText()
|
||||
{
|
||||
if(named.size())
|
||||
return named.c_str();
|
||||
return "Move";
|
||||
}
|
||||
|
||||
const char * AAMover::getMenuText(TargetChooser * tc)
|
||||
const char* AAMover::getMenuText(TargetChooser * tc)
|
||||
{
|
||||
if(named.size())
|
||||
return named.c_str();
|
||||
@@ -2867,7 +2871,7 @@ int AARandomMover::resolve()
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char * AARandomMover::getMenuText()
|
||||
const string AARandomMover::getMenuText()
|
||||
{
|
||||
return "Dig";
|
||||
}
|
||||
@@ -2905,7 +2909,7 @@ int AARandomDiscarder::resolve()
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * AARandomDiscarder::getMenuText()
|
||||
const string AARandomDiscarder::getMenuText()
|
||||
{
|
||||
return "Discard Random";
|
||||
}
|
||||
@@ -2932,7 +2936,7 @@ int AAShuffle::resolve()
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * AAShuffle::getMenuText()
|
||||
const string AAShuffle::getMenuText()
|
||||
{
|
||||
return "Shuffle";
|
||||
}
|
||||
@@ -3030,7 +3034,7 @@ int AARemoveMana::resolve()
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * AARemoveMana::getMenuText()
|
||||
const string AARemoveMana::getMenuText()
|
||||
{
|
||||
if (mRemoveAll && !mManaDesc)
|
||||
return "Empty Manapool";
|
||||
@@ -3069,7 +3073,7 @@ int AATapper::resolve()
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * AATapper::getMenuText()
|
||||
const string AATapper::getMenuText()
|
||||
{
|
||||
return "Tap";
|
||||
}
|
||||
@@ -3099,7 +3103,7 @@ int AAUntapper::resolve()
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * AAUntapper::getMenuText()
|
||||
const string AAUntapper::getMenuText()
|
||||
{
|
||||
return "Untap";
|
||||
}
|
||||
@@ -3180,7 +3184,7 @@ int AAWinGame::resolve()
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * AAWinGame::getMenuText()
|
||||
const string AAWinGame::getMenuText()
|
||||
{
|
||||
return "Win Game";
|
||||
}
|
||||
@@ -3271,7 +3275,7 @@ int IfThenAbility::resolve()
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char * IfThenAbility::getMenuText()
|
||||
const string IfThenAbility::getMenuText()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
@@ -3323,7 +3327,7 @@ void MayAbility::Update(float dt)
|
||||
}
|
||||
}
|
||||
|
||||
const char * MayAbility::getMenuText()
|
||||
const string MayAbility::getMenuText()
|
||||
{
|
||||
return ability->getMenuText();
|
||||
}
|
||||
@@ -3459,7 +3463,7 @@ int MenuAbility::resolve()
|
||||
return a->addToGame();
|
||||
}
|
||||
|
||||
const char * MenuAbility::getMenuText()
|
||||
const string MenuAbility::getMenuText()
|
||||
{
|
||||
if((abilities.size() > 1 && must)||(abilities.size() > 2 && !must))
|
||||
return "choose one";
|
||||
@@ -3530,10 +3534,10 @@ int MenuAbility::reactToChoiceClick(Targetable * object,int choice,int control)
|
||||
if (mClone && !toPay && optionalCosts.size() && i < int(optionalCosts.size()) && optionalCosts[i])//paidability only supports the first ability as paid for now.
|
||||
{
|
||||
toPay = NEW ManaCost();
|
||||
if(optionalCosts[i]->extraCosts)
|
||||
toPay->extraCosts = optionalCosts[i]->extraCosts->clone();
|
||||
if (optionalCosts[i]->extraCosts)
|
||||
toPay->extraCosts = optionalCosts[i]->extraCosts->clone();
|
||||
toPay->addExtraCost(NEW ExtraManaCost(NEW ManaCost(optionalCosts[i])));
|
||||
toPay->setExtraCostsAction(this,source);
|
||||
toPay->setExtraCostsAction(this, source);
|
||||
game->mExtraPayment = toPay->extraCosts;
|
||||
return 0;
|
||||
}
|
||||
@@ -3660,7 +3664,7 @@ int MultiAbility::destroy()
|
||||
return ActivatedAbility::destroy();
|
||||
}
|
||||
|
||||
const char * MultiAbility::getMenuText()
|
||||
const string MultiAbility::getMenuText()
|
||||
{
|
||||
if (abilities.size() && abilities[0])
|
||||
return abilities[0]->getMenuText();
|
||||
@@ -3699,7 +3703,7 @@ GenericTargetAbility::GenericTargetAbility(GameObserver* observer, string newNam
|
||||
counters = 0;
|
||||
}
|
||||
|
||||
const char * GenericTargetAbility::getMenuText()
|
||||
const string GenericTargetAbility::getMenuText()
|
||||
{
|
||||
if (!ability)
|
||||
return "Error";
|
||||
@@ -4252,7 +4256,7 @@ int ATransformer::destroy()
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * ATransformer::getMenuText()
|
||||
const string ATransformer::getMenuText()
|
||||
{
|
||||
if(menutext.size())
|
||||
return menutext.c_str();
|
||||
@@ -4285,7 +4289,7 @@ int ATransformerInstant::resolve()
|
||||
wrapper->addToGame();
|
||||
return 1;
|
||||
}
|
||||
const char * ATransformerInstant::getMenuText()
|
||||
const string ATransformerInstant::getMenuText()
|
||||
{
|
||||
if(menu.size())
|
||||
return menu.c_str();
|
||||
@@ -4319,7 +4323,7 @@ int PTInstant::resolve()
|
||||
wrapper->addToGame();
|
||||
return 1;
|
||||
}
|
||||
const char * PTInstant::getMenuText()
|
||||
const string PTInstant::getMenuText()
|
||||
{
|
||||
return ability->getMenuText();
|
||||
}
|
||||
@@ -4350,7 +4354,7 @@ int ASwapPTUEOT::resolve()
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * ASwapPTUEOT::getMenuText()
|
||||
const string ASwapPTUEOT::getMenuText()
|
||||
{
|
||||
return ability->getMenuText();
|
||||
}
|
||||
@@ -4383,7 +4387,7 @@ int AAExchangeLife::resolve()
|
||||
int oldlife = player->getLife();
|
||||
int targetOldLife = _target->getLife();
|
||||
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;
|
||||
MTGCardInstance * card = ((MTGCardInstance*)_target);
|
||||
@@ -4420,7 +4424,7 @@ int AAExchangeLife::resolve()
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char * AAExchangeLife::getMenuText()
|
||||
const string AAExchangeLife::getMenuText()
|
||||
{
|
||||
return "Exchange life";
|
||||
}
|
||||
@@ -4600,15 +4604,15 @@ int APreventDamageTypes::addToGame()
|
||||
fromTc->targetter = NULL;
|
||||
if (type != 1 && type != 2)
|
||||
{//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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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);
|
||||
return MTGAbility::addToGame();
|
||||
@@ -4658,7 +4662,7 @@ int APreventDamageTypesUEOT::destroy()
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * APreventDamageTypesUEOT::getMenuText()
|
||||
const string APreventDamageTypesUEOT::getMenuText()
|
||||
{
|
||||
return ability->getMenuText();
|
||||
}
|
||||
@@ -4728,7 +4732,7 @@ int AVanishing::resolve()
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * AVanishing::getMenuText()
|
||||
const string AVanishing::getMenuText()
|
||||
{
|
||||
if(counterName.find("fade") != string::npos)
|
||||
return "Fading";
|
||||
@@ -4824,7 +4828,7 @@ int AUpkeep::resolve()
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * AUpkeep::getMenuText()
|
||||
const string AUpkeep::getMenuText()
|
||||
{
|
||||
return "Upkeep";
|
||||
}
|
||||
@@ -4924,7 +4928,7 @@ int APhaseAction::resolve()
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char * APhaseAction::getMenuText()
|
||||
const string APhaseAction::getMenuText()
|
||||
{
|
||||
if(psMenuText.size())
|
||||
return psMenuText.c_str();
|
||||
@@ -4961,7 +4965,7 @@ int APhaseActionGeneric::resolve()
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * APhaseActionGeneric::getMenuText()
|
||||
const string APhaseActionGeneric::getMenuText()
|
||||
{
|
||||
return ability->getMenuText();
|
||||
}
|
||||
@@ -5119,7 +5123,7 @@ int ABlink::resolve()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
const char * ABlink::getMenuText()
|
||||
const string ABlink::getMenuText()
|
||||
{
|
||||
return "Blink";
|
||||
}
|
||||
@@ -5150,7 +5154,7 @@ int ABlinkGeneric::resolve()
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * ABlinkGeneric::getMenuText()
|
||||
const string ABlinkGeneric::getMenuText()
|
||||
{
|
||||
return "Blink";
|
||||
}
|
||||
@@ -5294,6 +5298,116 @@ AAConnect * AAConnect::clone() const
|
||||
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(¤tAbilities, 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.
|
||||
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)
|
||||
@@ -5305,83 +5419,83 @@ AACastCard::AACastCard(GameObserver* observer, int _id, MTGCardInstance * _sourc
|
||||
}
|
||||
|
||||
|
||||
void AACastCard::Update(float dt)
|
||||
void AACastCard::Update(float dt)
|
||||
{
|
||||
MTGAbility::Update(dt);
|
||||
if (processed)
|
||||
return;
|
||||
if(cardNamed.size() && !theNamedCard)
|
||||
{
|
||||
theNamedCard = makeCard();
|
||||
}
|
||||
if (restricted)
|
||||
{
|
||||
MTGAbility::Update(dt);
|
||||
if (processed)
|
||||
return;
|
||||
if(cardNamed.size() && !theNamedCard)
|
||||
{
|
||||
theNamedCard = makeCard();
|
||||
}
|
||||
if (restricted)
|
||||
{
|
||||
MTGCardInstance * toCheck = (MTGCardInstance*)target;
|
||||
if(theNamedCard)
|
||||
toCheck = theNamedCard;
|
||||
if (game->currentActionPlayer->game->playRestrictions->canPutIntoZone(toCheck, source->controller()->game->stack) == PlayRestriction::CANT_PLAY)
|
||||
{
|
||||
processed = true;
|
||||
this->forceDestroy = 1;
|
||||
return ;
|
||||
}
|
||||
if(!allowedToCast(toCheck,source->controller()))
|
||||
{
|
||||
processed = true;
|
||||
this->forceDestroy = 1;
|
||||
return;
|
||||
}
|
||||
if(!toCheck->hasType(Subtypes::TYPE_INSTANT) && !(game->getCurrentGamePhase() == MTG_PHASE_FIRSTMAIN || game->getCurrentGamePhase() == MTG_PHASE_SECONDMAIN))
|
||||
{
|
||||
processed = true;
|
||||
this->forceDestroy = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
MTGCardInstance * toCheck = (MTGCardInstance*)target;
|
||||
if(theNamedCard)
|
||||
toCheck = theNamedCard;
|
||||
if (Spell * checkSpell = dynamic_cast<Spell*>(target))
|
||||
if (game->currentActionPlayer->game->playRestrictions->canPutIntoZone(toCheck, source->controller()->game->stack) == PlayRestriction::CANT_PLAY)
|
||||
{
|
||||
toCheck = checkSpell->source;
|
||||
processed = true;
|
||||
this->forceDestroy = 1;
|
||||
return ;
|
||||
}
|
||||
if (!game->targetListIsSet(toCheck))
|
||||
if(!allowedToCast(toCheck,source->controller()))
|
||||
{
|
||||
if(game->targetChooser)
|
||||
game->targetChooser->Owner = source->controller();//sources controller is the caster
|
||||
processed = true;
|
||||
this->forceDestroy = 1;
|
||||
return;
|
||||
}
|
||||
resolveSpell();
|
||||
this->forceDestroy = 1;
|
||||
if(!toCheck->hasType(Subtypes::TYPE_INSTANT) && !(game->getCurrentGamePhase() == MTG_PHASE_FIRSTMAIN || game->getCurrentGamePhase() == MTG_PHASE_SECONDMAIN))
|
||||
{
|
||||
processed = true;
|
||||
this->forceDestroy = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
MTGCardInstance * toCheck = (MTGCardInstance*)target;
|
||||
if(theNamedCard)
|
||||
toCheck = theNamedCard;
|
||||
if (Spell * checkSpell = dynamic_cast<Spell*>(target))
|
||||
{
|
||||
toCheck = checkSpell->source;
|
||||
}
|
||||
if (!game->targetListIsSet(toCheck))
|
||||
{
|
||||
if(game->targetChooser)
|
||||
game->targetChooser->Owner = source->controller();//sources controller is the caster
|
||||
return;
|
||||
}
|
||||
int AACastCard::isReactingToTargetClick(Targetable * card){return 0;}
|
||||
int AACastCard::reactToTargetClick(Targetable * object)
|
||||
{
|
||||
if (MTGCardInstance * cObject = dynamic_cast<MTGCardInstance *>(object))
|
||||
return reactToClick(cObject);
|
||||
resolveSpell();
|
||||
this->forceDestroy = 1;
|
||||
return;
|
||||
}
|
||||
int AACastCard::isReactingToTargetClick(Targetable * card){return 0;}
|
||||
int AACastCard::reactToTargetClick(Targetable * object)
|
||||
{
|
||||
if (MTGCardInstance * cObject = dynamic_cast<MTGCardInstance *>(object))
|
||||
return reactToClick(cObject);
|
||||
|
||||
if (waitingForAnswer)
|
||||
if (waitingForAnswer)
|
||||
{
|
||||
if (tc->toggleTarget(object) == TARGET_OK_FULL)
|
||||
{
|
||||
if (tc->toggleTarget(object) == TARGET_OK_FULL)
|
||||
{
|
||||
waitingForAnswer = 0;
|
||||
game->mLayers->actionLayer()->setCurrentWaitingAction(NULL);
|
||||
return MTGAbility::reactToClick(source);
|
||||
}
|
||||
return 1;
|
||||
waitingForAnswer = 0;
|
||||
game->mLayers->actionLayer()->setCurrentWaitingAction(NULL);
|
||||
return MTGAbility::reactToClick(source);
|
||||
}
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
MTGCardInstance * AACastCard::makeCard()
|
||||
{
|
||||
MTGCardInstance * card = NULL;
|
||||
MTGCard * cardData = MTGCollection()->getCardByName(cardNamed);
|
||||
card = NEW MTGCardInstance(cardData, source->controller()->game);
|
||||
source->controller()->game->temp->addCard(card);
|
||||
return card;
|
||||
}
|
||||
MTGCardInstance * AACastCard::makeCard()
|
||||
{
|
||||
MTGCardInstance * card = NULL;
|
||||
MTGCard * cardData = MTGCollection()->getCardByName(cardNamed);
|
||||
card = NEW MTGCardInstance(cardData, source->controller()->game);
|
||||
source->controller()->game->temp->addCard(card);
|
||||
return card;
|
||||
}
|
||||
|
||||
int AACastCard::resolveSpell()
|
||||
{
|
||||
@@ -5477,7 +5591,7 @@ int AACastCard::resolveSpell()
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char * AACastCard::getMenuText()
|
||||
const string AACastCard::getMenuText()
|
||||
{
|
||||
if(nameThis.size())
|
||||
return nameThis.c_str();
|
||||
|
||||
@@ -160,7 +160,8 @@ MTGCardInstance * CardDescriptor::match_and(MTGCardInstance * card)
|
||||
|
||||
if (mColorExclusions)
|
||||
{
|
||||
if ((mColorExclusions & card->colors) == mColorExclusions)
|
||||
// if any of forbidden colors intersect with card colors
|
||||
if ((mColorExclusions & card->colors) != 0)
|
||||
match = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
#include "../include/GameApp.h"
|
||||
#include "../include/MTGCard.h"
|
||||
#include "../include/GameOptions.h"
|
||||
#include "../include/CardEffect.h"
|
||||
|
||||
CardEffect::CardEffect(CardGui* target) :
|
||||
target(target)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CardEffect::~CardEffect()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CardEffect::Render()
|
||||
{
|
||||
// std::cout << "Rendering effect" << std::endl;
|
||||
}
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "Counters.h"
|
||||
#include "ModRules.h"
|
||||
#include "CardDescriptor.h"
|
||||
#include "GameApp.h"
|
||||
|
||||
const float CardGui::Width = 28.0;
|
||||
const float CardGui::Height = 40.0;
|
||||
@@ -110,17 +111,17 @@ void CardGui::Update(float dt)
|
||||
PlayGuiObject::Update(dt);
|
||||
}
|
||||
|
||||
void CardGui::DrawCard(const Pos& inPosition, int inMode)
|
||||
void CardGui::DrawCard(const Pos& inPosition, int inMode, bool thumb)
|
||||
{
|
||||
DrawCard(card, inPosition, inMode);
|
||||
DrawCard(card, inPosition, inMode, thumb);
|
||||
}
|
||||
|
||||
void CardGui::DrawCard(MTGCard* inCard, const Pos& inPosition, int inMode)
|
||||
void CardGui::DrawCard(MTGCard* inCard, const Pos& inPosition, int inMode, bool thumb)
|
||||
{
|
||||
switch (inMode)
|
||||
{
|
||||
case DrawMode::kNormal:
|
||||
RenderBig(inCard, inPosition);
|
||||
RenderBig(inCard, inPosition, thumb);
|
||||
break;
|
||||
case DrawMode::kText:
|
||||
AlternateRender(inCard, inPosition);
|
||||
@@ -957,7 +958,7 @@ void CardGui::TinyCropRender(MTGCard * card, const Pos& pos, JQuad * quad)
|
||||
}
|
||||
|
||||
//Renders a big card on screen. Defaults to the "alternate" rendering if no image is found
|
||||
void CardGui::RenderBig(MTGCard* card, const Pos& pos)
|
||||
void CardGui::RenderBig(MTGCard* card, const Pos& pos, bool thumb)
|
||||
{
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
//GameObserver * game = GameObserver::GetInstance();
|
||||
@@ -966,7 +967,8 @@ void CardGui::RenderBig(MTGCard* card, const Pos& pos)
|
||||
//i want this but ai targets cards so quickly that it can crash the game.
|
||||
float x = pos.actX;
|
||||
|
||||
JQuadPtr quad = WResourceManager::Instance()->RetrieveCard(card);
|
||||
JQuadPtr quad = thumb ? WResourceManager::Instance()->RetrieveCard(card, RETRIEVE_THUMB)
|
||||
: WResourceManager::Instance()->RetrieveCard(card);
|
||||
MTGCardInstance * kcard = dynamic_cast<MTGCardInstance*>(card);
|
||||
if(kcard && !kcard->isToken && kcard->name != kcard->model->data->name)
|
||||
{
|
||||
@@ -1013,7 +1015,7 @@ bool CardGui::FilterCard(MTGCard * _card,string filter)
|
||||
CardDescriptor cd;
|
||||
MTGCardInstance * card = (MTGCardInstance*) _card->data;
|
||||
cd.init();
|
||||
cd.mode = CD_OR;
|
||||
cd.mode = CardDescriptor::CD_OR;
|
||||
while (filter.size())
|
||||
{
|
||||
|
||||
@@ -1033,13 +1035,13 @@ bool CardGui::FilterCard(MTGCard * _card,string filter)
|
||||
string attribute;
|
||||
if (found2 != string::npos)
|
||||
{
|
||||
cd.mode = CD_OR;
|
||||
cd.mode = CardDescriptor::CD_OR;
|
||||
attribute = attributes.substr(0, found2);
|
||||
attributes = attributes.substr(found2 + 1);
|
||||
}
|
||||
else if (foundAnd != string::npos)
|
||||
{
|
||||
cd.mode = CD_AND;
|
||||
cd.mode = CardDescriptor::CD_AND;
|
||||
attribute = attributes.substr(0, foundAnd);
|
||||
attributes = attributes.substr(foundAnd + 1);
|
||||
}
|
||||
@@ -1302,7 +1304,7 @@ bool CardGui::FilterCard(MTGCard * _card,string filter)
|
||||
}
|
||||
}
|
||||
if (nbminuses)
|
||||
cd.mode = CD_AND;
|
||||
cd.mode = CardDescriptor::CD_AND;
|
||||
filter = filter.substr(0, found);
|
||||
}
|
||||
else
|
||||
@@ -1312,7 +1314,7 @@ bool CardGui::FilterCard(MTGCard * _card,string filter)
|
||||
|
||||
if (found != string::npos)
|
||||
{
|
||||
cd.mode = CD_OR;
|
||||
cd.mode = CardDescriptor::CD_OR;
|
||||
typeName = filter.substr(0, found);
|
||||
filter = filter.substr(found + 1);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "MTGDeck.h"
|
||||
#include "Subtypes.h"
|
||||
#include "Translate.h"
|
||||
#include "GameApp.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
@@ -84,6 +85,9 @@ int CardPrimitive::init()
|
||||
alias = 0;
|
||||
restrictions = NULL;
|
||||
dredgeAmount = 0;
|
||||
|
||||
power = 0;
|
||||
toughness = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -225,6 +229,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);
|
||||
addType(id);
|
||||
@@ -344,18 +351,12 @@ bool CardPrimitive::hasSubtype(int _subtype)
|
||||
return hasType(_subtype);
|
||||
}
|
||||
|
||||
bool CardPrimitive::hasType(const char * _type)
|
||||
bool CardPrimitive::hasType(const string& _type)
|
||||
{
|
||||
int id = MTGAllCards::findType(_type);
|
||||
return hasType(id);
|
||||
}
|
||||
|
||||
bool CardPrimitive::hasSubtype(const char * _subtype)
|
||||
{
|
||||
int id = MTGAllCards::findType(_subtype);
|
||||
return hasType(id);
|
||||
}
|
||||
|
||||
bool CardPrimitive::hasSubtype(const string& _subtype)
|
||||
{
|
||||
int id = MTGAllCards::findType(_subtype);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user