Advertisement
jordan3012000

Untitled

Oct 15th, 2019
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 63.91 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. self.Owner:SetNW2Float( "ForceLeap", 1 )
  46. return true
  47. end
  48. })
  49.  
  50. wOS.ForcePowers:RegisterNewPower({
  51. name = "Charge",
  52. icon = "CH",
  53. distance = 600,
  54. image = "wos/forceicons/charge.png",
  55. target = 1,
  56. cooldown = 0,
  57. manualaim = false,
  58. description = "Lunge at your enemy",
  59. action = function( self )
  60. local ent = self:SelectTargets( 1, 600 )[ 1 ]
  61. if !IsValid( ent ) then self:SetNextAttack( 0.2 ) return end
  62. if ( self:GetForce() < 20 ) then self:SetNextAttack( 0.2 ) return end
  63. local newpos = ( ent:GetPos() - self.Owner:GetPos() )
  64. newpos = newpos / newpos:Length()
  65. self.Owner:SetLocalVelocity( newpos*700 + Vector( 0, 0, 300 ) )
  66. self:SetForce( self:GetForce() - 20 )
  67. self:PlayWeaponSound( "lightsaber/force_leap.wav" )
  68. self.Owner:SetSequenceOverride( "phalanx_a_s2_t1", 5 )
  69. self:SetNextAttack( 1 )
  70. self.AerialLand = false
  71. return true
  72. end
  73. })
  74.  
  75. wOS.ForcePowers:RegisterNewPower({
  76. name = "Force Absorb",
  77. icon = "A",
  78. image = "wos/forceicons/absorb.png",
  79. cooldown = 0,
  80. description = "Hold Mouse 2 to protect yourself from harm",
  81. action = function( self )
  82. if ( self:GetForce() < 1 ) then return end
  83. self:SetForce( self:GetForce() - 0.1 )
  84. self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.6 )
  85. self:SetNextAttack( 0.3 )
  86. return true
  87. end
  88. })
  89.  
  90. wOS.ForcePowers:RegisterNewPower({
  91. name = "Unrelenting Advance",
  92. icon = "UA",
  93. image = "wos/forceicons/absorb.png",
  94. cooldown = 0,
  95. description = "Hold Mouse 2 to protect yourself from harm",
  96. action = function( self )
  97. if ( self:GetForce() < 1 ) then return end
  98. self:SetForce( self:GetForce() - 0.1 )
  99. self.Owner:SetNW2Float( "wOS.GrievousAnim", CurTime() + 0.6 )
  100. self:SetNextAttack( 0.3 )
  101. return true
  102. end
  103. })
  104.  
  105. wOS.ForcePowers:RegisterNewPower({
  106. name = "Saber Throw",
  107. icon = "T",
  108. image = "wos/forceicons/throw.png",
  109. cooldown = 0,
  110. manualaim = false,
  111. description = "Throws your lightsaber. It will return to you.",
  112. action = function(self)
  113. if self:GetForce() < 20 then return end
  114. self:SetForce( self:GetForce() - 20 )
  115. self:SetEnabled(false)
  116. self:SetBladeLength(0)
  117. self:SetNextAttack( 1 )
  118. self:GetOwner():DrawWorldModel(false)
  119.  
  120. local ent = ents.Create("ent_lightsaber_thrown")
  121. ent:SetModel(self:GetWorldModel())
  122. ent:Spawn()
  123. ent:SetBladeLength(self:GetMaxLength())
  124. ent:SetMaxLength(self:GetMaxLength())
  125. ent:SetCrystalColor(self:GetCrystalColor())
  126. ent:SetDarkInner( self:GetDarkInner() )
  127.  
  128. local pos = self:GetSaberPosAng()
  129. ent:SetPos(pos)
  130. pos = pos + self.Owner:GetAimVector() * 750
  131. ent:SetEndPos(pos)
  132. ent:SetOwner(self.Owner)
  133. return true
  134. end
  135. })
  136.  
  137. wOS.ForcePowers:RegisterNewPower({
  138. name = "Force Heal",
  139. icon = "H",
  140. image = "wos/forceicons/heal.png",
  141. cooldown = 0,
  142. target = 1,
  143. manualaim = false,
  144. description = "Heals your target.",
  145. action = function( self )
  146. if ( self:GetForce() < 10 ) then return end
  147. local foundents = 0
  148.  
  149. for k, v in pairs( self:SelectTargets( 1 ) ) do
  150. if ( !IsValid( v ) ) then continue end
  151. if v:Health() == v:GetMaxHealth() then return end
  152. foundents = foundents + 1
  153. local ed = EffectData()
  154. ed:SetOrigin( self:GetSaberPosAng() )
  155. ed:SetEntity( v )
  156. util.Effect( "rb655_force_heal", ed, true, true )
  157. v:SetHealth( math.Clamp( v:Health() + 25, 0, v:GetMaxHealth() ) )
  158. end
  159. if ( foundents > 0 ) then
  160. self:SetForce( self:GetForce() - 3 )
  161. local tbl = wOS.ExperienceTable[ self.Owner:GetUserGroup() ]
  162. if not tbl then
  163. tbl = wOS.ExperienceTable[ "Default" ].XPPerHeal
  164. else
  165. tbl = wOS.ExperienceTable[ self.Owner:GetUserGroup() ].XPPerHeal
  166. end
  167. self.Owner:AddSkillXP( tbl )
  168. end
  169. self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.5 )
  170. self:SetNextAttack( 0.25 )
  171. return true
  172. end
  173. })
  174.  
  175. wOS.ForcePowers:RegisterNewPower({
  176. name = "Group Heal",
  177. icon = "GH",
  178. image = "wos/forceicons/group_heal.png",
  179. cooldown = 0,
  180. manualaim = false,
  181. description = "Heals all around you.",
  182. action = function( self )
  183. if ( self:GetForce() < 100 ) then return end
  184. local players = 0
  185. for _, ply in pairs( ents.FindInSphere( self.Owner:GetPos(), 200 ) ) do
  186. if not IsValid( ply ) then continue end
  187. if not ply:IsPlayer() then continue end
  188. if not ply:Alive() then continue end
  189. if players >= 8 then break end
  190. ply:SetHealth( math.Clamp( ply:Health() + 200, 0, ply:GetMaxHealth() ) )
  191. local ed = EffectData()
  192. ed:SetOrigin( self:GetSaberPosAng() )
  193. ed:SetEntity( ply )
  194. util.Effect( "rb655_force_heal", ed, true, true )
  195. players = players + 1
  196. end
  197. self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.6 )
  198. self:SetForce( self:GetForce() - 100 )
  199. local tbl = wOS.ExperienceTable[ self.Owner:GetUserGroup() ]
  200. if not tbl then
  201. tbl = wOS.ExperienceTable[ "Default" ].XPPerHeal
  202. else
  203. tbl = wOS.ExperienceTable[ self.Owner:GetUserGroup() ].XPPerHeal
  204. end
  205. self.Owner:AddSkillXP( tbl )
  206. return true
  207. end
  208. })
  209.  
  210. wOS.ForcePowers:RegisterNewPower({
  211. name = "Cloak",
  212. icon = "C",
  213. image = "wos/forceicons/cloak.png",
  214. cooldown = 0,
  215. description = "Shrowd yourself with the force for 10 seconds",
  216. action = function( self )
  217. if ( self:GetForce() < 50 || !self.Owner:IsOnGround() ) then return end
  218. if self.Owner:GetNW2Float( "CloakTime", 0 ) >= CurTime() then return end
  219. self:SetForce( self:GetForce() - 50 )
  220. self:SetNextAttack( 0.7 )
  221. self:PlayWeaponSound( "lightsaber/force_leap.wav" )
  222. self.Owner:SetNW2Float( "CloakTime", CurTime() + 10 )
  223. return true
  224. end
  225. })
  226.  
  227. wOS.ForcePowers:RegisterNewPower({
  228. name = "Force Reflect",
  229. icon = "FR",
  230. image = "wos/forceicons/eshell.png",
  231. cooldown = 28,
  232. description = "An eye for an eye",
  233. action = function( self )
  234. if ( self:GetForce() < 100 || !self.Owner:IsOnGround() ) then return end
  235. if self.Owner:GetNW2Float( "ReflectTime", 0 ) >= CurTime() then return end
  236. self:SetForce( self:GetForce() - 100 )
  237. self:SetNextAttack( 0.7 )
  238. self:PlayWeaponSound( "lightsaber/force_leap.wav" )
  239. self.Owner:SetNW2Float( "ReflectTime", CurTime() + 5 )
  240. return true
  241. end
  242. })
  243.  
  244. wOS.ForcePowers:RegisterNewPower({
  245. name = "Rage",
  246. icon = "RA",
  247. image = "wos/forceicons/rage.png",
  248. cooldown = 0,
  249. description = "Unleash your anger",
  250. action = function( self )
  251. if ( self:GetForce() < 50 || !self.Owner:IsOnGround() ) then return end
  252. if self.Owner:GetNW2Float( "RageTime", 0 ) >= CurTime() then return end
  253. self:SetForce( self:GetForce() - 50 )
  254. self:SetNextAttack( 0.7 )
  255. self:PlayWeaponSound( "lightsaber/force_leap.wav" )
  256. self.Owner:SetNW2Float( "RageTime", CurTime() + 10 )
  257. return true
  258. end
  259. })
  260.  
  261. wOS.ForcePowers:RegisterNewPower({
  262. name = "Shadow Strike",
  263. icon = "SS",
  264. distance = 30,
  265. image = "wos/forceicons/shadow_strike.png",
  266. cooldown = 0,
  267. target = 1,
  268. manualaim = false,
  269. description = "From the darkness it preys",
  270. action = function( self )
  271. if self.Owner:GetNW2Float( "CloakTime", 0 ) < CurTime() then return end
  272. local ent = self:SelectTargets( 1, 30 )[ 1 ]
  273. if !IsValid( ent ) then self:SetNextAttack( 0.2 ) return end
  274. if ( self:GetForce() < 50 ) then self:SetNextAttack( 0.2 ) return end
  275. self.Owner:SetSequenceOverride("b_c3_t2", 1)
  276. self:SetForce( self:GetForce() - 50 )
  277. self.Owner:EmitSound( "lightsaber/saber_hit_laser" .. math.random( 1, 4 ) .. ".wav" )
  278. self.Owner:AnimResetGestureSlot( GESTURE_SLOT_CUSTOM )
  279. self.Owner:SetAnimation( PLAYER_ATTACK1 )
  280. ent:TakeDamage( 500, self.Owner, self )
  281. self.Owner:SetNW2Float( "CloakTime", CurTime() + 0.5 )
  282. self:SetNextAttack( 0.7 )
  283. return true
  284. end
  285. })
  286.  
  287. wOS.ForcePowers:RegisterNewPower({
  288. name = "Force Pull",
  289. icon = "PL",
  290. target = 1,
  291. description = "Get over here!",
  292. image = "wos/forceicons/pull.png",
  293. cooldown = 0,
  294. manualaim = false,
  295. action = function( self )
  296. if ( self:GetForce() < 20 ) then return end
  297. local ent = self:SelectTargets( 1 )[ 1 ]
  298. if not IsValid( ent ) then return end
  299. self:PlayWeaponSound( "lightsaber/force_repulse.wav" )
  300. local newpos = ( self.Owner:GetPos() - ent:GetPos() )
  301. newpos = newpos / newpos:Length()
  302. ent:SetVelocity( newpos*700 + Vector( 0, 0, 300 ) )
  303. self:SetForce( self:GetForce() - 20 )
  304. self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.3 )
  305. self:SetNextAttack( 1.5 )
  306. return true
  307. end
  308. })
  309.  
  310. wOS.ForcePowers:RegisterNewPower({
  311. name = "Force Push",
  312. icon = "PH",
  313. target = 1,
  314. distance = 150,
  315. description = "They are no harm at a distance",
  316. image = "wos/forceicons/push.png",
  317. cooldown = 0,
  318. manualaim = false,
  319. action = function( self )
  320. if ( self:GetForce() < 20 ) then return end
  321. local ent = self:SelectTargets( 1 )[ 1 ]
  322. if not IsValid( ent ) then return end
  323. self:PlayWeaponSound( "lightsaber/force_repulse.wav" )
  324. local newpos = ( self.Owner:GetPos() - ent:GetPos() )
  325. newpos = newpos / newpos:Length()
  326. ent:SetVelocity( newpos*-700 + Vector( 0, 0, 300 ) )
  327. self:SetForce( self:GetForce() - 20 )
  328. self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.3 )
  329. self:SetNextAttack( 1.5 )
  330. return true
  331. end
  332. })
  333.  
  334. wOS.ForcePowers:RegisterNewPower({
  335. name = "Lightning Strike",
  336. icon = "LS",
  337. distance = 900,
  338. image = "wos/forceicons/lightning_strike.png",
  339. cooldown = 2,
  340. manualaim = false,
  341. description = "A focused charge of lightning",
  342. action = function( self )
  343. local tr = util.TraceLine( util.GetPlayerTrace( self.Owner ) )
  344. local ent = tr.Entity
  345. if !IsValid( ent ) then self:SetNextAttack( 0.2 ) return end
  346. if ( self:GetForce() < 20 ) then self:SetNextAttack( 0.2 ) return end
  347. self:SetForce( self:GetForce() - 20 )
  348.  
  349. local ed = EffectData()
  350. ed:SetOrigin( self:GetSaberPosAng() )
  351. ed:SetEntity( ent )
  352. util.Effect( "rb655_force_lighting", ed, true, true )
  353.  
  354. local dmg = DamageInfo()
  355. dmg:SetAttacker( self.Owner || self )
  356. dmg:SetInflictor( self.Owner || self )
  357. dmg:SetDamage( 350 )
  358. ent:TakeDamageInfo( dmg )
  359. self.Owner:EmitSound( Sound( "npc/strider/fire.wav" ) )
  360. self.Owner:EmitSound( Sound( "ambient/atmosphere/thunder1.wav" ) )
  361. if ( !self.SoundLightning ) then
  362. self.SoundLightning = CreateSound( self.Owner, "lightsaber/force_lightning" .. math.random( 1, 2 ) .. ".wav" )
  363. self.SoundLightning:Play()
  364. else
  365. self.SoundLightning:Play()
  366. end
  367. local bullet = {}
  368. bullet.Num = 1
  369. bullet.Src = self.Owner:GetPos() + Vector( 0, 0, 10 )
  370. bullet.Dir = ( ent:GetPos() - ( self.Owner:GetPos() + Vector( 0, 0, 10 ) ) )
  371. bullet.Spread = 0
  372. bullet.Tracer = 1
  373. bullet.Force = 0
  374. bullet.Damage = 0
  375. bullet.AmmoType = "Pistol"
  376. bullet.Entity = self.Owner
  377. bullet.TracerName = "thor_thunder"
  378. self:SetNextAttack( 0 )
  379. self.Owner:FireBullets( bullet )
  380. timer.Create( "test", 0.2, 1, function() if ( self.SoundLightning ) then self.SoundLightning:Stop() self.SoundLightning = nil end end )
  381. return true
  382. end
  383. })
  384.  
  385. wOS.ForcePowers:RegisterNewPower({
  386. name = "Advanced Cloak",
  387. icon = "AC",
  388. image = "wos/forceicons/advanced_cloak.png",
  389. cooldown = 0,
  390. manualaim = false,
  391. description = "Shrowd yourself with the force for 25 seconds",
  392. action = function( self )
  393. if ( self:GetForce() < 50 || !self.Owner:IsOnGround() ) then return end
  394.  
  395. if self.Owner:GetNW2Float( "CloakTime", 0 ) >= CurTime() then return end
  396. self:SetForce( self:GetForce() - 50 )
  397. self:SetNextAttack( 0.7 )
  398. self:PlayWeaponSound( "lightsaber/force_leap.wav" )
  399. self.Owner:SetNW2Float( "CloakTime", CurTime() + 25 )
  400. return true
  401. end
  402. })
  403.  
  404. wOS.ForcePowers:RegisterNewPower({
  405. name = "Force Lightning",
  406. icon = "L",
  407. target = 1,
  408. image = "wos/forceicons/lightning.png",
  409. cooldown = 0,
  410. manualaim = false,
  411. description = "Torture people ( and monsters ) at will.",
  412. action = function( self )
  413. if ( self:GetForce() < 1 ) then return end
  414.  
  415. local foundents = 0
  416. for id, ent in pairs( self:SelectTargets( 1 ) ) do
  417. if ( !IsValid( ent ) ) then continue end
  418.  
  419. foundents = foundents + 1
  420. local ed = EffectData()
  421. ed:SetOrigin( self:GetSaberPosAng() )
  422. ed:SetEntity( ent )
  423. util.Effect( "rb655_force_lighting", ed, true, true )
  424.  
  425. local dmg = DamageInfo()
  426. dmg:SetAttacker( self.Owner || self )
  427. dmg:SetInflictor( self.Owner || self )
  428. dmg:SetDamage( 12.5 )
  429. if ( ent:IsNPC() ) then dmg:SetDamage( 10 ) end
  430. ent:TakeDamageInfo( dmg )
  431.  
  432. end
  433.  
  434. if ( foundents > 0 ) then
  435. self:SetForce( self:GetForce() - foundents )
  436. if ( !self.SoundLightning ) then
  437. self.SoundLightning = CreateSound( self.Owner, "lightsaber/force_lightning" .. math.random( 1, 2 ) .. ".wav" )
  438. self.SoundLightning:Play()
  439. else
  440. self.SoundLightning:Play()
  441. end
  442.  
  443. timer.Create( "test", 0.2, 1, function() if ( self.SoundLightning ) then self.SoundLightning:Stop() self.SoundLightning = nil end end )
  444. end
  445. self:SetNextAttack( 0.1 )
  446. return true
  447. end
  448. })
  449.  
  450. wOS.ForcePowers:RegisterNewPower({
  451. name = "Force Repulse",
  452. icon = "R",
  453. image = "wos/forceicons/repulse.png",
  454. description = "Hold to charge for greater distance/damage. Push back everything near you.",
  455. think = function( self )
  456. if ( self:GetNextSecondaryFire() > CurTime() ) then return end
  457. if ( self:GetForce() < 1 ) then return end
  458. if ( !self.Owner:KeyDown( IN_ATTACK2 ) && !self.Owner:KeyReleased( IN_ATTACK2 ) ) then return end
  459. if ( !self._ForceRepulse && self:GetForce() < 16 ) then return end
  460.  
  461. if ( !self.Owner:KeyReleased( IN_ATTACK2 ) ) then
  462. if ( !self._ForceRepulse ) then self:SetForce( self:GetForce() - 16 ) self._ForceRepulse = 1 end
  463.  
  464. if ( !self.NextForceEffect or self.NextForceEffect < CurTime() ) then
  465. local ed = EffectData()
  466. ed:SetOrigin( self.Owner:GetPos() + Vector( 0, 0, 36 ) )
  467. ed:SetRadius( 128 * self._ForceRepulse )
  468. util.Effect( "rb655_force_repulse_in", ed, true, true )
  469.  
  470. self.NextForceEffect = CurTime() + math.Clamp( self._ForceRepulse / 20, 0.1, 0.5 )
  471. end
  472.  
  473. self._ForceRepulse = self._ForceRepulse + 0.05
  474. self:SetForce( self:GetForce() - 1 )
  475. if ( self:GetForce() > 0.99 ) then return end
  476. else
  477. if ( !self._ForceRepulse ) then return end
  478. end
  479.  
  480. local maxdist = 128 * self._ForceRepulse
  481.  
  482. for i, e in pairs( ents.FindInSphere( self.Owner:GetPos(), maxdist ) ) do
  483. if ( e == self.Owner ) then continue end
  484.  
  485. local dist = self.Owner:GetPos():Distance( e:GetPos() )
  486. local mul = ( maxdist - dist ) / 256
  487.  
  488. local v = ( self.Owner:GetPos() - e:GetPos() ):GetNormalized()
  489. v.z = 0
  490.  
  491. if ( e:IsNPC() && util.IsValidRagdoll( e:GetModel() or "" ) ) then
  492.  
  493. local dmg = DamageInfo()
  494. dmg:SetDamagePosition( e:GetPos() + e:OBBCenter() )
  495. dmg:SetDamage( 48 * mul )
  496. dmg:SetDamageType( DMG_GENERIC )
  497. if ( ( 1 - dist / maxdist ) > 0.8 ) then
  498. dmg:SetDamageType( DMG_DISSOLVE )
  499. dmg:SetDamage( e:Health() * 3 )
  500. end
  501. dmg:SetDamageForce( -v * math.min( mul * 40000, 80000 ) )
  502. dmg:SetInflictor( self.Owner )
  503. dmg:SetAttacker( self.Owner )
  504. e:TakeDamageInfo( dmg )
  505.  
  506. if ( e:IsOnGround() ) then
  507. e:SetVelocity( v * mul * -2048 + Vector( 0, 0, 64 ) )
  508. elseif ( !e:IsOnGround() ) then
  509. e:SetVelocity( v * mul * -1024 + Vector( 0, 0, 64 ) )
  510. end
  511.  
  512. elseif ( e:IsPlayer() && e:IsOnGround() ) then
  513. e:SetVelocity( v * mul * -2048 + Vector( 0, 0, 64 ) )
  514. elseif ( e:IsPlayer() && !e:IsOnGround() ) then
  515. e:SetVelocity( v * mul * -384 + Vector( 0, 0, 64 ) )
  516. elseif ( e:GetPhysicsObjectCount() > 0 ) then
  517. for i = 0, e:GetPhysicsObjectCount() - 1 do
  518. e:GetPhysicsObjectNum( i ):ApplyForceCenter( v * mul * -512 * math.min( e:GetPhysicsObject():GetMass(), 256 ) + Vector( 0, 0, 64 ) )
  519. end
  520. end
  521. end
  522.  
  523. local ed = EffectData()
  524. ed:SetOrigin( self.Owner:GetPos() + Vector( 0, 0, 36 ) )
  525. ed:SetRadius( maxdist )
  526. util.Effect( "rb655_force_repulse_out", ed, true, true )
  527.  
  528. self._ForceRepulse = nil
  529.  
  530. self:SetNextAttack( 1 )
  531.  
  532. self:PlayWeaponSound( "lightsaber/force_repulse.wav" )
  533. end
  534. })
  535.  
  536. wOS.ForcePowers:RegisterNewPower({
  537. name = "Storm",
  538. icon = "STR",
  539. image = "wos/forceicons/storm.png",
  540. cooldown = 3,
  541. description = "Charge for 0.5 seconds, unleash a storm on your enemies",
  542. action = function( self )
  543. if ( self:GetForce() < 100 ) then self:SetNextAttack( 0.2 ) return end
  544. if self.Owner:GetNW2Float( "wOS.SaberAttackDelay", 0 ) >= CurTime() then return end
  545. self:SetForce( self:GetForce() - 100 )
  546. self.Owner:EmitSound( Sound( "npc/strider/charging.wav" ) )
  547. self.Owner:SetNW2Float( "wOS.SaberAttackDelay", CurTime() + 0.5 )
  548. local tr = util.TraceLine( util.GetPlayerTrace( self.Owner ) )
  549. local pos = tr.HitPos + Vector( 0, 0, 600 )
  550. local pi = math.pi
  551. local bullet = {}
  552. bullet.Num = 1
  553. bullet.Spread = 0
  554. bullet.Tracer = 1
  555. bullet.Force = 0
  556. bullet.Damage = 1500
  557. bullet.AmmoType = "Pistol"
  558. bullet.Entity = self.Owner
  559. bullet.TracerName = "thor_storm"
  560. timer.Simple( 2, function()
  561. if not IsValid( self.Owner ) then return end
  562. self.Owner:EmitSound( Sound( "ambient/atmosphere/thunder1.wav" ) )
  563. bullet.Src = pos
  564. bullet.Dir = Vector( 0, 0, -1 )
  565. self.Owner:EmitSound( Sound( "npc/strider/fire.wav" ) )
  566. self.Owner:FireBullets( bullet )
  567. timer.Simple( 0.1, function()
  568. if not IsValid( self.Owner ) then return end
  569. bullet.Src = pos + Vector( 65*math.sin( pi*2/5 ), 65*math.cos( pi*2/5 ), 0 )
  570. bullet.Dir = Vector( 0, 0, -1 )
  571. self.Owner:EmitSound( Sound( "npc/strider/fire.wav" ) )
  572. self.Owner:FireBullets( bullet )
  573. end )
  574. timer.Simple( 0.2, function()
  575. if not IsValid( self.Owner ) then return end
  576. bullet.Src = pos + Vector( 65*math.sin( pi*4/5 ), 65*math.cos( pi*4/5 ), 0 )
  577. bullet.Dir = Vector( 0, 0, -1 )
  578. self.Owner:EmitSound( Sound( "npc/strider/fire.wav" ) )
  579. self.Owner:FireBullets( bullet )
  580. end )
  581. timer.Simple( 0.3, function()
  582. if not IsValid( self.Owner ) then return end
  583. bullet.Src = pos + Vector( 65*math.sin( pi*6/5 ), 65*math.cos( pi*6/5 ), 0 )
  584. bullet.Dir = Vector( 0, 0, -1 )
  585. self.Owner:EmitSound( Sound( "npc/strider/fire.wav" ) )
  586. self.Owner:FireBullets( bullet )
  587. end )
  588. timer.Simple( 0.4, function()
  589. if not IsValid( self.Owner ) then return end
  590. bullet.Src = pos + Vector( 65*math.sin( pi*8/5 ), 65*math.cos( pi*8/5 ), 0 )
  591. bullet.Dir = Vector( 0, 0, -1 )
  592. self.Owner:EmitSound( Sound( "npc/strider/fire.wav" ) )
  593. self.Owner:FireBullets( bullet )
  594. end )
  595. timer.Simple( 0.5, function()
  596. if not IsValid( self.Owner ) then return end
  597. bullet.Src = pos + Vector( 65*math.sin( 2*pi ), 65*math.cos( 2*pi ), 0 )
  598. bullet.Dir = Vector( 0, 0, -1 )
  599. self.Owner:EmitSound( Sound( "npc/strider/fire.wav" ) )
  600. self.Owner:FireBullets( bullet )
  601. end )
  602. end )
  603. return true
  604. end
  605. })
  606.  
  607. wOS.ForcePowers:RegisterNewPower({
  608. name = "Kneel",
  609. icon = "K",
  610. image = "wos/forceicons/meditate.png",
  611. description = "Relax yourself and channel your energy",
  612. think = function( self )
  613. if self.MeditateCooldown and self.MeditateCooldown >= CurTime() then return end
  614. if ( self.Owner:KeyDown( IN_ATTACK2 ) ) and !self:GetEnabled() and self.Owner:OnGround() then
  615. --if !self._ForceMeditating then
  616. --self.Owner.SaveAngles = self.Owner:GetAngles()
  617. --end
  618. self._ForceMeditating = true
  619. else
  620. self._ForceMeditating = false
  621. end
  622. if self._ForceMeditating then
  623. self.Owner:SetNW2Bool("IsMeditating", true)
  624. if not self._NextMeditateHeal then self._NextMeditateHeal = 0 end
  625. if self._NextMeditateHeal < CurTime() then
  626. self.Owner:SetHealth( math.min( self.Owner:Health() + ( self.Owner:GetMaxHealth()*0.02), self.Owner:GetMaxHealth() ) )
  627. self.Owner:SetArmor( math.min( self.Owner:Armor() + ( self.Owner:GetMaxArmor()*0.03 ), self.Owner:GetMaxArmor() ) )
  628. if #self.DevestatorList > 0 then
  629. self:SetDevEnergy( self:GetDevEnergy() * 0)
  630. end
  631. --local tbl = wOS.ExperienceTable[ self.Owner:GetUserGroup() ]
  632. --if not tbl then
  633. --tbl = wOS.ExperienceTable[ "Default" ].Meditation
  634. --else
  635. --tbl = wOS.ExperienceTable[ self.Owner:GetUserGroup() ].Meditation
  636. --end
  637. --self.Owner:AddSkillXP( tbl )
  638. self._NextMeditateHeal = CurTime() + 1
  639. end
  640. self.Owner:SetLocalVelocity(Vector(0, 0, 0))
  641. self.Owner:SetMoveType(MOVETYPE_NONE)
  642. --self.Owner:SetEyeAngles( self.Owner.SaveAngles )
  643. --self.Owner:SetAngles( self.Owner.SaveAngles )
  644. else
  645. self.Owner:SetNW2Bool("IsMeditating", false)
  646. if self:GetMoveType() != MOVETYPE_WALK and self.Owner:GetNW2Float( "wOS.DevestatorTime", 0 ) < CurTime() then
  647. self.Owner:SetMoveType(MOVETYPE_WALK)
  648. end
  649. end
  650. if self.Owner:KeyReleased( IN_ATTACK2 ) then
  651. self.MeditateCooldown = CurTime() + 0
  652. end
  653. end
  654. })
  655.  
  656. wOS.ForcePowers:RegisterNewPower({
  657. name = "Channel Hatred",
  658. icon = "HT",
  659. image = "wos/forceicons/channel_hatred.png",
  660. description = "I can feel your anger",
  661. think = function( self )
  662. if self.ChannelCooldown and self.ChannelCooldown >= CurTime() then return end
  663. if ( self.Owner:KeyDown( IN_ATTACK2 ) ) and !self:GetEnabled() and self.Owner:OnGround() then
  664. self._ForceChanneling = true
  665. else
  666. self._ForceChanneling = false
  667. end
  668. if self.Owner:KeyReleased( IN_ATTACK2 ) then
  669. self.ChannelCooldown = CurTime() + 3
  670. end
  671. if self._ForceChanneling then
  672. if not self._NextChannelHeal then self._NextChannelHeal = 0 end
  673. self.Owner:SetNW2Bool("wOS.IsChanneling", true)
  674. if self._NextChannelHeal < CurTime() then
  675. self.Owner:SetHealth( math.min( self.Owner:Health() + ( self.Owner:GetMaxHealth()*0.01 ), self.Owner:GetMaxHealth() ) )
  676. if #self.DevestatorList > 0 then
  677. self:SetDevEnergy( self:GetDevEnergy() + self.DevCharge + 10 )
  678. end
  679. local tbl = wOS.ExperienceTable[ self.Owner:GetUserGroup() ]
  680. if not tbl then
  681. tbl = wOS.ExperienceTable[ "Default" ].Meditation
  682. else
  683. tbl = wOS.ExperienceTable[ self.Owner:GetUserGroup() ].Meditation
  684. end
  685. self.Owner:AddSkillXP( tbl )
  686. self._NextChannelHeal = CurTime() + 3
  687. end
  688. self.Owner:SetLocalVelocity(Vector(0, 0, 0))
  689. self.Owner:SetMoveType(MOVETYPE_NONE)
  690. if ( !self.SoundChanneling ) then
  691. self.SoundChanneling = CreateSound( self.Owner, "music/hl2_song8.mp3" )
  692. self.SoundChanneling:Play()
  693. else
  694. self.SoundChanneling:Play()
  695. end
  696.  
  697. timer.Create( "test", 0.2, 1, function() if ( self.SoundChanneling ) then self.SoundChanneling:Stop() self.SoundChanneling = nil end end )
  698. else
  699. self.Owner:SetNW2Bool("wOS.IsChanneling", false)
  700. if self:GetMoveType() != MOVETYPE_WALK and self.Owner:GetNW2Float( "wOS.DevestatorTime", 0 ) < CurTime() then
  701. self.Owner:SetMoveType(MOVETYPE_WALK)
  702. end
  703. end
  704. if self.Owner:KeyReleased( IN_ATTACK2 ) then
  705. self.ChannelCooldown = CurTime() + 3
  706. end
  707. end
  708. })
  709.  
  710. wOS.ForcePowers:RegisterNewPower({
  711. name = "Ground Slam",
  712. icon = "GS",
  713. image = "wos/forceicons/blood.png",
  714. cooldown = 30,
  715. description = "Shocks and destroys everything around you.",
  716. action = function( self )
  717. if ( self:GetForce() < 60 || CLIENT || !self.Owner:IsOnGround() ) then return end
  718. if self.Owner:GetNW2Float( "GroundSlamTimer", 0 ) >= CurTime() then return end
  719. local elev = 400
  720. local time = 1
  721. ent = self.Owner
  722. self.Owner:SetSequenceOverride( "h_c3_t3", 1 )
  723. self.Owner:SetNW2Float( "GroundSlamTimer", CurTime() + 30 )
  724.  
  725. self:SetForce(self:GetForce() - 60)
  726. self:SetNextAttack( 3 )
  727.  
  728. for j = 0,6 do
  729. for i = 0, 24 do
  730. local ed = EffectData()
  731. ed:SetOrigin( self.Owner:GetPos() + Vector(0,0,0) )
  732. ed:SetStart( self.Owner:GetPos() + Vector(0,0,0) + Angle(0 , i * 15, 0):Forward() * 512)
  733. util.Effect( "force_groundslam", ed, true, true )
  734. end
  735. end
  736.  
  737. local maxdist = 128 * 4
  738.  
  739. local ed = EffectData()
  740. ed:SetOrigin( self.Owner:GetPos() + Vector( 0, 0, 36 ) )
  741. ed:SetRadius( maxdist )
  742. util.Effect( "rb655_force_repulse_out", ed, true, true )
  743. for i, e in pairs( ents.FindInSphere( self.Owner:GetPos(), maxdist ) ) do
  744. if (e.Team and e:Team() == self.Owner:Team()) or (e.PlayerTeam and e.PlayerTeam == self.Owner:Team()) then continue end
  745.  
  746. local dist = self.Owner:GetPos():Distance( e:GetPos() )
  747. local mul = ( maxdist - dist ) / 256
  748.  
  749. local v = ( self.Owner:GetPos() - e:GetPos() ):GetNormalized()
  750. v.z = 0
  751.  
  752. local dmg = DamageInfo()
  753. dmg:SetDamagePosition( e:GetPos() + e:OBBCenter() )
  754. dmg:SetDamage( 200 * mul )
  755. dmg:SetDamageType( DMG_DISSOLVE )
  756. dmg:SetDamageForce( -v * math.min( mul * 20000, 40000 ) )
  757. dmg:SetInflictor( self.Owner )
  758. dmg:SetAttacker( self.Owner )
  759. e:TakeDamageInfo( dmg )
  760.  
  761. if ( e:IsOnGround() ) then
  762. e:SetVelocity( v * mul * -2048 + Vector( 0, 0, 64 ) )
  763. elseif ( !e:IsOnGround() ) then
  764. e:SetVelocity( v * mul * -1024 + Vector( 0, 0, 64 ) )
  765. end
  766. end
  767.  
  768. if ( !self.SoundLightning ) then
  769. self.SoundLightning = CreateSound( self.Owner, "lightsaber/force_lightning" .. math.random( 1, 2 ) .. ".wav" )
  770. self.SoundLightning:Play()
  771. self.SoundLightning:ChangeVolume(0,0.3)
  772. else
  773. self.SoundLightning:Play()
  774. end
  775. timer.Create( "test", 0.6, 1, function() if ( self.SoundLightning ) then self.SoundLightning:Stop() self.SoundLightning = nil end end )
  776.  
  777. self:PlayWeaponSound( "lightsaber/force_repulse.wav" )
  778. end
  779.  
  780. })
  781.  
  782.  
  783. wOS.ForcePowers:RegisterNewPower({
  784. name = "Force Blind",
  785. icon = "FB",
  786. image = "anzati/icons/force_blind.png",
  787. cooldown = 0,
  788. manualaim = false,
  789. description = "Make your escape or final blow.",
  790. action = function( self )
  791. if ( self:GetForce() < 75 ) then return end
  792. for _, ply in pairs( ents.FindInSphere( self.Owner:GetPos(), 200 ) ) do
  793. if not IsValid( ply ) then continue end
  794. if not ply:IsPlayer() then continue end
  795. if not ply:Alive() then continue end
  796. if ply == self.Owner then continue end
  797. ply:SetNW2Float( "wOS.BlindTime", CurTime() + 15 )
  798. local coil = ents.Create( "wos_sonic_discharge" )
  799. coil:SetPos( self.Owner:GetPos() )
  800. coil:Spawn()
  801. coil:SetOwner( self.Owner )
  802. end
  803. self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.5 )
  804. self:SetForce( self:GetForce() - 75 )
  805. self:SetNextAttack( 1 )
  806. return true
  807. end
  808. })
  809.  
  810.  
  811.  
  812. wOS.ForcePowers:RegisterNewPower({
  813. name = "Crushing Malice",
  814. icon = "LM",
  815. distance = 800,
  816. image = "anzati/icons/crushing_malice.png",
  817. cooldown = 10,
  818. target = 1,
  819. manualaim = true,
  820. description = "Finally you are free",
  821. action = function( self )
  822. if self.Owner:GetNW2Float( "CrushingMalaceTimer", 0 ) >= CurTime() then return end
  823. local ent = self:SelectTargets( 1, 600 )[ 1 ]
  824. ent:SetSequenceOverride( "wos_force_crush", 1 )
  825. if !IsValid( ent ) then self:SetNextAttack( 1.0 ) return end
  826. if ( self:GetForce() < 20 ) then self:SetNextAttack( 1.0 ) return end
  827. self:SetForce( self:GetForce() - 20 )
  828. local ed = EffectData()
  829. ed:SetOrigin( self:GetSaberPosAng() )
  830. ed:SetEntity( ent )
  831. util.Effect( "ThumperDust", ed, true, true )
  832. for i= 10,1,-1 do
  833. local dmg = DamageInfo()
  834. dmg:SetAttacker( self.Owner || self )
  835. dmg:SetInflictor( self.Owner || self )
  836. dmg:SetDamage( 25 )
  837. ent:TakeDamageInfo( dmg )
  838. self.Owner:EmitSound( Sound( "physics/body/body_medium_break2.wav" ) )
  839. end
  840. self.Owner:SetNW2Float( "CrushingMalaceTimer", CurTime() + 10 )
  841. self.Owner:SetNW2Bool("wOS.Cast_Choke", true)
  842. self.Owner:SetNW2Float( "CrushingMalaceAnim", CurTime() + 1 )
  843. end,
  844.  
  845. think = function( self )
  846. if self.Owner:GetNW2Float( "CrushingMalaceAnim", 0 ) < CurTime() then
  847. self.Owner:SetNW2Bool("wOS.Cast_Choke", false)
  848. end
  849. end
  850. })
  851.  
  852.  
  853.  
  854. wOS.ForcePowers:RegisterNewPower({
  855. name = "Force Slow",
  856. icon = "GH",
  857. image = "wos/forceicons/group_heal.png",
  858. cooldown = 5,
  859. target = 1,
  860. description = "Strike Up to 4 Enemys",
  861. action = function(self)
  862. if CLIENT then return end
  863. if self:GetForce() < 80 then return end
  864. local ent = self:SelectTargets( 1, 600 )[ 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. if !ent:IsNPC() and !ent:IsPlayer() then return end
  868. if not IsValid( self ) then return end
  869. --Setup damageinfo
  870. local dmg = DamageInfo()
  871. dmg:SetDamage( 0 )
  872. dmg:SetDamageType( DMG_DIRECT )
  873. dmg:SetInflictor( self.Owner )
  874. dmg:SetAttacker( self.Owner )
  875.  
  876. local Hit = {[ent:EntIndex()] = ent}
  877. local count = 0
  878. for x = 1,4 do
  879. local org = ent:GetPos()
  880. local sound = CreateSound( ent, Sound( self.SwingSound ) )
  881. ent:TakeDamageInfo( dmg )
  882. sound:Play()
  883. timer.Simple(0.75, function()
  884. sound:Stop()
  885. end)
  886. //sound:ChangeVolume( 0, 0 )
  887. // ent = nil
  888.  
  889. for x,y in pairs(ents.FindInSphere(org, 512) ) do
  890. if (y:IsPlayer() or y:IsNPC()) and y != self.Owner and !Hit[y:EntIndex()] then
  891. Hit[y:EntIndex()] = y
  892. ent = y
  893. end
  894. end
  895.  
  896. ent = ent or table.Random(Hit)
  897. if x == 4 then
  898. pos1 = self.Owner:GetPos()
  899. pos2 = ent:GetPos()
  900. self.Owner:SetPos(pos2)
  901. ent:SetPos(pos1)
  902. end
  903. end
  904.  
  905. end
  906.  
  907. })
  908.  
  909.  
  910.  
  911. wOS.ForcePowers:RegisterNewPower({
  912. name = "Force Stasis",
  913. icon = "STS",
  914. description = "Let their fear stop them",
  915. target = 1,
  916. image = "wos/forceicons/icefuse/stasis.png",
  917. cooldown = 0,
  918. manualaim = false,
  919. action = function( self )
  920. if ( self:GetForce() < 80 || !self.Owner:IsOnGround() ) then return end
  921. local ent = self:SelectTargets( 1 )[ 1 ]
  922. if not IsValid( ent ) then return end
  923. if not ent:IsPlayer() then return end
  924. self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.5 )
  925. self:SetForce( self:GetForce() - 80 )
  926. self:PlayWeaponSound( "lightsaber/force_leap.wav" )
  927. ent:SetNW2Float( "wOS.ForceStasis", CurTime() + 10 )
  928. self:SetNextAttack( 1 )
  929. return true
  930. end,
  931. })
  932.  
  933.  
  934.  
  935. wOS.ForcePowers:RegisterNewPower({
  936. name = "Group Pull",
  937. icon = "GPL",
  938. target = 8,
  939. distance = 850,
  940. description = "Keep your friends closer and you enemy's even closer!",
  941. image = "wos/forceicons/attract.png",
  942. cooldown = 0,
  943. manualaim = false,
  944. action = function( self )
  945. if ( self:GetForce() < 20 ) then return end
  946. local foundents = self:SelectTargets( 10 )
  947. if #foundents < 1 then return end
  948. for id, ent in pairs( foundents ) do
  949. local newpos = ( self.Owner:GetPos() - ent:GetPos() )
  950. newpos = newpos / newpos:Length()
  951. ent:SetVelocity( newpos*850 + Vector( 0, 0, 300 ) )
  952. if ent:IsPlayer() then
  953. local time = ent:SetSequenceOverride( "h_reaction_upper", 2)
  954. end
  955. end
  956. self:PlayWeaponSound( "lightsaber/force_repulse.wav" )
  957. self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.5 )
  958. self:SetForce( self:GetForce() - 20 )
  959. self:SetNextAttack( 1.5 )
  960. return true
  961. end,
  962. })
  963.  
  964.  
  965. wOS.ForcePowers:RegisterNewPower({
  966. name = "Group Push",
  967. icon = "GPH",
  968. target = 50,
  969. distance = 650,
  970. description = "They are no harm at a distance",
  971. image = "wos/forceicons/overdrive.png",
  972. cooldown = 0,
  973. manualaim = false,
  974. action = function( self )
  975. if ( self:GetForce() < 20 ) then return end
  976. local foundents = self:SelectTargets( 50, 650 )
  977. if #foundents < 1 then return end
  978. for id, ent in pairs( foundents ) do
  979. local newpos = ( self.Owner:GetPos() - ent:GetPos() )
  980. newpos = newpos / newpos:Length()
  981. ent:SetVelocity( newpos*-850 + Vector( 0, 0, 300 ) )
  982. if ent:IsPlayer() then
  983. local time = ent:SetSequenceOverride( "h_reaction_upper", 2 )
  984. end
  985. end
  986. self:SetForce( self:GetForce() - 20 )
  987. self:PlayWeaponSound( "lightsaber/force_repulse.wav" )
  988. self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.5 )
  989. self:SetNextAttack( 1.5 )
  990. return true
  991. end,
  992. })
  993.  
  994.  
  995.  
  996. wOS.ForcePowers:RegisterNewPower({
  997. name = "Group Lightning",
  998. icon = "GL",
  999. target = 4,
  1000. description = "Send a jolt to wake up groups of victims.",
  1001. image = "wos/forceicons/icefuse/group_lightning.png",
  1002. cooldown = 0,
  1003. manualaim = false,
  1004. action = function( self )
  1005. if ( self:GetForce() < 1 ) then return end
  1006. local foundents = 0
  1007. for id, ent in pairs( self:SelectTargets( 4 ) ) do
  1008. if ( !IsValid( ent ) ) then continue end
  1009. foundents = foundents + 1
  1010. local ed = EffectData()
  1011. ed:SetOrigin( self:GetSaberPosAng() )
  1012. ed:SetEntity( ent )
  1013. util.Effect( "rb655_force_lighting", ed, true, true )
  1014. local dmg = DamageInfo()
  1015. dmg:SetAttacker( self.Owner || self )
  1016. dmg:SetInflictor( self.Owner || self )
  1017. dmg:SetDamage( 10 )
  1018. if ent.IsBlocking then
  1019. ent:EmitSound( "lightsaber/saber_hit_laser" .. math.random( 1, 4 ) .. ".wav" )
  1020. if wOS.EnableStamina then
  1021. ent:AddStamina( -6 )
  1022. else
  1023. ent:GetActiveWeapon():SetForce( ent:GetActiveWeapon():GetForce() - 1 )
  1024. end
  1025. ent:SetSequenceOverride( "h_block", 0.5 )
  1026. else
  1027. ent:TakeDamageInfo( dmg )
  1028. end
  1029. if ( ent:IsNPC() ) then dmg:SetDamage( 1.2 ) end
  1030. end
  1031. if ( foundents > 0 ) then
  1032. self:SetForce( self:GetForce() - foundents )
  1033. if ( !self.SoundLightning ) then
  1034. self.SoundLightning = CreateSound( self.Owner, "lightsaber/force_lightning" .. math.random( 1, 2 ) .. ".wav" )
  1035. self.SoundLightning:Play()
  1036. else
  1037. self.SoundLightning:Play()
  1038. end
  1039. self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.5 )
  1040. timer.Create( "test" .. self.Owner:SteamID64(), 0.2, 1, function() if ( self.SoundLightning ) then self.SoundLightning:Stop() self.SoundLightning = nil end end )
  1041. end
  1042. self:SetNextAttack( 0.1 )
  1043. return true
  1044. end,
  1045. })
  1046.  
  1047.  
  1048. wOS.ForcePowers:RegisterNewPower({
  1049. name = "Force Breach",
  1050. icon = "BR",
  1051. description = "Make a path",
  1052. image = "anzati/icons/force_breach.png",
  1053. cooldown = 0,
  1054. manualaim = false,
  1055. action = function( self )
  1056. if self:GetForce() < 35 then return end
  1057. local tr = util.TraceLine( util.GetPlayerTrace( self.Owner ) )
  1058. if not IsValid( tr.Entity ) then return end
  1059. 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
  1060. self:SetForce( self:GetForce() - 35 )
  1061. self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.5 )
  1062. tr.Entity:Fire("unlock","",0)
  1063. tr.Entity:Fire("Open","",0)
  1064. self:SetNextAttack( 1 )
  1065. return true
  1066. end,
  1067. })
  1068.  
  1069.  
  1070.  
  1071. wOS.ForcePowers:RegisterNewPower({
  1072. name = "Teleport",
  1073. icon = "TP",
  1074. description = "Phase through to a new location.",
  1075. image = "wos/forceicons/lightstream.png",
  1076. cooldown = 0,
  1077. manualaim = false,
  1078. think = function( self )
  1079. if ( self:GetNextSecondaryFire() > CurTime() ) then return end
  1080. if ( self:GetForce() < 75 ) then return end
  1081. if ( !self.Owner:KeyDown( IN_ATTACK2 ) && !self.Owner:KeyReleased( IN_ATTACK2 ) ) then return end
  1082. if self.Owner:KeyReleased( IN_ATTACK2 ) and self.groundTrace then
  1083. local speed = 4000;
  1084. local bFoundEdge = false;
  1085. self.Owner:SetNW2Float("wOS.ShowBlink", 0 );
  1086. local hullTrace = util.TraceHull({
  1087. start = self.Owner:EyePos(),
  1088. endpos = self.Owner:EyePos() + self.Owner:EyeAngles():Forward() * 2400,
  1089. filter = self.Owner,
  1090. mins = Vector(-16, -16, 0),
  1091. maxs = Vector(16, 16, 9)
  1092. });
  1093. local groundTrace = util.TraceEntity({
  1094. start = hullTrace.HitPos + Vector(0, 0, 1),
  1095. endpos = hullTrace.HitPos - (self.Owner:EyePos() - self.Owner:GetPos()),
  1096. filter = self.Owner
  1097. }, self.Owner);
  1098. local edgeTrace;
  1099. if (hullTrace.Hit and hullTrace.HitNormal.z <= 0) then
  1100. local ledgeForward = Angle(0, hullTrace.HitNormal:Angle().y, 0):Forward();
  1101. edgeTrace = util.TraceEntity({
  1102. start = hullTrace.HitPos - ledgeForward * 33 + Vector(0, 0, 40),
  1103. endpos = hullTrace.HitPos - ledgeForward * 33,
  1104. filter = self.Owner
  1105. }, self.Owner);
  1106. if (edgeTrace.Hit and !edgeTrace.AllSolid) then
  1107. local clearTrace = util.TraceHull({
  1108. start = hullTrace.HitPos,
  1109. endpos = hullTrace.HitPos + Vector(0, 0, 35),
  1110. mins = Vector(-16, -16, 0),
  1111. maxs = Vector(16, 16, 1),
  1112. filter = self.Owner
  1113. });
  1114. bFoundEdge = !clearTrace.Hit;
  1115. end;
  1116. end;
  1117. if (!bFoundEdge and groundTrace.AllSolid) then
  1118. self.groundTrace = nil
  1119. self:SetNextSecondaryFire( CurTime() + 1 )
  1120. return;
  1121. end;
  1122. local endPos = ( bFoundEdge and edgeTrace.HitPos ) or groundTrace.HitPos;
  1123. self.Owner:SetPos( endPos )
  1124. self.Owner:EmitSound("blink/exit" .. math.random(1, 2) .. ".wav");
  1125. self.groundTrace = nil
  1126. self:SetForce( self:GetForce() - 75 )
  1127. self:SetNextSecondaryFire( CurTime() + 1 )
  1128. return
  1129. end;
  1130. if self.Owner:KeyDown( IN_ATTACK2 ) then
  1131. local bFoundEdge = false;
  1132. self.Owner:SetNW2Float( "wOS.ShowBlink", CurTime() + 0.5 )
  1133. local hullTrace = util.TraceHull({
  1134. start = self.Owner:EyePos(),
  1135. endpos = self.Owner:EyePos() + self.Owner:EyeAngles():Forward() * 2400,
  1136. filter = self.Owner,
  1137. mins = Vector(-16, -16, 0),
  1138. maxs = Vector(16, 16, 9)
  1139. });
  1140. self.groundTrace = util.TraceHull({
  1141. start = hullTrace.HitPos + Vector(0, 0, 1),
  1142. endpos = hullTrace.HitPos - Vector(0, 0, 1000),
  1143. filter = self.Owner,
  1144. mins = Vector(-16, -16, 0),
  1145. maxs = Vector(16, 16, 1)
  1146. });
  1147. local edgeTrace;
  1148. if (hullTrace.Hit and hullTrace.HitNormal.z <= 0) then
  1149. local ledgeForward = Angle(0, hullTrace.HitNormal:Angle().y, 0):Forward();
  1150. edgeTrace = util.TraceEntity({
  1151. start = hullTrace.HitPos - ledgeForward * 33 + Vector(0, 0, 40),
  1152. endpos = hullTrace.HitPos - ledgeForward * 33,
  1153. filter = self.Owner
  1154. }, self.Owner);
  1155. if (edgeTrace.Hit and !edgeTrace.AllSolid) then
  1156. local clearTrace = util.TraceHull({
  1157. start = hullTrace.HitPos,
  1158. endpos = hullTrace.HitPos + Vector(0, 0, 35),
  1159. mins = Vector(-16, -16, 0),
  1160. maxs = Vector(16, 16, 1),
  1161. filter = self.Owner
  1162. });
  1163. if (!clearTrace.Hit) then
  1164.  
  1165. self.groundTrace.HitPos = edgeTrace.HitPos;
  1166.  
  1167. bFoundEdge = true;
  1168.  
  1169. end;
  1170.  
  1171. end;
  1172.  
  1173. end;
  1174.  
  1175. end
  1176.  
  1177. end,
  1178.  
  1179. })
  1180.  
  1181.  
  1182.  
  1183. wOS.ForcePowers:RegisterNewPower({
  1184. name = "Destruction",
  1185. icon = "DES",
  1186. description = "Hold to unleash true power on your enemies",
  1187. image = "wos/forceicons/icefuse/destruction.png",
  1188. cooldown = 0,
  1189. manualaim = false,
  1190. think = function( self )
  1191. if ( self:GetNextSecondaryFire() > CurTime() ) then return end
  1192. if ( self:GetForce() < 1 ) then return end
  1193. if ( !self.Owner:KeyDown( IN_ATTACK2 ) && !self.Owner:KeyReleased( IN_ATTACK2 ) ) then return end
  1194. if ( !self._ForceDestruction && self:GetForce() < 50 ) then return end
  1195. if ( !self.Owner:KeyReleased( IN_ATTACK2 ) ) then
  1196. if ( !self._ForceDestruction ) then self:SetForce( self:GetForce() - 50 ) self._ForceDestruction = 5 end
  1197. self._ForceDestruction = self._ForceDestruction + 1
  1198. self:SetForce( self:GetForce() - 2 )
  1199. if ( self:GetForce() > 0.99 ) then return end
  1200. else
  1201. if ( !self._ForceDestruction ) then return end
  1202. end
  1203. self.Owner:EmitSound( Sound( "npc/strider/charging.wav" ) )
  1204. self.Owner:SetNW2Float( "wOS.SaberAttackDelay", CurTime() + 2 )
  1205. self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 2 )
  1206. local tr = util.TraceLine( util.GetPlayerTrace( self.Owner ) )
  1207. local pos = tr.HitPos + Vector( 0, 0, 600 )
  1208. local pi = math.pi
  1209. local max = self._ForceDestruction
  1210. local bullet = {}
  1211. bullet.Num = 1
  1212. bullet.Spread = 0
  1213. bullet.Tracer = 1
  1214. bullet.Force = 0
  1215. bullet.Damage = 500
  1216. bullet.AmmoType = "Pistol"
  1217. bullet.Entity = self.Owner
  1218. bullet.TracerName = "thor_storm"
  1219. bullet.Callback = function( ply, tr, dmginfo )
  1220. sound.Play( "npc/strider/fire.wav", tr.HitPos )
  1221. end
  1222. timer.Simple( 2, function()
  1223. if not IsValid( self ) then return end
  1224. bullet.Src = pos
  1225. bullet.Dir = Vector( 0, 0, -1 )
  1226. self.Owner:FireBullets( bullet )
  1227. for i=1, max do
  1228. timer.Simple( 0.1*i, function()
  1229. if not IsValid( self ) then return end
  1230. local dis = i + i*30
  1231. if not IsValid( self.Owner ) then return end
  1232. bullet.Src = pos + Vector( dis*math.sin( i*pi*1/8 ), dis*math.cos( i*pi*1/8 ), 0 )
  1233. bullet.Dir = Vector( 0, 0, -1 )
  1234. self.Owner:FireBullets( bullet )
  1235. bullet.Src = pos + Vector( dis*math.sin( i*pi*3/8 ), dis*math.cos( i*pi*3/8 ), 0 )
  1236. bullet.Dir = Vector( 0, 0, -1 )
  1237. self.Owner:FireBullets( bullet )
  1238. bullet.Src = pos + Vector( dis*math.sin( i*pi*5/8 ), dis*math.cos( i*pi*5/8 ), 0 )
  1239. bullet.Dir = Vector( 0, 0, -1 )
  1240. self.Owner:FireBullets( bullet )
  1241. bullet.Src = pos + Vector( dis*math.sin( i*pi*7/8 ), dis*math.cos( i*pi*7/8 ), 0 )
  1242. bullet.Dir = Vector( 0, 0, -1 )
  1243. self.Owner:FireBullets( bullet )
  1244. end )
  1245. end
  1246. end )
  1247. self._ForceDestruction = nil
  1248. self:SetNextAttack( 3 )
  1249. end,
  1250. })
  1251.  
  1252.  
  1253.  
  1254. wOS.ForcePowers:RegisterNewPower({
  1255. name = "Force Choke",
  1256. icon = "CH",
  1257. description = "I find your lack of faith disturbing",
  1258. image = "wos/forceicons/icefuse/choke.png",
  1259. cooldown = 0,
  1260. manualaim = false,
  1261. action = function( self )
  1262. if self:GetForce() < 1 then return end
  1263. if IsValid( self.ChokeTarget ) then return end
  1264. local tr = util.TraceLine( util.GetPlayerTrace( self.Owner ) )
  1265. if not tr.Entity then return end
  1266. if not tr.Entity:IsPlayer() and not tr.Entity:IsNPC() then return end
  1267. if self.Owner:GetPos():Distance( tr.Entity:GetPos() ) >= 400 then return end
  1268. self.ChokeTarget = tr.Entity
  1269. self.ChokeTarget:EmitSound( "wos/icefuse/choke_start.wav" )
  1270. self.ChokePos = tr.Entity:GetPos()
  1271. end,
  1272.  
  1273. think = function( self )
  1274. if not IsValid( self.ChokeTarget ) then return end
  1275. if ( self:GetNextSecondaryFire() > CurTime() ) then return end
  1276. if ( self:GetForce() < 1 ) then return end
  1277. if not self.ChokeTarget:Alive() then self.ChokeTarget = nil return end
  1278. if ( !self.Owner:KeyDown( IN_ATTACK2 ) && !self.Owner:KeyReleased( IN_ATTACK2 ) ) then self.Owner:SetNW2Bool("wOS.Cast_Choke", false) return end
  1279. self.Owner:SetNW2Bool("wOS.Cast_Choke", true)
  1280. if ( !self.Owner:KeyReleased( IN_ATTACK2 ) ) then
  1281. local Cdmg = DamageInfo()
  1282. Cdmg:SetDamage( 0.4 ) --0.21
  1283. Cdmg:SetDamageType( DMG_CRUSH )
  1284. Cdmg:SetAttacker( self.Owner )
  1285. Cdmg:SetInflictor( self )
  1286. self.ChokeTarget:TakeDamageInfo( Cdmg )
  1287. self.ChokeTarget:SetLocalVelocity( ( self.ChokePos - self.ChokeTarget:GetPos() + Vector( 0, 0, 0 ) )*0 )
  1288. --self.ChokeTarget:SetPos( Vector( self.ChokePos.x, self.ChokePos.y, math.min( self.ChokeTarget:GetPos().z + 0.5, self.ChokePos.z + 55 ) ) )
  1289. --self.ChokeTarget:SetLocalVelocity( Vector( 0, 0, 100 ) )
  1290. self.ChokeTarget:SetNW2Bool("wOS.Choked", true)
  1291. self.ChokeTarget:SetNW2Float( "wOS.SaberAttackDelay", CurTime() + 0.5 )
  1292. self.Owner:SetNW2Bool("wOS.Cast_Choke", true)
  1293. self:SetForce( self:GetForce() - 0.02 )
  1294. if ( !self.SoundChoking ) then
  1295. self.SoundChoking = CreateSound( self.Owner, "wos/icefuse/choke_active.wav" )
  1296. self.SoundChoking:PlayEx( 0.25, 100 )
  1297. else
  1298. self.SoundChoking:PlayEx( 0.25, 100 )
  1299. end
  1300. timer.Create( "test" .. self.Owner:SteamID64() .. "_choke", 0.2, 1, function() if ( self.SoundChoking ) then self.SoundChoking:Stop() self.SoundChoking = nil end end )
  1301.  
  1302. if ( !self.SoundGagging ) then
  1303. self.SoundGagging = CreateSound( self.ChokeTarget, "wos/icefuse/choke_gagging.wav" )
  1304. self.SoundGagging:Play()
  1305. else
  1306. self.SoundGagging:Play()
  1307. end
  1308. timer.Create( "test" .. self.Owner:SteamID64(), 0.2, 1, function() if ( self.SoundGagging ) then self.SoundGagging:Stop() self.SoundGagging = nil end end )
  1309.  
  1310. if ( self:GetForce() <= 0 ) then
  1311. local ed = EffectData()
  1312. self.ChokeTarget = nil
  1313. self.ChokeTarget:SetNW2Bool("wOS.Choked", false)
  1314. self.Owner:SetNW2Bool("wOS.Cast_Choke", false)
  1315. self:SetNextAttack( 1 )
  1316. end
  1317. if (self.ChokeTarget:Health() == 1) then
  1318. self.ChokeTarget:SetNW2Bool("wOS.Choked", false)
  1319. self.Owner:SetNW2Bool("wOS.Cast_Choke", false)
  1320. end
  1321. else
  1322. if not IsValid( self.ChokeTarget ) then return end
  1323. local ed = EffectData()
  1324. self.ChokeTarget:SetNW2Bool("wOS.Choked", false)
  1325. self.Owner:SetNW2Bool("wOS.Cast_Choke", false)
  1326. self.ChokeTarget = nil
  1327. self:SetNextAttack( 1 )
  1328.  
  1329. end
  1330.  
  1331. end
  1332.  
  1333. })
  1334.  
  1335.  
  1336.  
  1337. wOS.ForcePowers:RegisterNewPower({
  1338. name = "Group Choke",
  1339. icon = "GCH",
  1340. description = "Choke them all",
  1341. image = "wos/forceicons/icefuse/choke.png",
  1342. cooldown = 0,
  1343. manualaim = false,
  1344. distance = 400,
  1345. target = 10,
  1346. action = function( self )
  1347. if self:GetForce() < 1 then return end
  1348. if self.IsGroupChoking then return end
  1349. local foundents = self:SelectTargets( 10, 400 )
  1350. if #foundents < 1 then return end
  1351. self.ChokeTargets = {}
  1352. self.ChokePoss = {}
  1353. for id, ent in pairs( foundents ) do
  1354. if not ent:IsPlayer() then continue end
  1355. self.ChokeTargets[ id ] = ent
  1356. ent:EmitSound( "wos/icefuse/choke_start.wav" )
  1357. self.ChokePoss[ id ] = ent:GetPos()
  1358. end
  1359. end,
  1360. think = function( self )
  1361. if not self.ChokeTargets then self.IsGroupChoking = false return end
  1362. if ( self:GetNextSecondaryFire() > CurTime() ) then self.IsGroupChoking = false return end
  1363. if ( self:GetForce() < 1 ) then self.IsGroupChoking = false return end
  1364. if #self.ChokeTargets < 1 then self.IsGroupChoking = false return end
  1365. if ( !self.Owner:KeyDown( IN_ATTACK2 ) && !self.Owner:KeyReleased( IN_ATTACK2 ) ) then self.Owner:SetNW2Float("wOS.Cast_Choke", false) return end
  1366. self.Owner:SetNW2Float("wOS.Cast_Choke", true)
  1367. if ( !self.Owner:KeyReleased( IN_ATTACK2 ) ) then
  1368. self:SetForce( self:GetForce() - 0.02 )
  1369. if ( !self.SoundChoking ) then
  1370. self.SoundChoking = CreateSound( self.Owner, "wos/icefuse/choke_active.wav" )
  1371. self.SoundChoking:PlayEx( 0.25, 100 )
  1372. else
  1373. self.SoundChoking:PlayEx( 0.25, 100 )
  1374. end
  1375. timer.Create( "test" .. self.Owner:SteamID64() .. "_choke", 0.2, 1, function() if ( self.SoundChoking ) then self.SoundChoking:Stop() self.SoundChoking = nil end end )
  1376. self.IsGroupChoking = true
  1377. for id, ply in pairs( self.ChokeTargets ) do
  1378. if not IsValid( ply ) then self.ChokeTargets[ id ] = nil continue end
  1379. if not ply:Alive() then self.ChokeTargets[ id ] = nil continue end
  1380. local GCdmg = DamageInfo()
  1381. GCdmg:SetDamage( 0.4 ) --0.21
  1382. GCdmg:SetDamageType( DMG_CRUSH )
  1383. GCdmg:SetAttacker( self.Owner )
  1384. GCdmg:SetInflictor( self )
  1385. ply:TakeDamageInfo( GCdmg )
  1386. ply:SetLocalVelocity( ( self.ChokePoss[ id ] - ply:GetPos() + Vector( 0, 0, 0) )*0 )
  1387. --self.ChokeTarget:SetPos( Vector( self.ChokePos.x, self.ChokePos.y, math.min( self.ChokeTarget:GetPos().z + 0.5, self.ChokePos.z + 55 ) ) )
  1388. --self.ChokeTarget:SetLocalVelocity( Vector( 0, 0, 100 ) )
  1389. ply:SetNW2Float( "wOS.Choked", true )
  1390. ply:SetNW2Float( "wOS.SaberAttackDelay", CurTime() + 0.5 )
  1391. self.Owner:SetNW2Float( "wOS.Cast_Choke", true )
  1392. if ( !ply.SoundGagging ) then
  1393. ply.SoundGagging = CreateSound( ply, "wos/icefuse/choke_gagging.wav" )
  1394. ply.SoundGagging:Play()
  1395. else
  1396. ply.SoundGagging:Play()
  1397. end
  1398. timer.Create( "test" .. ply:SteamID64(), 0.2, 1, function() if ( ply.SoundGagging ) then ply.SoundGagging:Stop() ply.SoundGagging = nil end end )
  1399. if ( self:GetForce() < 1 ) then
  1400. ply:SetNW2Float( "wOS.Choked", false )
  1401. self.Owner:SetNW2Float( "wOS.Cast_Choke", false )
  1402. self.ChokeTargets = {}
  1403. self:SetNextAttack( 1 )
  1404. self.IsGroupChoking = false
  1405. return
  1406. end
  1407. if (ply:Health() <= 0) then
  1408. self.ChokeTarget:SetNW2Bool("wOS.Choked", false)
  1409. self.Owner:SetNW2Bool("wOS.Cast_Choke", false)
  1410. end
  1411. end
  1412. else
  1413. for id, ply in pairs( self.ChokeTargets ) do
  1414. ply:SetNW2Float( "wOS.Choked", false )
  1415. if not IsValid( ply ) then self.ChokeTargets[ id ] = nil continue end
  1416. if not ply:Alive() then self.ChokeTargets[ id ] = nil continue end
  1417. end
  1418. self.Owner:SetNW2Float( "wOS.Cast_Choke", false )
  1419. self.ChokeTargets = {}
  1420. self:SetNextAttack( 1 )
  1421. self.IsGroupChoking = false
  1422. end
  1423. end
  1424. })
  1425.  
  1426. wOS.ForcePowers:RegisterNewPower({
  1427. name = "Force Meteor",
  1428. icon = "C",
  1429. target = 1,
  1430. image = "anzati/icons/force_meteor.png",
  1431. description = "Shoot Meteors down from the sky",
  1432. action = function( sel )
  1433. if ( CLIENT ) then return end
  1434. local ply = sel.Owner
  1435. local ent = sel:SelectTargets( 1 )[ 1 ]
  1436.  
  1437. if ( !IsValid( ent )) then sel:SetNextAttack( 0.2 ) return end
  1438.  
  1439. if sel:GetForce() < 70 then return end
  1440. for x = 1,5 do
  1441. local meteor = ents.Create("star_metor")
  1442. meteor.nodupe = true
  1443. meteor:Spawn()
  1444. meteor:SetMeteorTarget(ent)
  1445. end
  1446. sel:SetForce( sel:GetForce() - 70 )
  1447. local metor = CreateSound( sel.Owner,( "gbombs/daisy/daisy_explo.wav" .. 1 ..".mp3" ))
  1448. metor:Play()
  1449. sel:SetNextAttack( 2 )
  1450. sel.Owner:SetCoolDown(sel:GetActiveForcePowerType( sel:GetForceType() ).name, 60)
  1451.  
  1452. end
  1453. })
  1454.  
  1455. wOS.ForcePowers:RegisterNewPower({
  1456. name = "Force Frenzy",
  1457. icon = "FF",
  1458. image = "anzati/icons/force_frenzy.png",
  1459. cooldown = 60,
  1460. description = "An eye for an eye",
  1461. action = function( self )
  1462. if ( self:GetForce() < 200 || !self.Owner:IsOnGround() ) then return end
  1463. if self.Owner:GetNW2Float( "AdvancedReflectTime", 0 ) >= CurTime() then return end
  1464. self:SetForce( self:GetForce() - 200 )
  1465. self:SetNextAttack( 0.7 )
  1466. self:PlayWeaponSound( "lightsaber/force_leap.wav" )
  1467. self.Owner:SetNW2Float( "AdvancedReflectTime", CurTime() + 5 )
  1468. return true
  1469. end
  1470. })
  1471.  
  1472. wOS.ForcePowers:RegisterNewPower({
  1473. name = "Electric Judgement",
  1474. icon = "EJ",
  1475. description = "The truth can blind us all.",
  1476. image = "wos/forceicons/icefuse/electric_judgement.png",
  1477. cooldown = 0,
  1478. manualaim = false,
  1479. action = function( self )
  1480. if ( self:GetForce() < 25 ) then return end
  1481. local tr = util.TraceLine( util.GetPlayerTrace( self.Owner ) )
  1482. local ent = tr.Entity
  1483. if not ent then return end
  1484. if not ent:IsPlayer() then return end
  1485. if self.Owner:GetPos():Distance( ent:GetPos() ) > 300 then return end
  1486. if ent:GetNW2Float( "EJTime", 0 ) >= CurTime() then return end
  1487.  
  1488. local ed = EffectData()
  1489. ed:SetOrigin( self:GetSaberPosAng() )
  1490. ed:SetEntity( ent )
  1491. util.Effect( "wos_emerald_lightning", ed, true, true )
  1492.  
  1493. if ent.IsBlocking then
  1494. ent:EmitSound( "lightsaber/saber_hit_laser" .. math.random( 1, 4 ) .. ".wav" )
  1495. if wOS.EnableStamina then
  1496. ent:AddStamina( -5 )
  1497. else
  1498. ent:GetActiveWeapon():SetForce( ent:GetActiveWeapon():GetForce() - 1 )
  1499. end
  1500. ent:SetSequenceOverride( "h_block", 0.5 )
  1501. else
  1502. self:SetNextAttack( 0.7 )
  1503. if ent:GetNW2Float( "EJTime", 0 ) < CurTime() then
  1504. ent:SetNW2Float( "EJTime", CurTime() + 8 )
  1505. ent:SetRunSpeed( ent:GetRunSpeed()*0.5 )
  1506. end
  1507. end
  1508.  
  1509. self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.5 )
  1510. self:SetForce( self:GetForce() - 25 )
  1511. if ( !self.SoundLightning ) then
  1512. self.SoundLightning = CreateSound( self.Owner, "ambient/wind/wind_snippet2.wav" )
  1513. self.SoundLightning:PlayEx( 0.5, 100 )
  1514. else
  1515. self.SoundLightning:PlayEx( 0.5, 100 )
  1516. end
  1517. timer.Create( "test" .. self.Owner:SteamID64(), 0.2, 1, function() if ( self.SoundLightning ) then self.SoundLightning:Stop() self.SoundLightning = nil end end )
  1518. -- self:SetNextAttack( 0.1 )
  1519. end,
  1520.  
  1521. think = function( self )
  1522. for k, v in pairs( player.GetAll() ) do
  1523. if v:GetNW2Float( "EJTime", 0 ) < CurTime() then
  1524. v:SetRunSpeed( v:GetMaxRunSpeed() )
  1525. end
  1526. end
  1527. end,
  1528. })
  1529.  
  1530. wOS.ForcePowers:RegisterNewPower({
  1531. name = "Blood Lust",
  1532. icon = "BL",
  1533. image = "anzati/icons/blood_lust.png",
  1534. cooldown = 20,
  1535. description = "Regenerate 900 health over 15 seconds",
  1536. action = function( self )
  1537. if ( self:GetForce() < 50 || !self.Owner:IsOnGround() ) then return end
  1538. self:SetForce( self:GetForce() - 50 )
  1539. self:SetNextAttack( 0.7 )
  1540. self:PlayWeaponSound( "lightsaber/force_leap.wav" )
  1541. timer.Create( "BloodLust", 0.5, 30, function()
  1542. self.Owner:SetHealth(math.min(self.Owner:GetMaxHealth(), self.Owner:Health() + 30))
  1543. self.Owner:SetArmor(math.min(self.Owner:GetMaxArmor(), self.Owner:Armor() + 5))
  1544. end)
  1545. return true
  1546. end
  1547. })
  1548.  
  1549. wOS.ForcePowers:RegisterNewPower({
  1550. name = "Adrenaline",
  1551. icon = "ADR",
  1552. description = "Be quick to the draw",
  1553. image = "anzati/icons/adrenaline.png",
  1554. cooldown = 80,
  1555. manualaim = false,
  1556. action = function( self )
  1557. if ( self:GetForce() < 50 || !self.Owner:IsOnGround() ) then return end
  1558. if self.Owner:GetNW2Float( "SpeedTime", 0 ) >= CurTime() then return end
  1559. self:SetForce( self:GetForce() - 200 )
  1560. self:SetNextAttack( 0.7 )
  1561. self:PlayWeaponSound( "lightsaber/force_leap.wav" )
  1562. if self.Owner:GetNW2Float( "SpeedTime", 0 ) < CurTime() then
  1563. self.RunSpeed = self.Owner:GetRunSpeed()
  1564. --self.WalkSpeed = self.Owner:GetWalkSpeed()
  1565. end
  1566. self.Owner:SetNW2Float( "SpeedTime", CurTime() + 10 )
  1567. self.Owner:SetRunSpeed( self.RunSpeed*4.5 )
  1568.  
  1569. --self.Owner:SetWalkSpeed( self.WalkSpeed*4.5 )
  1570. return true
  1571. end,
  1572. think = function( self )
  1573. if self.Owner:GetNW2Float( "SpeedTime", 0 ) < CurTime() then
  1574. self.Owner:SetRunSpeed( self.Owner:GetMaxRunSpeed() )
  1575. end
  1576. end,
  1577. })
  1578.  
  1579. wOS.ForcePowers:RegisterNewPower({
  1580. name = "Force Vanish",
  1581. icon = "FV",
  1582. image = "anzati/icons/force_vanish.png",
  1583. cooldown = 5,
  1584. manualaim = false,
  1585. description = "Shrowd yourself with the force forever.",
  1586. action = function( self )
  1587. if ( self:GetForce() < 50 || !self.Owner:IsOnGround() ) then return end
  1588.  
  1589. self:SetForce( self:GetForce() - 50 )
  1590. self:SetNextAttack( 0.7 )
  1591. self:PlayWeaponSound( "lightsaber/force_leap.wav" )
  1592. if self.Owner:GetNW2Int( "ForceVanish", 0 ) == 0 then
  1593. self.Owner:SetNW2Int( "ForceVanish", 1 )
  1594. self.Owner:SetNW2Float( "CloakTime", CurTime() + 1000 )
  1595. else
  1596. self.Owner:SetNW2Int( "ForceVanish", 0 )
  1597. self.Owner:SetNW2Float( "CloakTime", CurTime() + 1 )
  1598. end
  1599.  
  1600. return true
  1601. end
  1602. })
  1603.  
  1604. wOS.ForcePowers:RegisterNewPower({
  1605. name = "Force Drain",
  1606. icon = "FD",
  1607. image = "anzati/icons/force_drain.png",
  1608. cooldown = 60,
  1609. description = "A combined version of Force Frenzy and Force Reflect, although 50% less efficient.",
  1610. action = function( self )
  1611. if ( self:GetForce() < 200 || !self.Owner:IsOnGround() ) then return end
  1612. if self.Owner:GetNW2Float( "ForceDrain", 0 ) >= CurTime() then return end
  1613. self:SetForce( self:GetForce() - 200 )
  1614. self:SetNextAttack( 0.7 )
  1615. self:PlayWeaponSound( "lightsaber/force_leap.wav" )
  1616. self.Owner:SetNW2Float( "ForceDrain", CurTime() + 5 )
  1617. return true
  1618. end
  1619. })
  1620.  
  1621. wOS.ForcePowers:RegisterNewPower({
  1622. name = "Red Lightning",
  1623. icon = "RL",
  1624. target = 1,
  1625. image = "wos/forceicons/lightning.png",
  1626. cooldown = 0,
  1627. manualaim = false,
  1628. description = "Torture people ( and monsters ) at will.",
  1629. action = function( self )
  1630. if ( self:GetForce() < 1 ) then return end
  1631.  
  1632. local foundents = 0
  1633. for id, ent in pairs( self:SelectTargets( 1 ) ) do
  1634. if ( !IsValid( ent ) ) then continue end
  1635.  
  1636. foundents = foundents + 1
  1637. local ed = EffectData()
  1638. ed:SetOrigin( self:GetSaberPosAng() )
  1639. ed:SetEntity( ent )
  1640. util.Effect( "rb655_red_lightning", ed, true, true )
  1641.  
  1642. local dmg = DamageInfo()
  1643. dmg:SetAttacker( self.Owner || self )
  1644. dmg:SetInflictor( self.Owner || self )
  1645. dmg:SetDamage( 25 )
  1646. if ( ent:IsNPC() ) then dmg:SetDamage( 20 ) end
  1647. ent:TakeDamageInfo( dmg )
  1648.  
  1649. end
  1650.  
  1651. if ( foundents > 0 ) then
  1652. self:SetForce( self:GetForce() - foundents )
  1653. if ( !self.SoundLightning ) then
  1654. self.SoundLightning = CreateSound( self.Owner, "lightsaber/force_lightning" .. math.random( 1, 2 ) .. ".wav" )
  1655. self.SoundLightning:Play()
  1656. else
  1657. self.SoundLightning:Play()
  1658. end
  1659.  
  1660. timer.Create( "test", 0.2, 1, function() if ( self.SoundLightning ) then self.SoundLightning:Stop() self.SoundLightning = nil end end )
  1661. end
  1662. self:SetNextAttack( 0.1 )
  1663. return true
  1664. end
  1665. })
  1666.  
  1667. wOS.ForcePowers:RegisterNewPower({
  1668. name = "Chain Lightning",
  1669. icon = "CL",
  1670. target = 1,
  1671. image = "wos/forceicons/lightning.png",
  1672. cooldown = 0,
  1673. manualaim = false,
  1674. description = "Torture people ( and monsters ) at will.",
  1675. action = function( self )
  1676. if ( self:GetForce() < 1 ) then return end
  1677.  
  1678. local foundents = 0
  1679. local entsin = 0
  1680. for id, ent in pairs( self:SelectTargets( 1 ) ) do
  1681. if ( !IsValid( ent ) ) then continue end
  1682.  
  1683. foundents = foundents + 1
  1684. local ed = EffectData()
  1685. ed:SetOrigin( self:GetSaberPosAng() )
  1686. ed:SetEntity( ent )
  1687. util.Effect( "rb655_force_lighting", ed, true, true )
  1688.  
  1689. local dmg = DamageInfo()
  1690. dmg:SetAttacker( self.Owner || self )
  1691. dmg:SetInflictor( self.Owner || self )
  1692. dmg:SetDamage( 12.5 )
  1693. if ( ent:IsNPC() ) then dmg:SetDamage( 10 ) end
  1694. ent:TakeDamageInfo( dmg )
  1695.  
  1696. for _, ply in pairs( ents.FindInSphere( ent:GetPos(), 250 ) ) do
  1697. if ply:IsNPC() || ply:IsPlayer() then
  1698. if ( !IsValid( ply ) ) then continue end
  1699. if ply == self.Owner then continue end
  1700. foundents = foundents + 1
  1701. local ed = EffectData()
  1702. ed:SetOrigin( ent:GetPos() )
  1703. ed:SetEntity( ply )
  1704. util.Effect( "rb655_force_lighting", ed, true, true )
  1705.  
  1706. local dmg = DamageInfo()
  1707. dmg:SetAttacker( self.Owner || self )
  1708. dmg:SetInflictor( self.Owner || self )
  1709. dmg:SetDamage( 5 )
  1710. if ( ply:IsNPC() ) then dmg:SetDamage( 7.5 ) end
  1711. ply:TakeDamageInfo( dmg )
  1712. end
  1713. end
  1714.  
  1715. end
  1716.  
  1717. if ( foundents > 0 ) then
  1718. self:SetForce( self:GetForce() - (foundents)*0.6 )
  1719. if ( !self.SoundLightning ) then
  1720. self.SoundLightning = CreateSound( self.Owner, "lightsaber/force_lightning" .. math.random( 1, 2 ) .. ".wav" )
  1721. self.SoundLightning:Play()
  1722. else
  1723. self.SoundLightning:Play()
  1724. end
  1725.  
  1726. timer.Create( "test", 0.2, 1, function() if ( self.SoundLightning ) then self.SoundLightning:Stop() self.SoundLightning = nil end end )
  1727. end
  1728. self:SetNextAttack( 0.1 )
  1729. return true
  1730. end
  1731. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement