share/hedgewars/Data/Scripts/Multiplayer/Continental_supplies.lua
changeset 14324 5da99c43b96f
parent 14230 8edbdd3a1fe7
child 14811 d65e25e211d4
equal deleted inserted replaced
14323:461a9a2d9ed8 14324:5da99c43b96f
  1631 	end
  1631 	end
  1632 end
  1632 end
  1633 
  1633 
  1634 -- Spawn sabotage smoke for inactive hogs (red smoke, more subtle than for active hogs)
  1634 -- Spawn sabotage smoke for inactive hogs (red smoke, more subtle than for active hogs)
  1635 function SabotageSmokeInactive(gear)
  1635 function SabotageSmokeInactive(gear)
  1636 	if GetGearType(gear) == gtHedgehog and gear ~= CurrentHedgehog and CS.SABOTAGE_HOGS[gear]~=nil and CS.SABOTAGE_HOGS[gear]>=1 then
  1636 	if GetGearType(gear) == gtHedgehog and (gear ~= CurrentHedgehog or ReadyTimeLeft > 0) and CS.SABOTAGE_HOGS[gear]~=nil and CS.SABOTAGE_HOGS[gear]>=1 then
  1637 		local vg = AddVisualGear(GetX(gear), GetY(gear), vgtSmokeWhite, 0, false)
  1637 		local vg = AddVisualGear(GetX(gear), GetY(gear), vgtSmokeWhite, 0, false)
  1638 		SetVisualGearValues(vg, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0xFF8080B0)
  1638 		SetVisualGearValues(vg, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0xFF8080B0)
  1639 	end
  1639 	end
  1640 end
  1640 end
  1641 
  1641 
  1771 
  1771 
  1772 	--sabotage
  1772 	--sabotage
  1773 	if(CS.SABOTAGE_HOGS[CurrentHedgehog]~=nil and CS.SABOTAGE_HOGS[CurrentHedgehog]>=1)
  1773 	if(CS.SABOTAGE_HOGS[CurrentHedgehog]~=nil and CS.SABOTAGE_HOGS[CurrentHedgehog]>=1)
  1774 	then
  1774 	then
  1775 		--for sabotage
  1775 		--for sabotage
  1776 		if(CS.SABOTAGE_HOGS[CurrentHedgehog]==1)
  1776 		if(CS.SABOTAGE_HOGS[CurrentHedgehog]==1 and ReadyTimeLeft == 0)
  1777 		then
  1777 		then
  1778 			AddCaption(loc("You are sabotaged, RUN!"))
  1778 			AddCaption(loc("You are sabotaged, RUN!"))
  1779 
  1779 
  1780 			PlaySound(sndHellish)
  1780 			PlaySound(sndHellish)
  1781 			--update the constant at the top also to something in between
  1781 			--update the constant at the top also to something in between
  1783 			SetGravity(CS.SABOTAGE_GRAVITY)
  1783 			SetGravity(CS.SABOTAGE_GRAVITY)
  1784 
  1784 
  1785 			CS.SABOTAGE_HOGS[CurrentHedgehog]=2
  1785 			CS.SABOTAGE_HOGS[CurrentHedgehog]=2
  1786 		end
  1786 		end
  1787 
  1787 
  1788 		if(CS.SABOTAGE_COUNTER % 20 == 0)
  1788 		if(CS.SABOTAGE_HOGS[CurrentHedgehog]==2 and CS.SABOTAGE_COUNTER % 20 == 0)
  1789 		then
  1789 		then
  1790 			-- Sabotage effect (red smoke)
  1790 			-- Sabotage effect (red smoke)
  1791 			local vg = AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmokeWhite, 0, false)
  1791 			local vg = AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmokeWhite, 0, false)
  1792 			SetVisualGearValues(vg, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0xFF4040FF)
  1792 			SetVisualGearValues(vg, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0xFF4040FF)
  1793 		end
  1793 		end
  1797 			CS.SABOTAGE_HOGS[CurrentHedgehog]=0
  1797 			CS.SABOTAGE_HOGS[CurrentHedgehog]=0
  1798 		elseif(CS.SABOTAGE_COUNTER >= CS.SABOTAGE_FREQUENCY_NOW)
  1798 		elseif(CS.SABOTAGE_COUNTER >= CS.SABOTAGE_FREQUENCY_NOW)
  1799 		then
  1799 		then
  1800 			-- Sabotage decreases hog health regularily,
  1800 			-- Sabotage decreases hog health regularily,
  1801 			-- but invulnerable protects.
  1801 			-- but invulnerable protects.
  1802 			-- Also do not decrease health while retreating or attacking.
  1802 			-- Also do not decrease health while retreating, attacking or in ready phase.
  1803 			if(GetEffect(CurrentHedgehog, heInvulnerable) == 0 and
  1803 			if(GetEffect(CurrentHedgehog, heInvulnerable) == 0 and
  1804 			band(GetState(CurrentHedgehog), gstHHDriven) ~= 0 and
  1804 			band(GetState(CurrentHedgehog), gstHHDriven) ~= 0 and
  1805 			band(GetState(CurrentHedgehog), gstAttacked+gstAttacking) == 0)
  1805 			band(GetState(CurrentHedgehog), gstAttacked+gstAttacking) == 0) and
       
  1806 			(ReadyTimeLeft == 0)
  1806 			then
  1807 			then
  1807 				if(GetHealth(CurrentHedgehog)<=CS.SABOTAGE_DAMAGE)
  1808 				if(GetHealth(CurrentHedgehog)<=CS.SABOTAGE_DAMAGE)
  1808 				then
  1809 				then
  1809 					-- All health lost! Sabotage is cruel.
  1810 					-- All health lost! Sabotage is cruel.
  1810 					PlaySound(sndPoisonMoan, CurrentHedgehog)
  1811 					PlaySound(sndPoisonMoan, CurrentHedgehog)