Draiget

Untitled

May 3rd, 2015
349
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.10 KB | None | 0 0
  1.  
  2. if !Gamemode then
  3.     Gamemode = {
  4.         score = 0,
  5.         combos = {},
  6.     }
  7. end
  8.  
  9. function addCombo( data )
  10.     Gamemode.combos[ #Gamemode.combos ] = data
  11. end
  12.  
  13. function getCombosBonus()
  14.     local retval = 0
  15.     for index=1,#Gamemode.combos do
  16.         retval = retval + Gamemode.combos[index].value
  17.     end
  18.     return retval
  19. end
  20.  
  21. function OnPuzzleCollecting()
  22.     local points = 0
  23.  
  24.     local puzzle = GetPuzzle()
  25.     local cells = puzzle["cells"]
  26.     for colnum=1,#cells do
  27.         local col = cells[colnum]
  28.         for rownum=1,#col do
  29.             local cell = col[rownum]
  30.             if cell["matched"] then
  31.                 local cellPoints = 10 * ((cell["type"]+1) * cell["matchsize"])
  32.                 points = points + cellPoints
  33.                
  34.                 -- combo stuff
  35.                 addCombo { value = cellPoints }
  36.             end
  37.         end
  38.     end
  39.  
  40.     Gamemode.score = Gamemode.score + points
  41.     SetGlobalScore{ score = Gamemode.score, showdelta = true }
  42.     -- copied from mono_classic.lua
  43.    
  44. end
  45.  
  46. function OnRequestFinalScoring()
  47.    
  48.     return {
  49.         rawscore = Gamemode.score,
  50.         bonuses = {
  51.             "Combos: " .. #Gamemode.combos,
  52.             "Score:" .. Gamemode.score
  53.         },
  54.         finalscore = Gamemode.score + getCombosBonus()
  55.     }
  56. end
Advertisement
Add Comment
Please, Sign In to add comment