# HG changeset patch # User Wuzzy # Date 1559084720 -7200 # Node ID a2d09a597fbb34f6401b47d0d4d4f58ca1f8879d # Parent 527a7414bb44503213563fe4423b3d984eff01f2 ASA fruit01: Recognize victory if killing all enemy hogs in "flee" variant diff -r 527a7414bb44 -r a2d09a597fbb ChangeLog.txt --- a/ChangeLog.txt Tue May 28 22:07:56 2019 +0200 +++ b/ChangeLog.txt Wed May 29 01:05:20 2019 +0200 @@ -69,6 +69,7 @@ * Searching in the dust: Fix a lot of broken/stupid smuggler behaviours * Chasing the blue hog: Fix player not losing the race when timing out while still having the rope * Chasing the blue hog: Fix player winning if Crazy Runner died + * Bad timing: Win mission in "flee" variant if all enemy hogs are dead * Getting to the device: Fix clan colors * Various minor tweaks and bugfixes diff -r 527a7414bb44 -r a2d09a597fbb share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit01.lua --- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit01.lua Tue May 28 22:07:56 2019 +0200 +++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit01.lua Wed May 29 01:05:20 2019 +0200 @@ -315,6 +315,19 @@ return win end +function onEscapeWinByKill(gear) + local win = true + for i=1,7 do + if GetHealth(yellowArmy[i].gear) or yellowArmy[i].hidden then + win = false + end + end + if GetHealth(yellow1.gear) then + win = false + end + return win +end + function isHeroOnLaunchPad() if not hero.dead and GetX(hero.gear) < 170 and GetY(hero.gear) > 1980 and StoppedGear(hero.gear) then return true @@ -377,6 +390,15 @@ EndGame() end +function escapeWinByKill(gear) + RemoveEventFunc(heroOnLaunchPadWithEnemies) + -- add stats + saveVariables() + SendStat(siGameResult, string.format(loc("%s won!"), teamB.name)) + sendSimpleTeamRankings({teamA.name, teamD.name, teamB.name, teamC.name}) + EndGame() +end + function heroSelect() awaitingInput = false FollowGear(hero.gear) @@ -391,6 +413,8 @@ AddAmmo(green1.gear, amSwitch, 100) AddEvent(onHeroOnLaunchPadWithEnemies, {hero.gear}, heroOnLaunchPadWithEnemies, {hero.gear}, 0) AddEvent(onEscapeWin, {hero.gear}, escapeWin, {hero.gear}, 0) + -- Alternative victory in the "flee" mission: ALL yellow hedgehogs killed + AddEvent(onEscapeWinByKill, {hero.gear}, escapeWinByKill, {hero.gear}, 0) local greenTeam = { green2, green3, green4, green5 } for i=1,4 do SetHogLevel(greenTeam[i].gear, 1)