Advertisement
Hird194

Unexpected end of file before comment at line '2' was closed

Oct 23rd, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.83 KB | None | 0 0
  1. /***********************************************************************/
  2. /** © 2015 CD PROJEKT S.A. All rights reserved.
  3. /** THE WITCHER® is a trademark of CD PROJEKT S. A.
  4.  
  5.  
  6. class W3AardProjectile extends W3SignProjectile
  7. {
  8. protected function ProcessCollision( collider : CGameplayEntity, pos, normal : Vector )
  9. {
  10. var dmgVal : float;
  11. var sp : SAbilityAttributeValue;
  12. //if already hit this entity, skip
  13. if ( hitEntities.FindFirst( collider ) != -1 )
  14. {
  15. return;
  16. }
  17. //mark that entity was hit
  18. hitEntities.PushBack( collider );
  19.  
  20. super.ProcessCollision( collider, pos, normal );
  21.  
  22. victimNPC = (CNewNPC) collider;
  23. action.SetHitAnimationPlayType(EAHA_ForceNo);
  24. //check if mutation 6 is in effect
  25. action.SetProcessBuffsIfNoDamage(true);
  26. if( IsRequiredAttitudeBetween(victimNPC, caster, true )
  27. if ( owner.CanUseSkill(S_Magic_s06)
  28. isMutation6 = ( ( W3PlayerWitcher )owner.GetPlayer() && GetWitcherPlayer().IsMutationActive( EPMT_Mutation6 ) );
  29. if( isMutation6 )
  30. {
  31. action.SetBuffSourceName( "Mutation6" );
  32. }
  33. else if ( owner.CanUseSkill(S_Magic_s06) )
  34. isMutation6 = ( ( W3PlayerWitcher )owner.GetPlayer() && GetWitcherPlayer().IsMutationActive( EPMT_Mutation6 ) );
  35. if( isMutation6 )
  36. {
  37. action.SetBuffSourceName( "Mutation6" );
  38. }
  39. else if ( owner.CanUseSkill(S_Magic_s06) )
  40.  
  41. //add skill bonus damage but only if we don't have mutation 6 - otherwise target might die due to skill and thus won't be frost-dismembered
  42. dmgVal = GetWitcherPlayer().GetSkillLevel(S_Magic_s06) * CalculateAttributeValue( owner.GetSkillAttributeValue( S_Magic_s06, theGame.params.DAMAGE_NAME_FORCE, false, true ) );
  43. action.AddDamage( theGame.params.DAMAGE_NAME_FORCE, dmgVal );
  44. }
  45.  
  46. //HAXXOR
  47. if ( !owner.IsPlayer() )
  48. {
  49. action.AddEffectInfo( EET_KnockdownTypeApplicator );
  50. }
  51.  
  52. //action.SetHitEffect('aard_hit', false, false);
  53. //action.SetHitEffect('aard_hit_back', true, false);
  54. //action.SetHitEffect('aard_hit_parried', false, true);
  55. //action.SetHitEffect('aard_hit_back_parried', true, true);
  56.  
  57. theGame.damageMgr.ProcessAction( action );
  58.  
  59. collider.OnAardHit( this );
  60.  
  61. if( isMutation6 && victimNPC && victimNPC.IsAlive() )
  62. //freeze + if enemy is knocked down - instant kill
  63. if( isMutation6 )
  64.  
  65. victimNPC = (CNewNPC) collider;
  66. if( victimNPC && victimNPC.IsAlive() )
  67. {
  68. ProcessMutation6( victimNPC );
  69. }
  70.  
  71. {
  72. ProcessMutation6( victimNPC );
  73. }
  74. }
  75.  
  76. var instaKill, hasKnockdown, applySlowdown : bool;
  77. var noInstaKill : bool;
  78. noInstaKill = false;
  79.  
  80. //freeze or slowdown freeze
  81.  
  82. applySlowdown = true;
  83. instaKill = false;
  84. //if slowdown do nothing more
  85. victimNPC.AddEffectDefault( EET_SlowdownFrost, this, "Mutation 6", true );
  86. noInstaKill = true;
  87. //add freeze effect to trigger instant kill
  88.  
  89. if( EffectInteractionSuccessfull( result ) && hasKnockdown )
  90. //check if both freeze & knockdown was applied to target
  91. if( EffectInteractionSuccessfull( result ) && ( victimNPC.HasBuff( EET_Knockdown ) || victimNPC.HasBuff( EET_HeavyKnockdown ) || victimNPC.GetIsRecoveringFromKnockdown() ) )
  92. //if frozen and knocked down -> instakill
  93. else
  94.  
  95. victimNPC.AddEffectDefault( EET_SlowdownFrost, this, "Mutation 6", true );
  96. noInstaKill = true;
  97. }
  98.  
  99. if( !instaKill && !victimNPC.HasBuff( EET_Frozen ) )
  100. //if not instakilling then deal additional damage. If this kills target, it should dismember as well
  101. if( noInstaKill && !victimNPC.HasBuff( EET_Frozen ) )
  102. }
  103.  
  104. event OnAttackRangeHit( entity : CGameplayEntity )
  105. {
  106. entity.OnAardHit( this );
  107. }
  108. }
  109.  
  110. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  111.  
  112. class W3AxiiProjectile extends W3SignProjectile
  113. {
  114. protected function ProcessCollision( collider : CGameplayEntity, pos, normal : Vector )
  115. {
  116. DestroyAfter( 3.f );
  117.  
  118. collider.OnAxiiHit( this );
  119. //Destroy();
  120. }
  121.  
  122. protected function ShouldCheckAttitude() : bool
  123. {
  124. return false;
  125. }
  126. }
  127. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  128. class W3IgniProjectile extends W3SignProjectile
  129. {
  130. private var channelCollided : bool;
  131. private var dt : float;
  132. private var isUsed : bool;
  133.  
  134. default channelCollided = false;
  135. default isUsed = false;
  136.  
  137. public function SetDT(d : float)
  138. {
  139. dt = d;
  140. }
  141.  
  142. public function IsUsed() : bool
  143. {
  144. return isUsed;
  145. }
  146.  
  147. public function SetIsUsed( used : bool )
  148. {
  149. isUsed = used;
  150. }
  151.  
  152. event OnProjectileCollision( pos, normal : Vector, collidingComponent : CComponent, hitCollisionsGroups : array< name >, actorIndex : int, shapeIndex : int )
  153. {
  154. var rot, rotImp : EulerAngles;
  155. var v, posF, pos2, n : Vector;
  156. var igniEntity : W3IgniEntity;
  157. var ent, colEnt : CEntity;
  158. var template : CEntityTemplate;
  159. var f : float;
  160. var test : bool;
  161. var postEffect : CGameplayFXSurfacePost;
  162.  
  163. channelCollided = true;
  164.  
  165. //show collision fx at the place of impact
  166. igniEntity = (W3IgniEntity)signEntity;
  167.  
  168. if(signEntity.IsAlternateCast())
  169. {
  170. //igni burn fx left on objects and terrain
  171. test = (!collidingComponent && hitCollisionsGroups.Contains( 'Terrain' ) ) || (collidingComponent && !((CActor)collidingComponent.GetEntity()));
  172.  
  173. colEnt = collidingComponent.GetEntity();
  174. if( (W3BoltProjectile)colEnt || (W3SignEntity)colEnt || (W3SignProjectile)colEnt )
  175. test = false;
  176.  
  177. if(test)
  178. {
  179. f = theGame.GetEngineTimeAsSeconds();
  180.  
  181. if(f - igniEntity.lastFxSpawnTime >= 1)
  182. {
  183. igniEntity.lastFxSpawnTime = f;
  184.  
  185. template = (CEntityTemplate)LoadResource( "igni_object_fx" );
  186.  
  187. //set rotation to normal of terrain
  188. rot.Pitch = AcosF( VecDot( Vector( 0, 0, 0 ), normal ) );
  189. rot.Yaw = this.GetHeading();
  190. rot.Roll = 0.0f;
  191.  
  192. //trace
  193. posF = pos + VecNormalize(pos - signEntity.GetWorldPosition());
  194. if(theGame.GetWorld().StaticTrace(pos, posF, pos2, n, igniEntity.projectileCollision))
  195. {
  196. ent = theGame.CreateEntity(template, pos2, rot );
  197. ent.AddTimer('TimerStopVisualFX', 5, , , , true);
  198.  
  199. postEffect = theGame.GetSurfacePostFX();
  200. postEffect.AddSurfacePostFXGroup( pos2, 0.5f, 8.0f, 10.0f, 0.3f, 1 );
  201. }
  202. }
  203. }
  204.  
  205. //collision fx
  206. if ( !hitCollisionsGroups.Contains( 'Water' ) )
  207. {
  208. //show collision fx at the place of impact
  209. v = GetWorldPosition() - signEntity.GetWorldPosition();
  210. rot = MatrixGetRotation(MatrixBuildFromDirectionVector(-v));
  211.  
  212. igniEntity.ShowChannelingCollisionFx(GetWorldPosition(), rot, -v);
  213. }
  214. }
  215.  
  216. return super.OnProjectileCollision(pos, normal, collidingComponent, hitCollisionsGroups, actorIndex, shapeIndex);
  217. }
  218.  
  219. protected function ProcessCollision( collider : CGameplayEntity, pos, normal : Vector )
  220. {
  221. var signPower, channelDmg : SAbilityAttributeValue;
  222. var burnChance : float; // chance to apply burn effect (NPC only)
  223. var maxArmorReduction : float; // by how much the armor can be reduced
  224. var applyNbr : int; // how many times base armor reduction has to be applied
  225. var i : int;
  226. var npc : CNewNPC;
  227. var armorRedAblName : name;
  228. var currentReduction : int;
  229. var actorVictim : CActor;
  230. var ownerActor : CActor;
  231. var dmg : float;
  232. var performBurningTest : bool;
  233. var igniEntity : W3IgniEntity;
  234. var postEffect : CGameplayFXSurfacePost = theGame.GetSurfacePostFX();
  235.  
  236. postEffect.AddSurfacePostFXGroup( pos, 0.5f, 8.0f, 10.0f, 2.5f, 1 );
  237.  
  238. // this condition prevents from hitting actor twice by the same projectile
  239. if ( hitEntities.Contains( collider ) )
  240. {
  241. return;
  242. }
  243. hitEntities.PushBack( collider );
  244.  
  245. super.ProcessCollision( collider, pos, normal );
  246.  
  247. ownerActor = owner.GetActor();
  248. actorVictim = ( CActor ) action.victim;
  249. npc = (CNewNPC)collider;
  250.  
  251. //igni burning
  252. if(signEntity.IsAlternateCast())
  253. {
  254. igniEntity = (W3IgniEntity)signEntity;
  255. performBurningTest = igniEntity.UpdateBurningChance(actorVictim, dt);
  256. //VIO
  257.  
  258.  
  259. // if target was already hit then skip initial damage, also skip the hit particle
  260. // this condition prevents from hitting actor twice by the the whole igni entity
  261. if( igniEntity.hitEntities.Contains( collider ) )
  262. {
  263. channelCollided = true;
  264. action.SetHitEffect('');
  265. action.SetHitEffect('', true );
  266. action.SetHitEffect('', false, true);
  267. action.SetHitEffect('', false, true);
  268. action.SetHitEffect('', false, true);
  269. action.SetHitEffect('', true, true);
  270. action.ClearDamage();
  271.  
  272. //add channeling damage
  273. channelDmg = owner.GetSkillAttributeValue(signSkill, 'channeling_damage', false, true);
  274. dmg = channelDmg.valueAdditive + channelDmg.valueMultiplicative * actorVictim.GetMaxHealth();
  275. dmg *= dt;
  276. action.AddDamage(theGame.params.DAMAGE_NAME_FIRE, dmg);
  277. action.SetIsDoTDamage(dt);
  278.  
  279. if(!collider) //if no target (just showing impact fx) then exit
  280. return;
  281. }
  282. else
  283. {
  284. igniEntity.hitEntities.PushBack( collider );
  285. }
  286.  
  287. if(!performBurningTest)
  288. {
  289. action.ClearEffects();
  290. }
  291. }
  292.  
  293. //if npc is shielded do not take any dmg
  294. if ( npc && npc.IsShielded( ownerActor ) )
  295. {
  296. collider.OnIgniHit( this );
  297. return;
  298. }
  299.  
  300. // Claculate sign spellpower, taking target resistances into consideration
  301. signPower = signEntity.GetOwner().GetTotalSignSpellPower(signEntity.GetSkill());
  302.  
  303. // a piece of custom code for calculating burning effect
  304. if ( !owner.IsPlayer() )
  305. {
  306. //NPCs
  307. burnChance = signPower.valueMultiplicative;
  308. if ( RandF() < burnChance )
  309. {//VIO
  310. action.AddEffectInfo(EET_Burning);
  311. action.AddEffectInfo(EET_Burning);
  312. action.AddEffectInfo(EET_Burning);
  313. }
  314.  
  315. dmg = CalculateAttributeValue(signPower);
  316. if ( dmg <= 0 )
  317. {
  318. dmg = 20;
  319. }
  320. action.AddDamage( theGame.params.DAMAGE_NAME_FIRE, dmg);
  321. }
  322.  
  323. if(signEntity.IsAlternateCast())
  324. {
  325. action.SetHitAnimationPlayType(EAHA_ForceNo);
  326. }
  327. else
  328. {//VIO
  329. action.SetHitEffect('igni_cone_hit', false, false);
  330. action.SetHitEffect('igni_cone_hit', true, false);
  331. action.SetHitEffect('igni_cone_hit', false, true);
  332. action.SetHitEffect('igni_cone_hit', true, false);
  333. action.SetHitReactionType(EHRT_Igni, false);
  334. }
  335.  
  336. theGame.damageMgr.ProcessAction( action );
  337.  
  338. // Melt armor
  339. if ( owner.CanUseSkill(S_Magic_s08) && (CActor)collider)
  340. {
  341. maxArmorReduction = CalculateAttributeValue(owner.GetSkillAttributeValue(S_Magic_s08, 'max_armor_reduction', false, true)) * GetWitcherPlayer().GetSkillLevel(S_Magic_s08);
  342. applyNbr = RoundMath( 100 * maxArmorReduction * ( signPower.valueMultiplicative / theGame.params.MAX_SPELLPOWER_ASSUMED ) );
  343.  
  344. armorRedAblName = SkillEnumToName(S_Magic_s08);
  345. currentReduction = ((CActor)collider).GetAbilityCount(armorRedAblName);
  346.  
  347. applyNbr -= currentReduction;
  348.  
  349. for ( i = 0; i < applyNbr; i += 1 )
  350. action.victim.AddAbility(armorRedAblName, true);
  351. }
  352. collider.OnIgniHit( this );
  353. }
  354.  
  355. event OnAttackRangeHit( entity : CGameplayEntity )
  356. {
  357. entity.OnIgniHit( this );
  358. }
  359.  
  360. //range fx
  361. event OnRangeReached()
  362. {
  363. var v : Vector;
  364. var rot : EulerAngles;
  365.  
  366. //projectile keeps flying e.g. through actors so we need to check if it hit something before or not
  367. if(!channelCollided)
  368. {
  369. //collision fx
  370. v = GetWorldPosition() - signEntity.GetWorldPosition();
  371. rot = MatrixGetRotation(MatrixBuildFromDirectionVector(-v));
  372. ((W3IgniEntity)signEntity).ShowChannelingRangeFx(GetWorldPosition(), rot);
  373. }
  374.  
  375. isUsed = false;
  376.  
  377. super.OnRangeReached();
  378. }
  379.  
  380. public function IsProjectileFromChannelMode() : bool
  381. {
  382. return signSkill == S_Magic_s02;
  383. }
  384. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement