1. ## Combat system

Ok so i'm making a text based Rpg game, but the one stubling block on is the combat system.

At the moment i have a general idea of what i want to happen.

Points
Triangle attack system
e.g Magic > Block > Attack > Magic
Turn based system between player and mob
Option to leave combat on your go.
Option to use different spells if possible.

Now the way have thought about doing it is to use if possible is

Code:
Write (Pick an attack option block, magic, attack
choice = uppercase choice

Randomrange mob(3,10)     Used to random to different mobs e.g skeleton and zombie
for mob[x] get mob stats from defined mob health [need help here]

Case choice of
Magic:Magic
block:Block              with the magic block and attack being a function of somekind?
Attack:attack

Mob attack = randomrange (1,3) 1:block 2:Attack 3:magic
If mobattack= block and playerattack = magic then
Player = hit mob
If mobattack = block and playerattack = attack then
mob = hit player
If Mobattack = block and playerattack = block then
draw

If mob attack = attack and player attack = magic then
mob = hit player
If mobattack = attack and player attack = block then
player = hit mob
If mobattack = attack and player attack = attack then
Mob = hit player
player = hit mob

If mobattack = magic and playerattack = magic then
mob = hit player
player = hit mob
if mobattack = magic and playerattack = block then
mob = hit player
if mobattack = magic and playerattack = attack then
player = hit mob
In this i want the mob's hp to be decided from a procedure or function where i can have each mob defined.

I was just wondering if you guys think this system would work or not as pesudocode and how well you think it would work.

2. For clarity i'd make another function (still pseudo):

Code:
function IsCountered(action, defence): boolean
result = true
if action = attack then
if (defence = magic) or (defence = attack) then
result = false
else if action = magic then
if (defence = magic) or (defence = block) then
result = false
else if (action = block) and (defence = attack) then
result = false

Main app:

player_attack_blocked = IsCountered(player_attack, mob_attack)
mob_attack_blocked = IsCountered(mob_attack, player_attack)
if not player_attack_blocked then
hit mob
if not mob_attack_blocked then
hit player
if player_attack_blocked and mob_attack_blocked then
draw

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•