- Fix one card in ZEN
- Fix AI and counters (issue 75, see tests/manual/torture_ai.txt)
- Fix counters target
This commit is contained in:
wagic.the.homebrew@gmail.com
2009-09-28 13:34:49 +00:00
parent 7efdad82de
commit f7331b7066
8 changed files with 67 additions and 8 deletions

View File

@@ -219,6 +219,7 @@ telekinetic_sliver.txt
terror.txt
terror2.txt
titanic_ultimatum.txt
torture.txt
tranquil_domain.txt
unwilling_recruit.txt
volcanic_island.txt

View File

@@ -0,0 +1,20 @@
#Bug:Does torture correctly cast torture on opponent's creatures ?
[INIT]
SECONDMAIN
[PLAYER1]
inplay:grizzly bears
[PLAYER2]
hand:torture
inplay:air elemental,swamp,plains
[DO]
ai
ai
[ASSERT]
COMBATEND
[PLAYER1]
inplay:Wildslayer Elves,Armadillo Cloak
life:25
[PLAYER2]
graveyard:grizzly bears
life:17
[END]

View File

@@ -0,0 +1,32 @@
#Bug: Torture doesn't put counters
[INIT]
FIRSTMAIN
[PLAYER1]
inplay:grizzly bears,swamp,mountain
hand:torture
manapool:{B}
[PLAYER2]
[DO]
torture
grizzly bears
swamp
mountain
torture
next
#begin
next
#attackers
grizzly bears
next
#blockers
next
#damage
next
#end combat
[ASSERT]
COMBATEND
[PLAYER1]
inplay:grizzly bears,swamp,mountain,torture
[PLAYER2]
life:19
[END]

View File

@@ -57,7 +57,7 @@ class AIPlayer: public Player{
int chooseAttackers();
int chooseBlockers();
int canFirstStrikeKill(MTGCardInstance * card, MTGCardInstance *ennemy);
int effectBadOrGood(MTGCardInstance * card);
int effectBadOrGood(MTGCardInstance * card, int mode = MODE_PUTINTOPLAY);
int getCreaturesInfo(Player * player, int neededInfo = INFO_NBCREATURES , int untapMode = 0, int canAttack = 0);
AIStats * getStats();
public:

View File

@@ -159,7 +159,7 @@ class AACounter: public ActivatedAbility{
int power;
int toughness;
AACounter(int id, MTGCardInstance * source, MTGCardInstance * target, int power, int toughness, int nb, ManaCost * cost = NULL, int doTap = 0) : ActivatedAbility(id, source, cost, 0, doTap), nb(nb), power(power), toughness(toughness) {
target = target;
this->target = target;
}

View File

@@ -31,6 +31,7 @@ using std::map;
#define BAKA_EFFECT_DONTKNOW 0
#define MODE_PUTINTOPLAY 1
#define MODE_ABILITY 2
#define MODE_TARGET 3
#define COUNT_POWER 1
@@ -205,7 +206,7 @@ class AbilityFactory{
MTGAbility * parseMagicLine(string s, int id, Spell * spell, MTGCardInstance *card, int activated = 0, int forceUEOT = 0);
public:
int abilityEfficiency(MTGAbility * a, Player * p, int mode = MODE_ABILITY);
int magicText(int id, Spell * spell, MTGCardInstance * card = NULL);
int magicText(int id, Spell * spell, MTGCardInstance * card = NULL, int mode = MODE_PUTINTOPLAY);
static int computeX(Spell * spell, MTGCardInstance * card);
int destroyAllInPlay(TargetChooser * tc, int bury = 0);
int moveAll(TargetChooser * tc, string destinationZone);

View File

@@ -281,10 +281,10 @@ int AIPlayer::interruptIfICan(){
return 0;
}
int AIPlayer::effectBadOrGood(MTGCardInstance * card){
int AIPlayer::effectBadOrGood(MTGCardInstance * card, int mode){
int id = card->getMTGId();
AbilityFactory * af = NEW AbilityFactory();
int autoGuess = af->magicText(id,NULL,card);
int autoGuess = af->magicText(id,NULL,card, mode);
delete af;
if (autoGuess) return autoGuess;
return BAKA_EFFECT_DONTKNOW;
@@ -305,7 +305,7 @@ int AIPlayer::chooseTarget(TargetChooser * tc){
if (!tc) return 0;
if (!(gameObs->currentlyActing() == this)) return 0;
Player * target = this;
int cardEffect = effectBadOrGood(tc->source);
int cardEffect = effectBadOrGood(tc->source, MODE_TARGET);
if (cardEffect != BAKA_EFFECT_GOOD){
target = this->opponent();
}

View File

@@ -655,6 +655,11 @@ int AbilityFactory::abilityEfficiency(MTGAbility * a, Player * p, int mode){
if (dynamic_cast<AAFizzler *>(a)) return BAKA_EFFECT_BAD;
if (dynamic_cast<AAUntapper *>(a)) return BAKA_EFFECT_GOOD;
if (dynamic_cast<AATapper *>(a)) return BAKA_EFFECT_BAD;
if (AACounter * ac = dynamic_cast<AACounter *>(a)) {
bool negative_effect = ac->power < 0 || ac->toughness < 0;
if ((ac->nb > 0 && negative_effect) || (ac->nb < 0 && !negative_effect)) return BAKA_EFFECT_BAD;
return BAKA_EFFECT_GOOD ;
}
if (dynamic_cast<ATokenCreator *>(a)) return BAKA_EFFECT_GOOD;
if (dynamic_cast<AAMover *>(a)) return BAKA_EFFECT_BAD; //TODO
if (dynamic_cast<AACopier *>(a)) return BAKA_EFFECT_GOOD;
@@ -709,7 +714,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 AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card, int mode){
int dryMode = 0;
if (!spell) dryMode = 1;
@@ -741,7 +746,7 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){
MTGAbility * a = parseMagicLine(line, result, spell, card);
if (dryMode){
result = abilityEfficiency(a, card->controller(),MODE_PUTINTOPLAY);
result = abilityEfficiency(a, card->controller(),mode);
SAFE_DELETE(a);
return result;
}