Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.19 KB | None | 0 0
  1.  
  2. var/tournament/tournamentBot = new()
  3. var/tmp/tournamentCheck = FALSE
  4. mob/var/tmp/inTournament = FALSE
  5.  
  6. mob/Logout()
  7. ..()
  8. tournamentBot.removeParticipant(src)
  9.  
  10. mob/tournament/verb
  11. register()
  12. tournamentBot.addParticipant(src)
  13. resign()
  14. tournamentBot.removeParticipant(src)
  15.  
  16. mob/Stat()
  17. ..()
  18. statpanel("Tournament")
  19. stat(tournamentCheck)
  20. stat("-")
  21. stat("Fighter One : ", tournamentBot.fighter_one)
  22. stat("Fighter Two : ", tournamentBot.fighter_two)
  23. stat("-")
  24. stat("Participants : ")
  25. for(var/mob/fighter in tournamentBot.participants)
  26. stat(fighter)
  27.  
  28. /*
  29.  
  30. Testing :
  31.  
  32. client/verb/start_tournament()
  33. tournamentBot.checkTournament()
  34.  
  35. */
  36. tournament
  37. parent_type = /obj
  38. name = "@Tournament Bot"
  39. var/tmp/fighter_one = null
  40. var/tmp/fighter_two = null
  41. var/tmp/list/participants = list()
  42.  
  43. New()
  44. ..()
  45. spawn(1) src.checkTournament()
  46.  
  47. proc/reward(mob/winner)
  48. /* winner.mrei = winner.mrei * 1.5
  49. winner.mattack = winner.mattack * 1.5
  50. winner.attack = winner.mattack
  51. winner.mhealth = winner.mhealth * 1.5
  52. winner.mdefence = winner.mdefence * 1.4
  53. winner.defence = winner.mdefence
  54. entries.Remove(winner)
  55. winner.loc=locate(150,147,1)*/
  56.  
  57. proc/removeParticipant(mob/player)
  58. if(player in src.participants)
  59. player.verbs -= typesof(/mob/tournament/verb)
  60. src.participants -= player
  61. player.inTournament = FALSE
  62.  
  63. proc/addParticipant(mob/player)
  64. if(player.inTournament) return
  65. src.participants += player
  66. player.inTournament = TRUE
  67.  
  68. proc/clearTournament()
  69. src.participants = null
  70. for(var/mob/player in world)
  71. if(player.client)
  72. player.verbs -= typesof(/mob/tournament/verb)
  73. player.inTournament = FALSE
  74. tournamentCheck = FALSE
  75. return
  76.  
  77. proc/checkTournament()
  78. set background = 1
  79. while(src)
  80. if(tournamentCheck)
  81. sleep(36000)
  82. continue
  83. if(!tournamentCheck)
  84. src.startupTournament()
  85. sleep(36000)
  86.  
  87. proc/checkRound(mob/killer, mob/victim)
  88. if(!killer.client||!victim.client) return
  89. if(killer in src.participants||victim in src.participants)
  90. if(src.fighter_one!=killer||src.fighter_one!=victim)
  91. if(src.fighter_two!=killer||src.fighter_two!=victim)
  92. world << "[src] : [killer] and [victim] have been disqualified!"
  93. src.removeParticipant(killer)
  94. src.removeParticipant(victim)
  95.  
  96. proc/newRound()
  97. var/mob/fighterOne = pick(src.participants)
  98. var/list/configFighterTwo= list()
  99. configFighterTwo.Copy(src.participants)
  100. configFighterTwo -= fighterOne
  101. var/mob/fighterTwo = pick(configFighterTwo)
  102. if(!fighterOne&&!fighterTwo)
  103. world << "[src] : There appears to be no participants!"
  104. src.clearTournament()
  105. return
  106. if(fighterOne&&!fighterTwo)
  107. world << "[src] : We have a winner! Congratulations [fighterOne]!"
  108. src.reward(fighterOne)
  109. src.clearTournament()
  110. return
  111. if(fighterOne==fighterTwo)
  112. world << "[src] : We have a winner! Congratulations [fighterOne]!"
  113. src.reward(fighterOne)
  114. src.clearTournament()
  115. return
  116. if(fighterTwo&&!fighterOne)
  117. world << "[src] : We have a winner! Congratulations [fighterTwo]!"
  118. src.reward(fighterTwo)
  119. src.clearTournament()
  120. return
  121. world << "[src] : The next fight begins! [fighterOne] versus [fighterTwo]!"
  122. src.fighter_one = fighterOne
  123. src.fighter_two = fighterTwo
  124.  
  125. proc/startupTournament()
  126. if(tournamentCheck) return
  127. for(var/mob/player in world)
  128. if(player.client) player.verbs += typesof(/mob/tournament/verb)
  129. world << "[src] : The tournament registration has started! Click <b>Register</b> to join!"
  130. spawn(300) src.startTournament()
  131.  
  132. proc/startTournament()
  133. if(src.participants.len<2)
  134. world << "[src] : Cannot start a tournament with less than 2 participants."
  135. tournamentCheck = FALSE
  136. src.clearTournament()
  137. return
  138. world << "[src] : Tournament registration has now ended. We have [src.participants.len] fighters!"
  139. for(var/mob/player in world)
  140. if(player.client)
  141. player.verbs -= typesof(/mob/tournament/verb)
  142. world << "[player]"
  143. if(src.participants.len<2)
  144. world << "[src] : Not enough participants anymore. Tournament is now ending."
  145. tournamentCheck = FALSE
  146. src.clearTournament()
  147. return
  148. spawn(300)
  149. src.newRound()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement