175 fIsMissing[wtf] = false |
176 fIsMissing[wtf] = false |
176 fNeedsRespawn[wtf] = true |
177 fNeedsRespawn[wtf] = true |
177 fIsMissing[bbq] = false |
178 fIsMissing[bbq] = false |
178 fNeedsRespawn[bbq] = true |
179 fNeedsRespawn[bbq] = true |
179 fCaptures[wtf] = fCaptures[wtf] +1 |
180 fCaptures[wtf] = fCaptures[wtf] +1 |
180 ShowMission(loc("You have SCORED!!"), GetHogTeamName(CurrentHedgehog) .. ": " .. fCaptures[wtf], loc("Opposing Team: ") .. fCaptures[bbq], 0, 0) |
181 AddCaption(string.format(loc("%s has scored!"), GetHogName(CurrentHedgehog))) |
|
182 showMissionAndScorebar() |
181 PlaySound(sndVictory) |
183 PlaySound(sndVictory) |
182 fThief[bbq] = nil -- player no longer has the enemy flag |
184 fThief[bbq] = nil -- player no longer has the enemy flag |
183 CheckScore(wtf) |
185 CheckScore(wtf) |
184 |
186 |
185 --if the player is returning the flag |
187 --if the player is returning the flag |
451 WaterRise = 0 |
453 WaterRise = 0 |
452 Delay = 10 |
454 Delay = 10 |
453 |
455 |
454 end |
456 end |
455 |
457 |
|
458 function showMissionAndScorebar(instaHide) |
|
459 local place = loc("Flag placement phase: Flags, and their home base will be placed|where each team ends their first turn.") |
|
460 |
|
461 local rules = loc("Rules:") .. " |" .. |
|
462 loc("- Return the enemy flag to your base to score") .."|".. |
|
463 loc("- First team to score 3 captures wins") .."|".. |
|
464 loc("- You may only score when your flag is in your base") .."|".. |
|
465 loc("- Hogs will drop the flag when killed") .."|".. |
|
466 loc("- Dropped flags may be returned or recaptured").."|".. |
|
467 loc("- Hogs respawn when killed") |
|
468 |
|
469 local mission |
|
470 |
|
471 if gameTurns <= 2 then |
|
472 mission = place |
|
473 else |
|
474 local scoreboard = "" |
|
475 |
|
476 if gameStarted then |
|
477 scoreboard = "|" .. loc("Scores: ") .. "|" |
|
478 for i=0, 1 do |
|
479 scoreboard = scoreboard .. string.format(loc("%s: %d"), teamNameArr[i], fCaptures[i]) |
|
480 if i~=1 then scoreboard = scoreboard .. "|" end |
|
481 end |
|
482 end |
|
483 mission = rules .. scoreboard |
|
484 end |
|
485 |
|
486 ShowMission(loc("Capture The Flag"), loc("A Hedgewars minigame"), mission, 0, 0) |
|
487 if instaHide then |
|
488 HideMission() |
|
489 end |
|
490 end |
456 |
491 |
457 function onGameStart() |
492 function onGameStart() |
458 |
493 |
459 --ShowMission(loc(caption), loc(subcaption), loc(goal), 0, 0) |
494 showMissionAndScorebar() |
460 ShowMission(loc("CAPTURE THE FLAG"), loc("Flags, and their home base will be placed where each team ends their first turn."), "", 0, 0) |
|
461 |
495 |
462 RebuildTeamInfo() |
496 RebuildTeamInfo() |
463 |
497 |
464 -- should gfDivideTeams do this automatically? |
498 -- should gfDivideTeams do this automatically? |
465 --[[for i = 0, (TeamsCount-1) do |
499 --[[for i = 0, (TeamsCount-1) do |
494 --AddCaption("Handling respawns") |
528 --AddCaption("Handling respawns") |
495 if gameStarted == true then |
529 if gameStarted == true then |
496 HandleRespawns() |
530 HandleRespawns() |
497 --new method of placing starting flags |
531 --new method of placing starting flags |
498 elseif gameTurns == 1 then |
532 elseif gameTurns == 1 then |
499 ShowMission(loc("CAPTURE THE FLAG"), loc("Flags, and their home base will be placed where each team ends their first turn."), "", 0, 0) |
533 showMissionAndScorebar() |
500 elseif gameTurns == 2 then |
534 elseif gameTurns == 2 then |
501 fPlaced[0] = true |
535 fPlaced[0] = true |
502 ShowMission(loc("CAPTURE THE FLAG"), loc("RULES OF THE GAME [Press ESC to view]"), loc(" - Return the enemy flag to your base to score | - First team to 3 captures wins | - You may only score when your flag is in your base | - Hogs will drop the flag if killed, or drowned | - Dropped flags may be returned or recaptured | - Hogs respawn when killed"), 0, 0) |
536 showMissionAndScorebar() |
503 elseif gameTurns == 3 then |
537 elseif gameTurns == 3 then |
504 fPlaced[1] = true |
538 fPlaced[1] = true |
|
539 showMissionAndScorebar() |
505 StartTheGame() |
540 StartTheGame() |
506 end |
541 end |
507 |
542 |
508 end |
543 end |
509 |
544 |