share/hedgewars/Data/Scripts/Multiplayer/Space_Invasion.lua
changeset 12061 b68ec446a111
parent 12060 ddf0fee75449
child 12062 1ee28630d424
equal deleted inserted replaced
12060:ddf0fee75449 12061:b68ec446a111
  1087 			y = y*2
  1087 			y = y*2
  1088 			SetGearVelocity(morte, x, y)
  1088 			SetGearVelocity(morte, x, y)
  1089 
  1089 
  1090 			if wepAmmo[wepIndex] == 0 then
  1090 			if wepAmmo[wepIndex] == 0 then
  1091 				PlaySound(sndSuddenDeath)
  1091 				PlaySound(sndSuddenDeath)
  1092 				AddCaption(loc("Ammo Depleted!"),0xff0000ff,capgrpMessage)
  1092 				AddCaption(loc("Ammo depleted!"),0xff0000ff,capgrpMessage)
  1093 			else
  1093 			else
  1094 				PlaySound(sndThrowRelease)
  1094 				PlaySound(sndThrowRelease)
  1095 			end
  1095 			end
  1096 			DrawTag(1)
  1096 			DrawTag(1)
  1097 
  1097 
  1101 			DrawTag(1)
  1101 			DrawTag(1)
  1102 		end
  1102 		end
  1103 
  1103 
  1104 	elseif (wepAmmo[wepIndex] == 0) and (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then
  1104 	elseif (wepAmmo[wepIndex] == 0) and (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then
  1105 		PlaySound(sndDenied)
  1105 		PlaySound(sndDenied)
  1106 		AddCaption(loc("Ammo Depleted!"),0xff0000ff,capgrpMessage)
  1106 		AddCaption(loc("Ammo depleted!"),0xff0000ff,capgrpMessage)
  1107 	end
  1107 	end
  1108 
  1108 
  1109 	preciseOn = true
  1109 	preciseOn = true
  1110 
  1110 
  1111 end
  1111 end
  1117 function onLJump()
  1117 function onLJump()
  1118 
  1118 
  1119 	if (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then
  1119 	if (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then
  1120 		shieldMiser = false
  1120 		shieldMiser = false
  1121 		if shieldHealth == 80 then
  1121 		if shieldHealth == 80 then
  1122 			AddCaption(loc("Shield Depleted"),0xff0000ff,capgrpMessage)
  1122 			AddCaption(loc("Shield depleted"),0xff0000ff,capgrpMessage)
  1123 			PlaySound(sndDenied)
  1123 			PlaySound(sndDenied)
  1124 		elseif (beam == false) and (shieldHealth > 80) then
  1124 		elseif (beam == false) and (shieldHealth > 80) then
  1125 			beam = true
  1125 			beam = true
  1126 			SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), 40, 255, 1, 10, 0, 300, 1, 0xa800ffff)
  1126 			SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), 40, 255, 1, 10, 0, 300, 1, 0xa800ffff)
  1127 			AddCaption( loc("Shield ON:") .. " " .. shieldHealth - 80 .. " " .. loc("Power Remaining") )
  1127 			AddCaption( string.format(loc("Shield ON: %d power remaining"), shieldHealth - 80))
  1128 			PlaySound(sndWarp)
  1128 			PlaySound(sndWarp)
  1129 		else
  1129 		else
  1130 			beam = false
  1130 			beam = false
  1131 			SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), 0, 0, 1, 10, 0, 0, 0, 0xa800ffff)
  1131 			SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), 0, 0, 1, 10, 0, 0, 0, 0xa800ffff)
  1132 			AddCaption(loc("Shield OFF:") .. " " .. shieldHealth - 80 .. " " .. loc("Power Remaining") )
  1132 			AddCaption( string.format(loc("Shield ON: %d power remaining"), shieldHealth - 80))
  1133 		end
  1133 		end
  1134 	end
  1134 	end
  1135 end
  1135 end
  1136 
  1136 
  1137 function onHJump()
  1137 function onHJump()
  1140 	(rAlpha == 255) then
  1140 	(rAlpha == 255) then
  1141 		if radShotsLeft > 0 then
  1141 		if radShotsLeft > 0 then
  1142 			rPingTimer = 0
  1142 			rPingTimer = 0
  1143 			rAlpha = 0
  1143 			rAlpha = 0
  1144 			radShotsLeft = radShotsLeft -1
  1144 			radShotsLeft = radShotsLeft -1
  1145 			AddCaption(loc("Pings left:") .. " " .. radShotsLeft,GetClanColor(GetHogClan(CurrentHedgehog)),capgrpMessage)
  1145 			AddCaption(string.format(loc("Pings left: %d"), radShotsLeft),GetClanColor(GetHogClan(CurrentHedgehog)),capgrpMessage)
  1146 			-- Play sonar sound
  1146 			-- Play sonar sound
  1147 			PlaySound(sndJetpackLaunch)
  1147 			PlaySound(sndJetpackLaunch)
  1148 
  1148 
  1149 		else
  1149 		else
  1150 			AddCaption(loc("No radar pings left!"),0xFF0000FF,capgrpMessage)
  1150 			AddCaption(loc("No radar pings left!"),0xFF0000FF,capgrpMessage)
  1273 
  1273 
  1274 function onGameStart()
  1274 function onGameStart()
  1275 	SendHealthStatsOff()
  1275 	SendHealthStatsOff()
  1276 
  1276 
  1277 	ShowMission	(
  1277 	ShowMission	(
  1278 				"SPACE INVASION",
  1278 				loc("SPACE INVASION"),
  1279 				loc("a Hedgewars mini-game"),
  1279 				loc("A Hedgewars mini-game"),
  1280 
  1280 
  1281 				loc("Destroy invaders to score points.") .. "|" ..
  1281 				loc("Destroy invaders to score points.") .. "|" ..
  1282 				" " .. "|" ..
  1282 				" " .. "|" ..
  1283 
  1283 
  1284 				loc("Round Limit") .. ": " .. roundLimit .. "|" ..
  1284 				string.format(loc("Round Limit: %d"), roundLimit) .. "|" ..
  1285 				loc("Turn Time") .. ": " .. (TurnTime/1000) .. loc("sec") .. "|" ..
  1285 				string.format(loc("Turn Time: %dsec"), (TurnTime/1000)) .. "|" ..
  1286 				" " .. "|" ..
  1286 				" " .. "|" ..
  1287 
  1287 
  1288 				loc("Movement: [Up], [Down], [Left], [Right]") .. "|" ..
  1288 				loc("Movement: [Up], [Down], [Left], [Right]") .. "|" ..
  1289 				loc("Fire") .. ": " .. loc("[Left Shift]") .. "|" ..
  1289 				loc("Fire: [Precise]") .. "|" ..
  1290 				loc("Toggle Shield") .. ": " .. loc("[Enter]") .. "|" ..
  1290 				loc("Toggle Shield: [Long jump]") .. "|" ..
  1291 				loc("Radar Ping") .. ": " .. loc("[Backspace]") .. "|" ..
  1291 				loc("Radar Ping: [High jump]") .. "|" ..
  1292 
  1292 
  1293 				"", 4, 4000
  1293 				"", 4, 5000
  1294 				)
  1294 				)
  1295 
  1295 
  1296 	CreateMeSomeCircles()
  1296 	CreateMeSomeCircles()
  1297 	RebuildTeamInfo() -- control
  1297 	RebuildTeamInfo() -- control
  1298 	lastRound = TotalRounds
  1298 	lastRound = TotalRounds
  1419 		if beam == true then
  1419 		if beam == true then
  1420 			shieldHealth = shieldHealth - 1
  1420 			shieldHealth = shieldHealth - 1
  1421 			if shieldHealth < 80 then -- <= 80
  1421 			if shieldHealth < 80 then -- <= 80
  1422 				shieldHealth = 80
  1422 				shieldHealth = 80
  1423 				beam = false
  1423 				beam = false
  1424 				AddCaption(loc("Shield Depleted"),0xff0000ff,capgrpMessage)
  1424 				AddCaption(loc("Shield depleted"),0xff0000ff,capgrpMessage)
  1425 				PlaySound(sndMineTick)
  1425 				PlaySound(sndMineTick)
  1426 				PlaySound(sndSwitchHog)
  1426 				PlaySound(sndSwitchHog)
  1427 			end
  1427 			end
  1428 		end
  1428 		end
  1429 
  1429 
  1516 
  1516 
  1517 				if shieldMiser == true then
  1517 				if shieldMiser == true then
  1518 
  1518 
  1519 					p = (roundKills*3.5) - ((roundKills*3.5)%1) + 2
  1519 					p = (roundKills*3.5) - ((roundKills*3.5)%1) + 2
  1520 
  1520 
  1521 					AddCaption(loc("Shield Miser!") .." +" .. p .." ".. loc("points") .. "!",0xffba00ff,capgrpAmmoinfo)
  1521 					AddCaption(string.format(loc("Shield Miser! +%d points!"), p),0xffba00ff,capgrpAmmoinfo)
  1522 					AwardPoints(p)
  1522 					AwardPoints(p)
  1523 				end
  1523 				end
  1524 
  1524 
  1525 				local accuracy = (shotsHit / shotsFired) * 100
  1525 				local accuracy = (shotsHit / shotsFired) * 100
  1526 				if (accuracy >= 80) and (shotsFired > 4) then
  1526 				if (accuracy >= 80) and (shotsFired > 4) then
  1527 					AddCaption(loc("Accuracy Bonus!") .. " +15 " .. loc("points") .. "!",0xffba00ff,capgrpVolume)
  1527 					AddCaption(loc("Accuracy Bonus! +15 points"),0xffba00ff,capgrpVolume)
  1528 					AwardPoints(15)
  1528 					AwardPoints(15)
  1529 
  1529 
  1530 
  1530 
  1531 					-- special award for no misses
  1531 					-- special award for no misses
  1532 					local award = false
  1532 					local award = false
  1654 
  1654 
  1655 function onGearDamage(gear, damage)
  1655 function onGearDamage(gear, damage)
  1656 	if GetGearType(gear) == gtHedgehog then
  1656 	if GetGearType(gear) == gtHedgehog then
  1657 		if (fierceComp == false) and (damage >= 60) and (GetHogClan(gear) ~= GetHogClan(CurrentHedgehog)) then
  1657 		if (fierceComp == false) and (damage >= 60) and (GetHogClan(gear) ~= GetHogClan(CurrentHedgehog)) then
  1658 			fierceComp = true
  1658 			fierceComp = true
  1659 			AddCaption(loc("Fierce Competition!") .. " +8 " .. loc("points") .. "!",0xffba00ff,capgrpGameState)
  1659 			AddCaption(loc("Fierce Competition! +8 points!"),0xffba00ff,capgrpGameState)
  1660 			AwardPoints(8)
  1660 			AwardPoints(8)
  1661 		end
  1661 		end
  1662 	end
  1662 	end
  1663 end
  1663 end
  1664 
  1664 
  1866 		vCircActive[i] = false
  1866 		vCircActive[i] = false
  1867 
  1867 
  1868 		if (vType[i] == "drone") then
  1868 		if (vType[i] == "drone") then
  1869 			PlaySound(sndHellishImpact4)
  1869 			PlaySound(sndHellishImpact4)
  1870 			TimeLeft = TimeLeft + timeBonus
  1870 			TimeLeft = TimeLeft + timeBonus
  1871 			AddCaption(loc("Time Extended!") .. "+" .. timeBonus .. loc("sec"), 0xff0000ff,capgrpMessage )
  1871 			AddCaption(string.format(loc("Time Extended! +%dsec"), timeBonus), 0xff0000ff,capgrpMessage )
  1872 			DrawTag(0)
  1872 			DrawTag(0)
  1873 
  1873 
  1874 			morte = AddGear(vCircX[i], vCircY[i], gtExplosives, 0, 0, 0, 1)
  1874 			morte = AddGear(vCircX[i], vCircY[i], gtExplosives, 0, 0, 0, 1)
  1875 			SetHealth(morte, 0)
  1875 			SetHealth(morte, 0)
  1876 
  1876 
  1877 			RK = RK + 1
  1877 			RK = RK + 1
  1878 			if RK == 5 then
  1878 			if RK == 5 then
  1879 				RK = 0
  1879 				RK = 0
  1880 				AddCaption(loc("Drone Hunter!") .. " +10 " .. loc("points") .. "!",0xffba00ff,capgrpMessage2)
  1880 				AddCaption(loc("Drone Hunter! +10 points!"),0xffba00ff,capgrpMessage2)
  1881 				AwardPoints(10)
  1881 				AwardPoints(10)
  1882 			end
  1882 			end
  1883 
  1883 
  1884 		elseif (vType[i] == "ammo") then
  1884 		elseif (vType[i] == "ammo") then
  1885 			AddVisualGear(vCircX[i], vCircY[i], vgtExplosion, 0, false)
  1885 			AddVisualGear(vCircX[i], vCircY[i], vgtExplosion, 0, false)
  1890 			DrawTag(1)
  1890 			DrawTag(1)
  1891 
  1891 
  1892 			GK = GK + 1
  1892 			GK = GK + 1
  1893 			if GK == 3 then
  1893 			if GK == 3 then
  1894 				GK = 0
  1894 				GK = 0
  1895 				AddCaption(loc("Ammo Maniac!") .. " +5 " .. loc("points") .. "!",0xffba00ff,capgrpMessage2)
  1895 				AddCaption(loc("Ammo Maniac! +5 points!"),0xffba00ff,capgrpMessage2)
  1896 				AwardPoints(5)
  1896 				AwardPoints(5)
  1897 			end
  1897 			end
  1898 
  1898 
  1899 		elseif (vType[i] == "bonus") then
  1899 		elseif (vType[i] == "bonus") then
  1900 
  1900 
  1919 			DrawTag(2)
  1919 			DrawTag(2)
  1920 
  1920 
  1921 			OK = OK + 1
  1921 			OK = OK + 1
  1922 			if OK == 3 then
  1922 			if OK == 3 then
  1923 				OK = 0
  1923 				OK = 0
  1924 				AddCaption(loc("Shield Seeker!") .. " + 10 " .. loc("points") .. "!",0xffba00ff,capgrpMessage2)
  1924 				AddCaption(loc("Shield Seeker! +10 points!"),0xffba00ff,capgrpMessage2)
  1925 				AwardPoints(10)
  1925 				AwardPoints(10)
  1926 			end
  1926 			end
  1927 
  1927 
  1928 		elseif (vType[i] == "blueboss") then
  1928 		elseif (vType[i] == "blueboss") then
  1929 			PlaySound(sndHellishImpact3)
  1929 			PlaySound(sndHellishImpact3)
  1930 			AddCaption(loc("Boss defeated!") .. " +30 " .. loc("points") .. "!", 0x0050ffff,capgrpMessage)
  1930 			AddCaption(loc("Boss defeated! +30 points!"), 0x0050ffff,capgrpMessage)
  1931 
  1931 
  1932 			morte = AddGear(vCircX[i], vCircY[i], gtExplosives, 0, 0, 0, 1)
  1932 			morte = AddGear(vCircX[i], vCircY[i], gtExplosives, 0, 0, 0, 1)
  1933 			SetHealth(morte, 0)
  1933 			SetHealth(morte, 0)
  1934 
  1934 
  1935 			BK = BK + 1
  1935 			BK = BK + 1
  1936 			if BK == 2 then
  1936 			if BK == 2 then
  1937 				BK = 0
  1937 				BK = 0
  1938 				AddCaption(loc("Boss Slayer!") .. " +25 " .. loc("points") .. "!",0xffba00ff,capgrpMessage2)
  1938 				AddCaption(loc("Boss Slayer! +25 points!"),0xffba00ff,capgrpMessage2)
  1939 				AwardPoints(25)
  1939 				AwardPoints(25)
  1940 			end
  1940 			end
  1941 
  1941 
  1942 		end
  1942 		end
  1943 
  1943 
  1947 		res = "fatal"
  1947 		res = "fatal"
  1948 
  1948 
  1949 		chainCounter = 3000
  1949 		chainCounter = 3000
  1950 		chainLength = chainLength + 1
  1950 		chainLength = chainLength + 1
  1951 		if chainLength > 1 then
  1951 		if chainLength > 1 then
  1952 			AddCaption( chainLength .. "-" .. loc("Hit Combo!") .. " +" .. chainLength*2 .. " " .. loc("points") .. "!",0xffba00ff,capgrpAmmostate)
  1952 			AddCaption( string.format(loc("%d-Hit Combo! +%d points!"), chainLength, chainLength*2),0xffba00ff,capgrpAmmostate)
  1953 			AwardPoints(chainLength*2)
  1953 			AwardPoints(chainLength*2)
  1954 		end
  1954 		end
  1955 
  1955 
  1956 		awardCombo = UpdateSimpleAward(awardCombo, chainLength, 5)
  1956 		awardCombo = UpdateSimpleAward(awardCombo, chainLength, 5)
  1957 
  1957 
  2119 
  2119 
  2120 				dist = (GetDistFromXYtoXY(vCircX[i], vCircY[i], getGearValue(gear,"XP"), getGearValue(gear,"YP")) - (NR*NR))
  2120 				dist = (GetDistFromXYtoXY(vCircX[i], vCircY[i], getGearValue(gear,"XP"), getGearValue(gear,"YP")) - (NR*NR))
  2121 				--AddCaption(loc("Dist: ") .. dist .. "!",0xffba00ff,capgrpGameState)
  2121 				--AddCaption(loc("Dist: ") .. dist .. "!",0xffba00ff,capgrpGameState)
  2122 				if dist >= 1000000 then
  2122 				if dist >= 1000000 then
  2123 					sniperHits = sniperHits +1
  2123 					sniperHits = sniperHits +1
  2124 					AddCaption(loc("Sniper!") .. " +8 " .. loc("points") .. "!",0xffba00ff,capgrpGameState)
  2124 					AddCaption(loc("Sniper! +8 points!"),0xffba00ff,capgrpGameState)
  2125 					AwardPoints(8)
  2125 					AwardPoints(8)
  2126 					if sniperHits == 3 then
  2126 					if sniperHits == 3 then
  2127 						sniperHits = 0
  2127 						sniperHits = 0
  2128 						AddCaption(loc("They Call Me Bullseye!") .. " +16 " .. loc("points") .. "!",0xffba00ff,capgrpGameState)
  2128 						AddCaption(loc("They Call Me Bullseye! +16 points!"),0xffba00ff,capgrpGameState)
  2129 						AwardPoints(16)
  2129 						AwardPoints(16)
  2130 					end
  2130 					end
  2131 				elseif dist <= 6000 then
  2131 				elseif dist <= 6000 then
  2132 					pointBlankHits = pointBlankHits +1
  2132 					pointBlankHits = pointBlankHits +1
  2133 					if pointBlankHits == 3 then
  2133 					if pointBlankHits == 3 then
  2134 						pointBlankHits = 0
  2134 						pointBlankHits = 0
  2135 						AddCaption(loc("Point Blank Combo!") .. " +5 " .. loc("points") .. "!",0xffba00ff,capgrpGameState)
  2135 						AddCaption(loc("Point Blank Combo! +5 points!"),0xffba00ff,capgrpGameState)
  2136 						AwardPoints(5)
  2136 						AwardPoints(5)
  2137 					end
  2137 					end
  2138 				end
  2138 				end
  2139 
  2139 
  2140 				AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
  2140 				AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
  2145 
  2145 
  2146 				CircleDamaged(i)
  2146 				CircleDamaged(i)
  2147 
  2147 
  2148 				circsHit = circsHit + 1
  2148 				circsHit = circsHit + 1
  2149 				if circsHit > 1 then
  2149 				if circsHit > 1 then
  2150 					AddCaption(loc("Multi-shot!") .. " +15 " .. loc("points") .. "!",0xffba00ff,capgrpAmmostate)
  2150 					AddCaption(loc("Multi-shot! +15 points!"),0xffba00ff,capgrpAmmostate)
  2151 					AwardPoints(15)
  2151 					AwardPoints(15)
  2152 						circsHit = 0
  2152 						circsHit = 0
  2153 				end
  2153 				end
  2154 
  2154 
  2155 				shotsHit = shotsHit + 1
  2155 				shotsHit = shotsHit + 1
  2173 				DeleteGear(gear)
  2173 				DeleteGear(gear)
  2174 
  2174 
  2175 				SK = SK + 1
  2175 				SK = SK + 1
  2176 				if SK == 5 then
  2176 				if SK == 5 then
  2177 					SK = 0
  2177 					SK = 0
  2178 					AddCaption(loc("Shield Master!") .. " +10 " .. loc("points") .. "!",0xffba00ff,capgrpAmmoinfo)
  2178 					AddCaption(loc("Shield Master! +10 points!"),0xffba00ff,capgrpAmmoinfo)
  2179 					AwardPoints(10)
  2179 					AwardPoints(10)
  2180 				end
  2180 				end
  2181 			end
  2181 			end
  2182 
  2182 
  2183 		elseif dist < 1600 then
  2183 		elseif dist < 1600 then
  2240 				WellHeAintGonnaJumpNoMore(GetX(CurrentHedgehog),GetY(CurrentHedgehog),explosion)
  2240 				WellHeAintGonnaJumpNoMore(GetX(CurrentHedgehog),GetY(CurrentHedgehog),explosion)
  2241 
  2241 
  2242 				if ss == "fatal" then
  2242 				if ss == "fatal" then
  2243 
  2243 
  2244 					if (wepAmmo[0] == 0) and (TimeLeft <= 9) then
  2244 					if (wepAmmo[0] == 0) and (TimeLeft <= 9) then
  2245 						AddCaption(loc("Kamikaze Expert!") .. " +15 " .. loc("points") .. "!",0xffba00ff,capgrpMessage)
  2245 						AddCaption(loc("Kamikaze Expert! +15 points!"),0xffba00ff,capgrpMessage)
  2246 						AwardPoints(15)
  2246 						AwardPoints(15)
  2247 						PlaySound(sndKamikaze, CurrentHedgehog)
  2247 						PlaySound(sndKamikaze, CurrentHedgehog)
  2248 					elseif (wepAmmo[0] == 0) then
  2248 					elseif (wepAmmo[0] == 0) then
  2249 						AddCaption(loc("Depleted Kamikaze!") .. " +5 " .. loc("points") .. "!",0xffba00ff,capgrpMessage)
  2249 						AddCaption(loc("Depleted Kamikaze! +5 points!"),0xffba00ff,capgrpMessage)
  2250 						AwardPoints(5)
  2250 						AwardPoints(5)
  2251 						PlaySound(sndKamikaze, CurrentHedgehog)
  2251 						PlaySound(sndKamikaze, CurrentHedgehog)
  2252 					elseif TimeLeft <= 9 then
  2252 					elseif TimeLeft <= 9 then
  2253 						AddCaption(loc("Timed Kamikaze!") .. " +10 " .. loc("points") .. "!",0xffba00ff,capgrpMessage)
  2253 						AddCaption(loc("Timed Kamikaze! +10 points!"),0xffba00ff,capgrpMessage)
  2254 						AwardPoints(10)
  2254 						AwardPoints(10)
  2255 						PlaySound(sndKamikaze, CurrentHedgehog)
  2255 						PlaySound(sndKamikaze, CurrentHedgehog)
  2256 					end
  2256 					end
  2257 				end
  2257 				end
  2258 
  2258