Simulating AI in C++

I'm building a MUD in C++. I'm attempting to create something similar to AI but I'm not sure the best way to go about it. Here's a simple example:

Warrior Mob (WM) is fighting Ranger Mob (RM). WM has 5 different maledictions (WMM1, WMM2, WMM3, WMM4, WMM5) it can inflict on RM. RM can respond in 5 different ways (RMR1, RMR2, RMR3, RMR4, RMR5) depending on which of the 5 maledictions WM has used. I know I could use a bunch of if/then statements:

if(WMM1) then RMR1
if(WMM1 && WMM3) then RMR3
if(WMM1 && WMM4 || WMM5) then RMR4
etc...

but even with only 10 variables that becomes unmanageable quickly. The skill set on any given character is upwards of 45+.

Is there a better way?
Use a lookup table.
Aren't lookup tables restricted to 3 dimensions? What if I need to check for more than 3 criteria?
Do you know what lookup tables are?
If yes, why do you think that they are restricted to 3 dimensions?

If there are several dependencies you might use trees, like:

http://www.boost.org/doc/libs/1_58_0/doc/html/property_tree.html

The good thing is that you can define the dependencies in a separate file (like XML or other formats)
Topic archived. No new replies allowed.