Commit Graph

43 Commits

Author SHA1 Message Date
wagic.the.homebrew
e27cf56fa2 - Support for Zip Filesystem. It is now possible to zip the entire Res folder ("store" method preferred, zip so that the root of the zip has ai, player, etc...) in one single file for read only. Write access is done in another folder (hardcoded to be User/ for now, can be updated depending on platforms, etc...
-- zipFS has several limitations...
--- in a general way, seekg doesn't work... so getting a file's size needs to be done through JFileSystem.
--- getLine on files open with zipFS doesn't work so great. Not sure if it is a normal issue because files are open in binary or not... JFileSystem therefore offers a "readIntoString" function that needs to be used instead of the usual "getline" technique. However getLine can then be used on a stream connected to the string.

-- tested on Windows and PSP, I also made sure android still works, but haven't tested zip support on Android.
-- I tried to maintain backwards compatibility, but this might break on some platforms, if I broke some platforms and you can't find a way to fix them, please contact me and we'll figure something out
-- This removes wagic::ifstream. I didn't reimplement the securities that were involved in this, apologies for that. Might be useful to reimplement such securities in JFileSystem
-- I haven't tested options/profiles in a deep way, it is possible I broke that.
2011-08-21 09:04:59 +00:00
wagic.the.homebrew
7beb958067 Adding a way to mark decks as "locked" based on options requirements (option on or off). Can be used for example to lock a deck until a specific set is not unlocked. Works for both player decks (could be used for premade?) and AI decks. 2011-05-06 06:40:00 +00:00
wagic.the.homebrew
691a1e1b91 - Fixed a Bug where AI would not block any attacker in Demo mode (bug introduced in r2759)
- Fixed a Bug where AI would not correctly assign blockers if the first attacker is super strong.
- Added a hack to prevent AI from an infinite loop while choosing a target. There are edge cases where the AI gets to choose the targets for a TargetChooser that doesn't belong to it. I couldn't dig too long for the root cause, so I added a "return 0" when the case happens. Should probably open a ticket
- Added a "Hint" System in AI decks, to help the AI with its strategy. This is not really usable yet, it only works with abilities (not cards to play), and I only added some basic code for counters and tokens. This can probably be extended, but let's wait until we see it working on that other game I'm working on, before rushing into adding hints to all AI decks...
- minor cleanup of AI Code
2011-05-05 14:27:46 +00:00
techdragon.nguyen@gmail.com
f4d1154cd6 reverted latest change 2011-02-14 09:35:43 +00:00
techdragon.nguyen@gmail.com
d9efb408e5 * optimized card loading. There was some redundant code that wasn't necessary.
* getCardByName seemed to have a initialization error if you tried to use it before the entire game loaded.  The cache would
throw an exception if you tried to use find and it was empty.  I put a guard around it to avoid this issue.

* refactored Zeth's "toggledifficuly" feature to be stored in meta data.  http://code.google.com/p/wagic/source/detail?r=3106
 -- This is slightly modified as it forces a 1 for 1 swap of cards that are specified.
    from the example given this is how it seemed to be used anyways.
 -- since all the information is stored in the meta data, there's no need to alter the deck's
    definition.
2011-02-14 08:14:35 +00:00
omegablast2002@yahoo.com
76653b6f54 going to go ahead and commit this now as updating the ai decks to use this tool is going to be a huge task...i originally wanted to commit this when i had a substantial amount of ai decks using it, to show case how it makes a huge difference.
it is a feature that is for ai deck building
what it will do is as follows

#NAME:sample deck
#DESC:The forces of fire and nature unite. 
#DESC: 
#DESC:Can you withstand 
#DESC:their combined fervor? 

toggledifficulty:lotus petal|black lotus (*) * 4
grizzly bear (*) * 4
someCard (8) *4

notice the toggle dificulty?
syntax is ....toggledifficulty:easy card name or number|hard card (optional set if both belong to same set otheriwse use * ) *howmany

toggledifficulty:frying pan|machine gun
toggledifficulty:tomatoe|pumpkin (MBS) * 3
toggledifficulty:tomatoe|squash
grizzly bear (*) * 4

the above exsample as easy will have a deck with:
frying pan
4X tomatoe
4X grizzly bear

and on hard it will have:
machine gun
3x pumpkin
squash
4X grizzly bears

the entire deck can be built with toggledifficulty cards....its not limited to just a single use.
you can also mix it up, some can be toggledifficulty some can be just like normal, you are not limited to having to have a complete deck of toggled cards...

if your currently selected deck has an over all win ratio of 65% or higher...this deck will have 4 black lotuses in it...if youre overall win with the current deck you are playing is below 65% then those 4 black lotuses are replaced by 4 lotus petals instead...effectively making it an easier ai deck...

note, the 2 cards used are exsamples...its a great way to show you the potential this change can have...an ai deck with 4 black lotuses will do WAY better then the same deck with 4 lotus petal...if you catch my drift...
2011-02-11 18:01:50 +00:00
techdragon.nguyen@gmail.com
93c63cef3d reimplemented mana color display for deck selection. This is now totally controlled by
stats generation.  No data needs to be written to the deck master files themselves.
Now the mana colors will only show if you have battled with a particular deck at least once.
This is not retroactive, so you will need to battle the ai again.  This can not be edited manually
either to prevent tampering with the statistical data.  Player deck mana color display is also
covered this way.

Decks will still be saved in the new layout if a disk write is necessary.  So any changes via
the deck editor will result in a deck file rewrite is was always the case.:)
2011-02-10 17:19:11 +00:00
Xawotihs
b7b584113b - Moved the card collection out of the GameApp class to clean up the dependencies
- Added method to build a card collection independently of the GUI to ease my unitary test application
- Added part of some network GUI I'm working on, it's #ifdef out, I'm only committing this part to ease later merges
- Added the beginning of a serialization code of the Player and related classes used for network support
- various other minor cleanup
2011-02-06 11:35:40 +00:00
wagic.the.homebrew@gmail.com
f6bef26243 Erwan
- added some cache for function getCardByName. On my machine, this divides the running time of the test suite by almost 2 (now runs in 12 minutes instead of 21)
2011-02-05 03:46:41 +00:00
techdragon.nguyen@gmail.com
767983631a * moved deck saving to end of match. It now only saves when you've actually completed a game.
* added additional meta data for decks when saving them back to file.
  - decks saved this way now are split into three regions: creatures, spells and lands.  It's more for a visual sorting if a
     player wanted to look at the deck outside of the game.  It does not impact the deck loading negatively at all.  It may
     increase performance in cases where the deck was previously defined using the canonical names of the cards as the numeric ids
     reduce the work done when looking up the cards by name.
* modified ManaCost toString method.
* added toString method for ManaCostHybrid ( possibly make ManaCostHybrid a subclass of ManaCost)
* added additional operator overloading for ManaCost for printing to cover ManaCost when it's a pointer as well as a copy
   ( TODO: might want to check if making usage of ManaCost as a copy as opposed to a ptr is really necessary in most cases. )
* added alternate version of "trim" to handle trimming temporary strings as returned by things like ostringstream.str().
 - This was necessary since the PSP compiler doesn't do the necessary adjustments for those types of calls.
2011-02-04 12:37:44 +00:00
techdragon.nguyen@gmail.com
8af5870d48 * Added new options parameter. "SaveDetailedDeckInfo". This will force the system to save all
deck files in long format.  This is not configurable from the game.  It must be set manually
     inside options.txt.
     ie.  saveDetailedDeckInfo=1

* added extra debug information (line number inside text file) when card parser fails to recognize a line.
    - modified return value from "processConfLine()" to return 0 only when a true error occurs and print out
         "MTGDeck: Bad Line:
         [<line no>]: <line with error>"
    - processConfLine will now return 1 for lines starting with "#".  Previously it returned 0 which is incorrect
         as comments should not be considered as errors.

* removed DeckMetaDataList class from code.  This was duplicating the DeckMetaData storage in DeckManager
* new feature for deck selection screens.
   - player decks will now have an indication of what mana color it consists of.
   - Ai decks will show symbols once the player has played against the AI deck at least once.
   -- This is made possible with a new meta data inside each deck file.
        MANA:<string representing color switches - 0/1 >
