Advertisement
Guest User

Untitled

a guest
Feb 1st, 2020
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 152.99 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. /** The Witcher game is based on the prose of Andrzej Sapkowski.
  5. /***********************************************************************/
  6.  
  7.  
  8.  
  9. enum EConverserType
  10. {
  11. CT_General,
  12. CT_Nobleman,
  13. CT_Guard,
  14. CT_Mage,
  15. CT_Bandit,
  16. CT_Scoiatael,
  17. CT_Peasant,
  18. CT_Poor,
  19. CT_Child
  20. };
  21.  
  22.  
  23. statemachine import class CNewNPC extends CActor
  24. {
  25.  
  26.  
  27.  
  28. editable var isImmortal : bool;
  29. editable var isInvulnerable : bool;
  30. editable var willBeUnconscious : bool;
  31. editable var minUnconsciousTime : float; default minUnconsciousTime = 20.f;
  32.  
  33. editable var unstoppable : bool; hint unstoppable = "won't play hit reaction nor critical state reaction";
  34.  
  35. editable var RemainsTags : array<name>; hint RemainsTags="If set then the NPC's remains will be tagged with given tags";
  36. editable var level : int; default level = 1;
  37. var currentLevel : int;
  38. editable saved var levelFakeAddon : int; default levelFakeAddon = 0;
  39. private saved var newGamePlusFakeLevelAddon : bool; default newGamePlusFakeLevelAddon = false;
  40. private saved var xmlLevel : SAbilityAttributeValue;
  41. private var isXmlLevelSet : bool; default isXmlLevelSet = false;
  42. editable var isMiniBossLevel : bool; default isMiniBossLevel = false;
  43. import var suppressBroadcastingReactions : bool;
  44. editable saved var dontUseReactionOneLiners : bool; default dontUseReactionOneLiners = false;
  45. editable saved var disableConstrainLookat : bool; default disableConstrainLookat = false;
  46.  
  47. editable var isMonsterType_Group : bool; default isMonsterType_Group = false;
  48.  
  49. editable var useSoundValue : bool; default useSoundValue = false;
  50. editable var soundValue : int;
  51.  
  52.  
  53. editable var clearInvOnDeath : bool;
  54. default clearInvOnDeath = false;
  55.  
  56. editable var noAdaptiveBalance : bool;
  57. default noAdaptiveBalance = false;
  58.  
  59. editable var grantNoExperienceAfterKill : bool;
  60. default grantNoExperienceAfterKill = false;
  61.  
  62. editable var abilityBuffStackedOnEnemyHitName : name;
  63.  
  64.  
  65. // W3EE - Begin
  66. public var levelBonusesComputedAtPlayerLevel : int; default levelBonusesComputedAtPlayerLevel = -1;
  67. // W3EE - End
  68.  
  69. hint abilityBuffStackedOnEnemyHitName = "Stackable ability added on hitting enemies. Mainly for damage scaling of followers.";
  70. hint disableConstrainLookat = "It will disable lookats form reactions and from QuestLookat block";
  71. hint useSoundValue = "If true it will add the SoundValue to the threat Rating used for combat music control";
  72. hint soundValue = "This value will be added or subtracted from sound system to achieve final threat Rating";
  73.  
  74.  
  75.  
  76. import private saved var npcGroupType : ENPCGroupType; default npcGroupType = ENGT_Enemy;
  77.  
  78.  
  79. private optional autobind horseComponent : W3HorseComponent = single;
  80. private var isHorse : bool;
  81. private saved var canFlee : bool; default canFlee = true;
  82. private var isFallingFromHorse : bool; default isFallingFromHorse = false;
  83.  
  84. private var immortalityInitialized : bool;
  85.  
  86.  
  87. private var canBeFollowed : bool; default canBeFollowed = false;
  88.  
  89.  
  90. private var bAgony : bool; default bAgony = false;
  91. private var bFinisher : bool; default bFinisher = false;
  92. private var bPlayDeathAnim : bool; default bPlayDeathAnim = true;
  93. private var bAgonyDisabled : bool; default bAgonyDisabled = false;
  94. private var bFinisherInterrupted : bool;
  95.  
  96. private var bIsInHitAnim : bool;
  97.  
  98.  
  99. private var threatLevel : int; default threatLevel = 10;
  100. private var counterWindowStartTime : EngineTime;
  101. private var bIsCountering : bool;
  102. private var allowBehGraphChange : bool; default allowBehGraphChange = true;
  103. private var aardedFlight : bool;
  104. public var lastMeleeHitTime : EngineTime;
  105.  
  106. private saved var preferedCombatStyle : EBehaviorGraph;
  107.  
  108.  
  109. private var previousStance : ENpcStance; default previousStance = NS_Normal;
  110. private var regularStance : ENpcStance; default regularStance = NS_Normal;
  111.  
  112.  
  113. private var currentFightStage : ENPCFightStage;
  114.  
  115.  
  116. private var currentState : CName; default autoState = 'NewIdle';
  117.  
  118. private var behaviorGraphEventListened : array<name>;
  119.  
  120.  
  121. private var isTemporaryOffGround : bool;
  122.  
  123.  
  124. private var npc_health_bar : float;
  125.  
  126.  
  127. private var isUnderwater : bool; default isUnderwater = false;
  128.  
  129.  
  130. private var isTranslationScaled : bool;
  131.  
  132.  
  133. private var tauntedToAttackTimeStamp : float;
  134.  
  135.  
  136.  
  137.  
  138.  
  139. public var isTeleporting : bool; default isTeleporting = false;
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147. public var itemToEquip : SItemUniqueId;
  148.  
  149.  
  150. private saved var wasBleedingBurningPoisoned : bool; default wasBleedingBurningPoisoned = false;
  151.  
  152.  
  153. public var wasInTalkInteraction : bool;
  154. private var wasInCutscene : bool;
  155. public var shieldDebris : CItemEntity;
  156. public var lastMealTime : float; default lastMealTime = -1;
  157. public var packName : name;
  158. public var isPackLeader : bool;
  159. private var mac : CMovingPhysicalAgentComponent;
  160. private var parentEncounter : CEncounter;
  161. public var npcLevelToUpscaledLevelDifference : int;
  162.  
  163.  
  164. private saved var isTalkDisabled : bool; default isTalkDisabled = false;
  165. private var isTalkDisabledTemporary : bool; default isTalkDisabledTemporary = false;
  166.  
  167.  
  168. private var wasNGPlusLevelAdded : bool; default wasNGPlusLevelAdded = false;
  169.  
  170. private var deathTimestamp : float;
  171.  
  172. private var weatherAbilityHandler : W3EEAbilityHandler;
  173.  
  174.  
  175. event OnGameDifficultyChanged( previousDifficulty : int, currentDifficulty : int )
  176. {
  177. if ( HasAbility('difficulty_CommonEasy') ) RemoveAbility('difficulty_CommonEasy');
  178. if ( HasAbility('difficulty_CommonMedium') ) RemoveAbility('difficulty_CommonMedium');
  179. if ( HasAbility('difficulty_CommonHard') ) RemoveAbility('difficulty_CommonHard');
  180. if ( HasAbility('difficulty_CommonHardcore') ) RemoveAbility('difficulty_CommonHardcore');
  181.  
  182. switch ( theGame.GetSpawnDifficultyMode() )
  183. {
  184. case EDM_Easy:
  185. AddAbility('difficulty_CommonEasy');
  186. break;
  187. case EDM_Medium:
  188. AddAbility('difficulty_CommonMedium');
  189. break;
  190. case EDM_Hard:
  191. AddAbility('difficulty_CommonHard');
  192. break;
  193. case EDM_Hardcore:
  194. AddAbility('difficulty_CommonHardcore');
  195. break;
  196. }
  197.  
  198. levelBonusesComputedAtPlayerLevel = -1;
  199. // W3EE - Begin
  200. SetWasScaled(false);
  201. // W3EE - End
  202. AddTimer('AddLevelBonuses', 0.1, true, false, , true);
  203. }
  204.  
  205. event OnLevelUpscalingChanged()
  206. {
  207. levelBonusesComputedAtPlayerLevel = -1;
  208. AddTimer('AddLevelBonuses', RandRangeF(0.05,0.2), true, false, , true);
  209. }
  210.  
  211. timer function ResetTalkInteractionFlag( td : float , id : int)
  212. {
  213. if ( !IsSpeaking() )
  214. {
  215. wasInTalkInteraction = false;
  216. RemoveTimer('ResetTalkInteractionFlag');
  217. }
  218. }
  219.  
  220. protected function OnCombatModeSet( toggle : bool )
  221. {
  222. super.OnCombatModeSet( toggle );
  223.  
  224. if( toggle )
  225. {
  226. SetCombatStartTime();
  227. SetCombatPartStartTime();
  228.  
  229.  
  230.  
  231.  
  232. RecalcLevel();
  233. }
  234. else
  235. {
  236. ResetCombatStartTime();
  237. ResetCombatPartStartTime();
  238. }
  239. }
  240.  
  241. public function SetImmortalityInitialized(){ immortalityInitialized = true; }
  242.  
  243. public function SetNPCType( type : ENPCGroupType ) { npcGroupType = type; }
  244. public function GetNPCType() : ENPCGroupType { return npcGroupType; }
  245.  
  246. public function GetBloodType() : EBloodType
  247. {
  248. var tmpName : name;
  249. var tmpBool : bool;
  250. var mc : EMonsterCategory;
  251. var blood : EBloodType;
  252.  
  253. theGame.GetMonsterParamsForActor(this, mc, tmpName, tmpBool, tmpBool, tmpBool);
  254.  
  255. switch( mc )
  256. {
  257. case MC_Specter :
  258. case MC_Vampire :
  259. case MC_Magicals :
  260. blood = BT_Black;
  261. break;
  262.  
  263. case MC_Cursed :
  264. blood = BT_Yellow;
  265. break;
  266.  
  267. case MC_Insectoid :
  268. blood = BT_Green;
  269. break;
  270.  
  271. case MC_Troll :
  272. case MC_Human :
  273. case MC_Animal :
  274. case MC_Necrophage :
  275. case MC_Hybrid :
  276. case MC_Relic :
  277. case MC_Beast :
  278. case MC_Draconide :
  279. default :
  280. blood = BT_Red;
  281. }
  282.  
  283. return blood;
  284. }
  285.  
  286. public function SetCanBeFollowed( val : bool ) { canBeFollowed = val; }
  287. public function CanBeFollowed() : bool { return canBeFollowed; }
  288.  
  289. event OnPreAttackEvent(animEventName : name, animEventType : EAnimationEventType, data : CPreAttackEventData, animInfo : SAnimationEventAnimInfo )
  290. {
  291. var witcher : W3PlayerWitcher;
  292. // var levelDiff : int;
  293. var blizzard : W3Potion_Blizzard;
  294. var yrden : W3YrdenEntity;
  295. var yrdenAlternate : W3YrdenEntityStateYrdenShock;
  296.  
  297. super.OnPreAttackEvent(animEventName, animEventType, data, animInfo);
  298.  
  299. if(animEventType == AET_DurationStart )
  300. {
  301.  
  302.  
  303. witcher = GetWitcherPlayer();
  304.  
  305.  
  306.  
  307. // W3EE - Begin
  308. if(GetTarget() == witcher )
  309. {
  310. /*levelDiff = GetLevel() - witcher.GetLevel();
  311.  
  312. if ( levelDiff < theGame.params.LEVEL_DIFF_DEADLY )*/
  313. this.SetDodgeFeedback( true );
  314.  
  315. blizzard = (W3Potion_Blizzard)thePlayer.GetBuff(EET_Blizzard);
  316. if( (blizzard) && (thePlayer.IsActionAllowed(EIAB_Dodge) || thePlayer.IsActionAllowed(EIAB_Roll)) )
  317. blizzard.KilledEnemy();
  318.  
  319. yrden = (W3YrdenEntity)witcher.GetSignEntity(ST_Yrden);
  320. yrdenAlternate = (W3YrdenEntityStateYrdenShock)yrden.GetCurrentState();
  321. yrdenAlternate.SetWardingGlyphTargets(this);
  322. }
  323.  
  324. /*
  325. if ( IsCountering() )
  326. {
  327. if(GetTarget() == witcher && ( thePlayer.IsActionAllowed(EIAB_Dodge) || thePlayer.IsActionAllowed(EIAB_Roll) ) && witcher.GetStat(BCS_Toxicity, false) > theGame.params.TOXICITY_DAMAGE_THRESHOLD && witcher.CanUseSkill(S_Alchemy_s16))
  328. witcher.StartFrenzy();
  329. }
  330. */
  331. // W3EE - End
  332. }
  333. else if(animEventType == AET_DurationEnd )
  334. {
  335. witcher = GetWitcherPlayer();
  336.  
  337. if(GetTarget() == witcher )
  338. {
  339. this.SetDodgeFeedback( false );
  340. }
  341. }
  342. }
  343.  
  344. public function SetDodgeFeedback( flag : bool )
  345. {
  346.  
  347. if ( flag )
  348. {
  349. thePlayer.SetDodgeFeedbackTarget( this );
  350. }
  351. else
  352. {
  353. thePlayer.SetDodgeFeedbackTarget( NULL );
  354. }
  355. }
  356.  
  357. event OnBlockingSceneEnded( optional output : CStorySceneOutput)
  358. {
  359. super.OnBlockingSceneEnded( output );
  360. wasInCutscene = true;
  361. }
  362.  
  363. public function WasInCutscene() : bool
  364. {
  365. return wasInCutscene;
  366. }
  367.  
  368.  
  369. public function IsVIP() : bool
  370. {
  371. var tags : array<name>;
  372. var i : int;
  373.  
  374.  
  375. tags = GetTags();
  376. for ( i = 0; i < tags.Size(); i+=1 )
  377. {
  378. if ( tags[i] == 'vip' )
  379. {
  380. return true;
  381. }
  382. }
  383.  
  384. return false;
  385. }
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392. event OnSpawned(spawnData : SEntitySpawnData )
  393. {
  394. var lvlDiff, playerLevel: int;
  395. var heading : float;
  396. var remainingDuration : float;
  397. var oldLevel : int;
  398.  
  399. currentLevel = level;
  400. levelBonusesComputedAtPlayerLevel = -1;
  401.  
  402. // W3EE - Begin
  403. SetWasScaled(false);
  404. // W3EE - End
  405.  
  406. super.OnSpawned(spawnData);
  407.  
  408. // W3EE - Begin
  409. Enemies().CacheNPCData(this, npcStats);
  410. // W3EE - End
  411.  
  412. SetThreatLevel();
  413.  
  414.  
  415. GotoStateAuto();
  416.  
  417.  
  418. isTalkDisabledTemporary = false;
  419.  
  420.  
  421. if ( HasTag( 'fergus_graem' ) )
  422. {
  423. if ( !isTalkDisabled )
  424. {
  425. GetComponent( 'talk' ).SetEnabled( true );
  426. }
  427. }
  428.  
  429.  
  430. if(!spawnData.restored )
  431. {
  432. if( !isXmlLevelSet )
  433. {
  434. xmlLevel = GetAttributeValue( 'level',,true );
  435. isXmlLevelSet = true;
  436. }
  437. if ( !immortalityInitialized )
  438. {
  439. SetCanPlayHitAnim( true );
  440.  
  441. if(isInvulnerable)
  442. {
  443. SetImmortalityMode(AIM_Invulnerable, AIC_Default);
  444. }
  445. else if(isImmortal)
  446. {
  447. SetImmortalityMode(AIM_Immortal, AIC_Default);
  448. }
  449. else if( willBeUnconscious )
  450. {
  451. SetImmortalityMode(AIM_Unconscious, AIC_Default);
  452. SignalGameplayEventParamFloat('ChangeUnconsciousDuration',minUnconsciousTime);
  453. }
  454. // W3EE - Begin
  455. else if ( npcGroupType == ENGT_Commoner /*|| npcGroupType == ENGT_Guard*/ || npcGroupType == ENGT_Quest )
  456. // W3EE - End
  457. {
  458. SetImmortalityMode(AIM_Unconscious, AIC_Default);
  459. }
  460. }
  461. }
  462.  
  463.  
  464. if( npcGroupType == ENGT_Guard )
  465. {
  466. SetOriginalInteractionPriority( IP_Prio_5 );
  467. RestoreOriginalInteractionPriority();
  468. }
  469. else if( npcGroupType == ENGT_Quest )
  470. {
  471. SetOriginalInteractionPriority( IP_Max_Unpushable );
  472. RestoreOriginalInteractionPriority();
  473. }
  474.  
  475.  
  476.  
  477. mac = (CMovingPhysicalAgentComponent)GetMovingAgentComponent();
  478. if(mac && IsFlying() )
  479. mac.SetAnimatedMovement( true );
  480.  
  481.  
  482. RegisterCollisionEventsListener();
  483.  
  484.  
  485. if (focusModeSoundEffectType == FMSET_None)
  486. SetFocusModeSoundEffectType( FMSET_Gray );
  487.  
  488. heading = AngleNormalize( GetHeading() );
  489.  
  490. SetBehaviorVariable( 'requestedFacingDirection', heading );
  491.  
  492. if ( disableConstrainLookat )
  493. SetBehaviorVariable( 'disableConstraintLookat', 1.f);
  494.  
  495.  
  496. SoundSwitch( "vo_3d", 'vo_3d_long', 'head' );
  497.  
  498. AddAnimEventCallback('EquipItemL' , 'OnAnimEvent_EquipItemL');
  499. AddAnimEventCallback('HideItemL' , 'OnAnimEvent_HideItemL');
  500. AddAnimEventCallback('HideWeapons' , 'OnAnimEvent_HideWeapons');
  501. AddAnimEventCallback('TemporaryOffGround' , 'OnAnimEvent_TemporaryOffGround');
  502. AddAnimEventCallback('NullifyBurning' , 'OnAnimEvent_NullifyBurning');
  503. AddAnimEventCallback('setVisible' , 'OnAnimEvent_setVisible');
  504. AddAnimEventCallback('extensionWalk' , 'OnAnimEvent_extensionWalk');
  505. AddAnimEventCallback('extensionWalkNormalSpeed' , 'OnAnimEvent_extensionWalkNormalSpeed');
  506. AddAnimEventCallback('extensionWalkRightHandOnly' , 'OnAnimEvent_extensionWalkRightHandOnly');
  507. AddAnimEventCallback('extensionWalkStartStopNormalSpeed' , 'OnAnimEvent_extensionWalkStartStopNormalSpeed');
  508. AddAnimEventCallback('weaponSoundType' , 'OnAnimEvent_weaponSoundType');
  509. AddAnimEventCallback('disableCrowdOverride' , 'OnAnimEvent_disableCrowdOverride');
  510.  
  511. if ( IsAnimal() )
  512. {
  513. AddAnimEventCallback('OwlSwitchOpen' , 'OnAnimEvent_OwlSwitchOpen');
  514. AddAnimEventCallback('OwlSwitchClose' , 'OnAnimEvent_OwlSwitchClose');
  515. AddAnimEventCallback('Goose01OpenWings' , 'OnAnimEvent_Goose01OpenWings');
  516. AddAnimEventCallback('Goose01CloseWings' , 'OnAnimEvent_Goose01CloseWings');
  517. AddAnimEventCallback('Goose02OpenWings' , 'OnAnimEvent_Goose02OpenWings');
  518. AddAnimEventCallback('Goose02CloseWings' , 'OnAnimEvent_Goose02CloseWings');
  519. }
  520.  
  521. if( HasTag( 'olgierd_gpl' ) )
  522. {
  523. AddAnimEventCallback('IdleDown' , 'OnAnimEvent_IdleDown');
  524. AddAnimEventCallback('IdleForward' , 'OnAnimEvent_IdleForward');
  525. AddAnimEventCallback('IdleCombat' , 'OnAnimEvent_IdleCombat');
  526. AddAnimEventCallback('WeakenedState' , 'OnAnimEvent_WeakenedState');
  527. AddAnimEventCallback('WeakenedStateOff' , 'OnAnimEvent_WeakenedStateOff');
  528. AddAnimEventCallback('SlideAway' , 'OnAnimEvent_SlideAway');
  529. AddAnimEventCallback('SlideForward' , 'OnAnimEvent_SlideForward');
  530. AddAnimEventCallback('SlideTowards' , 'OnAnimEvent_SlideTowards');
  531. AddAnimEventCallback('OpenHitWindow' , 'OnAnimEvent_WindowManager');
  532. AddAnimEventCallback('CloseHitWindow' , 'OnAnimEvent_WindowManager');
  533. AddAnimEventCallback('OpenCounterWindow' , 'OnAnimEvent_WindowManager');
  534. AddAnimEventCallback('BC_Weakened' , 'OnAnimEvent_PlayBattlecry');
  535. AddAnimEventCallback('BC_Attack' , 'OnAnimEvent_PlayBattlecry');
  536. AddAnimEventCallback('BC_Parry' , 'OnAnimEvent_PlayBattlecry');
  537. AddAnimEventCallback('BC_Sign' , 'OnAnimEvent_PlayBattlecry');
  538. AddAnimEventCallback('BC_Taunt' , 'OnAnimEvent_PlayBattlecry');
  539. }
  540. else if( HasTag( 'scolopendromorph' ) || HasTag( 'archespor' ) )
  541. {
  542. AddAnimEventCallback('SetIsUnderground' , 'OnAnimEvent_ToggleIsOverground');
  543. AddAnimEventCallback('SetIsOverground' , 'OnAnimEvent_ToggleIsOverground');
  544. AddAnimEventCallback('IdleDown' , 'OnAnimEvent_IdleDown');
  545. AddAnimEventCallback('IdleForward' , 'OnAnimEvent_IdleForward');
  546. AddAnimEventCallback('CannotBeAttacked' , 'OnAnimEvent_CannotBeAttacked');
  547.  
  548. if( HasTag( 'scolopendromorph' ) )
  549. {
  550. ToggleIsOverground( false );
  551. }
  552. }
  553. else if( HasTag( 'dettlaff_vampire' ) )
  554. {
  555. AddAnimEventCallback('OpenHitWindow' , 'OnAnimEvent_WindowManager');
  556. AddAnimEventCallback('CloseHitWindow' , 'OnAnimEvent_WindowManager');
  557. AddAnimEventCallback('OpenCounterWindow' , 'OnAnimEvent_WindowManager');
  558. AddAnimEventCallback('SlideAway' , 'OnAnimEvent_SlideAway');
  559. AddAnimEventCallback('SlideForward' , 'OnAnimEvent_SlideForward');
  560. AddAnimEventCallback('WeakenedState' , 'OnAnimEvent_WeakenedState');
  561. AddAnimEventCallback('WeakenedStateOff' , 'OnAnimEvent_WeakenedStateOff');
  562. }
  563. else if( HasTag( 'fairytale_witch' ) )
  564. {
  565. AddAnimEventCallback('CauldronDropped' , 'OnAnimEvent_CauldronDropped');
  566. AddAnimEventCallback('OpenHitWindow' , 'OnAnimEvent_WindowManager');
  567. AddAnimEventCallback('CloseHitWindow' , 'OnAnimEvent_WindowManager');
  568. }
  569. else if( HasTag( 'fairytaleWitchBroom' ) )
  570. {
  571. AddAnimEventCallback('BroomDeath' , 'OnAnimEvent_BroomDeath');
  572. }
  573. else if( HasTag( 'q703_ofir_mage' ) )
  574. {
  575. AddAnimEventCallback('ActivateSide' , 'OnAnimEvent_ActivateSide');
  576. AddAnimEventCallback('ActivateUp' , 'OnAnimEvent_ActivateUp');
  577. }
  578. else if ( HasTag( 'q703_dolphin' ) )
  579. {
  580. AddAnimEventCallback('DeactivateSide' , 'OnAnimEvent_DeactivateSide');
  581. AddAnimEventCallback('DeactivateUp' , 'OnAnimEvent_DeactivateUp');
  582. }
  583. else if ( HasAbility( 'mon_vampiress_base' ) )
  584. {
  585. AddAnimEventCallback('bruxa_jump_failsafe' , 'OnAnimEvent_BruxaJumpFailsafe' );
  586. }
  587. else if ( HasAbility( 'mon_werewolf_base' ) )
  588. {
  589. AddAnimEventCallback('ResetOneTimeSpawnActivation' , 'OnAnimEvent_ResetOneTimeSpawnActivation' );
  590. }
  591.  
  592. if( HasAbility( 'NoShadows' ) )
  593. {
  594. SetGroupShadows( false );
  595. }
  596.  
  597. if(HasAbility('_canBeFollower') && theGame.GetDifficultyMode() != EDM_Hardcore)
  598. RemoveAbility('_canBeFollower');
  599.  
  600.  
  601.  
  602.  
  603.  
  604. if( (FactsQuerySum("NewGamePlus") > 0 || (!HasAbility('NoAdaptBalance') && currentLevel > 1 ) ) )
  605. {
  606.  
  607.  
  608. if ( theGame.IsActive() )
  609. {
  610. if( ( ( FactsQuerySum("NewGamePlus") > 0 ) && !HasTag('animal') ))
  611. {
  612. if( !HasAbility('NPCDoNotGainBoost') && !HasAbility('NewGamePlusFakeLevel') )
  613. {
  614. currentLevel += theGame.params.GetNewGamePlusLevel();
  615. if ( currentLevel > ( theGame.params.GetPlayerMaxLevel() + 5 ) )
  616. {
  617. currentLevel = theGame.params.GetPlayerMaxLevel() + 5;
  618. }
  619. }
  620. else if ( !HasAbility('NPCDoNotGainNGPlusLevel') )
  621. {
  622. newGamePlusFakeLevelAddon = true;
  623. }
  624.  
  625.  
  626. }
  627. // W3EE - Begin
  628. /*else
  629. {
  630. if ( ( theGame.GetDifficultyMode() == EDM_Easy || theGame.GetDifficultyMode() == EDM_Medium ) && playerLevel == 1 && npcGroupType != ENGT_Guard && !HasAbility('PrologModifier'))
  631. {
  632. AddAbility('PrologModifier');
  633. }
  634. }*/
  635. // W3EE - End
  636. }
  637. }
  638. }
  639.  
  640. protected function SetAbilityManager()
  641. {
  642. if(npcGroupType != ENGT_Commoner)
  643. abilityManager = new W3NonPlayerAbilityManager in this;
  644. }
  645.  
  646. protected function SetEffectManager()
  647. {
  648. if(npcGroupType != ENGT_Commoner)
  649. super.SetEffectManager();
  650. }
  651.  
  652. public function SetLevel ( _level : int )
  653. {
  654. currentLevel = _level;
  655. levelBonusesComputedAtPlayerLevel = -1;
  656. // W3EE - Begin
  657. SetWasScaled(false);
  658. // W3EE - End
  659. AddTimer('AddLevelBonuses', 0.1, true, false, , true);
  660. AddTimer('InitWeatherBonus', 1);
  661. }
  662.  
  663. private function SetThreatLevel()
  664. {
  665. var temp : float;
  666.  
  667. temp = CalculateAttributeValue(GetAttributeValue('threat_level'));
  668. if ( temp >= 0.f )
  669. {
  670. threatLevel = (int)temp;
  671. }
  672. else
  673. {
  674. LogAssert(false,"No threat_level attribute set. Threat level set to 0");
  675. threatLevel = 0;
  676. }
  677. }
  678. public function ChangeThreatLevel( newValue : int )
  679. {
  680. threatLevel = newValue;
  681. }
  682.  
  683.  
  684. public function SetNpcHealthBar()
  685. {
  686. npc_health_bar = GetHealthPercents();
  687. SoundParameter( 'npc_health_bar', npc_health_bar, 'all' );
  688. }
  689.  
  690. public function GetNpcHealthBar() : float
  691. {
  692. return npc_health_bar;
  693. }
  694.  
  695. public function GetHorseUser() : CActor
  696. {
  697. if( horseComponent )
  698. {
  699. return horseComponent.GetCurrentUser();
  700. }
  701.  
  702. return NULL;
  703. }
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711. public function GetPreferedCombatStyle() : EBehaviorGraph
  712. {
  713. return preferedCombatStyle;
  714. }
  715.  
  716. public function SetPreferedCombatStyle( _preferedCombatStyle : EBehaviorGraph )
  717. {
  718. preferedCombatStyle = _preferedCombatStyle;
  719. }
  720. //W3EE - Begin
  721. /*
  722. timer function WeatherBonusCheck(dt : float, id : int)
  723. {
  724. var curGameTime : GameTime;
  725. var dayPart : EDayPart;
  726. var bonusName : name;
  727. var curEffect : CBaseGameplayEffect;
  728. var moonState : EMoonState;
  729. var weather : EWeatherEffect;
  730. var params : SCustomEffectParams;
  731.  
  732. if ( !IsAlive() )
  733. {
  734. return;
  735. }
  736.  
  737. moonState = GetCurMoonState();
  738.  
  739. curGameTime = GameTimeCreate();
  740. dayPart = GetDayPart(curGameTime);
  741.  
  742. weather = GetCurWeather();
  743.  
  744. bonusName = ((W3NonPlayerAbilityManager)abilityManager).GetWeatherBonus(dayPart, weather, moonState);
  745.  
  746. curEffect = GetBuff(EET_WeatherBonus);
  747. if (curEffect)
  748. {
  749. if ( curEffect.GetAbilityName() == bonusName )
  750. {
  751. return;
  752. }
  753. else
  754. {
  755. WeatherBonusToStatIncrease(curEffect.GetAbilityName(), true);
  756. RemoveBuff(EET_WeatherBonus);
  757. }
  758. }
  759.  
  760. if (bonusName != 'None')
  761. {
  762.  
  763. params.effectType = EET_WeatherBonus;
  764. params.creator = this;
  765. params.sourceName = "WeatherBonus";
  766. params.customAbilityName = bonusName;
  767. AddEffectCustom(params);
  768.  
  769. WeatherBonusToStatIncrease(bonusName, false);
  770.  
  771. }
  772. }
  773. */
  774. //W3EE - End
  775.  
  776. public function IsFlying() : bool
  777. {
  778. var result : bool;
  779. result = ( this.GetCurrentStance() == NS_Fly );
  780. return result;
  781. }
  782.  
  783. public function IsRanged() : bool
  784. {
  785. var weapon : SItemUniqueId;
  786. var weapon2 : SItemUniqueId;
  787.  
  788. if( HasAbility( 'Ranged' ) )
  789. {
  790. return true;
  791. }
  792.  
  793. weapon = this.GetInventory().GetItemFromSlot( 'l_weapon' );
  794. weapon2 = this.GetInventory().GetItemFromSlot( 'r_weapon' );
  795.  
  796. return ( this.GetInventory().GetItemCategory( weapon ) == 'bow' || this.GetInventory().GetItemCategory( weapon2 ) == 'crossbow' );
  797.  
  798. }
  799.  
  800.  
  801.  
  802. public function IsVisuallyOffGround() : bool
  803. {
  804. if( isTemporaryOffGround )
  805. return true;
  806. if( IsFlying() )
  807. return true;
  808.  
  809. return false;
  810. }
  811.  
  812. public function SetIsHorse()
  813. {
  814. if ( horseComponent )
  815. isHorse = true;
  816. }
  817.  
  818. public function IsHorse() : bool
  819. {
  820. return isHorse;
  821. }
  822.  
  823. public function GetHorseComponent() : W3HorseComponent
  824. {
  825. if ( isHorse )
  826. return horseComponent;
  827. else
  828. return NULL;
  829. }
  830.  
  831. public function HideHorseAfter( time : float )
  832. {
  833. if( !isHorse )
  834. return;
  835.  
  836. SetVisibility( false );
  837. SetGameplayVisibility( false );
  838.  
  839. AddTimer( 'HideHorse', time );
  840. }
  841.  
  842. private timer function HideHorse( delta : float , id : int )
  843. {
  844. Teleport( thePlayer.GetWorldPosition() + thePlayer.GetHeadingVector() * 1000.0 );
  845.  
  846. SetVisibility( true );
  847. SetGameplayVisibility( true );
  848. }
  849.  
  850. public function KillHorseAfter( time : float )
  851. {
  852. if( !isHorse )
  853. return;
  854. AddTimer( 'KillHorse', time );
  855. }
  856.  
  857. private timer function KillHorse( delta : float , id : int )
  858. {
  859. SetKinematic( false );
  860. Kill( 'KillHorse', true );
  861. SetAlive( false );
  862. GetComponentByClassName( 'CInteractionComponent' ).SetEnabled( false );
  863. PlayEffect( 'hit_ground' );
  864. }
  865.  
  866. public timer function RemoveAxiiFromHorse( delta : float , id : int )
  867. {
  868. RemoveAbility( 'HorseAxiiBuff' );
  869. }
  870.  
  871. public function ToggleCanFlee( val : bool ) { canFlee = val; }
  872. public function GetCanFlee() : bool { return canFlee; }
  873.  
  874. public function SetIsFallingFromHorse( val : bool )
  875. {
  876. if( val )
  877. {
  878. AddBuffImmunity( EET_HeavyKnockdown, 'SetIsFallingFromHorse', true );
  879. isFallingFromHorse = true;
  880. }
  881. else
  882. {
  883. RemoveBuffImmunity( EET_HeavyKnockdown, 'SetIsFallingFromHorse' );
  884. isFallingFromHorse = false;
  885. }
  886. }
  887. public function GetIsFallingFromHorse() : bool { return isFallingFromHorse; }
  888.  
  889. public function SetCounterWindowStartTime(time : EngineTime) {counterWindowStartTime = time;}
  890. public function GetCounterWindowStartTime() : EngineTime {return counterWindowStartTime;}
  891.  
  892. // W3EE - Begin
  893. function GetThreatLevel() : int
  894. {
  895. //return threatLevel;
  896. return npcStats.dangerLevel;
  897. }
  898. // W3EE - End
  899.  
  900. function GetSoundValue() : int
  901. {
  902. return soundValue;
  903. }
  904.  
  905. public function WasTauntedToAttack()
  906. {
  907. tauntedToAttackTimeStamp = theGame.GetEngineTimeAsSeconds();
  908. }
  909.  
  910.  
  911.  
  912. timer function MaintainSpeedTimer( d : float , id : int)
  913. {
  914. this.SetBehaviorVariable( 'Editor_MovementSpeed', 0 );
  915. }
  916. timer function MaintainFlySpeedTimer( d : float , id : int)
  917. {
  918. this.SetBehaviorVariable( 'Editor_FlySpeed', 0 );
  919. }
  920.  
  921.  
  922.  
  923.  
  924. public function SetIsInHitAnim( toggle : bool )
  925. {
  926. bIsInHitAnim = toggle;
  927. if ( !toggle )
  928. this.SignalGameplayEvent('WasHit');
  929. }
  930.  
  931. public function IsInHitAnim() : bool
  932. {
  933. return bIsInHitAnim;
  934. }
  935.  
  936. public function CanChangeBehGraph() : bool
  937. {
  938. return allowBehGraphChange;
  939. }
  940.  
  941. public function WeaponSoundType() : CItemEntity
  942. {
  943. var weapon : SItemUniqueId;
  944. weapon = GetInventory().GetItemFromSlot( 'r_weapon' );
  945.  
  946. return GetInventory().GetItemEntityUnsafe(weapon);
  947. }
  948.  
  949.  
  950.  
  951.  
  952. function EnableCounterParryFor( time : float )
  953. {
  954. bCanPerformCounter = true;
  955. AddTimer('DisableCounterParry',time,false);
  956. }
  957.  
  958. timer function DisableCounterParry( td : float , id : int)
  959. {
  960. bCanPerformCounter = false;
  961. }
  962.  
  963. var combatStorage : CBaseAICombatStorage;
  964.  
  965. public final function IsAttacking() : bool
  966. {
  967. if ( !combatStorage )
  968. combatStorage = (CBaseAICombatStorage)GetScriptStorageObject('CombatData');
  969.  
  970. if(combatStorage)
  971. {
  972. return combatStorage.GetIsAttacking();
  973. }
  974.  
  975. return false;
  976. }
  977.  
  978. public final function RecalcLevel()
  979. {
  980. if(!IsAlive())
  981. return;
  982.  
  983. AddLevelBonuses(0, 0);
  984. }
  985.  
  986.  
  987. protected function PerformCounterCheck(parryInfo: SParryInfo) : bool
  988. {
  989. return false;
  990. }
  991.  
  992.  
  993. protected function PerformParryCheck(parryInfo : SParryInfo) : bool
  994. {
  995. var mult : float;
  996. var isHeavy : bool;
  997. var npcTarget : CNewNPC;
  998. var fistFightParry,a,b : bool;
  999.  
  1000. if ( !parryInfo.canBeParried || thePlayer.IsCounterAttack(parryInfo.attackActionName) )
  1001. return false;
  1002. a = a(); b = b();
  1003. // W3EE - Begin
  1004. if( IsHuman() && ((CHumanAICombatStorage)this.GetScriptStorageObject('CombatData')).IsProtectedByQuen() )
  1005. return false;
  1006. // W3EE - End
  1007. if( !CanParryAttack() )
  1008. return false;
  1009. if( !FistFightCheck(parryInfo.target, parryInfo.attacker, fistFightParry) )
  1010. return false;
  1011. if( IsInHitAnim() && HasTag( 'imlerith' ) )
  1012. return false;
  1013.  
  1014. npcTarget = (CNewNPC)parryInfo.target;
  1015.  
  1016. if( npcTarget.IsShielded(parryInfo.attacker) || ( !npcTarget.HasShieldedAbility() && parryInfo.targetToAttackerAngleAbs < 90 ) || ( npcTarget.HasTag( 'olgierd_gpl' ) && parryInfo.targetToAttackerAngleAbs < 120 ) )
  1017. {
  1018. isHeavy = IsHeavyAttack(parryInfo.attackActionName);
  1019.  
  1020.  
  1021. if( HasStaminaToParry( parryInfo.attackActionName ) && ( HasAbility( 'ablParryHeavyAttacks' ) || !isHeavy ) )
  1022. {
  1023.  
  1024. SetBehaviorVariable( 'parryAttackType', (int)PAT_Light );
  1025.  
  1026. if( isHeavy )
  1027. SignalGameplayEventParamInt( 'ParryPerform', 1 );
  1028. else
  1029. SignalGameplayEventParamInt( 'ParryPerform', 0 );
  1030. }
  1031. else
  1032. {
  1033.  
  1034. SetBehaviorVariable( 'parryAttackType', (int)PAT_Heavy );
  1035.  
  1036. if( isHeavy )
  1037. SignalGameplayEventParamInt( 'ParryStagger', 1 );
  1038. else
  1039. SignalGameplayEventParamInt( 'ParryStagger', 0 );
  1040. }
  1041.  
  1042. if( parryInfo.attacker == thePlayer && parryInfo.attacker.IsWeaponHeld( 'fist' ) && !parryInfo.target.IsWeaponHeld( 'fist' ) )
  1043. {
  1044. parryInfo.attacker.SetBehaviorVariable( 'reflectAnim', 1.f );
  1045. parryInfo.attacker.ReactToReflectedAttack(this);
  1046. }
  1047. else
  1048. {
  1049. if( isHeavy )
  1050. {
  1051. ToggleEffectOnShield( 'heavy_block', true );
  1052. }
  1053. else
  1054. {
  1055. ToggleEffectOnShield( 'light_block', true );
  1056. }
  1057. }
  1058.  
  1059. return true;
  1060. }
  1061.  
  1062. return false;
  1063. }
  1064.  
  1065. public function GetTotalSignSpellPower(signSkill : ESkill) : SAbilityAttributeValue
  1066. {
  1067. return GetPowerStatValue(CPS_SpellPower);
  1068. }
  1069.  
  1070. event OnProcessActionPost(action : W3DamageAction)
  1071. {
  1072. var actorVictim : CActor;
  1073. var time, maxTox, toxToAdd : float;
  1074. var gameplayEffect : CBaseGameplayEffect;
  1075. var template : CEntityTemplate;
  1076. var fxEnt : CEntity;
  1077. var toxicity : SAbilityAttributeValue;
  1078.  
  1079. super.OnProcessActionPost(action);
  1080.  
  1081.  
  1082. actorVictim = (CActor)action.victim;
  1083. // W3EE - Begin
  1084. if(HasBuff(EET_AxiiGuardMe) && (thePlayer.HasAbility('Glyphword 18 _Stats', true) || thePlayer.HasAbility('Glyphword 13 _Stats', true)) && action.DealtDamage())
  1085. // W3EE - End
  1086. {
  1087. time = CalculateAttributeValue(thePlayer.GetAttributeValue('increas_duration'));
  1088. gameplayEffect = GetBuff(EET_AxiiGuardMe);
  1089. gameplayEffect.SetTimeLeft( gameplayEffect.GetTimeLeft() + time );
  1090.  
  1091. template = (CEntityTemplate)LoadResource('glyphword_10_18');
  1092.  
  1093. if(GetBoneIndex('head') != -1)
  1094. {
  1095. fxEnt = theGame.CreateEntity(template, GetBoneWorldPosition('head'), GetWorldRotation(), , , true);
  1096. fxEnt.CreateAttachmentAtBoneWS(this, 'head', GetBoneWorldPosition('head'), GetWorldRotation());
  1097. }
  1098. else
  1099. {
  1100. fxEnt = theGame.CreateEntity(template, GetBoneWorldPosition('k_head_g'), GetWorldRotation(), , , true);
  1101. fxEnt.CreateAttachmentAtBoneWS(this, 'k_head_g', GetBoneWorldPosition('k_head_g'), GetWorldRotation());
  1102.  
  1103. }
  1104.  
  1105. fxEnt.PlayEffect('axii_extra_time');
  1106. fxEnt.DestroyAfter(5);
  1107. }
  1108.  
  1109.  
  1110. if( action.victim && action.victim == GetWitcherPlayer() && action.DealtDamage() )
  1111. {
  1112. toxicity = GetAttributeValue( 'toxicity_increase_on_hit' );
  1113. if( toxicity.valueAdditive > 0.f || toxicity.valueMultiplicative > 0.f )
  1114. {
  1115. maxTox = GetWitcherPlayer().GetStatMax( BCS_Toxicity );
  1116. toxToAdd = maxTox * toxicity.valueMultiplicative + toxicity.valueAdditive;
  1117. GetWitcherPlayer().GainStat( BCS_Toxicity, toxToAdd );
  1118. }
  1119. }
  1120. }
  1121.  
  1122. protected function PrepareAttackAction( hitTarget : CGameplayEntity, animData : CPreAttackEventData, weaponId : SItemUniqueId, parried : bool, countered : bool, parriedBy : array<CActor>, attackAnimationName : name, hitTime : float, weaponEntity : CItemEntity, out attackAction : W3Action_Attack) : bool
  1123. {
  1124. var containedAbs, abs, tmp : array< name >;
  1125. var i : int;
  1126. var ret : bool;
  1127. var effectType : EEffectType;
  1128. var customAbilityName : name;
  1129.  
  1130. ret = super.PrepareAttackAction( hitTarget, animData, weaponId, parried, countered, parriedBy, attackAnimationName, hitTime, weaponEntity, attackAction );
  1131.  
  1132.  
  1133. GetCharacterStats().GetAbilities( abs, false );
  1134. for( i=0; i<abs.Size(); i+=1 )
  1135. {
  1136. theGame.GetDefinitionsManager().GetContainedAbilities( abs[i], tmp );
  1137. ArrayOfNamesAppendUnique( containedAbs, tmp );
  1138. tmp.Clear();
  1139. }
  1140.  
  1141. for( i=0; i<containedAbs.Size(); i+=1 )
  1142. {
  1143. EffectNameToType( containedAbs[i], effectType, customAbilityName );
  1144.  
  1145. if( effectType == EET_ToxicityVenom )
  1146. {
  1147. attackAction.AddEffectInfo( effectType, , GetAttributeValue( 'toxicityVenom' ) );
  1148. break;
  1149. }
  1150. }
  1151.  
  1152. return ret;
  1153. }
  1154.  
  1155.  
  1156.  
  1157.  
  1158. var fistFightForcedFromQuest : bool;
  1159.  
  1160. var displayLevel : int;
  1161.  
  1162. // W3EE - Begin
  1163. public var npcStats : SOpponentStats;
  1164. private var wasScaled : bool; default wasScaled = false;
  1165.  
  1166. public function IsImmuneToBuff( effect : EEffectType ) : bool
  1167. {
  1168. var resPrc : float;
  1169.  
  1170. resPrc = GetNPCCustomStat(ResistStatToName(theGame.effectMgr.GetBuffResistStat(effect)));
  1171.  
  1172. return super.IsImmuneToBuff(effect) || resPrc >= 1.f;
  1173. }
  1174.  
  1175. public function ResistStatToName( resistStat : ECharacterDefenseStats ) : name
  1176. {
  1177. switch(resistStat)
  1178. {
  1179. case CDS_PhysicalRes:
  1180. case CDS_SlashingRes:
  1181. case CDS_PiercingRes:
  1182. case CDS_BludgeoningRes:
  1183. case CDS_RendingRes: return theGame.params.DAMAGE_NAME_PHYSICAL;
  1184.  
  1185. case CDS_BleedingRes:
  1186. case CDS_DoTBleedingDamageRes: return theGame.params.DAMAGE_NAME_BLEEDING;
  1187.  
  1188. case CDS_PoisonRes:
  1189. case CDS_DoTPoisonDamageRes: return theGame.params.DAMAGE_NAME_POISON;
  1190.  
  1191. case CDS_FireRes:
  1192. case CDS_BurningRes:
  1193. case CDS_DoTBurningDamageRes: return theGame.params.DAMAGE_NAME_FIRE;
  1194.  
  1195. case CDS_FrostRes:
  1196. case CDS_FreezeRes: return theGame.params.DAMAGE_NAME_FROST;
  1197.  
  1198. case CDS_ShockRes: return theGame.params.DAMAGE_NAME_SHOCK;
  1199. case CDS_ElementalRes: return theGame.params.DAMAGE_NAME_ELEMENTAL;
  1200.  
  1201. case CDS_ForceRes: return theGame.params.DAMAGE_NAME_FORCE;
  1202.  
  1203. case CDS_WillRes: return theGame.params.DAMAGE_NAME_MENTAL;
  1204.  
  1205. default: return '';
  1206. }
  1207. }
  1208.  
  1209. public function GetNPCCustomStat( damageName : name ) : float
  1210. {
  1211. switch(damageName)
  1212. {
  1213. case theGame.params.DAMAGE_NAME_FROST : return npcStats.frostResist;
  1214.  
  1215. case theGame.params.DAMAGE_NAME_FORCE : return npcStats.forceResist;
  1216.  
  1217. case theGame.params.DAMAGE_NAME_POISON : return npcStats.poisonResist;
  1218.  
  1219. case theGame.params.DAMAGE_NAME_FIRE : return npcStats.fireResist;
  1220.  
  1221. case theGame.params.DAMAGE_NAME_SLOW : return npcStats.slowResist;
  1222.  
  1223. case theGame.params.DAMAGE_NAME_BLEEDING : return npcStats.bleedingResist;
  1224.  
  1225. case theGame.params.DAMAGE_NAME_MENTAL : return npcStats.confusionResist;
  1226.  
  1227. case theGame.params.DAMAGE_NAME_STUN : return npcStats.stunResist;
  1228.  
  1229. case theGame.params.DAMAGE_NAME_INJURY : return npcStats.injuryResist;
  1230.  
  1231. case theGame.params.DAMAGE_NAME_ARMOR_PIERCE : return npcStats.armorPiercing;
  1232.  
  1233. case theGame.params.DAMAGE_NAME_ARMOR_PIERCE_RANGED : return npcStats.rangedArmorPiercing;
  1234.  
  1235. case theGame.params.DAMAGE_NAME_PHYSICAL :
  1236. case theGame.params.DAMAGE_NAME_SILVER :
  1237. case theGame.params.DAMAGE_NAME_SLASHING :
  1238. case theGame.params.DAMAGE_NAME_PIERCING :
  1239. case theGame.params.DAMAGE_NAME_BLUDGEONING :
  1240. case theGame.params.DAMAGE_NAME_RENDING : return npcStats.physicalResist;
  1241.  
  1242. case theGame.params.DAMAGE_NAME_ELEMENTAL : return npcStats.elementalResist;
  1243.  
  1244. case theGame.params.DAMAGE_NAME_SHOCK : return npcStats.shockResist;
  1245.  
  1246. case theGame.params.DAMAGE_NAME_MORALE :
  1247. case theGame.params.DAMAGE_NAME_DIRECT : return 0.f;
  1248. default : return 0.f;
  1249. }
  1250. }
  1251.  
  1252. public function SetNPCCustomStat( damageName : name, value : float )
  1253. {
  1254. switch(damageName)
  1255. {
  1256. case theGame.params.DAMAGE_NAME_FROST : npcStats.frostResist = value; break;
  1257.  
  1258. case theGame.params.DAMAGE_NAME_FORCE : npcStats.forceResist = value; break;
  1259.  
  1260. case theGame.params.DAMAGE_NAME_POISON : npcStats.poisonResist = value; break;
  1261.  
  1262. case theGame.params.DAMAGE_NAME_FIRE : npcStats.fireResist = value; break;
  1263.  
  1264. case theGame.params.DAMAGE_NAME_BLEEDING : npcStats.bleedingResist = value; break;
  1265.  
  1266. case theGame.params.DAMAGE_NAME_SLOW : npcStats.slowResist = value; break;
  1267.  
  1268. case theGame.params.DAMAGE_NAME_MENTAL : npcStats.confusionResist = value; break;
  1269.  
  1270. case theGame.params.DAMAGE_NAME_STUN : npcStats.stunResist = value; break;
  1271.  
  1272. case theGame.params.DAMAGE_NAME_INJURY : npcStats.injuryResist = value; break;
  1273.  
  1274. case theGame.params.DAMAGE_NAME_ARMOR_PIERCE : npcStats.armorPiercing = value; break;
  1275.  
  1276. case theGame.params.DAMAGE_NAME_ARMOR_PIERCE_RANGED : npcStats.rangedArmorPiercing = value; break;
  1277.  
  1278. case theGame.params.DAMAGE_NAME_PHYSICAL :
  1279. case theGame.params.DAMAGE_NAME_SILVER :
  1280. case theGame.params.DAMAGE_NAME_SLASHING :
  1281. case theGame.params.DAMAGE_NAME_PIERCING :
  1282. case theGame.params.DAMAGE_NAME_BLUDGEONING :
  1283. case theGame.params.DAMAGE_NAME_RENDING : npcStats.physicalResist = value; break;
  1284.  
  1285. case theGame.params.DAMAGE_NAME_ELEMENTAL : npcStats.elementalResist = value; break;
  1286.  
  1287. case theGame.params.DAMAGE_NAME_SHOCK : npcStats.shockResist = value; break;
  1288.  
  1289. default : return;
  1290. }
  1291. }
  1292.  
  1293. public function AddDamageImmunity( damageName : name )
  1294. {
  1295. var effects : array<EEffectType>;
  1296. var i : int;
  1297.  
  1298. switch(damageName)
  1299. {
  1300. case theGame.params.DAMAGE_NAME_FROST : effects.PushBack(EET_Frozen); effects.PushBack(EET_SlowdownFrost); break;
  1301.  
  1302. case theGame.params.DAMAGE_NAME_FORCE : effects.PushBack(EET_Knockdown); effects.PushBack(EET_HeavyKnockdown); break;
  1303.  
  1304. case theGame.params.DAMAGE_NAME_POISON : effects.PushBack(EET_Poison); break;
  1305.  
  1306. case theGame.params.DAMAGE_NAME_FIRE : effects.PushBack(EET_Burning); break;
  1307.  
  1308. case theGame.params.DAMAGE_NAME_BLEEDING : effects.PushBack(EET_Bleeding); break;
  1309.  
  1310. case theGame.params.DAMAGE_NAME_SLOW : effects.PushBack(EET_Slowdown); break;
  1311.  
  1312. case theGame.params.DAMAGE_NAME_MENTAL : effects.PushBack(EET_Hypnotized); effects.PushBack(EET_Confusion); effects.PushBack(EET_AxiiGuardMe); break;
  1313.  
  1314. case theGame.params.DAMAGE_NAME_INJURY : npcStats.injuryResist = 1.f; break;
  1315.  
  1316. case theGame.params.DAMAGE_NAME_STUN :
  1317. case theGame.params.DAMAGE_NAME_PHYSICAL :
  1318. case theGame.params.DAMAGE_NAME_SILVER :
  1319. case theGame.params.DAMAGE_NAME_SLASHING :
  1320. case theGame.params.DAMAGE_NAME_PIERCING :
  1321. case theGame.params.DAMAGE_NAME_BLUDGEONING :
  1322. case theGame.params.DAMAGE_NAME_RENDING : effects.PushBack(EET_Stagger); effects.PushBack(EET_LongStagger); break;
  1323.  
  1324. case theGame.params.DAMAGE_NAME_ELEMENTAL :
  1325. case theGame.params.DAMAGE_NAME_SHOCK : effects.PushBack(EET_VitalityDrain); break;
  1326.  
  1327. default : return;
  1328. }
  1329.  
  1330. for(i=0; i<effects.Size(); i+=1)
  1331. AddBuffImmunity(effects[i], 'Resistances', false);
  1332. }
  1333.  
  1334. public function HasTwoHandedWeapon() : bool
  1335. {
  1336. switch(npcStats.meleeWeapon)
  1337. {
  1338. case EMWT_Spear:
  1339. case EMWT_Halberd:
  1340. case EMWT_Halberd:
  1341. case EMWT_Pike:
  1342. case EMWT_MetalPole:
  1343. case EMWT_Staff:
  1344. case EMWT_GreatAxe:
  1345. case EMWT_GreatHammerWood:
  1346. case EMWT_GreatHammerMetal:
  1347. return true;
  1348.  
  1349. default : return false;
  1350. }
  1351.  
  1352. return false;
  1353. }
  1354.  
  1355. public function GetNPCStats() : SOpponentStats
  1356. {
  1357. return npcStats;
  1358. }
  1359.  
  1360. public function CanGetCrippled() : bool
  1361. {
  1362. return npcStats.canGetCrippled;
  1363. }
  1364.  
  1365. public function IsProtectedByArmor() : bool
  1366. {
  1367. return npcStats.isArmored;
  1368. }
  1369.  
  1370. private var armorReducedBy : float; default armorReducedBy = 0;
  1371. public function GetTotalArmorReduction() : float
  1372. {
  1373. return AbsF(armorReducedBy);
  1374. }
  1375.  
  1376. public function ModifyArmorValue( by : float )
  1377. {
  1378. npcStats.physicalResist += by;
  1379. armorReducedBy += AbsF(by);
  1380. }
  1381.  
  1382. //W3EE - Begin
  1383. private var fireResistReducedBy : float; default fireResistReducedBy = 0;
  1384. public function GetTotalFireResistReduction() : float
  1385. {
  1386. return AbsF(fireResistReducedBy);
  1387. }
  1388.  
  1389. public function ModifyFireResistance( by : float )
  1390. {
  1391. npcStats.fireResist += by;
  1392. fireResistReducedBy += AbsF(by);
  1393. }
  1394.  
  1395. //W3EE riving blasts
  1396. private var hasBeenHitByBomb : bool; default hasBeenHitByBomb = false;
  1397.  
  1398. public function HasBeenHitByBomb() : bool
  1399. {
  1400. return hasBeenHitByBomb;
  1401. }
  1402.  
  1403. public function SetHasBeenHitByBomb()
  1404. {
  1405. hasBeenHitByBomb = true;
  1406. }
  1407.  
  1408. public function MultiplyTypeResistBy( damageType : name, by : float )
  1409. {
  1410. if( !hasBeenHitByBomb )
  1411. {
  1412. switch ( damageType )
  1413. {
  1414. case 'FireDamage' :
  1415. npcStats.fireResist -= by;
  1416. SetHasBeenHitByBomb();
  1417. return;
  1418. case 'ElementalDamage' :
  1419. npcStats.elementalResist -= by;
  1420. SetHasBeenHitByBomb();
  1421. return;
  1422. case 'PoisonDamage' :
  1423. npcStats.poisonResist -= by;
  1424. SetHasBeenHitByBomb();
  1425. return;
  1426. case 'FrostDamage' :
  1427. npcStats.frostResist -= by;
  1428. SetHasBeenHitByBomb();
  1429. return;
  1430. case 'PhysicalDamage' :
  1431. npcStats.physicalResist -= by;
  1432. SetHasBeenHitByBomb();
  1433. return;
  1434. case 'BleedingEffect' :
  1435. npcStats.bleedingResist -= by;
  1436. SetHasBeenHitByBomb();
  1437. return;
  1438. default : return;
  1439. }
  1440. }
  1441. }
  1442.  
  1443. //W3EE weather abilities
  1444.  
  1445. var weatherAbilities : array<SWeatherBonus>;
  1446.  
  1447. public function AddWeatherAbility( daypart : EDayPart, weather : EWeatherEffect, moonState : EMoonState, weatherAbilityname : name )
  1448. {
  1449. var params : SWeatherBonus;
  1450. params.dayPart = daypart;
  1451. params.weather = weather;
  1452. params.moonState = moonState;
  1453. params.ability = weatherAbilityname;
  1454. params.isActive = false;
  1455.  
  1456. weatherAbilities.PushBack(params);
  1457. }
  1458.  
  1459. public function GetWeatherAbilities() : array<SWeatherBonus>
  1460. {
  1461. return weatherAbilities;
  1462. }
  1463.  
  1464. public timer function RefreshWeatherBonus( dt : float, id : int )
  1465. {
  1466. weatherAbilityHandler.ModifyWeatherBonus();
  1467. }
  1468. //W3EE - End
  1469. public function IsHuge() : bool
  1470. {
  1471. return npcStats.isHuge;
  1472. }
  1473.  
  1474. public function GetHealthRegenFactor() : float
  1475. {
  1476. return npcStats.healthRegenFactor;
  1477. }
  1478.  
  1479. public timer function AddHealthRegenEffect( dt : float, id : int )
  1480. {
  1481. AddEffectDefault(EET_HealthRegen, this, "W3EEHealthRegen");
  1482. }
  1483.  
  1484. public function GetPoiseValue() : float
  1485. {
  1486. return npcStats.poiseValue;
  1487. }
  1488.  
  1489. public function GetHealthBarType() : bool
  1490. {
  1491. if( npcStats.healthType == BCS_Essence )
  1492. return true;
  1493. else return false;
  1494. }
  1495.  
  1496. public function GetOpponentType() : EMonsterCategory
  1497. {
  1498. return npcStats.opponentType;
  1499. }
  1500.  
  1501. public function GetScaledDamage() : float
  1502. {
  1503. return npcStats.damageValue;
  1504. }
  1505.  
  1506. public function GetScaledRangedDamage() : float
  1507. {
  1508. return npcStats.rangedDamageValue;
  1509. }
  1510.  
  1511. public function GetCachedHealth() : float
  1512. {
  1513. return npcStats.healthMult;
  1514. }
  1515.  
  1516. public function GetCachedDamage() : float
  1517. {
  1518. return npcStats.damageMult;
  1519. }
  1520.  
  1521. public function SetWasScaled( b : bool )
  1522. {
  1523. wasScaled = b;
  1524. }
  1525.  
  1526. public function GetWasScaled() : bool
  1527. {
  1528. return wasScaled;
  1529. }
  1530.  
  1531. timer function AddLevelBonuses (dt : float, id : int)
  1532. {
  1533.  
  1534.  
  1535. /*
  1536. var ciriEntity : W3ReplacerCiri;
  1537. var ignoreLowLevelCheck : bool;
  1538. var lvlDiff : int;
  1539. var npcLevel : int;
  1540. var ngpLevel : int;
  1541. var i : int;
  1542. var playerLevel : int;
  1543. var stats : CCharacterStats;
  1544. var npcGroupType : ENPCGroupType;
  1545. */
  1546. // W3EE - End
  1547.  
  1548. RemoveTimer( 'AddLevelBonuses' );
  1549.  
  1550. // W3EE - Begin
  1551. /*
  1552. playerLevel = thePlayer.GetLevel();
  1553.  
  1554.  
  1555. if ( levelBonusesComputedAtPlayerLevel == playerLevel && !fistFightForcedFromQuest )
  1556. {
  1557. return;
  1558. }
  1559. stats = GetCharacterStats();
  1560.  
  1561.  
  1562. levelBonusesComputedAtPlayerLevel = playerLevel;
  1563.  
  1564. ciriEntity = (W3ReplacerCiri)thePlayer;
  1565. npcLevel = currentLevel;
  1566. npcGroupType = GetNPCType();
  1567. ignoreLowLevelCheck = thePlayer.GetEnemyUpscaling() && ( npcGroupType == ENGT_Enemy || npcGroupType == ENGT_Quest );
  1568.  
  1569. if ( npcGroupType != ENGT_Guard && !ignoreLowLevelCheck && npcLevel + (int)CalculateAttributeValue( GetAttributeValue( 'level',,true ) ) <= 2 ) return;
  1570. if ( stats.HasAbilityWithTag('Boss') && !ciriEntity )
  1571. {
  1572. if ( thePlayer.GetEnemyUpscaling() && npcLevel < playerLevel )
  1573. {
  1574. stats.AddAbilityMultiple( theGame.params.BOSS_NGP_BONUS, playerLevel - npcLevel );
  1575. }
  1576. else if ( FactsQuerySum( "NewGamePlus" ) > 0 && theGame.params.NewGamePlusLevelDifference() > 0 )
  1577. {
  1578. stats.AddAbilityMultiple( theGame.params.BOSS_NGP_BONUS, theGame.params.NewGamePlusLevelDifference() );
  1579. return ;
  1580. }
  1581. }
  1582.  
  1583. if ( stats.HasAbility( 'NPCDoNotGainBoost' ) ) return;
  1584.  
  1585.  
  1586.  
  1587.  
  1588. if ( !ciriEntity && thePlayer.GetEnemyUpscaling() && npcLevel + levelFakeAddon < playerLevel
  1589. && !stats.HasAbility( 'fistfight_minigame' ) && !fistFightForcedFromQuest )
  1590. {
  1591.  
  1592. npcLevelToUpscaledLevelDifference = playerLevel - npcLevel;
  1593. if ( xmlLevel.valueAdditive != npcLevel )
  1594. {
  1595. npcLevel = playerLevel - (int)xmlLevel.valueAdditive + 1 - levelFakeAddon;
  1596. }
  1597. else
  1598. {
  1599. npcLevel = playerLevel - levelFakeAddon;
  1600. }
  1601. }
  1602. else
  1603. {
  1604. npcLevelToUpscaledLevelDifference = 0;
  1605. }
  1606.  
  1607. if ( stats.HasAbility(theGame.params.ENEMY_BONUS_DEADLY) ) stats.RemoveAbility(theGame.params.ENEMY_BONUS_DEADLY); else
  1608. if ( stats.HasAbility(theGame.params.ENEMY_BONUS_HIGH) ) stats.RemoveAbility(theGame.params.ENEMY_BONUS_HIGH); else
  1609. if ( stats.HasAbility(theGame.params.ENEMY_BONUS_LOW) ) stats.RemoveAbility(theGame.params.ENEMY_BONUS_LOW); else
  1610. if ( stats.HasAbility(theGame.params.MONSTER_BONUS_DEADLY) ) stats.RemoveAbility(theGame.params.MONSTER_BONUS_DEADLY); else
  1611. if ( stats.HasAbility(theGame.params.MONSTER_BONUS_HIGH) ) stats.RemoveAbility(theGame.params.MONSTER_BONUS_HIGH); else
  1612. if ( stats.HasAbility(theGame.params.MONSTER_BONUS_LOW) ) stats.RemoveAbility(theGame.params.MONSTER_BONUS_LOW);
  1613. stats.RemoveAbilityAll(theGame.params.ENEMY_BONUS_PER_LEVEL);
  1614. stats.RemoveAbilityAll(theGame.params.MONSTER_BONUS_PER_LEVEL_GROUP_ARMORED);
  1615. stats.RemoveAbilityAll(theGame.params.MONSTER_BONUS_PER_LEVEL_GROUP);
  1616. stats.RemoveAbilityAll(theGame.params.MONSTER_BONUS_PER_LEVEL_ARMORED );
  1617. stats.RemoveAbilityAll(theGame.params.MONSTER_BONUS_PER_LEVEL);
  1618.  
  1619. if ( IsHuman() && GetStat( BCS_Essence, true ) < 0 )
  1620. {
  1621. if ( npcGroupType != ENGT_Guard )
  1622. {
  1623. if ( !stats.HasAbility(theGame.params.ENEMY_BONUS_PER_LEVEL) )
  1624. {
  1625. stats.AddAbilityMultiple(theGame.params.ENEMY_BONUS_PER_LEVEL, npcLevel-1);
  1626. }
  1627. }
  1628. else
  1629. {
  1630. if ( !stats.HasAbility(theGame.params.ENEMY_BONUS_PER_LEVEL) )
  1631. {
  1632. stats.AddAbilityMultiple(theGame.params.ENEMY_BONUS_PER_LEVEL, 1 + GetWitcherPlayer().GetLevel() + RandRange( 13, 11 ) );
  1633. if ( FactsQuerySum("NewGamePlus") > 0 )
  1634. {
  1635. stats.AddAbilityMultiple(theGame.params.ENEMY_BONUS_PER_LEVEL, RandRange( 13, 11 ) );
  1636. }
  1637. }
  1638. }
  1639.  
  1640. if ( thePlayer.IsCiri() && theGame.GetDifficultyMode() == EDM_Hardcore && !stats.HasAbility('CiriHardcoreDebuffHuman') )
  1641. {
  1642. stats.AddAbility('CiriHardcoreDebuffHuman');
  1643. }
  1644.  
  1645. if ( !ciriEntity )
  1646. {
  1647. lvlDiff = (int)CalculateAttributeValue( GetAttributeValue( 'level',,true ) ) - playerLevel;
  1648. if ( lvlDiff >= theGame.params.LEVEL_DIFF_DEADLY ) { if ( !stats.HasAbility(theGame.params.ENEMY_BONUS_DEADLY) )
  1649. {
  1650. stats.AddAbility(theGame.params.ENEMY_BONUS_DEADLY, true); AddBuffImmunity(EET_Blindness, 'DeadlyEnemy', true);
  1651. AddBuffImmunity(EET_WraithBlindness, 'DeadlyEnemy', true); }
  1652. }
  1653. else if ( lvlDiff >= theGame.params.LEVEL_DIFF_HIGH )
  1654. {
  1655. if ( !stats.HasAbility(theGame.params.ENEMY_BONUS_HIGH) )
  1656. {
  1657. stats.AddAbility(theGame.params.ENEMY_BONUS_HIGH, true);
  1658. }
  1659. }
  1660. else if ( lvlDiff > -theGame.params.LEVEL_DIFF_HIGH )
  1661. {
  1662. }
  1663. else
  1664. {
  1665. if ( !stats.HasAbility(theGame.params.ENEMY_BONUS_LOW) )
  1666. {
  1667. stats.AddAbility(theGame.params.ENEMY_BONUS_LOW, true);
  1668. }
  1669. }
  1670. }
  1671. }
  1672. else
  1673. {
  1674. if ( GetStat( BCS_Vitality, true ) > 0 )
  1675. {
  1676. if ( !ciriEntity )
  1677. {
  1678. lvlDiff = (int)CalculateAttributeValue( GetAttributeValue( 'level',,true ) ) - playerLevel;
  1679. if ( lvlDiff >= theGame.params.LEVEL_DIFF_DEADLY ) { if ( !stats.HasAbility(theGame.params.ENEMY_BONUS_DEADLY) ) { stats.AddAbility(theGame.params.ENEMY_BONUS_DEADLY, true); AddBuffImmunity(EET_Blindness, 'DeadlyEnemy', true); AddBuffImmunity(EET_WraithBlindness, 'DeadlyEnemy', true); } }
  1680. else if ( lvlDiff >= theGame.params.LEVEL_DIFF_HIGH ) { if ( !stats.HasAbility(theGame.params.ENEMY_BONUS_HIGH) ) stats.AddAbility(theGame.params.ENEMY_BONUS_HIGH, true);}
  1681. else if ( lvlDiff > -theGame.params.LEVEL_DIFF_HIGH ) { }
  1682. else { if ( !stats.HasAbility(theGame.params.ENEMY_BONUS_LOW) ) stats.AddAbility(theGame.params.ENEMY_BONUS_LOW, true); }
  1683.  
  1684. if ( !stats.HasAbility(theGame.params.ENEMY_BONUS_PER_LEVEL) ) stats.AddAbilityMultiple(theGame.params.ENEMY_BONUS_PER_LEVEL, npcLevel-1);
  1685. }
  1686. }
  1687. else
  1688. {
  1689.  
  1690. if( !stats.HasAbility(theGame.params.MONSTER_BONUS_PER_LEVEL_GROUP_ARMORED) &&
  1691. !stats.HasAbility(theGame.params.MONSTER_BONUS_PER_LEVEL_ARMORED) &&
  1692. !stats.HasAbility(theGame.params.MONSTER_BONUS_PER_LEVEL_GROUP) &&
  1693. !stats.HasAbility(theGame.params.MONSTER_BONUS_PER_LEVEL)
  1694. )
  1695. {
  1696. if ( CalculateAttributeValue(GetTotalArmor()) > 0.f )
  1697. {
  1698. if ( GetIsMonsterTypeGroup() )
  1699. {
  1700. stats.AddAbilityMultiple(theGame.params.MONSTER_BONUS_PER_LEVEL_GROUP_ARMORED, npcLevel-1);
  1701. }
  1702. else
  1703. {
  1704. stats.AddAbilityMultiple(theGame.params.MONSTER_BONUS_PER_LEVEL_ARMORED, npcLevel-1);
  1705. }
  1706. }
  1707. else
  1708. {
  1709. if ( GetIsMonsterTypeGroup() )
  1710. {
  1711. stats.AddAbilityMultiple(theGame.params.MONSTER_BONUS_PER_LEVEL_GROUP, npcLevel-1);
  1712. }
  1713. else
  1714. {
  1715. stats.AddAbilityMultiple(theGame.params.MONSTER_BONUS_PER_LEVEL, npcLevel-1);
  1716. }
  1717. }
  1718. }
  1719.  
  1720. if ( thePlayer.IsCiri() && theGame.GetDifficultyMode() == EDM_Hardcore && !stats.HasAbility('CiriHardcoreDebuffMonster') ) stats.AddAbility('CiriHardcoreDebuffMonster');
  1721.  
  1722. if ( !ciriEntity )
  1723. {
  1724. lvlDiff = (int)CalculateAttributeValue(GetAttributeValue('level',,true)) - playerLevel;
  1725. if ( lvlDiff >= theGame.params.LEVEL_DIFF_DEADLY ) { if ( !stats.HasAbility(theGame.params.MONSTER_BONUS_DEADLY) ) { stats.AddAbility(theGame.params.MONSTER_BONUS_DEADLY, true); AddBuffImmunity(EET_Blindness, 'DeadlyEnemy', true); AddBuffImmunity(EET_WraithBlindness, 'DeadlyEnemy', true); } }
  1726. else if ( lvlDiff >= theGame.params.LEVEL_DIFF_HIGH ) { if ( !stats.HasAbility(theGame.params.MONSTER_BONUS_HIGH) ) stats.AddAbility(theGame.params.MONSTER_BONUS_HIGH, true); }
  1727. else if ( lvlDiff > -theGame.params.LEVEL_DIFF_HIGH ) { }
  1728. else { if ( !stats.HasAbility(theGame.params.MONSTER_BONUS_LOW) ) stats.AddAbility(theGame.params.MONSTER_BONUS_LOW, true); }
  1729. }
  1730. }
  1731.  
  1732. }
  1733. */
  1734.  
  1735. Scaling().OpponentSetup(this, abilityManager, npcStats, currentLevel, displayLevel);
  1736. }
  1737.  
  1738.  
  1739. public timer function InitWeatherBonus( dt : float, id : int)
  1740. {
  1741. weatherAbilityHandler = new W3EEAbilityHandler in this;
  1742. weatherAbilityHandler.Init(this);
  1743. }
  1744. // W3EE - End
  1745.  
  1746. public function SetParentEncounter( encounter : CEncounter )
  1747. {
  1748. parentEncounter = encounter;
  1749. }
  1750.  
  1751. public function GetParentEncounter() : CEncounter
  1752. {
  1753. return parentEncounter;
  1754. }
  1755.  
  1756. public function GainStat( stat : EBaseCharacterStats, amount : float )
  1757. {
  1758.  
  1759. if(stat == BCS_Panic && IsHorse() && thePlayer.GetUsedVehicle() == this)
  1760. {
  1761. return;
  1762. }
  1763.  
  1764. super.GainStat(stat, amount);
  1765. }
  1766.  
  1767. public function ForceSetStat(stat : EBaseCharacterStats, val : float)
  1768. {
  1769.  
  1770. if(stat == BCS_Panic && IsHorse() && thePlayer.GetUsedVehicle() == this && val >= GetStat(BCS_Panic))
  1771. {
  1772. return;
  1773. }
  1774.  
  1775. super.ForceSetStat(stat, val);
  1776. }
  1777.  
  1778.  
  1779.  
  1780.  
  1781.  
  1782. timer function FundamentalsAchFailTimer(dt : float, id : int)
  1783. {
  1784. RemoveTag('failedFundamentalsAchievement');
  1785. }
  1786.  
  1787.  
  1788.  
  1789.  
  1790.  
  1791. event OnCriticalStateAnimStop()
  1792. {
  1793. isRecoveringFromKnockdown = false;
  1794. }
  1795.  
  1796. protected function CriticalBuffInformBehavior(buff : CBaseGameplayEffect)
  1797. {
  1798. SignalGameplayEventParamInt('CriticalState',(int)GetBuffCriticalType(buff));
  1799. }
  1800.  
  1801.  
  1802. public function StartCSAnim(buff : CBaseGameplayEffect) : bool
  1803. {
  1804. if(super.StartCSAnim(buff))
  1805. {
  1806. CriticalBuffInformBehavior(buff);
  1807. return true;
  1808. }
  1809.  
  1810. return false;
  1811. }
  1812.  
  1813. public function CSAnimStarted(buff : CBaseGameplayEffect) : bool
  1814. {
  1815. return super.StartCSAnim(buff);
  1816. }
  1817.  
  1818. function SetCanPlayHitAnim( flag : bool )
  1819. {
  1820. if( !flag && this.IsHuman() && this.GetAttitude( thePlayer ) != AIA_Friendly )
  1821. {
  1822. super.SetCanPlayHitAnim( flag );
  1823. }
  1824. else
  1825. {
  1826. super.SetCanPlayHitAnim( flag );
  1827. }
  1828. }
  1829.  
  1830.  
  1831.  
  1832. event OnStartFistfightMinigame()
  1833. {
  1834. super.OnStartFistfightMinigame();
  1835.  
  1836. thePlayer.ProcessLockTarget( this );
  1837. SignalGameplayEventParamInt('ChangePreferedCombatStyle',(int)EBG_Combat_Fists );
  1838. SetTemporaryAttitudeGroup( 'fistfight_opponent', AGP_Fistfight );
  1839. ForceVulnerableImmortalityMode();
  1840. if ( !thePlayer.IsFistFightMinigameToTheDeath() )
  1841. SetImmortalityMode(AIM_Unconscious, AIC_Fistfight);
  1842. if(FactsQuerySum("NewGamePlus") > 0)
  1843. {FistFightNewGamePlusSetup();}
  1844. // W3EE - Begin
  1845. //FistFightHealthSetup();
  1846. abilityManager.SetStatPointMax(BCS_Stamina, abilityManager.GetStatMax(BCS_Stamina) * 4.f);
  1847. abilityManager.SetStatPointCurrent(BCS_Stamina, abilityManager.GetStatMax(BCS_Stamina));
  1848. SetHealthPerc(100);
  1849. // W3EE - End
  1850.  
  1851. }
  1852.  
  1853. event OnEndFistfightMinigame()
  1854. {
  1855. SignalGameplayEvent('ResetPreferedCombatStyle');
  1856. ResetTemporaryAttitudeGroup( AGP_Fistfight );
  1857. RestoreImmortalityMode();
  1858. LowerGuard();
  1859. if ( IsKnockedUnconscious() )
  1860. {
  1861. SignalGameplayEvent('ForceStopUnconscious');
  1862. }
  1863. if ( !IsAlive() )
  1864. {
  1865. Revive();
  1866. }
  1867. // W3EE - Begin
  1868. abilityManager.SetStatPointMax(BCS_Stamina, abilityManager.GetStatMax(BCS_Stamina) / 4.f);
  1869. //FistFightHealthSetup();
  1870. // W3EE - End
  1871.  
  1872. super.OnEndFistfightMinigame();
  1873. }
  1874.  
  1875. private function FistFightHealthSetup()
  1876. {
  1877.  
  1878. if ( HasAbility( 'fistfight_minigame' ) )
  1879. {
  1880. FistFightersHealthDiff();
  1881. }
  1882. else return;
  1883.  
  1884. }
  1885.  
  1886. private function FistFightersHealthDiff()
  1887. {
  1888. var vitality : float;
  1889. var stats : CCharacterStats;
  1890. stats = GetCharacterStats();
  1891.  
  1892. if ( stats.HasAbility( 'StatsFistsTutorial' ) )
  1893. {
  1894. stats.AddAbility( 'HealthFistFightTutorial', false );
  1895. }
  1896. else if ( stats.HasAbility( 'StatsFistsEasy' ) )
  1897. {
  1898. stats.AddAbility( 'HealthFistFightEasy', false );
  1899. }
  1900. else if ( stats.HasAbility( 'StatsFistsMedium' ) )
  1901. {
  1902. stats.AddAbility( 'HealthFistFightMedium', false );
  1903. }
  1904. else if ( stats.HasAbility( 'StatsFistsHard' ) )
  1905. {
  1906. stats.AddAbility( 'HealthFistFightHard', false );
  1907. }
  1908. vitality = abilityManager.GetStatMax( BCS_Vitality );
  1909. SetHealthPerc( 100 );
  1910. }
  1911.  
  1912. private function FistFightNewGamePlusSetup()
  1913. {
  1914. if ( HasAbility( 'NPCLevelBonus' ) )
  1915. {
  1916. RemoveAbilityMultiple( 'NPCLevelBonus', theGame.params.GetNewGamePlusLevel() );
  1917. newGamePlusFakeLevelAddon = true;
  1918. currentLevel -= theGame.params.GetNewGamePlusLevel();
  1919. RecalcLevel();
  1920. }
  1921. }
  1922.  
  1923. private function ApplyFistFightLevelDiff()
  1924. {
  1925. var lvlDiff : int;
  1926. var i : int;
  1927. var attribute : SAbilityAttributeValue;
  1928. var min, max : SAbilityAttributeValue;
  1929. var ffHP, ffAP : SAbilityAttributeValue;
  1930. var dm : CDefinitionsManagerAccessor;
  1931.  
  1932. lvlDiff = (int)CalculateAttributeValue(GetAttributeValue('level',,true)) - thePlayer.GetLevel();
  1933.  
  1934. if ( !HasAbility('NPC fists _Stats') )
  1935. {
  1936. dm = theGame.GetDefinitionsManager();
  1937. dm.GetAbilityAttributeValue('NPC fists _Stats', 'vitality', min, max);
  1938. ffHP = GetAttributeRandomizedValue(min, max);
  1939. dm.GetAbilityAttributeValue('NPC fists _Stats', 'attack_power', min, max);
  1940. ffAP = GetAttributeRandomizedValue(min, max);
  1941. }
  1942.  
  1943. if ( lvlDiff < -theGame.params.LEVEL_DIFF_HIGH )
  1944. {
  1945. for (i=0; i < 5; i+=1)
  1946. {
  1947. AddAbility(theGame.params.ENEMY_BONUS_FISTFIGHT_LOW, true);
  1948. attribute = GetAttributeValue('vitality');
  1949. attribute += ffHP;
  1950. if (attribute.valueMultiplicative <= 0)
  1951. {
  1952. RemoveAbility(theGame.params.ENEMY_BONUS_FISTFIGHT_LOW);
  1953. return;
  1954. }
  1955. attribute = GetAttributeValue('attack_power');
  1956. attribute += ffAP;
  1957. if (attribute.valueMultiplicative <= 0)
  1958. {
  1959. RemoveAbility(theGame.params.ENEMY_BONUS_FISTFIGHT_LOW);
  1960. return;
  1961. }
  1962. }
  1963. }
  1964. else if ( lvlDiff < 0 )
  1965. {
  1966. for (i=0; i < -lvlDiff; i+=1)
  1967. {
  1968. AddAbility(theGame.params.ENEMY_BONUS_FISTFIGHT_LOW, true);
  1969. attribute = GetAttributeValue('vitality');
  1970. if (attribute.valueMultiplicative <= 0)
  1971. {
  1972. RemoveAbility(theGame.params.ENEMY_BONUS_FISTFIGHT_LOW);
  1973. return;
  1974. }
  1975. attribute = GetAttributeValue('attack_power');
  1976. if (attribute.valueMultiplicative <= 0)
  1977. {
  1978. RemoveAbility(theGame.params.ENEMY_BONUS_FISTFIGHT_LOW);
  1979. return;
  1980. }
  1981. }
  1982. }
  1983. else if ( lvlDiff > theGame.params.LEVEL_DIFF_HIGH )
  1984. AddAbilityMultiple(theGame.params.ENEMY_BONUS_FISTFIGHT_HIGH, 5);
  1985. else if ( lvlDiff > 0 )
  1986. AddAbilityMultiple(theGame.params.ENEMY_BONUS_FISTFIGHT_HIGH, lvlDiff);
  1987. }
  1988.  
  1989. private function RemoveFistFightLevelDiff()
  1990. {
  1991. RemoveAbilityMultiple(theGame.params.ENEMY_BONUS_FISTFIGHT_LOW, 5);
  1992. RemoveAbilityMultiple(theGame.params.ENEMY_BONUS_FISTFIGHT_HIGH, 5);
  1993. }
  1994.  
  1995.  
  1996.  
  1997.  
  1998.  
  1999. private function IsThisStanceRegular( Stance : ENpcStance ) : bool
  2000. {
  2001. if( Stance == NS_Normal ||
  2002. Stance == NS_Strafe ||
  2003. Stance == NS_Retreat )
  2004. {
  2005. return true;
  2006. }
  2007.  
  2008. return false;
  2009. }
  2010.  
  2011. private function IsThisStanceDefensive( Stance : ENpcStance ) : bool
  2012. {
  2013. if( Stance == NS_Guarded ||
  2014. Stance == NS_Guarded )
  2015. {
  2016. return true;
  2017. }
  2018.  
  2019. return false;
  2020. }
  2021.  
  2022. function GetCurrentStance() : ENpcStance
  2023. {
  2024. var l_currentStance : int;
  2025. l_currentStance = (int)this.GetBehaviorVariable( 'npcStance');
  2026. return l_currentStance;
  2027. }
  2028.  
  2029. function GetRegularStance() : ENpcStance
  2030. {
  2031. return this.regularStance;
  2032. }
  2033.  
  2034. function ReturnToRegularStance()
  2035. {
  2036. this.SetBehaviorVariable( 'npcStance',(int)this.regularStance);
  2037. }
  2038.  
  2039. function IsInRegularStance() : bool
  2040. {
  2041. if( GetCurrentStance() == GetRegularStance() )
  2042. {
  2043. return true;
  2044. }
  2045.  
  2046. return false;
  2047. }
  2048.  
  2049. function ChangeStance( newStance : ENpcStance ) : bool
  2050. {
  2051. if ( IsThisStanceDefensive( newStance ) )
  2052. {
  2053. LogChannel('NPC ChangeStance', "You shouldn't use this function to change to this stance - " + newStance );
  2054. }
  2055. else if ( IsThisStanceRegular( newStance ) )
  2056. {
  2057. if ( this.SetBehaviorVariable( 'npcStance',(int)newStance) )
  2058. {
  2059. this.regularStance = newStance;
  2060. return true;
  2061. }
  2062. }
  2063. else
  2064. {
  2065. return this.SetBehaviorVariable( 'npcStance',(int)newStance);
  2066. }
  2067. return false;
  2068. }
  2069.  
  2070. function RaiseGuard() : bool
  2071. {
  2072. SetGuarded( true );
  2073. return true;
  2074. }
  2075.  
  2076. function LowerGuard() : bool
  2077. {
  2078. SetGuarded( false );
  2079. return true;
  2080. }
  2081.  
  2082.  
  2083.  
  2084.  
  2085.  
  2086. function IsInAgony() : bool
  2087. {
  2088. return bAgony;
  2089. }
  2090.  
  2091. function EnterAgony()
  2092. {
  2093. bAgony = true;
  2094. }
  2095.  
  2096. function EndAgony()
  2097. {
  2098. bAgony = false;
  2099. }
  2100.  
  2101. function EnableDeathAndAgony()
  2102. {
  2103. bPlayDeathAnim = true;
  2104. bAgonyDisabled = false;
  2105. }
  2106.  
  2107. function EnableDeath()
  2108. {
  2109. bPlayDeathAnim = true;
  2110. }
  2111.  
  2112. function EnableAgony()
  2113. {
  2114. bAgonyDisabled = false;
  2115. }
  2116.  
  2117. function DisableDeathAndAgony()
  2118. {
  2119. bPlayDeathAnim = false;
  2120. bAgonyDisabled = true;
  2121. }
  2122. function DisableAgony()
  2123. {
  2124. bAgonyDisabled = true;
  2125. }
  2126.  
  2127. function IsAgonyDisabled() : bool
  2128. {
  2129. return bAgonyDisabled;
  2130. }
  2131.  
  2132. function IsInFinisherAnim() : bool
  2133. {
  2134. return bFinisher;
  2135. }
  2136.  
  2137. function FinisherAnimStart()
  2138. {
  2139. bPlayDeathAnim = false;
  2140. bFinisher = true;
  2141. SetBehaviorMimicVariable( 'gameplayMimicsMode', (float)(int)GMM_Death );
  2142. }
  2143.  
  2144. function FinisherAnimInterrupted()
  2145. {
  2146. bPlayDeathAnim = true;
  2147. bFinisher = false;
  2148. bFinisherInterrupted = true;
  2149. }
  2150.  
  2151. function ResetFinisherAnimInterruptionState()
  2152. {
  2153. bFinisherInterrupted = false;
  2154. }
  2155.  
  2156. function WasFinisherAnimInterrupted() : bool
  2157. {
  2158. return bFinisherInterrupted;
  2159. }
  2160.  
  2161. function FinisherAnimEnd()
  2162. {
  2163. bFinisher = false;
  2164. }
  2165.  
  2166. function ShouldPlayDeathAnim() : bool
  2167. {
  2168. return bPlayDeathAnim;
  2169. }
  2170.  
  2171. function NPCGetAgonyAnim() : CName
  2172. {
  2173. var agonyType : float;
  2174. agonyType = GetBehaviorVariable( 'AgonyType');
  2175.  
  2176. if (agonyType == (int)AT_ThroatCut)
  2177. {
  2178. return 'man_throat_cut_start';
  2179. }
  2180. else if(agonyType == (int)AT_Knockdown)
  2181. {
  2182. return 'man_wounded_crawl_killed';
  2183. }
  2184. else
  2185. return '';
  2186. }
  2187.  
  2188. function GeraltGetAgonyAnim() : CName
  2189. {
  2190. var agonyType : float;
  2191. agonyType = GetBehaviorVariable( 'AgonyType');
  2192.  
  2193. if (agonyType == (int)AT_ThroatCut)
  2194. {
  2195. return 'man_ger_throat_cut_attack_01';
  2196. }
  2197. else if(agonyType == (int)AT_Knockdown)
  2198. {
  2199. return 'man_ger_crawl_finish';
  2200. }
  2201. else
  2202. return '';
  2203. }
  2204.  
  2205.  
  2206.  
  2207.  
  2208.  
  2209. protected function PlayHitAnimation(damageAction : W3DamageAction, animType : EHitReactionType)
  2210. {
  2211. var node : CNode;
  2212.  
  2213. SetBehaviorVariable( 'HitReactionWeapon', ProcessSwordOrFistHitReaction( this, (CActor)damageAction.attacker ) );
  2214. SetBehaviorVariable( 'HitReactionType',(int)animType);
  2215.  
  2216. if ( damageAction.attacker )
  2217. {
  2218. super.PlayHitAnimation( damageAction, animType );
  2219. node = (CNode)damageAction.causer;
  2220. if (node)
  2221. {
  2222. SetHitReactionDirection(node);
  2223. }
  2224. else
  2225. {
  2226. SetHitReactionDirection(damageAction.attacker);
  2227. }
  2228. SetDetailedHitReaction(damageAction.GetSwingType(), damageAction.GetSwingDirection());
  2229. }
  2230.  
  2231. if ( this.customHits )
  2232. {
  2233. damageAction.customHitReactionRequested = true;
  2234. }
  2235. else
  2236. {
  2237. damageAction.hitReactionAnimRequested = true;
  2238. }
  2239. }
  2240.  
  2241. public function GetAbilityBuffStackedOnEnemyHitName() : name
  2242. {
  2243. return abilityBuffStackedOnEnemyHitName;
  2244. }
  2245.  
  2246. // W3EE - Begin
  2247. var canGlyphHit : bool; default canGlyphHit = true;
  2248. public function SetCanGlyphHit( b : bool )
  2249. {
  2250. canGlyphHit = b;
  2251. }
  2252.  
  2253. public function CanGlyphHit() : bool
  2254. {
  2255. return canGlyphHit;
  2256. }
  2257.  
  2258. timer function StartGlyphCooldown( dt : float, id : int )
  2259. {
  2260. canGlyphHit = true;
  2261. }
  2262. // W3EE - End
  2263.  
  2264. public function ReactToBeingHit(damageAction : W3DamageAction, optional buffNotApplied : bool) : bool
  2265. {
  2266. var ret : bool;
  2267. var percentageLoss : float;
  2268. var totalHealth : float;
  2269. var damaveValue : float;
  2270. var poiseValue : float;
  2271. var healthLossToForceLand_perc : SAbilityAttributeValue;
  2272. var witcher : W3PlayerWitcher;
  2273. var node : CNode;
  2274. var boltCauser : W3ArrowProjectile;
  2275. var yrdenCauser : W3YrdenEntityStateYrdenShock;
  2276. var attackAction : W3Action_Attack;
  2277.  
  2278. damaveValue = damageAction.GetDamageDealt();
  2279. totalHealth = GetMaxHealth();
  2280. percentageLoss = damaveValue / totalHealth;
  2281. healthLossToForceLand_perc = GetAttributeValue( 'healthLossToForceLand_perc' );
  2282. poiseValue = GetPoiseValue() * GetHealthPercents();
  2283.  
  2284.  
  2285. if( percentageLoss >= healthLossToForceLand_perc.valueBase && ( GetCurrentStance() == NS_Fly || ( !IsUsingVehicle() && GetCurrentStance() != NS_Swim && !((CMovingPhysicalAgentComponent) GetMovingAgentComponent()).IsOnGround()) ) && !(damageAction.IsDoTDamage() && !damageAction.DealsAnyDamage()) )
  2286. {
  2287.  
  2288. if( !((CBaseGameplayEffect) damageAction.causer ) )
  2289. {
  2290. damageAction.AddEffectInfo( EET_Knockdown);
  2291. }
  2292. }
  2293.  
  2294.  
  2295. boltCauser = (W3ArrowProjectile)( damageAction.causer );
  2296. yrdenCauser = (W3YrdenEntityStateYrdenShock)( damageAction.causer );
  2297. if( boltCauser /*|| yrdenCauser*/ )
  2298. {
  2299. if( HasAbility( 'AdditiveHits' ) )
  2300. {
  2301. SetUseAdditiveHit( true, GetCriticalCancelAdditiveHit(), true );
  2302. ret = super.ReactToBeingHit(damageAction, buffNotApplied);
  2303.  
  2304. if( ret || damageAction.DealsAnyDamage())
  2305. SignalGameplayDamageEvent('BeingHit', damageAction );
  2306. }
  2307. else if( HasAbility( 'mon_wild_hunt_default' ) )
  2308. {
  2309. ret = false;
  2310. }
  2311. // W3EE - Begin
  2312. else if( /*!boltCauser.HasTag( 'bodkinbolt' ) ||*/ this.IsUsingHorse() || RandRange(100) < 75.f )
  2313. // W3EE - End
  2314. {
  2315. ret = super.ReactToBeingHit(damageAction, buffNotApplied);
  2316.  
  2317. if( ret || damageAction.DealsAnyDamage())
  2318. SignalGameplayDamageEvent('BeingHit', damageAction );
  2319. }
  2320. else
  2321. {
  2322. ret = false;
  2323. }
  2324. }
  2325. else if( yrdenCauser )
  2326. {
  2327. if( RandF() <= MinF(1, 0.3f * ((W3PlayerWitcher)damageAction.attacker).GetSkillLevel(S_Magic_s03) * (1.f - poiseValue)) )
  2328. {
  2329. ret = super.ReactToBeingHit(damageAction, buffNotApplied);
  2330.  
  2331. if( ret || damageAction.DealsAnyDamage())
  2332. SignalGameplayDamageEvent('BeingHit', damageAction );
  2333. }
  2334. else
  2335. {
  2336. ret = false;
  2337. }
  2338. }
  2339. else
  2340. {
  2341. ret = super.ReactToBeingHit(damageAction, buffNotApplied);
  2342.  
  2343. if( ret || damageAction.DealsAnyDamage() )
  2344. SignalGameplayDamageEvent('BeingHit', damageAction );
  2345. }
  2346.  
  2347. if( damageAction.additiveHitReactionAnimRequested == true )
  2348. {
  2349. node = (CNode)damageAction.causer;
  2350. if (node)
  2351. {
  2352. SetHitReactionDirection(node);
  2353. }
  2354. else
  2355. {
  2356. SetHitReactionDirection(damageAction.attacker);
  2357. }
  2358. }
  2359.  
  2360. if(((CPlayer)damageAction.attacker || !((CNewNPC)damageAction.attacker)) && damageAction.DealsAnyDamage())
  2361. theTelemetry.LogWithLabelAndValue( TE_FIGHT_ENEMY_GETS_HIT, damageAction.victim.ToString(), (int)damageAction.processedDmg.vitalityDamage + (int)damageAction.processedDmg.essenceDamage );
  2362.  
  2363.  
  2364. witcher = GetWitcherPlayer();
  2365. if ( damageAction.attacker == witcher && HasBuff( EET_AxiiGuardMe ) )
  2366. {
  2367.  
  2368. //if(!witcher.CanUseSkill(S_Magic_s05) || witcher.GetSkillLevel(S_Magic_s05) < 3) //W3EE
  2369. RemoveBuff(EET_AxiiGuardMe, true);
  2370. }
  2371.  
  2372. if(damageAction.attacker == thePlayer && damageAction.DealsAnyDamage() && !damageAction.IsDoTDamage())
  2373. {
  2374. attackAction = (W3Action_Attack) damageAction;
  2375.  
  2376.  
  2377.  
  2378.  
  2379. if(attackAction && attackAction.UsedZeroStaminaPerk())
  2380. {
  2381. ForceSetStat(BCS_Stamina, 0.f);
  2382. }
  2383. }
  2384.  
  2385. return ret;
  2386. }
  2387.  
  2388.  
  2389.  
  2390.  
  2391.  
  2392. function Kill( source : name, optional ignoreImmortalityMode : bool, optional attacker : CGameplayEntity )
  2393. {
  2394. var action : W3DamageAction;
  2395.  
  2396. if ( theGame.CanLog() )
  2397. {
  2398. LogDMHits( "CActor.Kill: called for actor <<" + this + ">> with source <<" + source + ">>" );
  2399. }
  2400.  
  2401. action = GetKillAction( source, ignoreImmortalityMode, attacker );
  2402.  
  2403. if ( this.IsKnockedUnconscious() )
  2404. {
  2405. DisableDeathAndAgony();
  2406. OnDeath(action);
  2407. }
  2408. else if ( !abilityManager )
  2409. {
  2410. OnDeath(action);
  2411. }
  2412. else
  2413. {
  2414. if ( ignoreImmortalityMode )
  2415. this.immortalityFlags = 0;
  2416.  
  2417. theGame.damageMgr.ProcessAction(action);
  2418. }
  2419.  
  2420. delete action;
  2421. }
  2422.  
  2423. public final function GetLevel() : int
  2424. {
  2425. return (int)CalculateAttributeValue(GetAttributeValue('level',,true));
  2426. }
  2427.  
  2428. public final function GetLevelFromLocalVar() : int
  2429. {
  2430. return currentLevel;
  2431. }
  2432.  
  2433. function GetExperienceDifferenceLevelName( out strLevel : string ) : string
  2434. {
  2435. //W3EE - Begin
  2436. var lvlDiff, lvlDisplay : int;
  2437. var ciriEntity : W3ReplacerCiri;
  2438.  
  2439. var Options : W3EEOptionHandler;
  2440. var Fixes : W3EEExperienceHandler;
  2441.  
  2442. Fixes = new W3EEExperienceHandler in this;
  2443.  
  2444. /* if ( !Options().Scale() )
  2445. {
  2446. lvlDisplay = GetLevel() + levelFakeAddon;
  2447.  
  2448. if ( newGamePlusFakeLevelAddon )
  2449. {
  2450. lvlDisplay += theGame.params.GetNewGamePlusLevel();
  2451. }
  2452.  
  2453. if ( currentLevel > ( theGame.params.GetPlayerMaxLevel() + 5 ) )
  2454. {
  2455. currentLevel = theGame.params.GetPlayerMaxLevel() + 5;
  2456. }
  2457. lvlDiff = lvlDisplay - thePlayer.GetLevel();
  2458.  
  2459. if( GetAttitude( thePlayer ) != AIA_Hostile )
  2460. {
  2461. if( ( GetAttitudeGroup() != 'npc_charmed' ) )
  2462. {
  2463. strLevel = "";
  2464. return "none";
  2465. }
  2466. }
  2467.  
  2468. ciriEntity = (W3ReplacerCiri)thePlayer;
  2469. if ( ciriEntity )
  2470. {
  2471. strLevel = "<font color=\"#66FF66\">" + lvlDisplay + "</font>"; // #B red
  2472. return "normalLevel";
  2473. }
  2474.  
  2475.  
  2476. if ( lvlDiff >= theGame.params.LEVEL_DIFF_DEADLY )
  2477. {
  2478. strLevel = "";
  2479. return "deadlyLevel";
  2480. }
  2481. else if ( lvlDiff >= theGame.params.LEVEL_DIFF_HIGH )
  2482. {
  2483. strLevel = "<font color=\"#FF1919\">" + lvlDisplay + "</font>"; // #B red
  2484. return "highLevel";
  2485. }
  2486. else if ( lvlDiff > -theGame.params.LEVEL_DIFF_HIGH )
  2487. {
  2488. strLevel = "<font color=\"#66FF66\">" + lvlDisplay + "</font>"; // #B green
  2489. return "normalLevel";
  2490. }
  2491. else
  2492. {
  2493. strLevel = "<font color=\"#E6E6E6\">" + lvlDisplay + "</font>"; // #B grey
  2494. return "lowLevel";
  2495. }
  2496. }
  2497. else
  2498. return Experience().DisplayScaledLevel(this, displayLevel, strLevel);*/
  2499. //W3EE - End
  2500.  
  2501. return "none";
  2502. }
  2503.  
  2504.  
  2505. private function ShouldGiveExp(attacker : CGameplayEntity) : bool
  2506. {
  2507. var actor : CActor;
  2508. var npc : CNewNPC;
  2509. var victimAt : EAIAttitude;
  2510. var giveExp : bool;
  2511.  
  2512. victimAt = GetAttitudeBetween(thePlayer, this);
  2513. giveExp = false;
  2514.  
  2515.  
  2516. if(victimAt == AIA_Hostile)
  2517. {
  2518. if(attacker == thePlayer && !((W3PlayerWitcher)thePlayer) )
  2519. {
  2520.  
  2521. giveExp = false;
  2522. }
  2523. else if(attacker == thePlayer)
  2524. {
  2525.  
  2526. giveExp = true;
  2527. }
  2528.  
  2529. else if(VecDistance(thePlayer.GetWorldPosition(), GetWorldPosition()) <= 20)
  2530. {
  2531. npc = (CNewNPC)attacker;
  2532. if(!npc || npc.npcGroupType != ENGT_Guard)
  2533. {
  2534. actor = (CActor)attacker;
  2535. if(!actor)
  2536. {
  2537.  
  2538. giveExp = true;
  2539. }
  2540. else if(actor.HasTag(theGame.params.TAG_NPC_IN_PARTY) || actor.HasBuff(EET_AxiiGuardMe))
  2541. {
  2542.  
  2543. giveExp = true;
  2544. }
  2545. }
  2546. }
  2547. }
  2548.  
  2549. return giveExp;
  2550. }
  2551.  
  2552. function AddBestiaryKnowledge()
  2553. {
  2554. var manager : CWitcherJournalManager;
  2555. var resource : CJournalResource;
  2556. var entryBase : CJournalBase;
  2557.  
  2558. manager = theGame.GetJournalManager();
  2559.  
  2560. if ( AddBestiaryKnowledgeEP2() ) return;
  2561.  
  2562. if ( HasAbility( 'NoJournalEntry' )) return; else
  2563. if ( GetSfxTag() == 'sfx_arachas' && HasAbility('mon_arachas_armored') ) activateBaseBestiaryEntryWithAlias("BestiaryArmoredArachas", manager); else
  2564. if ( GetSfxTag() == 'sfx_arachas' && HasAbility('mon_poison_arachas') ) activateBaseBestiaryEntryWithAlias("BestiaryPoisonousArachas", manager); else
  2565. if ( GetSfxTag() == 'sfx_bear' ) activateBaseBestiaryEntryWithAlias("BestiaryBear", manager); else
  2566. if ( GetSfxTag() == 'sfx_alghoul' ) activateBaseBestiaryEntryWithAlias("BestiaryAlghoul", manager); else
  2567. if ( HasAbility('mon_greater_miscreant') ) activateBaseBestiaryEntryWithAlias("BestiaryMiscreant", manager); else
  2568. if ( HasAbility('mon_basilisk') ) activateBaseBestiaryEntryWithAlias("BestiaryBasilisk", manager); else
  2569. if ( HasAbility('mon_boar_base') )
  2570. {
  2571. resource = (CJournalResource)LoadResource( "BestiaryBoarEP2" );
  2572. if ( resource )
  2573. {
  2574. entryBase = resource.GetEntry();
  2575. if ( entryBase )
  2576. {
  2577. if ( manager.GetEntryStatus( entryBase ) == JS_Inactive )
  2578. {
  2579. activateBaseBestiaryEntryWithAlias("BestiaryBoar", manager);
  2580. }
  2581. }
  2582. }
  2583. } else
  2584. if ( HasAbility('mon_black_spider_base') )
  2585. {
  2586. resource = (CJournalResource)LoadResource( "BestiarySpiderEP2" );
  2587. if ( resource )
  2588. {
  2589. entryBase = resource.GetEntry();
  2590. if ( entryBase )
  2591. {
  2592. if ( manager.GetEntryStatus( entryBase ) == JS_Inactive )
  2593. {
  2594. activateBaseBestiaryEntryWithAlias("BestiarySpider", manager);
  2595. }
  2596. }
  2597. }
  2598. } else
  2599. if ( HasAbility('mon_toad_base') ) activateBaseBestiaryEntryWithAlias("BestiaryToad", manager); else
  2600. if ( HasAbility('q604_caretaker') ) activateBaseBestiaryEntryWithAlias("Bestiarycaretaker", manager); else
  2601. if ( HasAbility('mon_nightwraith_iris') ) activateBaseBestiaryEntryWithAlias("BestiaryIris", manager); else
  2602. if ( GetSfxTag() == 'sfx_cockatrice' ) activateBaseBestiaryEntryWithAlias("BestiaryCockatrice", manager); else
  2603. if ( GetSfxTag() == 'sfx_arachas' && !HasAbility('mon_arachas_armored') && !HasAbility('mon_poison_arachas') ) activateBaseBestiaryEntryWithAlias("BestiaryCrabSpider", manager); else
  2604. if ( GetSfxTag() == 'sfx_katakan' && HasAbility('mon_ekimma') ) activateBaseBestiaryEntryWithAlias("BestiaryEkkima", manager); else
  2605. if ( GetSfxTag() == 'sfx_elemental_dao' ) activateBaseBestiaryEntryWithAlias("BestiaryElemental", manager); else
  2606. if ( GetSfxTag() == 'sfx_endriaga' && HasAbility('mon_endriaga_soldier_tailed') ) activateBaseBestiaryEntryWithAlias("BestiaryEndriaga", manager); else
  2607. if ( GetSfxTag() == 'sfx_endriaga' && HasAbility('mon_endriaga_worker') ) activateBaseBestiaryEntryWithAlias("BestiaryEndriagaWorker", manager); else
  2608. if ( GetSfxTag() == 'sfx_endriaga' && HasAbility('mon_endriaga_soldier_spikey') ) activateBaseBestiaryEntryWithAlias("BestiaryEndriagaTruten", manager); else
  2609. if ( HasAbility('mon_forktail_young') || HasAbility('mon_forktail') || HasAbility('mon_forktail_mh') ) activateBaseBestiaryEntryWithAlias("BestiaryForktail", manager); else
  2610. if ( GetSfxTag() == 'sfx_ghoul' ) activateBaseBestiaryEntryWithAlias("BestiaryGhoul", manager); else
  2611. if ( GetSfxTag() == 'sfx_golem' ) activateBaseBestiaryEntryWithAlias("BestiaryGolem", manager); else
  2612. if ( GetSfxTag() == 'sfx_katakan' && !HasAbility('mon_ekimma') ) activateBaseBestiaryEntryWithAlias("BestiaryKatakan", manager); else
  2613. if ( GetSfxTag() == 'sfx_ghoul' && HasAbility('mon_greater_miscreant') ) activateBaseBestiaryEntryWithAlias("BestiaryMiscreant", manager); else
  2614. if ( HasAbility('mon_nightwraith')|| HasAbility('mon_nightwraith_mh') ) activateBaseBestiaryEntryWithAlias("BestiaryMoonwright", manager); else
  2615. if ( HasAbility('mon_noonwraith') && !HasAbility('mon_noonwraith_doppelganger') ) activateBaseBestiaryEntryWithAlias("BestiaryNoonwright", manager); else
  2616. if ( HasAbility('mon_lycanthrope') ) activateBaseBestiaryEntryWithAlias("BestiaryLycanthrope", manager); else
  2617. if ( GetSfxTag() == 'sfx_werewolf' ) activateBaseBestiaryEntryWithAlias("BestiaryWerewolf", manager); else
  2618. if ( GetSfxTag() == 'sfx_wyvern' ) activateBaseBestiaryEntryWithAlias("BestiaryWyvern", manager); else
  2619. if ( HasAbility('mon_czart') ) activateBaseBestiaryEntryWithAlias("BestiaryCzart", manager); else
  2620. if ( GetSfxTag() == 'sfx_bies' ) activateBaseBestiaryEntryWithAlias("BestiaryBies", manager); else
  2621. if ( GetSfxTag() == 'sfx_wild_dog' ) activateBaseBestiaryEntryWithAlias("BestiaryDog", manager); else
  2622. if ( GetSfxTag() == 'sfx_drowner' ) activateBaseBestiaryEntryWithAlias("BestiaryDrowner", manager); else
  2623. if ( GetSfxTag() == 'sfx_elemental_ifryt' ) activateBaseBestiaryEntryWithAlias("BestiaryFireElemental", manager); else
  2624. if ( GetSfxTag() == 'sfx_fogling' ) activateBaseBestiaryEntryWithAlias("BestiaryFogling", manager); else
  2625. if ( GetSfxTag() == 'sfx_gravehag' ) activateBaseBestiaryEntryWithAlias("BestiaryGraveHag", manager); else
  2626. if ( GetSfxTag() == 'sfx_gryphon' ) activateBaseBestiaryEntryWithAlias("BestiaryGriffin", manager); else
  2627. if ( HasAbility('mon_erynia') ) activateBaseBestiaryEntryWithAlias("BestiaryErynia", manager); else
  2628. if ( GetSfxTag() == 'sfx_harpy' ) activateBaseBestiaryEntryWithAlias("BestiaryHarpy", manager); else
  2629. if ( GetSfxTag() == 'sfx_ice_giant' ) activateBaseBestiaryEntryWithAlias("BestiaryIceGiant", manager); else
  2630. if ( GetSfxTag() == 'sfx_lessog' ) activateBaseBestiaryEntryWithAlias("BestiaryLeshy", manager); else
  2631. if ( GetSfxTag() == 'sfx_nekker' ) activateBaseBestiaryEntryWithAlias("BestiaryNekker", manager); else
  2632. if ( GetSfxTag() == 'sfx_siren' ) activateBaseBestiaryEntryWithAlias("BestiarySiren", manager); else
  2633. if ( HasTag('ice_troll') ) activateBaseBestiaryEntryWithAlias("BestiaryIceTroll", manager); else
  2634. if ( GetSfxTag() == 'sfx_troll_cave' ) activateBaseBestiaryEntryWithAlias("BestiaryCaveTroll", manager); else
  2635. if ( GetSfxTag() == 'sfx_waterhag' ) activateBaseBestiaryEntryWithAlias("BestiaryWaterHag", manager); else
  2636. if ( GetSfxTag() == 'sfx_wildhunt_minion' ) activateBaseBestiaryEntryWithAlias("BestiaryWhMinion", manager); else
  2637. if ( GetSfxTag() == 'sfx_wolf' ) activateBaseBestiaryEntryWithAlias("BestiaryWolf", manager); else
  2638. if ( GetSfxTag() == 'sfx_wraith' ) activateBaseBestiaryEntryWithAlias("BestiaryWraith", manager); else
  2639. if ( HasAbility('mon_cyclops') ) activateBaseBestiaryEntryWithAlias("BestiaryCyclop", manager); else
  2640. if ( HasAbility('mon_ice_golem') ) activateBaseBestiaryEntryWithAlias("BestiaryIceGolem", manager); else
  2641. if ( HasAbility('mon_gargoyle') ) activateBaseBestiaryEntryWithAlias("BestiaryGargoyle", manager); else
  2642. if ( HasAbility('mon_rotfiend') || HasAbility('mon_rotfiend_large')) activateBaseBestiaryEntryWithAlias("BestiaryGreaterRotFiend", manager); else
  2643. if ( HasAbility('mon_gravier') ) activateJournalBestiaryEntryWithAlias("BestiaryGraveir", manager);
  2644. }
  2645.  
  2646. function AddBestiaryKnowledgeEP2() : bool
  2647. {
  2648. var manager : CWitcherJournalManager;
  2649. var resource : CJournalResource;
  2650. var entryBase : CJournalBase;
  2651. manager = theGame.GetJournalManager();
  2652.  
  2653. if ( HasAbility('mon_mq7010_dracolizard') ) { activateBaseBestiaryEntryWithAlias("BestiaryDracolizardMatriarch", manager); return true; } else
  2654. if ( HasAbility('mon_draco_base') ) { activateBaseBestiaryEntryWithAlias("BestiaryDracolizard", manager); return true; } else
  2655. if ( HasAbility('mon_sprigan') ) { activateBaseBestiaryEntryWithAlias("BestiarySpriggan", manager); return true; } else
  2656. if ( HasAbility('mon_garkain') ) { activateBaseBestiaryEntryWithAlias("BestiaryGarkain", manager); return true; } else
  2657. if ( HasAbility('mon_panther_base') && !HasAbility('mon_panther_ghost') ) { activateBaseBestiaryEntryWithAlias("BestiaryPanther", manager); return true; } else
  2658. if ( HasAbility('mon_sharley_base') ) { activateBaseBestiaryEntryWithAlias("BestiarySharley", manager); return true; } else
  2659. if ( HasAbility('mon_barghest_base') ) { activateBaseBestiaryEntryWithAlias("BestiaryBarghest", manager); return true; } else
  2660. if ( HasAbility('mon_bruxa') ) { activateBaseBestiaryEntryWithAlias("BestiaryBruxa", manager); return true; } else
  2661. if ( HasAbility('mon_fleder') ) { activateBaseBestiaryEntryWithAlias("BestiaryFleder", manager); return true; } else
  2662. if ( HasAbility('q704_mon_protofleder') ) { activateBaseBestiaryEntryWithAlias("BestiaryProtofleder", manager); return true; } else
  2663. if ( HasAbility('mon_alp') ) { activateBaseBestiaryEntryWithAlias("BestiaryAlp", manager); return true; } else
  2664. if ( HasTag('mq7023_pale_widow') ) { activateBaseBestiaryEntryWithAlias("BestiaryPaleWidow", manager); return true; } else
  2665. if ( HasAbility('mon_scolopendromorph_base') ) { activateBaseBestiaryEntryWithAlias("BestiaryScolopendromorph", manager); return true; } else
  2666. if ( HasAbility('mon_kikimora_warrior') ) { activateBaseBestiaryEntryWithAlias("BestiaryKikimoraWarrior", manager); return true; } else
  2667. if ( HasAbility('mon_kikimora_worker') ) { activateBaseBestiaryEntryWithAlias("BestiaryKikimoraWorker", manager); return true; } else
  2668. if ( HasAbility('mon_archespor_base') ) { activateBaseBestiaryEntryWithAlias("BestiaryArchespore", manager); return true; } else
  2669. if ( HasAbility('mon_dark_pixie_base') || HasAbility('mon_q704_ft_pixies') ) { activateBaseBestiaryEntryWithAlias("BestiaryDarkPixie", manager); return true; } else
  2670. if ( HasAbility('mon_graveir') ) { activateBaseBestiaryEntryWithAlias("BestiaryDarkPixie", manager); return true; } else
  2671. if ( HasAbility('mon_wight') ) { activateBaseBestiaryEntryWithAlias("BestiaryWicht", manager); return true; } else
  2672. if ( HasAbility('mon_knight_giant') ) { activateBaseBestiaryEntryWithAlias("BestiaryDagonet", manager); return true; } else
  2673. if ( HasAbility('mon_q704_ft_wilk') ) { activateBaseBestiaryEntryWithAlias("BestiaryBigBadWolf", manager); return true; } else
  2674. if ( HasAbility('mon_q704_ft_pigs_evil') ) { activateBaseBestiaryEntryWithAlias("BestiaryPigsEvil", manager); return true; } else
  2675. if ( HasAbility('mon_mq7018_basilisk') ) { activateBaseBestiaryEntryWithAlias("BestiaryLastBasilisk", manager); return true; } else
  2676. if ( HasAbility('mon_fairytale_witch') ) { activateBaseBestiaryEntryWithAlias("BestiaryFairtaleWitch", manager); return true; } else
  2677. if ( HasAbility('banshee_rapunzel') ) { activateBaseBestiaryEntryWithAlias("BestiaryRapunzel", manager); return true; } else
  2678. if ( HasAbility('mon_nightwraith_banshee') ) { activateBaseBestiaryEntryWithAlias("BestiaryBeanshie", manager); return true; } else
  2679. if ( HasAbility('mon_black_spider_ep2_base') )
  2680. {
  2681. resource = (CJournalResource)LoadResource( "BestiarySpider" );
  2682. if ( resource )
  2683. {
  2684. entryBase = resource.GetEntry();
  2685. if ( entryBase )
  2686. {
  2687. if ( manager.GetEntryStatus( entryBase ) == JS_Inactive )
  2688. {
  2689. activateBaseBestiaryEntryWithAlias("BestiarySpiderEP2", manager);
  2690. return true;
  2691. }
  2692. }
  2693. }
  2694. } else
  2695. if ( HasAbility('mon_boar_ep2_base') )
  2696. {
  2697. resource = (CJournalResource)LoadResource( "BestiaryBoar" );
  2698. if ( resource )
  2699. {
  2700. entryBase = resource.GetEntry();
  2701. if ( entryBase )
  2702. {
  2703. if ( manager.GetEntryStatus( entryBase ) == JS_Inactive )
  2704. {
  2705. activateBaseBestiaryEntryWithAlias("BestiaryBoarEP2", manager);
  2706. return true;
  2707. }
  2708. }
  2709. }
  2710. } else
  2711. if ( HasAbility('mon_cloud_giant') ) { activateBaseBestiaryEntryWithAlias("BestiaryCloudGiant", manager); return true; }
  2712.  
  2713. return false;
  2714.  
  2715. }
  2716.  
  2717.  
  2718. public function CalculateExperiencePoints(optional skipLog : bool) : int
  2719. {
  2720. var finalExp : int;
  2721. var exp : float;
  2722. var lvlDiff : int;
  2723. var modDamage, modArmor, modVitality, modOther : float;
  2724. var stats : CCharacterStats;
  2725.  
  2726. if ( grantNoExperienceAfterKill || HasAbility('Zero_XP' ) || GetNPCType() == ENGT_Guard ) return 0;
  2727.  
  2728. // W3EE - Begin
  2729. /*modDamage = CalculateAttributeValue(GetAttributeValue('RendingDamage',,true));
  2730. modDamage += CalculateAttributeValue(GetAttributeValue('BludgeoningDamage',,true));
  2731. modDamage += CalculateAttributeValue(GetAttributeValue('FireDamage',,true));
  2732. modDamage += CalculateAttributeValue(GetAttributeValue('ElementalDamage',,true));
  2733. modDamage += CalculateAttributeValue(GetPowerStatValue(CPS_AttackPower, , true));
  2734. modDamage *= 5;
  2735.  
  2736. modArmor = CalculateAttributeValue(GetTotalArmor()) * 100;
  2737.  
  2738. modVitality = GetStatMax(BCS_Essence) + 3 * GetStatMax(BCS_Vitality);*/
  2739. // W3EE - End
  2740.  
  2741. stats = GetCharacterStats();
  2742.  
  2743. if ( stats.HasAbility('AcidSpit' ) ) modOther = modOther + 2;
  2744. if ( stats.HasAbility('Aggressive' ) ) modOther = modOther + 2;
  2745. if ( stats.HasAbility('Charge' ) ) modOther = modOther + 3;
  2746. if ( stats.HasAbility('ContactBlindness' ) ) modOther = modOther + 2;
  2747. if ( stats.HasAbility('ContactSlowdown' ) ) modOther = modOther + 2;
  2748. if ( stats.HasAbility('Cursed' ) ) modOther = modOther + 2;
  2749. if ( stats.HasAbility('BurnIgnore' ) ) modOther = modOther + 2;
  2750. if ( stats.HasAbility('DamageBuff' ) ) modOther = modOther + 2;
  2751. if ( stats.HasAbility('Draconide' ) ) modOther = modOther + 2;
  2752. if ( stats.HasAbility('Fireball' ) ) modOther = modOther + 2;
  2753. if ( stats.HasAbility('Flashstep' ) ) modOther = modOther + 2;
  2754. if ( stats.HasAbility('Flying' ) ) modOther = modOther + 10;
  2755. if ( stats.HasAbility('Frost' ) ) modOther = modOther + 4;
  2756. if ( stats.HasAbility('EssenceRegen' ) ) modOther = modOther + 2;
  2757. if ( stats.HasAbility('Gargoyle' ) ) modOther = modOther + 2;
  2758. if ( stats.HasAbility('Hypnosis' ) ) modOther = modOther + 2;
  2759. if ( stats.HasAbility('IceArmor' ) ) modOther = modOther + 5;
  2760. if ( stats.HasAbility('InstantKillImmune' ) ) modOther = modOther + 2;
  2761. if ( stats.HasAbility('JumpAttack' ) ) modOther = modOther + 2;
  2762. if ( stats.HasAbility('Magical' ) ) modOther = modOther + 2;
  2763. if ( stats.HasAbility('MistForm' ) ) modOther = modOther + 2;
  2764. if ( stats.HasAbility('MudTeleport' ) ) modOther = modOther + 2;
  2765. if ( stats.HasAbility('MudAttack' ) ) modOther = modOther + 2;
  2766. if ( stats.HasAbility('PoisonCloud' ) ) modOther = modOther + 2;
  2767. if ( stats.HasAbility('PoisonDeath' ) ) modOther = modOther + 2;
  2768. if ( stats.HasAbility('Rage' ) ) modOther = modOther + 2;
  2769. if ( stats.HasAbility('Relic' ) ) modOther = modOther + 5;
  2770. if ( stats.HasAbility('Scream' ) ) modOther = modOther + 2;
  2771. if ( stats.HasAbility('Shapeshifter' ) ) modOther = modOther + 5;
  2772. if ( stats.HasAbility('Shout' ) ) modOther = modOther + 2;
  2773. if ( stats.HasAbility('Spikes' ) ) modOther = modOther + 2;
  2774. if ( stats.HasAbility('StaggerCounter' ) ) modOther = modOther + 2;
  2775. if ( stats.HasAbility('StinkCloud' ) ) modOther = modOther + 2;
  2776. if ( stats.HasAbility('Summon' ) ) modOther = modOther + 2;
  2777. if ( stats.HasAbility('Tail' ) ) modOther = modOther + 5;
  2778. if ( stats.HasAbility('Teleport' ) ) modOther = modOther + 5;
  2779. if ( stats.HasAbility('Thorns' ) ) modOther = modOther + 2;
  2780. if ( stats.HasAbility('Throw' ) ) modOther = modOther + 2;
  2781. if ( stats.HasAbility('ThrowFire' ) ) modOther = modOther + 2;
  2782. if ( stats.HasAbility('ThrowIce' ) ) modOther = modOther + 2;
  2783. if ( stats.HasAbility('Vampire' ) ) modOther = modOther + 2;
  2784. if ( stats.HasAbility('Venom' ) ) modOther = modOther + 2;
  2785. if ( stats.HasAbility('VitalityRegen' ) ) modOther = modOther + 5;
  2786. if ( stats.HasAbility('Wave' ) ) modOther = modOther + 2;
  2787. if ( stats.HasAbility('WeakToAard' ) ) modOther = modOther - 2;
  2788. if ( stats.HasAbility('TongueAttack' ) ) modOther = modOther + 2;
  2789.  
  2790. // W3EE - Begin
  2791. exp = ( /*modDamage + modArmor + modVitality*/ modOther )/* / 99*/;
  2792.  
  2793. /*
  2794. if( thePlayer.GetEnemyUpscaling() && npcLevelToUpscaledLevelDifference > 0 ) currentLevel -= npcLevelToUpscaledLevelDifference;
  2795. if( FactsQuerySum("NewGamePlus") > 0 ) currentLevel -= theGame.params.GetNewGamePlusLevel();
  2796.  
  2797. if ( IsHuman() )
  2798. {
  2799. if ( exp > 1 + ( currentLevel * 2 ) ) { exp = 1 + ( currentLevel * 2 ); }
  2800. } else
  2801. {
  2802. if ( exp > 5 + ( currentLevel * 4 ) ) { exp = 5 + ( currentLevel * 4 ); }
  2803. }
  2804.  
  2805.  
  2806. exp += 1;
  2807.  
  2808. if( ( FactsQuerySum("NewGamePlus") > 0 ) )
  2809. {
  2810. if ( thePlayer.GetLevel() - theGame.params.GetNewGamePlusLevel() < 30 ) exp = ( exp / 4 ); else exp = ( exp / 2 );
  2811. }
  2812. else if ( thePlayer.GetLevel() < 30 ) exp = ( exp / 4 ); else exp = ( exp / 2 );
  2813.  
  2814.  
  2815. if( ( FactsQuerySum("NewGamePlus") > 0 ) )
  2816. lvlDiff = currentLevel - thePlayer.GetLevel() + theGame.params.GetNewGamePlusLevel();
  2817. else
  2818. lvlDiff = currentLevel - thePlayer.GetLevel();
  2819. if ( lvlDiff >= theGame.params.LEVEL_DIFF_DEADLY ) { exp = 25 + exp * 1.5; }
  2820. else if ( lvlDiff >= theGame.params.LEVEL_DIFF_HIGH ) { exp = exp * 1.05; }
  2821. else if ( lvlDiff > -theGame.params.LEVEL_DIFF_HIGH ) { }
  2822. else { exp = 2; }
  2823.  
  2824. if ( (FactsQuerySum("NewGamePlus") > 0 && thePlayer.GetLevel() >= (35 + theGame.params.GetNewGamePlusLevel()) ) || (FactsQuerySum("NewGamePlus") < 1 && thePlayer.GetLevel() >= 35) )
  2825. {
  2826. if ( thePlayer.GetLevel() < 45 || lvlDiff < 0 )
  2827. exp = exp * (1 + lvlDiff * theGame.params.LEVEL_DIFF_XP_MOD);
  2828. exp /= 2;
  2829. if (exp < 2) exp = 2;
  2830. }
  2831. */
  2832.  
  2833. if ( exp > 25 ) exp = 25;
  2834. // W3EE - End
  2835. if ( theGame.GetDifficultyMode() == EDM_Easy ) exp = exp * 1.2; else
  2836. if ( theGame.GetDifficultyMode() == EDM_Hard ) exp = exp * 0.9; else
  2837. if ( theGame.GetDifficultyMode() == EDM_Hardcore ) exp = exp * 0.8;
  2838. finalExp = RoundF( exp );
  2839.  
  2840. if(!skipLog)
  2841. {
  2842. LogStats("--------------------------------");
  2843. LogStats("- [CALCULATED EXP] -");
  2844. LogStats("- base, without difficulty and -");
  2845. LogStats("- level difference bonuses -");
  2846. LogStats("--------------------------------");
  2847. LogStats(" -> for entity : " + GetName());
  2848. LogStats("--------------------------------");
  2849. LogStats("* modDamage : " + modDamage);
  2850. LogStats("* modArmor : " + modArmor);
  2851. LogStats("* modVitality : " + modVitality);
  2852. LogStats("+ modOther : " + modOther);
  2853. LogStats("--------------------------------");
  2854. LogStats(" BASE EXPERIENCE POINTS = [ " + finalExp + " ]");
  2855. LogStats("--------------------------------");
  2856. }
  2857.  
  2858. return finalExp;
  2859. }
  2860.  
  2861.  
  2862. timer function StopMutation6FX( dt : float, id : int )
  2863. {
  2864. StopEffect( 'critical_frozen' );
  2865. }
  2866.  
  2867. // W3EE - Begin
  2868. timer function StopPossessionEffect( dt : float, id : int )
  2869. {
  2870. StopEffect('demonic_possession');
  2871. }
  2872.  
  2873. private var isInsideYrden : bool;
  2874. public function IsInsideYrden() : bool
  2875. {
  2876. return isInsideYrden;
  2877. }
  2878.  
  2879. public function SetInsideYrden( b : bool )
  2880. {
  2881. isInsideYrden = b;
  2882. }
  2883. // W3EE - End
  2884.  
  2885. event OnDeath( damageAction : W3DamageAction )
  2886. {
  2887. var inWater, fists, tmpBool, addAbility, isFinisher : bool;
  2888. var expPoints, npcLevel, lvlDiff, i, j : int;
  2889. var abilityName, tmpName : name;
  2890. var abilityCount, maxStack, minDist : float;
  2891. var itemExpBonus, radius : float;
  2892.  
  2893. var allItems : array<SItemUniqueId>;
  2894. var damages : array<SRawDamage>;
  2895. var atts : array<name>;
  2896. var entities : array< CGameplayEntity >;
  2897.  
  2898. var params : SCustomEffectParams;
  2899. var dmg : SRawDamage;
  2900. var weaponID : SItemUniqueId;
  2901. var min, max, bonusExp : SAbilityAttributeValue;
  2902.  
  2903. var monsterCategory : EMonsterCategory;
  2904. var attitudeToPlayer : EAIAttitude;
  2905.  
  2906. var actor , targetEntity : CActor;
  2907. var gameplayEffect : CBaseGameplayEffect;
  2908. var fxEnt : CEntity;
  2909.  
  2910. var attackAction : W3Action_Attack;
  2911. //modIgnition++
  2912. var dismembermentComp : CDismembermentComponent;
  2913. var wounds : array< name >;
  2914. var usedWound : name;
  2915. var victim : CActor;
  2916. //modIgnition--
  2917. var ciriEntity : W3ReplacerCiri;
  2918. var witcher : W3PlayerWitcher;
  2919. var blizzard : W3Potion_Blizzard;
  2920. var act : W3DamageAction;
  2921. var burningCauser : W3Effect_Burning;
  2922. var vfxEnt : W3VisualFx;
  2923. var aerondight : W3Effect_Aerondight;
  2924.  
  2925. // W3EE - Begin
  2926. var surface : CGameplayFXSurfacePost;
  2927. // W3EE - End
  2928.  
  2929. ciriEntity = (W3ReplacerCiri)thePlayer;
  2930. witcher = (W3PlayerWitcher)damageAction.attacker;
  2931.  
  2932. deathTimestamp = theGame.GetEngineTimeAsSeconds();
  2933.  
  2934.  
  2935. if( damageAction.GetBuffSourceName() == "Magic_s12" || damageAction.GetBuffSourceName() == "Glyphword 10" )
  2936. {
  2937. PlayEffect( 'critical_frozen' );
  2938. AddTimer( 'StopMutation6FX', 3.f );
  2939. }
  2940.  
  2941. // W3EE - Begin
  2942. if( witcher.HasAbility('Glyphword 8 _Stats', true) && isInsideYrden )
  2943. {
  2944. witcher.PlayEffectSingle('drain_energy_caretaker_shovel');
  2945. if( UsesEssence() )
  2946. {
  2947. witcher.GainStat(BCS_Stamina, witcher.GetStatMax(BCS_Stamina) * ClampF(GetStatMax(BCS_Essence) * 0.00003f, 0.f, 1.f ));
  2948. witcher.GainStat(BCS_Vitality, witcher.GetStatMax(BCS_Vitality) * ClampF(GetStatMax(BCS_Essence) * 0.00002f, 0.f, 1.f ));
  2949. }
  2950. else
  2951. {
  2952. witcher.GainStat(BCS_Stamina, witcher.GetStatMax(BCS_Stamina) * ClampF(GetStatMax(BCS_Vitality) * 0.00003f, 0.f, 1.f ));
  2953. witcher.GainStat(BCS_Vitality, witcher.GetStatMax(BCS_Vitality) * ClampF(GetStatMax(BCS_Vitality) * 0.00002f, 0.f, 1.f ));
  2954. }
  2955. }
  2956.  
  2957. isInsideYrden = false;
  2958. if( witcher && damageAction.IsActionMelee() )
  2959. {
  2960. witcher.GetAdrenalineEffect().AdrenalineGrantKill();
  2961. ((W3Effect_SwordKillBuff)witcher.GetBuff(EET_SwordKillBuff)).SetKillBuffActive(true);
  2962. ((W3Decoction2_Effect)witcher.GetBuff(EET_Decoction2)).HealPlayer(damageAction, witcher);
  2963. }
  2964.  
  2965. if ( GetWitcherPlayer().HasAbility('Glyphword 13 _Stats', true) && (HasBuff(EET_AxiiGuardMe) || HasBuff(EET_Confusion)) )
  2966. {
  2967. abilityName = 'Glyphword 13 _Stats';
  2968. min = GetWitcherPlayer().GetAbilityAttributeValue(abilityName, 'glyphword_range');
  2969. FindGameplayEntitiesInRange(entities, this, min.valueAdditive, 10,, FLAG_OnlyAliveActors + FLAG_ExcludeTarget, this);
  2970. // W3EE - End
  2971.  
  2972. minDist = 10000;
  2973. for (i = 0; i < entities.Size(); i += 1)
  2974. {
  2975. if ( entities[i] == thePlayer.GetHorseWithInventory() || entities[i] == thePlayer || !IsRequiredAttitudeBetween(thePlayer, entities[i], true) )
  2976. continue;
  2977.  
  2978. if ( VecDistance2D(this.GetWorldPosition(), entities[i].GetWorldPosition()) < minDist)
  2979. {
  2980. minDist = VecDistance2D(this.GetWorldPosition(), entities[i].GetWorldPosition());
  2981. targetEntity = (CActor)entities[i];
  2982. }
  2983. }
  2984.  
  2985. if ( targetEntity )
  2986. {
  2987. if ( HasBuff(EET_AxiiGuardMe) )
  2988. gameplayEffect = GetBuff(EET_AxiiGuardMe);
  2989. else if ( HasBuff(EET_Confusion) )
  2990. gameplayEffect = GetBuff(EET_Confusion);
  2991.  
  2992. params.effectType = gameplayEffect.GetEffectType();
  2993. params.creator = gameplayEffect.GetCreator();
  2994. params.sourceName = gameplayEffect.GetSourceName();
  2995. params.duration = gameplayEffect.GetDurationLeft();
  2996. if ( params.duration < 5.0f ) params.duration = 5.0f;
  2997. params.effectValue = gameplayEffect.GetEffectValue();
  2998. params.customAbilityName = gameplayEffect.GetAbilityName();
  2999. params.customFXName = gameplayEffect.GetTargetEffectName();
  3000. params.isSignEffect = gameplayEffect.IsSignEffect();
  3001. params.customPowerStatValue = gameplayEffect.GetCreatorPowerStat();
  3002. params.vibratePadLowFreq = gameplayEffect.GetVibratePadLowFreq();
  3003. params.vibratePadHighFreq = gameplayEffect.GetVibratePadHighFreq();
  3004.  
  3005. targetEntity.AddEffectCustom(params);
  3006. gameplayEffect = targetEntity.GetBuff(params.effectType);
  3007. gameplayEffect.SetTimeLeft(params.duration);
  3008.  
  3009. fxEnt = CreateFXEntityAtPelvis( 'glyphword_10_18', true );
  3010. fxEnt.PlayEffect('out');
  3011. fxEnt.DestroyAfter(5);
  3012.  
  3013. fxEnt = targetEntity.CreateFXEntityAtPelvis( 'glyphword_10_18', true );
  3014. fxEnt.PlayEffect('in');
  3015. fxEnt.DestroyAfter(5);
  3016. }
  3017. }
  3018.  
  3019. super.OnDeath( damageAction );
  3020.  
  3021. //W3EE - Begin
  3022. attackAction = (W3Action_Attack)damageAction;
  3023. Combat().SeveranceRunewordStaminaAbsorb(attackAction);
  3024. Combat().ObliterationRunewordExplosion(attackAction);
  3025. Combat().ObliterationRunewordGroundFX(attackAction);
  3026. Combat().EruptionGlyphword(damageAction);
  3027.  
  3028. if( witcher && damageAction.GetBuffSourceName() != "WinterBladeDamage" && witcher.HasBuff(EET_WinterBlade) )
  3029. {
  3030. witcher.PlayEffect('mutation_6_power');
  3031. surface = theGame.GetSurfacePostFX();
  3032. surface.AddSurfacePostFXGroup(GetWorldPosition(), 2, 15, 6, 3.5f, 0);
  3033. }
  3034.  
  3035. // if (!IsHuman() && damageAction.attacker == thePlayer && !ciriEntity && !HasTag('NoBestiaryEntry') ) AddBestiaryKnowledge();
  3036.  
  3037. if( witcher )
  3038. {
  3039. witcher.enemiesKilled += 1;
  3040. }
  3041. //W3EE - End
  3042.  
  3043. if ( !WillBeUnconscious() && !HasTag( 'NoHitFx' ) )
  3044. {
  3045. if ( theGame.GetWorld().GetWaterDepth( this.GetWorldPosition() ) > 0 )
  3046. {
  3047. if ( this.HasEffect( 'water_death' ) ) this.PlayEffectSingle( 'water_death' );
  3048. }
  3049. else
  3050. {
  3051. if ( this.HasEffect( 'blood_spill' ) && !HasAbility ( 'NoBloodSpill' ) ) this.PlayEffectSingle( 'blood_spill' );
  3052. }
  3053. }
  3054.  
  3055.  
  3056. if ( ( ( CMovingPhysicalAgentComponent ) this.GetMovingAgentComponent() ).HasRagdoll() )
  3057. {
  3058. SetBehaviorVariable('HasRagdoll', 1 );
  3059. }
  3060.  
  3061.  
  3062. if ( (W3AardProjectile)( damageAction.causer ) )
  3063. {
  3064. DropItemFromSlot( 'r_weapon' );
  3065. DropItemFromSlot( 'l_weapon' );
  3066. this.BreakAttachment();
  3067. }
  3068.  
  3069. SignalGameplayEventParamObject( 'OnDeath', damageAction );
  3070. theGame.GetBehTreeReactionManager().CreateReactionEvent( this, 'BattlecryGroupDeath', 1.0f, 20.0f, -1.0f, 1 );
  3071.  
  3072. // W3EE - Begin
  3073. //attackAction = (W3Action_Attack)damageAction;
  3074. // W3EE - End
  3075.  
  3076.  
  3077. if ( ((CMovingPhysicalAgentComponent)GetMovingAgentComponent()).GetSubmergeDepth() < 0 )
  3078. {
  3079. inWater = true;
  3080. DisableAgony();
  3081. }
  3082.  
  3083.  
  3084. if( IsUsingHorse() )
  3085. {
  3086. SoundEvent( "cmb_play_hit_heavy" );
  3087. SoundEvent( "grunt_vo_death" );
  3088. }
  3089.  
  3090. if(damageAction.attacker == thePlayer && damageAction.IsActionMelee() && thePlayer.GetStat(BCS_Toxicity) > 0 && thePlayer.CanUseSkill(S_Alchemy_s17))
  3091. {
  3092. //thePlayer.AddAbilityMultiple( SkillEnumToName(S_Alchemy_s17), thePlayer.GetSkillLevel(S_Alchemy_s17) );
  3093. witcher.GainStat(BCS_Stamina, witcher.GetStatMax(BCS_Stamina) * 0.05f * thePlayer.GetSkillLevel(S_Alchemy_s17) * thePlayer.GetStatPercents(BCS_Toxicity));
  3094. witcher.GainStat(BCS_Focus, witcher.GetStatMax(BCS_Focus) * 0.05f * thePlayer.GetSkillLevel(S_Alchemy_s17) * thePlayer.GetStatPercents(BCS_Toxicity));
  3095. }
  3096.  
  3097. OnChangeDyingInteractionPriorityIfNeeded();
  3098.  
  3099. actor = (CActor)damageAction.attacker;
  3100.  
  3101.  
  3102. // W3EE - Begin
  3103. /*
  3104. if(ShouldGiveExp(damageAction.attacker))
  3105. {
  3106. npcLevel = (int)CalculateAttributeValue(GetAttributeValue('level',,true));
  3107. lvlDiff = npcLevel - witcher.GetLevel();
  3108. expPoints = CalculateExperiencePoints();
  3109.  
  3110.  
  3111. if(expPoints > 0)
  3112. {
  3113. theGame.GetMonsterParamsForActor(this, monsterCategory, tmpName, tmpBool, tmpBool, tmpBool);
  3114. if(MonsterCategoryIsMonster(monsterCategory))
  3115. {
  3116. bonusExp = thePlayer.GetAttributeValue('nonhuman_exp_bonus_when_fatal');
  3117. }
  3118. else
  3119. {
  3120. bonusExp = thePlayer.GetAttributeValue('human_exp_bonus_when_fatal');
  3121. }
  3122.  
  3123. expPoints = RoundMath( expPoints * (1 + CalculateAttributeValue(bonusExp)) );
  3124.  
  3125. witcher.AddPoints(EExperiencePoint, RoundF( expPoints * theGame.expGlobalMod_kills ), false );
  3126.  
  3127. }
  3128. }
  3129. */
  3130. //W3EE - End
  3131.  
  3132. attitudeToPlayer = GetAttitudeBetween(this, thePlayer);
  3133.  
  3134. if(attitudeToPlayer == AIA_Hostile && !HasTag('AchievementKillDontCount'))
  3135. {
  3136.  
  3137. if(actor && actor.HasBuff(EET_AxiiGuardMe))
  3138. {
  3139. theGame.GetGamerProfile().IncStat(ES_CharmedNPCKills);
  3140. FactsAdd("statistics_cerberus_sign");
  3141. }
  3142.  
  3143.  
  3144. if( aardedFlight && damageAction.GetBuffSourceName() == "FallingDamage" )
  3145. {
  3146. theGame.GetGamerProfile().IncStat(ES_AardFallKills);
  3147. }
  3148.  
  3149.  
  3150. if(damageAction.IsActionEnvironment())
  3151. {
  3152. theGame.GetGamerProfile().IncStat(ES_EnvironmentKills);
  3153. FactsAdd("statistics_cerberus_environment");
  3154. }
  3155. }
  3156.  
  3157.  
  3158. if(HasTag('cow'))
  3159. {
  3160. if( (damageAction.attacker == thePlayer) ||
  3161. ((W3SignEntity)damageAction.attacker && ((W3SignEntity)damageAction.attacker).GetOwner() == thePlayer) ||
  3162. ((W3SignProjectile)damageAction.attacker && ((W3SignProjectile)damageAction.attacker).GetCaster() == thePlayer) ||
  3163. ( (W3Petard)damageAction.attacker && ((W3Petard)damageAction.attacker).GetOwner() == thePlayer)
  3164. ){
  3165. theGame.GetGamerProfile().IncStat(ES_KilledCows);
  3166. }
  3167. }
  3168.  
  3169.  
  3170. if ( damageAction.attacker == thePlayer )
  3171. {
  3172. theGame.GetMonsterParamsForActor(this, monsterCategory, tmpName, tmpBool, tmpBool, tmpBool);
  3173.  
  3174. if( witcher.IsSetBonusActive( EISB_Vampire ) && !witcher.IsInFistFight() && !WillBeUnconscious() )
  3175. {
  3176. witcher.VampiricSetAbilityRegeneration();
  3177. }
  3178.  
  3179. if(!HasTag('AchievementKillDontCount'))
  3180. {
  3181. if (damageAction.GetIsHeadShot() && monsterCategory == MC_Human )
  3182. theGame.GetGamerProfile().IncStat(ES_HeadShotKills);
  3183.  
  3184.  
  3185. if( (W3SignEntity)damageAction.causer || (W3SignProjectile)damageAction.causer)
  3186. {
  3187. FactsAdd("statistics_cerberus_sign");
  3188. }
  3189. else if( (CBaseGameplayEffect)damageAction.causer && ((CBaseGameplayEffect)damageAction.causer).IsSignEffect())
  3190. {
  3191. FactsAdd("statistics_cerberus_sign");
  3192. }
  3193. else if( (W3Petard)damageAction.causer )
  3194. {
  3195. FactsAdd("statistics_cerberus_petard");
  3196. }
  3197. else if( (W3BoltProjectile)damageAction.causer )
  3198. {
  3199. FactsAdd("statistics_cerberus_bolt");
  3200. }
  3201. else
  3202. {
  3203. if(!attackAction)
  3204. attackAction = (W3Action_Attack)damageAction;
  3205.  
  3206. fists = false;
  3207. if(attackAction)
  3208. {
  3209. weaponID = attackAction.GetWeaponId();
  3210. if(damageAction.attacker.GetInventory().IsItemFists(weaponID))
  3211. {
  3212. FactsAdd("statistics_cerberus_fists");
  3213. fists = true;
  3214. }
  3215. }
  3216.  
  3217. if(!fists && damageAction.IsActionMelee())
  3218. {
  3219. FactsAdd("statistics_cerberus_melee");
  3220. }
  3221. }
  3222. }
  3223.  
  3224.  
  3225. if( expPoints > 0 && !HasTag( 'AchievementKillDontCount' ) && thePlayer.inv.HasItem( 'q705_tissue_extractor' ) )
  3226. {
  3227. thePlayer.TissueExtractorIncCharge();
  3228. }
  3229.  
  3230.  
  3231. if( (W3BoltProjectile)damageAction.causer && damageAction.GetWasFrozen() && !WillBeUnconscious() )
  3232. {
  3233. theGame.GetGamerProfile().AddAchievement( EA_HastaLaVista );
  3234. thePlayer.PlayVoiceset( 100, "HastaLaVista", true );
  3235. }
  3236.  
  3237.  
  3238.  
  3239. }
  3240.  
  3241.  
  3242. if( damageAction.attacker == thePlayer || !((CNewNPC)damageAction.attacker) )
  3243. {
  3244. theTelemetry.LogWithLabelAndValue(TE_FIGHT_ENEMY_DIES, this.ToString(), GetLevel());
  3245. }
  3246.  
  3247.  
  3248. if(damageAction.attacker == thePlayer && !HasTag('AchievementKillDontCount'))
  3249. {
  3250. if ( attitudeToPlayer == AIA_Hostile )
  3251. {
  3252.  
  3253. if(!HasTag('AchievementSwankDontCount'))
  3254. {
  3255. if(FactsQuerySum("statistic_killed_in_10_sec") >= 4)
  3256. theGame.GetGamerProfile().AddAchievement(EA_Swank);
  3257. else
  3258. FactsAdd("statistic_killed_in_10_sec", 1, 10);
  3259. }
  3260.  
  3261.  
  3262. if( witcher && !thePlayer.ReceivedDamageInCombat() && !witcher.UsedQuenInCombat())
  3263. {
  3264. theGame.GetGamerProfile().IncStat(ES_FinesseKills);
  3265. }
  3266. }
  3267.  
  3268.  
  3269. if((W3PlayerWitcher)thePlayer)
  3270. {
  3271. if(!thePlayer.DidFailFundamentalsFirstAchievementCondition() && HasTag(theGame.params.MONSTER_HUNT_ACTOR_TAG) && !HasTag('failedFundamentalsAchievement'))
  3272. {
  3273. theGame.GetGamerProfile().IncStat(ES_FundamentalsFirstKills);
  3274. }
  3275. }
  3276. }
  3277.  
  3278.  
  3279. if(!inWater && (W3IgniProjectile)damageAction.causer)
  3280. {
  3281.  
  3282. if(RandF() < 0.3 && !WillBeUnconscious() )
  3283. {
  3284. AddEffectDefault(EET_Burning, this, 'IgniKill', true);
  3285. EnableAgony();
  3286. SignalGameplayEvent('ForceAgony');
  3287. }
  3288. }
  3289.  
  3290.  
  3291. OnDeathMutation2( damageAction );
  3292.  
  3293. //modIgnition++
  3294. if(damageAction.attacker == thePlayer)
  3295. {
  3296. burningCauser = (W3Effect_Burning)damageAction.causer;
  3297.  
  3298. if(damageAction.attacker == thePlayer && IsRequiredAttitudeBetween(thePlayer, damageAction.victim, true, false, false) && ((burningCauser && burningCauser.IsSignEffect()) || (W3IgniProjectile)damageAction.causer))
  3299. {
  3300. damageAction.SetForceExplosionDismemberment();
  3301. PlayEffect('explosion');
  3302. PlayEffect('critical_burning');
  3303. PlayEffect('critical_burning_csx');
  3304. thePlayer.PlayEffect('wet_skin_dlc');
  3305. }
  3306. }
  3307. //modIgnition--
  3308.  
  3309. /*if(damageAction.attacker == thePlayer && thePlayer.HasAbility('Glyphword 20 _Stats', true) && damageAction.GetBuffSourceName() != "Glyphword 20")
  3310. {
  3311. burningCauser = (W3Effect_Burning)damageAction.causer;
  3312.  
  3313. if(IsRequiredAttitudeBetween(thePlayer, damageAction.victim, true, false, false) && ((burningCauser && burningCauser.IsSignEffect()) || (W3IgniProjectile)damageAction.causer))
  3314. {
  3315. damageAction.SetForceExplosionDismemberment();
  3316.  
  3317.  
  3318. radius = CalculateAttributeValue(thePlayer.GetAbilityAttributeValue('Glyphword 20 _Stats', 'radius'));
  3319.  
  3320.  
  3321. theGame.GetDefinitionsManager().GetAbilityAttributes('Glyphword 20 _Stats', atts);
  3322. for(i=0; i<atts.Size(); i+=1)
  3323. {
  3324. if(IsDamageTypeNameValid(atts[i]))
  3325. {
  3326. dmg.dmgType = atts[i];
  3327. dmg.dmgVal = CalculateAttributeValue(thePlayer.GetAbilityAttributeValue('Glyphword 20 _Stats', dmg.dmgType));
  3328. damages.PushBack(dmg);
  3329. }
  3330. }
  3331.  
  3332.  
  3333. FindGameplayEntitiesInSphere(entities, GetWorldPosition(), radius, 1000, , FLAG_OnlyAliveActors);
  3334.  
  3335.  
  3336. for(i=0; i<entities.Size(); i+=1)
  3337. {
  3338. if(IsRequiredAttitudeBetween(thePlayer, entities[i], true, false, false))
  3339. {
  3340. act = new W3DamageAction in this;
  3341. act.Initialize(thePlayer, entities[i], damageAction.causer, "Glyphword 20", EHRT_Heavy, CPS_SpellPower, false, false, true, false);
  3342.  
  3343. for(j=0; j<damages.Size(); j+=1)
  3344. {
  3345. act.AddDamage(damages[j].dmgType, damages[j].dmgVal);
  3346. }
  3347.  
  3348. act.AddEffectInfo(EET_Burning, , , , , 0.5f);
  3349.  
  3350. theGame.damageMgr.ProcessAction(act);
  3351. delete act;
  3352. }
  3353. }
  3354.  
  3355. CreateFXEntityAtPelvis( 'glyphword_20_explosion', false );
  3356. }
  3357. }*/
  3358.  
  3359.  
  3360. if(attackAction && IsWeaponHeld('fist') && damageAction.attacker == thePlayer && !thePlayer.ReceivedDamageInCombat() && !HasTag('AchievementKillDontCount'))
  3361. {
  3362. weaponID = attackAction.GetWeaponId();
  3363. if(thePlayer.inv.IsItemFists(weaponID))
  3364. theGame.GetGamerProfile().AddAchievement(EA_FistOfTheSouthStar);
  3365. }
  3366.  
  3367.  
  3368. if(damageAction.IsActionRanged() && damageAction.IsBouncedArrow())
  3369. {
  3370. theGame.GetGamerProfile().IncStat(ES_SelfArrowKills);
  3371. }
  3372.  
  3373.  
  3374. isFinisher = ( damageAction.GetBuffSourceName() == "Finisher" || damageAction.GetBuffSourceName() == "AutoFinisher" );
  3375. if( damageAction.attacker == thePlayer && ( damageAction.IsActionMelee() || isFinisher ) )
  3376. {
  3377. weaponID = attackAction.GetWeaponId();
  3378.  
  3379. if( isFinisher && !thePlayer.inv.IsIdValid( weaponID ) )
  3380. {
  3381. weaponID = thePlayer.inv.GetCurrentlyHeldSword();
  3382. }
  3383.  
  3384. if( damageAction.attacker.GetInventory().ItemHasTag( weaponID, 'Aerondight' ) )
  3385. {
  3386. aerondight = (W3Effect_Aerondight)thePlayer.GetBuff( EET_Aerondight );
  3387.  
  3388. if( aerondight )
  3389. {
  3390. // W3EE - Begin
  3391. if( aerondight.IsFullyCharged() )
  3392. {
  3393. /*
  3394. if( aerondight.DischargeAerondight() )
  3395. {
  3396. PlayEffect( 'hit_electric_quen' );
  3397. }
  3398. */
  3399. PlayEffect('hit_electric_quen');
  3400. }
  3401. else if( isFinisher )
  3402. {
  3403. aerondight.IncreaseAerondightCharges( theGame.params.ATTACK_NAME_LIGHT );
  3404. }
  3405. // W3EE - End
  3406. }
  3407. }
  3408. }
  3409. }
  3410.  
  3411.  
  3412. private final function OnDeathMutation2( out damageAction : W3DamageAction )
  3413. {
  3414. var burning : W3Effect_Burning;
  3415. var vfxEnt : W3VisualFx;
  3416. var fxName : name;
  3417.  
  3418.  
  3419. if( !damageAction.IsMutation2PotentialKill() )
  3420. {
  3421. return;
  3422. }
  3423.  
  3424.  
  3425. burning = ( W3Effect_Burning ) damageAction.causer;
  3426. if( burning && burning.IsFromMutation2() )
  3427. {
  3428. damageAction.SetSignSkill( S_Magic_2 );
  3429. }
  3430.  
  3431.  
  3432. damageAction.SetForceExplosionDismemberment();
  3433. vfxEnt = ( W3VisualFx ) CreateFXEntityAtPelvis( 'mutation_2_explode', false );
  3434. if( vfxEnt )
  3435. {
  3436. if ( (W3IgniProjectile)damageAction.causer )
  3437. {
  3438. fxName = 'mutation_2_igni';
  3439. }
  3440. else if ( (W3YrdenEntityStateYrdenShock)damageAction.causer )
  3441. {
  3442. fxName = 'mutation_2_yrden';
  3443. }
  3444. else if ( (W3QuenEntity)damageAction.causer )
  3445. {
  3446. fxName = 'mutation_2_quen';
  3447. }
  3448. else if ( (W3AardProjectile)damageAction.causer )
  3449. {
  3450. fxName = 'mutation_2_aard';
  3451. }
  3452.  
  3453. vfxEnt.PlayEffect( fxName );
  3454. vfxEnt.DestroyOnFxEnd( fxName );
  3455. }
  3456. }
  3457.  
  3458. event OnChangeDyingInteractionPriorityIfNeeded()
  3459. {
  3460. if ( WillBeUnconscious() )
  3461. return true;
  3462. if ( HasTag('animal') )
  3463. {
  3464. return true;
  3465. }
  3466.  
  3467.  
  3468. this.SetInteractionPriority(IP_Max_Unpushable);
  3469. }
  3470.  
  3471.  
  3472.  
  3473. public final function IsImmuneToMutation8Finisher() : bool
  3474. {
  3475. var min, max : SAbilityAttributeValue;
  3476. var str : string;
  3477.  
  3478. if( !IsHuman() || !IsAlive() || !IsRequiredAttitudeBetween( thePlayer, this, true ) )
  3479. {
  3480. return true;
  3481. }
  3482.  
  3483. if( HasAbility( 'SkillBoss' ) )
  3484. {
  3485. return true;
  3486. }
  3487. if( HasAbility( 'Boss' ) )
  3488. {
  3489. return true;
  3490. }
  3491. if( HasAbility( 'InstantKillImmune' ) )
  3492. {
  3493. return true;
  3494. }
  3495. if( HasTag( 'olgierd_gpl' ) )
  3496. {
  3497. return true;
  3498. }
  3499. if( HasAbility( 'DisableFinishers' ) )
  3500. {
  3501. return true;
  3502. }
  3503. if( HasTag( 'Mutation8CounterImmune' ) )
  3504. {
  3505. return true;
  3506. }
  3507.  
  3508. if( WillBeUnconscious() )
  3509. {
  3510. return true;
  3511. }
  3512.  
  3513. str = GetName();
  3514. if( StrStartsWith( str, "rosa_var_attre" ) )
  3515. {
  3516. return true;
  3517. }
  3518.  
  3519. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation8', 'hp_perc_trigger', min, max );
  3520. if( GetHealthPercents() > min.valueMultiplicative )
  3521. {
  3522. return true;
  3523. }
  3524.  
  3525. return false;
  3526. }
  3527.  
  3528. event OnFireHit(source : CGameplayEntity)
  3529. {
  3530. super.OnFireHit(source);
  3531.  
  3532. if ( HasTag('animal') )
  3533. {
  3534. Kill( 'Animal hit by fire', source );
  3535. }
  3536.  
  3537. if ( !IsAlive() && IsInAgony() )
  3538. {
  3539.  
  3540. SignalGameplayEvent('AbandonAgony');
  3541.  
  3542. SetKinematic(false);
  3543. }
  3544. }
  3545.  
  3546. event OnAardHit( sign : W3AardProjectile )
  3547. {
  3548. var staminaDrainPerc : float;
  3549.  
  3550. SignalGameplayEvent( 'AardHitReceived' );
  3551.  
  3552. aardedFlight = true;
  3553.  
  3554.  
  3555. /*if( !sign.GetOwner().GetPlayer() || !GetWitcherPlayer().IsMutationActive( EPMT_Mutation6 ) )
  3556. {
  3557. RemoveAllBuffsOfType(EET_Frozen);
  3558. }*/
  3559.  
  3560.  
  3561.  
  3562.  
  3563. super.OnAardHit(sign);
  3564.  
  3565. if ( HasTag('small_animal') )
  3566. {
  3567. Kill( 'Small Animal Aard Hit' );
  3568. }
  3569. if ( IsShielded(sign.GetCaster()) )
  3570. {
  3571. ToggleEffectOnShield('aard_cone_hit', true);
  3572. }
  3573. else if ( HasAbility('ablIgnoreSigns') )
  3574. {
  3575. this.SignalGameplayEvent( 'IgnoreSigns' );
  3576. this.SetBehaviorVariable( 'bIgnoreSigns',1.f );
  3577. AddTimer('IgnoreSignsTimeOut',0.2,false);
  3578. }
  3579.  
  3580.  
  3581. staminaDrainPerc = sign.GetStaminaDrainPerc();
  3582. if(IsAlive() && staminaDrainPerc > 0.f && IsRequiredAttitudeBetween(this, sign.GetCaster(), true))
  3583. {
  3584. DrainStamina(ESAT_FixedValue, staminaDrainPerc * GetStatMax(BCS_Stamina));
  3585.  
  3586. }
  3587.  
  3588. if ( !IsAlive() && deathTimestamp + 0.2 < theGame.GetEngineTimeAsSeconds() )
  3589. {
  3590.  
  3591. SignalGameplayEvent('AbandonAgony');
  3592.  
  3593.  
  3594.  
  3595. if( !HasAbility( 'mon_bear_base' )
  3596. && !HasAbility( 'mon_golem_base' )
  3597. && !HasAbility( 'mon_endriaga_base' )
  3598. && !HasAbility( 'mon_gryphon_base' )
  3599. && !HasAbility( 'q604_shades' )
  3600. && !IsAnimal() )
  3601. {
  3602.  
  3603. SetKinematic( false );
  3604. }
  3605. }
  3606. }
  3607.  
  3608. event OnAxiiHit( sign : W3AxiiProjectile )
  3609. {
  3610. super.OnAxiiHit(sign);
  3611.  
  3612. if ( HasAbility('ablIgnoreSigns') )
  3613. {
  3614. this.SignalGameplayEvent( 'IgnoreSigns' );
  3615. this.SetBehaviorVariable( 'bIgnoreSigns',1.f );
  3616. AddTimer('IgnoreSignsTimeOut',0.2,false);
  3617. }
  3618. }
  3619.  
  3620. private const var SHIELD_BURN_TIMER : float;
  3621. default SHIELD_BURN_TIMER = 1.0;
  3622.  
  3623. private var beingHitByIgni : bool;
  3624. private var firstIgniTick, lastIgniTick : float;
  3625.  
  3626. event OnIgniHit( sign : W3IgniProjectile )
  3627. {
  3628. var horseComponent : W3HorseComponent;
  3629. super.OnIgniHit( sign );
  3630.  
  3631. SignalGameplayEvent( 'IgniHitReceived' );
  3632.  
  3633. if ( HasAbility( 'ablIgnoreSigns') )
  3634. {
  3635. this.SignalGameplayEvent( 'IgnoreSigns' );
  3636. this.SetBehaviorVariable('bIgnoreSigns',1.f);
  3637. AddTimer('IgnoreSignsTimeOut',0.2,false);
  3638. }
  3639.  
  3640. if ( HasAbility( 'IceArmor') )
  3641. {
  3642. this.RemoveAbility( 'IceArmor' );
  3643. this.StopEffect( 'ice_armor' );
  3644. this.PlayEffect( 'ice_armor_hit' );
  3645. }
  3646.  
  3647. if( IsShielded( sign.GetCaster() ) )
  3648. {
  3649. if( sign.IsProjectileFromChannelMode() )
  3650. {
  3651. SignalGameplayEvent( 'BeingHitByIgni' );
  3652.  
  3653. if( !beingHitByIgni )
  3654. {
  3655. beingHitByIgni = true;
  3656. firstIgniTick = theGame.GetEngineTimeAsSeconds();
  3657. ToggleEffectOnShield( 'burn', true );
  3658. RaiseShield();
  3659. }
  3660.  
  3661. if( firstIgniTick + SHIELD_BURN_TIMER < theGame.GetEngineTimeAsSeconds() )
  3662. {
  3663. ProcessShieldDestruction();
  3664. return false;
  3665. }
  3666.  
  3667. AddTimer( 'IgniCleanup', 0.2, false );
  3668. }
  3669. else
  3670. {
  3671. ToggleEffectOnShield( 'igni_cone_hit', true );
  3672. }
  3673. }
  3674.  
  3675. horseComponent = GetHorseComponent();
  3676. if ( horseComponent )
  3677. horseComponent.OnIgniHit(sign);
  3678. else
  3679. {
  3680. horseComponent = GetUsedHorseComponent();
  3681. if ( horseComponent )
  3682. horseComponent.OnIgniHit(sign);
  3683. }
  3684. }
  3685.  
  3686. public function IsBeingHitByIgni() : bool
  3687. {
  3688. return beingHitByIgni;
  3689. }
  3690.  
  3691. function ToggleEffectOnShield(effectName : name, toggle : bool)
  3692. {
  3693. var itemID : SItemUniqueId;
  3694. var inv : CInventoryComponent;
  3695.  
  3696. inv = GetInventory();
  3697. itemID = inv.GetItemFromSlot('l_weapon');
  3698. if ( toggle )
  3699. inv.PlayItemEffect(itemID,effectName);
  3700. else
  3701. inv.StopItemEffect(itemID,effectName);
  3702. }
  3703.  
  3704. timer function IgniCleanup( dt : float , id : int)
  3705. {
  3706. if( beingHitByIgni )
  3707. {
  3708. ToggleEffectOnShield( 'burn', false );
  3709. AddTimer( 'LowerShield', 0.5 );
  3710. beingHitByIgni = false;
  3711. }
  3712. }
  3713.  
  3714. timer function IgnoreSignsTimeOut( dt : float , id : int)
  3715. {
  3716. this.SignalGameplayEvent( 'IgnoreSignsEnd' );
  3717. this.SetBehaviorVariable( 'bIgnoreSigns',0.f);
  3718. }
  3719.  
  3720.  
  3721.  
  3722. function SetIsTeleporting( b : bool )
  3723. {
  3724. isTeleporting = b;
  3725. }
  3726.  
  3727. function IsTeleporting() : bool
  3728. {
  3729. return isTeleporting;
  3730. }
  3731.  
  3732. final function SetUnstoppable( toggle : bool )
  3733. {
  3734. unstoppable = toggle;
  3735. }
  3736.  
  3737. final function IsUnstoppable() : bool
  3738. {
  3739. return unstoppable;
  3740. }
  3741.  
  3742. final function SetIsCountering( toggle : bool )
  3743. {
  3744. bIsCountering = toggle;
  3745. }
  3746.  
  3747. final function IsCountering() : bool
  3748. {
  3749. return bIsCountering;
  3750. }
  3751.  
  3752.  
  3753. timer function Tick(deltaTime : float, id : int)
  3754. {
  3755.  
  3756.  
  3757. }
  3758.  
  3759. private function UpdateBumpCollision()
  3760. {
  3761. var npc : CNewNPC;
  3762. var collisionData : SCollisionData;
  3763. var collisionNum : int;
  3764. var i : int;
  3765.  
  3766.  
  3767.  
  3768.  
  3769.  
  3770. if( mac )
  3771. {
  3772.  
  3773. collisionNum = mac.GetCollisionCharacterDataCount();
  3774. for( i = 0; i < collisionNum; i += 1 )
  3775. {
  3776. collisionData = mac.GetCollisionCharacterData( i );
  3777. npc = ( CNewNPC ) collisionData.entity;
  3778. if( npc )
  3779. {
  3780. this.SignalGameplayEvent( 'AI_GetOutOfTheWay' );
  3781. this.SignalGameplayEventParamObject( 'CollideWithPlayer', npc );
  3782. theGame.GetBehTreeReactionManager().CreateReactionEvent( this, 'BumpAction', 1, 1, 1, 1, false );
  3783.  
  3784.  
  3785. break;
  3786. }
  3787. }
  3788. }
  3789. }
  3790.  
  3791.  
  3792. public function SetIsTranslationScaled(b : bool) {isTranslationScaled = b;}
  3793. public function GetIsTranslationScaled() : bool {return isTranslationScaled;}
  3794.  
  3795.  
  3796. import final function GetActiveActionPoint() : SActionPointId;
  3797.  
  3798.  
  3799.  
  3800.  
  3801.  
  3802.  
  3803.  
  3804.  
  3805.  
  3806. import final function IsInInterior() : bool;
  3807.  
  3808.  
  3809. import final function IsInDanger() : bool;
  3810.  
  3811.  
  3812. import final function IsSeeingNonFriendlyNPC() : bool;
  3813.  
  3814.  
  3815. import final function IsAIEnabled() : bool;
  3816.  
  3817.  
  3818. import final function FindActionPoint( out apID : SActionPointId, out category : name );
  3819.  
  3820.  
  3821. import final function GetDefaultDespawnPoint( out spawnPoint : Vector ) : bool;
  3822.  
  3823.  
  3824.  
  3825. import final function NoticeActor( actor : CActor );
  3826.  
  3827.  
  3828. import final function ForgetActor( actor : CActor );
  3829.  
  3830.  
  3831. import final function ForgetAllActors();
  3832.  
  3833.  
  3834. import final function GetNoticedObject( index : int) : CActor;
  3835.  
  3836.  
  3837.  
  3838. import final function GetPerceptionRange() : float;
  3839.  
  3840.  
  3841.  
  3842. import final function PlayDialog( optional forceSpawnedActors : bool ) : bool;
  3843.  
  3844.  
  3845.  
  3846.  
  3847. import final function GetReactionScript( index : int ) : CReactionScript;
  3848.  
  3849. import final function IfCanSeePlayer() : bool;
  3850.  
  3851. import final function GetGuardArea() : CAreaComponent;
  3852. import final function SetGuardArea( areaComponent : CAreaComponent );
  3853. import final function DeriveGuardArea( ncp : CNewNPC ) : bool;
  3854.  
  3855. import final function IsConsciousAtWork() : bool;
  3856. import final function GetCurrentJTType() : int;
  3857. import final function IsInLeaveAction() : bool;
  3858. import final function IsSittingAtWork() : bool;
  3859. import final function IsAtWork() : bool;
  3860. import final function IsPlayingChatScene() : bool;
  3861. import final function CanUseChatInCurrentAP() : bool;
  3862.  
  3863.  
  3864. import final function NoticeActorInGuardArea( actor : CActor );
  3865.  
  3866.  
  3867.  
  3868.  
  3869. event OnAnimEvent_EquipItemL( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  3870. {
  3871. GetInventory().MountItem( itemToEquip, true );
  3872. }
  3873. event OnAnimEvent_HideItemL( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  3874. {
  3875. GetInventory().UnmountItem( itemToEquip, true );
  3876. }
  3877. event OnAnimEvent_HideWeapons( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  3878. {
  3879. var inventory : CInventoryComponent = GetInventory();
  3880. var ids : array<SItemUniqueId>;
  3881. var i : int;
  3882.  
  3883. ids = inventory.GetAllWeapons();
  3884. for( i = 0; i < ids.Size() ; i += 1 )
  3885. {
  3886. if( inventory.IsItemHeld( ids[i] ) || inventory.IsItemMounted( ids[i] ) )
  3887. inventory.UnmountItem( ids[i], true );
  3888. }
  3889. }
  3890.  
  3891. event OnAnimEvent_TemporaryOffGround( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  3892. {
  3893. if( animEventType == AET_DurationEnd )
  3894. {
  3895. isTemporaryOffGround = false;
  3896. }
  3897. else
  3898. {
  3899. isTemporaryOffGround = true;
  3900. }
  3901. }
  3902. event OnAnimEvent_weaponSoundType( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  3903. {
  3904. WeaponSoundType().SetupDrawHolsterSounds();
  3905. }
  3906.  
  3907. event OnAnimEvent_IdleDown( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  3908. {
  3909. SetBehaviorVariable( 'idleType', 0.0 );
  3910. }
  3911.  
  3912. event OnAnimEvent_IdleForward( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  3913. {
  3914. SetBehaviorVariable( 'idleType', 1.0 );
  3915. }
  3916.  
  3917. event OnAnimEvent_IdleCombat( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  3918. {
  3919. SetBehaviorVariable( 'idleType', 2.0 );
  3920. }
  3921.  
  3922. event OnAnimEvent_WeakenedState( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  3923. {
  3924. SetWeakenedState( true );
  3925. }
  3926.  
  3927. event OnAnimEvent_WeakenedStateOff( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  3928. {
  3929. SetWeakenedState( false );
  3930. }
  3931.  
  3932. public function SetWeakenedState( val : bool )
  3933. {
  3934. if( val )
  3935. {
  3936. if( HasTag( 'olgierd_gpl' ) )
  3937. {
  3938. AddAbility( 'WeakenedState', false );
  3939. SetBehaviorVariable( 'weakenedState', 1.0 );
  3940. PlayEffect( 'olgierd_energy_blast' );
  3941.  
  3942. if( HasTag( 'ethereal' ) && !HasAbility( 'EtherealSkill_4' ) )
  3943. {
  3944. AddAbility( 'EtherealMashingFixBeforeSkill4' );
  3945. }
  3946. }
  3947. else if( HasTag( 'dettlaff_vampire' ) )
  3948. {
  3949. AddAbility( 'DettlaffWeakenedState', false );
  3950. StopEffect( 'shadowdash' );
  3951. PlayEffect( 'weakened' );
  3952. SetHitWindowOpened( false );
  3953. }
  3954.  
  3955. AddTimer( 'ResetHitCounter', 0.0, false );
  3956. }
  3957. else
  3958. {
  3959. if( HasTag( 'olgierd_gpl' ) )
  3960. {
  3961. RemoveAbility( 'WeakenedState' );
  3962. SetBehaviorVariable( 'weakenedState', 0.0 );
  3963. StopEffect( 'olgierd_energy_blast' );
  3964.  
  3965. if( HasTag( 'ethereal' ) && !HasAbility( 'EtherealSkill_4' ) )
  3966. {
  3967. RemoveAbility( 'EtherealMashingFixBeforeSkill4' );
  3968. }
  3969. }
  3970. else if( HasTag( 'dettlaff_vampire' ) )
  3971. {
  3972. RemoveAbility( 'DettlaffWeakenedState' );
  3973. StopEffect( 'weakened' );
  3974. }
  3975. }
  3976. }
  3977.  
  3978. public function SetHitWindowOpened( val : bool )
  3979. {
  3980. if( val )
  3981. {
  3982. AddAbility( 'HitWindowOpened', false );
  3983. SetBehaviorVariable( 'hitWindowOpened', 1.0 );
  3984.  
  3985. if( HasTag( 'fairytale_witch' ) )
  3986. {
  3987. SetImmortalityMode( AIM_None, AIC_Combat );
  3988. }
  3989.  
  3990. if( HasTag( 'dettlaff_vampire' ) )
  3991. {
  3992. AddBuffImmunity( EET_Burning, 'SetHitWindowOpened', true );
  3993. }
  3994. }
  3995. else
  3996. {
  3997. RemoveAbility( 'HitWindowOpened' );
  3998. SetBehaviorVariable( 'hitWindowOpened', 0.0 );
  3999.  
  4000. if( HasTag( 'fairytale_witch' ) )
  4001. {
  4002. SetImmortalityMode( AIM_Invulnerable, AIC_Combat );
  4003. }
  4004.  
  4005. if( HasTag( 'dettlaff_vampire' ) )
  4006. {
  4007. RemoveBuffImmunity( EET_Burning, 'SetHitWindowOpened' );
  4008. }
  4009. }
  4010. }
  4011.  
  4012. event OnAnimEvent_WindowManager( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4013. {
  4014. if( animEventName == 'OpenHitWindow' )
  4015. {
  4016. SetHitWindowOpened( true );
  4017. }
  4018. else if( animEventName == 'CloseHitWindow' )
  4019. {
  4020. SetHitWindowOpened( false );
  4021. }
  4022. else if( animEventName == 'OpenCounterWindow' )
  4023. {
  4024. SetBehaviorVariable( 'counterHitType', 1.0 );
  4025. AddTimer( 'CloseHitWindowAfter', 0.75 );
  4026. }
  4027. }
  4028.  
  4029. event OnAnimEvent_CauldronDropped( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4030. {
  4031. DropItemFromSlot( 'l_weapon', true );
  4032. SetBehaviorVariable( 'cauldronDropped', 1.0 );
  4033. }
  4034.  
  4035. event OnAnimEvent_BroomDeath( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4036. {
  4037. var witch : CNewNPC;
  4038.  
  4039. witch = theGame.GetNPCByTag( 'fairytale_witch' );
  4040. if( witch )
  4041. {
  4042. witch.SetBehaviorVariable( 'canDropCauldron', 1.0 );
  4043. }
  4044. }
  4045.  
  4046. event OnAnimEvent_ToggleIsOverground( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4047. {
  4048. if( animEventName == 'SetIsUnderground' )
  4049. {
  4050. ToggleIsOverground( false );
  4051. }
  4052. else if( animEventName == 'SetIsOverground' )
  4053. {
  4054. ToggleIsOverground( true );
  4055. }
  4056. }
  4057.  
  4058. public function ToggleIsOverground( val : bool )
  4059. {
  4060. if( val )
  4061. {
  4062. SetBehaviorVariable( 'isOverground', 1.0 );
  4063. EnableCollisions( true );
  4064. EnableCharacterCollisions( true );
  4065. SetGameplayVisibility( true );
  4066. SetImmortalityMode( AIM_None, AIC_Combat );
  4067. SetUnstoppable( false );
  4068. RemoveTag( 'isHiddenUnderground' );
  4069. RemoveBuffImmunity( EET_Frozen, 'ToggleIsOverground' );
  4070. }
  4071. else
  4072. {
  4073. SetBehaviorVariable( 'isOverground', 0.0 );
  4074. EnableCollisions( false );
  4075. EnableCharacterCollisions( false );
  4076. SetGameplayVisibility( false );
  4077. SetImmortalityMode( AIM_Invulnerable, AIC_Combat );
  4078. SetUnstoppable( true );
  4079. AddTag( 'isHiddenUnderground' );
  4080. AddBuffImmunity( EET_Frozen, 'ToggleIsOverground', true );
  4081. }
  4082. }
  4083.  
  4084. event OnAnimEvent_CannotBeAttacked( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4085. {
  4086. AddAbility( 'CannotBeAttackedFromAllSides', false );
  4087. }
  4088.  
  4089. event OnAnimEvent_SlideAway( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4090. {
  4091. var ticket : SMovementAdjustmentRequestTicket;
  4092. var movementAdjustor : CMovementAdjustor;
  4093. var slidePos : Vector;
  4094. var slideDuration : float;
  4095.  
  4096. movementAdjustor = GetMovingAgentComponent().GetMovementAdjustor();
  4097. movementAdjustor.CancelByName( 'SlideAway' );
  4098.  
  4099. ticket = movementAdjustor.CreateNewRequest( 'SlideAway' );
  4100. slidePos = GetWorldPosition() + ( VecNormalize2D( GetWorldPosition() - thePlayer.GetWorldPosition() ) * 0.75 );
  4101.  
  4102. if( theGame.GetWorld().NavigationLineTest( GetWorldPosition(), slidePos, GetRadius(), false, true ) )
  4103. {
  4104. slideDuration = VecDistance2D( GetWorldPosition(), slidePos ) / 35;
  4105.  
  4106. movementAdjustor.Continuous( ticket );
  4107. movementAdjustor.AdjustmentDuration( ticket, slideDuration );
  4108. movementAdjustor.AdjustLocationVertically( ticket, true );
  4109. movementAdjustor.BlendIn( ticket, 0.25 );
  4110. movementAdjustor.SlideTo( ticket, slidePos );
  4111. movementAdjustor.RotateTowards( ticket, GetTarget() );
  4112. }
  4113.  
  4114. return true;
  4115. }
  4116.  
  4117. event OnAnimEvent_SlideForward( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4118. {
  4119. var ticket : SMovementAdjustmentRequestTicket;
  4120. var movementAdjustor : CMovementAdjustor;
  4121. var slidePos : Vector;
  4122. var slideDuration : float;
  4123.  
  4124. movementAdjustor = GetMovingAgentComponent().GetMovementAdjustor();
  4125. movementAdjustor.CancelByName( 'SlideForward' );
  4126.  
  4127. ticket = movementAdjustor.CreateNewRequest( 'SlideForward' );
  4128. slidePos = GetWorldPosition() + ( VecNormalize2D( GetWorldPosition() - thePlayer.GetWorldPosition() ) * 0.75 );
  4129.  
  4130. if( theGame.GetWorld().NavigationLineTest( GetWorldPosition(), slidePos, GetRadius(), false, true ) )
  4131. {
  4132. slideDuration = VecDistance2D( GetWorldPosition(), slidePos ) / 35;
  4133.  
  4134. movementAdjustor.Continuous( ticket );
  4135. movementAdjustor.AdjustmentDuration( ticket, slideDuration );
  4136. movementAdjustor.AdjustLocationVertically( ticket, true );
  4137. movementAdjustor.BlendIn( ticket, 0.25 );
  4138. movementAdjustor.SlideTo( ticket, slidePos );
  4139. }
  4140.  
  4141. return true;
  4142. }
  4143.  
  4144. event OnAnimEvent_SlideTowards( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4145. {
  4146. var ticket : SMovementAdjustmentRequestTicket;
  4147. var movementAdjustor : CMovementAdjustor;
  4148.  
  4149. movementAdjustor = GetMovingAgentComponent().GetMovementAdjustor();
  4150. movementAdjustor.CancelByName( 'SlideTowards' );
  4151.  
  4152. ticket = movementAdjustor.CreateNewRequest( 'SlideTowards' );
  4153.  
  4154. movementAdjustor.AdjustLocationVertically( ticket, true );
  4155. movementAdjustor.BindToEventAnimInfo( ticket, animInfo );
  4156. movementAdjustor.MaxLocationAdjustmentSpeed( ticket, 4 );
  4157. movementAdjustor.ScaleAnimation( ticket );
  4158. movementAdjustor.SlideTowards( ticket, thePlayer, 1.0, 1.25 );
  4159. movementAdjustor.RotateTowards( ticket, GetTarget() );
  4160.  
  4161. return true;
  4162. }
  4163.  
  4164. event OnAnimEvent_PlayBattlecry( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4165. {
  4166. if( animEventName == 'BC_Sign' )
  4167. {
  4168. PlayVoiceset( 100, "q601_olgierd_taunt_sign" );
  4169. }
  4170. else if( animEventName == 'BC_Taunt' )
  4171. {
  4172. PlayVoiceset( 100, "q601_olgierd_taunt" );
  4173. }
  4174. else
  4175. {
  4176. if( RandRange( 100 ) < 75 )
  4177. {
  4178. if( animEventName == 'BC_Weakened' )
  4179. {
  4180. PlayVoiceset( 100, "q601_olgierd_weakened" );
  4181. }
  4182. else if( animEventName == 'BC_Attack' )
  4183. {
  4184. PlayVoiceset( 100, "q601_olgierd_fast_attack" );
  4185. }
  4186. else if( animEventName == 'BC_Parry' )
  4187. {
  4188. PlayVoiceset( 100, "q601_olgierd_taunt_parry" );
  4189. }
  4190. else
  4191. {
  4192. return false;
  4193. }
  4194. }
  4195. }
  4196. }
  4197.  
  4198.  
  4199. event OnAnimEvent_OwlSwitchOpen( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4200. {
  4201. SetAppearance('owl_01');
  4202. }
  4203.  
  4204. event OnAnimEvent_OwlSwitchClose( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4205. {
  4206. SetAppearance('owl_02');
  4207. }
  4208.  
  4209. event OnAnimEvent_Goose01OpenWings( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4210. {
  4211. SetAppearance('goose_01_wings');
  4212. }
  4213.  
  4214. event OnAnimEvent_Goose01CloseWings( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4215. {
  4216. SetAppearance('goose_01');
  4217. }
  4218.  
  4219. event OnAnimEvent_Goose02OpenWings( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4220. {
  4221. SetAppearance('goose_02_wings');
  4222. }
  4223.  
  4224. event OnAnimEvent_Goose02CloseWings( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4225. {
  4226. SetAppearance('goose_02');
  4227. }
  4228.  
  4229. event OnAnimEvent_NullifyBurning( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4230. {
  4231. RemoveAllBuffsOfType(EET_Burning);
  4232. }
  4233.  
  4234. event OnAnimEvent_setVisible( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4235. {
  4236. SetVisibility( true );
  4237. SetGameplayVisibility( true );
  4238. }
  4239.  
  4240. event OnAnimEvent_extensionWalk( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4241. {
  4242. SetBehaviorVariable( 'UsesExtension', 1 );
  4243. SetBehaviorVariable( 'WalkExtensionAnimSpeed', 0.1 );
  4244. SetBehaviorVariable( 'WalkTransitionAnimSpeed', 0.5 );
  4245. }
  4246.  
  4247. event OnAnimEvent_extensionWalkNormalSpeed( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4248. {
  4249. SetBehaviorVariable( 'UsesExtension', 1 );
  4250. SetBehaviorVariable( 'WalkExtensionAnimSpeed', 1.0 );
  4251. SetBehaviorVariable( 'WalkTransitionAnimSpeed', 0.5 );
  4252. }
  4253.  
  4254. event OnAnimEvent_extensionWalkRightHandOnly( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4255. {
  4256. SetBehaviorVariable( 'UsesExtension', 2 );
  4257. SetBehaviorVariable( 'WalkExtensionAnimSpeed', 0.1 );
  4258. }
  4259.  
  4260. event OnAnimEvent_extensionWalkStartStopNormalSpeed( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4261. {
  4262. SetBehaviorVariable( 'UsesExtension', 3 );
  4263. SetBehaviorVariable( 'WalkExtensionAnimSpeed', 1.0 );
  4264. SetBehaviorVariable( 'WalkTransitionAnimSpeed', 0.5 );
  4265. }
  4266.  
  4267. event OnAnimEvent_disableCrowdOverride( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4268. {
  4269. SetBehaviorVariable( 'disableCrowdOverride', 1 );
  4270. }
  4271.  
  4272. event OnAnimEvent_ActivateSide( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4273. {
  4274. var template : CEntityTemplate;
  4275. var entity : CEntity;
  4276. var spawnPos : Vector;
  4277. var spawnRot : EulerAngles;
  4278.  
  4279. template = ( CEntityTemplate )LoadResource( 'dolphin' );
  4280.  
  4281.  
  4282. spawnRot = GetWorldRotation();
  4283. spawnRot.Yaw += 180;
  4284. spawnPos = GetWorldPosition() - 1.5 * VecNormalize( VecFromHeading( spawnRot.Yaw + 180 )) + 1 * VecNormalize( VecFromHeading( spawnRot.Yaw + 90 ));
  4285. entity = theGame.CreateEntity( template, spawnPos, spawnRot );
  4286. entity.SetBehaviorVariable( 'side', 1 );
  4287. entity.SetBehaviorVariable( 'alternate', 0 );
  4288.  
  4289.  
  4290.  
  4291. spawnPos = GetWorldPosition() + 1.5 * VecNormalize( VecFromHeading( spawnRot.Yaw + 180 )) + 1 * VecNormalize( VecFromHeading( spawnRot.Yaw + 90 ));
  4292. entity = theGame.CreateEntity( template, spawnPos, spawnRot );
  4293. entity.SetBehaviorVariable( 'side', 1 );
  4294. entity.SetBehaviorVariable( 'alternate', 1 );
  4295.  
  4296. }
  4297.  
  4298. event OnAnimEvent_ActivateUp( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4299. {
  4300. var template : CEntityTemplate;
  4301. var entity : CEntity;
  4302. var spawnPos : Vector;
  4303. var spawnRot : EulerAngles;
  4304.  
  4305. template = ( CEntityTemplate )LoadResource( 'dolphin' );
  4306.  
  4307.  
  4308. spawnRot = GetWorldRotation();
  4309. spawnRot.Yaw += 180;
  4310. spawnPos = GetWorldPosition() + 0.0 * VecNormalize( VecFromHeading( spawnRot.Yaw + 180 )) - 8 * VecNormalize( VecFromHeading( spawnRot.Yaw + 90 ));
  4311. entity = theGame.CreateEntity( template, spawnPos, spawnRot );
  4312. entity.SetBehaviorVariable( 'up', 1 );
  4313. entity.SetBehaviorVariable( 'alternate', 0 );
  4314.  
  4315.  
  4316.  
  4317. spawnPos = GetWorldPosition() + 0.0 * VecNormalize( VecFromHeading( spawnRot.Yaw + 180 )) + 8 * VecNormalize( VecFromHeading( spawnRot.Yaw + 90 ));
  4318. entity = theGame.CreateEntity( template, spawnPos, spawnRot );
  4319. entity.SetBehaviorVariable( 'up', 1 );
  4320. entity.SetBehaviorVariable( 'alternate', 1 );
  4321.  
  4322. }
  4323.  
  4324. event OnAnimEvent_DeactivateSide( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4325. {
  4326. SetBehaviorVariable( 'up', 0 );
  4327. SetBehaviorVariable( 'side', 0 );
  4328. DestroyAfter( 5.0 );
  4329. SetVisibility( false );
  4330.  
  4331. }
  4332.  
  4333. event OnAnimEvent_DeactivateUp( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4334. {
  4335. SetBehaviorVariable( 'up', 0 );
  4336. SetBehaviorVariable( 'side', 0 );
  4337. DestroyAfter( 5.0 );
  4338. SetVisibility( false );
  4339.  
  4340. }
  4341.  
  4342. event OnAnimEvent_BruxaJumpFailsafe( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4343. {
  4344. PlayEffect( 'appear' );
  4345. SignalGameplayEvent( 'appeared' );
  4346. SetBehaviorVariable( 'inAir', 0, true );
  4347. SetBehaviorVariable( 'vanished', 0, true );
  4348. SetBehaviorVariable( 'invisible', 0, true );
  4349. SetGameplayVisibility( true );
  4350. }
  4351.  
  4352. event OnAnimEvent_ResetOneTimeSpawnActivation( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4353. {
  4354. SignalGameplayEvent( 'ResetOneTimeSpawnActivation' );
  4355. }
  4356.  
  4357.  
  4358.  
  4359. event OnEquippedItem( category : name, slotName : name )
  4360. {
  4361. if ( slotName == 'r_weapon' )
  4362. {
  4363. switch( category )
  4364. {
  4365. case 'axe1h':
  4366. case 'axe2h':
  4367. SetBehaviorVariable( 'EquippedItemR', (int) RIT_Axe );
  4368. break;
  4369. case 'halberd2h':
  4370. SetBehaviorVariable( 'EquippedItemR', (int) RIT_Halberd );
  4371. break;
  4372. case 'steelsword' :
  4373. case 'silversword' :
  4374. SetBehaviorVariable( 'EquippedItemR', (int) RIT_Sword );
  4375. break;
  4376. case 'crossbow' :
  4377. SetBehaviorVariable( 'EquippedItemR', (int) RIT_Crossbow );
  4378. break;
  4379. default:
  4380. SetBehaviorVariable( 'EquippedItemR', (int) RIT_None );
  4381. break;
  4382. }
  4383. }
  4384. else if ( slotName == 'l_weapon' )
  4385. {
  4386. switch( category )
  4387. {
  4388. case 'shield' :
  4389. SetBehaviorVariable( 'EquippedItemL', (int) LIT_Shield );
  4390. break;
  4391. case 'bow' :
  4392. SetBehaviorVariable( 'EquippedItemL', (int) LIT_Bow );
  4393. break;
  4394. case 'usable' :
  4395. SetBehaviorVariable( 'EquippedItemL', (int) LIT_Torch );
  4396. break;
  4397. default:
  4398. SetBehaviorVariable( 'EquippedItemL', (int) LIT_None );
  4399. break;
  4400. }
  4401. }
  4402.  
  4403. if ( category != 'fist' && category != 'work' && category != 'usable' && IsInCombat() && GetTarget() == thePlayer && thePlayer.GetTarget() == this )
  4404. thePlayer.OnTargetWeaponDrawn();
  4405. }
  4406.  
  4407. event OnHolsteredItem( category : name, slotName : name )
  4408. {
  4409. if ( slotName == 'r_weapon' )
  4410. {
  4411. SetBehaviorVariable( 'EquippedItemR', (int) RIT_None );
  4412. }
  4413. else if ( slotName == 'l_weapon' )
  4414. {
  4415. SetBehaviorVariable( 'EquippedItemL', (int) LIT_None );
  4416. }
  4417. }
  4418.  
  4419. function IsTalkDisabled () : bool
  4420. {
  4421. return isTalkDisabled || isTalkDisabledTemporary;
  4422. }
  4423.  
  4424. public function DisableTalking( disable : bool, optional temporary : bool )
  4425. {
  4426. if ( temporary )
  4427. {
  4428. isTalkDisabledTemporary = disable;
  4429. }
  4430. else
  4431. {
  4432. isTalkDisabled = disable;
  4433. }
  4434. }
  4435.  
  4436. public function CanStartTalk() : bool
  4437. {
  4438.  
  4439. if( IsAtWork() && !IsConsciousAtWork() || IsTalkDisabled () )
  4440. return false;
  4441.  
  4442. if(HasBuff(EET_AxiiGuardMe) || HasBuff(EET_Confusion))
  4443. return false;
  4444.  
  4445. return !IsFrozen() && CanTalk( true );
  4446. }
  4447.  
  4448. event OnInteraction( actionName : string, activator : CEntity )
  4449. {
  4450. var horseComponent : W3HorseComponent;
  4451. var ciriEntity : W3ReplacerCiri;
  4452. var isAtWork : bool;
  4453. var isConciousAtWork : bool;
  4454.  
  4455. LogChannel( 'DialogueTest', "Event Interaction Used" );
  4456. if ( actionName == "Talk" )
  4457. {
  4458. LogChannel( 'DialogueTest', "Activating TALK Interaction - PLAY DIALOGUE" );
  4459.  
  4460. if ( !PlayDialog() )
  4461. {
  4462.  
  4463.  
  4464. EnableDynamicLookAt( thePlayer, 5 );
  4465. ciriEntity = (W3ReplacerCiri)thePlayer;
  4466. if ( ciriEntity )
  4467. {
  4468. }
  4469. else
  4470. {
  4471.  
  4472. if( !IsAtWork() || IsConsciousAtWork() )
  4473. {
  4474. PlayVoiceset(100, "greeting_geralt" );
  4475. }
  4476. else
  4477. PlayVoiceset(100, "sleeping" );
  4478.  
  4479. wasInTalkInteraction = true;
  4480. AddTimer( 'ResetTalkInteractionFlag', 1.0, true, , , true);
  4481. }
  4482. }
  4483. }
  4484. if ( actionName == "Finish" )
  4485. {
  4486.  
  4487. }
  4488. else if( actionName == "AxiiCalmHorse" )
  4489. {
  4490. SignalGameplayEvent( 'HorseAxiiCalmDownStart' );
  4491. }
  4492. }
  4493.  
  4494. event OnInteractionActivationTest( interactionComponentName : string, activator : CEntity )
  4495. {
  4496. var stateName : name;
  4497. var horseComp : W3HorseComponent;
  4498.  
  4499. if( interactionComponentName == "talk" )
  4500. {
  4501. if( activator == thePlayer && thePlayer.CanStartTalk() && CanStartTalk() )
  4502. {
  4503. return true;
  4504. }
  4505. }
  4506. else if( interactionComponentName == "Finish" && activator == thePlayer )
  4507. {
  4508. stateName = thePlayer.GetCurrentStateName();
  4509. if( stateName == 'CombatSteel' || stateName == 'CombatSilver' )
  4510. return true;
  4511. }
  4512. else if( interactionComponentName == "horseMount" && activator == thePlayer )
  4513. {
  4514. if( !thePlayer.IsActionAllowed( EIAB_MountVehicle ) || thePlayer.IsInAir() )
  4515. return false;
  4516. if ( horseComponent.IsInHorseAction() || !IsAlive() )
  4517. return false;
  4518. if ( GetAttitudeBetween(this,thePlayer) == AIA_Hostile && !( HasBuff(EET_Confusion) || HasBuff(EET_AxiiGuardMe) ) )
  4519. return false;
  4520.  
  4521. if( mac.IsOnNavigableSpace() )
  4522. {
  4523. if( theGame.GetWorld().NavigationLineTest( activator.GetWorldPosition(), this.GetWorldPosition(), 0.05, false, true ) )
  4524. {
  4525.  
  4526. if( theGame.TestNoCreaturesOnLine( activator.GetWorldPosition(), this.GetWorldPosition(), 0.4, (CActor)activator, this, true ) )
  4527. {
  4528. return true;
  4529. }
  4530.  
  4531. return false;
  4532. }
  4533. }
  4534. else
  4535. {
  4536. horseComp = this.GetHorseComponent();
  4537.  
  4538. if( horseComp )
  4539. {
  4540. horseComp.mountTestPlayerPos = activator.GetWorldPosition();
  4541. horseComp.mountTestPlayerPos.Z += 0.5;
  4542. horseComp.mountTestHorsePos = this.GetWorldPosition();
  4543. horseComp.mountTestHorsePos.Z += 0.5;
  4544.  
  4545. if( !theGame.GetWorld().StaticTrace( horseComp.mountTestPlayerPos, horseComp.mountTestHorsePos, horseComp.mountTestEndPos, horseComp.mountTestNormal, horseComp.mountTestCollisionGroups ) )
  4546. {
  4547. return true;
  4548. }
  4549. }
  4550.  
  4551. return false;
  4552. }
  4553. }
  4554.  
  4555.  
  4556.  
  4557. return false;
  4558. }
  4559.  
  4560. event OnInteractionTalkTest()
  4561. {
  4562. return CanStartTalk();
  4563. }
  4564.  
  4565.  
  4566. event OnInteractionActivated( interactionComponentName : string, activator : CEntity )
  4567. {
  4568.  
  4569.  
  4570.  
  4571.  
  4572.  
  4573.  
  4574. }
  4575.  
  4576. event OnInteractionDeactivated( interactionComponentName : string, activator : CEntity )
  4577. {
  4578.  
  4579.  
  4580.  
  4581.  
  4582. }
  4583.  
  4584.  
  4585.  
  4586.  
  4587.  
  4588.  
  4589.  
  4590.  
  4591.  
  4592.  
  4593.  
  4594. event OnBehaviorGraphNotification( notificationName : name, stateName : name )
  4595. {
  4596. var i: int;
  4597. for ( i = 0; i < behaviorGraphEventListened.Size(); i += 1 )
  4598. {
  4599. if( behaviorGraphEventListened[i] == notificationName )
  4600. {
  4601. SignalGameplayEventParamCName( notificationName, stateName );
  4602. }
  4603. }
  4604. super.OnBehaviorGraphNotification( notificationName, stateName );
  4605. }
  4606.  
  4607. public function ActivateSignalBehaviorGraphNotification( notificationName : name )
  4608. {
  4609. if( !behaviorGraphEventListened.Contains( notificationName ) )
  4610. {
  4611. behaviorGraphEventListened.PushBack( notificationName );
  4612. }
  4613. }
  4614.  
  4615. public function DeactivateSignalBehaviorGraphNotification( notificationName : name )
  4616. {
  4617. behaviorGraphEventListened.Remove( notificationName );
  4618. }
  4619.  
  4620.  
  4621.  
  4622.  
  4623.  
  4624. timer function RemoveMutation4BloodDebuff( dt : float, id : int )
  4625. {
  4626. RemoveAbility( 'Mutation4BloodDebuff' );
  4627. }
  4628.  
  4629. function IsShielded( target : CNode ) : bool
  4630. {
  4631. var targetToSourceAngle : float;
  4632. var protectionAngleLeft, protectionAngleRight : float;
  4633.  
  4634. if( target )
  4635. {
  4636. if( HasShieldedAbility() && IsGuarded() )
  4637. {
  4638. targetToSourceAngle = NodeToNodeAngleDistance(target, this);
  4639. protectionAngleLeft = CalculateAttributeValue( this.GetAttributeValue( 'protection_angle_left' ) );
  4640. protectionAngleRight = CalculateAttributeValue( this.GetAttributeValue( 'protection_angle_right' ) );
  4641.  
  4642.  
  4643. if( targetToSourceAngle < protectionAngleRight && targetToSourceAngle > protectionAngleLeft )
  4644. {
  4645. return true;
  4646. }
  4647. }
  4648. return false;
  4649. }
  4650. else
  4651. return HasShieldedAbility() && IsGuarded();
  4652. }
  4653.  
  4654. function HasShieldedAbility() : bool
  4655. {
  4656. var attval : float;
  4657. attval = CalculateAttributeValue( this.GetAttributeValue( 'shielded' ) );
  4658. if( attval >= 1.f )
  4659. return true;
  4660. else
  4661. return false;
  4662. }
  4663.  
  4664. function RaiseShield()
  4665. {
  4666. SetBehaviorVariable( 'bShieldUp', 1.f );
  4667. }
  4668.  
  4669. timer function LowerShield( td : float , id : int)
  4670. {
  4671. SetBehaviorVariable( 'bShieldUp', 0.f );
  4672. }
  4673.  
  4674. // W3EE - Begin
  4675. timer function ResetShieldRaiseBlock( dt : float, id : int )
  4676. {
  4677. Enemies().SunderShieldedBlockChance(this, false);
  4678. }
  4679.  
  4680. public function LowerGuardSunder()
  4681. {
  4682. var resetTime : float;
  4683.  
  4684. LowerGuard();
  4685.  
  4686. if (HasShieldedAbility() && Enemies().SunderShieldedBlockChance(this, true))
  4687. {
  4688. RemoveTimer('ResetShieldRaiseBlock');
  4689.  
  4690. if (HasAbility('SkillShieldHard'))
  4691. resetTime = 1.0f;
  4692. else
  4693. resetTime = 1.5f;
  4694.  
  4695. AddTimer('ResetShieldRaiseBlock', resetTime);
  4696. }
  4697. }
  4698. // W3EE - End
  4699.  
  4700. public function ProcessShieldDestruction()
  4701. {
  4702. // W3EE - Begin
  4703. var hasShield : CEntity;
  4704.  
  4705. hasShield = GetInventory().GetItemEntityUnsafe( GetInventory().GetItemFromSlot( 'l_weapon' ) );
  4706.  
  4707. if( HasTag( 'imlerith' ) || !hasShield )
  4708. return;
  4709.  
  4710. SetBehaviorVariable( 'bShieldbreak', 1.0 );
  4711. AddEffectDefault( EET_Stagger, thePlayer, "ParryStagger" );
  4712. ToggleEffectOnShield( 'heavy_block', true );
  4713. DropItemFromSlot( 'l_weapon', true );
  4714. SignalGameplayEventParamInt('ChangePreferedCombatStyle', (int)EBG_Combat_1Handed_Any);
  4715. // W3EE - End
  4716. }
  4717.  
  4718. // W3EE - Begin
  4719. public function ProcessWeaponDisarm()
  4720. {
  4721. if( HasTag('IsBoss') )
  4722. return;
  4723.  
  4724. DropItemFromSlot('r_weapon', true);
  4725. //AddEffectDefault(EET_Stagger, thePlayer, "ParryStagger");
  4726. SignalGameplayEventParamInt('ChangePreferedCombatStyle', (int)EBG_Combat_Fists);
  4727. }
  4728. // W3EE - End
  4729.  
  4730. event OnIncomingProjectile( isBomb : bool )
  4731. {
  4732. if( IsShielded( thePlayer ) )
  4733. {
  4734. RaiseShield();
  4735. AddTimer( 'LowerShield', 3.0 );
  4736. }
  4737. }
  4738.  
  4739. function ShouldAttackImmidiately() : bool
  4740. {
  4741. return tauntedToAttackTimeStamp > 0 && ( tauntedToAttackTimeStamp + 10 > theGame.GetEngineTimeAsSeconds() );
  4742. }
  4743.  
  4744. function CanAttackKnockeddownTarget() : bool
  4745. {
  4746. var attval : float;
  4747. attval = CalculateAttributeValue(this.GetAttributeValue('attackKnockeddownTarget'));
  4748. if ( attval >= 1.f )
  4749. return true;
  4750. else
  4751. return false;
  4752. }
  4753.  
  4754. event OnProcessRequiredItemsFinish()
  4755. {
  4756. var inv : CInventoryComponent = this.GetInventory();
  4757. var heldItems, heldItemsNames, mountedItems : array<name>;
  4758.  
  4759. if ( thePlayer.GetTarget() == this )
  4760. thePlayer.OnTargetWeaponDrawn();
  4761.  
  4762.  
  4763. SetBehaviorVariable( 'bIsGuarded', (int)IsGuarded() );
  4764.  
  4765. inv.GetAllHeldAndMountedItemsCategories(heldItems, mountedItems);
  4766.  
  4767.  
  4768. if ( this.HasShieldedAbility() )
  4769. {
  4770. RaiseGuard();
  4771. }
  4772.  
  4773. inv.GetAllHeldItemsNames( heldItemsNames );
  4774.  
  4775. if ( heldItemsNames.Contains('fists_lightning') || heldItemsNames.Contains('fists_fire') )
  4776. {
  4777. this.PlayEffect('hand_fx');
  4778. theGame.GetBehTreeReactionManager().CreateReactionEventIfPossible( this, 'FireDanger', -1, 5.0f, 1, -1, true, true );
  4779. }
  4780. else
  4781. {
  4782. this.StopEffect('hand_fx');
  4783. theGame.GetBehTreeReactionManager().RemoveReactionEvent( this, 'FireDanger' );
  4784. }
  4785.  
  4786. if ( mountedItems.Contains('shield') )
  4787. {
  4788. this.AddAbility('CannotBeAttackedFromBehind', false);
  4789. LowerGuard();
  4790. }
  4791. else
  4792. {
  4793. this.RemoveAbility('CannotBeAttackedFromBehind');
  4794. }
  4795. }
  4796.  
  4797. public function ProcessSpearDestruction() : bool
  4798. {
  4799. var appearanceName : name;
  4800. var shouldDrop : bool;
  4801. var spear : CEntity;
  4802.  
  4803. appearanceName = 'broken';
  4804. spear = GetInventory().GetItemEntityUnsafe( GetInventory().GetItemFromSlot( 'r_weapon' ) );
  4805. spear.ApplyAppearance( appearanceName );
  4806. DropItemFromSlot('r_weapon', true);
  4807. return true;
  4808.  
  4809. }
  4810.  
  4811.  
  4812.  
  4813.  
  4814.  
  4815. function PlayVitalSpotAmbientSound( soundEvent : string )
  4816. {
  4817. SoundEvent( soundEvent, 'pelvis' );
  4818. }
  4819.  
  4820. function StopVitalSpotAmbientSound( soundEvent : string)
  4821. {
  4822. SoundEvent( soundEvent, 'pelvis' );
  4823. }
  4824.  
  4825. event OnScriptReloaded()
  4826. {
  4827.  
  4828. }
  4829.  
  4830.  
  4831.  
  4832.  
  4833.  
  4834.  
  4835.  
  4836. public function ChangeFightStage( fightStage : ENPCFightStage )
  4837. {
  4838. currentFightStage = fightStage;
  4839. SetCurrentFightStage();
  4840. }
  4841.  
  4842. public function SetCurrentFightStage()
  4843. {
  4844. SetBehaviorVariable( 'npcFightStage', (float)(int)currentFightStage, true );
  4845. }
  4846.  
  4847. public function GetCurrentFightStage() : ENPCFightStage
  4848. {
  4849. return currentFightStage;
  4850. }
  4851.  
  4852.  
  4853. public function SetBleedBurnPoison()
  4854. {
  4855. wasBleedingBurningPoisoned = true;
  4856. }
  4857.  
  4858. public function WasBurnedBleedingPoisoned() : bool
  4859. {
  4860. return wasBleedingBurningPoisoned;
  4861. }
  4862.  
  4863.  
  4864. public function HasAlternateQuen() : bool
  4865. {
  4866. var npcStorage : CHumanAICombatStorage;
  4867.  
  4868. npcStorage = (CHumanAICombatStorage)GetScriptStorageObject('CombatData');
  4869. if(npcStorage && npcStorage.IsProtectedByQuen() )
  4870. {
  4871. return true;
  4872. }
  4873.  
  4874. return false;
  4875. }
  4876.  
  4877.  
  4878. public function GetIsMonsterTypeGroup() : bool { return isMonsterType_Group; }
  4879.  
  4880. timer function AardDismemberForce( dt : float, id : int )
  4881. {
  4882. var ent : CEntity;
  4883. var template : CEntityTemplate;
  4884. var pos, toPlayerVec : Vector;
  4885.  
  4886.  
  4887. template = (CEntityTemplate) LoadResource( "explosion_dismember_force" );
  4888. toPlayerVec = GetWorldPosition() - thePlayer.GetWorldPosition();
  4889. pos = GetWorldPosition() + toPlayerVec / VecDistance2D( GetWorldPosition(), thePlayer.GetWorldPosition() * 3 );
  4890. ent = theGame.CreateEntity( template, pos, , , , true );
  4891. ent.DestroyAfter( 5.f );
  4892. }
  4893.  
  4894.  
  4895.  
  4896.  
  4897. function UpdateAIVisualDebug()
  4898. {
  4899. }
  4900.  
  4901.  
  4902. event OnAllowBehGraphChange()
  4903. {
  4904. allowBehGraphChange = true;
  4905. }
  4906.  
  4907. event OnDisallowBehGraphChange()
  4908. {
  4909. allowBehGraphChange = false;
  4910. }
  4911.  
  4912. event OnObstacleCollision( object : CObject, physicalActorindex : int, shapeIndex : int )
  4913. {
  4914. var ent : CEntity;
  4915. var component : CComponent;
  4916. component = (CComponent) object;
  4917. if( !component )
  4918. {
  4919. return false;
  4920. }
  4921.  
  4922. ent = component.GetEntity();
  4923.  
  4924. if ( (CActor)ent != this )
  4925. {
  4926.  
  4927. this.SignalGameplayEventParamObject('CollisionWithObstacle',ent);
  4928. }
  4929. }
  4930.  
  4931. event OnObstacleCollisionProbe( object : CObject, physicalActorindex : int, shapeIndex : int )
  4932. {
  4933. var ent : CEntity;
  4934. var component : CComponent;
  4935. component = (CComponent) object;
  4936. if( !component )
  4937. {
  4938. return false;
  4939. }
  4940.  
  4941. ent = component.GetEntity();
  4942. if ( (CActor)ent != this )
  4943. {
  4944. this.SignalGameplayEventParamObject('CollisionWithObstacleProbe',ent);
  4945. }
  4946. }
  4947.  
  4948. event OnProjectileCustomCollision( object : CObject, physicalActorindex : int, shapeIndex : int )
  4949. {
  4950. var ent : CEntity;
  4951. var component : CComponent;
  4952. component = (CComponent) object;
  4953. if( !component )
  4954. {
  4955. return false;
  4956. }
  4957.  
  4958. ent = component.GetEntity();
  4959. if ( (CActor)ent != this )
  4960. {
  4961. this.SignalGameplayEventParamObject('CollisionWithProjectileCustom',ent);
  4962. }
  4963. }
  4964.  
  4965.  
  4966. event OnActorCollision( object : CObject, physicalActorindex : int, shapeIndex : int )
  4967. {
  4968. var ent : CEntity;
  4969. var component : CComponent;
  4970. component = (CComponent) object;
  4971. if( !component )
  4972. {
  4973. return false;
  4974. }
  4975.  
  4976. ent = component.GetEntity();
  4977. if ( ent != this )
  4978. {
  4979. this.SignalGameplayEventParamObject('CollisionWithActor', ent );
  4980.  
  4981.  
  4982. if( horseComponent )
  4983. {
  4984. horseComponent.OnCharacterCollision( ent );
  4985. }
  4986. }
  4987. }
  4988.  
  4989. event OnActorSideCollision( object : CObject, physicalActorindex : int, shapeIndex : int )
  4990. {
  4991. var ent : CEntity;
  4992. var horseComp : W3HorseComponent;
  4993. var component : CComponent;
  4994. component = (CComponent) object;
  4995. if( !component )
  4996. {
  4997. return false;
  4998. }
  4999.  
  5000. ent = component.GetEntity();
  5001. if ( ent != this )
  5002. {
  5003. this.SignalGameplayEventParamObject('CollisionWithActor', ent );
  5004.  
  5005.  
  5006. if( horseComponent )
  5007. {
  5008. horseComponent.OnCharacterSideCollision( ent );
  5009. }
  5010. }
  5011. }
  5012.  
  5013. event OnStaticCollision( component : CComponent )
  5014. {
  5015. SignalGameplayEventParamObject('CollisionWithStatic',component);
  5016. }
  5017.  
  5018. event OnBoatCollision( object : CObject, physicalActorindex : int, shapeIndex : int )
  5019. {
  5020. var ent : CEntity;
  5021. var component : CComponent;
  5022. component = (CComponent) object;
  5023. if( !component )
  5024. {
  5025. return false;
  5026. }
  5027.  
  5028. ent = component.GetEntity();
  5029. if ( ent != this )
  5030. {
  5031. this.SignalGameplayEventParamObject('CollisionWithBoat', ent );
  5032. }
  5033. }
  5034.  
  5035.  
  5036.  
  5037.  
  5038.  
  5039. public function IsUnderwater() : bool { return isUnderwater; }
  5040. public function ToggleIsUnderwater ( toggle : bool ) { isUnderwater = toggle; }
  5041.  
  5042. event OnOceanTriggerEnter()
  5043. {
  5044. SignalGameplayEvent('EnterWater');
  5045. }
  5046.  
  5047. event OnOceanTriggerLeave()
  5048. {
  5049. SignalGameplayEvent('LeaveWater');
  5050. }
  5051.  
  5052.  
  5053.  
  5054.  
  5055.  
  5056. var isRagdollOn : bool; default isRagdollOn = false;
  5057.  
  5058. event OnInAirStarted()
  5059. {
  5060.  
  5061. }
  5062.  
  5063. event OnRagdollOnGround()
  5064. {
  5065. var params : SCustomEffectParams;
  5066.  
  5067. if( GetIsFallingFromHorse() )
  5068. {
  5069. params.effectType = EET_Ragdoll;
  5070. params.creator = this;
  5071. params.sourceName = "ragdoll_dismount";
  5072. params.duration = 0.5;
  5073. AddEffectCustom( params );
  5074. SignalGameplayEvent( 'RagdollFromHorse' );
  5075. SetIsFallingFromHorse( false );
  5076. }
  5077. else if( IsInAir() )
  5078. {
  5079. SetIsInAir(false);
  5080. }
  5081. }
  5082.  
  5083. var m_storedInteractionPri : EInteractionPriority;
  5084. default m_storedInteractionPri = IP_NotSet;
  5085.  
  5086. event OnRagdollStart()
  5087. {
  5088. var currentPri : EInteractionPriority;
  5089.  
  5090.  
  5091. currentPri = GetInteractionPriority();
  5092. if ( currentPri != IP_Max_Unpushable && IsAlive() )
  5093. {
  5094. m_storedInteractionPri = currentPri;
  5095. SetInteractionPriority( IP_Max_Unpushable );
  5096. }
  5097. }
  5098.  
  5099. event OnNoLongerInRagdoll()
  5100. {
  5101. aardedFlight = false;
  5102.  
  5103.  
  5104. if ( m_storedInteractionPri != IP_NotSet && IsAlive() )
  5105. {
  5106. SetInteractionPriority( m_storedInteractionPri );
  5107. m_storedInteractionPri = IP_NotSet;
  5108. }
  5109. }
  5110.  
  5111. timer function DelayRagdollSwitch( td : float , id : int)
  5112. {
  5113. var params : SCustomEffectParams;
  5114.  
  5115. if( IsInAir() )
  5116. {
  5117. isRagdollOn = true;
  5118. params.effectType = EET_Ragdoll;
  5119. params.duration = 5;
  5120.  
  5121. AddEffectCustom(params);
  5122. }
  5123. }
  5124.  
  5125. event OnRagdollIsAwayFromCapsule( ragdollPosition : Vector, entityPosition : Vector )
  5126. {
  5127. }
  5128.  
  5129. event OnRagdollCloseToCapsule( ragdollPosition : Vector, entityPosition : Vector )
  5130. {
  5131. }
  5132.  
  5133. // W3EE - Begin
  5134. private var isRegenActive : bool; default isRegenActive = true;
  5135. public function GetIsRegenActive() : bool
  5136. {
  5137. return isRegenActive;
  5138. }
  5139.  
  5140. timer function SetRegenActive( dt : float, id : int )
  5141. {
  5142. isRegenActive = true;
  5143. }
  5144.  
  5145. public function StartRegenTimer(optional extraDelay : float)
  5146. {
  5147. isRegenActive = false;
  5148. AddTimer('SetRegenActive', npcStats.regenDelay + extraDelay, false,,,,true);
  5149. }
  5150. // W3EE - End
  5151.  
  5152. event OnTakeDamage( action : W3DamageAction )
  5153. {
  5154. var i : int;
  5155. var abilityName : name;
  5156. var abilityCount, maxStack : float;
  5157. var min, max : SAbilityAttributeValue;
  5158. var addAbility : bool;
  5159. var witcher : W3PlayerWitcher;
  5160. var attackAction : W3Action_Attack;
  5161. var gameplayEffects : array<CBaseGameplayEffect>;
  5162. var template : CEntityTemplate;
  5163. var hud : CR4ScriptedHud;
  5164. var ent : CEntity;
  5165. var weaponId : SItemUniqueId;
  5166.  
  5167. super.OnTakeDamage(action);
  5168.  
  5169. // W3EE - Begin
  5170. if( npcStats.healthRegenFactor > 0 && npcStats.regenDelay > 0 && !action.IsDoTDamage() && action.DealsAnyDamage() && isRegenActive == true )
  5171. StartRegenTimer();
  5172. // W3EE - End
  5173.  
  5174. if(action.IsActionMelee())
  5175. lastMeleeHitTime = theGame.GetEngineTime();
  5176.  
  5177.  
  5178. if( (W3PlayerWitcher)action.attacker && action.IsActionRanged() && GetWitcherPlayer().IsMutationActive( EPMT_Mutation9 ) )
  5179. {
  5180. attackAction = (W3Action_Attack)action;
  5181. if( attackAction )
  5182. {
  5183. weaponId = attackAction.GetWeaponId();
  5184. if( thePlayer.inv.IsItemCrossbow( weaponId ) || thePlayer.inv.IsItemBolt( weaponId ) )
  5185. {
  5186. theGame.MutationHUDFeedback( MFT_PlayOnce );
  5187. }
  5188. }
  5189. }
  5190. }
  5191.  
  5192. public function GetInteractionData( out actionName : name, out text : string ) : bool
  5193. {
  5194. if ( CanStartTalk() && !IsInCombat() && !HasTag( 'no_talk' ) )
  5195. {
  5196. actionName = 'Talk';
  5197. text = "panel_button_common_talk";
  5198. return true;
  5199. }
  5200. return false;
  5201. }
  5202.  
  5203. public function IsAtWorkDependentOnFireSource() : bool
  5204. {
  5205. if ( IsAPValid(GetActiveActionPoint()) )
  5206. {
  5207. return theGame.GetAPManager().IsFireSourceDependent( GetActiveActionPoint() );
  5208. }
  5209.  
  5210. return false;
  5211. }
  5212.  
  5213. public function FinishQuen( skipVisuals : bool, optional forceNoBearSetBonus : bool )
  5214. {
  5215. SignalGameplayEvent('FinishQuen');
  5216. }
  5217.  
  5218. public function IsAxiied() : Bool
  5219. {
  5220. return HasBuff( EET_AxiiGuardMe ) || HasBuff( EET_Confusion );
  5221. }
  5222.  
  5223. private timer function CloseHitWindowAfter( dt : float, id : int )
  5224. {
  5225. SetBehaviorVariable( 'counterHitType', 0.0 );
  5226. }
  5227.  
  5228.  
  5229.  
  5230.  
  5231.  
  5232.  
  5233.  
  5234. public timer function SetShowAllHorseItems( dt : float, id : int )
  5235. {
  5236. var hiddenItems : bool;
  5237.  
  5238. hiddenItems = TryToHideAllHorseItems();
  5239.  
  5240.  
  5241. if( !hiddenItems )
  5242. {
  5243. AddTimer( 'SetShowAllHorseItems', 0.1f, true );
  5244. }
  5245. else
  5246. {
  5247. RemoveTimer( 'SetShowAllHorseItems' );
  5248. }
  5249. }
  5250.  
  5251.  
  5252.  
  5253.  
  5254. public final function TryToHideAllHorseItems() : bool
  5255. {
  5256. var items : array< SItemUniqueId >;
  5257. var itemEntity : CItemEntity;
  5258. var i, k : int;
  5259. var drawableComp : CDrawableComponent;
  5260. var drawableComps : array<CComponent>;
  5261. var inv : CInventoryComponent;
  5262. var itemVisibility : bool;
  5263. var foundTail, foundReins, foundHair : bool;
  5264. var itemName : name;
  5265.  
  5266. inv = GetInventory();
  5267. inv.GetAllItems( items );
  5268. itemVisibility = !GetWitcherPlayer().GetHorseManager().GetShouldHideAllItems();
  5269.  
  5270. foundTail = false;
  5271. foundReins = false;
  5272. foundHair = false;
  5273.  
  5274. for( i=0; i<items.Size(); i+=1 )
  5275. {
  5276. itemName = inv.GetItemName( items[ i ] );
  5277. itemEntity = inv.GetItemEntityUnsafe( items[ i ] );
  5278. if( itemEntity )
  5279. {
  5280. if( inv.ItemHasTag( items[i], 'HorseTail' ) )
  5281. {
  5282. foundTail = true;
  5283. }
  5284. else if( inv.ItemHasTag( items[i], 'HorseReins' ) )
  5285. {
  5286. foundReins = true;
  5287. }
  5288. else if( inv.GetItemCategory( items[i] ) == 'horse_hair' )
  5289. {
  5290. foundHair = true;
  5291. }
  5292.  
  5293. drawableComps = itemEntity.GetComponentsByClassName( 'CDrawableComponent' );
  5294.  
  5295. for( k = 0; k < drawableComps.Size(); k += 1 )
  5296. {
  5297. drawableComp = ( CDrawableComponent )drawableComps[ k ];
  5298. if( drawableComp )
  5299. {
  5300. drawableComp.SetVisible( itemVisibility );
  5301. }
  5302. }
  5303. }
  5304. }
  5305.  
  5306.  
  5307. return items.Size() == 0 || ( foundTail && foundReins && foundHair );
  5308. }
  5309.  
  5310. timer function SetUnconsciousFinisher( time : float , id : int )
  5311. {
  5312. SetBehaviorVariable( 'unconsciousFinisher', 1.0 );
  5313. SetBehaviorVariable( 'prepareForUnconsciousFinisher', 0.0f );
  5314. }
  5315.  
  5316. timer function EvadeFinisherTimer( dt : float, id : int )
  5317. {
  5318. var ticketS, ticketR : SMovementAdjustmentRequestTicket;
  5319. var movementAdjustor : CMovementAdjustor;
  5320.  
  5321. PlayEffectSingle( 'disappear' );
  5322.  
  5323. movementAdjustor = this.GetMovingAgentComponent().GetMovementAdjustor();
  5324.  
  5325. ticketS = movementAdjustor.CreateNewRequest( 'FinisherSlide' );
  5326. movementAdjustor.MaxLocationAdjustmentSpeed( ticketS, 9999 );
  5327. movementAdjustor.AdjustLocationVertically( ticketS, true );
  5328. movementAdjustor.AdjustmentDuration( ticketS, 0.6 );
  5329. movementAdjustor.BlendIn( ticketS, 0.25 );
  5330. movementAdjustor.SlideTowards( ticketS, GetTarget(), 5, 7 );
  5331.  
  5332. ticketR = movementAdjustor.CreateNewRequest( 'FinisherRotate' );
  5333. movementAdjustor.MaxLocationAdjustmentSpeed( ticketR, 9999 );
  5334. movementAdjustor.AdjustmentDuration( ticketR, 0.1 );
  5335. movementAdjustor.RotateTowards( ticketR, GetTarget() );
  5336.  
  5337. this.AddTimer( 'EvadeFinisherTimerStop', 0.6, false );
  5338. }
  5339.  
  5340. timer function EvadeFinisherTimerStop( dt : float, id : int )
  5341. {
  5342. PlayEffectSingle( 'appear' );
  5343. }
  5344. }
  5345.  
  5346. exec function IsFireSource( tag : name )
  5347. {
  5348. var npc : CNewNPC;
  5349.  
  5350. npc = ( CNewNPC )theGame.GetEntityByTag( tag );
  5351.  
  5352. LogChannel('SD', "" + npc.IsAtWorkDependentOnFireSource() );
  5353. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement