drool66 wrote:It is done in setup_ai_combat_data() and written to ai_combat_data[ ][ ], then copied from there to ai_combat_attack_power[ ] and modified with pumpable_power[ ] in TENTATIVE_ai_speculate_on_combat().
For cards like
Fervent Charge "Whenever a creature you control attacks, it gets" it can be done like you say, using existing EVENT_CHECK_PUMP and pumpable_power[] and pumpable_toughness[]. But for cards like
Kavu Mauler "Whenever ~ attacks, it gets ... until end of turn for each other attacking" , or
Rubblebelt Raiders "Whenever ~ attacks, put a +1/+1 counter on it for each attacking creature you control", or
Marton Stromgald "Whenever ~ attacks, other attacking creatures get +1/+1 until end of turn for each attacking creature other than ~." or
Fangren Pathcutter which pumps abilities "Whenever ~ attacks, attacking creatures gain trample until end of turn." what we have already doesn't work.
drool66 wrote:So it would seem to me this change is redundant and effectively doubles the effects of check_abilities_power / _toughness.
With my changes the above cards and other similar work for AI. In my tests I didn't see any doubling effect for check_abilities_power / _toughness, or EVENT_CHECK_PUMP and EVENT_POW_BOOST / EVENT_TOU_BOOST.
drool66 wrote:but I would still be very careful modifying how some of these basic functions work, especially without checking how Shandalar does it
Shandalar doesn't have AI code for these cards and such clause so I can't get any help from there.
drool66 wrote:With that said, check_abilities_power / _toughness are integers and not bitfields, so is there a reason you're combining them using bitwise OR? I'm not sure I know how "a = b |= c" is computed I don't think a = b |= c does what you want it to do.
I just tried any idea that came into my mind and this happened to work (mostly) so I don't know how it works, but it mostly works as I want it to work. That's the reason why I asked for your help and test scenarios that this code would fail because my tests revealed not so good behaviour rarely and only by AI thinking it had 1 more point of power than it would really get. And I prefer this far from not having AI get these cards at all.
With that said I will still keep an eye for weird AI attack decisions / behaviors while I play-test as I always do and if we proceed for an update maybe others can chip in and report weird AI attacks. drool66 wrote:I'm also wondering why pumpable_power and pumpable_toughness are added up from among all creatures for each player, and then the total for all creatures is applied to the power & toughness (in ai_combat_attack_power / _toughness) for each creature. Am I missing something?
Where do you see this as I don't see any code for pumpable_power and pumpable_toughness in engine.c or in main.c?