share/hedgewars/Data/Scripts/Multiplayer/Space_Invasion.lua
changeset 13580 dc4ce9f486b0
parent 13579 ff7378430675
child 13643 690cc84e9fd6
equal deleted inserted replaced
13579:ff7378430675 13580:dc4ce9f486b0
   106 
   106 
   107 -- new invader: golden snitch, doesn't show up on your radar
   107 -- new invader: golden snitch, doesn't show up on your radar
   108 
   108 
   109 -- maybe replace (48/100*vCircRadius[i])/2 with something better
   109 -- maybe replace (48/100*vCircRadius[i])/2 with something better
   110 
   110 
       
   111 -------------------
       
   112 -- CAPTION TYPES --
       
   113 -------------------
       
   114 --[[
       
   115 The captions have been carefully assigned to avoid overlapping.
       
   116 
       
   117 capgrpMessage: Basic bonuses for a simple action, rounds complete
       
   118 capgrpMessage2: Extended bonus, awarded for repeating a basic bonus
       
   119 capgrpVolume: X-Hit Combo
       
   120 capgrpGameState: End of turn information, kamikaze achievements
       
   121 capgrpAmmoinfo: Ammo type at start of turn; Multi-shot, Shield Miser
       
   122 capgrpAmmostate: Remaining ammo, depleted ammo; Accuracy Bonus, Sniper, They Call Me Bullseye, Point Blank Combo
       
   123 ]]
   111 
   124 
   112 ------- CODE FOLLOWS -------
   125 ------- CODE FOLLOWS -------
   113 
   126 
   114 ----------------------------------
   127 ----------------------------------
   115 -- so I herd u liek wariables
   128 -- so I herd u liek wariables
   299 local vCircFuckAll = {}
   312 local vCircFuckAll = {}
   300 local vCircRadius = {}
   313 local vCircRadius = {}
   301 local vCircWidth = {}
   314 local vCircWidth = {}
   302 local vCircCol = {}
   315 local vCircCol = {}
   303 
   316 
       
   317 -- Colors
       
   318 -- Invaders
       
   319 local colorDrone = 0xFF0000FF
       
   320 local colorBoss = 0x0050FFFF
       
   321 local colorBossParticle = colorBoss
       
   322 local colorAmmo = 0x00FF00FF
       
   323 local colorShield = 0xA800FFFF
       
   324 local colorShieldParticle = colorShield
       
   325 local colorDisabled = 0xFFFFFFFF -- disabled invader at end of turn
       
   326 
       
   327 -- Other colors
       
   328 local colorMsgDepleted = 0xFF0000FF
       
   329 local colorMsgBonus = 0xFFBA00FF
       
   330 local colorTimer = 0xFFEE00FF
       
   331 local colorScore = 0xFFFFFFFF
       
   332 local colorShockwave = 0xFF3300FF
       
   333 
   304 -------------------------------------------
   334 -------------------------------------------
   305 -- some lazy copypasta/modified methods
   335 -- some lazy copypasta/modified methods
   306 -------------------------------------------
   336 -------------------------------------------
   307 
   337 
   308 
   338 
   309 
   339 
   310 function HideTag(i)
   340 function HideTag(i)
   311 
   341 
   312 	SetVisualGearValues(vTag[i],0,0,0,0,0,1,0, 0, 240000, 0xffffff00)
   342 	SetVisualGearValues(vTag[i],0,0,0,0,0,1,0, 0, 240000, 0xFFFFFF00)
   313 
   343 
   314 end
   344 end
   315 
   345 
   316 function DrawTag(i)
   346 function DrawTag(i)
   317 
   347 
   319 	local xOffset = 40
   349 	local xOffset = 40
   320 	local yOffset, tValue, tCol
   350 	local yOffset, tValue, tCol
   321 
   351 
   322 	if i == TAG_TIME then
   352 	if i == TAG_TIME then
   323 		yOffset = 40
   353 		yOffset = 40
   324 		tCol = 0xffee00ff
   354 		tCol = colorTimer
   325 		tValue = TimeLeft
   355 		tValue = TimeLeft
   326 	elseif i == TAG_BARRELS then
   356 	elseif i == TAG_BARRELS then
   327 		zoomL = 1.1
   357 		zoomL = 1.1
   328 		yOffset = 70
   358 		yOffset = 70
   329 		tCol = 0x00ff00ff
   359 		tCol = colorAmmo
   330 		tValue = wepAmmo[wepIndex] --primShotsLeft
   360 		tValue = wepAmmo[wepIndex]
   331 	elseif i == TAG_SHIELD then
   361 	elseif i == TAG_SHIELD then
   332 		zoomL = 1.1
   362 		zoomL = 1.1
   333 		xOffset = 40 + 35
   363 		xOffset = 40 + 35
   334 		yOffset = 70
   364 		yOffset = 70
   335 		tCol = 0xa800ffff
   365 		tCol = colorShield
   336 		tValue = shieldHealth - 80
   366 		tValue = shieldHealth - 80
   337 	elseif i == TAG_ROUND_SCORE then
   367 	elseif i == TAG_ROUND_SCORE then
   338 		zoomL = 1.1
   368 		zoomL = 1.1
   339 		xOffset = 40
   369 		xOffset = 40
   340 		yOffset = 100
   370 		yOffset = 100
   341 		tCol = 0xffffffff
   371 		tCol = colorScore
   342 		tValue = roundScore
   372 		tValue = roundScore
   343 	end
   373 	end
   344 
   374 
   345 	DeleteVisualGear(vTag[i])
   375 	DeleteVisualGear(vTag[i])
   346 	vTag[i] = AddVisualGear(0, 0, vgtHealthTag, 0, false)
   376 	vTag[i] = AddVisualGear(0, 0, vgtHealthTag, 0, false)
   523 	local statusText, scoreText
   553 	local statusText, scoreText
   524 	if roundNumber >= roundLimit then
   554 	if roundNumber >= roundLimit then
   525 		statusText = loc("Game over!")
   555 		statusText = loc("Game over!")
   526 		scoreText = loc("Final team scores:")
   556 		scoreText = loc("Final team scores:")
   527 	else
   557 	else
   528 		AddCaption(string.format(loc("Rounds complete: %d/%d"), roundNumber, roundLimit, 0xFFFFFFFF))
   558 		AddCaption(string.format(loc("Rounds complete: %d/%d"), roundNumber, roundLimit), 0xFFFFFFFF, capgrpMessage)
   529 		return
   559 		return
   530 	end
   560 	end
   531 	local displayTime
   561 	local displayTime
   532 	if roundNumber >= roundLimit then
   562 	if roundNumber >= roundLimit then
   533 		displayTime = 20000
   563 		displayTime = 20000
   544 		for i = 0, (numhhs-1) do
   574 		for i = 0, (numhhs-1) do
   545 			if GetHogTeamName(hhs[i]) == winnerTeam then
   575 			if GetHogTeamName(hhs[i]) == winnerTeam then
   546 				SetState(hhs[i], bor(GetState(hhs[i]), gstWinner))
   576 				SetState(hhs[i], bor(GetState(hhs[i]), gstWinner))
   547 			end
   577 			end
   548 		end
   578 		end
   549 		AddCaption(string.format(loc("%s wins!"), winnerTeam))
   579 		AddCaption(string.format(loc("%s wins!"), winnerTeam), 0xFFFFFFFF, capgrpGameState)
   550 		SendStat(siGameResult, string.format(loc("%s wins!"), winnerTeam))
   580 		SendStat(siGameResult, string.format(loc("%s wins!"), winnerTeam))
   551 
   581 
   552 		for i = 1, TeamsCount do
   582 		for i = 1, TeamsCount do
   553 			SendStat(siPointType, loc("points"))
   583 			SendStat(siPointType, loc("points"))
   554 			SendStat(siPlayerKills, tostring(teamStats[i].score), teamStats[i].name)
   584 			SendStat(siPlayerKills, tostring(teamStats[i].score), teamStats[i].name)
   800 
   830 
   801 	wepIndex = wepIndex + 1
   831 	wepIndex = wepIndex + 1
   802 	if wepIndex == wepCount then
   832 	if wepIndex == wepCount then
   803 		wepIndex = 0
   833 		wepIndex = 0
   804 	end
   834 	end
       
   835 	AddCaption(wep[wepIndex], GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo)
   805 end
   836 end
   806 
   837 
   807 -- derp tumbler
   838 -- derp tumbler
   808 function onPrecise()
   839 function onPrecise()
   809 
   840 
   821 			y = y*2
   852 			y = y*2
   822 			SetGearVelocity(morte, x, y)
   853 			SetGearVelocity(morte, x, y)
   823 
   854 
   824 			if wepAmmo[wepIndex] == 0 then
   855 			if wepAmmo[wepIndex] == 0 then
   825 				PlaySound(sndSuddenDeath)
   856 				PlaySound(sndSuddenDeath)
   826 				AddCaption(loc("Ammo depleted!"),0xff0000ff,capgrpMessage)
   857 				AddCaption(loc("Ammo depleted!"),colorMsgDepleted,capgrpAmmostate)
   827 			else
   858 			else
   828 				PlaySound(sndThrowRelease)
   859 				PlaySound(sndThrowRelease)
   829 			end
   860 			end
   830 			DrawTag(TAG_BARRELS)
   861 			DrawTag(TAG_BARRELS)
   831 
   862 
   835 			DrawTag(TAG_BARRELS)
   866 			DrawTag(TAG_BARRELS)
   836 		end
   867 		end
   837 
   868 
   838 	elseif (wepAmmo[wepIndex] == 0) and (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then
   869 	elseif (wepAmmo[wepIndex] == 0) and (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then
   839 		PlaySound(sndDenied)
   870 		PlaySound(sndDenied)
   840 		AddCaption(loc("Ammo depleted!"),0xff0000ff,capgrpMessage)
   871 		AddCaption(loc("Ammo depleted!"),colorMsgDepleted,capgrpAmmostate)
   841 	end
   872 	end
   842 
   873 
   843 	preciseOn = true
   874 	preciseOn = true
   844 
   875 
   845 end
   876 end
   851 function onLJump()
   882 function onLJump()
   852 
   883 
   853 	if (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then
   884 	if (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then
   854 		shieldMiser = false
   885 		shieldMiser = false
   855 		if shieldHealth == 80 then
   886 		if shieldHealth == 80 then
   856 			AddCaption(loc("Shield depleted"),0xff0000ff,capgrpMessage)
   887 			AddCaption(loc("Shield depleted"),colorMsgDepleted,capgrpAmmostate)
   857 			PlaySound(sndDenied)
   888 			PlaySound(sndDenied)
   858 		elseif (beam == false) and (shieldHealth > 80) then
   889 		elseif (beam == false) and (shieldHealth > 80) then
   859 			beam = true
   890 			beam = true
   860 			SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), 40, 255, 1, 10, 0, 300, 1, 0xa800ffff)
   891 			SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), 40, 255, 1, 10, 0, 300, 1, colorShield)
   861 			AddCaption( string.format(loc("Shield ON: %d power remaining"), shieldHealth - 80))
   892 			AddCaption( string.format(loc("Shield ON: %d power remaining"), shieldHealth - 80), colorShield, capgrpAmmostate)
   862 			PlaySound(sndInvulnerable)
   893 			PlaySound(sndInvulnerable)
   863 		else
   894 		else
   864 			beam = false
   895 			beam = false
   865 			SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), 0, 0, 1, 10, 0, 0, 0, 0xa800ffff)
   896 			SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), 0, 0, 1, 10, 0, 0, 0, colorShield)
   866 			AddCaption( string.format(loc("Shield OFF: %d power remaining"), shieldHealth - 80))
   897 			AddCaption( string.format(loc("Shield OFF: %d power remaining"), shieldHealth - 80), colorShield, capgrpAmmostate)
   867 		end
   898 		end
   868 	end
   899 	end
   869 end
   900 end
   870 
   901 
   871 function onHJump()
   902 function onHJump()
   874 	(rAlpha == 255) then
   905 	(rAlpha == 255) then
   875 		if radShotsLeft > 0 then
   906 		if radShotsLeft > 0 then
   876 			rPingTimer = 0
   907 			rPingTimer = 0
   877 			rAlpha = 0
   908 			rAlpha = 0
   878 			radShotsLeft = radShotsLeft -1
   909 			radShotsLeft = radShotsLeft -1
   879 			AddCaption(string.format(loc("Pings left: %d"), radShotsLeft),GetClanColor(GetHogClan(CurrentHedgehog)),capgrpMessage)
   910 			AddCaption(string.format(loc("Pings left: %d"), radShotsLeft),GetClanColor(GetHogClan(CurrentHedgehog)),capgrpAmmostate)
   880 			-- Play sonar sound
   911 			-- Play sonar sound
   881 			PlaySound(sndJetpackLaunch)
   912 			PlaySound(sndJetpackLaunch)
   882 
   913 
   883 		else
   914 		else
   884 			AddCaption(loc("No radar pings left!"),0xFF0000FF,capgrpMessage)
   915 			AddCaption(loc("No radar pings left!"),colorMsgDepleted,capgrpAmmostate)
   885 			PlaySound(sndDenied)
   916 			PlaySound(sndDenied)
   886 		end
   917 		end
   887 	end
   918 	end
   888 
   919 
   889 end
   920 end
  1145 	if gear == CurrentHedgehog then
  1176 	if gear == CurrentHedgehog then
  1146 
  1177 
  1147 		for i = 0,(TeamsCount-1) do
  1178 		for i = 0,(TeamsCount-1) do
  1148 			if teamClan[i] == GetHogClan(CurrentHedgehog) and (teamSurfer[i] == false) then
  1179 			if teamClan[i] == GetHogClan(CurrentHedgehog) and (teamSurfer[i] == false) then
  1149 				teamSurfer[i] = true
  1180 				teamSurfer[i] = true
  1150 				AddCaption(loc("Surfer! +15 points!"),0xffba00ff,capgrpVolume)
  1181 				AddCaption(loc("Surfer! +15 points!"),colorMsgBonus,capgrpMessage)
  1151 				AwardPoints(15)
  1182 				AwardPoints(15)
  1152 			end
  1183 			end
  1153 		end
  1184 		end
  1154 
  1185 
  1155 	end
  1186 	end
  1168 		if beam == true then
  1199 		if beam == true then
  1169 			shieldHealth = shieldHealth - 1
  1200 			shieldHealth = shieldHealth - 1
  1170 			if shieldHealth < 80 then
  1201 			if shieldHealth < 80 then
  1171 				shieldHealth = 80
  1202 				shieldHealth = 80
  1172 				beam = false
  1203 				beam = false
  1173 				AddCaption(loc("Shield depleted"),0xff0000ff,capgrpMessage)
  1204 				AddCaption(loc("Shield depleted"),colorMsgDepleted,capgrpAmmostate)
  1174 				PlaySound(sndMineTick)
  1205 				PlaySound(sndMineTick)
  1175 				PlaySound(sndSwitchHog)
  1206 				PlaySound(sndSwitchHog)
  1176 			end
  1207 			end
  1177 		end
  1208 		end
  1178 
  1209 
  1245 		if PlayerIsFine() == false then
  1276 		if PlayerIsFine() == false then
  1246 			TimeLeft = 0
  1277 			TimeLeft = 0
  1247 		end
  1278 		end
  1248 
  1279 
  1249 		if (TimeLeft == 0) then
  1280 		if (TimeLeft == 0) then
  1250 			if PlayerIsFine() then AddCaption(loc("Time's up!")) end
  1281 			if PlayerIsFine() then
       
  1282 				AddCaption(loc("Time's up!"), 0xFFFFFFFF, capgrpGameState)
       
  1283 			end
  1251 			if (stopMovement == false) then	--time to stop the player
  1284 			if (stopMovement == false) then	--time to stop the player
  1252 				stopMovement = true
  1285 				stopMovement = true
  1253 				boosterOn = false
  1286 				boosterOn = false
  1254 				beam = false
  1287 				beam = false
  1255 				upOn = false
  1288 				upOn = false
  1262 
  1295 
  1263 				if shieldMiser == true then
  1296 				if shieldMiser == true then
  1264 
  1297 
  1265 					local p = (roundKills*3.5) - ((roundKills*3.5)%1) + 2
  1298 					local p = (roundKills*3.5) - ((roundKills*3.5)%1) + 2
  1266 
  1299 
  1267 					AddCaption(string.format(loc("Shield Miser! +%d points!"), p),0xffba00ff,capgrpAmmoinfo)
  1300 					AddCaption(string.format(loc("Shield Miser! +%d points!"), p), colorMsgBonus, capgrpAmmoinfo)
  1268 					AwardPoints(p)
  1301 					AwardPoints(p)
  1269 				end
  1302 				end
  1270 
  1303 
  1271 				local accuracy = (shotsHit / shotsFired) * 100
  1304 				local accuracy = (shotsHit / shotsFired) * 100
  1272 				if (accuracy >= 80) and (shotsFired > 4) then
  1305 				if (accuracy >= 80) and (shotsFired > 4) then
  1273 					AddCaption(loc("Accuracy Bonus! +15 points"),0xffba00ff,capgrpVolume)
  1306 					AddCaption(loc("Accuracy Bonus! +15 points"),colorMsgBonus,capgrpAmmostate)
  1274 					AwardPoints(15)
  1307 					AwardPoints(15)
  1275 
  1308 
  1276 
  1309 
  1277 					-- special award for no misses
  1310 					-- special award for no misses
  1278 					local award = false
  1311 					local award = false
  1385 function onGearDamage(gear, damage)
  1418 function onGearDamage(gear, damage)
  1386 	if GetGearType(gear) == gtHedgehog and damage >= 60 then
  1419 	if GetGearType(gear) == gtHedgehog and damage >= 60 then
  1387 		if GetHogClan(gear) ~= GetHogClan(CurrentHedgehog) then
  1420 		if GetHogClan(gear) ~= GetHogClan(CurrentHedgehog) then
  1388 			if (fierceComp == false) then
  1421 			if (fierceComp == false) then
  1389 				fierceComp = true
  1422 				fierceComp = true
  1390 				AddCaption(loc("Fierce Competition! +8 points!"),0xffba00ff,capgrpGameState)
  1423 				AddCaption(loc("Fierce Competition! +8 points!"),colorMsgBonus,capgrpMessage)
  1391 				AwardPoints(8)
  1424 				AwardPoints(8)
  1392 			end
  1425 			end
  1393 
  1426 
  1394 			tauntTimer = 500
  1427 			tauntTimer = 500
  1395 			tauntGear = gear
  1428 			tauntGear = gear
  1572 		vCircRadDir[i] = -1
  1605 		vCircRadDir[i] = -1
  1573 		vCircRadCounter[i] = 0
  1606 		vCircRadCounter[i] = 0
  1574 
  1607 
  1575 		vCircX[i], vCircY[i] = 0,0
  1608 		vCircX[i], vCircY[i] = 0,0
  1576 
  1609 
  1577 		vCircCol[i] = 0xff00ffff
  1610 		vCircCol[i] = 0xFF00FFFF
  1578 
  1611 
  1579 		SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], vCircCol[i])
  1612 		SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], vCircCol[i])
  1580 
  1613 
  1581 		SetVisualGearValues(rCirc[i], 0, 0, 100, 255, 1, 10, 0, 40, 3, vCircCol[i])
  1614 		SetVisualGearValues(rCirc[i], 0, 0, 100, 255, 1, 10, 0, 40, 3, vCircCol[i])
  1582 
  1615 
  1614 		vCircActive[i] = false
  1647 		vCircActive[i] = false
  1615 
  1648 
  1616 		if (vType[i] == "drone") then
  1649 		if (vType[i] == "drone") then
  1617 			PlaySound(sndHellishImpact4)
  1650 			PlaySound(sndHellishImpact4)
  1618 			TimeLeft = TimeLeft + timeBonus
  1651 			TimeLeft = TimeLeft + timeBonus
  1619 			AddCaption(string.format(loc("Time extended! +%dsec"), timeBonus), 0xff0000ff,capgrpMessage )
  1652 			AddCaption(string.format(loc("Time extended! +%dsec"), timeBonus), colorDrone, capgrpMessage )
  1620 			DrawTag(TAG_TIME)
  1653 			DrawTag(TAG_TIME)
  1621 
  1654 
  1622 			local morte = AddGear(vCircX[i], vCircY[i], gtExplosives, 0, 0, 0, 1)
  1655 			local morte = AddGear(vCircX[i], vCircY[i], gtExplosives, 0, 0, 0, 1)
  1623 			SetHealth(morte, 0)
  1656 			SetHealth(morte, 0)
  1624 
  1657 
  1625 			RK = RK + 1
  1658 			RK = RK + 1
  1626 			if RK == 5 then
  1659 			if RK == 5 then
  1627 				RK = 0
  1660 				RK = 0
  1628 				AddCaption(loc("Drone Hunter! +10 points!"),0xffba00ff,capgrpMessage2)
  1661 				AddCaption(loc("Drone Hunter! +10 points!"),colorMsgBonus,capgrpMessage2)
  1629 				AwardPoints(10)
  1662 				AwardPoints(10)
  1630 			end
  1663 			end
  1631 
  1664 
  1632 		elseif (vType[i] == "ammo") then
  1665 		elseif (vType[i] == "ammo") then
  1633 			AddVisualGear(vCircX[i], vCircY[i], vgtExplosion, 0, false)
  1666 			AddVisualGear(vCircX[i], vCircY[i], vgtExplosion, 0, false)
  1634 			PlaySound(sndExplosion)
  1667 			PlaySound(sndExplosion)
  1635 			PlaySound(sndShotgunReload)
  1668 			PlaySound(sndShotgunReload)
  1636 			wepAmmo[0] = wepAmmo[0] + barrelBonus
  1669 			wepAmmo[0] = wepAmmo[0] + barrelBonus
  1637 			AddCaption(string.format(loc("+%d Ammo"), barrelBonus), 0x00ff00ff,capgrpMessage)
  1670 			AddCaption(string.format(loc("+%d Ammo"), barrelBonus), colorAmmo,capgrpMessage)
  1638 			DrawTag(TAG_BARRELS)
  1671 			DrawTag(TAG_BARRELS)
  1639 
  1672 
  1640 			GK = GK + 1
  1673 			GK = GK + 1
  1641 			if GK == 3 then
  1674 			if GK == 3 then
  1642 				GK = 0
  1675 				GK = 0
  1643 				AddCaption(loc("Ammo Maniac! +5 points!"),0xffba00ff,capgrpMessage2)
  1676 				AddCaption(loc("Ammo Maniac! +5 points!"),colorMsgBonus,capgrpMessage2)
  1644 				AwardPoints(5)
  1677 				AwardPoints(5)
  1645 			end
  1678 			end
  1646 
  1679 
  1647 		elseif (vType[i] == "bonus") then
  1680 		elseif (vType[i] == "bonus") then
  1648 
  1681 
  1657 			AddVisualGear(vCircX[i], vCircY[i], vgtSmoke, 0, false)
  1690 			AddVisualGear(vCircX[i], vCircY[i], vgtSmoke, 0, false)
  1658 
  1691 
  1659 			PlaySound(sndVaporize)
  1692 			PlaySound(sndVaporize)
  1660 
  1693 
  1661 			shieldHealth = shieldHealth + shieldBonus
  1694 			shieldHealth = shieldHealth + shieldBonus
  1662 			AddCaption(string.format(loc("Shield boosted! +%d power"),shieldBonus), 0xa800ffff,capgrpMessage)
       
  1663 			if shieldHealth >= 250 then
  1695 			if shieldHealth >= 250 then
  1664 				shieldHealth = 250
  1696 				shieldHealth = 250
  1665 				AddCaption(loc("Shield is fully recharged!"),0xa800ffff,capgrpMessage)
  1697 				AddCaption(loc("Shield is fully recharged!"),colorShield,capgrpMessage)
       
  1698 			else
       
  1699 				AddCaption(string.format(loc("Shield boosted! +%d power"),shieldBonus), colorShield,capgrpMessage)
  1666 			end
  1700 			end
  1667 			DrawTag(TAG_SHIELD)
  1701 			DrawTag(TAG_SHIELD)
  1668 
  1702 
  1669 			OK = OK + 1
  1703 			OK = OK + 1
  1670 			if OK == 3 then
  1704 			if OK == 3 then
  1671 				OK = 0
  1705 				OK = 0
  1672 				AddCaption(loc("Shield Seeker! +10 points!"),0xffba00ff,capgrpMessage2)
  1706 				AddCaption(loc("Shield Seeker! +10 points!"),colorShield,capgrpMessage2)
  1673 				AwardPoints(10)
  1707 				AwardPoints(10)
  1674 			end
  1708 			end
  1675 
  1709 
  1676 		elseif (vType[i] == "blueboss") then
  1710 		elseif (vType[i] == "blueboss") then
  1677 			PlaySound(sndHellishImpact3)
  1711 			PlaySound(sndHellishImpact3)
  1678 			tauntTimer = 300
  1712 			tauntTimer = 300
  1679 			tauntSound = sndEnemyDown
  1713 			tauntSound = sndEnemyDown
  1680 			tauntGear = CurrentHedgehog
  1714 			tauntGear = CurrentHedgehog
  1681 			AddCaption(loc("Boss defeated! +30 points!"), 0x0050ffff,capgrpMessage)
  1715 			AddCaption(loc("Boss defeated! +30 points!"), colorBoss,capgrpMessage)
  1682 
  1716 
  1683 			local morte = AddGear(vCircX[i], vCircY[i], gtExplosives, 0, 0, 0, 1)
  1717 			local morte = AddGear(vCircX[i], vCircY[i], gtExplosives, 0, 0, 0, 1)
  1684 			SetHealth(morte, 0)
  1718 			SetHealth(morte, 0)
  1685 
  1719 
  1686 			BK = BK + 1
  1720 			BK = BK + 1
  1687 			if BK == 2 then
  1721 			if BK == 2 then
  1688 				BK = 0
  1722 				BK = 0
  1689 				AddCaption(loc("Boss Slayer! +25 points!"),0xffba00ff,capgrpMessage2)
  1723 				AddCaption(loc("Boss Slayer! +25 points!"),colorMsgBonus,capgrpMessage2)
  1690 				AwardPoints(25)
  1724 				AwardPoints(25)
  1691 			end
  1725 			end
  1692 
  1726 
  1693 		end
  1727 		end
  1694 
  1728 
  1698 		res = "fatal"
  1732 		res = "fatal"
  1699 
  1733 
  1700 		chainCounter = 3000
  1734 		chainCounter = 3000
  1701 		chainLength = chainLength + 1
  1735 		chainLength = chainLength + 1
  1702 		if chainLength > 1 then
  1736 		if chainLength > 1 then
  1703 			AddCaption( string.format(loc("%d-Hit Combo! +%d points!"), chainLength, chainLength*2),0xffba00ff,capgrpAmmostate)
  1737 			AddCaption( string.format(loc("%d-Hit Combo! +%d points!"), chainLength, chainLength*2),colorMsgBonus,capgrpVolume)
  1704 			AwardPoints(chainLength*2)
  1738 			AwardPoints(chainLength*2)
  1705 		end
  1739 		end
  1706 
  1740 
  1707 		awardCombo = UpdateSimpleAward(awardCombo, chainLength, 5)
  1741 		awardCombo = UpdateSimpleAward(awardCombo, chainLength, 5)
  1708 
  1742 
  1722 
  1756 
  1723 function SetUpCircle(i)
  1757 function SetUpCircle(i)
  1724 
  1758 
  1725 
  1759 
  1726 	local r = GetRandom(10)
  1760 	local r = GetRandom(10)
  1727 	-- 80% of spawning either red/green
  1761 	-- 80% of spawning either drone/ammo
  1728 	if r <= 7 then
  1762 	if r <= 7 then
  1729 
  1763 
  1730 		r = GetRandom(2)
  1764 		r = GetRandom(2)
  1731 		if r == 0 then
  1765 		if r == 0 then
  1732 			vCircCol[i] = 0xff0000ff -- red
  1766 			vCircCol[i] = colorDrone
  1733 			vType[i] = "drone"
  1767 			vType[i] = "drone"
  1734 			vCircRadMin[i] = 50	*5
  1768 			vCircRadMin[i] = 50	*5
  1735 			vCircRadMax[i] = 90	*5
  1769 			vCircRadMax[i] = 90	*5
  1736 			vCounterLim[i] = 3000
  1770 			vCounterLim[i] = 3000
  1737 			vCircScore[i] = 10
  1771 			vCircScore[i] = 10
  1738 			vCircHealth[i] = 1
  1772 			vCircHealth[i] = 1
  1739 		elseif r == 1 then
  1773 		elseif r == 1 then
  1740 			vCircCol[i] = 0x00ff00ff -- green
  1774 			vCircCol[i] = colorAmmo
  1741 			vType[i] = "ammo"
  1775 			vType[i] = "ammo"
  1742 			vCircRadMin[i] = 25	*7
  1776 			vCircRadMin[i] = 25	*7
  1743 			vCircRadMax[i] = 30	*7
  1777 			vCircRadMax[i] = 30	*7
  1744 			vCircScore[i] = 3
  1778 			vCircScore[i] = 3
  1745 			vCircHealth[i] = 1
  1779 			vCircHealth[i] = 1
  1747 
  1781 
  1748 	-- 20% chance of spawning boss or bonus
  1782 	-- 20% chance of spawning boss or bonus
  1749 	else
  1783 	else
  1750 		r = GetRandom(5)
  1784 		r = GetRandom(5)
  1751 		if r <= 1 then
  1785 		if r <= 1 then
  1752 			vCircCol[i] = 0x0050ffff -- sexy blue
  1786 			vCircCol[i] = colorBoss
  1753 			vType[i] = "blueboss"
  1787 			vType[i] = "blueboss"
  1754 			vCircRadMin[i] = 100*5
  1788 			vCircRadMin[i] = 100*5
  1755 			vCircRadMax[i] = 180*5
  1789 			vCircRadMax[i] = 180*5
  1756 			vCircWidth[i] = 1
  1790 			vCircWidth[i] = 1
  1757 			vCounterLim[i] = 2000
  1791 			vCounterLim[i] = 2000
  1758 			vCircScore[i] = 30
  1792 			vCircScore[i] = 30
  1759 			vCircHealth[i] = 3
  1793 			vCircHealth[i] = 3
  1760 		else
  1794 		else
  1761 			vCircCol[i] = 0xa800ffff -- purp
  1795 			vCircCol[i] = colorShield
  1762 			vType[i] = "bonus"
  1796 			vType[i] = "bonus"
  1763 			vCircRadMin[i] = 20 *7
  1797 			vCircRadMin[i] = 20 *7
  1764 			vCircRadMax[i] = 40 *7
  1798 			vCircRadMax[i] = 40 *7
  1765 			vCircScore[i] = 5
  1799 			vCircScore[i] = 5
  1766 			vCircHealth[i] = 1
  1800 			vCircHealth[i] = 1
  1778 		end
  1812 		end
  1779 	end
  1813 	end
  1780 
  1814 
  1781 	vCircRadius[i] = vCircRadMax[i] - GetRandom(vCircRadMin[i])
  1815 	vCircRadius[i] = vCircRadMax[i] - GetRandom(vCircRadMin[i])
  1782 
  1816 
  1783 	SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], nil, nil, nil, nil, nil, vCircRadius[i], vCircWidth[i], vCircCol[i]-0x000000ff)
  1817 	SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], nil, nil, nil, nil, nil, vCircRadius[i], vCircWidth[i], vCircCol[i]-0x000000FF)
  1784 
  1818 
  1785 	SetVisualGearValues(rCirc[i], 0, 0, nil, nil, nil, nil, nil, nil, nil, vCircCol[i]-0x000000ff)
  1819 	SetVisualGearValues(rCirc[i], 0, 0, nil, nil, nil, nil, nil, nil, nil, vCircCol[i]-0x000000FF)
  1786 
  1820 
  1787 
  1821 
  1788 	vCircActive[i] = true
  1822 	vCircActive[i] = true
  1789 
  1823 
  1790 end
  1824 end
  1813 		local r = math.random(1,3)
  1847 		local r = math.random(1,3)
  1814 		PlaySound(_G["sndOoff"..r], CurrentHedgehog)
  1848 		PlaySound(_G["sndOoff"..r], CurrentHedgehog)
  1815 	end
  1849 	end
  1816 
  1850 
  1817 	playerIsFine = false
  1851 	playerIsFine = false
  1818 	AddCaption(loc("GOTCHA!"))
       
  1819 	FailGraphics()
  1852 	FailGraphics()
  1820 
  1853 
  1821 	if not kamikaze then
  1854 	if not kamikaze then
       
  1855 		AddCaption(loc("GOTCHA!"), 0xFFFFFFFF, capgrpGameState)
  1822 		PlaySound(sndHellish)
  1856 		PlaySound(sndHellish)
  1823 	end
  1857 	end
  1824 
  1858 
  1825 	targetHit = true
  1859 	targetHit = true
  1826 
  1860 
  1827 end
  1861 end
  1828 
  1862 
  1829 -- Turn all circles white to indicate they can't be hit anymore
  1863 -- Turn all circles white to indicate they can't be hit anymore
  1830 function FailGraphics()
  1864 function FailGraphics()
  1831 	for i = 0,(vCCount-1) do
  1865 	for i = 0,(vCCount-1) do
  1832 		vCircCol[i] = 0xffffffff
  1866 		vCircCol[i] = colorDisabled
  1833 	end
  1867 	end
  1834 end
  1868 end
  1835 
  1869 
  1836 --- collision detection for weapons fire
  1870 --- collision detection for weapons fire
  1837 function CheckVarious(gear)
  1871 function CheckVarious(gear)
  1857 			if dist <= NR*NR then
  1891 			if dist <= NR*NR then
  1858 
  1892 
  1859 				dist = (GetDistFromXYtoXY(vCircX[i], vCircY[i], getGearValue(gear,"XP"), getGearValue(gear,"YP")) - (NR*NR))
  1893 				dist = (GetDistFromXYtoXY(vCircX[i], vCircY[i], getGearValue(gear,"XP"), getGearValue(gear,"YP")) - (NR*NR))
  1860 				if dist >= 1000000 then
  1894 				if dist >= 1000000 then
  1861 					sniperHits = sniperHits +1
  1895 					sniperHits = sniperHits +1
  1862 					AddCaption(loc("Sniper! +8 points!"),0xffba00ff,capgrpGameState)
  1896 					AddCaption(loc("Sniper! +8 points!"),colorMsgBonus,capgrpAmmostate)
  1863 					AwardPoints(8)
  1897 					AwardPoints(8)
  1864 					if sniperHits == 3 then
  1898 					if sniperHits == 3 then
  1865 						sniperHits = 0
  1899 						sniperHits = 0
  1866 						AddCaption(loc("They Call Me Bullseye! +16 points!"),0xffba00ff,capgrpGameState)
  1900 						AddCaption(loc("They Call Me Bullseye! +16 points!"),colorMsgBonus,capgrpAmmostate)
  1867 						AwardPoints(16)
  1901 						AwardPoints(16)
  1868 					end
  1902 					end
  1869 				elseif dist <= 6000 then
  1903 				elseif dist <= 6000 then
  1870 					pointBlankHits = pointBlankHits +1
  1904 					pointBlankHits = pointBlankHits +1
  1871 					if pointBlankHits == 3 then
  1905 					if pointBlankHits == 3 then
  1872 						pointBlankHits = 0
  1906 						pointBlankHits = 0
  1873 						AddCaption(loc("Point Blank Combo! +5 points!"),0xffba00ff,capgrpGameState)
  1907 						AddCaption(loc("Point Blank Combo! +5 points!"),colorMsgBonus,capgrpAmmostate)
  1874 						AwardPoints(5)
  1908 						AwardPoints(5)
  1875 					end
  1909 					end
  1876 				end
  1910 				end
  1877 
  1911 
  1878 				AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
  1912 				AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
  1880 				targetHit = true
  1914 				targetHit = true
  1881 				CircleDamaged(i)
  1915 				CircleDamaged(i)
  1882 
  1916 
  1883 				circsHit = circsHit + 1
  1917 				circsHit = circsHit + 1
  1884 				if circsHit > 1 then
  1918 				if circsHit > 1 then
  1885 					AddCaption(loc("Multi-shot! +15 points!"),0xffba00ff,capgrpAmmostate)
  1919 					AddCaption(loc("Multi-shot! +15 points!"),colorMsgBonus,capgrpAmmoinfo)
  1886 					AwardPoints(15)
  1920 					AwardPoints(15)
  1887 						circsHit = 0
  1921 						circsHit = 0
  1888 				end
  1922 				end
  1889 
  1923 
  1890 				shotsHit = shotsHit + 1
  1924 				shotsHit = shotsHit + 1
  1900 
  1934 
  1901 		if beam == true then
  1935 		if beam == true then
  1902 
  1936 
  1903 			if dist < 3000 then
  1937 			if dist < 3000 then
  1904 				local tempE = AddVisualGear(GetX(gear), GetY(gear), vgtSmoke, 0, true)
  1938 				local tempE = AddVisualGear(GetX(gear), GetY(gear), vgtSmoke, 0, true)
  1905 				SetVisualGearValues(tempE, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0xff00ffff )
  1939 				SetVisualGearValues(tempE, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0xFF00FFFF)
  1906 				PlaySound(sndVaporize)
  1940 				PlaySound(sndVaporize)
  1907 				DeleteGear(gear)
  1941 				DeleteGear(gear)
  1908 
  1942 
  1909 				SK = SK + 1
  1943 				SK = SK + 1
  1910 				if SK == 5 then
  1944 				if SK == 5 then
  1911 					SK = 0
  1945 					SK = 0
  1912 					AddCaption(loc("Shield Master! +10 points!"),0xffba00ff,capgrpAmmoinfo)
  1946 					AddCaption(loc("Shield Master! +10 points!"),colorMsgBonus,capgrpMessage)
  1913 					AwardPoints(10)
  1947 					AwardPoints(10)
  1914 				end
  1948 				end
  1915 			end
  1949 			end
  1916 
  1950 
  1917 		elseif dist < 1600 then
  1951 		elseif dist < 1600 then
  1967 				if vType[i] == "blueboss" then explosion = true else explosion = false end
  2001 				if vType[i] == "blueboss" then explosion = true else explosion = false end
  1968 
  2002 
  1969 				local kamikaze = false
  2003 				local kamikaze = false
  1970 				if ss == "fatal" then
  2004 				if ss == "fatal" then
  1971 					if (wepAmmo[0] == 0) and (TimeLeft <= 9) then
  2005 					if (wepAmmo[0] == 0) and (TimeLeft <= 9) then
  1972 						AddCaption(loc("Kamikaze Expert! +15 points!"),0xffba00ff,capgrpMessage)
  2006 						AddCaption(loc("Kamikaze Expert! +15 points!"),colorMsgBonus,capgrpGameState)
  1973 						AwardPoints(15)
  2007 						AwardPoints(15)
  1974 						PlaySound(sndKamikaze, CurrentHedgehog)
  2008 						PlaySound(sndKamikaze, CurrentHedgehog)
  1975 						kamikaze = true
  2009 						kamikaze = true
  1976 					elseif (wepAmmo[0] == 0) then
  2010 					elseif (wepAmmo[0] == 0) then
  1977 						AddCaption(loc("Depleted Kamikaze! +5 points!"),0xffba00ff,capgrpMessage)
  2011 						AddCaption(loc("Depleted Kamikaze! +5 points!"),colorMsgBonus,capgrpGameState)
  1978 						AwardPoints(5)
  2012 						AwardPoints(5)
  1979 						PlaySound(sndKamikaze, CurrentHedgehog)
  2013 						PlaySound(sndKamikaze, CurrentHedgehog)
  1980 						kamikaze = true
  2014 						kamikaze = true
  1981 					elseif TimeLeft <= 9 then
  2015 					elseif TimeLeft <= 9 then
  1982 						AddCaption(loc("Timed Kamikaze! +10 points!"),0xffba00ff,capgrpMessage)
  2016 						AddCaption(loc("Timed Kamikaze! +10 points!"),colorMsgBonus,capgrpGameState)
  1983 						AwardPoints(10)
  2017 						AwardPoints(10)
  1984 						PlaySound(sndKamikaze, CurrentHedgehog)
  2018 						PlaySound(sndKamikaze, CurrentHedgehog)
  1985 						kamikaze = true
  2019 						kamikaze = true
  1986 					end
  2020 					end
  1987 				end
  2021 				end
  2065 					SetVisualGearValues(tempE, vCircX[i], vCircY[i], nil, nil, nil, nil, nil, nil, nil, vCircCol[i] )
  2099 					SetVisualGearValues(tempE, vCircX[i], vCircY[i], nil, nil, nil, nil, nil, nil, nil, vCircCol[i] )
  2066 
  2100 
  2067 				elseif vType[i] == "bonus" then
  2101 				elseif vType[i] == "bonus" then
  2068 
  2102 
  2069 					local tempE = AddVisualGear(vCircX[i], vCircY[i], vgtDust, 0, true)
  2103 					local tempE = AddVisualGear(vCircX[i], vCircY[i], vgtDust, 0, true)
  2070 					SetVisualGearValues(tempE, vCircX[i], vCircY[i], nil, nil, nil, nil, nil, 1, nil, 0xff00ffff )
  2104 					SetVisualGearValues(tempE, vCircX[i], vCircY[i], nil, nil, nil, nil, nil, 1, nil, colorShieldParticle)
  2071 
  2105 
  2072 
  2106 
  2073 				elseif vType[i] == "blueboss" then
  2107 				elseif vType[i] == "blueboss" then
  2074 
  2108 
  2075 					local k = 25
  2109 					local k = 25
  2076 					local g = vgtSteam
  2110 					local g = vgtSteam
  2077 					local trailColour = 0xae00ffff
  2111 					local trailColour = colorBossParticle
  2078 
  2112 
  2079 					local tempE = AddVisualGear(vCircX[i], vCircY[i], g, 0, true)
  2113 					local tempE = AddVisualGear(vCircX[i], vCircY[i], g, 0, true)
  2080 					SetVisualGearValues(tempE, vCircX[i], vCircY[i]+k, nil, nil, nil, nil, nil, nil, nil, trailColour-75 )
  2114 					SetVisualGearValues(tempE, vCircX[i], vCircY[i]+k, nil, nil, nil, nil, nil, nil, nil, trailColour-75 )
  2081 
  2115 
  2082 					tempE = AddVisualGear(vCircX[i], vCircY[i], g, 0, true)
  2116 					tempE = AddVisualGear(vCircX[i], vCircY[i], g, 0, true)
  2185 	end
  2219 	end
  2186 
  2220 
  2187 
  2221 
  2188 	if (CurrentHedgehog ~= nil) then
  2222 	if (CurrentHedgehog ~= nil) then
  2189 		if beam == true then
  2223 		if beam == true then
  2190 			SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), nil, nil, nil, nil, nil, 200, nil, 0xa800ffff-0x000000ff - -shieldHealth )
  2224 			SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), nil, nil, nil, nil, nil, 200, nil, colorShield-0x000000FF - -shieldHealth )
  2191 			DrawTag(TAG_SHIELD)
  2225 			DrawTag(TAG_SHIELD)
  2192 		else
  2226 		else
  2193 			SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), nil, nil, nil, nil, nil, 0)
  2227 			SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), nil, nil, nil, nil, nil, 0)
  2194 		end
  2228 		end
  2195 
  2229 
  2196 		if shockwaveHealth > 0 then
  2230 		if shockwaveHealth > 0 then
  2197 			SetVisualGearValues(shockwave, GetX(CurrentHedgehog), GetY(CurrentHedgehog), nil, nil, nil, nil, nil, shockwaveRad, nil, 0xff3300ff-0x000000ff - -shockwaveHealth )
  2231 			SetVisualGearValues(shockwave, GetX(CurrentHedgehog), GetY(CurrentHedgehog), nil, nil, nil, nil, nil, shockwaveRad, nil, colorShockwave-0x000000FF - -shockwaveHealth )
  2198 		else
  2232 		else
  2199 			SetVisualGearValues(shockwave, GetX(CurrentHedgehog), GetY(CurrentHedgehog), nil, nil, nil, nil, nil, 0)
  2233 			SetVisualGearValues(shockwave, GetX(CurrentHedgehog), GetY(CurrentHedgehog), nil, nil, nil, nil, nil, 0)
  2200 		end
  2234 		end
  2201 
  2235 
  2202 	end
  2236 	end