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.
This commit is contained in:
omegablast2002@yahoo.com
2010-12-10 20:51:50 +00:00
parent f894056e74
commit c54de679d4
11 changed files with 440 additions and 503 deletions

View File

@@ -71,7 +71,7 @@ class GameObserver{
Player * currentlyActing();
GameObserver(Player * _players[], int _nbplayers);
~GameObserver();
void stateEffects();
void gameStateBasedEffects();
void eventOccured();
void addObserver(MTGAbility * observer);
void removeObserver(ActionElement * observer);