ID:142209
 
Code:
    proc
StartChecking(mob/A,mob/B) // this procedure checks if the people logged out of the battle or just
spawn while(src) // disappeared for some reason
if(!A) LogOutBattle(A, B)
else if(!B) LogOutBattle(B, A)
sleep(25) // we really don't need to loop it frequently, because it isn't really showable
StartBattle(mob/A, mob/B)
if(A.agi==B.agi)
/* // removed as of version 2, thanks Crispy
var/list/Rand = list(A, B)
var/a = rand(1,2)
while(a--)
Rand.Swap(1,2)
*/


if(prob(50)) // if a 1/2 chance is come
var/tempvar = A // save a temporary variable for A
A = B // and swap ahead
B = tempvar // and restore the A to the B, making a successful swap
EngageBattle(A, B) // let the battle begin
else
if(A.agi > B.agi) // the faster, the better
EngageBattle(A, B)
else
EngageBattle(B, A) // early bird gets to kill first


EngageBattle(mob/A,mob/B)
/* if(A.def) // defending only lasts one turn
A << "<font color = #9a5927>You stop defending."
B << "<font color = #9a5927>[A] stops defending."
A.def -= 50*/

if(A.stunned)
B<<"[A] is stunned!"
B<<"[A] is forced to skip his turn!"
EngageBattle(B,A)
return

if(A.client) // if somebody is posessing A, let them control themselves

var/list/commands = list("Fight","Item","Run")

var/command = input(A, "Please select a command.","Command?") in commands // Base commands to use from
switch(command)
if("Fight")
FightBattle(A,B)

if("Item")
var/list/L = A.contents
if(L.len)
var/item/I = input(A, "Pick an item to use","Item") in L + "Back"
if(I=="Back")
EngageBattle(A,B)
else
I.BattleUse(A)

EngageBattle(B,A) // your turn is done, start the battle again, except backwards.


else
A << "You do not have any items to use."
EngageBattle(A,B)

if("Run")
RunFromBattle(B,A)
else // otherwise, do the monster intelligence
MonsterBattle(B,A)

FightBattle(mob/A,mob/B)
var/list/commands = list("Attack","Skill",/*"Defend",*/"Wait","Change Party Members")
var/command = input(A, "Please select a command.","Command?") in commands
switch(command)
if("Change Party Members")
if(A.party.len)
for(var/mob/M in A.party)
if(M.hp)
Partymember_forcecall(B,A)
else
A<<"Your other party members are all dead!"
else
A<<"You have no party members."
FightBattle(A,B)
if("Attack")
if(B.Status_Check(B))
EngageBattle(B,A)

A.attack(B)
if(B.stunned)
B.stunturns += 1
if(B.stunturns == 5)
B.stunturns = 0
B.stunned = 0
A<<"[B] is no longer stunned!"
B<<"You are no longer stunned!"
if(B.DeathCheck(A))
EndBattle(A, B, "win")
else
EngageBattle(B, A)


if("Skill")
var/list/L = A.skills
if(L.len)
var/battle/battleskill/I = input(A, "Pick a skill to use","Skill") in L + "Back"
if(I=="Back")
EngageBattle(A,B)
else
var/path = I.skillpath
call(A,path)(B)
if(B.stunned)
B.stunturns += 1
if(B.stunturns == 5)
B.stunturns = 0
B.stunned = 0
A<<"[B] is no longer stunned!"
B<<"You are no longer stunned!" // the call() procedure saves the day so there is no long if() tree
if(B.DeathCheck(A)) // if they're dead, stop the battle
EndBattle(A, B, "win")
else
EngageBattle(B,A) // otherwise, keep on going


else
A << "You don't have any skills to use."
FightBattle(A, B)
/* if("Defend")
A << "<font color = #9a5927>You start to defend."
B << "<font color = #9a5927>[A] starts to defend."
A.def += 50 // half damage next turn
sleep(10)
EngageBattle(B, A)*/



if("Wait")
A << "You decide to wait the turn."
B << "[A] decides to wait the turn."
sleep(10)
EngageBattle(B, A)


Problem description:
I am not sure where the problem is but for some reason instead of going throught the procedures smoothly it starts the battle and automatically uses your first skill until you win and the enemy cant attack. Why I dont know...