diff --git a/projects/mtg/bin/Res/sound/sfx/artifact.wav b/projects/mtg/bin/Res/sound/sfx/artifact.wav index 21a276a16..035c2e583 100644 Binary files a/projects/mtg/bin/Res/sound/sfx/artifact.wav and b/projects/mtg/bin/Res/sound/sfx/artifact.wav differ diff --git a/projects/mtg/bin/Res/sound/sfx/bear.wav b/projects/mtg/bin/Res/sound/sfx/bear.wav index 8e6cec17d..328597274 100644 Binary files a/projects/mtg/bin/Res/sound/sfx/bear.wav and b/projects/mtg/bin/Res/sound/sfx/bear.wav differ diff --git a/projects/mtg/bin/Res/sound/sfx/beast.wav b/projects/mtg/bin/Res/sound/sfx/beast.wav index af355a80f..2206c74a9 100644 Binary files a/projects/mtg/bin/Res/sound/sfx/beast.wav and b/projects/mtg/bin/Res/sound/sfx/beast.wav differ diff --git a/projects/mtg/bin/Res/sound/sfx/bonus.wav b/projects/mtg/bin/Res/sound/sfx/bonus.wav index c9cde1832..6aefdd3ea 100644 Binary files a/projects/mtg/bin/Res/sound/sfx/bonus.wav and b/projects/mtg/bin/Res/sound/sfx/bonus.wav differ diff --git a/projects/mtg/bin/Res/sound/sfx/cat.wav b/projects/mtg/bin/Res/sound/sfx/cat.wav index c5c304ad7..0e020542e 100644 Binary files a/projects/mtg/bin/Res/sound/sfx/cat.wav and b/projects/mtg/bin/Res/sound/sfx/cat.wav differ diff --git a/projects/mtg/bin/Res/sound/sfx/creature.wav b/projects/mtg/bin/Res/sound/sfx/creature.wav index 4059f3856..c256c0475 100644 Binary files a/projects/mtg/bin/Res/sound/sfx/creature.wav and b/projects/mtg/bin/Res/sound/sfx/creature.wav differ diff --git a/projects/mtg/bin/Res/sound/sfx/dragon.wav b/projects/mtg/bin/Res/sound/sfx/dragon.wav index 6538f588e..9c48652a7 100644 Binary files a/projects/mtg/bin/Res/sound/sfx/dragon.wav and b/projects/mtg/bin/Res/sound/sfx/dragon.wav differ diff --git a/projects/mtg/bin/Res/sound/sfx/enchantment.wav b/projects/mtg/bin/Res/sound/sfx/enchantment.wav index 4849c6544..b6563756c 100644 Binary files a/projects/mtg/bin/Res/sound/sfx/enchantment.wav and b/projects/mtg/bin/Res/sound/sfx/enchantment.wav differ diff --git a/projects/mtg/bin/Res/sound/sfx/faerie.wav b/projects/mtg/bin/Res/sound/sfx/faerie.wav index d23f91237..daa07cb60 100644 Binary files a/projects/mtg/bin/Res/sound/sfx/faerie.wav and b/projects/mtg/bin/Res/sound/sfx/faerie.wav differ diff --git a/projects/mtg/bin/Res/sound/sfx/flying.wav b/projects/mtg/bin/Res/sound/sfx/flying.wav index c21ed1e41..29cc075f7 100644 Binary files a/projects/mtg/bin/Res/sound/sfx/flying.wav and b/projects/mtg/bin/Res/sound/sfx/flying.wav differ diff --git a/projects/mtg/bin/Res/sound/sfx/goblin.wav b/projects/mtg/bin/Res/sound/sfx/goblin.wav index 29eb223d2..441885c86 100644 Binary files a/projects/mtg/bin/Res/sound/sfx/goblin.wav and b/projects/mtg/bin/Res/sound/sfx/goblin.wav differ diff --git a/projects/mtg/bin/Res/sound/sfx/graveyard.wav b/projects/mtg/bin/Res/sound/sfx/graveyard.wav index 9e909e41a..67116deb9 100644 Binary files a/projects/mtg/bin/Res/sound/sfx/graveyard.wav and b/projects/mtg/bin/Res/sound/sfx/graveyard.wav differ diff --git a/projects/mtg/bin/Res/sound/sfx/human.wav b/projects/mtg/bin/Res/sound/sfx/human.wav index 20fd8ce51..499205ef1 100644 Binary files a/projects/mtg/bin/Res/sound/sfx/human.wav and b/projects/mtg/bin/Res/sound/sfx/human.wav differ diff --git a/projects/mtg/bin/Res/sound/sfx/imp.wav b/projects/mtg/bin/Res/sound/sfx/imp.wav index 836b8ceaa..af646961b 100644 Binary files a/projects/mtg/bin/Res/sound/sfx/imp.wav and b/projects/mtg/bin/Res/sound/sfx/imp.wav differ diff --git a/projects/mtg/bin/Res/sound/sfx/instant.wav b/projects/mtg/bin/Res/sound/sfx/instant.wav index bd491e0be..09e1152db 100644 Binary files a/projects/mtg/bin/Res/sound/sfx/instant.wav and b/projects/mtg/bin/Res/sound/sfx/instant.wav differ diff --git a/projects/mtg/bin/Res/sound/sfx/knight.wav b/projects/mtg/bin/Res/sound/sfx/knight.wav index 8fe36b7ed..c021d40a8 100644 Binary files a/projects/mtg/bin/Res/sound/sfx/knight.wav and b/projects/mtg/bin/Res/sound/sfx/knight.wav differ diff --git a/projects/mtg/bin/Res/sound/sfx/mana.wav b/projects/mtg/bin/Res/sound/sfx/mana.wav index ec72676ae..683c3195d 100644 Binary files a/projects/mtg/bin/Res/sound/sfx/mana.wav and b/projects/mtg/bin/Res/sound/sfx/mana.wav differ diff --git a/projects/mtg/bin/Res/sound/sfx/sorcery.wav b/projects/mtg/bin/Res/sound/sfx/sorcery.wav index a61f75ca9..5d5c383b2 100644 Binary files a/projects/mtg/bin/Res/sound/sfx/sorcery.wav and b/projects/mtg/bin/Res/sound/sfx/sorcery.wav differ diff --git a/projects/mtg/bin/Res/sound/sfx/troll.wav b/projects/mtg/bin/Res/sound/sfx/troll.wav index 416994b3b..05f8129c0 100644 Binary files a/projects/mtg/bin/Res/sound/sfx/troll.wav and b/projects/mtg/bin/Res/sound/sfx/troll.wav differ diff --git a/projects/mtg/bin/Res/sound/sfx/vampire.wav b/projects/mtg/bin/Res/sound/sfx/vampire.wav index 6ba3ded15..179e55202 100644 Binary files a/projects/mtg/bin/Res/sound/sfx/vampire.wav and b/projects/mtg/bin/Res/sound/sfx/vampire.wav differ diff --git a/projects/mtg/bin/Res/sound/sfx/wurm.wav b/projects/mtg/bin/Res/sound/sfx/wurm.wav index 64a1e827a..316de2d34 100644 Binary files a/projects/mtg/bin/Res/sound/sfx/wurm.wav and b/projects/mtg/bin/Res/sound/sfx/wurm.wav differ diff --git a/projects/mtg/bin/Res/sound/sfx/zombie.wav b/projects/mtg/bin/Res/sound/sfx/zombie.wav index 442d0db13..dc3da7bbf 100644 Binary files a/projects/mtg/bin/Res/sound/sfx/zombie.wav and b/projects/mtg/bin/Res/sound/sfx/zombie.wav differ diff --git a/projects/mtg/include/AIPlayer.h b/projects/mtg/include/AIPlayer.h index dc8eae7aa..5d67f45d0 100644 --- a/projects/mtg/include/AIPlayer.h +++ b/projects/mtg/include/AIPlayer.h @@ -56,7 +56,7 @@ class AIPlayer: public Player{ int chooseAttackers(); int chooseBlockers(); int canFirstStrikeKill(MTGCardInstance * card, MTGCardInstance *ennemy); - int effectBadOrGood(MTGCardInstance * card, int mode = MODE_PUTINTOPLAY); + int effectBadOrGood(MTGCardInstance * card, int mode = MODE_PUTINTOPLAY, TargetChooser * tc = NULL); int getCreaturesInfo(Player * player, int neededInfo = INFO_NBCREATURES , int untapMode = 0, int canAttack = 0); AIStats * getStats(); public: diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index e2803c0d9..9294c7540 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -644,6 +644,11 @@ public: if (_target) target = _target; } + MTGGameZone * destinationZone(){ + MTGCardInstance * _target = (MTGCardInstance *) target; + return MTGGameZone::stringToZone(destination, source,_target); + } + int resolve(){ MTGCardInstance * _target = (MTGCardInstance *) target; if(target){ @@ -651,7 +656,7 @@ public: if (p){ GameObserver * g = GameObserver::GetInstance(); MTGGameZone * fromZone = _target->getCurrentZone(); - MTGGameZone * destZone = MTGGameZone::stringToZone(destination, source,_target); + MTGGameZone * destZone = destinationZone(); //inplay is a special zone ! for (int i=0; i < 2; i++){ diff --git a/projects/mtg/include/MTGAbility.h b/projects/mtg/include/MTGAbility.h index e372e16e4..62f81e19a 100644 --- a/projects/mtg/include/MTGAbility.h +++ b/projects/mtg/include/MTGAbility.h @@ -204,8 +204,8 @@ class AbilityFactory{ TriggeredAbility * parseTrigger(string s, int id, Spell * spell, MTGCardInstance *card, Targetable * target); public: MTGAbility * parseMagicLine(string s, int id, Spell * spell, MTGCardInstance *card, int activated = 0, int forceUEOT = 0); - int abilityEfficiency(MTGAbility * a, Player * p, int mode = MODE_ABILITY); - int magicText(int id, Spell * spell, MTGCardInstance * card = NULL, int mode = MODE_PUTINTOPLAY); + int abilityEfficiency(MTGAbility * a, Player * p, int mode = MODE_ABILITY, TargetChooser * tc = NULL); + int magicText(int id, Spell * spell, MTGCardInstance * card = NULL, int mode = MODE_PUTINTOPLAY, TargetChooser * tc = NULL); static int computeX(Spell * spell, MTGCardInstance * card); int destroyAllInPlay(TargetChooser * tc, int bury = 0); int moveAll(TargetChooser * tc, string destinationZone); diff --git a/projects/mtg/include/WResourceManager.h b/projects/mtg/include/WResourceManager.h index 23f0a4b0d..31b79f15d 100644 --- a/projects/mtg/include/WResourceManager.h +++ b/projects/mtg/include/WResourceManager.h @@ -8,7 +8,7 @@ #include "WCachedResource.h" #define HUGE_CACHE_LIMIT 6000000 // Size of the cache for Windows and Linux -#define SAMPLES_CACHE_SIZE 1000000 // Size in bytes of the cached samples +#define SAMPLES_CACHE_SIZE 1500000 // Size in bytes of the cached samples #define PSI_CACHE_SIZE 500000 // Size in bytes of the cahed particles #define TEXTURES_CACHE_MINSIZE 2000000 // Minimum size of the cache on the PSP. The program should complain if the cache ever gets smaller than this #define OPERATIONAL_SIZE 5000000 // Size required by Wagic for operational stuff. 3MB is not enough. The cache will usually try to take (Total Ram - Operational size) @@ -27,7 +27,7 @@ #define MAX_CACHE_OBJECTS 300 #define MAX_CACHE_ATTEMPTS 10 #define MAX_CACHE_MISSES 200 -#define MAX_CACHED_SAMPLES 10 +#define MAX_CACHED_SAMPLES 50 #define MAX_CACHE_GARBAGE 10 diff --git a/projects/mtg/src/AIPlayer.cpp b/projects/mtg/src/AIPlayer.cpp index 477c74c62..bbc22b863 100644 --- a/projects/mtg/src/AIPlayer.cpp +++ b/projects/mtg/src/AIPlayer.cpp @@ -291,10 +291,10 @@ int AIPlayer::interruptIfICan(){ return 0; } -int AIPlayer::effectBadOrGood(MTGCardInstance * card, int mode){ +int AIPlayer::effectBadOrGood(MTGCardInstance * card, int mode, TargetChooser * tc){ int id = card->getMTGId(); AbilityFactory * af = NEW AbilityFactory(); - int autoGuess = af->magicText(id,NULL,card, mode); + int autoGuess = af->magicText(id,NULL,card, mode, tc); delete af; if (autoGuess) return autoGuess; return BAKA_EFFECT_DONTKNOW; @@ -315,7 +315,7 @@ int AIPlayer::chooseTarget(TargetChooser * tc){ if (!tc) return 0; if (!(gameObs->currentlyActing() == this)) return 0; Player * target = this; - int cardEffect = effectBadOrGood(tc->source, MODE_TARGET); + int cardEffect = effectBadOrGood(tc->source, MODE_TARGET, tc); if (cardEffect != BAKA_EFFECT_GOOD){ target = this->opponent(); } diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index b5e8f600b..194a76196 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -698,28 +698,28 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG } //Tells the AI if the ability should target itself or an ennemy -int AbilityFactory::abilityEfficiency(MTGAbility * a, Player * p, int mode){ +int AbilityFactory::abilityEfficiency(MTGAbility * a, Player * p, int mode, TargetChooser * tc){ if (!a) return BAKA_EFFECT_DONTKNOW; if (GenericTargetAbility * abi = dynamic_cast(a)) { if (mode == MODE_PUTINTOPLAY) return BAKA_EFFECT_GOOD; - return abilityEfficiency(abi->ability,p, mode); + return abilityEfficiency(abi->ability,p, mode, abi->tc); } if (GenericActivatedAbility * abi = dynamic_cast(a)) { if (mode == MODE_PUTINTOPLAY) return BAKA_EFFECT_GOOD; - return abilityEfficiency(abi->ability,p, mode); + return abilityEfficiency(abi->ability,p, mode,tc); } - if (MultiAbility * abi = dynamic_cast(a)) return abilityEfficiency(abi->abilities[0],p, mode); - if (MayAbility * abi = dynamic_cast(a)) return abilityEfficiency(abi->ability,p, mode); + if (MultiAbility * abi = dynamic_cast(a)) return abilityEfficiency(abi->abilities[0],p, mode,tc ); + if (MayAbility * abi = dynamic_cast(a)) return abilityEfficiency(abi->ability,p, mode,tc); if (ALord * abi = dynamic_cast(a)) { int myCards = countCards(abi->tc, p); int theirCards = countCards(abi->tc, p->opponent()); - int efficiency = abilityEfficiency(abi->ability,p, mode); + int efficiency = abilityEfficiency(abi->ability,p, mode,tc); if (myCards > theirCards) return efficiency; return -efficiency; } - if (AAsLongAs * abi = dynamic_cast(a)) return abilityEfficiency(abi->ability,p, mode); - if (AForeach * abi = dynamic_cast(a)) return abilityEfficiency(abi->ability,p, mode); + if (AAsLongAs * abi = dynamic_cast(a)) return abilityEfficiency(abi->ability,p, mode,tc); + if (AForeach * abi = dynamic_cast(a)) return abilityEfficiency(abi->ability,p, mode,tc); if (dynamic_cast(a)) return BAKA_EFFECT_BAD; if (dynamic_cast(a)) return BAKA_EFFECT_GOOD; if (dynamic_cast(a)) return BAKA_EFFECT_BAD; @@ -729,7 +729,15 @@ int AbilityFactory::abilityEfficiency(MTGAbility * a, Player * p, int mode){ return BAKA_EFFECT_GOOD ; } if (dynamic_cast(a)) return BAKA_EFFECT_GOOD; - if (dynamic_cast(a)) return BAKA_EFFECT_BAD; //TODO + + if (AAMover * aam = dynamic_cast(a)) { + MTGGameZone * z = aam->destinationZone(); + if (tc && tc->targetsZone(p->game->library)){ + if (z == p->game->hand || z == p->game->inPlay) return BAKA_EFFECT_GOOD; + } + return BAKA_EFFECT_BAD; //TODO + } + if (dynamic_cast(a)) return BAKA_EFFECT_GOOD; if (dynamic_cast(a)) return BAKA_EFFECT_BAD; if (dynamic_cast(a)) return BAKA_EFFECT_GOOD; @@ -741,7 +749,7 @@ int AbilityFactory::abilityEfficiency(MTGAbility * a, Player * p, int mode){ if (dynamic_cast(a)) return BAKA_EFFECT_GOOD; if (AInstantPowerToughnessModifierUntilEOT * abi = dynamic_cast(a)) return (abi->wppt->power.getValue()>=0 && abi->wppt->toughness.getValue()>=0) ? BAKA_EFFECT_GOOD : BAKA_EFFECT_BAD; if (APowerToughnessModifier * abi = dynamic_cast(a)) return (abi->wppt->power.getValue()>=0 && abi->wppt->toughness.getValue()>=0) ? BAKA_EFFECT_GOOD : BAKA_EFFECT_BAD; - if (APowerToughnessModifierUntilEndOfTurn * abi = dynamic_cast(a)) return abilityEfficiency(abi->ability, p, mode); + if (APowerToughnessModifierUntilEndOfTurn * abi = dynamic_cast(a)) return abilityEfficiency(abi->ability, p, mode,tc); map badAbilities; badAbilities[Constants::CANTATTACK] = true; @@ -780,7 +788,7 @@ int AbilityFactory::computeX(Spell * spell, MTGCardInstance * card){ * - target (if there ie a "target(" in the string, then this is a TargetAbility) * - doTap (a dirty way to know if tapping is included in the cost... */ -int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card, int mode){ +int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card, int mode, TargetChooser * tc){ int dryMode = 0; if (!spell) dryMode = 1; @@ -791,7 +799,9 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card, int string magicText = card->magicText; if (card->alias && magicText.size() == 0){ //An awful way to get access to the aliasedcard - magicText = GameObserver::GetInstance()->players[0]->game->collection->getCardById(card->alias)->magicText; + MTGCard * c = GameObserver::GetInstance()->players[0]->game->collection->getCardById(card->alias); + if (!c) return 0; + magicText = c->magicText; } string line; int size = magicText.size(); @@ -812,7 +822,7 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card, int MTGAbility * a = parseMagicLine(line, result, spell, card); if (dryMode){ - result = abilityEfficiency(a, card->controller(),mode); + result = abilityEfficiency(a, card->controller(),mode,tc); SAFE_DELETE(a); return result; } diff --git a/projects/mtg/src/ManaCost.cpp b/projects/mtg/src/ManaCost.cpp index 834241cd8..41667b2d9 100644 --- a/projects/mtg/src/ManaCost.cpp +++ b/projects/mtg/src/ManaCost.cpp @@ -27,9 +27,9 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost, MTGCardInstan case 0: start = s.find_first_of("{"); if (start == string::npos){ - return manaCost; + return manaCost; }else{ - state = 1; + state = 1; } break; case 1: