share/hedgewars/Data/Scripts/Multiplayer/Space_Invasion.lua
changeset 13028 8b6d8418d580
parent 13026 ca7fdb431b34
child 13272 5984e8c6cbeb
equal deleted inserted replaced
13027:625d5a45f267 13028:8b6d8418d580
   416 local awardRoundScore	-- hog with most score in 1 round (min. 50)
   416 local awardRoundScore	-- hog with most score in 1 round (min. 50)
   417 local awardRoundKills	-- most kills in 1 round (min. 5)
   417 local awardRoundKills	-- most kills in 1 round (min. 5)
   418 local awardAccuracy	-- awarded to hog who didn’t miss once in his round, with most kills (min. 5)
   418 local awardAccuracy	-- awarded to hog who didn’t miss once in his round, with most kills (min. 5)
   419 local awardCombo	-- hog with longest combo (min. 5)
   419 local awardCombo	-- hog with longest combo (min. 5)
   420 
   420 
       
   421 
       
   422 
       
   423 -- Taunt trackers
       
   424 local tauntTimer = -1
       
   425 local tauntGear = nil
       
   426 local tauntSound = nil
       
   427 local tauntClanShots = 0 -- hogs of same clans shot in this turn
       
   428 
   421 ---------------------
   429 ---------------------
   422 -- tumbler goods
   430 -- tumbler goods
   423 ---------------------
   431 ---------------------
   424 
   432 
   425 local moveTimer = 0
   433 local moveTimer = 0
  1087 			PlaySound(sndDenied)
  1095 			PlaySound(sndDenied)
  1088 		elseif (beam == false) and (shieldHealth > 80) then
  1096 		elseif (beam == false) and (shieldHealth > 80) then
  1089 			beam = true
  1097 			beam = true
  1090 			SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), 40, 255, 1, 10, 0, 300, 1, 0xa800ffff)
  1098 			SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), 40, 255, 1, 10, 0, 300, 1, 0xa800ffff)
  1091 			AddCaption( string.format(loc("Shield ON: %d power remaining"), shieldHealth - 80))
  1099 			AddCaption( string.format(loc("Shield ON: %d power remaining"), shieldHealth - 80))
  1092 			PlaySound(sndWarp)
  1100 			PlaySound(sndInvulnerable)
  1093 		else
  1101 		else
  1094 			beam = false
  1102 			beam = false
  1095 			SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), 0, 0, 1, 10, 0, 0, 0, 0xa800ffff)
  1103 			SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), 0, 0, 1, 10, 0, 0, 0, 0xa800ffff)
  1096 			AddCaption( string.format(loc("Shield OFF: %d power remaining"), shieldHealth - 80))
  1104 			AddCaption( string.format(loc("Shield OFF: %d power remaining"), shieldHealth - 80))
  1097 		end
  1105 		end
  1308 	sniperHits = 0
  1316 	sniperHits = 0
  1309 	pointBlankHits = 0
  1317 	pointBlankHits = 0
  1310 	chainLength = 0
  1318 	chainLength = 0
  1311 	chainCounter = 0
  1319 	chainCounter = 0
  1312 
  1320 
       
  1321 	tauntClanShots = 0
       
  1322 	tauntTimer = -1
       
  1323 
  1313 	-------------------------
  1324 	-------------------------
  1314 	-- gaudy racer
  1325 	-- gaudy racer
  1315 	-------------------------
  1326 	-------------------------
  1316 	CheckForNewRound()
  1327 	CheckForNewRound()
  1317 
  1328 
  1398 				PlaySound(sndMineTick)
  1409 				PlaySound(sndMineTick)
  1399 				PlaySound(sndSwitchHog)
  1410 				PlaySound(sndSwitchHog)
  1400 			end
  1411 			end
  1401 		end
  1412 		end
  1402 
  1413 
  1403 
  1414 		if tauntTimer > 0 then
       
  1415 			tauntTimer = tauntTimer - 100
       
  1416 			if tauntTimer <= 0 and tumbleStarted and not stopMovement then
       
  1417 				PlaySound(tauntSound, tauntGear)
       
  1418 			end
       
  1419 		end
  1404 
  1420 
  1405 		--nw WriteLnToConsole("Starting ThingsToBeRunOnGears()")
  1421 		--nw WriteLnToConsole("Starting ThingsToBeRunOnGears()")
  1406 
  1422 
  1407 		runOnGears(ThingsToBeRunOnGears)
  1423 		runOnGears(ThingsToBeRunOnGears)
  1408 
  1424 
  1626 	--WriteLnToConsole("End of GameTick")
  1642 	--WriteLnToConsole("End of GameTick")
  1627 
  1643 
  1628 end
  1644 end
  1629 
  1645 
  1630 function onGearDamage(gear, damage)
  1646 function onGearDamage(gear, damage)
  1631 	if GetGearType(gear) == gtHedgehog then
  1647 	if GetGearType(gear) == gtHedgehog and damage >= 60 then
  1632 		if (fierceComp == false) and (damage >= 60) and (GetHogClan(gear) ~= GetHogClan(CurrentHedgehog)) then
  1648 		if GetHogClan(gear) ~= GetHogClan(CurrentHedgehog) then
  1633 			fierceComp = true
  1649 			if (fierceComp == false) then
  1634 			AddCaption(loc("Fierce Competition! +8 points!"),0xffba00ff,capgrpGameState)
  1650 				fierceComp = true
  1635 			AwardPoints(8)
  1651 				AddCaption(loc("Fierce Competition! +8 points!"),0xffba00ff,capgrpGameState)
       
  1652 				AwardPoints(8)
       
  1653 			end
       
  1654 
       
  1655 			tauntTimer = 500
       
  1656 			tauntGear = gear
       
  1657 			local r = math.random(1, 2)
       
  1658 			if r == 1 then
       
  1659 				tauntSound = sndIllGetYou
       
  1660 			else
       
  1661 				tauntSound = sndJustYouWait
       
  1662 			end
       
  1663 		elseif gear ~= CurrentHedgehog then
       
  1664 			tauntTimer = 500
       
  1665 			tauntGear = gear
       
  1666 			if tauntClanShots == 0 then
       
  1667 				tauntSound = sndSameTeam
       
  1668 			else
       
  1669 				tauntSound = sndTraitor
       
  1670 			end
       
  1671 			tauntClanShots = tauntClanShots + 1
  1636 		end
  1672 		end
  1637 	end
  1673 	end
  1638 end
  1674 end
  1639 
  1675 
  1640 function onGearResurrect(gear)
  1676 function onGearResurrect(gear)
  1900 				AwardPoints(10)
  1936 				AwardPoints(10)
  1901 			end
  1937 			end
  1902 
  1938 
  1903 		elseif (vType[i] == "blueboss") then
  1939 		elseif (vType[i] == "blueboss") then
  1904 			PlaySound(sndHellishImpact3)
  1940 			PlaySound(sndHellishImpact3)
       
  1941 			tauntTimer = 300
       
  1942 			tauntSound = sndEnemyDown
       
  1943 			tauntGear = CurrentHedgehog
  1905 			AddCaption(loc("Boss defeated! +30 points!"), 0x0050ffff,capgrpMessage)
  1944 			AddCaption(loc("Boss defeated! +30 points!"), 0x0050ffff,capgrpMessage)
  1906 
  1945 
  1907 			morte = AddGear(vCircX[i], vCircY[i], gtExplosives, 0, 0, 0, 1)
  1946 			morte = AddGear(vCircX[i], vCircY[i], gtExplosives, 0, 0, 0, 1)
  1908 			SetHealth(morte, 0)
  1947 			SetHealth(morte, 0)
  1909 
  1948 
  2045 
  2084 
  2046 	end
  2085 	end
  2047 
  2086 
  2048 end
  2087 end
  2049 
  2088 
  2050 function WellHeAintGonnaJumpNoMore(x,y,explode)
  2089 function WellHeAintGonnaJumpNoMore(x,y,explode,kamikaze)
  2051 	if explode==true then
  2090 	if explode==true then
  2052 		AddVisualGear(x, y, vgtBigExplosion, 0, false)
  2091 		AddVisualGear(x, y, vgtBigExplosion, 0, false)
  2053 		PlaySound(sndExplosion)
  2092 		PlaySound(sndExplosion)
  2054 		local r = math.random(1,3)
  2093 		local r = math.random(1,3)
  2055 		PlaySound(_G["sndOoff"..r], CurrentHedgehog)
  2094 		PlaySound(_G["sndOoff"..r], CurrentHedgehog)
  2056 	end
  2095 	end
  2057 
  2096 
  2058 	playerIsFine = false
  2097 	playerIsFine = false
  2059 	AddCaption(loc("GOTCHA!"))
  2098 	AddCaption(loc("GOTCHA!"))
  2060 	FailGraphics()
  2099 	FailGraphics()
  2061 	PlaySound(sndHellish)
  2100 
       
  2101 	if not kamikaze then
       
  2102 		PlaySound(sndHellish)
       
  2103 	end
  2062 
  2104 
  2063 	targetHit = true
  2105 	targetHit = true
  2064 
  2106 
  2065 end
  2107 end
  2066 
  2108 
  2217 			then
  2259 			then
  2218 
  2260 
  2219 				ss = CircleDamaged(i)
  2261 				ss = CircleDamaged(i)
  2220 				local explosion
  2262 				local explosion
  2221 				if vType[i] == "blueboss" then explosion = true else explosion = false end
  2263 				if vType[i] == "blueboss" then explosion = true else explosion = false end
  2222 				WellHeAintGonnaJumpNoMore(GetX(CurrentHedgehog),GetY(CurrentHedgehog),explosion)
  2264 
  2223 
  2265 				local kamikaze = false
  2224 				if ss == "fatal" then
  2266 				if ss == "fatal" then
  2225 
       
  2226 					if (wepAmmo[0] == 0) and (TimeLeft <= 9) then
  2267 					if (wepAmmo[0] == 0) and (TimeLeft <= 9) then
  2227 						AddCaption(loc("Kamikaze Expert! +15 points!"),0xffba00ff,capgrpMessage)
  2268 						AddCaption(loc("Kamikaze Expert! +15 points!"),0xffba00ff,capgrpMessage)
  2228 						AwardPoints(15)
  2269 						AwardPoints(15)
  2229 						PlaySound(sndKamikaze, CurrentHedgehog)
  2270 						PlaySound(sndKamikaze, CurrentHedgehog)
       
  2271 						kamikaze = true
  2230 					elseif (wepAmmo[0] == 0) then
  2272 					elseif (wepAmmo[0] == 0) then
  2231 						AddCaption(loc("Depleted Kamikaze! +5 points!"),0xffba00ff,capgrpMessage)
  2273 						AddCaption(loc("Depleted Kamikaze! +5 points!"),0xffba00ff,capgrpMessage)
  2232 						AwardPoints(5)
  2274 						AwardPoints(5)
  2233 						PlaySound(sndKamikaze, CurrentHedgehog)
  2275 						PlaySound(sndKamikaze, CurrentHedgehog)
       
  2276 						kamikaze = true
  2234 					elseif TimeLeft <= 9 then
  2277 					elseif TimeLeft <= 9 then
  2235 						AddCaption(loc("Timed Kamikaze! +10 points!"),0xffba00ff,capgrpMessage)
  2278 						AddCaption(loc("Timed Kamikaze! +10 points!"),0xffba00ff,capgrpMessage)
  2236 						AwardPoints(10)
  2279 						AwardPoints(10)
  2237 						PlaySound(sndKamikaze, CurrentHedgehog)
  2280 						PlaySound(sndKamikaze, CurrentHedgehog)
       
  2281 						kamikaze = true
  2238 					end
  2282 					end
  2239 				end
  2283 				end
       
  2284 				WellHeAintGonnaJumpNoMore(GetX(CurrentHedgehog),GetY(CurrentHedgehog),explosion,kamikaze)
  2240 
  2285 
  2241 			end
  2286 			end
  2242 
  2287 
  2243 
  2288 
  2244 		end
  2289 		end