Jass documentation Database

JASS Documentation Database REFORGED


Results for the query "MeleeTournamentFinishNowRuleA" as a "function"

The search keyword must be a single word (no spaces).

Function MeleeTournamentFinishNowRuleA

Line: 9773
Location: blizzard.j
Constant? no
Type: function
Arguments: integer multiplier
Returns: nothing

Preview

Extra spaces may have been removed from the original file to show the function in a comfortable way.
  1. function MeleeTournamentFinishNowRuleA takes integer multiplier returns nothing
  2.     local integer array playerScore
  3.     local integer array teamScore
  4.     local force array   teamForce
  5.     local integer       teamCount
  6.     local integer       index
  7.     local player        indexPlayer
  8.     local integer       index2
  9.     local player        indexPlayer2
  10.     local integer       bestTeam
  11.     local integer       bestScore
  12.     local boolean       draw
  13.  
  14.     // Compute individual player scores
  15.     set index = 0
  16.     loop
  17.         set indexPlayer = Player(index)
  18.         if MeleeWasUserPlayer(indexPlayer) then
  19.             set playerScore[index] = GetTournamentScore(indexPlayer)
  20.             if playerScore[index] <= 0 then
  21.                 set playerScore[index] = 1
  22.             endif
  23.         else
  24.             set playerScore[index] = 0
  25.         endif
  26.         set index = index + 1
  27.         exitwhen index == bj_MAX_PLAYERS
  28.     endloop
  29.  
  30.     // Compute team scores and team forces
  31.     set teamCount = 0
  32.     set index = 0
  33.     loop
  34.         if playerScore[index] != 0 then
  35.             set indexPlayer = Player(index)
  36.  
  37.             set teamScore[teamCount] = 0
  38.             set teamForce[teamCount] = CreateForce()
  39.  
  40.             set index2 = index
  41.             loop
  42.                 if playerScore[index2] != 0 then
  43.                     set indexPlayer2 = Player(index2)
  44.  
  45.                     if PlayersAreCoAllied(indexPlayer, indexPlayer2) then
  46.                         set teamScore[teamCount] = teamScore[teamCount] + playerScore[index2]
  47.                         call ForceAddPlayer(teamForce[teamCount], indexPlayer2)
  48.                         set playerScore[index2] = 0
  49.                     endif
  50.                 endif
  51.  
  52.                 set index2 = index2 + 1
  53.                 exitwhen index2 == bj_MAX_PLAYERS
  54.             endloop
  55.  
  56.             set teamCount = teamCount + 1
  57.         endif
  58.  
  59.         set index = index + 1
  60.         exitwhen index == bj_MAX_PLAYERS
  61.     endloop
  62.  
  63.     // The game is now over
  64.     set bj_meleeGameOver = true
  65.  
  66.     // There should always be at least one team, but continue to work if not
  67.     if teamCount != 0 then
  68.  
  69.         // Find best team score
  70.         set bestTeam = -1
  71.         set bestScore = -1
  72.         set index = 0
  73.         loop
  74.             if teamScore[index] > bestScore then
  75.                 set bestTeam = index
  76.                 set bestScore = teamScore[index]
  77.             endif
  78.  
  79.             set index = index + 1
  80.             exitwhen index == teamCount
  81.         endloop
  82.  
  83.         // Check whether the best team's score is 'multiplier' times better than
  84.         // every other team. In the case of multiplier == 1 and exactly equal team
  85.         // scores, the first team (which was randomly chosen by the server) will win.
  86.         set draw = false
  87.         set index = 0
  88.         loop
  89.             if index != bestTeam then
  90.                 if bestScore < (multiplier * teamScore[index]) then
  91.                     set draw = true
  92.                 endif
  93.             endif
  94.  
  95.             set index = index + 1
  96.             exitwhen index == teamCount
  97.         endloop
  98.  
  99.         if draw then
  100.             // Give draw to all players on all teams
  101.             set index = 0
  102.             loop
  103.                 call ForForce(teamForce[index], function MeleeDoDrawEnum)
  104.  
  105.                 set index = index + 1
  106.                 exitwhen index == teamCount
  107.             endloop
  108.         else
  109.             // Give defeat to all players on teams other than the best team
  110.             set index = 0
  111.             loop
  112.                 if index != bestTeam then
  113.                     call ForForce(teamForce[index], function MeleeDoDefeatEnum)
  114.                 endif
  115.  
  116.                 set index = index + 1
  117.                 exitwhen index == teamCount
  118.             endloop
  119.  
  120.             // Give victory to all players on the best team
  121.             call ForForce(teamForce[bestTeam], function MeleeDoVictoryEnum)
  122.         endif
  123.     endif
  124.  
  125. endfunction
"That noise? That’s a bad noise." Hmmm... there's no info about this keyword... be the first one in contribute with the keyword MeleeTournamentFinishNowRuleA. You must be logged into the site in order to give us a hand in keeping updated the information. If you don't have an account, you can create one here.
Page loaded in 0.0934 seconds.
Vivir aprendiendo.co - A place for learning stuff, in Spanish   Chaos Realm - The world of Game modders and wc3 addicts   Diplo, a gaming community   Power of Corruption, an altered melee featuring Naga and Demon. Play it now!!!   WC3JASS.com - The JASS Vault + vJASS and Zinc   Jetcraft - A Starcraft II mod   WormTastic Clan (wTc)   Warcraft RESOURCES Reforged: Modelos, mapas, proyectos y mas...