Commit Graph

751 Commits

Author SHA1 Message Date
wagic.the.homebrew@gmail.com
19fe04b882 Erwan
- fix for issue 558 (compilation issues in release mode on most platforms)
2010-12-13 13:16:01 +00:00
techdragon.nguyen@gmail.com
fe75493ffa No code change. Reformat code 2010-12-11 22:42:48 +00:00
Xawotihs
b3650bcccf - deactivate testsuite if _DEBUG is not defined 2010-12-11 22:39:35 +00:00
omegablast2002@yahoo.com
c54de679d4 couple bug fixes, a slight refactor,
ok here goes, first, fixed a crash that would happen when ever a player would gain more then 2000 life or take more then 2000 damage...the buffer was becoming corrupted i imagine because it was too small, increasing it to 10 slots allowed players to successfully take massive amounts of damage, highest i bothered checking was about 35k gained/lost, no crash...

2nd, removed the and refactored cantcaster rule, moved it to stateEffects() and renamed stateeffects to better reflect what it will be handling,

removed sneak attack rule and moved it into stateeffects

the following ints have been converted into bool, 
all the cantcasters, canputlandsintoplay is becoming a bool, the amount of lands you can play is now handled by a new varible int landsPlayerCanStillPlay (this is for my ability additional lands increase in support on perminents coming after the release)

the changes to bools were for an obvious reason, they were all ints pretending to be bools, my varibles were confusing as you would often see code like this if(cantblahblah > 0)
which to another coder might not make any sense.

these varible ints were returning 0 as false and 1 as true...changed them all to bools, same goes for putlandsinplay int, in half the places it was being used as a bool, AND it was tracking the amount, when i was coding additional land ability, this made it impossible to maintain correct amounts without damaging the rest of the code.
as a bool, controlled by stateeffects, it can now be used correctly as a bool in all cases, and the stateEffects manages the switch on it to false if you no longer have any landsPlayerCanStillPlay left.

the refactor on cantcaster was also a bug fix, it was reported to me that cantcasters were not correctly working, sometimes ai or player would still be allowed to play a card with one in play, because of the old way i had it setup somecases of bothcantcaster were reseting the cantcast to 0, basically making the check do nothing.

it is now handled in stateeffects if you have one in play, then its true, if not then false...this returns very accurate tracking of the cards instantly instead of checking as cards enter or left play.

the "both" versions now have their own bools to avoid future conflicts with the single player cantcast...

