equal
deleted
inserted
replaced
149 end |
149 end |
150 if CurrentHedgehog ~= nil then |
150 if CurrentHedgehog ~= nil then |
151 AddCaption(string.format(loc("Victory for %s!"), GetHogTeamName(CurrentHedgehog)), 0xFFFFFFFF, capgrpGameState) |
151 AddCaption(string.format(loc("Victory for %s!"), GetHogTeamName(CurrentHedgehog)), 0xFFFFFFFF, capgrpGameState) |
152 updateScores() |
152 updateScores() |
153 end |
153 end |
|
154 |
|
155 -- Calculate team rankings |
|
156 |
|
157 local teamList = {} |
|
158 for i=0, TeamsCount-1 do |
|
159 local name = GetTeamName(i) |
|
160 local clan = GetTeamClan(name) |
|
161 table.insert(teamList, { score = fCaptures[clan], name = name, clan = clan }) |
|
162 end |
|
163 local teamRank = function(a, b) |
|
164 return a.score > b.score |
|
165 end |
|
166 table.sort(teamList, teamRank) |
|
167 |
|
168 for i=1, #teamList do |
|
169 SendStat(siPointType, loc("point(s)")) |
|
170 SendStat(siPlayerKills, tostring(teamList[i].score), teamList[i].name) |
|
171 end |
154 end |
172 end |
155 |
173 |
156 end |
174 end |
157 |
175 |
158 function DoFlagStuff(flag, flagClan) |
176 function DoFlagStuff(flag, flagClan) |
252 |
270 |
253 end |
271 end |
254 |
272 |
255 end |
273 end |
256 |
274 |
|
275 -- Advance the clan score graph by one step |
|
276 function DrawScores() |
|
277 local clansUsed = {} |
|
278 for i=0, TeamsCount-1 do |
|
279 local team = GetTeamName(i) |
|
280 local clan = GetTeamClan(team) |
|
281 if not clansUsed[clan] then |
|
282 local captures = fCaptures[clan] |
|
283 SendStat(siClanHealth, captures, team) |
|
284 clansUsed[clan] = true |
|
285 end |
|
286 end |
|
287 end |
257 |
288 |
258 function FlagThiefDead(gear) |
289 function FlagThiefDead(gear) |
259 |
290 |
260 local thiefClan |
291 local thiefClan |
261 local stolenFlagClan |
292 local stolenFlagClan |
406 EnableGameFlags(gfDivideTeams) |
437 EnableGameFlags(gfDivideTeams) |
407 |
438 |
408 -- Disable Sudden Death |
439 -- Disable Sudden Death |
409 WaterRise = 0 |
440 WaterRise = 0 |
410 HealthDecrease = 0 |
441 HealthDecrease = 0 |
411 |
|
412 end |
442 end |
413 |
443 |
414 function showCTFMission() |
444 function showCTFMission() |
415 local captures |
445 local captures |
416 if captureLimit == 1 then |
446 if captureLimit == 1 then |
454 AddAmmo(hhs[h], amResurrector, 0) |
484 AddAmmo(hhs[h], amResurrector, 0) |
455 end |
485 end |
456 |
486 |
457 updateScores() |
487 updateScores() |
458 |
488 |
|
489 SendStat(siGraphTitle, loc("Score graph")) |
|
490 SendHealthStatsOff() |
|
491 SendRankingStatsOff() |
|
492 |
459 end |
493 end |
460 |
494 |
461 |
495 |
462 function onNewTurn() |
496 function onNewTurn() |
463 |
497 |
464 if gameStarted == true then |
498 if gameStarted == true and not gameOver then |
465 HandleRespawns() |
499 HandleRespawns() |
466 end |
500 end |
467 |
501 |
468 local flagsPlaced = 0 |
502 local flagsPlaced = 0 |
469 for i=0, ClansCount-1 do |
503 for i=0, ClansCount-1 do |
472 end |
506 end |
473 end |
507 end |
474 if not gameStarted and flagsPlaced == ClansCount then |
508 if not gameStarted and flagsPlaced == ClansCount then |
475 StartTheGame() |
509 StartTheGame() |
476 end |
510 end |
477 |
|
478 end |
511 end |
479 |
512 |
480 function onEndTurn() |
513 function onEndTurn() |
481 -- if the game hasn't started yet, keep track of where we are gonna put the flags on turn end |
514 -- if the game hasn't started yet, keep track of where we are gonna put the flags on turn end |
482 if not gameStarted and CurrentHedgehog ~= nil then |
515 if not gameStarted and CurrentHedgehog ~= nil then |
484 |
517 |
485 if GetX(CurrentHedgehog) and not fSpawnX[clan] then |
518 if GetX(CurrentHedgehog) and not fSpawnX[clan] then |
486 fSpawnX[clan] = GetX(CurrentHedgehog) |
519 fSpawnX[clan] = GetX(CurrentHedgehog) |
487 fSpawnY[clan] = GetY(CurrentHedgehog) |
520 fSpawnY[clan] = GetY(CurrentHedgehog) |
488 end |
521 end |
|
522 end |
|
523 |
|
524 if gameStarted == true then |
|
525 DrawScores() |
489 end |
526 end |
490 end |
527 end |
491 |
528 |
492 function onGameTick() |
529 function onGameTick() |
493 |
530 |