added slot for starting campaign by clicking the image and some events in moon mission spacecampaign
authorPeriklis Ntanasis <pntanasis@gmail.com>
Thu, 11 Jul 2013 02:05:59 +0300
branchspacecampaign
changeset 9324 98368198a75d
parent 9322 18cbaf1436c7
child 9326 689f591aa226
added slot for starting campaign by clicking the image and some events in moon mission
QTfrontend/hwform.cpp
share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/moon01.lua
--- a/QTfrontend/hwform.cpp	Tue Jul 09 22:53:28 2013 +0300
+++ b/QTfrontend/hwform.cpp	Thu Jul 11 02:05:59 2013 +0300
@@ -307,6 +307,7 @@
     connect(ui.pageTraining, SIGNAL(startMission(const QString&)), this, SLOT(startTraining(const QString&)));
 
     connect(ui.pageCampaign->BtnStartCampaign, SIGNAL(clicked()), this, SLOT(StartCampaign()));
+    connect(ui.pageCampaign->btnPreview, SIGNAL(clicked()), this, SLOT(StartCampaign()));
     connect(ui.pageCampaign->CBTeam, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateCampaignPage(int)));
     connect(ui.pageCampaign->CBCampaign, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateCampaignPage(int)));
     connect(ui.pageCampaign->CBMission, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateCampaignPageMission(int)));
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/moon01.lua	Tue Jul 09 22:53:28 2013 +0300
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/moon01.lua	Thu Jul 11 02:05:59 2013 +0300
@@ -183,6 +183,7 @@
 	-- check for death has to go first
 	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
 	AddEvent(onProfessorDeath, {professor.gear}, professorDeath, {professor.gear}, 0)
+	AddEvent(onMinionsDeath, {professor.gear}, minionsDeath, {professor.gear}, 0)
 	AddEvent(onBattleZone, {hero.gear}, battleZone, {hero.gear}, 0)
 	AddEvent(onProfessorHit, {professor.gear}, professorHit, {professor.gear}, 1)
 
@@ -300,7 +301,7 @@
 end
 
 function onMinionsDeath(gear)
-	if GetHealth(mimion1.gear) or GetHealth(mimion2.gear) or GetHealth(mimion3.gear) then
+	if not (GetHealth(minion1.gear) or GetHealth(minion2.gear) or GetHealth(minion3.gear)) then
 		return true
 	end
 	return false
@@ -340,11 +341,25 @@
 
 function professorDeath(gear)
 	-- do stats stuff here
+	if GetHealth(minion1.gear) then
+		AnimSay(minion1.gear, loc("The boss has fallen! Retreat!"), SAY_SHOUT, 6000)
+	elseif GetHealth(minion2.gear) then
+		AnimSay(minion2.gear, loc("The boss has fallen! Retreat!"), SAY_SHOUT, 6000)
+	elseif GetHealth(minion3.gear) then
+		AnimSay(minion3.gear, loc("The boss has fallen! Retreat!"), SAY_SHOUT, 6000)
+	end
+	ParseCommand("teamgone " .. teamB.name)
+	AnimCaption(hero.gear, loc("Congrats! You made them run away!"), 6000)
+	AnimWait(hero.gear,5000)
 	EndGame()
 end
 
 function minionsDeath(gear)
 	-- do staffs here
+	AnimSay(professor.gear, loc("I may lost that battle, but I haven't lost the war yet!"), SAY_SHOUT, 6000)
+	ParseCommand("teamgone " .. teamC.name)
+	AnimCaption(hero.gear, loc("Congrats! You won!"), 6000)
+	AnimWait(hero.gear,5000)	
 	EndGame()
 end