Here's the current algorithm:
myNbCards = count the number of cards in my play that will be impacted by the "destroy all"
opponentNbCards = count the number of cards in my opponent's play that will be impacted
myCardsPower = count the total power of the creatures in my play that will be impacted by the card
opponentCardsPower= count the total power of the creatures in opponent's play that will be impacted by the card
if (myNbCards < opponentNbCards OR myCardsPower < opponentCardsPower) then high percentage of chance to cast the spell, otherwise low percentage
could a life vs power requirement be added to this?
like
life/10 < [myNbCards - opponentNbCards] OR life/4 < [myCardsPower - opponentCardsPower]
or simply a number higher than 0, like
2 < [myNbCards - opponentNbCards] OR 3 < [myCardsPower - opponentCardsPower]
so that the destroy all should affect either 2 cards of opponents more than yours or destroy 3 more power than you lose
destroy all
Re: destroy all
for spells like judgment day etc. the current algorithm is a quote from wololo in this thread viewtopic.php?f=32&t=416
year and a half old tho, might have moved on.
making it not simply a matter of power inferiority but actually requiring it to be of a certain size would make it less likely that AI burns through it destroyall spells while there no creatures in play or while playing a creature would actually give it power superiority.
year and a half old tho, might have moved on.
making it not simply a matter of power inferiority but actually requiring it to be of a certain size would make it less likely that AI burns through it destroyall spells while there no creatures in play or while playing a creature would actually give it power superiority.
Re: destroy all
whatever that is, it is certainly not the case anymore...
Re: destroy all
Why, did you change it? It used to work fairly well, for the AI to know if it should cast such a spell or not.Zethfox wrote:whatever that is, it is certainly not the case anymore...
Re: destroy all
i didnt change it, it was changed long before me...if you try to break point in those old "all" function in the svn, they say "no executable code is associated with this line, this breakpoint will not be hit" i imagine these became obsolete when "all(" was introduced...but thats just guessing....this also explains why ai waste cards like wraith of gods....even tho you have no creatures it will cast it killing his own....
Re: destroy all
The code is still here, but changed a bit:
in function int AbilityFactory::abilityEfficiency(MTGAbility * a, Player * p, int mode, TargetChooser * tc)
http://code.google.com/p/wagic/source/b ... y.cpp#2785
in function int AbilityFactory::abilityEfficiency(MTGAbility * a, Player * p, int mode, TargetChooser * tc)
Code: Select all
if (ALord * abi = dynamic_cast<ALord *>(a))
{
int myCards = countCards(abi->tc, p);
int theirCards = countCards(abi->tc, p->opponent());
int efficiency = abilityEfficiency(abi->ability, p, mode, tc);
if (myCards > theirCards)
return efficiency;
return -efficiency;
}
Re: destroy all
ah...well, havent messed with that piece of code myself...did the logic behind it change...becuase currently its as if its completely ignored.
after debugging a bit i find the where it states return eff..thats the suggestion...bad naming considering everywhere else it calls this int suggestion....
this function is not coded correctly , using the logic of returning -(-number) is bad....and can lead to alot of confusion...like why did this ai just return a bad ability as a good one and kill off its 4 creatures with day of judgement....
after debugging a bit i find the where it states return eff..thats the suggestion...bad naming considering everywhere else it calls this int suggestion....
this function is not coded correctly , using the logic of returning -(-number) is bad....and can lead to alot of confusion...like why did this ai just return a bad ability as a good one and kill off its 4 creatures with day of judgement....
Re: destroy all
I think I coded it correctly, but I'm not perfectZethfox wrote: this function is not coded correctly , using the logic of returning -(-number) is bad....and can lead to alot of confusion...like why did this ai just return a bad ability as a good one and kill off its 4 creatures with day of judgement....
Here's the logic, in english:
I have a lord, that impacts some of my cards, and some of my opponent's card.
The lord core effect (such as "+1/+1"), independently of the targets, is either negative, or positive (for example, "-1/-1" is negative)
If I have more creatures impacted than my opponent, return the same impact as the effect (i.e if the effect is negative and more creatures from me are impacted than from my opponent, return negative. if the effect is positive and more creatures from me are impacted than from my opponent, return positive.)
If I have less creatures impacted than my opponent, return the opposite of the effect. (i.e if the effect is negative and less creatures from me are impacted than from my opponent, return positive) <- makes sense?
But if you find a flaw in the logic, please enlighten me. I'm not perfect, but right now I just think you didn't actually understand the (fairly simple) logic
This is not to say that it is bug free, but at least this part I believe is correct...
Re: destroy all
not so much the logic of the code itself...but something you touched on with me the other day..using code logic that forces the human brain to think in negitive negitive...like i dont like not going without having a car...did i mean i DO like it when i dont have a car...or did i mean i DONT like it when i do have a car....