--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/backstab.lua Wed Jan 16 15:40:11 2019 +0100
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/backstab.lua Wed Jan 16 19:59:08 2019 +0100
@@ -969,6 +969,7 @@
function AddHogs()
tribeTeamName = AddTeam(loc("Tribe"), -2, "Bone", "Island", "HillBilly", "cm_birdy")
+ SetTeamPassive(tribeTeamName, true)
for i = 8, 9 do
natives[i] = AddHog(nativeNames[i], 0, 100, nativeHats[i])
end
@@ -1020,8 +1021,7 @@
function onGameInit()
Seed = 2
- -- gfTagTeam makes it easier to skip the Tribe team
- GameFlags = gfSolidLand + gfTagTeam
+ GameFlags = gfSolidLand
TurnTime = 60000
CaseFreq = 0
MinesNum = 0
@@ -1120,10 +1120,6 @@
return
end
- if GetHogTeamName(CurrentHedgehog) == loc("Tribe") then
- EndTurn(true)
- return
- end
TurnsLeft = TurnsLeft - 1
if stage == platformStage then
--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/epil.lua Wed Jan 16 15:40:11 2019 +0100
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/epil.lua Wed Jan 16 19:59:08 2019 +0100
@@ -113,6 +113,8 @@
gearDead = {}
hogDead = {}
+
+local traitorTeamName = loc("Traitors")
--------------------------Anim skip functions--------------------------
function SkipStartAnim()
SetGearMessage(CurrentHedgehog, 0)
@@ -328,7 +330,8 @@
end
if m8Scene == denseScene or m8Scene == waterScene then
- AddTeam(loc("Traitors"), -2, grave, "Island", voice, "cm_bloodyblade")
+ traitorTeamName = AddTeam(traitorTeamName, -2, grave, "Island", voice, "cm_bloodyblade")
+ SetTeamPassive(traitorTeamName, true)
if m8Scene == denseScene then
DeleteGear(natives[2])
natives[2] = AddHog(nativeNames[2], 0, 100, nativeHats[2])
@@ -434,6 +437,9 @@
if GetGearType(gear) == gtHedgehog then
hogDead[gear] = true
end
+ if IsEveryoneExceptTraitorDead() then
+ SetTeamPassive(traitorTeamName, false)
+ end
end
function onAmmoStoreInit()
@@ -483,16 +489,7 @@
end
function onNewTurn()
- if AnimInProgress() then
- SetTurnTimeLeft(MAX_TURN_TIME)
- return
- end
- -- Don't allow player to play with traitor, except when it is the final hog left
- if CurrentHedgehog == traitor and not IsEveryoneExceptTraitorDead() then
- EndTurn(true)
- else
- SetTurnTimeLeft(MAX_TURN_TIME)
- end
+ SetTurnTimeLeft(MAX_TURN_TIME)
end
function onPrecise()
--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/family.lua Wed Jan 16 15:40:11 2019 +0100
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/family.lua Wed Jan 16 19:59:08 2019 +0100
@@ -525,6 +525,7 @@
function AddHogs()
princessTeamName = AddTeam(loc("Princess"), -2, "Bone", "Island", "HillBilly", "cm_female")
+ SetTeamPassive(princessTeamName, true)
princess = AddHog(loc("Fell From Heaven"), 0, 333, "tiara")
SetGearAIHints(princess, aihDoesntMatter)
gearDead[princess] = false
@@ -578,8 +579,7 @@
function onGameInit()
Seed = 0
- -- Using gfTagTeam makes it far easier to skip the Princess team
- GameFlags = gfSolidLand + gfDisableLandObjects + gfDisableGirders + gfTagTeam
+ GameFlags = gfSolidLand + gfDisableLandObjects + gfDisableGirders
TurnTime = 60000
CaseFreq = 0
MinesNum = 0
@@ -652,9 +652,6 @@
end
end
EndTurn(true)
- elseif CurrentHedgehog == princess then
- -- Princess is passive
- EndTurn(true)
else
for i = 1, 3 do
if gearDead[natives[i]] ~= true then
--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/journey.lua Wed Jan 16 15:40:11 2019 +0100
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/journey.lua Wed Jan 16 19:59:08 2019 +0100
@@ -234,7 +234,7 @@
function AfterEndAnimAlone()
stage = endStage
- SwitchHog(leaks)
+ AnimSwitchHog(leaks)
SetGearMessage(leaks, 0)
SetTurnTimeLeft(MAX_TURN_TIME)
ShowMission(loc("The Journey Back"), loc("Collateral Damage II"), loc("Save Fell From Heaven!"), 1, 4000)
@@ -245,7 +245,7 @@
function AfterEndAnimDuo()
stage = endStage
- SwitchHog(leaks)
+ AnimSwitchHog(leaks)
SetGearMessage(leaks, 0)
SetGearMessage(dense, 0)
SetTurnTimeLeft(MAX_TURN_TIME)
@@ -323,7 +323,7 @@
AddEvent(CheckDensePit, {}, DoDensePit, {}, 0)
SetGearMessage(leaks, 0)
SetGearMessage(dense, 0)
- EndTurn(0)
+ EndTurn(true)
ShowMission(loc("The Journey Back"), loc("The Savior"),
loc("Get Dense Cloud out of the pit!") .. "|" ..
loc("Your hogs must survive!") .. "|" ..
@@ -883,7 +883,7 @@
end
function DoDensePit()
- EndTurn(0)
+ EndTurn(true)
RestoreHedge(cyborg)
AnimWait(cyborg, 1)
AddFunction({func = AddAnim, args = {outPitAnim}})
@@ -1096,6 +1096,7 @@
dense = AddHog(loc("Dense Cloud"), 0, 100, "RobinHood")
princessTeamName = AddTeam(loc("Princess"), -2, "Bone", "Island", "HillBilly", "cm_female")
+ SetTeamPassive(princessTeamName, true)
princess = AddHog(loc("Fell From Heaven"), 0, 200, "tiara")
cannibalsTeamName = AddTeam(loc("Cannibal Sentry"), -1, "skull", "Island", "Pirate","cm_vampire")
@@ -1197,10 +1198,13 @@
SetTurnTimeLeft(MAX_TURN_TIME)
elseif victory then
EndTurn(true)
- elseif stage == endStage and CurrentHedgehog ~= leaks then
- AnimSwitchHog(leaks)
- SetGearMessage(leaks, 0)
- SetTurnTimeLeft(MAX_TURN_TIME)
+ elseif stage == endStage then
+ if GetHogTeamName(CurrentHedgehog) == nativesTeamName and CurrentHedgehog ~= leaks then
+ AnimSwitchHog(leaks)
+ SetTurnTimeLeft(MAX_TURN_TIME)
+ else
+ SkipTurn()
+ end
elseif GetHogTeamName(CurrentHedgehog) ~= nativesTeamName then
SetTurnTimeLeft(20000)
else
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/cosmos.lua Wed Jan 16 15:40:11 2019 +0100
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/cosmos.lua Wed Jan 16 19:59:08 2019 +0100
@@ -98,7 +98,7 @@
Seed = 35
ClearGameFlags()
- EnableGameFlags(gfSolidLand, gfDisableWind, gfTagTeam)
+ EnableGameFlags(gfSolidLand, gfDisableWind)
if checkPointReached == 4 then
-- Disable walking as long we're stuck on the moon
EnableGameFlags(gfArtillery)
@@ -126,6 +126,7 @@
HogTurnLeft(hero.gear, true)
-- PAotH
teamA.name = AddTeam(teamA.name, teamA.color, "Earth", "Island", "Default", "cm_galaxy")
+ SetTeamPassive(teamA.name, true)
director.gear = AddHog(director.name, 0, 100, "hair_yellow")
AnimSetGearPosition(director.gear, director.x, director.y)
doctor.gear = AddHog(doctor.name, 0, 100, "Glasses")
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/death01.lua Wed Jan 16 15:40:11 2019 +0100
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/death01.lua Wed Jan 16 19:59:08 2019 +0100
@@ -114,6 +114,7 @@
-- PAotH (passive team)
teamB.name = AddTeam(teamB.name, teamB.color, "Earth", "Island", "Default", "cm_galaxy")
+ SetTeamPassive(teamB.name, true)
paoth1.gear = AddHog(paoth1.name, 0, 100, "hair_yellow")
AnimSetGearPosition(paoth1.gear, paoth1.x, paoth1.y)
HogTurnLeft(paoth1.gear, true)
@@ -213,13 +214,6 @@
SendHealthStatsOff()
end
-function onNewTurn()
- -- Team PAotH is passive and does not play
- if CurrentHedgehog == paoth1.gear or CurrentHedgehog == paoth2.gear then
- EndTurn(true)
- end
-end
-
function onGameTick()
AnimUnWait()
if ShowAnimation() == false then
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert01.lua Wed Jan 16 15:40:11 2019 +0100
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert01.lua Wed Jan 16 19:59:08 2019 +0100
@@ -111,10 +111,12 @@
HogTurnLeft(hero.gear, true)
-- PAotH undercover scientist and chief Sandologist
teamA.name = AddTeam(teamA.name, teamA.color, "Earth", "Island", "Default", "cm_galaxy")
+ SetTeamPassive(teamA.name, true)
ally.gear = AddHog(ally.name, 0, 100, "Cowboy")
AnimSetGearPosition(ally.gear, ally.x, ally.y)
-- Smugglers
teamB.name = AddTeam(teamB.name, teamB.color, "chest", "Island", "Default", "cm_bloodyblade")
+ SetTeamPassive(teamB.name, true)
smuggler1.gear = AddHog(smuggler1.name, 1, 100, "hair_orange")
AnimSetGearPosition(smuggler1.gear, smuggler1.x, smuggler1.y)
smuggler2.gear = AddHog(smuggler2.name, 1, 100, "lambda")
@@ -205,31 +207,14 @@
end
function onNewTurn()
- local function getReady(hog)
- -- This clears the "Get ready, Hog!" caption from the engine, because it will name the
- -- false hog because we immediately switch the hog after the turn start.
- -- TODO: Find a better method for this and show the real hog name (preferably using an engine string)
- AddCaption("")
- end
-
- if CurrentHedgehog ~= hero.gear and not heroIsInBattle then
- AnimSwitchHog(hero.gear)
- getReady(hero.gear)
- SetTurnTimeLeft(MAX_TURN_TIME)
- elseif CurrentHedgehog == hero.gear and not heroIsInBattle then
+ if CurrentHedgehog == hero.gear and not heroIsInBattle then
SetTurnTimeLeft(MAX_TURN_TIME)
elseif (CurrentHedgehog == smuggler2.gear or CurrentHedgehog == smuggler3.gear) and ongoingBattle == 1 then
AnimSwitchHog(smuggler1.gear)
- getReady(smuggler1.gear)
elseif (CurrentHedgehog == smuggler1.gear or CurrentHedgehog == smuggler3.gear) and ongoingBattle == 2 then
AnimSwitchHog(smuggler2.gear)
- getReady(smuggler2.gear)
elseif (CurrentHedgehog == smuggler1.gear or CurrentHedgehog == smuggler2.gear) and ongoingBattle == 3 then
AnimSwitchHog(smuggler3.gear)
- getReady(smuggler3.gear)
- elseif CurrentHedgehog == ally.gear then
- AnimSwitchHog(hero.gear)
- getReady(hero.gear)
end
end
@@ -291,6 +276,7 @@
hero.dead = true
elseif (gear == smuggler1.gear or gear == smuggler2.gear or gear == smuggler3.gear) and heroIsInBattle then
heroIsInBattle = false
+ SetTeamPassive(teamB.name, true)
AddAmmo(hero.gear, amSkip, 0)
ongoingBattle = 0
end
@@ -397,8 +383,9 @@
dy = div(dy, 3)
end
SetGearMessage(hero.gear, 0)
+ SetTeamPassive(teamB.name, false)
+ heroIsInBattle = true
EndTurn(true)
- heroIsInBattle = true
AddAmmo(hero.gear, amSkip, 100)
ongoingBattle = 1
AnimSwitchHog(smuggler1.gear)
@@ -408,8 +395,9 @@
function heroFleeFirstBattle(gear)
AnimSay(smuggler1.gear, loc("Run away, you coward!"), SAY_SHOUT, 4000)
+ SetTeamPassive(teamB.name, true)
+ heroIsInBattle = false
EndTurn(true)
- heroIsInBattle = false
AddAmmo(hero.gear, amSkip, 0)
ongoingBattle = 0
end
@@ -424,6 +412,7 @@
function heroAtThirdBattle(gear)
heroIsInBattle = true
+ SetTeamPassive(teamB.name, false)
AddAmmo(hero.gear, amSkip, 100)
ongoingBattle = 3
AnimSay(smuggler3.gear, loc("Who's there?! I'll get you!"), SAY_SHOUT, 5000)
@@ -521,6 +510,7 @@
end
SetGearMessage(hero.gear, 0)
heroIsInBattle = true
+ SetTeamPassive(teamB.name, false)
AddAmmo(hero.gear, amSkip, 100)
ongoingBattle = 2
AnimSay(smuggler2.gear, loc("This seems like a wealthy hedgehog, nice ..."), SAY_THINK, 5000)
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/ice01.lua Wed Jan 16 15:40:11 2019 +0100
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/ice01.lua Wed Jan 16 19:59:08 2019 +0100
@@ -118,6 +118,7 @@
HogTurnLeft(hero.gear, true)
-- Ally
teamA.name = AddTeam(teamA.name, teamA.color, "heart", "Island", "Default", "cm_face")
+ SetTeamPassive(teamA.name, true)
ally.gear = AddHog(ally.name, 0, 100, "war_airwarden02")
AnimSetGearPosition(ally.gear, ally.x, ally.y)
-- Frozen Bandits
@@ -234,29 +235,48 @@
SendHealthStatsOff()
end
+function getNextBandit(hog)
+ local continue = true
+ local startHog = hog
+ while true do
+ if (GetHealth(hog) and GetEffect(hog, heFrozen) < 256) and
+ ( (heroAtFinalStep and (hog == bandit1.gear or hog == bandit4.gear or hog == bandit5.gear)) or
+ ((not heroAtFinalStep) and (hog == bandit2.gear or hog == bandit3.gear)) ) then
+ return hog
+ end
+ if hog == bandit1.gear then
+ hog = bandit2.gear
+ elseif hog == bandit2.gear then
+ hog = bandit3.gear
+ elseif hog == bandit3.gear then
+ hog = bandit4.gear
+ elseif hog == bandit4.gear then
+ hog = bandit5.gear
+ elseif hog == bandit5.gear then
+ hog = bandit1.gear
+ end
+ if startHog == hog then
+ return nil
+ end
+ end
+end
+
function onNewTurn()
heroDamageAtCurrentTurn = 0
-- round has to start if hero goes near the column
if not heroVisitedAntiFlyArea and CurrentHedgehog ~= hero.gear then
- EndTurn(true)
+ SkipTurn()
elseif not heroVisitedAntiFlyArea and CurrentHedgehog == hero.gear then
SetTurnTimeLeft(MAX_TURN_TIME)
- elseif not heroAtFinalStep and (CurrentHedgehog == bandit1.gear or CurrentHedgehog == bandit4.gear or CurrentHedgehog == bandit5.gear) then
- AnimSwitchHog(hero.gear)
- EndTurn(true)
- elseif heroAtFinalStep and (CurrentHedgehog == bandit2.gear or CurrentHedgehog == bandit3.gear) then
- if (GetHealth(bandit1.gear) and GetEffect(bandit1.gear,heFrozen) > 256) and
- ((GetHealth(bandit4.gear) and GetEffect(bandit4.gear,heFrozen) > 256) or not GetHealth(bandit4.gear)) and
- ((GetHealth(bandit5.gear) and GetEffect(bandit5.gear,heFrozen) > 256) or not GetHealth(bandit5.gear)) then
- EndTurn(true)
+ elseif (GetHogTeamName(CurrentHedgehog) == teamB.name) then
+ local nextBandit = getNextBandit(CurrentHedgehog)
+ if nextBandit ~= nil then
+ if CurrentHedgehog ~= nextBandit then
+ AnimSwitchHog(nextBandit)
+ end
else
- AnimSwitchHog(hero.gear)
- EndTurn(true)
+ SkipTurn()
end
- elseif CurrentHedgehog == ally.gear then
- -- This switches back to hero (indirectly)
- SwitchHog(bandit1.gear)
- EndTurn(true)
end
-- frozen hogs accounting
if CurrentHedgehog == hero.gear and heroAtFinalStep and TurnTimeLeft > 0 then
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/ice02.lua Wed Jan 16 15:40:11 2019 +0100
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/ice02.lua Wed Jan 16 19:59:08 2019 +0100
@@ -12,6 +12,7 @@
-- globals
local missionName = loc("Hard flying")
local challengeStarted = false
+local challengeStartRequested = false
local currentWaypoint = 1
local radius = 75 -- Ring radius. Will become smaller and smaller
local totalTime = 15000 -- Total available time. Initial value is start time; is added to later when player wins extra time
@@ -88,6 +89,7 @@
AnimSetGearPosition(hero.gear, hero.x, hero.y)
-- Ally
teamB.name = AddTeam(teamB.name, teamB.color, "heart", "Island", "Default", "cm_face")
+ SetTeamPassive(teamB.name, true)
ally.gear = AddHog(ally.name, 0, 100, "war_airwarden02")
AnimSetGearPosition(ally.gear, ally.x, ally.y)
HogTurnLeft(ally.gear, true)
@@ -134,9 +136,10 @@
end
function onNewTurn()
- if not hero.dead and CurrentHedgehog == ally.gear and challengeStarted then
- heroLost()
- elseif not hero.dead and CurrentHedgehog == hero.gear and challengeStarted then
+ if challengeStartRequested then
+ challengeStarted = true
+ end
+ if not hero.dead and CurrentHedgehog == hero.gear and challengeStarted then
SetWeapon(amJetpack)
end
heroTurn = CurrentHedgehog == hero.gear
@@ -258,9 +261,8 @@
------------------ Other Functions -------------------
function startFlying()
- AnimSwitchHog(ally.gear)
+ challengeStartRequested = true
EndTurn(true)
- challengeStarted = true
end
function placeNextWaypoint()
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/moon01.lua Wed Jan 16 15:40:11 2019 +0100
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/moon01.lua Wed Jan 16 19:59:08 2019 +0100
@@ -122,6 +122,7 @@
AnimSetGearPosition(hero.gear, hero.x, hero.y)
-- PAotH
teamA.name = AddTeam(teamA.name, teamA.color, "Earth", "Island", "Default", "cm_galaxy")
+ SetTeamPassive(teamA.name, true)
paoth1.gear = AddHog(paoth1.name, 0, 100, "scif_2001O")
AnimSetGearPosition(paoth1.gear, paoth1.x, paoth1.y)
HogTurnLeft(paoth1.gear, true)
@@ -136,6 +137,7 @@
HogTurnLeft(paoth4.gear, true)
-- Professor
teamC.name = AddTeam(teamC.name, teamC.color, "star", "Island", "Default", "cm_sine")
+ SetTeamPassive(teamC.name, true)
professor.gear = AddHog(professor.name, 0, professor.health, "tophats")
AnimSetGearPosition(professor.gear, professor.x, professor.y)
HogTurnLeft(professor.gear, true)
@@ -253,9 +255,6 @@
elseif weaponsAcquired and not battleZoneReached and afterDialog02 then
battleZone(hero.gear)
end
- elseif CurrentHedgehog == paoth1.gear or CurrentHedgehog == paoth2.gear
- or CurrentHedgehog == paoth3.gear or CurrentHedgehog == paoth4.gear then
- EndTurn(true)
elseif CurrentHedgehog == professor.gear then
if weaponsAcquired and not battleZoneReached and afterDialog02 then
battleZone(hero.gear)