I'm working on a turn based battle system, wondering if something like this is possible;
I'd like to have, say, 5 string instance variables per enemy called 'Attack Slot 1' through 'Attack Slot 5'.
The slots/string variables would each contain strings of different attack names, which in turn would be paired to corresponding functions with those names that would then trigger.
When it's an enemy's turn to attack, a random number (1 - 5) generates and calls whatever function's name appears in that specific enemy's corresponding attack slot.
For example;
Enemy A may have the 'Punch' function listed in it's Attack Slot 1, while enemy B may have 'Kick' listed under it's attack slot 1. These would always be different depending on the type of enemy that is attacking, so I'm trying to develop universal attack calling logic that works regardless of the type of enemy via family instance variables.
I'm digging into mapping functions and 'map function to string' but I'm getting confused as to how I could actually make that reference the string name in the enemy sprite's instance variables. Maybe I should instead be looking at arrays?
I've attached a screengrab of how I'm trying to attempt solving this so far.
Any help is appreciated, thanks gang.