ID:144975
 
Code:
mob/proc/Fire3()
//blows a ball of Fire from his mouth that engulfs \icon[AttChoice.Face][AttChoice] in a burst of flames!
if (usr.Energy < 5)
usr << "You don't have enough energy for this skill!"
usr.SelectedCommand = 0
return
var/list/PlayerList = new()
for (var/mob/M in world)
if (usr.BattleNum == M.BattleNum)
if (usr.TeamNum == 0 || M.TeamNum != usr.TeamNum)
if (usr != M && M.Hp > 0)
PlayerList += M
PlayerList += "Cancel"
var/mob/Target = input("Who do you wish to attack?", "Katon: Housenka no Jutsu", null) in PlayerList
if(Target == "Cancel")
usr.SelectedCommand = 0
return
var/lvl = round(usr.Level/3)
if (lvl <= 0)
lvl=1
var/Damage = roll("[lvl]d10") + usr.Wisdom + round(usr.Nin/3) - round(Target.Wisdom/3)
usr.Energy -= 5
var/AttackSpeed = rand(1, 20) + usr.Hit + Luck + usr.Level
var/DefenseSpeed = rand(1, 20) + Target.Evasion + round(Target.Luck / 2) + round(Target.Level/2)
if (AttackSpeed < DefenseSpeed)
for (var/mob/M in world)
if (M.BattleNum == BattleNum)
M << "\icon[usr.Face][usr] blows a ball of Fire from his mouth at \icon[Target.Face][Target], but [Target] dodges the blow!"
else if (Damage <= 0)
for (var/mob/M in world)
if (M.BattleNum == usr.BattleNum)
M << "\icon[usr.Face][usr] blows a ball of Fire from his mouth at \icon[Target.Face][Target], but the fire seems ineffective!"
else
for (var/mob/M in world)
if (M.BattleNum == usr.BattleNum)
M << "\icon[usr.Face][usr] blows a ball of Fire from his mouth that engulfs \icon[Target.Face][Target] in a burst of flames! \[[num2text(Damage,50)] Damage\]"
Target.Hp -= Damage
usr.SelectedCommand = 0
usr.IsTurn = 0


Problem description: above is the code I started with. the problem is pretty much everything. I cant figure out how to target one opponent do hit calculations then deal them damage and then go on to the next. anyone that could shed some light on this I would be greetful. (note: this is built currently to target one opponent.)

Don't use usr in procs.

Also, the way you're doing that is incredibly wrong.

For a turn based battle system, you should have some data structure (A datum) that keeps track of pertinent variables for everyone concerned, and then some sort of main battle proc is the way to go about it.
In response to Jp
There is a main battle proc though I dont know how could use it for this. It doesnt do everything though. As for the way its built this is kind of my first turn based (done arena style).
I could use some better help with it than my structure is bad.
In response to Sleinth
I'm afraid there really isn't anything I'm going to do. Basically, you will get nowhere with it written like that. And I'm not going to delve into the madness of it in order to paste together some hack.

Honestly, a re-write is in order.