Let's presume that we have a PVP fight scene, where 1 or 2 heroes, are fighting 3 monsters.
The monsters that the heroes are fighting are the following:
Skeleton (2 of this monster)
Death Knight (1 of this monster)
Whenever a hero attacks, the defense of the monster is reduced from the damage the hero deals.
The heroes are the same, they can use one of two attacks, an attack, that deals 1 damage to every enemy, or an attack, that deals 3 damage to a single enemy.
The objective of the heroes are to sustain as few damage as possible from the monsters.
If a single hero faces this threat, the optimal move would be, to use it's mass attack, to kill the two Skeletons first with one shot, and then kill the Death Knight in the following two turns, this way sustaining a total damage of: (3)+(3)=6. (if the single hero tries to kill the Death Knight first, he needs two turns to do so, so he will sustain (3+1+1)+(1+1)=7 damage
But if two heroes are present, it would be more wiser for the heroes, to gang up on the Death Knight firstly, with two single attacks(which eliminate him), and then either clear out the skeletons with a single mass attack, or with two simple attacks. This way the total damage sustained would be (1+1)=2. (if they clear the Skeletons with a single mass attack, and the other hero attacks the Death Knight, they would sustain a total of (3)=6 damage, as they would still need a second turn to kill the Death Knight.)
NOTE: the parantheses are the damages sustained in a turn
How could I find an algorithm, that would tell my heroes which attack is more cost-worthy for them to use? I could try brute forcing it, but in larger scenarios (ie: 4 heroes vs 9 different monsters) it just too resource intensive to achieve.
This would be used in a little script, which makes some calculations for me, which will be used to balance a board game that I am in the progress of making. If this isn't the correct stack site for my question, please point me in the correct direction. Note: I only need an algorithm, which I should use, no programming advice needed for the completion of the script.
EDIT 1: Based on this example, I could say that the correct move is always the one, which kills the most monsters in a single case, but this isn't correct, if we increase the Death Knights damage, so the correct move must have a score which is calculated using the monsters attack, and the number of monsters that can be killed in a single turn. Am I right in assuming this?