Commit Graph

1191 Commits

Author SHA1 Message Date
wrenczes@gmail.com
5c819a3b3c Found & fixed a crash while testing trample. The bug: if the AI's player hand dropped to zero cards. This broke in r2696.
Zeth, please review, I put in a comment where there's something that doesn't make sense- probably an early change that's now obsolete.
2010-12-08 07:53:51 +00:00
omegablast2002@yahoo.com
d3a4745686 did a couple things here, fixed issue507 but also, very very very possibly fixed issue548, tho i will leave the closing of those 2 tickets to wololo, as he was the one who originally reported them.
another issue i fixed, when last trigger would be resolving in "trigger" substep, the game was moving to next combatstep before you could finish it, NOW the game correctly finishes resolving any triggers that might have fired off in "Triggers" substep, THEN it adds combatdamage step to the stack. this also fixes an issue where if you were multiblocked and combattriggers fired off, then your trigger would be UNDER the "ordering window" and unresolvable.

added waitingforanwsers return to userRequestNextGamePhase
when youre "waiting for anwsers" that means you have a menu box open and the game is waiting for you to decide....this was one of the causes of the rush to combat damage while youre still selecting something on a menu.

moved Trigger step call to requestnextgamephase into stateEffects() and out of updates, works MUCH better this way. i wonder why this isnt handling more of the automated functions, i suggest we consider moving the autopassphase into stateEffects() also as it will most likely be handled much better in there then in the update function.


also,
adjust Ailessons on Adrawer, it was still getting a little too excited about drawing cards. 
moved around the eff setting on grantingability lessons.
having it set to 0 BEFORE actually giving it a value was conter productive.

added a peice of commented out code in "isintop" function that if you uncomment will allow you to have Ai ALWAYS multiblock you.

im pushing this in as i feel comfortable with the positives and havent really come across an adverse effect yet.
however i am just one person and testing something like this is much easier with alot more then 1 person on it.
2010-12-07 17:58:46 +00:00
wagic.the.homebrew@gmail.com
c28c14171f Erwan
-fix for issue 489 (protection prevents some triggers to happen)
2010-12-07 14:12:04 +00:00
omegablast2002@yahoo.com
8ba23dd99f Bug Fix for issue 464, multipling the secs you set to interrupt by the amount of unresolved stack actions. this extends you time giving you essentially X sec of interrupt offer for each stack action.
exsample, 3 unresolved stack actions. with interrupt set to 5 secs, will allot you 15 secs to decide the first action, then 10 secs to decide the 2nd action, then 5 secs to decide the last action.

note: its multiplicative, this does not make each stack action into 15 sec interrupt.

as they resolve "extraTime" gets recalculated.
2010-12-06 12:12:53 +00:00
omegablast2002@yahoo.com
336cf0bc32 jace's erasure fix, this is only temporary until i add all the abilitie varibles, currently theres no system beside a workaround we use "thisforeach(varible) effect" to return a value, when im done with the varible returning for abilities then the code will be replaced with @drawn(controller):may deplete:cardamount. for now tho this makes the addDraw send 1 event for each card drawn, essentially making all the @drawn cards 100%. 2010-12-06 11:28:11 +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
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
ba3ca7018b reduced the Eff by 50 up from 20 on Adrawer, and reduced to 0 if more then 10 cards in hand, theres too high of a chance that Ai will not be able to actually cast any of that and is just milling himself. 2010-12-04 21:12:58 +00:00
omegablast2002@yahoo.com
e8582e1413 told Ai not to block its own attacking creatures(?), hopefully this is whats happening in issue 547.
its been discovered and maybe even known that Ai can do alot of illegal actions as if the rules we set inplace for the player don't apply to it.
2010-12-04 20:01:22 +00:00
omegablast2002@yahoo.com
7805e52910 Attempt to fix a bug with Ai and how it manages mana, if an ability or effect would add for exsample 3 black to the manapool, the old way this was set up would be either/or but never both, current mana was always just what was in the pool or what it could make.
with this change, currentmana is now what it could make and if anything is in the pool then add whats in the pool as potential mana., if it could potentially make mana then THIS is its currentpool. as getpotentialMana already handles the rest.

i originally added the manapool at the end of potential as my first attempt to stop this behavior, but this either/or if statement really got in the way of producing the result i wanted, which is, if 
Ai has a 3 swamps, and a dark ritual, and it cast darkritual.
in hand Ai has a 5 black drop.

in OLD set up Ai would see it has 3 mana, then it would see it had 2 mana from the untapped swamps. it would pass the phase thinking that it could not cast the creature.

NOW ai looks for how much it has in mana, it see 3 swamps, it cast dark ritual, it now see what it can create on the next call to findcards, it see 2 swamps + 3 mana in pool, it cast the 5 drop creature.


mind you that this does not fix Ai mindlessly casting dark ritual as we have no current system to tell AI "hey dont cast that card now its useless to do so" like the fancy system to tell it what abilities it should use on cards :) *maybe someday*
2010-12-04 19:45:39 +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
omegablast2002@yahoo.com
142d6b4609 bug fixs, added colon to "damage" parsing so we can finally not worry about "damage" wanting to build a ability. it now has to look for "damage:" which makes it more consistent with how we made the other abilities. did the same with lifeset however no bug there.
2nd bug fix, 
commented out a peice of code that compared if power and toughness would be cancelled out by a new counter. exsample:
1/1 is cancelled by -1/-1...this is actually extremely incorrect, 

if you "put a 1/1 on a creature"
then you "put a -1/-1" on the same one. it does NOT remove the 1/1 as per MTG rules. the counters all all treated as NEW objects on a card. so a creature that had both those abilities used on it should have BOTH a 1/1 and a -1/-1 counter.
commenting out the section of code corrected this probelm.
modular creature, phantom creatures,sunburst and many many more will now correctly be able to use their counters even if they recieved "cancelling" Counters

last was just an improvement, as i got overly frustraited tonight while fighting with a deck that slaps many different types of counters on cards, i was having a very hard time telling what exactly i was about to put on a creature.

so what i did to correct this is create a much better menuText return on aacounter class.

PLEASE let me know if i missed a case where a counter is not showing correct text.
2010-12-04 12:32:33 +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
bb9ad159c3 Fix for Issue 530: wither vs daily regimen = crash?. Turns out that it was a simple missing NULL check in the code that draws counter info on the large format cards. 2010-12-04 09:09:24 +00:00
wrenczes@gmail.com
793f6245f0 Reinstated the call to setExtraCostsAction() in reactToClick, as removing it breaks Basal Sliver (when sacrificing another sliver, it would kill off Basal Sliver instead of the other sliver that inherited the ability). 2010-12-04 08:36:10 +00:00
wrenczes@gmail.com
6e327379fd Fix for Issue 529, May abilities with counters shouldn't present selection dialog when counters == 0.
The problem I found was specific to ManaProducer.  I added an additional check when calling isReactingToClick(), if the cost has an extra cost, check if it can be paid.  For this to work though, I had to change things around a little - there was a hack in the parsing code for ManaProducer abilities, where the cost wasn't being passed into the constructor.  To compensate, the extra cost was being set during reactToClick, but this is too late, as isReactingToClick is called first.  Now, where the hack occurs, after we construct the ManaProducer, if there's a cost, make sure we set the extra cost action immediately.

This seems to work well for the Vivid Creek card case: once the counters are tapped out, the menu system doesn't add the extra card abilities anymore, and you simply get the land tap without the menu popping up.  I'm not seeing any adverse effects so far with other mana producer cards, but I'd appreciate a sanity check from other people here in case there's some other fallout I'm not seeing from this change.
2010-12-04 07:39:32 +00:00
wrenczes@gmail.com
08761d294e The right way to fix the cast warning for PSP. 2010-12-04 06:46:25 +00:00
omegablast2002@yahoo.com
e8e8553cd0 fixed psp compiling. 2010-12-04 06:26:05 +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
techdragon.nguyen@gmail.com
fab5f9da29 fixed formatting 2010-12-03 01:09:30 +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
Xawotihs
802937573d Fixed a crash occuring when trying to select card with the mouse in an empty list 2010-12-02 20:35:42 +00:00
omegablast2002@yahoo.com
08b6779d59 forcing Ai to attack with creature that have "treason" ( the ability that sacrifices cards like ball lightining at end of turn)
since the creature is going to die anyways, might as well send it in and see if it can kill something.

and yes i consider ai being THAT stupid a bug :P
2010-12-02 18:43:39 +00:00
omegablast2002@yahoo.com
2a4b0e28f0 another tweak, sorry! forgot i needed to compensate for removing the base by increasing the actual. 2010-12-02 17:06:20 +00:00
omegablast2002@yahoo.com
03bc34101f reduced abilitygranting base eff to 0, aparently when Ai has nothing better to do it spams ability grantings, but it should be playing cards. 2010-12-02 16:46:45 +00:00
wagic.the.homebrew@gmail.com
81153939f9 Erwan
- Fix a bug where AI would not check for the NULL status of some variables before calling functions on them. This would cause crashes that could seem random ingame. Possibly fixes issue 541
2010-12-02 14:03:10 +00:00
wagic.the.homebrew@gmail.com
15d504c160 Erwan
- fix for issue 539 . It is now possible to provide several possible paths in Res.txt, the game will use the first one that matches. If none of them works, it reverts to the oldschool "Res" folder
2010-12-02 12:56:18 +00:00
techdragon.nguyen@gmail.com
bcca766cb6 Premade decks will not create/update stats on battles.
Update description for default premade deck to allow proper wrapping of text.  
Issue: 540
2010-12-02 08:36:36 +00:00
wrenczes@gmail.com
720ee30c9a Fix for issue 518, Shop "background light" image "candle effect" not working. Basically some bad math made the alpha clamp all the time at its max value of 50. Now we pick a random number distribution between -25 and + 25 for the alpha offset value. 2010-12-02 07:42:32 +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
omegablast2002@yahoo.com
68a7d418e9 Hiding "New Deck" option when "Create a Deck!" option is showing.
it was redundent.
2010-12-01 13:35:53 +00:00
wrenczes@gmail.com
af6c7bd1f0 Ran VS formatting on this file, as the indentation was all over the place. No actual code changes here. 2010-12-01 08:54:45 +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
69c1ba8717 PC specific change (ie PSP not impacted) - OpenGL is not thread safe, only one thread is allowed to have the context at any given time. The JGE library was not written with multithreading in mind, so the LoadTexture call doesn't work when called on a worker thread. In order to get my threading changes to work, I had to split out the OpenGL calls to happen on a point where we're guaranteed to be back on the main thread.
Functionally, this has no impact to the current build - all I've done is effectively the texture loading to happen in JQuad's constructor instead of inside the LoadTexture() function.

Side note - I probably broke the IOS build with this change.  Sorry, but I can only build so many targets at a time - I'm simply not set up to build this platform.  As it's not a shipping target, I have to consider it a 2nd class citizen...
2010-12-01 07:19:12 +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
techdragon.nguyen@gmail.com
be707e2396 limiting the number of deck lookups to 6 to reduce load time 2010-11-30 05:39:17 +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
4badcc374f * modified task window to define what the bracketed numbers mean.
* modified main page banner to use actual deck names and not the filename when
   displaying stats information.
2010-11-29 12:45:48 +00:00
techdragon.nguyen@gmail.com
b46112dfcd reverting change made in r2701
The conditions on which to "updateStats" during the rebuilding of filters needed to be updated.  stw is NULL
when rebuilding the filters due to a "UNLOCK CARDS" action.  Thus the call to stw->updateStats throws a NPE.
stw is not null only when a deck has been selected to edit.  Otherwise, it makes no sense to actually update the
stats of a non-selected deck.
2010-11-29 11:50:12 +00:00
techdragon.nguyen@gmail.com
0856ddaeb2 added missing semicolon. missed it in the check in somehow... 2010-11-29 10:12:39 +00:00
omegablast2002@yahoo.com
6e6ca0394b seperated an if( statement that was causing a crash in deck editor when you used the "unlock cards" cheat. this->needsUpdate is actually a Null Pointer at the time its checked, so having it checked in the same if ( would instantly cause the game to crash.
Issue: 536
2010-11-29 00:36:38 +00:00
techdragon.nguyen@gmail.com
83daafb3bf Issue 537: The initializer for the options needs to be told how many different values are available. 2010-11-29 00:15:01 +00:00