added a case for the fancy moving text, some move to library effects were incorrectly returing fetch.
2010-12-10 20:51:50 +00:00
wrenczes@gmail.com
f894056e74 Fixed the order of initializers to make the psp warnings go away. (Stupid gcc, I don't understand why it cares about the order of initializers in the first place...) 2010-12-10 10:25:35 +00:00
wrenczes@gmail.com
f8368d01c4 Found & fixed two memory leaks:
- computeActions would leak a ManaCost.  This was fairly minor.
- AIPlayer::SelectAbility had a major leak.  Basically, there's some code that pulls a random number for an efficiency check - if the action's efficiency value was below that random number, the action pointer was cleared, and none of the actions that were to be discarded would be deleted out of the rankings map.  I've switched out the rankings container to not contain action pointers, but real action objects, so regardless what kind of logic is implemented, the map will properly clear out its objects upon destruction.
2010-12-10 08:37:41 +00:00
wagic.the.homebrew@gmail.com
6360734ea3 Erwan
-Attempt at fixing issue 538. This is a wild guess, but basically 1 000 000 bytes is NOT enough to decompress a 512*512*4 texture (32bits png). We need at least 1MB (1024*1024) AND some additional space for the decompression process. Based on that, bumped the 1 000 000 (minimum contiguous ram necessary to start decompressing a picture) to 1 500 000. I've had pretty good results so far but this needs confirmation
- GameObserver <- changes from Win to *nix carriage returns.
2010-12-09 13:47:04 +00:00
techdragon.nguyen@gmail.com
833bd4714d reformatted indentations as they were slightly off.
refactored latest changes to group similar menu texts.
2010-12-09 01:28:25 +00:00
omegablast2002@yahoo.com
585eae1852 added fancy location based move menutext return to lord...it was a case we must have messed when we were trying to get rid of generic "move" messages...lord returns ability menutext which in case of amover is "move"...and "all(" is a lord. so ran into a deck where i had a couple "move" menus display and i didnt know which i was choosing, moving creatures to hand or moving theirs to grave...
death to generic messages!!!
2010-12-08 20:16:27 +00:00
wrenczes@gmail.com
ffd3b7b074 At Z's request, fixed Issue 184, ExtraCost types with targets such as Siege-Gang Commander/Drowner of secrets combined with targeted abilities bug.
This one was a bit of a doozy to fix correctly, but the actual fix ended up being fairly simple - the upshot is that TargetAbility never checked for whether an extra cost needed setting prior doing a target selection.  While at it, I discovered and fixed another bug:  if you're in the middle of an extra cost choice (like sacrifice, for instance) and hit the next phase button, the game would let you proceed, and then hang in an endless loop.

While at it, did a little cleanup/refactoring around GameObserver's waitForExtraPayment - any time a bool has something that sounds like a verb, it probably deserves to be a function.  Now it is. (I needed to refactor it anyway, as I reused that code for the next phase hang.)

Note that after this fix, I had to patch two test cases (siege_gang_commander.txt & seismic_assault.txt) - since I've change the selection order (ie a target ability with a sacrifice cost requires the cost to be paid up front before picking the target), this means that tests involving targeting & sacrifices need to switch the order of the cards to pass.
2010-12-06 06:49:36 +00:00
wagic.the.homebrew@gmail.com
c7a17a0e57 Erwan
- some code cleanup, as I am trying to figure out the root cause for issue 548
2010-12-05 14:13:42 +00:00
omegablast2002@yahoo.com
59864cbcb7 removed a variable mike readded accidently(?) which i converted into a static local variable 2010-12-04 21:59:08 +00:00
techdragon.nguyen@gmail.com
a7675ec216 issue 547
fixed the bug where the ai "attacks/blocks" its own attackers during the combat phase.
Strangely, creatures only die in this bug when there are two or more suffering from
summoning sickness.

If somebody can double check this code change to make sure that it is appropriate.
My playtesting indicates a success but I don't have the variety of player decks others have.
2010-12-04 21:26:12 +00:00
omegablast2002@yahoo.com
8a49d2af51 moved the gaurds i introduced in r2734 into the function selectAbility() as a static bool as suggested by jean, its much cleaner this way. 2010-12-04 18:25:59 +00:00
omegablast2002@yahoo.com
15e6fabd9f redid the counters menutext function to be more like the one "add mana" uses. makes it easier to read and add to later if needed. 2010-12-04 16:08:51 +00:00
wrenczes@gmail.com
1b876d61af Issue 494: "Valuable Collection" trophy is gone?
The check to give the award was lost in some of Jeck's reorg work (R1825), as ShopItem was deprecated & folded into GameStateShop. While at it, I took the liberty to delete ShopItem.h/cpp since they're not used.
2010-12-04 09:46:31 +00:00
wrenczes@gmail.com
92bbb78ed1 Fix for [PSP|PC]ability menus and card view switch causes a crash. This broke as a side effect to the addition of the 'details' option that Mike added - the ActionStack had very rigid interpretations of what a valid control ID would be (either -1, or a valid id in its container). As kInfoMenuID is assigned a value of -200, this would crash when attempting to look up that index value in the vector.
I've patched the problem so that ActionLayer checks for a valid ID before doing anything, and does a no-op for IDs it doesn't know how to handle. However, this only fixes the problem during gameplay.  It's quite possible that hitting the triangle button in other places in the app might equally cause a crash.


Issue: 544
2010-12-04 04:25:43 +00:00
omegablast2002@yahoo.com
b5ec029d79 couple changes, first i re-added my fancy getMenuText for becomes/transforms abilities, somewhere in the refactor these were forgotten. Fix "Swap" ueot menutext display, it was returning "ability".
fixed a Ai related bug, taught Ai not to mill itself to death basically. played a few matches which Ai was just destroying himself with a creature that allowed him to draw cards for each(whatever) in play. Ai will be a little more careful not to kill himself by Mill, also not to draw 30 cards in a turn when it clearly cant play them.
2010-12-03 20:59:46 +00:00
omegablast2002@yahoo.com
336b25c0f5 init'ed the variable "mFindingAbility" bool in Aiplayer constructor and changed its name from previous name "findingAbility" to keep in line with recent code rules.
added COMMENTS to explain the variable.
2010-12-03 12:10:35 +00:00
omegablast2002@yahoo.com
0f419144b5 Fixed a bug where Ai was able to do actions such as sacrifice Mogg fanatic 3 time in a row by tripping over its own clickstream, added gaurds to selectAbility() function calls to prevent Ai from running multiple instences of selectAbility before its completed running another which occurs when Ai is offered an interupt after player cast/does an action.
this also fixes the spamming of Abilities like Ai atempting to untap something more then once, or Ai uses regenerate ability multiple times on the same creature.

there will be no noticible difference in Ai game play except now it actually doesnt do the above mentioned bugs.
2010-12-02 21:30:14 +00:00
wrenczes@gmail.com
2693f35506 Fixed the graphics whiteout bug I introduced when switching profiles. When Refresh() was being called on the texture, the bitmap wasn't been re-transferred back into the openGL context.
While debugging this, I noticed a separate issue:  when changing profiles, we'd actually call refresh twice.  Removed the spurious call, as reloading profiles doesn't need to concern itself with the image cache - that's already covered by the game options menu.

Also did some minor formatting / cleanup in the JGfx code for PSP - stubbed out a bunch of JLOG calls I had put in while debugging the PNG loading code.
2010-12-02 04:04:03 +00:00
wrenczes@gmail.com
65e38b0694 Another change that looks bigger than it is: changed out the global extern WResourceManager to a real singleton. This means that it's no longer being init'ed at static initialization time, and we can debug construction/destruction properly; it's also safer in a multithreaded context. 2010-12-01 08:22:17 +00:00
linshier
aa6aa20ba5 Fixed left offset parameter handling for center/right align string drawing. A brief note about string drawing, offset and display width is added in the WFont.h 2010-12-01 08:01:13 +00:00
wrenczes@gmail.com
609ece329e Splitting up my threading changes into smaller pieces, as it's getting too large. This change: pass strings by reference, never by value; some minor formatting cleanup in WResourceManager. 2010-12-01 04:27:56 +00:00
wagic.the.homebrew@gmail.com
50c0f1dd8e Erwan
- reduced requirements for ai decks unlocks
- attempt to fix a Quad issue when unlocking something
2010-11-30 13:29:57 +00:00
techdragon.nguyen@gmail.com
96cdb7353a fixed line endings
fixed horizontal scrolling to be controlled by a function of dt as per linshier suggestion.
  * this allows compatibility for multi-byte character sets
2010-11-30 12:15:32 +00:00
linshier
970cd456de Fixed some utf-8 decoding for Japanese and tweaked card text formating for multi-encoding support. 2010-11-29 17:40:21 +00:00
techdragon.nguyen@gmail.com
0c9f5cd558 moved word wrap function from Vertical Scroller into utils.
moved MTG specific functions out of utils.cpp into AllAbilities
added word wrapping to descriptions while viewing deck information.
2010-11-29 13:38:36 +00:00
techdragon.nguyen@gmail.com
8fd35ac513 Improved Vertical Scrolling 2010-11-28 23:54:36 +00:00
omegablast2002@yahoo.com
29fc58388d Added 2 new cheats, "Optimize starting hand" and "Unlock all Ai decks"
added new mana display option "No Glitter" acciddently(?) lost "both" options somehow.
the new "no glitter mana display is basically "eye candy without particle effects" on PC created 2000 mana...no FPS drop...on PSP created an EXTREMELY large amount of mana before i noticed an FPS drop of any kind, this is dramatically better then 
what was in previous rev, create 20 mana and crash.

if someone could figure out how i manage to lose the "Both" option, please explain to me why it wasnt showing up, i spent 2 hours trying to get it back.

both "optimize starting hand" and "Unlock all Ai Decks" appear in options under the option to "enable cheats"

optimize gives you decent starting hands, and Unlock all Ai decks is basically just a bypass options for the unlock deck mode varible wololo added.

tweaked abilitygranting Eff in Ai lessons to be divided by the number of cards in hand, this will mean Ai will tend to focus on using mana to cast spells instead of using them to grant abilities, until theres only 1 or less cards in hand, at this point it will go all out. there is a splash of randomness in Ai so it will still often do whatever it freaking wants lol, you should notice a proformence increase from Ai in this aspect. no more giving unblockable to a creature in 2nd main.

please note, one of the recent previous revs broke cheat mode "unlock cards" in deck editor, i filed a bug report. its a probelm i was not able to fix myself so there is no fix included in this rev....i came across the bug while testing cheat mode stuff.
2010-11-28 20:55:04 +00:00
wagic.the.homebrew@gmail.com
52fce24bf8 Erwan
- Added AI Decks unlock system. Please update your graphics folder, and crossing fingers that Ilya B. is still around as I don't have the correct fonts.
2010-11-28 04:15:58 +00:00
omegablast2002@yahoo.com
6467ab5aa8 reduced abilitymodify eff slightly increased base eff, added abilitygranted to activated. 2010-11-27 18:28:38 +00:00
omegablast2002@yahoo.com
e23e3d0728 more Ai training: use ability modifiers on creatures that dont already have the ability and prefferedly during first mains, use life altering cards as often as possible, improved foreach a little more, use untappers on card that are tapped that belong to Ai and tappers on cards that are not tapped that belong to player 2010-11-27 18:05:35 +00:00
omegablast2002@yahoo.com
3151dfd348 Better Ai: Foreach training, reduced Eff on "levelingup" based on cards in hand/maxxed in 2nd main, added a selectAbility() call after lands are played and after all cards were searched if none were found to play. after much playtesting i found that if given the chance to find an ability BEFORE playing cards, Ai does dramatically better during a match, the same goes if its given a chance to find one after it looked for stuff to play.
with this change please try playing a few matchs against vanguards chosen and wraith feast, my 2 most favorate decks to fight now. youre in for a treat :)

keep in mind that even tho ive taught Ai Foreach in a somewhat crude manner it still does not understand how much mana it can gain from a foreach manaproducer, and this does not make it suddenly use dark ritual correctly. however this change was dramatic enough that i wanted it in for 14.1

this is also still under massive play testing, however no issues were found so far with it as it is presented here.
2010-11-26 22:10:43 +00:00
wrenczes@gmail.com
75345469ee File addition for my threading work. This has no impact on the build until I tie in my other changes. 2010-11-26 19:41:15 +00:00
techdragon.nguyen@gmail.com
29805852c8 changed vertical scroller as per wololo's suggestion. Scroll speed is a function of the
dt value gathered from Update() instead of ticks.
2010-11-25 16:39:22 +00:00
techdragon.nguyen@gmail.com
22b743ccdf restoring scroller on main page to normal speed 2010-11-25 13:52:36 +00:00
techdragon.nguyen@gmail.com
77cfdf4571 implemented wrapping horizontal scrolling for deck selection screens 2010-11-25 11:32:18 +00:00
techdragon.nguyen@gmail.com
e4c8469490 implemented vertical scrolling.
created new class VerticalTextScroller to handle task display in deck selection screens
modified detailed popup placement on deck selection screen to compensate for lack of border
2010-11-24 16:12:18 +00:00
Xawotihs
7e37e68755 more iOS port fix 2010-11-23 23:35:40 +00:00
omegablast2002@yahoo.com
bce5b9e54b Ai training: some Foreach training, optimizted the equip training to have Ai better use equipment, it should no longer leave equipment sitting around, enticed Ai into paying upcost on cards YAY! no more summon now and lose it next turn! :) enjoy. 2010-11-23 16:52:46 +00:00
techdragon.nguyen@gmail.com
e39c94756b added border to extra details popup as per design at
http://wololo.net/forum/viewtopic.php?f=37&t=2380
and
http://wololo.net/forum/viewtopic.php?f=37&t=2382
2010-11-23 14:02:02 +00:00
techdragon.nguyen@gmail.com
064dad3085 reverted ability/color parser for AATokenCreator.
fixed color parsing error for Transformer classes
2010-11-22 09:51:36 +00:00
Xawotihs
2b6469e391 Mouse support in deck editor 2010-11-20 21:30:15 +00:00
techdragon.nguyen@gmail.com
7e55039b0a * added hashmap for all basic abilities.
* created three new utility functions that return a vector of matching abilities, colors and types
* migrated all activated ability impl into AllAbilities.cpp.  Perhaps we could break AllAbilities up into separate impl files for manageability?
    One for Activated abilities, another for triggers,etc
2010-11-20 19:41:26 +00:00
Xawotihs
048ecb3324 Mouse support in Shop 2010-11-20 17:46:53 +00:00
techdragon.nguyen@gmail.com
36d25441e2 * fixed some boundary conditions for menu initialization
* changed # victories to be calculated value
* removed nbVictories accessor
2010-11-20 10:11:06 +00:00
Xawotihs
3725958fc3 Fix mouse support in menus and first screen 2010-11-20 00:33:37 +00:00
Xawotihs
8339cdd3b3 iOS compilation fixes 2010-11-19 23:16:31 +00:00
techdragon.nguyen@gmail.com
5f70d1cff1 * Renamed AManaRedux to AAlterCost since the latter is more representative of the effect
* moved more implementations from AllAbilities header file into the impl file.
2010-11-19 14:55:29 +00:00