2011-01-31 10:04:18 +00:00
techdragon.nguyen@gmail.com
e53c16f700 No code change just reformatting of header files.
finishing up my reformatting of the source from November/December following the guidelines that were posted.
some extra things I added:
   * Any empty virtual declarations were kept to one line.  
   * Enums were split up into separate lines to promote uniformity across all headers. ( each header file had a different style for enums)
2011-01-21 18:01:14 +00:00
techdragon.nguyen@gmail.com
28d3b9b9a9 fixes ai deck saving bug pointed out by Zethfox.
TODO: fix text to the right of the box when saving ai deck.
2010-10-27 03:00:39 +00:00
wrenczes
d5f3e4cfea Enabled precompiled headers for the build. This cuts the win compile time in debug by at least half on my laptop; on the psp compile, it shaves it down by ~ 45 seconds. I only did a cursory inspection of what to add to PrecompiledHeader.h, there's probably more that we can throw in there for more incremental speed improvements.
Also fixed the project includes so that we don't need to always use the indirect include path, ie:
#include "../include/foo.h" -> #include "foo.h"

I'm don't know much about make files - if I busted the linux build, mea culpa, but I think we're okay on that front too.  For future reference, here's the most straightforward link on the topic of adding pch support to make files:

http://www.mercs-eng.com/~hulud/index.php?2008/06/13/6-writing-a-good-makefile-for-a-c-project
2010-10-24 05:55:24 +00:00
techdragon.nguyen@gmail.com
34bdfab36f fixed bug with saving brand new AI decks. 2010-10-22 09:22:25 +00:00
techdragon.nguyen@gmail.com
34335ba2aa added option to save deck in editor as an AI deck.
No option to delete or edit the AI deck once it has been created.
The deck gets saved as the canonical form of the deck to match other AI deck formats.
2010-10-22 08:28:52 +00:00
wagic.the.homebrew@gmail.com
bdc43052d3 Erwan
- support for tinyCrops see http://wololo.net/forum/viewtopic.php?f=15&t=2197
- card images can now be named after the card's name (ex: sets/10E/Ancestor's Chosen.jpg , or sets/10E/10E.zip:Ancestor's Chosen.jpg)
- yet another attempt at fixing tokens in the shop
2010-09-20 07:10:21 +00:00
jean.chalard
fc9fccd93b J :
* Improve loading performance by about 25%.
  - This is certainly not the kind of change I was aiming at, but it
    just happened to get done, so why not commit it.
  - Little point for users in this change actually, since the loading
    times get down from 15 to 11 secs or so, it's not even that
    obvious.
  - I get about 25% on my PSP. Valgrind reports 36% improvement on PC.
    I wish it was the opposite ;_;
  - Feedback welcome
2010-06-08 17:42:35 +00:00
wagic.jeck
afffd4509f Jeck - fixed issue 354, cleaned up mixed boosters, fixed a few issues with pack loading (slot pools weren't working), fixed TSP boosters to use 'S' rarity, removed some unused code. 2010-02-19 20:10:30 +00:00
wagic.jeck
a123cebfe5 Jeck - Fixed an error with packs, fixed basic info in deck editor, removed duplicated code in DeckDataWrapper. 2010-02-17 03:10:56 +00:00
wagic.jeck
83e2b04547 Jeck - Added full filtering system to deck editor and shop. I've spent 24hours on pure debugging, but there are likely a couple bugs I've missed. So please, if you find something, make an issue of it! :P Also split OptionItem classes into separate files, and added support for mixed-set boosters (which I think are way, way cool). 2010-02-08 01:03:07 +00:00
wagic.the.homebrew@gmail.com
dd01706527 Erwan
- introducing "grade" system for cards
- Fixed a few typos in _cards.dat
2010-01-30 06:33:40 +00:00
wagic.jeck
bd0e139e6d Jeck - Minor update to trophy room, moved metadata into cards.dat
* updated daily build
* Card spoiler now sorts by collector's number.
* Metadata looks for "[m" (for speed reasons), I've been using "[meta]" in files. No sets currently use metadata.
2010-01-05 23:32:31 +00:00
wagic.the.homebrew@gmail.com
05a72de5bc Erwan
- Card Primitives system. Check Royal Assassin in RV, 10E, M10
- Please review, is sets/primitives a good directory? Should we rename MTGCard into "CardPrint"? 
- Unfortunately for now it is not possible to "override" a Primitive. A card that links to a primitive but also defines new "values" will create its own data and ignore the data in the "linked" primitive for the time being. I hope to solve that at some point...
2009-12-27 12:14:36 +00:00
wagic.the.homebrew@gmail.com
7f9d22e0aa Erwan
-fixed a memory leak
- Added P02 and PTK 
- New way to create tokens in the parser, much more flexible, see the Hive in RV. Tokens can now be written as other cards, with a rarity of "T". I suggest their id to be the negative value of the card that generates them when possible. Naming convention for images is the same as before: a negative id such as -1138 will need a [id]t.jpg image (1138t.jpg). Positive ids work as "normal" pictures
2009-11-18 13:14:08 +00:00
wagic.jeck
37ad16d90e Jeck - Basic set metadata support. Also a minor improvement to WGuiImage.
* Metadata is currently only used in exactly one place: the set's "Pretty Name" is displayed when the set is first unlocked. 
* WGuiImage now has a function to set scaling.
2009-11-18 09:27:24 +00:00
Psyyringe
779921a53f Psyringe - This revision adds "cheat mode", as suggested and pre-reviewed here:
http://wololo.net/forum/viewtopic.php?f=15&t=730

Although the feature is named "cheat mode", its main purpose is to provide a toolbox for content creators. Currently this means to help AI deck creators, but the cheat mode is easily extensible.

Features:
- To enable cheat mode, create a new profile with the super secret cheat name (shouldn't be hard to find - or just mail me if you don't want to look). Then, leave and re-enter the Options menu. You can now enable cheat mode on the first tab. Note: The secret profile name is *not* my original suggestion from the forum, I went with Jeck's alternative suggestion so that he won't have to cringe over bad puns everytime he's using it. ;)

- Complete collection: In cheat mode, there's a new option in the deck viewer, which makes sure that you have at least 4 of any card available.

- Deck integrity: When in cheat mode, and you load a deck with cards that are not present in your collection, then these cards won't be stripped from your deck any more. Instead, they are added to your collection.

- Money cheat: In cheat mode, when you click on an item in the shop, you get the option to steal 1,000 credits from the shopkeeper.

Please review my code - I just started with C++, I may make very obvious mistakes or use inelegant style. The sooner you point this out, the sooner I'll improve.

thanks to wololo and jeck for comments and suggestions.

Jeck: Do the setVisible and setHidden methods currently work? I tried to use them to hide a menu item, but they all seem to lead to empty methods - Perhaps placeholders for a not yet implemented functionality?
2009-11-02 04:27:14 +00:00
wagic.the.homebrew@gmail.com
e4a277f9ff Erwan
- Added some outputs in debug mode for bad formatted _cards.dat
2009-10-07 13:44:43 +00:00
wagic.jeck
f220d2e9b9 Jeck - Cache and resource manager merged, streamlined.
This is pretty major, so there'll probably be something wrong with it... even though I did spend a few hours looking.
NOTES:
 * If you've Retrieved it, don't delete it--- Use resources.Release(Whatever). 
    Textures automatically release subordinate quads.
 * Most of the time, use resources.RetrieveQuad to grab a quad. Should handle everything for you.
    RetrieveQuad will load the required texture, if needed.
    Only managed resources have a resource name ("back", "simon", etc). 
    Managed resources can be retrieved with GetTexture/GetQuad/GetWhatever.
    Non managed quads lookup by position/dimensions, defaulting to the whole texture.
 * Use resources.RetrieveTexture only when you need to do something special to it. 
    Calling retrieve texture with RETRIEVE_MANAGE will permanently add a texture to the manager
    RETRIEVE_LOCK and RETRIEVE_VRAM will lock a texture. It will not leave the cache until
    Release(JTexture*) is called, or as a last resort during cache overflow.
 * Try to only store (as a class member) pointers to textures retrieved with RETRIEVE_MANAGE. 
    All others may become invalid, although locked textures do have a high degree of stability. It's
    pretty safe to store a locked texture if you're not going to load much between uses.

There's a lot going on here, so I might have missed something... but it runs through the test suite alright.

TODO: 
 * When called without any arguments, RetrieveQuad sometimes leaves a thin border around the image. 
    This can be bypassed by specifying a quad one or two pixels less than the image size. Why?
 * I've had a crash while runing the Demo mode, something to do with receiveEventMinus? 
    This hasn't exactly reproduced on a clean SVN copy, (being a hang, rather than a crash) so 
    I've probably done something to worsen the problem somehow? I'll look into it tomorrow.
 * Clean up lock/unlock system, memory usage. Streamline interface, consider phasing out calls using GetWhatever() format.
2009-09-03 09:28:16 +00:00
jean.chalard
3349f974f1 J :
* New interface.
* This breaks a lot of things. It is not feature-equivalent. It
  probably doesn't compile under windows and doesn't work on PSP.
* Damage is not resolved any more. This will have to be fixed.
* Blockers can't be ordered any more. This will have to be fixed.
* A lot of new art is included.
2009-08-22 05:59:43 +00:00
wagic.the.homebrew@gmail.com
328aa1c9f4 Erwan
- reduced price of boosters
- Sets need to be unlocked in order to be accessed from the shop
- Added a "refresh" option in the shop
2009-07-23 13:44:50 +00:00
wagic.the.homebrew@gmail.com
3e7ecb3016 Erwan
- fixed a bug (crash if a card that had an ability until end of turn would be put into the graveyard before the end of the turn)
- Added a new game Mode : Random 1 or 2 color.
2009-07-18 08:50:14 +00:00
wagic.the.homebrew@gmail.com
951065a59c Erwan
- no more 5 decks limitation for Player
- Player decks can be given a name/description the same way we do for the AI. No PSP Gui for that yet though, has to be done outside of Wagic (PSPWrite ?)
2009-07-16 11:48:59 +00:00
wagic.the.homebrew@gmail.com
ab42e5db06 Erwan
- fixed card id collisions in Legends, Ravnica, Portal
- Changed Deck and Database structures with better design (a bit faster, hopefully a lot cleaner)
- updated Windows project file
2009-06-06 04:46:54 +00:00
wagic.the.homebrew@gmail.com
ee58109449 Erwan
- Added a way to name and describe AI Decks. Let's find cool names and descriptions :)
2009-05-25 12:43:58 +00:00
wagic.the.homebrew@gmail.com
3ae91e8226 Erwan
- Removed 4000 cards limitation
- URGENT FIX NEEDED: Test Northern_paladin2.txt fails :(
2009-05-20 11:07:20 +00:00
wagic.the.homebrew@gmail.com
f50d7e30d4 Erwan
- Added a few "stats" to the main menu. This might slow down loading times on the PSP (needs testing). In that case I'll move it to the options, or optimize it if needed
2009-05-19 13:45:53 +00:00
wagic.the.homebrew@gmail.com
5952b382a2 Erwan
-Fixed bug with fountain of youth
-New alternate format for decks
2009-04-02 12:50:18 +00:00
wagic.the.homebrew@gmail.com
e8d32b2c6d Erwan
- _cards.dat parsing error fixes on erroneous files
- replaced cards array with a vector for MTGGameZones
2009-03-25 13:53:19 +00:00
jean.chalard
3bb2c431c9 J :
* Split constants file to have them in a single place.
2009-01-06 13:07:28 +00:00
wagic.the.homebrew
7bf9cc8c07 Erwan
- Fixed a bug in SampleCache
- simplified card files initial parsing
2008-11-29 15:31:56 +00:00
jean.chalard
c97dd1f260 J :
* Remove ^M's.
* Re-indent automatically.
* Remove whitespace at the end of lines.
2008-11-12 13:45:42 +00:00
wagic.the.homebrew
d45e3b101b 2008-11-02 09:50:16 +00:00