battle_sorters // these objects sort out battles, so it should only be deleted when the battle ends
parent_type = /obj
var
mob/A // player one is A, while player 2 is B (P1 would be you, and P2 would be the monster)
mob/B
mob/turn1
mob/turn2
mob/turn3
mob/turn4
mob/turn5
mob/turn6
New(location, mob/a, mob/b)
..()
src.A = a
src.B = b
if(A&&B) // if they are both there, start the battle
StartBattle(A,B)
StartChecking(A, B)
proc
StartChecking(mob/A, mob/B,mob/C,mob/D,mob/E,/mob/F) // 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!"
FightBattle(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(A, B)
else // otherwise, do the monster intelligence
MonsterBattle(A, B)
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")
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)
MonsterBattle(mob/A, mob/B) // fun monster AI
if(A.stunned)
B<<"[A] is stunned!"
B<<"[A] is forced to skip his turn!"
FightBattle(B,A)
return
if(A.hp<=A.maxhp/4) // if the monster is low on HP
var/list/L = A.skills // get the skills list
for(var/battle/battleskill/item in L) // remove all non-support items
if(!item.supportuse)
L -= item
if(L.len) // if there are any support skills
var/battle/battleskill/I = pick(L) // use a random one
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!"
if(B.DeathCheck(A))
EndBattle(A, B, "win")
else
EngageBattle(B, A)
else // otherwise, the monster will attempt to run
RunFromBattle(A, B)
else // if they are all alright
var/list/L = A.skills
for(var/battle/battleskill/item in L)
if(item.supportuse) // remove all support spells. no need for any of them.
L -= item
if(L.len) // check if they have any
var/battle/battleskill/I = pick(L)
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!"
if(B.DeathCheck(A))
if(B.party.len)
for(var/mob/N in B.party)
if(N.hp >= 0)
Partymember_forcecall(A,B)
else
EndBattle(A,B, "win")
else
EndBattle(A,B, "win")
else
EngageBattle(B, A)
else // otherwise attack normally
A.attack(B)
if(B.DeathCheck(A))
if(B.party.len)
for(var/mob/M in B.party)
if(M.hp >= 0)
Partymember_forcecall(A,B)
else
EndBattle(A,B, "win")
else
EndBattle(A,B, "win")
else
EngageBattle(B, A)
Question
I am trying to make an MMO where joining parties is almost Necessary to defeat monster and enemies.But how would i make it so its more of a team battle then a 1v1 duel
for instance something along the lines of...
mob/turn1
mob/turn2
mob/turn3
mob/turn4
mob/turn5
mob/turn6
//battle proc
proc
Battle(mob/a,mob/d,mob/e,mob/f)
//and you mob/a attacks mob/d||e||f