Guest User

Untitled

a guest
Dec 7th, 2014
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.50 KB | None | 0 0
  1. #define PLUGIN_VERSION "0.0.0.2 (1/26/2013) 8:22AM EST"
  2. /**
  3. * File: War3Source_CustomRace_OrcishForce.sp
  4. * Description: The Orcish Force Horde race.
  5. * Author(s): El Diablo
  6. *
  7. *--modified version of orcish horde from war3source.
  8. */
  9.  
  10. #pragma semicolon 1
  11. #pragma tabsize 0
  12.  
  13. #include <sourcemod>
  14. #include "W3SIncs/War3Source_Interface"
  15. #include <sdktools>
  16. #include <sdktools_functions>
  17. #include <sdktools_tempents>
  18. #include <sdktools_tempents_stocks>
  19.  
  20. //#include <cstrike>
  21.  
  22. public W3ONLY(){} //unload this?
  23. new thisRaceID;
  24. new Handle:ultCooldownCvar;
  25.  
  26. new Float:LastThunderClap[MAXPLAYERSCUSTOM];
  27.  
  28. new bool:bBeenHit[MAXPLAYERSCUSTOM][MAXPLAYERSCUSTOM]; // [caster][victim] been hit this chain lightning?
  29.  
  30.  
  31.  
  32. //new MyWeaponsOffset,AmmoOffset;
  33. //Clip1Offset
  34.  
  35.  
  36. // blitz
  37. new Float:forcblitz[5]={0.0,1.05,1.10,1.15,1.25};
  38. new Float:OnFireToSlow[5]={0.0,0.50,0.60,0.70,0.80};
  39.  
  40. // lustful power
  41. new Float:forclustfulpower[5]={1.0,1.05,1.10,1.15,1.20};
  42. new Float:MagicResistanceReduction[5]={1.0,-1.20,-1.30,-1.40,-1.50};
  43.  
  44. // Chance/Data Arrays
  45. new Float:CriticalStrikePercent[5]={0.0,0.30,0.50,0.60,0.70};
  46. //new Float:ChainDistance[5]={0.0,150.0,200.0,250.0,300.0};
  47. new Float:ChainDistance[5]={0.0,150.0,200.0,300.0,450.0};
  48. new Float:DischargeDelay[5]={0.0,4.0,3.0,2.0,1.0};
  49.  
  50. // WARDS
  51. #define MAXWARDS 64*4 //on map LOL
  52. #define WARDRADIUS 60
  53. #define WARDDAMAGE 20 // was three
  54. #define WARDBELOW -2.0 // player is 60 units tall about (6 feet)
  55. #define WARDABOVE 160.0
  56.  
  57. new CurrentWardCount[MAXPLAYERSCUSTOM];
  58. new WardStartingArr[]={0,1,2,3,4};
  59. new Float:WardLocation[MAXWARDS][3];
  60. new WardOwner[MAXWARDS];
  61.  
  62. new String:lightningSound[]="war3source/lightningbolt.wav";
  63. new String:wardDamageSound[]="war3source/thunder_clap.wav";
  64.  
  65.  
  66. new SKILL_CRIT,SKILL_BLITZ,SKILL_LUSTFUL_POWER,SKILL_WARD,ULT_LIGHTNING;
  67. // Effects
  68.  
  69. new BeamSprite,HaloSprite,BloodSpray,BloodDrop;
  70.  
  71. public Plugin:myinfo =
  72. {
  73. name = "Race - Orcish Force",
  74. author = "El Diablo",
  75. description = "The Orcish Force job for War3evo.",
  76. version = "1.0.0.0",
  77. url = "http://www.war3evo.com"
  78. };
  79.  
  80. public OnPluginStart()
  81. {
  82. CreateConVar("war3evo_OrcishForce",PLUGIN_VERSION,"War3evo Orcish Force",FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_DONTRECORD);
  83. //HookEvent("round_start",RoundStartEvent);
  84. ultCooldownCvar=CreateConVar("war3_orcishforce_chain_cooldown","20.0","Cooldown time for chain lightning.");
  85.  
  86. //MyWeaponsOffset=FindSendPropOffs("CBaseCombatCharacter","m_hMyWeapons");
  87. // Clip1Offset=FindSendPropOffs("CBaseCombatWeapon","m_iClip1");
  88. //AmmoOffset=FindSendPropOffs("CBasePlayer","m_iAmmo");
  89. CreateTimer(0.14,CalcWards,_,TIMER_REPEAT);
  90. // HookEvent("player_hurt",PlayerHurtEvent);
  91.  
  92. //LoadTranslations("w3s.race.orc.phrases");
  93. }
  94.  
  95.  
  96. public OnWar3LoadRaceOrItemOrdered(num)
  97. {
  98. if(num==30)
  99. {
  100. thisRaceID=War3_CreateNewRace("Orcish Force","orcishforce");
  101. SKILL_CRIT=War3_AddRaceSkill(thisRaceID,"War Strike",
  102. "Chance of doing critical damage",false,4);
  103. SKILL_BLITZ=War3_AddRaceSkill(thisRaceID,"Blitz",
  104. "Increases movement speed. On Burn: you have a\nchance of 100% to getting slowed by 50%/60%/70%/80%",false,4);
  105. SKILL_LUSTFUL_POWER=War3_AddRaceSkill(thisRaceID,"Lustful Power",
  106. "Increases attack speed. Magical resistance is vulnerability is increased.",false,4);
  107. SKILL_WARD=War3_AddRaceSkill(thisRaceID,"Serpent Wards",
  108. "Wards that damage enemies if they touch. Activate by '+ability'",false,4);
  109. ULT_LIGHTNING=War3_AddRaceSkill(thisRaceID,"Chain Lightning",
  110. "Discharges a bolt of lightning that jumps to\nnearby enemies 150-300 units in range,\ndealing each damage.\nAfter Discharge you cannot attack for 4/3/2/1 seconds.",true,4); //TEST
  111. W3SkillCooldownOnSpawn(thisRaceID,ULT_LIGHTNING,10.0,_); //translated doesnt use this "Chain Lightning"?
  112. War3_CreateRaceEnd(thisRaceID);
  113. War3_SetDependency(thisRaceID, SKILL_LUSTFUL_POWER, SKILL_BLITZ, 4);
  114. } //blood thirsty Sweeping Strikes
  115. }
  116.  
  117.  
  118.  
  119.  
  120. public OnWar3PlayerAuthed(client)
  121. {
  122. LastThunderClap[client]=0.0;
  123. }
  124.  
  125. public OnRaceChanged(client,oldrace,newrace)
  126. {
  127. if(newrace!=thisRaceID)
  128. {
  129. War3_SetBuff(client,fSlow,thisRaceID,1.0);
  130. War3_SetBuff(client,fMaxSpeed,thisRaceID,1.0);
  131. War3_SetBuff(client,fAttackSpeed,thisRaceID,1.0);
  132. War3_SetBuff(client,bDisarm,thisRaceID,false);
  133. War3_SetBuff(client,fArmorMagic,thisRaceID,0.0);
  134. }
  135. else if(War3_GetRace(client)==thisRaceID)
  136. {
  137. ActivateSkills(client);
  138. }
  139. }
  140.  
  141. public ActivateSkills(client)
  142. {
  143. // blitz
  144. new skill_blitz=War3_GetSkillLevel(client,thisRaceID,SKILL_BLITZ);
  145. new Float:orcblitz=forcblitz[skill_blitz];
  146. War3_SetBuff(client,fSlow,thisRaceID,1.0);
  147. War3_SetBuff(client,fMaxSpeed,thisRaceID,orcblitz);
  148.  
  149. // lustful power
  150. new skill_lustful_power=War3_GetSkillLevel(client,thisRaceID,SKILL_LUSTFUL_POWER);
  151. new Float:orclustfulpower=forclustfulpower[skill_lustful_power];
  152. War3_SetBuff(client,fAttackSpeed,thisRaceID,orclustfulpower);
  153. // reduced magic resistance
  154. new Float:fMagicResistanceReduction=MagicResistanceReduction[skill_lustful_power];
  155. War3_SetBuff(client,fArmorMagic,thisRaceID,fMagicResistanceReduction);
  156.  
  157. War3_SetBuff(client,bDisarm,thisRaceID,false);
  158.  
  159. }
  160.  
  161. public OnW3Denyable(W3DENY:event,client)
  162. {
  163. if((event == DN_CanBuyItem1) && (W3GetVar(EventArg1) == War3_GetItemIdByShortname("antiward")))
  164. {
  165. if(War3_GetRace(client)==thisRaceID)
  166. {
  167. W3Deny();
  168. War3_ChatMessage(client, "I'm a strong green orcish force and I don't need no antiward!");
  169. }
  170. }
  171. }
  172. /*
  173. public OnWar3Event(W3EVENT:event, client)
  174. {
  175. if(event == CanBuyItem)
  176. {
  177. new item = W3GetVar(EventArg1);
  178. new itemname=War3_GetItemIdByShortname("antiward");
  179. if(item==itemname && War3_GetRace(client)==thisRaceID)
  180. {
  181. W3SetVar(EventArg2, 0);
  182. War3_ChatMessage(client, "I'm a strong green orcish force and I don't need no antiward!");
  183. //War3_SetGold(client,100);
  184. //War3_SetOwnsItem(client,item,false);
  185. //PrintToChat(client,"Store refunded your gold.");
  186. }
  187. else W3SetVar(EventArg2, 1);
  188. }
  189. }
  190. */
  191. public TF2_OnConditionAdded(client, TFCond:condition)
  192. {
  193. if(ValidPlayer(client))
  194. {
  195. if(TF2_IsPlayerInCondition(client,TFCond_OnFire) && War3_GetRace(client)==thisRaceID)
  196. {
  197. //DP("Player is on fire!");
  198. new skill_blitz=War3_GetSkillLevel(client,thisRaceID,SKILL_BLITZ);
  199. new Float:orcblitz=forcblitz[skill_blitz]*OnFireToSlow[skill_blitz]; // by 50%
  200.  
  201. War3_SetBuff(client,fMaxSpeed,thisRaceID,1.0);
  202. War3_SetBuff(client,fSlow,thisRaceID,orcblitz);
  203. /*else
  204. {
  205. orcblitz=forcblitz[skill_blitz];
  206. War3_SetBuff(client,fSlow,thisRaceID,1.0);
  207. War3_SetBuff(client,fMaxSpeed,thisRaceID,orcblitz);
  208. } */
  209. }
  210. }
  211. }
  212.  
  213. public TF2_OnConditionRemoved(client, TFCond:condition)
  214. {
  215. if(ValidPlayer(client))
  216. {
  217. if(!(TF2_IsPlayerInCondition(client,TFCond_OnFire)) && War3_GetRace(client)==thisRaceID)
  218. {
  219. new skill_blitz=War3_GetSkillLevel(client,thisRaceID,SKILL_BLITZ);
  220. new Float:orcblitz=forcblitz[skill_blitz];
  221. War3_SetBuff(client,fSlow,thisRaceID,1.0);
  222. War3_SetBuff(client,fMaxSpeed,thisRaceID,orcblitz);
  223. }
  224. }
  225. }
  226.  
  227. public DoChain(client,Float:distance,dmg,bool:first_call,last_target)
  228. {
  229. new target=0;
  230. new Float:target_dist=distance+1.0; // just an easy way to do this
  231. new caster_team=GetClientTeam(client);
  232. new Float:start_pos[3];
  233. if(last_target<=0)
  234. GetClientAbsOrigin(client,start_pos);
  235. else
  236. GetClientAbsOrigin(last_target,start_pos);
  237. for(new x=1;x<=MaxClients;x++)
  238. {
  239. if(ValidPlayer(x,true)&&!bBeenHit[client][x]&&caster_team!=GetClientTeam(x)&&!W3HasImmunity(x,Immunity_Ultimates))
  240. {
  241. new Float:this_pos[3];
  242. GetClientAbsOrigin(x,this_pos);
  243. new Float:dist_check=GetVectorDistance(start_pos,this_pos);
  244. if(dist_check<=target_dist)
  245. {
  246. // found a candidate, whom is currently the closest
  247. target=x;
  248. target_dist=dist_check;
  249. }
  250. }
  251. }
  252. if(target<=0)
  253. {
  254. //DP("no target");
  255. // no target, if first call dont do cooldown
  256. if(first_call)
  257. {
  258. W3MsgNoTargetFound(client,distance);
  259. }
  260. else
  261. {
  262. // alright, time to cooldown
  263. new Float:cooldown=GetConVarFloat(ultCooldownCvar);
  264. War3_CooldownMGR(client,cooldown,thisRaceID,ULT_LIGHTNING,_,_);
  265. War3_SetBuff(client,bDisarm,thisRaceID,true); //since this is where the cooldown activates it seems appropriate to activate the disarm here - Dagothur 1/16/2013
  266. //DP("CD %f %d %d",cooldown,thisRaceID,ULT_LIGHTNING);
  267. }
  268. }
  269. else
  270. {
  271. // found someone
  272. if(!W3HasImmunity(target,Immunity_Ultimates))
  273. {
  274. bBeenHit[client][target]=true; // don't let them get hit twice
  275. War3_DealDamage(target,dmg,client,DMG_ENERGYBEAM,"chainlightning");
  276. PrintHintText(target,"Hit by Chain Lightning -%i HP",War3_GetWar3DamageDealt());
  277. start_pos[2]+=30.0; // offset for effect
  278. decl Float:target_pos[3],Float:vecAngles[3];
  279. GetClientAbsOrigin(target,target_pos);
  280. target_pos[2]+=30.0;
  281. TE_SetupBeamPoints(start_pos,target_pos,BeamSprite,HaloSprite,0,35,1.0,25.0,25.0,0,10.0,{255,100,255,255},40);
  282. TE_SendToAll();
  283. GetClientEyeAngles(target,vecAngles);
  284. TE_SetupBloodSprite(target_pos, vecAngles, {200, 20, 20, 255}, 28, BloodSpray, BloodDrop);
  285. TE_SendToAll();
  286. EmitSoundToAll( lightningSound , target,_,SNDLEVEL_TRAIN);
  287. new new_dmg=RoundFloat(float(dmg)*0.66);
  288.  
  289. DoChain(client,distance,new_dmg,false,target);
  290. }
  291. }
  292. }
  293.  
  294. public OnUltimateCommand(client,race,bool:pressed)
  295. {
  296. if(race==thisRaceID && pressed && IsPlayerAlive(client))
  297. {
  298. new skill=War3_GetSkillLevel(client,race,ULT_LIGHTNING);
  299. if(skill>0)
  300. {
  301.  
  302. if(War3_SkillNotInCooldown(client,thisRaceID,ULT_LIGHTNING,true)&&!Silenced(client))
  303. {
  304.  
  305. for(new x=1;x<=MaxClients;x++)
  306. bBeenHit[client][x]=false;
  307.  
  308. new Float:distance=ChainDistance[skill];
  309. // Dochange was 60 damage:
  310. DoChain(client,distance,90,true,0); // This function should also handle if there aren't targets
  311.  
  312. CreateTimer(DischargeDelay[skill],Enable_Attack,GetClientUserId(client));
  313. }
  314. }
  315. else
  316. {
  317. W3MsgUltNotLeveled(client);
  318. }
  319. }
  320. }
  321.  
  322. public Action:Enable_Attack(Handle:timer,any:userid)
  323. {
  324. new client=GetClientOfUserId(userid);
  325. if(ValidPlayer(client))
  326. {
  327. War3_SetBuff(client,bDisarm,thisRaceID,false);
  328. }
  329. }
  330.  
  331.  
  332. new totalChecks; // dont use int:totalChecks; gave tagmismatch
  333. new checkArray[20][4];
  334.  
  335. public OnMapStart()
  336. {
  337. decl String:mapname[128];
  338. GetCurrentMap(mapname, sizeof(mapname));
  339. //DP(mapname);
  340. if (strcmp(mapname, "pl_goldrush", false) == 0) {
  341. totalChecks = 2;
  342. checkArray[0][0] = -2200; //x <
  343. checkArray[0][1] = -3700; //x >
  344. checkArray[0][2] = 1700; //y >
  345. checkArray[0][3] = 2200; //y <
  346.  
  347. checkArray[1][0] = -4100;
  348. checkArray[1][1] = -4700;
  349. checkArray[1][2] = -2666;
  350. checkArray[1][3] = -2255;
  351. } else if (strcmp(mapname, "koth_nucleus", false) == 0) {
  352. totalChecks = 6;
  353. checkArray[0][0] = -1300; //x <
  354. checkArray[0][1] = -1500; //x >
  355. checkArray[0][2] = -450; //y >
  356. checkArray[0][3] = 400; //y <
  357.  
  358. checkArray[1][0] = 1500; //x <
  359. checkArray[1][1] = 1200; //x >
  360. checkArray[1][2] = -400; //y >
  361. checkArray[1][3] = 400; //y <
  362.  
  363. checkArray[2][0] = 2000; //x < not bugged
  364. checkArray[2][1] = 1600; //x >
  365. checkArray[2][2] = 100; //y >
  366. checkArray[2][3] = 400; //y <
  367.  
  368. checkArray[3][0] = 1800; //x < not bugged
  369. checkArray[3][1] = 1100; //x >
  370. checkArray[3][2] = -1000; //y >
  371. checkArray[3][3] = -700; //y <
  372.  
  373. checkArray[4][0] = -1100; //x < not bugged
  374. checkArray[4][1] = -1900; //x >
  375. checkArray[4][2] = -1000; //y >
  376. checkArray[4][3] = -700; //y <
  377.  
  378. checkArray[5][0] = -1600; //x < not bugged
  379. checkArray[5][1] = -2000; //x >
  380. checkArray[5][2] = 100; //y >]
  381. checkArray[5][3] = 400; //y <
  382.  
  383. } else if (strcmp(mapname, "koth_viaduct", false) == 0) {
  384. totalChecks = 2;
  385. checkArray[0][0] = -928; //x <
  386. checkArray[0][1] = -1800; //x >
  387. checkArray[0][2] = 2823; //y >
  388. checkArray[0][3] = 3224; //y <
  389.  
  390. checkArray[1][0] = -1000;
  391. checkArray[1][1] = -1700;
  392. checkArray[1][2] = -3200;
  393. checkArray[1][3] = -2800;
  394. } else if (strcmp(mapname, "koth_lakeside_final", false) == 0) {
  395. totalChecks = 2;
  396. checkArray[0][0] = 3400; //x <
  397. checkArray[0][1] = 2800; //x >
  398. checkArray[0][2] = -1000; //y >
  399. checkArray[0][3] = -50; //y <
  400.  
  401. checkArray[1][0] = -2600;
  402. checkArray[1][1] = -3400;
  403. checkArray[1][2] = -1000;
  404. checkArray[1][3] = 50;
  405. } else if (strcmp(mapname, "koth_harvest_final", false) == 0) {
  406. totalChecks = 2;
  407. checkArray[0][0] = 900; //x <
  408. checkArray[0][1] = 27; //x >
  409. checkArray[0][2] = 1700; //y >
  410. checkArray[0][3] = 2100; //y <
  411.  
  412. checkArray[1][0] = -27;
  413. checkArray[1][1] = -900;
  414. checkArray[1][2] = -2100;
  415. checkArray[1][3] = -1700;
  416. } else if (strcmp(mapname, "pl_badwater", false) == 0) {
  417. totalChecks = 5;
  418. checkArray[0][0] = -1000; //x <
  419. checkArray[0][1] = -1300; //x >
  420. checkArray[0][2] = -80; //y >
  421. checkArray[0][3] = 200; //y <
  422.  
  423. checkArray[1][0] = 255;
  424. checkArray[1][1] = -230;
  425. checkArray[1][2] = -90;
  426. checkArray[1][3] = 300;
  427.  
  428. checkArray[2][0] = 550; //x <
  429. checkArray[2][1] = 375; //x >
  430. checkArray[2][2] = 150; //y >
  431. checkArray[2][3] = 900; //y <
  432.  
  433. checkArray[3][0] = 3200;
  434.  
  435.  
  436. checkArray[3][1] = 2650;
  437. checkArray[3][2] = -2000;
  438. checkArray[3][3] = -400;
  439.  
  440. checkArray[4][0] = -1500; //x <
  441. checkArray[4][1] = -2250; //x >
  442. checkArray[4][2] = -1100; //y >
  443. checkArray[4][3] = -725; //y <
  444. } else if (strcmp(mapname, "pl_upward", false) == 0) {
  445. totalChecks = 6;
  446. checkArray[0][0] = -600; //x <
  447. checkArray[0][1] = -1000; //x >
  448. checkArray[0][2] = -2300; //y >
  449. checkArray[0][3] = -1900; //y <
  450.  
  451. checkArray[1][0] = -1600; //x <
  452. checkArray[1][1] = -2000; //x >
  453. checkArray[1][2] = -1700; //y >
  454. checkArray[1][3] = -1400; //y <
  455.  
  456. checkArray[2][0] = -1150; //x < not bugged
  457. checkArray[2][1] = -1400; //x >
  458. checkArray[2][2] = -1300; //y >
  459. checkArray[2][3] = -800; //y <
  460.  
  461. checkArray[3][0] = 720; //x < not bugged
  462. checkArray[3][1] = 300; //x >
  463. checkArray[3][2] = 1000; //y >
  464. checkArray[3][3] = 1400; //y <
  465.  
  466. checkArray[4][0] = 1000; //x < not bugged
  467. checkArray[4][1] = 88; //x >
  468. checkArray[4][2] = -25; //y >
  469. checkArray[4][3] = 730; //y <
  470.  
  471. checkArray[5][0] = 2000; //x < not bugged
  472. checkArray[5][1] = 1500; //x >
  473. checkArray[5][2] = -800; //y >]
  474. checkArray[5][3] = -475; //y <
  475.  
  476.  
  477. } else if (strcmp(mapname, "cp_dustbowl", false) == 0) {
  478. totalChecks = 7;
  479. checkArray[0][0] = -1750; //x <
  480. checkArray[0][1] = -2500; //x >
  481. checkArray[0][2] = 2264; //y >
  482. checkArray[0][3] = 3100; //y <
  483.  
  484. checkArray[1][0] = -1550; //x <
  485. checkArray[1][1] = -1800; //x >
  486. checkArray[1][2] = 1400; //y >
  487. checkArray[1][3] = 2100; //y <
  488.  
  489. checkArray[2][0] = 2900; //x < not bugged
  490. checkArray[2][1] = 1400; //x >
  491. checkArray[2][2] = -350; //y >
  492. checkArray[2][3] = 1100; //y <
  493.  
  494. checkArray[3][0] = -1300; //x < not bugged
  495. checkArray[3][1] = -2655; //x >
  496. checkArray[3][2] = -1750; //y >
  497. checkArray[3][3] = -560; //y <
  498.  
  499. checkArray[4][0] = -215; //x < not bugged
  500. checkArray[4][1] = -1300; //x >
  501. checkArray[4][2] = 250; //y >
  502. checkArray[4][3] = 1315; //y <
  503.  
  504. checkArray[5][0] = 300; //x < not bugged
  505. checkArray[5][1] = -100; //x >
  506. checkArray[5][2] = 600; //y >]
  507. checkArray[5][3] = 1000; //y <
  508.  
  509. checkArray[6][0] = 1300; //x < not bugged
  510. checkArray[6][1] = 800; //x >
  511. checkArray[6][2] = 600; //y >]
  512. checkArray[6][3] = 1000; //y <
  513.  
  514. } else if (strcmp(mapname, "pl_hoodoo_final", false) == 0) {
  515. totalChecks = 5;
  516. checkArray[0][0] = 5700; //x <
  517. checkArray[0][1] = 5000; //x >
  518. checkArray[0][2] = 340; //y >
  519. checkArray[0][3] = 1400; //y <
  520.  
  521. checkArray[1][0] = 2700; //x <
  522. checkArray[1][1] = 1450; //x >
  523. checkArray[1][2] = -3800; //y >
  524. checkArray[1][3] = -1750; //y <
  525.  
  526. checkArray[2][0] = -3400; //x < not bugged
  527. checkArray[2][1] = -3900; //x >
  528. checkArray[2][2] = -1650; //y >
  529. checkArray[2][3] = -1200; //y <
  530.  
  531. checkArray[3][0] = -4200; //x < not bugged
  532. checkArray[3][1] = -4800; //x >
  533. checkArray[3][2] = -1300; //y >
  534. checkArray[3][3] = -300; //y <
  535.  
  536. checkArray[4][0] = -7700; //x < not bugged
  537. checkArray[4][1] = -8800; //x >
  538. checkArray[4][2] = -1100; //y >
  539. checkArray[4][3] = 0; //y <
  540.  
  541.  
  542.  
  543. } else {
  544. totalChecks = 0;
  545. }
  546.  
  547. BeamSprite=PrecacheModel("materials/sprites/lgtning.vmt");
  548. HaloSprite=PrecacheModel("materials/sprites/halo01.vmt");
  549.  
  550. BloodSpray = PrecacheModel("sprites/bloodspray.vmt");
  551. BloodDrop = PrecacheModel("sprites/blood.vmt");
  552.  
  553. War3_PrecacheSound(lightningSound);
  554. War3_PrecacheSound(wardDamageSound);
  555.  
  556. }
  557.  
  558. /* SHADOW HUNTER SWAP ABILITY BELOW */
  559. public bool:wardCheck(client)
  560. {
  561.  
  562. if (!totalChecks)
  563. return false;
  564.  
  565.  
  566. new Float:vec[3];
  567. GetClientAbsOrigin(client, vec);
  568.  
  569. for(new x=0;x<totalChecks;x++) {
  570. if (vec[0] < checkArray[x][0] && vec[0] > checkArray[x][1] && vec[1] > checkArray[x][2] && vec[1] < checkArray[x][3]) {
  571. War3_ChatMessage(client, "You cannot place wards here, cheapo!");
  572. return true;
  573. }
  574. }
  575. return false;
  576. }
  577. public OnAbilityCommand(client,ability,bool:pressed)
  578. {
  579. if(War3_GetRace(client)==thisRaceID && ability==0 && pressed && IsPlayerAlive(client))
  580. {
  581. new skill_level=War3_GetSkillLevel(client,thisRaceID,SKILL_WARD);
  582. if(skill_level>0)
  583. {
  584. if (!wardCheck(client))
  585. {
  586. if(!Silenced(client)&&CurrentWardCount[client]<WardStartingArr[skill_level])
  587. {
  588. new iTeam=GetClientTeam(client);
  589. new bool:conf_found=false;
  590. new Handle:hCheckEntities=War3_NearBuilding(client);
  591. new size_arr=0;
  592. if(hCheckEntities!=INVALID_HANDLE)
  593. size_arr=GetArraySize(hCheckEntities);
  594. for(new x=0;x<size_arr;x++)
  595. {
  596. new ent=GetArrayCell(hCheckEntities,x);
  597. if(!IsValidEdict(ent)) continue;
  598. new builder=GetEntPropEnt(ent,Prop_Send,"m_hBuilder");
  599. if(builder>0 && ValidPlayer(builder) && GetClientTeam(builder)!=iTeam)
  600. {
  601. conf_found=true;
  602. break;
  603. }
  604. }
  605. if(size_arr>0)
  606. CloseHandle(hCheckEntities);
  607. if(conf_found)
  608. {
  609. W3MsgWardLocationDeny(client);
  610. }
  611. else
  612. {
  613. if(War3_IsCloaked(client))
  614. {
  615. W3MsgNoWardWhenInvis(client);
  616. return;
  617. }
  618. CreateWard(client);
  619. CurrentWardCount[client]++;
  620. W3MsgCreatedWard(client,CurrentWardCount[client],WardStartingArr[skill_level]);
  621. }
  622. }
  623. else
  624. {
  625. W3MsgNoWardsLeft(client);
  626. }
  627. }
  628. }
  629. }
  630. }
  631.  
  632. public OnSkillLevelChanged(client,race,skill,newskilllevel)
  633. {
  634. if(race==thisRaceID)
  635. {
  636. ActivateSkills(client);
  637. //War3_SetBuff(client,fInvisibilitySkill,thisRaceID,alpha);
  638. //War3_SetBuff(client,bInvisibilityDenySkill,thisRaceID,false);
  639. }
  640. }
  641.  
  642. public OnWar3EventSpawn(client)
  643. {
  644. RemoveWards(client);
  645. for(new x=1;x<=MaxClients;x++)
  646. bBeenHit[client][x]=false;
  647. /* if(ValidPlayer(client))
  648. {
  649. if(IsFakeClient(client))
  650. {
  651. if(War3_GetRace(client)==thisRaceID)
  652. {
  653. }
  654. }
  655. }*/
  656. }
  657.  
  658. new damagestackcritmatch=-1;
  659. new Float:critpercent=0.0;
  660. public OnW3TakeDmgBulletPre(victim,attacker,Float:damage)
  661. {
  662. if(IS_PLAYER(victim)&&IS_PLAYER(attacker)&&victim>0&&attacker>0&&attacker!=victim)
  663. {
  664. new vteam=GetClientTeam(victim);
  665. new ateam=GetClientTeam(attacker);
  666. if(vteam!=ateam)
  667. {
  668. new race_attacker=War3_GetRace(attacker);
  669. new Float:chance_mod=W3ChanceModifier(attacker);
  670. if(race_attacker==thisRaceID)
  671. {
  672. new skill_cs_attacker=War3_GetSkillLevel(attacker,race_attacker,SKILL_CRIT);
  673. if(skill_cs_attacker>0&&!Hexed(attacker,false))
  674. {
  675. //new Float:chance=0.15*chance_mod;
  676. new Float:chance=0.30*chance_mod;
  677. if( GetRandomFloat(0.0,1.0)<=chance && !W3HasImmunity(victim,Immunity_Skills))
  678. {
  679. damagestackcritmatch=W3GetDamageStack();
  680. new Float:percent=CriticalStrikePercent[skill_cs_attacker]; //0.0 = zero effect -1.0 = no damage 1.0=double damage
  681. War3_DamageModPercent(percent+1.0);
  682. critpercent=percent;
  683. }
  684. }
  685. }
  686. }
  687. }
  688. }
  689.  
  690. //need event for weapon string
  691. public OnWar3EventPostHurt(victim,attacker,Float:damage, const String:weapon[32],bool:isWarcraft)
  692. {
  693. // Trigger Ultimate on bots 5% chance
  694. if(ValidPlayer(victim))
  695. {
  696. if(IsFakeClient(victim)&&War3_GetRace(victim)==thisRaceID&&W3Chance(0.05))
  697. {
  698. //DP("ultimate should trigger");
  699. OnUltimateCommand(victim,thisRaceID,true);
  700. new Float:cooldown=GetConVarFloat(ultCooldownCvar);
  701. War3_CooldownMGR(victim,cooldown,thisRaceID,ULT_LIGHTNING,true,false);
  702. }
  703. }
  704. if(victim>0&&attacker>0&&victim!=attacker)
  705. {
  706. new race_attacker=War3_GetRace(attacker);
  707.  
  708. if(race_attacker==thisRaceID)
  709. {
  710. if(damagestackcritmatch==W3GetDamageStack())
  711. {
  712. damagestackcritmatch=-1;
  713. W3PrintSkillDmgHintConsole(victim,attacker,RoundFloat(damage*critpercent/(critpercent+1.0)),SKILL_CRIT);
  714. W3FlashScreen(victim,RGBA_COLOR_RED);
  715. }
  716. }
  717. }
  718. }
  719.  
  720. /*
  721. public OnWar3EventDeath(index,attacker)
  722. {
  723. } */
  724.  
  725. /* *********************** SHADOW HUNTER SWAP ************************* */
  726.  
  727. CreateWard(client)
  728. {
  729. for(new i=0;i<MAXWARDS;i++)
  730. {
  731. if(WardOwner[i]==0)
  732. {
  733. WardOwner[i]=client;
  734. GetClientAbsOrigin(client,WardLocation[i]);
  735. break;
  736. ////CHECK BOMB HOSTAGES TO BE IMPLEMENTED
  737. }
  738. }
  739. }
  740.  
  741. RemoveWards(client)
  742. {
  743. for(new i=0;i<MAXWARDS;i++)
  744. {
  745. if(WardOwner[i]==client)
  746. {
  747. WardOwner[i]=0;
  748. }
  749. }
  750. CurrentWardCount[client]=0;
  751. }
  752.  
  753. public Action:CalcWards(Handle:timer,any:userid)
  754. {
  755. new client;
  756. for(new i=0;i<MAXWARDS;i++)
  757. {
  758. if(WardOwner[i]!=0)
  759. {
  760. client=WardOwner[i];
  761. if(!ValidPlayer(client,true))
  762. {
  763. WardOwner[i]=0; //he's dead, so no more wards for him
  764. --CurrentWardCount[client];
  765. }
  766. else
  767. {
  768. WardEffectAndDamage(client,i);
  769. }
  770. }
  771. }
  772. }
  773. public WardEffectAndDamage(owner,wardindex)
  774. {
  775. new ownerteam=GetClientTeam(owner);
  776. new beamcolor[]={0,0,200,255};
  777. if(ownerteam==2)
  778. { //TERRORISTS/RED in TF?
  779. beamcolor[0]=255;
  780. beamcolor[1]=0;
  781. beamcolor[2]=0;
  782.  
  783. beamcolor[3]=155; //red blocks more than blue, so less alpha
  784. }
  785.  
  786.  
  787. new Float:start_pos[3];
  788. new Float:end_pos[3];
  789.  
  790. new Float:tempVec1[]={0.0,0.0,WARDBELOW};
  791. new Float:tempVec2[]={0.0,0.0,WARDABOVE};
  792. AddVectors(WardLocation[wardindex],tempVec1,start_pos);
  793. AddVectors(WardLocation[wardindex],tempVec2,end_pos);
  794.  
  795. TE_SetupBeamPoints(start_pos,end_pos,BeamSprite,HaloSprite,0,GetRandomInt(30,100),0.17,float(WARDRADIUS),float(WARDRADIUS),0,0.0,beamcolor,10);
  796. TE_SendToAll();
  797.  
  798. new Float:BeamXY[3];
  799. for(new x=0;x<3;x++) BeamXY[x]=start_pos[x]; //only compare xy
  800. new Float:BeamZ= BeamXY[2];
  801. BeamXY[2]=0.0;
  802.  
  803.  
  804. new Float:VictimPos[3];
  805. new Float:tempZ;
  806. for(new i=1;i<=MaxClients;i++)
  807. {
  808. if(ValidPlayer(i,true)&& GetClientTeam(i)!=ownerteam )
  809. {
  810. GetClientAbsOrigin(i,VictimPos);
  811. tempZ=VictimPos[2];
  812. VictimPos[2]=0.0; //no Z
  813.  
  814. if(GetVectorDistance(BeamXY,VictimPos) < WARDRADIUS) ////ward RADIUS
  815. {
  816. // now compare z
  817. if(tempZ>BeamZ+WARDBELOW && tempZ < BeamZ+WARDABOVE)
  818. {
  819. if(W3HasImmunity(i,Immunity_Wards))
  820. {
  821. W3MsgSkillBlocked(i,_,"Wards");
  822. }
  823. else
  824. {
  825. //Boom!
  826. new DamageScreen[4];
  827. DamageScreen[0]=beamcolor[0];
  828. DamageScreen[1]=beamcolor[1];
  829. DamageScreen[2]=beamcolor[2];
  830. DamageScreen[3]=50; //alpha
  831. W3FlashScreen(i,DamageScreen);
  832. if(War3_DealDamage(i,WARDDAMAGE,owner,DMG_ENERGYBEAM,"wards",_,W3DMGTYPE_MAGIC))
  833. {
  834. if(LastThunderClap[i]<GetGameTime()-2)
  835. {
  836. EmitSoundToAll(wardDamageSound,i,SNDCHAN_WEAPON);
  837. LastThunderClap[i]=GetGameTime();
  838. }
  839. }
  840. }
  841. }
  842. }
  843. }
  844. }
  845.  
  846. }
Advertisement
Add Comment
Please, Sign In to add comment