70 |
70 |
71 } |
71 } |
72 |
72 |
73 local playerTeamName = loc("Wannabe Shoppsta") |
73 local playerTeamName = loc("Wannabe Shoppsta") |
74 |
74 |
75 function GenericEnd() |
|
76 EndGame() |
|
77 end |
|
78 |
|
79 function GetKillScore() |
75 function GetKillScore() |
80 return math.ceil((hogsKilled / 16)*6000) |
76 return math.ceil((hogsKilled / 16)*6000) |
81 end |
77 end |
82 |
78 |
|
79 function ProtectEnemies() |
|
80 for i=1, 16 do |
|
81 if hhs[i] and GetHealth(hhs[i]) then |
|
82 SetEffect(hhs[i], heInvulnerable, 1) |
|
83 end |
|
84 end |
|
85 end |
|
86 |
83 function GameOverMan() |
87 function GameOverMan() |
84 missionWon = false |
88 missionWon = false |
|
89 ProtectEnemies() |
85 ShowMission(loc("Rope-knocking Challenge"), loc("Challenge over!"), loc("Oh no! Just try again!"), -amSkip, 0) |
90 ShowMission(loc("Rope-knocking Challenge"), loc("Challenge over!"), loc("Oh no! Just try again!"), -amSkip, 0) |
86 SendStat(siGameResult, loc("Challenge over!")) |
91 SendStat(siGameResult, loc("Challenge over!")) |
87 local score = GetKillScore() |
92 local score = GetKillScore() |
88 SendStat(siCustomAchievement, string.format(loc("You have killed %d of 16 hedgehogs (+%d points)."), hogsKilled, score)) |
93 SendStat(siCustomAchievement, string.format(loc("You have killed %d of 16 hedgehogs (+%d points)."), hogsKilled, score)) |
89 SendStat(siPointType, loc("points")) |
94 SendStat(siPointType, loc("points")) |
90 SendStat(siPlayerKills, tostring(score), playerTeamName) |
95 SendStat(siPlayerKills, tostring(score), playerTeamName) |
91 PlaySound(sndHellish) |
96 PlaySound(sndHellish) |
|
97 EndGame() |
92 end |
98 end |
93 |
99 |
94 function GG() |
100 function GG() |
95 missionWon = true |
101 missionWon = true |
96 local completeTime = (TurnTime - finishTime) / 1000 |
102 local completeTime = (TurnTime - finishTime) / 1000 |
98 PlaySound(sndHomerun) |
104 PlaySound(sndHomerun) |
99 SendStat(siGameResult, loc("Challenge completed!")) |
105 SendStat(siGameResult, loc("Challenge completed!")) |
100 local hogScore = GetKillScore() |
106 local hogScore = GetKillScore() |
101 local timeScore = math.ceil((finishTime/TurnTime)*6000) |
107 local timeScore = math.ceil((finishTime/TurnTime)*6000) |
102 local score = hogScore + timeScore |
108 local score = hogScore + timeScore |
|
109 |
103 SendStat(siCustomAchievement, string.format(loc("You have killed %d of 16 hedgehogs (+%d points)."), hogsKilled, hogScore)) |
110 SendStat(siCustomAchievement, string.format(loc("You have killed %d of 16 hedgehogs (+%d points)."), hogsKilled, hogScore)) |
104 SendStat(siCustomAchievement, string.format(loc("You have completed this challenge in %.2f s (+%d points)."), completeTime, timeScore)) |
111 SendStat(siCustomAchievement, string.format(loc("You have completed this challenge in %.2f s (+%d points)."), completeTime, timeScore)) |
105 SendStat(siPointType, loc("points")) |
112 SendStat(siPointType, loc("points")) |
106 SendStat(siPlayerKills, tostring(score), playerTeamName) |
113 SendStat(siPlayerKills, tostring(score), playerTeamName) |
107 SetTeamLabel(playerTeamName, tostring(score)) |
114 SetTeamLabel(playerTeamName, tostring(score)) |
|
115 |
|
116 if hhs[0] and GetHealth(hhs[0]) then |
|
117 SetEffect(hhs[0], heInvulnerable, 1) |
|
118 end |
|
119 SetTurnTimeLeft(MAX_TURN_TIME) |
108 end |
120 end |
109 |
121 |
110 function AssignCharacter(p) |
122 function AssignCharacter(p) |
111 |
123 |
112 done = false |
124 done = false |
215 |
227 |
216 if missionWon ~= nil then |
228 if missionWon ~= nil then |
217 |
229 |
218 endTimer = endTimer - 1 |
230 endTimer = endTimer - 1 |
219 if endTimer == 1 then |
231 if endTimer == 1 then |
220 GenericEnd() |
232 EndGame() |
221 end |
233 end |
222 |
234 |
223 if missionWon == true then |
235 if missionWon == true then |
224 AddCaption(loc("Victory!"), capcolDefault, capgrpGameState) |
236 AddCaption(loc("Victory!"), capcolDefault, capgrpGameState) |
225 else |
237 else |
232 |
244 |
233 function onGearDamage(gear, damage) |
245 function onGearDamage(gear, damage) |
234 |
246 |
235 if gear == hhs[0] then |
247 if gear == hhs[0] then |
236 ouchies = true |
248 ouchies = true |
|
249 ProtectEnemies() |
237 end |
250 end |
238 |
251 |
239 if gear ~= hhs[0] and GetGearType(gear) == gtHedgehog and missionWon == nil and ouchies == false then |
252 if gear ~= hhs[0] and GetGearType(gear) == gtHedgehog and missionWon == nil and ouchies == false then |
240 |
253 |
241 AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false) |
254 AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false) |