Advertisement
Guest User

Untitled

a guest
Mar 8th, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.38 KB | None | 0 0
  1. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  2. class W3AardProjectile extends W3SignProjectile
  3. {
  4. protected var staminaDrainPerc : float;
  5.  
  6. event OnProjectileCollision( pos, normal : Vector, collidingComponent : CComponent, hitCollisionsGroups : array< name >, actorIndex : int, shapeIndex : int )
  7. {
  8. var projectileVictim : CProjectileTrajectory;
  9.  
  10. projectileVictim = (CProjectileTrajectory)collidingComponent.GetEntity();
  11.  
  12. if( projectileVictim )
  13. {
  14. projectileVictim.OnAardHit( this );
  15. }
  16.  
  17. super.OnProjectileCollision( pos, normal, collidingComponent, hitCollisionsGroups, actorIndex, shapeIndex );
  18. }
  19.  
  20. protected function ProcessCollision( collider : CGameplayEntity, pos, normal : Vector )
  21. {
  22. // W3EE - Begin
  23. var dmgVal : float;
  24. var sp : SAbilityAttributeValue;
  25. var isFrostAard : bool;
  26. var effectParams : SCustomEffectParams;
  27. var victimNPC : CNewNPC;
  28.  
  29. //if already hit this entity, skip
  30. if ( hitEntities.FindFirst( collider ) != -1 )
  31. {
  32. return;
  33. }
  34.  
  35. //mark that entity was hit
  36. hitEntities.PushBack( collider );
  37. super.ProcessCollision( collider, pos, normal );
  38.  
  39. //check if mutation 6 is in effect
  40. isFrostAard = ( ( W3PlayerWitcher )owner.GetPlayer() && owner.CanUseSkill(S_Magic_s12, GetSignEntity()) );
  41.  
  42. if( owner.GetPlayer().IsSwimming() )
  43. action.AddDamage(theGame.params.DAMAGE_NAME_FORCE, 20000.f);
  44.  
  45. if( isFrostAard )
  46. {
  47. action.SetBuffSourceName( "Magic_s12" );
  48. }
  49. else
  50. {
  51. dmgVal = 500.f;
  52. sp = GetSignEntity().GetTotalSignIntensity();
  53. if (owner.GetSkillLevel(S_Magic_s20, GetSignEntity()) >= 2)
  54. dmgVal += 100.f;
  55. if (owner.GetSkillLevel(S_Magic_s20, GetSignEntity()) >= 4)
  56. dmgVal += 100.f;
  57.  
  58. dmgVal *= sp.valueMultiplicative;
  59. if( signEntity.IsAlternateCast() )
  60. dmgVal *= 0.1f * owner.GetSkillLevel(S_Magic_s01, GetSignEntity());
  61. action.AddDamage( theGame.params.DAMAGE_NAME_FORCE, dmgVal );
  62. }
  63. isFrostAard = false;
  64.  
  65. action.SetHitAnimationPlayType(EAHA_ForceNo);
  66. action.SetProcessBuffsIfNoDamage(true);
  67. if( isFrostAard && victimNPC && victimNPC.IsAlive() )
  68. {
  69. ProcessFrostAard( victimNPC );
  70. }
  71. if ( !owner.IsPlayer() )
  72. {
  73. action.AddEffectInfo( EET_KnockdownTypeApplicator );
  74. }
  75.  
  76. //action.SetHitEffect('aard_hit', false, false);
  77. //action.SetHitEffect('aard_hit_back', true, false);
  78. //action.SetHitEffect('aard_hit_parried', false, true);
  79. //action.SetHitEffect('aard_hit_back_parried', true, true);
  80. theGame.damageMgr.ProcessAction( action );
  81. collider.OnAardHit( this );
  82.  
  83. if (RandRange(100, 0) < 5 + owner.GetSkillLevel(S_Magic_s06, GetSignEntity()) * 3)
  84. {
  85. victimNPC = (CNewNPC) collider;
  86. if( victimNPC && victimNPC.IsAlive() )
  87. }
  88. var noInstaKill : bool;
  89. noInstaKill = false;
  90.  
  91. //freeze or slowdown freeze
  92. //if slowdown do nothing more
  93. victimNPC.AddEffectDefault( EET_SlowdownFrost, this, "Mutation 6", true );
  94. noInstaKill = true;
  95. //add freeze effect to trigger instant kill
  96. {
  97. effectParams.effectType = EET_Confusion;
  98. effectParams.creator = owner.GetPlayer();
  99. effectParams.sourceName = 'AardShockwave';
  100. effectParams.duration = 3.f;
  101. victimNPC.AddEffectCustom(effectParams);
  102. }
  103. }
  104.  
  105. //check if both freeze & knockdown was applied to target
  106. if( EffectInteractionSuccessfull( result ) && ( victimNPC.HasBuff( EET_Knockdown ) || victimNPC.HasBuff( EET_HeavyKnockdown ) || victimNPC.GetIsRecoveringFromKnockdown() ) )
  107. {
  108. //if frozen and knocked down -> instakill
  109. var dmgVal, slowDuration, prc : float;
  110. var sp : SAbilityAttributeValue;
  111. else
  112. dmgVal = 250.f;
  113. sp = GetSignEntity().GetTotalSignIntensity();
  114. if (owner.GetSkillLevel(S_Magic_s20, GetSignEntity()) >= 2)
  115. dmgVal += 50.f;
  116. if (owner.GetSkillLevel(S_Magic_s20, GetSignEntity()) >= 4)
  117. dmgVal += 50.f;
  118.  
  119. dmgVal *= sp.valueMultiplicative;
  120. if( noInstaKill && !victimNPC.HasBuff( EET_Frozen ) )
  121. if( signEntity.IsAlternateCast() )
  122. dmgVal *= 0.1f * owner.GetSkillLevel(S_Magic_s01, GetSignEntity());
  123.  
  124. prc = victimNPC.GetNPCCustomStat(theGame.params.DAMAGE_NAME_FROST);
  125. action.AddDamage( theGame.params.DAMAGE_NAME_FORCE, dmgVal );
  126. action.AddDamage( theGame.params.DAMAGE_NAME_FROST, dmgVal );
  127. slowDuration = (2.f + owner.GetSkillLevel(S_Magic_s12, GetSignEntity() )) * sp.valueMultiplicative * (1 - prc);
  128. action.AddEffectInfo( EET_SlowdownFrost, slowDuration );
  129. }
  130. // W3EE - End
  131.  
  132. event OnAttackRangeHit( entity : CGameplayEntity )
  133. {
  134. entity.OnAardHit( this );
  135. }
  136.  
  137. public final function GetStaminaDrainPerc() : float
  138. {
  139. return staminaDrainPerc;
  140. }
  141.  
  142. public final function SetStaminaDrainPerc(p : float)
  143. {
  144. var sp : SAbilityAttributeValue;
  145. sp = GetSignEntity().GetTotalSignIntensity();
  146. staminaDrainPerc = p * sp.valueMultiplicative;
  147. }
  148. }
  149.  
  150. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  151.  
  152. class W3AxiiProjectile extends W3SignProjectile
  153. {
  154. protected function ProcessCollision( collider : CGameplayEntity, pos, normal : Vector )
  155. {
  156. DestroyAfter( 3.f );
  157.  
  158. collider.OnAxiiHit( this );
  159. //Destroy();
  160. }
  161.  
  162. protected function ShouldCheckAttitude() : bool
  163. {
  164. return false;
  165. }
  166. }
  167. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  168. class W3IgniProjectile extends W3SignProjectile
  169. {
  170. private var channelCollided : bool;
  171. private var dt : float;
  172. private var isUsed : bool;
  173.  
  174. default channelCollided = false;
  175. default isUsed = false;
  176.  
  177. // W3EE - Begin
  178. public function GetSignEntity() : W3SignEntity
  179. {
  180. return signEntity;
  181. }
  182. // W3EE - End
  183.  
  184. public function SetDT(d : float)
  185. {
  186. dt = d;
  187. }
  188.  
  189. public function IsUsed() : bool
  190. {
  191. return isUsed;
  192. }
  193.  
  194. public function SetIsUsed( used : bool )
  195. {
  196. isUsed = used;
  197. }
  198.  
  199. event OnProjectileCollision( pos, normal : Vector, collidingComponent : CComponent, hitCollisionsGroups : array< name >, actorIndex : int, shapeIndex : int )
  200. {
  201. var rot, rotImp : EulerAngles;
  202. var v, posF, pos2, n : Vector;
  203. var igniEntity : W3IgniEntity;
  204. var ent, colEnt : CEntity;
  205. var template : CEntityTemplate;
  206. var f : float;
  207. var test : bool;
  208. var postEffect : CGameplayFXSurfacePost;
  209.  
  210. channelCollided = true;
  211.  
  212. //show collision fx at the place of impact
  213. igniEntity = (W3IgniEntity)signEntity;
  214.  
  215. if(signEntity.IsAlternateCast())
  216. {
  217. //igni burn fx left on objects and terrain
  218. test = (!collidingComponent && hitCollisionsGroups.Contains( 'Terrain' ) ) || (collidingComponent && !((CActor)collidingComponent.GetEntity()));
  219.  
  220. colEnt = collidingComponent.GetEntity();
  221. if( (W3BoltProjectile)colEnt || (W3SignEntity)colEnt || (W3SignProjectile)colEnt )
  222. test = false;
  223.  
  224. if(test)
  225. {
  226. f = theGame.GetEngineTimeAsSeconds();
  227.  
  228. if(f - igniEntity.lastFxSpawnTime >= 1)
  229. {
  230. igniEntity.lastFxSpawnTime = f;
  231.  
  232. template = (CEntityTemplate)LoadResource( "igni_object_fx" );
  233.  
  234. //set rotation to normal of terrain
  235. rot.Pitch = AcosF( VecDot( Vector( 0, 0, 0 ), normal ) );
  236. rot.Yaw = this.GetHeading();
  237. rot.Roll = 0.0f;
  238.  
  239. //trace
  240. posF = pos + VecNormalize(pos - signEntity.GetWorldPosition());
  241. if(theGame.GetWorld().StaticTrace(pos, posF, pos2, n, igniEntity.projectileCollision))
  242. {
  243. ent = theGame.CreateEntity(template, pos2, rot );
  244. ent.AddTimer('TimerStopVisualFX', 5, , , , true);
  245.  
  246. postEffect = theGame.GetSurfacePostFX();
  247. postEffect.AddSurfacePostFXGroup( pos2, 0.5f, 8.0f, 10.0f, 0.3f, 1 );
  248. }
  249. }
  250. }
  251.  
  252. //collision fx
  253. if ( !hitCollisionsGroups.Contains( 'Water' ) )
  254. {
  255. //show collision fx at the place of impact
  256. v = GetWorldPosition() - signEntity.GetWorldPosition();
  257. rot = MatrixGetRotation(MatrixBuildFromDirectionVector(-v));
  258.  
  259. igniEntity.ShowChannelingCollisionFx(GetWorldPosition(), rot, -v);
  260. }
  261. }
  262.  
  263. return super.OnProjectileCollision(pos, normal, collidingComponent, hitCollisionsGroups, actorIndex, shapeIndex);
  264. }
  265.  
  266. protected function ProcessCollision( collider : CGameplayEntity, pos, normal : Vector )
  267. {
  268. var signPower, channelDmg : SAbilityAttributeValue;
  269. var burnChance : float; // chance to apply burn effect (NPC only)
  270. var maxArmorReduction : float; // by how much the armor can be reduced
  271. var applyNbr : int; // how many times base armor reduction has to be applied
  272. var i : int;
  273. var npc : CNewNPC;
  274. var armorRedAblName : name;
  275. var actorVictim : CActor;
  276. var ownerActor : CActor;
  277. var dmg : float;
  278. var performBurningTest : bool;
  279. var igniEntity : W3IgniEntity;
  280. var postEffect : CGameplayFXSurfacePost = theGame.GetSurfacePostFX();
  281. // W3EE - Begin
  282. var armorRedAttr : SAbilityAttributeValue;
  283. var currentReduction, perHitReduction, armorRedVal, pts, prc, reductionFactor, maxReductionFactor : float;
  284. // W3EE - End
  285.  
  286. postEffect.AddSurfacePostFXGroup( pos, 0.5f, 8.0f, 10.0f, 2.5f, 1 );
  287.  
  288. // this condition prevents from hitting actor twice by the same projectile
  289. if ( hitEntities.Contains( collider ) )
  290. {
  291. return;
  292. }
  293. hitEntities.PushBack( collider );
  294.  
  295. super.ProcessCollision( collider, pos, normal );
  296.  
  297. ownerActor = owner.GetActor();
  298. actorVictim = ( CActor ) action.victim;
  299. npc = (CNewNPC)collider;
  300.  
  301. signPower = signEntity.GetTotalSignIntensity();
  302. if(signEntity.IsAlternateCast())
  303. {
  304. igniEntity = (W3IgniEntity)signEntity;
  305. // W3EE - Begin
  306. performBurningTest = false;
  307. if(!actorVictim.HasBuff(EET_Burning))
  308. performBurningTest = igniEntity.UpdateBurningChance(actorVictim, dt);
  309. // W3EE - End
  310.  
  311.  
  312. // if target was already hit then skip initial damage, also skip the hit particle
  313. // signPower = signEntity.GetTotalSignIntensity();
  314. if( igniEntity.hitEntities.Contains( collider ) )
  315. {
  316. channelCollided = true;
  317. action.SetHitEffect('');
  318. action.SetHitEffect('', true );
  319. action.SetHitEffect('', false, true);
  320. action.SetHitEffect('', false, true);
  321. action.SetHitEffect('', false, true);
  322. action.SetHitEffect('', true, true);
  323. action.ClearDamage();
  324.  
  325. //add channeling damage
  326. // W3EE - Begin
  327. // channelDmg = owner.GetSkillAttributeValue(signSkill, 'channeling_damage', false, true);
  328. dmg = 800.f + GetSignEntity().GetActualOwner().GetSkillLevel(S_Magic_s09, GetSignEntity()) * 100;
  329. dmg *= signPower.valueMultiplicative;
  330. if(actorVictim.HasBuff(EET_Burning))
  331. dmg *= 0.6f;
  332. // W3EE - End
  333. dmg *= dt;
  334. action.AddDamage(theGame.params.DAMAGE_NAME_FIRE, dmg);
  335. action.SetIsDoTDamage(dt);
  336.  
  337. if(!collider) //if no target (just showing impact fx) then exit
  338. return;
  339. }
  340. else
  341. {
  342. igniEntity.hitEntities.PushBack( collider );
  343. }
  344.  
  345. if(!performBurningTest)
  346. {
  347. action.ClearEffects();
  348. }
  349.  
  350. if( !actorVictim.HasBuff(EET_SlowdownFirestream) && !actorVictim.HasBuff(EET_Burning) )
  351. actorVictim.AddEffectDefault(EET_SlowdownFirestream, ownerActor,,true);
  352.  
  353. actorVictim.AddTimer('Runeword1DisableFireFX', 1.f, false,,,, true);
  354. if( !actorVictim.IsEffectActive('critical_burning') )
  355. {
  356. actorVictim.PlayEffect('critical_burning');
  357. actorVictim.PlayEffect('critical_burning_csx');
  358. }
  359. }
  360.  
  361. //if npc is shielded do not take any dmg
  362. if ( npc && npc.IsShielded( ownerActor ) )
  363. {
  364. collider.OnIgniHit( this );
  365. return;
  366. }
  367.  
  368. // Claculate sign spellpower, taking target resistances into consideration
  369. // signPower = ownerActor.GetTotalSignSpellPower(S_Magic_s02);
  370.  
  371. // a piece of custom code for calculating burning effect
  372. if ( !owner.IsPlayer() )
  373. {
  374. signPower = ownerActor.GetTotalSignSpellPower(S_Magic_s02);
  375. burnChance = signPower.valueMultiplicative;
  376. if ( RandF() < burnChance )
  377. {//VIO
  378. action.AddEffectInfo(EET_Burning);
  379. action.AddEffectInfo(EET_Burning);
  380. action.AddEffectInfo(EET_Burning);
  381. }
  382.  
  383. dmg = CalculateAttributeValue(signPower);
  384. if ( dmg <= 0 )
  385. {
  386. dmg = 20;
  387. }
  388. action.AddDamage( theGame.params.DAMAGE_NAME_FIRE, dmg);
  389. }
  390.  
  391. if(signEntity.IsAlternateCast())
  392. {
  393. action.SetHitAnimationPlayType(EAHA_ForceNo);
  394. }
  395. else
  396. {//VIO
  397. action.SetHitEffect('igni_cone_hit', false, false);
  398. action.SetHitEffect('igni_cone_hit', true, false);
  399. action.SetHitEffect('igni_cone_hit', false, true);
  400. action.SetHitEffect('igni_cone_hit', true, false);
  401. action.SetHitReactionType(EHRT_Igni, false);
  402. }
  403.  
  404. theGame.damageMgr.ProcessAction( action );
  405.  
  406. // Melt armor
  407. // W3EE - Begin
  408. if ( owner.CanUseSkill(S_Magic_s08, GetSignEntity()) && npc )
  409. {
  410. prc = npc.GetNPCCustomStat(theGame.params.DAMAGE_NAME_FIRE);
  411.  
  412. maxArmorReduction = CalculateAttributeValue(owner.GetSkillAttributeValue(S_Magic_s08, 'max_armor_reduction', false, true)) * GetSignEntity().GetActualOwner().GetSkillLevel(S_Magic_s08, GetSignEntity());
  413. maxReductionFactor = 0.02f * GetSignEntity().GetActualOwner().GetSkillLevel(S_Magic_s08, GetSignEntity()) * signPower.valueMultiplicative;
  414. if ( !npc.IsProtectedByArmor() )
  415. {
  416. maxArmorReduction *= 0.5f;
  417. maxReductionFactor *= 0.5f;
  418. }
  419. reductionFactor = MinF(1, maxReductionFactor * MaxF(0.25f, 1 - prc));
  420. if( signEntity.IsAlternateCast() )
  421. {
  422. reductionFactor = MinF(1, reductionFactor * dt);
  423. }
  424.  
  425. reductionFactor = ClampF(reductionFactor, 0.f, maxArmorReduction - npc.GetTotalArmorReduction()) * -1.f;
  426. npc.ModifyArmorValue(reductionFactor);
  427. }
  428. // W3EE - End
  429. collider.OnIgniHit( this );
  430. }
  431.  
  432. event OnAttackRangeHit( entity : CGameplayEntity )
  433. {
  434. entity.OnIgniHit( this );
  435. }
  436.  
  437. //range fx
  438. event OnRangeReached()
  439. {
  440. var v : Vector;
  441. var rot : EulerAngles;
  442.  
  443. //projectile keeps flying e.g. through actors so we need to check if it hit something before or not
  444. if(!channelCollided)
  445. {
  446. //collision fx
  447. v = GetWorldPosition() - signEntity.GetWorldPosition();
  448. rot = MatrixGetRotation(MatrixBuildFromDirectionVector(-v));
  449. ((W3IgniEntity)signEntity).ShowChannelingRangeFx(GetWorldPosition(), rot);
  450. }
  451.  
  452. isUsed = false;
  453.  
  454. super.OnRangeReached();
  455. }
  456.  
  457. public function IsProjectileFromChannelMode() : bool
  458. {
  459. return signSkill == S_Magic_s02;
  460. }
  461. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement