Compare commits

..

163 Commits

Author SHA1 Message Date
xawotihs 292bf7b1d2 Merge branch 'ci_upload_binaries' 2013-12-08 00:33:42 +01:00
xawotihs 4041fe690b Create a release and parse its ID using jq. 2013-12-08 00:16:52 +01:00
xawotihs cb73e2b90d Merge branch 'master' into ci_upload_binaries
Fixed Windows compilation.
2013-12-07 22:08:54 +01:00
ZobyTwo a1fa36a934 Merge pull request #578 from ZobyTwo/deck_viewer_1
Reset positions and filters when reopening the editor. These changes are trivial so I will merge them.
2013-12-07 11:53:16 -08:00
Tobias Loose bdd0e6c042 Reset positions and filters when reopening the editor 2013-12-07 20:47:50 +01:00
xawotihs ee217e94a8 Fixed carousel pull request with Visual Studio. 2013-12-07 20:29:42 +01:00
xawotihs 38e19f7d35 Removed mingw32-qt
Merged SDL and QT .pro files
Removed glu dependency in corewrapper and JGfx to enable mingw cross compilation.
2013-12-07 18:57:57 +01:00
xawotihs 0bbfd00d15 Tries to install mingw32-qt on Travis 2013-12-07 18:31:02 +01:00
Tobias Loose aaceb3c038 Remove unused declaration 2013-12-07 13:33:16 +01:00
Tobias Loose 5efa7e10bd Remove test debug output. Fix HUD fading. 2013-12-07 13:01:14 +01:00
Tobias Loose 14c164364e Cleanups and state reduction.
This mainly moves datamembers around and tries to avoid caching of
results of calculations when the calculations are cheap.
2013-12-07 12:58:20 +01:00
Tobias Loose 4514725aba Make the eased value a reference and add source code doc to Easing.h
This allows to apply multiple easings to the same variable.
2013-12-07 10:05:26 +01:00
Tobias Loose 2b0f50bb88 Remove redundancy and make control flow a bit simpler 2013-12-07 09:04:24 +01:00
xawotihs a65fc0c0f0 Merge branch 'master' into ci_upload_binaries
sudo pip installation of pyjavaproperties
2013-12-06 22:52:32 +01:00
xawotihs 99db363253 Uses pip to install pyjavaproperties 2013-12-06 22:41:09 +01:00
xawotihs c25dfec67e Fixed python module installation 2013-12-06 22:17:19 +01:00
xawotihs dd7210d187 Install pyjavaproperties in travis. 2013-12-06 21:59:29 +01:00
xawotihs 904b7a6d86 Build and upload core resource package 2013-12-06 21:21:01 +01:00
Tobias Loose 31b353c5ec Use easing within the carousel view sliding 2013-12-06 21:04:21 +01:00
Tobias Loose 0d350af1b6 Use easing within the carousel views scrolling
It is visible if you scroll more than one card
2013-12-06 20:51:18 +01:00
xawotihs 3bc9c93bab Build and upload PSP binary archive. 2013-12-06 20:40:02 +01:00
Tobias Loose 2002bb4e16 Fix crash that occured when opening the editor a second time 2013-12-06 20:13:30 +01:00
Tobias Loose 7e9c4ddbdd Fix logic error in optimization introduced in last commit 2013-12-06 19:53:38 +01:00
Tobias Loose 12b71de63c Render small cards as thumbnails 2013-12-06 19:51:42 +01:00
Tobias Loose 15011961f4 Do only prefetch cards if resource management is threaded 2013-12-06 16:43:09 +01:00
xawotihs b851103711 Commented out the release creation and refered an existing release instead. 2013-12-06 00:47:24 +01:00
xawotihs 67b8af8d15 Merge branch 'ci_upload_binaries' of https://github.com/WagicProject/wagic into ci_upload_binaries 2013-12-06 00:41:16 +01:00
xawotihs 8100e390b1 I'm starting to understand the stuff, the upload only works with a releaseId... 2013-12-06 00:10:36 +01:00
Tobias Loose 72e6876001 Remove temporary and binary files 2013-12-05 23:57:03 +01:00
Tobias Loose 96aeaffa1b Style and logic error. 2013-12-05 23:33:43 +01:00
xawotihs 74faa35b91 Removed useless local file copy before upload. 2013-12-05 23:27:40 +01:00
Tobias Loose 8bb58ca3b1 Put boilerplate code into easing base class 2013-12-05 23:27:28 +01:00
Tobias Loose 93d1a637b6 Style guide 2013-12-05 23:22:50 +01:00
xawotihs 30e86ffcd8 Update script to handle better variables. 2013-12-05 23:09:06 +01:00
Tobias Loose cbe6c0c842 Parameterize animations in grid deck view 2013-12-05 23:06:32 +01:00
Tobias Loose 77eb7f2777 Add missing header 2013-12-05 23:06:32 +01:00
Tobias Loose 077ab10c05 Rename Button to ButtonPressed 2013-12-05 23:06:32 +01:00
Tobias Loose 1194463349 Let the deck view base class handle buttons 2013-12-05 23:06:32 +01:00
Tobias Loose 8de50532f2 Put easing code into Easing.h. Add easing to sliding 2013-12-05 23:06:31 +01:00
Tobias Loose 334454655d Add Easing code to make scrolling in grid view more fluid 2013-12-05 23:06:31 +01:00
Tobias Loose d8d52e185d Add another missing include 2013-12-05 23:06:31 +01:00
Tobias Loose 9f1d225259 Add additional source files to various build systems 2013-12-05 23:06:30 +01:00
Tobias Loose 0c72bfd4c4 Make deck views toggleable 2013-12-05 23:06:30 +01:00
Tobias Loose 55e0366f19 Move griddeckview implementation into source file 2013-12-05 23:06:30 +01:00
Tobias Loose 667b95f2b8 Refactor gamestatedeckviewer and add a grid view suited...
for bigger screens.
2013-12-05 23:06:30 +01:00
Tobias Loose e90f6fe224 Whitespaces and add button to toggle griv/scrolling view 2013-12-05 23:06:30 +01:00
Tobias Loose 2289fffb8d Do not ftbfs when in release mode (-weror, -wunused-.. combination) 2013-12-05 23:06:30 +01:00
xawotihs 826403a512 Fixed upload shell script 2013-12-05 22:44:02 +01:00
xawotihs 35fec3d9a0 Made upload-binaries executable 2013-12-05 22:05:31 +01:00
xawotihs e9eb86488e Redirect ant update errors to a file and push correct upload-binaries.sh 2013-12-05 21:43:29 +01:00
xawotihs ae97abbf96 Activates an automatic pre-release and binary upload from Travis. 2013-12-05 21:21:08 +01:00
Xawotihs a8391112b0 Merge pull request #576 from ZobyTwo/directories_1
Do not specify the system directory in JGE
2013-12-04 13:07:05 -08:00
Rolzad73 4257592568 Updated output of info about Android APIs 2013-12-04 12:58:22 -05:00
Tobias Loose 657479e0e4 Do not specify the system directory in JGE 2013-12-04 11:58:36 +01:00
Dmitry Panin 9e969881fd Added output of info about Android APIs 2013-12-04 12:04:54 +04:00
Dmitry Panin 2b434a7182 Merge pull request #575 from WagicProject/android_travis_sdk_downgrade
Changed Travis build file to use Android API 10 and Android build tools 18.1.1
2013-12-04 00:02:49 -08:00
Rolz73 d2e41f98c3 Changed Travis build file to use Android API 10 and Android build tools 18.1.1 2013-12-03 02:36:11 -05:00
Xawotihs 318fc98a39 Merge pull request #574 from WagicProject/feature/play-from-grave
Feature/play from grave
2013-12-02 12:34:52 -08:00
Dmitry Panin b7a4b7f6b9 Fixing Yawgmoth's will 2013-12-02 21:26:55 +04:00
Dmitry Panin ed03fb744d Added [Yawgmoth's Will] 2013-12-02 13:42:31 +04:00
Dmitry Panin 02be213d1e Test for keyword "CanPlayFromGraveyard"
Also added card [Crucible of Worlds] as example of it.
2013-12-02 04:36:58 +04:00
Dmitry Panin 0d4db9ee54 Fixed bug in alternative cost when playing lands 2013-12-02 04:33:39 +04:00
Dmitry Panin ae927576c5 Draft of new feature: canplayfromgraveyard
this will allow playing cards from graveyard
examples: tbd
2013-12-02 04:20:04 +04:00
Dmitry Panin f08ddac77b Fixed formatting 2013-12-02 04:16:25 +04:00
Dmitry Panin 9effa7c975 Slightly changed formatting while investigating src 2013-12-01 01:01:57 +04:00
Dmitry Panin a70259b5ba Fixed: Assembly-Worker didn't appear as creature type
For artifact creatures the parent type TYPE_ARTIFACT was used
and therefore that creature's subtype wasn't added in full list.
2013-12-01 00:59:16 +04:00
xawotihs bf0a0a1580 Build the graphics version in release instead of debug. 2013-11-30 19:32:55 +01:00
xawotihs eb8b22b2d5 Merge branch 'master' of https://github.com/WagicProject/wagic 2013-11-30 12:21:43 +01:00
xawotihs 4095676b6b Fixed memory leak introduced in #555 2013-11-29 22:07:45 +01:00
xawotihs bedd1e8da8 Merge branch 'valgrind' of https://github.com/ZobyTwo/wagic into ZobyTwo-valgrind 2013-11-29 19:41:46 +01:00
xawotihs 965d4f6d45 Fixes Windows project 2013-11-29 19:31:23 +01:00
Tobias Loose 0db2925e7a Fix initialization orders 2013-11-29 18:44:30 +01:00
Tobias Loose 031f2dbffb Fix Valgrind warnings appearing during the test suit. 2013-11-29 18:21:53 +01:00
Tobias Loose dbece750f8 Use tabs instead of spaces if the file uses tabs 2013-11-29 13:51:13 +01:00
Tobias Loose 6699902c24 Add TIXML_USE_STL to android builds 2013-11-29 13:34:44 +01:00
Tobias Loose e8407caa2a Add TIXML_USE_STL compiler flag to psp makefile to make headers compatible 2013-11-29 13:34:35 +01:00
Tobias Loose 69c6745f53 Make getMenuText() return string. 2013-11-29 13:33:33 +01:00
Tobias Loose 6f083389c2 Speedup MTGAllCards::countByType a bit 2013-11-29 11:51:58 +01:00
Tobias Loose 9ee44ca091 Substitute more char arrays with strings 2013-11-29 11:51:22 +01:00
Tobias Loose 3f0dd987f0 Remove bool CardInstance::hasSubtype(const char * _subtype)
There exists bool CardInstance::hasSubtype(const string& _subtype) and the
const char* version converts _subtype into string deeper in the call
hierarchy anyway. So both methods did the same.
2013-11-29 11:43:59 +01:00
Tobias Loose 672b0be7bd Fix a few string bugs add StartsWith for strings 2013-11-29 11:38:49 +01:00
Tobias Loose 9d5a83d588 Replace more strcmp with std::string::compare or std::string::operator==.
This commit also enables TinyXML STL support.
2013-11-28 16:42:29 +01:00
Tobias Loose 5d0d130587 Make MTGGameZone::countByType use string instead of char*
and replace strcmp with std::string operator== calls.
2013-11-28 16:42:29 +01:00
Tobias Loose c85d857604 Replace constness cast 2013-11-28 16:42:29 +01:00
Tobias Loose f68568cc1e Replace strcmp with c++ equivalent when comparing std::strings. 2013-11-28 16:42:29 +01:00
Dmitry Panin 89206b3a6b Added testing that QT GUI build is successfull 2013-11-28 16:44:12 +04:00
xawotihs dc118c64b8 Fixed compilation on Mac 2013-11-27 23:04:46 +01:00
xawotihs a43854420d Fixed compilation issue on Windows 2013-11-27 20:33:59 +01:00
xawotihs a695323bc7 Merge pull request #564 from ZobyTwo/cleanup_1
Add a few namespaces and fix header guards.
2013-11-25 15:42:18 -08:00
xawotihs 02a65ecd82 Merge branch 'cleanup_1' of https://github.com/ZobyTwo/wagic into ZobyTwo-cleanup_1 2013-11-26 00:17:48 +01:00
xawotihs 9ff087ecde Merge pull request #570 from WagicProject/android-travis-ci
Android travis ci
2013-11-25 14:31:15 -08:00
xawotihs 47685f4892 Added installation of 32 bits libs to make Android SDK work. 2013-11-25 22:42:09 +01:00
xawotihs 7aaebdc661 Merge branch 'android_build_fix' into android-travis-ci 2013-11-25 21:23:58 +01:00
Rolzad73 8aa0b8cea0 reverting sdk.buildtools change 2013-11-25 13:41:07 -05:00
Rolzad73 fac44c4b48 - updated AndroidManifest.xml to match desired API values.
- removed CardEffect.cpp reference from Android.mk build file.
- added sdk.buildtools=18.1.1 line to default.properties and project.properties
- updated .gitignore
2013-11-25 11:54:19 -05:00
Dmitry Panin 9889186eab Added missing "echo" statement 2013-11-25 13:41:29 +04:00
xawotihs 73f9319b92 Activates Android build from Travis 2013-11-25 05:27:31 +01:00
xawotihs fd6bc95539 Merge pull request #562 from citiral/master
Updated deckmenu.cpp to properly render deck description and summary
2013-11-24 10:28:05 -08:00
Tobias Loose 0bb211a581 Remove unused global variables from DeckStats.cpp and add proper...
member variable initialization.
2013-11-24 09:18:34 +01:00
Tobias Loose e0428ac7b0 Avoid more conflicts. We could now do unit builds...
and make the linker put every data element and function into its own section.
On linktime, we can output every discarded section and get a list of dead
code (for that build).
2013-11-23 17:04:24 +01:00
Tobias Loose 3e94de985f Add more include guards 2013-11-23 16:25:14 +01:00
Tobias Loose 9f0b70d1c9 Put constans into extra namespace as kBackToMainMenuID...
collides with itself. GameStateAwards::kBackToMainMenuID and
GameStateOptions::kBackToMainMenuID define those with different
values.
2013-11-23 16:18:45 +01:00
Tobias Loose 1e8fc81aa3 Add/fix broken include guards 2013-11-23 16:09:11 +01:00
Tobias Loose 352e3c2daa Remove makros and add undefs to avoid clashing names
FRAND and Clamp were not used and Clamp collided when doing unit builds.
SQUARE(x) is longer than x*x and if x is an expression it gets evaluated
twice.
2013-11-23 16:03:04 +01:00
Dmitry Panin 678a4734bb Merge pull request #560 from ZobyTwo/dead_code
Remove some dead code
2013-11-22 00:09:40 -08:00
Dmitry Panin 052e3abdb8 Small fix in match_and ( [-color1; -color2] was handled incorrectly ) 2013-11-22 01:03:07 +04:00
citiral 73c2d17080 Updated deckmenu.cpp to properly render deck description and summary
Deck description and statistics were being drawn as black text, this made it invisible as it was rendered over a black background. I made it change the color to white before drawing, so its shown as its suposed to be.(Did the default text color change?)
2013-11-21 20:38:41 +01:00
Dmitry Panin ffbb228d2d Fixed wrong activation cost in dragon hatchling 2013-11-21 14:25:01 +04:00
Dmitry Panin 306765c6b6 Merge pull request #561 from ZobyTwo/valgrind
Fix some valgrind memcheck warnings. However there remains one...

... within the threaded texture cache. Once it is resized, some textures
in GetQuad(...) (WCachedResource.cpp:102/103) have uninitialized widths/heights.
2013-11-21 01:58:49 -08:00
Tobias Loose 3cee80e3bc Delete another unused file (GuiMessageBox.cpp) 2013-11-20 14:01:59 +01:00
Tobias Loose 8209716fc9 Remove unused file 2013-11-20 13:53:15 +01:00
Tobias Loose e76c57d747 Fix some valgrind memcheck warnings. However there remains one...
... within the threaded texture cache. Once it is resized, some textures
in GetQuad(...) (WCachedResource.cpp:102/103) have uninitialized widths/heights.
2013-11-20 12:56:33 +01:00
Tobias Loose 9c282aeb56 Remove CardEffect.o from Makefile 2013-11-20 12:02:33 +01:00
Tobias Loose bbc310dec7 Remove some dead code 2013-11-20 11:43:27 +01:00
Dmitry Panin a37af1776a Merge pull request #557 from ZobyTwo/defines
Defines/Typos
2013-11-20 02:34:32 -08:00
Tobias Loose 35697a65b4 Use style guide 2013-11-20 11:13:35 +01:00
Tobias Loose 6bed1666be Merge branch 'master' into defines 2013-11-20 11:06:41 +01:00
Tobias Loose f021866368 Merge remote-tracking branch 'wp/master' 2013-11-20 11:06:28 +01:00
xawotihs d7e527166c Merge branch 'show-output-only-for-failing-tests' 2013-11-19 11:14:41 +01:00
Dmitry Panin 071a487100 Fixed compilation error 2013-11-19 11:06:31 +04:00
Dmitry Panin f370899a8a Thread-safe version of OutputCapturer 2013-11-19 03:58:43 +04:00
Dmitry Panin 331e126787 Added info about total number of tests 2013-11-19 02:57:42 +04:00
Dmitry Panin 6c41e5c92c Added option (#define CAPTURE_STDERR)
if set then the DebugTrace calls only for failing tests are shown
2013-11-19 02:41:30 +04:00
Tobias Loose 82e3ab3977 Merge branch 'cleanup' into defines
Merge cleanup codings style commit as i accidentally used that branch as
the base.
2013-11-17 21:06:56 +01:00
Tobias Loose f2314ca673 Use proposed coding style 2013-11-17 21:05:07 +01:00
Tobias Loose 94c3ac9ad9 Fix FTBFS 2013-11-17 21:02:08 +01:00
Tobias Loose 5419d87e4e Get rid of two more define groups. 2013-11-17 20:22:03 +01:00
Tobias Loose e1213d1c1f Remove variables flagged for removal (via conditional TODO comment)
x and y is provided by PlayGuiObject::Pos.
2013-11-17 19:50:17 +01:00
Tobias Loose 446ed20758 Fix typo ActionLayer::receiveEventPlus(...)
This method is rarely used, however it returned 0 after adding stuff.
It now returns the sum.
2013-11-17 19:39:46 +01:00
Tobias Loose 7a48c5e087 Fix some cppcheck warnings (mostly style and postfix vs prefix iteration) 2013-11-17 19:36:24 +01:00
Tobias Loose 3ca2f1c1ed Replace defines in Damage.h with enums. 2013-11-17 17:12:58 +01:00
Tobias Loose 146872797b ActionElement.h: Replace defines, remove superfluous ";"
Defines do not follow scope rules, but enums do. Enum classes
even utilize strong type checking (but i am not sure about compiler
support for c++11 on all target platforms).
2013-11-17 16:08:29 +01:00
Tobias Loose c6dc51c7d3 Simplify Damage::resolve a bit 2013-11-17 15:37:56 +01:00
Dmitry Panin 0ef92d154a Merge pull request #555 from WagicProject/fix-cranial-plating
Fix cranial plating
2013-11-16 13:58:56 -08:00
Dmitry Panin 2835bdf767 Fixed issue with Cranial Plating.
Issue
	attach then equip: plating will give bonus to both creatures
Fix
	Changed "attach" to "retarget target(creature|mybattlefield)"
	as this doesnot admit this bug
	Attach should become deprecated in future
2013-11-17 01:49:51 +04:00
Dmitry Panin afc903e31b Added different names for attach and equip
+ moved implementation of AEquip to .cpp
2013-11-17 00:44:37 +04:00
Dmitry Panin 6294bb1eed Added Master of Waves 2013-11-16 23:54:37 +04:00
xawotihs 9f16b2208d Removes the error, it was perfectly detected by Travis CI. 2013-11-09 20:15:00 +01:00
xawotihs 0a765b702b Introducing an error to check if Travis reports correctly a compile
error with the script.
2013-11-09 20:01:57 +01:00
xawotihs 82de6f2840 Fixes stupid typo. 2013-11-09 19:51:47 +01:00
xawotihs 90652fa73d Fixed PSP build and integrates it with Travis CI 2013-11-09 19:40:01 +01:00
Rolzad73 e8c73aaf9d Merge pull request #1 from WagicProject/android_cleanup
Android cleanup
2013-11-07 13:15:41 -08:00
Rolzad73 f95094a429 removing commented lines I had intended to delete outright 2013-11-07 15:56:43 -05:00
Rolzad73 7a57de6608 removed ads on Android version 2013-11-07 15:49:53 -05:00
Rolzad73 14c2d522c2 removed Android gen dir 2013-11-07 15:04:37 -05:00
Dmitry Panin 6bf2147d94 From the Vault: Twenty
// imported accidental commit from svn repo
2013-11-06 12:56:54 +04:00
xawotihs fea5b04a77 Fixed compilation on Windows. 2013-10-31 23:48:19 +01:00
xawotihs ea98b769a7 Merge branch 'develop'
Activates full testsuite run in Travis CI. Travis will complain as soon as at least one testcase does not pass successfully after a new commit.
2013-10-30 23:10:03 +01:00
xawotihs 017f6dd1ed Deactivated part of the traces outputted by the testsuite to make Travis
happy.
2013-10-30 22:58:04 +01:00
xawotihs 784d127a6e I think I got it ... messy / not appearing at the end of folders in the
travis linux where it appears fine on mine :(
2013-10-30 22:28:09 +01:00
xawotihs f6c47b85e3 More debug 2013-10-30 22:02:43 +01:00
xawotihs dac31994b6 Adding traces for important directories. 2013-10-30 21:44:23 +01:00
xawotihs 74280aef1d Added some traces in the primitives and sets loading. 2013-10-30 20:50:34 +01:00
xawotihs 8013d09e4f Reactivated wagic console in travis CI 2013-10-30 20:30:33 +01:00
Dmitry Panin 6bbe290762 Fixed bug with syncopate to consume all the mana available
Now pay[[{x}]] is not supported because of this.
use "pay[[{value:storedx}]]" instead
2013-10-30 12:39:08 +04:00
xawotihs 57c9940244 Deactivated testsuite from travis, resources are not loaded correctly. 2013-10-30 00:38:34 +01:00
xawotihs db1c552321 Tries to work around crash of the testsuite in Travis. 2013-10-30 00:20:58 +01:00
xawotihs f08f0ad3b9 Merge branch 'master' of https://github.com/WagicProject/wagic
Conflicts:
	JGE/include/JTypes.h
2013-10-29 23:36:07 +01:00
xawotihs a3a1bc2b79 Created a dedicate console Qt based wagic application and run it in the
travis file.
2013-10-29 22:38:37 +01:00
Dmitry Panin 9037699281 Added missing test for syncopate + 2 tests for spell_rupture 2013-10-29 19:49:31 +04:00
Michael Nguyen 8d66f82179 Merge branch 'release/wagic-v0.19.2' 2013-10-28 16:19:28 -07:00
Michael Nguyen b17d9d3f85 Merge branch 'master' of github.com:WagicProject/wagic 2013-10-28 15:35:45 -07:00
Michael Nguyen c5190a62cd Merge branch 'develop' 2013-10-28 15:35:18 -07:00
153 changed files with 4239 additions and 2488 deletions
+23 -1
View File
@@ -1,2 +1,24 @@
language: cpp 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
View File
@@ -73,7 +73,7 @@
<Optimization>MaxSpeed</Optimization> <Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>src/zipFS;Dependencies/SDL/include;Dependencies/include;$(JGEEXTRAS);../Boost;../projects/mtg/include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>src/zipFS;Dependencies/SDL/include;Dependencies/include;$(JGEEXTRAS);../Boost;../projects/mtg/include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>SDL_CONFIG;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>TIXML_USE_STL; SDL_CONFIG;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
@@ -101,7 +101,7 @@
<ClCompile> <ClCompile>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>src/zipFS;Dependencies/SDL/include;Dependencies/include;$(JGEEXTRAS);../Boost;../projects/mtg/include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>src/zipFS;Dependencies/SDL/include;Dependencies/include;$(JGEEXTRAS);../Boost;../projects/mtg/include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>SDL_CONFIG;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>TIXML_USE_STL; SDL_CONFIG;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader> <PrecompiledHeader>
@@ -129,7 +129,7 @@
<Optimization>Full</Optimization> <Optimization>Full</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>src/zipFS;Dependencies/SDL/include;Dependencies/include;$(JGEEXTRAS);../Boost;../projects/mtg/include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>src/zipFS;Dependencies/SDL/include;Dependencies/include;$(JGEEXTRAS);../Boost;../projects/mtg/include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>SDL_CONFIG;WIN32;NDEBUG;_LIB;_SECURE_SCL=0;_HAS_ITERATOR_DEBBUGING=0;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>TIXML_USE_STL; SDL_CONFIG;WIN32;NDEBUG;_LIB;_SECURE_SCL=0;_HAS_ITERATOR_DEBBUGING=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
+1
View File
@@ -31,6 +31,7 @@ HGE_OBJS = src/hge/hgecolor.o src/hge/hgeparticle.o \
CXXFLAGS = -W -Wall -Werror -Wno-unused CXXFLAGS = -W -Wall -Werror -Wno-unused
CXXFLAGS += -DTIXML_USE_STL
ifdef DEBUG ifdef DEBUG
CXXFLAGS += -ggdb3 CXXFLAGS += -ggdb3
+16 -3
View File
@@ -4,6 +4,8 @@
// dirty, but I get OS header includes this way // dirty, but I get OS header includes this way
#include "JGE.h" #include "JGE.h"
#include "OutputCapturer.h"
#include <ostream> #include <ostream>
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
@@ -29,12 +31,23 @@ std::string ToHex(T* pointer)
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
#ifdef QT_CONFIG #ifdef QT_CONFIG
#ifdef CAPTURE_STDERR
#define DebugTrace(inString) \ #define DebugTrace(inString) \
{ \ { \
std::ostringstream stream; \ std::ostringstream stream; \
stream << inString << std::endl; \ stream << inString; \
qDebug("%s", stream.str().c_str()); \ OutputCapturer::add(stream.str()); \
} }
#else // CAPTURE_STDERR
#define DebugTrace(inString) \
{ \
std::ostringstream stream; \
stream << inString; \
qDebug("%s", stream.str().c_str()); \
}
#endif // CAPTURE_STDERR
#elif defined (ANDROID) #elif defined (ANDROID)
#include <android/log.h> #include <android/log.h>
#define DebugTrace(inString) \ #define DebugTrace(inString) \
@@ -48,7 +61,7 @@ std::string ToHex(T* pointer)
{ \ { \
std::ostringstream stream; \ std::ostringstream stream; \
stream << inString << std::endl; \ stream << inString << std::endl; \
OutputDebugString(stream.str().c_str()); \ OutputDebugStringA(stream.str().c_str()); \
} }
#endif // QT_CONFIG #endif // QT_CONFIG
#endif // Win32, Linux #endif // Win32, Linux
+11
View File
@@ -44,6 +44,17 @@ typedef WPARAM LocalKeySym;
#include <X11/keysym.h> #include <X11/keysym.h>
typedef KeySym LocalKeySym; typedef KeySym LocalKeySym;
#define LOCAL_KEY_NONE XK_VoidSymbol #define LOCAL_KEY_NONE XK_VoidSymbol
#undef Status
#undef Bool
#undef None
#undef CursorShape
#undef KeyPress
#undef KeyRelease
#undef FocusIn
#undef FocusOut
#undef FontChange
#undef Unsorted
#undef GrayScale
#elif defined(ANDROID) // This is temporary until we understand how to send real key events from Java #elif defined(ANDROID) // This is temporary until we understand how to send real key events from Java
typedef long unsigned int LocalKeySym; typedef long unsigned int LocalKeySym;
+1 -1
View File
@@ -578,7 +578,7 @@ private:
#if (!defined PSP) #if (!defined PSP)
GLuint mCurrentTex; 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 // MVP matrix
ESMatrix theMvpMatrix; ESMatrix theMvpMatrix;
+2 -3
View File
@@ -25,8 +25,7 @@
#elif defined USE_PHONON #elif defined USE_PHONON
#include <phonon/AudioOutput> #include <phonon/AudioOutput>
#include <phonon/MediaObject> #include <phonon/MediaObject>
#else #elif defined WIN32
#ifdef WIN32
#include <windows.h> #include <windows.h>
#define WITH_FMOD #define WITH_FMOD
#elif defined (PSP) #elif defined (PSP)
@@ -43,10 +42,10 @@
#include "JAudio.h" #include "JAudio.h"
#include "JMP3.h" #include "JMP3.h"
#endif #endif
#ifdef WITH_FMOD #ifdef WITH_FMOD
#include "../Dependencies/include/fmod.h" #include "../Dependencies/include/fmod.h"
#endif #endif
#endif
//------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------
using namespace std; using namespace std;
+64 -47
View File
@@ -75,6 +75,23 @@ enum {
#define SCREEN_HEIGHT_F 272.0f #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 #ifdef WIN32
// #define DEFAULT_BLEND BLEND_DEFAULT // #define DEFAULT_BLEND BLEND_DEFAULT
// #define BLEND_OPTION_ADD BLEND_COLORADD // #define BLEND_OPTION_ADD BLEND_COLORADD
@@ -84,9 +101,10 @@ enum {
#define BLEND_OPTION_ADD GU_TFX_ADD #define BLEND_OPTION_ADD GU_TFX_ADD
#define BLEND_OPTION_BLEND GU_TFX_BLEND #define BLEND_OPTION_BLEND GU_TFX_BLEND
#endif #endif
#endif // CONSOLE_CONFIG
#if (defined WIN32) && (!defined LINUX) #if (defined WIN32) && (!defined LINUX)
#include <windows.h> #include <windows.h>
#endif #endif
#if defined(LINUX) && (!defined WIN32) || defined(IOS) || defined (ANDROID) #if defined(LINUX) && (!defined WIN32) || defined(IOS) || defined (ANDROID)
typedef uint8_t byte; typedef uint8_t byte;
@@ -97,8 +115,21 @@ typedef bool BOOL;
#endif #endif
#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 #ifndef QT_CONFIG
#if defined (IOS) #if defined (IOS)
#import <OpenGLES/ES2/gl.h> #import <OpenGLES/ES2/gl.h>
@@ -113,7 +144,7 @@ typedef bool BOOL;
#include <GL/glu.h> #include <GL/glu.h>
#endif #endif
#else #else
# include <QtOpenGL> #include <QtOpenGL>
#endif #endif
#if (defined FORCE_GLES) #if (defined FORCE_GLES)
@@ -127,14 +158,12 @@ typedef bool BOOL;
#endif #endif
#if defined (PSP) #if defined (PSP)
#ifndef ABGR8888 #ifndef ABGR8888
#define ABGR8888 #define ABGR8888
#endif #endif
#if defined (ABGR8888) #if defined (ABGR8888)
#define PIXEL_TYPE u32
#ifndef ARGB #ifndef ARGB
#define ARGB(a, r, g, b) (PIXEL_TYPE)((a << 24) | (b << 16) | (g << 8) | r) // macro to assemble pixels in correct format #define ARGB(a, r, g, b) (PIXEL_TYPE)((a << 24) | (b << 16) | (g << 8) | r) // macro to assemble pixels in correct format
#endif #endif
@@ -215,13 +244,6 @@ typedef struct
#else //non PSP #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_ZERO GL_ZERO
#define BLEND_ONE GL_ONE #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_ONE_MINUS_DST_COLOR GL_ONE_MINUS_DST_COLOR
#define BLEND_SRC_ALPHA_SATURATE GL_SRC_ALPHA_SATURATE #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 GU_PSM_8888 0
#define RGBA(r, g, b, a) ((PIXEL_TYPE)((a) << 24) | ((b) << 16) | ((g) << 8) | (r)) #define GU_PSM_5551 0
#define GU_PSM_4444 0
#define TEXTURE_FORMAT 0 #define GU_PSM_5650 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
#endif #endif
#else
typedef uint32_t GLuint;
typedef float GLfloat;
typedef enum Buttons #endif //CONSOLE_CONFIG
{
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;
//------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------
struct Vertex 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 #endif
+23
View File
@@ -0,0 +1,23 @@
#ifndef OUTPUTCAPTURER_H
#define OUTPUTCAPTURER_H
#if defined(QT_CONFIG)
#include <Qt>
#include <string>
#include <sstream>
#include "Threading.h"
class OutputCapturer
{
private:
static std::ostringstream stream;
static boost::mutex mMutex;
public:
static void add(const std::string& s);
static void debugAndClear();
static void clear();
};
#endif
#endif // OUTPUTCAPTURER_H
-1
View File
@@ -315,7 +315,6 @@ namespace boost
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include "../include/DebugRoutines.h"
#include "../include/JLogger.h" #include "../include/JLogger.h"
namespace boost namespace boost
+1 -10
View File
@@ -3,15 +3,6 @@
#include <math.h> #include <math.h>
/*************************** Macros and constants ***************************/
// returns a number ranging from -1.0 to 1.0
#define FRAND (((float)rand()-(float)rand())/RAND_MAX)
#define Clamp(x, min, max) x = (x<min ? min : x<max ? x : max);
#define SQUARE(x) (x)*(x)
struct Vector3D struct Vector3D
{ {
Vector3D(float x, float y, float z) : x(x), y(y), z(z) {} Vector3D(float x, float y, float z) : x(x), y(y), z(z) {}
@@ -63,7 +54,7 @@ struct Vector3D
float Length() float Length()
{ {
float length = (float)sqrt(SQUARE(x) + SQUARE(y) + SQUARE(z)); float length = sqrt(x*x + y*y + z*z);
return (length != 0.0f) ? length : 1.0f; return (length != 0.0f) ? length : 1.0f;
} }
+3 -3
View File
@@ -67,7 +67,7 @@ bool JAnimator::Load(const char* scriptFile)
element = script->ToElement(); element = script->ToElement();
printf("---- Loading %s:%s\n", element->Value(), element->Attribute("name")); printf("---- Loading %s:%s\n", element->Value(), element->Attribute("name"));
const char *type[] = string type[] =
{ {
"ANIMATION_TYPE_LOOPING", "ANIMATION_TYPE_LOOPING",
"ANIMATION_TYPE_ONCE_AND_STAY", "ANIMATION_TYPE_ONCE_AND_STAY",
@@ -78,7 +78,7 @@ bool JAnimator::Load(const char* scriptFile)
const char* aniType = element->Attribute("type"); const char* aniType = element->Attribute("type");
for (int i=0;i<5;i++) for (int i=0;i<5;i++)
if (strcmp(type[i], aniType)==0) if (type[i] == aniType)
{ {
SetAnimationType(i); SetAnimationType(i);
break; break;
@@ -108,7 +108,7 @@ bool JAnimator::Load(const char* scriptFile)
element = param->ToElement(); element = param->ToElement();
if (element != NULL) if (element != NULL)
{ {
if (strcmp(element->Value(), "settings")==0) if (element->ValueStr() == "settings")
{ {
const char* quadName = element->Attribute("quad"); const char* quadName = element->Attribute("quad");
JQuad* quad = mResource->GetQuad(quadName); JQuad* quad = mResource->GetQuad(quadName);
+15 -6
View File
@@ -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. The content that users should not be touching.
*/ */
#if defined(ANDROID) #ifndef PSP
#include "../../include/PrecompiledHeader.h" #include "PrecompiledHeader.h"
#endif #endif //PSP
#ifdef WIN32 #ifdef WIN32
#pragma warning(disable : 4786) #pragma warning(disable : 4786)
@@ -34,6 +34,10 @@ The content that users should not be touching.
#include "../include/JLogger.h" #include "../include/JLogger.h"
#include <dirent.h> #include <dirent.h>
#ifdef QT_CONFIG
#include <QDir>
#endif
JFileSystem* JFileSystem::mInstance = NULL; JFileSystem* JFileSystem::mInstance = NULL;
JZipCache::JZipCache() JZipCache::JZipCache()
@@ -121,13 +125,18 @@ JFileSystem::JFileSystem(const string & _userPath, const string & _systemPath)
DebugTrace("User path " << userPath); DebugTrace("User path " << userPath);
#elif defined (QT_CONFIG) #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(); userPath = QDir::toNativeSeparators(dir.absolutePath()).toStdString();
systemPath = QDir::toNativeSeparators(sysDir.absolutePath()).toStdString(); systemPath = QDir::toNativeSeparators(sysDir.absolutePath()).toStdString();
DebugTrace("User path " << userPath);
DebugTrace("System path " << systemPath);
DebugTrace("Current path " << QDir::currentPath().toStdString());
#else #else
//Find the Res.txt file and matching Res folders for backwards compatibility //Find the Res.txt file and matching Res folders for backwards compatibility
ifstream mfile("Res.txt"); ifstream mfile("Res.txt");
+506
View File
@@ -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)
{
}
+8 -8
View File
@@ -75,10 +75,10 @@ bool JOBJModel::Load(const char *modelName, const char *textureName)
int count; int count;
while (filePtr < size) while (filePtr < size)
{ {
filePtr = ReadLine(tmpLine, buffer, filePtr, size); filePtr = ReadLine(tmpLine, buffer, filePtr, size);
{ {
if ((tmpLine[0] == '#') || (strlen(tmpLine) < 3)) if ((tmpLine[0] == '#') || (strlen(tmpLine) < 3))
{ {
@@ -89,16 +89,16 @@ bool JOBJModel::Load(const char *modelName, const char *textureName)
if (count == 4) if (count == 4)
{ {
if (strcmp(s1, "vn") == 0) if (string("vn") == s1)
normalList.push_back(vert); normalList.push_back(vert);
else if (strcmp(s1, "vt") == 0) else if (string("vt") == s1)
texList.push_back(vert); texList.push_back(vert);
else if (strcmp(s1, "v") == 0) else if (string("v") == s1)
vertList.push_back(vert); vertList.push_back(vert);
} }
else if (count == 3) else if (count == 3)
{ {
if (strcmp(s1, "vt") == 0) if (string("vt") == s1)
texList.push_back(vert); texList.push_back(vert);
} }
@@ -211,7 +211,7 @@ bool JOBJModel::Load(const char *modelName, const char *textureName)
if (textureName != NULL) if (textureName != NULL)
mTexture = JRenderer::GetInstance()->LoadTexture(textureName); mTexture = JRenderer::GetInstance()->LoadTexture(textureName);
return true; return true;
} }
+16 -16
View File
@@ -90,7 +90,7 @@ bool JParticleEffect::Load(const char* filename)
// FIELD_COUNT // FIELD_COUNT
// }; // };
const char* lifeValues[] = const string lifeValues[] =
{ {
"speed", "speed",
"size", "size",
@@ -104,7 +104,7 @@ bool JParticleEffect::Load(const char* filename)
"gravity" "gravity"
}; };
const char* typeNames[] = const string typeNames[] =
{ {
"POINT", "POINT",
"AREA", "AREA",
@@ -113,7 +113,7 @@ bool JParticleEffect::Load(const char* filename)
"CIRCLE" "CIRCLE"
}; };
const char* modeNames[] = const string modeNames[] =
{ {
"REPEAT", "REPEAT",
"ONCE", "ONCE",
@@ -149,32 +149,32 @@ bool JParticleEffect::Load(const char* filename)
{ {
element = param->ToElement(); element = param->ToElement();
if (strcmp(element->Attribute("name"), "settings")==0) if (string("settings") == element->Attribute("name"))
{ {
if (strcmp(element->Attribute("blend"), "NORMAL")==0) if (string("NORMAL") == element->Attribute("blend"))
mParticleEmitters[mEmitterCount]->SetBlending(BLEND_SRC_ALPHA, BLEND_ONE_MINUS_SRC_ALPHA); mParticleEmitters[mEmitterCount]->SetBlending(BLEND_SRC_ALPHA, BLEND_ONE_MINUS_SRC_ALPHA);
else if (strcmp(element->Attribute("blend"), "ADDITIVE")==0) else if (string("ADDITIVE") == element->Attribute("blend"))
mParticleEmitters[mEmitterCount]->SetBlending(BLEND_SRC_ALPHA, BLEND_ONE); mParticleEmitters[mEmitterCount]->SetBlending(BLEND_SRC_ALPHA, BLEND_ONE);
for (unsigned int i=0;i<sizeof(modeNames)/sizeof(char*);i++) for (unsigned int i=0;i<sizeof(modeNames)/sizeof(char*);i++)
{ {
if (strcmp(element->Attribute("mode"), modeNames[i])==0) if (modeNames[i] == element->Attribute("mode"))
{ {
mParticleEmitters[mEmitterCount]->mEmitterMode = i; mParticleEmitters[mEmitterCount]->mEmitterMode = i;
#if defined (_DEBUG) #if defined (_DEBUG)
printf("emitter mode:%s\n", modeNames[i]); printf("emitter mode:%s\n", modeNames[i].c_str());
#endif #endif
break; break;
} }
} }
for (unsigned i=0;i<sizeof(typeNames)/sizeof(char*);i++) for (unsigned i=0;i<sizeof(typeNames)/sizeof(char*);i++)
{ {
if (strcmp(element->Attribute("type"), typeNames[i])==0) if (typeNames[i] == element->Attribute("type"))
{ {
mParticleEmitters[mEmitterCount]->mType = i; mParticleEmitters[mEmitterCount]->mType = i;
#if defined (_DEBUG) #if defined (_DEBUG)
printf("emitter type:%s\n", typeNames[i]); printf("emitter type:%s\n", typeNames[i].c_str());
#endif #endif
break; break;
} }
@@ -213,7 +213,7 @@ bool JParticleEffect::Load(const char* filename)
} }
} }
else if (strcmp(element->Attribute("name"), "quantity")==0) else if (string("quantity") == element->Attribute("name"))
{ {
for (key = param->FirstChild(); key; key = key->NextSibling()) for (key = param->FirstChild(); key; key = key->NextSibling())
{ {
@@ -227,7 +227,7 @@ bool JParticleEffect::Load(const char* filename)
} }
} }
else if (strcmp(element->Attribute("name"), "lifex")==0) else if (string("lifex") == element->Attribute("name"))
{ {
if (element->QueryFloatAttribute("base", &baseValue) == TIXML_SUCCESS && if (element->QueryFloatAttribute("base", &baseValue) == TIXML_SUCCESS &&
element->QueryFloatAttribute("max", &value) == TIXML_SUCCESS) element->QueryFloatAttribute("max", &value) == TIXML_SUCCESS)
@@ -236,7 +236,7 @@ bool JParticleEffect::Load(const char* filename)
mParticleEmitters[mEmitterCount]->mLifeMax= value; mParticleEmitters[mEmitterCount]->mLifeMax= value;
} }
} }
else if (strcmp(element->Attribute("name"), "anglex")==0) else if (string("anglex") == element->Attribute("name"))
{ {
if (element->QueryFloatAttribute("base", &baseValue) == TIXML_SUCCESS && if (element->QueryFloatAttribute("base", &baseValue) == TIXML_SUCCESS &&
element->QueryFloatAttribute("max", &value) == TIXML_SUCCESS) element->QueryFloatAttribute("max", &value) == TIXML_SUCCESS)
@@ -245,7 +245,7 @@ bool JParticleEffect::Load(const char* filename)
mParticleEmitters[mEmitterCount]->mAngleMax= value*DEG2RAD; mParticleEmitters[mEmitterCount]->mAngleMax= value*DEG2RAD;
} }
} }
else if (strcmp(element->Attribute("name"), "speedx")==0) else if (string("speedx") == element->Attribute("name"))
{ {
if (element->QueryFloatAttribute("base", &baseValue) == TIXML_SUCCESS && if (element->QueryFloatAttribute("base", &baseValue) == TIXML_SUCCESS &&
element->QueryFloatAttribute("max", &value) == TIXML_SUCCESS) element->QueryFloatAttribute("max", &value) == TIXML_SUCCESS)
@@ -254,7 +254,7 @@ bool JParticleEffect::Load(const char* filename)
mParticleEmitters[mEmitterCount]->mSpeedMax= value; mParticleEmitters[mEmitterCount]->mSpeedMax= value;
} }
} }
else if (strcmp(element->Attribute("name"), "sizex")==0) else if (string("sizex") == element->Attribute("name"))
{ {
if (element->QueryFloatAttribute("base", &baseValue) == TIXML_SUCCESS && if (element->QueryFloatAttribute("base", &baseValue) == TIXML_SUCCESS &&
element->QueryFloatAttribute("max", &value) == TIXML_SUCCESS) element->QueryFloatAttribute("max", &value) == TIXML_SUCCESS)
@@ -267,7 +267,7 @@ bool JParticleEffect::Load(const char* filename)
{ {
for (int i=0;i<FIELD_COUNT;i++) for (int i=0;i<FIELD_COUNT;i++)
{ {
if (strcmp(element->Attribute("name"), lifeValues[i])==0) if (lifeValues[i] == element->Attribute("name"))
{ {
for (key = param->FirstChild(); key; key = key->NextSibling()) for (key = param->FirstChild(); key; key = key->NextSibling())
{ {
+3 -3
View File
@@ -119,11 +119,11 @@ bool JResourceManager::LoadResource(const string& resourceName)
element = node->ToElement(); element = node->ToElement();
if (element != NULL) if (element != NULL)
{ {
if (strcmp(element->Value(), "texture")==0) if (element->ValueStr() == "texture")
{ {
CreateTexture(element->Attribute("name")); CreateTexture(element->Attribute("name"));
} }
else if (strcmp(element->Value(), "quad")==0) else if (element->ValueStr() == "quad")
{ {
string quadName = element->Attribute("name"); string quadName = element->Attribute("name");
string textureName = element->Attribute("texture"); string textureName = element->Attribute("texture");
@@ -170,7 +170,7 @@ bool JResourceManager::LoadResource(const string& resourceName)
GetQuad(id)->SetHotSpot(hotspotX, hotspotY); GetQuad(id)->SetHotSpot(hotspotX, hotspotY);
} }
} }
else if (strcmp(element->Value(), "font")==0) else if (element->ValueStr() == "font")
{ {
} }
+22
View File
@@ -0,0 +1,22 @@
#include "../include/OutputCapturer.h"
std::ostringstream OutputCapturer::stream;
boost::mutex OutputCapturer::mMutex;
void OutputCapturer::add(const std::string& s)
{
boost::mutex::scoped_lock lock(mMutex);
stream << s << "\n";
}
void OutputCapturer::debugAndClear()
{
stream.flush();
qDebug("%s", stream.str().c_str());
stream.str("");
}
void OutputCapturer::clear()
{
stream.str("");
}
+105
View File
@@ -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
View File
@@ -69,7 +69,7 @@ int main(int argc, char* argv[])
#endif //QT_WIDGET #endif //QT_WIDGET
if(argc >= 2 && strcmp(argv[1], "testsuite")==0) if(argc >= 2 && string(argv[1]) == "testsuite")
{ {
int result = 0; int result = 0;
result += WagicCore::runTestSuite(); result += WagicCore::runTestSuite();
+3 -3
View File
@@ -343,7 +343,7 @@ void JQuad::SetHotSpot(float x, float y)
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
JTexture::JTexture() : mBuffer(NULL) JTexture::JTexture() : mWidth(0), mHeight(0), mBuffer(NULL)
{ {
mTexId = -1; mTexId = -1;
} }
@@ -823,7 +823,7 @@ void JRenderer::BeginScene()
esMatrixLoadIdentity(&theMvpMatrix); esMatrixLoadIdentity(&theMvpMatrix);
esOrtho(&theMvpMatrix, 0.0f, SCREEN_WIDTH_F, 0.0f, SCREEN_HEIGHT_F-1.0f,-1.0f, 1.0f); 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) #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 scaleH = mActualHeight/SCREEN_HEIGHT_F;
float scaleW = mActualWidth/SCREEN_WIDTH_F; float scaleW = mActualWidth/SCREEN_WIDTH_F;
if (scaleH != 1.0f || scaleW != 1.0f) 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) #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); glOrthof(0.0f, SCREEN_WIDTH_F, 0.0f, SCREEN_HEIGHT_F-1.0f, -1.0f, 1.0f);
#else #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 #endif
glMatrixMode (GL_MODELVIEW); // Select The Modelview Matrix glMatrixMode (GL_MODELVIEW); // Select The Modelview Matrix
+1 -1
View File
@@ -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) #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); 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 #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 #endif
glMatrixMode (GL_MODELVIEW); // Select The Modelview Matrix glMatrixMode (GL_MODELVIEW); // Select The Modelview Matrix
+1
View File
@@ -1,2 +1,3 @@
/gen /gen
/bin
+1 -1
View File
@@ -14,5 +14,5 @@
<activity android:configChanges="keyboard|keyboardHidden|orientation" android:name="com.google.ads.AdActivity" android:screenOrientation="sensorLandscape"/> <activity android:configChanges="keyboard|keyboardHidden|orientation" android:name="com.google.ads.AdActivity" android:screenOrientation="sensorLandscape"/>
</application> </application>
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="9"/> <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="10"/>
</manifest> </manifest>
-10
View File
@@ -1,10 +0,0 @@
/Volumes/data/home/mnguyen/Projects/eclipse-workspace/wagic/projects/mtg/Android/gen/net/wagic/app/R.java \
: /Volumes/data/home/mnguyen/Projects/eclipse-workspace/wagic/projects/mtg/Android/res/drawable-hdpi/icon.png \
/Volumes/data/home/mnguyen/Projects/eclipse-workspace/wagic/projects/mtg/Android/res/drawable-ldpi/icon.png \
/Volumes/data/home/mnguyen/Projects/eclipse-workspace/wagic/projects/mtg/Android/res/drawable-mdpi/icon.png \
/Volumes/data/home/mnguyen/Projects/eclipse-workspace/wagic/projects/mtg/Android/res/layout/main.xml \
/Volumes/data/home/mnguyen/Projects/eclipse-workspace/wagic/projects/mtg/Android/res/values/strings.xml \
/Volumes/data/home/mnguyen/Projects/eclipse-workspace/wagic/projects/mtg/Android/bin/res/drawable-hdpi/icon.png \
/Volumes/data/home/mnguyen/Projects/eclipse-workspace/wagic/projects/mtg/Android/bin/res/drawable-ldpi/icon.png \
/Volumes/data/home/mnguyen/Projects/eclipse-workspace/wagic/projects/mtg/Android/bin/res/drawable-mdpi/icon.png \
/Volumes/data/home/mnguyen/Projects/eclipse-workspace/wagic/projects/mtg/Android/bin/AndroidManifest.xml \
@@ -1,6 +0,0 @@
/** Automatically generated file. DO NOT MODIFY */
package net.wagic.app;
public final class BuildConfig {
public final static boolean DEBUG = true;
}
@@ -1,27 +0,0 @@
/* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package net.wagic.app;
public final class R {
public static final class attr {
}
public static final class drawable {
public static final int icon=0x7f020000;
}
public static final class id {
public static final int mainLayout=0x7f050000;
}
public static final class layout {
public static final int main=0x7f030000;
}
public static final class string {
public static final int app_name=0x7f040000;
public static final int app_version=0x7f040001;
public static final int info_text=0x7f040002;
}
}
+4 -2
View File
@@ -14,7 +14,7 @@ PNG_PATH := $(JGE_PATH)/Dependencies/libpng
DEBUG ?= DEBUG DEBUG ?= DEBUG
LOCAL_CFLAGS += -DLINUX -DANDROID -DSDL_CONFIG -D_$(DEBUG) LOCAL_CFLAGS += -DLINUX -DANDROID -DSDL_CONFIG -D_$(DEBUG)
LOCAL_CFLAGS += -D_STLP_USE_SIMPLE_NODE_ALLOC LOCAL_CFLAGS += -D_STLP_USE_SIMPLE_NODE_ALLOC -DTIXML_USE_STL
LOCAL_CFLAGS += -D__arm__ -D_REENTRANT -D_GLIBCXX__PTHREADS LOCAL_CFLAGS += -D__arm__ -D_REENTRANT -D_GLIBCXX__PTHREADS
LOCAL_STATIC_LIBRARIES := libpng libjpeg LOCAL_STATIC_LIBRARIES := libpng libjpeg
LOCAL_SHARED_LIBRARIES := SDL LOCAL_SHARED_LIBRARIES := SDL
@@ -41,7 +41,6 @@ LOCAL_SRC_FILES := $(SDL_PATH)/src/main/android/SDL_android_main.cpp \
$(MTG_PATH)/src/AllAbilities.cpp \ $(MTG_PATH)/src/AllAbilities.cpp \
$(MTG_PATH)/src/CardDescriptor.cpp \ $(MTG_PATH)/src/CardDescriptor.cpp \
$(MTG_PATH)/src/CardDisplay.cpp \ $(MTG_PATH)/src/CardDisplay.cpp \
$(MTG_PATH)/src/CardEffect.cpp \
$(MTG_PATH)/src/CardGui.cpp \ $(MTG_PATH)/src/CardGui.cpp \
$(MTG_PATH)/src/CardPrimitive.cpp \ $(MTG_PATH)/src/CardPrimitive.cpp \
$(MTG_PATH)/src/CardSelector.cpp \ $(MTG_PATH)/src/CardSelector.cpp \
@@ -137,6 +136,9 @@ LOCAL_SRC_FILES := $(SDL_PATH)/src/main/android/SDL_android_main.cpp \
$(MTG_PATH)/src/WFont.cpp \ $(MTG_PATH)/src/WFont.cpp \
$(MTG_PATH)/src/WGui.cpp \ $(MTG_PATH)/src/WGui.cpp \
$(MTG_PATH)/src/WResourceManager.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/SDLmain.cpp \
$(JGE_PATH)/src/Encoding.cpp \ $(JGE_PATH)/src/Encoding.cpp \
$(JGE_PATH)/src/JAnimator.cpp \ $(JGE_PATH)/src/JAnimator.cpp \
@@ -54,10 +54,6 @@ import android.view.View.OnKeyListener;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.FrameLayout.LayoutParams; import android.widget.FrameLayout.LayoutParams;
import com.google.ads.AdRequest;
import com.google.ads.AdSize;
import com.google.ads.AdView;
/** /**
* SDL Activity * SDL Activity
*/ */
@@ -68,7 +64,6 @@ public class SDLActivity extends Activity implements OnKeyListener
public static String TAG = Activity.class.getCanonicalName(); public static String TAG = Activity.class.getCanonicalName();
// Main components // Main components
private static AdView mAdView;
private static SDLActivity mSingleton; private static SDLActivity mSingleton;
private static SDLSurface mSurface; private static SDLSurface mSurface;
@@ -422,25 +417,12 @@ public class SDLActivity extends Activity implements OnKeyListener
SurfaceHolder holder = mSurface.getHolder(); SurfaceHolder holder = mSurface.getHolder();
holder.setType(SurfaceHolder.SURFACE_TYPE_GPU); holder.setType(SurfaceHolder.SURFACE_TYPE_GPU);
// Create the adView
mAdView = new AdView(this, AdSize.BANNER, "a14e9009f88864f"); // "a14dc0ab7b27413" <-- for the alpha);
_videoLayout.addView(mSurface, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); _videoLayout.addView(mSurface, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
_videoLayout.addView(mAdView, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, Gravity.BOTTOM + Gravity.CENTER_HORIZONTAL));
// mGLView.setFocusableInTouchMode(true); // mGLView.setFocusableInTouchMode(true);
// mGLView.setFocusable(true); // mGLView.setFocusable(true);
// adView.requestFreshAd(); // adView.requestFreshAd();
setContentView(_videoLayout, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); setContentView(_videoLayout, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
mSurface.requestFocus(); mSurface.requestFocus();
AdRequest request = new AdRequest();
request.addTestDevice(AdRequest.TEST_EMULATOR);
request.addTestDevice("1DA1E070BC7D4ABE8BA77EB73C2CB0AA"); // wololo's phone
request.addTestDevice("C386F3830A9789C649098A817BF54C04"); // xawotihs's tablet
// Initiate a generic request to load it with an ad
mAdView.loadAd(request);
} }
// Setup // Setup
@@ -512,14 +494,6 @@ public class SDLActivity extends Activity implements OnKeyListener
{ {
return; return;
} }
if ((command.compareTo("entergamestate:menu") == 0) || (command.compareTo("enterduelphase:end") == 0))
{
mAdView.setVisibility(View.VISIBLE);
} else if (command.compareTo("leavegamestate:menu") == 0)
{
mAdView.setVisibility(View.INVISIBLE);
}
} }
// Messages from the SDLMain thread // Messages from the SDLMain thread
+31 -2
View File
@@ -1,4 +1,33 @@
OBJS = objs/InteractiveButton.o objs/AbilityParser.o objs/ActionElement.o objs/ActionLayer.o objs/ActionStack.o objs/AIHints.o objs/AIMomirPlayer.o objs/AIPlayer.o objs/AIPlayerBaka.o objs/AIStats.o objs/AllAbilities.o objs/CardGui.o objs/CardDescriptor.o objs/CardDisplay.o objs/CardEffect.o objs/CardPrimitive.o objs/CardSelector.o objs/CardSelectorSingleton.o objs/Counters.o objs/Credits.o objs/Damage.o objs/DamagerDamaged.o objs/DeckDataWrapper.o objs/DeckEditorMenu.o objs/DeckMenu.o objs/DeckMenuItem.o objs/DeckMetaData.o objs/DeckStats.o objs/DuelLayers.o objs/Effects.o objs/ExtraCost.o objs/GameApp.o objs/GameLauncher.o objs/GameObserver.o objs/GameOptions.o objs/GameState.o objs/GameStateAwards.o objs/GameStateDeckViewer.o objs/GameStateDuel.o objs/DeckManager.o objs/GameStateMenu.o objs/GameStateOptions.o objs/GameStateShop.o objs/GameStateStory.o objs/GameStateTransitions.o objs/GuiAvatars.o objs/GuiBackground.o objs/GuiCardsController.o objs/GuiCombat.o objs/GuiFrame.o objs/GuiHand.o objs/GuiLayers.o objs/GuiMana.o objs/GuiPhaseBar.o objs/GuiPlay.o objs/GuiStatic.o objs/IconButton.o objs/ManaCost.o objs/ManaCostHybrid.o objs/MenuItem.o objs/ModRules.o objs/MTGAbility.o objs/MTGCardInstance.o objs/MTGCard.o objs/MTGDeck.o objs/MTGDefinitions.o objs/MTGGamePhase.o objs/MTGGameZones.o objs/MTGPack.o objs/MTGRules.o objs/Navigator.o objs/ObjectAnalytics.o objs/OptionItem.o objs/PhaseRing.o objs/Player.o objs/PlayerData.o objs/PlayGuiObjectController.o objs/PlayGuiObject.o objs/PlayRestrictions.o objs/Pos.o objs/PrecompiledHeader.o objs/PriceList.o objs/ReplacementEffects.o objs/Rules.o objs/SimpleMenu.o objs/SimpleButton.o objs/SimpleMenuItem.o objs/SimplePad.o objs/SimplePopup.o objs/StoryFlow.o objs/StyleManager.o objs/Subtypes.o objs/TargetChooser.o objs/TargetsList.o objs/TextScroller.o objs/ThisDescriptor.o objs/Token.o objs/Translate.o objs/TranslateKeys.o objs/Trash.o objs/utils.o objs/WEvent.o objs/WResourceManager.o objs/WCachedResource.o objs/WDataSrc.o objs/WGui.o objs/WFilter.o objs/Tasks.o objs/WFont.o OBJS = objs/InteractiveButton.o objs/AbilityParser.o objs/ActionElement.o\
objs/ActionLayer.o objs/ActionStack.o objs/AIHints.o objs/AIMomirPlayer.o\
objs/AIPlayer.o objs/AIPlayerBaka.o objs/AIStats.o objs/AllAbilities.o\
objs/CardGui.o objs/CardDescriptor.o objs/CardDisplay.o\
objs/CardPrimitive.o objs/CardSelector.o objs/CardSelectorSingleton.o\
objs/Counters.o objs/Credits.o objs/Damage.o objs/DamagerDamaged.o\
objs/DeckDataWrapper.o objs/DeckEditorMenu.o objs/DeckMenu.o\
objs/DeckMenuItem.o objs/DeckMetaData.o objs/DeckStats.o objs/DuelLayers.o\
objs/Effects.o objs/ExtraCost.o objs/GameApp.o objs/GameLauncher.o\
objs/GameObserver.o objs/GameOptions.o objs/GameState.o\
objs/GameStateAwards.o objs/GameStateDeckViewer.o objs/GameStateDuel.o\
objs/DeckManager.o objs/GameStateMenu.o objs/GameStateOptions.o\
objs/GameStateShop.o objs/GameStateStory.o objs/GameStateTransitions.o\
objs/GuiAvatars.o objs/GuiBackground.o objs/GuiCardsController.o\
objs/GuiCombat.o objs/GuiFrame.o objs/GuiHand.o objs/GuiLayers.o\
objs/GuiMana.o objs/GuiPhaseBar.o objs/GuiPlay.o objs/GuiStatic.o\
objs/IconButton.o objs/ManaCost.o objs/ManaCostHybrid.o objs/MenuItem.o\
objs/ModRules.o objs/MTGAbility.o objs/MTGCardInstance.o objs/MTGCard.o\
objs/MTGDeck.o objs/MTGDefinitions.o objs/MTGGamePhase.o objs/MTGGameZones.o\
objs/MTGPack.o objs/MTGRules.o objs/Navigator.o objs/ObjectAnalytics.o\
objs/OptionItem.o objs/PhaseRing.o objs/Player.o objs/PlayerData.o\
objs/PlayGuiObjectController.o objs/PlayGuiObject.o objs/PlayRestrictions.o\
objs/Pos.o objs/PrecompiledHeader.o objs/PriceList.o objs/ReplacementEffects.o\
objs/Rules.o objs/SimpleMenu.o objs/SimpleButton.o objs/SimpleMenuItem.o\
objs/SimplePad.o objs/SimplePopup.o objs/StoryFlow.o objs/StyleManager.o\
objs/Subtypes.o objs/TargetChooser.o objs/TargetsList.o objs/TextScroller.o\
objs/ThisDescriptor.o objs/Token.o objs/Translate.o objs/TranslateKeys.o\
objs/Trash.o objs/utils.o objs/WEvent.o objs/WResourceManager.o\
objs/WCachedResource.o objs/WDataSrc.o objs/WGui.o objs/WFilter.o objs/Tasks.o\
objs/WFont.o objs/CarouselDeckView.o objs/GridDeckView.o objs/DeckView.o
DEPS = $(patsubst objs/%.o, deps/%.d, $(OBJS)) DEPS = $(patsubst objs/%.o, deps/%.d, $(OBJS))
RESULT = $(shell psp-config --psp-prefix 2> Makefile.cache) RESULT = $(shell psp-config --psp-prefix 2> Makefile.cache)
@@ -44,7 +73,7 @@ PSP_EBOOT_UNKPNG = pic0.png
PSP_EBOOT_PIC1 = pic1.png PSP_EBOOT_PIC1 = pic1.png
INCDIR = ../../JGE/include ../../JGE/src/zipFS ../../JGE/include/psp ../../JGE/include/psp/freetype2 ../../JGE/src ../../projects/mtg/include ../../Boost INCDIR = ../../JGE/include ../../JGE/src/zipFS ../../JGE/include/psp ../../JGE/include/psp/freetype2 ../../JGE/src ../../projects/mtg/include ../../Boost
LIBDIR = ../../JGE/lib/psp LIBDIR = ../../JGE/lib/psp
CFLAGS = -O2 -G0 -DPSPFW3XX -DDEVHOOK -DUSE_PRECOMPILED_HEADERS=1 -DPSP CFLAGS = -O2 -G0 -DPSPFW3XX -DDEVHOOK -DUSE_PRECOMPILED_HEADERS=1 -DPSP -DTIXML_USE_STL
else else
OBJS += objs/TestSuiteAI.o OBJS += objs/TestSuiteAI.o
INCDIR = -I../../JGE/include -I../../JGE/src -I/usr/X11/include -I../../projects/mtg/include -I../../Boost -I../../JGE/src/zipFS INCDIR = -I../../JGE/include -I../../JGE/src -I/usr/X11/include -I../../projects/mtg/include -I../../Boost -I../../JGE/src/zipFS
+1
View File
@@ -16,6 +16,7 @@ auto=flashbackrule
auto=retracerule auto=retracerule
auto=suspendrule auto=suspendrule
auto=morphrule auto=morphrule
auto=playfromgraveyardrule
auto=attackrule auto=attackrule
auto=blockrule auto=blockrule
auto=combattriggerrule auto=combattriggerrule
+106
View File
@@ -0,0 +1,106 @@
[meta]
author=Wagic Team
name=From the Vault: Twenty
block=Vault
year=2013
[/meta]
[card]
primitive=Akroma's Vengeance
id=373328
rarity=M
[/card]
[card]
primitive=Chainer's Edict
id=373317
rarity=M
[/card]
[card]
primitive=Chameleon Colossus
id=373321
rarity=M
[/card]
[card]
primitive=Char
id=373332
rarity=M
[/card]
[card]
primitive=Cruel Ultimatum
id=373318
rarity=M
[/card]
[card]
primitive=Dark Ritual
id=373329
rarity=M
[/card]
[card]
primitive=Fact or Fiction
id=373325
rarity=M
[/card]
[card]
primitive=Fyndhorn Elves
id=373320
rarity=M
[/card]
[card]
primitive=Gilded Lotus
id=373335
rarity=M
[/card]
[card]
primitive=Green Sun's Zenith
id=373333
rarity=M
[/card]
[card]
primitive=Hymn to Tourach
id=373324
rarity=M
[/card]
[card]
primitive=Impulse
id=373330
rarity=M
[/card]
[card]
primitive=Ink-Eyes, Servant of Oni
id=373327
rarity=M
[/card]
[card]
primitive=Jace, the Mind Sculptor
id=373316
rarity=M
[/card]
[card]
primitive=Kessig Wolf Run
id=373323
rarity=M
[/card]
[card]
primitive=Swords to Plowshares
id=373334
rarity=M
[/card]
[card]
primitive=Tangle Wire
id=373322
rarity=M
[/card]
[card]
primitive=Thran Dynamo
id=373331
rarity=M
[/card]
[card]
primitive=Venser, Shaper Savant
id=373326
rarity=M
[/card]
[card]
primitive=Wall of Blossoms
id=373319
rarity=M
[/card]
+36 -8
View File
@@ -17432,7 +17432,7 @@ toughness=4
[card] [card]
name=Cranial Plating name=Cranial Plating
auto=foreach(artifact|mybattlefield) 1/0 auto=foreach(artifact|mybattlefield) 1/0
auto={B}{B}:attach auto={B}{B}:name(attach) retarget target(creature|mybattlefield)
auto={1}:equip auto={1}:equip
text=Equipped creature gets +1/+0 for each artifact you control. -- {B}{B}: Attach Cranial Plating to target creature you control. -- Equip {1} ({1}: Attach to target creature you control. Equip only as a sorcery.) text=Equipped creature gets +1/+0 for each artifact you control. -- {B}{B}: Attach Cranial Plating to target creature you control. -- Equip {1} ({1}: Attach to target creature you control. Equip only as a sorcery.)
mana={2} mana={2}
@@ -18104,6 +18104,13 @@ mana={3}{R}
type=Enchantment type=Enchantment
[/card] [/card]
[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 name=Crude Rampart
abilities=defender abilities=defender
facedown={3} facedown={3}
@@ -23286,7 +23293,7 @@ type=Sorcery
[/card] [/card]
[card] [card]
name=Dragon Hatchling name=Dragon Hatchling
auto={1}{R}:1/0 auto={R}:1/0
abilities=flying abilities=flying
text=Flying -- {R}: Dragon Hatchling gets +1/+0 until end of turn. text=Flying -- {R}: Dragon Hatchling gets +1/+0 until end of turn.
mana={1}{R} mana={1}{R}
@@ -39826,7 +39833,7 @@ name=Healer's Headdress
auto={1}:equip auto={1}:equip
auto=0/2 auto=0/2
auto=teach(creature) {T}:prevent:1 target(creature,player) auto=teach(creature) {T}:prevent:1 target(creature,player)
auto={W}{W}:attach auto={W}{W}:name(attach) retarget target(creature|mybattlefield)
text=Equipped creature gets +0/+2 and has "{T}: Prevent the next 1 damage that would be dealt to target creature or player this turn." -- {W}{W}: Attach Healer's Headdress to target creature you control. -- Equip {1} ({1}: Attach to target creature you control. Equip only as a sorcery.) text=Equipped creature gets +0/+2 and has "{T}: Prevent the next 1 damage that would be dealt to target creature or player this turn." -- {W}{W}: Attach Healer's Headdress to target creature you control. -- Equip {1} ({1}: Attach to target creature you control. Equip only as a sorcery.)
mana={2} mana={2}
type=Artifact type=Artifact
@@ -41596,7 +41603,7 @@ toughness=2
name=Horned Helm name=Horned Helm
auto=1/1 auto=1/1
auto=trample auto=trample
auto={G}{G}:attach auto={G}{G}:name(attach) retarget target(creature|mybattlefield)
auto={1}:equip auto={1}:equip
text=Equipped creature gets +1/+1 and has trample. -- {G}{G}: Attach Horned Helm to target creature you control. -- Equip {1} ({1}: Attach to target creature you control. Equip only as a sorcery.) text=Equipped creature gets +1/+1 and has trample. -- {G}{G}: Attach Horned Helm to target creature you control. -- Equip {1} ({1}: Attach to target creature you control. Equip only as a sorcery.)
mana={2} mana={2}
@@ -54155,6 +54162,18 @@ power=2
toughness=2 toughness=2
[/card] [/card]
[card] [card]
name=Master of Waves
abilities=protection from red
auto=lord(Elemental|mybattlefield) 1/1
auto=token(Elemental,Creature Elemental,1/0)*type:manaU
text=Protection from red. -- Elemental creatures you control get +1/+1. -- When Master of Waves enters the battlefield, put a number of 1/0 blue Elemental creature tokens onto the battlefield equal to your devotion to blue. (Each {U} in the mana costs of permanents you control counts toward your devotion to blue.)
mana={3}{U}
type=Creature
subtype=Merfolk Wizard
power=2
toughness=1
[/card]
[card]
name=Master Splicer name=Master Splicer
auto=token(Golem,Artifact Creature Golem,3/3) auto=token(Golem,Artifact Creature Golem,3/3)
auto=lord(golem|mybattlefield) 1/1 auto=lord(golem|mybattlefield) 1/1
@@ -59971,7 +59990,7 @@ toughness=2
[card] [card]
name=Neurok Stealthsuit name=Neurok Stealthsuit
auto=teach(creature) shroud auto=teach(creature) shroud
auto={U}{U}:attach auto={U}{U}:name(attach) retarget target(creature|mybattlefield)
auto={1}:equip auto={1}:equip
text=Equipped creature has shroud. (It can't be the target of spells or abilities.) -- {U}{U}: Attach Neurok Stealthsuit to target creature you control. -- Equip {1} ({1}: Attach to target creature you control. Equip only as a sorcery.) text=Equipped creature has shroud. (It can't be the target of spells or abilities.) -- {U}{U}: Attach Neurok Stealthsuit to target creature you control. -- Equip {1} ({1}: Attach to target creature you control. Equip only as a sorcery.)
mana={2} mana={2}
@@ -83425,7 +83444,7 @@ toughness=3
[card] [card]
name=Sparring Collar name=Sparring Collar
auto=first strike auto=first strike
auto={R}{R}:attach auto={R}{R}:name(attach) retarget target(creature|mybattlefield)
auto={1}:equip auto={1}:equip
text=Equipped creature has first strike. -- {R}{R}: Attach Sparring Collar to target creature you control. -- Equip {1} ({1}: Attach to target creature you control. Equip only as a sorcery.) text=Equipped creature has first strike. -- {R}{R}: Attach Sparring Collar to target creature you control. -- Equip {1} ({1}: Attach to target creature you control. Equip only as a sorcery.)
mana={2} mana={2}
@@ -83704,7 +83723,7 @@ type=Instant
[card] [card]
name=Spell Rupture name=Spell Rupture
target=*|stack 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. text=Counter target spell unless its controller pays {X}, where X is the greatest power among creatures you control.
mana={1}{U} mana={1}{U}
type=Instant type=Instant
@@ -88480,7 +88499,7 @@ toughness=3
[card] [card]
name=Syncopate name=Syncopate
target=*|stack 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. 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} mana={X}{U}
type=Instant type=Instant
@@ -103456,6 +103475,15 @@ mana={1}{B}
type=Enchantment type=Enchantment
[/card] [/card]
[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 name=Yawning Fissure
auto=ability$!name(sacrifice land) notatarget(land|mybattlefield) sacrifice!$ opponent auto=ability$!name(sacrifice land) notatarget(land|mybattlefield) sacrifice!$ opponent
text=Each opponent sacrifices a land. text=Each opponent sacrifices a land.
@@ -3187,19 +3187,6 @@ mana={2}
type=Artifact type=Artifact
[/card] [/card]
[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 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. 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} mana={1}{B}
+5 -1
View File
@@ -226,6 +226,7 @@ colossus_of_sardia1.txt
colossus_of_sardia2.txt colossus_of_sardia2.txt
composite_golem.txt composite_golem.txt
conservator.txt conservator.txt
consign_to_dream.txt
Contagion_Clasp.txt Contagion_Clasp.txt
control_magic.txt control_magic.txt
control_magic2.txt control_magic2.txt
@@ -238,7 +239,7 @@ counterspell.txt
counterspell2.txt counterspell2.txt
counterspell3.txt counterspell3.txt
counterspell4.txt counterspell4.txt
counter_unless_pay.txt counter_unless_pay_x.txt
Covetous_Dragon_ASLONGAS_3.txt Covetous_Dragon_ASLONGAS_3.txt
Covetous_Dragon_ASLONGAS_4.txt Covetous_Dragon_ASLONGAS_4.txt
cranial_plating.txt cranial_plating.txt
@@ -248,6 +249,7 @@ curiosity2_i217.txt
crimson_kobolds.txt crimson_kobolds.txt
crosis_s_catacombs_1.txt crosis_s_catacombs_1.txt
crosis_s_catacombs_2.txt crosis_s_catacombs_2.txt
crucible_of_worlds.txt
crumble.txt crumble.txt
crystal_rod_i172.txt crystal_rod_i172.txt
cursed_land1_i188.txt cursed_land1_i188.txt
@@ -614,6 +616,8 @@ souls_attendant_i489.txt
soul's grace_POWERLIFEGAIN.txt soul's grace_POWERLIFEGAIN.txt
spark_elemental.txt spark_elemental.txt
spectral_shield_CANTBETARGETOF.txt spectral_shield_CANTBETARGETOF.txt
spell_rupture.txt
spell_rupture_2.txt
sphinx_summoner.txt sphinx_summoner.txt
spirit_link.txt spirit_link.txt
spirit_link_i173.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]
+5 -3
View File
@@ -2,6 +2,7 @@
<!-- build.properties should contain the values for major, minor and point --> <!-- build.properties should contain the values for major, minor and point -->
<property file="build.properties" /> <property file="build.properties" />
<property file="build.number.properties" /> <property file="build.number.properties" />
<property environment="env"/>
<path id="groovy.class.path" > <path id="groovy.class.path" >
<fileset dir="${groovy.dir}" /> <fileset dir="${groovy.dir}" />
@@ -76,15 +77,16 @@ Author: Michael Nguyen
#define WAGIC_VERSION_MAJOR ${build.major} #define WAGIC_VERSION_MAJOR ${build.major}
#define WAGIC_VERSION_MEDIUM ${build.minor} #define WAGIC_VERSION_MEDIUM ${build.minor}
#define WAGIC_VERSION_MINOR ${build.point} #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_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_FILE(a, b, c) VERSION_WITHOUT_DOT(a, b, c)
#define VERSION_TOSTRING(a) #a #define VERSION_TOSTRING(a) #a
#define VERSION_STRINGIFY(a) VERSION_TOSTRING(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_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)
+10 -17
View File
@@ -9,10 +9,6 @@
#include <JGui.h> #include <JGui.h>
#include "MTGDefinitions.h" #include "MTGDefinitions.h"
#define INACTIVE 0
#define ACTION_REQUESTED 1
#define ACTIVE 2
class MTGCardInstance; class MTGCardInstance;
class ManaCost; class ManaCost;
class Targetable; class Targetable;
@@ -22,31 +18,33 @@ class WEvent;
class ActionElement: public JGuiObject class ActionElement: public JGuiObject
{ {
protected: protected:
int activeState; enum Activity{
Inactive,
ActionRequested,
Active
};
Activity activity;
TargetChooser * tc; TargetChooser * tc;
public: public:
GamePhase currentPhase; GamePhase currentPhase;
GamePhase newPhase; GamePhase newPhase;
int modal; int modal;
int waitingForAnswer; int waitingForAnswer;
int getActivity(); virtual void Update(float){}
virtual void Update(float){}; virtual void Render(){}
virtual void Render(){};
virtual int testDestroy() virtual int testDestroy()
{ {
return 0; return 0;
} }
;
virtual int destroy() virtual int destroy()
{ {
return 0; return 0;
} }
;
virtual bool CheckUserInput(JButton) virtual bool CheckUserInput(JButton)
{ {
return false; return false;
} }
;
ActionElement(int id); ActionElement(int id);
ActionElement(const ActionElement& copyFromMe); ActionElement(const ActionElement& copyFromMe);
TargetChooser * getActionTc(){return tc;} TargetChooser * getActionTc(){return tc;}
@@ -62,27 +60,22 @@ public:
{ {
return 0; return 0;
} }
;
virtual int stillInUse(MTGCardInstance *) virtual int stillInUse(MTGCardInstance *)
{ {
return 0; return 0;
} }
;
virtual int receiveEvent(WEvent *) virtual int receiveEvent(WEvent *)
{ {
return 0; return 0;
} }
;
virtual int reactToClick(MTGCardInstance *) virtual int reactToClick(MTGCardInstance *)
{ {
return 0; return 0;
} }
; virtual const string getMenuText()
virtual const char * getMenuText()
{ {
return "Ability"; return "Ability";
} }
;
virtual ActionElement * clone() const = 0; virtual ActionElement * clone() const = 0;
}; };
+6 -8
View File
@@ -41,16 +41,9 @@ class DamageStack;
class ManaCost; class ManaCost;
class TargetChooser; class TargetChooser;
#define ACTIONSTACK_STANDARD 0
#define ACTIONSTACK_TARGET 1
class Interruptible: public PlayGuiObject, public Targetable class Interruptible: public PlayGuiObject, public Targetable
{ {
public: public:
//TODO : remove these when they are back in PlayGuiObject
float x, y;
int state, display; int state, display;
MTGCardInstance * source; MTGCardInstance * source;
virtual void Entering() virtual void Entering()
@@ -186,6 +179,11 @@ public:
class ActionStack :public GuiLayer class ActionStack :public GuiLayer
{ {
public: public:
enum ActionStackMode{
ACTIONSTACK_STANDARD = 0,
ACTIONSTACK_TARGET = 1
};
typedef enum typedef enum
{ {
NOT_DECIDED = 0, NOT_DECIDED = 0,
@@ -207,7 +205,7 @@ protected:
InterruptDecision interruptDecision[2]; InterruptDecision interruptDecision[2];
float timer; float timer;
int currentState; int currentState;
int mode; ActionStackMode mode;
int checked; int checked;
ATutorialMessage* currentTutorial; ATutorialMessage* currentTutorial;
int interruptBtnXOffset, noBtnXOffset, noToAllBtnXOffset, interruptDialogWidth; int interruptBtnXOffset, noBtnXOffset, noToAllBtnXOffset, interruptDialogWidth;
+109 -197
View File
@@ -873,8 +873,8 @@ public:
return 0; return 0;
if (!tc->canTarget(e->damage->target)) return 0; if (!tc->canTarget(e->damage->target)) return 0;
if (fromTc && !fromTc->canTarget(e->damage->source)) return 0; if (fromTc && !fromTc->canTarget(e->damage->source)) return 0;
if (type == 1 && e->damage->typeOfDamage != DAMAGE_COMBAT) return 0; if (type == 1 && e->damage->typeOfDamage != Damage::DAMAGE_COMBAT) return 0;
if (type == 2 && e->damage->typeOfDamage == DAMAGE_COMBAT) return 0; if (type == 2 && e->damage->typeOfDamage == Damage::DAMAGE_COMBAT) return 0;
e->damage->target->thatmuch = e->damage->damage; e->damage->target->thatmuch = e->damage->damage;
e->damage->source->thatmuch = e->damage->damage; e->damage->source->thatmuch = e->damage->damage;
this->source->thatmuch = e->damage->damage; this->source->thatmuch = e->damage->damage;
@@ -1081,7 +1081,7 @@ public:
ManaCost * cost = NULL); ManaCost * cost = NULL);
int resolve(); int resolve();
const char* getMenuText(); const string getMenuText();
AACounter * clone() const; AACounter * clone() const;
}; };
@@ -1100,7 +1100,7 @@ public:
bool all,ManaCost * cost = NULL); bool all,ManaCost * cost = NULL);
int resolve(); int resolve();
const char* getMenuText(); const string getMenuText();
AARemoveAllCounter * clone() const; AARemoveAllCounter * clone() const;
}; };
@@ -1110,7 +1110,7 @@ class AAResetDamage: public ActivatedAbility
public: public:
AAResetDamage(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, ManaCost * cost = NULL); AAResetDamage(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, ManaCost * cost = NULL);
int resolve(); int resolve();
const char* getMenuText(); const string getMenuText();
AAResetDamage * clone() const; AAResetDamage * clone() const;
}; };
@@ -1120,7 +1120,7 @@ public:
string named; string named;
AAFakeAbility(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target,string _newName, ManaCost * cost = NULL); AAFakeAbility(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target,string _newName, ManaCost * cost = NULL);
int resolve(); int resolve();
const char* getMenuText(); const string getMenuText();
AAFakeAbility * clone() const; AAFakeAbility * clone() const;
}; };
@@ -1131,7 +1131,7 @@ public:
AAFizzler(GameObserver* observer, int _id, MTGCardInstance * card, Spell * _target, ManaCost * _cost = NULL); AAFizzler(GameObserver* observer, int _id, MTGCardInstance * card, Spell * _target, ManaCost * _cost = NULL);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AAFizzler* clone() const; AAFizzler* clone() const;
}; };
@@ -1160,7 +1160,7 @@ public:
string Cond; string Cond;
IfThenAbility(GameObserver* observer, int _id,MTGAbility * delayedAbility = NULL,MTGAbility * delayedElseAbility = NULL, MTGCardInstance * _source=NULL, Targetable * target = NULL, int type = 1,string Cond = ""); IfThenAbility(GameObserver* observer, int _id,MTGAbility * delayedAbility = NULL,MTGAbility * delayedElseAbility = NULL, MTGCardInstance * _source=NULL, Targetable * target = NULL, int type = 1,string Cond = "");
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
IfThenAbility * clone() const; IfThenAbility * clone() const;
~IfThenAbility(); ~IfThenAbility();
}; };
@@ -1179,7 +1179,7 @@ public:
void Update(float dt); void Update(float dt);
const char * getMenuText(); const string getMenuText();
int testDestroy(); int testDestroy();
int isReactingToTargetClick(Targetable * card); int isReactingToTargetClick(Targetable * card);
@@ -1209,7 +1209,7 @@ public:
bool CheckUserInput(JButton key); bool CheckUserInput(JButton key);
void Update(float dt); void Update(float dt);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
int testDestroy(); int testDestroy();
int isReactingToTargetClick(Targetable * card); int isReactingToTargetClick(Targetable * card);
int reactToTargetClick(Targetable * object); int reactToTargetClick(Targetable * object);
@@ -1225,7 +1225,7 @@ class AAProliferate: public ActivatedAbility
public: public:
AAProliferate(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target,ManaCost * cost = NULL); AAProliferate(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target,ManaCost * cost = NULL);
int resolve(); int resolve();
const char* getMenuText(); const string getMenuText();
AAProliferate * clone() const; AAProliferate * clone() const;
~AAProliferate(); ~AAProliferate();
}; };
@@ -1243,7 +1243,7 @@ public:
int resolve(); int resolve();
int addToGame(); int addToGame();
int destroy(); int destroy();
const char * getMenuText(); const string getMenuText();
MultiAbility * clone() const; MultiAbility * clone() const;
~MultiAbility(); ~MultiAbility();
}; };
@@ -1258,8 +1258,9 @@ public:
GenericActivatedAbility(GameObserver* observer, string newName,string castRestriction,int _id, MTGCardInstance * card, MTGAbility * a, ManaCost * _cost, string limit = "",MTGAbility * sideEffects = NULL,string usesBeforeSideEffects = "", GenericActivatedAbility(GameObserver* observer, string newName,string castRestriction,int _id, MTGCardInstance * card, MTGAbility * a, ManaCost * _cost, string limit = "",MTGAbility * sideEffects = NULL,string usesBeforeSideEffects = "",
int restrictions = 0, MTGGameZone * dest = NULL); int restrictions = 0, MTGGameZone * dest = NULL);
GenericActivatedAbility(const GenericActivatedAbility& other);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL); int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
void Update(float dt); void Update(float dt);
int testDestroy(); int testDestroy();
@@ -1274,7 +1275,7 @@ class AALibraryBottom: public ActivatedAbility
public: public:
AALibraryBottom(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL); AALibraryBottom(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AALibraryBottom * clone() const; AALibraryBottom * clone() const;
}; };
@@ -1284,7 +1285,7 @@ class AACopier: public ActivatedAbility
public: public:
AACopier(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL); AACopier(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AACopier * clone() const; AACopier * clone() const;
}; };
//imprint //imprint
@@ -1293,7 +1294,7 @@ class AAPhaseOut: public ActivatedAbility
public: public:
AAPhaseOut(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL); AAPhaseOut(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AAPhaseOut * clone() const; AAPhaseOut * clone() const;
}; };
//cloning...this makes a token thats a copy of the target. //cloning...this makes a token thats a copy of the target.
@@ -1310,7 +1311,7 @@ public:
AACloner(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL, int who = 0, AACloner(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL, int who = 0,
string abilitiesStringList = "",string typeslist = ""); string abilitiesStringList = "",string typeslist = "");
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
AACloner * clone() const; AACloner * clone() const;
~AACloner(); ~AACloner();
@@ -1326,7 +1327,7 @@ public:
AAMover(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, string dest,string _name, ManaCost * _cost = NULL); AAMover(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, string dest,string _name, ManaCost * _cost = NULL);
MTGGameZone * destinationZone(Targetable * target = NULL); MTGGameZone * destinationZone(Targetable * target = NULL);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
const char * getMenuText(TargetChooser * fromTc); const char * getMenuText(TargetChooser * fromTc);
AAMover * clone() const; AAMover * clone() const;
~AAMover(); ~AAMover();
@@ -1342,7 +1343,7 @@ public:
AARandomMover(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, string tcs, string from, string to); AARandomMover(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, string tcs, string from, string to);
MTGGameZone * destinationZone(Targetable * target = NULL,string zone = ""); MTGGameZone * destinationZone(Targetable * target = NULL,string zone = "");
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AARandomMover * clone() const; AARandomMover * clone() const;
~AARandomMover(); ~AARandomMover();
}; };
@@ -1356,7 +1357,7 @@ public:
string menu; string menu;
AABuryCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target); AABuryCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AABuryCard * clone() const; AABuryCard * clone() const;
~AABuryCard(); ~AABuryCard();
}; };
@@ -1367,7 +1368,7 @@ public:
MTGAbility * andAbility; MTGAbility * andAbility;
AADestroyCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target); AADestroyCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AADestroyCard * clone() const; AADestroyCard * clone() const;
~AADestroyCard(); ~AADestroyCard();
}; };
@@ -1378,7 +1379,7 @@ public:
MTGAbility * andAbility; MTGAbility * andAbility;
AASacrificeCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target); AASacrificeCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AASacrificeCard * clone() const; AASacrificeCard * clone() const;
~AASacrificeCard(); ~AASacrificeCard();
}; };
@@ -1389,7 +1390,7 @@ public:
MTGAbility * andAbility; MTGAbility * andAbility;
AADiscardCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target); AADiscardCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AADiscardCard * clone() const; AADiscardCard * clone() const;
~AADiscardCard(); ~AADiscardCard();
}; };
@@ -1409,7 +1410,7 @@ public:
string tcString; string tcString;
GenericTargetAbility(GameObserver* observer, string newName, string castRestriction, int _id, MTGCardInstance * _source, TargetChooser * _tc, MTGAbility * a, ManaCost * _cost = NULL, string limit = "",MTGAbility * sideEffects = NULL,string usesBeforeSideEffects = "", int restrictions = 0, MTGGameZone * dest = NULL,string tcString =""); GenericTargetAbility(GameObserver* observer, string newName, string castRestriction, int _id, MTGCardInstance * _source, TargetChooser * _tc, MTGAbility * a, ManaCost * _cost = NULL, string limit = "",MTGAbility * sideEffects = NULL,string usesBeforeSideEffects = "", int restrictions = 0, MTGGameZone * dest = NULL,string tcString ="");
const char * getMenuText(); const string getMenuText();
~GenericTargetAbility(); ~GenericTargetAbility();
GenericTargetAbility * clone() const; GenericTargetAbility * clone() const;
int resolve(); int resolve();
@@ -1447,7 +1448,7 @@ public:
return 1; return 1;
} }
const char * getMenuText() const string getMenuText()
{ {
return "Ninjutsu"; return "Ninjutsu";
} }
@@ -1479,7 +1480,7 @@ public:
return 1; return 1;
} }
const char * getMenuText() const string getMenuText()
{ {
return "Remove From Combat"; return "Remove From Combat";
} }
@@ -1501,7 +1502,7 @@ public:
AADrawer(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost,string nbcardsStr, int who = AADrawer(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost,string nbcardsStr, int who =
TargetChooser::UNSET,bool noReplace = false); TargetChooser::UNSET,bool noReplace = false);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AADrawer * clone() const; AADrawer * clone() const;
int getNumCards(); int getNumCards();
}; };
@@ -1521,7 +1522,7 @@ public:
ACastRestriction(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, TargetChooser * _restrictionsScope, WParsedInt * _value, bool _modifyExisting, int _zoneId, int who = TargetChooser::UNSET); ACastRestriction(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, TargetChooser * _restrictionsScope, WParsedInt * _value, bool _modifyExisting, int _zoneId, int who = TargetChooser::UNSET);
int addToGame(); int addToGame();
int destroy(); int destroy();
const char * getMenuText(); const string getMenuText();
ACastRestriction * clone() const; ACastRestriction * clone() const;
~ACastRestriction(); ~ACastRestriction();
@@ -1536,7 +1537,7 @@ public:
AInstantCastRestrictionUEOT(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, TargetChooser * _restrictionsScope, WParsedInt * _value, bool _modifyExisting, int _zoneId, int who = TargetChooser::UNSET); AInstantCastRestrictionUEOT(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, TargetChooser * _restrictionsScope, WParsedInt * _value, bool _modifyExisting, int _zoneId, int who = TargetChooser::UNSET);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AInstantCastRestrictionUEOT * clone() const; AInstantCastRestrictionUEOT * clone() const;
~AInstantCastRestrictionUEOT(); ~AInstantCastRestrictionUEOT();
}; };
@@ -1549,7 +1550,7 @@ public:
AALifer(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target,string life_s, ManaCost * _cost = NULL, AALifer(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target,string life_s, ManaCost * _cost = NULL,
int who = TargetChooser::UNSET); int who = TargetChooser::UNSET);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AALifer * clone() const; AALifer * clone() const;
int getLife(); int getLife();
@@ -1562,7 +1563,7 @@ public:
AAWinGame(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost = NULL, int who = AAWinGame(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost = NULL, int who =
TargetChooser::UNSET); TargetChooser::UNSET);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AAWinGame * clone() const; AAWinGame * clone() const;
}; };
@@ -1603,7 +1604,7 @@ public:
return 1; return 1;
} }
const char * getMenuText() const string getMenuText()
{ {
return Constants::MTGBasicAbilities[ability]; return Constants::MTGBasicAbilities[ability];
} }
@@ -1645,7 +1646,7 @@ public:
return InstantAbility::addToGame(); return InstantAbility::addToGame();
} }
const char * getMenuText() const string getMenuText()
{ {
return Constants::MTGBasicAbilities[ability]; return Constants::MTGBasicAbilities[ability];
} }
@@ -1706,7 +1707,7 @@ public:
return ActivatedAbility::addToGame(); return ActivatedAbility::addToGame();
} }
const char * getMenuText() const string getMenuText()
{ {
return ability->getMenuText(); return ability->getMenuText();
} }
@@ -1862,7 +1863,7 @@ public:
return 1; return 1;
} }
const char * getMenuText() const string getMenuText()
{ {
sprintf(menuText,"Protection from %s",tcstr.c_str()); sprintf(menuText,"Protection from %s",tcstr.c_str());
return menuText; return menuText;
@@ -2054,7 +2055,7 @@ public:
((MTGCardInstance *) target)->addToToughness(-wppt->toughness.getValue()); ((MTGCardInstance *) target)->addToToughness(-wppt->toughness.getValue());
return 1; return 1;
} }
const char * getMenuText() const string getMenuText()
{ {
if(PT.size()) if(PT.size())
{ {
@@ -2147,7 +2148,7 @@ public:
return 1; return 1;
} }
const char * getMenuText() const string getMenuText()
{ {
return ability->getMenuText(); return ability->getMenuText();
} }
@@ -2189,7 +2190,7 @@ public:
return toAdd->addToGame(); return toAdd->addToGame();
} }
const char * getMenuText() const string getMenuText()
{ {
return ability->getMenuText(); return ability->getMenuText();
} }
@@ -2287,7 +2288,7 @@ public:
return 1; return 1;
} }
const char * getMenuText() const string getMenuText()
{ {
return "Regenerate"; return "Regenerate";
} }
@@ -2494,7 +2495,7 @@ public:
SAFE_DELETE(ability); SAFE_DELETE(ability);
} }
const char * getMenuText() const string getMenuText()
{ {
if(ability) if(ability)
{ {
@@ -2523,13 +2524,13 @@ public:
ALord(GameObserver* observer, int _id, MTGCardInstance * card, TargetChooser * _tc, int _includeSelf, MTGAbility * a) : ALord(GameObserver* observer, int _id, MTGCardInstance * card, TargetChooser * _tc, int _includeSelf, MTGAbility * a) :
ListMaintainerAbility(observer, _id, card), NestedAbility(a) ListMaintainerAbility(observer, _id, card), NestedAbility(a)
{ {
tc = _tc; tc = _tc;
tc->targetter = NULL; tc->targetter = NULL;
includeSelf = _includeSelf; includeSelf = _includeSelf;
if(ability->aType == MTGAbility::STANDARD_PREVENT) if(ability->aType == MTGAbility::STANDARD_PREVENT)
aType = MTGAbility::STANDARD_PREVENT; aType = MTGAbility::STANDARD_PREVENT;
} }
//returns true if it is me who created ability a attached to Damageable d //returns true if it is me who created ability a attached to Damageable d
bool isParentOf(Damageable * d, MTGAbility * a) bool isParentOf(Damageable * d, MTGAbility * a)
@@ -2577,7 +2578,7 @@ public:
} }
else else
{ {
if (d->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE) if (d->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE)
{ {
a->source = (MTGCardInstance *) d; a->source = (MTGCardInstance *) d;
} }
@@ -2607,7 +2608,8 @@ public:
int removed(MTGCardInstance * card) 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]); game->removeObserver(abilities[card]);
abilities.erase(card); abilities.erase(card);
@@ -2620,7 +2622,7 @@ public:
SAFE_DELETE(ability); SAFE_DELETE(ability);
} }
const char * getMenuText() const string getMenuText()
{ {
//Special case for move //Special case for move
if (AAMover * move = dynamic_cast<AAMover *>(ability)) if (AAMover * move = dynamic_cast<AAMover *>(ability))
@@ -2725,7 +2727,7 @@ public:
} }
else else
{ {
if (d->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE) if (d->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE)
{ {
a->source = (MTGCardInstance *) d; a->source = (MTGCardInstance *) d;
} }
@@ -2794,113 +2796,24 @@ public:
//equipment //equipment
class AEquip: public TargetAbility class AEquip: public TargetAbility
{ {
public: private:
bool isAttach;
vector<MTGAbility *> currentAbilities; vector<MTGAbility *> currentAbilities;
AEquip(GameObserver* observer, int _id, MTGCardInstance * _source, ManaCost * _cost = NULL, int restrictions =
ActivatedAbility::AS_SORCERY) :
TargetAbility(observer, _id, _source, NULL, _cost, restrictions)
{
aType = MTGAbility::STANDARD_EQUIP;
}
int unequip() public:
{ AEquip(GameObserver* observer, int _id, MTGCardInstance * _source, ManaCost * _cost = NULL,
if (source->target) int restrictions = ActivatedAbility::AS_SORCERY);
{
source->target->equipment -= 1;
source->parentCards.clear();
for(unsigned int w = 0;w < source->target->childrenCards.size();w++)
{
MTGCardInstance * child = source->target->childrenCards[w];
if(child == source)
source->target->childrenCards.erase(source->target->childrenCards.begin() + w);
}
}
source->target = NULL;
for (size_t i = 0; i < currentAbilities.size(); ++i)
{
MTGAbility * a = currentAbilities[i];
if (dynamic_cast<AEquip *> (a) || dynamic_cast<ATeach *> (a) || dynamic_cast<AAConnect *> (a) || (a->aType == MTGAbility::STANDARD_TOKENCREATOR && a->oneShot))
{
SAFE_DELETE(a);
continue;
}
game->removeObserver(currentAbilities[i]);
}
currentAbilities.clear();
return 1;
}
int equip(MTGCardInstance * equipped) int unequip();
{ int equip(MTGCardInstance * equipped);
source->target = equipped;
source->target->equipment += 1;
source->parentCards.push_back(equipped);
source->target->childrenCards.push_back((MTGCardInstance*)source);
AbilityFactory af(game);
af.getAbilities(&currentAbilities, NULL, source);
for (size_t i = 0; i < currentAbilities.size(); ++i)
{
MTGAbility * a = currentAbilities[i];
if (dynamic_cast<AEquip *> (a)) continue;
if (dynamic_cast<ATeach *> (a)) continue;
if (dynamic_cast<AAConnect *> (a)) continue;
if (a->aType == MTGAbility::STANDARD_TOKENCREATOR && a->oneShot)
{
a->forceDestroy = 1;
continue;
}
if (dynamic_cast<AACopier *> (af.getCoreAbility(a)))
{
a->forceDestroy = 1;
continue;
}
//we generally dont want to pass oneShot tokencreators to the cards
//we equip...
a->addToGame();
}
return 1;
} int resolve();
const string getMenuText();
int resolve() int testDestroy();
{ int destroy();
MTGCardInstance * mTarget = tc->getNextCardTarget();
if (!mTarget) return 0;
if (mTarget == source) return 0;
unequip();
equip(mTarget);
return 1;
}
const char * getMenuText()
{
return "Equip";
}
int testDestroy()
{
if (source->target && !game->isInPlay(source->target))
unequip();
if(!game->connectRule)
{
if (source->target && TargetAbility::tc && !TargetAbility::tc->canTarget((Targetable *)source->target,true))
unequip();
}
return TargetAbility::testDestroy();
}
int destroy()
{
unequip();
return TargetAbility::destroy();
}
AEquip * clone() const
{
return NEW AEquip(*this);
}
AEquip * clone() const;
}; };
class ATokenCreator: public ActivatedAbility class ATokenCreator: public ActivatedAbility
@@ -3123,7 +3036,7 @@ public:
card->setAttacker(1); card->setAttacker(1);
} }
const char * getMenuText() const string getMenuText()
{ {
sprintf(menuText, "Create %s", name.c_str()); sprintf(menuText, "Create %s", name.c_str());
return menuText; return menuText;
@@ -3224,7 +3137,7 @@ public:
} }
} }
const char * getMenuText() const string getMenuText()
{ {
if(name.size()) if(name.size())
return name.c_str(); return name.c_str();
@@ -3397,7 +3310,7 @@ public:
return 0; return 0;
} }
const char * getMenuText() const string getMenuText()
{ {
return ability->getMenuText(); return ability->getMenuText();
} }
@@ -3609,7 +3522,7 @@ public:
} }
} }
const char * getMenuText() const string getMenuText()
{ {
return ability->getMenuText(); return ability->getMenuText();
} }
@@ -3632,7 +3545,7 @@ public:
AASetHand(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, int hand, ManaCost * _cost = NULL, AASetHand(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, int hand, ManaCost * _cost = NULL,
int who = TargetChooser::UNSET); int who = TargetChooser::UNSET);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AASetHand * clone() const; AASetHand * clone() const;
}; };
@@ -3646,7 +3559,7 @@ public:
AALifeSet(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, WParsedInt * life, ManaCost * _cost = NULL, AALifeSet(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, WParsedInt * life, ManaCost * _cost = NULL,
int who = TargetChooser::UNSET); int who = TargetChooser::UNSET);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AALifeSet * clone() const; AALifeSet * clone() const;
~AALifeSet(); ~AALifeSet();
@@ -3663,7 +3576,7 @@ public:
AADamager(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, string d, ManaCost * _cost = NULL, AADamager(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, string d, ManaCost * _cost = NULL,
int who = TargetChooser::UNSET); int who = TargetChooser::UNSET);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
int getDamage(); int getDamage();
AADamager * clone() const; AADamager * clone() const;
@@ -3677,7 +3590,7 @@ public:
AADamagePrevent(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, int preventing, ManaCost * _cost = NULL, int who = TargetChooser::UNSET); AADamagePrevent(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, int preventing, ManaCost * _cost = NULL, int who = TargetChooser::UNSET);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AADamagePrevent * clone() const; AADamagePrevent * clone() const;
~AADamagePrevent(); ~AADamagePrevent();
}; };
@@ -3691,7 +3604,7 @@ public:
AAAlterPoison(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, int poison, ManaCost * _cost = NULL, AAAlterPoison(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, int poison, ManaCost * _cost = NULL,
int who = TargetChooser::UNSET); int who = TargetChooser::UNSET);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AAAlterPoison * clone() const; AAAlterPoison * clone() const;
~AAAlterPoison(); ~AAAlterPoison();
}; };
@@ -3719,7 +3632,7 @@ class AATapper: public ActivatedAbility
public: public:
AATapper(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL); AATapper(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AATapper * clone() const; AATapper * clone() const;
}; };
@@ -3729,7 +3642,7 @@ class AAUntapper: public ActivatedAbility
public: public:
AAUntapper(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL); AAUntapper(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AAUntapper * clone() const; AAUntapper * clone() const;
}; };
@@ -3750,7 +3663,7 @@ class AAFrozen: public ActivatedAbility
public: public:
AAFrozen(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL); AAFrozen(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AAFrozen * clone() const; AAFrozen * clone() const;
}; };
/* ghetto new target*/ /* ghetto new target*/
@@ -3760,7 +3673,7 @@ public:
bool retarget; bool retarget;
AANewTarget(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target,bool retarget = false, ManaCost * _cost = NULL); AANewTarget(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target,bool retarget = false, ManaCost * _cost = NULL);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AANewTarget * clone() const; AANewTarget * clone() const;
}; };
/* morph*/ /* morph*/
@@ -3771,7 +3684,7 @@ public:
AAMorph(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL); AAMorph(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL);
int resolve(); int resolve();
int testDestroy(); int testDestroy();
const char * getMenuText(); const string getMenuText();
AAMorph * clone() const; AAMorph * clone() const;
}; };
/* flip*/ /* flip*/
@@ -3783,7 +3696,7 @@ public:
AAFlip(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target,string flipStats); AAFlip(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target,string flipStats);
int resolve(); int resolve();
int testDestroy(); int testDestroy();
const char * getMenuText(); const string getMenuText();
AAFlip * clone() const; AAFlip * clone() const;
}; };
/* dynamic ability build*/ /* dynamic ability build*/
@@ -3848,7 +3761,7 @@ string menu;
int resolve(); int resolve();
int activateMainAbility(MTGAbility * toActivate,MTGCardInstance * source , Damageable * target); int activateMainAbility(MTGAbility * toActivate,MTGCardInstance * source , Damageable * target);
int activateStored(); int activateStored();
const char * getMenuText(); const string getMenuText();
AADynamic * clone() const; AADynamic * clone() const;
~AADynamic(); ~AADynamic();
}; };
@@ -3901,7 +3814,7 @@ public:
return 1; return 1;
} }
const char * getMenuText() const string getMenuText()
{ {
return "Swap power and toughness"; return "Swap power and toughness";
} }
@@ -3917,7 +3830,7 @@ public:
AAExchangeLife(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, ManaCost * _cost = NULL, AAExchangeLife(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, ManaCost * _cost = NULL,
int who = TargetChooser::UNSET); int who = TargetChooser::UNSET);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AAExchangeLife * clone() const; AAExchangeLife * clone() const;
}; };
@@ -4153,7 +4066,7 @@ public:
int reapplyCountersBonus(MTGCardInstance * rtarget= NULL,bool powerapplied=false,bool toughnessapplied=false); int reapplyCountersBonus(MTGCardInstance * rtarget= NULL,bool powerapplied=false,bool toughnessapplied=false);
int testDestroy(); int testDestroy();
int destroy(); int destroy();
const char * getMenuText(); const string getMenuText();
ATransformer * clone() const; ATransformer * clone() const;
~ATransformer(); ~ATransformer();
}; };
@@ -4176,7 +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 = ""); ATransformerInstant(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, string types = "", string abilities = "",string newpower = "",bool newpowerfound = false,string newtoughness = "",bool newtoughnessfound = false,vector<string>newAbilitiesList = vector<string>(),bool newAbilityFound = false,bool aForever = false, bool UYNT = false,string menutext = "");
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
ATransformerInstant * clone() const; ATransformerInstant * clone() const;
~ATransformerInstant(); ~ATransformerInstant();
}; };
@@ -4192,7 +4105,7 @@ public:
WParsedPT * newWppt; WParsedPT * newWppt;
PTInstant(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, WParsedPT * wppt,string s = "",bool nonstatic = false); PTInstant(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, WParsedPT * wppt,string s = "",bool nonstatic = false);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
PTInstant * clone() const; PTInstant * clone() const;
~PTInstant(); ~PTInstant();
}; };
@@ -4251,7 +4164,7 @@ public:
return 1; return 1;
} }
const char * getMenuText() const string getMenuText()
{ {
return "Exalted"; return "Exalted";
} }
@@ -4269,7 +4182,7 @@ public:
ASwapPT * ability; ASwapPT * ability;
ASwapPTUEOT(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target); ASwapPTUEOT(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
ASwapPTUEOT * clone() const; ASwapPTUEOT * clone() const;
~ASwapPTUEOT(); ~ASwapPTUEOT();
}; };
@@ -4346,7 +4259,7 @@ public:
APreventDamageTypesUEOT(GameObserver* observer, int id, MTGCardInstance * source, string to, string from, int type = 0); APreventDamageTypesUEOT(GameObserver* observer, int id, MTGCardInstance * source, string to, string from, int type = 0);
int resolve(); int resolve();
int destroy(); int destroy();
const char * getMenuText(); const string getMenuText();
APreventDamageTypesUEOT * clone() const; APreventDamageTypesUEOT * clone() const;
~APreventDamageTypesUEOT(); ~APreventDamageTypesUEOT();
}; };
@@ -4363,7 +4276,7 @@ public:
AVanishing(GameObserver* observer, int _id, MTGCardInstance * card, ManaCost * _cost, int restrictions = 0,int amount = 0,string counterName = ""); AVanishing(GameObserver* observer, int _id, MTGCardInstance * card, ManaCost * _cost, int restrictions = 0,int amount = 0,string counterName = "");
void Update(float dt); void Update(float dt);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AVanishing * clone() const; AVanishing * clone() const;
~AVanishing(); ~AVanishing();
}; };
@@ -4385,7 +4298,7 @@ public:
void Update(float dt); void Update(float dt);
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL); int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
AUpkeep * clone() const; AUpkeep * clone() const;
~AUpkeep(); ~AUpkeep();
@@ -4411,7 +4324,7 @@ public:
MTG_PHASE_UPKEEP,bool forcedestroy = false,bool next = true,bool myturn = true,bool opponentturn = true,bool once = false); MTG_PHASE_UPKEEP,bool forcedestroy = false,bool next = true,bool myturn = true,bool opponentturn = true,bool once = false);
void Update(float dt); void Update(float dt);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
APhaseAction * clone() const; APhaseAction * clone() const;
~APhaseAction(); ~APhaseAction();
}; };
@@ -4425,7 +4338,7 @@ public:
APhaseActionGeneric(GameObserver* observer, int _id, MTGCardInstance * card, MTGCardInstance * target, string sAbility, int restrictions = 0, int _phase = APhaseActionGeneric(GameObserver* observer, int _id, MTGCardInstance * card, MTGCardInstance * target, string sAbility, int restrictions = 0, int _phase =
MTG_PHASE_UPKEEP,bool forcedestroy = false,bool next = true,bool myturn = false,bool opponentturn = false,bool once = false); MTG_PHASE_UPKEEP,bool forcedestroy = false,bool next = true,bool myturn = false,bool opponentturn = false,bool once = false);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
APhaseActionGeneric * clone() const; APhaseActionGeneric * clone() const;
~APhaseActionGeneric(); ~APhaseActionGeneric();
@@ -4445,7 +4358,7 @@ public:
void Update(float dt); void Update(float dt);
void resolveBlink(); void resolveBlink();
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
ABlink * clone() const; ABlink * clone() const;
~ABlink(); ~ABlink();
private: private:
@@ -4463,7 +4376,7 @@ public:
MTGAbility * stored; MTGAbility * stored;
ABlinkGeneric(GameObserver* observer, int _id, MTGCardInstance * card, MTGCardInstance * _target,bool blinkueot=false,bool blinkForSource = false,bool blinkhand = false,MTGAbility * stored = NULL); ABlinkGeneric(GameObserver* observer, int _id, MTGCardInstance * card, MTGCardInstance * _target,bool blinkueot=false,bool blinkForSource = false,bool blinkhand = false,MTGAbility * stored = NULL);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
ABlinkGeneric * clone() const; ABlinkGeneric * clone() const;
~ABlinkGeneric(); ~ABlinkGeneric();
@@ -5369,7 +5282,7 @@ public:
return 1; return 1;
} }
const char * getMenuText() const string getMenuText()
{ {
return "phase alter"; return "phase alter";
} }
@@ -5388,7 +5301,7 @@ public:
AADepleter(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target,string nbcardsStr, ManaCost * _cost = NULL, AADepleter(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target,string nbcardsStr, ManaCost * _cost = NULL,
int who = TargetChooser::UNSET); int who = TargetChooser::UNSET);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AADepleter * clone() const; AADepleter * clone() const;
}; };
@@ -5401,7 +5314,7 @@ public:
AAModTurn(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target,string nbTurnStr, ManaCost * _cost = NULL, AAModTurn(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target,string nbTurnStr, ManaCost * _cost = NULL,
int who = TargetChooser::UNSET); int who = TargetChooser::UNSET);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AAModTurn * clone() const; AAModTurn * clone() const;
}; };
@@ -5412,7 +5325,7 @@ public:
AAShuffle(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost = NULL, int who = AAShuffle(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost = NULL, int who =
TargetChooser::UNSET); TargetChooser::UNSET);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AAShuffle * clone() const; AAShuffle * clone() const;
}; };
@@ -5425,7 +5338,7 @@ public:
AARemoveMana(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, string ManaDesc, int who = TargetChooser::UNSET); AARemoveMana(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, string ManaDesc, int who = TargetChooser::UNSET);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AARemoveMana * clone() const; AARemoveMana * clone() const;
~AARemoveMana(); ~AARemoveMana();
@@ -5440,7 +5353,7 @@ public:
AARandomDiscarder(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target,string nbcardsStr, ManaCost * _cost = NULL, AARandomDiscarder(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target,string nbcardsStr, ManaCost * _cost = NULL,
int who = TargetChooser::UNSET); int who = TargetChooser::UNSET);
int resolve(); int resolve();
const char * getMenuText(); const string getMenuText();
AARandomDiscarder * clone() const; AARandomDiscarder * clone() const;
}; };
@@ -5612,7 +5525,7 @@ public:
int testDestroy(){return 0;}; int testDestroy(){return 0;};
void Update(float dt); void Update(float dt);
const char * getMenuText(); const string getMenuText();
int isReactingToTargetClick(Targetable * card); int isReactingToTargetClick(Targetable * card);
int reactToTargetClick(Targetable * object); int reactToTargetClick(Targetable * object);
MTGCardInstance * makeCard(); MTGCardInstance * makeCard();
@@ -5638,7 +5551,7 @@ public:
{ {
WEventDamage * e = (WEventDamage *) event; WEventDamage * e = (WEventDamage *) event;
Damage * d = e->damage; Damage * d = e->damage;
if (combatonly && e->damage->typeOfDamage != DAMAGE_COMBAT) if (combatonly && e->damage->typeOfDamage != Damage::DAMAGE_COMBAT)
return 0; return 0;
MTGCardInstance * card = d->source; MTGCardInstance * card = d->source;
if (d->damage > 0 && card && (card == source || card == source->target)) if (d->damage > 0 && card && (card == source || card == source->target))
@@ -5729,7 +5642,7 @@ public:
MTGAbility * abilityAltered; MTGAbility * abilityAltered;
AASetColorChosen(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, int _color = 0 ,string toAdd = ""); AASetColorChosen(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, int _color = 0 ,string toAdd = "");
int resolve(); int resolve();
const char* getMenuText(); const string getMenuText();
AASetColorChosen * clone() const; AASetColorChosen * clone() const;
~AASetColorChosen(); ~AASetColorChosen();
}; };
@@ -5742,7 +5655,7 @@ public:
MTGAbility * abilityAltered; MTGAbility * abilityAltered;
AASetTypeChosen(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, int _type = 0,string menu = "error" ,string toAdd = ""); AASetTypeChosen(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, int _type = 0,string menu = "error" ,string toAdd = "");
int resolve(); int resolve();
const char* getMenuText(); const string getMenuText();
AASetTypeChosen * clone() const; AASetTypeChosen * clone() const;
~AASetTypeChosen(); ~AASetTypeChosen();
}; };
@@ -5756,7 +5669,7 @@ public:
bool ANonWall; bool ANonWall;
GenericChooseTypeColor(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target, string toAdd = "",bool chooseColor = false,bool nonwall = false, ManaCost * cost = NULL); GenericChooseTypeColor(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target, string toAdd = "",bool chooseColor = false,bool nonwall = false, ManaCost * cost = NULL);
int resolve(); int resolve();
const char* getMenuText(); const string getMenuText();
GenericChooseTypeColor * clone() const; GenericChooseTypeColor * clone() const;
~GenericChooseTypeColor(); ~GenericChooseTypeColor();
@@ -5773,7 +5686,7 @@ public:
MTGAbility * abilityAltered; MTGAbility * abilityAltered;
AASetCoin(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, int side = -1,string toAdd = ""); AASetCoin(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, int side = -1,string toAdd = "");
int resolve(); int resolve();
const char* getMenuText(); const string getMenuText();
AASetCoin * clone() const; AASetCoin * clone() const;
~AASetCoin(); ~AASetCoin();
}; };
@@ -5781,11 +5694,10 @@ class GenericFlipACoin: public ActivatedAbility
{ {
public: public:
string baseAbility; string baseAbility;
bool chooseColor;
AASetCoin * setCoin; AASetCoin * setCoin;
GenericFlipACoin(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target, string toAdd = "", ManaCost * cost = NULL); GenericFlipACoin(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target, string toAdd = "", ManaCost * cost = NULL);
int resolve(); int resolve();
const char* getMenuText(); const string getMenuText();
GenericFlipACoin * clone() const; GenericFlipACoin * clone() const;
~GenericFlipACoin(); ~GenericFlipACoin();
@@ -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); GenericPaidAbility(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target,string _newName,string _castRestriction,string _mayCost, string toAdd, ManaCost * cost = NULL);
int resolve(); int resolve();
const char* getMenuText(); const string getMenuText();
GenericPaidAbility * clone() const; GenericPaidAbility * clone() const;
~GenericPaidAbility(); ~GenericPaidAbility();
+5
View File
@@ -1,3 +1,6 @@
#ifndef _CACHE_ENGINE_H_
#define _CACHE_ENGINE_H_
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "Threading.h" #include "Threading.h"
@@ -208,3 +211,5 @@ public:
CardRetrieverBase* CacheEngine::sInstance = NULL; CardRetrieverBase* CacheEngine::sInstance = NULL;
bool CacheEngine::sIsThreaded = false; bool CacheEngine::sIsThreaded = false;
#endif //_CACHE_ENGINE_H_
+6 -4
View File
@@ -9,9 +9,6 @@
#include "MTGGameZones.h" #include "MTGGameZones.h"
#include "Counters.h" #include "Counters.h"
#define CD_OR 1
#define CD_AND 2
enum ENUM_COMPARISON_MODES enum ENUM_COMPARISON_MODES
{ {
COMPARISON_NONE = 0, // Needs to remain 0 for quick if(comparison_mode) checks COMPARISON_NONE = 0, // Needs to remain 0 for quick if(comparison_mode) checks
@@ -31,7 +28,12 @@ class CardDescriptor: public MTGCardInstance
MTGCardInstance * match_not(MTGCardInstance * card); MTGCardInstance * match_not(MTGCardInstance * card);
bool valueInRange(int comparisonMode, int value, int criterion); bool valueInRange(int comparisonMode, int value, int criterion);
public: public:
int mode; enum Operator{
CD_OR = 1,
CD_AND = 2
};
Operator mode;
int powerComparisonMode; int powerComparisonMode;
int toughnessComparisonMode; int toughnessComparisonMode;
int manacostComparisonMode; int manacostComparisonMode;
-21
View File
@@ -1,21 +0,0 @@
#ifndef _CARDEFFECT_H_
#define _CARDEFFECT_H_
#include <JGE.h>
#include "Effects.h"
struct CardGui;
class CardEffect: public Effect
{
public:
CardEffect(CardGui* target);
~CardEffect();
private:
CardGui* target;
public:
virtual void Render();
};
#endif // _CARDEFFECT_H_
+3 -3
View File
@@ -33,7 +33,7 @@ protected:
/* /*
** Tries to render the Big version of a card picture, backups to text version in case of failure ** 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 RenderCountersBig(MTGCard * card, const Pos& pos, int drawMode = DrawMode::kNormal);
static void AlternateRender(MTGCard * card, const Pos& pos); static void AlternateRender(MTGCard * card, const Pos& pos);
@@ -55,8 +55,8 @@ public:
virtual void Render(); virtual void Render();
virtual void Update(float dt); virtual void Update(float dt);
void DrawCard(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); static void DrawCard(MTGCard* inCard, const Pos& inPosition, int inMode = DrawMode::kNormal, bool thumb = false);
static JQuadPtr AlternateThumbQuad(MTGCard * card); static JQuadPtr AlternateThumbQuad(MTGCard * card);
virtual ostream& toString(ostream&) const; virtual ostream& toString(ostream&) const;
+1 -2
View File
@@ -101,10 +101,9 @@ public:
int removeType(string value, int removeAll = 0); int removeType(string value, int removeAll = 0);
int removeType(int value, int removeAll = 0); int removeType(int value, int removeAll = 0);
bool hasSubtype(int _subtype); bool hasSubtype(int _subtype);
bool hasSubtype(const char * _subtype);
bool hasSubtype(const string& _subtype); bool hasSubtype(const string& _subtype);
bool hasType(int _type); bool hasType(int _type);
bool hasType(const char * type); bool hasType(const string& type);
void setManaCost(const string& value); void setManaCost(const string& value);
ManaCost * getManaCost(); ManaCost * getManaCost();
+42
View File
@@ -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_
+22 -16
View File
@@ -11,17 +11,15 @@ class JGuiObject;
class MTGCardInstance; class MTGCardInstance;
class GameObserver; class GameObserver;
#define DAMAGEABLE_MTGCARDINSTANCE 0
#define DAMAGEABLE_PLAYER 1
#define DAMAGE_ALL_TYPES 0
#define DAMAGE_COMBAT 1
#define DAMAGE_OTHER 2
class Damageable:public Targetable class Damageable:public Targetable
{ {
protected: protected:
public: public:
enum DamageableType{
DAMAGEABLE_MTGCARDINSTANCE = 0,
DAMAGEABLE_PLAYER
};
int life; int life;
int handsize; int handsize;
int poisonCount; int poisonCount;
@@ -29,12 +27,14 @@ public:
int preventable; int preventable;
int thatmuch; int thatmuch;
int lifeLostThisTurn; int lifeLostThisTurn;
int type_as_damageable; DamageableType type_as_damageable;
Damageable(GameObserver* observer, int _life) Damageable(GameObserver* observer, int _life)
: Targetable(observer) : Targetable(observer), life(_life), handsize(0),
{life=_life;lifeLostThisTurn = 0;}; poisonCount(0), damageCount(0), preventable(0), thatmuch(0),
int getLife(){return life;}; lifeLostThisTurn(0), type_as_damageable(DAMAGEABLE_MTGCARDINSTANCE)
virtual int dealDamage(int damage){life-=damage;return life;}; {}
int getLife(){return life;}
virtual int dealDamage(int damage){life-=damage;return life;}
virtual int afterDamage(){return 0;} virtual int afterDamage(){return 0;}
virtual int poisoned(){return 0;} virtual int poisoned(){return 0;}
virtual int prevented(){return 0;} virtual int prevented(){return 0;}
@@ -47,17 +47,23 @@ public:
class Damage: public Interruptible class Damage: public Interruptible
{ {
protected:
void init(MTGCardInstance * source, Damageable * target, int damage, int typeOfDamage);
public: public:
enum DamageType{
DAMAGE_ALL_TYPES = 0,
DAMAGE_COMBAT,
DAMAGE_OTHER
};
Damageable * target; Damageable * target;
int typeOfDamage; DamageType typeOfDamage;
int damage; int damage;
void Render(); void Render();
Damage(GameObserver* observer, MTGCardInstance* source, Damageable * target); Damage(GameObserver* observer, MTGCardInstance* source, Damageable * target);
Damage(GameObserver* observer, MTGCardInstance* source, Damageable * target, int damage, int typeOfDamage = DAMAGE_OTHER); Damage(GameObserver* observer, MTGCardInstance* source, Damageable * target, int damage, DamageType typeOfDamage = DAMAGE_OTHER);
int resolve(); int resolve();
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
protected:
void init(MTGCardInstance * source, Damageable * target, int damage, DamageType typeOfDamage);
}; };
class DamageStack : public GuiLayer, public Interruptible class DamageStack : public GuiLayer, public Interruptible
+4 -1
View File
@@ -1,3 +1,5 @@
#ifndef _DECK_EDITOR_MENU_H
#define _DECK_EDITOR_MENU_H
#pragma once #pragma once
#include "DeckMenu.h" #include "DeckMenu.h"
#include "DeckDataWrapper.h" #include "DeckDataWrapper.h"
@@ -15,7 +17,8 @@ private:
StatsWrapper *stw; StatsWrapper *stw;
public: public:
DeckEditorMenu(int id, JGuiListener* listener = NULL, int fontId = 1, const char * _title = "", DeckDataWrapper *selectedDeck = NULL, StatsWrapper *stats = NULL); DeckEditorMenu(int id, JGuiListener* listener = NULL, int fontId = 1, const string& _title = "", DeckDataWrapper *selectedDeck = NULL, StatsWrapper *stats = NULL);
void Render(); void Render();
virtual ~DeckEditorMenu(); virtual ~DeckEditorMenu();
}; };
#endif //_DECK_EDITOR_MENU_H
+5
View File
@@ -1,3 +1,6 @@
#ifndef _DECK_MANAGER_H
#define _DECK_MANAGER_H
#include <string> #include <string>
#include <vector> #include <vector>
@@ -43,3 +46,5 @@ public:
~DeckManager(); ~DeckManager();
}; };
#endif //_DECK_MANAGER_H
+1 -1
View File
@@ -79,7 +79,7 @@ public:
virtual void Render(); virtual void Render();
virtual void Update(float dt); virtual void Update(float dt);
using JGuiController::Add; using JGuiController::Add;
virtual void Add(int id, const char * Text, string desc = "", bool forceFocus = false, DeckMetaData *deckMetaData = NULL); virtual void Add(int id, const string& Text, const string& desc = "", bool forceFocus = false, DeckMetaData *deckMetaData = NULL);
virtual void Close(); virtual void Close();
void updateScroller(); void updateScroller();
void RenderBackground(); void RenderBackground();
+1 -3
View File
@@ -77,9 +77,7 @@ public:
} }
// Setters // Setters
void setDescription( const string description ) { mDescription = description; }; void setDescription( const string& description ) { mDescription = description; }
;
}; };
#endif #endif
+1 -1
View File
@@ -98,7 +98,7 @@ public:
string getManaColorIndex(); string getManaColorIndex();
void updateStats(string filename, MTGAllCards * collection); void updateStats(string filename, MTGAllCards * collection);
void updateStats(DeckDataWrapper *mtgDeck); void updateStats(DeckDataWrapper *mtgDeck);
int countCardsByType(const char * _type, DeckDataWrapper * myDeck); int countCardsByType(const string& _type, DeckDataWrapper * myDeck);
float noLuck(int n, int a, int x); float noLuck(int n, int a, int x);
vector<string> aiDeckNames; vector<string> aiDeckNames;
+63
View File
@@ -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_
+201
View File
@@ -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_
-2
View File
@@ -20,7 +20,6 @@
#include "MTGCard.h" #include "MTGCard.h"
#include "MTGGameZones.h" #include "MTGGameZones.h"
#include "CardEffect.h"
#ifdef NETWORK_SUPPORT #ifdef NETWORK_SUPPORT
#include "JNetwork.h" #include "JNetwork.h"
#endif //NETWORK_SUPPORT #endif //NETWORK_SUPPORT
@@ -49,7 +48,6 @@ public:
GameType gameType; GameType gameType;
Rules * rules; Rules * rules;
CardEffect *effect;
#ifdef NETWORK_SUPPORT #ifdef NETWORK_SUPPORT
string mServerAddress; string mServerAddress;
JNetwork* mpNetwork; JNetwork* mpNetwork;
+2 -2
View File
@@ -98,8 +98,8 @@ class GameObserver{
int cardClick(MTGCardInstance * card,Targetable * _object = NULL, bool log = true); int cardClick(MTGCardInstance * card,Targetable * _object = NULL, bool log = true);
GamePhase getCurrentGamePhase(); GamePhase getCurrentGamePhase();
void setCurrentGamePhase(GamePhase phase) { mCurrentGamePhase = phase; }; void setCurrentGamePhase(GamePhase phase) { mCurrentGamePhase = phase; };
const char * getCurrentGamePhaseName(); const string& getCurrentGamePhaseName();
const char * getNextGamePhaseName(); const string& getNextGamePhaseName();
void nextCombatStep(); void nextCombatStep();
void userRequestNextGamePhase(bool allowInterrupt = true, bool log = true); void userRequestNextGamePhase(bool allowInterrupt = true, bool log = true);
void cleanupPhase(); void cleanupPhase();
+26 -54
View File
@@ -19,22 +19,7 @@
#include "WGui.h" #include "WGui.h"
#include "InteractiveButton.h" #include "InteractiveButton.h"
#define NO_USER_ACTIVITY_HELP_DELAY 10 class DeckView;
#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
};
// TODO: need a better name for MENU_FIRST_MENU, this is reused for the 1st submenu of // TODO: need a better name for MENU_FIRST_MENU, this is reused for the 1st submenu of
// available options in the duel menu // available options in the duel menu
@@ -44,7 +29,7 @@ enum
MENU_DECK_SELECTION = 10, MENU_DECK_SELECTION = 10,
MENU_DECK_BUILDER = 11, MENU_DECK_BUILDER = 11,
MENU_FIRST_DUEL_SUBMENU = 102, MENU_FIRST_DUEL_SUBMENU = 102,
MENU_LANGUAGE_SELECTION = 103, MENU_LANGUAGE_SELECTION = 103
}; };
// enums for menu options // enums for menu options
@@ -64,79 +49,69 @@ enum DECK_VIEWER_MENU_ITEMS
MENU_ITEM_NO = 21, MENU_ITEM_NO = 21,
MENU_ITEM_FILTER_BY = 22, MENU_ITEM_FILTER_BY = 22,
MENUITEM_MORE_INFO = kInfoMenuID 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 class GameStateDeckViewer: public GameState, public JGuiListener
{ {
private: private:
enum DeckViewerStages
{
STAGE_WAITING = 0,
STAGE_ONSCREEN_MENU,
STAGE_WELCOME,
STAGE_MENU,
STAGE_FILTERS
};
vector<JQuadPtr> mIcons; vector<JQuadPtr> mIcons;
JQuadPtr pspIcons[8]; JQuadPtr pspIcons[8];
JTexture * pspIconsTexture; JTexture * pspIconsTexture;
float last_user_activity; float last_user_activity;
float onScreenTransition; float onScreenTransition;
float mRotation; DeckViewerStages mStage;
float mSlide;
int mAlpha;
int mStage;
int useFilter;
JMusic * bgMusic; JMusic * bgMusic;
int lastPos;
int lastTotal;
int mSelected;
InteractiveButton *toggleDeckButton, *sellCardButton, *statsPrevButton, *filterButton; InteractiveButton *toggleDeckButton, *sellCardButton, *statsPrevButton, *filterButton, *toggleViewButton;
WGuiFilters * filterMenu; WGuiFilters * filterMenu;
WSrcDeckViewer * source; WSrcDeckViewer * source;
DeckEditorMenu * welcome_menu; DeckEditorMenu * welcome_menu;
SimpleMenu * subMenu; SimpleMenu * subMenu;
DeckEditorMenu * menu; DeckEditorMenu * deckMenu;
PriceList* pricelist; PriceList* pricelist;
PlayerData * playerdata; PlayerData * playerdata;
int price;
DeckDataWrapper * displayed_deck;
DeckDataWrapper * myDeck; DeckDataWrapper * myDeck;
DeckDataWrapper * myCollection; DeckDataWrapper * myCollection;
MTGCard * cardIndex[CARDS_DISPLAYED]; StatsWrapper * mStatsWrapper;
StatsWrapper *stw;
int hudAlpha; int hudAlpha;
string newDeckname; string newDeckname;
bool isAIDeckSave; bool isAIDeckSave;
bool mSwitching; bool mSwitching;
enum AvailableView{
CAROUSEL_VIEW,
GRID_VIEW
};
DeckView* mView;
AvailableView mCurrentView;
void saveDeck(); //Saves the deck and additional necessary information void saveDeck(); //Saves the deck and additional necessary information
void saveAsAIDeck(string deckName); // saves deck as an AI Deck void saveAsAIDeck(string deckName); // saves deck as an AI Deck
int getCurrentPos();
void sellCard(); void sellCard();
void setButtonState(bool state); void setButtonState(bool state);
bool userPressedButton(); bool userPressedButton();
void RenderButtons(); void RenderButtons();
void setupView(AvailableView view, DeckDataWrapper *deck);
pair<float, float> cardsCoordinates[CARDS_DISPLAYED]; void toggleView();
public: public:
GameStateDeckViewer(GameApp* parent); GameStateDeckViewer(GameApp* parent);
virtual ~GameStateDeckViewer(); virtual ~GameStateDeckViewer();
void updateDecks(); void updateDecks();
void rotateCards(int direction);
void loadIndexes();
void updateFilters(); void updateFilters();
void rebuildFilters(); void rebuildFilters();
void switchDisplay(); void toggleCollection();
void Start(); void Start();
virtual void End(); virtual void End();
void addRemove(MTGCard * card); void addRemove(MTGCard * card);
@@ -145,11 +120,8 @@ public:
void renderSlideBar(); void renderSlideBar();
void renderDeckBackground(); void renderDeckBackground();
void renderOnScreenMenu(); void renderOnScreenMenu();
virtual void renderCard(int id, float rotation);
virtual void renderCard(int id);
virtual void Render(); virtual void Render();
int loadDeck(int deckid); int loadDeck(int deckid);
void LoadDeckStatistics(int deckId);
void OnScroll(int inXVelocity, int inYVelocity); void OnScroll(int inXVelocity, int inYVelocity);
+38
View File
@@ -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
+7 -1
View File
@@ -1,10 +1,14 @@
#ifndef _GUI_MANA_H
#define _GUI_MANA_H
#include "string.h" #include "string.h"
#include <vector> #include <vector>
#include <hge/hgeparticle.h> #include <hge/hgeparticle.h>
#include "JGE.h" #include "JGE.h"
#include "MTGDefinitions.h" #include "MTGDefinitions.h"
#include "GameApp.h" #include "Pos.h"
#include "GuiLayers.h" #include "GuiLayers.h"
#include "WResource_Fwd.h"
class ManaIcon : public Pos class ManaIcon : public Pos
{ {
@@ -51,3 +55,5 @@ public:
virtual int receiveEventPlus(WEvent * e); virtual int receiveEventPlus(WEvent * e);
virtual int receiveEventMinus(WEvent * e); virtual int receiveEventMinus(WEvent * e);
}; };
#endif //_GUI_MANA_H
+1
View File
@@ -28,6 +28,7 @@ const int kNextStatsButtonId = 10005;
const int kPrevStatsButtonId = 10006; const int kPrevStatsButtonId = 10006;
const int kCycleCardsButtonId = 10007; const int kCycleCardsButtonId = 10007;
const int kShowCardListButtonId = 10008; const int kShowCardListButtonId = 10008;
const int kSwitchViewButton = 10009;
class InteractiveButton: public SimpleButton class InteractiveButton: public SimpleButton
{ {
+3 -3
View File
@@ -317,7 +317,7 @@ public:
virtual TargetAbility* clone() const = 0; virtual TargetAbility* clone() const = 0;
virtual void Render(); virtual void Render();
virtual int resolve(); virtual int resolve();
virtual const char * getMenuText(); virtual const string getMenuText();
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
}; };
@@ -436,7 +436,7 @@ public:
void Update(float dt); void Update(float dt);
virtual GenericTriggeredAbility* clone() const; virtual GenericTriggeredAbility* clone() const;
const char * getMenuText(); const string getMenuText();
~GenericTriggeredAbility(); ~GenericTriggeredAbility();
}; };
@@ -525,7 +525,7 @@ public:
int isReactingToClick(MTGCardInstance * _card, ManaCost * mana = NULL); int isReactingToClick(MTGCardInstance * _card, ManaCost * mana = NULL);
int resolve(); int resolve();
int reactToClick(MTGCardInstance* _card); int reactToClick(MTGCardInstance* _card);
const char * getMenuText(); const string getMenuText();
~AManaProducer(); ~AManaProducer();
virtual AManaProducer * clone() const; virtual AManaProducer * clone() const;
}; };
+4 -4
View File
@@ -129,11 +129,11 @@ public:
//types //types
void addType(char * type_text); void addType(const string& type_text);
virtual void addType(int id); virtual void addType(int id);
void setType(const char * type_text); void setType(const string& type_text);
void setSubtype( string value); void setSubtype(const string &value);
int removeType(string value, int removeAll = 0); int removeType(const string &value, int removeAll = 0);
int removeType(int value, int removeAll = 0); int removeType(int value, int removeAll = 0);
//dangerranking is a hint to Ai which creatures are the ones it should be targetting for effects. //dangerranking is a hint to Ai which creatures are the ones it should be targetting for effects.
+9 -8
View File
@@ -4,7 +4,6 @@
#define MTG_ERROR -1 #define MTG_ERROR -1
#include "MTGDefinitions.h" #include "MTGDefinitions.h"
#include "GameApp.h"
#include "WResourceManager.h" #include "WResourceManager.h"
#include <dirent.h> #include <dirent.h>
#include <Threading.h> #include <Threading.h>
@@ -19,7 +18,7 @@ class MTGPack;
class MTGSetInfo class MTGSetInfo
{ {
public: public:
MTGSetInfo(string _id); MTGSetInfo(const string& _id);
~MTGSetInfo(); ~MTGSetInfo();
string id; //Short name: 10E, RAV, etc. Automatic from folder. string id; //Short name: 10E, RAV, etc. Automatic from folder.
string author; //Author of set, for crediting mod makers, etc. string author; //Author of set, for crediting mod makers, etc.
@@ -70,7 +69,7 @@ public:
MTGSets(); MTGSets();
~MTGSets(); ~MTGSets();
int Add(const char * subtype); int Add(const string& subtype);
int findSet(string value); int findSet(string value);
int findBlock(string s); int findBlock(string s);
int size(); int size();
@@ -127,8 +126,10 @@ public:
MTGCard * getCardByName(string name); MTGCard * getCardByName(string name);
void loadFolder(const string& folder, const string& filename="" ); void loadFolder(const string& folder, const string& filename="" );
int load(const char * config_file, const char * setName = NULL, int autoload = 1); int load(const string& config_file);
int countByType(const char * _type); int load(const string& config_file, const string& setName);
int load(const string& config_file, int set_id);
int countByType(const string& _type);
int countByColor(int color); int countByColor(int color);
int countBySet(int setId); int countBySet(int setId);
int totalCards(); int totalCards();
@@ -136,7 +137,7 @@ public:
static int findType(string subtype, bool forceAdd = true) { static int findType(string subtype, bool forceAdd = true) {
boost::mutex::scoped_lock lock(instance->mMutex); boost::mutex::scoped_lock lock(instance->mMutex);
int result = instance->subtypesList.find(subtype, forceAdd); int result = instance->subtypesList.find(subtype, forceAdd);
return result; return result;
}; };
static int add(string value, unsigned int parentType) { static int add(string value, unsigned int parentType) {
@@ -218,8 +219,8 @@ public:
int totalCards(); int totalCards();
int totalPrice(); int totalPrice();
MTGDeck(MTGAllCards * _allcards); MTGDeck(MTGAllCards * _allcards);
MTGDeck(const char * config_file, MTGAllCards * _allcards, int meta_only = 0,int difficultySetting = 0); MTGDeck(const string& config_file, MTGAllCards * _allcards, int meta_only = 0,int difficultySetting = 0);
int addRandomCards(int howmany, int * setIds = NULL, int nbSets = 0, int rarity = -1, const char * subtype = NULL, int addRandomCards(int howmany, int * setIds = NULL, int nbSets = 0, int rarity = -1, const string& subtype = "",
int * colors = NULL, int nbcolors = 0); int * colors = NULL, int nbcolors = 0);
int add(int cardid); int add(int cardid);
int add(MTGDeck * deck); // adds the contents of "deck" into myself int add(MTGDeck * deck); // adds the contents of "deck" into myself
+3 -2
View File
@@ -218,7 +218,8 @@ class Constants
soulbond = 100, soulbond = 100,
LURE = 101, LURE = 101,
NOLEGEND = 102, NOLEGEND = 102,
NB_BASIC_ABILITIES = 103, CANPLAYFROMGRAVEYARD = 103,
NB_BASIC_ABILITIES = 104,
RARITY_S = 'S', //Special Rarity RARITY_S = 'S', //Special Rarity
@@ -293,7 +294,7 @@ class Constants
static map<string,int> MTGBasicAbilitiesMap; static map<string,int> MTGBasicAbilitiesMap;
static const char* MTGBasicAbilities[]; static const char* MTGBasicAbilities[];
static const char* MTGPhaseNames[]; static const string MTGPhaseNames[];
static const char* MTGPhaseCodeNames[]; static const char* MTGPhaseCodeNames[];
static int GetBasicAbilityIndex(string mtgAbility); static int GetBasicAbilityIndex(string mtgAbility);
+1 -1
View File
@@ -95,7 +95,7 @@ class MTGGameZone {
void cleanupPhase(); void cleanupPhase();
void beforeBeginPhase(); void beforeBeginPhase();
unsigned int countByType(const char * value); unsigned int countByType(const string &value);
unsigned int countByCanTarget(TargetChooser * tc); unsigned int countByCanTarget(TargetChooser * tc);
unsigned int countTotalManaSymbols(TargetChooser * tc, int color); unsigned int countTotalManaSymbols(TargetChooser * tc, int color);
MTGCardInstance * findByName(string name); MTGCardInstance * findByName(string name);
+1 -1
View File
@@ -1,4 +1,4 @@
#ifndef _MTGPACCK_H_ #ifndef _MTGPACK_H_
#define _MTGPACK_H_ #define _MTGPACK_H_
class ShopBooster; class ShopBooster;
+32 -16
View File
@@ -66,6 +66,7 @@ public:
MTGEventBonus(GameObserver* observer, int _id); MTGEventBonus(GameObserver* observer, int _id);
virtual MTGEventBonus * clone() const; virtual MTGEventBonus * clone() const;
}; };
class MTGPutInPlayRule: public PermanentAbility class MTGPutInPlayRule: public PermanentAbility
{ {
public: public:
@@ -73,7 +74,7 @@ public:
int reactToClick(MTGCardInstance * card); int reactToClick(MTGCardInstance * card);
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
MTGPutInPlayRule(GameObserver* observer, int _id); MTGPutInPlayRule(GameObserver* observer, int _id);
const char * getMenuText() const string getMenuText()
{ {
return "cast card normally"; return "cast card normally";
} }
@@ -87,7 +88,7 @@ public:
int reactToClick(MTGCardInstance * card); int reactToClick(MTGCardInstance * card);
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
MTGKickerRule(GameObserver* observer, int _id); MTGKickerRule(GameObserver* observer, int _id);
const char * getMenuText() const string getMenuText()
{ {
return "pay kicker"; return "pay kicker";
} }
@@ -105,7 +106,7 @@ public:
int reactToClick(MTGCardInstance * card); int reactToClick(MTGCardInstance * card);
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
MTGAlternativeCostRule(GameObserver* observer, int _id); MTGAlternativeCostRule(GameObserver* observer, int _id);
const char * getMenuText() const string getMenuText()
{ {
if(alternativeName.size()) if(alternativeName.size())
return alternativeName.c_str(); return alternativeName.c_str();
@@ -121,7 +122,7 @@ public:
int reactToClick(MTGCardInstance * card); int reactToClick(MTGCardInstance * card);
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
MTGBuyBackRule(GameObserver* observer, int _id); MTGBuyBackRule(GameObserver* observer, int _id);
const char * getMenuText() const string getMenuText()
{ {
return "cast and buy back"; return "cast and buy back";
} }
@@ -136,7 +137,7 @@ public:
int reactToClick(MTGCardInstance * card); int reactToClick(MTGCardInstance * card);
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
MTGFlashBackRule(GameObserver* observer, int _id); MTGFlashBackRule(GameObserver* observer, int _id);
const char * getMenuText() const string getMenuText()
{ {
return "flash back"; return "flash back";
} }
@@ -150,7 +151,7 @@ public:
int reactToClick(MTGCardInstance * card); int reactToClick(MTGCardInstance * card);
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
MTGRetraceRule(GameObserver* observer, int _id); MTGRetraceRule(GameObserver* observer, int _id);
const char * getMenuText() const string getMenuText()
{ {
return "retrace"; return "retrace";
} }
@@ -165,13 +166,28 @@ public:
int reactToClick(MTGCardInstance * card); int reactToClick(MTGCardInstance * card);
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
MTGMorphCostRule(GameObserver* observer, int _id); MTGMorphCostRule(GameObserver* observer, int _id);
const char * getMenuText() const string getMenuText()
{ {
return "play morphed"; return "play morphed";
} }
virtual MTGMorphCostRule * clone() const; 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 class MTGSuspendRule: public MTGAlternativeCostRule
{ {
public: public:
@@ -181,7 +197,7 @@ public:
string suspendmenu; string suspendmenu;
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
MTGSuspendRule(GameObserver* observer, int _id); MTGSuspendRule(GameObserver* observer, int _id);
const char * getMenuText(); const string getMenuText();
virtual MTGSuspendRule * clone() const; virtual MTGSuspendRule * clone() const;
}; };
@@ -195,7 +211,7 @@ public:
int reactToClick(MTGCardInstance * card); int reactToClick(MTGCardInstance * card);
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
MTGAttackRule(GameObserver* observer, int _id); MTGAttackRule(GameObserver* observer, int _id);
const char * getMenuText() const string getMenuText()
{ {
return "Attacker"; return "Attacker";
} }
@@ -213,7 +229,7 @@ public:
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL); int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
int reactToClick(MTGCardInstance * card); int reactToClick(MTGCardInstance * card);
MTGPlaneswalkerAttackRule(GameObserver* observer, int _id); MTGPlaneswalkerAttackRule(GameObserver* observer, int _id);
const char * getMenuText() const string getMenuText()
{ {
return "Attack Planeswalker"; return "Attack Planeswalker";
} }
@@ -226,7 +242,7 @@ public:
MTGCardInstance* attacker; MTGCardInstance* attacker;
AAPlaneswalkerAttacked(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target); AAPlaneswalkerAttacked(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target);
int resolve(); int resolve();
const char* getMenuText(); const string getMenuText();
AAPlaneswalkerAttacked * clone() const; AAPlaneswalkerAttacked * clone() const;
~AAPlaneswalkerAttacked(); ~AAPlaneswalkerAttacked();
}; };
@@ -252,7 +268,7 @@ public:
int reactToClick(MTGCardInstance * card); int reactToClick(MTGCardInstance * card);
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
MTGBlockRule(GameObserver* observer, int _id); MTGBlockRule(GameObserver* observer, int _id);
const char * getMenuText(); const string getMenuText();
virtual MTGBlockRule * clone() const; virtual MTGBlockRule * clone() const;
~MTGBlockRule(); ~MTGBlockRule();
}; };
@@ -386,7 +402,7 @@ public:
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL); int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
int reactToClick(MTGCardInstance * card); int reactToClick(MTGCardInstance * card);
int reactToClick(MTGCardInstance * card, int id); int reactToClick(MTGCardInstance * card, int id);
const char * getMenuText() const string getMenuText()
{ {
return "Momir"; return "Momir";
} }
@@ -406,7 +422,7 @@ public:
MTGCardInstance * genEquip(int id); MTGCardInstance * genEquip(int id);
MTGStoneHewerRule(GameObserver* observer, int _id, MTGAllCards * _collection); MTGStoneHewerRule(GameObserver* observer, int _id, MTGAllCards * _collection);
int receiveEvent(WEvent * event); int receiveEvent(WEvent * event);
const char * getMenuText() const string getMenuText()
{ {
return "Stone Hewer"; return "Stone Hewer";
} }
@@ -419,7 +435,7 @@ class MTGHermitRule: public PermanentAbility
public: public:
MTGHermitRule(GameObserver* observer, int _id); MTGHermitRule(GameObserver* observer, int _id);
int receiveEvent(WEvent * event); int receiveEvent(WEvent * event);
const char * getMenuText() const string getMenuText()
{ {
return "Hermit"; return "Hermit";
} }
@@ -447,7 +463,7 @@ public:
int receiveEvent(WEvent * event); int receiveEvent(WEvent * event);
const char * getMenuText() const string getMenuText()
{ {
return "Deathtouch"; return "Deathtouch";
} }
-11
View File
@@ -1,11 +0,0 @@
#ifndef _OSD_H_
#define _OSD_H_
class OSDLayer: public PlayGuiObjectController
{
virtual void Update(float dt);
virtual bool CheckUserInput(JButton key);
virtual void Render();
};
#endif
+2
View File
@@ -1,6 +1,8 @@
#ifndef OBJECTANALYTICS_H #ifndef OBJECTANALYTICS_H
#define OBJECTANALYTICS_H #define OBJECTANALYTICS_H
#include <boost/cstdint.hpp>
#ifdef _DEBUG #ifdef _DEBUG
#define TRACK_OBJECT_USAGE #define TRACK_OBJECT_USAGE
#endif #endif
-1
View File
@@ -7,7 +7,6 @@
#include <JGui.h> #include <JGui.h>
#include <vector> #include <vector>
#include <string> #include <string>
#include "GameApp.h"
#include "GameStateOptions.h" #include "GameStateOptions.h"
#include "WFilter.h" #include "WFilter.h"
#include "WDataSrc.h" #include "WDataSrc.h"
+1 -1
View File
@@ -62,7 +62,7 @@ public:
int addCombatAfter(Player* player, int after_id, bool withMain = false); int addCombatAfter(Player* player, int after_id, bool withMain = false);
int addPhaseAfter(GamePhase id, Player* player, int after_id); int addPhaseAfter(GamePhase id, Player* player, int after_id);
int removePhase(int id); int removePhase(int id);
const char * phaseName(int id); const string& phaseName(int id);
static GamePhase phaseStrToInt(string s); static GamePhase phaseStrToInt(string s);
static string phaseIntToStr(int id); static string phaseIntToStr(int id);
+3 -1
View File
@@ -20,16 +20,18 @@ public:
~PriceList(); ~PriceList();
int save(); int save();
int getSellPrice(int cardid); int getSellPrice(int cardid);
int getSellPrice(MTGCard* card);
int getPurchasePrice(int cardid); int getPurchasePrice(int cardid);
int getPrice(MTGCard *card);
int getPrice(int cardId); int getPrice(int cardId);
int setPrice(int cardId, int price); int setPrice(int cardId, int price);
int setPrice(MTGCard *card, int price);
int getOtherPrice(int amt); int getOtherPrice(int amt);
static float difficultyScalar(float price, int cardid = 0); static float difficultyScalar(float price, int cardid = 0);
static void updateKey() static void updateKey()
{ {
randomKey = rand(); randomKey = rand();
} }
;
}; };
#endif #endif
+3 -2
View File
@@ -29,9 +29,10 @@ protected:
TargetChooser * tcTarget; TargetChooser * tcTarget;
int damage; int damage;
bool oneShot; bool oneShot;
int typeOfDamage; Damage::DamageType typeOfDamage;
public: public:
REDamagePrevention(MTGAbility * _source, TargetChooser *_tcSource = NULL, TargetChooser *_tcTarget = NULL, int _damage = -1, bool _oneShot = true, int typeOfDamage = DAMAGE_ALL_TYPES); REDamagePrevention(MTGAbility * _source, TargetChooser *_tcSource = NULL, TargetChooser *_tcTarget = NULL,
int _damage = -1, bool _oneShot = true, Damage::DamageType typeOfDamage = Damage::DAMAGE_ALL_TYPES);
WEvent * replace(WEvent *e); WEvent * replace(WEvent *e);
~REDamagePrevention(); ~REDamagePrevention();
}; };
+1 -1
View File
@@ -43,7 +43,7 @@ public:
virtual bool CheckUserInput(JButton key); virtual bool CheckUserInput(JButton key);
virtual void Update(float dt); virtual void Update(float dt);
using JGuiController::Add; using JGuiController::Add;
virtual void Add(int id, const char * Text, string desc = "", bool forceFocus = false); virtual void Add(int id, const string &Text, string desc = "", bool forceFocus = false);
int getmCurr(){return mCurr;} int getmCurr(){return mCurr;}
float getWidth(){return mWidth; } float getWidth(){return mWidth; }
virtual void Close(); virtual void Close();
+5
View File
@@ -1,3 +1,6 @@
#ifndef _STYLE_MANAGER_H_
#define _STYLE_MANAGER_H_
class WStyle class WStyle
{ {
public: public:
@@ -34,3 +37,5 @@ protected:
string activeStyle; string activeStyle;
map<string, WStyle*> styles; map<string, WStyle*> styles;
}; };
#endif //_STYLE_MANAGER_H_
+2
View File
@@ -3,6 +3,8 @@
#include <vector> #include <vector>
class GameObserver;
// Task type constant // Task type constant
#define TASK_BASIC 'B' #define TASK_BASIC 'B'
+2
View File
@@ -1,3 +1,5 @@
#include "MTGDeck.h"
#ifndef _WFILTER_H_ #ifndef _WFILTER_H_
#define _WFILTER_H_ #define _WFILTER_H_
/** /**
+1
View File
@@ -8,6 +8,7 @@
class hgeDistortionMesh; class hgeDistortionMesh;
class GameStateOptions; class GameStateOptions;
class SimpleMenu;
/** /**
@defgroup WGui Basic Gui @defgroup WGui Basic Gui
+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)) && (!defined QT_CONFIG) #if ((defined WIN32) || (defined WP8))
#define snprintf sprintf_s #define snprintf sprintf_s
#endif #endif
+17
View File
@@ -26,6 +26,7 @@
#include <iostream> #include <iostream>
#include <algorithm> #include <algorithm>
#include <stdlib.h> #include <stdlib.h>
#include <list>
#include "DebugRoutines.h" #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 */ /* replace_all ... replacement to avoid depending on boost for that */
void ReplaceString(std::string& subject, const std::string& search, const std::string& replace); void ReplaceString(std::string& subject, const std::string& search, const std::string& replace);
/*! \brief Returns true if base starts with start, otherwise false
*
* Compares the first strlen(start) characters of base with start and
* returns true if both match.
*/
bool StartsWith(const std::string& base, const char *start);
/*! \brief Returns true if base starts with start, otherwise false
*
* This version is slightly more efficient as strlen does not need to
* get called. Otherwise, it behaves exactly like
* StartsWith(const std::string& base, const char *start)
*
* \see StartsWith(const std::string& base, const char *start)
*/
bool StartsWith(const std::string& base, const std::string& start);
#endif #endif
+6 -8
View File
@@ -74,8 +74,7 @@ AIHint::AIHint(string _line)
if(action.find( "combo ") != string::npos) if(action.find( "combo ") != string::npos)
{ {
string Combo = ""; string Combo = action.c_str() + 6;
Combo = action.c_str() + 6;
combos.push_back(Combo); combos.push_back(Combo);
} }
@@ -307,14 +306,13 @@ bool AIHints::canWeCombo(GameObserver* observer,MTGCardInstance * card,AIPlayerB
TargetChooserFactory tfc(observer); TargetChooserFactory tfc(observer);
TargetChooser * hintTc = NULL; TargetChooser * hintTc = NULL;
bool gotCombo = false; bool gotCombo = false;
int comboPartsHold = 0;
int comboPartsUntil = 0;
int comboPartsRestriction = 0;
for(unsigned int i = 0; i < hints.size();i++) for(unsigned int i = 0; i < hints.size();i++)
{ {
comboPartsHold = 0; int comboPartsHold = 0;
comboPartsUntil = 0; int comboPartsUntil = 0;
comboPartsRestriction = 0; int comboPartsRestriction = 0;
if(gotCombo) if(gotCombo)
return gotCombo;//because more then one might be possible at any time. return gotCombo;//because more then one might be possible at any time.
if (hints[i]->hold.size()) if (hints[i]->hold.size())
+2 -6
View File
@@ -90,13 +90,12 @@ int AIMomirPlayer::computeActions()
} }
else if (p == this && observer->mLayers->stackLayer()->count(0, NOT_RESOLVED) == 0) else if (p == this && observer->mLayers->stackLayer()->count(0, NOT_RESOLVED) == 0)
{ //standard actions { //standard actions
CardDescriptor cd;
MTGCardInstance * card = NULL;
switch (currentGamePhase) switch (currentGamePhase)
{ {
case MTG_PHASE_FIRSTMAIN: case MTG_PHASE_FIRSTMAIN:
{ {
CardDescriptor cd;
ManaCost * potentialMana = getPotentialMana(); ManaCost * potentialMana = getPotentialMana();
int converted = potentialMana->getConvertedCost(); int converted = potentialMana->getConvertedCost();
SAFE_DELETE(potentialMana); SAFE_DELETE(potentialMana);
@@ -106,7 +105,7 @@ int AIMomirPlayer::computeActions()
//Attempt to put land into play //Attempt to put land into play
cd.init(); cd.init();
cd.setColor(Constants::MTG_COLOR_LAND); cd.setColor(Constants::MTG_COLOR_LAND);
card = cd.match(game->hand); MTGCardInstance *card = cd.match(game->hand);
int canPutLandsIntoPlay = game->playRestrictions->canPutIntoZone(card, game->inPlay); int canPutLandsIntoPlay = game->playRestrictions->canPutIntoZone(card, game->inPlay);
if (card && (canPutLandsIntoPlay == PlayRestriction::CAN_PLAY)) if (card && (canPutLandsIntoPlay == PlayRestriction::CAN_PLAY))
{ {
@@ -118,15 +117,12 @@ int AIMomirPlayer::computeActions()
} }
momir(); momir();
return 1; return 1;
break;
} }
case MTG_PHASE_SECONDMAIN: case MTG_PHASE_SECONDMAIN:
selectAbility(); selectAbility();
return 1; return 1;
break;
default: default:
return AIPlayerBaka::computeActions(); return AIPlayerBaka::computeActions();
break;
} }
} }
return AIPlayerBaka::computeActions(); return AIPlayerBaka::computeActions();
+2 -2
View File
@@ -97,7 +97,7 @@ int AIAction::clickMultiAct(vector<Targetable*>& actionTargets)
ite = actionTargets.erase(ite); ite = actionTargets.erase(ite);
continue; continue;
} }
ite++; ++ite;
} }
//shuffle to make it less predictable, otherwise ai will always seem to target from right to left. making it very obvious. //shuffle to make it less predictable, otherwise ai will always seem to target from right to left. making it very obvious.
@@ -167,7 +167,7 @@ int AIPlayer::clickMultiTarget(TargetChooser * tc, vector<Targetable*>& potentia
ite = potentialTargets.erase(ite); ite = potentialTargets.erase(ite);
continue; continue;
} }
ite++; ++ite;
} }
randomGenerator.random_shuffle(potentialTargets.begin(), potentialTargets.end()); randomGenerator.random_shuffle(potentialTargets.begin(), potentialTargets.end());
+10 -22
View File
@@ -134,10 +134,9 @@ int OrderedAIAction::getEfficiency()
if (!target) if (!target)
break; break;
bool NeedPreventing;
NeedPreventing = false;
if (currentPhase == MTG_PHASE_COMBATBLOCKERS) if (currentPhase == MTG_PHASE_COMBATBLOCKERS)
{ {
bool NeedPreventing = false;
MTGCardInstance * nextOpponent = target->getNextOpponent(); MTGCardInstance * nextOpponent = target->getNextOpponent();
if(!nextOpponent) if(!nextOpponent)
break; break;
@@ -152,12 +151,10 @@ int OrderedAIAction::getEfficiency()
//small bonus added for the poor 1/1s, if we can save them, we will unless something else took precidence. //small bonus added for the poor 1/1s, if we can save them, we will unless something else took precidence.
//note is the target is being blocked or blocking a creature with wither or deathtouch, it is not even considered for preventing as it is a waste. //note is the target is being blocked or blocking a creature with wither or deathtouch, it is not even considered for preventing as it is a waste.
//if its combat blockers, it is being blocked or blocking, and has less prevents the the amount of damage it will be taking, the effeincy is increased slightly and totalled by the danger rank multiplier for final result. //if its combat blockers, it is being blocked or blocking, and has less prevents the the amount of damage it will be taking, the effeincy is increased slightly and totalled by the danger rank multiplier for final result.
int calculateAfterDamage = 0;
int damages = 0;
if((target->defenser || target->blockers.size()) && target->controller() == p) if((target->defenser || target->blockers.size()) && target->controller() == p)
{ {
damages = nextOpponent->power; int damages = nextOpponent->power;
calculateAfterDamage = int(target->toughness - damages); int calculateAfterDamage = target->toughness - damages;
if((calculateAfterDamage + target->preventable) > 0) if((calculateAfterDamage + target->preventable) > 0)
{ {
efficiency = 0; efficiency = 0;
@@ -588,8 +585,7 @@ int OrderedAIAction::getEfficiency()
efficiency = 80; efficiency = 80;
if(atc->name.length() && atc->sabilities.length() && atc->types.size() && p->game->inPlay->findByName(atc->name)) if(atc->name.length() && atc->sabilities.length() && atc->types.size() && p->game->inPlay->findByName(atc->name))
{ {
list<int>::iterator it; for (list<int>::const_iterator it = atc->types.begin(); it != atc->types.end(); ++it)
for (it = atc->types.begin(); it != atc->types.end(); it++)
{ {
if(*it == Subtypes::TYPE_LEGENDARY)//ai please stop killing voja!!! :P if(*it == Subtypes::TYPE_LEGENDARY)//ai please stop killing voja!!! :P
efficiency = 0; efficiency = 0;
@@ -978,11 +974,10 @@ vector<MTGAbility*> AIPlayerBaka::canPayMana(MTGCardInstance * target,ManaCost *
} }
} }
ManaCostHybrid * hybridCost; ManaCostHybrid * hybridCost;
int hyb;
hyb = 0;
hybridCost = cost->getHybridCost(0); hybridCost = cost->getHybridCost(0);
if(hybridCost) if(hybridCost)
{ {
int hyb = 0;
while ((hybridCost = cost->getHybridCost(hyb)) != NULL) while ((hybridCost = cost->getHybridCost(hyb)) != NULL)
{ {
//here we try to find one of the colors in the hybrid cost, it is done 1 at a time unfortunately //here we try to find one of the colors in the hybrid cost, it is done 1 at a time unfortunately
@@ -1046,7 +1041,6 @@ vector<MTGAbility*> AIPlayerBaka::canPayMana(MTGCardInstance * target,ManaCost *
{ {
ManaCost * withKickerCost= NEW ManaCost(cost->getKicker()); ManaCost * withKickerCost= NEW ManaCost(cost->getKicker());
int canKick = 0;
vector<MTGAbility*>kickerPayment; vector<MTGAbility*>kickerPayment;
bool keepLooking = true; bool keepLooking = true;
while(keepLooking) while(keepLooking)
@@ -1061,7 +1055,6 @@ vector<MTGAbility*> AIPlayerBaka::canPayMana(MTGCardInstance * target,ManaCost *
payments.push_back(kickerPayment[w]); payments.push_back(kickerPayment[w]);
} }
} }
canKick += 1;
keepLooking = cost->getKicker()->isMulti; keepLooking = cost->getKicker()->isMulti;
} }
else else
@@ -1297,12 +1290,10 @@ int AIPlayerBaka::createAbilityTargets(MTGAbility * a, MTGCardInstance * c, Rank
TargetChooser * AIPlayerBaka::GetComboTc( GameObserver * observer,TargetChooser * tc) TargetChooser * AIPlayerBaka::GetComboTc( GameObserver * observer,TargetChooser * tc)
{ {
TargetChooser * gathertc = NULL;
TargetChooserFactory tcf(observer); TargetChooserFactory tcf(observer);
map<string, string>::iterator it = comboHint->cardTargets.begin(); for(map<string, string>::iterator it = comboHint->cardTargets.begin();it != comboHint->cardTargets.end();++it)
for(map<string, string>::iterator it = comboHint->cardTargets.begin();it != comboHint->cardTargets.end();it++)
{ {
gathertc = tcf.createTargetChooser(it->first.c_str(),tc->source); TargetChooser *gathertc = tcf.createTargetChooser(it->first.c_str(),tc->source);
gathertc->setAllZones(); gathertc->setAllZones();
if(gathertc->canTarget(tc->source)) if(gathertc->canTarget(tc->source))
{ {
@@ -1402,7 +1393,6 @@ int AIPlayerBaka::selectAbility()
MTGCardInstance * card = game->inPlay->cards[j]; MTGCardInstance * card = game->inPlay->cards[j];
if(a->getCost() && !a->isReactingToClick(card, totalPotentialMana))//for performance reason only look for specific mana if the payment couldnt be made with potential. if(a->getCost() && !a->isReactingToClick(card, totalPotentialMana))//for performance reason only look for specific mana if the payment couldnt be made with potential.
{ {
abilityPayment = vector<MTGAbility*>();
abilityPayment = canPayMana(card,a->getCost()); abilityPayment = canPayMana(card,a->getCost());
} }
if (a->isReactingToClick(card, totalPotentialMana) || abilityPayment.size()) if (a->isReactingToClick(card, totalPotentialMana) || abilityPayment.size())
@@ -1410,10 +1400,9 @@ int AIPlayerBaka::selectAbility()
if(a->getCost() && a->getCost()->hasX() && totalPotentialMana->getConvertedCost() < a->getCost()->getConvertedCost()+1) if(a->getCost() && a->getCost()->hasX() && totalPotentialMana->getConvertedCost() < a->getCost()->getConvertedCost()+1)
continue; continue;
//don't even bother to play an ability with {x} if you can't even afford x=1. //don't even bother to play an ability with {x} if you can't even afford x=1.
ManaCost * fullPayment = NULL;
if (abilityPayment.size()) if (abilityPayment.size())
{ {
fullPayment = NEW ManaCost(); ManaCost *fullPayment = NEW ManaCost();
for(int ch = 0; ch < int(abilityPayment.size());ch++) for(int ch = 0; ch < int(abilityPayment.size());ch++)
{ {
AManaProducer * ampp = dynamic_cast<AManaProducer*> (abilityPayment[ch]); AManaProducer * ampp = dynamic_cast<AManaProducer*> (abilityPayment[ch]);
@@ -1525,7 +1514,7 @@ int AIPlayerBaka::chooseTarget(TargetChooser * _tc, Player * forceTarget,MTGCard
} }
//Make sure we own the decision to choose the targets //Make sure we own the decision to choose the targets
assert(tc->Owner == observer->currentlyActing()); assert(tc->Owner == observer->currentlyActing());
if (tc && tc->Owner != observer->currentlyActing()) if (tc->Owner != observer->currentlyActing())
{ {
observer->currentActionPlayer = tc->Owner; observer->currentActionPlayer = tc->Owner;
//this is a hack, but if we hit this condition we are locked in a infinate loop //this is a hack, but if we hit this condition we are locked in a infinate loop
@@ -1905,12 +1894,11 @@ MTGCardInstance * AIPlayerBaka::activateCombo()
{ {
if(!comboHint) if(!comboHint)
return NULL; return NULL;
TargetChooser * hintTc = NULL;
TargetChooserFactory tfc(observer); TargetChooserFactory tfc(observer);
ManaCost * totalCost = ManaCost::parseManaCost(comboHint->manaNeeded); ManaCost * totalCost = ManaCost::parseManaCost(comboHint->manaNeeded);
for(unsigned int k = 0;k < comboHint->casting.size(); k++) for(unsigned int k = 0;k < comboHint->casting.size(); k++)
{ {
hintTc = tfc.createTargetChooser(comboHint->casting[k],nextCardToPlay); TargetChooser *hintTc = tfc.createTargetChooser(comboHint->casting[k],nextCardToPlay);
int combohand = game->hand->cards.size(); int combohand = game->hand->cards.size();
for(int j = 0; j < combohand;j++) for(int j = 0; j < combohand;j++)
{ {
+5 -5
View File
@@ -24,7 +24,7 @@ AIStats::AIStats(Player * _player, char * _filename)
AIStats::~AIStats() AIStats::~AIStats()
{ {
list<AIStat *>::iterator it; list<AIStat *>::iterator it;
for (it = stats.begin(); it != stats.end(); it++) for (it = stats.begin(); it != stats.end(); ++it)
{ {
AIStat * stat = *it; AIStat * stat = *it;
delete stat; delete stat;
@@ -47,7 +47,7 @@ void AIStats::updateStatsCard(MTGCardInstance * cardInstance, Damage * damage, f
{ {
stat->value += static_cast<int>(multiplier * STATS_PLAYER_MULTIPLIER * damage->damage); stat->value += static_cast<int>(multiplier * STATS_PLAYER_MULTIPLIER * damage->damage);
} }
else if (damage->target->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE) else if (damage->target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE)
{ {
MTGCardInstance * target = (MTGCardInstance *) damage->target; MTGCardInstance * target = (MTGCardInstance *) damage->target;
if (target->controller() == player && !target->isInPlay(player->getObserver())) if (target->controller() == player && !target->isInPlay(player->getObserver()))
@@ -115,7 +115,7 @@ bool AIStats::isInTop(MTGCardInstance * card, unsigned int max, bool tooSmallCou
MTGCard * source = card->model; MTGCard * source = card->model;
int id = source->getMTGId(); int id = source->getMTGId();
list<AIStat *>::iterator it; list<AIStat *>::iterator it;
for (it = stats.begin(); it != stats.end(); it++) for (it = stats.begin(); it != stats.end(); ++it)
{ {
if (n >= max) if (n >= max)
return false; return false;
@@ -135,7 +135,7 @@ AIStat * AIStats::find(MTGCard * source)
{ {
int id = source->getMTGId(); int id = source->getMTGId();
list<AIStat *>::iterator it; list<AIStat *>::iterator it;
for (it = stats.begin(); it != stats.end(); it++) for (it = stats.begin(); it != stats.end(); ++it)
{ {
AIStat * stat = *it; AIStat * stat = *it;
if (stat->source == id) if (stat->source == id)
@@ -174,7 +174,7 @@ void AIStats::save()
{ {
char writer[128]; char writer[128];
list<AIStat *>::iterator it; list<AIStat *>::iterator it;
for (it = stats.begin(); it != stats.end(); it++) for (it = stats.begin(); it != stats.end(); ++it)
{ {
AIStat * stat = *it; AIStat * stat = *it;
if (stat->value > 0) if (stat->value > 0)
+2 -8
View File
@@ -8,7 +8,7 @@
ActionElement::ActionElement(int id) : ActionElement::ActionElement(int id) :
JGuiObject(id) JGuiObject(id)
{ {
activeState = INACTIVE; activity = Inactive;
modal = 0; modal = 0;
waitingForAnswer = 0; waitingForAnswer = 0;
currentPhase = MTG_PHASE_INVALID; currentPhase = MTG_PHASE_INVALID;
@@ -18,7 +18,7 @@ ActionElement::ActionElement(int id) :
ActionElement::ActionElement(const ActionElement& a): JGuiObject(a) ActionElement::ActionElement(const ActionElement& a): JGuiObject(a)
{ {
activeState = a.activeState; activity = a.activity;
tc = a.tc ? a.tc->clone() : NULL; tc = a.tc ? a.tc->clone() : NULL;
currentPhase = a.currentPhase; currentPhase = a.currentPhase;
newPhase = a.newPhase; newPhase = a.newPhase;
@@ -31,12 +31,6 @@ ActionElement::~ActionElement()
SAFE_DELETE(tc); SAFE_DELETE(tc);
} }
int ActionElement::getActivity()
{
return activeState;
}
int ActionElement::isReactingToTargetClick(Targetable * object) int ActionElement::isReactingToTargetClick(Targetable * object)
{ {
if (MTGCardInstance * cObject = dynamic_cast<MTGCardInstance *>(object)) if (MTGCardInstance * cObject = dynamic_cast<MTGCardInstance *>(object))
+4 -7
View File
@@ -165,8 +165,6 @@ void ActionLayer::Update(float dt)
if (cantCancel) if (cantCancel)
{ {
ActionElement * ae = isWaitingForAnswer(); ActionElement * ae = isWaitingForAnswer();
int countTargets = 0;
int maxTargets = 0;
if(ae && ae->getActionTc()) if(ae && ae->getActionTc())
{ {
if (!ae->getActionTc()->validTargetsExist()) if (!ae->getActionTc()->validTargetsExist())
@@ -175,8 +173,8 @@ void ActionLayer::Update(float dt)
cancelCurrentAction(); cancelCurrentAction();
return; return;
} }
countTargets = ae->getActionTc()->countValidTargets(); int countTargets = ae->getActionTc()->countValidTargets();
maxTargets = ae->getActionTc()->maxtargets; int maxTargets = ae->getActionTc()->maxtargets;
if (countTargets < maxTargets) if (countTargets < maxTargets)
{ {
/* /*
@@ -266,7 +264,7 @@ int ActionLayer::receiveEventPlus(WEvent * event)
ActionElement * currentAction = (ActionElement *) mObjects[i]; ActionElement * currentAction = (ActionElement *) mObjects[i];
result += currentAction->receiveEvent(event); result += currentAction->receiveEvent(event);
} }
return 0; return result;
} }
int ActionLayer::isReactingToTargetClick(Targetable * card) int ActionLayer::isReactingToTargetClick(Targetable * card)
@@ -440,10 +438,9 @@ void ActionLayer::setCustomMenuObject(Targetable * object, bool must,vector<MTGA
if(abilities.size()) if(abilities.size())
{ {
abilitiesMenu->isMultipleChoice = true; abilitiesMenu->isMultipleChoice = true;
ActionElement * currentAction = NULL;
for(int w = 0; w < int(abilities.size());w++) for(int w = 0; w < int(abilities.size());w++)
{ {
currentAction = (ActionElement*)abilities[w]; ActionElement* currentAction = (ActionElement*)abilities[w];
currentActionCard = (MTGCardInstance*)abilities[0]->target; currentActionCard = (MTGCardInstance*)abilities[0]->target;
abilitiesMenu->Add(mObjects.size()-1, currentAction->getMenuText(),"",false); abilitiesMenu->Add(mObjects.size()-1, currentAction->getMenuText(),"",false);
} }
+4 -3
View File
@@ -57,7 +57,7 @@ void NextGamePhase::Render()
if (observer->currentActionPlayer == observer->players[1]) if (observer->currentActionPlayer == observer->players[1])
playerId = 2; playerId = 2;
sprintf(buffer, "%s %i : %s", _("Player").c_str(), playerId, observer->getNextGamePhaseName()); sprintf(buffer, "%s %i : %s", _("Player").c_str(), playerId, observer->getNextGamePhaseName().c_str());
mFont->DrawString(buffer, x + 15, y+10, JGETEXT_LEFT); mFont->DrawString(buffer, x + 15, y+10, JGETEXT_LEFT);
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE); mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
@@ -161,7 +161,7 @@ void StackAbility::Render()
if (target) if (target)
{ {
quad = target->getIcon(); quad = target->getIcon();
if (target->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE) if (target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE)
{ {
alt2 = ((MTGCardInstance *) target)->name; alt2 = ((MTGCardInstance *) target)->name;
} }
@@ -400,7 +400,7 @@ void Spell::Render()
if (target) if (target)
{ {
quad = target->getIcon(); quad = target->getIcon();
if (target->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE) if (target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE)
{ {
alt2 = ((MTGCardInstance *) target)->name; alt2 = ((MTGCardInstance *) target)->name;
} }
@@ -675,6 +675,7 @@ ActionStack::ActionStack(GameObserver* game)
currentState = -1; currentState = -1;
mode = ACTIONSTACK_STANDARD; mode = ACTIONSTACK_STANDARD;
checked = 0; checked = 0;
lastActionController = NULL;
if(!observer->getResourceManager()) return; if(!observer->getResourceManager()) return;
for (int i = 0; i < 8; ++i) for (int i = 0; i < 8; ++i)
+257 -143
View File
@@ -55,6 +55,12 @@ GenericActivatedAbility::GenericActivatedAbility(GameObserver* observer, string
target = ability->target; target = ability->target;
} }
GenericActivatedAbility::GenericActivatedAbility(const GenericActivatedAbility &other):
ActivatedAbility(other), NestedAbility(other), activeZone(other.activeZone), newName(other.newName)
{
}
int GenericActivatedAbility::resolve() int GenericActivatedAbility::resolve()
{ {
//Note: I've seen a similar block in some other MTGAbility, can this be refactored . //Note: I've seen a similar block in some other MTGAbility, can this be refactored .
@@ -71,7 +77,7 @@ int GenericActivatedAbility::resolve()
return 0; return 0;
} }
const char * GenericActivatedAbility::getMenuText() const string GenericActivatedAbility::getMenuText()
{ {
if(newName.size()) if(newName.size())
return newName.c_str(); return newName.c_str();
@@ -105,6 +111,7 @@ int GenericActivatedAbility::testDestroy()
GenericActivatedAbility * GenericActivatedAbility::clone() const GenericActivatedAbility * GenericActivatedAbility::clone() const
{ {
GenericActivatedAbility * a = NEW GenericActivatedAbility(*this); GenericActivatedAbility * a = NEW GenericActivatedAbility(*this);
a->ability = ability->clone(); a->ability = ability->clone();
return a; return a;
} }
@@ -133,7 +140,7 @@ int AAAlterPoison::resolve()
return 0; return 0;
} }
const char * AAAlterPoison::getMenuText() const string AAAlterPoison::getMenuText()
{ {
return "Poison"; return "Poison";
} }
@@ -165,7 +172,7 @@ int AADamagePrevent::resolve()
return 0; return 0;
} }
const char * AADamagePrevent::getMenuText() const string AADamagePrevent::getMenuText()
{ {
return "Prevent Damage"; return "Prevent Damage";
} }
@@ -237,7 +244,7 @@ AADamager::AADamager(GameObserver* observer, int _id, MTGCardInstance * _source,
return damage.getValue(); return damage.getValue();
} }
const char * AADamager::getMenuText() const string AADamager::getMenuText()
{ {
MTGCardInstance * _target = dynamic_cast<MTGCardInstance*>(target); MTGCardInstance * _target = dynamic_cast<MTGCardInstance*>(target);
if(_target && _target->hasType(Subtypes::TYPE_PLANESWALKER)) if(_target && _target->hasType(Subtypes::TYPE_PLANESWALKER))
@@ -276,7 +283,7 @@ AADepleter::AADepleter(GameObserver* observer, int _id, MTGCardInstance * card,
return 1; return 1;
} }
const char * AADepleter::getMenuText() const string AADepleter::getMenuText()
{ {
return "Deplete"; return "Deplete";
} }
@@ -311,7 +318,7 @@ AAModTurn::AAModTurn(GameObserver* observer, int _id, MTGCardInstance * card, Ta
return 1; return 1;
} }
const char * AAModTurn::getMenuText() const string AAModTurn::getMenuText()
{ {
WParsedInt numTurns(nbTurnStr, NULL, source); WParsedInt numTurns(nbTurnStr, NULL, source);
if(numTurns.getValue() > 0) if(numTurns.getValue() > 0)
@@ -354,7 +361,7 @@ int AALibraryBottom::resolve()
return 0; return 0;
} }
const char * AALibraryBottom::getMenuText() const string AALibraryBottom::getMenuText()
{ {
return "Bottom Of Library"; return "Bottom Of Library";
} }
@@ -382,7 +389,7 @@ int AACopier::resolve()
return 0; return 0;
} }
const char * AACopier::getMenuText() const string AACopier::getMenuText()
{ {
return "Copy"; return "Copy";
} }
@@ -415,7 +422,7 @@ int AAPhaseOut::resolve()
return 0; return 0;
} }
const char * AAPhaseOut::getMenuText() const string AAPhaseOut::getMenuText()
{ {
return "Phase Out"; return "Phase Out";
} }
@@ -506,7 +513,7 @@ AACounter::AACounter(GameObserver* observer, int id, MTGCardInstance * source, M
return 0; return 0;
} }
const char* AACounter::getMenuText() const string AACounter::getMenuText()
{ {
if (menu.size()) if (menu.size())
{ {
@@ -695,7 +702,7 @@ int AARemoveAllCounter::resolve()
return nb; return nb;
} }
const char* AARemoveAllCounter::getMenuText() const string AARemoveAllCounter::getMenuText()
{ {
if (menu.size()) if (menu.size())
{ {
@@ -773,7 +780,7 @@ int AAProliferate::resolve()
} }
const char* AAProliferate::getMenuText() const string AAProliferate::getMenuText()
{ {
return "Proliferate"; return "Proliferate";
} }
@@ -816,13 +823,13 @@ int GenericChooseTypeColor::resolve()
for (size_t i = 0; i < values.size(); ++i) for (size_t i = 0; i < values.size(); ++i)
{ {
string menu = values[i]; string menu = values[i];
if(!ANonWall || (menu != "wall" && menu != "Wall")) if (!ANonWall || (menu != "wall" && menu != "Wall"))
{ {
setType = NEW AASetTypeChosen(game, game->mLayers->actionLayer()->getMaxId(), source,(MTGCardInstance*)target, i,menu,baseAbility); setType = NEW AASetTypeChosen(game, game->mLayers->actionLayer()->getMaxId(), source,(MTGCardInstance*)target, i,menu,baseAbility);
MTGAbility * set = setType->clone(); MTGAbility * set = setType->clone();
set->oneShot = true; set->oneShot = true;
selection.push_back(set); selection.push_back(set);
SAFE_DELETE(setType); SAFE_DELETE(setType);
} }
} }
} }
@@ -837,7 +844,7 @@ int GenericChooseTypeColor::resolve()
} }
const char* GenericChooseTypeColor::getMenuText() const string GenericChooseTypeColor::getMenuText()
{ {
if(chooseColor) if(chooseColor)
return "Choose a color"; return "Choose a color";
@@ -899,7 +906,7 @@ int AASetColorChosen::resolve()
return 1; return 1;
} }
const char* AASetColorChosen::getMenuText() const string AASetColorChosen::getMenuText()
{ {
return Constants::MTGColorStrings[color]; return Constants::MTGColorStrings[color];
} }
@@ -956,7 +963,7 @@ int AASetTypeChosen::resolve()
return 1; return 1;
} }
const char* AASetTypeChosen::getMenuText() const string AASetTypeChosen::getMenuText()
{ {
return menutext.c_str(); return menutext.c_str();
} }
@@ -973,7 +980,7 @@ AASetTypeChosen::~AASetTypeChosen()
// //
//choosing a type or color //choosing a type or color
GenericFlipACoin::GenericFlipACoin(GameObserver* observer, int id, MTGCardInstance * source, Targetable *,string _toAdd, ManaCost * cost) : 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(); this->GetId();
setCoin = NULL; setCoin = NULL;
@@ -1003,7 +1010,7 @@ int GenericFlipACoin::resolve()
} }
const char* GenericFlipACoin::getMenuText() const string GenericFlipACoin::getMenuText()
{ {
return "Flip A Coin"; return "Flip A Coin";
} }
@@ -1095,7 +1102,7 @@ int AASetCoin::resolve()
return 1; return 1;
} }
const char* AASetCoin::getMenuText() const string AASetCoin::getMenuText()
{ {
if(side == 1) if(side == 1)
return "Tails"; return "Tails";
@@ -1144,9 +1151,6 @@ int GenericPaidAbility::resolve()
baseAbility = Af.parseMagicLine(baseAbilityStrSplit[0], this->GetId(), NULL, source); baseAbility = Af.parseMagicLine(baseAbilityStrSplit[0], this->GetId(), NULL, source);
baseAbility->target = target; baseAbility->target = target;
optionalCost = ManaCost::parseManaCost(baseCost, NULL, source); optionalCost = ManaCost::parseManaCost(baseCost, NULL, source);
if (optionalCost->hasX()) {
optionalCost->add(Constants::MTG_COLOR_ARTIFACT, source->storedSourceCard->X);
}
// hacky way to produce better MenuText // hacky way to produce better MenuText
AAFakeAbility* isFake = dynamic_cast< AAFakeAbility* >( baseAbility ); AAFakeAbility* isFake = dynamic_cast< AAFakeAbility* >( baseAbility );
@@ -1189,7 +1193,7 @@ int GenericPaidAbility::resolve()
return 1; return 1;
} }
const char* GenericPaidAbility::getMenuText() const string GenericPaidAbility::getMenuText()
{ {
if (newName.size()) if (newName.size())
return newName.c_str(); return newName.c_str();
@@ -1291,7 +1295,7 @@ int AAResetDamage::resolve()
return 1; return 1;
} }
const char* AAResetDamage::getMenuText() const string AAResetDamage::getMenuText()
{ {
return "Reset Damages"; return "Reset Damages";
} }
@@ -1312,7 +1316,7 @@ int AAFakeAbility::resolve()
return 1; return 1;
} }
const char* AAFakeAbility::getMenuText() const string AAFakeAbility::getMenuText()
{ {
if(named.size()) if(named.size())
return named.c_str(); return named.c_str();
@@ -1359,7 +1363,7 @@ int AAFizzler::resolve()
return 1; return 1;
} }
const char * AAFizzler::getMenuText() const string AAFizzler::getMenuText()
{ {
return "Fizzle"; return "Fizzle";
} }
@@ -1406,7 +1410,7 @@ int AABuryCard::resolve()
return 0; return 0;
} }
const char * AABuryCard::getMenuText() const string AABuryCard::getMenuText()
{ {
if(menu.size()) if(menu.size())
return menu.c_str(); return menu.c_str();
@@ -1462,7 +1466,7 @@ int AADestroyCard::resolve()
return 0; return 0;
} }
const char * AADestroyCard::getMenuText() const string AADestroyCard::getMenuText()
{ {
return "Destroy"; return "Destroy";
} }
@@ -1518,7 +1522,7 @@ int AASacrificeCard::resolve()
return 0; return 0;
} }
const char * AASacrificeCard::getMenuText() const string AASacrificeCard::getMenuText()
{ {
return "Sacrifice"; return "Sacrifice";
} }
@@ -1573,7 +1577,7 @@ int AADiscardCard::resolve()
return 0; return 0;
} }
const char * AADiscardCard::getMenuText() const string AADiscardCard::getMenuText()
{ {
return "Discard"; return "Discard";
} }
@@ -1637,7 +1641,7 @@ AADrawer::AADrawer(GameObserver* observer, int _id, MTGCardInstance * card, Targ
return numCards.getValue(); return numCards.getValue();
} }
const char * AADrawer::getMenuText() const string AADrawer::getMenuText()
{ {
return "Draw"; return "Draw";
} }
@@ -1666,7 +1670,7 @@ int AAFrozen::resolve()
return 1; return 1;
} }
const char * AAFrozen::getMenuText() const string AAFrozen::getMenuText()
{ {
return "Freeze"; return "Freeze";
} }
@@ -1731,7 +1735,7 @@ int AANewTarget::resolve()
return 1; return 1;
} }
const char * AANewTarget::getMenuText() const string AANewTarget::getMenuText()
{ {
return "New Target"; return "New Target";
} }
@@ -1812,7 +1816,7 @@ int AAMorph::testDestroy()
return 0; return 0;
} }
const char * AAMorph::getMenuText() const string AAMorph::getMenuText()
{ {
return "Morph"; return "Morph";
} }
@@ -1949,7 +1953,7 @@ int AAFlip::testDestroy()
return 0; return 0;
} }
const char * AAFlip::getMenuText() const string AAFlip::getMenuText()
{ {
string s = flipStats; string s = flipStats;
sprintf(menuText, "Transform:%s", s.c_str()); sprintf(menuText, "Transform:%s", s.c_str());
@@ -2255,7 +2259,7 @@ int AADynamic::activateStored()
return 1; return 1;
} }
const char * AADynamic::getMenuText() const string AADynamic::getMenuText()
{ {
if (menu.size()) if (menu.size())
{ {
@@ -2354,7 +2358,7 @@ int AALifer::resolve()
return 0; return 0;
WParsedInt life(life_s, NULL, source); WParsedInt life(life_s, NULL, source);
if (_target->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE) if (_target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE)
{ {
_target = ((MTGCardInstance *) _target)->controller(); _target = ((MTGCardInstance *) _target)->controller();
} }
@@ -2370,7 +2374,7 @@ int AALifer::getLife()
return life.getValue(); return life.getValue();
} }
const char * AALifer::getMenuText() const string AALifer::getMenuText()
{ {
if(getLife() < 0) if(getLife() < 0)
return "Life Loss"; return "Life Loss";
@@ -2403,7 +2407,7 @@ int AASetHand::resolve()
return 1; return 1;
} }
const char * AASetHand::getMenuText() const string AASetHand::getMenuText()
{ {
return "Set Hand Size"; return "Set Hand Size";
} }
@@ -2434,7 +2438,7 @@ int AALifeSet::resolve()
return 1; return 1;
} }
const char * AALifeSet::getMenuText() const string AALifeSet::getMenuText()
{ {
return "Set Life"; return "Set Life";
} }
@@ -2516,7 +2520,7 @@ int AACloner::resolve()
} }
const char * AACloner::getMenuText() const string AACloner::getMenuText()
{ {
if (who == 1) if (who == 1)
return "Clone For Opponent"; return "Clone For Opponent";
@@ -2591,7 +2595,7 @@ int ACastRestriction::destroy()
return 1; return 1;
} }
const char * ACastRestriction::getMenuText() const string ACastRestriction::getMenuText()
{ {
if (modifyExisting) if (modifyExisting)
return "Additional Lands"; //hardoced because only the lands rule allows to modify existing rule for now return "Additional Lands"; //hardoced because only the lands rule allows to modify existing rule for now
@@ -2626,7 +2630,7 @@ int AInstantCastRestrictionUEOT::resolve()
wrapper->addToGame(); wrapper->addToGame();
return 1; return 1;
} }
const char * AInstantCastRestrictionUEOT::getMenuText() const string AInstantCastRestrictionUEOT::getMenuText()
{ {
return ability->getMenuText(); return ability->getMenuText();
} }
@@ -2720,14 +2724,14 @@ int AAMover::resolve()
return 0; return 0;
} }
const char * AAMover::getMenuText() const string AAMover::getMenuText()
{ {
if(named.size()) if(named.size())
return named.c_str(); return named.c_str();
return "Move"; return "Move";
} }
const char * AAMover::getMenuText(TargetChooser * tc) const char* AAMover::getMenuText(TargetChooser * tc)
{ {
if(named.size()) if(named.size())
return named.c_str(); return named.c_str();
@@ -2867,7 +2871,7 @@ int AARandomMover::resolve()
return 0; return 0;
} }
const char * AARandomMover::getMenuText() const string AARandomMover::getMenuText()
{ {
return "Dig"; return "Dig";
} }
@@ -2905,7 +2909,7 @@ int AARandomDiscarder::resolve()
return 1; return 1;
} }
const char * AARandomDiscarder::getMenuText() const string AARandomDiscarder::getMenuText()
{ {
return "Discard Random"; return "Discard Random";
} }
@@ -2932,7 +2936,7 @@ int AAShuffle::resolve()
return 1; return 1;
} }
const char * AAShuffle::getMenuText() const string AAShuffle::getMenuText()
{ {
return "Shuffle"; return "Shuffle";
} }
@@ -3030,7 +3034,7 @@ int AARemoveMana::resolve()
return 1; return 1;
} }
const char * AARemoveMana::getMenuText() const string AARemoveMana::getMenuText()
{ {
if (mRemoveAll && !mManaDesc) if (mRemoveAll && !mManaDesc)
return "Empty Manapool"; return "Empty Manapool";
@@ -3069,7 +3073,7 @@ int AATapper::resolve()
return 1; return 1;
} }
const char * AATapper::getMenuText() const string AATapper::getMenuText()
{ {
return "Tap"; return "Tap";
} }
@@ -3099,7 +3103,7 @@ int AAUntapper::resolve()
return 1; return 1;
} }
const char * AAUntapper::getMenuText() const string AAUntapper::getMenuText()
{ {
return "Untap"; return "Untap";
} }
@@ -3180,7 +3184,7 @@ int AAWinGame::resolve()
return 1; return 1;
} }
const char * AAWinGame::getMenuText() const string AAWinGame::getMenuText()
{ {
return "Win Game"; return "Win Game";
} }
@@ -3271,7 +3275,7 @@ int IfThenAbility::resolve()
return 0; return 0;
} }
const char * IfThenAbility::getMenuText() const string IfThenAbility::getMenuText()
{ {
return ""; return "";
} }
@@ -3323,7 +3327,7 @@ void MayAbility::Update(float dt)
} }
} }
const char * MayAbility::getMenuText() const string MayAbility::getMenuText()
{ {
return ability->getMenuText(); return ability->getMenuText();
} }
@@ -3459,7 +3463,7 @@ int MenuAbility::resolve()
return a->addToGame(); return a->addToGame();
} }
const char * MenuAbility::getMenuText() const string MenuAbility::getMenuText()
{ {
if((abilities.size() > 1 && must)||(abilities.size() > 2 && !must)) if((abilities.size() > 1 && must)||(abilities.size() > 2 && !must))
return "choose one"; return "choose one";
@@ -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. if (mClone && !toPay && optionalCosts.size() && i < int(optionalCosts.size()) && optionalCosts[i])//paidability only supports the first ability as paid for now.
{ {
toPay = NEW ManaCost(); toPay = NEW ManaCost();
if(optionalCosts[i]->extraCosts) if (optionalCosts[i]->extraCosts)
toPay->extraCosts = optionalCosts[i]->extraCosts->clone(); toPay->extraCosts = optionalCosts[i]->extraCosts->clone();
toPay->addExtraCost(NEW ExtraManaCost(NEW ManaCost(optionalCosts[i]))); toPay->addExtraCost(NEW ExtraManaCost(NEW ManaCost(optionalCosts[i])));
toPay->setExtraCostsAction(this,source); toPay->setExtraCostsAction(this, source);
game->mExtraPayment = toPay->extraCosts; game->mExtraPayment = toPay->extraCosts;
return 0; return 0;
} }
@@ -3660,7 +3664,7 @@ int MultiAbility::destroy()
return ActivatedAbility::destroy(); return ActivatedAbility::destroy();
} }
const char * MultiAbility::getMenuText() const string MultiAbility::getMenuText()
{ {
if (abilities.size() && abilities[0]) if (abilities.size() && abilities[0])
return abilities[0]->getMenuText(); return abilities[0]->getMenuText();
@@ -3699,7 +3703,7 @@ GenericTargetAbility::GenericTargetAbility(GameObserver* observer, string newNam
counters = 0; counters = 0;
} }
const char * GenericTargetAbility::getMenuText() const string GenericTargetAbility::getMenuText()
{ {
if (!ability) if (!ability)
return "Error"; return "Error";
@@ -4252,7 +4256,7 @@ int ATransformer::destroy()
return 1; return 1;
} }
const char * ATransformer::getMenuText() const string ATransformer::getMenuText()
{ {
if(menutext.size()) if(menutext.size())
return menutext.c_str(); return menutext.c_str();
@@ -4285,7 +4289,7 @@ int ATransformerInstant::resolve()
wrapper->addToGame(); wrapper->addToGame();
return 1; return 1;
} }
const char * ATransformerInstant::getMenuText() const string ATransformerInstant::getMenuText()
{ {
if(menu.size()) if(menu.size())
return menu.c_str(); return menu.c_str();
@@ -4319,7 +4323,7 @@ int PTInstant::resolve()
wrapper->addToGame(); wrapper->addToGame();
return 1; return 1;
} }
const char * PTInstant::getMenuText() const string PTInstant::getMenuText()
{ {
return ability->getMenuText(); return ability->getMenuText();
} }
@@ -4350,7 +4354,7 @@ int ASwapPTUEOT::resolve()
return 1; return 1;
} }
const char * ASwapPTUEOT::getMenuText() const string ASwapPTUEOT::getMenuText()
{ {
return ability->getMenuText(); return ability->getMenuText();
} }
@@ -4383,7 +4387,7 @@ int AAExchangeLife::resolve()
int oldlife = player->getLife(); int oldlife = player->getLife();
int targetOldLife = _target->getLife(); int targetOldLife = _target->getLife();
int modifier = oldlife > targetOldLife? oldlife - targetOldLife:targetOldLife - oldlife; int modifier = oldlife > targetOldLife? oldlife - targetOldLife:targetOldLife - oldlife;
if (_target->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE) if (_target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE)
{ {
int increaser = 0; int increaser = 0;
MTGCardInstance * card = ((MTGCardInstance*)_target); MTGCardInstance * card = ((MTGCardInstance*)_target);
@@ -4420,7 +4424,7 @@ int AAExchangeLife::resolve()
return 0; return 0;
} }
const char * AAExchangeLife::getMenuText() const string AAExchangeLife::getMenuText()
{ {
return "Exchange life"; return "Exchange life";
} }
@@ -4600,15 +4604,15 @@ int APreventDamageTypes::addToGame()
fromTc->targetter = NULL; fromTc->targetter = NULL;
if (type != 1 && type != 2) if (type != 1 && type != 2)
{//not adding this creates a memory leak. {//not adding this creates a memory leak.
re = NEW REDamagePrevention(this, fromTc, toTc, -1, false, DAMAGE_COMBAT); re = NEW REDamagePrevention(this, fromTc, toTc, -1, false, Damage::DAMAGE_COMBAT);
} }
else if (type == 1) else if (type == 1)
{ {
re = NEW REDamagePrevention(this, fromTc, toTc, -1, false, DAMAGE_ALL_TYPES); re = NEW REDamagePrevention(this, fromTc, toTc, -1, false, Damage::DAMAGE_ALL_TYPES);
} }
else if (type == 2) else if (type == 2)
{ {
re = NEW REDamagePrevention(this, fromTc, toTc, -1, false, DAMAGE_OTHER); re = NEW REDamagePrevention(this, fromTc, toTc, -1, false, Damage::DAMAGE_OTHER);
} }
game->replacementEffects->add(re); game->replacementEffects->add(re);
return MTGAbility::addToGame(); return MTGAbility::addToGame();
@@ -4658,7 +4662,7 @@ int APreventDamageTypesUEOT::destroy()
return 1; return 1;
} }
const char * APreventDamageTypesUEOT::getMenuText() const string APreventDamageTypesUEOT::getMenuText()
{ {
return ability->getMenuText(); return ability->getMenuText();
} }
@@ -4728,7 +4732,7 @@ int AVanishing::resolve()
return 1; return 1;
} }
const char * AVanishing::getMenuText() const string AVanishing::getMenuText()
{ {
if(counterName.find("fade") != string::npos) if(counterName.find("fade") != string::npos)
return "Fading"; return "Fading";
@@ -4824,7 +4828,7 @@ int AUpkeep::resolve()
return 1; return 1;
} }
const char * AUpkeep::getMenuText() const string AUpkeep::getMenuText()
{ {
return "Upkeep"; return "Upkeep";
} }
@@ -4924,7 +4928,7 @@ int APhaseAction::resolve()
return 0; return 0;
} }
const char * APhaseAction::getMenuText() const string APhaseAction::getMenuText()
{ {
if(psMenuText.size()) if(psMenuText.size())
return psMenuText.c_str(); return psMenuText.c_str();
@@ -4961,7 +4965,7 @@ int APhaseActionGeneric::resolve()
return 1; return 1;
} }
const char * APhaseActionGeneric::getMenuText() const string APhaseActionGeneric::getMenuText()
{ {
return ability->getMenuText(); return ability->getMenuText();
} }
@@ -5119,7 +5123,7 @@ int ABlink::resolve()
{ {
return 0; return 0;
} }
const char * ABlink::getMenuText() const string ABlink::getMenuText()
{ {
return "Blink"; return "Blink";
} }
@@ -5150,7 +5154,7 @@ int ABlinkGeneric::resolve()
return 1; return 1;
} }
const char * ABlinkGeneric::getMenuText() const string ABlinkGeneric::getMenuText()
{ {
return "Blink"; return "Blink";
} }
@@ -5294,6 +5298,116 @@ AAConnect * AAConnect::clone() const
return NEW AAConnect(*this); return NEW AAConnect(*this);
} }
AEquip::AEquip(GameObserver* observer, int _id, MTGCardInstance * _source, ManaCost * _cost, int restrictions) :
TargetAbility(observer, _id, _source, NULL, _cost, restrictions)
{
aType = MTGAbility::STANDARD_EQUIP;
isAttach = restrictions != ActivatedAbility::AS_SORCERY;
}
int AEquip::unequip()
{
if (source->target)
{
source->target->equipment -= 1;
source->parentCards.clear();
for (unsigned int w = 0; w < source->target->childrenCards.size(); w++)
{
MTGCardInstance * child = source->target->childrenCards[w];
if (child == source)
source->target->childrenCards.erase(source->target->childrenCards.begin() + w);
}
}
source->target = NULL;
for (size_t i = 0; i < currentAbilities.size(); ++i)
{
MTGAbility * a = currentAbilities[i];
if (dynamic_cast<AEquip *> (a) || dynamic_cast<ATeach *> (a) || dynamic_cast<AAConnect *> (a)
|| dynamic_cast<AANewTarget *> (AbilityFactory::getCoreAbility(a))
|| (a->aType == MTGAbility::STANDARD_TOKENCREATOR && a->oneShot))
{
SAFE_DELETE(a);
continue;
}
game->removeObserver(currentAbilities[i]);
}
currentAbilities.clear();
return 1;
}
int AEquip::equip(MTGCardInstance * equipped)
{
source->target = equipped;
source->target->equipment += 1;
source->parentCards.push_back(equipped);
source->target->childrenCards.push_back((MTGCardInstance*)source);
AbilityFactory af(game);
af.getAbilities(&currentAbilities, NULL, source);
for (size_t i = 0; i < currentAbilities.size(); ++i)
{
MTGAbility * a = currentAbilities[i];
if (dynamic_cast<AEquip *> (a)) continue;
if (dynamic_cast<ATeach *> (a)) continue;
if (dynamic_cast<AAConnect *> (a)) continue;
if (dynamic_cast<AANewTarget *> (af.getCoreAbility(a))) continue;
if (a->aType == MTGAbility::STANDARD_TOKENCREATOR && a->oneShot)
{
a->forceDestroy = 1;
continue;
}
if (dynamic_cast<AACopier *> (af.getCoreAbility(a)))
{
a->forceDestroy = 1;
continue;
}
//we generally dont want to pass oneShot tokencreators to the cards
//we equip...
a->addToGame();
}
return 1;
}
int AEquip::resolve()
{
MTGCardInstance * mTarget = tc->getNextCardTarget();
if (!mTarget) return 0;
if (mTarget == source) return 0;
unequip();
equip(mTarget);
return 1;
}
const string AEquip::getMenuText()
{
if (isAttach)
return "Attach";
else
return "Equip";
}
int AEquip::testDestroy()
{
if (source->target && !game->isInPlay(source->target))
unequip();
if (!game->connectRule)
{
if (source->target && TargetAbility::tc && !TargetAbility::tc->canTarget((Targetable *)source->target,true))
unequip();
}
return TargetAbility::testDestroy();
}
int AEquip::destroy()
{
unequip();
return TargetAbility::destroy();
}
AEquip * AEquip::clone() const
{
return NEW AEquip(*this);
}
// casting a card for free, or casting a copy of a card. // casting a card for free, or casting a copy of a card.
AACastCard::AACastCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target,bool _restricted,bool _copied,bool asNormal,string _namedCard,string _name,bool _noEvent) : AACastCard::AACastCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target,bool _restricted,bool _copied,bool asNormal,string _namedCard,string _name,bool _noEvent) :
MTGAbility(observer, _id, _source),restricted(_restricted),asCopy(_copied),normal(asNormal),cardNamed(_namedCard),nameThis(_name),noEvent(_noEvent) MTGAbility(observer, _id, _source),restricted(_restricted),asCopy(_copied),normal(asNormal),cardNamed(_namedCard),nameThis(_name),noEvent(_noEvent)
@@ -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; MTGCardInstance * toCheck = (MTGCardInstance*)target;
if(theNamedCard) if(theNamedCard)
toCheck = 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) processed = true;
game->targetChooser->Owner = source->controller();//sources controller is the caster this->forceDestroy = 1;
return; return;
} }
resolveSpell(); if(!toCheck->hasType(Subtypes::TYPE_INSTANT) && !(game->getCurrentGamePhase() == MTG_PHASE_FIRSTMAIN || game->getCurrentGamePhase() == MTG_PHASE_SECONDMAIN))
this->forceDestroy = 1; {
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; return;
} }
int AACastCard::isReactingToTargetClick(Targetable * card){return 0;} resolveSpell();
int AACastCard::reactToTargetClick(Targetable * object) this->forceDestroy = 1;
{ return;
if (MTGCardInstance * cObject = dynamic_cast<MTGCardInstance *>(object)) }
return reactToClick(cObject); 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);
waitingForAnswer = 0; return MTGAbility::reactToClick(source);
game->mLayers->actionLayer()->setCurrentWaitingAction(NULL);
return MTGAbility::reactToClick(source);
}
return 1;
} }
return 0; return 1;
} }
return 0;
}
MTGCardInstance * AACastCard::makeCard() MTGCardInstance * AACastCard::makeCard()
{ {
MTGCardInstance * card = NULL; MTGCardInstance * card = NULL;
MTGCard * cardData = MTGCollection()->getCardByName(cardNamed); MTGCard * cardData = MTGCollection()->getCardByName(cardNamed);
card = NEW MTGCardInstance(cardData, source->controller()->game); card = NEW MTGCardInstance(cardData, source->controller()->game);
source->controller()->game->temp->addCard(card); source->controller()->game->temp->addCard(card);
return card; return card;
} }
int AACastCard::resolveSpell() int AACastCard::resolveSpell()
{ {
@@ -5477,7 +5591,7 @@ int AACastCard::resolveSpell()
return 0; return 0;
} }
const char * AACastCard::getMenuText() const string AACastCard::getMenuText()
{ {
if(nameThis.size()) if(nameThis.size())
return nameThis.c_str(); return nameThis.c_str();
+2 -1
View File
@@ -160,7 +160,8 @@ MTGCardInstance * CardDescriptor::match_and(MTGCardInstance * card)
if (mColorExclusions) if (mColorExclusions)
{ {
if ((mColorExclusions & card->colors) == mColorExclusions) // if any of forbidden colors intersect with card colors
if ((mColorExclusions & card->colors) != 0)
match = NULL; match = NULL;
} }
-20
View File
@@ -1,20 +0,0 @@
#include "../include/GameApp.h"
#include "../include/MTGCard.h"
#include "../include/GameOptions.h"
#include "../include/CardEffect.h"
CardEffect::CardEffect(CardGui* target) :
target(target)
{
}
CardEffect::~CardEffect()
{
}
void CardEffect::Render()
{
// std::cout << "Rendering effect" << std::endl;
}
+13 -11
View File
@@ -17,6 +17,7 @@
#include "Counters.h" #include "Counters.h"
#include "ModRules.h" #include "ModRules.h"
#include "CardDescriptor.h" #include "CardDescriptor.h"
#include "GameApp.h"
const float CardGui::Width = 28.0; const float CardGui::Width = 28.0;
const float CardGui::Height = 40.0; const float CardGui::Height = 40.0;
@@ -110,17 +111,17 @@ void CardGui::Update(float dt)
PlayGuiObject::Update(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) switch (inMode)
{ {
case DrawMode::kNormal: case DrawMode::kNormal:
RenderBig(inCard, inPosition); RenderBig(inCard, inPosition, thumb);
break; break;
case DrawMode::kText: case DrawMode::kText:
AlternateRender(inCard, inPosition); 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 //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(); JRenderer * renderer = JRenderer::GetInstance();
//GameObserver * game = GameObserver::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. //i want this but ai targets cards so quickly that it can crash the game.
float x = pos.actX; 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); MTGCardInstance * kcard = dynamic_cast<MTGCardInstance*>(card);
if(kcard && !kcard->isToken && kcard->name != kcard->model->data->name) if(kcard && !kcard->isToken && kcard->name != kcard->model->data->name)
{ {
@@ -1013,7 +1015,7 @@ bool CardGui::FilterCard(MTGCard * _card,string filter)
CardDescriptor cd; CardDescriptor cd;
MTGCardInstance * card = (MTGCardInstance*) _card->data; MTGCardInstance * card = (MTGCardInstance*) _card->data;
cd.init(); cd.init();
cd.mode = CD_OR; cd.mode = CardDescriptor::CD_OR;
while (filter.size()) while (filter.size())
{ {
@@ -1033,13 +1035,13 @@ bool CardGui::FilterCard(MTGCard * _card,string filter)
string attribute; string attribute;
if (found2 != string::npos) if (found2 != string::npos)
{ {
cd.mode = CD_OR; cd.mode = CardDescriptor::CD_OR;
attribute = attributes.substr(0, found2); attribute = attributes.substr(0, found2);
attributes = attributes.substr(found2 + 1); attributes = attributes.substr(found2 + 1);
} }
else if (foundAnd != string::npos) else if (foundAnd != string::npos)
{ {
cd.mode = CD_AND; cd.mode = CardDescriptor::CD_AND;
attribute = attributes.substr(0, foundAnd); attribute = attributes.substr(0, foundAnd);
attributes = attributes.substr(foundAnd + 1); attributes = attributes.substr(foundAnd + 1);
} }
@@ -1302,7 +1304,7 @@ bool CardGui::FilterCard(MTGCard * _card,string filter)
} }
} }
if (nbminuses) if (nbminuses)
cd.mode = CD_AND; cd.mode = CardDescriptor::CD_AND;
filter = filter.substr(0, found); filter = filter.substr(0, found);
} }
else else
@@ -1312,7 +1314,7 @@ bool CardGui::FilterCard(MTGCard * _card,string filter)
if (found != string::npos) if (found != string::npos)
{ {
cd.mode = CD_OR; cd.mode = CardDescriptor::CD_OR;
typeName = filter.substr(0, found); typeName = filter.substr(0, found);
filter = filter.substr(found + 1); filter = filter.substr(found + 1);
} }
+8 -7
View File
@@ -6,6 +6,7 @@
#include "MTGDeck.h" #include "MTGDeck.h"
#include "Subtypes.h" #include "Subtypes.h"
#include "Translate.h" #include "Translate.h"
#include "GameApp.h"
using std::string; using std::string;
@@ -84,6 +85,9 @@ int CardPrimitive::init()
alias = 0; alias = 0;
restrictions = NULL; restrictions = NULL;
dredgeAmount = 0; dredgeAmount = 0;
power = 0;
toughness = 0;
return 1; return 1;
} }
@@ -225,6 +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); int id = MTGAllCards::add(value, parentType);
addType(id); addType(id);
@@ -344,18 +351,12 @@ bool CardPrimitive::hasSubtype(int _subtype)
return hasType(_subtype); return hasType(_subtype);
} }
bool CardPrimitive::hasType(const char * _type) bool CardPrimitive::hasType(const string& _type)
{ {
int id = MTGAllCards::findType(_type); int id = MTGAllCards::findType(_type);
return hasType(id); return hasType(id);
} }
bool CardPrimitive::hasSubtype(const char * _subtype)
{
int id = MTGAllCards::findType(_subtype);
return hasType(id);
}
bool CardPrimitive::hasSubtype(const string& _subtype) bool CardPrimitive::hasSubtype(const string& _subtype)
{ {
int id = MTGAllCards::findType(_subtype); int id = MTGAllCards::findType(_subtype);

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