--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit01.lua Sun Aug 11 22:28:58 2013 +0300
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit01.lua Mon Aug 12 22:29:28 2013 +0300
@@ -4,7 +4,20 @@
-- to search for the missing part. However, a war
-- has broke out and hero has to take part or leave.
--- TODO: remove unwanted delay after first dialog
+-- TODO:
+-- * remove unwanted delay after first dialog
+-- * check strings
+-- * rethink the difficulty level
+-- NOTES:
+-- There is an ugly hack out there! I use 2 Captain Limes
+-- One in human level and one in bot level
+-- I want to have a Captain Lime in human level when the game
+-- begins because in animation if the hog is in bot level skip
+-- doesn't work - onPrecise() isn't triggered
+-- Later I want the hog to take place in the battle in bot level
+-- However if I use SetHogLevel I get an error: Engine bug: AI may break demos playing
+-- So I have 2 hogs, one in bot level and one in hog level that I hide them
+-- or restore them regarding the case
HedgewarsScriptLoad("/Scripts/Locale.lua")
HedgewarsScriptLoad("/Scripts/Animate.lua")
@@ -21,9 +34,9 @@
local dialog03 = {}
-- mission objectives
local goals = {
- [dialog01] = {missionName, loc("Ready for Battle?"), loc("Walk left if you want to join Captain Lime or right if you want to decline his offer"), 1, 7000},
- [dialog02] = {missionName, loc("Battle Starts Now!"), loc("You have choose to fight! Lead the Green Bananas to battle and try not to let them be killed"), 1, 7000},
- [dialog03] = {missionName, loc("Ready for Battle?"), loc("You have choose to flee... Unfortunately the only place where you can launch your saucer is in the most left side of the map"), 1, 7000},
+ [dialog01] = {missionName, loc("Ready for Battle?"), loc("Walk left if you want to join Captain Lime or right if you want to decline his offer"), 1, 4000},
+ [dialog02] = {missionName, loc("Battle Starts Now!"), loc("You have choose to fight! Lead the Green Bananas to battle and try not to let them be killed"), 1, 4000},
+ [dialog03] = {missionName, loc("Ready for Battle?"), loc("You have choose to flee... Unfortunately the only place where you can launch your saucer is in the most left side of the map"), 1, 4000},
}
-- crates
local crateWMX = 2170
@@ -37,18 +50,20 @@
local green2 = {}
local green3 = {}
local green4 = {}
+local green5 = {}
-- teams
local teamA = {}
local teamB = {}
local teamC = {}
+local teamD = {}
-- hedgehogs values
hero.name = "Hog Solo"
-hero.x = 3650
-hero.y = 295
+hero.x = 3350
+hero.y = 365
hero.dead = false
green1.name = "Captain Lime"
-green1.x = 3600
-green1.y = 295
+green1.x = 3300
+green1.y = 395
green1.dead = false
green2.name = "Mister Pear"
green2.x = 3600
@@ -59,17 +74,20 @@
green4.name = "Green Hog Grape"
green4.x = 2900
green4.y = 1650
+green5.name = "Mr Mango"
+green5.x = 1350
+green5.y = 850
yellow1.name = "General Lemon"
yellow1.x = 140
yellow1.y = 1980
local yellowArmy = {
- {name = "Robert Yellow Apple", x = 710, y = 1780},
- {name = "Summer Squash", x = 315 , y = 1960},
- {name = "Tall Potato", x = 830 , y = 1748},
- {name = "Yellow Pepper", x = 2160 , y = 820},
- {name = "Corn", x = 1320 , y = 740},
- {name = "Max Citrus", x = 1900 , y = 1700},
- {name = "Naranja Jed", x = 960 , y = 516},
+ {name = "Robert Yellow Apple", x = 710, y = 1780, health = 100},
+ {name = "Summer Squash", x = 315 , y = 1960, health = 100},
+ {name = "Tall Potato", x = 830 , y = 1748, health = 80},
+ {name = "Yellow Pepper", x = 2160 , y = 820, health = 60},
+ {name = "Corn", x = 1320 , y = 740, health = 60},
+ {name = "Max Citrus", x = 1900 , y = 1700, health = 40},
+ {name = "Naranja Jed", x = 960 , y = 516, health = 40},
}
teamA.name = loc("Hog Solo")
teamA.color = tonumber("38D61C",16) -- green
@@ -77,6 +95,8 @@
teamB.color = tonumber("38D61C",16) -- green
teamC.name = loc("Yellow Watermelons")
teamC.color = tonumber("DDFF00",16) -- yellow
+teamD.name = loc("Captain Lime")
+teamD.color = tonumber("38D61C",16) -- green
function onGameInit()
Seed = 1
@@ -96,10 +116,15 @@
hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1")
AnimSetGearPosition(hero.gear, hero.x, hero.y)
HogTurnLeft(hero.gear, true)
+ -- Captain Lime
+ AddTeam(teamD.name, teamD.color, "Bone", "Island", "HillBilly", "cm_birdy")
+ green1.bot = AddHog(green1.name, 1, 200, "war_desertgrenadier1")
+ AnimSetGearPosition(green1.bot, green1.x, green1.y)
+ green1.human = AddHog(green1.name, 0, 200, "war_desertgrenadier1")
+ AnimSetGearPosition(green1.human, green1.x, green1.y)
+ green1.gear = green1.human
-- Green Bananas
AddTeam(teamB.name, teamB.color, "Bone", "Island", "HillBilly", "cm_birdy")
- green1.gear = AddHog(green1.name, 1, 100, "war_desertgrenadier1")
- AnimSetGearPosition(green1.gear, green1.x, green1.y)
green2.gear = AddHog(green2.name, 0, 100, "war_desertgrenadier1")
AnimSetGearPosition(green2.gear, green2.x, green2.y)
HogTurnLeft(green2.gear, true)
@@ -109,13 +134,16 @@
green4.gear = AddHog(green4.name, 0, 100, "war_desertgrenadier1")
AnimSetGearPosition(green4.gear, green4.x, green4.y)
HogTurnLeft(green4.gear, true)
+ green5.gear = AddHog(green5.name, 0, 100, "war_desertgrenadier1")
+ AnimSetGearPosition(green5.gear, green5.x, green5.y)
+ HogTurnLeft(green5.gear, true)
-- Yellow Watermelons
AddTeam(teamC.name, teamC.color, "Bone", "Island", "HillBilly", "cm_birdy")
yellow1.gear = AddHog(yellow1.name, 1, 100, "war_desertgrenadier1")
AnimSetGearPosition(yellow1.gear, yellow1.x, yellow1.y)
-- the rest of the Yellow Watermelons
for i=1,7 do
- yellowArmy[i].gear = AddHog(yellowArmy[i].name, 1, 100, "war_desertgrenadier1")
+ yellowArmy[i].gear = AddHog(yellowArmy[i].name, 1, yellowArmy[i].health, "war_desertgrenadier1")
AnimSetGearPosition(yellowArmy[i].gear, yellowArmy[i].x, yellowArmy[i].y)
end
@@ -137,13 +165,17 @@
AddAmmo(hero.gear, amGrenade, 6)
AddAmmo(hero.gear, amDEagle, 4)
-- Green team weapons
- AddAmmo(green1.gear, amBlowTorch, 5)
- AddAmmo(green1.gear, amRope, 5)
- AddAmmo(green1.gear, amBazooka, 10)
- AddAmmo(green1.gear, amGrenade, 7)
- AddAmmo(green1.gear, amFirePunch, 2)
- AddAmmo(green1.gear, amDrill, 3)
- AddAmmo(green1.gear, amSkip, 100)
+ local greenArmy = { green1, green2 }
+ for i=1,2 do
+ AddAmmo(greenArmy[i].gear, amBlowTorch, 5)
+ AddAmmo(greenArmy[i].gear, amRope, 5)
+ AddAmmo(greenArmy[i].gear, amBazooka, 10)
+ AddAmmo(greenArmy[i].gear, amGrenade, 7)
+ AddAmmo(greenArmy[i].gear, amFirePunch, 2)
+ AddAmmo(greenArmy[i].gear, amDrill, 3)
+ AddAmmo(greenArmy[i].gear, amSwitch, 2)
+ AddAmmo(greenArmy[i].gear, amSkip, 100)
+ end
-- Yellow team weapons
AddAmmo(yellow1.gear, amBlowTorch, 1)
AddAmmo(yellow1.gear, amRope, 1)
@@ -152,34 +184,31 @@
AddAmmo(yellow1.gear, amFirePunch, 5)
AddAmmo(yellow1.gear, amDrill, 3)
AddAmmo(yellow1.gear, amBee, 1)
- AddAmmo(yellow1.gear, amMortar, 3)
- AddAmmo(yellow1.gear, amSniperRifle, 5)
+ AddAmmo(yellow1.gear, amMortar, 3)
AddAmmo(yellow1.gear, amDEagle, 4)
AddAmmo(yellow1.gear, amDynamite, 1)
AddAmmo(yellow1.gear, amSwitch, 100)
for i=3,7 do
HideHog(yellowArmy[i].gear)
end
+ HideHog(green1.bot)
-- crates
SpawnHealthCrate(health1X, health1Y)
SpawnAmmoCrate(crateWMX, crateWMY, amWatermelon)
- SetHogLevel(green1.gear,0)
AddAnim(dialog01)
SendHealthStatsOff()
end
function onNewTurn()
- WriteLnToConsole("NEW TURN "..TotalRounds.." hog "..CurrentHedgehog)
if chooseToBattle then
if CurrentHedgehog == green1.gear then
- WriteLnToConsole("IT'S GREEN HOG ")
TotalRounds = TotalRounds - 2
- SwitchHog(previousHog)
+ AnimSwitchHog(previousHog)
TurnTimeLeft = 0
end
- previousHog = CurrentHedghog
+ previousHog = CurrentHedgehog
end
getNextWave()
end
@@ -329,7 +358,7 @@
AddAmmo(green1.gear, amSwitch, 100)
AddEvent(onEscapeWin, {hero.gear}, escapeWin, {hero.gear}, 0)
local greenTeam = { green2, green3, green4 }
- for i=1,3 do
+ for i=1,4 do
SetHogLevel(greenTeam[i].gear, 1)
end
AddAnim(dialog03)
@@ -393,9 +422,12 @@
------------- OTHER FUNCTIONS ---------------
function startBattle()
- SetHogLevel(green1.gear, 1)
- AnimSwitchHog(yellow1.gear)
- TurnTimeLeft = 0
+ --HideHog(green1.human)
+ RestoreHog(green1.bot)
+ DeleteGear(green1.human)
+ green1.gear = green1.bot
+ AnimSwitchHog(hero.gear)
+ TurnTimeLeft = TurnTime
end
function gameLost()