Im working in the implementation of the combat system for my RPG (made with Unity3d and c#), which depends on the item system, skill system, etc. The idea is to have real time pausable combat, so my initial idea was to have a queue of actions. An action can be a weapon attack or an spell, and can be created by the AI or the player input during combat. But when started to work on the actual implementaiton I thought that perhaps my system was too complex.
Described in pseudocode, it something like this:
On the Update() of each entity (including player)
if queue is not empty
get the first action if cooldown timer expired and it is loopable, else, remove and get next
is it an item action?
if the item is a weapon then get the item dmg properties, the target protect properties and decide if it is a succesful attack, dmg, etc
if the item is something else, decide what to do
is it a spell cast?
then do the spell stuff, etc
set the cooldown timer
The advantage I see: the item class is generic and can contain any item, because it just hold properties, doesnt knows how to actually use the item.
The disadvantage: the same. Also, the gameplay code becomes complex (you have to compare all the item damage types against all the target protection types). The action class is a mess: it must contain all possible combinations of actions: item on actor (like a sword attack), spell on actor, and any other I can figure out later.
Is there any other more optimal solution to this?