Feedback on my combat system concept

flyinian

Member
I've been trying to create a combat system for the last few days.

I'm also learning about arrays, lists and maps so, it's Abit more challenging.



How difficult would this be?:


First,

When player/enemy attacks, randomly pick between groups 1 - 10. Or more than 1 group.

Then,

Once the group(s) is randomly selected, randomly select sub group(s) of the selected group(s).

After that,

Apply a predetermined amount of damage to the sub group's health.

Lastly,

Update all of the stats of the groups due to change in health.


Groups are the categories.

Sub groups are the units .

Health is the quantity in troops.

I also have to determine if the groups and sub groups have health and if they don't, they have to reroll the random selection of the group/subgroup until it finds one with health to subtract from. If all groups/sub groups have no health, then battle is over...along with various seen and unforseen things.

The hardest for me to do is the random selection and rerolling group selection, due to arrays/lists/maps.


I guess I'm mainly looking for feedback. Or possibly a much easier work around for a beginner.
 

YanBG

Member
Each time there is Attack, go through the enemy groups and if there is no hp skip to the next, eventually end the battle. If there is hp, commence the attack and break the for loop.
To pick random group, you only need to know how many of them have hp or are possible target and use irandom(their amount - 1), fill a list with them or array that has no entries for the ones without any hp left.
 
Top