Battle_Control
var
Player_Limit
Phase_Count
list
Players = new
Anyways, I want to keep everything simple with simplistic methods of keeping track (I've made numerous attempts at such a system only to confuse myself with too many variables to continue before), so procedures as simplistic and easy as adding and removing players.
proc
Add_Player(mob/m)
if(Player_Limit && !(Player_Limit < Players.len)) //if there's a limit and it has been reached
world << "Player Limit has been reached."
return
Players += m
world << "[m] [m.clan] has joined the battle"
Remove_Player(mob/m)
if(m in Players)
Players -= m
Anyways, onto the main point; I'm trying to decide upon the best way for options to appear for the user, after the "next_phase" procedure is run.
Next_Phase()
Phase_Count ++
world << "Phase [Phase_Count]"
var/list/turn_order = Find_Turn_Order(Players)
world << "It is now [turn_order[1]]'s turn!"
proc
Find_Turn_Order(list/players)
var/list/turn_order = new
var/mob/temp_lowest
while(players.len)
for(var/mob/m in players)
if(!(temp_lowest) || m.delay < temp_lowest.delay)
temp_lowest = m
//once the above loop is finished we have determined the lowest delay of a player.
turn_order += temp_lowest //add the player to the list in that order
players -= temp_lowest //remove from list to find next lowest delay... repeat.
temp_lowest = null
return turn_order
Is the easiest and best way to just give the determined player who was selected to have their turn next a variable such as "MyTurn = 1"? Or is there a more effective way to doing this and keeping track of it through a variable?
I was thinking maybe on "turn_phase" it could "call" a variable procedure if the mob has one, which would give access to all their "battle" and "movement" procedures (and the reason I quote these as they have more than one connotation).
What would be the easiest way to either go about one of the above ideas, or perhaps an easier method? I'm not completely familiar with how I would define these "battle" and "movement" procedures and would like some feedback. Thanks :)
P.S. If any of the code is less than efficient, or is wrong, don't hesitate to point it out.