Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var/tournament/tournamentBot = new()
- var/tmp/tournamentCheck = FALSE
- mob/var/tmp/inTournament = FALSE
- mob/Logout()
- ..()
- tournamentBot.removeParticipant(src)
- mob/tournament/verb
- register()
- tournamentBot.addParticipant(src)
- resign()
- tournamentBot.removeParticipant(src)
- mob/Stat()
- ..()
- statpanel("Tournament")
- stat(tournamentCheck)
- stat("-")
- stat("Fighter One : ", tournamentBot.fighter_one)
- stat("Fighter Two : ", tournamentBot.fighter_two)
- stat("-")
- stat("Participants : ")
- for(var/mob/fighter in tournamentBot.participants)
- stat(fighter)
- /*
- Testing :
- client/verb/start_tournament()
- tournamentBot.checkTournament()
- */
- tournament
- parent_type = /obj
- name = "@Tournament Bot"
- var/tmp/fighter_one = null
- var/tmp/fighter_two = null
- var/tmp/list/participants = list()
- New()
- ..()
- spawn(1) src.checkTournament()
- proc/reward(mob/winner)
- /* winner.mrei = winner.mrei * 1.5
- winner.mattack = winner.mattack * 1.5
- winner.attack = winner.mattack
- winner.mhealth = winner.mhealth * 1.5
- winner.mdefence = winner.mdefence * 1.4
- winner.defence = winner.mdefence
- entries.Remove(winner)
- winner.loc=locate(150,147,1)*/
- proc/removeParticipant(mob/player)
- if(player in src.participants)
- player.verbs -= typesof(/mob/tournament/verb)
- src.participants -= player
- player.inTournament = FALSE
- proc/addParticipant(mob/player)
- if(player.inTournament) return
- src.participants += player
- player.inTournament = TRUE
- proc/clearTournament()
- src.participants = null
- for(var/mob/player in world)
- if(player.client)
- player.verbs -= typesof(/mob/tournament/verb)
- player.inTournament = FALSE
- tournamentCheck = FALSE
- return
- proc/checkTournament()
- set background = 1
- while(src)
- if(tournamentCheck)
- sleep(36000)
- continue
- if(!tournamentCheck)
- src.startupTournament()
- sleep(36000)
- proc/checkRound(mob/killer, mob/victim)
- if(!killer.client||!victim.client) return
- if(killer in src.participants||victim in src.participants)
- if(src.fighter_one!=killer||src.fighter_one!=victim)
- if(src.fighter_two!=killer||src.fighter_two!=victim)
- world << "[src] : [killer] and [victim] have been disqualified!"
- src.removeParticipant(killer)
- src.removeParticipant(victim)
- proc/newRound()
- var/mob/fighterOne = pick(src.participants)
- var/list/configFighterTwo= list()
- configFighterTwo.Copy(src.participants)
- configFighterTwo -= fighterOne
- var/mob/fighterTwo = pick(configFighterTwo)
- if(!fighterOne&&!fighterTwo)
- world << "[src] : There appears to be no participants!"
- src.clearTournament()
- return
- if(fighterOne&&!fighterTwo)
- world << "[src] : We have a winner! Congratulations [fighterOne]!"
- src.reward(fighterOne)
- src.clearTournament()
- return
- if(fighterOne==fighterTwo)
- world << "[src] : We have a winner! Congratulations [fighterOne]!"
- src.reward(fighterOne)
- src.clearTournament()
- return
- if(fighterTwo&&!fighterOne)
- world << "[src] : We have a winner! Congratulations [fighterTwo]!"
- src.reward(fighterTwo)
- src.clearTournament()
- return
- world << "[src] : The next fight begins! [fighterOne] versus [fighterTwo]!"
- src.fighter_one = fighterOne
- src.fighter_two = fighterTwo
- proc/startupTournament()
- if(tournamentCheck) return
- for(var/mob/player in world)
- if(player.client) player.verbs += typesof(/mob/tournament/verb)
- world << "[src] : The tournament registration has started! Click <b>Register</b> to join!"
- spawn(300) src.startTournament()
- proc/startTournament()
- if(src.participants.len<2)
- world << "[src] : Cannot start a tournament with less than 2 participants."
- tournamentCheck = FALSE
- src.clearTournament()
- return
- world << "[src] : Tournament registration has now ended. We have [src.participants.len] fighters!"
- for(var/mob/player in world)
- if(player.client)
- player.verbs -= typesof(/mob/tournament/verb)
- world << "[player]"
- if(src.participants.len<2)
- world << "[src] : Not enough participants anymore. Tournament is now ending."
- tournamentCheck = FALSE
- src.clearTournament()
- return
- spawn(300)
- src.newRound()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement