Battle AI Part 4 - SPELL CASTING

[size=75]Continuing the Battle AI discussion threads (links to the other topics here).[/size]

[size=150]Battle AI Part 4 - SPELL CASTING[/size]

4.A. SPELL CASTING – CREATURES

  1. Archangels – rules to follow

  2. Master Genies – rules to follow

  3. Pit Lords – rules to follow

  4. Ogre Magi – rules to follow

  5. Elementals (Protection from elements) – rules to follow

  6. Faerie Dragons. They represent a special case, as their attacks fall under the rules of any shooter of a hero with Golden Bow (i.e.: nearby enemy doesn’t block the ability to cast, so that also shouldn’t affect their choice between cast & melee). But we could already say that as Basic rule we can have “always cast, looking for maximum damage” BUT “avoid hitting friendly creatures (in case of area spells)”. The Advanced rule would calculate MPA and try to block shooters if melee is chosen (see 3.B. MELLE rule #1). The Expert rules would add bonuses in case of blocking shooters but also vulnerabilities in case melee moves within the range of more enemies (but these are all similar with the general rules for range creatures).

(WoG creatures to follow)

4.B. SPELL CASTING – HEROES

This is probably the topic on which most “ink” will flow in the future. I haven’t really started to analyze this yet, but as very Basic rules, we could consider the following in the beginning:

  1. AI should cast every turn as soon as possible
  2. If at least 5 targets applicable, cast one of the top 5-10 mass buff/debuff spells (if available; list to be defined, but would probably include Prayer, Haste, Slow, Bless and a couple of others).
  3. Else go for the most damage inflicting spell (include nearby hexes in damage calculation of area spells)
  4. Else go for another spell (hierarchy to be defined until the implementation of the Advanced Rules)
  5. Do not re-cast a spell if still effective on (at least one of) the target creatures

But – as said – I didn’t analyze this properly to see if even these basic rules are good enough. Advanced/Expert rules to follow.

Same as for other threads, if you have thoughts/suggestions, feel free to share then, no need to wait until I find time to fill in the gaps above. :stuck_out_tongue:

If it doesn’t work that way yet, every spell should have a few parameters determining to what group it belongs. It’s more flexible than list as will allow adding simple spells in the future, with AI support already.

Coding the above sequence sounds trivial, but the choice of optimal spell certainly is not as many of them have different and very special effects.
I believe optimal solution here is another application of Expert System. This would relate to my old suggestion that Spell should be an instance of BonusSystemNode. Anyway, it’s the last thing to do now.