Compare commits

...

59 Commits

Author SHA1 Message Date
xawotihs 25c844c1f5 Activates SDL build in travis 2014-02-10 22:57:53 +01:00
xawotihs 34492d9096 Adds Threading implementation on SDL 2014-02-03 23:08:17 +01:00
xawotihs 30d92eb68c Should fix issue #497 with the broken freezing the game. 2014-01-18 22:50:16 +01:00
xawotihs 6e6a0fd5c2 OMG I so hate shells 2014-01-18 16:00:14 +01:00
xawotihs cd4a980182 More debug 2014-01-18 15:26:09 +01:00
xawotihs aad54fd98d Adds debug in build script 2014-01-18 14:57:23 +01:00
xawotihs 6b7a49506c Should fix the stringifying issue 2014-01-18 14:23:26 +01:00
xawotihs 7ecf67c176 And again 2014-01-18 13:37:43 +01:00
xawotihs 77aeb2d0ac Fixed release name 2014-01-18 13:29:50 +01:00
xawotihs 7a9f989104 Adds some URL error log 2014-01-18 12:46:27 +01:00
xawotihs ae06bebd24 Merge branch 'github_downloader' 2014-01-18 12:11:08 +01:00
xawotihs 042fb7b376 Tries to fix Android compilation 2014-01-18 11:18:27 +01:00
xawotihs c3583ade01 Updated resource name and URL for android project 2014-01-17 23:25:48 +01:00
xawotihs f97d9805dd Removed build number in released filename and added computation of resource URL based on release name. 2014-01-17 21:50:10 +01:00
xawotihs 1d33de59a9 Fixed compilation issue 2014-01-12 22:56:53 +01:00
xawotihs 0c4b09891b Removed hardcoded testing values and used 32 bits file size instead of 64 bits. 2014-01-12 22:40:45 +01:00
xawotihs 25955303e7 Adds a Downloader component to JGE able to download and cache files. 2014-01-12 22:16:35 +01:00
Rolzad73 27b75eecb0 Merge pull request #600 from WagicProject/android_build_update
update android build tools version
2014-01-09 12:33:11 -08:00
Rolzad73 e40921cf13 update android build tools version 2014-01-09 14:57:06 -05:00
Rolzad73 083cebcc7e updated credits text 2014-01-09 14:46:58 -05:00
Rolzad73 a722736335 Merge pull request #599 from WagicProject/android_travis_explicit
Attempt to make android tools fetching for TravisCI explicit and futureproof
2014-01-08 08:40:47 -08:00
Rolzad73 c483c20c81 attempt to make android tools fetching for TravisCI explicit and futureproof 2014-01-08 11:14:47 -05:00
Dmitry Panin dec1caa43c Revert "Fixed issue with multiple basic abilities in TargetChooser"
This reverts commit d9816c7ad0.
2014-01-04 18:40:59 -08:00
Dmitry Panin 9526e22118 Fixed grave pact 2014-01-04 18:14:15 -08:00
Dmitry Panin d9816c7ad0 Fixed issue with multiple basic abilities in TargetChooser
E.g. card create[trample;haste] wasn't handled properly
2014-01-04 18:13:22 -08:00
Dmitry Panin 8e327a27df Fixed formatting 2014-01-04 18:13:22 -08:00
xawotihs 43fe67d7d8 Adds executioners_swing tests in _tests.txt 2013-12-31 18:38:30 +01:00
Xawotihs a63991bb4e Merge pull request #598 from bjornsnoen/master
Damager keyword
2013-12-31 09:11:20 -08:00
xawotihs b09db0c60f Removed c++11 warning. 2013-12-22 21:26:06 +01:00
Bjørn Snoen 928ca3497a More code compliance. New tests. 2013-12-21 19:31:32 +01:00
Bjørn Snoen 60219411f6 Coding style compliance 2013-12-21 14:33:44 +01:00
Bjørn Snoen 642f5bb515 Fixed indentation mistakes 2013-12-21 11:18:18 +01:00
Bjørn Snoen 20e878a102 Made damager keyword work. Fixed Executioner's Swing in mtg.txt 2013-12-21 11:05:15 +01:00
xawotihs da31371d86 Include c++11 threading 2013-12-20 18:39:02 +01:00
xawotihs 0df408793a Tries to fix android sdk installation in Travis 2013-12-20 14:09:30 +01:00
xawotihs 9630bcd56b Removed file wrongly added. 2013-12-20 12:37:25 +01:00
xawotihs 3c38e21b25 Merge branch 'master' into Qt5.2_macx 2013-12-20 11:14:10 +01:00
xawotihs caec886e22 Fixed issues found by XCode. 2013-12-20 00:24:08 +01:00
Dmitry Panin 927f8955e9 Merge pull request #596 from bjornsnoen/master
Fix a rarity mistake and a grammatical error
2013-12-19 02:44:38 -08:00
Bjørn Snoen d4e0296d2b Fixed wrong rarity on millstone in M14 2013-12-18 09:37:20 +01:00
Bjørn Snoen 8eb664f93d Fixed grammatical then/than error. 2013-12-18 05:50:30 +01:00
xawotihs b180c3d1a7 Fixed Qt5 mingw32 build 2013-12-16 22:11:28 +01:00
Dmitry Panin db9f18a644 Added _cards.dat for M14 (taken from forum) 2013-12-15 22:39:08 +04:00
xawotihs 95805ea387 Fixed QT mingw cross compile with QT4.8 2013-12-15 00:26:04 +01:00
xawotihs 4765890d0a Fixed mouse input with retina display 2013-12-14 23:46:23 +01:00
Xawotihs 2e13f29945 Update README.md 2013-12-14 19:13:26 +01:00
xawotihs 22b1c3b5d8 Fixed zip permission while rezipping PSP package 2013-12-14 14:40:26 +01:00
xawotihs c7bae65697 Fixed core unzip 2013-12-14 13:18:11 +01:00
xawotihs 2381f0306c Fixed paths 2013-12-14 12:06:51 +01:00
xawotihs b12e15e4ff Tries to arrange a bit the PSP binary package to make it more usual for users. 2013-12-14 11:55:12 +01:00
xawotihs 9e21751e12 Fixed windows build upload 2013-12-13 22:54:40 +01:00
xawotihs db60c38eda Added windows build 2013-12-13 23:07:17 +01:00
xawotihs 1a4327a2e6 Fixed mingw32 build linking 2013-12-13 21:54:43 +01:00
xawotihs 88095c67b8 Fixed mingw32 compilation 2013-12-13 21:27:40 +01:00
xawotihs ec34380668 Fixed mingw gcc package name 2013-12-13 00:12:32 +01:00
xawotihs 89dcd6c71d Added some windows cross compiling of the Qt flavor. 2013-12-12 17:54:43 -05:00
Dmitry Panin fd3cf574cf Remove previous tag "latest-master" before uploading new one 2013-12-12 21:08:39 +04:00
Dmitry Panin f21452feec Fixed some Cards:
Rune-Tail, Kitsune Ascendant
Shifting Sky
Flourishing Defenses (thanks to Shadowfireomega)
2013-12-12 20:11:35 +04:00
Dmitry Panin 0f85471216 Enabled automatic releases for each commit in master 2013-12-12 02:20:14 +04:00
48 changed files with 2452 additions and 149 deletions
+8 -3
View File
@@ -1,20 +1,25 @@
language: cpp language: cpp
branches:
except:
- latest-master
before_install: before_install:
- export PSPDEV="$TRAVIS_BUILD_DIR/opt/pspsdk" - export PSPDEV="$TRAVIS_BUILD_DIR/opt/pspsdk"
- export PSPSDK="$PSPDEV/psp/sdk" - export PSPSDK="$PSPDEV/psp/sdk"
- export PATH="$PATH:$PSPDEV/bin:$PSPSDK/bin" - export PATH="$PATH:$PSPDEV/bin:$PSPSDK/bin"
- export ANDROID="android-sdk-linux/tools/android" - export ANDROID="android-sdk-linux/tools/android"
install: install:
- sudo add-apt-repository ppa:tobydox/mingw -y
- sudo apt-get update -qq - 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 - if [ `uname -m` = x86_64 ]; then sudo apt-get install -qq --force-yes libgd2-xpm ia32-libs ia32-libs-multiarch jq mingw32-x-gcc mingw32-x-qt; fi
- sudo ln -s /opt/mingw32/bin/moc /opt/mingw32/bin/i686-w64-mingw32-moc
- 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 - 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 - 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/ndk/android-ndk-r9-linux-x86_64.tar.bz2 -nv
- wget http://dl.google.com/android/android-sdk_r22-linux.tgz -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 --absolute-names -jxf android-ndk-r9-linux-x86_64.tar.bz2
- tar -zxf android-sdk_r22-linux.tgz - tar -zxf android-sdk_r22-linux.tgz
- $ANDROID list sdk -a - $ANDROID list sdk --extended -a
- echo yes | $ANDROID update sdk -a --filter 1,2,4,18 --no-ui --force > log.txt - echo yes | $ANDROID update sdk -a --filter "tools","platform-tools","build-tools-19.0.1","android-10" --no-ui --force > log.txt
- sudo pip install pyjavaproperties - sudo pip install pyjavaproperties
script: ./travis-script.sh script: ./travis-script.sh
env: env:
+128
View File
@@ -0,0 +1,128 @@
#ifndef DOWNLOADER_H
#define DOWNLOADER_H
//-------------------------------------------------------------------------------------
//
// This class handles download of remote resources (any kind of file)
// All the resources are stored locally in the userPath
// For every resources, the downloader verifies if the resource was modifed
// on the server before downloading the update. The Downloader maintains a catalogue
// of resource downloaded to be able to check if they need to be updated.
//
// The interface can be used completly synchronously by the application and some
// context or message loop is needed in the implementation of this interface
//
// Note that the Downloader could in theory by implemented on top of JNetwork.
//
//-------------------------------------------------------------------------------------
#include <string>
#include <ostream>
#include <istream>
#include <fstream>
#include <map>
#include "Threading.h"
#ifdef QT_CONFIG
#include <QObject>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QNetworkAccessManager>
#endif
using namespace std;
class DownloadRequest
#ifdef QT_CONFIG
: public QObject
#endif
{
#ifdef QT_CONFIG
Q_OBJECT
private slots:
#endif
void fileDownloaded();
void downloadProgress(qint64 bytesReceived, qint64 bytesTotal);
#ifdef QT_CONFIG
signals:
void percentChanged(int percent);
void statusChanged(int);
#endif
public:
typedef enum {
NOT_PRESENT,
DOWNLOADING,
DOWNLOADED,
DOWNLOAD_ERROR
} DownloadStatus;
protected:
string mLocalPath;
string mRemoteResourceURL;
// previous one is the original, next one can change after redirection
string mRequestedRemoteResourceURL;
string mETag;
DownloadStatus mDownloadStatus;
bool mUpgradeAvailable;
size_t mTotalSize;
size_t mCurrentSize;
ofstream mFile;
#ifdef QT_CONFIG
QNetworkReply* mNetworkReply;
static QNetworkAccessManager networkAccessManager;
#endif
public:
DownloadRequest(string localPath="",
string remoteResourceURL="",
string ETag = "",
DownloadStatus downloadStatus=NOT_PRESENT,
size_t totalSize = 0,
size_t currentSize = 0);
~DownloadRequest();
static bool NetworkIsAccessible();
string getTempLocalPath() const { return (mLocalPath+".tmp"); };
string getLocalPath() const { return mLocalPath; };
string getRemoteResource() const { return mRemoteResourceURL; };
string getETag() const { return mETag; };
void startGet();
void startHead();
DownloadStatus getDownloadStatus() const { return mDownloadStatus; };
bool upgradeAvailable() const { return mUpgradeAvailable; };
void getSizes(size_t& totalSize, size_t&currentSize) {
totalSize = mTotalSize;
currentSize = mCurrentSize;
};
friend ostream& operator<<(ostream& out, const DownloadRequest& d);
friend istream& operator>>(istream&, DownloadRequest&);
friend class Downloader;
};
class Downloader
{
protected:
Downloader(string globalRemoteURL="", string localCacheRecords="");
virtual ~Downloader();
static Downloader* mInstance;
string mGlobalRemoteURL;
string mLocalCacheRecords;
boost::mutex mMutex;
map<string, DownloadRequest*> mRequestMap;
public:
static Downloader* GetInstance();
static void Release();
void Update();
DownloadRequest* Get(string localPath, string remoteResourceURL="");
friend ostream& operator<<(ostream& out, const Downloader& d);
friend istream& operator>>(istream&, Downloader&);
};
#endif // DOWNLOADER_H
-1
View File
@@ -297,7 +297,6 @@ public:
private: private:
float mTimer; float mTimer;
float mFrameTime; float mFrameTime;
JAnimator* mAnimator;
vector<JAnimatorObject *> mObjects; vector<JAnimatorObject *> mObjects;
}; };
-1
View File
@@ -37,7 +37,6 @@ private:
float mTexY; float mTexY;
float mTexWidth; float mTexWidth;
float mTexHeight; float mTexHeight;
JTexture* mTexture;
JQuad* mQuad; JQuad* mQuad;
+2 -1
View File
@@ -128,6 +128,7 @@ public:
bool readIntoString(const string & FilePath, string & target); bool readIntoString(const string & FilePath, string & target);
bool openForWrite(ofstream & File, const string & FilePath, ios_base::openmode mode = ios_base::out ); bool openForWrite(ofstream & File, const string & FilePath, ios_base::openmode mode = ios_base::out );
bool Rename(string from, string to); bool Rename(string from, string to);
bool Remove(string aFile);
//Returns true if strFilename exists somewhere in the fileSystem //Returns true if strFilename exists somewhere in the fileSystem
bool FileExists(const string& strFilename); bool FileExists(const string& strFilename);
@@ -163,4 +164,4 @@ protected:
#endif #endif
+309 -15
View File
@@ -1,7 +1,7 @@
#ifndef THREADING_H #ifndef THREADING_H
#define THREADING_H #define THREADING_H
#if !defined(PSP) && !defined(QT_CONFIG) #if !defined(PSP) && !defined(QT_CONFIG) && !(__cplusplus > 199711L) && !defined(SDL_CONFIG)
#include <boost/date_time.hpp> #include <boost/date_time.hpp>
#ifdef WIN32 #ifdef WIN32
@@ -14,7 +14,7 @@
#endif #endif
#include <boost/thread/mutex.hpp> #include <boost/thread/mutex.hpp>
#elif !defined(QT_CONFIG) #elif defined(PSP)
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
@@ -26,7 +26,7 @@
namespace boost namespace boost
{ {
/** /**
** PSP specific variant of a boost mutex & scoped_lock ** PSP specific variant of a boost mutex & scoped_lock
*/ */
template <class Mutex> template <class Mutex>
@@ -60,7 +60,7 @@ namespace boost
{ {
sceKernelDeleteSema(mID); sceKernelDeleteSema(mID);
} }
void lock() void lock()
{ {
int result = sceKernelWaitSema(mID, 1, 0); int result = sceKernelWaitSema(mID, 1, 0);
@@ -142,7 +142,7 @@ namespace boost
} }
} }
int mID; int mID;
int mThreadID; int mThreadID;
volatile int mRecursionCount; volatile int mRecursionCount;
@@ -164,7 +164,7 @@ namespace boost
/** /**
** Emulating boost::thread configuration glue, with some shortcuts ** Emulating boost::thread configuration glue, with some shortcuts
** This detail namespace is a distillation of boost's thread.hpp, thread_data.hpp. ** This detail namespace is a distillation of boost's thread.hpp, thread_data.hpp.
*/ */
namespace detail namespace detail
@@ -212,13 +212,13 @@ namespace boost
** **
** The intent of its usage is this form only: ** The intent of its usage is this form only:
** mWorkerThread = boost::thread(ThreadProc, this); ** mWorkerThread = boost::thread(ThreadProc, this);
** where ThreadProc is a static member function of the 'this' class,eg: ** where ThreadProc is a static member function of the 'this' class,eg:
** static void FOO::ThreadProc(void* inParam) ** static void FOO::ThreadProc(void* inParam)
** { ** {
** FOO* instance = reinterpret_cast<FOO*>(inParam); ** FOO* instance = reinterpret_cast<FOO*>(inParam);
** // now you have class instance data available... ** // now you have class instance data available...
** } ** }
** **
** Any other variant of a thread proc with more than one param is unimplemented. ** Any other variant of a thread proc with more than one param is unimplemented.
*/ */
class thread class thread
@@ -227,7 +227,7 @@ namespace boost
** Helper class for sceKernelStartThread, which passes args by value, not by reference ** Helper class for sceKernelStartThread, which passes args by value, not by reference
** We use this struct to wrap any pointers that we want to pass to the worker thread. ** We use this struct to wrap any pointers that we want to pass to the worker thread.
*/ */
struct CallbackData struct CallbackData
{ {
CallbackData(detail::thread_data_ptr inThreadInfo) CallbackData(detail::thread_data_ptr inThreadInfo)
: mThreadInfo(inThreadInfo) : mThreadInfo(inThreadInfo)
@@ -307,7 +307,7 @@ namespace boost
} }
} }
#elif defined(QT_CONFIG) #elif defined(QT_CONFIG) && (__cplusplus <= 199711L)
#include <QMutex> #include <QMutex>
#include <QThread> #include <QThread>
@@ -537,6 +537,300 @@ namespace boost
} }
} }
#elif (__cplusplus > 199711L)
#include <thread>
#include <mutex>
namespace boost
{
typedef std::thread thread;
template <class Mutex>
struct unique_lock
{
unique_lock(Mutex& inMutex) : mMutex(&inMutex)
{
mMutex->lock();
}
~unique_lock()
{
mMutex->unlock();
}
Mutex* mMutex;
};
class mutex
{
public:
typedef unique_lock<mutex> scoped_lock;
mutex()
: mQMutex()
{
}
~mutex()
{
}
void lock()
{
mQMutex.lock();
}
void unlock()
{
mQMutex.unlock();
}
std::mutex mQMutex;
private:
mutex(mutex const&);
mutex& operator=(mutex const&);
};
namespace posix_time
{
typedef unsigned int milliseconds;
}
/**
** boost's platform neutral sleep call.
*/
namespace this_thread
{
inline void sleep(boost::posix_time::milliseconds const& time)
{
std::this_thread::sleep_for(std::chrono::milliseconds(time));
}
}
}
#elif defined(SDL_CONFIG)
#include "SDL_thread.h"
#include "SDL_timer.h"
#include <boost/bind.hpp>
#include <boost/shared_ptr.hpp>
#include "../include/JLogger.h"
namespace boost
{
template <class Mutex>
struct unique_lock
{
unique_lock(Mutex& inMutex) : mMutex(&inMutex)
{
mMutex->lock();
}
~unique_lock()
{
mMutex->unlock();
}
Mutex* mMutex;
};
class mutex
{
public:
typedef unique_lock<mutex> scoped_lock;
mutex()
: mpSDLMutex(0)
{
mpSDLMutex = SDL_CreateMutex();
}
~mutex()
{
SDL_DestroyMutex(mpSDLMutex);
}
void lock()
{
SDL_mutexP(mpSDLMutex);
}
void unlock()
{
SDL_mutexV(mpSDLMutex);
}
SDL_mutex* mpSDLMutex;
private:
mutex(mutex const&);
mutex& operator=(mutex const&);
};
class recursive_mutex
{
public:
typedef unique_lock<recursive_mutex> scoped_lock;
recursive_mutex()
: mpSDLMutex(0)
{
mpSDLMutex = SDL_CreateMutex();
}
~recursive_mutex()
{
SDL_DestroyMutex(mpSDLMutex);
}
void lock()
{
SDL_mutexP(mpSDLMutex);
}
void unlock()
{
SDL_mutexV(mpSDLMutex);
}
SDL_mutex* mpSDLMutex;
private:
recursive_mutex(recursive_mutex const&);
recursive_mutex& operator=(recursive_mutex const&);
};
/**
** Emulating boost::thread configuration glue, with some shortcuts
** This detail namespace is a distillation of boost's thread.hpp, thread_data.hpp.
*/
namespace detail
{
struct thread_data_base
{
thread_data_base()
{
}
virtual ~thread_data_base()
{
}
virtual void run() = 0;
};
typedef boost::shared_ptr<detail::thread_data_base> thread_data_ptr;
template<typename F>
class thread_data : public detail::thread_data_base
{
public:
thread_data(F f_) : f(f_)
{
}
void run()
{
f();
}
private:
F f;
void operator=(thread_data&);
thread_data(thread_data&);
};
} //namespace detail
/**
** A simplistic implementation of boost::thread, using QThread.
**
*/
class thread
{
/*
** Helper class for sceKernelStartThread, which passes args by value, not by reference
** We use this struct to wrap any pointers that we want to pass to the worker thread.
*/
struct CallbackData
{
CallbackData(detail::thread_data_ptr inThreadInfo)
: mThreadInfo(inThreadInfo)
{
}
detail::thread_data_ptr mThreadInfo;
};
public:
thread()
{
}
template <class F,class A1>
thread(F f, A1 a1) : mThreadInfo(make_thread_info(boost::bind(boost::type<void>(), f, a1)))
{
mpSDLThread = SDL_CreateThread(ThreadProc, &mThreadInfo);
}
~thread()
{
}
void join()
{
int status;
SDL_WaitThread(mpSDLThread, &status);
}
private:
static int ThreadProc(void *inParam)
{
detail::thread_data_ptr* threadInfo = reinterpret_cast<detail::thread_data_ptr* >(inParam);
CallbackData callbackData(*threadInfo);
LOG("Entering thread::ThreadProc");
callbackData.mThreadInfo->run();
return 0;
}
template<typename F>
static inline detail::thread_data_ptr make_thread_info(F f)
{
return detail::thread_data_ptr(new detail::thread_data<F>(f));
}
detail::thread_data_ptr mThreadInfo;
SDL_Thread* mpSDLThread;
};
namespace posix_time
{
typedef unsigned int milliseconds;
}
/**
** boost's platform neutral sleep call.
*/
namespace this_thread
{
inline void sleep(boost::posix_time::milliseconds const& time)
{
SDL_Delay(time);
}
}
}
#endif #endif
#endif // THREADING_H #endif // THREADING_H
+15
View File
@@ -136,6 +136,20 @@ signals:
private slots: private slots:
private: private:
int lastPosx(){
#if QT_VERSION >= 0x050000
return m_lastPos.x()*devicePixelRatio();
#else
return m_lastPos.x();
#endif
}
int lastPosy(){
#if QT_VERSION >= 0x050000
return m_lastPos.y()*devicePixelRatio();
#else
return m_lastPos.y();
#endif
}
void timerEvent( QTimerEvent* ); void timerEvent( QTimerEvent* );
void doAndEnqueue(JButton action) { void doAndEnqueue(JButton action) {
m_engine->HoldKey_NoRepeat(action); m_engine->HoldKey_NoRepeat(action);
@@ -154,6 +168,7 @@ private:
int m_timerId; int m_timerId;
bool m_active; bool m_active;
QRect m_viewPort; QRect m_viewPort;
QPoint m_lastPos;
#ifdef QT_WIDGET #ifdef QT_WIDGET
#if (defined Q_WS_MAEMO_5) || (defined MEEGO_EDITION_HARMATTAN) || (defined Q_WS_ANDROID) #if (defined Q_WS_MAEMO_5) || (defined MEEGO_EDITION_HARMATTAN) || (defined Q_WS_ANDROID)
int mMouseDownX; int mMouseDownX;
+298
View File
@@ -0,0 +1,298 @@
#include "DebugRoutines.h"
#include "JFileSystem.h"
#include "Downloader.h"
#define RECORDS_DEFAULT_FILE "cache/records.txt"
#ifdef QT_CONFIG
QNetworkAccessManager DownloadRequest::networkAccessManager;
#endif
DownloadRequest::DownloadRequest(string localPath,
string remoteResourceURL,
string ETag,
DownloadStatus downloadStatus,
size_t totalSize,
size_t currentSize):
mLocalPath(localPath),
mRemoteResourceURL(remoteResourceURL),
mRequestedRemoteResourceURL(remoteResourceURL),
mETag(ETag),
mDownloadStatus(downloadStatus),
mUpgradeAvailable(false),
mTotalSize(totalSize),
mCurrentSize(currentSize)
{
}
DownloadRequest::~DownloadRequest()
{
}
void DownloadRequest::startHead()
{
#ifdef QT_CONFIG
QNetworkRequest request(QUrl(QString(mRequestedRemoteResourceURL.c_str())));
request.setRawHeader("If-None-Match", mETag.c_str());
mNetworkReply = networkAccessManager.head(request);
connect(mNetworkReply, SIGNAL(finished()), SLOT(fileDownloaded()));
#endif
}
void DownloadRequest::startGet()
{
#ifdef QT_CONFIG
mNetworkReply = networkAccessManager.get(QNetworkRequest(QUrl(QString(mRequestedRemoteResourceURL.c_str()))));
#endif
mFile.close();
JFileSystem::GetInstance()->Remove(getTempLocalPath());
JFileSystem::GetInstance()->openForWrite(mFile, getTempLocalPath());
#ifdef QT_CONFIG
connect(mNetworkReply, SIGNAL(downloadProgress(qint64, qint64)),
SLOT(downloadProgress(qint64, qint64)));
connect(mNetworkReply, SIGNAL(finished()), SLOT(fileDownloaded()));
#endif
}
void DownloadRequest::fileDownloaded()
{
do {
QByteArray eTagByteArray = mNetworkReply->rawHeader("ETag");
if(!eTagByteArray.isEmpty()) {
string oldETag = mETag;
mETag = QString(eTagByteArray).toStdString();
if(oldETag!="" && oldETag != mETag)
mUpgradeAvailable = true;
}
// let's check some error
if(mNetworkReply->error() != QNetworkReply::NoError) {
DebugTrace(mNetworkReply->errorString().toStdString());
mDownloadStatus = DownloadRequest::DOWNLOAD_ERROR;
mFile.close();
JFileSystem::GetInstance()->Remove(getTempLocalPath());
break;
}
// check if we're getting redirected
QVariant redirectionTarget = mNetworkReply->attribute(QNetworkRequest::RedirectionTargetAttribute);
if (!redirectionTarget.isNull()) {
QUrl newUrl = QUrl(mRequestedRemoteResourceURL.c_str()).resolved(redirectionTarget.toUrl());
DebugTrace(string("Redirect to ")+ newUrl.toString().toStdString());
mRequestedRemoteResourceURL = newUrl.toString().toStdString();
mNetworkReply->deleteLater();
if(mFile.is_open())
startGet();
else
startHead();
return;
}
if(mFile.is_open())
{
QByteArray byteArray = mNetworkReply->readAll();
mFile.write(byteArray.constData(), byteArray.size());
mFile.close();
if(!JFileSystem::GetInstance()->Rename(getTempLocalPath(), mLocalPath)) {
mDownloadStatus = DownloadRequest::DOWNLOAD_ERROR;
break;
}
}
mDownloadStatus = DownloadRequest::DOWNLOADED;
} while(0);
Downloader::GetInstance()->Update();
mNetworkReply->deleteLater();
emit statusChanged((int)mDownloadStatus);
}
void DownloadRequest::downloadProgress(qint64 bytesReceived, qint64 bytesTotal)
{
QByteArray byteArray = mNetworkReply->readAll();
mFile.write(byteArray.constData(), byteArray.size());
mCurrentSize = bytesReceived;
mTotalSize = bytesTotal;
int percent = 0;
if(bytesTotal)
percent = (bytesReceived/bytesTotal)*100;
emit percentChanged(percent);
}
Downloader* Downloader::mInstance = 0;
Downloader::Downloader(string globalRemoteURL, string localcacheRecords):
mGlobalRemoteURL(globalRemoteURL),
mLocalCacheRecords(localcacheRecords)
{
JFileSystem::GetInstance()->MakeDir("cache");
izfstream downloadRecords;
if(mLocalCacheRecords.empty())
mLocalCacheRecords = RECORDS_DEFAULT_FILE;
if(JFileSystem::GetInstance()->openForRead(downloadRecords, mLocalCacheRecords))
{// File exists, let's read it.
downloadRecords >> (*this);
}
JFileSystem::GetInstance()->CloseFile();
}
Downloader::~Downloader()
{
map<string, DownloadRequest*>::iterator ite;
for(ite = mRequestMap.begin(); ite != mRequestMap.end(); ite++)
{
delete (*ite).second;
}
mRequestMap.erase(mRequestMap.begin(), mRequestMap.end());
}
Downloader* Downloader::GetInstance()
{
if(!mInstance)
{
mInstance = new Downloader();
}
return mInstance;
}
void Downloader::Release()
{
if(mInstance)
{
delete mInstance;
mInstance = 0;
}
}
bool DownloadRequest::NetworkIsAccessible()
{
bool result = false;
#ifdef QT_CONFIG
networkAccessManager.setNetworkAccessible(QNetworkAccessManager::Accessible);
result = networkAccessManager.networkAccessible();
#endif
return result;
}
DownloadRequest* Downloader::Get(string localPath, string remoteResourceURL)
{
map<string, DownloadRequest*>::iterator ite = mRequestMap.find(localPath);
if(ite == mRequestMap.end())
{ // request does not exist, let's create it
DownloadRequest* request = new DownloadRequest(localPath, remoteResourceURL);
std::pair<std::map<string,DownloadRequest*>::iterator,bool> ret;
ret = mRequestMap.insert ( std::pair<string,DownloadRequest*>(localPath, request) );
if (ret.second==false) {
DebugTrace("Downloader::Get Error inserting request in Map");
return 0;
}
ite = ret.first;
}
// Now, we can check the server
if((*ite).second->getDownloadStatus() == DownloadRequest::NOT_PRESENT ||
(*ite).second->upgradeAvailable())
{ // File is not here or an update is available, let's get it
(*ite).second->startGet();
(*ite).second->mDownloadStatus = DownloadRequest::DOWNLOADING;
}
else if ((*ite).second->getDownloadStatus() == DownloadRequest::DOWNLOADED)
{ // File is here, let's check if there is some update without blocking the playback
(*ite).second->startHead();
}
return (*ite).second;
}
void Downloader::Update()
{
ofstream downloadRecords;
if(JFileSystem::GetInstance()->openForWrite(downloadRecords, mLocalCacheRecords))
{
downloadRecords << (*this);
}
downloadRecords.close();
}
ostream& operator<<(ostream& out, const DownloadRequest& d)
{
// HEAD request fails, so this line erase cache record after upgrade check :(
// if(d.getDownloadStatus() == DownloadRequest::DOWNLOADED)
{
out << "localPath=" << d.mLocalPath << endl;
out << "remoteResource=" << d.mRemoteResourceURL << endl;
out << "ETag=" << d.mETag << endl;
out << "upgradeAvailable=" << d.mUpgradeAvailable <<endl;
}
return out;
}
istream& operator>>(istream& in, DownloadRequest& d)
{
string s;
while(std::getline(in, s))
{
size_t limiter = s.find("=");
string areaS;
if (limiter != string::npos)
{
areaS = s.substr(0, limiter);
if (areaS.compare("localPath") == 0)
{
d.mLocalPath = s.substr(limiter + 1);
}
else if (areaS.compare("remoteResource") == 0)
{
d.mRemoteResourceURL = s.substr(limiter + 1);
d.mRequestedRemoteResourceURL = d.mRemoteResourceURL;
}
else if (areaS.compare("ETag") == 0)
{
d.mETag = s.substr(limiter + 1);
d.mDownloadStatus = DownloadRequest::DOWNLOADED;
}
else if (areaS.compare("upgradeAvailable") == 0)
{
d.mUpgradeAvailable = (bool)atoi(s.substr(limiter + 1).c_str());
break;
}
}
}
return in;
}
ostream& operator<<(ostream& out, const Downloader& d)
{
map<string, DownloadRequest*>::const_iterator ite;
for(ite = d.mRequestMap.begin(); ite != d.mRequestMap.end(); ite++)
{
out << (*(*ite).second) << endl;
}
return out;
}
istream& operator>>(istream& in, Downloader& d)
{
while(!in.eof())
{
DownloadRequest* downloadRequest = new DownloadRequest();
in >> (*downloadRequest);
if(!downloadRequest->getLocalPath().empty() &&
!downloadRequest->getRemoteResource().empty() &&
!downloadRequest->getETag().empty()) {
d.mRequestMap[downloadRequest->getLocalPath()] = downloadRequest;
} else {
delete downloadRequest;
}
}
return in;
}
+11 -1
View File
@@ -313,11 +313,15 @@ bool JFileSystem::readIntoString(const string & FilePath, string & target)
int fileSize = GetFileSize(file); int fileSize = GetFileSize(file);
#ifndef __MINGW32__
try { try {
#endif
target.resize((std::string::size_type) fileSize); target.resize((std::string::size_type) fileSize);
#ifndef __MINGW32__
} catch (bad_alloc&) { } catch (bad_alloc&) {
return false; return false;
} }
#endif
if (fileSize) if (fileSize)
@@ -553,7 +557,13 @@ bool JFileSystem::Rename(string _from, string _to)
string from = mUserFSPath + _from; string from = mUserFSPath + _from;
string to = mUserFSPath + _to; string to = mUserFSPath + _to;
std::remove(to.c_str()); std::remove(to.c_str());
return rename(from.c_str(), to.c_str()) ? true: false; return (rename(from.c_str(), to.c_str()) == 0);
}
bool JFileSystem::Remove(string aFile)
{
string toRemove = mUserFSPath + aFile;
return (std::remove(toRemove.c_str()) == 0);
} }
int JFileSystem::GetFileSize(izfstream & file) int JFileSystem::GetFileSize(izfstream & file)
+18 -11
View File
@@ -9,11 +9,11 @@
#include <QtDeclarative> #include <QtDeclarative>
#include "qmlapplicationviewer.h" #include "qmlapplicationviewer.h"
#endif //QT_WIDGET #endif //QT_WIDGET
#include "filedownloader.h" #include "Downloader.h"
#include "GameApp.h" #include "GameApp.h"
#include "corewrapper.h" #include "corewrapper.h"
QWidget* g_glwidget = NULL; WagicCore* g_glwidget = NULL;
static const struct { LocalKeySym keysym; JButton keycode; } gDefaultBindings[] = static const struct { LocalKeySym keysym; JButton keycode; } gDefaultBindings[] =
{ {
@@ -69,18 +69,25 @@ int main(int argc, char* argv[])
#endif //QT_WIDGET #endif //QT_WIDGET
if(argc >= 2 && string(argv[1]) == "testsuite")
{
int result = 0;
result += WagicCore::runTestSuite();
return result;
}
app->setApplicationName(WagicCore::getApplicationName()); app->setApplicationName(WagicCore::getApplicationName());
FileDownloader fileDownloader(USERDIR, WAGIC_RESOURCE_NAME); DownloadRequest* downloadRequest = NULL;
#ifdef WAGIC_RESOURCE_URL
Downloader*downloader = Downloader::GetInstance();
downloadRequest = downloader->Get(
"core.zip",
WAGIC_RESOURCE_URL
);
#endif
#ifdef QT_WIDGET #ifdef QT_WIDGET
g_glwidget = new WagicCore(); g_glwidget = new WagicCore();
g_glwidget->connect(&fileDownloader, SIGNAL(finished(int)), SLOT(start(int))); if(!downloadRequest || downloadRequest->getDownloadStatus() == DownloadRequest::DOWNLOADED)
{
g_glwidget->start(0);
}
else
{
g_glwidget->connect(downloadRequest, SIGNAL(statusChanged(int)), SLOT(start(int)));
}
#else #else
qmlRegisterType<WagicCore>("CustomComponents", 1, 0, "WagicCore"); qmlRegisterType<WagicCore>("CustomComponents", 1, 0, "WagicCore");
+14 -1
View File
@@ -78,7 +78,20 @@ extern "C" void Java_org_libsdl_app_SDLActivity_nativeResume(
{ {
if (!g_engine) if (!g_engine)
return; return;
g_engine->Resume(); g_engine->Resume();
}
#include "Wagic_Version.h"
extern "C" jstring Java_org_libsdl_app_SDLActivity_getResourceName(
JNIEnv* env, jclass cls)
{
return env->NewStringUTF (WAGIC_RESOURCE_NAME);
}
extern "C" jstring Java_org_libsdl_app_SDLActivity_getResourceUrl(
JNIEnv* env, jclass cls)
{
return env->NewStringUTF (WAGIC_RESOURCE_URL);
} }
#endif #endif
+28 -28
View File
@@ -418,29 +418,29 @@ void WagicCore::mousePressEvent(QMouseEvent *event)
{ {
if(event->button() == Qt::LeftButton) if(event->button() == Qt::LeftButton)
{ {
QPoint lastPos = event->pos(); m_lastPos = event->pos();
// this is intended to convert window coordinate into game coordinate. // this is intended to convert window coordinate into game coordinate.
// this is correct only if the game and window have the same aspect ratio, otherwise, it's just wrong // this is correct only if the game and window have the same aspect ratio, otherwise, it's just wrong
int actualWidth = (int) JRenderer::GetInstance()->GetActualWidth(); int actualWidth = (int) JRenderer::GetInstance()->GetActualWidth();
int actualHeight = (int) JRenderer::GetInstance()->GetActualHeight(); int actualHeight = (int) JRenderer::GetInstance()->GetActualHeight();
if (lastPos.y() >= m_viewPort.top() && if (lastPosy() >= m_viewPort.top() &&
lastPos.y() <= m_viewPort.bottom() && lastPosy() <= m_viewPort.bottom() &&
lastPos.x() <= m_viewPort.right() && lastPosx() <= m_viewPort.right() &&
lastPos.x() >= m_viewPort.left()) { lastPosx() >= m_viewPort.left()) {
m_engine->LeftClicked( m_engine->LeftClicked(
((lastPos.x()-m_viewPort.left())*SCREEN_WIDTH)/actualWidth, ((lastPosx()-m_viewPort.left())*SCREEN_WIDTH)/actualWidth,
((lastPos.y()-m_viewPort.top())*SCREEN_HEIGHT)/actualHeight); ((lastPosy()-m_viewPort.top())*SCREEN_HEIGHT)/actualHeight);
#if (!defined Q_WS_MAEMO_5) && (!defined MEEGO_EDITION_HARMATTAN) && (!defined Q_WS_ANDROID) #if (!defined Q_WS_MAEMO_5) && (!defined MEEGO_EDITION_HARMATTAN) && (!defined Q_WS_ANDROID)
m_engine->HoldKey_NoRepeat(JGE_BTN_OK); m_engine->HoldKey_NoRepeat(JGE_BTN_OK);
#else #else
mMouseDownX = lastPos.x(); mMouseDownX = lastPosx();
mMouseDownY = lastPos.y(); mMouseDownY = lastPosy();
mLastFingerDownTime = g_startTimer.elapsed(); mLastFingerDownTime = g_startTimer.elapsed();
#endif #endif
} else if(lastPos.y()<m_viewPort.top()) { } else if(lastPosy()<m_viewPort.top()) {
m_engine->HoldKey_NoRepeat(JGE_BTN_MENU); m_engine->HoldKey_NoRepeat(JGE_BTN_MENU);
} else if(lastPos.y()>m_viewPort.bottom()) { } else if(lastPosy()>m_viewPort.bottom()) {
m_engine->HoldKey_NoRepeat(JGE_BTN_NEXT); m_engine->HoldKey_NoRepeat(JGE_BTN_NEXT);
} }
event->accept(); event->accept();
@@ -465,33 +465,33 @@ void WagicCore::mouseReleaseEvent(QMouseEvent *event)
{ {
if(event->button() == Qt::LeftButton) if(event->button() == Qt::LeftButton)
{ {
QPoint lastPos = event->pos(); m_lastPos = event->pos();
if (lastPos.y() >= m_viewPort.top() && if (lastPosy() >= m_viewPort.top() &&
lastPos.y() <= m_viewPort.bottom() && lastPosy() <= m_viewPort.bottom() &&
lastPos.x() <= m_viewPort.right() && lastPosx() <= m_viewPort.right() &&
lastPos.x() >= m_viewPort.left()) { lastPosx() >= m_viewPort.left()) {
#if (defined Q_WS_MAEMO_5) || (defined MEEGO_EDITION_HARMATTAN) || (defined Q_WS_ANDROID) #if (defined Q_WS_MAEMO_5) || (defined MEEGO_EDITION_HARMATTAN) || (defined Q_WS_ANDROID)
if(g_startTimer.elapsed() - mLastFingerDownTime <= kTapEventTimeout ) if(g_startTimer.elapsed() - mLastFingerDownTime <= kTapEventTimeout )
{ {
if(abs(mMouseDownX - lastPos.x()) < kHitzonePliancy && if(abs(mMouseDownX - lastPosx()) < kHitzonePliancy &&
abs(mMouseDownY - lastPos.y()) < kHitzonePliancy) abs(mMouseDownY - lastPosy()) < kHitzonePliancy)
{ {
m_engine->HoldKey_NoRepeat(JGE_BTN_OK); m_engine->HoldKey_NoRepeat(JGE_BTN_OK);
} }
} }
else if (g_startTimer.elapsed() - mLastFingerDownTime >= kSwipeEventMinDuration) else if (g_startTimer.elapsed() - mLastFingerDownTime >= kSwipeEventMinDuration)
{ // Let's swipe { // Let's swipe
m_engine->Scroll(lastPos.x()-mMouseDownX, lastPos.y()-mMouseDownY); m_engine->Scroll(lastPosx()-mMouseDownX, lastPosy()-mMouseDownY);
} }
#else #else
//#if (!defined Q_WS_MAEMO_5) && (!defined MEEGO_EDITION_HARMATTAN) //#if (!defined Q_WS_MAEMO_5) && (!defined MEEGO_EDITION_HARMATTAN)
m_engine->ReleaseKey(JGE_BTN_OK); m_engine->ReleaseKey(JGE_BTN_OK);
#endif #endif
m_engine->ReleaseKey(JGE_BTN_MENU); m_engine->ReleaseKey(JGE_BTN_MENU);
} else if(lastPos.y() < m_viewPort.top()) { } else if(lastPosy() < m_viewPort.top()) {
m_engine->ReleaseKey(JGE_BTN_MENU); m_engine->ReleaseKey(JGE_BTN_MENU);
} else if(lastPos.y() > m_viewPort.bottom()) { } else if(lastPosy() > m_viewPort.bottom()) {
m_engine->ReleaseKey(JGE_BTN_NEXT); m_engine->ReleaseKey(JGE_BTN_NEXT);
} }
event->accept(); event->accept();
@@ -517,15 +517,15 @@ void WagicCore::mouseMoveEvent(QMouseEvent *event)
int actualWidth = (int) JRenderer::GetInstance()->GetActualWidth(); int actualWidth = (int) JRenderer::GetInstance()->GetActualWidth();
int actualHeight = (int) JRenderer::GetInstance()->GetActualHeight(); int actualHeight = (int) JRenderer::GetInstance()->GetActualHeight();
QPoint lastPos = event->pos(); m_lastPos = event->pos();
if (lastPos.y() >= m_viewPort.top() && if (lastPosy() >= m_viewPort.top() &&
lastPos.y() <= m_viewPort.bottom() && lastPosy() <= m_viewPort.bottom() &&
lastPos.x() <= m_viewPort.right() && lastPosx() <= m_viewPort.right() &&
lastPos.x() >= m_viewPort.left()) { lastPosx() >= m_viewPort.left()) {
m_engine->LeftClicked( m_engine->LeftClicked(
((lastPos.x()-m_viewPort.left())*SCREEN_WIDTH)/actualWidth, ((lastPosx()-m_viewPort.left())*SCREEN_WIDTH)/actualWidth,
((lastPos.y()-m_viewPort.top())*SCREEN_HEIGHT)/actualHeight); ((lastPosy()-m_viewPort.top())*SCREEN_HEIGHT)/actualHeight);
event->accept(); event->accept();
} else { } else {
super::mouseMoveEvent(event); super::mouseMoveEvent(event);
+2
View File
@@ -106,6 +106,7 @@ public:
virtual int overflow(int c = EOF); virtual int overflow(int c = EOF);
virtual int underflow(); virtual int underflow();
virtual int sync(); virtual int sync();
using std::streambuf::setbuf;
virtual std::streambuf * setbuf(char * pr, int nLength); virtual std::streambuf * setbuf(char * pr, int nLength);
virtual std::streampos seekoff(std::streamoff, std::ios::seekdir, std::ios::openmode); virtual std::streampos seekoff(std::streamoff, std::ios::seekdir, std::ios::openmode);
@@ -131,6 +132,7 @@ public:
virtual int overflow(int c = EOF); virtual int overflow(int c = EOF);
virtual int underflow(); virtual int underflow();
virtual int sync(); virtual int sync();
using std::streambuf::setbuf;
virtual std::streambuf * setbuf(char * pr, int nLength); virtual std::streambuf * setbuf(char * pr, int nLength);
virtual std::streampos seekoff(std::streamoff, std::ios::seekdir, std::ios::openmode); virtual std::streampos seekoff(std::streamoff, std::ios::seekdir, std::ios::openmode);
+1 -1
View File
@@ -16,6 +16,6 @@ Wagic, the Homebrew, is a C++ game engine that allows to play card games against
It is highly customizable and allows the player to tweak the rules / create their own cards, their own themes, etc... It is highly customizable and allows the player to tweak the rules / create their own cards, their own themes, etc...
Info, Downloads, and more at http://wololo.net Info, downloads, discussions and more at http://wololo.net/forum/index.php
-![alt text](http://wololo.net/wagic/wp-content/uploads/2009/10/shop.jpg "Screenshot") -![alt text](http://wololo.net/wagic/wp-content/uploads/2009/10/shop.jpg "Screenshot")
@@ -80,7 +80,6 @@ public class SDLActivity extends Activity implements OnKeyListener
public Boolean mErrorHappened = false; public Boolean mErrorHappened = false;
public final static String RES_FOLDER = Environment.getExternalStorageDirectory().getPath() + "/Wagic/Res/"; public final static String RES_FOLDER = Environment.getExternalStorageDirectory().getPath() + "/Wagic/Res/";
public static String RES_FILENAME = "core_0184.zip"; public static String RES_FILENAME = "core_0184.zip";
public static final String RES_URL = "http://wagic.googlecode.com/files/";
public String systemFolder = Environment.getExternalStorageDirectory().getPath() + "/Wagic/Res/"; public String systemFolder = Environment.getExternalStorageDirectory().getPath() + "/Wagic/Res/";
private String userFolder; private String userFolder;
@@ -307,7 +306,7 @@ public class SDLActivity extends Activity implements OnKeyListener
private void startDownload() private void startDownload()
{ {
String url = RES_URL + RES_FILENAME; String url = getResourceUrl();
if (!checkStorageState()) if (!checkStorageState())
{ {
Log.e(TAG, "Error in initializing storage space."); Log.e(TAG, "Error in initializing storage space.");
@@ -437,7 +436,7 @@ public class SDLActivity extends Activity implements OnKeyListener
mContext = this.getApplicationContext(); mContext = this.getApplicationContext();
// get the current version of the app to set the core filename // get the current version of the app to set the core filename
String versionCodeString = getApplicationCode(); String versionCodeString = getApplicationCode();
RES_FILENAME = "core_" + versionCodeString + ".zip"; RES_FILENAME = getResourceName();
StorageOptions.determineStorageOptions(); StorageOptions.determineStorageOptions();
checkStorageLocationPreference(); checkStorageLocationPreference();
@@ -525,6 +524,9 @@ public class SDLActivity extends Activity implements OnKeyListener
} }
// C functions we call // C functions we call
public static native String getResourceUrl();
public static native String getResourceName();
public static native void nativeInit(); public static native void nativeInit();
public static native void nativeQuit(); public static native void nativeQuit();
File diff suppressed because it is too large Load Diff
+6 -10
View File
@@ -28204,7 +28204,7 @@ subtype=Equipment
[card] [card]
name=Executioner's Swing name=Executioner's Swing
text=Target creature that dealt damage this turn gets -5/-5 until end of turn. text=Target creature that dealt damage this turn gets -5/-5 until end of turn.
target=creature[damaged] target=creature[damager]
auto=-5/-5 ueot auto=-5/-5 ueot
mana={W}{B} mana={W}{B}
type=Instant type=Instant
@@ -31457,7 +31457,7 @@ toughness=2
[/card] [/card]
[card] [card]
name=Flourishing Defenses name=Flourishing Defenses
auto=@counteradded(-1/-1) from(creature|mybattlefield):may token(Elf Warrior,Creature elf warrior,1/1,green) auto=@counteradded(-1/-1) from(creature):may token(Elf Warrior,Creature elf warrior,1/1,green)
text=Whenever a -1/-1 counter is placed on a creature, you may put a 1/1 green Elf Warrior creature token onto the battlefield. text=Whenever a -1/-1 counter is placed on a creature, you may put a 1/1 green Elf Warrior creature token onto the battlefield.
mana={4}{G} mana={4}{G}
type=Enchantment type=Enchantment
@@ -37166,7 +37166,7 @@ type=Sorcery
[/card] [/card]
[card] [card]
name=Grave Pact name=Grave Pact
auto=@movedTo(creature|mygraveyard) from(mybattlefield):ability$!name(sacrifice) notatarget(creature|mybattlefield) sacrifice!$ opponent auto=@movedTo(creature|graveyard) from(mybattlefield):ability$!name(sacrifice) notatarget(creature|mybattlefield) sacrifice!$ opponent
text=Whenever a creature you control dies, each other player sacrifices a creature. text=Whenever a creature you control dies, each other player sacrifices a creature.
mana={1}{B}{B}{B} mana={1}{B}{B}{B}
type=Enchantment type=Enchantment
@@ -73586,7 +73586,7 @@ toughness=6
###The 2 cards below should stay together (Flip Card)### ###The 2 cards below should stay together (Flip Card)###
[card] [card]
name=Rune-Tail, Kitsune Ascendant name=Rune-Tail, Kitsune Ascendant
auto=this(controllerlife >30) all(this) flip(Rune-Tail's Essence) auto=this(controllerlife > 29) transforms((,newability[flip(Rune-Tail's Essence)]))
text=When you have 30 or more life, flip Rune-Tail, Kitsune Ascendant. text=When you have 30 or more life, flip Rune-Tail, Kitsune Ascendant.
mana={2}{W} mana={2}{W}
type=Legendary Creature type=Legendary Creature
@@ -78444,11 +78444,7 @@ toughness=2
[/card] [/card]
[card] [card]
name=Shifting Sky name=Shifting Sky
auto=choice name(choose white) all(this) transforms((,newability[lord(*[-land]) becomes(,white)])) forever auto=chooseacolor lord(*[-land]) becomes(,chosencolor) chooseend
auto=choice name(choose blue) all(this) transforms((,newability[lord(*[-land]) becomes(,blue)])) forever
auto=choice name(choose black) all(this) transforms((,newability[lord(*[-land]) becomes(,black)])) forever
auto=choice name(choose red) all(this) transforms((,newability[lord(*[-land]) becomes(,red)])) forever
auto=choice name(choose green) all(this) transforms((,newability[lord(*[-land]) becomes(,green)])) forever
text=As Shifting Sky enters the battlefield, choose a color. -- All nonland permanents are the chosen color. text=As Shifting Sky enters the battlefield, choose a color. -- All nonland permanents are the chosen color.
mana={2}{U} mana={2}{U}
type=Enchantment type=Enchantment
@@ -104302,4 +104298,4 @@ type=Land Creature
subtype=Forest Dryad subtype=Forest Dryad
power=1 power=1
toughness=1 toughness=1
[/card] [/card]
+3
View File
@@ -308,6 +308,9 @@ evil_presence3.txt
evil_presence_i647.txt evil_presence_i647.txt
evil_presence_i647_2.txt evil_presence_i647_2.txt
exaltedsourcekilled.txt exaltedsourcekilled.txt
executioners_swing.txt
executioners_swing2.txt
executioners_swing3.txt
explore.txt explore.txt
Faceless_Butcher.txt Faceless_Butcher.txt
fading.txt fading.txt
@@ -0,0 +1,42 @@
#NAME: Executioner's Swing
#DESC: Checks targetability
#DESC: Test that can target creature that damaged creature this turn
[INIT]
combatattackers
[PLAYER1]
inplay:Grizzly Bears
[PLAYER2]
inplay:Flying Men,Swamp,Plains
hand:Executioner's Swing
[DO]
Grizzly Bears
next
Flying Men
next
next
next
# second main
# kill bear
yes
Swamp
Plains
Executioner's Swing
Grizzly Bears
endinterruption
[ASSERT]
secondmain
[PLAYER1]
graveyard:Grizzly Bears
[PLAYER2]
graveyard:Executioner's Swing,Flying Men
inplay:Plains,Swamp
[END]
@@ -0,0 +1,42 @@
#NAME: Executioner's Swing
#DESC: Checks targetability
#DESC: Test that can target creature that damaged player
[INIT]
combatattackers
[PLAYER1]
inplay:Grizzly Bears
[PLAYER2]
inplay:Swamp,Plains
hand:Executioner's Swing
[DO]
Grizzly Bears
next
next
next
next
# second main
# kill bear
yes
Swamp
Plains
Executioner's Swing
Grizzly Bears
endinterruption
[ASSERT]
secondmain
[PLAYER1]
graveyard:Grizzly Bears
[PLAYER2]
graveyard:Executioner's Swing
inplay:Plains,Swamp
life:18
[END]
@@ -0,0 +1,34 @@
#NAME: Executioner's Swing
#DESC: Checks targetability
#DESC: Prove that can't target passive creature
[INIT]
secondmain
[PLAYER1]
inplay:Grizzly Bears
[PLAYER2]
manapool:{B}{W}
hand:Executioner's Swing
[DO]
# attempt to kill bear
yes
Swamp
Plains
Executioner's Swing
Grizzly Bears
endinterruption
[ASSERT]
secondmain
[PLAYER1]
inplay:Grizzly Bears
[PLAYER2]
hand:Executioner's Swing
manapool:{W}{B}
[END]
+4 -2
View File
@@ -3,7 +3,7 @@
<property file="build.properties" /> <property file="build.properties" />
<property file="build.number.properties" /> <property file="build.number.properties" />
<property environment="env"/> <property environment="env"/>
<path id="groovy.class.path" > <path id="groovy.class.path" >
<fileset dir="${groovy.dir}" /> <fileset dir="${groovy.dir}" />
</path> </path>
@@ -90,7 +90,9 @@ Author: Michael Nguyen
#define WAGIC_RESOURCE_VERSION VERSION_FILE(WAGIC_VERSION_MAJOR, WAGIC_VERSION_MEDIUM, WAGIC_VERSION_MINOR) #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_VERSION_STRING VERSION_STRINGIFY(WAGIC_VERSION)
#define WAGIC_CORE_VERSION_STRING "core_" VERSION_STRINGIFY(WAGIC_RESOURCE_VERSION) #define WAGIC_CORE_VERSION_STRING "core_" VERSION_STRINGIFY(WAGIC_RESOURCE_VERSION)
#define WAGIC_RESOURCE_NAME WAGIC_CORE_VERSION_STRING ".zip" #define WAGIC_RESOURCE_NAME "Wagic-core.zip"
#define WAGIC_RELEASE_NAME "${env.RELEASE_NAME}"
#define WAGIC_RESOURCE_URL "https://github.com/WagicProject/wagic/releases/download/" WAGIC_RELEASE_NAME "/" WAGIC_RESOURCE_NAME
#endif #endif
+1
View File
@@ -64,6 +64,7 @@ class CardDescriptor: public MTGCardInstance
string compareName; string compareName;
int CDopponentDamaged; int CDopponentDamaged;
int CDcontrollerDamaged; int CDcontrollerDamaged;
int CDdamager;
}; };
#endif #endif
-1
View File
@@ -17,7 +17,6 @@ private:
WSrcCards * setSrc; WSrcCards * setSrc;
SimpleMenu * menu; SimpleMenu * menu;
bool showMenu; bool showMenu;
bool showAlt;
bool saveMe; bool saveMe;
int mState; int mState;
int mDetailItem; int mDetailItem;
-1
View File
@@ -47,7 +47,6 @@ protected:
{ {
static const float HEIGHT; static const float HEIGHT;
unsigned attackers; unsigned attackers;
unsigned blockers;
unsigned currentAttacker; unsigned currentAttacker;
float height; float height;
+1
View File
@@ -65,6 +65,7 @@ public:
bool wasDealtDamage; bool wasDealtDamage;
bool damageToOpponent; bool damageToOpponent;
bool damageToController; bool damageToController;
bool damageToCreature;
bool mPropertiesChangedSinceLastUpdate; bool mPropertiesChangedSinceLastUpdate;
int reduxamount; int reduxamount;
int flanked; int flanked;
-1
View File
@@ -20,7 +20,6 @@ class SimplePopup: public JGuiController
private: private:
float mWidth, mX, mY; float mWidth, mX, mY;
int mMaxLines; int mMaxLines;
int mFontId;
DeckMetaData * mDeckInformation; DeckMetaData * mDeckInformation;
string mTitle; string mTitle;
WFont *mTextFont; WFont *mTextFont;
+4 -4
View File
@@ -1,12 +1,12 @@
#ifndef WRESOURCE_FWD_H #ifndef WRESOURCE_FWD_H
#define WRESOURCE_FWD_H #define WRESOURCE_FWD_H
#ifndef WP8 #if (__cplusplus > 199711L)
#include <boost/shared_ptr.hpp>
typedef boost::shared_ptr<JQuad> JQuadPtr;
#else
#include <memory> #include <memory>
typedef std::shared_ptr<JQuad> JQuadPtr; typedef std::shared_ptr<JQuad> JQuadPtr;
#else
#include <boost/shared_ptr.hpp>
typedef boost::shared_ptr<JQuad> JQuadPtr;
#endif #endif
#endif #endif
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef _DEBUG_H_ #ifndef _DEBUG_H_
#define _DEBUG_H_ #define _DEBUG_H_
#if ((defined WIN32) || (defined WP8)) #if ((defined WIN32) || (defined WP8)) && !defined(__MINGW32__)
#define snprintf sprintf_s #define snprintf sprintf_s
#endif #endif
+1 -1
View File
@@ -314,7 +314,7 @@ bool AIHints::canWeCombo(GameObserver* observer,MTGCardInstance * card,AIPlayerB
int comboPartsRestriction = 0; int comboPartsRestriction = 0;
if(gotCombo) if(gotCombo)
return gotCombo;//because more then one might be possible at any time. return gotCombo;//because more than one might be possible at any time.
if (hints[i]->hold.size()) if (hints[i]->hold.size())
{ {
for(unsigned int hPart = 0; hPart < hints[i]->hold.size(); hPart++) for(unsigned int hPart = 0; hPart < hints[i]->hold.size(); hPart++)
+2 -2
View File
@@ -445,7 +445,7 @@ int OrderedAIAction::getEfficiency()
} }
if ((drawer->getNumCards() >= p->game->library->nb_cards && (Targetable*)p == drawer->getTarget()) || (p->game->hand->nb_cards > 10 && (Targetable*)p == drawer->getTarget())) if ((drawer->getNumCards() >= p->game->library->nb_cards && (Targetable*)p == drawer->getTarget()) || (p->game->hand->nb_cards > 10 && (Targetable*)p == drawer->getTarget()))
{ {
//if the amount im drawing will mill me to death or i have more then 10 cards in hand, eff is 0; //if the amount im drawing will mill me to death or i have more than 10 cards in hand, eff is 0;
efficiency = 0; efficiency = 0;
} }
break; break;
@@ -853,7 +853,7 @@ ManaCost * AIPlayerBaka::getPotentialMana(MTGCardInstance * target)
if (card == target) if (card == target)
used[card] = true; //http://code.google.com/p/wagic/issues/detail?id=76 used[card] = true; //http://code.google.com/p/wagic/issues/detail?id=76
if (!used[card] && amp->isReactingToClick(card) && amp->output->getConvertedCost() == 1) if (!used[card] && amp->isReactingToClick(card) && amp->output->getConvertedCost() == 1)
{//ai can't use cards which produce more then 1 converted while using the old pMana method. {//ai can't use cards which produce more than 1 converted while using the old pMana method.
result->add(amp->output); result->add(amp->output);
used[card] = true; used[card] = true;
} }
+6 -9
View File
@@ -1994,28 +1994,23 @@ int AADynamic::resolve()
break; break;
case DYNAMIC_ABILITY_WHO_ITSELF: case DYNAMIC_ABILITY_WHO_ITSELF:
source = ((MTGCardInstance *) _target); source = ((MTGCardInstance *) _target);
_target = _target;
break; break;
case DYNAMIC_ABILITY_WHO_TARGETCONTROLLER: case DYNAMIC_ABILITY_WHO_TARGETCONTROLLER:
_target = _target;
secondaryTarget = ((MTGCardInstance *) _target)->controller(); secondaryTarget = ((MTGCardInstance *) _target)->controller();
break; break;
case DYNAMIC_ABILITY_WHO_TARGETOPPONENT: case DYNAMIC_ABILITY_WHO_TARGETOPPONENT:
_target = _target;
secondaryTarget = ((MTGCardInstance *) _target)->controller()->opponent(); secondaryTarget = ((MTGCardInstance *) _target)->controller()->opponent();
break; break;
case DYNAMIC_ABILITY_WHO_TOSOURCE: case DYNAMIC_ABILITY_WHO_TOSOURCE:
tosrc = true; tosrc = true;
break; break;
case DYNAMIC_ABILITY_WHO_SOURCECONTROLLER: case DYNAMIC_ABILITY_WHO_SOURCECONTROLLER:
_target = _target;
secondaryTarget = ((MTGCardInstance *) OriginalSrc)->controller(); secondaryTarget = ((MTGCardInstance *) OriginalSrc)->controller();
break; break;
case DYNAMIC_ABILITY_WHO_SOURCEOPPONENT: case DYNAMIC_ABILITY_WHO_SOURCEOPPONENT:
secondaryTarget = OriginalSrc->controller()->opponent(); secondaryTarget = OriginalSrc->controller()->opponent();
break; break;
default: default:
_target = _target;
break; break;
} }
if(amountsource == DYNAMIC_MYSELF_AMOUNT) if(amountsource == DYNAMIC_MYSELF_AMOUNT)
@@ -4728,14 +4723,15 @@ void AVanishing::Update(float dt)
int AVanishing::resolve() int AVanishing::resolve()
{ {
return 1; return 1;
} }
const string AVanishing::getMenuText() const string AVanishing::getMenuText()
{ {
if(counterName.find("fade") != string::npos) if (counterName.find("fade") != string::npos)
return "Fading"; {
return "Fading";
}
return "Vanishing"; return "Vanishing";
} }
@@ -5708,7 +5704,8 @@ void ATutorialMessage::Update(float dt)
mElapsed += dt; mElapsed += dt;
IconButtonsController::Update(dt); if(!mUserCloseRequest)
IconButtonsController::Update(dt);
if (mIsImage) if (mIsImage)
return; return;
+19 -7
View File
@@ -23,6 +23,7 @@ CardDescriptor::CardDescriptor()
colorComparisonMode = COMPARISON_NONE; colorComparisonMode = COMPARISON_NONE;
CDopponentDamaged = 0; CDopponentDamaged = 0;
CDcontrollerDamaged = 0; CDcontrollerDamaged = 0;
CDdamager = 0;
} }
int CardDescriptor::init() int CardDescriptor::init()
@@ -226,16 +227,27 @@ MTGCardInstance * CardDescriptor::match(MTGCardInstance * card)
{ {
match = NULL; match = NULL;
} }
if(CDopponentDamaged == -1 || CDopponentDamaged == 1)
{ if ((CDdamager == -1 && (card->damageToOpponent || card->damageToController || card->damageToCreature))
Player * p = card->controller()->opponent();//controller()->opponent(); || (CDdamager == 1 && !(card->damageToOpponent || card->damageToController || card->damageToCreature)))
if ((CDopponentDamaged == -1 && card->damageToOpponent && card->controller() == p) || (CDopponentDamaged == 1 && !card->damageToOpponent && card->controller() == p)
|| (CDopponentDamaged == -1 && card->damageToController && card->controller() == p->opponent()) || (CDopponentDamaged == 1 && !card->damageToController && card->controller() == p->opponent()))
{ {
match = NULL; match = NULL;
} }
if ((CDcontrollerDamaged == -1 && card->damageToController && card->controller() == p) || (CDcontrollerDamaged == 1 && !card->damageToController && card->controller() == p)
|| (CDcontrollerDamaged == -1 && card->damageToOpponent && card->controller() == p->opponent()) || (CDcontrollerDamaged == 1 && !card->damageToOpponent && card->controller() == p->opponent())) if(CDopponentDamaged == -1 || CDopponentDamaged == 1)
{
Player * p = card->controller()->opponent();//controller()->opponent();
if ((CDopponentDamaged == -1 && card->damageToOpponent && card->controller() == p)
|| (CDopponentDamaged == 1 && !card->damageToOpponent && card->controller() == p)
|| (CDopponentDamaged == -1 && card->damageToController && card->controller() == p->opponent())
|| (CDopponentDamaged == 1 && !card->damageToController && card->controller() == p->opponent()))
{
match = NULL;
}
if ((CDcontrollerDamaged == -1 && card->damageToController && card->controller() == p)
|| (CDcontrollerDamaged == 1 && !card->damageToController && card->controller() == p)
|| (CDcontrollerDamaged == -1 && card->damageToOpponent && card->controller() == p->opponent())
|| (CDcontrollerDamaged == 1 && !card->damageToOpponent && card->controller() == p->opponent()))
{ {
match = NULL; match = NULL;
} }
+12
View File
@@ -1224,6 +1224,18 @@ bool CardGui::FilterCard(MTGCard * _card,string filter)
cd.CDcontrollerDamaged = 1; cd.CDcontrollerDamaged = 1;
} }
} }
//creature dealt damage to anything
else if (attribute.find("damager") != string::npos)
{
if (minus)
{
cd.CDdamager = -1;
}
else
{
cd.CDdamager = 1;
}
}
else if (attribute.find("multicolor") != string::npos) else if (attribute.find("multicolor") != string::npos)
{ {
//card is multicolored? //card is multicolored?
+1 -1
View File
@@ -386,7 +386,7 @@ void Credits::computeTournament(GameObserver* g, GameApp * _app,bool tournament,
} }
if (mGamesWon>mGamesPlayed*0.80 && mGamesWon<mGamesPlayed) if (mGamesWon>mGamesPlayed*0.80 && mGamesWon<mGamesPlayed)
{ {
CreditBonus * b = NEW CreditBonus(250, _("Won more then 80 percentage of games")); CreditBonus * b = NEW CreditBonus(250, _("Won more than 80 percentage of games"));
bonus.push_back(b); bonus.push_back(b);
} }
+3 -1
View File
@@ -192,8 +192,10 @@ int Damage::resolve()
//return the left over amount after effects have been applied to them. //return the left over amount after effects have been applied to them.
a = target->dealDamage(damage); a = target->dealDamage(damage);
target->damageCount += damage;//the amount must be the actual damage so i changed this from 1 to damage, this fixes pdcount and odcount target->damageCount += damage;//the amount must be the actual damage so i changed this from 1 to damage, this fixes pdcount and odcount
if (target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE) if (target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE){
((MTGCardInstance*)target)->wasDealtDamage = true; ((MTGCardInstance*)target)->wasDealtDamage = true;
((MTGCardInstance*)source)->damageToCreature = true;
}
if (target->type_as_damageable == Damageable::DAMAGEABLE_PLAYER) if (target->type_as_damageable == Damageable::DAMAGEABLE_PLAYER)
{ {
if(target == source->controller()) if(target == source->controller())
+1
View File
@@ -795,6 +795,7 @@ void GameObserver::gameStateBasedEffects()
c->wasDealtDamage = false; c->wasDealtDamage = false;
c->damageToController = false; c->damageToController = false;
c->damageToOpponent = false; c->damageToOpponent = false;
c->damageToCreature = false;
c->isAttacking = NULL; c->isAttacking = NULL;
} }
for (int t = 0; t < nbcards; t++) for (int t = 0; t < nbcards; t++)
+1 -1
View File
@@ -796,7 +796,7 @@ void GameStateDuel::Update(float dt)
if (game->didWin()) if (game->didWin())
{ {
//the following section will be called only in a classic or demo gamemode and if a tournament or match with more then one game is activ //the following section will be called only in a classic or demo gamemode and if a tournament or match with more than one game is activ
if ( (mParent->gameType == GAME_TYPE_CLASSIC || mParent->gameType == GAME_TYPE_DEMO)&& mParent->players[1] == PLAYER_TYPE_CPU && (tournament->isTournament() || tournament->getGamesToPlay()>1 )) if ( (mParent->gameType == GAME_TYPE_CLASSIC || mParent->gameType == GAME_TYPE_DEMO)&& mParent->players[1] == PLAYER_TYPE_CPU && (tournament->isTournament() || tournament->getGamesToPlay()>1 ))
{ {
setGamePhase(DUEL_STATE_SHOW_SCORE); setGamePhase(DUEL_STATE_SHOW_SCORE);
+17 -12
View File
@@ -215,34 +215,39 @@ void GameStateOptions::Render()
const char * const CreditsText[] = { const char * const CreditsText[] = {
"Wagic, The Homebrew?! by Wololo", "Wagic, The Homebrew?! by Wololo",
"", "",
"updates, new cards, and more on http://wololo.net/wagic", "Updates, new cards, and more on http://wololo.net/wagic",
"Many thanks to the people who help this project", "Many thanks to the people who help this project",
"", "",
"", "",
"Art: Ilya B, Julio, Jeck, J, Kaioshin, Lakeesha", "Art:",
"Ilya B, Julio, Jeck, J, Kaioshin, Lakeesha",
"Check themeinfo.txt for the full credits of each theme!", "Check themeinfo.txt for the full credits of each theme!",
"", "",
"Dev Team:", "Dev Team:",
"Abrasax, Almosthumane, Daddy32, DJardin, Dr.Solomat,", "Abrasax, Almosthumane, Daddy32, DJardin, Dr.Solomat, J, Jeck,",
"J, Jeck, kevlahnota, Leungclj, linshier, Mootpoint, Mnguyen,", "kevlahnota, Leungclj, linshier, Mootpoint, Mnguyen, Psyringe,",
"Psyringe, Salmelo, Superhiro, Wololo, Yeshua, Zethfox", "Rolzad73, Salmelo, Superhiro, Wololo, Yeshua, Zethfox",
"", "",
"Music by Celestial Aeon Project, http://www.jamendo.com", "Music by Celestial Aeon Project, http://www.jamendo.com",
"", "",
"Deck Builders: Abrasax, AzureKnight, colarchon", "Deck Builders:",
"Excessum, Hehotfarv, Jeremy, Jog1118, JonyAS", "Abrasax, AzureKnight, colarchon, Excessum, Hehotfarv,",
"Lachaux, Link17, Muddobbers, Nakano, Niegen", "Jeremy, Jog1118, JonyAS, Lachaux, Link17, Muddobbers,",
"Kaioshin, Psyringe, r1c47, Superhiro, Szei", "Nakano, Niegen, Kaioshin, Psyringe, r1c47, Superhiro,",
"Thanatos02, Whismer, Wololo", "Szei, Thanatos02, Whismer, Wololo",
"", "",
"Thanks also go to Dr.Watson, Orine, Raphael, Sakya, Tyranid", "Thanks also go to Dr.Watson, Orine, Raphael, Sakya, Tyranid",
"for their help.", "for their help.",
"", "",
"Thanks to everyone who contributes code/content on the forums!", "Thanks to everyone who contributes code/content on the forums!",
"", "",
"Developed with the JGE++ Library (http://code.google.com/p/wagic)", "",
"Source:",
"http://code.google.com/p/wagic (2009-2013)",
"https://github.com/WagicProject/wagic (2013- )",
"",
"Developed with the JGE++ Library",
"SFX From www.soundsnap.com", "SFX From www.soundsnap.com",
"", "",
"", "",
"This work is not related to or endorsed by Wizards of the Coast, Inc", "This work is not related to or endorsed by Wizards of the Coast, Inc",
+1 -1
View File
@@ -103,7 +103,7 @@ inline float GuiPlay::VertStack::nextX()
} }
GuiPlay::BattleField::BattleField() : GuiPlay::BattleField::BattleField() :
attackers(0), blockers(0), height(0.0), red(0), colorFlow(0) attackers(0), height(0.0), red(0), colorFlow(0)
{ {
} }
const float GuiPlay::BattleField::HEIGHT = 80.0f; const float GuiPlay::BattleField::HEIGHT = 80.0f;
-2
View File
@@ -4276,8 +4276,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell)
if (card->hasType(Subtypes::TYPE_INSTANT) || card->hasType(Subtypes::TYPE_SORCERY)) if (card->hasType(Subtypes::TYPE_INSTANT) || card->hasType(Subtypes::TYPE_SORCERY))
{ {
MTGPlayerCards * zones = card->owner->game; MTGPlayerCards * zones = card->owner->game;
if(card->getCurrentZone())
card->currentZone->owner->game;//grab it from where ever it is.
MTGPlayerCards * Endzones = card->owner->game;//put them in thier owners respective zones as per rules. MTGPlayerCards * Endzones = card->owner->game;//put them in thier owners respective zones as per rules.
if (card->basicAbilities[(int)Constants::EXILEDEATH]) if (card->basicAbilities[(int)Constants::EXILEDEATH])
{ {
+1
View File
@@ -158,6 +158,7 @@ void MTGCardInstance::initMTGCI()
auras = 0; auras = 0;
damageToOpponent = false; damageToOpponent = false;
damageToController = false; damageToController = false;
damageToCreature = false;
wasDealtDamage = false; wasDealtDamage = false;
isDualWielding = false; isDualWielding = false;
suspended = false; suspended = false;
+1 -1
View File
@@ -146,7 +146,7 @@ int MTGEventBonus::receiveEvent(WEvent * event)
} }
//////bonus for having a LOT of specific type. //////bonus for having a LOT of specific type.
//not else'd becuase it is possible for a card to contain //not else'd becuase it is possible for a card to contain
//more then one of the types, and for more then one to trigger. //more than one of the types, and for more than one to trigger.
if(e->card->hasType(Subtypes::TYPE_ARTIFACT)) if(e->card->hasType(Subtypes::TYPE_ARTIFACT))
toys[currentPlayer->getId()]++; toys[currentPlayer->getId()]++;
if(e->card->isCreature()) if(e->card->isCreature())
+1 -1
View File
@@ -15,7 +15,7 @@
#include <iomanip> #include <iomanip>
SimplePopup::SimplePopup(int id, JGuiListener* listener, const int fontId, const char * _title, DeckMetaData* deckMetaData, MTGAllCards * collection, float cancelX, float cancelY) : SimplePopup::SimplePopup(int id, JGuiListener* listener, const int fontId, const char * _title, DeckMetaData* deckMetaData, MTGAllCards * collection, float cancelX, float cancelY) :
JGuiController(JGE::GetInstance(), id, listener), mFontId(fontId), mCollection(collection) JGuiController(JGE::GetInstance(), id, listener), mCollection(collection)
{ {
mX = 19; mX = 19;
mY = 66; mY = 66;
+12
View File
@@ -485,6 +485,18 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
cd->CDcontrollerDamaged = 1; cd->CDcontrollerDamaged = 1;
} }
} }
//creature dealt damage to anything
else if (attribute.find("damager") != string::npos)
{
if (minus)
{
cd->CDdamager = -1;
}
else
{
cd->CDdamager = 1;
}
}
else if (attribute.find("multicolor") != string::npos) else if (attribute.find("multicolor") != string::npos)
{ {
//card is multicolored? //card is multicolored?
+10 -7
View File
@@ -4,11 +4,11 @@ TEMPLATE = app
#!macx:CONFIG += precompile_header #!macx:CONFIG += precompile_header
unix|macx:QMAKE_CXXFLAGS += -Wno-unused-parameter unix|macx:QMAKE_CXXFLAGS += -Wno-unused-parameter
unix:!macx:QMAKE_CXXFLAGS += -Wno-unused-but-set-parameter unix:!*macx*:QMAKE_CXXFLAGS += -Wno-unused-but-set-parameter
unix:!macx:QMAKE_CXXFLAGS += -Wno-unused-but-set-variable unix:!*macx*:QMAKE_CXXFLAGS += -Wno-unused-but-set-variable
unix|macx:QMAKE_CXXFLAGS += -Wno-unused-value unix|*macx*:QMAKE_CXXFLAGS += -Wno-unused-value
unix:!macx:QMAKE_CXXFLAGS += -Wno-unused-local-typedefs unix:!*macx*:QMAKE_CXXFLAGS += -Wno-unused-local-typedefs
unix:!macx:!maemo5:!symbian:QMAKE_CXXFLAGS += -Werror unix:!*macx*:!maemo5:!symbian:QMAKE_CXXFLAGS += -Werror
windows:DEFINES += _CRT_SECURE_NO_WARNINGS windows:DEFINES += _CRT_SECURE_NO_WARNINGS
unix|macx:DEFINES += LINUX unix|macx:DEFINES += LINUX
@@ -27,6 +27,7 @@ windows{
# INCLUDEPATH += /usr/i686-w64-mingw32/sys-root/mingw/include/c++ # INCLUDEPATH += /usr/i686-w64-mingw32/sys-root/mingw/include/c++
LIBS += -L/usr/i686-w64-mingw32/sys-root/mingw/lib LIBS += -L/usr/i686-w64-mingw32/sys-root/mingw/lib
LIBS += -lwsock32 LIBS += -lwsock32
DEFINES += FORCE_GL2
} }
*-msvc* { *-msvc* {
INCLUDEPATH += extra INCLUDEPATH += extra
@@ -40,8 +41,8 @@ INCLUDEPATH += ../../Boost
INCLUDEPATH += include INCLUDEPATH += include
unix:!symbian:LIBS += -lz unix:!symbian:LIBS += -lz
win32:LIBS += ../../JGE/Dependencies/lib/fmodvc.lib windows:LIBS += ../../JGE/Dependencies/lib/fmodvc.lib
win32:LIBS += ../../JGE/Dependencies/lib/zlibd.lib windows:LIBS += ../../JGE/Dependencies/lib/zlibd.lib
PRECOMPILED_HEADER = include/PrecompiledHeader.h PRECOMPILED_HEADER = include/PrecompiledHeader.h
#DEFINES += TRACK_OBJECT_USAGE #DEFINES += TRACK_OBJECT_USAGE
@@ -282,6 +283,7 @@ HEADERS += \
# JGE, could probably be moved outside # JGE, could probably be moved outside
SOURCES += \ SOURCES += \
../../JGE/src/Downloader.cpp\
../../JGE/src/Encoding.cpp\ ../../JGE/src/Encoding.cpp\
../../JGE/src/JAnimator.cpp\ ../../JGE/src/JAnimator.cpp\
../../JGE/src/JApp.cpp\ ../../JGE/src/JApp.cpp\
@@ -319,6 +321,7 @@ SOURCES += \
../../JGE/src/zipFS/zstream.cpp ../../JGE/src/zipFS/zstream.cpp
HEADERS += \ HEADERS += \
../../JGE/include/Downloader.h\
../../JGE/include/Threading.h\ ../../JGE/include/Threading.h\
../../JGE/include/decoder_prx.h\ ../../JGE/include/decoder_prx.h\
../../JGE/include/DebugRoutines.h\ ../../JGE/include/DebugRoutines.h\
+56 -14
View File
@@ -5,12 +5,35 @@ echo PSPDEV = $PSPDEV
echo psp-config = `psp-config --psp-prefix` echo psp-config = `psp-config --psp-prefix`
echo ls = `ls` echo ls = `ls`
echo pwd = `pwd` echo pwd = `pwd`
# computing potential release name
echo TRAVIS_PULL_REQUEST = $TRAVIS_PULL_REQUEST
echo TRAVIS_BRANCH = $TRAVIS_BRANCH
if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then
if [ "$TRAVIS_BRANCH" = "alphas" ]; then
export RELEASE_NAME="alpha-${TRAVIS_BUILD_NUMBER}"
else if [ "$TRAVIS_BRANCH" = "master" ]; then
export RELEASE_NAME="latest-master"
fi
fi
fi
echo RELEASE_NAME = $RELEASE_NAME
# updating versions with the TRAVIS build numbers # updating versions with the TRAVIS build numbers
cd projects/mtg/ cd projects/mtg/
ant update > error.txt ant update > error.txt
cd ../.. cd ../..
# we create resource package
cd projects/mtg/bin/Res
python createResourceZip.py
# if we let the zip here, Wagic will use it in the testsuite
# and we'll get 51 failed test cases
mv core_*.zip ../../../../core.zip
cd ../../../..
# we're building a PSP binary here # we're building a PSP binary here
cd JGE cd JGE
make -j 8 make -j 8
@@ -18,11 +41,18 @@ cd ..
cd projects/mtg cd projects/mtg
mkdir objs mkdir objs
make -j 8 make -j 8
mkdir psprelease mkdir WTH
mv EBOOT.PBP psprelease/ mkdir WTH/Res
mv wagic.elf psprelease/ mv EBOOT.PBP WTH/
mv wagic.prx psprelease/ mv ../../JGE/exceptionHandler/prx/exception.prx WTH/
zip psprelease.zip -r psprelease/ cp ../../core.zip WTH/Res
cd WTH/Res
unzip core.zip
rm core.zip
cd ..
chmod -R 775 Res
cd ..
zip psprelease.zip -r WTH/
cd ../.. cd ../..
# we're building an Android binary here # we're building an Android binary here
@@ -34,7 +64,7 @@ ant debug -f projects/mtg/Android/build.xml
# we're building a Qt version with GUI here # we're building a Qt version with GUI here
mkdir qt-gui-build mkdir qt-gui-build
cd qt-gui-build cd qt-gui-build
qmake ../projects/mtg/wagic-qt.pro CONFIG+=release CONFIG+=graphics qmake ../projects/mtg/wagic-SDL.pro CONFIG+=release CONFIG+=graphics
make -j 8 make -j 8
cd .. cd ..
@@ -42,16 +72,28 @@ cd ..
qmake projects/mtg/wagic-qt.pro CONFIG+=console CONFIG+=debug DEFINES+=CAPTURE_STDERR qmake projects/mtg/wagic-qt.pro CONFIG+=console CONFIG+=debug DEFINES+=CAPTURE_STDERR
make -j 8 make -j 8
# we create resource package # we're cross-compiling a Qt Windows version here,
cd projects/mtg/bin/Res # PATH is only set here to prevent colision
python createResourceZip.py export PATH="$PATH:/opt/mingw32/bin"
# if we let the zip here, Wagic will use it in the testsuite mkdir build
# and we'll get 51 failed test cases cd build
mv core_*.zip ../../../../core.zip mkdir win-cross
cd ../../../.. cd win-cross
/opt/mingw32/bin/qmake ../../projects/mtg/wagic-qt.pro CONFIG+=release CONFIG+=graphics
make -j 8
cd release
cp ../../../projects/mtg/bin/fmod.dll .
cp /opt/mingw32/bin/QtCore4.dll .
cp /opt/mingw32/bin/QtGui4.dll .
cp /opt/mingw32/bin/QtNetwork4.dll .
cp /opt/mingw32/bin/QtOpenGL4.dll .
cp ../../../projects/mtg/bin/zlib1.dll .
cp /opt/mingw32/bin/libpng15-15.dll .
cd ..
zip win-cross.zip -r release/
cd ../..
# Now we run the testsuite (Res needs to be in the working directory) # Now we run the testsuite (Res needs to be in the working directory)
cd projects/mtg cd projects/mtg
../../wagic ../../wagic
cd ../.. cd ../..
+71 -3
View File
@@ -10,21 +10,89 @@ if [ "$TRAVIS_BRANCH" == "alphas" ]; then
-H "Accept: application/vnd.github.manifold-preview" \ -H "Accept: application/vnd.github.manifold-preview" \
-H "Content-Type: application/zip" \ -H "Content-Type: application/zip" \
--data-binary @core.zip \ --data-binary @core.zip \
"https://uploads.github.com/repos/WagicProject/wagic/releases/${IDDI}/assets?name=Wagic-core-${TRAVIS_BUILD_NUMBER}.zip" "https://uploads.github.com/repos/WagicProject/wagic/releases/${IDDI}/assets?name=Wagic-core.zip"
echo -e "Uploading android package\n" echo -e "Uploading android package\n"
curl -X POST -H "Authorization: token ${GH_TOKEN}" \ curl -X POST -H "Authorization: token ${GH_TOKEN}" \
-H "Accept: application/vnd.github.manifold-preview" \ -H "Accept: application/vnd.github.manifold-preview" \
-H "Content-Type: application/zip" \ -H "Content-Type: application/zip" \
--data-binary @projects/mtg/Android/bin/Wagic-debug.apk \ --data-binary @projects/mtg/Android/bin/Wagic-debug.apk \
"https://uploads.github.com/repos/WagicProject/wagic/releases/${IDDI}/assets?name=Wagic-android-${TRAVIS_BUILD_NUMBER}.apk" "https://uploads.github.com/repos/WagicProject/wagic/releases/${IDDI}/assets?name=Wagic-android.apk"
echo -e "Uploading PSP package\n" echo -e "Uploading PSP package\n"
curl -X POST -H "Authorization: token ${GH_TOKEN}" \ curl -X POST -H "Authorization: token ${GH_TOKEN}" \
-H "Accept: application/vnd.github.manifold-preview" \ -H "Accept: application/vnd.github.manifold-preview" \
-H "Content-Type: application/zip" \ -H "Content-Type: application/zip" \
--data-binary @projects/mtg/psprelease.zip \ --data-binary @projects/mtg/psprelease.zip \
"https://uploads.github.com/repos/WagicProject/wagic/releases/${IDDI}/assets?name=Wagic-psp-${TRAVIS_BUILD_NUMBER}.zip" "https://uploads.github.com/repos/WagicProject/wagic/releases/${IDDI}/assets?name=Wagic-psp.zip"
echo -e "Uploading Windows package\n"
curl -X POST -H "Authorization: token ${GH_TOKEN}" \
-H "Accept: application/vnd.github.manifold-preview" \
-H "Content-Type: application/zip" \
--data-binary @build/win-cross/win-cross.zip \
"https://uploads.github.com/repos/WagicProject/wagic/releases/${IDDI}/assets?name=Wagic-windows.zip"
echo -e "Done uploading\n"
fi
fi
if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
if [ "$TRAVIS_BRANCH" == "master" ]; then
# get info about all releases
echo -e "Getting info about previous releases"
curl -X GET -H "Authorization: token ${GH_TOKEN}" \
"https://api.github.com/repos/WagicProject/wagic/releases" > json.txt
# extract info only about only "latest-release" tag
cat json.txt |jq 'map(select (.tag_name == "latest-master"))' > latest.txt
# get id of release
ID_TO_DELETE=`cat latest.txt |jq '.[0].id'`
# delete previous release
echo -e "Deleting release number ${ID_TO_DELETE}"
curl -X DELETE -H "Authorization: token ${GH_TOKEN}" \
"https://api.github.com/repos/WagicProject/wagic/releases/${ID_TO_DELETE}"
# delete previous tag
curl -X DELETE -H "Authorization: token ${GH_TOKEN}" \
"https://api.github.com/repos/WagicProject/wagic/git/refs/tags/latest-master"
echo -e "Creating a release\n"
curl -X POST -H "Authorization: token ${GH_TOKEN}" \
-d '{"tag_name": "latest-master", "target_commitish": "master", "name": "master-'${TRAVIS_BUILD_NUMBER}'", "body": "Automatic release based on latest commit to master branch generated by Travis CI", "draft": false, "prerelease": true}' "https://api.github.com/repos/WagicProject/wagic/releases" > json.txt
IDDI=`cat json.txt | jq '.id'`
echo -e "Uploading Core resources\n"
curl -X POST -H "Authorization: token ${GH_TOKEN}" \
-H "Accept: application/vnd.github.manifold-preview" \
-H "Content-Type: application/zip" \
--data-binary @core.zip \
"https://uploads.github.com/repos/WagicProject/wagic/releases/${IDDI}/assets?name=Wagic-core.zip"
echo -e "Uploading android package\n"
curl -X POST -H "Authorization: token ${GH_TOKEN}" \
-H "Accept: application/vnd.github.manifold-preview" \
-H "Content-Type: application/zip" \
--data-binary @projects/mtg/Android/bin/Wagic-debug.apk \
"https://uploads.github.com/repos/WagicProject/wagic/releases/${IDDI}/assets?name=Wagic-android.apk"
echo -e "Uploading PSP package\n"
curl -X POST -H "Authorization: token ${GH_TOKEN}" \
-H "Accept: application/vnd.github.manifold-preview" \
-H "Content-Type: application/zip" \
--data-binary @projects/mtg/psprelease.zip \
"https://uploads.github.com/repos/WagicProject/wagic/releases/${IDDI}/assets?name=Wagic-psp.zip"
echo -e "Uploading Windows package\n"
curl -X POST -H "Authorization: token ${GH_TOKEN}" \
-H "Accept: application/vnd.github.manifold-preview" \
-H "Content-Type: application/zip" \
--data-binary @build/win-cross/win-cross.zip \
"https://uploads.github.com/repos/WagicProject/wagic/releases/${IDDI}/assets?name=Wagic-windows.zip"
echo -e "Done uploading\n" echo -e "Done uploading\n"
fi fi