but only by chance that the previous step set the current deck file. Used victory percentage
from the MetaData object rather than forcing what has already been computed.
TODO: getVictoryPercentage() needs to represent Overall VictoryPercentage for all decks, not just
player decks. AI Decks use getVictoryPercentage() to represent the VictoryPercentage against a
specific deck. There should be an additional method that says getVictoryPercentageVsDeck( deckObject )
- submit a fix for TestSuiteAI, I don't understand why it wasn't submitted with my other changes yesterday. This fixes a bug in the test suite (One storm test would fail without this)
- minor refactor to AI code
* 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.
For some reason, the VS2008 compiler allows this illegal access and VS2010 does not. In all actuality it should never be permitted.
Please review the thread posted on the SVN thread for details as to why this needs a fix.
http://code.google.com/p/wagic/issues/detail?id=593&sort=-id
Issue: 593
- deprecated the following keywords (see list below for new usage)
-- cantcreaturecast => auto=maxCast(creature)0
-- cantspellcast => auto=maxCast(*)0
-- onlyonecast => auto=maxCast(*)1
-- bothcantcast => auto=maxCast(*)0 auto=maxCast(*)0 opponent
-- bothnocreature => auto=maxCast(creature)0 auto=maxCast(creature)0 opponent
-- oneboth => auto=maxCast(*)1 auto=maxCast(*)1 opponent
Strangely enough, I couldn't find most of these keywords in mtg.txt?
I also removed variables such as "spellCastedThisTurn" and stuff like that... now if you want to know how many spells were cast in one turn by a given player, use player->game->stack->seenThisTurn("*").
seenThisTurn can take a string representing a TargetChooser, or better, a TargetChooser.
I can't guarantee I didn't break anything, but the test suite passes and the AI seems to run ok
- added maxCast and maxPlay abilities, this deprecates the following abilities: nospells,nocreatures,onlyonespell,land
I usually don't like to deprecate abilities, but the existing ones, despite having easy to remember names, were really not flexible enough.
If you want to use these old keywords, instead use:
-- nospells => maxCast(*)0
-- onlyOneSpell => maxCast(*)1
--nocreatures => maxCast(creature)0
--land:1 => maxplay(land)+1
note maxPlay and maxCast. They follow similar rules, but maxPlay monitors the number of cards that are going on the Battlefield, while maxCast monitors the stack. In most cases, maxCast should be the one to use, but lands are a special case because they go directly to play.
I unfortunately cannot guarantee I didn't break anything, especially in the AI, but the test suite passes ,and I added a few additional tests yesterday and today, to feel more confident about the change.
next step is removing the creatures keywords that do the same kind of thing (cantcast, etc...) and replace them with maxCast
1. Fire Dragon(It has same problem as unchanged Honden Of Infinite Rage, using new code "type:" to fix it.)
auto=foreach(mountain|myBattlefield) damage:1 target(creature) oneshot
==>
auto=damage:type:mountain target(creature)
2. Burden of Greed
auto=foreach(artifact[tapped]|opponentBattlefield)damage:1
==>
auto=foreach(artifact[tapped]|opponentBattlefield) life:-1 opponent
- replaced variables canPutLandsIntoPlay and landsPlayerCanStillPlay with a PlayRestrictions class.
- Added seenThisTurn(TargetChooser * tc) in MTGGameZones, which allows to count how many cards matching a targetChooser have been in a given zone in the current turn. With minor work, this can probably be reused by the ability parser for some cards that need to count how many **** where played or put on the stack during a turn.
-- for example player->game->stack->seenThisTurn([put a TypeTargetChooser("creature") here]) would give you the number of creature spells cast by the player this turn.
- This is the first step of a refactor that aims at removing all the adhoc variables for "cant cast". I plan to get rid of the following variables in Player.h (and the associated code, which hopefully will become smaller):
int castedspellsthisturn;
bool onlyonecast;
int castcount;
bool nocreatureinstant;
bool nospellinstant;
bool onlyoneinstant;
bool castrestrictedcreature;
bool castrestrictedspell;
bool onlyoneboth;
bool bothrestrictedspell;
bool bothrestrictedcreature;
They will be replaced by the PlayRestrictions system, and hopefully I'll have time to update the parser to make this more generic as well.
My initial goal with this change was to move the limit of 1 land per turn outside of the code, and make it an external rule in Rules/mtg.txt. I have yet to do it.
draw:type:creature|opponentbattlefield
will draw a card for each creature on the opponents battlefield
this defualts to "|mybattlefield" however any target zone can be used, hand, library ect....
this will add support to some cards which werent possible with previous version of it, without having to create new word variables to do the same exact thing as can now be done with this.
moved it out of rules, it was FAR to error prone and after fixing bugs on this ability about 12 times, im done with it.
noticed yesterday that it was removing the completely wrong amounts, and not maintaining its cost AT ALL. so i got sick of adjusting it as a rule, its now a statebased effect, called through gamestatebasedeffect as a side function.
the new affinity is less then 100 lines of code, down from 300. to acomplish the effect with FAR less effort. it is also FAR easier to maintain in the future if i die or leave the scene or whatever.
added a new count tool for MTGGameZones canByCanTarget...which allows for returns of amounts based on if it can be targetted by a tc. much like how listmaintainer does it. affinitygreencreature will not be the only ability to use this function, just a heads up. its just the first to do so.
hopefully this much more accurate affinity will be the last version...considering adding the other types which old affinity couldnt handle :D
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...
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.:)