Advertisement
Guest User

Untitled

a guest
Mar 18th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 60.74 KB | None | 0 0
  1. --[[-------------------------------------------------------------------
  2. Lightsaber Force Powers:
  3. The available powers that the new saber base uses.
  4. Powered by
  5. _ _ _ ___ ____
  6. __ _(_) | |_ / _ \/ ___|
  7. \ \ /\ / / | | __| | | \___ \
  8. \ V V /| | | |_| |_| |___) |
  9. \_/\_/ |_|_|\__|\___/|____/
  10.  
  11. _____ _ _ _
  12. |_ _|__ ___| |__ _ __ ___ | | ___ __ _(_) ___ ___
  13. | |/ _ \/ __| '_ \| '_ \ / _ \| |/ _ \ / _` | |/ _ \/ __|
  14. | | __/ (__| | | | | | | (_) | | (_) | (_| | | __/\__ \
  15. |_|\___|\___|_| |_|_| |_|\___/|_|\___/ \__, |_|\___||___/
  16. |___/
  17. ----------------------------- Copyright 2017, David "King David" Wiltos ]]--[[
  18.  
  19. Lua Developer: King David
  20. Contact: http://steamcommunity.com/groups/wiltostech
  21.  
  22. -- Copyright 2017, David "King David" Wiltos ]]--
  23.  
  24. wOS = wOS or {}
  25.  
  26. wOS.ForcePowers:RegisterNewPower({
  27. name = "Force Leap",
  28. icon = "L",
  29. image = "wos/forceicons/leap.png",
  30. cooldown = 2,
  31. manualaim = false,
  32. description = "Jump longer and higher. Aim higher to jump higher/further.",
  33. action = function( self )
  34. if ( self:GetForce() < 10 || !self.Owner:IsOnGround() ) then return end
  35. self:SetForce( self:GetForce() - 10 )
  36.  
  37. self:SetNextAttack( 0.5 )
  38.  
  39. self.Owner:SetVelocity( self.Owner:GetAimVector() * 512 + Vector( 0, 0, 512 ) )
  40.  
  41. self:PlayWeaponSound( "lightsaber/force_leap.wav" )
  42.  
  43. // Trigger the jump animation, yay
  44. self:CallOnClient( "ForceJumpAnim", "" )
  45. return true
  46. end
  47. })
  48.  
  49. wOS.ForcePowers:RegisterNewPower({
  50. name = "Charge",
  51. icon = "CH",
  52. distance = 600,
  53. image = "wos/forceicons/charge.png",
  54. target = 1,
  55. cooldown = 0,
  56. manualaim = false,
  57. description = "Lunge at your enemy",
  58. action = function( self )
  59. local ent = self:SelectTargets( 1, 600 )[ 1 ]
  60. if !IsValid( ent ) then self:SetNextAttack( 0.2 ) return end
  61. if ( self:GetForce() < 20 ) then self:SetNextAttack( 0.2 ) return end
  62. local newpos = ( ent:GetPos() - self.Owner:GetPos() )
  63. newpos = newpos / newpos:Length()
  64. self.Owner:SetLocalVelocity( newpos*700 + Vector( 0, 0, 300 ) )
  65. self:SetForce( self:GetForce() - 20 )
  66. self:PlayWeaponSound( "lightsaber/force_leap.wav" )
  67. self.Owner:SetSequenceOverride( "phalanx_a_s2_t1", 5 )
  68. self:SetNextAttack( 1 )
  69. self.AerialLand = false
  70. return true
  71. end
  72. })
  73.  
  74. wOS.ForcePowers:RegisterNewPower({
  75. name = "Force Absorb",
  76. icon = "A",
  77. image = "wos/forceicons/absorb.png",
  78. cooldown = 0,
  79. description = "Hold Mouse 2 to protect yourself from harm",
  80. action = function( self )
  81. if ( self:GetForce() < 1 ) then return end
  82. self:SetForce( self:GetForce() - 0.1 )
  83. self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.6 )
  84. self:SetNextAttack( 0.3 )
  85. return true
  86. end
  87. })
  88.  
  89. wOS.ForcePowers:RegisterNewPower({
  90. name = "Unrelenting Advance",
  91. icon = "UA",
  92. image = "wos/forceicons/absorb.png",
  93. cooldown = 0,
  94. description = "Hold Mouse 2 to protect yourself from harm",
  95. action = function( self )
  96. if ( self:GetForce() < 1 ) then return end
  97. self:SetForce( self:GetForce() - 0.1 )
  98. self.Owner:SetNW2Float( "wOS.GrievousAnim", CurTime() + 0.6 )
  99. self:SetNextAttack( 0.3 )
  100. return true
  101. end
  102. })
  103.  
  104. wOS.ForcePowers:RegisterNewPower({
  105. name = "Saber Throw",
  106. icon = "T",
  107. image = "wos/forceicons/throw.png",
  108. cooldown = 0,
  109. manualaim = false,
  110. description = "Throws your lightsaber. It will return to you.",
  111. action = function(self)
  112. if self:GetForce() < 20 then return end
  113. self:SetForce( self:GetForce() - 20 )
  114. self:SetEnabled(false)
  115. self:SetBladeLength(0)
  116. self:SetNextAttack( 1 )
  117. self:GetOwner():DrawWorldModel(false)
  118.  
  119. local ent = ents.Create("ent_lightsaber_thrown")
  120. ent:SetModel(self:GetWorldModel())
  121. ent:Spawn()
  122. ent:SetBladeLength(self:GetMaxLength())
  123. ent:SetMaxLength(self:GetMaxLength())
  124. ent:SetCrystalColor(self:GetCrystalColor())
  125. ent:SetDarkInner( self:GetDarkInner() )
  126.  
  127. local pos = self:GetSaberPosAng()
  128. ent:SetPos(pos)
  129. pos = pos + self.Owner:GetAimVector() * 750
  130. ent:SetEndPos(pos)
  131. ent:SetOwner(self.Owner)
  132. return true
  133. end
  134. })
  135.  
  136. wOS.ForcePowers:RegisterNewPower({
  137. name = "Force Heal",
  138. icon = "H",
  139. image = "wos/forceicons/heal.png",
  140. cooldown = 0,
  141. target = 1,
  142. manualaim = false,
  143. description = "Heals your target.",
  144. action = function( self )
  145. if ( self:GetForce() < 10 ) then return end
  146. local foundents = 0
  147.  
  148. for k, v in pairs( self:SelectTargets( 1 ) ) do
  149. if ( !IsValid( v ) ) then continue end
  150. foundents = foundents + 1
  151. local ed = EffectData()
  152. ed:SetOrigin( self:GetSaberPosAng() )
  153. ed:SetEntity( v )
  154. util.Effect( "rb655_force_heal", ed, true, true )
  155. v:SetHealth( math.Clamp( v:Health() + 25, 0, v:GetMaxHealth() ) )
  156. end
  157.  
  158. if ( foundents > 0 ) then
  159. self:SetForce( self:GetForce() - 3 )
  160. local tbl = wOS.ExperienceTable[ self.Owner:GetUserGroup() ]
  161. if not tbl then
  162. tbl = wOS.ExperienceTable[ "Default" ].XPPerHeal
  163. else
  164. tbl = wOS.ExperienceTable[ self.Owner:GetUserGroup() ].XPPerHeal
  165. end
  166. self.Owner:AddSkillXP( tbl )
  167. end
  168. self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.5 )
  169. self:SetNextAttack( 0.25 )
  170. return true
  171. end
  172. })
  173.  
  174. wOS.ForcePowers:RegisterNewPower({
  175. name = "Group Heal",
  176. icon = "GH",
  177. image = "wos/forceicons/group_heal.png",
  178. cooldown = 0,
  179. manualaim = false,
  180. description = "Heals all around you.",
  181. action = function( self )
  182. if ( self:GetForce() < 100 ) then return end
  183. local players = 0
  184. for _, ply in pairs( ents.FindInSphere( self.Owner:GetPos(), 200 ) ) do
  185. if not IsValid( ply ) then continue end
  186. if not ply:IsPlayer() then continue end
  187. if not ply:Alive() then continue end
  188. if players >= 8 then break end
  189. ply:SetHealth( math.Clamp( ply:Health() + 200, 0, ply:GetMaxHealth() ) )
  190. local ed = EffectData()
  191. ed:SetOrigin( self:GetSaberPosAng() )
  192. ed:SetEntity( ply )
  193. util.Effect( "rb655_force_heal", ed, true, true )
  194. players = players + 1
  195. end
  196. self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.6 )
  197. self:SetForce( self:GetForce() - 100 )
  198. local tbl = wOS.ExperienceTable[ self.Owner:GetUserGroup() ]
  199. if not tbl then
  200. tbl = wOS.ExperienceTable[ "Default" ].XPPerHeal
  201. else
  202. tbl = wOS.ExperienceTable[ self.Owner:GetUserGroup() ].XPPerHeal
  203. end
  204. self.Owner:AddSkillXP( tbl )
  205. return true
  206. end
  207. })
  208.  
  209. wOS.ForcePowers:RegisterNewPower({
  210. name = "Cloak",
  211. icon = "C",
  212. image = "wos/forceicons/cloak.png",
  213. cooldown = 0,
  214. description = "Shrowd yourself with the force for 10 seconds",
  215. action = function( self )
  216. if ( self:GetForce() < 50 || !self.Owner:IsOnGround() ) then return end
  217. if self.Owner:GetNW2Float( "CloakTime", 0 ) >= CurTime() then return end
  218. self:SetForce( self:GetForce() - 50 )
  219. self:SetNextAttack( 0.7 )
  220. self:PlayWeaponSound( "lightsaber/force_leap.wav" )
  221. self.Owner:SetNW2Float( "CloakTime", CurTime() + 10 )
  222. return true
  223. end
  224. })
  225.  
  226. wOS.ForcePowers:RegisterNewPower({
  227. name = "Force Reflect",
  228. icon = "FR",
  229. image = "wos/forceicons/reflect.png",
  230. cooldown = 28,
  231. description = "An eye for an eye",
  232. action = function( self )
  233. if ( self:GetForce() < 100 || !self.Owner:IsOnGround() ) then return end
  234. if self.Owner:GetNW2Float( "ReflectTime", 0 ) >= CurTime() then return end
  235. self:SetForce( self:GetForce() - 100 )
  236. self:SetNextAttack( 0.7 )
  237. self:PlayWeaponSound( "lightsaber/force_leap.wav" )
  238. self.Owner:SetNW2Float( "ReflectTime", CurTime() + 5 )
  239. return true
  240. end
  241. })
  242.  
  243. wOS.ForcePowers:RegisterNewPower({
  244. name = "Rage",
  245. icon = "RA",
  246. image = "wos/forceicons/rage.png",
  247. cooldown = 0,
  248. description = "Unleash your anger",
  249. action = function( self )
  250. if ( self:GetForce() < 50 || !self.Owner:IsOnGround() ) then return end
  251. if self.Owner:GetNW2Float( "RageTime", 0 ) >= CurTime() then return end
  252. self:SetForce( self:GetForce() - 50 )
  253. self:SetNextAttack( 0.7 )
  254. self:PlayWeaponSound( "lightsaber/force_leap.wav" )
  255. self.Owner:SetNW2Float( "RageTime", CurTime() + 10 )
  256. return true
  257. end
  258. })
  259.  
  260. wOS.ForcePowers:RegisterNewPower({
  261. name = "Shadow Strike",
  262. icon = "SS",
  263. distance = 30,
  264. image = "wos/forceicons/shadow_strike.png",
  265. cooldown = 0,
  266. target = 1,
  267. manualaim = false,
  268. description = "From the darkness it preys",
  269. action = function( self )
  270. if self.Owner:GetNW2Float( "CloakTime", 0 ) < CurTime() then return end
  271. local ent = self:SelectTargets( 1, 30 )[ 1 ]
  272. if !IsValid( ent ) then self:SetNextAttack( 0.2 ) return end
  273. if ( self:GetForce() < 50 ) then self:SetNextAttack( 0.2 ) return end
  274. self.Owner:SetSequenceOverride("b_c3_t2", 1)
  275. self:SetForce( self:GetForce() - 50 )
  276. self.Owner:EmitSound( "lightsaber/saber_hit_laser" .. math.random( 1, 4 ) .. ".wav" )
  277. self.Owner:AnimResetGestureSlot( GESTURE_SLOT_CUSTOM )
  278. self.Owner:SetAnimation( PLAYER_ATTACK1 )
  279. ent:TakeDamage( 500, self.Owner, self )
  280. self.Owner:SetNW2Float( "CloakTime", CurTime() + 0.5 )
  281. self:SetNextAttack( 0.7 )
  282. return true
  283. end
  284. })
  285.  
  286. wOS.ForcePowers:RegisterNewPower({
  287. name = "Force Pull",
  288. icon = "PL",
  289. target = 1,
  290. description = "Get over here!",
  291. image = "wos/forceicons/pull.png",
  292. cooldown = 0,
  293. manualaim = false,
  294. action = function( self )
  295. if ( self:GetForce() < 20 ) then return end
  296. local ent = self:SelectTargets( 1 )[ 1 ]
  297. if not IsValid( ent ) then return end
  298. self:PlayWeaponSound( "lightsaber/force_repulse.wav" )
  299. local newpos = ( self.Owner:GetPos() - ent:GetPos() )
  300. newpos = newpos / newpos:Length()
  301. ent:SetVelocity( newpos*700 + Vector( 0, 0, 300 ) )
  302. self:SetForce( self:GetForce() - 20 )
  303. self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.3 )
  304. self:SetNextAttack( 1.5 )
  305. return true
  306. end
  307. })
  308.  
  309. wOS.ForcePowers:RegisterNewPower({
  310. name = "Force Push",
  311. icon = "PH",
  312. target = 1,
  313. distance = 150,
  314. description = "They are no harm at a distance",
  315. image = "wos/forceicons/push.png",
  316. cooldown = 0,
  317. manualaim = false,
  318. action = function( self )
  319. if ( self:GetForce() < 20 ) then return end
  320. local ent = self:SelectTargets( 1 )[ 1 ]
  321. if not IsValid( ent ) then return end
  322. self:PlayWeaponSound( "lightsaber/force_repulse.wav" )
  323. local newpos = ( self.Owner:GetPos() - ent:GetPos() )
  324. newpos = newpos / newpos:Length()
  325. ent:SetVelocity( newpos*-700 + Vector( 0, 0, 300 ) )
  326. self:SetForce( self:GetForce() - 20 )
  327. self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.3 )
  328. self:SetNextAttack( 1.5 )
  329. return true
  330. end
  331. })
  332.  
  333. wOS.ForcePowers:RegisterNewPower({
  334. name = "Lightning Strike",
  335. icon = "LS",
  336. distance = 600,
  337. image = "wos/forceicons/lightning_strike.png",
  338. cooldown = 0,
  339. target = 1,
  340. manualaim = false,
  341. description = "A focused charge of lightning",
  342. action = function( self )
  343. local ent = self:SelectTargets( 1, 600 )[ 1 ]
  344. if !IsValid( ent ) then self:SetNextAttack( 0.2 ) return end
  345. if ( self:GetForce() < 20 ) then self:SetNextAttack( 0.2 ) return end
  346. self:SetForce( self:GetForce() - 20 )
  347.  
  348. local ed = EffectData()
  349. ed:SetOrigin( self:GetSaberPosAng() )
  350. ed:SetEntity( ent )
  351. util.Effect( "rb655_force_lighting", ed, true, true )
  352.  
  353. local dmg = DamageInfo()
  354. dmg:SetAttacker( self.Owner || self )
  355. dmg:SetInflictor( self.Owner || self )
  356. dmg:SetDamage( 150 )
  357. ent:TakeDamageInfo( dmg )
  358. self.Owner:EmitSound( Sound( "npc/strider/fire.wav" ) )
  359. self.Owner:EmitSound( Sound( "ambient/atmosphere/thunder1.wav" ) )
  360. if ( !self.SoundLightning ) then
  361. self.SoundLightning = CreateSound( self.Owner, "lightsaber/force_lightning" .. math.random( 1, 2 ) .. ".wav" )
  362. self.SoundLightning:Play()
  363. else
  364. self.SoundLightning:Play()
  365. end
  366. local bullet = {}
  367. bullet.Num = 1
  368. bullet.Src = self.Owner:GetPos() + Vector( 0, 0, 10 )
  369. bullet.Dir = ( ent:GetPos() - ( self.Owner:GetPos() + Vector( 0, 0, 10 ) ) )
  370. bullet.Spread = 0
  371. bullet.Tracer = 1
  372. bullet.Force = 0
  373. bullet.Damage = 0
  374. bullet.AmmoType = "Pistol"
  375. bullet.Entity = self.Owner
  376. bullet.TracerName = "thor_thunder"
  377. self:SetNextAttack( 2 )
  378. self.Owner:FireBullets( bullet )
  379. timer.Create( "test", 0.2, 1, function() if ( self.SoundLightning ) then self.SoundLightning:Stop() self.SoundLightning = nil end end )
  380. return true
  381. end
  382. })
  383. wOS.ForcePowers:RegisterNewPower({
  384. name = "Advanced Cloak",
  385. icon = "AC",
  386. image = "wos/forceicons/advanced_cloak.png",
  387. cooldown = 0,
  388. manualaim = false,
  389. description = "Shrowd yourself with the force for 25 seconds",
  390. action = function( self )
  391. if ( self:GetForce() < 50 || !self.Owner:IsOnGround() ) then return end
  392.  
  393. if self.Owner:GetNW2Float( "CloakTime", 0 ) >= CurTime() then return end
  394. self:SetForce( self:GetForce() - 50 )
  395. self:SetNextAttack( 0.7 )
  396. self:PlayWeaponSound( "lightsaber/force_leap.wav" )
  397. self.Owner:SetNW2Float( "CloakTime", CurTime() + 25 )
  398. return true
  399. end
  400. })
  401.  
  402. wOS.ForcePowers:RegisterNewPower({
  403. name = "Force Lightning",
  404. icon = "L",
  405. target = 1,
  406. image = "wos/forceicons/lightning.png",
  407. cooldown = 0,
  408. manualaim = false,
  409. description = "Torture people ( and monsters ) at will.",
  410. action = function( self )
  411. if ( self:GetForce() < 1 ) then return end
  412.  
  413. local foundents = 0
  414. for id, ent in pairs( self:SelectTargets( 1 ) ) do
  415. if ( !IsValid( ent ) ) then continue end
  416.  
  417. foundents = foundents + 1
  418. local ed = EffectData()
  419. ed:SetOrigin( self:GetSaberPosAng() )
  420. ed:SetEntity( ent )
  421. util.Effect( "rb655_force_lighting", ed, true, true )
  422.  
  423. local dmg = DamageInfo()
  424. dmg:SetAttacker( self.Owner || self )
  425. dmg:SetInflictor( self.Owner || self )
  426. dmg:SetDamage( 12.5 )
  427. if ( ent:IsNPC() ) then dmg:SetDamage( 12.5 ) end
  428. ent:TakeDamageInfo( dmg )
  429.  
  430. end
  431.  
  432. if ( foundents > 0 ) then
  433. self:SetForce( self:GetForce() - foundents )
  434. if ( !self.SoundLightning ) then
  435. self.SoundLightning = CreateSound( self.Owner, "lightsaber/force_lightning" .. math.random( 1, 2 ) .. ".wav" )
  436. self.SoundLightning:Play()
  437. else
  438. self.SoundLightning:Play()
  439. end
  440.  
  441. timer.Create( "test", 0.2, 1, function() if ( self.SoundLightning ) then self.SoundLightning:Stop() self.SoundLightning = nil end end )
  442. end
  443. self:SetNextAttack( 0.1 )
  444. return true
  445. end
  446. })
  447.  
  448.  
  449. wOS.ForcePowers:RegisterNewPower({
  450. name = "Force Combust",
  451. icon = "C",
  452. target = 1,
  453. description = "Ignite stuff infront of you.",
  454. image = "wos/forceicons/combust.png",
  455. cooldown = 0,
  456. manualaim = false,
  457. action = function( self )
  458.  
  459. local ent = self:SelectTargets( 1 )[ 1 ]
  460.  
  461. if ( !IsValid( ent ) or ent:IsOnFire() ) then self:SetNextAttack( 0.2 ) return end
  462.  
  463. local time = math.Clamp( 512 / self.Owner:GetPos():Distance( ent:GetPos() ), 1, 16 )
  464. local neededForce = math.ceil( math.Clamp( time * 2, 10, 32 ) )
  465.  
  466. if ( self:GetForce() < neededForce ) then self:SetNextAttack( 0.2 ) return end
  467.  
  468. ent:Ignite( time, 0 )
  469. self:SetForce( self:GetForce() - neededForce )
  470.  
  471. self:SetNextAttack( 1 )
  472. return true
  473. end
  474. })
  475.  
  476. wOS.ForcePowers:RegisterNewPower({
  477. name = "Force Repulse",
  478. icon = "R",
  479. image = "wos/forceicons/repulse.png",
  480. description = "Hold to charge for greater distance/damage. Push back everything near you.",
  481. think = function( self )
  482. if ( self:GetNextSecondaryFire() > CurTime() ) then return end
  483. if ( self:GetForce() < 1 ) then return end
  484. if ( !self.Owner:KeyDown( IN_ATTACK2 ) && !self.Owner:KeyReleased( IN_ATTACK2 ) ) then return end
  485. if ( !self._ForceRepulse && self:GetForce() < 16 ) then return end
  486.  
  487. if ( !self.Owner:KeyReleased( IN_ATTACK2 ) ) then
  488. if ( !self._ForceRepulse ) then self:SetForce( self:GetForce() - 16 ) self._ForceRepulse = 1 end
  489.  
  490. if ( !self.NextForceEffect or self.NextForceEffect < CurTime() ) then
  491. local ed = EffectData()
  492. ed:SetOrigin( self.Owner:GetPos() + Vector( 0, 0, 36 ) )
  493. ed:SetRadius( 128 * self._ForceRepulse )
  494. util.Effect( "rb655_force_repulse_in", ed, true, true )
  495.  
  496. self.NextForceEffect = CurTime() + math.Clamp( self._ForceRepulse / 20, 0.1, 0.5 )
  497. end
  498.  
  499. self._ForceRepulse = self._ForceRepulse + 0.025
  500. self:SetForce( self:GetForce() - 0.5 )
  501. if ( self:GetForce() > 0.99 ) then return end
  502. else
  503. if ( !self._ForceRepulse ) then return end
  504. end
  505.  
  506. local maxdist = 128 * self._ForceRepulse
  507.  
  508. for i, e in pairs( ents.FindInSphere( self.Owner:GetPos(), maxdist ) ) do
  509. if ( e == self.Owner ) then continue end
  510.  
  511. local dist = self.Owner:GetPos():Distance( e:GetPos() )
  512. local mul = ( maxdist - dist ) / 256
  513.  
  514. local v = ( self.Owner:GetPos() - e:GetPos() ):GetNormalized()
  515. v.z = 0
  516.  
  517. if ( e:IsNPC() && util.IsValidRagdoll( e:GetModel() or "" ) ) then
  518.  
  519. local dmg = DamageInfo()
  520. dmg:SetDamagePosition( e:GetPos() + e:OBBCenter() )
  521. dmg:SetDamage( 48 * mul )
  522. dmg:SetDamageType( DMG_GENERIC )
  523. if ( ( 1 - dist / maxdist ) > 0.8 ) then
  524. dmg:SetDamageType( DMG_DISSOLVE )
  525. dmg:SetDamage( e:Health() * 3 )
  526. end
  527. dmg:SetDamageForce( -v * math.min( mul * 40000, 80000 ) )
  528. dmg:SetInflictor( self.Owner )
  529. dmg:SetAttacker( self.Owner )
  530. e:TakeDamageInfo( dmg )
  531.  
  532. if ( e:IsOnGround() ) then
  533. e:SetVelocity( v * mul * -2048 + Vector( 0, 0, 64 ) )
  534. elseif ( !e:IsOnGround() ) then
  535. e:SetVelocity( v * mul * -1024 + Vector( 0, 0, 64 ) )
  536. end
  537.  
  538. elseif ( e:IsPlayer() && e:IsOnGround() ) then
  539. e:SetVelocity( v * mul * -2048 + Vector( 0, 0, 64 ) )
  540. elseif ( e:IsPlayer() && !e:IsOnGround() ) then
  541. e:SetVelocity( v * mul * -384 + Vector( 0, 0, 64 ) )
  542. elseif ( e:GetPhysicsObjectCount() > 0 ) then
  543. for i = 0, e:GetPhysicsObjectCount() - 1 do
  544. e:GetPhysicsObjectNum( i ):ApplyForceCenter( v * mul * -512 * math.min( e:GetPhysicsObject():GetMass(), 256 ) + Vector( 0, 0, 64 ) )
  545. end
  546. end
  547. end
  548.  
  549. local ed = EffectData()
  550. ed:SetOrigin( self.Owner:GetPos() + Vector( 0, 0, 36 ) )
  551. ed:SetRadius( maxdist )
  552. util.Effect( "rb655_force_repulse_out", ed, true, true )
  553.  
  554. self._ForceRepulse = nil
  555.  
  556. self:SetNextAttack( 1 )
  557.  
  558. self:PlayWeaponSound( "lightsaber/force_repulse.wav" )
  559. end
  560. })
  561.  
  562. wOS.ForcePowers:RegisterNewPower({
  563. name = "Storm",
  564. icon = "STR",
  565. image = "wos/forceicons/storm.png",
  566. cooldown = 3,
  567. description = "Charge for 0.5 seconds, unleash a storm on your enemies",
  568. action = function( self )
  569. if ( self:GetForce() < 100 ) then self:SetNextAttack( 0.2 ) return end
  570. if self.Owner:GetNW2Float( "wOS.SaberAttackDelay", 0 ) >= CurTime() then return end
  571. self:SetForce( self:GetForce() - 100 )
  572. self.Owner:EmitSound( Sound( "npc/strider/charging.wav" ) )
  573. self.Owner:SetNW2Float( "wOS.SaberAttackDelay", CurTime() + 0.5 )
  574. local tr = util.TraceLine( util.GetPlayerTrace( self.Owner ) )
  575. local pos = tr.HitPos + Vector( 0, 0, 600 )
  576. local pi = math.pi
  577. local bullet = {}
  578. bullet.Num = 1
  579. bullet.Spread = 0
  580. bullet.Tracer = 1
  581. bullet.Force = 0
  582. bullet.Damage = 1500
  583. bullet.AmmoType = "Pistol"
  584. bullet.Entity = self.Owner
  585. bullet.TracerName = "thor_storm"
  586. timer.Simple( 2, function()
  587. if not IsValid( self.Owner ) then return end
  588. self.Owner:EmitSound( Sound( "ambient/atmosphere/thunder1.wav" ) )
  589. bullet.Src = pos
  590. bullet.Dir = Vector( 0, 0, -1 )
  591. self.Owner:EmitSound( Sound( "npc/strider/fire.wav" ) )
  592. self.Owner:FireBullets( bullet )
  593. timer.Simple( 0.1, function()
  594. if not IsValid( self.Owner ) then return end
  595. bullet.Src = pos + Vector( 65*math.sin( pi*2/5 ), 65*math.cos( pi*2/5 ), 0 )
  596. bullet.Dir = Vector( 0, 0, -1 )
  597. self.Owner:EmitSound( Sound( "npc/strider/fire.wav" ) )
  598. self.Owner:FireBullets( bullet )
  599. end )
  600. timer.Simple( 0.2, function()
  601. if not IsValid( self.Owner ) then return end
  602. bullet.Src = pos + Vector( 65*math.sin( pi*4/5 ), 65*math.cos( pi*4/5 ), 0 )
  603. bullet.Dir = Vector( 0, 0, -1 )
  604. self.Owner:EmitSound( Sound( "npc/strider/fire.wav" ) )
  605. self.Owner:FireBullets( bullet )
  606. end )
  607. timer.Simple( 0.3, function()
  608. if not IsValid( self.Owner ) then return end
  609. bullet.Src = pos + Vector( 65*math.sin( pi*6/5 ), 65*math.cos( pi*6/5 ), 0 )
  610. bullet.Dir = Vector( 0, 0, -1 )
  611. self.Owner:EmitSound( Sound( "npc/strider/fire.wav" ) )
  612. self.Owner:FireBullets( bullet )
  613. end )
  614. timer.Simple( 0.4, function()
  615. if not IsValid( self.Owner ) then return end
  616. bullet.Src = pos + Vector( 65*math.sin( pi*8/5 ), 65*math.cos( pi*8/5 ), 0 )
  617. bullet.Dir = Vector( 0, 0, -1 )
  618. self.Owner:EmitSound( Sound( "npc/strider/fire.wav" ) )
  619. self.Owner:FireBullets( bullet )
  620. end )
  621. timer.Simple( 0.5, function()
  622. if not IsValid( self.Owner ) then return end
  623. bullet.Src = pos + Vector( 65*math.sin( 2*pi ), 65*math.cos( 2*pi ), 0 )
  624. bullet.Dir = Vector( 0, 0, -1 )
  625. self.Owner:EmitSound( Sound( "npc/strider/fire.wav" ) )
  626. self.Owner:FireBullets( bullet )
  627. end )
  628. end )
  629. return true
  630. end
  631. })
  632.  
  633. wOS.ForcePowers:RegisterNewPower({
  634. name = "Kneel",
  635. icon = "K",
  636. image = "wos/forceicons/meditate.png",
  637. description = "Relax yourself and channel your energy",
  638. think = function( self )
  639. if self.MeditateCooldown and self.MeditateCooldown >= CurTime() then return end
  640. if ( self.Owner:KeyDown( IN_ATTACK2 ) ) and !self:GetEnabled() and self.Owner:OnGround() then
  641. if !self._ForceMeditating then
  642. self.Owner.SaveAngles = self.Owner:GetAngles()
  643. end
  644. self._ForceMeditating = true
  645. else
  646. self._ForceMeditating = false
  647. end
  648. if self._ForceMeditating then
  649. self.Owner:SetNW2Bool("IsMeditating", true)
  650. if not self._NextMeditateHeal then self._NextMeditateHeal = 0 end
  651. if self._NextMeditateHeal < CurTime() then
  652. self.Owner:SetHealth( math.min( self.Owner:Health() + ( self.Owner:GetMaxHealth()*0.01 ), self.Owner:GetMaxHealth() ) )
  653. if #self.DevestatorList > 0 then
  654. self:SetDevEnergy( self:GetDevEnergy() * 0)
  655. end
  656. local tbl = wOS.ExperienceTable[ self.Owner:GetUserGroup() ]
  657. if not tbl then
  658. tbl = wOS.ExperienceTable[ "Default" ].Meditation
  659. else
  660. tbl = wOS.ExperienceTable[ self.Owner:GetUserGroup() ].Meditation
  661. end
  662. self.Owner:AddSkillXP( tbl )
  663. self._NextMeditateHeal = CurTime() + 3
  664. end
  665. self.Owner:SetLocalVelocity(Vector(0, 0, 0))
  666. self.Owner:SetMoveType(MOVETYPE_NONE)
  667. self.Owner:SetEyeAngles( self.Owner.SaveAngles )
  668. self.Owner:SetAngles( self.Owner.SaveAngles )
  669. else
  670. self.Owner:SetNW2Bool("IsMeditating", false)
  671. if self:GetMoveType() != MOVETYPE_WALK and self.Owner:GetNW2Float( "wOS.DevestatorTime", 0 ) < CurTime() then
  672. self.Owner:SetMoveType(MOVETYPE_WALK)
  673. end
  674. end
  675. if self.Owner:KeyReleased( IN_ATTACK2 ) then
  676. self.MeditateCooldown = CurTime() + 3
  677. end
  678. end
  679. })
  680.  
  681. wOS.ForcePowers:RegisterNewPower({
  682. name = "Channel Hatred",
  683. icon = "HT",
  684. image = "wos/forceicons/channel_hatred.png",
  685. description = "I can feel your anger",
  686. think = function( self )
  687. if self.ChannelCooldown and self.ChannelCooldown >= CurTime() then return end
  688. if ( self.Owner:KeyDown( IN_ATTACK2 ) ) and !self:GetEnabled() and self.Owner:OnGround() then
  689. self._ForceChanneling = true
  690. else
  691. self._ForceChanneling = false
  692. end
  693. if self.Owner:KeyReleased( IN_ATTACK2 ) then
  694. self.ChannelCooldown = CurTime() + 12
  695. end
  696. if self._ForceChanneling then
  697. if not self._NextChannelHeal then self._NextChannelHeal = 0 end
  698. self.Owner:SetNW2Bool("wOS.IsChanneling", true)
  699. if self._NextChannelHeal < CurTime() then
  700. self.Owner:SetHealth( math.min( self.Owner:Health() + ( self.Owner:GetMaxHealth()*0.01 ), self.Owner:GetMaxHealth() ) )
  701. if #self.DevestatorList > 0 then
  702. self:SetDevEnergy( self:GetDevEnergy() + self.DevCharge + 15 )
  703. end
  704. local tbl = wOS.ExperienceTable[ self.Owner:GetUserGroup() ]
  705. if not tbl then
  706. tbl = wOS.ExperienceTable[ "Default" ].Meditation
  707. else
  708. tbl = wOS.ExperienceTable[ self.Owner:GetUserGroup() ].Meditation
  709. end
  710. self.Owner:AddSkillXP( tbl )
  711. self._NextChannelHeal = CurTime() + 3
  712. end
  713. self.Owner:SetLocalVelocity(Vector(0, 0, 0))
  714. self.Owner:SetMoveType(MOVETYPE_NONE)
  715. if ( !self.SoundChanneling ) then
  716. self.SoundChanneling = CreateSound( self.Owner, "ambient/levels/citadel/field_loop1.wav" )
  717. self.SoundChanneling:Play()
  718. else
  719. self.SoundChanneling:Play()
  720. end
  721.  
  722. timer.Create( "test", 0.2, 1, function() if ( self.SoundChanneling ) then self.SoundChanneling:Stop() self.SoundChanneling = nil end end )
  723. else
  724. self.Owner:SetNW2Bool("wOS.IsChanneling", false)
  725. if self:GetMoveType() != MOVETYPE_WALK and self.Owner:GetNW2Float( "wOS.DevestatorTime", 0 ) < CurTime() then
  726. self.Owner:SetMoveType(MOVETYPE_WALK)
  727. end
  728. end
  729. if self.Owner:KeyReleased( IN_ATTACK2 ) then
  730. self.ChannelCooldown = CurTime() + 8
  731. end
  732. end
  733. })
  734.  
  735. wOS.ForcePowers:RegisterNewPower({
  736. name = "Ground Slam",
  737. icon = "GS",
  738. texture = "star/icon/ground_slam.png",
  739. cooldown = 30,
  740. description = "Shocks and destroys everything around you.",
  741. action = function( self )
  742. if ( self:GetForce() < 60 || CLIENT || !self.Owner:IsOnGround() ) then return end
  743. local elev = 400
  744. local time = 1
  745. ent = self.Owner
  746. self.Owner:SetSequenceOverride( "wos_bs_shared_kick", 1 )
  747.  
  748. self:SetForce(self:GetForce() - 60)
  749. self:SetNextAttack( 3 )
  750.  
  751. for j = 0,6 do
  752. for i = 0, 24 do
  753. local ed = EffectData()
  754. ed:SetOrigin( self.Owner:GetPos() + Vector(0,0,0) )
  755. ed:SetStart( self.Owner:GetPos() + Vector(0,0,0) + Angle(0 , i * 15, 0):Forward() * 512)
  756. util.Effect( "force_groundslam", ed, true, true )
  757. end
  758. end
  759.  
  760. local maxdist = 128 * 4
  761.  
  762. local ed = EffectData()
  763. ed:SetOrigin( self.Owner:GetPos() + Vector( 0, 0, 36 ) )
  764. ed:SetRadius( maxdist )
  765. util.Effect( "rb655_force_repulse_out", ed, true, true )
  766. for i, e in pairs( ents.FindInSphere( self.Owner:GetPos(), maxdist ) ) do
  767. if (e.Team and e:Team() == self.Owner:Team()) or (e.PlayerTeam and e.PlayerTeam == self.Owner:Team()) then continue end
  768.  
  769. local dist = self.Owner:GetPos():Distance( e:GetPos() )
  770. local mul = ( maxdist - dist ) / 256
  771.  
  772. local v = ( self.Owner:GetPos() - e:GetPos() ):GetNormalized()
  773. v.z = 0
  774.  
  775. local dmg = DamageInfo()
  776. dmg:SetDamagePosition( e:GetPos() + e:OBBCenter() )
  777. dmg:SetDamage( 200 * mul )
  778. dmg:SetDamageType( DMG_DISSOLVE )
  779. dmg:SetDamageForce( -v * math.min( mul * 20000, 40000 ) )
  780. dmg:SetInflictor( self.Owner )
  781. dmg:SetAttacker( self.Owner )
  782. e:TakeDamageInfo( dmg )
  783.  
  784. if ( e:IsOnGround() ) then
  785. e:SetVelocity( v * mul * -2048 + Vector( 0, 0, 64 ) )
  786. elseif ( !e:IsOnGround() ) then
  787. e:SetVelocity( v * mul * -1024 + Vector( 0, 0, 64 ) )
  788. end
  789. end
  790.  
  791. if ( !self.SoundLightning ) then
  792. self.SoundLightning = CreateSound( self.Owner, "lightsaber/force_lightning" .. math.random( 1, 2 ) .. ".wav" )
  793. self.SoundLightning:Play()
  794. self.SoundLightning:ChangeVolume(0,0.3)
  795. else
  796. self.SoundLightning:Play()
  797. end
  798. timer.Create( "test", 0.6, 1, function() if ( self.SoundLightning ) then self.SoundLightning:Stop() self.SoundLightning = nil end end )
  799.  
  800. self:PlayWeaponSound( "lightsaber/force_repulse.wav" )
  801. end
  802.  
  803. })
  804. wOS.ForcePowers:RegisterNewPower({
  805.  
  806. name = "Force Blind",
  807.  
  808. icon = "FB",
  809.  
  810. image = "wos/forceicons/icefuse/blind.png",
  811.  
  812. cooldown = 0,
  813.  
  814. manualaim = false,
  815.  
  816. description = "Make your escape or final blow.",
  817.  
  818. action = function( self )
  819.  
  820. if ( self:GetForce() < 75 ) then return end
  821.  
  822. for _, ply in pairs( ents.FindInSphere( self.Owner:GetPos(), 200 ) ) do
  823.  
  824. if not IsValid( ply ) then continue end
  825.  
  826. if not ply:IsPlayer() then continue end
  827.  
  828. if not ply:Alive() then continue end
  829.  
  830. if ply == self.Owner then continue end
  831.  
  832. ply:SetNW2Float( "wOS.BlindTime", CurTime() + 15 )
  833. local coil = ents.Create( "wos_sonic_discharge" )
  834. coil:SetPos( self.Owner:GetPos() )
  835. coil:Spawn()
  836. coil:SetOwner( self.Owner )
  837. end
  838.  
  839. self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.5 )
  840.  
  841. self:SetForce( self:GetForce() - 75 )
  842.  
  843. self:SetNextAttack( 1 )
  844.  
  845. return true
  846.  
  847. end
  848.  
  849. })
  850.  
  851.  
  852.  
  853. wOS.ForcePowers:RegisterNewPower({
  854. name = "Crushing Malice",
  855. icon = "LM",
  856. distance = 800,
  857. image = "wos/forceicons/advanced_cloak.png",
  858. cooldown = 10,
  859. target = 1,
  860. manualaim = false,
  861. description = "Finally you are free",
  862. action = function( self )
  863. local ent = self:SelectTargets( 1, 600 )[ 1 ]
  864. ent:SetSequenceOverride( "wos_force_crush", 1 )
  865. if !IsValid( ent ) then self:SetNextAttack( 1.0 ) return end
  866. if ( self:GetForce() < 20 ) then self:SetNextAttack( 1.0 ) return end
  867. self:SetForce( self:GetForce() - 20 )
  868. local ed = EffectData()
  869. ed:SetOrigin( self:GetSaberPosAng() )
  870. ed:SetEntity( ent )
  871. util.Effect( "ThumperDust", ed, true, true )
  872. for i= 10,1,-1 do
  873. local dmg = DamageInfo()
  874. dmg:SetAttacker( self.Owner || self )
  875. dmg:SetInflictor( self.Owner || self )
  876. dmg:SetDamage( 1 )
  877. ent:TakeDamageInfo( dmg )
  878. self.Owner:EmitSound( Sound( "physics/body/body_medium_break2.wav" ) )
  879. end
  880. end
  881.  
  882. })
  883.  
  884.  
  885.  
  886. wOS.ForcePowers:RegisterNewPower({
  887. name = "Force Slow",
  888. icon = "GH",
  889. image = "wos/forceicons/group_heal.png",
  890. cooldown = 5,
  891. target = 1,
  892. description = "Strike Up to 4 Enemys",
  893. action = function(self)
  894. if CLIENT then return end
  895. if self:GetForce() < 80 then return end
  896. local ent = self:SelectTargets( 1, 600 )[ 1 ]
  897. if !IsValid( ent ) then self:SetNextAttack( 1.0 ) return end
  898. if ( self:GetForce() < 20 ) then self:SetNextAttack( 1.0 ) return end
  899. if !ent:IsNPC() and !ent:IsPlayer() then return end
  900. if not IsValid( self ) then return end
  901. --Setup damageinfo
  902. local dmg = DamageInfo()
  903. dmg:SetDamage( 0 )
  904. dmg:SetDamageType( DMG_DIRECT )
  905. dmg:SetInflictor( self.Owner )
  906. dmg:SetAttacker( self.Owner )
  907.  
  908. local Hit = {[ent:EntIndex()] = ent}
  909. local count = 0
  910. for x = 1,4 do
  911. local org = ent:GetPos()
  912. local sound = CreateSound( ent, Sound( self.SwingSound ) )
  913. ent:TakeDamageInfo( dmg )
  914. sound:Play()
  915. timer.Simple(0.75, function()
  916. sound:Stop()
  917. end)
  918. //sound:ChangeVolume( 0, 0 )
  919. // ent = nil
  920.  
  921. for x,y in pairs(ents.FindInSphere(org, 512) ) do
  922. if (y:IsPlayer() or y:IsNPC()) and y != self.Owner and !Hit[y:EntIndex()] then
  923. Hit[y:EntIndex()] = y
  924. ent = y
  925. end
  926. end
  927.  
  928. ent = ent or table.Random(Hit)
  929. if x == 4 then
  930. pos1 = self.Owner:GetPos()
  931. pos2 = ent:GetPos()
  932. self.Owner:SetPos(pos2)
  933. ent:SetPos(pos1)
  934. end
  935. end
  936.  
  937. end
  938.  
  939. })
  940.  
  941.  
  942.  
  943. wOS.ForcePowers:RegisterNewPower({
  944.  
  945. name = "Force Stasis",
  946.  
  947. icon = "STS",
  948.  
  949. description = "Let their fear stop them",
  950.  
  951. target = 1,
  952.  
  953. image = "wos/forceicons/icefuse/stasis.png",
  954.  
  955. cooldown = 0,
  956.  
  957. manualaim = false,
  958.  
  959. action = function( self )
  960.  
  961. if ( self:GetForce() < 80 || !self.Owner:IsOnGround() ) then return end
  962.  
  963. local ent = self:SelectTargets( 1 )[ 1 ]
  964.  
  965. if not IsValid( ent ) then return end
  966.  
  967. if not ent:IsPlayer() then return end
  968.  
  969. self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.5 )
  970.  
  971. self:SetForce( self:GetForce() - 80 )
  972.  
  973. self:PlayWeaponSound( "lightsaber/force_leap.wav" )
  974.  
  975. ent:SetNW2Float( "wOS.ForceStasis", CurTime() + 10 )
  976.  
  977. self:SetNextAttack( 1 )
  978.  
  979. return true
  980.  
  981. end,
  982.  
  983. })
  984.  
  985.  
  986.  
  987. wOS.ForcePowers:RegisterNewPower({
  988.  
  989. name = "Group Pull",
  990.  
  991. icon = "GPL",
  992.  
  993. target = 8,
  994.  
  995. distance = 850,
  996.  
  997. description = "Keep your friends closer and you enemy's even closer!",
  998.  
  999. image = "wos/forceicons/icefuse/group_pull.png",
  1000.  
  1001. cooldown = 0,
  1002.  
  1003. manualaim = false,
  1004.  
  1005. action = function( self )
  1006.  
  1007. if ( self:GetForce() < 20 ) then return end
  1008.  
  1009. local foundents = self:SelectTargets( 10 )
  1010.  
  1011. if #foundents < 1 then return end
  1012.  
  1013. for id, ent in pairs( foundents ) do
  1014.  
  1015. local newpos = ( self.Owner:GetPos() - ent:GetPos() )
  1016.  
  1017. newpos = newpos / newpos:Length()
  1018.  
  1019. ent:SetVelocity( newpos*850 + Vector( 0, 0, 300 ) )
  1020.  
  1021. if ent:IsPlayer() then
  1022.  
  1023. local time = ent:SetSequenceOverride( "h_reaction_upper", 2)
  1024.  
  1025. end
  1026.  
  1027. end
  1028.  
  1029. self:PlayWeaponSound( "lightsaber/force_repulse.wav" )
  1030.  
  1031. self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.5 )
  1032.  
  1033. self:SetForce( self:GetForce() - 20 )
  1034.  
  1035. self:SetNextAttack( 1.5 )
  1036.  
  1037. return true
  1038.  
  1039. end,
  1040.  
  1041. })
  1042.  
  1043.  
  1044. wOS.ForcePowers:RegisterNewPower({
  1045.  
  1046. name = "Group Push",
  1047.  
  1048. icon = "GPH",
  1049.  
  1050. target = 50,
  1051.  
  1052. distance = 650,
  1053.  
  1054. description = "They are no harm at a distance",
  1055.  
  1056. image = "wos/forceicons/icefuse/group_push.png",
  1057.  
  1058. cooldown = 0,
  1059.  
  1060. manualaim = false,
  1061.  
  1062. action = function( self )
  1063.  
  1064. if ( self:GetForce() < 20 ) then return end
  1065.  
  1066. local foundents = self:SelectTargets( 50, 650 )
  1067.  
  1068. if #foundents < 1 then return end
  1069.  
  1070. for id, ent in pairs( foundents ) do
  1071.  
  1072. local newpos = ( self.Owner:GetPos() - ent:GetPos() )
  1073.  
  1074. newpos = newpos / newpos:Length()
  1075.  
  1076. ent:SetVelocity( newpos*-850 + Vector( 0, 0, 300 ) )
  1077.  
  1078. if ent:IsPlayer() then
  1079.  
  1080. local time = ent:SetSequenceOverride( "h_reaction_upper", 2 )
  1081.  
  1082. end
  1083.  
  1084. end
  1085.  
  1086. self:SetForce( self:GetForce() - 20 )
  1087.  
  1088. self:PlayWeaponSound( "lightsaber/force_repulse.wav" )
  1089.  
  1090. self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.5 )
  1091.  
  1092. self:SetNextAttack( 1.5 )
  1093.  
  1094. return true
  1095.  
  1096. end,
  1097.  
  1098. })
  1099.  
  1100.  
  1101.  
  1102. wOS.ForcePowers:RegisterNewPower({
  1103.  
  1104. name = "Group Lightning",
  1105.  
  1106. icon = "GL",
  1107.  
  1108. target = 4,
  1109.  
  1110. description = "Send a jolt to wake up groups of victims.",
  1111.  
  1112. image = "wos/forceicons/icefuse/group_lightning.png",
  1113.  
  1114. cooldown = 0,
  1115.  
  1116. manualaim = false,
  1117.  
  1118. action = function( self )
  1119.  
  1120. if ( self:GetForce() < 1 ) then return end
  1121.  
  1122.  
  1123.  
  1124. local foundents = 0
  1125.  
  1126. for id, ent in pairs( self:SelectTargets( 10 ) ) do
  1127.  
  1128. if ( !IsValid( ent ) ) then continue end
  1129.  
  1130.  
  1131.  
  1132. foundents = foundents + 1
  1133.  
  1134. local ed = EffectData()
  1135.  
  1136. ed:SetOrigin( self:GetSaberPosAng() )
  1137.  
  1138. ed:SetEntity( ent )
  1139.  
  1140. util.Effect( "rb655_force_lighting", ed, true, true )
  1141.  
  1142.  
  1143.  
  1144. local dmg = DamageInfo()
  1145.  
  1146. dmg:SetAttacker( self.Owner || self )
  1147.  
  1148. dmg:SetInflictor( self.Owner || self )
  1149.  
  1150. dmg:SetDamage( 15 )
  1151.  
  1152. if ent.IsBlocking then
  1153.  
  1154. ent:EmitSound( "lightsaber/saber_hit_laser" .. math.random( 1, 4 ) .. ".wav" )
  1155.  
  1156. if wOS.EnableStamina then
  1157.  
  1158. ent:AddStamina( -6 )
  1159.  
  1160. else
  1161.  
  1162. ent:GetActiveWeapon():SetForce( ent:GetActiveWeapon():GetForce() - 1 )
  1163.  
  1164. end
  1165.  
  1166. ent:SetSequenceOverride( "h_block", 0.5 )
  1167.  
  1168. else
  1169.  
  1170. ent:TakeDamageInfo( dmg )
  1171.  
  1172. end
  1173.  
  1174. if ( ent:IsNPC() ) then dmg:SetDamage( 1.6 ) end
  1175.  
  1176.  
  1177.  
  1178. end
  1179.  
  1180.  
  1181.  
  1182. if ( foundents > 0 ) then
  1183.  
  1184. self:SetForce( self:GetForce() - foundents )
  1185.  
  1186. if ( !self.SoundLightning ) then
  1187.  
  1188. self.SoundLightning = CreateSound( self.Owner, "lightsaber/force_lightning" .. math.random( 1, 2 ) .. ".wav" )
  1189.  
  1190. self.SoundLightning:Play()
  1191.  
  1192. else
  1193.  
  1194. self.SoundLightning:Play()
  1195.  
  1196. end
  1197.  
  1198. self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.5 )
  1199.  
  1200. timer.Create( "test" .. self.Owner:SteamID64(), 0.2, 1, function() if ( self.SoundLightning ) then self.SoundLightning:Stop() self.SoundLightning = nil end end )
  1201.  
  1202. end
  1203.  
  1204. self:SetNextAttack( 0.1 )
  1205.  
  1206. return true
  1207.  
  1208. end,
  1209.  
  1210. })
  1211.  
  1212.  
  1213. wOS.ForcePowers:RegisterNewPower({
  1214.  
  1215. name = "Electric Judgement",
  1216.  
  1217. icon = "EJ",
  1218.  
  1219. description = "The truth can blind us all.",
  1220.  
  1221. image = "wos/forceicons/icefuse/electric_judgement.png",
  1222.  
  1223. cooldown = 0,
  1224.  
  1225. manualaim = false,
  1226.  
  1227. action = function( self )
  1228.  
  1229. if ( self:GetForce() < 5 ) then return end
  1230.  
  1231. local tr = util.TraceLine( util.GetPlayerTrace( self.Owner ) )
  1232.  
  1233. local ent = tr.Entity
  1234.  
  1235. if not ent then return end
  1236.  
  1237. if not ent:IsPlayer() then return end
  1238.  
  1239. if self.Owner:GetPos():Distance( ent:GetPos() ) > 300 then return end
  1240.  
  1241. local ed = EffectData()
  1242.  
  1243. ed:SetOrigin( self:GetSaberPosAng() )
  1244.  
  1245. ed:SetEntity( ent )
  1246.  
  1247. util.Effect( "wos_emerald_lightning", ed, true, true )
  1248.  
  1249. if ent.IsBlocking then
  1250.  
  1251. ent:EmitSound( "lightsaber/saber_hit_laser" .. math.random( 1, 4 ) .. ".wav" )
  1252.  
  1253. if wOS.EnableStamina then
  1254.  
  1255. ent:AddStamina( -5 )
  1256.  
  1257. else
  1258.  
  1259. ent:GetActiveWeapon():SetForce( ent:GetActiveWeapon():GetForce() - 1 )
  1260.  
  1261. end
  1262.  
  1263. ent:SetSequenceOverride( "h_block", 0.5 )
  1264.  
  1265. else
  1266.  
  1267. ent:SetNW2Float( "wOS.DisorientTime", CurTime() + 7 )
  1268.  
  1269. ent:SetNW2Float( "wOS.SaberAttackDelay", CurTime() + 7 )
  1270.  
  1271. end
  1272.  
  1273. self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.5 )
  1274.  
  1275. self:SetForce( self:GetForce() - 5 )
  1276.  
  1277. if ( !self.SoundLightning ) then
  1278.  
  1279. self.SoundLightning = CreateSound( self.Owner, "ambient/wind/wind_snippet2.wav" )
  1280.  
  1281. self.SoundLightning:PlayEx( 0.5, 100 )
  1282.  
  1283. else
  1284.  
  1285. self.SoundLightning:PlayEx( 0.5, 100 )
  1286.  
  1287. end
  1288.  
  1289. timer.Create( "test" .. self.Owner:SteamID64(), 0.2, 1, function() if ( self.SoundLightning ) then self.SoundLightning:Stop() self.SoundLightning = nil end end )
  1290.  
  1291. -- self:SetNextAttack( 0.1 )
  1292.  
  1293. return true
  1294.  
  1295. end,
  1296.  
  1297. })
  1298.  
  1299.  
  1300.  
  1301. wOS.ForcePowers:RegisterNewPower({
  1302.  
  1303. name = "Force Whirlwind",
  1304.  
  1305. icon = "WW",
  1306.  
  1307. description = "That which you harness is all around you",
  1308.  
  1309. image = "wos/forceicons/icefuse/whirlwind.png",
  1310.  
  1311. cooldown = 0,
  1312.  
  1313. manualaim = false,
  1314.  
  1315. action = function( self )
  1316.  
  1317. if self:GetForce() < 1 then return end
  1318.  
  1319. if IsValid( self.WindTarget ) then return end
  1320.  
  1321. local tr = util.TraceLine( util.GetPlayerTrace( self.Owner ) )
  1322.  
  1323. local dist = tr.HitPos:Distance( self.Owner:GetPos() )
  1324.  
  1325. if not tr.Entity then return end
  1326.  
  1327. if dist >= 800 then return end
  1328.  
  1329. self.WindTarget = tr.Entity
  1330.  
  1331. self.WindDistance = dist
  1332.  
  1333. end,
  1334.  
  1335. think = function( self )
  1336.  
  1337. if not IsValid( self.WindTarget ) then return end
  1338.  
  1339. if ( self:GetNextSecondaryFire() > CurTime() ) then return end
  1340.  
  1341. if ( self:GetForce() < 1 ) then return end
  1342.  
  1343. if self.WindTarget:IsPlayer() and not self.WindTarget:Alive() then self.WindTarget = nil return end
  1344.  
  1345. if ( !self.Owner:KeyDown( IN_ATTACK2 ) && !self.Owner:KeyReleased( IN_ATTACK2 ) ) then return end
  1346.  
  1347. self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.5 )
  1348.  
  1349. if ( !self.Owner:KeyReleased( IN_ATTACK2 ) ) then
  1350.  
  1351. --self.WindTarget:SetLocalVelocity( Vector( 0, 0, 0 ) )
  1352.  
  1353. --self.WindTarget:SetPos( ply:EyePos() + ply:GetAimVector()*self.WindDistance )
  1354.  
  1355. local vec = ( ( self.Owner:EyePos() + self.Owner:GetAimVector()*self.WindDistance ) - self.WindTarget:GetPos() )
  1356.  
  1357. local vec2 = ( ( self.Owner:EyePos() + self.Owner:GetAimVector()*2*self.WindDistance ) - self.WindTarget:GetPos() )
  1358.  
  1359. if self.WindTarget:IsPlayer() or self.WindTarget:IsNPC() then
  1360.  
  1361. self.WindTarget:SetLocalVelocity( vec*15 )
  1362.  
  1363. self.WindTarget:SetNW2Float( "wOS.SaberAttackDelay", CurTime() + 0.2 )
  1364.  
  1365. else
  1366.  
  1367. --self.WindTarget:SetVelocity( ( ( self.Owner:EyePos() + self.Owner:GetAimVector()*self.WindDistance ) - self.WindTarget:GetPos() )*30 )
  1368.  
  1369. local phys = self.WindTarget:GetPhysicsObject()
  1370.  
  1371. phys:SetVelocity( vec*15 )
  1372.  
  1373. end
  1374.  
  1375. self:SetForce( self:GetForce() -1 )
  1376.  
  1377. if ( self:GetForce() < 1 ) then
  1378.  
  1379. local ed = EffectData()
  1380.  
  1381. ed:SetOrigin( self.WindTarget:GetPos() + Vector( 0, 0, 8 ) )
  1382.  
  1383. ed:SetRadius( 128 )
  1384.  
  1385. util.Effect( "rb655_force_repulse_out", ed, true, true )
  1386.  
  1387. self.WindTarget = nil
  1388.  
  1389. self:SetNextAttack( 1 )
  1390.  
  1391. self:PlayWeaponSound( "lightsaber/force_repulse.wav" )
  1392.  
  1393. end
  1394.  
  1395. if self.Owner:KeyReleased( IN_ATTACK ) then
  1396.  
  1397. local ed = EffectData()
  1398.  
  1399. ed:SetOrigin( self.WindTarget:GetPos() + Vector( 0, 0, 8 ) )
  1400.  
  1401. ed:SetRadius( 800 )
  1402.  
  1403. util.Effect( "rb655_force_repulse_out", ed, true, true )
  1404.  
  1405. self:PlayWeaponSound( "lightsaber/force_repulse.wav" )
  1406.  
  1407. if self.WindTarget:IsPlayer() or self.WindTarget:IsNPC() then
  1408.  
  1409. self.WindTarget:SetLocalVelocity( vec2*10 )
  1410.  
  1411. else
  1412.  
  1413. --self.WindTarget:SetVelocity( ( ( self.Owner:EyePos() + self.Owner:GetAimVector()*self.WindDistance ) - self.WindTarget:GetPos() )*30 )
  1414.  
  1415. local phys = self.WindTarget:GetPhysicsObject()
  1416.  
  1417. phys:SetVelocity( vec2*10 )
  1418.  
  1419. end
  1420.  
  1421. self.WindTarget = nil
  1422.  
  1423. self:SetNextAttack( 1 )
  1424.  
  1425. end
  1426.  
  1427. else
  1428.  
  1429. if not IsValid( self.WindTarget ) then return end
  1430.  
  1431. local ed = EffectData()
  1432.  
  1433. ed:SetOrigin( self.WindTarget:GetPos() + Vector( 0, 0, 8 ) )
  1434.  
  1435. ed:SetRadius( 800 )
  1436.  
  1437. util.Effect( "rb655_force_repulse_out", ed, true, true )
  1438.  
  1439.  
  1440.  
  1441. self.WindTarget = nil
  1442.  
  1443. self:SetNextAttack( 1 )
  1444.  
  1445. self:PlayWeaponSound( "lightsaber/force_repulse.wav" )
  1446.  
  1447. end
  1448.  
  1449. end
  1450.  
  1451. })
  1452.  
  1453.  
  1454. wOS.ForcePowers:RegisterNewPower({
  1455.  
  1456. name = "Force Breach",
  1457.  
  1458. icon = "BR",
  1459.  
  1460. description = "Make a path",
  1461.  
  1462. image = "wos/forceicons/icefuse/breach.png",
  1463.  
  1464. cooldown = 0,
  1465.  
  1466. manualaim = false,
  1467.  
  1468. action = function( self )
  1469.  
  1470. if self:GetForce() < 35 then return end
  1471.  
  1472. local tr = util.TraceLine( util.GetPlayerTrace( self.Owner ) )
  1473.  
  1474. if not IsValid( tr.Entity ) then return end
  1475.  
  1476. if not tr.Entity:GetClass()=="func_door" or not tr.Entity:GetClass()=="prop_door_rotating" or not tr.Entity:GetClass()=="func_door_rotating" then return end
  1477.  
  1478. self:SetForce( self:GetForce() - 35 )
  1479.  
  1480. self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.5 )
  1481.  
  1482. tr.Entity:Fire("unlock","",0)
  1483.  
  1484. tr.Entity:Fire("Open","",0)
  1485.  
  1486. self:SetNextAttack( 1 )
  1487.  
  1488. return true
  1489.  
  1490. end,
  1491.  
  1492. })
  1493.  
  1494.  
  1495.  
  1496. wOS.ForcePowers:RegisterNewPower({
  1497.  
  1498. name = "Teleport",
  1499.  
  1500. icon = "TP",
  1501.  
  1502. description = "Phase through to a new location.",
  1503.  
  1504. cooldown = 0,
  1505.  
  1506. manualaim = false,
  1507.  
  1508. think = function( self )
  1509.  
  1510. if ( self:GetNextSecondaryFire() > CurTime() ) then return end
  1511.  
  1512. if ( self:GetForce() < 75 ) then return end
  1513.  
  1514. if ( !self.Owner:KeyDown( IN_ATTACK2 ) && !self.Owner:KeyReleased( IN_ATTACK2 ) ) then return end
  1515.  
  1516. if self.Owner:KeyReleased( IN_ATTACK2 ) and self.groundTrace then
  1517.  
  1518. local speed = 4000;
  1519.  
  1520. local bFoundEdge = false;
  1521.  
  1522.  
  1523.  
  1524. self.Owner:SetNW2Float("wOS.ShowBlink", 0 );
  1525.  
  1526.  
  1527.  
  1528. local hullTrace = util.TraceHull({
  1529.  
  1530. start = self.Owner:EyePos(),
  1531.  
  1532. endpos = self.Owner:EyePos() + self.Owner:EyeAngles():Forward() * 2400,
  1533.  
  1534. filter = self.Owner,
  1535.  
  1536. mins = Vector(-16, -16, 0),
  1537.  
  1538. maxs = Vector(16, 16, 9)
  1539.  
  1540. });
  1541.  
  1542.  
  1543.  
  1544. local groundTrace = util.TraceEntity({
  1545.  
  1546. start = hullTrace.HitPos + Vector(0, 0, 1),
  1547.  
  1548. endpos = hullTrace.HitPos - (self.Owner:EyePos() - self.Owner:GetPos()),
  1549.  
  1550. filter = self.Owner
  1551.  
  1552. }, self.Owner);
  1553.  
  1554.  
  1555.  
  1556. local edgeTrace;
  1557.  
  1558.  
  1559.  
  1560. if (hullTrace.Hit and hullTrace.HitNormal.z <= 0) then
  1561.  
  1562. local ledgeForward = Angle(0, hullTrace.HitNormal:Angle().y, 0):Forward();
  1563.  
  1564. edgeTrace = util.TraceEntity({
  1565.  
  1566. start = hullTrace.HitPos - ledgeForward * 33 + Vector(0, 0, 40),
  1567.  
  1568. endpos = hullTrace.HitPos - ledgeForward * 33,
  1569.  
  1570. filter = self.Owner
  1571.  
  1572. }, self.Owner);
  1573.  
  1574.  
  1575.  
  1576. if (edgeTrace.Hit and !edgeTrace.AllSolid) then
  1577.  
  1578. local clearTrace = util.TraceHull({
  1579.  
  1580. start = hullTrace.HitPos,
  1581.  
  1582. endpos = hullTrace.HitPos + Vector(0, 0, 35),
  1583.  
  1584. mins = Vector(-16, -16, 0),
  1585.  
  1586. maxs = Vector(16, 16, 1),
  1587.  
  1588. filter = self.Owner
  1589.  
  1590. });
  1591.  
  1592.  
  1593.  
  1594. bFoundEdge = !clearTrace.Hit;
  1595.  
  1596. end;
  1597.  
  1598. end;
  1599.  
  1600.  
  1601.  
  1602. if (!bFoundEdge and groundTrace.AllSolid) then
  1603.  
  1604. self.groundTrace = nil
  1605.  
  1606. self:SetNextSecondaryFire( CurTime() + 1 )
  1607.  
  1608. return;
  1609.  
  1610. end;
  1611.  
  1612.  
  1613.  
  1614. local endPos = ( bFoundEdge and edgeTrace.HitPos ) or groundTrace.HitPos;
  1615.  
  1616.  
  1617.  
  1618. self.Owner:SetPos( endPos )
  1619.  
  1620. self.Owner:EmitSound("blink/exit" .. math.random(1, 2) .. ".wav");
  1621.  
  1622.  
  1623.  
  1624. self.groundTrace = nil
  1625.  
  1626. self:SetForce( self:GetForce() - 75 )
  1627.  
  1628. self:SetNextSecondaryFire( CurTime() + 1 )
  1629.  
  1630. return
  1631.  
  1632. end;
  1633.  
  1634.  
  1635.  
  1636. if self.Owner:KeyDown( IN_ATTACK2 ) then
  1637.  
  1638. local bFoundEdge = false;
  1639.  
  1640. self.Owner:SetNW2Float( "wOS.ShowBlink", CurTime() + 0.5 )
  1641.  
  1642. local hullTrace = util.TraceHull({
  1643.  
  1644. start = self.Owner:EyePos(),
  1645.  
  1646. endpos = self.Owner:EyePos() + self.Owner:EyeAngles():Forward() * 2400,
  1647.  
  1648. filter = self.Owner,
  1649.  
  1650. mins = Vector(-16, -16, 0),
  1651.  
  1652. maxs = Vector(16, 16, 9)
  1653.  
  1654. });
  1655.  
  1656.  
  1657.  
  1658. self.groundTrace = util.TraceHull({
  1659.  
  1660. start = hullTrace.HitPos + Vector(0, 0, 1),
  1661.  
  1662. endpos = hullTrace.HitPos - Vector(0, 0, 1000),
  1663.  
  1664. filter = self.Owner,
  1665.  
  1666. mins = Vector(-16, -16, 0),
  1667.  
  1668. maxs = Vector(16, 16, 1)
  1669.  
  1670. });
  1671.  
  1672.  
  1673.  
  1674. local edgeTrace;
  1675.  
  1676.  
  1677.  
  1678. if (hullTrace.Hit and hullTrace.HitNormal.z <= 0) then
  1679.  
  1680. local ledgeForward = Angle(0, hullTrace.HitNormal:Angle().y, 0):Forward();
  1681.  
  1682. edgeTrace = util.TraceEntity({
  1683.  
  1684. start = hullTrace.HitPos - ledgeForward * 33 + Vector(0, 0, 40),
  1685.  
  1686. endpos = hullTrace.HitPos - ledgeForward * 33,
  1687.  
  1688. filter = self.Owner
  1689.  
  1690. }, self.Owner);
  1691.  
  1692.  
  1693.  
  1694. if (edgeTrace.Hit and !edgeTrace.AllSolid) then
  1695.  
  1696. local clearTrace = util.TraceHull({
  1697.  
  1698. start = hullTrace.HitPos,
  1699.  
  1700. endpos = hullTrace.HitPos + Vector(0, 0, 35),
  1701.  
  1702. mins = Vector(-16, -16, 0),
  1703.  
  1704. maxs = Vector(16, 16, 1),
  1705.  
  1706. filter = self.Owner
  1707.  
  1708. });
  1709.  
  1710.  
  1711.  
  1712. if (!clearTrace.Hit) then
  1713.  
  1714. self.groundTrace.HitPos = edgeTrace.HitPos;
  1715.  
  1716. bFoundEdge = true;
  1717.  
  1718. end;
  1719.  
  1720. end;
  1721.  
  1722. end;
  1723.  
  1724. end
  1725.  
  1726. end,
  1727.  
  1728. })
  1729.  
  1730.  
  1731.  
  1732. wOS.ForcePowers:RegisterNewPower({
  1733.  
  1734. name = "Destruction",
  1735.  
  1736. icon = "DES",
  1737.  
  1738. description = "Hold to unleash true power on your enemies",
  1739.  
  1740. image = "wos/forceicons/icefuse/destruction.png",
  1741.  
  1742. cooldown = 0,
  1743.  
  1744. manualaim = false,
  1745.  
  1746. think = function( self )
  1747.  
  1748. if ( self:GetNextSecondaryFire() > CurTime() ) then return end
  1749.  
  1750. if ( self:GetForce() < 1 ) then return end
  1751.  
  1752. if ( !self.Owner:KeyDown( IN_ATTACK2 ) && !self.Owner:KeyReleased( IN_ATTACK2 ) ) then return end
  1753.  
  1754. if ( !self._ForceDestruction && self:GetForce() < 50 ) then return end
  1755.  
  1756.  
  1757.  
  1758. if ( !self.Owner:KeyReleased( IN_ATTACK2 ) ) then
  1759.  
  1760. if ( !self._ForceDestruction ) then self:SetForce( self:GetForce() - 50 ) self._ForceDestruction = 5 end
  1761.  
  1762. self._ForceDestruction = self._ForceDestruction + 1
  1763.  
  1764. self:SetForce( self:GetForce() - 2 )
  1765.  
  1766. if ( self:GetForce() > 0.99 ) then return end
  1767.  
  1768. else
  1769.  
  1770. if ( !self._ForceDestruction ) then return end
  1771.  
  1772. end
  1773.  
  1774. self.Owner:EmitSound( Sound( "npc/strider/charging.wav" ) )
  1775.  
  1776. self.Owner:SetNW2Float( "wOS.SaberAttackDelay", CurTime() + 2 )
  1777.  
  1778. self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 2 )
  1779.  
  1780. local tr = util.TraceLine( util.GetPlayerTrace( self.Owner ) )
  1781.  
  1782. local pos = tr.HitPos + Vector( 0, 0, 600 )
  1783.  
  1784. local pi = math.pi
  1785.  
  1786. local max = self._ForceDestruction
  1787.  
  1788. local bullet = {}
  1789.  
  1790. bullet.Num = 1
  1791.  
  1792. bullet.Spread = 0
  1793.  
  1794. bullet.Tracer = 1
  1795.  
  1796. bullet.Force = 0
  1797.  
  1798. bullet.Damage = 500
  1799.  
  1800. bullet.AmmoType = "Pistol"
  1801.  
  1802. bullet.Entity = self.Owner
  1803.  
  1804. bullet.TracerName = "thor_storm"
  1805.  
  1806. bullet.Callback = function( ply, tr, dmginfo )
  1807.  
  1808. sound.Play( "npc/strider/fire.wav", tr.HitPos )
  1809.  
  1810. end
  1811.  
  1812. timer.Simple( 2, function()
  1813.  
  1814. if not IsValid( self ) then return end
  1815.  
  1816. bullet.Src = pos
  1817.  
  1818. bullet.Dir = Vector( 0, 0, -1 )
  1819.  
  1820. self.Owner:FireBullets( bullet )
  1821.  
  1822. for i=1, max do
  1823.  
  1824. timer.Simple( 0.1*i, function()
  1825.  
  1826. if not IsValid( self ) then return end
  1827.  
  1828. local dis = i + i*30
  1829.  
  1830. if not IsValid( self.Owner ) then return end
  1831.  
  1832. bullet.Src = pos + Vector( dis*math.sin( i*pi*1/8 ), dis*math.cos( i*pi*1/8 ), 0 )
  1833.  
  1834. bullet.Dir = Vector( 0, 0, -1 )
  1835.  
  1836. self.Owner:FireBullets( bullet )
  1837.  
  1838. bullet.Src = pos + Vector( dis*math.sin( i*pi*3/8 ), dis*math.cos( i*pi*3/8 ), 0 )
  1839.  
  1840. bullet.Dir = Vector( 0, 0, -1 )
  1841.  
  1842. self.Owner:FireBullets( bullet )
  1843.  
  1844. bullet.Src = pos + Vector( dis*math.sin( i*pi*5/8 ), dis*math.cos( i*pi*5/8 ), 0 )
  1845.  
  1846. bullet.Dir = Vector( 0, 0, -1 )
  1847.  
  1848. self.Owner:FireBullets( bullet )
  1849.  
  1850. bullet.Src = pos + Vector( dis*math.sin( i*pi*7/8 ), dis*math.cos( i*pi*7/8 ), 0 )
  1851.  
  1852. bullet.Dir = Vector( 0, 0, -1 )
  1853.  
  1854. self.Owner:FireBullets( bullet )
  1855.  
  1856. end )
  1857.  
  1858. end
  1859.  
  1860. end )
  1861.  
  1862. self._ForceDestruction = nil
  1863.  
  1864. self:SetNextAttack( 3 )
  1865.  
  1866. end,
  1867.  
  1868. })
  1869.  
  1870.  
  1871.  
  1872. wOS.ForcePowers:RegisterNewPower({
  1873.  
  1874. name = "Force Choke",
  1875.  
  1876. icon = "CH",
  1877.  
  1878. description = "I find your lack of faith disturbing",
  1879.  
  1880. image = "wos/forceicons/icefuse/choke.png",
  1881.  
  1882. cooldown = 0,
  1883.  
  1884. manualaim = false,
  1885.  
  1886. action = function( self )
  1887.  
  1888. if self:GetForce() < 1 then return end
  1889.  
  1890. if IsValid( self.ChokeTarget ) then return end
  1891.  
  1892. local tr = util.TraceLine( util.GetPlayerTrace( self.Owner ) )
  1893.  
  1894. if not tr.Entity then return end
  1895.  
  1896. if not tr.Entity:IsPlayer() and not tr.Entity:IsNPC() then return end
  1897.  
  1898. if self.Owner:GetPos():Distance( tr.Entity:GetPos() ) >= 400 then return end
  1899.  
  1900. self.ChokeTarget = tr.Entity
  1901.  
  1902. self.ChokeTarget:EmitSound( "wos/icefuse/choke_start.wav" )
  1903.  
  1904. self.ChokePos = tr.Entity:GetPos()
  1905.  
  1906. end,
  1907.  
  1908. think = function( self )
  1909.  
  1910. if not IsValid( self.ChokeTarget ) then return end
  1911.  
  1912. if ( self:GetNextSecondaryFire() > CurTime() ) then return end
  1913.  
  1914. if ( self:GetForce() < 1 ) then return end
  1915.  
  1916. if not self.ChokeTarget:Alive() then self.ChokeTarget = nil return end
  1917.  
  1918. if ( !self.Owner:KeyDown( IN_ATTACK2 ) && !self.Owner:KeyReleased( IN_ATTACK2 ) ) then self.Owner:SetNW2Bool("wOS.Cast_Choke", false) return end
  1919.  
  1920. self.Owner:SetNW2Bool("wOS.Cast_Choke", true)
  1921.  
  1922. if ( !self.Owner:KeyReleased( IN_ATTACK2 ) ) then
  1923.  
  1924. local Cdmg = DamageInfo()
  1925.  
  1926. Cdmg:SetDamage( 0.4 ) --0.21
  1927.  
  1928. Cdmg:SetDamageType( DMG_CRUSH )
  1929.  
  1930. Cdmg:SetAttacker( self.Owner )
  1931.  
  1932. Cdmg:SetInflictor( self )
  1933.  
  1934. self.ChokeTarget:TakeDamageInfo( Cdmg )
  1935.  
  1936. self.ChokeTarget:SetLocalVelocity( ( self.ChokePos - self.ChokeTarget:GetPos() + Vector( 0, 0, 0 ) )*0 )
  1937.  
  1938. --self.ChokeTarget:SetPos( Vector( self.ChokePos.x, self.ChokePos.y, math.min( self.ChokeTarget:GetPos().z + 0.5, self.ChokePos.z + 55 ) ) )
  1939.  
  1940. --self.ChokeTarget:SetLocalVelocity( Vector( 0, 0, 100 ) )
  1941.  
  1942. self.ChokeTarget:SetNW2Bool("wOS.Choked", true)
  1943.  
  1944. self.ChokeTarget:SetNW2Float( "wOS.SaberAttackDelay", CurTime() + 0.5 )
  1945.  
  1946. self.Owner:SetNW2Bool("wOS.Cast_Choke", true)
  1947.  
  1948. self:SetForce( self:GetForce() - 0.02 )
  1949.  
  1950. if ( !self.SoundChoking ) then
  1951.  
  1952. self.SoundChoking = CreateSound( self.Owner, "wos/icefuse/choke_active.wav" )
  1953.  
  1954. self.SoundChoking:PlayEx( 0.25, 100 )
  1955.  
  1956. else
  1957.  
  1958. self.SoundChoking:PlayEx( 0.25, 100 )
  1959.  
  1960. end
  1961.  
  1962. timer.Create( "test" .. self.Owner:SteamID64() .. "_choke", 0.2, 1, function() if ( self.SoundChoking ) then self.SoundChoking:Stop() self.SoundChoking = nil end end )
  1963.  
  1964.  
  1965.  
  1966. if ( !self.SoundGagging ) then
  1967.  
  1968. self.SoundGagging = CreateSound( self.ChokeTarget, "wos/icefuse/choke_gagging.wav" )
  1969.  
  1970. self.SoundGagging:Play()
  1971.  
  1972. else
  1973.  
  1974. self.SoundGagging:Play()
  1975.  
  1976. end
  1977.  
  1978. timer.Create( "test" .. self.Owner:SteamID64(), 0.2, 1, function() if ( self.SoundGagging ) then self.SoundGagging:Stop() self.SoundGagging = nil end end )
  1979.  
  1980.  
  1981.  
  1982. if ( self:GetForce() <= 0 ) then
  1983.  
  1984. local ed = EffectData()
  1985.  
  1986. self.ChokeTarget = nil
  1987.  
  1988. self.ChokeTarget:SetNW2Bool("wOS.Choked", false)
  1989.  
  1990. self.Owner:SetNW2Bool("wOS.Cast_Choke", false)
  1991.  
  1992. self:SetNextAttack( 1 )
  1993.  
  1994. end
  1995.  
  1996. if (self.ChokeTarget:Health() == 1) then
  1997.  
  1998. self.ChokeTarget:SetNW2Bool("wOS.Choked", false)
  1999.  
  2000. self.Owner:SetNW2Bool("wOS.Cast_Choke", false)
  2001.  
  2002. end
  2003.  
  2004. else
  2005.  
  2006. if not IsValid( self.ChokeTarget ) then return end
  2007.  
  2008. local ed = EffectData()
  2009.  
  2010. self.ChokeTarget:SetNW2Bool("wOS.Choked", false)
  2011.  
  2012. self.Owner:SetNW2Bool("wOS.Cast_Choke", false)
  2013.  
  2014. self.ChokeTarget = nil
  2015.  
  2016. self:SetNextAttack( 1 )
  2017.  
  2018.  
  2019. end
  2020.  
  2021. end
  2022.  
  2023. })
  2024.  
  2025.  
  2026.  
  2027. wOS.ForcePowers:RegisterNewPower({
  2028.  
  2029. name = "Group Choke",
  2030.  
  2031. icon = "GCH",
  2032.  
  2033. description = "Choke them all",
  2034.  
  2035. image = "wos/forceicons/icefuse/choke.png",
  2036.  
  2037. cooldown = 0,
  2038.  
  2039. manualaim = false,
  2040.  
  2041. distance = 400,
  2042.  
  2043. target = 10,
  2044.  
  2045. action = function( self )
  2046.  
  2047. if self:GetForce() < 1 then return end
  2048.  
  2049. if self.IsGroupChoking then return end
  2050.  
  2051. local foundents = self:SelectTargets( 10, 400 )
  2052.  
  2053. if #foundents < 1 then return end
  2054.  
  2055. self.ChokeTargets = {}
  2056.  
  2057. self.ChokePoss = {}
  2058.  
  2059. for id, ent in pairs( foundents ) do
  2060.  
  2061. if not ent:IsPlayer() then continue end
  2062.  
  2063. self.ChokeTargets[ id ] = ent
  2064.  
  2065. ent:EmitSound( "wos/icefuse/choke_start.wav" )
  2066.  
  2067. self.ChokePoss[ id ] = ent:GetPos()
  2068.  
  2069. end
  2070.  
  2071. end,
  2072.  
  2073. think = function( self )
  2074.  
  2075. if not self.ChokeTargets then self.IsGroupChoking = false return end
  2076.  
  2077. if ( self:GetNextSecondaryFire() > CurTime() ) then self.IsGroupChoking = false return end
  2078.  
  2079. if ( self:GetForce() < 1 ) then self.IsGroupChoking = false return end
  2080.  
  2081. if #self.ChokeTargets < 1 then self.IsGroupChoking = false return end
  2082.  
  2083. if ( !self.Owner:KeyDown( IN_ATTACK2 ) && !self.Owner:KeyReleased( IN_ATTACK2 ) ) then self.Owner:SetNW2Float("wOS.Cast_Choke", false) return end
  2084.  
  2085. self.Owner:SetNW2Float("wOS.Cast_Choke", true)
  2086.  
  2087. if ( !self.Owner:KeyReleased( IN_ATTACK2 ) ) then
  2088.  
  2089. self:SetForce( self:GetForce() - 0.02 )
  2090.  
  2091. if ( !self.SoundChoking ) then
  2092.  
  2093. self.SoundChoking = CreateSound( self.Owner, "wos/icefuse/choke_active.wav" )
  2094.  
  2095. self.SoundChoking:PlayEx( 0.25, 100 )
  2096.  
  2097. else
  2098.  
  2099. self.SoundChoking:PlayEx( 0.25, 100 )
  2100.  
  2101. end
  2102.  
  2103. timer.Create( "test" .. self.Owner:SteamID64() .. "_choke", 0.2, 1, function() if ( self.SoundChoking ) then self.SoundChoking:Stop() self.SoundChoking = nil end end )
  2104.  
  2105. self.IsGroupChoking = true
  2106.  
  2107. for id, ply in pairs( self.ChokeTargets ) do
  2108.  
  2109. if not IsValid( ply ) then self.ChokeTargets[ id ] = nil continue end
  2110.  
  2111. if not ply:Alive() then self.ChokeTargets[ id ] = nil continue end
  2112.  
  2113. local GCdmg = DamageInfo()
  2114.  
  2115. GCdmg:SetDamage( 0.4 ) --0.21
  2116.  
  2117. GCdmg:SetDamageType( DMG_CRUSH )
  2118.  
  2119. GCdmg:SetAttacker( self.Owner )
  2120.  
  2121. GCdmg:SetInflictor( self )
  2122.  
  2123. ply:TakeDamageInfo( GCdmg )
  2124.  
  2125. ply:SetLocalVelocity( ( self.ChokePoss[ id ] - ply:GetPos() + Vector( 0, 0, 0) )*0 )
  2126.  
  2127. --self.ChokeTarget:SetPos( Vector( self.ChokePos.x, self.ChokePos.y, math.min( self.ChokeTarget:GetPos().z + 0.5, self.ChokePos.z + 55 ) ) )
  2128.  
  2129. --self.ChokeTarget:SetLocalVelocity( Vector( 0, 0, 100 ) )
  2130.  
  2131. ply:SetNW2Float( "wOS.Choked", true )
  2132. ply:SetNW2Float( "wOS.SaberAttackDelay", CurTime() + 0.5 )
  2133.  
  2134. self.Owner:SetNW2Float( "wOS.Cast_Choke", true )
  2135.  
  2136. if ( !ply.SoundGagging ) then
  2137.  
  2138. ply.SoundGagging = CreateSound( ply, "wos/icefuse/choke_gagging.wav" )
  2139.  
  2140. ply.SoundGagging:Play()
  2141.  
  2142. else
  2143.  
  2144. ply.SoundGagging:Play()
  2145.  
  2146. end
  2147.  
  2148. timer.Create( "test" .. ply:SteamID64(), 0.2, 1, function() if ( ply.SoundGagging ) then ply.SoundGagging:Stop() ply.SoundGagging = nil end end )
  2149.  
  2150.  
  2151.  
  2152. if ( self:GetForce() < 1 ) then
  2153.  
  2154. ply:SetNW2Float( "wOS.Choked", false )
  2155. self.Owner:SetNW2Float( "wOS.Cast_Choke", false )
  2156.  
  2157. self.ChokeTargets = {}
  2158.  
  2159. self:SetNextAttack( 1 )
  2160.  
  2161. self.IsGroupChoking = false
  2162.  
  2163. return
  2164.  
  2165. end
  2166.  
  2167. if (ply:Health() <= 0) then
  2168.  
  2169. self.ChokeTarget:SetNW2Bool("wOS.Choked", false)
  2170.  
  2171. self.Owner:SetNW2Bool("wOS.Cast_Choke", false)
  2172.  
  2173. end
  2174.  
  2175. end
  2176.  
  2177. else
  2178.  
  2179. for id, ply in pairs( self.ChokeTargets ) do
  2180. ply:SetNW2Float( "wOS.Choked", false )
  2181. if not IsValid( ply ) then self.ChokeTargets[ id ] = nil continue end
  2182. if not ply:Alive() then self.ChokeTargets[ id ] = nil continue end
  2183. end
  2184.  
  2185. self.Owner:SetNW2Float( "wOS.Cast_Choke", false )
  2186.  
  2187. self.ChokeTargets = {}
  2188.  
  2189. self:SetNextAttack( 1 )
  2190.  
  2191. self.IsGroupChoking = false
  2192. end
  2193.  
  2194. end
  2195.  
  2196. })
  2197.  
  2198. wOS.ForcePowers:RegisterNewPower({
  2199. name = "Force Meteor",
  2200. icon = "C",
  2201. target = 1,
  2202. texture = "star/icon/choke.png",
  2203. description = "Shoot Meteors down from the sky",
  2204. action = function( sel )
  2205. if ( CLIENT ) then return end
  2206. local ply = sel.Owner
  2207. local ent = sel:SelectTargets( 1 )[ 1 ]
  2208.  
  2209. if ( !IsValid( ent )) then sel:SetNextAttack( 0.2 ) return end
  2210.  
  2211. if sel:GetForce() < 70 then return end
  2212. for x = 1,5 do
  2213. local meteor = ents.Create("star_metor")
  2214. meteor.nodupe = true
  2215. meteor:Spawn()
  2216. meteor:SetMeteorTarget(ent)
  2217. end
  2218. sel:SetForce( sel:GetForce() - 70 )
  2219. local metor = CreateSound( sel.Owner,( "gbombs/daisy/daisy_explo.wav" .. 1 ..".mp3" ))
  2220. metor:Play()
  2221. sel:SetNextAttack( 2 )
  2222. sel.Owner:SetCoolDown(sel:GetActiveForcePowerType( sel:GetForceType() ).name, 60)
  2223.  
  2224. end
  2225. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement