share/hedgewars/Data/Missions/Challenge/User_Mission_-_Rope_Knock_Challenge.lua
changeset 13065 a297e06d1607
parent 12770 cf1377ab2f89
child 13067 64aba90811a2
equal deleted inserted replaced
13064:6766b900ab13 13065:a297e06d1607
    68 					{"Wuzzy",		"fr_orange",false},
    68 					{"Wuzzy",		"fr_orange",false},
    69 					{"Xeli", 			"android",false}
    69 					{"Xeli", 			"android",false}
    70 
    70 
    71 				}
    71 				}
    72 
    72 
       
    73 local playerTeamName = loc("Wannabe Shoppsta")
       
    74 
    73 function GenericEnd()
    75 function GenericEnd()
    74 	EndGame()
    76 	EndGame()
       
    77 end
       
    78 
       
    79 function GetKillScore()
       
    80 	return math.ceil((hogsKilled / 16)*6000)
    75 end
    81 end
    76 
    82 
    77 function GameOverMan()
    83 function GameOverMan()
    78 	missionWon = false
    84 	missionWon = false
    79 	ShowMission(loc("Rope-knocking Challenge"), loc("Challenge over!"), loc("Oh no! Just try again!"), -amSkip, 0)
    85 	ShowMission(loc("Rope-knocking Challenge"), loc("Challenge over!"), loc("Oh no! Just try again!"), -amSkip, 0)
    80 	SendStat(siGameResult, loc("Challenge over!"))
    86 	SendStat(siGameResult, loc("Challenge over!"))
    81 	local score = math.ceil((hogsKilled / 16)*6000)
    87 	local score = GetKillScore()
    82 	SendStat(siCustomAchievement, string.format(loc("You have killed %d of 16 hedgehogs (+%d points)."), hogsKilled, score))
    88 	SendStat(siCustomAchievement, string.format(loc("You have killed %d of 16 hedgehogs (+%d points)."), hogsKilled, score))
    83 	SendStat(siPointType, loc("points"))
    89 	SendStat(siPointType, loc("points"))
    84 	SendStat(siPlayerKills, tostring(score), loc("Wannabe Shoppsta"))
    90 	SendStat(siPlayerKills, tostring(score), playerTeamName)
    85 	PlaySound(sndHellish)
    91 	PlaySound(sndHellish)
    86 end
    92 end
    87 
    93 
    88 function GG()
    94 function GG()
    89 	missionWon = true
    95 	missionWon = true
    90 	local completeTime = (TurnTime - finishTime) / 1000
    96 	local completeTime = (TurnTime - finishTime) / 1000
    91 	ShowMission(loc("Rope-knocking Challenge"), loc("Challenge completed!"), loc("Congratulations!") .. "|" .. string.format(loc("Completion time: %.2fs"), completeTime), 0, 0)
    97 	ShowMission(loc("Rope-knocking Challenge"), loc("Challenge completed!"), loc("Congratulations!") .. "|" .. string.format(loc("Completion time: %.2fs"), completeTime), 0, 0)
    92 	PlaySound(sndHomerun)
    98 	PlaySound(sndHomerun)
    93 	SendStat(siGameResult, loc("Challenge completed!"))
    99 	SendStat(siGameResult, loc("Challenge completed!"))
    94 	local hogScore = math.ceil((hogsKilled / 16)*6000)
   100 	local hogScore = GetKillScore()
    95 	local timeScore = math.ceil((finishTime/TurnTime)*6000)
   101 	local timeScore = math.ceil((finishTime/TurnTime)*6000)
    96 	local score = hogScore + timeScore
   102 	local score = hogScore + timeScore
    97 	SendStat(siCustomAchievement, string.format(loc("You have killed %d of 16 hedgehogs (+%d points)."), hogsKilled, hogScore))
   103 	SendStat(siCustomAchievement, string.format(loc("You have killed %d of 16 hedgehogs (+%d points)."), hogsKilled, hogScore))
    98 	SendStat(siCustomAchievement, string.format(loc("You have completed this challenge in %.2f s (+%d points)."), completeTime, timeScore))
   104 	SendStat(siCustomAchievement, string.format(loc("You have completed this challenge in %.2f s (+%d points)."), completeTime, timeScore))
    99 	SendStat(siPointType, loc("points"))
   105 	SendStat(siPointType, loc("points"))
   100 	SendStat(siPlayerKills, tostring(score), loc("Wannabe Shoppsta"))
   106 	SendStat(siPlayerKills, tostring(score), playerTeamName)
       
   107 	SetTeamLabel(playerTeamName, tostring(score))
   101 end
   108 end
   102 
   109 
   103 function AssignCharacter(p)
   110 function AssignCharacter(p)
   104 
   111 
   105 	done = false
   112 	done = false
   142 
   149 
   143 	CaseFreq = 0
   150 	CaseFreq = 0
   144 	MinesNum = 0
   151 	MinesNum = 0
   145 	Explosives = 0
   152 	Explosives = 0
   146 
   153 
   147 	AddTeam(loc("Wannabe Shoppsta"), 0x11F12B, "money", "Island", "Default", "cm_shoppa")
   154 	AddTeam(playerTeamName, 0x11F12B, "money", "Island", "Default", "cm_shoppa")
   148 	hhs[0] = AddHog(loc("Ace"), 0, 1, "Gasmask")
   155 	hhs[0] = AddHog(loc("Ace"), 0, 1, "Gasmask")
   149 	SetGearPosition(player, 1380, 1500)
   156 	SetGearPosition(player, 1380, 1500)
   150 
   157 
   151 	AddTeam(loc("Unsuspecting Louts"), 0xDD0000, "Simple", "Island", "Default", "cm_face")
   158 	AddTeam(loc("Unsuspecting Louts"), 0xDD0000, "Simple", "Island", "Default", "cm_face")
   152 	for i = 1, 8 do
   159 	for i = 1, 8 do
   169                         loc("Rope-knocking Challenge"),
   176                         loc("Rope-knocking Challenge"),
   170                         loc("Challenge"),
   177                         loc("Challenge"),
   171                         loc("Use the rope to knock your enemies to their doom.") .. "|" ..
   178                         loc("Use the rope to knock your enemies to their doom.") .. "|" ..
   172                         loc("Finish this challenge as fast as possible to earn bonus points."),
   179                         loc("Finish this challenge as fast as possible to earn bonus points."),
   173                         -amRope, 4000)
   180                         -amRope, 4000)
       
   181 	SetTeamLabel(playerTeamName, "0")
   174 
   182 
   175 	PlaceGirder(46,1783, 0)
   183 	PlaceGirder(46,1783, 0)
   176 
   184 
   177 	SetGearPosition(hhs[0], 2419, 1769)
   185 	SetGearPosition(hhs[0], 2419, 1769)
   178 	SetGearPosition(hhs[1], 3350, 570)
   186 	SetGearPosition(hhs[1], 3350, 570)
   233 		DeleteGear(gear)
   241 		DeleteGear(gear)
   234 		PlaySound(sndExplosion)
   242 		PlaySound(sndExplosion)
   235 		AddCaption(string.format(knockTaunt(), GetHogName(gear)), 0xFFFFFFFF, capgrpMessage)
   243 		AddCaption(string.format(knockTaunt(), GetHogName(gear)), 0xFFFFFFFF, capgrpMessage)
   236 
   244 
   237 		hogsKilled = hogsKilled +1
   245 		hogsKilled = hogsKilled +1
       
   246 		SetTeamLabel(playerTeamName, tostring(GetKillScore()))
       
   247 
   238 		if hogsKilled == 15 then
   248 		if hogsKilled == 15 then
   239 			PlaySound(sndRideOfTheValkyries)
   249 			PlaySound(sndRideOfTheValkyries)
   240 		elseif hogsKilled == 16 then
   250 		elseif hogsKilled == 16 then
   241 			finishTime = TurnTimeLeft
   251 			finishTime = TurnTimeLeft
   242 			GG()
   252 			GG()