Survitec

Untitled

Jan 27th, 2024
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 337.22 KB | Gaming | 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.  
  10. statemachine class W3PlayerWitcher extends CR4Player
  11. {
  12.  
  13. private saved var craftingSchematics : array<name>;
  14. private saved var expandedCraftingCategories : array<name>;
  15. private saved var craftingFilters : SCraftingFilters;
  16.  
  17.  
  18. private saved var alchemyRecipes : array<name>;
  19. private saved var expandedAlchemyCategories : array<name>;
  20. private saved var alchemyFilters : SCraftingFilters;
  21.  
  22.  
  23. private saved var expandedBestiaryCategories : array<name>;
  24.  
  25.  
  26. private saved var booksRead : array<name>;
  27.  
  28.  
  29. private var fastAttackCounter, heavyAttackCounter : int;
  30. private var isInFrenzy : bool;
  31. private var hasRecentlyCountered : bool;
  32. private saved var cannotUseUndyingSkill : bool;
  33.  
  34.  
  35. protected saved var amountOfSetPiecesEquipped : array<int>;
  36.  
  37.  
  38. public var canSwitchFocusModeTarget : bool;
  39. protected var switchFocusModeTargetAllowed : bool;
  40. default canSwitchFocusModeTarget = true;
  41. default switchFocusModeTargetAllowed = true;
  42.  
  43.  
  44. private editable var signs : array< SWitcherSign >;
  45. private saved var equippedSign : ESignType;
  46. private var currentlyCastSign : ESignType; default currentlyCastSign = ST_None;
  47. private var signOwner : W3SignOwnerPlayer;
  48. private var usedQuenInCombat : bool;
  49. public var yrdenEntities : array<W3YrdenEntity>;
  50. public saved var m_quenReappliedCount : int;
  51. private var m_quenHitFxTTL : float;
  52. private var m_TriggerEffectDisablePending : bool;
  53. private var m_TriggerEffectDisabled : bool;
  54. private var m_TriggerEffectDisableTTW : float;
  55.  
  56. default equippedSign = ST_Aard;
  57. default m_quenReappliedCount = 1;
  58.  
  59.  
  60.  
  61. private var bDispalyHeavyAttackIndicator : bool;
  62. private var bDisplayHeavyAttackFirstLevelTimer : bool;
  63. public var specialAttackHeavyAllowed : bool;
  64.  
  65. default bIsCombatActionAllowed = true;
  66. default bDispalyHeavyAttackIndicator = false;
  67. default bDisplayHeavyAttackFirstLevelTimer = true;
  68.  
  69.  
  70.  
  71. default explorationInputContext = 'Exploration';
  72. default combatInputContext = 'Combat';
  73. default combatFistsInputContext = 'Combat';
  74.  
  75.  
  76. private saved var companionNPCTag : name;
  77. private saved var companionNPCTag2 : name;
  78.  
  79. private saved var companionNPCIconPath : string;
  80. private saved var companionNPCIconPath2 : string;
  81.  
  82.  
  83. private saved var itemSlots : array<SItemUniqueId>;
  84. private var remainingBombThrowDelaySlot1 : float;
  85. private var remainingBombThrowDelaySlot2 : float;
  86. private var previouslyUsedBolt : SItemUniqueId;
  87. private saved var questMarkedSelectedQuickslotItems : array< SSelectedQuickslotItem >;
  88.  
  89. default isThrowingItem = false;
  90. default remainingBombThrowDelaySlot1 = 0.f;
  91. default remainingBombThrowDelaySlot2 = 0.f;
  92.  
  93.  
  94.  
  95.  
  96.  
  97. private saved var tempLearnedSignSkills : array<SSimpleSkill>;
  98. public saved var autoLevel : bool;
  99.  
  100.  
  101.  
  102.  
  103. protected saved var skillBonusPotionEffect : CBaseGameplayEffect;
  104.  
  105.  
  106. public saved var levelManager : W3LevelManager;
  107.  
  108.  
  109. saved var reputationManager : W3Reputation;
  110.  
  111.  
  112. private editable var medallionEntity : CEntityTemplate;
  113. private var medallionController : W3MedallionController;
  114.  
  115.  
  116.  
  117.  
  118. public var bShowRadialMenu : bool;
  119.  
  120. private var _HoldBeforeOpenRadialMenuTime : float;
  121.  
  122. default _HoldBeforeOpenRadialMenuTime = 0.5f;
  123.  
  124. public var MappinToHighlight : array<SHighlightMappin>;
  125.  
  126.  
  127. protected saved var horseManagerHandle : EntityHandle;
  128.  
  129. private var isInitialized : bool;
  130. private var timeForPerk21 : float;
  131.  
  132. default isInitialized = false;
  133.  
  134.  
  135. private var invUpdateTransaction : bool;
  136. default invUpdateTransaction = false;
  137.  
  138. public var lastPressedWithNostamina : bool;
  139. default lastPressedWithNostamina = false;
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151. event OnSpawned( spawnData : SEntitySpawnData )
  152. {
  153. var i : int;
  154. var items : array<SItemUniqueId>;
  155. var items2 : array<SItemUniqueId>;
  156. var horseTemplate : CEntityTemplate;
  157. var horseManager : W3HorseManager;
  158.  
  159.  
  160. var exceptions : array<CBaseGameplayEffect>;
  161. var wolf : CBaseGameplayEffect;
  162.  
  163.  
  164. AddAnimEventCallback( 'ActionBlend', 'OnAnimEvent_ActionBlend' );
  165. AddAnimEventCallback('cast_begin', 'OnAnimEvent_Sign');
  166. AddAnimEventCallback('cast_throw', 'OnAnimEvent_Sign');
  167. AddAnimEventCallback('cast_end', 'OnAnimEvent_Sign');
  168. AddAnimEventCallback('cast_friendly_begin', 'OnAnimEvent_Sign');
  169. AddAnimEventCallback('cast_friendly_throw', 'OnAnimEvent_Sign');
  170. AddAnimEventCallback('axii_ready', 'OnAnimEvent_Sign');
  171. AddAnimEventCallback('axii_alternate_ready', 'OnAnimEvent_Sign');
  172. AddAnimEventCallback('yrden_draw_ready', 'OnAnimEvent_Sign');
  173.  
  174. AddAnimEventCallback( 'ProjectileThrow', 'OnAnimEvent_Throwable' );
  175. AddAnimEventCallback( 'OnWeaponReload', 'OnAnimEvent_Throwable' );
  176. AddAnimEventCallback( 'ProjectileAttach', 'OnAnimEvent_Throwable' );
  177. AddAnimEventCallback( 'Mutation11AnimEnd', 'OnAnimEvent_Mutation11AnimEnd' );
  178. AddAnimEventCallback( 'Mutation11ShockWave', 'OnAnimEvent_Mutation11ShockWave' );
  179.  
  180.  
  181.  
  182. amountOfSetPiecesEquipped.Resize( EnumGetMax( 'EItemSetType' ) + 1 );
  183.  
  184. runewordInfusionType = ST_None;
  185.  
  186.  
  187. inv = GetInventory();
  188.  
  189.  
  190. signOwner = new W3SignOwnerPlayer in this;
  191. signOwner.Init( this );
  192.  
  193. itemSlots.Resize( EnumGetMax('EEquipmentSlots')+1 );
  194.  
  195. if(!spawnData.restored)
  196. {
  197. levelManager = new W3LevelManager in this;
  198. levelManager.Initialize();
  199.  
  200.  
  201. inv.GetAllItems(items);
  202. for(i=0; i<items.Size(); i+=1)
  203. {
  204. if(inv.IsItemMounted(items[i]) && ( !inv.IsItemBody(items[i]) || inv.GetItemCategory(items[i]) == 'hair' ) )
  205. EquipItem(items[i]);
  206. }
  207.  
  208.  
  209.  
  210.  
  211.  
  212. AddAlchemyRecipe('Recipe for Swallow 1',true,true);
  213. AddAlchemyRecipe('Recipe for Cat 1',true,true);
  214. AddAlchemyRecipe('Recipe for White Honey 1',true,true);
  215.  
  216. AddAlchemyRecipe('Recipe for Samum 1',true,true);
  217. AddAlchemyRecipe('Recipe for Grapeshot 1',true,true);
  218.  
  219. AddAlchemyRecipe('Recipe for Specter Oil 1',true,true);
  220. AddAlchemyRecipe('Recipe for Necrophage Oil 1',true,true);
  221. AddAlchemyRecipe('Recipe for Alcohest 1',true,true);
  222. }
  223. else
  224. {
  225. AddTimer('DelayedOnItemMount', 0.1, true);
  226.  
  227.  
  228. CheckHairItem();
  229. }
  230.  
  231.  
  232. AddStartingSchematics();
  233.  
  234. super.OnSpawned( spawnData );
  235.  
  236.  
  237. AddAlchemyRecipe('Recipe for Mutagen red',true,true);
  238. AddAlchemyRecipe('Recipe for Mutagen green',true,true);
  239. AddAlchemyRecipe('Recipe for Mutagen blue',true,true);
  240. AddAlchemyRecipe('Recipe for Greater mutagen red',true,true);
  241. AddAlchemyRecipe('Recipe for Greater mutagen green',true,true);
  242. AddAlchemyRecipe('Recipe for Greater mutagen blue',true,true);
  243.  
  244. AddCraftingSchematic('Starting Armor Upgrade schematic 1',true,true);
  245.  
  246.  
  247. if( inputHandler )
  248. {
  249. inputHandler.BlockAllActions( 'being_ciri', false );
  250. }
  251. SetBehaviorVariable( 'test_ciri_replacer', 0.0f);
  252.  
  253. if(!spawnData.restored)
  254. {
  255.  
  256. abilityManager.GainStat(BCS_Toxicity, 0);
  257. }
  258.  
  259. levelManager.PostInit(this, spawnData.restored, true);
  260.  
  261. SetBIsCombatActionAllowed( true );
  262. SetBIsInputAllowed( true, 'OnSpawned' );
  263.  
  264.  
  265. if ( !reputationManager )
  266. {
  267. reputationManager = new W3Reputation in this;
  268. reputationManager.Initialize();
  269. }
  270.  
  271. theSound.SoundParameter( "focus_aim", 1.0f, 1.0f );
  272. theSound.SoundParameter( "focus_distance", 0.0f, 1.0f );
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279. currentlyCastSign = ST_None;
  280.  
  281.  
  282. if(!spawnData.restored)
  283. {
  284. horseTemplate = (CEntityTemplate)LoadResource("horse_manager");
  285. horseManager = (W3HorseManager)theGame.CreateEntity(horseTemplate, GetWorldPosition(),,,,,PM_Persist);
  286. horseManager.CreateAttachment(this);
  287. horseManager.OnCreated();
  288. EntityHandleSet( horseManagerHandle, horseManager );
  289. }
  290. else
  291. {
  292. AddTimer('DelayedHorseUpdate', 0.01, true);
  293. }
  294.  
  295.  
  296. RemoveAbility('Ciri_CombatRegen');
  297. RemoveAbility('Ciri_Rage');
  298. RemoveAbility('CiriBlink');
  299. RemoveAbility('CiriCharge');
  300. RemoveAbility('Ciri_Q205');
  301. RemoveAbility('Ciri_Q305');
  302. RemoveAbility('Ciri_Q403');
  303. RemoveAbility('Ciri_Q111');
  304. RemoveAbility('Ciri_Q501');
  305. RemoveAbility('SkillCiri');
  306.  
  307. if(spawnData.restored)
  308. {
  309. RestoreQuen(savedQuenHealth, savedQuenDuration);
  310. }
  311. else
  312. {
  313. savedQuenHealth = 0.f;
  314. savedQuenDuration = 0.f;
  315. }
  316.  
  317. if(spawnData.restored)
  318. {
  319. ApplyPatchFixes();
  320. }
  321. else
  322. {
  323.  
  324. FactsAdd( "new_game_started_in_1_20" );
  325. }
  326.  
  327. if ( spawnData.restored )
  328. {
  329. FixEquippedMutagens();
  330. }
  331.  
  332. if ( FactsQuerySum("NewGamePlus") > 0 )
  333. {
  334. NewGamePlusAdjustDLC1TemerianSet(inv);
  335. NewGamePlusAdjustDLC5NilfgardianSet(inv);
  336. NewGamePlusAdjustDLC10WolfSet(inv);
  337. NewGamePlusAdjustDLC14SkelligeSet(inv);
  338.  
  339.  
  340.  
  341.  
  342. if(horseManager)
  343. {
  344. NewGamePlusAdjustDLC1TemerianSet(horseManager.GetInventoryComponent());
  345. NewGamePlusAdjustDLC5NilfgardianSet(horseManager.GetInventoryComponent());
  346. NewGamePlusAdjustDLC10WolfSet(horseManager.GetInventoryComponent());
  347. NewGamePlusAdjustDLC14SkelligeSet(horseManager.GetInventoryComponent());
  348.  
  349.  
  350.  
  351.  
  352. }
  353. }
  354.  
  355.  
  356. ResumeStaminaRegen('WhirlSkill');
  357.  
  358. if(HasAbility('Runeword 4 _Stats', true))
  359. StartVitalityRegen();
  360.  
  361.  
  362. if(HasAbility('sword_s19'))
  363. {
  364. RemoveTemporarySkills();
  365. }
  366.  
  367. HACK_UnequipWolfLiver();
  368.  
  369.  
  370. if( HasBuff( EET_GryphonSetBonusYrden ) )
  371. {
  372. RemoveBuff( EET_GryphonSetBonusYrden, false, "GryphonSetBonusYrden" );
  373. }
  374.  
  375. if( spawnData.restored )
  376. {
  377.  
  378. UpdateEncumbrance();
  379.  
  380.  
  381. RemoveBuff( EET_Mutation11Immortal );
  382. RemoveBuff( EET_Mutation11Buff );
  383. }
  384.  
  385.  
  386. theGame.GameplayFactsAdd( "PlayerIsGeralt" );
  387.  
  388. isInitialized = true;
  389.  
  390.  
  391. if(IsMutationActive( EPMT_Mutation6 ))
  392. if(( (W3PlayerAbilityManager)abilityManager).GetMutationSoundBank(( EPMT_Mutation6 )) != "" )
  393. theSound.SoundLoadBank(((W3PlayerAbilityManager)abilityManager).GetMutationSoundBank(( EPMT_Mutation6 )), true );
  394.  
  395.  
  396.  
  397. if( FactsQuerySum("NGE_SkillPointsCheck") < 1 )
  398. {
  399.  
  400. ForceSetStat(BCS_Toxicity, 0);
  401. wolf = GetBuff(EET_WolfHour);
  402. if(wolf)
  403. exceptions.PushBack(wolf);
  404.  
  405. RemoveAllPotionEffects(exceptions);
  406.  
  407.  
  408. AddTimer('NGE_FixSkillPoints',1.0f,false);
  409. }
  410.  
  411.  
  412.  
  413. ManageSetBonusesSoundbanks(EIST_Lynx);
  414. ManageSetBonusesSoundbanks(EIST_Gryphon);
  415. ManageSetBonusesSoundbanks(EIST_Bear);
  416.  
  417.  
  418. m_quenHitFxTTL = 0;
  419. m_TriggerEffectDisablePending = false;
  420. m_TriggerEffectDisabled = false;
  421. ApplyGamepadTriggerEffect( equippedSign );
  422. AddTimer( 'UpdateGamepadTriggerEffect', 0.1, true );
  423. }
  424.  
  425.  
  426. private timer function NGE_FixSkillPoints( dt : float, id : int )
  427. {
  428. ((W3PlayerAbilityManager)abilityManager).NGEFixSkillPoints();
  429. FixNGESwords();
  430. FactsAdd("NGE_SkillPointsCheck");
  431. }
  432.  
  433.  
  434.  
  435. private function FixNGESwords()
  436. {
  437.  
  438. var swords, swordsTemp : array<SItemUniqueId>;
  439. var i : int;
  440. var equipped : bool;
  441. var runesList : array <name>;
  442.  
  443. swords = inv.GetItemsByName('sq304 Novigraadan sword 4');
  444. if(swords.Size() > 0)
  445. {
  446. for(i=0;i<swords.Size();i+=1)
  447. {
  448. if( IsItemEquipped(swords[i]) )
  449. equipped = true;
  450.  
  451. if ( inv.GetItemEnhancementCount(swords[i]) > 0 )
  452. {
  453. inv.GetItemEnhancementItems(swords[i], runesList);
  454. for (i = 0; i < runesList.Size(); i+=1)
  455. {
  456. inv.AddAnItem( runesList[i] );
  457. }
  458. }
  459.  
  460. inv.RemoveItem(swords[i],1);
  461. swordsTemp = inv.AddAnItem('sq304 Novigraadan sword 4',1,true,true);
  462. if(equipped)
  463. EquipItem(swordsTemp[0]);
  464. }
  465. }
  466.  
  467. swords = inv.GetItemsByName('q402 Skellige sword 3');
  468. if(swords.Size() > 0)
  469. {
  470. for(i=0;i<swords.Size();i+=1)
  471. {
  472. if( IsItemEquipped(swords[i]) )
  473. equipped = true;
  474.  
  475. if ( inv.GetItemEnhancementCount(swords[i]) > 0 )
  476. {
  477. inv.GetItemEnhancementItems(swords[i], runesList);
  478. for (i = 0; i < runesList.Size(); i+=1)
  479. {
  480. inv.AddAnItem( runesList[i] );
  481. }
  482. }
  483.  
  484. inv.RemoveItem(swords[i],1);
  485. swordsTemp = inv.AddAnItem('q402 Skellige sword 3',1,true,true);
  486. if(equipped)
  487. EquipItem( swordsTemp[0]);
  488. }
  489. }
  490. }
  491.  
  492.  
  493. event OnDestroyed()
  494. {
  495. RemoveTimer( 'UpdateGamepadTriggerEffect' );
  496.  
  497. theGame.ClearTriggerEffect(0);
  498. theGame.ClearTriggerEffect(1);
  499.  
  500. super.OnDestroyed();
  501. }
  502.  
  503.  
  504.  
  505.  
  506.  
  507. private function HACK_UnequipWolfLiver()
  508. {
  509. var itemName1, itemName2, itemName3, itemName4 : name;
  510. var item1, item2, item3, item4 : SItemUniqueId;
  511.  
  512. GetItemEquippedOnSlot( EES_Potion1, item1 );
  513. GetItemEquippedOnSlot( EES_Potion2, item2 );
  514. GetItemEquippedOnSlot( EES_Potion3, item3 );
  515. GetItemEquippedOnSlot( EES_Potion4, item4 );
  516.  
  517. if ( inv.IsIdValid( item1 ) )
  518. itemName1 = inv.GetItemName( item1 );
  519. if ( inv.IsIdValid( item2 ) )
  520. itemName2 = inv.GetItemName( item2 );
  521. if ( inv.IsIdValid( item3 ) )
  522. itemName3 = inv.GetItemName( item3 );
  523. if ( inv.IsIdValid( item4 ) )
  524. itemName4 = inv.GetItemName( item4 );
  525.  
  526. if ( itemName1 == 'Wolf liver' || itemName3 == 'Wolf liver' )
  527. {
  528. if ( inv.IsIdValid( item1 ) )
  529. UnequipItem( item1 );
  530. if ( inv.IsIdValid( item3 ) )
  531. UnequipItem( item3 );
  532. }
  533. else if ( itemName2 == 'Wolf liver' || itemName4 == 'Wolf liver' )
  534. {
  535. if ( inv.IsIdValid( item2 ) )
  536. UnequipItem( item2 );
  537. if ( inv.IsIdValid( item4 ) )
  538. UnequipItem( item4 );
  539. }
  540. }
  541.  
  542.  
  543.  
  544.  
  545.  
  546. timer function DelayedHorseUpdate( dt : float, id : int )
  547. {
  548. var man : W3HorseManager;
  549.  
  550. man = GetHorseManager();
  551. if(man)
  552. {
  553. if ( man.ApplyHorseUpdateOnSpawn() )
  554. {
  555.  
  556. UpdateEncumbrance();
  557.  
  558. RemoveTimer( 'DelayedHorseUpdate' );
  559. }
  560. }
  561. }
  562.  
  563. event OnAbilityAdded( abilityName : name)
  564. {
  565. super.OnAbilityAdded(abilityName);
  566.  
  567. if( HasAbility('Runeword 4 _Stats', true) )
  568. {
  569. StartVitalityRegen();
  570. }
  571.  
  572. if ( abilityName == 'Runeword 8 _Stats' && GetStat(BCS_Focus, true) >= GetStatMax(BCS_Focus) && !HasBuff(EET_Runeword8) )
  573. {
  574. AddEffectDefault(EET_Runeword8, this, "equipped item");
  575. }
  576.  
  577. }
  578.  
  579. private final function AddStartingSchematics()
  580. {
  581. AddCraftingSchematic('Starting Armor Upgrade schematic 1', true,true);
  582. AddCraftingSchematic('Thread schematic', true, true);
  583. AddCraftingSchematic('String schematic', true, true);
  584. AddCraftingSchematic('Linen schematic', true, true);
  585. AddCraftingSchematic('Silk schematic', true, true);
  586. AddCraftingSchematic('Resin schematic', true, true);
  587. AddCraftingSchematic('Blasting powder schematic', true, true);
  588. AddCraftingSchematic('Haft schematic', true, true);
  589. AddCraftingSchematic('Hardened timber schematic', true, true);
  590. AddCraftingSchematic('Leather squares schematic', true, true);
  591. AddCraftingSchematic('Leather schematic', true, true);
  592. AddCraftingSchematic('Hardened leather schematic', true, true);
  593. AddCraftingSchematic('Draconide leather schematic', true, true);
  594. AddCraftingSchematic('Iron ingot schematic', true, true);
  595. AddCraftingSchematic('Steel ingot schematic', true, true);
  596. AddCraftingSchematic('Steel ingot schematic 1', true, true);
  597. AddCraftingSchematic('Steel plate schematic', true, true);
  598. AddCraftingSchematic('Dark iron ingot schematic', true, true);
  599. AddCraftingSchematic('Dark iron plate schematic', true, true);
  600. AddCraftingSchematic('Dark steel ingot schematic', true, true);
  601. AddCraftingSchematic('Dark steel ingot schematic 1', true, true);
  602. AddCraftingSchematic('Dark steel plate schematic', true, true);
  603. AddCraftingSchematic('Silver ore schematic', true, true);
  604. AddCraftingSchematic('Silver ingot schematic', true, true);
  605. AddCraftingSchematic('Silver ingot schematic 1', true, true);
  606. AddCraftingSchematic('Silver plate schematic', true, true);
  607. AddCraftingSchematic('Meteorite ingot schematic', true, true);
  608. AddCraftingSchematic('Meteorite silver ingot schematic', true, true);
  609. AddCraftingSchematic('Meteorite silver plate schematic', true, true);
  610. AddCraftingSchematic('Glowing ingot schematic', true, true);
  611. AddCraftingSchematic('Dwimeryte ore schematic', true, true);
  612. AddCraftingSchematic('Dwimeryte ingot schematic', true, true);
  613. AddCraftingSchematic('Dwimeryte ingot schematic 1', true, true);
  614. AddCraftingSchematic('Dwimeryte plate schematic', true, true);
  615. AddCraftingSchematic('Infused dust schematic', true, true);
  616. AddCraftingSchematic('Infused shard schematic', true, true);
  617. AddCraftingSchematic('Infused crystal schematic', true, true);
  618.  
  619. if ( theGame.GetDLCManager().IsEP2Available() )
  620. {
  621. AddCraftingSchematic('Draconide infused leather schematic', true, true);
  622. AddCraftingSchematic('Nickel ore schematic', true, true);
  623. AddCraftingSchematic('Cupronickel ore schematic', true, true);
  624. AddCraftingSchematic('Copper ore schematic', true, true);
  625. AddCraftingSchematic('Copper ingot schematic', true, true);
  626. AddCraftingSchematic('Copper plate schematic', true, true);
  627. AddCraftingSchematic('Green gold ore schematic', true, true);
  628. AddCraftingSchematic('Green gold ore schematic 1', true, true);
  629. AddCraftingSchematic('Green gold ingot schematic', true, true);
  630. AddCraftingSchematic('Green gold plate schematic', true, true);
  631. AddCraftingSchematic('Orichalcum ore schematic', true, true);
  632. AddCraftingSchematic('Orichalcum ore schematic 1', true, true);
  633. AddCraftingSchematic('Orichalcum ingot schematic', true, true);
  634. AddCraftingSchematic('Orichalcum plate schematic', true, true);
  635. AddCraftingSchematic('Dwimeryte enriched ore schematic', true, true);
  636. AddCraftingSchematic('Dwimeryte enriched ingot schematic', true, true);
  637. AddCraftingSchematic('Dwimeryte enriched plate schematic', true, true);
  638. }
  639. }
  640.  
  641. private final function ApplyPatchFixes()
  642. {
  643. var cnt, transmutationCount, mutagenCount, i, slot : int;
  644. var transmutationAbility, itemName : name;
  645. var pam : W3PlayerAbilityManager;
  646. var slotId : int;
  647. var offset : float;
  648. var buffs : array<CBaseGameplayEffect>;
  649. var mutagen : W3Mutagen_Effect;
  650. var skill : SSimpleSkill;
  651. var spentSkillPoints, swordSkillPointsSpent, alchemySkillPointsSpent, perkSkillPointsSpent, pointsToAdd : int;
  652. var mutagens : array< W3Mutagen_Effect >;
  653.  
  654. if(FactsQuerySum("ClearingPotionPassiveBonusFix") < 1)
  655. {
  656. pam = (W3PlayerAbilityManager)abilityManager;
  657.  
  658. cnt = GetAbilityCount('sword_adrenalinegain') - pam.GetPathPointsSpent(ESP_Sword);
  659. if(cnt > 0)
  660. RemoveAbilityMultiple('sword_adrenalinegain', cnt);
  661.  
  662. cnt = GetAbilityCount('magic_staminaregen') - pam.GetPathPointsSpent(ESP_Signs);
  663. if(cnt > 0)
  664. RemoveAbilityMultiple('magic_staminaregen', cnt);
  665.  
  666. cnt = GetAbilityCount('alchemy_potionduration') - pam.GetPathPointsSpent(ESP_Alchemy);
  667. if(cnt > 0)
  668. RemoveAbilityMultiple('alchemy_potionduration', cnt);
  669.  
  670. FactsAdd("ClearingPotionPassiveBonusFix");
  671. }
  672.  
  673.  
  674. if(FactsQuerySum("DimeritiumSynergyFix") < 1)
  675. {
  676. slotId = GetSkillSlotID(S_Alchemy_s19);
  677. if(slotId != -1)
  678. UnequipSkill(S_Alchemy_s19);
  679.  
  680. RemoveAbilityAll('greater_mutagen_color_green_synergy_bonus');
  681. RemoveAbilityAll('mutagen_color_green_synergy_bonus');
  682. RemoveAbilityAll('mutagen_color_lesser_green_synergy_bonus');
  683.  
  684. RemoveAbilityAll('greater_mutagen_color_blue_synergy_bonus');
  685. RemoveAbilityAll('mutagen_color_blue_synergy_bonus');
  686. RemoveAbilityAll('mutagen_color_lesser_blue_synergy_bonus');
  687.  
  688. RemoveAbilityAll('greater_mutagen_color_red_synergy_bonus');
  689. RemoveAbilityAll('mutagen_color_red_synergy_bonus');
  690. RemoveAbilityAll('mutagen_color_lesser_red_synergy_bonus');
  691.  
  692. if(slotId != -1)
  693. EquipSkill(S_Alchemy_s19, slotId);
  694.  
  695. FactsAdd("DimeritiumSynergyFix");
  696. }
  697.  
  698.  
  699. if(FactsQuerySum("DontShowRecipePinTut") < 1)
  700. {
  701. FactsAdd( "DontShowRecipePinTut" );
  702. TutorialScript('alchemyRecipePin', '');
  703. TutorialScript('craftingRecipePin', '');
  704. }
  705.  
  706.  
  707. if(FactsQuerySum("LevelReqPotGiven") < 1)
  708. {
  709. FactsAdd("LevelReqPotGiven");
  710. inv.AddAnItem('Wolf Hour', 1, false, false, true);
  711. }
  712.  
  713.  
  714. if(!HasBuff(EET_AutoStaminaRegen))
  715. {
  716. AddEffectDefault(EET_AutoStaminaRegen, this, 'autobuff', false);
  717. }
  718.  
  719.  
  720.  
  721. buffs = GetBuffs();
  722. offset = 0;
  723. mutagenCount = 0;
  724. for(i=0; i<buffs.Size(); i+=1)
  725. {
  726. mutagen = (W3Mutagen_Effect)buffs[i];
  727. if(mutagen)
  728. {
  729. offset += mutagen.GetToxicityOffset();
  730. mutagenCount += 1;
  731. }
  732. }
  733.  
  734.  
  735. if(offset != (GetStat(BCS_Toxicity) - GetStat(BCS_Toxicity, true)))
  736. SetToxicityOffset(offset);
  737.  
  738.  
  739. mutagenCount *= GetSkillLevel(S_Alchemy_s13);
  740. transmutationAbility = GetSkillAbilityName(S_Alchemy_s13);
  741. transmutationCount = GetAbilityCount(transmutationAbility);
  742. if(mutagenCount < transmutationCount)
  743. {
  744. RemoveAbilityMultiple(transmutationAbility, transmutationCount - mutagenCount);
  745. }
  746. else if(mutagenCount > transmutationCount)
  747. {
  748. AddAbilityMultiple(transmutationAbility, mutagenCount - transmutationCount);
  749. }
  750.  
  751.  
  752. if(theGame.GetDLCManager().IsEP1Available())
  753. {
  754. theGame.GetJournalManager().ActivateEntryByScriptTag('TutorialJournalEnchanting', JS_Active);
  755. }
  756.  
  757.  
  758. if(HasAbility('sword_s19') && FactsQuerySum("Patch_Sword_s19") < 1)
  759. {
  760. pam = (W3PlayerAbilityManager)abilityManager;
  761.  
  762.  
  763. skill.level = 0;
  764. for(i = S_Magic_s01; i <= S_Magic_s20; i+=1)
  765. {
  766. skill.skillType = i;
  767. pam.RemoveTemporarySkill(skill);
  768. }
  769.  
  770.  
  771. spentSkillPoints = levelManager.GetPointsUsed(ESkillPoint);
  772. swordSkillPointsSpent = pam.GetPathPointsSpent(ESP_Sword);
  773. alchemySkillPointsSpent = pam.GetPathPointsSpent(ESP_Alchemy);
  774. perkSkillPointsSpent = pam.GetPathPointsSpent(ESP_Perks);
  775.  
  776. pointsToAdd = spentSkillPoints - swordSkillPointsSpent - alchemySkillPointsSpent - perkSkillPointsSpent;
  777. if(pointsToAdd > 0)
  778. levelManager.UnspendPoints(ESkillPoint, pointsToAdd);
  779.  
  780.  
  781. RemoveAbilityAll('sword_s19');
  782.  
  783.  
  784. FactsAdd("Patch_Sword_s19");
  785. }
  786.  
  787.  
  788. if( HasAbility( 'sword_s19' ) )
  789. {
  790. RemoveAbilityAll( 'sword_s19' );
  791. }
  792.  
  793.  
  794. if(FactsQuerySum("Patch_Armor_Type_Glyphwords") < 1)
  795. {
  796. pam = (W3PlayerAbilityManager)abilityManager;
  797.  
  798. pam.SetPerkArmorBonus( S_Perk_05, this );
  799. pam.SetPerkArmorBonus( S_Perk_06, this );
  800. pam.SetPerkArmorBonus( S_Perk_07, this );
  801.  
  802. FactsAdd("Patch_Armor_Type_Glyphwords");
  803. }
  804. else if( FactsQuerySum("154999") < 1 )
  805. {
  806.  
  807. pam = (W3PlayerAbilityManager)abilityManager;
  808.  
  809. pam.SetPerkArmorBonus( S_Perk_05, this );
  810. pam.SetPerkArmorBonus( S_Perk_06, this );
  811. pam.SetPerkArmorBonus( S_Perk_07, this );
  812.  
  813. FactsAdd("154999");
  814. }
  815.  
  816. if( FactsQuerySum( "Patch_Decoction_Buff_Icons" ) < 1 )
  817. {
  818. mutagens = GetMutagenBuffs();
  819. for( i=0; i<mutagens.Size(); i+=1 )
  820. {
  821. itemName = DecoctionEffectTypeToItemName( mutagens[i].GetEffectType() );
  822. mutagens[i].OverrideIcon( itemName );
  823. }
  824.  
  825. FactsAdd( "Patch_Decoction_Buff_Icons" );
  826. }
  827.  
  828.  
  829. if( FactsQuerySum( "154997" ) < 1 )
  830. {
  831. if( IsSkillEquipped( S_Alchemy_s18 ) )
  832. {
  833. slot = GetSkillSlotID( S_Alchemy_s18 );
  834. UnequipSkill( slot );
  835. EquipSkill( S_Alchemy_s18, slot );
  836. }
  837. FactsAdd( "154997" );
  838. }
  839. if( FactsQuerySum( "Patch_Mutagen_Ing_Stacking" ) < 1 )
  840. {
  841. Patch_MutagenStacking();
  842. FactsAdd( "Patch_Mutagen_Ing_Stacking" );
  843. }
  844. }
  845.  
  846. private final function Patch_MutagenStacking()
  847. {
  848. var i, j, quantity : int;
  849. var muts : array< SItemUniqueId >;
  850. var item : SItemUniqueId;
  851. var mutName : name;
  852. var wasInArray : bool;
  853. var mutsToAdd : array< SItemParts >;
  854. var mutToAdd : SItemParts;
  855.  
  856. muts = inv.GetItemsByTag( 'MutagenIngredient' );
  857. if( GetItemEquippedOnSlot( EES_SkillMutagen1, item ) )
  858. {
  859. muts.Remove( item );
  860. inv.SetItemStackable( item, false );
  861. }
  862. if( GetItemEquippedOnSlot( EES_SkillMutagen2, item ) )
  863. {
  864. muts.Remove( item );
  865. inv.SetItemStackable( item, false );
  866. }
  867. if( GetItemEquippedOnSlot( EES_SkillMutagen3, item ) )
  868. {
  869. muts.Remove( item );
  870. inv.SetItemStackable( item, false );
  871. }
  872. if( GetItemEquippedOnSlot( EES_SkillMutagen4, item ) )
  873. {
  874. muts.Remove( item );
  875. inv.SetItemStackable( item, false );
  876. }
  877. muts = SSS_Patch_MutagenStacking(muts); //zur13 modSSS mutTabs
  878. for( i=0; i<muts.Size(); i+=1 )
  879. {
  880. mutName = inv.GetItemName( muts[i] );
  881. quantity = inv.GetItemQuantity( muts[i] );
  882.  
  883. wasInArray = false;
  884. for( j=0; j<mutsToAdd.Size(); j+=1 )
  885. {
  886. if( mutsToAdd[j].itemName == mutName )
  887. {
  888. mutsToAdd[j].quantity += quantity;
  889. wasInArray = true;
  890. break;
  891. }
  892. }
  893.  
  894. if( !wasInArray )
  895. {
  896. mutToAdd.itemName = mutName;
  897. mutToAdd.quantity = quantity;
  898. mutsToAdd.PushBack( mutToAdd );
  899. }
  900.  
  901. inv.RemoveItem( muts[i], quantity );
  902. }
  903.  
  904. for( i=0; i<mutsToAdd.Size(); i+=1 )
  905. {
  906. inv.AddAnItem( mutsToAdd[i].itemName, mutsToAdd[i].quantity, true, true );
  907. }
  908. }
  909.  
  910. private function FixEquippedMutagens()
  911. {
  912. var item : SItemUniqueId;
  913. if( GetItemEquippedOnSlot( EES_SkillMutagen1, item ) )
  914. {
  915. inv.SetItemStackable( item, false );
  916. }
  917. if( GetItemEquippedOnSlot( EES_SkillMutagen2, item ) )
  918. {
  919. inv.SetItemStackable( item, false );
  920. }
  921. if( GetItemEquippedOnSlot( EES_SkillMutagen3, item ) )
  922. {
  923. inv.SetItemStackable( item, false );
  924. }
  925. if( GetItemEquippedOnSlot( EES_SkillMutagen4, item ) )
  926. {
  927. inv.SetItemStackable( item, false );
  928. } SSS_FixEquippedMutagens(); //zur13 modSSS mutTabs
  929. }
  930.  
  931. public final function RestoreQuen( quenHealth : float, quenDuration : float, optional alternate : bool ) : bool
  932. {
  933. var restoredQuen : W3QuenEntity;
  934.  
  935. if(quenHealth > 0.f && quenDuration >= 3.f)
  936. {
  937. restoredQuen = (W3QuenEntity)theGame.CreateEntity( signs[ST_Quen].template, GetWorldPosition(), GetWorldRotation() );
  938. restoredQuen.Init( signOwner, signs[ST_Quen].entity, true );
  939.  
  940. if( alternate )
  941. {
  942. restoredQuen.SetAlternateCast( S_Magic_s04 );
  943. }
  944.  
  945. restoredQuen.OnStarted();
  946. restoredQuen.OnThrowing();
  947.  
  948. if( !alternate )
  949. {
  950. restoredQuen.OnEnded();
  951. }
  952.  
  953. restoredQuen.SetDataFromRestore(quenHealth, quenDuration);
  954.  
  955. return true;
  956. }
  957.  
  958. return false;
  959. }
  960.  
  961. public function IsInitialized() : bool
  962. {
  963. return isInitialized;
  964. }
  965.  
  966. private function NewGamePlusInitialize()
  967. {
  968. var questItems : array<name>;
  969. var horseManager : W3HorseManager;
  970. var horseInventory : CInventoryComponent;
  971. var i, missingLevels, expDiff : int;
  972.  
  973. super.NewGamePlusInitialize();
  974.  
  975.  
  976. horseManager = (W3HorseManager)EntityHandleGet(horseManagerHandle);
  977. if(horseManager)
  978. horseInventory = horseManager.GetInventoryComponent();
  979.  
  980.  
  981. theGame.params.SetNewGamePlusLevel(GetLevel());
  982.  
  983.  
  984. if (theGame.GetDLCManager().IsDLCAvailable('ep1'))
  985. missingLevels = theGame.params.NEW_GAME_PLUS_EP1_MIN_LEVEL - GetLevel();
  986. else
  987. missingLevels = theGame.params.NEW_GAME_PLUS_MIN_LEVEL - GetLevel();
  988.  
  989. for(i=0; i<missingLevels; i+=1)
  990. {
  991.  
  992. expDiff = levelManager.GetTotalExpForNextLevel() - levelManager.GetPointsTotal(EExperiencePoint);
  993. expDiff = CeilF( ((float)expDiff) / 2 );
  994. AddPoints(EExperiencePoint, expDiff, false);
  995. }
  996.  
  997.  
  998.  
  999.  
  1000.  
  1001. inv.RemoveItemByTag('Quest', -1);
  1002. horseInventory.RemoveItemByTag('Quest', -1);
  1003.  
  1004.  
  1005.  
  1006. questItems = theGame.GetDefinitionsManager().GetItemsWithTag('Quest');
  1007. for(i=0; i<questItems.Size(); i+=1)
  1008. {
  1009. inv.RemoveItemByName(questItems[i], -1);
  1010. horseInventory.RemoveItemByName(questItems[i], -1);
  1011. }
  1012.  
  1013.  
  1014. inv.RemoveItemByName('mq1002_artifact_3', -1);
  1015. horseInventory.RemoveItemByName('mq1002_artifact_3', -1);
  1016.  
  1017.  
  1018. inv.RemoveItemByTag('NotTransferableToNGP', -1);
  1019. horseInventory.RemoveItemByTag('NotTransferableToNGP', -1);
  1020.  
  1021.  
  1022. inv.RemoveItemByTag('NoticeBoardNote', -1);
  1023. horseInventory.RemoveItemByTag('NoticeBoardNote', -1);
  1024.  
  1025.  
  1026. RemoveAllNonAutoBuffs();
  1027.  
  1028.  
  1029. RemoveAlchemyRecipe('Recipe for Trial Potion Kit');
  1030. RemoveAlchemyRecipe('Recipe for Pops Antidote');
  1031. RemoveAlchemyRecipe('Recipe for Czart Lure');
  1032. RemoveAlchemyRecipe('q603_diarrhea_potion_recipe');
  1033.  
  1034.  
  1035. inv.RemoveItemByTag('Trophy', -1);
  1036. horseInventory.RemoveItemByTag('Trophy', -1);
  1037.  
  1038.  
  1039. inv.RemoveItemByCategory('usable', -1);
  1040. horseInventory.RemoveItemByCategory('usable', -1);
  1041.  
  1042.  
  1043. RemoveAbility('StaminaTutorialProlog');
  1044. RemoveAbility('TutorialStaminaRegenHack');
  1045. RemoveAbility('area_novigrad');
  1046. RemoveAbility('NoRegenEffect');
  1047. RemoveAbility('HeavySwimmingStaminaDrain');
  1048. RemoveAbility('AirBoost');
  1049. RemoveAbility('area_nml');
  1050. RemoveAbility('area_skellige');
  1051.  
  1052.  
  1053. inv.RemoveItemByTag('GwintCard', -1);
  1054. horseInventory.RemoveItemByTag('GwintCard', -1);
  1055.  
  1056.  
  1057.  
  1058. inv.RemoveItemByTag('ReadableItem', -1);
  1059. horseInventory.RemoveItemByTag('ReadableItem', -1);
  1060.  
  1061.  
  1062. abilityManager.RestoreStats();
  1063.  
  1064.  
  1065. ((W3PlayerAbilityManager)abilityManager).RemoveToxicityOffset(10000);
  1066.  
  1067.  
  1068. GetInventory().SingletonItemsRefillAmmo();
  1069.  
  1070.  
  1071. craftingSchematics.Clear();
  1072. AddStartingSchematics();
  1073.  
  1074.  
  1075. for( i=0; i<amountOfSetPiecesEquipped.Size(); i+=1 )
  1076. {
  1077. amountOfSetPiecesEquipped[i] = 0;
  1078. }
  1079.  
  1080.  
  1081. inv.AddAnItem('Clearing Potion', 1, true, false, false);
  1082.  
  1083.  
  1084. inv.RemoveItemByName('q203_broken_eyeofloki', -1);
  1085. horseInventory.RemoveItemByName('q203_broken_eyeofloki', -1);
  1086.  
  1087.  
  1088. NewGamePlusReplaceViperSet(inv);
  1089. NewGamePlusReplaceViperSet(horseInventory);
  1090. NewGamePlusReplaceLynxSet(inv);
  1091. NewGamePlusReplaceLynxSet(horseInventory);
  1092. NewGamePlusReplaceGryphonSet(inv);
  1093. NewGamePlusReplaceGryphonSet(horseInventory);
  1094. NewGamePlusReplaceBearSet(inv);
  1095. NewGamePlusReplaceBearSet(horseInventory);
  1096. NewGamePlusReplaceEP1(inv);
  1097. NewGamePlusReplaceEP1(horseInventory);
  1098. NewGamePlusReplaceEP2WitcherSets(inv);
  1099. NewGamePlusReplaceEP2WitcherSets(horseInventory);
  1100. NewGamePlusReplaceEP2Items(inv);
  1101. NewGamePlusReplaceEP2Items(horseInventory);
  1102. NewGamePlusMarkItemsToNotAdjust(inv);
  1103. NewGamePlusMarkItemsToNotAdjust(horseInventory);
  1104.  
  1105. NewGamePlusReplaceNetflixSet(inv);
  1106. NewGamePlusReplaceNetflixSet(horseInventory);
  1107.  
  1108. NewGamePlusReplaceDolBlathannaSet(inv);
  1109. NewGamePlusReplaceDolBlathannaSet(horseInventory);
  1110.  
  1111. NewGamePlusReplaceWhiteTigerSet(inv);
  1112. NewGamePlusReplaceWhiteTigerSet(horseInventory);
  1113.  
  1114.  
  1115. inputHandler.ClearLocksForNGP();
  1116.  
  1117.  
  1118. buffImmunities.Clear();
  1119. buffRemovedImmunities.Clear();
  1120.  
  1121. newGamePlusInitialized = true;
  1122.  
  1123.  
  1124. m_quenReappliedCount = 1;
  1125.  
  1126.  
  1127.  
  1128.  
  1129. tiedWalk = false;
  1130. proudWalk = false;
  1131. injuredWalk = false;
  1132. SetBehaviorVariable( 'alternateWalk', 0.0f );
  1133. SetBehaviorVariable( 'proudWalk', 0.0f );
  1134. if( GetHorseManager().GetHorseMode() == EHM_Unicorn )
  1135. GetHorseManager().SetHorseMode( EHM_Normal );
  1136.  
  1137. }
  1138.  
  1139. private final function NewGamePlusMarkItemsToNotAdjust(out inv : CInventoryComponent)
  1140. {
  1141. var ids : array<SItemUniqueId>;
  1142. var i : int;
  1143. var n : name;
  1144.  
  1145. inv.GetAllItems(ids);
  1146. for( i=0; i<ids.Size(); i+=1 )
  1147. {
  1148. inv.SetItemModifierInt(ids[i], 'NGPItemAdjusted', 1);
  1149. }
  1150. }
  1151.  
  1152. private final function NewGamePlusReplaceItem( item : name, new_item : name, out inv : CInventoryComponent)
  1153. {
  1154. var i, j : int;
  1155. var ids, new_ids, enh_ids : array<SItemUniqueId>;
  1156. var dye_ids : array<SItemUniqueId>;
  1157. var enh : array<name>;
  1158. var wasEquipped : bool;
  1159. var wasEnchanted : bool;
  1160. var wasDyed : bool;
  1161. var enchantName, colorName : name;
  1162.  
  1163. if ( inv.HasItem( item ) )
  1164. {
  1165. ids = inv.GetItemsIds(item);
  1166. for (i = 0; i < ids.Size(); i += 1)
  1167. {
  1168. inv.GetItemEnhancementItems( ids[i], enh );
  1169. wasEnchanted = inv.IsItemEnchanted( ids[i] );
  1170. if ( wasEnchanted )
  1171. enchantName = inv.GetEnchantment( ids[i] );
  1172. wasEquipped = IsItemEquipped( ids[i] );
  1173. wasDyed = inv.IsItemColored( ids[i] );
  1174. if ( wasDyed )
  1175. {
  1176. colorName = inv.GetItemColor( ids[i] );
  1177. }
  1178.  
  1179. inv.RemoveItem( ids[i], 1 );
  1180. new_ids = inv.AddAnItem( new_item, 1, true, true, false );
  1181. if ( wasEquipped )
  1182. {
  1183. EquipItem( new_ids[0] );
  1184. }
  1185. if ( wasEnchanted )
  1186. {
  1187. inv.EnchantItem( new_ids[0], enchantName, getEnchamtmentStatName(enchantName) );
  1188. }
  1189. for (j = 0; j < enh.Size(); j += 1)
  1190. {
  1191. enh_ids = inv.AddAnItem( enh[j], 1, true, true, false );
  1192. inv.EnhanceItemScript( new_ids[0], enh_ids[0] );
  1193. }
  1194. if ( wasDyed )
  1195. {
  1196. dye_ids = inv.AddAnItem( colorName, 1, true, true, false );
  1197. inv.ColorItem( new_ids[0], dye_ids[0] );
  1198. inv.RemoveItem( dye_ids[0], 1 );
  1199. }
  1200.  
  1201. inv.SetItemModifierInt( new_ids[0], 'NGPItemAdjusted', 1 );
  1202. }
  1203. }
  1204. }
  1205.  
  1206. private final function NewGamePlusAdjustDLCItem(item : name, mod : name, inv : CInventoryComponent)
  1207. {
  1208. var ids : array<SItemUniqueId>;
  1209. var i : int;
  1210.  
  1211. if( inv.HasItem(item) )
  1212. {
  1213. ids = inv.GetItemsIds(item);
  1214. for (i = 0; i < ids.Size(); i += 1)
  1215. {
  1216. if ( inv.GetItemModifierInt(ids[i], 'DoNotAdjustNGPDLC') <= 0 )
  1217. {
  1218. inv.AddItemBaseAbility(ids[i], mod);
  1219. inv.SetItemModifierInt(ids[i], 'DoNotAdjustNGPDLC', 1);
  1220. }
  1221. }
  1222. }
  1223.  
  1224. }
  1225.  
  1226. private final function NewGamePlusAdjustDLC1TemerianSet(inv : CInventoryComponent)
  1227. {
  1228. NewGamePlusAdjustDLCItem('NGP DLC1 Temerian Armor', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1229. NewGamePlusAdjustDLCItem('NGP DLC1 Temerian Gloves', 'NGP DLC Compatibility Armor Mod', inv);
  1230. NewGamePlusAdjustDLCItem('NGP DLC1 Temerian Pants', 'NGP DLC Compatibility Armor Mod', inv);
  1231. NewGamePlusAdjustDLCItem('NGP DLC1 Temerian Boots', 'NGP DLC Compatibility Armor Mod', inv);
  1232. }
  1233.  
  1234. private final function NewGamePlusAdjustDLC5NilfgardianSet(inv : CInventoryComponent)
  1235. {
  1236. NewGamePlusAdjustDLCItem('NGP DLC5 Nilfgaardian Armor', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1237. NewGamePlusAdjustDLCItem('NGP DLC5 Nilfgaardian Gloves', 'NGP DLC Compatibility Armor Mod', inv);
  1238. NewGamePlusAdjustDLCItem('NGP DLC5 Nilfgaardian Pants', 'NGP DLC Compatibility Armor Mod', inv);
  1239. NewGamePlusAdjustDLCItem('NGP DLC5 Nilfgaardian Boots', 'NGP DLC Compatibility Armor Mod', inv);
  1240. }
  1241.  
  1242. private final function NewGamePlusAdjustDLC10WolfSet(inv : CInventoryComponent)
  1243. {
  1244. NewGamePlusAdjustDLCItem('NGP Wolf Armor', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1245. NewGamePlusAdjustDLCItem('NGP Wolf Armor 1', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1246. NewGamePlusAdjustDLCItem('NGP Wolf Armor 2', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1247. NewGamePlusAdjustDLCItem('NGP Wolf Armor 3', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1248.  
  1249. NewGamePlusAdjustDLCItem('NGP Wolf Boots 1', 'NGP DLC Compatibility Armor Mod', inv);
  1250. NewGamePlusAdjustDLCItem('NGP Wolf Boots 2', 'NGP DLC Compatibility Armor Mod', inv);
  1251. NewGamePlusAdjustDLCItem('NGP Wolf Boots 3', 'NGP DLC Compatibility Armor Mod', inv);
  1252. NewGamePlusAdjustDLCItem('NGP Wolf Boots 4', 'NGP DLC Compatibility Armor Mod', inv);
  1253.  
  1254. NewGamePlusAdjustDLCItem('NGP Wolf Gloves 1', 'NGP DLC Compatibility Armor Mod', inv);
  1255. NewGamePlusAdjustDLCItem('NGP Wolf Gloves 2', 'NGP DLC Compatibility Armor Mod', inv);
  1256. NewGamePlusAdjustDLCItem('NGP Wolf Gloves 3', 'NGP DLC Compatibility Armor Mod', inv);
  1257. NewGamePlusAdjustDLCItem('NGP Wolf Gloves 4', 'NGP DLC Compatibility Armor Mod', inv);
  1258.  
  1259. NewGamePlusAdjustDLCItem('NGP Wolf Pants 1', 'NGP DLC Compatibility Armor Mod', inv);
  1260. NewGamePlusAdjustDLCItem('NGP Wolf Pants 2', 'NGP DLC Compatibility Armor Mod', inv);
  1261. NewGamePlusAdjustDLCItem('NGP Wolf Pants 3', 'NGP DLC Compatibility Armor Mod', inv);
  1262. NewGamePlusAdjustDLCItem('NGP Wolf Pants 4', 'NGP DLC Compatibility Armor Mod', inv);
  1263.  
  1264. NewGamePlusAdjustDLCItem('NGP Wolf School steel sword', 'NGP Wolf Steel Sword Mod', inv);
  1265. NewGamePlusAdjustDLCItem('NGP Wolf School steel sword 1', 'NGP Wolf Steel Sword Mod', inv);
  1266. NewGamePlusAdjustDLCItem('NGP Wolf School steel sword 2', 'NGP Wolf Steel Sword Mod', inv);
  1267. NewGamePlusAdjustDLCItem('NGP Wolf School steel sword 3', 'NGP Wolf Steel Sword Mod', inv);
  1268.  
  1269. NewGamePlusAdjustDLCItem('NGP Wolf School silver sword', 'NGP Wolf Silver Sword Mod', inv);
  1270. NewGamePlusAdjustDLCItem('NGP Wolf School silver sword 1', 'NGP Wolf Silver Sword Mod', inv);
  1271. NewGamePlusAdjustDLCItem('NGP Wolf School silver sword 2', 'NGP Wolf Silver Sword Mod', inv);
  1272. NewGamePlusAdjustDLCItem('NGP Wolf School silver sword 3', 'NGP Wolf Silver Sword Mod', inv);
  1273. }
  1274.  
  1275. private final function NewGamePlusAdjustDLC14SkelligeSet(inv : CInventoryComponent)
  1276. {
  1277. NewGamePlusAdjustDLCItem('NGP DLC14 Skellige Armor', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1278. NewGamePlusAdjustDLCItem('NGP DLC14 Skellige Gloves', 'NGP DLC Compatibility Armor Mod', inv);
  1279. NewGamePlusAdjustDLCItem('NGP DLC14 Skellige Pants', 'NGP DLC Compatibility Armor Mod', inv);
  1280. NewGamePlusAdjustDLCItem('NGP DLC14 Skellige Boots', 'NGP DLC Compatibility Armor Mod', inv);
  1281. }
  1282.  
  1283.  
  1284. private final function NewGamePlusAdjustDLC18NetflixSet(inv : CInventoryComponent)
  1285. {
  1286. NewGamePlusAdjustDLCItem('NGP Netflix Armor', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1287. NewGamePlusAdjustDLCItem('NGP Netflix Armor 1', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1288. NewGamePlusAdjustDLCItem('NGP Netflix Armor 2', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1289.  
  1290. NewGamePlusAdjustDLCItem('NGP Netflix Boots 1', 'NGP DLC Compatibility Armor Mod', inv);
  1291. NewGamePlusAdjustDLCItem('NGP Netflix Boots 2', 'NGP DLC Compatibility Armor Mod', inv);
  1292. NewGamePlusAdjustDLCItem('NGP Netflix Boots', 'NGP DLC Compatibility Armor Mod', inv);
  1293.  
  1294. NewGamePlusAdjustDLCItem('NGP Netflix Gloves 1', 'NGP DLC Compatibility Armor Mod', inv);
  1295. NewGamePlusAdjustDLCItem('NGP Netflix Gloves 2', 'NGP DLC Compatibility Armor Mod', inv);
  1296. NewGamePlusAdjustDLCItem('NGP Netflix Gloves', 'NGP DLC Compatibility Armor Mod', inv);
  1297.  
  1298. NewGamePlusAdjustDLCItem('NGP Netflix Pants 1', 'NGP DLC Compatibility Armor Mod', inv);
  1299. NewGamePlusAdjustDLCItem('NGP Netflix Pants 2', 'NGP DLC Compatibility Armor Mod', inv);
  1300. NewGamePlusAdjustDLCItem('NGP Netflix Pants', 'NGP DLC Compatibility Armor Mod', inv);
  1301.  
  1302. NewGamePlusAdjustDLCItem('NGP Netflix steel sword', 'NGP Wolf Steel Sword Mod', inv);
  1303. NewGamePlusAdjustDLCItem('NGP Netflix steel sword 1', 'NGP Wolf Steel Sword Mod', inv);
  1304. NewGamePlusAdjustDLCItem('NGP Netflix steel sword 2', 'NGP Wolf Steel Sword Mod', inv);
  1305.  
  1306. NewGamePlusAdjustDLCItem('NGP Netflix silver sword', 'NGP Wolf Silver Sword Mod', inv);
  1307. NewGamePlusAdjustDLCItem('NGP Netflix silver sword 1', 'NGP Wolf Silver Sword Mod', inv);
  1308. NewGamePlusAdjustDLCItem('NGP Netflix silver sword 2', 'NGP Wolf Silver Sword Mod', inv);
  1309. }
  1310.  
  1311.  
  1312.  
  1313. private final function NewGamePlusAdjustDolBlathannaSet(inv : CInventoryComponent)
  1314. {
  1315. NewGamePlusAdjustDLCItem('NGP Dol Blathanna Armor', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1316. NewGamePlusAdjustDLCItem('NGP Dol Blathanna Boots', 'NGP DLC Compatibility Armor Mod', inv);
  1317. NewGamePlusAdjustDLCItem('NGP Dol Blathanna Gloves', 'NGP DLC Compatibility Armor Mod', inv);
  1318. NewGamePlusAdjustDLCItem('NGP Dol Blathanna Pants', 'NGP DLC Compatibility Armor Mod', inv);
  1319. NewGamePlusAdjustDLCItem('NGP Dol Blathanna longsword', 'NGP Wolf Steel Sword Mod', inv);
  1320. NewGamePlusAdjustDLCItem('NGP White Widow of Dol Blathanna', 'NGP Wolf Silver Sword Mod', inv);
  1321. }
  1322.  
  1323.  
  1324.  
  1325. private final function NewGamePlusAdjustWhiteTigerSet(inv : CInventoryComponent)
  1326. {
  1327. NewGamePlusAdjustDLCItem('NGP White Tiger Armor', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1328. NewGamePlusAdjustDLCItem('NGP White Tiger Boots', 'NGP DLC Compatibility Armor Mod', inv);
  1329. NewGamePlusAdjustDLCItem('NGP White Tiger Gloves', 'NGP DLC Compatibility Armor Mod', inv);
  1330. NewGamePlusAdjustDLCItem('NGP White Tiger Pants', 'NGP DLC Compatibility Armor Mod', inv);
  1331. NewGamePlusAdjustDLCItem('NGP Steel Vixen', 'NGP Wolf Steel Sword Mod', inv);
  1332. NewGamePlusAdjustDLCItem('NGP Silver Vixen', 'NGP Wolf Silver Sword Mod', inv);
  1333. }
  1334.  
  1335.  
  1336. private final function NewGamePlusReplaceViperSet(out inv : CInventoryComponent)
  1337. {
  1338. NewGamePlusReplaceItem('Viper School steel sword', 'NGP Viper School steel sword', inv);
  1339.  
  1340. NewGamePlusReplaceItem('Viper School silver sword', 'NGP Viper School silver sword', inv);
  1341. }
  1342.  
  1343. private final function NewGamePlusReplaceLynxSet(out inv : CInventoryComponent)
  1344. {
  1345. NewGamePlusReplaceItem('Lynx Armor', 'NGP Lynx Armor', inv);
  1346. NewGamePlusReplaceItem('Lynx Armor 1', 'NGP Lynx Armor 1', inv);
  1347. NewGamePlusReplaceItem('Lynx Armor 2', 'NGP Lynx Armor 2', inv);
  1348. NewGamePlusReplaceItem('Lynx Armor 3', 'NGP Lynx Armor 3', inv);
  1349.  
  1350. NewGamePlusReplaceItem('Lynx Gloves 1', 'NGP Lynx Gloves 1', inv);
  1351. NewGamePlusReplaceItem('Lynx Gloves 2', 'NGP Lynx Gloves 2', inv);
  1352. NewGamePlusReplaceItem('Lynx Gloves 3', 'NGP Lynx Gloves 3', inv);
  1353. NewGamePlusReplaceItem('Lynx Gloves 4', 'NGP Lynx Gloves 4', inv);
  1354.  
  1355. NewGamePlusReplaceItem('Lynx Pants 1', 'NGP Lynx Pants 1', inv);
  1356. NewGamePlusReplaceItem('Lynx Pants 2', 'NGP Lynx Pants 2', inv);
  1357. NewGamePlusReplaceItem('Lynx Pants 3', 'NGP Lynx Pants 3', inv);
  1358. NewGamePlusReplaceItem('Lynx Pants 4', 'NGP Lynx Pants 4', inv);
  1359.  
  1360. NewGamePlusReplaceItem('Lynx Boots 1', 'NGP Lynx Boots 1', inv);
  1361. NewGamePlusReplaceItem('Lynx Boots 2', 'NGP Lynx Boots 2', inv);
  1362. NewGamePlusReplaceItem('Lynx Boots 3', 'NGP Lynx Boots 3', inv);
  1363. NewGamePlusReplaceItem('Lynx Boots 4', 'NGP Lynx Boots 4', inv);
  1364.  
  1365. NewGamePlusReplaceItem('Lynx School steel sword', 'NGP Lynx School steel sword', inv);
  1366. NewGamePlusReplaceItem('Lynx School steel sword 1', 'NGP Lynx School steel sword 1', inv);
  1367. NewGamePlusReplaceItem('Lynx School steel sword 2', 'NGP Lynx School steel sword 2', inv);
  1368. NewGamePlusReplaceItem('Lynx School steel sword 3', 'NGP Lynx School steel sword 3', inv);
  1369.  
  1370. NewGamePlusReplaceItem('Lynx School silver sword', 'NGP Lynx School silver sword', inv);
  1371. NewGamePlusReplaceItem('Lynx School silver sword 1', 'NGP Lynx School silver sword 1', inv);
  1372. NewGamePlusReplaceItem('Lynx School silver sword 2', 'NGP Lynx School silver sword 2', inv);
  1373. NewGamePlusReplaceItem('Lynx School silver sword 3', 'NGP Lynx School silver sword 3', inv);
  1374. }
  1375.  
  1376. private final function NewGamePlusReplaceGryphonSet(out inv : CInventoryComponent)
  1377. {
  1378. NewGamePlusReplaceItem('Gryphon Armor', 'NGP Gryphon Armor', inv);
  1379. NewGamePlusReplaceItem('Gryphon Armor 1', 'NGP Gryphon Armor 1', inv);
  1380. NewGamePlusReplaceItem('Gryphon Armor 2', 'NGP Gryphon Armor 2', inv);
  1381. NewGamePlusReplaceItem('Gryphon Armor 3', 'NGP Gryphon Armor 3', inv);
  1382.  
  1383. NewGamePlusReplaceItem('Gryphon Gloves 1', 'NGP Gryphon Gloves 1', inv);
  1384. NewGamePlusReplaceItem('Gryphon Gloves 2', 'NGP Gryphon Gloves 2', inv);
  1385. NewGamePlusReplaceItem('Gryphon Gloves 3', 'NGP Gryphon Gloves 3', inv);
  1386. NewGamePlusReplaceItem('Gryphon Gloves 4', 'NGP Gryphon Gloves 4', inv);
  1387.  
  1388. NewGamePlusReplaceItem('Gryphon Pants 1', 'NGP Gryphon Pants 1', inv);
  1389. NewGamePlusReplaceItem('Gryphon Pants 2', 'NGP Gryphon Pants 2', inv);
  1390. NewGamePlusReplaceItem('Gryphon Pants 3', 'NGP Gryphon Pants 3', inv);
  1391. NewGamePlusReplaceItem('Gryphon Pants 4', 'NGP Gryphon Pants 4', inv);
  1392.  
  1393. NewGamePlusReplaceItem('Gryphon Boots 1', 'NGP Gryphon Boots 1', inv);
  1394. NewGamePlusReplaceItem('Gryphon Boots 2', 'NGP Gryphon Boots 2', inv);
  1395. NewGamePlusReplaceItem('Gryphon Boots 3', 'NGP Gryphon Boots 3', inv);
  1396. NewGamePlusReplaceItem('Gryphon Boots 4', 'NGP Gryphon Boots 4', inv);
  1397.  
  1398. NewGamePlusReplaceItem('Gryphon School steel sword', 'NGP Gryphon School steel sword', inv);
  1399. NewGamePlusReplaceItem('Gryphon School steel sword 1', 'NGP Gryphon School steel sword 1', inv);
  1400. NewGamePlusReplaceItem('Gryphon School steel sword 2', 'NGP Gryphon School steel sword 2', inv);
  1401. NewGamePlusReplaceItem('Gryphon School steel sword 3', 'NGP Gryphon School steel sword 3', inv);
  1402.  
  1403. NewGamePlusReplaceItem('Gryphon School silver sword', 'NGP Gryphon School silver sword', inv);
  1404. NewGamePlusReplaceItem('Gryphon School silver sword 1', 'NGP Gryphon School silver sword 1', inv);
  1405. NewGamePlusReplaceItem('Gryphon School silver sword 2', 'NGP Gryphon School silver sword 2', inv);
  1406. NewGamePlusReplaceItem('Gryphon School silver sword 3', 'NGP Gryphon School silver sword 3', inv);
  1407. }
  1408.  
  1409. private final function NewGamePlusReplaceBearSet(out inv : CInventoryComponent)
  1410. {
  1411. NewGamePlusReplaceItem('Bear Armor', 'NGP Bear Armor', inv);
  1412. NewGamePlusReplaceItem('Bear Armor 1', 'NGP Bear Armor 1', inv);
  1413. NewGamePlusReplaceItem('Bear Armor 2', 'NGP Bear Armor 2', inv);
  1414. NewGamePlusReplaceItem('Bear Armor 3', 'NGP Bear Armor 3', inv);
  1415.  
  1416. NewGamePlusReplaceItem('Bear Gloves 1', 'NGP Bear Gloves 1', inv);
  1417. NewGamePlusReplaceItem('Bear Gloves 2', 'NGP Bear Gloves 2', inv);
  1418. NewGamePlusReplaceItem('Bear Gloves 3', 'NGP Bear Gloves 3', inv);
  1419. NewGamePlusReplaceItem('Bear Gloves 4', 'NGP Bear Gloves 4', inv);
  1420.  
  1421. NewGamePlusReplaceItem('Bear Pants 1', 'NGP Bear Pants 1', inv);
  1422. NewGamePlusReplaceItem('Bear Pants 2', 'NGP Bear Pants 2', inv);
  1423. NewGamePlusReplaceItem('Bear Pants 3', 'NGP Bear Pants 3', inv);
  1424. NewGamePlusReplaceItem('Bear Pants 4', 'NGP Bear Pants 4', inv);
  1425.  
  1426. NewGamePlusReplaceItem('Bear Boots 1', 'NGP Bear Boots 1', inv);
  1427. NewGamePlusReplaceItem('Bear Boots 2', 'NGP Bear Boots 2', inv);
  1428. NewGamePlusReplaceItem('Bear Boots 3', 'NGP Bear Boots 3', inv);
  1429. NewGamePlusReplaceItem('Bear Boots 4', 'NGP Bear Boots 4', inv);
  1430.  
  1431. NewGamePlusReplaceItem('Bear School steel sword', 'NGP Bear School steel sword', inv);
  1432. NewGamePlusReplaceItem('Bear School steel sword 1', 'NGP Bear School steel sword 1', inv);
  1433. NewGamePlusReplaceItem('Bear School steel sword 2', 'NGP Bear School steel sword 2', inv);
  1434. NewGamePlusReplaceItem('Bear School steel sword 3', 'NGP Bear School steel sword 3', inv);
  1435.  
  1436. NewGamePlusReplaceItem('Bear School silver sword', 'NGP Bear School silver sword', inv);
  1437. NewGamePlusReplaceItem('Bear School silver sword 1', 'NGP Bear School silver sword 1', inv);
  1438. NewGamePlusReplaceItem('Bear School silver sword 2', 'NGP Bear School silver sword 2', inv);
  1439. NewGamePlusReplaceItem('Bear School silver sword 3', 'NGP Bear School silver sword 3', inv);
  1440. }
  1441.  
  1442. private final function NewGamePlusReplaceEP1(out inv : CInventoryComponent)
  1443. {
  1444. NewGamePlusReplaceItem('Ofir Armor', 'NGP Ofir Armor', inv);
  1445. NewGamePlusReplaceItem('Ofir Sabre 2', 'NGP Ofir Sabre 2', inv);
  1446.  
  1447. NewGamePlusReplaceItem('Crafted Burning Rose Armor', 'NGP Crafted Burning Rose Armor', inv);
  1448. NewGamePlusReplaceItem('Crafted Burning Rose Gloves', 'NGP Crafted Burning Rose Gloves', inv);
  1449. NewGamePlusReplaceItem('Crafted Burning Rose Sword', 'NGP Crafted Burning Rose Sword', inv);
  1450.  
  1451. NewGamePlusReplaceItem('Crafted Ofir Armor', 'NGP Crafted Ofir Armor', inv);
  1452. NewGamePlusReplaceItem('Crafted Ofir Boots', 'NGP Crafted Ofir Boots', inv);
  1453. NewGamePlusReplaceItem('Crafted Ofir Gloves', 'NGP Crafted Ofir Gloves', inv);
  1454. NewGamePlusReplaceItem('Crafted Ofir Pants', 'NGP Crafted Ofir Pants', inv);
  1455. NewGamePlusReplaceItem('Crafted Ofir Steel Sword', 'NGP Crafted Ofir Steel Sword', inv);
  1456.  
  1457. NewGamePlusReplaceItem('EP1 Crafted Witcher Silver Sword', 'NGP EP1 Crafted Witcher Silver Sword', inv);
  1458. NewGamePlusReplaceItem('Olgierd Sabre', 'NGP Olgierd Sabre', inv);
  1459.  
  1460. NewGamePlusReplaceItem('EP1 Witcher Armor', 'NGP EP1 Witcher Armor', inv);
  1461. NewGamePlusReplaceItem('EP1 Witcher Boots', 'NGP EP1 Witcher Boots', inv);
  1462. NewGamePlusReplaceItem('EP1 Witcher Gloves', 'NGP EP1 Witcher Gloves', inv);
  1463. NewGamePlusReplaceItem('EP1 Witcher Pants', 'NGP EP1 Witcher Pants', inv);
  1464. NewGamePlusReplaceItem('EP1 Viper School steel sword', 'NGP EP1 Viper School steel sword', inv);
  1465. NewGamePlusReplaceItem('EP1 Viper School silver sword', 'NGP EP1 Viper School silver sword', inv);
  1466. }
  1467.  
  1468. private final function NewGamePlusReplaceEP2WitcherSets(out inv : CInventoryComponent)
  1469. {
  1470. NewGamePlusReplaceItem('Lynx Armor 4', 'NGP Lynx Armor 4', inv);
  1471. NewGamePlusReplaceItem('Gryphon Armor 4', 'NGP Gryphon Armor 4', inv);
  1472. NewGamePlusReplaceItem('Bear Armor 4', 'NGP Bear Armor 4', inv);
  1473. NewGamePlusReplaceItem('Wolf Armor 4', 'NGP Wolf Armor 4', inv);
  1474. NewGamePlusReplaceItem('Red Wolf Armor 1', 'NGP Red Wolf Armor 1', inv);
  1475.  
  1476. NewGamePlusReplaceItem('Lynx Gloves 5', 'NGP Lynx Gloves 5', inv);
  1477. NewGamePlusReplaceItem('Gryphon Gloves 5', 'NGP Gryphon Gloves 5', inv);
  1478. NewGamePlusReplaceItem('Bear Gloves 5', 'NGP Bear Gloves 5', inv);
  1479. NewGamePlusReplaceItem('Wolf Gloves 5', 'NGP Wolf Gloves 5', inv);
  1480. NewGamePlusReplaceItem('Red Wolf Gloves 1', 'NGP Red Wolf Gloves 1', inv);
  1481.  
  1482. NewGamePlusReplaceItem('Lynx Pants 5', 'NGP Lynx Pants 5', inv);
  1483. NewGamePlusReplaceItem('Gryphon Pants 5', 'NGP Gryphon Pants 5', inv);
  1484. NewGamePlusReplaceItem('Bear Pants 5', 'NGP Bear Pants 5', inv);
  1485. NewGamePlusReplaceItem('Wolf Pants 5', 'NGP Wolf Pants 5', inv);
  1486. NewGamePlusReplaceItem('Red Wolf Pants 1', 'NGP Red Wolf Pants 1', inv);
  1487.  
  1488. NewGamePlusReplaceItem('Lynx Boots 5', 'NGP Lynx Boots 5', inv);
  1489. NewGamePlusReplaceItem('Gryphon Boots 5', 'NGP Gryphon Boots 5', inv);
  1490. NewGamePlusReplaceItem('Bear Boots 5', 'NGP Bear Boots 5', inv);
  1491. NewGamePlusReplaceItem('Wolf Boots 5', 'NGP Wolf Boots 5', inv);
  1492. NewGamePlusReplaceItem('Red Wolf Boots 1', 'NGP Red Wolf Boots 1', inv);
  1493.  
  1494.  
  1495. NewGamePlusReplaceItem('Lynx School steel sword 4', 'NGP Lynx School steel sword 4', inv);
  1496. NewGamePlusReplaceItem('Gryphon School steel sword 4', 'NGP Gryphon School steel sword 4', inv);
  1497. NewGamePlusReplaceItem('Bear School steel sword 4', 'NGP Bear School steel sword 4', inv);
  1498. NewGamePlusReplaceItem('Wolf School steel sword 4', 'NGP Wolf School steel sword 4', inv);
  1499. NewGamePlusReplaceItem('Red Wolf School steel sword 1', 'NGP Red Wolf School steel sword 1', inv);
  1500.  
  1501. NewGamePlusReplaceItem('Lynx School silver sword 4', 'NGP Lynx School silver sword 4', inv);
  1502. NewGamePlusReplaceItem('Gryphon School silver sword 4', 'NGP Gryphon School silver sword 4', inv);
  1503. NewGamePlusReplaceItem('Bear School silver sword 4', 'NGP Bear School silver sword 4', inv);
  1504. NewGamePlusReplaceItem('Wolf School silver sword 4', 'NGP Wolf School silver sword 4', inv);
  1505. NewGamePlusReplaceItem('Red Wolf School silver sword 1', 'NGP Red Wolf School silver sword 1', inv);
  1506. }
  1507.  
  1508. private final function NewGamePlusReplaceEP2Items(out inv : CInventoryComponent)
  1509. {
  1510. NewGamePlusReplaceItem('Guard Lvl1 Armor 3', 'NGP Guard Lvl1 Armor 3', inv);
  1511. NewGamePlusReplaceItem('Guard Lvl1 A Armor 3', 'NGP Guard Lvl1 A Armor 3', inv);
  1512. NewGamePlusReplaceItem('Guard Lvl2 Armor 3', 'NGP Guard Lvl2 Armor 3', inv);
  1513. NewGamePlusReplaceItem('Guard Lvl2 A Armor 3', 'NGP Guard Lvl2 A Armor 3', inv);
  1514. NewGamePlusReplaceItem('Knight Geralt Armor 3', 'NGP Knight Geralt Armor 3', inv);
  1515. NewGamePlusReplaceItem('Knight Geralt A Armor 3', 'NGP Knight Geralt A Armor 3', inv);
  1516. NewGamePlusReplaceItem('q702_vampire_armor', 'NGP q702_vampire_armor', inv);
  1517.  
  1518. NewGamePlusReplaceItem('Guard Lvl1 Gloves 3', 'NGP Guard Lvl1 Gloves 3', inv);
  1519. NewGamePlusReplaceItem('Guard Lvl1 A Gloves 3', 'NGP Guard Lvl1 A Gloves 3', inv);
  1520. NewGamePlusReplaceItem('Guard Lvl2 Gloves 3', 'NGP Guard Lvl2 Gloves 3', inv);
  1521. NewGamePlusReplaceItem('Guard Lvl2 A Gloves 3', 'NGP Guard Lvl2 A Gloves 3', inv);
  1522. NewGamePlusReplaceItem('Knight Geralt Gloves 3', 'NGP Knight Geralt Gloves 3', inv);
  1523. NewGamePlusReplaceItem('Knight Geralt A Gloves 3', 'NGP Knight Geralt A Gloves 3', inv);
  1524. NewGamePlusReplaceItem('q702_vampire_gloves', 'NGP q702_vampire_gloves', inv);
  1525.  
  1526. NewGamePlusReplaceItem('Guard Lvl1 Pants 3', 'NGP Guard Lvl1 Pants 3', inv);
  1527. NewGamePlusReplaceItem('Guard Lvl1 A Pants 3', 'NGP Guard Lvl1 A Pants 3', inv);
  1528. NewGamePlusReplaceItem('Guard Lvl2 Pants 3', 'NGP Guard Lvl2 Pants 3', inv);
  1529. NewGamePlusReplaceItem('Guard Lvl2 A Pants 3', 'NGP Guard Lvl2 A Pants 3', inv);
  1530. NewGamePlusReplaceItem('Knight Geralt Pants 3', 'NGP Knight Geralt Pants 3', inv);
  1531. NewGamePlusReplaceItem('Knight Geralt A Pants 3', 'NGP Knight Geralt A Pants 3', inv);
  1532. NewGamePlusReplaceItem('q702_vampire_pants', 'NGP q702_vampire_pants', inv);
  1533.  
  1534. NewGamePlusReplaceItem('Guard Lvl1 Boots 3', 'NGP Guard Lvl1 Boots 3', inv);
  1535. NewGamePlusReplaceItem('Guard Lvl1 A Boots 3', 'NGP Guard Lvl1 A Boots 3', inv);
  1536. NewGamePlusReplaceItem('Guard Lvl2 Boots 3', 'NGP Guard Lvl2 Boots 3', inv);
  1537. NewGamePlusReplaceItem('Guard Lvl2 A Boots 3', 'NGP Guard Lvl2 A Boots 3', inv);
  1538. NewGamePlusReplaceItem('Knight Geralt Boots 3', 'NGP Knight Geralt Boots 3', inv);
  1539. NewGamePlusReplaceItem('Knight Geralt A Boots 3', 'NGP Knight Geralt A Boots 3', inv);
  1540. NewGamePlusReplaceItem('q702_vampire_boots', 'NGP q702_vampire_boots', inv);
  1541.  
  1542. NewGamePlusReplaceItem('Serpent Steel Sword 1', 'NGP Serpent Steel Sword 1', inv);
  1543. NewGamePlusReplaceItem('Serpent Steel Sword 2', 'NGP Serpent Steel Sword 2', inv);
  1544. NewGamePlusReplaceItem('Serpent Steel Sword 3', 'NGP Serpent Steel Sword 3', inv);
  1545. NewGamePlusReplaceItem('Guard lvl1 steel sword 3', 'NGP Guard lvl1 steel sword 3', inv);
  1546. NewGamePlusReplaceItem('Guard lvl2 steel sword 3', 'NGP Guard lvl2 steel sword 3', inv);
  1547. NewGamePlusReplaceItem('Knights steel sword 3', 'NGP Knights steel sword 3', inv);
  1548. NewGamePlusReplaceItem('Hanza steel sword 3', 'NGP Hanza steel sword 3', inv);
  1549. NewGamePlusReplaceItem('Toussaint steel sword 3', 'NGP Toussaint steel sword 3', inv);
  1550. NewGamePlusReplaceItem('q702 vampire steel sword', 'NGP q702 vampire steel sword', inv);
  1551.  
  1552. NewGamePlusReplaceItem('Serpent Silver Sword 1', 'NGP Serpent Silver Sword 1', inv);
  1553. NewGamePlusReplaceItem('Serpent Silver Sword 2', 'NGP Serpent Silver Sword 2', inv);
  1554. NewGamePlusReplaceItem('Serpent Silver Sword 3', 'NGP Serpent Silver Sword 3', inv);
  1555. }
  1556.  
  1557.  
  1558.  
  1559. private final function NewGamePlusReplaceNetflixSet(out inv : CInventoryComponent)
  1560. {
  1561. NewGamePlusReplaceItem('Netflix Armor', 'NGP Netflix Armor', inv);
  1562. NewGamePlusReplaceItem('Netflix Armor 1', 'NGP Netflix Armor 1', inv);
  1563. NewGamePlusReplaceItem('Netflix Armor 2', 'NGP Netflix Armor 2', inv);
  1564.  
  1565. NewGamePlusReplaceItem('Netflix Gloves 1', 'NGP Netflix Gloves 1', inv);
  1566. NewGamePlusReplaceItem('Netflix Gloves 2', 'NGP Netflix Gloves 2', inv);
  1567. NewGamePlusReplaceItem('Netflix Gloves', 'NGP Netflix Gloves', inv);
  1568.  
  1569. NewGamePlusReplaceItem('Netflix Pants 1', 'NGP Netflix Pants 1', inv);
  1570. NewGamePlusReplaceItem('Netflix Pants 2', 'NGP Netflix Pants 2', inv);
  1571. NewGamePlusReplaceItem('Netflix Pants', 'NGP Netflix Pants', inv);
  1572.  
  1573. NewGamePlusReplaceItem('Netflix Boots 1', 'NGP Netflix Boots 1', inv);
  1574. NewGamePlusReplaceItem('Netflix Boots 2', 'NGP Netflix Boots 2', inv);
  1575. NewGamePlusReplaceItem('Netflix Boots', 'NGP Netflix Boots', inv);
  1576.  
  1577. NewGamePlusReplaceItem('Netflix steel sword', 'NGP Netflix steel sword', inv);
  1578. NewGamePlusReplaceItem('Netflix steel sword 1', 'NGP Netflix steel sword 1', inv);
  1579. NewGamePlusReplaceItem('Netflix steel sword 2', 'NGP Netflix steel sword 2', inv);
  1580.  
  1581. NewGamePlusReplaceItem('Netflix silver sword', 'NGP Netflix silver sword', inv);
  1582. NewGamePlusReplaceItem('Netflix silver sword 1', 'NGP Netflix silver sword 1', inv);
  1583. NewGamePlusReplaceItem('Netflix silver sword 2', 'NGP Netflix silver sword 2', inv);
  1584. }
  1585.  
  1586.  
  1587.  
  1588. private final function NewGamePlusReplaceDolBlathannaSet(out inv : CInventoryComponent)
  1589. {
  1590. NewGamePlusReplaceItem('Dol Blathanna Armor', 'NGP Dol Blathanna Armor', inv);
  1591. NewGamePlusReplaceItem('Dol Blathanna Gloves', 'NGP Dol Blathanna Gloves', inv);
  1592. NewGamePlusReplaceItem('Dol Blathanna Pants', 'NGP Dol Blathanna Pants', inv);
  1593. NewGamePlusReplaceItem('Dol Blathanna Boots', 'NGP Dol Blathanna Boots', inv);
  1594. NewGamePlusReplaceItem('Dol Blathanna longsword', 'NGP Dol Blathanna longsword', inv);
  1595. NewGamePlusReplaceItem('White Widow of Dol Blathanna', 'NGP White Widow of Dol Blathanna', inv);
  1596. }
  1597.  
  1598.  
  1599.  
  1600. private final function NewGamePlusReplaceWhiteTigerSet(out inv : CInventoryComponent)
  1601. {
  1602. NewGamePlusReplaceItem('White Tiger Armor', 'NGP White Tiger Armor', inv);
  1603. NewGamePlusReplaceItem('White Tiger Gloves', 'NGP White Tiger Gloves', inv);
  1604. NewGamePlusReplaceItem('White Tiger Pants', 'NGP White Tiger Pants', inv);
  1605. NewGamePlusReplaceItem('White Tiger Boots', 'NGP White Tiger Boots', inv);
  1606. NewGamePlusReplaceItem('Steel Vixen', 'NGP Steel Vixen', inv);
  1607. NewGamePlusReplaceItem('Silver Vixen', 'NGP Silver Vixen', inv);
  1608. }
  1609.  
  1610.  
  1611. public function GetEquippedSword(steel : bool) : SItemUniqueId
  1612. {
  1613. var item : SItemUniqueId;
  1614.  
  1615. if(steel)
  1616. GetItemEquippedOnSlot(EES_SteelSword, item);
  1617. else
  1618. GetItemEquippedOnSlot(EES_SilverSword, item);
  1619.  
  1620. return item;
  1621. }
  1622.  
  1623. timer function BroadcastRain( deltaTime : float, id : int )
  1624. {
  1625. var rainStrength : float = 0;
  1626. rainStrength = GetRainStrength();
  1627. if( rainStrength > 0.5 )
  1628. {
  1629. theGame.GetBehTreeReactionManager().CreateReactionEventIfPossible( thePlayer, 'RainAction', 2.0f , 50.0f, -1.f, -1, true);
  1630. LogReactionSystem( "'RainAction' was sent by Player - single broadcast - distance: 50.0" );
  1631. }
  1632. }
  1633.  
  1634. function InitializeParryType()
  1635. {
  1636. var i, j : int;
  1637.  
  1638. parryTypeTable.Resize( EnumGetMax('EAttackSwingType')+1 );
  1639. for( i = 0; i < EnumGetMax('EAttackSwingType')+1; i += 1 )
  1640. {
  1641. parryTypeTable[i].Resize( EnumGetMax('EAttackSwingDirection')+1 );
  1642. }
  1643. parryTypeTable[AST_Horizontal][ASD_UpDown] = PT_None;
  1644. parryTypeTable[AST_Horizontal][ASD_DownUp] = PT_None;
  1645. parryTypeTable[AST_Horizontal][ASD_LeftRight] = PT_Left;
  1646. parryTypeTable[AST_Horizontal][ASD_RightLeft] = PT_Right;
  1647. parryTypeTable[AST_Vertical][ASD_UpDown] = PT_Up;
  1648. parryTypeTable[AST_Vertical][ASD_DownUp] = PT_Down;
  1649. parryTypeTable[AST_Vertical][ASD_LeftRight] = PT_None;
  1650. parryTypeTable[AST_Vertical][ASD_RightLeft] = PT_None;
  1651. parryTypeTable[AST_DiagonalUp][ASD_UpDown] = PT_None;
  1652. parryTypeTable[AST_DiagonalUp][ASD_DownUp] = PT_None;
  1653. parryTypeTable[AST_DiagonalUp][ASD_LeftRight] = PT_UpLeft;
  1654. parryTypeTable[AST_DiagonalUp][ASD_RightLeft] = PT_RightUp;
  1655. parryTypeTable[AST_DiagonalDown][ASD_UpDown] = PT_None;
  1656. parryTypeTable[AST_DiagonalDown][ASD_DownUp] = PT_None;
  1657. parryTypeTable[AST_DiagonalDown][ASD_LeftRight] = PT_LeftDown;
  1658. parryTypeTable[AST_DiagonalDown][ASD_RightLeft] = PT_DownRight;
  1659. parryTypeTable[AST_Jab][ASD_UpDown] = PT_Jab;
  1660. parryTypeTable[AST_Jab][ASD_DownUp] = PT_Jab;
  1661. parryTypeTable[AST_Jab][ASD_LeftRight] = PT_Jab;
  1662. parryTypeTable[AST_Jab][ASD_RightLeft] = PT_Jab;
  1663. }
  1664.  
  1665.  
  1666.  
  1667.  
  1668.  
  1669.  
  1670. event OnDeath( damageAction : W3DamageAction )
  1671. {
  1672. var items : array< SItemUniqueId >;
  1673. var i, size : int;
  1674. var slot : EEquipmentSlots;
  1675. var holdSlot : name;
  1676.  
  1677. super.OnDeath( damageAction );
  1678.  
  1679. items = GetHeldItems();
  1680.  
  1681. if( rangedWeapon && rangedWeapon.GetCurrentStateName() != 'State_WeaponWait')
  1682. {
  1683. OnRangedForceHolster( true, true, true );
  1684. rangedWeapon.ClearDeployedEntity(true);
  1685. }
  1686.  
  1687. size = items.Size();
  1688.  
  1689. if ( size > 0 )
  1690. {
  1691. for ( i = 0; i < size; i += 1 )
  1692. {
  1693. if ( this.inv.IsIdValid( items[i] ) && !( this.inv.IsItemCrossbow( items[i] ) ) )
  1694. {
  1695. holdSlot = this.inv.GetItemHoldSlot( items[i] );
  1696.  
  1697. if ( holdSlot == 'l_weapon' && this.IsHoldingItemInLHand() )
  1698. {
  1699. this.OnUseSelectedItem( true );
  1700. }
  1701.  
  1702. DropItemFromSlot( holdSlot, false );
  1703.  
  1704. if ( holdSlot == 'r_weapon' )
  1705. {
  1706. slot = this.GetItemSlot( items[i] );
  1707. if ( UnequipItemFromSlot( slot ) )
  1708. Log( "Unequip" );
  1709. }
  1710. }
  1711. }
  1712. }
  1713. }
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.  
  1721. function HandleMovement( deltaTime : float )
  1722. {
  1723. super.HandleMovement( deltaTime );
  1724.  
  1725. rawCameraHeading = theCamera.GetCameraHeading();
  1726. }
  1727.  
  1728.  
  1729.  
  1730.  
  1731.  
  1732.  
  1733.  
  1734. function ToggleSpecialAttackHeavyAllowed( toggle : bool)
  1735. {
  1736. specialAttackHeavyAllowed = toggle;
  1737. }
  1738.  
  1739. function GetReputationManager() : W3Reputation
  1740. {
  1741. return reputationManager;
  1742. }
  1743.  
  1744. function OnRadialMenuItemChoose( selectedItem : string )
  1745. {
  1746. var iSlotId : int;
  1747. var item : SItemUniqueId;
  1748.  
  1749. if ( selectedItem != "Crossbow" )
  1750. {
  1751. if ( rangedWeapon && rangedWeapon.GetCurrentStateName() != 'State_WeaponWait' )
  1752. OnRangedForceHolster( true, false );
  1753. }
  1754.  
  1755.  
  1756. switch(selectedItem)
  1757. {
  1758.  
  1759. case "Meditation":
  1760. theGame.RequestMenuWithBackground( 'MeditationClockMenu', 'CommonMenu' );
  1761. break;
  1762. case "Slot1":
  1763. GetItemEquippedOnSlot( EES_Petard1, item );
  1764. if( thePlayer.inv.IsIdValid( item ) )
  1765. {
  1766. SelectQuickslotItem( EES_Petard1 );
  1767. }
  1768. else
  1769. {
  1770. SelectQuickslotItem( EES_Petard2 );
  1771. }
  1772. break;
  1773.  
  1774. case "Slot2":
  1775. GetItemEquippedOnSlot( EES_Petard2, item );
  1776. if( thePlayer.inv.IsIdValid( item ) )
  1777. {
  1778. SelectQuickslotItem( EES_Petard2 );
  1779. }
  1780. else
  1781. {
  1782. SelectQuickslotItem( EES_Petard1 );
  1783. }
  1784. break;
  1785.  
  1786. case "Crossbow":
  1787. SelectQuickslotItem(EES_RangedWeapon);
  1788. break;
  1789.  
  1790. case "Slot3":
  1791. GetItemEquippedOnSlot( EES_Quickslot1, item );
  1792. if( thePlayer.inv.IsIdValid( item ) )
  1793. {
  1794. SelectQuickslotItem( EES_Quickslot1 );
  1795. }
  1796. else
  1797. {
  1798. SelectQuickslotItem( EES_Quickslot2 );
  1799. }
  1800. break;
  1801.  
  1802. case "Slot4":
  1803. GetItemEquippedOnSlot( EES_Quickslot2, item );
  1804. if( thePlayer.inv.IsIdValid( item ) )
  1805. {
  1806. SelectQuickslotItem( EES_Quickslot2 );
  1807. }
  1808. else
  1809. {
  1810. SelectQuickslotItem( EES_Quickslot1 );
  1811. }
  1812. break;
  1813.  
  1814. default:
  1815. SetEquippedSign(SignStringToEnum( selectedItem ));
  1816. FactsRemove("SignToggled");
  1817. break;
  1818. }
  1819. }
  1820.  
  1821. function ToggleNextItem()
  1822. {
  1823. var quickSlotItems : array< EEquipmentSlots >;
  1824. var currentSelectedItem : SItemUniqueId;
  1825. var item : SItemUniqueId;
  1826. var i : int;
  1827.  
  1828. for( i = EES_Quickslot2; i > EES_Petard1 - 1; i -= 1 )
  1829. {
  1830. GetItemEquippedOnSlot( i, item );
  1831. if( inv.IsIdValid( item ) )
  1832. {
  1833. quickSlotItems.PushBack( i );
  1834. }
  1835. }
  1836. if( !quickSlotItems.Size() )
  1837. {
  1838. return;
  1839. }
  1840.  
  1841. currentSelectedItem = GetSelectedItemId();
  1842.  
  1843. if( inv.IsIdValid( currentSelectedItem ) )
  1844. {
  1845. for( i = 0; i < quickSlotItems.Size(); i += 1 )
  1846. {
  1847. GetItemEquippedOnSlot( quickSlotItems[i], item );
  1848. if( currentSelectedItem == item )
  1849. {
  1850. if( i == quickSlotItems.Size() - 1 )
  1851. {
  1852. SelectQuickslotItem( quickSlotItems[ 0 ] );
  1853. }
  1854. else
  1855. {
  1856. SelectQuickslotItem( quickSlotItems[ i + 1 ] );
  1857. }
  1858. return;
  1859. }
  1860. }
  1861. }
  1862. else
  1863. {
  1864. SelectQuickslotItem( quickSlotItems[ 0 ] );
  1865. }
  1866. }
  1867.  
  1868. public function OnShieldHit()
  1869. {
  1870. m_quenHitFxTTL = 0.2;
  1871. ApplyGamepadTriggerEffect( equippedSign );
  1872. }
  1873.  
  1874. timer function UpdateGamepadTriggerEffect( dt : float, id : int )
  1875. {
  1876. if( m_TriggerEffectDisablePending )
  1877. {
  1878. m_TriggerEffectDisableTTW -= dt;
  1879.  
  1880. if( m_TriggerEffectDisableTTW < 0 )
  1881. {
  1882. m_TriggerEffectDisabled = true;
  1883. m_TriggerEffectDisablePending = false;
  1884. }
  1885. }
  1886.  
  1887. if( m_TriggerEffectDisabled && !theInput.IsActionPressed('CastSign') )
  1888. m_TriggerEffectDisabled = false;
  1889.  
  1890. m_quenHitFxTTL -= dt;
  1891. ApplyGamepadTriggerEffect( equippedSign );
  1892. }
  1893.  
  1894. public function ApplyCastSettings()
  1895. {
  1896. ApplyGamepadTriggerEffect( equippedSign );
  1897. }
  1898.  
  1899. private function ApplyGamepadTriggerEffect( type : ESignType )
  1900. {
  1901. var mode : int;
  1902. var param : array<Vector>;
  1903. var cur_sign : W3SignEntity;
  1904. var sign_skill : ESkill;
  1905.  
  1906. sign_skill = SignEnumToSkillEnum( type );
  1907.  
  1908. if( !thePlayer.CanUseSkill(sign_skill) || !HasStaminaToUseSkill(sign_skill,false) )
  1909. {
  1910. theGame.SetTriggerEffect( 1, GTFX_Off, param );
  1911. theGame.SetTriggerEffect( 0, GTFX_Off, param );
  1912. if(theInput.IsActionPressed('CastSign'))
  1913. {
  1914. lastPressedWithNostamina = true;
  1915. }
  1916. return;
  1917. }
  1918. if(lastPressedWithNostamina && !theInput.IsActionPressed('CastSign'))
  1919. {
  1920. lastPressedWithNostamina = false;
  1921. }
  1922.  
  1923. if(lastPressedWithNostamina)
  1924. {
  1925. return;
  1926. }
  1927.  
  1928. if( type == ST_Igni && IsCurrentSignChanneled() )
  1929. {
  1930. mode = GTFX_MultiVibration;
  1931.  
  1932. param.Resize( 10 );
  1933. param[0].Y = 0.3;
  1934. param[0].X = 0.0;
  1935. param[1].X = 0.0;
  1936. param[2].X = 0.0;
  1937. param[3].X = 0.0;
  1938. param[4].X = 0.0;
  1939. param[5].X = 0.0;
  1940. param[6].X = 0.8;
  1941. param[7].X = 0.8;
  1942. param[8].X = 0.8;
  1943. param[9].X = 0.9;
  1944.  
  1945. theGame.SetTriggerEffect( 1, mode, param );
  1946. return;
  1947. }
  1948.  
  1949. if( type == ST_Quen && m_quenHitFxTTL > 0 && HasBuff( EET_BasicQuen ) )
  1950. {
  1951. mode = GTFX_MultiVibration;
  1952.  
  1953. param.Resize( 10 );
  1954. param[0].Y = 0.5;
  1955. param[0].X = 0.0;
  1956. param[1].X = 0.0;
  1957. param[2].X = 0.0;
  1958. param[3].X = 0.0;
  1959. param[4].X = 0.0;
  1960. param[5].X = 0.0;
  1961. param[6].X = 0.8;
  1962. param[7].X = 0.8;
  1963. param[8].X = 0.99;
  1964. param[9].X = 0.99;
  1965.  
  1966. theGame.SetTriggerEffect( 1, mode, param );
  1967. return;
  1968. }
  1969.  
  1970.  
  1971. if( m_TriggerEffectDisabled )
  1972. {
  1973. theGame.SetTriggerEffect( 1, GTFX_Off, param );
  1974. theGame.SetTriggerEffect( 0, GTFX_Off, param );
  1975. return;
  1976. }
  1977.  
  1978. if(
  1979. theGame.IsPaused()
  1980. || theGame.GetPhotomodeEnabled()
  1981. || theGame.IsDialogOrCutscenePlaying()
  1982. || thePlayer.IsInCutsceneIntro()
  1983. || theGame.IsCurrentlyPlayingNonGameplayScene()
  1984. )
  1985. {
  1986. theGame.SetTriggerEffect( 1, GTFX_Off, param );
  1987. theGame.SetTriggerEffect( 0, GTFX_Off, param );
  1988.  
  1989. return;
  1990. }
  1991.  
  1992. mode = GTFX_Off;
  1993.  
  1994. if( GetInputHandler().GetIsAltSignCasting() )
  1995. {
  1996. mode = GTFX_Vibration;
  1997.  
  1998. param.Resize( 1 );
  1999. param[0].X = 0.9;
  2000. param[0].Y = 0.1;
  2001. param[0].Z = 0.15;
  2002.  
  2003. theGame.SetTriggerEffect( 1, mode, param );
  2004.  
  2005. if( GetInputHandler().GetIsAltSignCastingPressed() )
  2006. {
  2007. mode = GTFX_Weapon;
  2008.  
  2009. param.Resize( 1 );
  2010. param[0].X = 0.1;
  2011. param[0].Y = 0.5;
  2012. param[0].Z = 1.0;
  2013.  
  2014. theGame.SetTriggerEffect( 0, mode, param );
  2015. }
  2016. else
  2017. {
  2018. theGame.SetTriggerEffect( 0, GTFX_Off, param );
  2019. }
  2020. }
  2021. else
  2022. {
  2023. if( type == ST_Aard )
  2024. {
  2025. mode = GTFX_MultiFeedback;
  2026.  
  2027. param.Resize( 10 );
  2028. param[0].X = 0.0;
  2029. param[1].X = 0.0;
  2030. param[2].X = 0.0;
  2031. param[3].X = 0.1;
  2032. param[4].X = 0.2;
  2033. param[5].X = 0.2;
  2034. param[6].X = 0.0;
  2035. param[7].X = 0.0;
  2036. param[8].X = 0.4;
  2037. param[9].X = 0.4;
  2038. }
  2039. else if( type == ST_Axii )
  2040. {
  2041. mode = GTFX_Vibration;
  2042.  
  2043. param.Resize( 1 );
  2044. param[0].X = 0.8;
  2045. param[0].Y = 0.15;
  2046. param[0].Z = 0.2;
  2047. }
  2048. else if( type == ST_Igni )
  2049. {
  2050. mode = GTFX_Weapon;
  2051.  
  2052. param.Resize( 1 );
  2053. param[0].X = 0.5;
  2054. param[0].Y = 0.7;
  2055. param[0].Z = 1.0;
  2056. }
  2057. else if( type == ST_Quen )
  2058. {
  2059. mode = GTFX_Vibration;
  2060.  
  2061. param.Resize( 1 );
  2062. param[0].X = 0.8;
  2063. param[0].Y = 0.25;
  2064. param[0].Z = 0.7;
  2065. }
  2066. else if( type == ST_Yrden )
  2067. {
  2068. mode = GTFX_Vibration;
  2069.  
  2070. param.Resize( 1 );
  2071. param[0].X = 0.9;
  2072. param[0].Y = 0.5;
  2073. param[0].Z = 0.99;
  2074. }
  2075.  
  2076. theGame.SetTriggerEffect( 1, mode, param );
  2077. theGame.SetTriggerEffect( 0, GTFX_Off, param );
  2078. }
  2079.  
  2080. }
  2081.  
  2082.  
  2083. function SetEquippedSign( signType : ESignType )
  2084. {
  2085. if(!IsSignBlocked(signType))
  2086. {
  2087. equippedSign = signType;
  2088. FactsSet("CurrentlySelectedSign", equippedSign);
  2089. ApplyGamepadTriggerEffect( signType );
  2090. }
  2091. }
  2092.  
  2093. function GetEquippedSign() : ESignType
  2094. {
  2095. return equippedSign;
  2096. }
  2097.  
  2098. function GetCurrentlyCastSign() : ESignType
  2099. {
  2100. return currentlyCastSign;
  2101. }
  2102.  
  2103. function SetCurrentlyCastSign( type : ESignType, entity : W3SignEntity )
  2104. {
  2105. currentlyCastSign = type;
  2106.  
  2107. if( type != ST_None )
  2108. {
  2109. signs[currentlyCastSign].entity = entity;
  2110. }
  2111. }
  2112.  
  2113. function GetCurrentSignEntity() : W3SignEntity
  2114. {
  2115. if(currentlyCastSign == ST_None)
  2116. return NULL;
  2117.  
  2118. return signs[currentlyCastSign].entity;
  2119. }
  2120.  
  2121. public function GetSignEntity(type : ESignType) : W3SignEntity
  2122. {
  2123. if(type == ST_None)
  2124. return NULL;
  2125.  
  2126. return signs[type].entity;
  2127. }
  2128.  
  2129. public function GetSignTemplate(type : ESignType) : CEntityTemplate
  2130. {
  2131. if(type == ST_None)
  2132. return NULL;
  2133.  
  2134. return signs[type].template;
  2135. }
  2136.  
  2137. public function IsCurrentSignChanneled() : bool
  2138. {
  2139. if( currentlyCastSign != ST_None && signs[currentlyCastSign].entity)
  2140. return signs[currentlyCastSign].entity.OnCheckChanneling();
  2141.  
  2142. return false;
  2143. }
  2144.  
  2145. function IsCastingSign() : bool
  2146. {
  2147. return currentlyCastSign != ST_None;
  2148. }
  2149.  
  2150.  
  2151. protected function IsInCombatActionCameraRotationEnabled() : bool
  2152. {
  2153. if( IsInCombatAction() && ( GetCombatAction() == EBAT_EMPTY || GetCombatAction() == EBAT_Parry ) )
  2154. {
  2155. return true;
  2156. }
  2157.  
  2158. return !bIsInCombatAction;
  2159. }
  2160.  
  2161. function SetHoldBeforeOpenRadialMenuTime ( time : float )
  2162. {
  2163. _HoldBeforeOpenRadialMenuTime = time;
  2164. }
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172. public function RepairItem ( rapairKitId : SItemUniqueId, usedOnItem : SItemUniqueId )
  2173. {
  2174. var itemMaxDurablity : float;
  2175. var itemCurrDurablity : float;
  2176. var baseRepairValue : float;
  2177. var reapirValue : float;
  2178. var itemAttribute : SAbilityAttributeValue;
  2179.  
  2180. itemMaxDurablity = inv.GetItemMaxDurability(usedOnItem);
  2181. itemCurrDurablity = inv.GetItemDurability(usedOnItem);
  2182. itemAttribute = inv.GetItemAttributeValue ( rapairKitId, 'repairValue' );
  2183.  
  2184. if( itemCurrDurablity >= itemMaxDurablity )
  2185. {
  2186. return;
  2187. }
  2188.  
  2189. if ( inv.IsItemAnyArmor ( usedOnItem )|| inv.IsItemWeapon( usedOnItem ) )
  2190. {
  2191.  
  2192. baseRepairValue = itemMaxDurablity * itemAttribute.valueMultiplicative;
  2193. reapirValue = MinF( itemCurrDurablity + baseRepairValue, itemMaxDurablity );
  2194.  
  2195. inv.SetItemDurabilityScript ( usedOnItem, MinF ( reapirValue, itemMaxDurablity ));
  2196. }
  2197.  
  2198. inv.RemoveItem ( rapairKitId, 1 );
  2199.  
  2200. }
  2201. public function HasRepairAbleGearEquiped ( ) : bool
  2202. {
  2203. var curEquipedItem : SItemUniqueId;
  2204.  
  2205. return ( GetItemEquippedOnSlot(EES_Armor, curEquipedItem) || GetItemEquippedOnSlot(EES_Boots, curEquipedItem) || GetItemEquippedOnSlot(EES_Pants, curEquipedItem) || GetItemEquippedOnSlot(EES_Gloves, curEquipedItem)) == true;
  2206. }
  2207. public function HasRepairAbleWaponEquiped () : bool
  2208. {
  2209. var curEquipedItem : SItemUniqueId;
  2210.  
  2211. return ( GetItemEquippedOnSlot(EES_SilverSword, curEquipedItem) || GetItemEquippedOnSlot(EES_SteelSword, curEquipedItem) ) == true;
  2212. }
  2213. public function IsItemRepairAble ( item : SItemUniqueId ) : bool
  2214. {
  2215. return inv.GetItemDurabilityRatio(item) <= 0.99999f;
  2216. }
  2217.  
  2218.  
  2219.  
  2220.  
  2221.  
  2222.  
  2223.  
  2224.  
  2225. public function ApplyOil( oilId : SItemUniqueId, usedOnItem : SItemUniqueId ) : bool
  2226. {
  2227. var tutStateOil : W3TutorialManagerUIHandlerStateOils;
  2228.  
  2229. if( !super.ApplyOil( oilId, usedOnItem ))
  2230. return false;
  2231.  
  2232.  
  2233. if(ShouldProcessTutorial('TutorialOilCanEquip3'))
  2234. {
  2235. tutStateOil = (W3TutorialManagerUIHandlerStateOils)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
  2236. if(tutStateOil)
  2237. {
  2238. tutStateOil.OnOilApplied();
  2239. }
  2240. }
  2241.  
  2242. return true;
  2243. }
  2244.  
  2245.  
  2246. public final function RemoveExtraOilsFromItem( item : SItemUniqueId )
  2247. {
  2248. var oils : array< CBaseGameplayEffect >;
  2249. var i, cnt : int;
  2250. var buff : W3Effect_Oil;
  2251.  
  2252.  
  2253. inv.RemoveAllOilsFromItem(item);
  2254. return;
  2255.  
  2256.  
  2257.  
  2258. }
  2259.  
  2260.  
  2261.  
  2262.  
  2263.  
  2264.  
  2265.  
  2266.  
  2267. function ReduceDamage(out damageData : W3DamageAction)
  2268. {
  2269. var actorAttacker : CActor;
  2270. var quen : W3QuenEntity;
  2271. var attackRange : CAIAttackRange;
  2272. var attackerMovementAdjustor : CMovementAdjustor;
  2273. var dist, distToAttacker, actionHeading, attackerHeading, currAdrenaline, adrenReducedDmg, focus : float;
  2274. var attackName : name;
  2275. var useQuenForBleeding : bool;
  2276. var min, max : SAbilityAttributeValue;
  2277. var skillLevel : int;
  2278.  
  2279. super.ReduceDamage(damageData);
  2280.  
  2281.  
  2282.  
  2283. quen = (W3QuenEntity)signs[ST_Quen].entity;
  2284. useQuenForBleeding = false;
  2285. if(quen && !damageData.DealsAnyDamage() && ((W3Effect_Bleeding)damageData.causer) && damageData.GetDamageValue(theGame.params.DAMAGE_NAME_DIRECT) > 0.f)
  2286. useQuenForBleeding = true;
  2287.  
  2288.  
  2289. if(!useQuenForBleeding && !damageData.DealsAnyDamage())
  2290. return;
  2291.  
  2292. actorAttacker = (CActor)damageData.attacker;
  2293.  
  2294.  
  2295. if(actorAttacker && IsCurrentlyDodging() && damageData.CanBeDodged())
  2296. {
  2297.  
  2298.  
  2299. actionHeading = evadeHeading;
  2300. attackerHeading = actorAttacker.GetHeading();
  2301. dist = AngleDistance(actionHeading, attackerHeading);
  2302. distToAttacker = VecDistance(this.GetWorldPosition(),damageData.attacker.GetWorldPosition());
  2303. attackName = actorAttacker.GetLastAttackRangeName();
  2304. attackRange = theGame.GetAttackRangeForEntity( actorAttacker, attackName );
  2305. attackerMovementAdjustor = actorAttacker.GetMovingAgentComponent().GetMovementAdjustor();
  2306. if( ( AbsF(dist) < 150 && attackName != 'stomp' && attackName != 'anchor_special_far' && attackName != 'anchor_far' )
  2307. || ( ( attackName == 'stomp' || attackName == 'anchor_special_far' || attackName == 'anchor_far' ) && distToAttacker > attackRange.rangeMax * 0.75 ) )
  2308. {
  2309. if ( theGame.CanLog() )
  2310. {
  2311. LogDMHits("W3PlayerWitcher.ReduceDamage: Attack dodged by player - no damage done", damageData);
  2312. }
  2313. damageData.SetAllProcessedDamageAs(0);
  2314. damageData.SetWasDodged();
  2315. }
  2316.  
  2317. else if( !damageData.IsActionEnvironment() && !damageData.IsDoTDamage() && CanUseSkill( S_Sword_s09 ) )
  2318. {
  2319. skillLevel = GetSkillLevel( S_Sword_s09 );
  2320. if( skillLevel == GetSkillMaxLevel( S_Sword_s09 ) )
  2321. {
  2322. damageData.SetAllProcessedDamageAs(0);
  2323. damageData.SetWasDodged();
  2324. }
  2325. else
  2326. {
  2327. damageData.processedDmg.vitalityDamage *= 1 - CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s09, 'damage_reduction', false, true)) * skillLevel;
  2328. }
  2329.  
  2330. if ( theGame.CanLog() )
  2331. {
  2332. LogDMHits("W3PlayerWitcher.ReduceDamage: skill S_Sword_s09 reduced damage while dodging", damageData );
  2333. }
  2334. }
  2335. }
  2336.  
  2337.  
  2338. if(quen && damageData.GetBuffSourceName() != "FallingDamage")
  2339. {
  2340. if ( theGame.CanLog() )
  2341. {
  2342. LogDMHits("W3PlayerWitcher.ReduceDamage: Processing Quen sign damage reduction...", damageData);
  2343. }
  2344. quen.OnTargetHit( damageData );
  2345. }
  2346.  
  2347.  
  2348. if( HasBuff( EET_GryphonSetBonusYrden ) )
  2349. {
  2350. min = GetAttributeValue( 'gryphon_set_bns_dmg_reduction' );
  2351. damageData.processedDmg.vitalityDamage *= 1 - min.valueAdditive;
  2352. }
  2353.  
  2354.  
  2355. if( IsMutationActive( EPMT_Mutation5 ) && !IsAnyQuenActive() && !damageData.IsDoTDamage() )
  2356. {
  2357. focus = GetStat( BCS_Focus );
  2358. currAdrenaline = FloorF( focus );
  2359. if( currAdrenaline >= 1 )
  2360. {
  2361. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation5', 'mut5_dmg_red_perc', min, max );
  2362. adrenReducedDmg = ( currAdrenaline * min.valueAdditive );
  2363. damageData.processedDmg.vitalityDamage *= 1 - adrenReducedDmg;
  2364.  
  2365.  
  2366. theGame.MutationHUDFeedback( MFT_PlayOnce );
  2367.  
  2368. if( focus >= 3.f )
  2369. {
  2370. PlayEffect( 'mutation_5_stage_03' );
  2371. }
  2372. else if( focus >= 2.f )
  2373. {
  2374. PlayEffect( 'mutation_5_stage_02' );
  2375. }
  2376. else
  2377. {
  2378. PlayEffect( 'mutation_5_stage_01' );
  2379. }
  2380. }
  2381. }
  2382.  
  2383.  
  2384. if(!damageData.GetIgnoreImmortalityMode())
  2385. {
  2386. if(!((W3PlayerWitcher)this))
  2387. Log("");
  2388.  
  2389.  
  2390. if( IsInvulnerable() )
  2391. {
  2392. if ( theGame.CanLog() )
  2393. {
  2394. LogDMHits("CActor.ReduceDamage: victim Invulnerable - no damage will be dealt", damageData );
  2395. }
  2396. damageData.SetAllProcessedDamageAs(0);
  2397. return;
  2398. }
  2399.  
  2400. if(actorAttacker && damageData.DealsAnyDamage() )
  2401. actorAttacker.SignalGameplayEventParamObject( 'DamageInstigated', damageData );
  2402.  
  2403.  
  2404. if( IsImmortal() )
  2405. {
  2406. if ( theGame.CanLog() )
  2407. {
  2408. LogDMHits("CActor.ReduceDamage: victim is Immortal, clamping damage", damageData );
  2409. }
  2410. damageData.processedDmg.vitalityDamage = ClampF(damageData.processedDmg.vitalityDamage, 0, GetStat(BCS_Vitality)-1 );
  2411. damageData.processedDmg.essenceDamage = ClampF(damageData.processedDmg.essenceDamage, 0, GetStat(BCS_Essence)-1 );
  2412. return;
  2413. }
  2414. }
  2415. else
  2416. {
  2417.  
  2418. if(actorAttacker && damageData.DealsAnyDamage() )
  2419. actorAttacker.SignalGameplayEventParamObject( 'DamageInstigated', damageData );
  2420. }
  2421. }
  2422.  
  2423. timer function UndyingSkillCooldown(dt : float, id : int)
  2424. {
  2425. cannotUseUndyingSkill = false;
  2426. }
  2427.  
  2428.  
  2429. public function GetCannotUseUndying() : bool
  2430. {
  2431. return cannotUseUndyingSkill;
  2432. }
  2433.  
  2434. public function SetCannotUseUndyingSkill(set : bool)
  2435. {
  2436. cannotUseUndyingSkill = set;
  2437. }
  2438.  
  2439.  
  2440. event OnTakeDamage( action : W3DamageAction)
  2441. {
  2442. var currVitality, rgnVitality, hpTriggerTreshold : float;
  2443. var healingFactor : float;
  2444. var abilityName : name;
  2445. var abilityCount, maxStack, itemDurability : float;
  2446. var addAbility : bool;
  2447. var min, max : SAbilityAttributeValue;
  2448. var mutagenQuen : W3SignEntity;
  2449. var equipped : array<SItemUniqueId>;
  2450. var i : int;
  2451. var killSourceName : string;
  2452. var aerondight : W3Effect_Aerondight;
  2453.  
  2454. currVitality = GetStat(BCS_Vitality);
  2455.  
  2456.  
  2457. if(action.processedDmg.vitalityDamage >= currVitality)
  2458. {
  2459. killSourceName = action.GetBuffSourceName();
  2460.  
  2461.  
  2462. if( killSourceName != "Quest" && killSourceName != "Kill Trigger" && killSourceName != "Trap" && killSourceName != "FallingDamage" )
  2463. {
  2464.  
  2465. if(!cannotUseUndyingSkill && FloorF(GetStat(BCS_Focus)) >= 1 && CanUseSkill(S_Sword_s18) && HasBuff(EET_BattleTrance) )
  2466. {
  2467. healingFactor = CalculateAttributeValue( GetSkillAttributeValue(S_Sword_s18, 'healing_factor', false, true) );
  2468. healingFactor *= GetStatMax(BCS_Vitality);
  2469. healingFactor *= GetStat(BCS_Focus);
  2470. healingFactor *= 1 + CalculateAttributeValue( GetSkillAttributeValue(S_Sword_s18, 'healing_bonus', false, true) ) * (GetSkillLevel(S_Sword_s18) - 1);
  2471. ForceSetStat(BCS_Vitality, GetStatMax(BCS_Vitality));
  2472. DrainFocus(GetStat(BCS_Focus));
  2473. RemoveBuff(EET_BattleTrance);
  2474. cannotUseUndyingSkill = true;
  2475. AddTimer('UndyingSkillCooldown', CalculateAttributeValue( GetSkillAttributeValue(S_Sword_s18, 'trigger_delay', false, true) ), false, , , true);
  2476. }
  2477.  
  2478. else if( IsMutationActive( EPMT_Mutation11 ) && !HasBuff( EET_Mutation11Debuff ) && !IsInAir() )
  2479. {
  2480. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation11', 'health_prc', min, max );
  2481.  
  2482. action.SetAllProcessedDamageAs( 0 );
  2483.  
  2484. OnMutation11Triggered();
  2485. }
  2486. else
  2487. {
  2488.  
  2489. equipped = GetEquippedItems();
  2490.  
  2491. for(i=0; i<equipped.Size(); i+=1)
  2492. {
  2493. if ( !inv.IsIdValid( equipped[i] ) )
  2494. {
  2495. continue;
  2496. }
  2497. itemDurability = inv.GetItemDurability(equipped[i]);
  2498. if(inv.ItemHasAbility(equipped[i], 'MA_Reinforced') && itemDurability > 0)
  2499. {
  2500.  
  2501. inv.SetItemDurabilityScript(equipped[i], MaxF(0, itemDurability - action.processedDmg.vitalityDamage) );
  2502.  
  2503.  
  2504. action.processedDmg.vitalityDamage = 0;
  2505. ForceSetStat(BCS_Vitality, 1);
  2506.  
  2507. break;
  2508. }
  2509. }
  2510. }
  2511. }
  2512. }
  2513.  
  2514.  
  2515. if(action.DealsAnyDamage() && !((W3Effect_Toxicity)action.causer) )
  2516. {
  2517. if(HasBuff(EET_Mutagen10))
  2518. RemoveAbilityAll( GetBuff(EET_Mutagen10).GetAbilityName() );
  2519.  
  2520. if(HasBuff(EET_Mutagen15))
  2521. RemoveAbilityAll( GetBuff(EET_Mutagen15).GetAbilityName() );
  2522. }
  2523.  
  2524.  
  2525. if(HasBuff(EET_Mutagen19))
  2526. {
  2527. theGame.GetDefinitionsManager().GetAbilityAttributeValue(GetBuff(EET_Mutagen19).GetAbilityName(), 'max_hp_perc_trigger', min, max);
  2528. hpTriggerTreshold = GetStatMax(BCS_Vitality) * CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  2529.  
  2530. if(action.GetDamageDealt() >= hpTriggerTreshold)
  2531. {
  2532. mutagenQuen = (W3SignEntity)theGame.CreateEntity( signs[ST_Quen].template, GetWorldPosition(), GetWorldRotation() );
  2533. mutagenQuen.Init( signOwner, signs[ST_Quen].entity, true );
  2534. mutagenQuen.OnStarted();
  2535. mutagenQuen.OnThrowing();
  2536. mutagenQuen.OnEnded();
  2537. }
  2538. }
  2539.  
  2540.  
  2541. if(action.DealsAnyDamage() && !action.IsDoTDamage() && HasBuff(EET_Mutagen27))
  2542. {
  2543. abilityName = GetBuff(EET_Mutagen27).GetAbilityName();
  2544. abilityCount = GetAbilityCount(abilityName);
  2545.  
  2546. if(abilityCount == 0)
  2547. {
  2548. addAbility = true;
  2549. }
  2550. else
  2551. {
  2552. theGame.GetDefinitionsManager().GetAbilityAttributeValue(abilityName, 'mutagen27_max_stack', min, max);
  2553. maxStack = CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  2554.  
  2555. if(maxStack >= 0)
  2556. {
  2557. addAbility = (abilityCount < maxStack);
  2558. }
  2559. else
  2560. {
  2561. addAbility = true;
  2562. }
  2563. }
  2564.  
  2565. if(addAbility)
  2566. {
  2567. AddAbility(abilityName, true);
  2568. }
  2569. }
  2570.  
  2571. if(HasBuff(EET_Trap) && !action.IsDoTDamage() && action.attacker.HasAbility( 'mon_dettlaff_monster_base' ))
  2572. {
  2573. action.AddEffectInfo(EET_Knockdown);
  2574. RemoveBuff(EET_Trap, true);
  2575. }
  2576.  
  2577. super.OnTakeDamage(action);
  2578.  
  2579.  
  2580. if( !action.WasDodged() && action.DealtDamage() && inv.ItemHasTag( inv.GetCurrentlyHeldSword(), 'Aerondight' ) && !action.IsDoTDamage() && !( (W3Effect_Toxicity) action.causer ) )
  2581. {
  2582. aerondight = (W3Effect_Aerondight)GetBuff( EET_Aerondight );
  2583. if( aerondight && aerondight.GetCurrentCount() != 0 )
  2584. {
  2585. aerondight.ReduceAerondightStacks();
  2586. }
  2587. }
  2588.  
  2589.  
  2590. if( !action.WasDodged() && action.DealtDamage() && !( (W3Effect_Toxicity) action.causer ) )
  2591. {
  2592. RemoveBuff( EET_Mutation3 );
  2593. }
  2594. }
  2595.  
  2596.  
  2597.  
  2598.  
  2599.  
  2600.  
  2601.  
  2602. event OnStartFistfightMinigame()
  2603. {
  2604. var i : int;
  2605. var buffs : array< CBaseGameplayEffect >;
  2606.  
  2607.  
  2608. effectManager.RemoveAllPotionEffects();
  2609.  
  2610. abilityManager.DrainToxicity(GetStatMax( BCS_Toxicity ));
  2611.  
  2612. buffs = GetBuffs( EET_WellFed );
  2613. for( i=buffs.Size()-1; i>=0; i-=1 )
  2614. {
  2615. RemoveEffect( buffs[i] );
  2616. }
  2617.  
  2618.  
  2619. buffs.Clear();
  2620. buffs = GetBuffs( EET_WellHydrated );
  2621. for( i=buffs.Size()-1; i>=0; i-=1 )
  2622. {
  2623. RemoveEffect( buffs[i] );
  2624. }
  2625.  
  2626. super.OnStartFistfightMinigame();
  2627. }
  2628.  
  2629. event OnEndFistfightMinigame()
  2630. {
  2631. super.OnEndFistfightMinigame();
  2632. }
  2633.  
  2634.  
  2635. public function GetCriticalHitChance( isLightAttack : bool, isHeavyAttack : bool, target : CActor, victimMonsterCategory : EMonsterCategory, isBolt : bool ) : float
  2636. {
  2637. var ret : float;
  2638. var thunder : W3Potion_Thunderbolt;
  2639. var min, max : SAbilityAttributeValue;
  2640.  
  2641. ret = super.GetCriticalHitChance( isLightAttack, isHeavyAttack, target, victimMonsterCategory, isBolt );
  2642.  
  2643.  
  2644.  
  2645.  
  2646.  
  2647.  
  2648.  
  2649. thunder = ( W3Potion_Thunderbolt )GetBuff( EET_Thunderbolt );
  2650. if( thunder && thunder.GetBuffLevel() == 3 && GetCurWeather() == EWE_Storm )
  2651. {
  2652. ret += 1.0f;
  2653. }
  2654.  
  2655.  
  2656. if( isBolt && IsMutationActive( EPMT_Mutation9 ) )
  2657. {
  2658. theGame.GetDefinitionsManager().GetAbilityAttributeValue('Mutation9', 'critical_hit_chance', min, max);
  2659. ret += min.valueMultiplicative;
  2660. }
  2661.  
  2662.  
  2663. if( isBolt && CanUseSkill( S_Sword_s07 ) )
  2664. {
  2665. ret += CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s07, theGame.params.CRITICAL_HIT_CHANCE, false, true)) * GetSkillLevel(S_Sword_s07);
  2666. }
  2667.  
  2668. return ret;
  2669. }
  2670.  
  2671.  
  2672. public function GetCriticalHitDamageBonus(weaponId : SItemUniqueId, victimMonsterCategory : EMonsterCategory, isStrikeAtBack : bool) : SAbilityAttributeValue
  2673. {
  2674. var min, max, bonus, null, oilBonus : SAbilityAttributeValue;
  2675. var mutagen : CBaseGameplayEffect;
  2676. var monsterBonusType : name;
  2677.  
  2678. bonus = super.GetCriticalHitDamageBonus(weaponId, victimMonsterCategory, isStrikeAtBack);
  2679.  
  2680.  
  2681. if( inv.ItemHasActiveOilApplied( weaponId, victimMonsterCategory ) && GetStat( BCS_Focus ) >= 3 && CanUseSkill( S_Alchemy_s07 ) )
  2682. {
  2683. monsterBonusType = MonsterCategoryToAttackPowerBonus( victimMonsterCategory );
  2684. oilBonus = inv.GetItemAttributeValue( weaponId, monsterBonusType );
  2685. if(oilBonus != null)
  2686. {
  2687. bonus += GetSkillAttributeValue(S_Alchemy_s07, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, true) * GetSkillLevel(S_Alchemy_s07);
  2688. }
  2689. }
  2690.  
  2691.  
  2692. if (isStrikeAtBack && HasBuff(EET_Mutagen11))
  2693. {
  2694. mutagen = GetBuff(EET_Mutagen11);
  2695. theGame.GetDefinitionsManager().GetAbilityAttributeValue(mutagen.GetAbilityName(), 'damageIncrease', min, max);
  2696. bonus += GetAttributeRandomizedValue(min, max);
  2697. }
  2698.  
  2699. return bonus;
  2700. }
  2701.  
  2702. public function ProcessLockTarget( optional newLockTarget : CActor, optional checkLeftStickHeading : bool ) : bool
  2703. {
  2704. var newLockTargetFound : bool;
  2705.  
  2706. newLockTargetFound = super.ProcessLockTarget(newLockTarget, checkLeftStickHeading);
  2707.  
  2708. if(GetCurrentlyCastSign() == ST_Axii)
  2709. {
  2710. ((W3AxiiEntity)GetCurrentSignEntity()).OnDisplayTargetChange(newLockTarget);
  2711. }
  2712.  
  2713. return newLockTargetFound;
  2714. }
  2715.  
  2716.  
  2717.  
  2718.  
  2719.  
  2720.  
  2721.  
  2722. event OnProcessActionPost(action : W3DamageAction)
  2723. {
  2724. var attackAction : W3Action_Attack;
  2725. var rendLoad : float;
  2726. var value : SAbilityAttributeValue;
  2727. var actorVictim : CActor;
  2728. var weaponId : SItemUniqueId;
  2729. var usesSteel, usesSilver, usesVitality, usesEssence : bool;
  2730. var abs : array<name>;
  2731. var i : int;
  2732. var dm : CDefinitionsManagerAccessor;
  2733. var items : array<SItemUniqueId>;
  2734. var weaponEnt : CEntity;
  2735.  
  2736. super.OnProcessActionPost(action);
  2737.  
  2738. attackAction = (W3Action_Attack)action;
  2739. actorVictim = (CActor)action.victim;
  2740.  
  2741. if(attackAction)
  2742. {
  2743. if(attackAction.IsActionMelee())
  2744. {
  2745.  
  2746. if(SkillNameToEnum(attackAction.GetAttackTypeName()) == S_Sword_s02)
  2747. {
  2748. rendLoad = GetSpecialAttackTimeRatio();
  2749.  
  2750.  
  2751. rendLoad = MinF(rendLoad * GetStatMax(BCS_Focus), GetStat(BCS_Focus));
  2752.  
  2753.  
  2754. rendLoad = FloorF(rendLoad);
  2755. DrainFocus(rendLoad);
  2756.  
  2757. OnSpecialAttackHeavyActionProcess();
  2758. }
  2759. else if(actorVictim && IsRequiredAttitudeBetween(this, actorVictim, true))
  2760. {
  2761.  
  2762.  
  2763. value = GetAttributeValue('focus_gain');
  2764.  
  2765. if( FactsQuerySum("debug_fact_focus_boy") > 0 )
  2766. {
  2767. Debug_FocusBoyFocusGain();
  2768. }
  2769.  
  2770.  
  2771. if ( CanUseSkill(S_Sword_s20) )
  2772. {
  2773. value += GetSkillAttributeValue(S_Sword_s20, 'focus_gain', false, true) * GetSkillLevel(S_Sword_s20);
  2774. }
  2775.  
  2776.  
  2777. if( IsMutationActive( EPMT_Mutation3 ) && IsRequiredAttitudeBetween( this, action.victim, true ) && !action.victim.HasTag( 'Mutation3InvalidTarget' ) && !attackAction.IsParried() && !attackAction.WasDodged() && !attackAction.IsCountered() && !inv.IsItemFists( attackAction.GetWeaponId() ) && !attackAction.WasDamageReturnedToAttacker() && attackAction.DealtDamage() )
  2778. {
  2779. AddEffectDefault( EET_Mutation3, this, "", false );
  2780. }
  2781.  
  2782. GainStat(BCS_Focus, 0.1f * (1 + CalculateAttributeValue(value)) );
  2783. }
  2784.  
  2785.  
  2786. weaponId = attackAction.GetWeaponId();
  2787. if(actorVictim && (ShouldProcessTutorial('TutorialWrongSwordSteel') || ShouldProcessTutorial('TutorialWrongSwordSilver')) && GetAttitudeBetween(actorVictim, this) == AIA_Hostile)
  2788. {
  2789. usesSteel = inv.IsItemSteelSwordUsableByPlayer(weaponId);
  2790. usesSilver = inv.IsItemSilverSwordUsableByPlayer(weaponId);
  2791. usesVitality = actorVictim.UsesVitality();
  2792. usesEssence = actorVictim.UsesEssence();
  2793.  
  2794. if(usesSilver && usesVitality)
  2795. {
  2796. FactsAdd('tut_wrong_sword_silver',1);
  2797. }
  2798. else if(usesSteel && usesEssence)
  2799. {
  2800. FactsAdd('tut_wrong_sword_steel',1);
  2801. }
  2802. else if(FactsQuerySum('tut_wrong_sword_steel') && usesSilver && usesEssence)
  2803. {
  2804. FactsAdd('tut_proper_sword_silver',1);
  2805. FactsRemove('tut_wrong_sword_steel');
  2806. }
  2807. else if(FactsQuerySum('tut_wrong_sword_silver') && usesSteel && usesVitality)
  2808. {
  2809. FactsAdd('tut_proper_sword_steel',1);
  2810. FactsRemove('tut_wrong_sword_silver');
  2811. }
  2812. }
  2813.  
  2814.  
  2815. if(!action.WasDodged() && HasAbility('Runeword 1 _Stats', true))
  2816. {
  2817. if(runewordInfusionType == ST_Axii)
  2818. {
  2819. actorVictim.SoundEvent('sign_axii_release');
  2820. }
  2821. else if(runewordInfusionType == ST_Igni)
  2822. {
  2823. actorVictim.SoundEvent('sign_igni_charge_begin');
  2824. }
  2825. else if(runewordInfusionType == ST_Quen)
  2826. {
  2827. value = GetAttributeValue('runeword1_quen_heal');
  2828. Heal( action.GetDamageDealt() * value.valueMultiplicative );
  2829. PlayEffectSingle('drain_energy_caretaker_shovel');
  2830. }
  2831. else if(runewordInfusionType == ST_Yrden)
  2832. {
  2833. actorVictim.SoundEvent('sign_yrden_shock_activate');
  2834. }
  2835. runewordInfusionType = ST_None;
  2836.  
  2837.  
  2838. items = inv.GetHeldWeapons();
  2839. weaponEnt = inv.GetItemEntityUnsafe(items[0]);
  2840. weaponEnt.StopEffect('runeword_aard');
  2841. weaponEnt.StopEffect('runeword_axii');
  2842. weaponEnt.StopEffect('runeword_igni');
  2843. weaponEnt.StopEffect('runeword_quen');
  2844. weaponEnt.StopEffect('runeword_yrden');
  2845. }
  2846.  
  2847.  
  2848. if(ShouldProcessTutorial('TutorialLightAttacks') || ShouldProcessTutorial('TutorialHeavyAttacks'))
  2849. {
  2850. if(IsLightAttack(attackAction.GetAttackName()))
  2851. {
  2852. theGame.GetTutorialSystem().IncreaseGeraltsLightAttacksCount(action.victim.GetTags());
  2853. }
  2854. else if(IsHeavyAttack(attackAction.GetAttackName()))
  2855. {
  2856. theGame.GetTutorialSystem().IncreaseGeraltsHeavyAttacksCount(action.victim.GetTags());
  2857. }
  2858. }
  2859. }
  2860. else if(attackAction.IsActionRanged())
  2861. {
  2862.  
  2863. if(CanUseSkill(S_Sword_s15))
  2864. {
  2865. value = GetSkillAttributeValue(S_Sword_s15, 'focus_gain', false, true) * GetSkillLevel(S_Sword_s15) ;
  2866. GainStat(BCS_Focus, CalculateAttributeValue(value) );
  2867. }
  2868.  
  2869.  
  2870. if(CanUseSkill(S_Sword_s12) && attackAction.IsCriticalHit() && actorVictim)
  2871. {
  2872.  
  2873. actorVictim.GetCharacterStats().GetAbilities(abs, false);
  2874. dm = theGame.GetDefinitionsManager();
  2875. for(i=abs.Size()-1; i>=0; i-=1)
  2876. {
  2877. if(!dm.AbilityHasTag(abs[i], theGame.params.TAG_MONSTER_SKILL) || actorVictim.IsAbilityBlocked(abs[i]))
  2878. {
  2879. abs.EraseFast(i);
  2880. }
  2881. }
  2882.  
  2883.  
  2884. if(abs.Size() > 0)
  2885. {
  2886. value = GetSkillAttributeValue(S_Sword_s12, 'duration', true, true) * GetSkillLevel(S_Sword_s12);
  2887. actorVictim.BlockAbility(abs[ RandRange(abs.Size()) ], true, CalculateAttributeValue(value));
  2888. }
  2889. }
  2890. }
  2891. }
  2892.  
  2893.  
  2894. if( IsMutationActive( EPMT_Mutation10 ) && actorVictim && ( action.IsActionMelee() || action.IsActionWitcherSign() ) && !IsCurrentSignChanneled() )
  2895. {
  2896. PlayEffectSingle( 'mutation_10_energy' );
  2897. }
  2898.  
  2899.  
  2900. if(CanUseSkill(S_Perk_18) && ((W3Petard)action.causer) && action.DealsAnyDamage() && !action.IsDoTDamage())
  2901. {
  2902. value = GetSkillAttributeValue(S_Perk_18, 'focus_gain', false, true);
  2903. GainStat(BCS_Focus, CalculateAttributeValue(value));
  2904. }
  2905.  
  2906.  
  2907. if( attackAction && IsHeavyAttack( attackAction.GetAttackName() ) && !IsUsingHorse() && attackAction.DealtDamage() && IsSetBonusActive( EISB_Lynx_1 ) && !attackAction.WasDodged() && !attackAction.IsParried() && !attackAction.IsCountered() && ( inv.IsItemSteelSwordUsableByPlayer( attackAction.GetWeaponId() ) || inv.IsItemSilverSwordUsableByPlayer( attackAction.GetWeaponId() ) ) )
  2908. {
  2909. AddEffectDefault( EET_LynxSetBonus, NULL, "HeavyAttack" );
  2910. SoundEvent( "ep2_setskill_lynx_activate" );
  2911. }
  2912. }
  2913.  
  2914.  
  2915. timer function Mutagen14Timer(dt : float, id : int)
  2916. {
  2917. var abilityName : name;
  2918. var abilityCount, maxStack : float;
  2919. var min, max : SAbilityAttributeValue;
  2920. var addAbility : bool;
  2921.  
  2922. abilityName = GetBuff(EET_Mutagen14).GetAbilityName();
  2923. abilityCount = GetAbilityCount(abilityName);
  2924.  
  2925. if(abilityCount == 0)
  2926. {
  2927. addAbility = true;
  2928. }
  2929. else
  2930. {
  2931. theGame.GetDefinitionsManager().GetAbilityAttributeValue(abilityName, 'mutagen14_max_stack', min, max);
  2932. maxStack = CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  2933.  
  2934. if(maxStack >= 0)
  2935. {
  2936. addAbility = (abilityCount < maxStack);
  2937. }
  2938. else
  2939. {
  2940. addAbility = true;
  2941. }
  2942. }
  2943.  
  2944. if(addAbility)
  2945. {
  2946. AddAbility(abilityName, true);
  2947. }
  2948. else
  2949. {
  2950.  
  2951. RemoveTimer('Mutagen14Timer');
  2952. }
  2953. }
  2954.  
  2955. public final function FailFundamentalsFirstAchievementCondition()
  2956. {
  2957. SetFailedFundamentalsFirstAchievementCondition(true);
  2958. }
  2959.  
  2960. public final function SetUsedQuenInCombat()
  2961. {
  2962. usedQuenInCombat = true;
  2963. }
  2964.  
  2965. public final function UsedQuenInCombat() : bool
  2966. {
  2967. return usedQuenInCombat;
  2968. }
  2969.  
  2970. event OnCombatStart()
  2971. {
  2972. var quenEntity, glyphQuen : W3QuenEntity;
  2973. var focus, stamina : float;
  2974. var glowTargets, moTargets, actors : array< CActor >;
  2975. var delays : array< float >;
  2976. var rand, i : int;
  2977. var isHostile, isAlive, isUnconscious : bool;
  2978.  
  2979. super.OnCombatStart();
  2980.  
  2981. if ( IsInCombatActionFriendly() )
  2982. {
  2983. SetBIsCombatActionAllowed(true);
  2984. SetBIsInputAllowed(true, 'OnCombatActionStart' );
  2985. }
  2986.  
  2987.  
  2988. if(HasBuff(EET_Mutagen14))
  2989. {
  2990. AddTimer('Mutagen14Timer', 2, true);
  2991. }
  2992.  
  2993.  
  2994. if(HasBuff(EET_Mutagen15))
  2995. {
  2996. AddAbility(GetBuff(EET_Mutagen15).GetAbilityName(), false);
  2997. }
  2998.  
  2999.  
  3000. mutation12IsOnCooldown = false;
  3001.  
  3002.  
  3003. quenEntity = (W3QuenEntity)signs[ST_Quen].entity;
  3004.  
  3005.  
  3006. if(quenEntity)
  3007. {
  3008. usedQuenInCombat = quenEntity.IsAnyQuenActive();
  3009. }
  3010. else
  3011. {
  3012. usedQuenInCombat = false;
  3013. }
  3014.  
  3015. if(usedQuenInCombat || HasPotionBuff() || IsEquippedSwordUpgradedWithOil(true) || IsEquippedSwordUpgradedWithOil(false))
  3016. {
  3017. SetFailedFundamentalsFirstAchievementCondition(true);
  3018. }
  3019. else
  3020. {
  3021. if(IsAnyItemEquippedOnSlot(EES_PotionMutagen1) || IsAnyItemEquippedOnSlot(EES_PotionMutagen2) || IsAnyItemEquippedOnSlot(EES_PotionMutagen3) || IsAnyItemEquippedOnSlot(EES_PotionMutagen4))
  3022. SetFailedFundamentalsFirstAchievementCondition(true);
  3023. else
  3024. SetFailedFundamentalsFirstAchievementCondition(false);
  3025. }
  3026.  
  3027. if(CanUseSkill(S_Sword_s20) && IsThreatened())
  3028. {
  3029. focus = GetStat(BCS_Focus);
  3030. if(focus < 1)
  3031. {
  3032. GainStat(BCS_Focus, 1 - focus);
  3033. }
  3034. }
  3035.  
  3036. if ( HasAbility('Glyphword 17 _Stats', true) && RandF() < CalculateAttributeValue(GetAttributeValue('quen_apply_chance')) )
  3037. {
  3038. stamina = GetStat(BCS_Stamina);
  3039. glyphQuen = (W3QuenEntity)theGame.CreateEntity( signs[ST_Quen].template, GetWorldPosition(), GetWorldRotation() );
  3040. glyphQuen.Init( signOwner, signs[ST_Quen].entity, true );
  3041. glyphQuen.OnStarted();
  3042. glyphQuen.OnThrowing();
  3043. glyphQuen.OnEnded();
  3044. ForceSetStat(BCS_Stamina, stamina);
  3045. }
  3046.  
  3047.  
  3048. MeditationForceAbort(true);
  3049.  
  3050.  
  3051.  
  3052.  
  3053.  
  3054. if( IsMutationActive( EPMT_Mutation4 ) )
  3055. {
  3056. AddEffectDefault( EET_Mutation4, this, "combat start", false );
  3057. }
  3058. if( IsMutationActive( EPMT_Mutation5 ) && GetStat( BCS_Focus ) >= 1.f ) //zur13 modSSS
  3059. {
  3060. AddEffectDefault( EET_Mutation5, this, "", false );
  3061. }
  3062.  
  3063. if( IsMutationActive( EPMT_Mutation7 ) ) //zur13 modSSS
  3064. {
  3065.  
  3066.  
  3067. RemoveTimer( 'Mutation7CombatStartHackFixGo' );
  3068.  
  3069.  
  3070. AddTimer( 'Mutation7CombatStartHackFix', 1.f, true, , , , true );
  3071.  
  3072. }
  3073. if( IsMutationActive( EPMT_Mutation8 ) ) //zur13 modSSS
  3074. {
  3075. theGame.MutationHUDFeedback( MFT_PlayRepeat );
  3076. }
  3077.  
  3078. if( IsMutationActive( EPMT_Mutation10 ) ) //zur13 modSSS
  3079. {
  3080. if( !HasBuff( EET_Mutation10 ) && GetStat( BCS_Toxicity ) > 0.f )
  3081. {
  3082. AddEffectDefault( EET_Mutation10, this, "Mutation 10" );
  3083. }
  3084.  
  3085.  
  3086. PlayEffect( 'mutation_10' );
  3087.  
  3088.  
  3089. PlayEffect( 'critical_toxicity' );
  3090. AddTimer( 'Mutation10StopEffect', 5.f );
  3091. }
  3092. }
  3093.  
  3094. timer function Mutation7CombatStartHackFix( dt : float, id : int )
  3095. {
  3096. var actors : array< CActor >;
  3097.  
  3098. actors = GetEnemies();
  3099.  
  3100. if( actors.Size() > 0 )
  3101. {
  3102.  
  3103. AddTimer( 'Mutation7CombatStartHackFixGo', 0.5f );
  3104. RemoveTimer( 'Mutation7CombatStartHackFix' );
  3105. }
  3106. }
  3107.  
  3108. timer function Mutation7CombatStartHackFixGo( dt : float, id : int )
  3109. {
  3110. var actors : array< CActor >;
  3111.  
  3112. if( IsMutationActive( EPMT_Mutation7 ) )
  3113. {
  3114. actors = GetEnemies();
  3115.  
  3116. if( actors.Size() > 1 )
  3117. {
  3118. AddEffectDefault( EET_Mutation7Buff, this, "Mutation 7, combat start" );
  3119. }
  3120. }
  3121. }
  3122.  
  3123. public final function IsInFistFight() : bool
  3124. {
  3125. var enemies : array< CActor >;
  3126. var i, j : int;
  3127. var invent : CInventoryComponent;
  3128. var weapons : array< SItemUniqueId >;
  3129.  
  3130. if( IsInFistFightMiniGame() )
  3131. {
  3132. return true;
  3133. }
  3134.  
  3135. enemies = GetEnemies();
  3136. for( i=0; i<enemies.Size(); i+=1 )
  3137. {
  3138. weapons.Clear();
  3139. invent = enemies[i].GetInventory();
  3140. weapons = invent.GetHeldWeapons();
  3141.  
  3142. for( j=0; j<weapons.Size(); j+=1 )
  3143. {
  3144. if( invent.IsItemFists( weapons[j] ) )
  3145. {
  3146. return true;
  3147. }
  3148. }
  3149. }
  3150.  
  3151. return false;
  3152. }
  3153.  
  3154. timer function Mutation10StopEffect( dt : float, id : int )
  3155. {
  3156. StopEffect( 'critical_toxicity' );
  3157. }
  3158.  
  3159.  
  3160. event OnCombatFinished()
  3161. {
  3162. var mut17 : W3Mutagen17_Effect;
  3163. var inGameConfigWrapper : CInGameConfigWrapper;
  3164. var disableAutoSheathe : bool;
  3165.  
  3166. super.OnCombatFinished();
  3167.  
  3168.  
  3169. if(HasBuff(EET_Mutagen10))
  3170. {
  3171. RemoveAbilityAll( GetBuff(EET_Mutagen10).GetAbilityName() );
  3172. }
  3173.  
  3174.  
  3175. if(HasBuff(EET_Mutagen14))
  3176. {
  3177. RemoveAbilityAll( GetBuff(EET_Mutagen14).GetAbilityName() );
  3178. }
  3179.  
  3180.  
  3181. if(HasBuff(EET_Mutagen15))
  3182. {
  3183. RemoveAbilityAll( GetBuff(EET_Mutagen15).GetAbilityName() );
  3184. }
  3185.  
  3186.  
  3187. if(HasBuff(EET_Mutagen17))
  3188. {
  3189. mut17 = (W3Mutagen17_Effect)GetBuff(EET_Mutagen17);
  3190. mut17.ClearBoost();
  3191. }
  3192.  
  3193.  
  3194. if(HasBuff(EET_Mutagen18))
  3195. {
  3196. RemoveAbilityAll( GetBuff(EET_Mutagen18).GetAbilityName() );
  3197. }
  3198.  
  3199.  
  3200. if(HasBuff(EET_Mutagen22))
  3201. {
  3202. RemoveAbilityAll( GetBuff(EET_Mutagen22).GetAbilityName() );
  3203. }
  3204.  
  3205.  
  3206. if(HasBuff(EET_Mutagen27))
  3207. {
  3208. RemoveAbilityAll( GetBuff(EET_Mutagen27).GetAbilityName() );
  3209. }
  3210.  
  3211.  
  3212. RemoveBuff( EET_Mutation3 );
  3213.  
  3214.  
  3215. RemoveBuff( EET_Mutation4 );
  3216.  
  3217.  
  3218. RemoveBuff( EET_Mutation5 );
  3219.  
  3220.  
  3221. RemoveBuff( EET_Mutation7Buff );
  3222. RemoveBuff( EET_Mutation7Debuff );
  3223.  
  3224. if( IsMutationActive( EPMT_Mutation7 ) )
  3225. {
  3226. theGame.MutationHUDFeedback( MFT_PlayHide );
  3227. }
  3228. if( IsMutationActive( EPMT_Mutation8 ) ) //zur13 modSSS
  3229. {
  3230. theGame.MutationHUDFeedback( MFT_PlayHide );
  3231. }
  3232.  
  3233.  
  3234. RemoveBuff( EET_Mutation10 );
  3235.  
  3236.  
  3237. RemoveBuff( EET_LynxSetBonus );
  3238.  
  3239.  
  3240. if(GetStat(BCS_Focus) > 0)
  3241. {
  3242. AddTimer('DelayedAdrenalineDrain', theGame.params.ADRENALINE_DRAIN_AFTER_COMBAT_DELAY, , , , true);
  3243. }
  3244.  
  3245.  
  3246. thePlayer.abilityManager.ResetOverhealBonus();
  3247.  
  3248. usedQuenInCombat = false;
  3249.  
  3250. theGame.GetGamerProfile().ResetStat(ES_FinesseKills);
  3251.  
  3252. LogChannel( 'OnCombatFinished', "OnCombatFinished: DelayedSheathSword timer added" );
  3253.  
  3254.  
  3255. inGameConfigWrapper = (CInGameConfigWrapper)theGame.GetInGameConfigWrapper();
  3256. disableAutoSheathe = inGameConfigWrapper.GetVarValue( 'Gameplay', 'DisableAutomaticSwordSheathe' );
  3257. if( !disableAutoSheathe )
  3258. {
  3259. if ( ShouldAutoSheathSwordInstantly() )
  3260. AddTimer( 'DelayedSheathSword', 0.5f );
  3261. else
  3262. AddTimer( 'DelayedSheathSword', 2.f );
  3263. }
  3264.  
  3265. OnBlockAllCombatTickets( false );
  3266.  
  3267.  
  3268. runewordInfusionType = ST_None;
  3269.  
  3270.  
  3271.  
  3272.  
  3273.  
  3274. }
  3275.  
  3276. public function PlayHitEffect( damageAction : W3DamageAction )
  3277. {
  3278. var hitReactionType : EHitReactionType;
  3279. var isAtBack : bool;
  3280.  
  3281.  
  3282. if( damageAction.GetMutation4Triggered() )
  3283. {
  3284. hitReactionType = damageAction.GetHitReactionType();
  3285. isAtBack = IsAttackerAtBack( damageAction.attacker );
  3286.  
  3287. if( hitReactionType != EHRT_Heavy )
  3288. {
  3289. if( isAtBack )
  3290. {
  3291. damageAction.SetHitEffect( 'light_hit_back_toxic', true );
  3292. }
  3293. else
  3294. {
  3295. damageAction.SetHitEffect( 'light_hit_toxic' );
  3296. }
  3297. }
  3298. else
  3299. {
  3300. if( isAtBack )
  3301. {
  3302. damageAction.SetHitEffect( 'heavy_hit_back_toxic' ,true );
  3303. }
  3304. else
  3305. {
  3306. damageAction.SetHitEffect( 'heavy_hit_toxic' );
  3307. }
  3308. }
  3309. }
  3310.  
  3311. super.PlayHitEffect( damageAction );
  3312. }
  3313.  
  3314. timer function DelayedAdrenalineDrain(dt : float, id : int)
  3315. {
  3316. if ( !HasBuff(EET_Runeword8) )
  3317. AddEffectDefault(EET_AdrenalineDrain, this, "after_combat_adrenaline_drain");
  3318. }
  3319.  
  3320.  
  3321. protected function Attack( hitTarget : CGameplayEntity, animData : CPreAttackEventData, weaponId : SItemUniqueId, parried : bool, countered : bool, parriedBy : array<CActor>, attackAnimationName : name, hitTime : float, weaponEntity : CItemEntity)
  3322. {
  3323. var mutagen17 : W3Mutagen17_Effect;
  3324.  
  3325. super.Attack(hitTarget, animData, weaponId, parried, countered, parriedBy, attackAnimationName, hitTime, weaponEntity);
  3326.  
  3327. if( (CActor)hitTarget && HasBuff(EET_Mutagen17) )
  3328. {
  3329. mutagen17 = (W3Mutagen17_Effect)GetBuff(EET_Mutagen17);
  3330. if(mutagen17.HasBoost())
  3331. {
  3332. mutagen17.ClearBoost();
  3333. }
  3334. }
  3335. }
  3336.  
  3337. public final timer function SpecialAttackLightSustainCost(dt : float, id : int)
  3338. {
  3339. var focusPerSec, cost, delay : float;
  3340. var reduction : SAbilityAttributeValue;
  3341. var skillLevel : int;
  3342.  
  3343. if(abilityManager && abilityManager.IsInitialized() && IsAlive())
  3344. {
  3345. PauseStaminaRegen('WhirlSkill');
  3346.  
  3347. if(GetStat(BCS_Stamina) > 0)
  3348. {
  3349. cost = GetStaminaActionCost(ESAT_Ability, GetSkillAbilityName(S_Sword_s01), dt);
  3350. delay = GetStaminaActionDelay(ESAT_Ability, GetSkillAbilityName(S_Sword_s01), dt);
  3351. skillLevel = GetSkillLevel(S_Sword_s01);
  3352.  
  3353. if(skillLevel > 1)
  3354. {
  3355. reduction = GetSkillAttributeValue(S_Sword_s01, 'cost_reduction', false, true) * (skillLevel - 1);
  3356. cost = MaxF(0, cost * (1 - reduction.valueMultiplicative) - reduction.valueAdditive);
  3357. }
  3358.  
  3359. DrainStamina(ESAT_FixedValue, cost, delay, GetSkillAbilityName(S_Sword_s01));
  3360. }
  3361. else
  3362. {
  3363. GetSkillAttributeValue(S_Sword_s01, 'focus_cost_per_sec', false, true);
  3364. focusPerSec = GetWhirlFocusCostPerSec();
  3365. DrainFocus(focusPerSec * dt);
  3366. }
  3367. }
  3368.  
  3369. if(GetStat(BCS_Stamina) <= 0 && GetStat(BCS_Focus) <= 0)
  3370. {
  3371. OnPerformSpecialAttack(true, false);
  3372. }
  3373. }
  3374.  
  3375. public final function GetWhirlFocusCostPerSec() : float
  3376. {
  3377. var ability : SAbilityAttributeValue;
  3378. var val : float;
  3379. var skillLevel : int;
  3380.  
  3381. ability = GetSkillAttributeValue(S_Sword_s01, 'focus_cost_per_sec_initial', false, false);
  3382. skillLevel = GetSkillLevel(S_Sword_s01);
  3383.  
  3384. if(skillLevel > 1)
  3385. ability -= GetSkillAttributeValue(S_Sword_s01, 'cost_reduction', false, false) * (skillLevel-1);
  3386.  
  3387. val = CalculateAttributeValue(ability);
  3388.  
  3389. return val;
  3390. }
  3391.  
  3392. public final timer function SpecialAttackHeavySustainCost(dt : float, id : int)
  3393. {
  3394. var focusHighlight, ratio : float;
  3395. var hud : CR4ScriptedHud;
  3396. var hudWolfHeadModule : CR4HudModuleWolfHead;
  3397.  
  3398.  
  3399. DrainStamina(ESAT_Ability, 0, 0, GetSkillAbilityName(S_Sword_s02), dt);
  3400.  
  3401.  
  3402. if(GetStat(BCS_Stamina) <= 0)
  3403. OnPerformSpecialAttack(false, false);
  3404.  
  3405.  
  3406. ratio = EngineTimeToFloat(theGame.GetEngineTime() - specialHeavyStartEngineTime) / specialHeavyChargeDuration;
  3407.  
  3408.  
  3409. if(ratio > 0.95)
  3410. ratio = 1;
  3411.  
  3412. SetSpecialAttackTimeRatio(ratio);
  3413.  
  3414.  
  3415.  
  3416.  
  3417.  
  3418. }
  3419.  
  3420. public function OnSpecialAttackHeavyActionProcess()
  3421. {
  3422. var hud : CR4ScriptedHud;
  3423. var hudWolfHeadModule : CR4HudModuleWolfHead;
  3424.  
  3425. super.OnSpecialAttackHeavyActionProcess();
  3426.  
  3427. hud = (CR4ScriptedHud)theGame.GetHud();
  3428. if ( hud )
  3429. {
  3430. hudWolfHeadModule = (CR4HudModuleWolfHead)hud.GetHudModule( "WolfHeadModule" );
  3431. if ( hudWolfHeadModule )
  3432. {
  3433. hudWolfHeadModule.ResetFocusPoints();
  3434. }
  3435. }
  3436. }
  3437.  
  3438. timer function IsSpecialLightAttackInputHeld ( time : float, id : int )
  3439. {
  3440. var hasResource : bool;
  3441.  
  3442. if ( GetCurrentStateName() == 'CombatSteel' || GetCurrentStateName() == 'CombatSilver' )
  3443. {
  3444. if ( GetBIsCombatActionAllowed() && inputHandler.IsActionAllowed(EIAB_SwordAttack))
  3445. {
  3446. if(GetStat(BCS_Stamina) > 0)
  3447. {
  3448. hasResource = true;
  3449. }
  3450. else
  3451. {
  3452. hasResource = (GetStat(BCS_Focus) >= GetWhirlFocusCostPerSec() * time);
  3453. }
  3454.  
  3455. if(hasResource)
  3456. {
  3457. SetupCombatAction( EBAT_SpecialAttack_Light, BS_Pressed );
  3458. RemoveTimer('IsSpecialLightAttackInputHeld');
  3459. }
  3460. else if(!playedSpecialAttackMissingResourceSound)
  3461. {
  3462. IndicateTooLowAdrenaline();
  3463. playedSpecialAttackMissingResourceSound = true;
  3464. }
  3465. }
  3466. }
  3467. else
  3468. {
  3469. RemoveTimer('IsSpecialLightAttackInputHeld');
  3470. }
  3471. }
  3472.  
  3473. timer function IsSpecialHeavyAttackInputHeld ( time : float, id : int )
  3474. {
  3475. var cost : float;
  3476.  
  3477. if ( GetCurrentStateName() == 'CombatSteel' || GetCurrentStateName() == 'CombatSilver' )
  3478. {
  3479. cost = CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s02, 'stamina_cost_per_sec', false, false));
  3480.  
  3481. if( GetBIsCombatActionAllowed() && inputHandler.IsActionAllowed(EIAB_SwordAttack))
  3482. {
  3483. if(GetStat(BCS_Stamina) >= cost)
  3484. {
  3485. SetupCombatAction( EBAT_SpecialAttack_Heavy, BS_Pressed );
  3486. RemoveTimer('IsSpecialHeavyAttackInputHeld');
  3487. theGame.HapticStart( "haptic_rend_stop" );
  3488. }
  3489. else if(!playedSpecialAttackMissingResourceSound)
  3490. {
  3491. IndicateTooLowAdrenaline();
  3492. playedSpecialAttackMissingResourceSound = true;
  3493. theGame.HapticStart( "haptic_rend_stop" );
  3494. }
  3495. }
  3496. }
  3497. else
  3498. {
  3499. RemoveTimer('IsSpecialHeavyAttackInputHeld');
  3500. theGame.HapticStart( "haptic_rend_stop" );
  3501. }
  3502. }
  3503.  
  3504. public function EvadePressed( bufferAction : EBufferActionType )
  3505. {
  3506. var cat : float;
  3507.  
  3508. if( (bufferAction == EBAT_Dodge && IsActionAllowed(EIAB_Dodge)) || (bufferAction == EBAT_Roll && IsActionAllowed(EIAB_Roll)) )
  3509. {
  3510.  
  3511. if(bufferAction != EBAT_Roll && ShouldProcessTutorial('TutorialDodge'))
  3512. {
  3513. FactsAdd("tut_in_dodge", 1, 2);
  3514.  
  3515. if(FactsQuerySum("tut_fight_use_slomo") > 0)
  3516. {
  3517. theGame.RemoveTimeScale( theGame.GetTimescaleSource(ETS_TutorialFight) );
  3518. FactsRemove("tut_fight_slomo_ON");
  3519. }
  3520. }
  3521. else if(bufferAction == EBAT_Roll && ShouldProcessTutorial('TutorialRoll'))
  3522. {
  3523. FactsAdd("tut_in_roll", 1, 2);
  3524.  
  3525. if(FactsQuerySum("tut_fight_use_slomo") > 0)
  3526. {
  3527. theGame.RemoveTimeScale( theGame.GetTimescaleSource(ETS_TutorialFight) );
  3528. FactsRemove("tut_fight_slomo_ON");
  3529. }
  3530. }
  3531.  
  3532. if ( GetBIsInputAllowed() )
  3533. {
  3534. if ( GetBIsCombatActionAllowed() )
  3535. {
  3536. CriticalEffectAnimationInterrupted("Dodge 2");
  3537. PushCombatActionOnBuffer( bufferAction, BS_Released );
  3538. ProcessCombatActionBuffer();
  3539. }
  3540. else if ( IsInCombatAction() && GetBehaviorVariable( 'combatActionType' ) == (int)CAT_Attack )
  3541. {
  3542. if ( CanPlayHitAnim() && IsThreatened() )
  3543. {
  3544. CriticalEffectAnimationInterrupted("Dodge 1");
  3545. PushCombatActionOnBuffer( bufferAction, BS_Released );
  3546. ProcessCombatActionBuffer();
  3547. }
  3548. else
  3549. PushCombatActionOnBuffer( bufferAction, BS_Released );
  3550. }
  3551.  
  3552. else if ( !( IsCurrentSignChanneled() ) )
  3553. {
  3554.  
  3555. PushCombatActionOnBuffer( bufferAction, BS_Released );
  3556. }
  3557. }
  3558. else
  3559. {
  3560. if ( IsInCombatAction() && GetBehaviorVariable( 'combatActionType' ) == (int)CAT_Attack )
  3561. {
  3562. if ( CanPlayHitAnim() && IsThreatened() )
  3563. {
  3564. CriticalEffectAnimationInterrupted("Dodge 3");
  3565. PushCombatActionOnBuffer( bufferAction, BS_Released );
  3566. ProcessCombatActionBuffer();
  3567. }
  3568. else
  3569. PushCombatActionOnBuffer( bufferAction, BS_Released );
  3570. }
  3571. LogChannel( 'InputNotAllowed', "InputNotAllowed" );
  3572. }
  3573. }
  3574. else
  3575. {
  3576. DisplayActionDisallowedHudMessage(EIAB_Dodge);
  3577. }
  3578. }
  3579.  
  3580.  
  3581. public function ProcessCombatActionBuffer() : bool
  3582. {
  3583. var action : EBufferActionType = this.BufferCombatAction;
  3584. var stage : EButtonStage = this.BufferButtonStage;
  3585. var throwStage : EThrowStage;
  3586. var actionResult : bool = true;
  3587.  
  3588.  
  3589. if( isInFinisher )
  3590. {
  3591. return false;
  3592. }
  3593.  
  3594. if ( action != EBAT_SpecialAttack_Heavy )
  3595. specialAttackCamera = false;
  3596.  
  3597.  
  3598. if(super.ProcessCombatActionBuffer())
  3599. return true;
  3600.  
  3601. switch ( action )
  3602. {
  3603. case EBAT_CastSign :
  3604. {
  3605. switch ( stage )
  3606. {
  3607. case BS_Pressed :
  3608. {
  3609.  
  3610.  
  3611.  
  3612.  
  3613.  
  3614.  
  3615. actionResult = this.CastSign();
  3616. LogChannel('SignDebug', "CastSign()");
  3617.  
  3618.  
  3619. } break;
  3620.  
  3621. default :
  3622. {
  3623. actionResult = false;
  3624. } break;
  3625. }
  3626. } break;
  3627.  
  3628. case EBAT_SpecialAttack_Light :
  3629. {
  3630. switch ( stage )
  3631. {
  3632. case BS_Pressed :
  3633. {
  3634.  
  3635. actionResult = this.OnPerformSpecialAttack( true, true );
  3636. } break;
  3637.  
  3638. case BS_Released :
  3639. {
  3640. actionResult = this.OnPerformSpecialAttack( true, false );
  3641. } break;
  3642.  
  3643. default :
  3644. {
  3645. actionResult = false;
  3646. } break;
  3647. }
  3648. } break;
  3649.  
  3650. case EBAT_SpecialAttack_Heavy :
  3651. {
  3652. switch ( stage )
  3653. {
  3654. case BS_Pressed :
  3655. {
  3656.  
  3657. actionResult = this.OnPerformSpecialAttack( false, true );
  3658. } break;
  3659.  
  3660. case BS_Released :
  3661. {
  3662. actionResult = this.OnPerformSpecialAttack( false, false );
  3663. } break;
  3664.  
  3665. default :
  3666. {
  3667. actionResult = false;
  3668. } break;
  3669. }
  3670. } break;
  3671.  
  3672. default:
  3673. return false;
  3674. }
  3675.  
  3676.  
  3677. this.CleanCombatActionBuffer();
  3678.  
  3679. if (actionResult)
  3680. {
  3681. SetCombatAction( action ) ;
  3682. }
  3683.  
  3684. return true;
  3685. }
  3686.  
  3687.  
  3688. event OnPerformSpecialAttack( isLightAttack : bool, enableAttack : bool ){}
  3689.  
  3690. public final function GetEnemies() : array< CActor >
  3691. {
  3692. var actors, actors2 : array<CActor>;
  3693. var i : int;
  3694.  
  3695.  
  3696. actors = GetWitcherPlayer().GetHostileEnemies();
  3697. ArrayOfActorsAppendUnique( actors, GetWitcherPlayer().GetMoveTargets() );
  3698.  
  3699.  
  3700. thePlayer.GetVisibleEnemies( actors2 );
  3701. ArrayOfActorsAppendUnique( actors, actors2 );
  3702.  
  3703. for( i=actors.Size()-1; i>=0; i-=1 )
  3704. {
  3705. if( !IsRequiredAttitudeBetween( actors[i], this, true ) )
  3706. {
  3707. actors.EraseFast( i );
  3708. }
  3709. }
  3710.  
  3711. return actors;
  3712. }
  3713.  
  3714. event OnPlayerTickTimer( deltaTime : float )
  3715. {
  3716. super.OnPlayerTickTimer( deltaTime );
  3717.  
  3718. if ( !IsInCombat() )
  3719. {
  3720. fastAttackCounter = 0;
  3721. heavyAttackCounter = 0;
  3722. }
  3723. }
  3724.  
  3725.  
  3726.  
  3727.  
  3728.  
  3729. 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
  3730. {
  3731. var ret : bool;
  3732. var skill : ESkill;
  3733.  
  3734. ret = super.PrepareAttackAction(hitTarget, animData, weaponId, parried, countered, parriedBy, attackAnimationName, hitTime, weaponEntity, attackAction);
  3735.  
  3736. if(!ret)
  3737. return false;
  3738.  
  3739.  
  3740. if(attackAction.IsActionMelee())
  3741. {
  3742. skill = SkillNameToEnum( attackAction.GetAttackTypeName() );
  3743. if( skill != S_SUndefined && CanUseSkill(skill))
  3744. {
  3745. if(IsLightAttack(animData.attackName))
  3746. fastAttackCounter += 1;
  3747. else
  3748. fastAttackCounter = 0;
  3749.  
  3750. if(IsHeavyAttack(animData.attackName))
  3751. heavyAttackCounter += 1;
  3752. else
  3753. heavyAttackCounter = 0;
  3754. }
  3755. }
  3756.  
  3757. AddTimer('FastAttackCounterDecay',5.0);
  3758. AddTimer('HeavyAttackCounterDecay',5.0);
  3759.  
  3760. return true;
  3761. }
  3762.  
  3763. protected function TestParryAndCounter(data : CPreAttackEventData, weaponId : SItemUniqueId, out parried : bool, out countered : bool) : array<CActor>
  3764. {
  3765.  
  3766. if(SkillNameToEnum(attackActionName) == S_Sword_s02)
  3767. data.Can_Parry_Attack = false;
  3768.  
  3769. return super.TestParryAndCounter(data, weaponId, parried, countered);
  3770. }
  3771.  
  3772. private timer function FastAttackCounterDecay(delta : float, id : int)
  3773. {
  3774. fastAttackCounter = 0;
  3775. }
  3776.  
  3777. private timer function HeavyAttackCounterDecay(delta : float, id : int)
  3778. {
  3779. heavyAttackCounter = 0;
  3780. }
  3781.  
  3782.  
  3783. public function GetCraftingSchematicsNames() : array<name> {return craftingSchematics;}
  3784.  
  3785. public function RemoveAllCraftingSchematics()
  3786. {
  3787. craftingSchematics.Clear();
  3788. }
  3789.  
  3790.  
  3791. function AddCraftingSchematic( nam : name, optional isSilent : bool, optional skipTutorialUpdate : bool ) : bool
  3792. {
  3793. var i : int;
  3794.  
  3795. if(!skipTutorialUpdate && ShouldProcessTutorial('TutorialCraftingGotRecipe'))
  3796. {
  3797. FactsAdd("tut_received_schematic");
  3798. }
  3799.  
  3800. for(i=0; i<craftingSchematics.Size(); i+=1)
  3801. {
  3802. if(craftingSchematics[i] == nam)
  3803. return false;
  3804.  
  3805.  
  3806. if(StrCmp(craftingSchematics[i],nam) > 0)
  3807. {
  3808. craftingSchematics.Insert(i,nam);
  3809. AddCraftingHudNotification( nam, isSilent );
  3810. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_CraftingSchematics );
  3811. return true;
  3812. }
  3813. }
  3814.  
  3815.  
  3816. craftingSchematics.PushBack(nam);
  3817. AddCraftingHudNotification( nam, isSilent );
  3818. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_CraftingSchematics );
  3819. return true;
  3820. }
  3821.  
  3822. function AddCraftingHudNotification( nam : name, isSilent : bool )
  3823. {
  3824. var hud : CR4ScriptedHud;
  3825. if( !isSilent )
  3826. {
  3827. hud = (CR4ScriptedHud)theGame.GetHud();
  3828. if( hud )
  3829. {
  3830. hud.OnCraftingSchematicUpdate( nam );
  3831. }
  3832. }
  3833. }
  3834.  
  3835. function AddAlchemyHudNotification( nam : name, isSilent : bool )
  3836. {
  3837. var hud : CR4ScriptedHud;
  3838. if( !isSilent )
  3839. {
  3840. hud = (CR4ScriptedHud)theGame.GetHud();
  3841. if( hud )
  3842. {
  3843. hud.OnAlchemySchematicUpdate( nam );
  3844. }
  3845. }
  3846. }
  3847.  
  3848. public function GetExpandedCraftingCategories() : array< name >
  3849. {
  3850. return expandedCraftingCategories;
  3851. }
  3852.  
  3853. public function AddExpandedCraftingCategory( category : name )
  3854. {
  3855. if ( IsNameValid( category ) )
  3856. {
  3857. ArrayOfNamesPushBackUnique( expandedCraftingCategories, category );
  3858. }
  3859. }
  3860.  
  3861. public function RemoveExpandedCraftingCategory( category : name )
  3862. {
  3863. if ( IsNameValid( category ) )
  3864. {
  3865. expandedCraftingCategories.Remove( category );
  3866. }
  3867. }
  3868.  
  3869. public function SetCraftingFilters(showHasIngre : bool, showMissingIngre : bool, showAlreadyCrafted : bool )
  3870. {
  3871. craftingFilters.showCraftable = showHasIngre;
  3872. craftingFilters.showMissingIngre = showMissingIngre;
  3873. craftingFilters.showAlreadyCrafted = showAlreadyCrafted;
  3874. }
  3875.  
  3876. public function GetCraftingFilters() : SCraftingFilters
  3877. {
  3878.  
  3879. if ( craftingFilters.showCraftable == false && craftingFilters.showMissingIngre == false && craftingFilters.showAlreadyCrafted == false )
  3880. {
  3881. craftingFilters.showCraftable = true;
  3882. craftingFilters.showMissingIngre = true;
  3883. craftingFilters.showAlreadyCrafted = false;
  3884. }
  3885.  
  3886. return craftingFilters;
  3887. }
  3888.  
  3889.  
  3890.  
  3891.  
  3892.  
  3893. event OnMutation11Triggered()
  3894. {
  3895. var min, max : SAbilityAttributeValue;
  3896. var healValue : float;
  3897. var quenEntity : W3QuenEntity;
  3898.  
  3899.  
  3900. if( IsSwimming() || IsDiving() || IsSailing() || IsUsingHorse() || IsUsingBoat() || IsUsingVehicle() || IsUsingExploration() )
  3901. {
  3902.  
  3903. ForceSetStat( BCS_Vitality, GetStatMax( BCS_Vitality ) );
  3904.  
  3905.  
  3906. theGame.MutationHUDFeedback( MFT_PlayOnce );
  3907.  
  3908.  
  3909. GCameraShake( 1.0f, , , , true, 'camera_shake_loop_lvl1_1' );
  3910. AddTimer( 'StopMutation11CamShake', 2.f );
  3911.  
  3912.  
  3913. theGame.VibrateControllerVeryHard( 2.f );
  3914.  
  3915.  
  3916. Mutation11ShockWave( true );
  3917.  
  3918.  
  3919. AddEffectDefault( EET_Mutation11Debuff, NULL, "Mutation 11 Debuff", false );
  3920. }
  3921. else
  3922. {
  3923. AddEffectDefault( EET_Mutation11Buff, this, "Mutation 11", false );
  3924. }
  3925. }
  3926.  
  3927. timer function StopMutation11CamShake( dt : float, id : int )
  3928. {
  3929. theGame.GetGameCamera().StopAnimation( 'camera_shake_loop_lvl1_1' );
  3930. }
  3931.  
  3932. private var mutation12IsOnCooldown : bool;
  3933.  
  3934. public final function AddMutation12Decoction()
  3935. {
  3936. var params : SCustomEffectParams;
  3937. var buffs : array< EEffectType >;
  3938. var existingDecoctionBuffs : array<CBaseGameplayEffect>;
  3939. var i : int;
  3940. var effectType : EEffectType;
  3941. var decoctions : array< SItemUniqueId >;
  3942. var tmpName : name;
  3943. var min, max : SAbilityAttributeValue;
  3944.  
  3945. if( mutation12IsOnCooldown )
  3946. {
  3947. return;
  3948. }
  3949.  
  3950.  
  3951. existingDecoctionBuffs = GetDrunkMutagens( "Mutation12" );
  3952. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation12', 'maxcap', min, max );
  3953. if( existingDecoctionBuffs.Size() >= min.valueAdditive )
  3954. {
  3955. return;
  3956. }
  3957.  
  3958.  
  3959. mutation12IsOnCooldown = true;
  3960. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation12', 'cooldown', min, max );
  3961. AddTimer( 'Mutation12Cooldown', CalculateAttributeValue( min ) );
  3962.  
  3963.  
  3964. decoctions = inv.GetItemsByTag( 'Mutagen' );
  3965.  
  3966.  
  3967. for( i=decoctions.Size()-1; i>=0; i-=1 )
  3968. {
  3969. inv.GetPotionItemBuffData( decoctions[i], effectType, tmpName );
  3970. if( HasBuff( effectType ) )
  3971. {
  3972. decoctions.EraseFast( i );
  3973. continue;
  3974. }
  3975. buffs.PushBack( effectType );
  3976. }
  3977.  
  3978.  
  3979. if( buffs.Size() == 0 )
  3980. {
  3981. for( i=EET_Mutagen01; i<=EET_Mutagen28; i+=1 )
  3982. {
  3983. if( !HasBuff( i ) )
  3984. {
  3985. buffs.PushBack( i );
  3986. }
  3987. }
  3988. }
  3989.  
  3990.  
  3991. buffs.Remove( EET_Mutagen16 );
  3992. buffs.Remove( EET_Mutagen24 );
  3993.  
  3994.  
  3995. if( buffs.Size() == 0 )
  3996. {
  3997. return;
  3998. }
  3999.  
  4000.  
  4001. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation12', 'duration', min, max );
  4002. params.effectType = buffs[ RandRange( buffs.Size() ) ];
  4003. params.creator = this;
  4004. params.sourceName = "Mutation12";
  4005. params.duration = min.valueAdditive;
  4006. AddEffectCustom( params );
  4007. ( ( W3Mutagen_Effect ) GetBuff( params.effectType, params.sourceName ) ).OverrideIcon( DecoctionEffectTypeToItemName( params.effectType ) );
  4008.  
  4009.  
  4010. if ( !IsEffectActive( 'invisible' ) )
  4011. {
  4012. PlayEffect( 'use_potion' );
  4013. }
  4014.  
  4015. theGame.MutationHUDFeedback( MFT_PlayOnce );
  4016. }
  4017.  
  4018. timer function Mutation12Cooldown( dt : float, id : int )
  4019. {
  4020. mutation12IsOnCooldown = false;
  4021. }
  4022.  
  4023.  
  4024. public final function HasResourcesToStartAnyMutationResearch() : bool
  4025. {
  4026. var greenPoints, redPoints, bluePoints, count : int;
  4027. var itemIDs : array< SItemUniqueId >;
  4028.  
  4029. if( levelManager.GetPointsFree( ESkillPoint ) > 0 )
  4030. {
  4031. return true;
  4032. }
  4033.  
  4034.  
  4035. count = inv.GetItemQuantityByName( 'Greater mutagen green' );
  4036. if( count > 0 )
  4037. {
  4038. itemIDs = inv.GetItemsByName( 'Greater mutagen green' );
  4039. greenPoints = inv.GetMutationResearchPoints( SC_Green, itemIDs[0] );
  4040. if( greenPoints > 0 )
  4041. {
  4042. return true;
  4043. }
  4044. }
  4045. count = inv.GetItemQuantityByName( 'Greater mutagen red' );
  4046. if( count > 0 )
  4047. {
  4048. itemIDs.Clear();
  4049. itemIDs = inv.GetItemsByName( 'Greater mutagen red' );
  4050. redPoints = inv.GetMutationResearchPoints( SC_Red, itemIDs[0] );
  4051. if( redPoints > 0 )
  4052. {
  4053. return true;
  4054. }
  4055. }
  4056. count = inv.GetItemQuantityByName( 'Greater mutagen blue' );
  4057. if( count > 0 )
  4058. {
  4059. itemIDs.Clear();
  4060. itemIDs = inv.GetItemsByName( 'Greater mutagen blue' );
  4061. bluePoints = inv.GetMutationResearchPoints( SC_Blue, itemIDs[0] );
  4062. if( bluePoints > 0 )
  4063. {
  4064. return true;
  4065. }
  4066. }
  4067.  
  4068. return false;
  4069. }
  4070.  
  4071.  
  4072. public final function Mutation11StartAnimation()
  4073. {
  4074.  
  4075. thePlayer.ActionPlaySlotAnimationAsync( 'PLAYER_SLOT', 'geralt_mutation_11', 0.2, 0.2 );
  4076.  
  4077.  
  4078. BlockAllActions( 'Mutation11', true );
  4079.  
  4080.  
  4081. loopingCameraShakeAnimName = 'camera_shake_loop_lvl1_1';
  4082. GCameraShake( 1.0f, , , , true, loopingCameraShakeAnimName );
  4083.  
  4084.  
  4085. theGame.VibrateControllerVeryHard( 15.f );
  4086.  
  4087.  
  4088. storedInteractionPriority = GetInteractionPriority();
  4089. SetInteractionPriority( IP_Max_Unpushable );
  4090. }
  4091.  
  4092. event OnAnimEvent_Mutation11ShockWave( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4093. {
  4094. Mutation11ShockWave( false );
  4095. }
  4096.  
  4097. private final function Mutation11ShockWave( skipQuenSign : bool )
  4098. {
  4099. var action : W3DamageAction;
  4100. var ents : array< CGameplayEntity >;
  4101. var i, j : int;
  4102. var damages : array< SRawDamage >;
  4103.  
  4104.  
  4105. FindGameplayEntitiesInSphere(ents, GetWorldPosition(), 5.f, 1000, '', FLAG_OnlyAliveActors + FLAG_ExcludeTarget + FLAG_Attitude_Hostile + FLAG_Attitude_Neutral, this);
  4106.  
  4107. if( ents.Size() > 0 )
  4108. {
  4109. damages = theGame.GetDefinitionsManager().GetDamagesFromAbility( 'Mutation11' );
  4110. }
  4111.  
  4112.  
  4113. for(i=0; i<ents.Size(); i+=1)
  4114. {
  4115. action = new W3DamageAction in theGame;
  4116. action.Initialize( this, ents[i], NULL, "Mutation11", EHRT_Heavy, CPS_SpellPower, false, false, true, false );
  4117.  
  4118. for( j=0; j<damages.Size(); j+=1 )
  4119. {
  4120. action.AddDamage( damages[j].dmgType, damages[j].dmgVal );
  4121. }
  4122.  
  4123. action.SetCannotReturnDamage( true );
  4124. action.SetProcessBuffsIfNoDamage( true );
  4125. action.AddEffectInfo( EET_KnockdownTypeApplicator );
  4126. action.SetHitAnimationPlayType( EAHA_ForceYes );
  4127. action.SetCanPlayHitParticle( false );
  4128.  
  4129. theGame.damageMgr.ProcessAction( action );
  4130. delete action;
  4131. }
  4132.  
  4133.  
  4134.  
  4135.  
  4136.  
  4137. mutation11QuenEntity = ( W3QuenEntity )GetSignEntity( ST_Quen );
  4138. if( !mutation11QuenEntity )
  4139. {
  4140. mutation11QuenEntity = (W3QuenEntity)theGame.CreateEntity( GetSignTemplate( ST_Quen ), GetWorldPosition(), GetWorldRotation() );
  4141. mutation11QuenEntity.CreateAttachment( this, 'quen_sphere' );
  4142. AddTimer( 'DestroyMutation11QuenEntity', 2.f );
  4143. }
  4144. mutation11QuenEntity.PlayHitEffect( 'quen_impulse_explode', mutation11QuenEntity.GetWorldRotation() );
  4145.  
  4146. if( !skipQuenSign )
  4147. {
  4148.  
  4149. PlayEffect( 'mutation_11_second_life' );
  4150.  
  4151.  
  4152. RestoreQuen( 1000000.f, 10.f, true );
  4153. }
  4154. }
  4155.  
  4156. private var mutation11QuenEntity : W3QuenEntity;
  4157. private var storedInteractionPriority : EInteractionPriority;
  4158.  
  4159. timer function DestroyMutation11QuenEntity( dt : float, id : int )
  4160. {
  4161. if( mutation11QuenEntity )
  4162. {
  4163. mutation11QuenEntity.Destroy();
  4164. }
  4165. }
  4166.  
  4167. event OnAnimEvent_Mutation11AnimEnd( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4168. {
  4169. if( animEventType == AET_DurationEnd )
  4170. {
  4171.  
  4172. BlockAllActions( 'Mutation11', false );
  4173.  
  4174.  
  4175. theGame.GetGameCamera().StopAnimation( 'camera_shake_loop_lvl1_1' );
  4176.  
  4177.  
  4178. theGame.StopVibrateController();
  4179.  
  4180.  
  4181. SetInteractionPriority( storedInteractionPriority );
  4182.  
  4183.  
  4184. RemoveBuff( EET_Mutation11Buff, true );
  4185. }
  4186. else if ( animEventType == AET_DurationStart || animEventType == AET_DurationStartInTheMiddle )
  4187. {
  4188.  
  4189. SetBehaviorVariable( 'AIControlled', 0.f );
  4190. }
  4191. }
  4192.  
  4193. public final function MutationSystemEnable( enable : bool )
  4194. {
  4195. ( ( W3PlayerAbilityManager ) abilityManager ).MutationSystemEnable( enable );
  4196. }
  4197.  
  4198. public final function IsMutationSystemEnabled() : bool
  4199. {
  4200. return ( ( W3PlayerAbilityManager ) abilityManager ).IsMutationSystemEnabled();
  4201. }
  4202.  
  4203. public final function GetMutation( mutationType : EPlayerMutationType ) : SMutation
  4204. {
  4205. return ( ( W3PlayerAbilityManager ) abilityManager ).GetMutation( mutationType );
  4206. }
  4207.  
  4208. public final function IsMutationActive( mutationType : EPlayerMutationType) : bool
  4209. {
  4210. var swordQuality : int;
  4211. var sword : SItemUniqueId;
  4212.  
  4213. if( !SSS_IsMutationEquipped( mutationType, SSS_GetEquippedMutationType() ) ) //zur13 modSSS
  4214. {
  4215. return false;
  4216. }
  4217.  
  4218. switch( mutationType )
  4219. {
  4220. case EPMT_Mutation4 :
  4221. case EPMT_Mutation5 :
  4222. case EPMT_Mutation7 :
  4223. case EPMT_Mutation8 :
  4224. case EPMT_Mutation10 :
  4225. case EPMT_Mutation11 :
  4226. case EPMT_Mutation12 :
  4227. if( IsInFistFight() )
  4228. {
  4229. return false;
  4230. }
  4231. }
  4232.  
  4233. if( mutationType == EPMT_Mutation1 )
  4234. {
  4235. sword = inv.GetCurrentlyHeldSword();
  4236. swordQuality = inv.GetItemQuality( sword );
  4237.  
  4238.  
  4239. if( swordQuality < 3 )
  4240. {
  4241. return false;
  4242. }
  4243. }
  4244.  
  4245. return true;
  4246. }
  4247.  
  4248. public final function SetEquippedMutation( mutationType : EPlayerMutationType ) : bool
  4249. {
  4250. return ( ( W3PlayerAbilityManager ) abilityManager ).SetEquippedMutation( mutationType );
  4251. }
  4252.  
  4253. public final function GetEquippedMutationType() : EPlayerMutationType
  4254. {
  4255. return ( ( W3PlayerAbilityManager ) abilityManager ).GetEquippedMutationType();
  4256. }
  4257.  
  4258. public final function CanEquipMutation(mutationType : EPlayerMutationType) : bool
  4259. {
  4260. return ( ( W3PlayerAbilityManager ) abilityManager ).CanEquipMutation( mutationType );
  4261. }
  4262.  
  4263. public final function CanResearchMutation( mutationType : EPlayerMutationType ) : bool
  4264. {
  4265. return ( ( W3PlayerAbilityManager ) abilityManager ).CanResearchMutation( mutationType );
  4266. }
  4267.  
  4268. public final function IsMutationResearched(mutationType : EPlayerMutationType) : bool
  4269. {
  4270. return ( ( W3PlayerAbilityManager ) abilityManager ).IsMutationResearched( mutationType );
  4271. }
  4272.  
  4273. public final function GetMutationResearchProgress(mutationType : EPlayerMutationType) : int
  4274. {
  4275. return ( ( W3PlayerAbilityManager ) abilityManager ).GetMutationResearchProgress( mutationType );
  4276. }
  4277.  
  4278. public final function GetMasterMutationStage() : int
  4279. {
  4280. return ( ( W3PlayerAbilityManager ) abilityManager ).GetMasterMutationStage();
  4281. }
  4282.  
  4283. public final function MutationResearchWithSkillPoints(mutation : EPlayerMutationType, skillPoints : int) : bool
  4284. {
  4285. return ( ( W3PlayerAbilityManager ) abilityManager ).MutationResearchWithSkillPoints( mutation, skillPoints );
  4286. }
  4287.  
  4288. public final function MutationResearchWithItem(mutation : EPlayerMutationType, item : SItemUniqueId, optional count: int) : bool
  4289. {
  4290. return ( ( W3PlayerAbilityManager ) abilityManager ).MutationResearchWithItem( mutation, item, count );
  4291. }
  4292.  
  4293. public final function GetMutationLocalizedName( mutationType : EPlayerMutationType ) : string
  4294. {
  4295. var pam : W3PlayerAbilityManager;
  4296. var locKey : name;
  4297.  
  4298. pam = (W3PlayerAbilityManager)GetWitcherPlayer().abilityManager;
  4299. locKey = pam.GetMutationNameLocalizationKey( mutationType );
  4300.  
  4301. return GetLocStringByKeyExt( locKey );
  4302. }
  4303.  
  4304. public final function GetMutationLocalizedDescription( mutationType : EPlayerMutationType ) : string
  4305. {
  4306. var pam : W3PlayerAbilityManager;
  4307. var locKey : name;
  4308. var arrStr : array< string >;
  4309. var dm : CDefinitionsManagerAccessor;
  4310. var min, max, sp : SAbilityAttributeValue;
  4311. var tmp, tmp2, tox, critBonusDamage, val : float;
  4312. var stats, stats2 : SPlayerOffenseStats;
  4313. var buffPerc, exampleEnemyCount, debuffPerc : int;
  4314.  
  4315. pam = (W3PlayerAbilityManager)GetWitcherPlayer().abilityManager;
  4316. locKey = pam.GetMutationDescriptionLocalizationKey( mutationType );
  4317. dm = theGame.GetDefinitionsManager();
  4318.  
  4319. switch( mutationType )
  4320. {
  4321. case EPMT_Mutation1 :
  4322. dm.GetAbilityAttributeValue('Mutation1', 'dmg_bonus_factor', min, max);
  4323. arrStr.PushBack( NoTrailZeros( RoundMath( 100 * min.valueAdditive ) ) );
  4324. break;
  4325.  
  4326. case EPMT_Mutation2 :
  4327. sp = GetPowerStatValue( CPS_SpellPower );
  4328.  
  4329.  
  4330. dm.GetAbilityAttributeValue( 'Mutation2', 'crit_chance_factor', min, max );
  4331. arrStr.PushBack( NoTrailZeros( RoundMath( 100 * ( min.valueAdditive + sp.valueMultiplicative * min.valueMultiplicative ) ) ) );
  4332.  
  4333.  
  4334. dm.GetAbilityAttributeValue( 'Mutation2', 'crit_damage_factor', min, max );
  4335. critBonusDamage = sp.valueMultiplicative * min.valueMultiplicative;
  4336.  
  4337. arrStr.PushBack( NoTrailZeros( RoundMath( 100 * critBonusDamage ) ) );
  4338. break;
  4339.  
  4340. case EPMT_Mutation3 :
  4341.  
  4342. dm.GetAbilityAttributeValue( 'Mutation3', 'attack_power', min, max );
  4343. tmp = min.valueMultiplicative;
  4344. arrStr.PushBack( NoTrailZeros( RoundMath( 100 * tmp ) ) );
  4345.  
  4346.  
  4347. dm.GetAbilityAttributeValue( 'Mutation3', 'maxcap', min, max );
  4348. arrStr.PushBack( NoTrailZeros( RoundMath( 100 * tmp * min.valueAdditive ) ) );
  4349. break;
  4350.  
  4351. case EPMT_Mutation4 :
  4352.  
  4353. dm.GetAbilityAttributeValue( 'AcidEffect', 'DirectDamage', min, max );
  4354. tmp2 = 100 * min.valueAdditive;
  4355. dm.GetAbilityAttributeValue( 'AcidEffect', 'duration', min, max );
  4356. tmp2 *= min.valueAdditive;
  4357. arrStr.PushBack( NoTrailZeros( tmp2 ) );
  4358.  
  4359.  
  4360. tox = GetStat( BCS_Toxicity );
  4361. if( tox > 0 )
  4362. {
  4363. tmp = RoundMath( tmp2 * tox );
  4364. }
  4365. else
  4366. {
  4367. tmp = tmp2;
  4368. }
  4369. arrStr.PushBack( NoTrailZeros( tmp ) );
  4370.  
  4371.  
  4372. tox = GetStatMax( BCS_Toxicity );
  4373. tmp = RoundMath( tmp2 * tox );
  4374. arrStr.PushBack( NoTrailZeros( tmp ) );
  4375. break;
  4376.  
  4377. case EPMT_Mutation5 :
  4378.  
  4379. dm.GetAbilityAttributeValue( 'Mutation5', 'mut5_dmg_red_perc', min, max );
  4380. tmp = min.valueAdditive;
  4381. arrStr.PushBack( NoTrailZeros( 100 * tmp ) );
  4382.  
  4383.  
  4384. arrStr.PushBack( NoTrailZeros( 100 * tmp * 3 ) );
  4385.  
  4386. break;
  4387.  
  4388. case EPMT_Mutation6 :
  4389.  
  4390. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation6', 'full_freeze_chance', min, max );
  4391. arrStr.PushBack( NoTrailZeros( 100 * min.valueMultiplicative ) );
  4392.  
  4393.  
  4394. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation6', 'ForceDamage', min, max );
  4395. sp = GetTotalSignSpellPower( S_Magic_1 );
  4396. val = sp.valueAdditive + sp.valueMultiplicative * ( sp.valueBase + min.valueAdditive );
  4397. arrStr.PushBack( NoTrailZeros( RoundMath( val ) ) );
  4398.  
  4399. break;
  4400.  
  4401. case EPMT_Mutation7 :
  4402.  
  4403. dm.GetAbilityAttributeValue( 'Mutation7Buff', 'attack_power', min, max );
  4404. buffPerc = (int) ( 100 * min.valueMultiplicative );
  4405. arrStr.PushBack( NoTrailZeros( buffPerc ) );
  4406.  
  4407.  
  4408. dm.GetAbilityAttributeValue( 'Mutation7BuffEffect', 'duration', min, max );
  4409. arrStr.PushBack( NoTrailZeros( min.valueAdditive ) );
  4410.  
  4411.  
  4412. exampleEnemyCount = 11;
  4413. arrStr.PushBack( exampleEnemyCount );
  4414.  
  4415.  
  4416. arrStr.PushBack( buffPerc * ( exampleEnemyCount -1 ) );
  4417.  
  4418.  
  4419. dm.GetAbilityAttributeValue( 'Mutation7Debuff', 'attack_power', min, max );
  4420. debuffPerc = (int) ( - 100 * min.valueMultiplicative );
  4421. arrStr.PushBack( NoTrailZeros( debuffPerc ) );
  4422.  
  4423.  
  4424. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation7Debuff', 'minCapStacks', min, max );
  4425. arrStr.PushBack( NoTrailZeros( debuffPerc * min.valueAdditive ) );
  4426.  
  4427.  
  4428. dm.GetAbilityAttributeValue( 'Mutation7DebuffEffect', 'duration', min, max );
  4429. arrStr.PushBack( NoTrailZeros( min.valueAdditive ) );
  4430.  
  4431. break;
  4432.  
  4433. case EPMT_Mutation8 :
  4434.  
  4435. dm.GetAbilityAttributeValue( 'Mutation8', 'dmg_bonus', min, max );
  4436. arrStr.PushBack( NoTrailZeros( 100 * min.valueMultiplicative ) );
  4437.  
  4438.  
  4439. dm.GetAbilityAttributeValue( 'Mutation8', 'hp_perc_trigger', min, max );
  4440. arrStr.PushBack( NoTrailZeros( 100 * min.valueMultiplicative ) );
  4441.  
  4442. break;
  4443.  
  4444. case EPMT_Mutation9 :
  4445.  
  4446.  
  4447.  
  4448.  
  4449. stats = GetOffenseStatsList( 1 );
  4450. arrStr.PushBack( NoTrailZeros( RoundMath( stats.crossbowSteelDmg ) ) );
  4451.  
  4452.  
  4453. stats2 = GetOffenseStatsList( 2 );
  4454. arrStr.PushBack( NoTrailZeros( RoundMath( stats2.crossbowSteelDmg ) ) );
  4455.  
  4456.  
  4457. dm.GetAbilityAttributeValue( 'Mutation9', 'critical_hit_chance', min, max );
  4458. arrStr.PushBack( NoTrailZeros( 100 * min.valueMultiplicative ) );
  4459.  
  4460.  
  4461. dm.GetAbilityAttributeValue( 'Mutation9', 'health_reduction', min, max );
  4462. arrStr.PushBack( NoTrailZeros( 100 * min.valueMultiplicative ) );
  4463.  
  4464. break;
  4465.  
  4466. case EPMT_Mutation10 :
  4467.  
  4468. dm.GetAbilityAttributeValue( 'Mutation10Effect', 'mutation10_stat_boost', min, max );
  4469. arrStr.PushBack( NoTrailZeros( 100 * min.valueMultiplicative ) );
  4470.  
  4471.  
  4472. arrStr.PushBack( NoTrailZeros( 100 * min.valueMultiplicative * GetStatMax( BCS_Toxicity ) ) );
  4473.  
  4474. break;
  4475.  
  4476. case EPMT_Mutation11 :
  4477.  
  4478. arrStr.PushBack( 100 );
  4479.  
  4480.  
  4481. dm.GetAbilityAttributeValue( 'Mutation11DebuffEffect', 'duration', min, max);
  4482. arrStr.PushBack( NoTrailZeros( min.valueAdditive ) );
  4483. break;
  4484.  
  4485. case EPMT_Mutation12 :
  4486.  
  4487. dm.GetAbilityAttributeValue( 'Mutation12', 'duration', min, max );
  4488. arrStr.PushBack( NoTrailZeros( min.valueAdditive ) );
  4489.  
  4490.  
  4491. dm.GetAbilityAttributeValue( 'Mutation12', 'maxcap', min, max );
  4492. arrStr.PushBack( NoTrailZeros( min.valueAdditive ) );
  4493. break;
  4494.  
  4495. case EPMT_MutationMaster :
  4496.  
  4497. arrStr.PushBack( "4" );
  4498.  
  4499. break;
  4500. }
  4501.  
  4502. return GetLocStringByKeyExtWithParams( locKey, , , arrStr );
  4503. }
  4504.  
  4505. public final function ApplyMutation10StatBoost( out statValue : SAbilityAttributeValue )
  4506. {
  4507. var attValue : SAbilityAttributeValue;
  4508. var currToxicity : float;
  4509.  
  4510. if( IsMutationActive( EPMT_Mutation10 ) )
  4511. {
  4512. currToxicity = GetStat( BCS_Toxicity );
  4513. if( currToxicity > 0.f )
  4514. {
  4515. attValue = GetAttributeValue( 'mutation10_stat_boost' );
  4516. currToxicity *= attValue.valueMultiplicative;
  4517. statValue.valueMultiplicative += currToxicity;
  4518. }
  4519. }
  4520. }
  4521.  
  4522.  
  4523.  
  4524.  
  4525.  
  4526.  
  4527.  
  4528. public final function IsBookRead( bookName : name ):bool
  4529. {
  4530. return booksRead.Contains( bookName );
  4531. }
  4532.  
  4533. public final function AddReadBook( bookName : name ):void
  4534. {
  4535. if( !booksRead.Contains( bookName ) )
  4536. {
  4537. booksRead.PushBack( bookName );
  4538. }
  4539. }
  4540.  
  4541. public final function RemoveReadBook( bookName : name ):void
  4542. {
  4543. var idx : int = booksRead.FindFirst( bookName );
  4544.  
  4545. if( idx > -1 )
  4546. {
  4547. booksRead.Erase( idx );
  4548. }
  4549. }
  4550.  
  4551.  
  4552.  
  4553.  
  4554.  
  4555.  
  4556.  
  4557. public final function GetMutagenBuffs() : array< W3Mutagen_Effect >
  4558. {
  4559. var null : array< W3Mutagen_Effect >;
  4560.  
  4561. if(effectManager)
  4562. {
  4563. return effectManager.GetMutagenBuffs();
  4564. }
  4565.  
  4566. return null;
  4567. }
  4568.  
  4569. public function GetAlchemyRecipes() : array<name>
  4570. {
  4571. return alchemyRecipes;
  4572. }
  4573.  
  4574. public function CanLearnAlchemyRecipe(recipeName : name) : bool
  4575. {
  4576. var dm : CDefinitionsManagerAccessor;
  4577. var recipeNode : SCustomNode;
  4578. var i, tmpInt : int;
  4579. var tmpName : name;
  4580.  
  4581. dm = theGame.GetDefinitionsManager();
  4582. if ( dm.GetSubNodeByAttributeValueAsCName( recipeNode, 'alchemy_recipes', 'name_name', recipeName ) )
  4583. {
  4584. return true;
  4585.  
  4586. }
  4587.  
  4588. return false;
  4589. }
  4590.  
  4591. private final function RemoveAlchemyRecipe(recipeName : name)
  4592. {
  4593. alchemyRecipes.Remove(recipeName);
  4594. }
  4595.  
  4596. private final function RemoveAllAlchemyRecipes()
  4597. {
  4598. alchemyRecipes.Clear();
  4599. }
  4600.  
  4601.  
  4602. function AddAlchemyRecipe(nam : name, optional isSilent : bool, optional skipTutorialUpdate : bool) : bool
  4603. {
  4604. var i, potions, bombs : int;
  4605. var found : bool;
  4606. var m_alchemyManager : W3AlchemyManager;
  4607. var recipe : SAlchemyRecipe;
  4608. var knownBombTypes : array<string>;
  4609. var strRecipeName, recipeNameWithoutLevel : string;
  4610.  
  4611. if(!IsAlchemyRecipe(nam))
  4612. return false;
  4613.  
  4614. found = false;
  4615. for(i=0; i<alchemyRecipes.Size(); i+=1)
  4616. {
  4617. if(alchemyRecipes[i] == nam)
  4618. return false;
  4619.  
  4620.  
  4621. if(StrCmp(alchemyRecipes[i],nam) > 0)
  4622. {
  4623. alchemyRecipes.Insert(i,nam);
  4624. found = true;
  4625. AddAlchemyHudNotification(nam,isSilent);
  4626. break;
  4627. }
  4628. }
  4629.  
  4630. if(!found)
  4631. {
  4632. alchemyRecipes.PushBack(nam);
  4633. AddAlchemyHudNotification(nam,isSilent);
  4634. }
  4635.  
  4636. m_alchemyManager = new W3AlchemyManager in this;
  4637. m_alchemyManager.Init(alchemyRecipes);
  4638. m_alchemyManager.GetRecipe(nam, recipe);
  4639.  
  4640.  
  4641. if(CanUseSkill(S_Alchemy_s18))
  4642. {
  4643. if ((recipe.cookedItemType != EACIT_Bolt) && (recipe.cookedItemType != EACIT_Undefined) && (recipe.cookedItemType != EACIT_Dye) && (recipe.level <= GetSkillLevel(S_Alchemy_s18)))
  4644. AddAbility(SkillEnumToName(S_Alchemy_s18), true);
  4645.  
  4646. }
  4647.  
  4648.  
  4649. if(recipe.cookedItemType == EACIT_Bomb)
  4650. {
  4651. bombs = 0;
  4652. for(i=0; i<alchemyRecipes.Size(); i+=1)
  4653. {
  4654. m_alchemyManager.GetRecipe(alchemyRecipes[i], recipe);
  4655.  
  4656.  
  4657. if(recipe.cookedItemType == EACIT_Bomb)
  4658. {
  4659. strRecipeName = NameToString(alchemyRecipes[i]);
  4660. recipeNameWithoutLevel = StrLeft(strRecipeName, StrLen(strRecipeName)-2);
  4661. if(!knownBombTypes.Contains(recipeNameWithoutLevel))
  4662. {
  4663. bombs += 1;
  4664. knownBombTypes.PushBack(recipeNameWithoutLevel);
  4665. }
  4666. }
  4667. }
  4668.  
  4669. theGame.GetGamerProfile().SetStat(ES_KnownBombRecipes, bombs);
  4670. }
  4671.  
  4672. else if(recipe.cookedItemType == EACIT_Potion || recipe.cookedItemType == EACIT_MutagenPotion || recipe.cookedItemType == EACIT_Alcohol || recipe.cookedItemType == EACIT_Quest)
  4673. {
  4674. potions = 0;
  4675. for(i=0; i<alchemyRecipes.Size(); i+=1)
  4676. {
  4677. m_alchemyManager.GetRecipe(alchemyRecipes[i], recipe);
  4678.  
  4679.  
  4680. if(recipe.cookedItemType == EACIT_Potion || recipe.cookedItemType == EACIT_MutagenPotion || recipe.cookedItemType == EACIT_Alcohol || recipe.cookedItemType == EACIT_Quest)
  4681. {
  4682. potions += 1;
  4683. }
  4684. }
  4685. theGame.GetGamerProfile().SetStat(ES_KnownPotionRecipes, potions);
  4686. }
  4687.  
  4688. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_AlchemyRecipe );
  4689.  
  4690. return true;
  4691. }
  4692.  
  4693. public function GetExpandedAlchemyCategories() : array< name >
  4694. {
  4695. return expandedAlchemyCategories;
  4696. }
  4697.  
  4698. public function AddExpandedAlchemyCategory( category : name )
  4699. {
  4700. if ( IsNameValid( category ) )
  4701. {
  4702. ArrayOfNamesPushBackUnique( expandedAlchemyCategories, category );
  4703. }
  4704. }
  4705.  
  4706. public function RemoveExpandedAlchemyCategory( category : name )
  4707. {
  4708. if ( IsNameValid( category ) )
  4709. {
  4710. expandedAlchemyCategories.Remove( category );
  4711. }
  4712. }
  4713.  
  4714. public function SetAlchemyFilters(showHasIngre : bool, showMissingIngre : bool, showAlreadyCrafted : bool )
  4715. {
  4716. alchemyFilters.showCraftable = showHasIngre;
  4717. alchemyFilters.showMissingIngre = showMissingIngre;
  4718. alchemyFilters.showAlreadyCrafted = showAlreadyCrafted;
  4719. }
  4720.  
  4721. public function GetAlchemyFilters() : SCraftingFilters
  4722. {
  4723.  
  4724. if ( alchemyFilters.showCraftable == false && alchemyFilters.showMissingIngre == false && alchemyFilters.showAlreadyCrafted == false )
  4725. {
  4726. alchemyFilters.showCraftable = true;
  4727. alchemyFilters.showMissingIngre = true;
  4728. alchemyFilters.showAlreadyCrafted = false;
  4729. }
  4730.  
  4731. return alchemyFilters;
  4732. }
  4733.  
  4734.  
  4735.  
  4736.  
  4737.  
  4738.  
  4739.  
  4740. public function GetExpandedBestiaryCategories() : array< name >
  4741. {
  4742. return expandedBestiaryCategories;
  4743. }
  4744.  
  4745. public function AddExpandedBestiaryCategory( category : name )
  4746. {
  4747. if ( IsNameValid( category ) )
  4748. {
  4749. ArrayOfNamesPushBackUnique( expandedBestiaryCategories, category );
  4750. }
  4751. }
  4752.  
  4753. public function RemoveExpandedBestiaryCategory( category : name )
  4754. {
  4755. if ( IsNameValid( category ) )
  4756. {
  4757. expandedBestiaryCategories.Remove( category );
  4758. }
  4759. }
  4760.  
  4761.  
  4762.  
  4763.  
  4764.  
  4765.  
  4766.  
  4767. public function GetDisplayHeavyAttackIndicator() : bool
  4768. {
  4769. return bDispalyHeavyAttackIndicator;
  4770. }
  4771.  
  4772. public function SetDisplayHeavyAttackIndicator( val : bool )
  4773. {
  4774. bDispalyHeavyAttackIndicator = val;
  4775. }
  4776.  
  4777. public function GetDisplayHeavyAttackFirstLevelTimer() : bool
  4778. {
  4779. return bDisplayHeavyAttackFirstLevelTimer;
  4780. }
  4781.  
  4782. public function SetDisplayHeavyAttackFirstLevelTimer( val : bool )
  4783. {
  4784. bDisplayHeavyAttackFirstLevelTimer = val;
  4785. }
  4786.  
  4787.  
  4788.  
  4789.  
  4790.  
  4791.  
  4792.  
  4793. public function SelectQuickslotItem( slot : EEquipmentSlots )
  4794. {
  4795. var item : SItemUniqueId;
  4796.  
  4797. GetItemEquippedOnSlot(slot, item);
  4798. selectedItemId = item;
  4799. }
  4800.  
  4801.  
  4802.  
  4803.  
  4804.  
  4805.  
  4806.  
  4807. public function GetMedallion() : W3MedallionController
  4808. {
  4809. if ( !medallionController )
  4810. {
  4811. medallionController = new W3MedallionController in this;
  4812. }
  4813. return medallionController;
  4814. }
  4815.  
  4816.  
  4817. public final function HighlightObjects(range : float, optional highlightTime : float )
  4818. {
  4819. var ents : array<CGameplayEntity>;
  4820. var i : int;
  4821.  
  4822. FindGameplayEntitiesInSphere(ents, GetWorldPosition(), range, 100, 'HighlightedByMedalionFX', FLAG_ExcludePlayer);
  4823.  
  4824. if(highlightTime == 0)
  4825. highlightTime = 30;
  4826.  
  4827. for(i=0; i<ents.Size(); i+=1)
  4828. {
  4829. if(!ents[i].IsHighlighted())
  4830. {
  4831. ents[i].SetHighlighted( true );
  4832. ents[i].PlayEffectSingle( 'medalion_detection_fx' );
  4833. ents[i].AddTimer( 'MedallionEffectOff', highlightTime );
  4834. }
  4835. }
  4836. }
  4837.  
  4838.  
  4839. public final function HighlightEnemies(range : float, optional highlightTime : float )
  4840. {
  4841. var ents : array<CGameplayEntity>;
  4842. var i : int;
  4843. var catComponent : CGameplayEffectsComponent;
  4844.  
  4845. FindGameplayEntitiesInSphere(ents, GetWorldPosition(), range, 100, , FLAG_ExcludePlayer + FLAG_OnlyAliveActors);
  4846.  
  4847. if(highlightTime == 0)
  4848. highlightTime = 5;
  4849.  
  4850. for(i=0; i<ents.Size(); i+=1)
  4851. {
  4852. if(IsRequiredAttitudeBetween(this, ents[i], true))
  4853. {
  4854. catComponent = GetGameplayEffectsComponent(ents[i]);
  4855. if(catComponent)
  4856. {
  4857. catComponent.SetGameplayEffectFlag(EGEF_CatViewHiglight, true);
  4858. ents[i].AddTimer( 'EnemyHighlightOff', highlightTime, , , , , true );
  4859. }
  4860. }
  4861. }
  4862. }
  4863.  
  4864. function SpawnMedallionEntity()
  4865. {
  4866. var rot : EulerAngles;
  4867. var spawnedMedallion : CEntity;
  4868.  
  4869. spawnedMedallion = theGame.GetEntityByTag( 'new_Witcher_medallion_FX' );
  4870.  
  4871. if ( !spawnedMedallion )
  4872. theGame.CreateEntity( medallionEntity, GetWorldPosition(), rot, true, false );
  4873. }
  4874.  
  4875.  
  4876.  
  4877.  
  4878.  
  4879.  
  4880.  
  4881.  
  4882.  
  4883. public final function InterruptCombatFocusMode()
  4884. {
  4885. if( this.GetCurrentStateName() == 'CombatFocusMode_SelectSpot' )
  4886. {
  4887. SetCanPlayHitAnim( true );
  4888. PopState();
  4889. }
  4890. }
  4891.  
  4892. public final function IsInDarkPlace() : bool
  4893. {
  4894. var envs : array< string >;
  4895.  
  4896. if( FactsQuerySum( "tut_in_dark_place" ) )
  4897. {
  4898. return true;
  4899. }
  4900.  
  4901. GetActiveAreaEnvironmentDefinitions( envs );
  4902.  
  4903. if( envs.Contains( 'env_novigrad_cave' ) || envs.Contains( 'cave_catacombs' ) )
  4904. {
  4905. return true;
  4906. }
  4907.  
  4908. return false;
  4909. }
  4910.  
  4911.  
  4912.  
  4913.  
  4914.  
  4915. private saved var selectedPotionSlotUpper, selectedPotionSlotLower : EEquipmentSlots;
  4916. private var potionDoubleTapTimerRunning, potionDoubleTapSlotIsUpper : bool;
  4917. default selectedPotionSlotUpper = EES_Potion1;
  4918. default selectedPotionSlotLower = EES_Potion2;
  4919. default potionDoubleTapTimerRunning = false;
  4920.  
  4921. public final function SetPotionDoubleTapRunning(b : bool, optional isUpperSlot : bool)
  4922. {
  4923. if(b)
  4924. {
  4925. AddTimer('PotionDoubleTap', 0.3);
  4926. }
  4927. else
  4928. {
  4929. RemoveTimer('PotionDoubleTap');
  4930. }
  4931.  
  4932. potionDoubleTapTimerRunning = b;
  4933. potionDoubleTapSlotIsUpper = isUpperSlot;
  4934. }
  4935.  
  4936. public final function IsPotionDoubleTapRunning() : bool
  4937. {
  4938. return potionDoubleTapTimerRunning;
  4939. }
  4940.  
  4941. timer function PotionDoubleTap(dt : float, id : int)
  4942. {
  4943. potionDoubleTapTimerRunning = false;
  4944. OnPotionDrinkInput(potionDoubleTapSlotIsUpper);
  4945. }
  4946.  
  4947. public final function OnPotionDrinkInput(fromUpperSlot : bool)
  4948. {
  4949. var slot : EEquipmentSlots;
  4950.  
  4951. if(fromUpperSlot)
  4952. slot = GetSelectedPotionSlotUpper();
  4953. else
  4954. slot = GetSelectedPotionSlotLower();
  4955.  
  4956. DrinkPotionFromSlot(slot);
  4957. }
  4958.  
  4959. public final function OnPotionDrinkKeyboardsInput(slot : EEquipmentSlots)
  4960. {
  4961. DrinkPotionFromSlot(slot);
  4962. }
  4963.  
  4964. private function DrinkPotionFromSlot(slot : EEquipmentSlots):void
  4965. {
  4966. var item : SItemUniqueId;
  4967. var hud : CR4ScriptedHud;
  4968. var module : CR4HudModuleItemInfo;
  4969.  
  4970. GetItemEquippedOnSlot(slot, item);
  4971. if(inv.ItemHasTag(item, 'Edibles'))
  4972. {
  4973. ConsumeItem( item );
  4974. }
  4975. else
  4976. {
  4977. if (ToxicityLowEnoughToDrinkPotion(slot))
  4978. {
  4979. DrinkPreparedPotion(slot);
  4980. }
  4981. else
  4982. {
  4983. SendToxicityTooHighMessage();
  4984. }
  4985. }
  4986.  
  4987. hud = (CR4ScriptedHud)theGame.GetHud();
  4988. if ( hud )
  4989. {
  4990. module = (CR4HudModuleItemInfo)hud.GetHudModule("ItemInfoModule");
  4991. if( module )
  4992. {
  4993. module.ForceShowElement();
  4994. }
  4995. }
  4996. }
  4997.  
  4998. private function SendToxicityTooHighMessage()
  4999. {
  5000. var messageText : string;
  5001. var language : string;
  5002. var audioLanguage : string;
  5003.  
  5004. if (GetHudMessagesSize() < 2)
  5005. {
  5006. messageText = GetLocStringByKeyExt("menu_cannot_perform_action_now") + " " + GetLocStringByKeyExt("panel_common_statistics_tooltip_current_toxicity");
  5007.  
  5008. theGame.GetGameLanguageName(audioLanguage,language);
  5009. if (language == "AR")
  5010. {
  5011. messageText += (int)(abilityManager.GetStat(BCS_Toxicity, false)) + " / " + (int)(abilityManager.GetStatMax(BCS_Toxicity)) + " :";
  5012. }
  5013. else
  5014. {
  5015. messageText += ": " + (int)(abilityManager.GetStat(BCS_Toxicity, false)) + " / " + (int)(abilityManager.GetStatMax(BCS_Toxicity));
  5016. }
  5017.  
  5018. DisplayHudMessage(messageText);
  5019. }
  5020. theSound.SoundEvent("gui_global_denied");
  5021. }
  5022.  
  5023. public final function GetSelectedPotionSlotUpper() : EEquipmentSlots
  5024. {
  5025. return selectedPotionSlotUpper;
  5026. }
  5027.  
  5028. public final function GetSelectedPotionSlotLower() : EEquipmentSlots
  5029. {
  5030. return selectedPotionSlotLower;
  5031. }
  5032.  
  5033.  
  5034. public final function FlipSelectedPotion(isUpperSlot : bool) : bool
  5035. {
  5036. if(isUpperSlot)
  5037. {
  5038. if(selectedPotionSlotUpper == EES_Potion1)
  5039. {
  5040.  
  5041. if(IsAnyItemEquippedOnSlot(EES_Potion3))
  5042. {
  5043. selectedPotionSlotUpper = EES_Potion3;
  5044. return true;
  5045. }
  5046. else if(CheckRadialMenu())
  5047. {
  5048. PotionSelectionPopup( EISPM_RadialMenuSlot3 );
  5049. return true;
  5050. }
  5051.  
  5052. }
  5053. else if(selectedPotionSlotUpper == EES_Potion3)
  5054. {
  5055.  
  5056. if(IsAnyItemEquippedOnSlot(EES_Potion1))
  5057. {
  5058. selectedPotionSlotUpper = EES_Potion1;
  5059. return true;
  5060. }
  5061. else if(CheckRadialMenu())
  5062. {
  5063. PotionSelectionPopup( EISPM_RadialMenuSlot1 );
  5064. return true;
  5065. }
  5066.  
  5067. }
  5068. }
  5069. else
  5070. {
  5071. if(selectedPotionSlotLower == EES_Potion2)
  5072. {
  5073.  
  5074. if(IsAnyItemEquippedOnSlot(EES_Potion4))
  5075. {
  5076. selectedPotionSlotLower = EES_Potion4;
  5077. return true;
  5078. }
  5079. else if(CheckRadialMenu())
  5080. {
  5081. PotionSelectionPopup( EISPM_RadialMenuSlot4 );
  5082. }
  5083.  
  5084. }
  5085. else if(selectedPotionSlotLower == EES_Potion4)
  5086. {
  5087.  
  5088. if(IsAnyItemEquippedOnSlot(EES_Potion2))
  5089. {
  5090. selectedPotionSlotLower = EES_Potion2;
  5091. return true;
  5092. }
  5093. else if(CheckRadialMenu())
  5094. {
  5095. PotionSelectionPopup( EISPM_RadialMenuSlot2 );
  5096. }
  5097.  
  5098. }
  5099. }
  5100.  
  5101. return false;
  5102. }
  5103.  
  5104. public final function AddBombThrowDelay( bombId : SItemUniqueId )
  5105. {
  5106. var slot : EEquipmentSlots;
  5107.  
  5108. slot = GetItemSlot( bombId );
  5109.  
  5110. if( slot == EES_Unused )
  5111. {
  5112. return;
  5113. }
  5114.  
  5115. if( slot == EES_Petard1 || slot == EES_Quickslot1 )
  5116. {
  5117. remainingBombThrowDelaySlot1 = theGame.params.BOMB_THROW_DELAY;
  5118. AddTimer( 'BombDelay', 0.0f, true );
  5119. }
  5120. else if( slot == EES_Petard2 || slot == EES_Quickslot2 )
  5121. {
  5122. remainingBombThrowDelaySlot2 = theGame.params.BOMB_THROW_DELAY;
  5123. AddTimer( 'BombDelay', 0.0f, true );
  5124. }
  5125. else
  5126. {
  5127. return;
  5128. }
  5129. }
  5130.  
  5131. public final function GetBombDelay( slot : EEquipmentSlots ) : float
  5132. {
  5133. if( slot == EES_Petard1 || slot == EES_Quickslot1 )
  5134. {
  5135. return remainingBombThrowDelaySlot1;
  5136. }
  5137. else if( slot == EES_Petard2 || slot == EES_Quickslot2 )
  5138. {
  5139. return remainingBombThrowDelaySlot2;
  5140. }
  5141.  
  5142. return 0;
  5143. }
  5144.  
  5145. timer function BombDelay( dt : float, id : int )
  5146. {
  5147. remainingBombThrowDelaySlot1 = MaxF( 0.f , remainingBombThrowDelaySlot1 - dt );
  5148. remainingBombThrowDelaySlot2 = MaxF( 0.f , remainingBombThrowDelaySlot2 - dt );
  5149.  
  5150. if( remainingBombThrowDelaySlot1 <= 0.0f && remainingBombThrowDelaySlot2 <= 0.0f )
  5151. {
  5152. RemoveTimer('BombDelay');
  5153. }
  5154. }
  5155.  
  5156. public function ResetCharacterDev()
  5157. {
  5158.  
  5159. UnequipItemFromSlot(EES_SkillMutagen1);
  5160. UnequipItemFromSlot(EES_SkillMutagen2);
  5161. UnequipItemFromSlot(EES_SkillMutagen3);
  5162. UnequipItemFromSlot(EES_SkillMutagen4);
  5163. SSS_UnequipAllMutagens(); //zur13 modSSS mutTabs
  5164. levelManager.ResetCharacterDev();
  5165. ((W3PlayerAbilityManager)abilityManager).ResetCharacterDev();
  5166. }
  5167.  
  5168. public final function ResetMutationsDev()
  5169. {
  5170. levelManager.ResetMutationsDev();
  5171. ((W3PlayerAbilityManager)abilityManager).ResetMutationsDev();
  5172. }
  5173.  
  5174. public final function GetHeldSword() : SItemUniqueId
  5175. {
  5176. var i : int;
  5177. var weapons : array< SItemUniqueId >;
  5178.  
  5179. weapons = inv.GetHeldWeapons();
  5180. for( i=0; i<weapons.Size(); i+=1 )
  5181. {
  5182. if( inv.IsItemSilverSwordUsableByPlayer( weapons[i] ) || inv.IsItemSteelSwordUsableByPlayer( weapons[i] ) )
  5183. {
  5184. return weapons[i];
  5185. }
  5186. }
  5187.  
  5188. return GetInvalidUniqueId();
  5189. }
  5190.  
  5191. public function ConsumeItem( itemId : SItemUniqueId ) : bool
  5192. {
  5193. var itemName : name;
  5194. var removedItem, willRemoveItem : bool;
  5195. var edibles : array<SItemUniqueId>;
  5196. var toSlot : EEquipmentSlots;
  5197. var i : int;
  5198. var equippedNewEdible : bool;
  5199.  
  5200. var newEdibleId : int;
  5201. var isLevel1, isLevel2 : bool;
  5202. var abilities : array<name>;
  5203.  
  5204. itemName = inv.GetItemName( itemId );
  5205.  
  5206. if (itemName == 'q111_imlerith_acorn' )
  5207. {
  5208. AddPoints(ESkillPoint, 2, true);
  5209. removedItem = inv.RemoveItem( itemId, 1 );
  5210. theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt("panel_character_popup_title_buy_skill") + "<br>" + GetLocStringByKeyExt("panel_character_availablepoints") + " +2");
  5211. theSound.SoundEvent("gui_character_buy_skill");
  5212. }
  5213. else if ( itemName == 'Clearing Potion' )
  5214. {
  5215. ResetCharacterDev();
  5216. removedItem = inv.RemoveItem( itemId, 1 );
  5217. theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt("panel_character_popup_character_cleared") );
  5218. theSound.SoundEvent("gui_character_synergy_effect");
  5219. }
  5220. else if ( itemName == 'Restoring Potion' )
  5221. {
  5222. ResetMutationsDev();
  5223. removedItem = inv.RemoveItem( itemId, 1 );
  5224. theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt("panel_character_popup_character_cleared") );
  5225. theSound.SoundEvent("gui_character_synergy_effect");
  5226. }
  5227. else if(itemName == 'Wolf Hour')
  5228. {
  5229. removedItem = inv.RemoveItem( itemId, 1 );
  5230. theSound.SoundEvent("gui_character_synergy_effect");
  5231. AddEffectDefault(EET_WolfHour, thePlayer, 'wolf hour');
  5232. }
  5233. else if ( itemName == 'q704_ft_golden_egg' )
  5234. {
  5235. AddPoints(ESkillPoint, 1, true);
  5236. removedItem = inv.RemoveItem( itemId, 1 );
  5237. theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt("panel_character_popup_title_buy_skill") + "<br>" + GetLocStringByKeyExt("panel_character_availablepoints") + " +1");
  5238. theSound.SoundEvent("gui_character_buy_skill");
  5239. }
  5240. else if ( itemName == 'mq7023_cake' )
  5241. {
  5242. this.AddAbility('mq7023_cake_vitality_bonus');
  5243. removedItem = inv.RemoveItem( itemId, 1 );
  5244. theSound.SoundEvent("gui_character_synergy_effect");
  5245. }
  5246. else
  5247. {
  5248. willRemoveItem = inv.GetItemQuantity(itemId) == 1 && !inv.ItemHasTag(itemId, 'InfiniteUse');
  5249.  
  5250. if(willRemoveItem)
  5251. toSlot = GetItemSlot(itemId);
  5252.  
  5253. removedItem = super.ConsumeItem(itemId);
  5254.  
  5255. if(willRemoveItem && removedItem)
  5256. {
  5257. edibles = inv.GetItemsByTag('Edibles');
  5258. equippedNewEdible = false;
  5259.  
  5260. newEdibleId = 0;
  5261.  
  5262.  
  5263. for(i=0; i<edibles.Size(); i+=1)
  5264. {
  5265. if(!IsItemEquipped(edibles[i]) && !inv.ItemHasTag(edibles[i], 'Alcohol') && inv.GetItemName(edibles[i]) != 'Clearing Potion' && inv.GetItemName(edibles[i]) != 'Wolf Hour')
  5266. {
  5267. abilities.Clear();
  5268. inv.GetItemAbilities(edibles[i], abilities);
  5269. if (abilities.Contains('FoodEdibleQuality_3') || abilities.Contains('BeverageQuality_3'))
  5270. {
  5271. equippedNewEdible = true;
  5272. newEdibleId = i;
  5273. break;
  5274. }
  5275. else if (!isLevel2)
  5276. {
  5277. if (abilities.Contains('FoodEdibleQuality_2') || abilities.Contains('BeverageQuality_2'))
  5278. {
  5279. isLevel2 = true;
  5280. isLevel1 = false;
  5281. equippedNewEdible = true;
  5282. newEdibleId = i;
  5283. }
  5284. else if (!isLevel1)
  5285. {
  5286. if (abilities.Contains('FoodEdibleQuality_1') || abilities.Contains('BeverageQuality_1'))
  5287. {
  5288. equippedNewEdible = true;
  5289. newEdibleId = i;
  5290. isLevel1 = true;
  5291. }
  5292. else
  5293. {
  5294. equippedNewEdible = true;
  5295. newEdibleId = i;
  5296. }
  5297. }
  5298. }
  5299. }
  5300. }
  5301.  
  5302.  
  5303. if(!equippedNewEdible)
  5304. {
  5305. for(i=0; i<edibles.Size(); i+=1)
  5306. {
  5307. if(!IsItemEquipped(edibles[i]) && inv.GetItemName(edibles[i]) != 'Clearing Potion' && inv.GetItemName(edibles[i]) != 'Wolf Hour')
  5308. {
  5309. EquipItemInGivenSlot(edibles[i], toSlot, true, false);
  5310. break;
  5311. }
  5312. }
  5313. }
  5314. else
  5315. EquipItemInGivenSlot(edibles[newEdibleId], toSlot, true, false);
  5316. }
  5317. }
  5318.  
  5319. return removedItem;
  5320. }
  5321.  
  5322.  
  5323. public final function GetAlcoholForAlchemicalItemsRefill() : SItemUniqueId
  5324. {
  5325. var alcos : array<SItemUniqueId>;
  5326. var id : SItemUniqueId;
  5327. var i, price, minPrice : int;
  5328.  
  5329. alcos = inv.GetItemsByTag(theGame.params.TAG_ALCHEMY_REFILL_ALCO);
  5330.  
  5331. if(alcos.Size() > 0)
  5332. {
  5333. if(inv.ItemHasTag(alcos[0], theGame.params.TAG_INFINITE_USE))
  5334. return alcos[0];
  5335.  
  5336. minPrice = inv.GetItemPrice(alcos[0]);
  5337. price = minPrice;
  5338. id = alcos[0];
  5339.  
  5340. for(i=1; i<alcos.Size(); i+=1)
  5341. {
  5342. if(inv.ItemHasTag(alcos[i], theGame.params.TAG_INFINITE_USE))
  5343. return alcos[i];
  5344.  
  5345. price = inv.GetItemPrice(alcos[i]);
  5346.  
  5347. if(price < minPrice)
  5348. {
  5349. minPrice = price;
  5350. id = alcos[i];
  5351. }
  5352. }
  5353.  
  5354. return id;
  5355. }
  5356.  
  5357. return GetInvalidUniqueId();
  5358. }
  5359.  
  5360. public final function ClearPreviouslyUsedBolt()
  5361. {
  5362. previouslyUsedBolt = GetInvalidUniqueId();
  5363. }
  5364.  
  5365. public function ShouldUseInfiniteWaterBolts() : bool
  5366. {
  5367. return GetCurrentStateName() == 'Swimming' || IsSwimming() || IsDiving();
  5368. }
  5369.  
  5370. public function GetCurrentInfiniteBoltName( optional forceBodkin : bool, optional forceHarpoon : bool ) : name
  5371. {
  5372. if(!forceBodkin && (forceHarpoon || ShouldUseInfiniteWaterBolts()) )
  5373. {
  5374. return 'Harpoon Bolt';
  5375. }
  5376. return 'Bodkin Bolt';
  5377. }
  5378.  
  5379.  
  5380. public final function AddAndEquipInfiniteBolt(optional forceBodkin : bool, optional forceHarpoon : bool)
  5381. {
  5382. var bolt, bodkins, harpoons : array<SItemUniqueId>;
  5383. var boltItemName : name;
  5384. var i : int;
  5385.  
  5386.  
  5387. bodkins = inv.GetItemsByName('Bodkin Bolt');
  5388. harpoons = inv.GetItemsByName('Harpoon Bolt');
  5389.  
  5390. for(i=bodkins.Size()-1; i>=0; i-=1)
  5391. inv.RemoveItem(bodkins[i], inv.GetItemQuantity(bodkins[i]) );
  5392.  
  5393. for(i=harpoons.Size()-1; i>=0; i-=1)
  5394. inv.RemoveItem(harpoons[i], inv.GetItemQuantity(harpoons[i]) );
  5395.  
  5396.  
  5397.  
  5398. boltItemName = GetCurrentInfiniteBoltName( forceBodkin, forceHarpoon );
  5399.  
  5400.  
  5401. if(boltItemName == 'Bodkin Bolt' && inv.IsIdValid(previouslyUsedBolt))
  5402. {
  5403. bolt.PushBack(previouslyUsedBolt);
  5404. }
  5405. else
  5406. {
  5407.  
  5408. bolt = inv.AddAnItem(boltItemName, 1, true, true);
  5409.  
  5410.  
  5411. if(boltItemName == 'Harpoon Bolt')
  5412. {
  5413. GetItemEquippedOnSlot(EES_Bolt, previouslyUsedBolt);
  5414. }
  5415. }
  5416.  
  5417. EquipItem(bolt[0], EES_Bolt);
  5418. }
  5419.  
  5420.  
  5421. event OnItemGiven(data : SItemChangedData)
  5422. {
  5423. var m_guiManager : CR4GuiManager;
  5424.  
  5425. super.OnItemGiven(data);
  5426.  
  5427.  
  5428. if(!inv)
  5429. inv = GetInventory();
  5430.  
  5431.  
  5432. if(inv.IsItemEncumbranceItem(data.ids[0]))
  5433. UpdateEncumbrance();
  5434.  
  5435. m_guiManager = theGame.GetGuiManager();
  5436. if(m_guiManager)
  5437. m_guiManager.RegisterNewItem(data.ids[0]);
  5438. }
  5439.  
  5440.  
  5441. public final function CheckForFullyArmedAchievement()
  5442. {
  5443. if( HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_BEAR) || HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_GRYPHON) ||
  5444. HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_LYNX) || HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_WOLF) ||
  5445. HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_VIPER) || HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_NETFLIX)
  5446. )
  5447. {
  5448. theGame.GetGamerProfile().AddAchievement(EA_FullyArmed);
  5449. }
  5450. }
  5451.  
  5452.  
  5453. public final function HasAllItemsFromSet(setItemTag : name) : bool
  5454. {
  5455. var item : SItemUniqueId;
  5456.  
  5457. if(!GetItemEquippedOnSlot(EES_SteelSword, item) || !inv.ItemHasTag(item, setItemTag))
  5458. return false;
  5459.  
  5460. if(!GetItemEquippedOnSlot(EES_SilverSword, item) || !inv.ItemHasTag(item, setItemTag))
  5461. return false;
  5462.  
  5463. if(!GetItemEquippedOnSlot(EES_Boots, item) || !inv.ItemHasTag(item, setItemTag))
  5464. return false;
  5465.  
  5466. if(!GetItemEquippedOnSlot(EES_Pants, item) || !inv.ItemHasTag(item, setItemTag))
  5467. return false;
  5468.  
  5469. if(!GetItemEquippedOnSlot(EES_Gloves, item) || !inv.ItemHasTag(item, setItemTag))
  5470. return false;
  5471.  
  5472. if(!GetItemEquippedOnSlot(EES_Armor, item) || !inv.ItemHasTag(item, setItemTag))
  5473. return false;
  5474.  
  5475.  
  5476. if(setItemTag == theGame.params.ITEM_SET_TAG_BEAR || setItemTag == theGame.params.ITEM_SET_TAG_LYNX)
  5477. {
  5478. if(!GetItemEquippedOnSlot(EES_RangedWeapon, item) || !inv.ItemHasTag(item, setItemTag))
  5479. return false;
  5480. }
  5481.  
  5482. return true;
  5483. }
  5484.  
  5485.  
  5486. public final function CheckForFullyArmedByTag(setItemTag : name)
  5487. {
  5488. var doneParts, totalParts : int;
  5489. var item : SItemUniqueId;
  5490.  
  5491. if(setItemTag == '')
  5492. return;
  5493.  
  5494.  
  5495. doneParts = 0;
  5496. totalParts = 6;
  5497. if(GetItemEquippedOnSlot(EES_SteelSword, item) && inv.ItemHasTag(item, setItemTag))
  5498. doneParts += 1;
  5499.  
  5500. if(GetItemEquippedOnSlot(EES_SilverSword, item) && inv.ItemHasTag(item, setItemTag))
  5501. doneParts += 1;
  5502.  
  5503. if(GetItemEquippedOnSlot(EES_Boots, item) && inv.ItemHasTag(item, setItemTag))
  5504. doneParts += 1;
  5505.  
  5506. if(GetItemEquippedOnSlot(EES_Pants, item) && inv.ItemHasTag(item, setItemTag))
  5507. doneParts += 1;
  5508.  
  5509. if(GetItemEquippedOnSlot(EES_Gloves, item) && inv.ItemHasTag(item, setItemTag))
  5510. doneParts += 1;
  5511.  
  5512. if(GetItemEquippedOnSlot(EES_Armor, item) && inv.ItemHasTag(item, setItemTag))
  5513. doneParts += 1;
  5514.  
  5515.  
  5516. if(setItemTag == theGame.params.ITEM_SET_TAG_BEAR || setItemTag == theGame.params.ITEM_SET_TAG_LYNX)
  5517. {
  5518. totalParts += 1;
  5519. if(GetItemEquippedOnSlot(EES_RangedWeapon, item) && inv.ItemHasTag(item, setItemTag))
  5520. doneParts += 1;
  5521. }
  5522.  
  5523.  
  5524. if(doneParts >= totalParts)
  5525. {
  5526. theGame.GetGamerProfile().AddAchievement(EA_FullyArmed);
  5527. }
  5528. else
  5529. {
  5530. theGame.GetGamerProfile().NoticeAchievementProgress(EA_FullyArmed, doneParts, totalParts);
  5531. }
  5532. }
  5533.  
  5534.  
  5535.  
  5536.  
  5537. public function GetTotalArmor() : SAbilityAttributeValue
  5538. {
  5539. var armor : SAbilityAttributeValue;
  5540. var armorItem : SItemUniqueId;
  5541.  
  5542. armor = super.GetTotalArmor();
  5543.  
  5544. if(GetItemEquippedOnSlot(EES_Armor, armorItem))
  5545. {
  5546.  
  5547. armor -= inv.GetItemAttributeValue(armorItem, theGame.params.ARMOR_VALUE_NAME);
  5548.  
  5549.  
  5550. armor += inv.GetItemArmorTotal(armorItem);
  5551. }
  5552.  
  5553. if(GetItemEquippedOnSlot(EES_Pants, armorItem))
  5554. {
  5555.  
  5556. armor -= inv.GetItemAttributeValue(armorItem, theGame.params.ARMOR_VALUE_NAME);
  5557.  
  5558.  
  5559. armor += inv.GetItemArmorTotal(armorItem);
  5560. }
  5561.  
  5562. if(GetItemEquippedOnSlot(EES_Boots, armorItem))
  5563. {
  5564.  
  5565. armor -= inv.GetItemAttributeValue(armorItem, theGame.params.ARMOR_VALUE_NAME);
  5566.  
  5567.  
  5568. armor += inv.GetItemArmorTotal(armorItem);
  5569. }
  5570.  
  5571. if(GetItemEquippedOnSlot(EES_Gloves, armorItem))
  5572. {
  5573.  
  5574. armor -= inv.GetItemAttributeValue(armorItem, theGame.params.ARMOR_VALUE_NAME);
  5575.  
  5576.  
  5577. armor += inv.GetItemArmorTotal(armorItem);
  5578. }
  5579.  
  5580. return armor;
  5581. }
  5582.  
  5583.  
  5584.  
  5585. public function ReduceArmorDurability() : EEquipmentSlots
  5586. {
  5587. var r, sum : int;
  5588. var slot : EEquipmentSlots;
  5589. var id : SItemUniqueId;
  5590. var prevDurMult, currDurMult, ratio : float;
  5591.  
  5592.  
  5593. sum = theGame.params.DURABILITY_ARMOR_CHEST_WEIGHT;
  5594. sum += theGame.params.DURABILITY_ARMOR_PANTS_WEIGHT;
  5595. sum += theGame.params.DURABILITY_ARMOR_GLOVES_WEIGHT;
  5596. sum += theGame.params.DURABILITY_ARMOR_BOOTS_WEIGHT;
  5597. sum += theGame.params.DURABILITY_ARMOR_MISS_WEIGHT;
  5598.  
  5599. r = RandRange(sum);
  5600.  
  5601. if(r < theGame.params.DURABILITY_ARMOR_CHEST_WEIGHT)
  5602. slot = EES_Armor;
  5603. else if (r < theGame.params.DURABILITY_ARMOR_CHEST_WEIGHT + theGame.params.DURABILITY_ARMOR_PANTS_WEIGHT)
  5604. slot = EES_Pants;
  5605. else if (r < theGame.params.DURABILITY_ARMOR_CHEST_WEIGHT + theGame.params.DURABILITY_ARMOR_PANTS_WEIGHT + theGame.params.DURABILITY_ARMOR_GLOVES_WEIGHT)
  5606. slot = EES_Gloves;
  5607. else if (r < theGame.params.DURABILITY_ARMOR_CHEST_WEIGHT + theGame.params.DURABILITY_ARMOR_PANTS_WEIGHT + theGame.params.DURABILITY_ARMOR_GLOVES_WEIGHT + theGame.params.DURABILITY_ARMOR_BOOTS_WEIGHT)
  5608. slot = EES_Boots;
  5609. else
  5610. return EES_InvalidSlot;
  5611.  
  5612. GetItemEquippedOnSlot(slot, id);
  5613. ratio = inv.GetItemDurabilityRatio(id);
  5614. if(inv.ReduceItemDurability(id))
  5615. {
  5616. prevDurMult = theGame.params.GetDurabilityMultiplier(ratio, false);
  5617.  
  5618. ratio = inv.GetItemDurabilityRatio(id);
  5619. currDurMult = theGame.params.GetDurabilityMultiplier(ratio, false);
  5620.  
  5621. if(currDurMult != prevDurMult)
  5622. {
  5623.  
  5624.  
  5625.  
  5626.  
  5627. }
  5628.  
  5629. return slot;
  5630. }
  5631.  
  5632. return EES_InvalidSlot;
  5633. }
  5634.  
  5635.  
  5636. public function DismantleItem(dismantledItem : SItemUniqueId, toolItem : SItemUniqueId) : bool
  5637. {
  5638. var parts : array<SItemParts>;
  5639. var i : int;
  5640.  
  5641. if(!inv.IsItemDismantleKit(toolItem))
  5642. return false;
  5643.  
  5644. parts = inv.GetItemRecyclingParts(dismantledItem);
  5645.  
  5646. if(parts.Size() <= 0)
  5647. return false;
  5648.  
  5649. for(i=0; i<parts.Size(); i+=1)
  5650. inv.AddAnItem(parts[i].itemName, parts[i].quantity, true, false);
  5651.  
  5652. inv.RemoveItem(toolItem);
  5653. inv.RemoveItem(dismantledItem);
  5654. return true;
  5655. }
  5656.  
  5657.  
  5658. public function GetItemEquippedOnSlot(slot : EEquipmentSlots, out item : SItemUniqueId) : bool
  5659. {
  5660. if(slot == EES_InvalidSlot || slot < 0 || slot > EnumGetMax('EEquipmentSlots'))
  5661. return false;
  5662.  
  5663. item = itemSlots[slot];
  5664.  
  5665. return inv.IsIdValid(item);
  5666. }
  5667.  
  5668.  
  5669. public function GetItemSlotByItemName(itemName : name) : EEquipmentSlots
  5670. {
  5671. var ids : array<SItemUniqueId>;
  5672. var i : int;
  5673. var slot : EEquipmentSlots;
  5674.  
  5675. ids = inv.GetItemsByName(itemName);
  5676. for(i=0; i<ids.Size(); i+=1)
  5677. {
  5678. slot = GetItemSlot(ids[i]);
  5679. if(slot != EES_InvalidSlot)
  5680. return slot;
  5681. }
  5682.  
  5683. return EES_InvalidSlot;
  5684. }
  5685.  
  5686.  
  5687. public function GetItemSlot(item : SItemUniqueId) : EEquipmentSlots
  5688. {
  5689. var i : int;
  5690.  
  5691. if(!inv.IsIdValid(item))
  5692. return EES_InvalidSlot;
  5693.  
  5694. for(i=0; i<itemSlots.Size(); i+=1)
  5695. if(itemSlots[i] == item)
  5696. return i;
  5697.  
  5698. return EES_InvalidSlot;
  5699. }
  5700.  
  5701. public function GetEquippedItems() : array<SItemUniqueId>
  5702. {
  5703. return itemSlots;
  5704. }
  5705.  
  5706. public function IsItemEquipped(item : SItemUniqueId) : bool
  5707. {
  5708. if(!inv.IsIdValid(item))
  5709. return false;
  5710.  
  5711. return itemSlots.Contains(item);
  5712. }
  5713.  
  5714. public function IsItemHeld(item : SItemUniqueId) : bool
  5715. {
  5716. if(!inv.IsIdValid(item))
  5717. return false;
  5718.  
  5719. return inv.IsItemHeld(item);
  5720. }
  5721.  
  5722.  
  5723. public function IsAnyItemEquippedOnSlot(slot : EEquipmentSlots) : bool
  5724. {
  5725. if(slot == EES_InvalidSlot || slot < 0 || slot > EnumGetMax('EEquipmentSlots'))
  5726. return false;
  5727.  
  5728. return inv.IsIdValid(itemSlots[slot]);
  5729. }
  5730.  
  5731.  
  5732. public function GetFreeQuickslot() : EEquipmentSlots
  5733. {
  5734. if(!inv.IsIdValid(itemSlots[EES_Quickslot1])) return EES_Quickslot1;
  5735. if(!inv.IsIdValid(itemSlots[EES_Quickslot2])) return EES_Quickslot2;
  5736.  
  5737.  
  5738. return EES_InvalidSlot;
  5739. }
  5740.  
  5741.  
  5742. event OnEquipItemRequested(item : SItemUniqueId, ignoreMount : bool)
  5743. {
  5744. var slot : EEquipmentSlots;
  5745.  
  5746. if(inv.IsIdValid(item))
  5747. {
  5748. slot = inv.GetSlotForItemId(item);
  5749.  
  5750. if (slot != EES_InvalidSlot)
  5751. {
  5752.  
  5753.  
  5754. EquipItemInGivenSlot(item, slot, ignoreMount);
  5755. }
  5756. }
  5757. }
  5758.  
  5759. event OnUnequipItemRequested(item : SItemUniqueId)
  5760. {
  5761. UnequipItem(item);
  5762. }
  5763.  
  5764.  
  5765. public function EquipItem(item : SItemUniqueId, optional slot : EEquipmentSlots, optional toHand : bool) : bool
  5766. {
  5767. if(!inv.IsIdValid(item))
  5768. return false;
  5769.  
  5770. if(slot == EES_InvalidSlot)
  5771. {
  5772. slot = inv.GetSlotForItemId(item);
  5773.  
  5774. if(slot == EES_InvalidSlot)
  5775. return false;
  5776. }
  5777.  
  5778. ForceSoundAppearanceUpdate();
  5779.  
  5780. return EquipItemInGivenSlot(item, slot, false, toHand);
  5781. }
  5782.  
  5783. protected function ShouldMount(slot : EEquipmentSlots, item : SItemUniqueId, category : name):bool
  5784. {
  5785.  
  5786.  
  5787. return !IsSlotPotionMutagen(slot) && category != 'usable' && category != 'potion' && category != 'petard' && !inv.ItemHasTag(item, 'PlayerUnwearable');
  5788. }
  5789.  
  5790. protected function ShouldMountItemWithName( itemName: name ): bool
  5791. {
  5792. var slot : EEquipmentSlots;
  5793. var items : array<SItemUniqueId>;
  5794. var category : name;
  5795. var i : int;
  5796.  
  5797. items = inv.GetItemsByName( itemName );
  5798.  
  5799. category = inv.GetItemCategory( items[0] );
  5800.  
  5801. slot = GetItemSlot( items[0] );
  5802.  
  5803. return ShouldMount( slot, items[0], category );
  5804. }
  5805.  
  5806. public function GetMountableItems( out items : array< SItemUniqueId > )
  5807. {
  5808. var i : int;
  5809. var mountable : bool;
  5810. var mountableItems : array< SItemUniqueId >;
  5811. var slot : EEquipmentSlots;
  5812. var category : name;
  5813. var item: SItemUniqueId;
  5814.  
  5815. for ( i = 0; i < items.Size(); i += 1 )
  5816. {
  5817. item = items[i];
  5818.  
  5819. category = inv.GetItemCategory( item );
  5820.  
  5821. slot = GetItemSlot( item );
  5822.  
  5823. mountable = ShouldMount( slot, item, category );
  5824.  
  5825. if ( mountable )
  5826. {
  5827. mountableItems.PushBack( items[ i ] );
  5828. }
  5829. }
  5830. items = mountableItems;
  5831. }
  5832.  
  5833. public final function AddAndEquipItem( item : name ) : bool
  5834. {
  5835. var ids : array< SItemUniqueId >;
  5836.  
  5837. ids = inv.AddAnItem( item );
  5838. if( inv.IsIdValid( ids[ 0 ] ) )
  5839. {
  5840. return EquipItem( ids[ 0 ] );
  5841. }
  5842.  
  5843. return false;
  5844. }
  5845.  
  5846. public final function AddQuestMarkedSelectedQuickslotItem( sel : SSelectedQuickslotItem )
  5847. {
  5848. questMarkedSelectedQuickslotItems.PushBack( sel );
  5849. }
  5850.  
  5851. public final function GetQuestMarkedSelectedQuickslotItem( sourceName : name ) : SItemUniqueId
  5852. {
  5853. var i : int;
  5854.  
  5855. for( i=0; i<questMarkedSelectedQuickslotItems.Size(); i+=1 )
  5856. {
  5857. if( questMarkedSelectedQuickslotItems[i].sourceName == sourceName )
  5858. {
  5859. return questMarkedSelectedQuickslotItems[i].itemID;
  5860. }
  5861. }
  5862.  
  5863. return GetInvalidUniqueId();
  5864. }
  5865.  
  5866. public final function SwapEquippedItems(slot1 : EEquipmentSlots, slot2 : EEquipmentSlots)
  5867. {
  5868. var temp : SItemUniqueId;
  5869. var pam : W3PlayerAbilityManager;
  5870.  
  5871. temp = itemSlots[slot1];
  5872. itemSlots[slot1] = itemSlots[slot2];
  5873. itemSlots[slot2] = temp;
  5874.  
  5875. if(IsSlotSkillMutagen(slot1))
  5876. {
  5877. pam = (W3PlayerAbilityManager)abilityManager;
  5878. if(pam)
  5879. pam.OnSwappedMutagensPost(itemSlots[slot1], itemSlots[slot2]);
  5880. }
  5881. }
  5882.  
  5883. public final function GetSlotForEquippedItem( itemID : SItemUniqueId ) : EEquipmentSlots
  5884. {
  5885. var i : int;
  5886.  
  5887. for( i=0; i<itemSlots.Size(); i+=1 )
  5888. {
  5889. if( itemSlots[i] == itemID )
  5890. {
  5891. return i;
  5892. }
  5893. }
  5894.  
  5895. return EES_InvalidSlot;
  5896. }
  5897.  
  5898. public function EquipItemInGivenSlot(item : SItemUniqueId, slot : EEquipmentSlots, ignoreMounting : bool, optional toHand : bool) : bool
  5899. {
  5900. var i, groupID, quantity : int;
  5901. var fistsID : array<SItemUniqueId>;
  5902. var pam : W3PlayerAbilityManager;
  5903. var isSkillMutagen : bool;
  5904. var armorEntity : CItemEntity;
  5905. var armorMeshComponent : CComponent;
  5906. var armorSoundIdentification : name;
  5907. var category : name;
  5908. var tagOfASet : name;
  5909. var prevSkillColor : ESkillColor;
  5910. var containedAbilities : array<name>;
  5911. var dm : CDefinitionsManagerAccessor;
  5912. var armorType : EArmorType;
  5913. var otherMask, previousItemInSlot : SItemUniqueId;
  5914. var tutStatePot : W3TutorialManagerUIHandlerStatePotions;
  5915. var tutStateFood : W3TutorialManagerUIHandlerStateFood;
  5916. var tutStateSecondPotionEquip : W3TutorialManagerUIHandlerStateSecondPotionEquip;
  5917. var boltItem : SItemUniqueId;
  5918. var aerondight : W3Effect_Aerondight;
  5919.  
  5920. if(!inv.IsIdValid(item))
  5921. {
  5922. LogAssert(false, "W3PlayerWitcher.EquipItemInGivenSlot: invalid item");
  5923. return false;
  5924. }
  5925. if(slot == EES_InvalidSlot || slot == EES_HorseBlinders || slot == EES_HorseSaddle || slot == EES_HorseBag || slot == EES_HorseTrophy)
  5926. {
  5927. LogAssert(false, "W3PlayerWitcher.EquipItem: Cannot equip item <<" + inv.GetItemName(item) + ">> - provided slot <<" + slot + ">> is invalid");
  5928. return false;
  5929. }
  5930. if(itemSlots[slot] == item)
  5931. {
  5932. return true;
  5933. }
  5934.  
  5935. if(!HasRequiredLevelToEquipItem(item))
  5936. {
  5937.  
  5938. return false;
  5939. }
  5940.  
  5941. if(inv.ItemHasTag(item, 'PhantomWeapon') && !GetPhantomWeaponMgr())
  5942. {
  5943. InitPhantomWeaponMgr();
  5944. }
  5945.  
  5946.  
  5947. if( slot == EES_SilverSword && inv.ItemHasTag( item, 'Aerondight' ) )
  5948. {
  5949. AddEffectDefault( EET_Aerondight, this, "Aerondight" );
  5950.  
  5951.  
  5952. aerondight = (W3Effect_Aerondight)GetBuff( EET_Aerondight );
  5953. aerondight.Pause( 'ManageAerondightBuff' );
  5954. }
  5955.  
  5956.  
  5957. previousItemInSlot = itemSlots[slot];
  5958. if( IsItemEquipped(item))
  5959. {
  5960. SwapEquippedItems(slot, GetItemSlot(item));
  5961. return true;
  5962. }
  5963.  
  5964.  
  5965. isSkillMutagen = IsSlotSkillMutagen(slot);
  5966. if(isSkillMutagen)
  5967. {
  5968. pam = (W3PlayerAbilityManager)abilityManager;
  5969. if(!pam.IsSkillMutagenSlotUnlocked(slot))
  5970. {
  5971. return false;
  5972. }
  5973. }
  5974.  
  5975.  
  5976. if(inv.IsIdValid(previousItemInSlot))
  5977. {
  5978. if(!UnequipItemFromSlot(slot, true))
  5979. {
  5980. LogAssert(false, "W3PlayerWitcher.EquipItem: Cannot equip item <<" + inv.GetItemName(item) + ">> !!");
  5981. return false;
  5982. }
  5983. }
  5984.  
  5985.  
  5986. if(inv.IsItemMask(item))
  5987. {
  5988. if(slot == EES_Quickslot1)
  5989. GetItemEquippedOnSlot(EES_Quickslot2, otherMask);
  5990. else
  5991. GetItemEquippedOnSlot(EES_Quickslot1, otherMask);
  5992.  
  5993. if(inv.IsItemMask(otherMask))
  5994. UnequipItem(otherMask);
  5995. }
  5996.  
  5997. if(isSkillMutagen)
  5998. {
  5999. groupID = pam.GetSkillGroupIdOfMutagenSlot(slot);
  6000. prevSkillColor = pam.GetSkillGroupColor(groupID);
  6001. }
  6002.  
  6003. itemSlots[slot] = item;
  6004.  
  6005. category = inv.GetItemCategory( item );
  6006.  
  6007.  
  6008. if( !ignoreMounting && ShouldMount(slot, item, category) )
  6009. {
  6010.  
  6011. inv.MountItem( item, toHand, IsSlotSkillMutagen( slot ) );
  6012. }
  6013.  
  6014. theTelemetry.LogWithLabelAndValue( TE_INV_ITEM_EQUIPPED, inv.GetItemName(item), slot );
  6015.  
  6016. if(slot == EES_RangedWeapon)
  6017. {
  6018. rangedWeapon = ( Crossbow )( inv.GetItemEntityUnsafe(item) );
  6019. if(!rangedWeapon)
  6020. AddTimer('DelayedOnItemMount', 0.1, true);
  6021.  
  6022. if ( IsSwimming() || IsDiving() )
  6023. {
  6024. GetItemEquippedOnSlot(EES_Bolt, boltItem);
  6025.  
  6026. if(inv.IsIdValid(boltItem))
  6027. {
  6028. if ( !inv.ItemHasTag(boltItem, 'UnderwaterAmmo' ))
  6029. {
  6030. AddAndEquipInfiniteBolt(false, true);
  6031. }
  6032. }
  6033. else if(!IsAnyItemEquippedOnSlot(EES_Bolt))
  6034. {
  6035. AddAndEquipInfiniteBolt(false, true);
  6036. }
  6037. }
  6038.  
  6039. else if(!IsAnyItemEquippedOnSlot(EES_Bolt))
  6040. AddAndEquipInfiniteBolt();
  6041. }
  6042. else if(slot == EES_Bolt)
  6043. {
  6044. if(rangedWeapon)
  6045. { if ( !IsSwimming() || !IsDiving() )
  6046. {
  6047. rangedWeapon.OnReplaceAmmo();
  6048. rangedWeapon.OnWeaponReload();
  6049. }
  6050. else
  6051. {
  6052. DisplayHudMessage(GetLocStringByKeyExt( "menu_cannot_perform_action_now" ));
  6053. }
  6054. }
  6055. }
  6056.  
  6057. else if(isSkillMutagen)
  6058. {
  6059. theGame.GetGuiManager().IgnoreNewItemNotifications( true );
  6060.  
  6061.  
  6062. quantity = inv.GetItemQuantity( item );
  6063. if( quantity > 1 )
  6064. {
  6065. inv.SplitItem( item, quantity - 1 );
  6066. }
  6067.  
  6068. pam.OnSkillMutagenEquipped(item, slot, prevSkillColor);
  6069. LogSkillColors("Mutagen <<" + inv.GetItemName(item) + ">> equipped to slot <<" + slot + ">>");
  6070. LogSkillColors("Group bonus color is now <<" + pam.GetSkillGroupColor(groupID) + ">>");
  6071. LogSkillColors("");
  6072.  
  6073. theGame.GetGuiManager().IgnoreNewItemNotifications( false );
  6074. }
  6075. else if(slot == EES_Gloves && HasWeaponDrawn(false))
  6076. {
  6077. PlayRuneword4FX(PW_Steel);
  6078. PlayRuneword4FX(PW_Silver);
  6079. }
  6080.  
  6081. else if( ( slot == EES_Petard1 || slot == EES_Petard2 ) && inv.IsItemBomb( GetSelectedItemId() ) )
  6082. {
  6083. SelectQuickslotItem( slot );
  6084. }
  6085.  
  6086.  
  6087. if(inv.ItemHasAbility(item, 'MA_HtH'))
  6088. {
  6089. inv.GetItemContainedAbilities(item, containedAbilities);
  6090. fistsID = inv.GetItemsByName('fists');
  6091. dm = theGame.GetDefinitionsManager();
  6092. for(i=0; i<containedAbilities.Size(); i+=1)
  6093. {
  6094. if(dm.AbilityHasTag(containedAbilities[i], 'MA_HtH'))
  6095. {
  6096. inv.AddItemCraftedAbility(fistsID[0], containedAbilities[i], true);
  6097. }
  6098. }
  6099. }
  6100.  
  6101.  
  6102. if(inv.IsItemAnyArmor(item))
  6103. {
  6104. armorType = inv.GetArmorType(item);
  6105. pam = (W3PlayerAbilityManager)abilityManager;
  6106.  
  6107. if(armorType == EAT_Light)
  6108. {
  6109. if(CanUseSkill(S_Perk_05))
  6110. pam.SetPerkArmorBonus(S_Perk_05);
  6111. }
  6112. else if(armorType == EAT_Medium)
  6113. {
  6114. if(CanUseSkill(S_Perk_06))
  6115. pam.SetPerkArmorBonus(S_Perk_06);
  6116. }
  6117. else if(armorType == EAT_Heavy)
  6118. {
  6119. if(CanUseSkill(S_Perk_07))
  6120. pam.SetPerkArmorBonus(S_Perk_07);
  6121. }
  6122. }
  6123.  
  6124.  
  6125. UpdateItemSetBonuses( item, true );
  6126.  
  6127.  
  6128. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_OnItemEquipped );
  6129.  
  6130.  
  6131. if(ShouldProcessTutorial('TutorialPotionCanEquip3'))
  6132. {
  6133. if(IsSlotPotionSlot(slot))
  6134. {
  6135. tutStatePot = (W3TutorialManagerUIHandlerStatePotions)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
  6136. if(tutStatePot)
  6137. {
  6138. tutStatePot.OnPotionEquipped(inv.GetItemName(item));
  6139. }
  6140.  
  6141. tutStateSecondPotionEquip = (W3TutorialManagerUIHandlerStateSecondPotionEquip)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
  6142. if(tutStateSecondPotionEquip)
  6143. {
  6144. tutStateSecondPotionEquip.OnPotionEquipped(inv.GetItemName(item));
  6145. }
  6146.  
  6147. }
  6148. }
  6149.  
  6150. if(ShouldProcessTutorial('TutorialFoodSelectTab'))
  6151. {
  6152. if( IsSlotPotionSlot(slot) && inv.IsItemFood(item))
  6153. {
  6154. tutStateFood = (W3TutorialManagerUIHandlerStateFood)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
  6155. if(tutStateFood)
  6156. {
  6157. tutStateFood.OnFoodEquipped();
  6158. }
  6159. }
  6160. }
  6161.  
  6162.  
  6163.  
  6164.  
  6165. tagOfASet = inv.DetectTagOfASet(item);
  6166. CheckForFullyArmedByTag(tagOfASet);
  6167.  
  6168. return true;
  6169. }
  6170.  
  6171. private function CheckHairItem()
  6172. {
  6173. var ids : array<SItemUniqueId>;
  6174. var i : int;
  6175. var itemName : name;
  6176. var hairApplied : bool;
  6177.  
  6178. ids = inv.GetItemsByCategory('hair');
  6179.  
  6180. for(i=0; i<ids.Size(); i+= 1)
  6181. {
  6182. itemName = inv.GetItemName( ids[i] );
  6183.  
  6184. if( itemName != 'Preview Hair' )
  6185. {
  6186. if( hairApplied == false )
  6187. {
  6188. inv.MountItem( ids[i], false );
  6189. hairApplied = true;
  6190. }
  6191. else
  6192. {
  6193. inv.RemoveItem( ids[i], 1 );
  6194. }
  6195.  
  6196. }
  6197. }
  6198.  
  6199. if( hairApplied == false )
  6200. {
  6201. ids = inv.AddAnItem('Half With Tail Hairstyle', 1, true, false);
  6202. inv.MountItem( ids[0], false );
  6203. }
  6204.  
  6205. }
  6206.  
  6207.  
  6208. timer function DelayedOnItemMount( dt : float, id : int )
  6209. {
  6210. var crossbowID : SItemUniqueId;
  6211. var invent : CInventoryComponent;
  6212.  
  6213. invent = GetInventory();
  6214. if(!invent)
  6215. return;
  6216.  
  6217.  
  6218. GetItemEquippedOnSlot(EES_RangedWeapon, crossbowID);
  6219.  
  6220. if(invent.IsIdValid(crossbowID))
  6221. {
  6222.  
  6223. rangedWeapon = ( Crossbow )(invent.GetItemEntityUnsafe(crossbowID) );
  6224.  
  6225. if(rangedWeapon)
  6226. {
  6227.  
  6228. RemoveTimer('DelayedOnItemMount');
  6229. }
  6230. }
  6231. else
  6232. {
  6233.  
  6234. RemoveTimer('DelayedOnItemMount');
  6235. }
  6236. }
  6237.  
  6238. public function GetHeldItems() : array<SItemUniqueId>
  6239. {
  6240. var items : array<SItemUniqueId>;
  6241. var item : SItemUniqueId;
  6242.  
  6243. if( inv.GetItemEquippedOnSlot(EES_SilverSword, item) && inv.IsItemHeld(item))
  6244. items.PushBack(item);
  6245.  
  6246. if( inv.GetItemEquippedOnSlot(EES_SteelSword, item) && inv.IsItemHeld(item))
  6247. items.PushBack(item);
  6248.  
  6249. if( inv.GetItemEquippedOnSlot(EES_RangedWeapon, item) && inv.IsItemHeld(item))
  6250. items.PushBack(item);
  6251.  
  6252. if( inv.GetItemEquippedOnSlot(EES_Quickslot1, item) && inv.IsItemHeld(item))
  6253. items.PushBack(item);
  6254.  
  6255. if( inv.GetItemEquippedOnSlot(EES_Quickslot2, item) && inv.IsItemHeld(item))
  6256. items.PushBack(item);
  6257.  
  6258. if( inv.GetItemEquippedOnSlot(EES_Petard1, item) && inv.IsItemHeld(item))
  6259. items.PushBack(item);
  6260.  
  6261. if( inv.GetItemEquippedOnSlot(EES_Petard2, item) && inv.IsItemHeld(item))
  6262. items.PushBack(item);
  6263.  
  6264. return items;
  6265. }
  6266.  
  6267. public function MoveMutagenToSlot( item : SItemUniqueId, slotFrom : EEquipmentSlots, slotTo : EEquipmentSlots )
  6268. {
  6269. var pam : W3PlayerAbilityManager;
  6270. var prevSkillColor : ESkillColor;
  6271. var groupID : int;
  6272.  
  6273. if( IsSlotSkillMutagen( slotTo ) )
  6274. {
  6275. itemSlots[slotFrom] = GetInvalidUniqueId();
  6276.  
  6277. pam = (W3PlayerAbilityManager)abilityManager; //zur13 modSSS fixed orig script error
  6278. groupID = pam.GetSkillGroupIdOfMutagenSlot(slotFrom);
  6279. prevSkillColor = pam.GetSkillGroupColor(groupID);
  6280. pam = (W3PlayerAbilityManager)abilityManager;
  6281. pam.OnSkillMutagenUnequipped(item, slotFrom, prevSkillColor, true);
  6282.  
  6283.  
  6284.  
  6285. EquipItemInGivenSlot( item, slotTo, false );
  6286. }
  6287. }
  6288.  
  6289.  
  6290. public function UnequipItemFromSlot(slot : EEquipmentSlots, optional reequipped : bool) : bool
  6291. {
  6292. var item, bolts, id : SItemUniqueId;
  6293. var items : array<SItemUniqueId>;
  6294. var retBool : bool;
  6295. var fistsID, bolt : array<SItemUniqueId>;
  6296. var i, groupID : int;
  6297. var pam : W3PlayerAbilityManager;
  6298. var prevSkillColor : ESkillColor;
  6299. var containedAbilities : array<name>;
  6300. var dm : CDefinitionsManagerAccessor;
  6301. var armorType : EArmorType;
  6302. var isSwimming : bool;
  6303. var hud : CR4ScriptedHud;
  6304. var damagedItemModule : CR4HudModuleDamagedItems;
  6305.  
  6306. if(slot == EES_InvalidSlot || slot < 0 || slot > EnumGetMax('EEquipmentSlots') || !inv.IsIdValid(itemSlots[slot]))
  6307. return false;
  6308.  
  6309.  
  6310. if(IsSlotSkillMutagen(slot))
  6311. {
  6312.  
  6313. pam = (W3PlayerAbilityManager)abilityManager;
  6314. groupID = pam.GetSkillGroupIdOfMutagenSlot(slot);
  6315. prevSkillColor = pam.GetSkillGroupColor(groupID);
  6316. }
  6317.  
  6318.  
  6319. if(slot == EES_SilverSword || slot == EES_SteelSword)
  6320. {
  6321. PauseOilBuffs( slot == EES_SteelSword );
  6322. }
  6323.  
  6324. item = itemSlots[slot];
  6325. itemSlots[slot] = GetInvalidUniqueId();
  6326.  
  6327.  
  6328. if(inv.ItemHasTag( item, 'PhantomWeapon' ) && GetPhantomWeaponMgr())
  6329. {
  6330. DestroyPhantomWeaponMgr();
  6331. }
  6332.  
  6333.  
  6334.  
  6335.  
  6336. if( slot == EES_SilverSword && inv.ItemHasTag( item, 'Aerondight' ) )
  6337. {
  6338. RemoveBuff( EET_Aerondight );
  6339. }
  6340.  
  6341.  
  6342. if(slot == EES_RangedWeapon)
  6343. {
  6344.  
  6345. this.OnRangedForceHolster( true, true );
  6346. rangedWeapon.ClearDeployedEntity(true);
  6347. rangedWeapon = NULL;
  6348.  
  6349.  
  6350. if(GetItemEquippedOnSlot(EES_Bolt, bolts))
  6351. {
  6352. if(inv.ItemHasTag(bolts, theGame.params.TAG_INFINITE_AMMO))
  6353. {
  6354. inv.RemoveItem(bolts, inv.GetItemQuantity(bolts) );
  6355. }
  6356. }
  6357. }
  6358. else if(IsSlotSkillMutagen(slot))
  6359. {
  6360. pam.OnSkillMutagenUnequipped(item, slot, prevSkillColor);
  6361. LogSkillColors("Mutagen <<" + inv.GetItemName(item) + ">> unequipped from slot <<" + slot + ">>");
  6362. LogSkillColors("Group bonus color is now <<" + pam.GetSkillGroupColor(groupID) + ">>");
  6363. LogSkillColors("");
  6364. }
  6365.  
  6366.  
  6367. if(currentlyEquipedItem == item)
  6368. {
  6369. currentlyEquipedItem = GetInvalidUniqueId();
  6370. RaiseEvent('ForcedUsableItemUnequip');
  6371. }
  6372. if(currentlyEquipedItemL == item)
  6373. {
  6374. if ( currentlyUsedItemL )
  6375. {
  6376. currentlyUsedItemL.OnHidden( this );
  6377. }
  6378. HideUsableItem ( true );
  6379. }
  6380.  
  6381.  
  6382. if( !IsSlotPotionMutagen(slot) )
  6383. {
  6384. GetInventory().UnmountItem(item, true);
  6385. }
  6386.  
  6387. retBool = true;
  6388.  
  6389.  
  6390. if(IsAnyItemEquippedOnSlot(EES_RangedWeapon) && slot == EES_Bolt)
  6391. {
  6392. if(inv.ItemHasTag(item, theGame.params.TAG_INFINITE_AMMO))
  6393. {
  6394.  
  6395. inv.RemoveItem(item, inv.GetItemQuantityByName( inv.GetItemName(item) ) );
  6396. }
  6397. else if (!reequipped)
  6398. {
  6399.  
  6400. AddAndEquipInfiniteBolt();
  6401. }
  6402. }
  6403.  
  6404.  
  6405. if(slot == EES_SilverSword || slot == EES_SteelSword)
  6406. {
  6407. OnEquipMeleeWeapon(PW_None, true);
  6408. }
  6409.  
  6410. if( GetSelectedItemId() == item )
  6411. {
  6412. ClearSelectedItemId();
  6413. }
  6414.  
  6415. if(inv.IsItemBody(item))
  6416. {
  6417. retBool = true;
  6418. }
  6419.  
  6420. if(retBool && !reequipped)
  6421. {
  6422. theTelemetry.LogWithLabelAndValue( TE_INV_ITEM_UNEQUIPPED, inv.GetItemName(item), slot );
  6423.  
  6424.  
  6425. if(slot == EES_SteelSword && !IsAnyItemEquippedOnSlot(EES_SilverSword))
  6426. {
  6427. RemoveBuff(EET_EnhancedWeapon);
  6428. }
  6429. else if(slot == EES_SilverSword && !IsAnyItemEquippedOnSlot(EES_SteelSword))
  6430. {
  6431. RemoveBuff(EET_EnhancedWeapon);
  6432. }
  6433. else if(inv.IsItemAnyArmor(item))
  6434. {
  6435. if( !IsAnyItemEquippedOnSlot(EES_Armor) && !IsAnyItemEquippedOnSlot(EES_Gloves) && !IsAnyItemEquippedOnSlot(EES_Boots) && !IsAnyItemEquippedOnSlot(EES_Pants))
  6436. RemoveBuff(EET_EnhancedArmor);
  6437. }
  6438. }
  6439.  
  6440.  
  6441. if(inv.ItemHasAbility(item, 'MA_HtH'))
  6442. {
  6443. inv.GetItemContainedAbilities(item, containedAbilities);
  6444. fistsID = inv.GetItemsByName('fists');
  6445. dm = theGame.GetDefinitionsManager();
  6446. for(i=0; i<containedAbilities.Size(); i+=1)
  6447. {
  6448. if(dm.AbilityHasTag(containedAbilities[i], 'MA_HtH'))
  6449. {
  6450. inv.RemoveItemCraftedAbility(fistsID[0], containedAbilities[i]);
  6451. }
  6452. }
  6453. }
  6454.  
  6455.  
  6456. if(inv.IsItemAnyArmor(item))
  6457. {
  6458. armorType = inv.GetArmorType(item);
  6459. pam = (W3PlayerAbilityManager)abilityManager;
  6460.  
  6461. if(CanUseSkill(S_Perk_05) && (armorType == EAT_Light || GetCharacterStats().HasAbility('Glyphword 2 _Stats', true) || inv.ItemHasAbility(item, 'Glyphword 2 _Stats')))
  6462. {
  6463. pam.SetPerkArmorBonus(S_Perk_05);
  6464. }
  6465. if(CanUseSkill(S_Perk_06) && (armorType == EAT_Medium || GetCharacterStats().HasAbility('Glyphword 3 _Stats', true) || inv.ItemHasAbility(item, 'Glyphword 3 _Stats')) )
  6466. {
  6467. pam.SetPerkArmorBonus(S_Perk_06);
  6468. }
  6469. if(CanUseSkill(S_Perk_07) && (armorType == EAT_Heavy || GetCharacterStats().HasAbility('Glyphword 4 _Stats', true) || inv.ItemHasAbility(item, 'Glyphword 4 _Stats')) )
  6470. {
  6471. pam.SetPerkArmorBonus(S_Perk_07);
  6472. }
  6473. }
  6474.  
  6475.  
  6476. UpdateItemSetBonuses( item, false );
  6477.  
  6478.  
  6479. if( inv.ItemHasTag( item, theGame.params.ITEM_SET_TAG_BONUS ) && !IsSetBonusActive( EISB_RedWolf_2 ) )
  6480. {
  6481. SkillReduceBombAmmoBonus();
  6482. }
  6483.  
  6484. if( slot == EES_Gloves )
  6485. {
  6486. thePlayer.DestroyEffect('runeword_4');
  6487. }
  6488.  
  6489.  
  6490. hud = (CR4ScriptedHud)theGame.GetHud();
  6491. if ( hud )
  6492. {
  6493. damagedItemModule = hud.GetDamagedItemModule();
  6494. if ( damagedItemModule )
  6495. {
  6496. damagedItemModule.OnItemUnequippedFromSlot( slot );
  6497. }
  6498. }
  6499.  
  6500.  
  6501. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_OnItemEquipped );
  6502.  
  6503. return retBool;
  6504. }
  6505.  
  6506. public function UnequipItem(item : SItemUniqueId) : bool
  6507. {
  6508. if(!inv.IsIdValid(item))
  6509. return false;
  6510.  
  6511. return UnequipItemFromSlot( itemSlots.FindFirst(item) );
  6512. }
  6513.  
  6514. public function DropItem( item : SItemUniqueId, quantity : int ) : bool
  6515. {
  6516. if(!inv.IsIdValid(item))
  6517. return false;
  6518. if(IsItemEquipped(item))
  6519. return UnequipItem(item);
  6520.  
  6521. return true;
  6522. }
  6523.  
  6524.  
  6525. public function IsItemEquippedByName(itemName : name) : bool
  6526. {
  6527. var i : int;
  6528.  
  6529. for(i=0; i<itemSlots.Size(); i+=1)
  6530. if(inv.GetItemName(itemSlots[i]) == itemName)
  6531. return true;
  6532.  
  6533. return false;
  6534. }
  6535.  
  6536.  
  6537. public function IsItemEquippedByCategoryName(categoryName : name) : bool
  6538. {
  6539. var i : int;
  6540.  
  6541. for(i=0; i<itemSlots.Size(); i+=1)
  6542. if(inv.GetItemCategory(itemSlots[i]) == categoryName)
  6543. return true;
  6544.  
  6545. return false;
  6546. }
  6547.  
  6548. public function GetMaxRunEncumbrance(out usesHorseBonus : bool) : float
  6549. {
  6550. var value : float;
  6551.  
  6552. value = CalculateAttributeValue(GetHorseManager().GetHorseAttributeValue('encumbrance', false));
  6553. usesHorseBonus = (value > 0);
  6554. value += CalculateAttributeValue( GetAttributeValue('encumbrance') );
  6555.  
  6556. return value;
  6557. }
  6558.  
  6559. public function GetEncumbrance() : float
  6560. {
  6561. var i: int;
  6562. var encumbrance : float;
  6563. var items : array<SItemUniqueId>;
  6564. var inve : CInventoryComponent;
  6565.  
  6566. inve = GetInventory();
  6567. inve.GetAllItems(items);
  6568.  
  6569. for(i=0; i<items.Size(); i+=1)
  6570. {
  6571. encumbrance += inve.GetItemEncumbrance( items[i] );
  6572.  
  6573.  
  6574.  
  6575. }
  6576. return encumbrance;
  6577. }
  6578.  
  6579.  
  6580.  
  6581. public function StartInvUpdateTransaction():void
  6582. {
  6583. invUpdateTransaction = true;
  6584. }
  6585.  
  6586. public function FinishInvUpdateTransaction():void
  6587. {
  6588. invUpdateTransaction = false;
  6589.  
  6590.  
  6591.  
  6592. UpdateEncumbrance();
  6593. }
  6594.  
  6595.  
  6596. public function UpdateEncumbrance()
  6597. {
  6598. var temp : bool;
  6599.  
  6600. if (invUpdateTransaction)
  6601. {
  6602.  
  6603. return;
  6604. }
  6605.  
  6606.  
  6607.  
  6608. if ( GetEncumbrance() >= (GetMaxRunEncumbrance(temp) + 1) )
  6609. {
  6610. if( !HasBuff(EET_OverEncumbered) && FactsQuerySum( "DEBUG_EncumbranceBoy" ) == 0 )
  6611. {
  6612. AddEffectDefault(EET_OverEncumbered, NULL, "OverEncumbered");
  6613. }
  6614. }
  6615. else if(HasBuff(EET_OverEncumbered))
  6616. {
  6617. RemoveAllBuffsOfType(EET_OverEncumbered);
  6618. }
  6619. }
  6620.  
  6621. public final function GetSkillGroupIDFromIndex(idx : int) : int
  6622. {
  6623. var pam : W3PlayerAbilityManager;
  6624.  
  6625. pam = (W3PlayerAbilityManager)abilityManager;
  6626. if(pam && pam.IsInitialized())
  6627. return pam.GetSkillGroupIDFromIndex(idx);
  6628.  
  6629. return -1;
  6630. }
  6631.  
  6632. public final function GetSkillGroupColor(groupID : int) : ESkillColor
  6633. {
  6634. var pam : W3PlayerAbilityManager;
  6635.  
  6636. pam = (W3PlayerAbilityManager)abilityManager;
  6637. if(pam && pam.IsInitialized())
  6638. return pam.GetSkillGroupColor(groupID);
  6639.  
  6640. return SC_None;
  6641. }
  6642.  
  6643. public final function GetSkillGroupsCount() : int
  6644. {
  6645. var pam : W3PlayerAbilityManager;
  6646.  
  6647. pam = (W3PlayerAbilityManager)abilityManager;
  6648. if(pam && pam.IsInitialized())
  6649. return pam.GetSkillGroupsCount();
  6650.  
  6651. return 0;
  6652. }
  6653.  
  6654.  
  6655.  
  6656.  
  6657.  
  6658.  
  6659.  
  6660.  
  6661. function CycleSelectSign( bIsCyclingLeft : bool ) : ESignType
  6662. {
  6663. var signOrder : array<ESignType>;
  6664. var i : int;
  6665.  
  6666. signOrder.PushBack( ST_Yrden );
  6667. signOrder.PushBack( ST_Quen );
  6668. signOrder.PushBack( ST_Igni );
  6669. signOrder.PushBack( ST_Axii );
  6670. signOrder.PushBack( ST_Aard );
  6671.  
  6672. for( i = 0; i < signOrder.Size(); i += 1 )
  6673. if( signOrder[i] == equippedSign )
  6674. break;
  6675.  
  6676. if(bIsCyclingLeft)
  6677. return signOrder[ (4 + i) % 5 ];
  6678. else
  6679. return signOrder[ (6 + i) % 5 ];
  6680. }
  6681.  
  6682. function ToggleNextSign()
  6683. {
  6684. SetEquippedSign(CycleSelectSign( false ));
  6685. FactsAdd("SignToggled", 1, 1);
  6686. }
  6687.  
  6688. function TogglePreviousSign()
  6689. {
  6690. SetEquippedSign(CycleSelectSign( true ));
  6691. FactsAdd("SignToggled", 1, 1);
  6692. }
  6693.  
  6694. function ProcessSignEvent( eventName : name ) : bool
  6695. {
  6696. if( currentlyCastSign != ST_None && signs[currentlyCastSign].entity)
  6697. {
  6698. return signs[currentlyCastSign].entity.OnProcessSignEvent( eventName );
  6699. }
  6700.  
  6701. return false;
  6702. }
  6703.  
  6704. var findActorTargetTimeStamp : float;
  6705. var pcModeChanneledSignTimeStamp : float;
  6706. event OnProcessCastingOrientation( isContinueCasting : bool )
  6707. {
  6708. var customOrientationTarget : EOrientationTarget;
  6709. var checkHeading : float;
  6710. var rotHeading : float;
  6711. var playerToHeadingDist : float;
  6712. var slideTargetActor : CActor;
  6713. var newLockTarget : CActor;
  6714.  
  6715. var enableNoTargetOrientation : bool;
  6716.  
  6717. var currTime : float;
  6718.  
  6719. enableNoTargetOrientation = true;
  6720. if ( GetDisplayTarget() && this.IsDisplayTargetTargetable() )
  6721. {
  6722. enableNoTargetOrientation = false;
  6723. if ( theInput.GetActionValue( 'CastSignHold' ) > 0 || this.IsCurrentSignChanneled() )
  6724. {
  6725. if ( IsPCModeEnabled() )
  6726. {
  6727. if ( EngineTimeToFloat( theGame.GetEngineTime() ) > pcModeChanneledSignTimeStamp + 1.f )
  6728. enableNoTargetOrientation = true;
  6729. }
  6730. else
  6731. {
  6732. if ( GetCurrentlyCastSign() == ST_Igni || GetCurrentlyCastSign() == ST_Axii )
  6733. {
  6734. slideTargetActor = (CActor)GetDisplayTarget();
  6735. if ( slideTargetActor
  6736. && ( !slideTargetActor.GetGameplayVisibility() || !CanBeTargetedIfSwimming( slideTargetActor ) || !slideTargetActor.IsAlive() ) )
  6737. {
  6738. SetSlideTarget( NULL );
  6739. if ( ProcessLockTarget() )
  6740. slideTargetActor = (CActor)slideTarget;
  6741. }
  6742.  
  6743. if ( !slideTargetActor )
  6744. {
  6745. LockToTarget( false );
  6746. enableNoTargetOrientation = true;
  6747. }
  6748. else if ( IsThreat( slideTargetActor ) || GetCurrentlyCastSign() == ST_Axii )
  6749. LockToTarget( true );
  6750. else
  6751. {
  6752. LockToTarget( false );
  6753. enableNoTargetOrientation = true;
  6754. }
  6755. }
  6756. }
  6757. }
  6758.  
  6759. if ( !enableNoTargetOrientation )
  6760. {
  6761. customOrientationTarget = OT_Actor;
  6762. }
  6763. }
  6764.  
  6765. if ( enableNoTargetOrientation )
  6766. {
  6767. if ( GetPlayerCombatStance() == PCS_AlertNear && theInput.GetActionValue( 'CastSignHold' ) > 0 )
  6768. {
  6769. if ( GetDisplayTarget() && !slideTargetActor )
  6770. {
  6771. currTime = EngineTimeToFloat( theGame.GetEngineTime() );
  6772. if ( currTime > findActorTargetTimeStamp + 1.5f )
  6773. {
  6774. findActorTargetTimeStamp = currTime;
  6775.  
  6776. newLockTarget = GetScreenSpaceLockTarget( GetDisplayTarget(), 180.f, 1.f, 0.f, true );
  6777.  
  6778. if ( newLockTarget && IsThreat( newLockTarget ) && IsCombatMusicEnabled() )
  6779. {
  6780. SetTarget( newLockTarget, true );
  6781. SetMoveTargetChangeAllowed( true );
  6782. SetMoveTarget( newLockTarget );
  6783. SetMoveTargetChangeAllowed( false );
  6784. SetSlideTarget( newLockTarget );
  6785. }
  6786. }
  6787. }
  6788. else
  6789. ProcessLockTarget();
  6790. }
  6791.  
  6792. if ( wasBRAxisPushed )
  6793. customOrientationTarget = OT_CameraOffset;
  6794. else
  6795. {
  6796. if ( !lastAxisInputIsMovement || theInput.LastUsedPCInput() )
  6797. customOrientationTarget = OT_CameraOffset;
  6798. else if ( theInput.GetActionValue( 'CastSignHold' ) > 0 )
  6799. {
  6800. if ( GetOrientationTarget() == OT_CameraOffset )
  6801. customOrientationTarget = OT_CameraOffset;
  6802. else if ( GetPlayerCombatStance() == PCS_AlertNear || GetPlayerCombatStance() == PCS_Guarded )
  6803. customOrientationTarget = OT_CameraOffset;
  6804. else
  6805. customOrientationTarget = OT_Player;
  6806. }
  6807. else
  6808. customOrientationTarget = OT_CustomHeading;
  6809. }
  6810. }
  6811.  
  6812. if ( GetCurrentlyCastSign() == ST_Quen )
  6813. {
  6814. if ( theInput.LastUsedPCInput() )
  6815. {
  6816. customOrientationTarget = OT_Camera;
  6817. }
  6818. else if ( IsCurrentSignChanneled() )
  6819. {
  6820. if ( bLAxisReleased )
  6821. customOrientationTarget = OT_Player;
  6822. else
  6823. customOrientationTarget = OT_Camera;
  6824. }
  6825. else
  6826. customOrientationTarget = OT_Player;
  6827. }
  6828.  
  6829. if ( GetCurrentlyCastSign() == ST_Axii && IsCurrentSignChanneled() )
  6830. {
  6831. if ( slideTarget && (CActor)slideTarget )
  6832. {
  6833. checkHeading = VecHeading( slideTarget.GetWorldPosition() - this.GetWorldPosition() );
  6834. rotHeading = checkHeading;
  6835. playerToHeadingDist = AngleDistance( GetHeading(), checkHeading );
  6836.  
  6837. if ( playerToHeadingDist > 45 )
  6838. SetCustomRotation( 'ChanneledSignAxii', rotHeading, 0.0, 0.5, false );
  6839. else if ( playerToHeadingDist < -45 )
  6840. SetCustomRotation( 'ChanneledSignAxii', rotHeading, 0.0, 0.5, false );
  6841. }
  6842. else
  6843. {
  6844. checkHeading = VecHeading( theCamera.GetCameraDirection() );
  6845. rotHeading = GetHeading();
  6846. playerToHeadingDist = AngleDistance( GetHeading(), checkHeading );
  6847.  
  6848. if ( playerToHeadingDist > 45 )
  6849. SetCustomRotation( 'ChanneledSignAxii', rotHeading - 22.5, 0.0, 0.5, false );
  6850. else if ( playerToHeadingDist < -45 )
  6851. SetCustomRotation( 'ChanneledSignAxii', rotHeading + 22.5, 0.0, 0.5, false );
  6852. }
  6853. }
  6854.  
  6855. if ( IsActorLockedToTarget() )
  6856. customOrientationTarget = OT_Actor;
  6857.  
  6858. AddCustomOrientationTarget( customOrientationTarget, 'Signs' );
  6859.  
  6860. if ( customOrientationTarget == OT_CustomHeading )
  6861. SetOrientationTargetCustomHeading( GetCombatActionHeading(), 'Signs' );
  6862. }
  6863.  
  6864. event OnRaiseSignEvent()
  6865. {
  6866. var newTarget : CActor;
  6867.  
  6868. if ( ( !IsCombatMusicEnabled() && !CanAttackWhenNotInCombat( EBAT_CastSign, false, newTarget ) ) || ( IsOnBoat() && !IsCombatMusicEnabled() ) )
  6869. {
  6870. if ( CastSignFriendly() )
  6871. return true;
  6872. }
  6873. else
  6874. {
  6875. RaiseEvent('CombatActionFriendlyEnd');
  6876. SetBehaviorVariable( 'SignNum', (int)equippedSign );
  6877. SetBehaviorVariable( 'combatActionType', (int)CAT_CastSign );
  6878.  
  6879. if ( IsPCModeEnabled() )
  6880. pcModeChanneledSignTimeStamp = EngineTimeToFloat( theGame.GetEngineTime() );
  6881.  
  6882. if( RaiseForceEvent('CombatAction') )
  6883. {
  6884. OnCombatActionStart();
  6885. findActorTargetTimeStamp = EngineTimeToFloat( theGame.GetEngineTime() );
  6886. theTelemetry.LogWithValueStr(TE_FIGHT_PLAYER_USE_SIGN, SignEnumToString( equippedSign ));
  6887. return true;
  6888. }
  6889. }
  6890.  
  6891. return false;
  6892. }
  6893.  
  6894. function CastSignFriendly() : bool
  6895. {
  6896. var actor : CActor;
  6897.  
  6898. SetBehaviorVariable( 'combatActionTypeForOverlay', (int)CAT_CastSign );
  6899. if ( RaiseCombatActionFriendlyEvent() )
  6900. {
  6901.  
  6902. return true;
  6903. }
  6904.  
  6905. return false;
  6906. }
  6907.  
  6908. function CastSign() : bool
  6909. {
  6910. var equippedSignStr : string;
  6911. var newSignEnt : W3SignEntity;
  6912. var spawnPos : Vector;
  6913. var slotMatrix : Matrix;
  6914. var target : CActor;
  6915.  
  6916. if ( IsInAir() )
  6917. {
  6918. return false;
  6919. }
  6920.  
  6921. AddTemporarySkills();
  6922.  
  6923.  
  6924.  
  6925. if(equippedSign == ST_Aard)
  6926. {
  6927. CalcEntitySlotMatrix('l_weapon', slotMatrix);
  6928. spawnPos = MatrixGetTranslation(slotMatrix);
  6929. }
  6930. else
  6931. {
  6932. spawnPos = GetWorldPosition();
  6933. }
  6934.  
  6935. if( equippedSign == ST_Aard || equippedSign == ST_Igni )
  6936. {
  6937. target = GetTarget();
  6938. if(target)
  6939. target.SignalGameplayEvent( 'DodgeSign' );
  6940. }
  6941.  
  6942. m_TriggerEffectDisablePending = true;
  6943. m_TriggerEffectDisableTTW = 0.3;
  6944.  
  6945. newSignEnt = (W3SignEntity)theGame.CreateEntity( signs[equippedSign].template, spawnPos, GetWorldRotation() );
  6946. return newSignEnt.Init( signOwner, signs[equippedSign].entity );
  6947. }
  6948.  
  6949.  
  6950. private function HAX_SignToThrowItemRestore()
  6951. {
  6952. var action : SInputAction;
  6953.  
  6954. action.value = theInput.GetActionValue('ThrowItemHold');
  6955. action.lastFrameValue = 0;
  6956.  
  6957. if(IsPressed(action) && CanSetupCombatAction_Throw())
  6958. {
  6959. if(inv.IsItemBomb(selectedItemId))
  6960. {
  6961. BombThrowStart();
  6962. }
  6963. else
  6964. {
  6965. UsableItemStart();
  6966. }
  6967.  
  6968. SetThrowHold( true );
  6969. }
  6970. }
  6971.  
  6972. event OnCFMCameraZoomFail(){}
  6973.  
  6974.  
  6975.  
  6976. public final function GetDrunkMutagens( optional sourceName : string ) : array<CBaseGameplayEffect>
  6977. {
  6978. return effectManager.GetDrunkMutagens( sourceName );
  6979. }
  6980.  
  6981. public final function GetPotionBuffs() : array<CBaseGameplayEffect>
  6982. {
  6983. return effectManager.GetPotionBuffs();
  6984. }
  6985.  
  6986. public final function RecalcPotionsDurations()
  6987. {
  6988. var i : int;
  6989. var buffs : array<CBaseGameplayEffect>;
  6990.  
  6991. buffs = GetPotionBuffs();
  6992. for(i=0; i<buffs.Size(); i+=1)
  6993. {
  6994. buffs[i].RecalcPotionDuration();
  6995. }
  6996. }
  6997.  
  6998. public function StartFrenzy()
  6999. {
  7000. var ratio, duration : float;
  7001. var skillLevel : int;
  7002.  
  7003. isInFrenzy = true;
  7004. skillLevel = GetSkillLevel(S_Alchemy_s16);
  7005. ratio = 0.48f - skillLevel * CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s16, 'slowdown_ratio', false, true));
  7006. duration = skillLevel * CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s16, 'slowdown_duration', false, true));
  7007.  
  7008. theGame.SetTimeScale(ratio, theGame.GetTimescaleSource(ETS_SkillFrenzy), theGame.GetTimescalePriority(ETS_SkillFrenzy) );
  7009. AddTimer('SkillFrenzyFinish', duration * ratio, , , , true);
  7010. }
  7011.  
  7012. timer function SkillFrenzyFinish(dt : float, optional id : int)
  7013. {
  7014. theGame.RemoveTimeScale( theGame.GetTimescaleSource(ETS_SkillFrenzy) );
  7015. isInFrenzy = false;
  7016. }
  7017.  
  7018. public function GetToxicityDamageThreshold() : float
  7019. {
  7020. var ret : float;
  7021.  
  7022. ret = theGame.params.TOXICITY_DAMAGE_THRESHOLD;
  7023.  
  7024. if(CanUseSkill(S_Alchemy_s01))
  7025. ret += CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s01, 'threshold', false, true)) * GetSkillLevel(S_Alchemy_s01);
  7026.  
  7027. return ret;
  7028. }
  7029.  
  7030.  
  7031.  
  7032. public final function AddToxicityOffset( val : float)
  7033. {
  7034. ((W3PlayerAbilityManager)abilityManager).AddToxicityOffset(val);
  7035. }
  7036.  
  7037. public final function SetToxicityOffset( val : float)
  7038. {
  7039. ((W3PlayerAbilityManager)abilityManager).SetToxicityOffset(val);
  7040. }
  7041.  
  7042. public final function RemoveToxicityOffset( val : float)
  7043. {
  7044. ((W3PlayerAbilityManager)abilityManager).RemoveToxicityOffset(val);
  7045. }
  7046.  
  7047.  
  7048. public final function CalculatePotionDuration(item : SItemUniqueId, isMutagenPotion : bool, optional itemName : name) : float
  7049. {
  7050. var duration, skillPassiveMod, mutagenSkillMod : float;
  7051. var val, min, max : SAbilityAttributeValue;
  7052.  
  7053.  
  7054. if(inv.IsIdValid(item))
  7055. {
  7056. duration = CalculateAttributeValue(inv.GetItemAttributeValue(item, 'duration'));
  7057. }
  7058. else
  7059. {
  7060. theGame.GetDefinitionsManager().GetItemAttributeValueNoRandom(itemName, true, 'duration', min, max);
  7061. duration = CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  7062. }
  7063.  
  7064. skillPassiveMod = CalculateAttributeValue(GetAttributeValue('potion_duration'));
  7065.  
  7066. if(isMutagenPotion && CanUseSkill(S_Alchemy_s14))
  7067. {
  7068. val = GetSkillAttributeValue(S_Alchemy_s14, 'duration', false, true);
  7069. mutagenSkillMod = val.valueMultiplicative * GetSkillLevel(S_Alchemy_s14);
  7070. }
  7071.  
  7072. duration = duration * (1 + skillPassiveMod + mutagenSkillMod);
  7073.  
  7074.  
  7075. if( IsSetBonusActive( EISB_Netflix_1 ) )
  7076. {
  7077. duration += (duration * (amountOfSetPiecesEquipped[ EIST_Netflix ] * 7 )) / 100 ;
  7078. }
  7079.  
  7080. return duration;
  7081. }
  7082.  
  7083. public function ToxicityLowEnoughToDrinkPotion( slotid : EEquipmentSlots, optional itemId : SItemUniqueId ) : bool
  7084. {
  7085. var item : SItemUniqueId;
  7086. var maxTox : float;
  7087. var potionToxicity : float;
  7088. var toxicityOffset : float;
  7089. var effectType : EEffectType;
  7090. var customAbilityName : name;
  7091.  
  7092. if(itemId != GetInvalidUniqueId())
  7093. item = itemId;
  7094. else
  7095. item = itemSlots[slotid];
  7096.  
  7097. inv.GetPotionItemBuffData(item, effectType, customAbilityName);
  7098. maxTox = abilityManager.GetStatMax(BCS_Toxicity);
  7099. potionToxicity = CalculateAttributeValue(inv.GetItemAttributeValue(item, 'toxicity'));
  7100. toxicityOffset = CalculateAttributeValue(inv.GetItemAttributeValue(item, 'toxicity_offset'));
  7101.  
  7102. if(effectType != EET_WhiteHoney)
  7103. {
  7104. if(abilityManager.GetStat(BCS_Toxicity, false) + potionToxicity + toxicityOffset > maxTox )
  7105. {
  7106. return false;
  7107. }
  7108. }
  7109.  
  7110. return true;
  7111. }
  7112.  
  7113. public final function HasFreeToxicityToDrinkPotion( item : SItemUniqueId, effectType : EEffectType, out finalPotionToxicity : float ) : bool
  7114. {
  7115. var i : int;
  7116. var maxTox, toxicityOffset, adrenaline : float;
  7117. var costReduction : SAbilityAttributeValue;
  7118.  
  7119.  
  7120. if( effectType == EET_WhiteHoney )
  7121. {
  7122. return true;
  7123. }
  7124.  
  7125.  
  7126. maxTox = abilityManager.GetStatMax(BCS_Toxicity);
  7127. finalPotionToxicity = CalculateAttributeValue(inv.GetItemAttributeValue(item, 'toxicity'));
  7128. toxicityOffset = CalculateAttributeValue(inv.GetItemAttributeValue(item, 'toxicity_offset'));
  7129.  
  7130.  
  7131. if(CanUseSkill(S_Perk_13))
  7132. {
  7133. costReduction = GetSkillAttributeValue(S_Perk_13, 'cost_reduction', false, true);
  7134. adrenaline = FloorF(GetStat(BCS_Focus));
  7135. costReduction = costReduction * adrenaline;
  7136. finalPotionToxicity = (finalPotionToxicity - costReduction.valueBase) * (1 - costReduction.valueMultiplicative) - costReduction.valueAdditive;
  7137. finalPotionToxicity = MaxF(0.f, finalPotionToxicity);
  7138. }
  7139.  
  7140.  
  7141. if(abilityManager.GetStat(BCS_Toxicity, false) + finalPotionToxicity + toxicityOffset > maxTox )
  7142. {
  7143. return false;
  7144. }
  7145.  
  7146. return true;
  7147. }
  7148.  
  7149. public function DrinkPreparedPotion( slotid : EEquipmentSlots, optional itemId : SItemUniqueId )
  7150. {
  7151. var potParams : W3PotionParams;
  7152. var potionParams : SCustomEffectParams;
  7153. var factPotionParams : W3Potion_Fact_Params;
  7154. var adrenaline, hpGainValue, duration, finalPotionToxicity : float;
  7155. var ret : EEffectInteract;
  7156. var effectType : EEffectType;
  7157. var item : SItemUniqueId;
  7158. var customAbilityName, factId : name;
  7159. var atts : array<name>;
  7160. var i : int;
  7161. var mutagenParams : W3MutagenBuffCustomParams;
  7162.  
  7163.  
  7164. if(itemId != GetInvalidUniqueId())
  7165. item = itemId;
  7166. else
  7167. item = itemSlots[slotid];
  7168.  
  7169.  
  7170. if(!inv.IsIdValid(item))
  7171. return;
  7172.  
  7173.  
  7174. if( inv.SingletonItemGetAmmo(item) == 0 )
  7175. return;
  7176.  
  7177.  
  7178. inv.GetPotionItemBuffData(item, effectType, customAbilityName);
  7179.  
  7180.  
  7181. if( !HasFreeToxicityToDrinkPotion( item, effectType, finalPotionToxicity ) )
  7182. {
  7183. return;
  7184. }
  7185.  
  7186.  
  7187. if(effectType == EET_Fact)
  7188. {
  7189. inv.GetItemAttributes(item, atts);
  7190.  
  7191. for(i=0; i<atts.Size(); i+=1)
  7192. {
  7193. if(StrBeginsWith(NameToString(atts[i]), "fact_"))
  7194. {
  7195. factId = atts[i];
  7196. break;
  7197. }
  7198. }
  7199.  
  7200. factPotionParams = new W3Potion_Fact_Params in theGame;
  7201. factPotionParams.factName = factId;
  7202. factPotionParams.potionItemName = inv.GetItemName(item);
  7203.  
  7204. potionParams.buffSpecificParams = factPotionParams;
  7205. }
  7206.  
  7207. else if(inv.ItemHasTag( item, 'Mutagen' ))
  7208. {
  7209. mutagenParams = new W3MutagenBuffCustomParams in theGame;
  7210. mutagenParams.toxicityOffset = CalculateAttributeValue(inv.GetItemAttributeValue(item, 'toxicity_offset'));
  7211. mutagenParams.potionItemName = inv.GetItemName(item);
  7212.  
  7213. finalPotionToxicity += 0.001f;
  7214.  
  7215. potionParams.buffSpecificParams = mutagenParams;
  7216.  
  7217. if( IsMutationActive( EPMT_Mutation10 ) && !HasBuff( EET_Mutation10 ) )
  7218. {
  7219. AddEffectDefault( EET_Mutation10, this, "Mutation 10" );
  7220. }
  7221. }
  7222.  
  7223. else
  7224. {
  7225. potParams = new W3PotionParams in theGame;
  7226. potParams.potionItemName = inv.GetItemName(item);
  7227.  
  7228. potionParams.buffSpecificParams = potParams;
  7229. }
  7230.  
  7231.  
  7232. duration = CalculatePotionDuration(item, inv.ItemHasTag( item, 'Mutagen' ));
  7233.  
  7234.  
  7235. potionParams.effectType = effectType;
  7236. potionParams.creator = this;
  7237. potionParams.sourceName = "drank_potion";
  7238. potionParams.duration = duration;
  7239. potionParams.customAbilityName = customAbilityName;
  7240. ret = AddEffectCustom(potionParams);
  7241.  
  7242.  
  7243. if(factPotionParams)
  7244. delete factPotionParams;
  7245.  
  7246. if(mutagenParams)
  7247. delete mutagenParams;
  7248.  
  7249.  
  7250. inv.SingletonItemRemoveAmmo(item);
  7251.  
  7252.  
  7253. if(ret == EI_Pass || ret == EI_Override || ret == EI_Cumulate)
  7254. {
  7255. if( finalPotionToxicity > 0.f )
  7256. {
  7257. abilityManager.GainStat(BCS_Toxicity, finalPotionToxicity );
  7258. }
  7259.  
  7260.  
  7261. if(CanUseSkill(S_Perk_13))
  7262. {
  7263. abilityManager.DrainFocus(adrenaline);
  7264. }
  7265.  
  7266. if (!IsEffectActive('invisible'))
  7267. {
  7268. PlayEffect('use_potion');
  7269. }
  7270.  
  7271. if ( inv.ItemHasTag( item, 'Mutagen' ) )
  7272. {
  7273.  
  7274. theGame.GetGamerProfile().CheckTrialOfGrasses();
  7275.  
  7276.  
  7277. SetFailedFundamentalsFirstAchievementCondition(true);
  7278. }
  7279.  
  7280.  
  7281. if(CanUseSkill(S_Alchemy_s02))
  7282. {
  7283. hpGainValue = ClampF(GetStatMax(BCS_Vitality) * CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s02, 'vitality_gain_perc', false, true)) * GetSkillLevel(S_Alchemy_s02), 0, GetStatMax(BCS_Vitality));
  7284. GainStat(BCS_Vitality, hpGainValue);
  7285. }
  7286.  
  7287.  
  7288. if(CanUseSkill(S_Alchemy_s04) && !skillBonusPotionEffect && (RandF() < CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s04, 'apply_chance', false, true)) * GetSkillLevel(S_Alchemy_s04)))
  7289. {
  7290. AddRandomPotionEffectFromAlch4Skill( effectType );
  7291. }
  7292.  
  7293. theGame.GetGamerProfile().SetStat(ES_ActivePotions, effectManager.GetPotionBuffsCount());
  7294. }
  7295.  
  7296. theTelemetry.LogWithLabel(TE_ELIXIR_USED, inv.GetItemName(item));
  7297.  
  7298. if(ShouldProcessTutorial('TutorialPotionAmmo'))
  7299. {
  7300. FactsAdd("tut_used_potion");
  7301. }
  7302.  
  7303. SetFailedFundamentalsFirstAchievementCondition(true);
  7304. }
  7305.  
  7306.  
  7307. private final function AddRandomPotionEffectFromAlch4Skill( currentlyDrankPotion : EEffectType )
  7308. {
  7309. var randomPotions : array<EEffectType>;
  7310. var currentPotion : CBaseGameplayEffect;
  7311. var effectsOld, effectsNew : array<CBaseGameplayEffect>;
  7312. var i, ind : int;
  7313. var duration : float;
  7314. var params : SCustomEffectParams;
  7315. var ret : EEffectInteract;
  7316.  
  7317.  
  7318. randomPotions.PushBack( EET_BlackBlood );
  7319. randomPotions.PushBack( EET_Blizzard );
  7320. randomPotions.PushBack( EET_FullMoon );
  7321. randomPotions.PushBack( EET_GoldenOriole );
  7322.  
  7323. randomPotions.PushBack( EET_MariborForest );
  7324. randomPotions.PushBack( EET_PetriPhiltre );
  7325. randomPotions.PushBack( EET_Swallow );
  7326. randomPotions.PushBack( EET_TawnyOwl );
  7327. randomPotions.PushBack( EET_Thunderbolt );
  7328.  
  7329.  
  7330. randomPotions.Remove( currentlyDrankPotion );
  7331.  
  7332.  
  7333. ind = RandRange( randomPotions.Size() );
  7334.  
  7335.  
  7336. if( HasBuff( randomPotions[ ind ] ) )
  7337. {
  7338. currentPotion = GetBuff( randomPotions[ ind ] );
  7339. currentPotion.SetTimeLeft( currentPotion.GetInitialDurationAfterResists() );
  7340. }
  7341.  
  7342. else
  7343. {
  7344. duration = BonusPotionGetDurationFromXML( randomPotions[ ind ] );
  7345.  
  7346. if(duration > 0)
  7347. {
  7348. effectsOld = GetCurrentEffects();
  7349.  
  7350. params.effectType = randomPotions[ ind ];
  7351. params.creator = this;
  7352. params.sourceName = SkillEnumToName( S_Alchemy_s04 );
  7353. params.duration = duration;
  7354. ret = AddEffectCustom( params );
  7355.  
  7356.  
  7357. if( ret != EI_Undefined && ret != EI_Deny )
  7358. {
  7359. effectsNew = GetCurrentEffects();
  7360.  
  7361. ind = -1;
  7362. for( i=effectsNew.Size()-1; i>=0; i-=1)
  7363. {
  7364. if( !effectsOld.Contains( effectsNew[i] ) )
  7365. {
  7366. ind = i;
  7367. break;
  7368. }
  7369. }
  7370.  
  7371. if(ind > -1)
  7372. {
  7373. skillBonusPotionEffect = effectsNew[ind];
  7374. }
  7375. }
  7376. }
  7377. }
  7378. }
  7379.  
  7380.  
  7381. private function BonusPotionGetDurationFromXML(type : EEffectType) : float
  7382. {
  7383. var dm : CDefinitionsManagerAccessor;
  7384. var main, ingredients : SCustomNode;
  7385. var tmpName, typeName, itemName : name;
  7386. var abs : array<name>;
  7387. var min, max : SAbilityAttributeValue;
  7388. var tmpInt : int;
  7389. var temp : array<float>;
  7390. var i, temp2, temp3 : int;
  7391.  
  7392. dm = theGame.GetDefinitionsManager();
  7393. main = dm.GetCustomDefinition('alchemy_recipes');
  7394. typeName = EffectTypeToName(type);
  7395.  
  7396.  
  7397. for(i=0; i<main.subNodes.Size(); i+=1)
  7398. {
  7399. if(dm.GetCustomNodeAttributeValueName(main.subNodes[i], 'type_name', tmpName))
  7400. {
  7401.  
  7402. if(tmpName == typeName)
  7403. {
  7404. if(dm.GetCustomNodeAttributeValueInt(main.subNodes[i], 'level', tmpInt))
  7405. {
  7406.  
  7407. if(tmpInt == 1)
  7408. {
  7409. if(dm.GetCustomNodeAttributeValueName(main.subNodes[i], 'cookedItem_name', itemName))
  7410. {
  7411.  
  7412. if(IsNameValid(itemName))
  7413. {
  7414. break;
  7415. }
  7416. }
  7417. }
  7418. }
  7419. }
  7420. }
  7421. }
  7422.  
  7423. if(!IsNameValid(itemName))
  7424. return 0;
  7425.  
  7426.  
  7427. dm.GetItemAbilitiesWithWeights(itemName, true, abs, temp, temp2, temp3);
  7428. dm.GetAbilitiesAttributeValue(abs, 'duration', min, max);
  7429. return CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  7430. }
  7431.  
  7432. public function ClearSkillBonusPotionEffect()
  7433. {
  7434. skillBonusPotionEffect = NULL;
  7435. }
  7436.  
  7437. public function GetSkillBonusPotionEffect() : CBaseGameplayEffect
  7438. {
  7439. return skillBonusPotionEffect;
  7440. }
  7441.  
  7442.  
  7443.  
  7444.  
  7445.  
  7446.  
  7447.  
  7448. public final function HasRunewordActive(abilityName : name) : bool
  7449. {
  7450. var item : SItemUniqueId;
  7451. var hasRuneword : bool;
  7452.  
  7453. if(GetItemEquippedOnSlot(EES_SteelSword, item))
  7454. {
  7455. hasRuneword = inv.ItemHasAbility(item, abilityName);
  7456. }
  7457.  
  7458. if(!hasRuneword)
  7459. {
  7460. if(GetItemEquippedOnSlot(EES_SilverSword, item))
  7461. {
  7462. hasRuneword = inv.ItemHasAbility(item, abilityName);
  7463. }
  7464. }
  7465.  
  7466. return hasRuneword;
  7467. }
  7468.  
  7469. public final function GetShrineBuffs() : array<CBaseGameplayEffect>
  7470. {
  7471. var null : array<CBaseGameplayEffect>;
  7472.  
  7473. if(effectManager && effectManager.IsReady())
  7474. return effectManager.GetShrineBuffs();
  7475.  
  7476. return null;
  7477. }
  7478.  
  7479. public final function AddRepairObjectBuff(armor : bool, weapon : bool) : bool
  7480. {
  7481. var added : bool;
  7482.  
  7483. added = false;
  7484.  
  7485. if(weapon && (IsAnyItemEquippedOnSlot(EES_SilverSword) || IsAnyItemEquippedOnSlot(EES_SteelSword)) )
  7486. {
  7487. AddEffectDefault(EET_EnhancedWeapon, this, "repair_object", false);
  7488. added = true;
  7489. }
  7490.  
  7491. if(armor && (IsAnyItemEquippedOnSlot(EES_Armor) || IsAnyItemEquippedOnSlot(EES_Gloves) || IsAnyItemEquippedOnSlot(EES_Boots) || IsAnyItemEquippedOnSlot(EES_Pants)) )
  7492. {
  7493. AddEffectDefault(EET_EnhancedArmor, this, "repair_object", false);
  7494. added = true;
  7495. }
  7496.  
  7497. return added;
  7498. }
  7499.  
  7500.  
  7501. public function StartCSAnim(buff : CBaseGameplayEffect) : bool
  7502. {
  7503.  
  7504. if(IsAnyQuenActive() && (W3CriticalDOTEffect)buff)
  7505. return false;
  7506.  
  7507. return super.StartCSAnim(buff);
  7508. }
  7509.  
  7510. public function GetPotionBuffLevel(effectType : EEffectType) : int
  7511. {
  7512. if(effectManager && effectManager.IsReady())
  7513. return effectManager.GetPotionBuffLevel(effectType);
  7514.  
  7515. return 0;
  7516. }
  7517.  
  7518.  
  7519.  
  7520.  
  7521.  
  7522.  
  7523.  
  7524. event OnLevelGained(currentLevel : int, show : bool)
  7525. {
  7526.  
  7527. var swords : array<SItemUniqueId>;
  7528. var i : int;
  7529.  
  7530.  
  7531. var hud : CR4ScriptedHud;
  7532. hud = (CR4ScriptedHud)theGame.GetHud();
  7533.  
  7534. if(abilityManager && abilityManager.IsInitialized())
  7535. {
  7536. ((W3PlayerAbilityManager)abilityManager).OnLevelGained(currentLevel);
  7537. }
  7538.  
  7539. if ( theGame.GetDifficultyMode() != EDM_Hardcore )
  7540. {
  7541. Heal(GetStatMax(BCS_Vitality));
  7542. }
  7543.  
  7544.  
  7545. if(currentLevel >= 35)
  7546. {
  7547. theGame.GetGamerProfile().AddAchievement(EA_Immortal);
  7548. }
  7549. else
  7550. {
  7551. theGame.GetGamerProfile().NoticeAchievementProgress(EA_Immortal, currentLevel);
  7552. }
  7553.  
  7554. if ( hud && currentLevel < levelManager.GetMaxLevel() && FactsQuerySum( "DebugNoLevelUpUpdates" ) == 0 )
  7555. {
  7556. hud.OnLevelUpUpdate(currentLevel, show);
  7557. }
  7558.  
  7559.  
  7560. swords = inv.GetItemsByName('sq304 Novigraadan sword 4');
  7561. for(i=0;i<swords.Size();i+=1)
  7562. {
  7563. inv.AddItemCraftedAbility(swords[i], 'sq304_sword_upgrade _Stats', true);
  7564. }
  7565.  
  7566. swords.Clear();
  7567. swords = inv.GetItemsByName('q402 Skellige sword 3');
  7568. for(i=0;i<swords.Size();i+=1)
  7569. {
  7570. inv.AddItemCraftedAbility(swords[i], 'q402_sword_upgrade _Stats', true);
  7571. }
  7572.  
  7573.  
  7574. theGame.RequestAutoSave( "level gained", false );
  7575. }
  7576.  
  7577. public function GetSignStats(skill : ESkill, out damageType : name, out damageVal : float, out spellPower : SAbilityAttributeValue)
  7578. {
  7579. var i, size : int;
  7580. var dm : CDefinitionsManagerAccessor;
  7581. var attrs : array<name>;
  7582.  
  7583. spellPower = GetPowerStatValue(CPS_SpellPower);
  7584.  
  7585. dm = theGame.GetDefinitionsManager();
  7586. dm.GetAbilityAttributes(GetSkillAbilityName(skill), attrs);
  7587. size = attrs.Size();
  7588.  
  7589. for( i = 0; i < size; i += 1 )
  7590. {
  7591. if( IsDamageTypeNameValid(attrs[i]) )
  7592. {
  7593. damageVal = CalculateAttributeValue(GetSkillAttributeValue(skill, attrs[i], false, true));
  7594. damageType = attrs[i];
  7595. break;
  7596. }
  7597. }
  7598. }
  7599.  
  7600.  
  7601. public function SetIgnorePainMaxVitality(val : float)
  7602. {
  7603. if(abilityManager && abilityManager.IsInitialized())
  7604. abilityManager.SetStatPointMax(BCS_Vitality, val);
  7605. }
  7606.  
  7607. event OnAnimEvent_ActionBlend( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  7608. {
  7609. if ( animEventType == AET_DurationStart && !disableActionBlend )
  7610. {
  7611. if ( this.IsCastingSign() )
  7612. ProcessSignEvent( 'cast_end' );
  7613.  
  7614.  
  7615. FindMoveTarget();
  7616. SetCanPlayHitAnim( true );
  7617. this.SetBIsCombatActionAllowed( true );
  7618.  
  7619. if ( this.GetFinisherVictim() && this.GetFinisherVictim().HasAbility( 'ForceFinisher' ) && !isInFinisher )
  7620. {
  7621. this.GetFinisherVictim().SignalGameplayEvent( 'Finisher' );
  7622. }
  7623. else if (this.BufferCombatAction != EBAT_EMPTY )
  7624. {
  7625.  
  7626.  
  7627.  
  7628. if ( !IsCombatMusicEnabled() )
  7629. {
  7630. SetCombatActionHeading( ProcessCombatActionHeading( this.BufferCombatAction ) );
  7631. FindTarget();
  7632. UpdateDisplayTarget( true );
  7633. }
  7634.  
  7635. if ( AllowAttack( GetTarget(), this.BufferCombatAction ) )
  7636. this.ProcessCombatActionBuffer();
  7637. }
  7638. else
  7639. {
  7640.  
  7641. ResumeStaminaRegen( 'InsideCombatAction' );
  7642.  
  7643.  
  7644.  
  7645. }
  7646. }
  7647. else if ( disableActionBlend )
  7648. {
  7649. disableActionBlend = false;
  7650. }
  7651. }
  7652.  
  7653.  
  7654. event OnAnimEvent_Sign( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  7655. {
  7656. if( animEventType == AET_Tick )
  7657. {
  7658. ProcessSignEvent( animEventName );
  7659. }
  7660. }
  7661.  
  7662. event OnAnimEvent_Throwable( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  7663. {
  7664. var thrownEntity : CThrowable;
  7665.  
  7666. thrownEntity = (CThrowable)EntityHandleGet( thrownEntityHandle );
  7667.  
  7668. if ( inv.IsItemCrossbow( inv.GetItemFromSlot('l_weapon') ) && rangedWeapon.OnProcessThrowEvent( animEventName ) )
  7669. {
  7670. return true;
  7671. }
  7672. else if( thrownEntity && IsThrowingItem() && thrownEntity.OnProcessThrowEvent( animEventName ) )
  7673. {
  7674. return true;
  7675. }
  7676. }
  7677.  
  7678. event OnTaskSyncAnim( npc : CNewNPC, animNameLeft : name )
  7679. {
  7680. var tmpBool : bool;
  7681. var tmpName : name;
  7682. var damage, points, resistance : float;
  7683. var min, max : SAbilityAttributeValue;
  7684. var mc : EMonsterCategory;
  7685.  
  7686. super.OnTaskSyncAnim( npc, animNameLeft );
  7687.  
  7688. if( animNameLeft == 'BruxaBite' && IsMutationActive( EPMT_Mutation4 ) )
  7689. {
  7690. theGame.GetMonsterParamsForActor( npc, mc, tmpName, tmpBool, tmpBool, tmpBool );
  7691.  
  7692. if( mc == MC_Vampire )
  7693. {
  7694. GetResistValue( CDS_BleedingRes, points, resistance );
  7695.  
  7696. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'BleedingEffect', 'DirectDamage', min, max );
  7697. damage = MaxF( 0.f, max.valueMultiplicative * GetMaxHealth() - points );
  7698.  
  7699. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'BleedingEffect', 'duration', min, max );
  7700. damage *= min.valueAdditive * ( 1 - MinF( 1.f, resistance ) );
  7701.  
  7702. if( damage > 0.f )
  7703. {
  7704. npc.AddAbility( 'Mutation4BloodDebuff' );
  7705. ProcessActionMutation4ReturnedDamage( damage, npc, EAHA_ForceNo );
  7706. npc.AddTimer( 'RemoveMutation4BloodDebuff', 15.f, , , , , true );
  7707. }
  7708. }
  7709. }
  7710. }
  7711.  
  7712.  
  7713. public function ProcessActionMutation4ReturnedDamage( damageDealt : float, attacker : CActor, hitAnimationType : EActionHitAnim, optional action : W3DamageAction ) : bool
  7714. {
  7715. var customParams : SCustomEffectParams;
  7716. var currToxicity : float;
  7717. var min, max, customDamageValue : SAbilityAttributeValue;
  7718. var dm : CDefinitionsManagerAccessor;
  7719. var animAction : W3DamageAction;
  7720.  
  7721. if( damageDealt <= 0 )
  7722. {
  7723. return false;
  7724. }
  7725.  
  7726. if( action )
  7727. {
  7728. action.SetMutation4Triggered();
  7729. }
  7730.  
  7731. dm = theGame.GetDefinitionsManager();
  7732. currToxicity = GetStat( BCS_Toxicity );
  7733.  
  7734. dm.GetAbilityAttributeValue( 'AcidEffect', 'DirectDamage', min, max );
  7735. customDamageValue.valueAdditive = damageDealt * min.valueAdditive;
  7736.  
  7737. if( currToxicity > 0 )
  7738. {
  7739. customDamageValue.valueAdditive *= currToxicity;
  7740. }
  7741.  
  7742. dm.GetAbilityAttributeValue( 'AcidEffect', 'duration', min, max );
  7743. customDamageValue.valueAdditive /= min.valueAdditive;
  7744.  
  7745. customParams.effectType = EET_Acid;
  7746. customParams.effectValue = customDamageValue;
  7747. customParams.duration = min.valueAdditive;
  7748. customParams.creator = this;
  7749. customParams.sourceName = 'Mutation4';
  7750.  
  7751. attacker.AddEffectCustom( customParams );
  7752.  
  7753.  
  7754. animAction = new W3DamageAction in theGame;
  7755. animAction.Initialize( this, attacker, NULL, 'Mutation4', EHRT_Reflect, CPS_Undefined, true, false, false, false );
  7756. animAction.SetCannotReturnDamage( true );
  7757. animAction.SetCanPlayHitParticle( false );
  7758. animAction.SetHitAnimationPlayType( hitAnimationType );
  7759. theGame.damageMgr.ProcessAction( animAction );
  7760. delete animAction;
  7761.  
  7762. theGame.MutationHUDFeedback( MFT_PlayOnce );
  7763.  
  7764. return true;
  7765. }
  7766.  
  7767. event OnPlayerActionEnd()
  7768. {
  7769. var l_i : int;
  7770. var l_bed : W3WitcherBed;
  7771.  
  7772. l_i = (int)GetBehaviorVariable( 'playerExplorationAction' );
  7773.  
  7774. if( l_i == PEA_GoToSleep )
  7775. {
  7776. l_bed = (W3WitcherBed)theGame.GetEntityByTag( 'witcherBed' );
  7777. BlockAllActions( 'WitcherBed', false );
  7778. l_bed.ApplyAppearance( "collision" );
  7779. l_bed.GotoState( 'WakeUp' );
  7780. theGame.ReleaseNoSaveLock( l_bed.m_bedSaveLock );
  7781.  
  7782.  
  7783. substateManager.m_MovementCorrectorO.disallowRotWhenGoingToSleep = false;
  7784. }
  7785.  
  7786. super.OnPlayerActionEnd();
  7787. }
  7788.  
  7789. event OnPlayerActionStartFinished()
  7790. {
  7791. var l_initData : W3SingleMenuInitData;
  7792. var l_i : int;
  7793.  
  7794. l_i = (int)GetBehaviorVariable( 'playerExplorationAction' );
  7795.  
  7796. if( l_i == PEA_GoToSleep )
  7797. {
  7798. l_initData = new W3SingleMenuInitData in this;
  7799. l_initData.SetBlockOtherPanels( true );
  7800. l_initData.ignoreSaveSystem = true;
  7801. l_initData.ignoreMeditationCheck = true;
  7802. l_initData.setDefaultState( '' );
  7803. l_initData.isBonusMeditationAvailable = true;
  7804. l_initData.fixedMenuName = 'MeditationClockMenu';
  7805.  
  7806. theGame.RequestMenuWithBackground( 'MeditationClockMenu', 'CommonMenu', l_initData );
  7807. }
  7808.  
  7809. super.OnPlayerActionStartFinished();
  7810. }
  7811.  
  7812. public function IsInCombatAction_SpecialAttack() : bool
  7813. {
  7814. if ( IsInCombatAction() && ( GetCombatAction() == EBAT_SpecialAttack_Light || GetCombatAction() == EBAT_SpecialAttack_Heavy ) )
  7815. return true;
  7816. else
  7817. return false;
  7818. }
  7819.  
  7820. public function IsInCombatAction_SpecialAttackHeavy() : bool
  7821. {
  7822. if ( IsInCombatAction() && GetCombatAction() == EBAT_SpecialAttack_Heavy )
  7823. return true;
  7824. else
  7825. return false;
  7826. }
  7827.  
  7828. protected function WhenCombatActionIsFinished()
  7829. {
  7830. super.WhenCombatActionIsFinished();
  7831. RemoveTimer( 'ProcessAttackTimer' );
  7832. RemoveTimer( 'AttackTimerEnd' );
  7833. CastSignAbort();
  7834. specialAttackCamera = false;
  7835. this.OnPerformSpecialAttack( true, false );
  7836. }
  7837.  
  7838. event OnCombatActionEnd()
  7839. {
  7840. this.CleanCombatActionBuffer();
  7841. super.OnCombatActionEnd();
  7842.  
  7843. RemoveTemporarySkills();
  7844. }
  7845.  
  7846. event OnCombatActionFriendlyEnd()
  7847. {
  7848. if ( IsCastingSign() )
  7849. {
  7850. SetBehaviorVariable( 'IsCastingSign', 0 );
  7851. SetCurrentlyCastSign( ST_None, NULL );
  7852. LogChannel( 'ST_None', "ST_None" );
  7853. }
  7854.  
  7855. super.OnCombatActionFriendlyEnd();
  7856. }
  7857.  
  7858. public function GetPowerStatValue( stat : ECharacterPowerStats, optional ablName : name, optional ignoreDeath : bool ) : SAbilityAttributeValue
  7859. {
  7860. var result : SAbilityAttributeValue;
  7861.  
  7862.  
  7863. result = super.GetPowerStatValue( stat, ablName, ignoreDeath );
  7864. ApplyMutation10StatBoost( result );
  7865.  
  7866. return result;
  7867. }
  7868.  
  7869.  
  7870.  
  7871. timer function OpenRadialMenu( time: float, id : int )
  7872. {
  7873.  
  7874. if( GetBIsCombatActionAllowed() && !IsUITakeInput() )
  7875. {
  7876. bShowRadialMenu = true;
  7877. }
  7878.  
  7879. this.RemoveTimer('OpenRadialMenu');
  7880. }
  7881.  
  7882. public function OnAddRadialMenuOpenTimer( )
  7883. {
  7884.  
  7885.  
  7886.  
  7887.  
  7888.  
  7889. this.AddTimer('OpenRadialMenu', _HoldBeforeOpenRadialMenuTime * theGame.GetTimeScale() );
  7890.  
  7891. }
  7892.  
  7893. public function SetShowRadialMenuOpenFlag( bSet : bool )
  7894. {
  7895.  
  7896. bShowRadialMenu = bSet;
  7897. }
  7898.  
  7899. public function OnRemoveRadialMenuOpenTimer()
  7900. {
  7901.  
  7902. this.RemoveTimer('OpenRadialMenu');
  7903. }
  7904.  
  7905. public function ResetRadialMenuOpenTimer()
  7906. {
  7907.  
  7908. this.RemoveTimer('OpenRadialMenu');
  7909. if( GetBIsCombatActionAllowed() )
  7910. {
  7911.  
  7912.  
  7913. AddTimer('OpenRadialMenu', _HoldBeforeOpenRadialMenuTime * theGame.GetTimeScale() );
  7914. }
  7915. }
  7916.  
  7917.  
  7918.  
  7919. timer function ResendCompanionDisplayName(dt : float, id : int)
  7920. {
  7921. var hud : CR4ScriptedHud;
  7922. var companionModule : CR4HudModuleCompanion;
  7923.  
  7924. hud = (CR4ScriptedHud)theGame.GetHud();
  7925. if( hud )
  7926. {
  7927. companionModule = (CR4HudModuleCompanion)hud.GetHudModule("CompanionModule");
  7928. if( companionModule )
  7929. {
  7930. companionModule.ResendDisplayName();
  7931. }
  7932. }
  7933. }
  7934.  
  7935. timer function ResendCompanionDisplayNameSecond(dt : float, id : int)
  7936. {
  7937. var hud : CR4ScriptedHud;
  7938. var companionModule : CR4HudModuleCompanion;
  7939.  
  7940. hud = (CR4ScriptedHud)theGame.GetHud();
  7941. if( hud )
  7942. {
  7943. companionModule = (CR4HudModuleCompanion)hud.GetHudModule("CompanionModule");
  7944. if( companionModule )
  7945. {
  7946. companionModule.ResendDisplayNameSecond();
  7947. }
  7948. }
  7949. }
  7950.  
  7951. public function RemoveCompanionDisplayNameTimer()
  7952. {
  7953. this.RemoveTimer('ResendCompanionDisplayName');
  7954. }
  7955.  
  7956. public function RemoveCompanionDisplayNameTimerSecond()
  7957. {
  7958. this.RemoveTimer('ResendCompanionDisplayNameSecond');
  7959. }
  7960.  
  7961.  
  7962. public function GetCompanionNPCTag() : name
  7963. {
  7964. return companionNPCTag;
  7965. }
  7966.  
  7967. public function SetCompanionNPCTag( value : name )
  7968. {
  7969. companionNPCTag = value;
  7970. }
  7971.  
  7972. public function GetCompanionNPCTag2() : name
  7973. {
  7974. return companionNPCTag2;
  7975. }
  7976.  
  7977. public function SetCompanionNPCTag2( value : name )
  7978. {
  7979. companionNPCTag2 = value;
  7980. }
  7981.  
  7982. public function GetCompanionNPCIconPath() : string
  7983. {
  7984. return companionNPCIconPath;
  7985. }
  7986.  
  7987. public function SetCompanionNPCIconPath( value : string )
  7988. {
  7989. companionNPCIconPath = value;
  7990. }
  7991.  
  7992. public function GetCompanionNPCIconPath2() : string
  7993. {
  7994. return companionNPCIconPath2;
  7995. }
  7996.  
  7997. public function SetCompanionNPCIconPath2( value : string )
  7998. {
  7999. companionNPCIconPath2 = value;
  8000. }
  8001.  
  8002.  
  8003.  
  8004. public function ReactToBeingHit(damageAction : W3DamageAction, optional buffNotApplied : bool) : bool
  8005. {
  8006. var chance : float;
  8007. var procQuen : W3SignEntity;
  8008.  
  8009. if(!damageAction.IsDoTDamage() && damageAction.DealsAnyDamage())
  8010. {
  8011. if(inv.IsItemBomb(selectedItemId))
  8012. {
  8013. BombThrowAbort();
  8014. }
  8015. else
  8016. {
  8017.  
  8018. ThrowingAbort();
  8019. }
  8020. }
  8021.  
  8022.  
  8023. if(damageAction.IsActionRanged())
  8024. {
  8025. chance = CalculateAttributeValue(GetAttributeValue('quen_chance_on_projectile'));
  8026. if(chance > 0)
  8027. {
  8028. chance = ClampF(chance, 0, 1);
  8029.  
  8030. if(RandF() < chance)
  8031. {
  8032. procQuen = (W3SignEntity)theGame.CreateEntity(signs[ST_Quen].template, GetWorldPosition(), GetWorldRotation() );
  8033. procQuen.Init(signOwner, signs[ST_Quen].entity, true );
  8034. procQuen.OnStarted();
  8035. procQuen.OnThrowing();
  8036. procQuen.OnEnded();
  8037. }
  8038. }
  8039. }
  8040.  
  8041.  
  8042. if( !((W3Effect_Toxicity)damageAction.causer) )
  8043. MeditationForceAbort(true);
  8044.  
  8045.  
  8046. if(IsDoingSpecialAttack(false))
  8047. damageAction.SetHitAnimationPlayType(EAHA_ForceNo);
  8048.  
  8049. return super.ReactToBeingHit(damageAction, buffNotApplied);
  8050. }
  8051.  
  8052. protected function ShouldPauseHealthRegenOnHit() : bool
  8053. {
  8054.  
  8055. if( ( HasBuff( EET_Swallow ) && GetPotionBuffLevel( EET_Swallow ) >= 3 ) || HasBuff( EET_Runeword8 ) || HasBuff( EET_Mutation11Buff ) )
  8056. {
  8057. return false;
  8058. }
  8059.  
  8060. return true;
  8061. }
  8062.  
  8063. public function SetMappinToHighlight( mappinName : name, mappinState : bool )
  8064. {
  8065. var mappinDef : SHighlightMappin;
  8066. mappinDef.MappinName = mappinName;
  8067. mappinDef.MappinState = mappinState;
  8068. MappinToHighlight.PushBack(mappinDef);
  8069. }
  8070.  
  8071. public function ClearMappinToHighlight()
  8072. {
  8073. MappinToHighlight.Clear();
  8074. }
  8075.  
  8076. public function CastSignAbort()
  8077. {
  8078. if( currentlyCastSign != ST_None && signs[currentlyCastSign].entity)
  8079. {
  8080. signs[currentlyCastSign].entity.OnSignAborted();
  8081. }
  8082.  
  8083.  
  8084. }
  8085.  
  8086. event OnBlockingSceneStarted( scene: CStoryScene )
  8087. {
  8088. var med : W3PlayerWitcherStateMeditationWaiting;
  8089.  
  8090.  
  8091. med = (W3PlayerWitcherStateMeditationWaiting)GetCurrentState();
  8092. if(med)
  8093. {
  8094. med.StopRequested(true);
  8095. }
  8096.  
  8097.  
  8098. super.OnBlockingSceneStarted( scene );
  8099. }
  8100.  
  8101.  
  8102.  
  8103.  
  8104.  
  8105. public function GetHorseManager() : W3HorseManager
  8106. {
  8107. return (W3HorseManager)EntityHandleGet( horseManagerHandle );
  8108. }
  8109.  
  8110.  
  8111. public function HorseEquipItem(horsesItemId : SItemUniqueId) : bool
  8112. {
  8113. var man : W3HorseManager;
  8114.  
  8115. man = GetHorseManager();
  8116. if(man)
  8117. return man.EquipItem(horsesItemId) != GetInvalidUniqueId();
  8118.  
  8119. return false;
  8120. }
  8121.  
  8122.  
  8123. public function HorseUnequipItem(slot : EEquipmentSlots) : bool
  8124. {
  8125. var man : W3HorseManager;
  8126.  
  8127. man = GetHorseManager();
  8128. if(man)
  8129. return man.UnequipItem(slot) != GetInvalidUniqueId();
  8130.  
  8131. return false;
  8132. }
  8133.  
  8134.  
  8135. public final function HorseRemoveItemByName(itemName : name, quantity : int)
  8136. {
  8137. var man : W3HorseManager;
  8138.  
  8139. man = GetHorseManager();
  8140. if(man)
  8141. man.HorseRemoveItemByName(itemName, quantity);
  8142. }
  8143.  
  8144.  
  8145. public final function HorseRemoveItemByCategory(itemCategory : name, quantity : int)
  8146. {
  8147. var man : W3HorseManager;
  8148.  
  8149. man = GetHorseManager();
  8150. if(man)
  8151. man.HorseRemoveItemByCategory(itemCategory, quantity);
  8152. }
  8153.  
  8154.  
  8155. public final function HorseRemoveItemByTag(itemTag : name, quantity : int)
  8156. {
  8157. var man : W3HorseManager;
  8158.  
  8159. man = GetHorseManager();
  8160. if(man)
  8161. man.HorseRemoveItemByTag(itemTag, quantity);
  8162. }
  8163.  
  8164. public function GetAssociatedInventory() : CInventoryComponent
  8165. {
  8166. var man : W3HorseManager;
  8167.  
  8168. man = GetHorseManager();
  8169. if(man)
  8170. return man.GetInventoryComponent();
  8171.  
  8172. return NULL;
  8173. }
  8174.  
  8175.  
  8176.  
  8177.  
  8178.  
  8179. public final function TutorialMutagensUnequipPlayerSkills() : array<STutorialSavedSkill>
  8180. {
  8181. var pam : W3PlayerAbilityManager;
  8182.  
  8183. pam = (W3PlayerAbilityManager)abilityManager;
  8184. return pam.TutorialMutagensUnequipPlayerSkills();
  8185. }
  8186.  
  8187. public final function TutorialMutagensEquipOneGoodSkill()
  8188. {
  8189. var pam : W3PlayerAbilityManager;
  8190.  
  8191. pam = (W3PlayerAbilityManager)abilityManager;
  8192. pam.TutorialMutagensEquipOneGoodSkill();
  8193. }
  8194.  
  8195. public final function TutorialMutagensEquipOneGoodOneBadSkill()
  8196. {
  8197. var pam : W3PlayerAbilityManager;
  8198.  
  8199. pam = (W3PlayerAbilityManager)abilityManager;
  8200. if(pam)
  8201. pam.TutorialMutagensEquipOneGoodOneBadSkill();
  8202. }
  8203.  
  8204. public final function TutorialMutagensEquipThreeGoodSkills()
  8205. {
  8206. var pam : W3PlayerAbilityManager;
  8207.  
  8208. pam = (W3PlayerAbilityManager)abilityManager;
  8209. if(pam)
  8210. pam.TutorialMutagensEquipThreeGoodSkills();
  8211. }
  8212.  
  8213. public final function TutorialMutagensCleanupTempSkills(savedEquippedSkills : array<STutorialSavedSkill>)
  8214. {
  8215. var pam : W3PlayerAbilityManager;
  8216.  
  8217. pam = (W3PlayerAbilityManager)abilityManager;
  8218. return pam.TutorialMutagensCleanupTempSkills(savedEquippedSkills);
  8219. }
  8220.  
  8221.  
  8222.  
  8223.  
  8224.  
  8225. public final function CalculatedArmorStaminaRegenBonus() : float
  8226. {
  8227. var armorEq, glovesEq, pantsEq, bootsEq : bool;
  8228. var tempItem : SItemUniqueId;
  8229. var staminaRegenVal : float;
  8230. var armorRegenVal : SAbilityAttributeValue;
  8231.  
  8232. if( HasAbility( 'Glyphword 2 _Stats', true ) )
  8233. {
  8234. armorEq = inv.GetItemEquippedOnSlot( EES_Armor, tempItem );
  8235. glovesEq = inv.GetItemEquippedOnSlot( EES_Gloves, tempItem );
  8236. pantsEq = inv.GetItemEquippedOnSlot( EES_Pants, tempItem );
  8237. bootsEq = inv.GetItemEquippedOnSlot( EES_Boots, tempItem );
  8238.  
  8239. if ( armorEq )
  8240. staminaRegenVal += 0.1;
  8241. if ( glovesEq )
  8242. staminaRegenVal += 0.02;
  8243. if ( pantsEq )
  8244. staminaRegenVal += 0.1;
  8245. if ( bootsEq )
  8246. staminaRegenVal += 0.03;
  8247.  
  8248. }
  8249. else if( HasAbility( 'Glyphword 3 _Stats', true ) )
  8250. {
  8251. staminaRegenVal = 0;
  8252. }
  8253. else if( HasAbility( 'Glyphword 4 _Stats', true ) )
  8254. {
  8255. armorEq = inv.GetItemEquippedOnSlot( EES_Armor, tempItem );
  8256. glovesEq = inv.GetItemEquippedOnSlot( EES_Gloves, tempItem );
  8257. pantsEq = inv.GetItemEquippedOnSlot( EES_Pants, tempItem );
  8258. bootsEq = inv.GetItemEquippedOnSlot( EES_Boots, tempItem );
  8259.  
  8260. if ( armorEq )
  8261. staminaRegenVal -= 0.1;
  8262. if ( glovesEq )
  8263. staminaRegenVal -= 0.02;
  8264. if ( pantsEq )
  8265. staminaRegenVal -= 0.1;
  8266. if ( bootsEq )
  8267. staminaRegenVal -= 0.03;
  8268. }
  8269. else
  8270. {
  8271. armorRegenVal = GetAttributeValue('staminaRegen_armor_mod');
  8272. staminaRegenVal = armorRegenVal.valueMultiplicative;
  8273. }
  8274.  
  8275. return staminaRegenVal;
  8276. }
  8277.  
  8278. public function GetOffenseStatsList( optional hackMode : int ) : SPlayerOffenseStats
  8279. {
  8280. var playerOffenseStats:SPlayerOffenseStats;
  8281. var steelDmg, silverDmg, elementalSteel, elementalSilver : float;
  8282. var steelCritChance, steelCritDmg : float;
  8283. var silverCritChance, silverCritDmg : float;
  8284. var attackPower : SAbilityAttributeValue;
  8285. var fastCritChance, fastCritDmg : float;
  8286. var strongCritChance, strongCritDmg : float;
  8287. var fastAP, strongAP, min, max : SAbilityAttributeValue;
  8288. var item, crossbow : SItemUniqueId;
  8289. var value : SAbilityAttributeValue;
  8290. var mutagen : CBaseGameplayEffect;
  8291. var thunder : W3Potion_Thunderbolt;
  8292.  
  8293. if(!abilityManager || !abilityManager.IsInitialized())
  8294. return playerOffenseStats;
  8295.  
  8296. if (CanUseSkill(S_Sword_s21))
  8297. fastAP += GetSkillAttributeValue(S_Sword_s21, PowerStatEnumToName(CPS_AttackPower), false, true) * GetSkillLevel(S_Sword_s21);
  8298. if (CanUseSkill(S_Perk_05))
  8299. {
  8300. fastAP += GetAttributeValue('attack_power_fast_style');
  8301. fastCritDmg += CalculateAttributeValue(GetAttributeValue('critical_hit_chance_fast_style'));
  8302. strongCritDmg += CalculateAttributeValue(GetAttributeValue('critical_hit_chance_fast_style'));
  8303. }
  8304. if (CanUseSkill(S_Sword_s04))
  8305. strongAP += GetSkillAttributeValue(S_Sword_s04, PowerStatEnumToName(CPS_AttackPower), false, true) * GetSkillLevel(S_Sword_s04);
  8306. if (CanUseSkill(S_Perk_07))
  8307. strongAP += GetAttributeValue('attack_power_heavy_style');
  8308.  
  8309. if (CanUseSkill(S_Sword_s17))
  8310. {
  8311. fastCritChance += CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s17, theGame.params.CRITICAL_HIT_CHANCE, false, true)) * GetSkillLevel(S_Sword_s17);
  8312. fastCritDmg += CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s17, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, true)) * GetSkillLevel(S_Sword_s17);
  8313. }
  8314.  
  8315. if (CanUseSkill(S_Sword_s08))
  8316. {
  8317. strongCritChance += CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s08, theGame.params.CRITICAL_HIT_CHANCE, false, true)) * GetSkillLevel(S_Sword_s08);
  8318. strongCritDmg += CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s08, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, true)) * GetSkillLevel(S_Sword_s08);
  8319. }
  8320.  
  8321. if ( HasBuff(EET_Mutagen05) && (GetStat(BCS_Vitality) == GetStatMax(BCS_Vitality)) )
  8322. {
  8323. attackPower += GetAttributeValue('damageIncrease');
  8324. }
  8325.  
  8326. steelCritChance += CalculateAttributeValue(GetAttributeValue(theGame.params.CRITICAL_HIT_CHANCE));
  8327. silverCritChance += CalculateAttributeValue(GetAttributeValue(theGame.params.CRITICAL_HIT_CHANCE));
  8328. steelCritDmg += CalculateAttributeValue(GetAttributeValue(theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  8329. silverCritDmg += CalculateAttributeValue(GetAttributeValue(theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  8330. attackPower += GetPowerStatValue(CPS_AttackPower);
  8331.  
  8332. if (GetItemEquippedOnSlot(EES_SteelSword, item))
  8333. {
  8334. steelDmg = GetTotalWeaponDamage(item, theGame.params.DAMAGE_NAME_SLASHING, GetInvalidUniqueId());
  8335. steelDmg += GetTotalWeaponDamage(item, theGame.params.DAMAGE_NAME_PIERCING, GetInvalidUniqueId());
  8336. steelDmg += GetTotalWeaponDamage(item, theGame.params.DAMAGE_NAME_BLUDGEONING, GetInvalidUniqueId());
  8337. elementalSteel = CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_FIRE));
  8338. elementalSteel += CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_FROST));
  8339. if ( GetInventory().IsItemHeld(item) )
  8340. {
  8341. steelCritChance -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_CHANCE));
  8342. silverCritChance -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_CHANCE));
  8343. steelCritDmg -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  8344. silverCritDmg -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  8345. }
  8346. steelCritChance += CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_CHANCE));
  8347. steelCritDmg += CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  8348.  
  8349. thunder = (W3Potion_Thunderbolt)GetBuff(EET_Thunderbolt);
  8350. if(thunder && thunder.GetBuffLevel() == 3 && GetCurWeather() == EWE_Storm)
  8351. {
  8352. steelCritChance += 1.0f;
  8353. }
  8354. }
  8355. else
  8356. {
  8357. steelDmg += 0;
  8358. steelCritChance += 0;
  8359. steelCritDmg +=0;
  8360. }
  8361.  
  8362. if (GetItemEquippedOnSlot(EES_SilverSword, item))
  8363. {
  8364. silverDmg = GetTotalWeaponDamage(item, theGame.params.DAMAGE_NAME_SILVER, GetInvalidUniqueId());
  8365. elementalSilver = CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_FIRE));
  8366. elementalSilver += CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_FROST));
  8367. if ( GetInventory().IsItemHeld(item) )
  8368. {
  8369. steelCritChance -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_CHANCE));
  8370. silverCritChance -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_CHANCE));
  8371. steelCritDmg -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  8372. silverCritDmg -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  8373. }
  8374. silverCritChance += CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_CHANCE));
  8375. silverCritDmg += CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  8376.  
  8377. thunder = (W3Potion_Thunderbolt)GetBuff(EET_Thunderbolt);
  8378. if(thunder && thunder.GetBuffLevel() == 3 && GetCurWeather() == EWE_Storm)
  8379. {
  8380. silverCritChance += 1.0f;
  8381. }
  8382. }
  8383. else
  8384. {
  8385. silverDmg += 0;
  8386. silverCritChance += 0;
  8387. silverCritDmg +=0;
  8388. }
  8389.  
  8390. if ( HasAbility('Runeword 4 _Stats', true) )
  8391. {
  8392. steelDmg += steelDmg * (abilityManager.GetOverhealBonus() / GetStatMax(BCS_Vitality));
  8393. silverDmg += silverDmg * (abilityManager.GetOverhealBonus() / GetStatMax(BCS_Vitality));
  8394. }
  8395.  
  8396. fastAP += attackPower;
  8397. strongAP += attackPower;
  8398.  
  8399. playerOffenseStats.steelFastCritChance = (steelCritChance + fastCritChance) * 100;
  8400. playerOffenseStats.steelFastCritDmg = steelCritDmg + fastCritDmg;
  8401. if ( steelDmg != 0 )
  8402. {
  8403. playerOffenseStats.steelFastDmg = (steelDmg + fastAP.valueBase) * fastAP.valueMultiplicative + fastAP.valueAdditive + elementalSteel;
  8404. playerOffenseStats.steelFastCritDmg = (steelDmg + fastAP.valueBase) * (fastAP.valueMultiplicative + playerOffenseStats.steelFastCritDmg) + fastAP.valueAdditive + elementalSteel;
  8405. }
  8406. else
  8407. {
  8408. playerOffenseStats.steelFastDmg = 0;
  8409. playerOffenseStats.steelFastCritDmg = 0;
  8410. }
  8411. playerOffenseStats.steelFastDPS = (playerOffenseStats.steelFastDmg * (100 - playerOffenseStats.steelFastCritChance) + playerOffenseStats.steelFastCritDmg * playerOffenseStats.steelFastCritChance) / 100;
  8412. playerOffenseStats.steelFastDPS = playerOffenseStats.steelFastDPS / 0.6;
  8413.  
  8414.  
  8415. playerOffenseStats.steelStrongCritChance = (steelCritChance + strongCritChance) * 100;
  8416. playerOffenseStats.steelStrongCritDmg = steelCritDmg + strongCritDmg;
  8417. if ( steelDmg != 0 )
  8418. {
  8419. playerOffenseStats.steelStrongDmg = (steelDmg + strongAP.valueBase) * strongAP.valueMultiplicative + strongAP.valueAdditive + elementalSteel;
  8420. playerOffenseStats.steelStrongDmg *= 1.833f;
  8421. playerOffenseStats.steelStrongCritDmg = (steelDmg + strongAP.valueBase) * (strongAP.valueMultiplicative + playerOffenseStats.steelStrongCritDmg) + strongAP.valueAdditive + elementalSteel;
  8422. playerOffenseStats.steelStrongCritDmg *= 1.833f; }
  8423. else
  8424. {
  8425. playerOffenseStats.steelStrongDmg = 0;
  8426. playerOffenseStats.steelStrongCritDmg = 0;
  8427. }
  8428. playerOffenseStats.steelStrongDPS = (playerOffenseStats.steelStrongDmg * (100 - playerOffenseStats.steelStrongCritChance) + playerOffenseStats.steelStrongCritDmg * playerOffenseStats.steelStrongCritChance) / 100;
  8429. playerOffenseStats.steelStrongDPS = playerOffenseStats.steelStrongDPS / 1.1;
  8430.  
  8431.  
  8432.  
  8433. playerOffenseStats.silverFastCritChance = (silverCritChance + fastCritChance) * 100;
  8434. playerOffenseStats.silverFastCritDmg = silverCritDmg + fastCritDmg;
  8435. if ( silverDmg != 0 )
  8436. {
  8437. playerOffenseStats.silverFastDmg = (silverDmg + fastAP.valueBase) * fastAP.valueMultiplicative + fastAP.valueAdditive + elementalSilver;
  8438. playerOffenseStats.silverFastCritDmg = (silverDmg + fastAP.valueBase) * (fastAP.valueMultiplicative + playerOffenseStats.silverFastCritDmg) + fastAP.valueAdditive + elementalSilver;
  8439. }
  8440. else
  8441. {
  8442. playerOffenseStats.silverFastDmg = 0;
  8443. playerOffenseStats.silverFastCritDmg = 0;
  8444. }
  8445. playerOffenseStats.silverFastDPS = (playerOffenseStats.silverFastDmg * (100 - playerOffenseStats.silverFastCritChance) + playerOffenseStats.silverFastCritDmg * playerOffenseStats.silverFastCritChance) / 100;
  8446. playerOffenseStats.silverFastDPS = playerOffenseStats.silverFastDPS / 0.6;
  8447.  
  8448.  
  8449. playerOffenseStats.silverStrongCritChance = (silverCritChance + strongCritChance) * 100;
  8450. playerOffenseStats.silverStrongCritDmg = silverCritDmg + strongCritDmg;
  8451. if ( silverDmg != 0 )
  8452. {
  8453. playerOffenseStats.silverStrongDmg = (silverDmg + strongAP.valueBase) * strongAP.valueMultiplicative + strongAP.valueAdditive + elementalSilver;
  8454. playerOffenseStats.silverStrongDmg *= 1.833f;
  8455. playerOffenseStats.silverStrongCritDmg = (silverDmg + strongAP.valueBase) * (strongAP.valueMultiplicative + playerOffenseStats.silverStrongCritDmg) + strongAP.valueAdditive + elementalSilver;
  8456. playerOffenseStats.silverStrongCritDmg *= 1.833f;
  8457. }
  8458. else
  8459. {
  8460. playerOffenseStats.silverStrongDmg = 0;
  8461. playerOffenseStats.silverStrongCritDmg = 0;
  8462. }
  8463. playerOffenseStats.silverStrongDPS = (playerOffenseStats.silverStrongDmg * (100 - playerOffenseStats.silverStrongCritChance) + playerOffenseStats.silverStrongCritDmg * playerOffenseStats.silverStrongCritChance) / 100;
  8464. playerOffenseStats.silverStrongDPS = playerOffenseStats.silverStrongDPS / 1.1;
  8465.  
  8466.  
  8467. playerOffenseStats.crossbowCritChance = GetCriticalHitChance( false, false, NULL, MC_NotSet, true );
  8468.  
  8469.  
  8470. playerOffenseStats.crossbowSteelDmgType = theGame.params.DAMAGE_NAME_PIERCING;
  8471. if (GetItemEquippedOnSlot(EES_Bolt, item))
  8472. {
  8473.  
  8474.  
  8475. steelDmg = CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_FIRE));
  8476. if(steelDmg > 0)
  8477. {
  8478. playerOffenseStats.crossbowSteelDmg = steelDmg;
  8479.  
  8480. playerOffenseStats.crossbowSteelDmgType = theGame.params.DAMAGE_NAME_FIRE;
  8481. playerOffenseStats.crossbowSilverDmg = steelDmg;
  8482. }
  8483. else
  8484. {
  8485. playerOffenseStats.crossbowSilverDmg = CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_SILVER));
  8486.  
  8487. steelDmg = CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_PIERCING));
  8488. if(steelDmg > 0)
  8489. {
  8490. playerOffenseStats.crossbowSteelDmg = steelDmg;
  8491. playerOffenseStats.crossbowSteelDmgType = theGame.params.DAMAGE_NAME_PIERCING;
  8492. }
  8493. else
  8494. {
  8495. playerOffenseStats.crossbowSteelDmg = CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_BLUDGEONING));
  8496. playerOffenseStats.crossbowSteelDmgType = theGame.params.DAMAGE_NAME_BLUDGEONING;
  8497. }
  8498. }
  8499. }
  8500.  
  8501. if (GetItemEquippedOnSlot(EES_RangedWeapon, item))
  8502. {
  8503. attackPower += GetInventory().GetItemAttributeValue(item, PowerStatEnumToName(CPS_AttackPower));
  8504. if(CanUseSkill(S_Perk_02))
  8505. {
  8506. attackPower += GetSkillAttributeValue(S_Perk_02, PowerStatEnumToName(CPS_AttackPower), false, true);
  8507. }
  8508.  
  8509.  
  8510. if( hackMode != 1 && ( IsMutationActive( EPMT_Mutation9 ) || hackMode == 2 ) )
  8511. {
  8512. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation9', 'damage', min, max );
  8513. playerOffenseStats.crossbowSteelDmg += min.valueAdditive;
  8514. playerOffenseStats.crossbowSilverDmg += min.valueAdditive;
  8515. }
  8516.  
  8517. playerOffenseStats.crossbowSteelDmg = (playerOffenseStats.crossbowSteelDmg + attackPower.valueBase) * attackPower.valueMultiplicative + attackPower.valueAdditive;
  8518. playerOffenseStats.crossbowSilverDmg = (playerOffenseStats.crossbowSilverDmg + attackPower.valueBase) * attackPower.valueMultiplicative + attackPower.valueAdditive;
  8519. }
  8520. else
  8521. {
  8522. playerOffenseStats.crossbowSteelDmg = 0;
  8523. playerOffenseStats.crossbowSilverDmg = 0;
  8524. playerOffenseStats.crossbowSteelDmgType = theGame.params.DAMAGE_NAME_PIERCING;
  8525. }
  8526.  
  8527. return playerOffenseStats;
  8528. }
  8529.  
  8530. public function GetTotalWeaponDamage(weaponId : SItemUniqueId, damageTypeName : name, crossbowId : SItemUniqueId) : float
  8531. {
  8532. var damage, durRatio, durMod, itemMod : float;
  8533. var repairObjectBonus, min, max : SAbilityAttributeValue;
  8534.  
  8535. durMod = 0;
  8536. damage = super.GetTotalWeaponDamage(weaponId, damageTypeName, crossbowId);
  8537.  
  8538.  
  8539. if( IsMutationActive( EPMT_Mutation9 ) && inv.IsItemBolt( weaponId ) && IsDamageTypeAnyPhysicalType( damageTypeName ) )
  8540. {
  8541. theGame.GetDefinitionsManager().GetAbilityAttributeValue('Mutation9', 'damage', min, max);
  8542. damage += min.valueAdditive;
  8543. }
  8544.  
  8545.  
  8546. if(IsPhysicalResistStat(GetResistForDamage(damageTypeName, false)))
  8547. {
  8548. repairObjectBonus = inv.GetItemAttributeValue(weaponId, theGame.params.REPAIR_OBJECT_BONUS);
  8549. durRatio = -1;
  8550.  
  8551. if(inv.IsIdValid(crossbowId) && inv.HasItemDurability(crossbowId))
  8552. {
  8553. durRatio = inv.GetItemDurabilityRatio(crossbowId);
  8554. }
  8555. else if(inv.IsIdValid(weaponId) && inv.HasItemDurability(weaponId))
  8556. {
  8557. durRatio = inv.GetItemDurabilityRatio(weaponId);
  8558. }
  8559.  
  8560.  
  8561. if(durRatio >= 0)
  8562. durMod = theGame.params.GetDurabilityMultiplier(durRatio, true);
  8563. else
  8564. durMod = 1;
  8565. }
  8566.  
  8567.  
  8568. if( damageTypeName == 'SilverDamage' && inv.ItemHasTag( weaponId, 'Aerondight' ) )
  8569. {
  8570. itemMod = inv.GetItemModifierFloat( weaponId, 'PermDamageBoost' );
  8571. if( itemMod > 0.f )
  8572. {
  8573. damage += itemMod;
  8574. }
  8575. }
  8576.  
  8577. return damage * (durMod + repairObjectBonus.valueMultiplicative);
  8578. }
  8579.  
  8580.  
  8581.  
  8582.  
  8583.  
  8584. public final function GetSkillPathType(skill : ESkill) : ESkillPath
  8585. {
  8586. if(abilityManager && abilityManager.IsInitialized())
  8587. return ((W3PlayerAbilityManager)abilityManager).GetSkillPathType(skill);
  8588.  
  8589. return ESP_NotSet;
  8590. }
  8591.  
  8592. public function GetSkillLevel(s : ESkill) : int
  8593. {
  8594. if(abilityManager && abilityManager.IsInitialized())
  8595. return ((W3PlayerAbilityManager)abilityManager).GetSkillLevel(s);
  8596.  
  8597. return -1;
  8598. }
  8599.  
  8600. public function GetSkillMaxLevel(s : ESkill) : int
  8601. {
  8602. if(abilityManager && abilityManager.IsInitialized())
  8603. return ((W3PlayerAbilityManager)abilityManager).GetSkillMaxLevel(s);
  8604.  
  8605. return -1;
  8606. }
  8607.  
  8608. public function GetBoughtSkillLevel(s : ESkill) : int
  8609. {
  8610. if(abilityManager && abilityManager.IsInitialized())
  8611. return ((W3PlayerAbilityManager)abilityManager).GetBoughtSkillLevel(s);
  8612.  
  8613. return -1;
  8614. }
  8615.  
  8616.  
  8617. public function GetAxiiLevel() : int
  8618. {
  8619. var level : int;
  8620.  
  8621. level = 1;
  8622.  
  8623. if(CanUseSkill(S_Magic_s17)) level += GetSkillLevel(S_Magic_s17);
  8624.  
  8625. return Clamp(level, 1, 4);
  8626. }
  8627.  
  8628. public function IsInFrenzy() : bool
  8629. {
  8630. return isInFrenzy;
  8631. }
  8632.  
  8633. public function HasRecentlyCountered() : bool
  8634. {
  8635. return hasRecentlyCountered;
  8636. }
  8637.  
  8638. public function SetRecentlyCountered(counter : bool)
  8639. {
  8640. hasRecentlyCountered = counter;
  8641. }
  8642.  
  8643. timer function CheckBlockedSkills(dt : float, id : int)
  8644. {
  8645. var nextCallTime : float;
  8646.  
  8647. nextCallTime = ((W3PlayerAbilityManager)abilityManager).CheckBlockedSkills(dt);
  8648. if(nextCallTime != -1)
  8649. AddTimer('CheckBlockedSkills', nextCallTime, , , , true);
  8650. }
  8651.  
  8652.  
  8653. public function RemoveTemporarySkills()
  8654. {
  8655. var i : int;
  8656. var pam : W3PlayerAbilityManager;
  8657.  
  8658.  
  8659. if ( IsCastingSign() )
  8660. {
  8661. AddTimer( 'DelayedRemoveTemporarySkills', 0.1,,,, true );
  8662. return;
  8663. }
  8664.  
  8665. AddTimer( 'SuperchargedSignCleanup', 0.1,,,, true );
  8666.  
  8667.  
  8668. if(tempLearnedSignSkills.Size() > 0)
  8669. {
  8670. pam = (W3PlayerAbilityManager)abilityManager;
  8671. for(i=0; i<tempLearnedSignSkills.Size(); i+=1)
  8672. {
  8673. pam.RemoveTemporarySkill(tempLearnedSignSkills[i]);
  8674. }
  8675.  
  8676. tempLearnedSignSkills.Clear();
  8677. }
  8678. RemoveAbilityAll(SkillEnumToName(S_Sword_s19));
  8679. }
  8680.  
  8681.  
  8682.  
  8683. public timer function SuperchargedSignCleanup(dt : float, id : int)
  8684. {
  8685. superchargedSign = false;
  8686. }
  8687.  
  8688. public timer function DelayedRemoveTemporarySkills(dt : float, id : int)
  8689. {
  8690. var i : int;
  8691. var pam : W3PlayerAbilityManager;
  8692.  
  8693. if ( IsCastingSign() )
  8694. {
  8695. AddTimer( 'DelayedRemoveTemporarySkills', 0.1,,,, true );
  8696. return;
  8697. }
  8698.  
  8699. AddTimer( 'SuperchargedSignCleanup', 0.1,,,, true );
  8700.  
  8701. if(tempLearnedSignSkills.Size() > 0)
  8702. {
  8703. pam = (W3PlayerAbilityManager)abilityManager;
  8704. for(i=0; i<tempLearnedSignSkills.Size(); i+=1)
  8705. {
  8706. pam.RemoveTemporarySkill(tempLearnedSignSkills[i]);
  8707. }
  8708.  
  8709. tempLearnedSignSkills.Clear();
  8710. }
  8711. RemoveAbilityAll(SkillEnumToName(S_Sword_s19));
  8712. }
  8713.  
  8714.  
  8715.  
  8716. public function RemoveTemporarySkill(skill : SSimpleSkill) : bool
  8717. {
  8718. var pam : W3PlayerAbilityManager;
  8719.  
  8720. pam = (W3PlayerAbilityManager)abilityManager;
  8721. if(pam && pam.IsInitialized())
  8722. return pam.RemoveTemporarySkill(skill);
  8723.  
  8724. return false;
  8725. }
  8726.  
  8727.  
  8728.  
  8729. private var superchargedSign : bool;
  8730. public function IsSuperchargedSign() : bool
  8731. {
  8732. return superchargedSign;
  8733. }
  8734.  
  8735.  
  8736.  
  8737.  
  8738. private function AddTemporarySkills()
  8739. {
  8740. if(CanUseSkill(S_Sword_s19) && GetStat(BCS_Focus) >= 3)
  8741. {
  8742. RemoveTemporarySkills();
  8743. tempLearnedSignSkills = ((W3PlayerAbilityManager)abilityManager).AddTempNonAlchemySkills();
  8744. DrainFocus(GetStat(BCS_Focus));
  8745. if ( !this.HasAbility( SkillEnumToName(S_Sword_s19) ) )
  8746. AddAbilityMultiple(SkillEnumToName(S_Sword_s19), GetSkillLevel(S_Sword_s19));
  8747.  
  8748. superchargedSign = true;
  8749.  
  8750. }
  8751. }
  8752.  
  8753.  
  8754.  
  8755. public function HasAlternateQuen() : bool
  8756. {
  8757. var quenEntity : W3QuenEntity;
  8758.  
  8759. quenEntity = (W3QuenEntity)GetCurrentSignEntity();
  8760. if(quenEntity)
  8761. {
  8762. return quenEntity.IsAlternateCast();
  8763. }
  8764.  
  8765. return false;
  8766. }
  8767.  
  8768.  
  8769.  
  8770.  
  8771.  
  8772. public function AddPoints(type : ESpendablePointType, amount : int, show : bool)
  8773. {
  8774. levelManager.AddPoints(type, amount, show);
  8775. }
  8776.  
  8777. public function GetLevel() : int {return levelManager.GetLevel();}
  8778. public function GetMaxLevel() : int {return levelManager.GetMaxLevel();}
  8779. public function GetTotalExpForNextLevel() : int {return levelManager.GetTotalExpForNextLevel();}
  8780. public function GetPointsTotal(type : ESpendablePointType) : int {return levelManager.GetPointsTotal(type);}
  8781. public function IsAutoLeveling() : bool {return autoLevel;}
  8782. public function SetAutoLeveling( b : bool ) {autoLevel = b;}
  8783.  
  8784. public function GetMissingExpForNextLevel() : int
  8785. {
  8786. return Max(0, GetTotalExpForNextLevel() - GetPointsTotal(EExperiencePoint));
  8787. }
  8788.  
  8789.  
  8790.  
  8791.  
  8792. private saved var runewordInfusionType : ESignType;
  8793. default runewordInfusionType = ST_None;
  8794.  
  8795. public final function GetRunewordInfusionType() : ESignType
  8796. {
  8797. return runewordInfusionType;
  8798. }
  8799.  
  8800.  
  8801. public function QuenImpulse( isAlternate : bool, signEntity : W3QuenEntity, source : string, optional forceSkillLevel : int )
  8802. {
  8803. var level, i, j : int;
  8804. var atts, damages : array<name>;
  8805. var ents : array<CGameplayEntity>;
  8806. var action : W3DamageAction;
  8807. var dm : CDefinitionsManagerAccessor;
  8808. var skillAbilityName : name;
  8809. var dmg : float;
  8810. var min, max : SAbilityAttributeValue;
  8811. var pos : Vector;
  8812.  
  8813. if( forceSkillLevel > 0 )
  8814. {
  8815. level = forceSkillLevel;
  8816. }
  8817. else
  8818. {
  8819. level = GetSkillLevel(S_Magic_s13);
  8820. }
  8821.  
  8822. dm = theGame.GetDefinitionsManager();
  8823. skillAbilityName = GetSkillAbilityName(S_Magic_s13);
  8824.  
  8825. if(level >= 2)
  8826. {
  8827.  
  8828. dm.GetAbilityAttributes(skillAbilityName, atts);
  8829. for(i=0; i<atts.Size(); i+=1)
  8830. {
  8831. if(IsDamageTypeNameValid(atts[i]))
  8832. {
  8833. damages.PushBack(atts[i]);
  8834. }
  8835. }
  8836. }
  8837.  
  8838.  
  8839. pos = signEntity.GetWorldPosition();
  8840. FindGameplayEntitiesInSphere(ents, pos, 3, 1000, '', FLAG_OnlyAliveActors + FLAG_ExcludeTarget + FLAG_Attitude_Hostile + FLAG_Attitude_Neutral + FLAG_TestLineOfSight, this);
  8841.  
  8842.  
  8843. for(i=0; i<ents.Size(); i+=1)
  8844. {
  8845. action = new W3DamageAction in theGame;
  8846. action.Initialize(this, ents[i], signEntity, source, EHRT_Heavy, CPS_SpellPower, false, false, true, false);
  8847. action.SetSignSkill(S_Magic_s13);
  8848. action.SetCannotReturnDamage(true);
  8849. action.SetProcessBuffsIfNoDamage(true);
  8850.  
  8851.  
  8852. if(!isAlternate && level >= 2)
  8853. {
  8854. action.SetHitEffect('hit_electric_quen');
  8855. action.SetHitEffect('hit_electric_quen', true);
  8856. action.SetHitEffect('hit_electric_quen', false, true);
  8857. action.SetHitEffect('hit_electric_quen', true, true);
  8858. }
  8859.  
  8860. if(level >= 1)
  8861. {
  8862. action.AddEffectInfo(EET_Stagger);
  8863. }
  8864. if(level >= 2)
  8865. {
  8866. for(j=0; j<damages.Size(); j+=1)
  8867. {
  8868. dm.GetAbilityAttributeValue(skillAbilityName, damages[j], min, max);
  8869. dmg = CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  8870. if( IsSetBonusActive( EISB_Bear_2 ) )
  8871. {
  8872. dm.GetAbilityAttributeValue( GetSetBonusAbility( EISB_Bear_2 ), 'quen_dmg_boost', min, max );
  8873. dmg *= 1 + min.valueMultiplicative;
  8874. }
  8875. action.AddDamage(damages[j], dmg);
  8876. }
  8877. }
  8878. if(level == 3)
  8879. {
  8880. action.AddEffectInfo(EET_KnockdownTypeApplicator);
  8881. }
  8882.  
  8883. theGame.damageMgr.ProcessAction( action );
  8884. delete action;
  8885. }
  8886.  
  8887.  
  8888. if(isAlternate)
  8889. {
  8890. signEntity.PlayHitEffect('quen_impulse_explode', signEntity.GetWorldRotation());
  8891. signEntity.EraseFirstTimeStamp();
  8892.  
  8893.  
  8894. if(level >= 2)
  8895. {
  8896. if( !IsSetBonusActive( EISB_Bear_2 ) )
  8897. {
  8898. signEntity.PlayHitEffect('quen_electric_explode', signEntity.GetWorldRotation());
  8899. }
  8900. else
  8901. {
  8902. signEntity.PlayHitEffect('quen_electric_explode_bear_abl2', signEntity.GetWorldRotation());
  8903. }
  8904. }
  8905. }
  8906. else
  8907. {
  8908. signEntity.PlayEffect('lasting_shield_impulse');
  8909. }
  8910. }
  8911.  
  8912. public function OnSignCastPerformed(signType : ESignType, isAlternate : bool)
  8913. {
  8914. var items : array<SItemUniqueId>;
  8915. var weaponEnt : CEntity;
  8916. var fxName : name;
  8917. var pos : Vector;
  8918.  
  8919. super.OnSignCastPerformed(signType, isAlternate);
  8920.  
  8921. if(HasAbility('Runeword 1 _Stats', true) && GetStat(BCS_Focus) >= 1.0f)
  8922. {
  8923. DrainFocus(1.0f);
  8924. runewordInfusionType = signType;
  8925. items = inv.GetHeldWeapons();
  8926. weaponEnt = inv.GetItemEntityUnsafe(items[0]);
  8927.  
  8928.  
  8929. weaponEnt.StopEffect('runeword_aard');
  8930. weaponEnt.StopEffect('runeword_axii');
  8931. weaponEnt.StopEffect('runeword_igni');
  8932. weaponEnt.StopEffect('runeword_quen');
  8933. weaponEnt.StopEffect('runeword_yrden');
  8934.  
  8935.  
  8936. if(signType == ST_Aard)
  8937. fxName = 'runeword_aard';
  8938. else if(signType == ST_Axii)
  8939. fxName = 'runeword_axii';
  8940. else if(signType == ST_Igni)
  8941. fxName = 'runeword_igni';
  8942. else if(signType == ST_Quen)
  8943. fxName = 'runeword_quen';
  8944. else if(signType == ST_Yrden)
  8945. fxName = 'runeword_yrden';
  8946.  
  8947. weaponEnt.PlayEffect(fxName);
  8948. }
  8949.  
  8950.  
  8951. if( IsMutationActive( EPMT_Mutation6 ) && signType == ST_Aard && !isAlternate )
  8952. {
  8953. pos = GetWorldPosition() + GetWorldForward() * 2;
  8954.  
  8955. theGame.GetSurfacePostFX().AddSurfacePostFXGroup( pos, 0.f, 3.f, 2.f, 5.f, 0 );
  8956. }
  8957. }
  8958.  
  8959. public saved var savedQuenHealth, savedQuenDuration : float;
  8960.  
  8961. timer function HACK_QuenSaveStatus(dt : float, id : int)
  8962. {
  8963. var quenEntity : W3QuenEntity;
  8964.  
  8965. quenEntity = (W3QuenEntity)signs[ST_Quen].entity;
  8966. savedQuenHealth = quenEntity.GetShieldHealth();
  8967. savedQuenDuration = quenEntity.GetShieldRemainingDuration();
  8968. }
  8969.  
  8970. timer function DelayedRestoreQuen(dt : float, id : int)
  8971. {
  8972. RestoreQuen(savedQuenHealth, savedQuenDuration);
  8973. }
  8974.  
  8975. public final function OnBasicQuenFinishing()
  8976. {
  8977. RemoveTimer('HACK_QuenSaveStatus');
  8978. savedQuenHealth = 0.f;
  8979. savedQuenDuration = 0.f;
  8980. }
  8981.  
  8982. public final function IsAnyQuenActive() : bool
  8983. {
  8984. var quen : W3QuenEntity;
  8985.  
  8986. quen = (W3QuenEntity)GetSignEntity(ST_Quen);
  8987. if(quen)
  8988. return quen.IsAnyQuenActive();
  8989.  
  8990. return false;
  8991. }
  8992.  
  8993. public final function IsQuenActive(alternateMode : bool) : bool
  8994. {
  8995. if(IsAnyQuenActive() && GetSignEntity(ST_Quen).IsAlternateCast() == alternateMode)
  8996. return true;
  8997.  
  8998. return false;
  8999. }
  9000.  
  9001. public function FinishQuen( skipVisuals : bool, optional forceNoBearSetBonus : bool )
  9002. {
  9003. var quen : W3QuenEntity;
  9004.  
  9005. quen = (W3QuenEntity)GetSignEntity(ST_Quen);
  9006. if(quen)
  9007. quen.ForceFinishQuen( skipVisuals, forceNoBearSetBonus );
  9008. }
  9009.  
  9010.  
  9011. public function GetTotalSignSpellPower(signSkill : ESkill) : SAbilityAttributeValue
  9012. {
  9013. var sp : SAbilityAttributeValue;
  9014. var penalty : SAbilityAttributeValue;
  9015. var penaltyReduction : float;
  9016. var penaltyReductionLevel : int;
  9017.  
  9018.  
  9019. sp = GetSkillAttributeValue(signSkill, PowerStatEnumToName(CPS_SpellPower), true, true);
  9020.  
  9021.  
  9022. if ( signSkill == S_Magic_s01 )
  9023. {
  9024.  
  9025. penaltyReductionLevel = GetSkillLevel(S_Magic_s01) + 1;
  9026. if(penaltyReductionLevel > 0)
  9027. {
  9028. penaltyReduction = 1 - penaltyReductionLevel * CalculateAttributeValue(GetSkillAttributeValue(S_Magic_s01, 'spell_power_penalty_reduction', true, true));
  9029. penalty = GetSkillAttributeValue(S_Magic_s01, PowerStatEnumToName(CPS_SpellPower), false, false);
  9030. sp += penalty * penaltyReduction;
  9031. }
  9032. }
  9033.  
  9034.  
  9035. if(signSkill == S_Magic_1 || signSkill == S_Magic_s01)
  9036. {
  9037. sp += GetAttributeValue('spell_power_aard');
  9038. }
  9039. else if(signSkill == S_Magic_2 || signSkill == S_Magic_s02)
  9040. {
  9041. sp += GetAttributeValue('spell_power_igni');
  9042. }
  9043. else if(signSkill == S_Magic_3 || signSkill == S_Magic_s03)
  9044. {
  9045. sp += GetAttributeValue('spell_power_yrden');
  9046. }
  9047. else if(signSkill == S_Magic_4 || signSkill == S_Magic_s04)
  9048. {
  9049. sp += GetAttributeValue('spell_power_quen');
  9050. }
  9051. else if(signSkill == S_Magic_5 || signSkill == S_Magic_s05)
  9052. {
  9053. sp += GetAttributeValue('spell_power_axii');
  9054. }
  9055.  
  9056.  
  9057. ApplyMutation10StatBoost( sp );
  9058.  
  9059. return sp;
  9060. }
  9061.  
  9062.  
  9063.  
  9064.  
  9065.  
  9066. public final function GetGwentCardIndex( cardName : name ) : int
  9067. {
  9068. var dm : CDefinitionsManagerAccessor;
  9069.  
  9070. dm = theGame.GetDefinitionsManager();
  9071.  
  9072. if(dm.ItemHasTag( cardName , 'GwintCardLeader' ))
  9073. {
  9074. return theGame.GetGwintManager().GwentLeadersNametoInt( cardName );
  9075. }
  9076. else if(dm.ItemHasTag( cardName , 'GwintCardNrkd' ))
  9077. {
  9078. return theGame.GetGwintManager().GwentNrkdNameToInt( cardName );
  9079. }
  9080. else if(dm.ItemHasTag( cardName , 'GwintCardNlfg' ))
  9081. {
  9082. return theGame.GetGwintManager().GwentNlfgNameToInt( cardName );
  9083. }
  9084. else if(dm.ItemHasTag( cardName , 'GwintCardSctl' ))
  9085. {
  9086. return theGame.GetGwintManager().GwentSctlNameToInt( cardName );
  9087. }
  9088. else if(dm.ItemHasTag( cardName , 'GwintCardMstr' ))
  9089. {
  9090. return theGame.GetGwintManager().GwentMstrNameToInt( cardName );
  9091. }
  9092. else if(dm.ItemHasTag( cardName , 'GwintCardSke' ))
  9093. {
  9094. return theGame.GetGwintManager().GwentSkeNameToInt( cardName );
  9095. }
  9096. else if(dm.ItemHasTag( cardName , 'GwintCardNeutral' ))
  9097. {
  9098. return theGame.GetGwintManager().GwentNeutralNameToInt( cardName );
  9099. }
  9100. else if(dm.ItemHasTag( cardName , 'GwintCardSpcl' ))
  9101. {
  9102. return theGame.GetGwintManager().GwentSpecialNameToInt( cardName );
  9103. }
  9104.  
  9105. return -1;
  9106. }
  9107.  
  9108. public final function AddGwentCard(cardName : name, amount : int) : bool
  9109. {
  9110. var dm : CDefinitionsManagerAccessor;
  9111. var cardIndex, i : int;
  9112. var tut : STutorialMessage;
  9113. var gwintManager : CR4GwintManager;
  9114.  
  9115.  
  9116.  
  9117. if(FactsQuerySum("q001_nightmare_ended") > 0 && ShouldProcessTutorial('TutorialGwentDeckBuilder2'))
  9118. {
  9119. tut.type = ETMT_Hint;
  9120. tut.tutorialScriptTag = 'TutorialGwentDeckBuilder2';
  9121. tut.journalEntryName = 'TutorialGwentDeckBuilder2';
  9122. tut.hintPositionType = ETHPT_DefaultGlobal;
  9123. tut.markAsSeenOnShow = true;
  9124. tut.hintDurationType = ETHDT_Long;
  9125.  
  9126. theGame.GetTutorialSystem().DisplayTutorial(tut);
  9127. }
  9128.  
  9129. dm = theGame.GetDefinitionsManager();
  9130.  
  9131. cardIndex = GetGwentCardIndex(cardName);
  9132.  
  9133. if (cardIndex != -1)
  9134. {
  9135. FactsAdd("Gwint_Card_Looted");
  9136.  
  9137. for(i = 0; i < amount; i += 1)
  9138. {
  9139. theGame.GetGwintManager().AddCardToCollection( cardIndex );
  9140. }
  9141. }
  9142.  
  9143. if( dm.ItemHasTag( cardName, 'GwentTournament' ) )
  9144. {
  9145. if ( dm.ItemHasTag( cardName, 'GT1' ) )
  9146. {
  9147. FactsAdd( "GwentTournament", 1 );
  9148. }
  9149.  
  9150. else if ( dm.ItemHasTag( cardName, 'GT2' ) )
  9151. {
  9152. FactsAdd( "GwentTournament", 2 );
  9153. }
  9154.  
  9155. else if ( dm.ItemHasTag( cardName, 'GT3' ) )
  9156. {
  9157. FactsAdd( "GwentTournament", 3 );
  9158. }
  9159.  
  9160. else if ( dm.ItemHasTag( cardName, 'GT4' ) )
  9161. {
  9162. FactsAdd( "GwentTournament", 4 );
  9163. }
  9164.  
  9165. else if ( dm.ItemHasTag( cardName, 'GT5' ) )
  9166. {
  9167. FactsAdd( "GwentTournament", 5 );
  9168. }
  9169.  
  9170. else if ( dm.ItemHasTag( cardName, 'GT6' ) )
  9171. {
  9172. FactsAdd( "GwentTournament", 6 );
  9173. }
  9174.  
  9175. else if ( dm.ItemHasTag( cardName, 'GT7' ) )
  9176. {
  9177. FactsAdd( "GwentTournament", 7 );
  9178. }
  9179.  
  9180. CheckGwentTournamentDeck();
  9181. }
  9182.  
  9183. if( dm.ItemHasTag( cardName, 'EP2Tournament' ) )
  9184. {
  9185. if ( dm.ItemHasTag( cardName, 'GT1' ) )
  9186. {
  9187. FactsAdd( "EP2Tournament", 1 );
  9188. }
  9189.  
  9190. else if ( dm.ItemHasTag( cardName, 'GT2' ) )
  9191. {
  9192. FactsAdd( "EP2Tournament", 2 );
  9193. }
  9194.  
  9195. else if ( dm.ItemHasTag( cardName, 'GT3' ) )
  9196. {
  9197. FactsAdd( "EP2Tournament", 3 );
  9198. }
  9199.  
  9200. else if ( dm.ItemHasTag( cardName, 'GT4' ) )
  9201. {
  9202. FactsAdd( "EP2Tournament", 4 );
  9203. }
  9204.  
  9205. else if ( dm.ItemHasTag( cardName, 'GT5' ) )
  9206. {
  9207. FactsAdd( "EP2Tournament", 5 );
  9208. }
  9209.  
  9210. else if ( dm.ItemHasTag( cardName, 'GT6' ) )
  9211. {
  9212. FactsAdd( "EP2Tournament", 6 );
  9213. }
  9214.  
  9215. else if ( dm.ItemHasTag( cardName, 'GT7' ) )
  9216. {
  9217. FactsAdd( "EP2Tournament", 7 );
  9218. }
  9219.  
  9220. CheckEP2TournamentDeck();
  9221. }
  9222.  
  9223. gwintManager = theGame.GetGwintManager();
  9224. if( !gwintManager.IsDeckUnlocked( GwintFaction_Skellige ) &&
  9225. gwintManager.HasCardsOfFactionInCollection( GwintFaction_Skellige, false ) )
  9226. {
  9227. gwintManager.UnlockDeck( GwintFaction_Skellige );
  9228. }
  9229.  
  9230. return true;
  9231. }
  9232.  
  9233.  
  9234. public final function RemoveGwentCard(cardName : name, amount : int) : bool
  9235. {
  9236. var dm : CDefinitionsManagerAccessor;
  9237. var cardIndex, i : int;
  9238.  
  9239. dm = theGame.GetDefinitionsManager();
  9240.  
  9241. if(dm.ItemHasTag( cardName , 'GwintCardLeader' ))
  9242. {
  9243. cardIndex = theGame.GetGwintManager().GwentLeadersNametoInt( cardName );
  9244. for(i=0; i<amount; i+=1)
  9245. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  9246. }
  9247. else if(dm.ItemHasTag( cardName , 'GwintCardNrkd' ))
  9248. {
  9249. cardIndex = theGame.GetGwintManager().GwentNrkdNameToInt( cardName );
  9250. for(i=0; i<amount; i+=1)
  9251. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  9252. }
  9253. else if(dm.ItemHasTag( cardName , 'GwintCardNlfg' ))
  9254. {
  9255. cardIndex = theGame.GetGwintManager().GwentNlfgNameToInt( cardName );
  9256. for(i=0; i<amount; i+=1)
  9257. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  9258. }
  9259. else if(dm.ItemHasTag( cardName , 'GwintCardSctl' ))
  9260. {
  9261. cardIndex = theGame.GetGwintManager().GwentSctlNameToInt( cardName );
  9262. for(i=0; i<amount; i+=1)
  9263. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  9264. }
  9265. else if(dm.ItemHasTag( cardName , 'GwintCardMstr' ))
  9266. {
  9267. cardIndex = theGame.GetGwintManager().GwentMstrNameToInt( cardName );
  9268. for(i=0; i<amount; i+=1)
  9269. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  9270. }
  9271. else if(dm.ItemHasTag( cardName , 'GwintCardNeutral' ))
  9272. {
  9273. cardIndex = theGame.GetGwintManager().GwentNeutralNameToInt( cardName );
  9274. for(i=0; i<amount; i+=1)
  9275. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  9276. }
  9277. else if(dm.ItemHasTag( cardName , 'GwintCardSpcl' ))
  9278. {
  9279. cardIndex = theGame.GetGwintManager().GwentSpecialNameToInt( cardName );
  9280. for(i=0; i<amount; i+=1)
  9281. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  9282. }
  9283.  
  9284. if( dm.ItemHasTag( cardName, 'GwentTournament' ) )
  9285. {
  9286. if ( dm.ItemHasTag( cardName, 'GT1' ) )
  9287. {
  9288. FactsSubstract( "GwentTournament", 1 );
  9289. }
  9290.  
  9291. else if ( dm.ItemHasTag( cardName, 'GT2' ) )
  9292. {
  9293. FactsSubstract( "GwentTournament", 2 );
  9294. }
  9295.  
  9296. else if ( dm.ItemHasTag( cardName, 'GT3' ) )
  9297. {
  9298. FactsSubstract( "GwentTournament", 3 );
  9299. }
  9300.  
  9301. else if ( dm.ItemHasTag( cardName, 'GT4' ) )
  9302. {
  9303. FactsSubstract( "GwentTournament", 4 );
  9304. }
  9305.  
  9306. else if ( dm.ItemHasTag( cardName, 'GT5' ) )
  9307. {
  9308. FactsSubstract( "GwentTournament", 5 );
  9309. }
  9310.  
  9311. else if ( dm.ItemHasTag( cardName, 'GT6' ) )
  9312. {
  9313. FactsSubstract( "GwentTournament", 6 );
  9314. }
  9315.  
  9316. else if ( dm.ItemHasTag( cardName, 'GT7' ) )
  9317. {
  9318. FactsSubstract( "GwentTournament", 7 );
  9319. }
  9320.  
  9321. CheckGwentTournamentDeck();
  9322. }
  9323.  
  9324.  
  9325. if( dm.ItemHasTag( cardName, 'EP2Tournament' ) )
  9326. {
  9327. if ( dm.ItemHasTag( cardName, 'GT1' ) )
  9328. {
  9329. FactsSubstract( "EP2Tournament", 1 );
  9330. }
  9331.  
  9332. else if ( dm.ItemHasTag( cardName, 'GT2' ) )
  9333. {
  9334. FactsSubstract( "EP2Tournament", 2 );
  9335. }
  9336.  
  9337. else if ( dm.ItemHasTag( cardName, 'GT3' ) )
  9338. {
  9339. FactsSubstract( "EP2Tournament", 3 );
  9340. }
  9341.  
  9342. else if ( dm.ItemHasTag( cardName, 'GT4' ) )
  9343. {
  9344. FactsSubstract( "EP2Tournament", 4 );
  9345. }
  9346.  
  9347. else if ( dm.ItemHasTag( cardName, 'GT5' ) )
  9348. {
  9349. FactsSubstract( "EP2Tournament", 5 );
  9350. }
  9351.  
  9352. else if ( dm.ItemHasTag( cardName, 'GT6' ) )
  9353. {
  9354. FactsSubstract( "EP2Tournament", 6 );
  9355. }
  9356.  
  9357. else if ( dm.ItemHasTag( cardName, 'GT7' ) )
  9358. {
  9359. FactsSubstract( "EP2Tournament", 7 );
  9360. }
  9361.  
  9362. CheckEP2TournamentDeck();
  9363. }
  9364.  
  9365. return true;
  9366. }
  9367.  
  9368. function CheckGwentTournamentDeck()
  9369. {
  9370. var gwentPower : int;
  9371. var neededGwentPower : int;
  9372. var checkBreakpoint : int;
  9373.  
  9374. neededGwentPower = 70;
  9375.  
  9376. checkBreakpoint = neededGwentPower/5;
  9377. gwentPower = FactsQuerySum( "GwentTournament" );
  9378.  
  9379. if ( gwentPower >= neededGwentPower )
  9380. {
  9381. FactsAdd( "HasGwentTournamentDeck", 1 );
  9382. }
  9383. else
  9384. {
  9385. if( FactsDoesExist( "HasGwentTournamentDeck" ) )
  9386. {
  9387. FactsRemove( "HasGwentTournamentDeck" );
  9388. }
  9389.  
  9390. if ( gwentPower >= checkBreakpoint )
  9391. {
  9392. FactsAdd( "GwentTournamentObjective1", 1 );
  9393. }
  9394. else if ( FactsDoesExist( "GwentTournamentObjective1" ) )
  9395. {
  9396. FactsRemove( "GwentTournamentObjective1" );
  9397. }
  9398.  
  9399. if ( gwentPower >= checkBreakpoint*2 )
  9400. {
  9401. FactsAdd( "GwentTournamentObjective2", 1 );
  9402. }
  9403. else if ( FactsDoesExist( "GwentTournamentObjective2" ) )
  9404. {
  9405. FactsRemove( "GwentTournamentObjective2" );
  9406. }
  9407.  
  9408. if ( gwentPower >= checkBreakpoint*3 )
  9409. {
  9410. FactsAdd( "GwentTournamentObjective3", 1 );
  9411. }
  9412. else if ( FactsDoesExist( "GwentTournamentObjective3" ) )
  9413. {
  9414. FactsRemove( "GwentTournamentObjective3" );
  9415. }
  9416.  
  9417. if ( gwentPower >= checkBreakpoint*4 )
  9418. {
  9419. FactsAdd( "GwentTournamentObjective4", 1 );
  9420. }
  9421. else if ( FactsDoesExist( "GwentTournamentObjective4" ) )
  9422. {
  9423. FactsRemove( "GwentTournamentObjective4" );
  9424. }
  9425. }
  9426. }
  9427.  
  9428. function CheckEP2TournamentDeck()
  9429. {
  9430. var gwentPower : int;
  9431. var neededGwentPower : int;
  9432. var checkBreakpoint : int;
  9433.  
  9434. neededGwentPower = 24;
  9435.  
  9436. checkBreakpoint = neededGwentPower/5;
  9437. gwentPower = FactsQuerySum( "EP2Tournament" );
  9438.  
  9439. if ( gwentPower >= neededGwentPower )
  9440. {
  9441. if( FactsQuerySum( "HasEP2TournamentDeck") == 0 )
  9442. {
  9443. FactsAdd( "HasEP2TournamentDeck", 1 );
  9444. }
  9445.  
  9446. }
  9447. else
  9448. {
  9449. if( FactsDoesExist( "HasEP2TournamentDeck" ) )
  9450. {
  9451. FactsRemove( "HasEP2TournamentDeck" );
  9452. }
  9453.  
  9454. if ( gwentPower >= checkBreakpoint )
  9455. {
  9456. FactsAdd( "EP2TournamentObjective1", 1 );
  9457. }
  9458. else if ( FactsDoesExist( "EP2TournamentObjective1" ) )
  9459. {
  9460. FactsRemove( "EP2TournamentObjective1" );
  9461. }
  9462.  
  9463. if ( gwentPower >= checkBreakpoint*2 )
  9464. {
  9465. FactsAdd( "EP2TournamentObjective2", 1 );
  9466. }
  9467. else if ( FactsDoesExist( "EP2TournamentObjective2" ) )
  9468. {
  9469. FactsRemove( "EP2TournamentObjective2" );
  9470. }
  9471.  
  9472. if ( gwentPower >= checkBreakpoint*3 )
  9473. {
  9474. FactsAdd( "EP2TournamentObjective3", 1 );
  9475. }
  9476. else if ( FactsDoesExist( "EP2TournamentObjective3" ) )
  9477. {
  9478. FactsRemove( "EP2TournamentObjective3" );
  9479. }
  9480.  
  9481. if ( gwentPower >= checkBreakpoint*4 )
  9482. {
  9483. FactsAdd( "EP2TournamentObjective4", 1 );
  9484. }
  9485. else if ( FactsDoesExist( "EP2TournamentObjective4" ) )
  9486. {
  9487. FactsRemove( "EP2TournamentObjective4" );
  9488. }
  9489. }
  9490. }
  9491.  
  9492.  
  9493.  
  9494.  
  9495.  
  9496.  
  9497. public function SimulateBuffTimePassing(simulatedTime : float)
  9498. {
  9499. super.SimulateBuffTimePassing(simulatedTime);
  9500.  
  9501. FinishQuen(true);
  9502. }
  9503.  
  9504.  
  9505. public function CanMeditate() : bool
  9506. {
  9507. var currentStateName : name;
  9508.  
  9509. currentStateName = GetCurrentStateName();
  9510.  
  9511.  
  9512. if(currentStateName == 'Exploration' && !CanPerformPlayerAction())
  9513. return false;
  9514.  
  9515.  
  9516. if(GetCurrentStateName() != 'Exploration' && GetCurrentStateName() != 'Meditation' && GetCurrentStateName() != 'MeditationWaiting')
  9517. return false;
  9518.  
  9519.  
  9520. if(GetUsedVehicle())
  9521. return false;
  9522.  
  9523.  
  9524. return CanMeditateHere();
  9525. }
  9526.  
  9527.  
  9528. public final function CanMeditateWait(optional skipMeditationStateCheck : bool) : bool
  9529. {
  9530. var currState : name;
  9531.  
  9532. currState = GetCurrentStateName();
  9533.  
  9534.  
  9535.  
  9536. if(!skipMeditationStateCheck && currState != 'Meditation')
  9537. return false;
  9538.  
  9539.  
  9540. if(theGame.IsGameTimePaused())
  9541. return false;
  9542.  
  9543. if(!IsActionAllowed( EIAB_MeditationWaiting ))
  9544. return false;
  9545.  
  9546. return true;
  9547. }
  9548.  
  9549.  
  9550. public final function CanMeditateHere() : bool
  9551. {
  9552. var pos : Vector;
  9553.  
  9554. pos = GetWorldPosition();
  9555. if(pos.Z <= theGame.GetWorld().GetWaterLevel(pos, true) && IsInShallowWater())
  9556. return false;
  9557.  
  9558. if(IsThreatened())
  9559. return false;
  9560.  
  9561. return true;
  9562. }
  9563.  
  9564.  
  9565. public function Meditate() : bool
  9566. {
  9567. var medState : W3PlayerWitcherStateMeditation;
  9568. var stateName : name;
  9569.  
  9570. stateName = GetCurrentStateName();
  9571.  
  9572.  
  9573. if (!CanMeditate() || stateName == 'MeditationWaiting' )
  9574. return false;
  9575.  
  9576. GotoState('Meditation');
  9577. medState = (W3PlayerWitcherStateMeditation)GetState('Meditation');
  9578. medState.SetMeditationPointHeading(GetHeading());
  9579.  
  9580. return true;
  9581. }
  9582.  
  9583.  
  9584. public final function MeditationRestoring(simulatedTime : float)
  9585. {
  9586.  
  9587. if ( theGame.GetDifficultyMode() != EDM_Hard && theGame.GetDifficultyMode() != EDM_Hardcore )
  9588. {
  9589. Heal(GetStatMax(BCS_Vitality));
  9590. }
  9591.  
  9592.  
  9593. abilityManager.DrainToxicity( abilityManager.GetStat( BCS_Toxicity ) );
  9594. abilityManager.DrainFocus( abilityManager.GetStat( BCS_Focus ) );
  9595.  
  9596.  
  9597. inv.SingletonItemsRefillAmmo();
  9598.  
  9599.  
  9600. SimulateBuffTimePassing(simulatedTime);
  9601.  
  9602.  
  9603. ApplyWitcherHouseBuffs();
  9604. }
  9605.  
  9606. var clockMenu : CR4MeditationClockMenu;
  9607.  
  9608. public function MeditationClockStart(m : CR4MeditationClockMenu)
  9609. {
  9610. clockMenu = m;
  9611. AddTimer('UpdateClockTime',0.1,true);
  9612. }
  9613.  
  9614. public function MeditationClockStop()
  9615. {
  9616. clockMenu = NULL;
  9617. RemoveTimer('UpdateClockTime');
  9618. }
  9619.  
  9620. public timer function UpdateClockTime(dt : float, id : int)
  9621. {
  9622. if(clockMenu)
  9623. clockMenu.UpdateCurrentHours();
  9624. else
  9625. RemoveTimer('UpdateClockTime');
  9626. }
  9627.  
  9628. private var waitTimeHour : int;
  9629. public function SetWaitTargetHour(t : int)
  9630. {
  9631. waitTimeHour = t;
  9632. }
  9633. public function GetWaitTargetHour() : int
  9634. {
  9635. return waitTimeHour;
  9636. }
  9637.  
  9638. public function MeditationForceAbort(forceCloseUI : bool)
  9639. {
  9640. var waitt : W3PlayerWitcherStateMeditationWaiting;
  9641. var medd : W3PlayerWitcherStateMeditation;
  9642. var currentStateName : name;
  9643.  
  9644. currentStateName = GetCurrentStateName();
  9645.  
  9646. if(currentStateName == 'MeditationWaiting')
  9647. {
  9648. waitt = (W3PlayerWitcherStateMeditationWaiting)GetCurrentState();
  9649. if(waitt)
  9650. {
  9651. waitt.StopRequested(forceCloseUI);
  9652. }
  9653. }
  9654. else if(currentStateName == 'Meditation')
  9655. {
  9656. medd = (W3PlayerWitcherStateMeditation)GetCurrentState();
  9657. if(medd)
  9658. {
  9659. medd.StopRequested(forceCloseUI);
  9660. }
  9661. }
  9662.  
  9663.  
  9664.  
  9665. if( forceCloseUI && theGame.GetGuiManager().IsAnyMenu() && !theGame.GetPhotomodeEnabled() )
  9666. {
  9667. theGame.GetGuiManager().GetRootMenu().CloseMenu();
  9668. DisplayActionDisallowedHudMessage(EIAB_MeditationWaiting, false, false, true, false);
  9669. }
  9670. }
  9671.  
  9672. public function Runeword10Triggerred()
  9673. {
  9674. var min, max : SAbilityAttributeValue;
  9675. var amount : float;
  9676.  
  9677.  
  9678.  
  9679. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Runeword 10 _Stats', 'stamina_runeword_gain', min, max );
  9680.  
  9681.  
  9682. amount = min.valueMultiplicative * GetStatMax(BCS_Stamina);
  9683. if ( GetStat(BCS_Stamina) + amount > GetStatMax(BCS_Stamina) )
  9684. {
  9685. amount = GetStatMax(BCS_Stamina) - GetStat(BCS_Stamina);
  9686. }
  9687. GainStat(BCS_Stamina, amount);
  9688.  
  9689.  
  9690. PlayEffect('runeword_10_stamina');
  9691. }
  9692.  
  9693. public function Runeword12Triggerred()
  9694. {
  9695. var min, max : SAbilityAttributeValue;
  9696. var amount : float;
  9697.  
  9698.  
  9699.  
  9700. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Runeword 12 _Stats', 'focus_runeword_gain', min, max );
  9701.  
  9702.  
  9703. amount = RandRangeF(max.valueAdditive, min.valueAdditive);
  9704. if ( GetStat(BCS_Focus) + amount > GetStatMax(BCS_Focus) )
  9705. {
  9706. amount = GetStatMax(BCS_Focus) - GetStat(BCS_Focus);
  9707. }
  9708. GainStat(BCS_Focus, amount);
  9709.  
  9710.  
  9711. PlayEffect('runeword_20_adrenaline');
  9712. }
  9713.  
  9714. var runeword10TriggerredOnFinisher, runeword12TriggerredOnFinisher : bool;
  9715.  
  9716. event OnFinisherStart()
  9717. {
  9718. super.OnFinisherStart();
  9719.  
  9720. runeword10TriggerredOnFinisher = false;
  9721. runeword12TriggerredOnFinisher = false;
  9722. }
  9723.  
  9724. public function ApplyWitcherHouseBuffs()
  9725. {
  9726. var l_bed : W3WitcherBed;
  9727.  
  9728. if( FactsQuerySum( "PlayerInsideInnerWitcherHouse" ) > 0 )
  9729. {
  9730. l_bed = (W3WitcherBed)theGame.GetEntityByTag( 'witcherBed' );
  9731.  
  9732. if( l_bed.GetWasUsed() )
  9733. {
  9734. if( l_bed.GetBedLevel() != 0 )
  9735. {
  9736. AddEffectDefault( EET_WellRested, this, "Bed Buff" );
  9737. }
  9738.  
  9739. if( FactsQuerySum( "StablesExists" ) )
  9740. {
  9741. AddEffectDefault( EET_HorseStableBuff, this, "Stables" );
  9742. }
  9743.  
  9744. if( l_bed.GetWereItemsRefilled() )
  9745. {
  9746. theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt( "message_common_alchemy_table_buff_applied" ),, true );
  9747. l_bed.SetWereItemsRefilled( false );
  9748. }
  9749.  
  9750. AddEffectDefault( EET_BookshelfBuff, this, "Bookshelf" );
  9751.  
  9752. Heal( GetStatMax( BCS_Vitality ) );
  9753. }
  9754. }
  9755. }
  9756.  
  9757.  
  9758.  
  9759.  
  9760.  
  9761. public function CheatResurrect()
  9762. {
  9763. super.CheatResurrect();
  9764. theGame.ReleaseNoSaveLock(theGame.deathSaveLockId);
  9765. theInput.RestoreContext( 'Exploration', true );
  9766. }
  9767.  
  9768.  
  9769. public function Debug_EquipTestingSkills(equip : bool, force : bool)
  9770. {
  9771. var skills : array<ESkill>;
  9772. var i, slot : int;
  9773.  
  9774.  
  9775. ((W3PlayerAbilityManager)abilityManager).OnLevelGained(36);
  9776.  
  9777. skills.PushBack(S_Magic_s01);
  9778. skills.PushBack(S_Magic_s02);
  9779. skills.PushBack(S_Magic_s03);
  9780. skills.PushBack(S_Magic_s04);
  9781. skills.PushBack(S_Magic_s05);
  9782. skills.PushBack(S_Sword_s01);
  9783. skills.PushBack(S_Sword_s02);
  9784.  
  9785.  
  9786. if(equip)
  9787. {
  9788. for(i=0; i<skills.Size(); i+=1)
  9789. {
  9790. if(!force && IsSkillEquipped(skills[i]))
  9791. continue;
  9792.  
  9793.  
  9794. if(GetSkillLevel(skills[i]) == 0)
  9795. AddSkill(skills[i]);
  9796.  
  9797.  
  9798. if(force)
  9799. slot = i+1;
  9800. else
  9801. slot = GetFreeSkillSlot();
  9802.  
  9803.  
  9804. EquipSkill(skills[i], slot);
  9805. }
  9806. }
  9807. else
  9808. {
  9809. for(i=0; i<skills.Size(); i+=1)
  9810. {
  9811. UnequipSkill(GetSkillSlotID(skills[i]));
  9812. }
  9813. }
  9814. }
  9815.  
  9816. public function Debug_ClearCharacterDevelopment(optional keepInv : bool)
  9817. {
  9818. var template : CEntityTemplate;
  9819. var entity : CEntity;
  9820. var invTesting : CInventoryComponent;
  9821. var i : int;
  9822. var items : array<SItemUniqueId>;
  9823. var abs : array<name>;
  9824.  
  9825. delete abilityManager;
  9826. delete levelManager;
  9827. delete effectManager;
  9828.  
  9829.  
  9830. GetCharacterStats().GetAbilities(abs, false);
  9831. for(i=0; i<abs.Size(); i+=1)
  9832. RemoveAbility(abs[i]);
  9833.  
  9834.  
  9835. abs.Clear();
  9836. GetCharacterStatsParam(abs);
  9837. for(i=0; i<abs.Size(); i+=1)
  9838. AddAbility(abs[i]);
  9839.  
  9840.  
  9841. levelManager = new W3LevelManager in this;
  9842. levelManager.Initialize();
  9843. levelManager.PostInit(this, false, true);
  9844.  
  9845.  
  9846. AddAbility('GeraltSkills_Testing');
  9847. SetAbilityManager();
  9848. abilityManager.Init(this, GetCharacterStats(), false, theGame.GetDifficultyMode());
  9849.  
  9850. SetEffectManager();
  9851.  
  9852. abilityManager.PostInit();
  9853.  
  9854.  
  9855.  
  9856.  
  9857.  
  9858. if(!keepInv)
  9859. {
  9860. inv.RemoveAllItems();
  9861. }
  9862.  
  9863.  
  9864. template = (CEntityTemplate)LoadResource("geralt_inventory_release");
  9865. entity = theGame.CreateEntity(template, Vector(0,0,0));
  9866. invTesting = (CInventoryComponent)entity.GetComponentByClassName('CInventoryComponent');
  9867. invTesting.GiveAllItemsTo(inv, true);
  9868. entity.Destroy();
  9869.  
  9870.  
  9871. inv.GetAllItems(items);
  9872. for(i=0; i<items.Size(); i+=1)
  9873. {
  9874. if(!inv.ItemHasTag(items[i], 'NoDrop'))
  9875. EquipItem(items[i]);
  9876. }
  9877.  
  9878.  
  9879. Debug_GiveTestingItems(0);
  9880. }
  9881.  
  9882. function Debug_BearSetBonusQuenSkills()
  9883. {
  9884. var skills : array<ESkill>;
  9885. var i, slot : int;
  9886.  
  9887. skills.PushBack(S_Magic_s04);
  9888. skills.PushBack(S_Magic_s14);
  9889.  
  9890. for(i=0; i<skills.Size(); i+=1)
  9891. {
  9892.  
  9893. if(GetSkillLevel(skills[i]) == 0)
  9894. {
  9895. AddSkill(skills[i]);
  9896. }
  9897.  
  9898. slot = GetFreeSkillSlot();
  9899.  
  9900.  
  9901. EquipSkill(skills[i], slot);
  9902. }
  9903. }
  9904.  
  9905. final function Debug_HAX_UnlockSkillSlot(slotIndex : int) : bool
  9906. {
  9907. if(abilityManager && abilityManager.IsInitialized())
  9908. return ((W3PlayerAbilityManager)abilityManager).Debug_HAX_UnlockSkillSlot(slotIndex);
  9909.  
  9910. return false;
  9911. }
  9912.  
  9913.  
  9914. public function GetLevelupAbility( id : int) : name
  9915. {
  9916. switch(id)
  9917. {
  9918. case 1: return 'Lvl1';
  9919. case 2: return 'Lvl2';
  9920. case 3: return 'Lvl3';
  9921. case 4: return 'Lvl4';
  9922. case 5: return 'Lvl5';
  9923. case 6: return 'Lvl6';
  9924. case 7: return 'Lvl7';
  9925. case 8: return 'Lvl8';
  9926. case 9: return 'Lvl9';
  9927. case 10: return 'Lvl10';
  9928. case 11: return 'Lvl11';
  9929. case 12: return 'Lvl12';
  9930. case 13: return 'Lvl13';
  9931. case 14: return 'Lvl14';
  9932. case 15: return 'Lvl15';
  9933. case 16: return 'Lvl16';
  9934. case 17: return 'Lvl17';
  9935. case 18: return 'Lvl18';
  9936. case 19: return 'Lvl19';
  9937. case 20: return 'Lvl20';
  9938. case 21: return 'Lvl21';
  9939. case 22: return 'Lvl22';
  9940. case 23: return 'Lvl23';
  9941. case 24: return 'Lvl24';
  9942. case 25: return 'Lvl25';
  9943. case 26: return 'Lvl26';
  9944. case 27: return 'Lvl27';
  9945. case 28: return 'Lvl28';
  9946. case 29: return 'Lvl29';
  9947. case 30: return 'Lvl30';
  9948. case 31: return 'Lvl31';
  9949. case 32: return 'Lvl32';
  9950. case 33: return 'Lvl33';
  9951. case 34: return 'Lvl34';
  9952. case 35: return 'Lvl35';
  9953. case 36: return 'Lvl36';
  9954. case 37: return 'Lvl37';
  9955. case 38: return 'Lvl38';
  9956. case 39: return 'Lvl39';
  9957. case 40: return 'Lvl40';
  9958. case 41: return 'Lvl41';
  9959. case 42: return 'Lvl42';
  9960. case 43: return 'Lvl43';
  9961. case 44: return 'Lvl44';
  9962. case 45: return 'Lvl45';
  9963. case 46: return 'Lvl46';
  9964. case 47: return 'Lvl47';
  9965. case 48: return 'Lvl48';
  9966. case 49: return 'Lvl49';
  9967. case 50: return 'Lvl50';
  9968.  
  9969. default: return '';
  9970. }
  9971.  
  9972. return '';
  9973. }
  9974.  
  9975. public function CanSprint( speed : float ) : bool
  9976. {
  9977. if( !super.CanSprint( speed ) )
  9978. {
  9979. return false;
  9980. }
  9981. if( rangedWeapon && rangedWeapon.GetCurrentStateName() != 'State_WeaponWait' )
  9982. {
  9983. if ( this.GetPlayerCombatStance() == PCS_AlertNear )
  9984. {
  9985. if ( IsSprintActionPressed() )
  9986. OnRangedForceHolster( true, false );
  9987. }
  9988. else
  9989. return false;
  9990. }
  9991. if( GetCurrentStateName() != 'Swimming' && GetStat(BCS_Stamina) <= 0 )
  9992. {
  9993. SetSprintActionPressed(false,true);
  9994. return false;
  9995. }
  9996.  
  9997. return true;
  9998. }
  9999.  
  10000. public function ManageSleeping()
  10001. {
  10002. thePlayer.RemoveBuffImmunity_AllCritical( 'Bed' );
  10003. thePlayer.RemoveBuffImmunity_AllNegative( 'Bed' );
  10004.  
  10005. thePlayer.PlayerStopAction( PEA_GoToSleep );
  10006. }
  10007.  
  10008.  
  10009.  
  10010. public function RestoreHorseManager() : bool
  10011. {
  10012. var horseTemplate : CEntityTemplate;
  10013. var horseManager : W3HorseManager;
  10014.  
  10015. if ( GetHorseManager() )
  10016. {
  10017. return false;
  10018. }
  10019.  
  10020. horseTemplate = (CEntityTemplate)LoadResource("horse_manager");
  10021. horseManager = (W3HorseManager)theGame.CreateEntity(horseTemplate, GetWorldPosition(),,,,,PM_Persist);
  10022. horseManager.CreateAttachment(this);
  10023. horseManager.OnCreated();
  10024. EntityHandleSet( horseManagerHandle, horseManager );
  10025.  
  10026. return true;
  10027. }
  10028.  
  10029.  
  10030.  
  10031.  
  10032.  
  10033.  
  10034. final function PerformParryCheck( parryInfo : SParryInfo ) : bool
  10035. {
  10036. if( super.PerformParryCheck( parryInfo ) )
  10037. {
  10038. GainAdrenalineFromPerk21( 'parry' );
  10039. return true;
  10040. }
  10041. return false;
  10042. }
  10043.  
  10044. protected final function PerformCounterCheck( parryInfo: SParryInfo ) : bool
  10045. {
  10046. var fistFightCheck, isInFistFight : bool;
  10047.  
  10048. if( super.PerformCounterCheck( parryInfo ) )
  10049. {
  10050. GainAdrenalineFromPerk21( 'counter' );
  10051.  
  10052. isInFistFight = FistFightCheck( parryInfo.target, parryInfo.attacker, fistFightCheck );
  10053.  
  10054. if( isInFistFight && fistFightCheck )
  10055. {
  10056. FactsAdd( "statistics_fist_fight_counter" );
  10057. AddTimer( 'FistFightCounterTimer', 0.5f, , , , true );
  10058. }
  10059.  
  10060. return true;
  10061. }
  10062. return false;
  10063. }
  10064.  
  10065. public function GainAdrenalineFromPerk21( n : name )
  10066. {
  10067. var perkStats, perkTime : SAbilityAttributeValue;
  10068. var targets : array<CActor>;
  10069.  
  10070. targets = GetHostileEnemies();
  10071.  
  10072. if( !CanUseSkill( S_Perk_21 ) || targets.Size() == 0 )
  10073. {
  10074. return;
  10075. }
  10076.  
  10077. perkTime = GetSkillAttributeValue( S_Perk_21, 'perk21Time', false, false );
  10078.  
  10079. if( theGame.GetEngineTimeAsSeconds() >= timeForPerk21 + perkTime.valueAdditive )
  10080. {
  10081. perkStats = GetSkillAttributeValue( S_Perk_21, n , false, false );
  10082. GainStat( BCS_Focus, perkStats.valueAdditive );
  10083. timeForPerk21 = theGame.GetEngineTimeAsSeconds();
  10084.  
  10085. AddEffectDefault( EET_Perk21InternalCooldown, this, "Perk21", false );
  10086. }
  10087. }
  10088.  
  10089. timer function FistFightCounterTimer( dt : float, id : int )
  10090. {
  10091. FactsRemove( "statistics_fist_fight_counter" );
  10092. }
  10093.  
  10094. public final function IsSignBlocked(signType : ESignType) : bool
  10095. {
  10096. switch( signType )
  10097. {
  10098. case ST_Aard :
  10099. return IsRadialSlotBlocked ( 'Aard');
  10100. break;
  10101. case ST_Axii :
  10102. return IsRadialSlotBlocked ( 'Axii');
  10103. break;
  10104. case ST_Igni :
  10105. return IsRadialSlotBlocked ( 'Igni');
  10106. break;
  10107. case ST_Quen :
  10108. return IsRadialSlotBlocked ( 'Quen');
  10109. break;
  10110. case ST_Yrden :
  10111. return IsRadialSlotBlocked ( 'Yrden');
  10112. break;
  10113. default:
  10114. break;
  10115. }
  10116. return false;
  10117.  
  10118. }
  10119.  
  10120. public final function AddAnItemWithAutogenLevelAndQuality(itemName : name, desiredLevel : int, minQuality : int, optional equipItem : bool)
  10121. {
  10122. var itemLevel, quality : int;
  10123. var ids : array<SItemUniqueId>;
  10124. var attemptCounter : int;
  10125.  
  10126. itemLevel = 0;
  10127. quality = 0;
  10128. attemptCounter = 0;
  10129. while(itemLevel != desiredLevel || quality < minQuality)
  10130. {
  10131. attemptCounter += 1;
  10132. ids.Clear();
  10133. ids = inv.AddAnItem(itemName, 1, true);
  10134. itemLevel = inv.GetItemLevel(ids[0]);
  10135. quality = RoundMath(CalculateAttributeValue(inv.GetItemAttributeValue(ids[0], 'quality')));
  10136.  
  10137.  
  10138. if(attemptCounter >= 1000)
  10139. break;
  10140.  
  10141. if(itemLevel != desiredLevel || quality < minQuality)
  10142. inv.RemoveItem(ids[0]);
  10143. }
  10144.  
  10145. if(equipItem)
  10146. EquipItem(ids[0]);
  10147. }
  10148.  
  10149. public final function AddAnItemWithAutogenLevel(itemName : name, desiredLevel : int)
  10150. {
  10151. var itemLevel : int;
  10152. var ids : array<SItemUniqueId>;
  10153. var attemptCounter : int;
  10154.  
  10155. itemLevel = 0;
  10156. while(itemLevel != desiredLevel)
  10157. {
  10158. attemptCounter += 1;
  10159. ids.Clear();
  10160. ids = inv.AddAnItem(itemName, 1, true);
  10161. itemLevel = inv.GetItemLevel(ids[0]);
  10162.  
  10163.  
  10164. if(attemptCounter >= 1000)
  10165. break;
  10166.  
  10167. if(itemLevel != desiredLevel)
  10168. inv.RemoveItem(ids[0]);
  10169. }
  10170. }
  10171.  
  10172. public final function AddAnItemWithMinQuality(itemName : name, minQuality : int, optional equip : bool)
  10173. {
  10174. var quality : int;
  10175. var ids : array<SItemUniqueId>;
  10176. var attemptCounter : int;
  10177.  
  10178. quality = 0;
  10179. while(quality < minQuality)
  10180. {
  10181. attemptCounter += 1;
  10182. ids.Clear();
  10183. ids = inv.AddAnItem(itemName, 1, true);
  10184. quality = RoundMath(CalculateAttributeValue(inv.GetItemAttributeValue(ids[0], 'quality')));
  10185.  
  10186.  
  10187. if(attemptCounter >= 1000)
  10188. break;
  10189.  
  10190. if(quality < minQuality)
  10191. inv.RemoveItem(ids[0]);
  10192. }
  10193.  
  10194. if(equip)
  10195. EquipItem(ids[0]);
  10196. }
  10197.  
  10198.  
  10199.  
  10200.  
  10201.  
  10202.  
  10203. public function IsSetBonusActive( bonus : EItemSetBonus ) : bool
  10204. {
  10205. switch(bonus)
  10206. {
  10207. case EISB_Lynx_1: return amountOfSetPiecesEquipped[ EIST_Lynx ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  10208. case EISB_Lynx_2: return amountOfSetPiecesEquipped[ EIST_Lynx ] >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS;
  10209. case EISB_Gryphon_1: return amountOfSetPiecesEquipped[ EIST_Gryphon ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  10210. case EISB_Gryphon_2: return amountOfSetPiecesEquipped[ EIST_Gryphon ] >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS;
  10211. case EISB_Bear_1: return amountOfSetPiecesEquipped[ EIST_Bear ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  10212. case EISB_Bear_2: return amountOfSetPiecesEquipped[ EIST_Bear ] >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS;
  10213. case EISB_Wolf_1: return amountOfSetPiecesEquipped[ EIST_Wolf ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  10214. case EISB_Wolf_2: return amountOfSetPiecesEquipped[ EIST_Wolf ] >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS;
  10215. case EISB_RedWolf_1: return amountOfSetPiecesEquipped[ EIST_RedWolf ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  10216. case EISB_RedWolf_2: return amountOfSetPiecesEquipped[ EIST_RedWolf ] >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS;
  10217. case EISB_Vampire: return amountOfSetPiecesEquipped[ EIST_Vampire ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  10218. case EISB_Netflix_1: return amountOfSetPiecesEquipped[ EIST_Netflix ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  10219. case EISB_Netflix_2: return amountOfSetPiecesEquipped[ EIST_Netflix ] >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS;
  10220. default: return false;
  10221. }
  10222. }
  10223.  
  10224. public function GetSetPartsEquipped( setType : EItemSetType ) : int
  10225. {
  10226. return amountOfSetPiecesEquipped[ setType ];
  10227. }
  10228.  
  10229. protected function UpdateItemSetBonuses( item : SItemUniqueId, increment : bool )
  10230. {
  10231. var setType : EItemSetType;
  10232. var tutorialStateSets : W3TutorialManagerUIHandlerStateSetItemsUnlocked;
  10233. var id : SItemUniqueId;
  10234.  
  10235. if( !inv.IsIdValid( item ) || !inv.ItemHasTag(item, theGame.params.ITEM_SET_TAG_BONUS ) )
  10236. {
  10237.  
  10238.  
  10239.  
  10240.  
  10241. return;
  10242. }
  10243.  
  10244. setType = CheckSetType( item );
  10245.  
  10246. if( increment )
  10247. {
  10248. amountOfSetPiecesEquipped[ setType ] += 1;
  10249.  
  10250. if( amountOfSetPiecesEquipped[ setType ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS && ShouldProcessTutorial( 'TutorialSetBonusesUnlocked' ) && theGame.GetTutorialSystem().uiHandler && theGame.GetTutorialSystem().uiHandler.GetCurrentStateName() == 'SetItemsUnlocked' )
  10251. {
  10252. tutorialStateSets = ( W3TutorialManagerUIHandlerStateSetItemsUnlocked )theGame.GetTutorialSystem().uiHandler.GetCurrentState();
  10253. tutorialStateSets.OnSetBonusCompleted();
  10254. }
  10255. }
  10256. else if( amountOfSetPiecesEquipped[ setType ] > 0 )
  10257. {
  10258. amountOfSetPiecesEquipped[ setType ] -= 1;
  10259. }
  10260.  
  10261.  
  10262. if( setType != EIST_Vampire )
  10263. {
  10264. if(amountOfSetPiecesEquipped[ setType ] == theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS)
  10265. {
  10266. theGame.GetGamerProfile().AddAchievement( EA_ReadyToRoll );
  10267. }
  10268. else
  10269. {
  10270. theGame.GetGamerProfile().NoticeAchievementProgress( EA_ReadyToRoll, amountOfSetPiecesEquipped[ setType ]);
  10271. }
  10272. }
  10273.  
  10274.  
  10275.  
  10276.  
  10277.  
  10278.  
  10279. ManageActiveSetBonuses( setType );
  10280.  
  10281.  
  10282. ManageSetBonusesSoundbanks( setType );
  10283. }
  10284.  
  10285. public function ManageActiveSetBonuses( setType : EItemSetType )
  10286. {
  10287. var l_i : int;
  10288.  
  10289.  
  10290. if( setType == EIST_Lynx )
  10291. {
  10292.  
  10293. if( HasBuff( EET_LynxSetBonus ) && !IsSetBonusActive( EISB_Lynx_1 ) )
  10294. {
  10295. RemoveBuff( EET_LynxSetBonus );
  10296. }
  10297. }
  10298.  
  10299. else if( setType == EIST_Gryphon )
  10300. {
  10301.  
  10302. if( !IsSetBonusActive( EISB_Gryphon_1 ) )
  10303. {
  10304. RemoveBuff( EET_GryphonSetBonus );
  10305. }
  10306.  
  10307. if( IsSetBonusActive( EISB_Gryphon_2 ) && !HasBuff( EET_GryphonSetBonusYrden ) )
  10308. {
  10309. for( l_i = 0 ; l_i < yrdenEntities.Size() ; l_i += 1 )
  10310. {
  10311. if( yrdenEntities[ l_i ].GetIsPlayerInside() && !yrdenEntities[ l_i ].IsAlternateCast() )
  10312. {
  10313. AddEffectDefault( EET_GryphonSetBonusYrden, this, "GryphonSetBonusYrden" );
  10314. break;
  10315. }
  10316. }
  10317. }
  10318. else
  10319. {
  10320. RemoveBuff( EET_GryphonSetBonusYrden );
  10321. }
  10322. }
  10323. }
  10324.  
  10325. public function CheckSetTypeByName( itemName : name ) : EItemSetType
  10326. {
  10327. var dm : CDefinitionsManagerAccessor;
  10328.  
  10329. dm = theGame.GetDefinitionsManager();
  10330.  
  10331. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_LYNX ) )
  10332. {
  10333. return EIST_Lynx;
  10334. }
  10335. else
  10336. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_GRYPHON ) )
  10337. {
  10338. return EIST_Gryphon;
  10339. }
  10340. else
  10341. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_BEAR ) )
  10342. {
  10343. return EIST_Bear;
  10344. }
  10345. else
  10346. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_WOLF ) )
  10347. {
  10348. return EIST_Wolf;
  10349. }
  10350. else
  10351. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_RED_WOLF ) )
  10352. {
  10353. return EIST_RedWolf;
  10354. }
  10355. else
  10356. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_VAMPIRE ) )
  10357. {
  10358. return EIST_Vampire;
  10359. }
  10360. else
  10361. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_VIPER ) )
  10362. {
  10363. return EIST_Viper;
  10364. }
  10365. else
  10366. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_NETFLIX ) )
  10367. {
  10368. return EIST_Netflix;
  10369. }
  10370. else
  10371. {
  10372. return EIST_Undefined;
  10373. }
  10374. }
  10375.  
  10376. public function CheckSetType( item : SItemUniqueId ) : EItemSetType
  10377. {
  10378. var stopLoop : bool;
  10379. var tags : array<name>;
  10380. var i : int;
  10381. var setType : EItemSetType;
  10382.  
  10383. stopLoop = false;
  10384.  
  10385. inv.GetItemTags( item, tags );
  10386.  
  10387.  
  10388. for( i=0; i<tags.Size(); i+=1 )
  10389. {
  10390. switch( tags[i] )
  10391. {
  10392. case theGame.params.ITEM_SET_TAG_LYNX:
  10393. case theGame.params.ITEM_SET_TAG_GRYPHON:
  10394. case theGame.params.ITEM_SET_TAG_BEAR:
  10395. case theGame.params.ITEM_SET_TAG_WOLF:
  10396. case theGame.params.ITEM_SET_TAG_RED_WOLF:
  10397. case theGame.params.ITEM_SET_TAG_VAMPIRE:
  10398. case theGame.params.ITEM_SET_TAG_VIPER:
  10399. case theGame.params.ITEM_SET_TAG_NETFLIX:
  10400. setType = SetItemNameToType( tags[i] );
  10401. stopLoop = true;
  10402. break;
  10403. }
  10404. if ( stopLoop )
  10405. {
  10406. break;
  10407. }
  10408. }
  10409.  
  10410. return setType;
  10411. }
  10412.  
  10413. public function GetSetBonusStatusByName( itemName : name, out desc1, desc2 : string, out isActive1, isActive2 : bool ) : EItemSetType
  10414. {
  10415. var setType : EItemSetType;
  10416.  
  10417. if( theGame.GetDLCManager().IsEP2Enabled() )
  10418. {
  10419. setType = CheckSetTypeByName( itemName );
  10420. SetBonusStatusByType( setType, desc1, desc2, isActive1, isActive2 );
  10421.  
  10422. return setType;
  10423. }
  10424. else
  10425. {
  10426. return EIST_Undefined;
  10427. }
  10428. }
  10429.  
  10430. public function GetSetBonusStatus( item : SItemUniqueId, out desc1, desc2 : string, out isActive1, isActive2 : bool ) : EItemSetType
  10431. {
  10432. var setType : EItemSetType;
  10433.  
  10434. if( theGame.GetDLCManager().IsEP2Enabled() )
  10435. {
  10436. setType = CheckSetType( item );
  10437. SetBonusStatusByType( setType, desc1, desc2, isActive1, isActive2 );
  10438.  
  10439. return setType;
  10440. }
  10441. else
  10442. {
  10443. return EIST_Undefined;
  10444. }
  10445. }
  10446.  
  10447. private function SetBonusStatusByType(setType : EItemSetType, out desc1, desc2 : string, out isActive1, isActive2 : bool):void
  10448. {
  10449. var setBonus : EItemSetBonus;
  10450.  
  10451. if( amountOfSetPiecesEquipped[ setType ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS )
  10452. {
  10453. isActive1 = true;
  10454. }
  10455.  
  10456. if( amountOfSetPiecesEquipped[ setType ] >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS )
  10457. {
  10458. isActive2 = true;
  10459. }
  10460.  
  10461. setBonus = ItemSetTypeToItemSetBonus( setType, 1 );
  10462. desc1 = GetSetBonusTooltipDescription( setBonus );
  10463.  
  10464. setBonus = ItemSetTypeToItemSetBonus( setType, 2 );
  10465. desc2 = GetSetBonusTooltipDescription( setBonus );
  10466. }
  10467.  
  10468. public function ItemSetTypeToItemSetBonus( setType : EItemSetType, nr : int ) : EItemSetBonus
  10469. {
  10470. var setBonus : EItemSetBonus;
  10471.  
  10472. if( nr == 1 )
  10473. {
  10474. switch( setType )
  10475. {
  10476. case EIST_Lynx: setBonus = EISB_Lynx_1; break;
  10477. case EIST_Gryphon: setBonus = EISB_Gryphon_1; break;
  10478. case EIST_Bear: setBonus = EISB_Bear_1; break;
  10479. case EIST_Wolf: setBonus = EISB_Wolf_1; break;
  10480. case EIST_RedWolf: setBonus = EISB_RedWolf_1; break;
  10481. case EIST_Vampire: setBonus = EISB_Vampire; break;
  10482. case EIST_Netflix: setBonus = EISB_Netflix_1; break;
  10483. }
  10484. }
  10485. else
  10486. {
  10487. switch( setType )
  10488. {
  10489. case EIST_Lynx: setBonus = EISB_Lynx_2; break;
  10490. case EIST_Gryphon: setBonus = EISB_Gryphon_2; break;
  10491. case EIST_Bear: setBonus = EISB_Bear_2; break;
  10492. case EIST_Wolf: setBonus = EISB_Wolf_2; break;
  10493. case EIST_RedWolf: setBonus = EISB_RedWolf_2; break;
  10494. case EIST_Vampire: setBonus = EISB_Undefined; break;
  10495. case EIST_Netflix: setBonus = EISB_Netflix_2; break;
  10496. }
  10497. }
  10498.  
  10499. return setBonus;
  10500. }
  10501.  
  10502. public function GetSetBonusTooltipDescription( bonus : EItemSetBonus ) : string
  10503. {
  10504. var finalString : string;
  10505. var arrString : array<string>;
  10506. var dm : CDefinitionsManagerAccessor;
  10507. var min, max : SAbilityAttributeValue;
  10508. var tempString : string;
  10509.  
  10510. switch( bonus )
  10511. {
  10512. case EISB_Lynx_1: tempString = "skill_desc_lynx_set_ability1"; break;
  10513. case EISB_Lynx_2: tempString = "skill_desc_lynx_set_ability2"; break;
  10514. case EISB_Gryphon_1: tempString = "skill_desc_gryphon_set_ability1"; break;
  10515. case EISB_Gryphon_2: tempString = "skill_desc_gryphon_set_ability2"; break;
  10516. case EISB_Bear_1: tempString = "skill_desc_bear_set_ability1"; break;
  10517. case EISB_Bear_2: tempString = "skill_desc_bear_set_ability2"; break;
  10518. case EISB_Wolf_1: tempString = "skill_desc_wolf_set_ability2"; break;
  10519. case EISB_Wolf_2: tempString = "skill_desc_wolf_set_ability1"; break;
  10520. case EISB_RedWolf_1: tempString = "skill_desc_red_wolf_set_ability1"; break;
  10521. case EISB_RedWolf_2: tempString = "skill_desc_red_wolf_set_ability2"; break;
  10522. case EISB_Vampire: tempString = "skill_desc_vampire_set_ability1"; break;
  10523. case EISB_Netflix_1: tempString = "skill_desc_netflix_set_ability1"; break;
  10524. case EISB_Netflix_2: tempString = "skill_desc_netflix_set_ability2"; break;
  10525. default: tempString = ""; break;
  10526. }
  10527.  
  10528. dm = theGame.GetDefinitionsManager();
  10529.  
  10530. switch( bonus )
  10531. {
  10532. case EISB_Lynx_1:
  10533. dm.GetAbilityAttributeValue( 'LynxSetBonusEffect', 'duration', min, max );
  10534. arrString.PushBack( FloatToString( min.valueAdditive ) );
  10535. dm.GetAbilityAttributeValue( 'LynxSetBonusEffect', 'lynx_dmg_boost', min, max );
  10536. arrString.PushBack( FloatToString( min.valueAdditive * 100 ) );
  10537. arrString.PushBack( FloatToString( min.valueAdditive * 100 * amountOfSetPiecesEquipped[ EIST_Lynx ] ) );
  10538. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  10539. break;
  10540. case EISB_Lynx_2:
  10541. dm.GetAbilityAttributeValue( GetSetBonusAbility( EISB_Lynx_2 ), 'lynx_2_dmg_boost', min, max );
  10542. arrString.PushBack( FloatToString( min.valueAdditive * 100 ) );
  10543.  
  10544. dm.GetAbilityAttributeValue( GetSetBonusAbility( EISB_Lynx_2 ), 'lynx_2_adrenaline_cost', min, max );
  10545. arrString.PushBack( FloatToString( min.valueAdditive ) );
  10546.  
  10547. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  10548. break;
  10549. case EISB_Gryphon_1:
  10550. dm.GetAbilityAttributeValue( 'GryphonSetBonusEffect', 'duration', min, max );
  10551. arrString.PushBack( FloatToString( min.valueAdditive ) );
  10552. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  10553. break;
  10554. case EISB_Gryphon_2:
  10555. dm.GetAbilityAttributeValue( 'GryphonSetBonusYrdenEffect', 'trigger_scale', min, max );
  10556. arrString.PushBack( FloatToString( ( min.valueAdditive - 1 )* 100) );
  10557. dm.GetAbilityAttributeValue( 'GryphonSetBonusYrdenEffect', 'staminaRegen', min, max );
  10558. arrString.PushBack( FloatToString( min.valueMultiplicative * 100) );
  10559. dm.GetAbilityAttributeValue( 'GryphonSetBonusYrdenEffect', 'spell_power', min, max );
  10560. arrString.PushBack( FloatToString( min.valueMultiplicative * 100) );
  10561. dm.GetAbilityAttributeValue( 'GryphonSetBonusYrdenEffect', 'gryphon_set_bns_dmg_reduction', min, max );
  10562. arrString.PushBack( FloatToString( min.valueAdditive * 100) );
  10563. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  10564. break;
  10565. case EISB_Bear_1:
  10566. dm.GetAbilityAttributeValue( 'setBonusAbilityBear_1', 'quen_reapply_chance', min, max );
  10567. arrString.PushBack( FloatToString( min.valueMultiplicative * 100 ) );
  10568.  
  10569. arrString.PushBack( FloatToString( min.valueMultiplicative * 100 * amountOfSetPiecesEquipped[ EIST_Bear ] ) );
  10570. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  10571. break;
  10572. case EISB_Bear_2:
  10573. dm.GetAbilityAttributeValue( 'setBonusAbilityBear_2', 'quen_dmg_boost', min, max );
  10574. arrString.PushBack( FloatToString( min.valueMultiplicative * 100 ) );
  10575. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  10576. break;
  10577. case EISB_RedWolf_2:
  10578. dm.GetAbilityAttributeValue( 'setBonusAbilityRedWolf_2', 'amount', min, max );
  10579. arrString.PushBack( FloatToString( min.valueAdditive ) );
  10580. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  10581. break;
  10582. case EISB_Vampire:
  10583. dm.GetAbilityAttributeValue( 'setBonusAbilityVampire', 'life_percent', min, max );
  10584. arrString.PushBack( FloatToString( min.valueAdditive ) );
  10585. arrString.PushBack( FloatToString( min.valueAdditive * amountOfSetPiecesEquipped[ EIST_Vampire ] ) );
  10586. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  10587. break;
  10588.  
  10589. case EISB_Wolf_1:
  10590. arrString.PushBack( FloatToString( 1 * amountOfSetPiecesEquipped[ EIST_Wolf ] ) );
  10591. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  10592. break;
  10593.  
  10594. default:
  10595. finalString = GetLocStringByKeyExtWithParams( tempString );
  10596. }
  10597.  
  10598. return finalString;
  10599. }
  10600.  
  10601. public function ManageSetBonusesSoundbanks( setType : EItemSetType )
  10602. {
  10603. if( amountOfSetPiecesEquipped[ setType ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS )
  10604. {
  10605. switch( setType )
  10606. {
  10607. case EIST_Lynx:
  10608. LoadSetBonusSoundBank( "ep2_setbonus_lynx.bnk" );
  10609. break;
  10610. case EIST_Gryphon:
  10611. LoadSetBonusSoundBank( "ep2_setbonus_gryphon.bnk" );
  10612. break;
  10613. case EIST_Bear:
  10614. LoadSetBonusSoundBank( "ep2_setbonus_bear.bnk" );
  10615. break;
  10616. }
  10617. }
  10618. else
  10619. {
  10620. switch( setType )
  10621. {
  10622. case EIST_Lynx:
  10623. UnloadSetBonusSoundBank( "ep2_setbonus_lynx.bnk" );
  10624. break;
  10625. case EIST_Gryphon:
  10626. UnloadSetBonusSoundBank( "ep2_setbonus_gryphon.bnk" );
  10627. break;
  10628. case EIST_Bear:
  10629. UnloadSetBonusSoundBank( "ep2_setbonus_bear.bnk" );
  10630. break;
  10631. }
  10632. }
  10633. }
  10634.  
  10635. public function VampiricSetAbilityRegeneration()
  10636. {
  10637. var healthMax : float;
  10638. var healthToReg : float;
  10639.  
  10640. healthMax = GetStatMax( BCS_Vitality );
  10641.  
  10642. healthToReg = ( amountOfSetPiecesEquipped[ EIST_Vampire ] * healthMax ) / 100;
  10643.  
  10644. PlayEffect('drain_energy_caretaker_shovel');
  10645. GainStat( BCS_Vitality, healthToReg );
  10646. }
  10647.  
  10648. private function LoadSetBonusSoundBank( bankName : string )
  10649. {
  10650. if( !theSound.SoundIsBankLoaded( bankName ) )
  10651. {
  10652. theSound.SoundLoadBank( bankName, true );
  10653. }
  10654. }
  10655.  
  10656. private function UnloadSetBonusSoundBank( bankName : string )
  10657. {
  10658. if( theSound.SoundIsBankLoaded( bankName ) )
  10659. {
  10660. theSound.SoundUnloadBank( bankName );
  10661. }
  10662. }
  10663.  
  10664. timer function BearSetBonusQuenReapply( dt : float, id : int )
  10665. {
  10666. var newQuen : W3QuenEntity;
  10667.  
  10668. newQuen = (W3QuenEntity)theGame.CreateEntity( GetSignTemplate( ST_Quen ), GetWorldPosition(), GetWorldRotation() );
  10669. newQuen.Init( signOwner, GetSignEntity( ST_Quen ), true );
  10670. newQuen.freeFromBearSetBonus = true;
  10671. newQuen.OnStarted();
  10672. newQuen.OnThrowing();
  10673. newQuen.OnEnded();
  10674.  
  10675. m_quenReappliedCount += 1;
  10676.  
  10677. RemoveTimer( 'BearSetBonusQuenReapply');
  10678. }
  10679.  
  10680. public final function StandaloneEp1_1()
  10681. {
  10682. var i, inc, quantityLow, randLow, quantityMedium, randMedium, quantityHigh, randHigh, startingMoney : int;
  10683. var pam : W3PlayerAbilityManager;
  10684. var ids : array<SItemUniqueId>;
  10685. var STARTING_LEVEL : int;
  10686.  
  10687. FactsAdd("StandAloneEP1", 1);
  10688.  
  10689.  
  10690. inv.RemoveAllItems();
  10691.  
  10692.  
  10693. inv.AddAnItem('Illusion Medallion', 1, true, true, false);
  10694. inv.AddAnItem('q103_safe_conduct', 1, true, true, false);
  10695.  
  10696.  
  10697. theGame.GetGamerProfile().ClearAllAchievementsForEP1();
  10698.  
  10699.  
  10700. STARTING_LEVEL = 32;
  10701. inc = STARTING_LEVEL - GetLevel();
  10702. for(i=0; i<inc; i+=1)
  10703. {
  10704. levelManager.AddPoints(EExperiencePoint, levelManager.GetTotalExpForNextLevel() - levelManager.GetPointsTotal(EExperiencePoint), false);
  10705. }
  10706.  
  10707.  
  10708. levelManager.ResetCharacterDev();
  10709. pam = (W3PlayerAbilityManager)abilityManager;
  10710. if(pam)
  10711. {
  10712. pam.ResetCharacterDev();
  10713. }
  10714. levelManager.SetFreeSkillPoints(levelManager.GetLevel() - 1 + 11);
  10715.  
  10716.  
  10717. inv.AddAnItem('Mutagen red', 4);
  10718. inv.AddAnItem('Mutagen green', 4);
  10719. inv.AddAnItem('Mutagen blue', 4);
  10720. inv.AddAnItem('Lesser mutagen red', 2);
  10721. inv.AddAnItem('Lesser mutagen green', 2);
  10722. inv.AddAnItem('Lesser mutagen blue', 2);
  10723. inv.AddAnItem('Greater mutagen green', 1);
  10724. inv.AddAnItem('Greater mutagen blue', 2);
  10725.  
  10726.  
  10727. startingMoney = 40000;
  10728. if(GetMoney() > startingMoney)
  10729. {
  10730. RemoveMoney(GetMoney() - startingMoney);
  10731. }
  10732. else
  10733. {
  10734. AddMoney( 40000 - GetMoney() );
  10735. }
  10736.  
  10737.  
  10738.  
  10739.  
  10740.  
  10741. ids.Clear();
  10742. ids = inv.AddAnItem('EP1 Standalone Starting Armor');
  10743. EquipItem(ids[0]);
  10744. ids.Clear();
  10745. ids = inv.AddAnItem('EP1 Standalone Starting Boots');
  10746. EquipItem(ids[0]);
  10747. ids.Clear();
  10748. ids = inv.AddAnItem('EP1 Standalone Starting Gloves');
  10749. EquipItem(ids[0]);
  10750. ids.Clear();
  10751. ids = inv.AddAnItem('EP1 Standalone Starting Pants');
  10752. EquipItem(ids[0]);
  10753.  
  10754.  
  10755. ids.Clear();
  10756. ids = inv.AddAnItem('EP1 Standalone Starting Steel Sword');
  10757. EquipItem(ids[0]);
  10758. ids.Clear();
  10759. ids = inv.AddAnItem('EP1 Standalone Starting Silver Sword');
  10760. EquipItem(ids[0]);
  10761.  
  10762.  
  10763. inv.AddAnItem('Torch', 1, true, true, false);
  10764.  
  10765.  
  10766. quantityLow = 1;
  10767. randLow = 3;
  10768. quantityMedium = 4;
  10769. randMedium = 4;
  10770. quantityHigh = 8;
  10771. randHigh = 6;
  10772.  
  10773. inv.AddAnItem('Alghoul bone marrow',quantityMedium+RandRange(randMedium));
  10774. inv.AddAnItem('Amethyst dust',quantityLow+RandRange(randLow));
  10775. inv.AddAnItem('Arachas eyes',quantityLow+RandRange(randLow));
  10776. inv.AddAnItem('Arachas venom',quantityLow+RandRange(randLow));
  10777. inv.AddAnItem('Basilisk hide',quantityLow+RandRange(randLow));
  10778. inv.AddAnItem('Basilisk venom',quantityLow+RandRange(randLow));
  10779. inv.AddAnItem('Bear pelt',quantityHigh+RandRange(randHigh));
  10780. inv.AddAnItem('Berserker pelt',quantityLow+RandRange(randLow));
  10781. inv.AddAnItem('Coal',quantityHigh+RandRange(randHigh));
  10782. inv.AddAnItem('Cotton',quantityHigh+RandRange(randHigh));
  10783. inv.AddAnItem('Dark iron ingot',quantityLow+RandRange(randLow));
  10784. inv.AddAnItem('Dark iron ore',quantityLow+RandRange(randLow));
  10785. inv.AddAnItem('Deer hide',quantityHigh+RandRange(randHigh));
  10786. inv.AddAnItem('Diamond dust',quantityLow+RandRange(randLow));
  10787. inv.AddAnItem('Draconide leather',quantityLow+RandRange(randLow));
  10788. inv.AddAnItem('Drowned dead tongue',quantityLow+RandRange(randLow));
  10789. inv.AddAnItem('Drowner brain',quantityMedium+RandRange(randMedium));
  10790. inv.AddAnItem('Dwimeryte ingot',quantityLow+RandRange(randLow));
  10791. inv.AddAnItem('Dwimeryte ore',quantityLow+RandRange(randLow));
  10792. inv.AddAnItem('Emerald dust',quantityLow+RandRange(randLow));
  10793. inv.AddAnItem('Endriag chitin plates',quantityMedium+RandRange(randMedium));
  10794. inv.AddAnItem('Endriag embryo',quantityLow+RandRange(randLow));
  10795. inv.AddAnItem('Ghoul blood',quantityMedium+RandRange(randMedium));
  10796. inv.AddAnItem('Goat hide',quantityMedium+RandRange(randMedium));
  10797. inv.AddAnItem('Hag teeth',quantityMedium+RandRange(randMedium));
  10798. inv.AddAnItem('Hardened leather',quantityMedium+RandRange(randMedium));
  10799. inv.AddAnItem('Hardened timber',quantityMedium+RandRange(randMedium));
  10800. inv.AddAnItem('Harpy feathers',quantityMedium+RandRange(randMedium));
  10801. inv.AddAnItem('Horse hide',quantityLow+RandRange(randLow));
  10802. inv.AddAnItem('Iron ore',quantityHigh+RandRange(randHigh));
  10803. inv.AddAnItem('Leather straps',quantityHigh+RandRange(randHigh));
  10804. inv.AddAnItem('Leather',quantityHigh+RandRange(randHigh));
  10805. inv.AddAnItem('Linen',quantityMedium+RandRange(randMedium));
  10806. inv.AddAnItem('Meteorite ingot',quantityLow+RandRange(randLow));
  10807. inv.AddAnItem('Meteorite ore',quantityMedium+RandRange(randMedium));
  10808. inv.AddAnItem('Necrophage skin',quantityLow+RandRange(randLow));
  10809. inv.AddAnItem('Nekker blood',quantityHigh+RandRange(randHigh));
  10810. inv.AddAnItem('Nekker heart',quantityMedium+RandRange(randMedium));
  10811. inv.AddAnItem('Oil',quantityHigh+RandRange(randHigh));
  10812. inv.AddAnItem('Phosphorescent crystal',quantityLow+RandRange(randLow));
  10813. inv.AddAnItem('Pig hide',quantityMedium+RandRange(randMedium));
  10814. inv.AddAnItem('Pure silver',quantityMedium+RandRange(randMedium));
  10815. inv.AddAnItem('Rabbit pelt',quantityMedium+RandRange(randMedium));
  10816. inv.AddAnItem('Rotfiend blood',quantityMedium+RandRange(randMedium));
  10817. inv.AddAnItem('Sapphire dust',quantityLow+RandRange(randLow));
  10818. inv.AddAnItem('Silk',quantityHigh+RandRange(randHigh));
  10819. inv.AddAnItem('Silver ingot',quantityMedium+RandRange(randMedium));
  10820. inv.AddAnItem('Silver ore',quantityHigh+RandRange(randHigh));
  10821. inv.AddAnItem('Specter dust',quantityMedium+RandRange(randMedium));
  10822. inv.AddAnItem('Steel ingot',quantityHigh+RandRange(randHigh));
  10823. inv.AddAnItem('Steel plate',quantityHigh+RandRange(randHigh));
  10824. inv.AddAnItem('String',quantityHigh+RandRange(randHigh));
  10825. inv.AddAnItem('Thread',quantityHigh+RandRange(randHigh));
  10826. inv.AddAnItem('Timber',quantityHigh+RandRange(randHigh));
  10827. inv.AddAnItem('Twine',quantityMedium+RandRange(randMedium));
  10828. inv.AddAnItem('Venom extract',quantityMedium+RandRange(randMedium));
  10829. inv.AddAnItem('Water essence',quantityMedium+RandRange(randMedium));
  10830. inv.AddAnItem('Wolf liver',quantityHigh+RandRange(randHigh));
  10831. inv.AddAnItem('Wolf pelt',quantityMedium+RandRange(randMedium));
  10832.  
  10833. inv.AddAnItem('Alcohest', 5);
  10834. inv.AddAnItem('Dwarven spirit', 5);
  10835.  
  10836.  
  10837. ids.Clear();
  10838. ids = inv.AddAnItem('Crossbow 5');
  10839. EquipItem(ids[0]);
  10840. ids.Clear();
  10841. ids = inv.AddAnItem('Blunt Bolt', 100);
  10842. EquipItem(ids[0]);
  10843. inv.AddAnItem('Broadhead Bolt', 100);
  10844. inv.AddAnItem('Split Bolt', 100);
  10845.  
  10846.  
  10847. RemoveAllAlchemyRecipes();
  10848. RemoveAllCraftingSchematics();
  10849.  
  10850.  
  10851.  
  10852.  
  10853. AddAlchemyRecipe('Recipe for Cat 1');
  10854.  
  10855.  
  10856.  
  10857. AddAlchemyRecipe('Recipe for Maribor Forest 1');
  10858. AddAlchemyRecipe('Recipe for Petris Philtre 1');
  10859. AddAlchemyRecipe('Recipe for Swallow 1');
  10860. AddAlchemyRecipe('Recipe for Tawny Owl 1');
  10861.  
  10862. AddAlchemyRecipe('Recipe for White Gull 1');
  10863. AddAlchemyRecipe('Recipe for White Honey 1');
  10864. AddAlchemyRecipe('Recipe for White Raffards Decoction 1');
  10865.  
  10866.  
  10867.  
  10868. AddAlchemyRecipe('Recipe for Beast Oil 1');
  10869. AddAlchemyRecipe('Recipe for Cursed Oil 1');
  10870. AddAlchemyRecipe('Recipe for Hanged Man Venom 1');
  10871. AddAlchemyRecipe('Recipe for Hybrid Oil 1');
  10872. AddAlchemyRecipe('Recipe for Insectoid Oil 1');
  10873. AddAlchemyRecipe('Recipe for Magicals Oil 1');
  10874. AddAlchemyRecipe('Recipe for Necrophage Oil 1');
  10875. AddAlchemyRecipe('Recipe for Specter Oil 1');
  10876. AddAlchemyRecipe('Recipe for Vampire Oil 1');
  10877. AddAlchemyRecipe('Recipe for Draconide Oil 1');
  10878. AddAlchemyRecipe('Recipe for Ogre Oil 1');
  10879. AddAlchemyRecipe('Recipe for Relic Oil 1');
  10880. AddAlchemyRecipe('Recipe for Beast Oil 2');
  10881. AddAlchemyRecipe('Recipe for Cursed Oil 2');
  10882. AddAlchemyRecipe('Recipe for Hanged Man Venom 2');
  10883. AddAlchemyRecipe('Recipe for Hybrid Oil 2');
  10884. AddAlchemyRecipe('Recipe for Insectoid Oil 2');
  10885. AddAlchemyRecipe('Recipe for Magicals Oil 2');
  10886. AddAlchemyRecipe('Recipe for Necrophage Oil 2');
  10887. AddAlchemyRecipe('Recipe for Specter Oil 2');
  10888. AddAlchemyRecipe('Recipe for Vampire Oil 2');
  10889. AddAlchemyRecipe('Recipe for Draconide Oil 2');
  10890. AddAlchemyRecipe('Recipe for Ogre Oil 2');
  10891. AddAlchemyRecipe('Recipe for Relic Oil 2');
  10892.  
  10893.  
  10894. AddAlchemyRecipe('Recipe for Dancing Star 1');
  10895.  
  10896. AddAlchemyRecipe('Recipe for Dwimeritum Bomb 1');
  10897.  
  10898. AddAlchemyRecipe('Recipe for Grapeshot 1');
  10899. AddAlchemyRecipe('Recipe for Samum 1');
  10900.  
  10901. AddAlchemyRecipe('Recipe for White Frost 1');
  10902.  
  10903.  
  10904.  
  10905. AddAlchemyRecipe('Recipe for Dwarven spirit 1');
  10906. AddAlchemyRecipe('Recipe for Alcohest 1');
  10907. AddAlchemyRecipe('Recipe for White Gull 1');
  10908.  
  10909.  
  10910. AddStartingSchematics();
  10911.  
  10912.  
  10913. ids.Clear();
  10914. ids = inv.AddAnItem('Swallow 2');
  10915. EquipItem(ids[0]);
  10916. ids.Clear();
  10917. ids = inv.AddAnItem('Thunderbolt 2');
  10918. EquipItem(ids[0]);
  10919. ids.Clear();
  10920. ids = inv.AddAnItem('Tawny Owl 2');
  10921. EquipItem(ids[0]);
  10922. ids.Clear();
  10923.  
  10924. ids = inv.AddAnItem('Grapeshot 2');
  10925. EquipItem(ids[0]);
  10926. ids.Clear();
  10927. ids = inv.AddAnItem('Samum 2');
  10928. EquipItem(ids[0]);
  10929.  
  10930. inv.AddAnItem('Dwimeritum Bomb 1');
  10931. inv.AddAnItem('Dragons Dream 1');
  10932. inv.AddAnItem('Silver Dust Bomb 1');
  10933. inv.AddAnItem('White Frost 2');
  10934. inv.AddAnItem('Devils Puffball 2');
  10935. inv.AddAnItem('Dancing Star 2');
  10936. inv.AddAnItem('Beast Oil 1');
  10937. inv.AddAnItem('Cursed Oil 1');
  10938. inv.AddAnItem('Hanged Man Venom 2');
  10939. inv.AddAnItem('Hybrid Oil 1');
  10940. inv.AddAnItem('Insectoid Oil 1');
  10941. inv.AddAnItem('Magicals Oil 1');
  10942. inv.AddAnItem('Necrophage Oil 2');
  10943. inv.AddAnItem('Specter Oil 1');
  10944. inv.AddAnItem('Vampire Oil 1');
  10945. inv.AddAnItem('Draconide Oil 1');
  10946. inv.AddAnItem('Relic Oil 1');
  10947. inv.AddAnItem('Black Blood 1');
  10948. inv.AddAnItem('Blizzard 1');
  10949. inv.AddAnItem('Cat 2');
  10950. inv.AddAnItem('Full Moon 1');
  10951. inv.AddAnItem('Maribor Forest 1');
  10952. inv.AddAnItem('Petris Philtre 1');
  10953. inv.AddAnItem('White Gull 1', 3);
  10954. inv.AddAnItem('White Honey 2');
  10955. inv.AddAnItem('White Raffards Decoction 1');
  10956.  
  10957.  
  10958. inv.AddAnItem('Mutagen 17');
  10959. inv.AddAnItem('Mutagen 19');
  10960. inv.AddAnItem('Mutagen 27');
  10961. inv.AddAnItem('Mutagen 26');
  10962.  
  10963.  
  10964. inv.AddAnItem('weapon_repair_kit_1', 5);
  10965. inv.AddAnItem('weapon_repair_kit_2', 3);
  10966. inv.AddAnItem('armor_repair_kit_1', 5);
  10967. inv.AddAnItem('armor_repair_kit_2', 3);
  10968.  
  10969.  
  10970. quantityMedium = 2;
  10971. quantityLow = 1;
  10972. inv.AddAnItem('Rune stribog lesser', quantityMedium);
  10973. inv.AddAnItem('Rune stribog', quantityLow);
  10974. inv.AddAnItem('Rune dazhbog lesser', quantityMedium);
  10975. inv.AddAnItem('Rune dazhbog', quantityLow);
  10976. inv.AddAnItem('Rune devana lesser', quantityMedium);
  10977. inv.AddAnItem('Rune devana', quantityLow);
  10978. inv.AddAnItem('Rune zoria lesser', quantityMedium);
  10979. inv.AddAnItem('Rune zoria', quantityLow);
  10980. inv.AddAnItem('Rune morana lesser', quantityMedium);
  10981. inv.AddAnItem('Rune morana', quantityLow);
  10982. inv.AddAnItem('Rune triglav lesser', quantityMedium);
  10983. inv.AddAnItem('Rune triglav', quantityLow);
  10984. inv.AddAnItem('Rune svarog lesser', quantityMedium);
  10985. inv.AddAnItem('Rune svarog', quantityLow);
  10986. inv.AddAnItem('Rune veles lesser', quantityMedium);
  10987. inv.AddAnItem('Rune veles', quantityLow);
  10988. inv.AddAnItem('Rune perun lesser', quantityMedium);
  10989. inv.AddAnItem('Rune perun', quantityLow);
  10990. inv.AddAnItem('Rune elemental lesser', quantityMedium);
  10991. inv.AddAnItem('Rune elemental', quantityLow);
  10992.  
  10993. inv.AddAnItem('Glyph aard lesser', quantityMedium);
  10994. inv.AddAnItem('Glyph aard', quantityLow);
  10995. inv.AddAnItem('Glyph axii lesser', quantityMedium);
  10996. inv.AddAnItem('Glyph axii', quantityLow);
  10997. inv.AddAnItem('Glyph igni lesser', quantityMedium);
  10998. inv.AddAnItem('Glyph igni', quantityLow);
  10999. inv.AddAnItem('Glyph quen lesser', quantityMedium);
  11000. inv.AddAnItem('Glyph quen', quantityLow);
  11001. inv.AddAnItem('Glyph yrden lesser', quantityMedium);
  11002. inv.AddAnItem('Glyph yrden', quantityLow);
  11003.  
  11004.  
  11005. StandaloneEp1_2();
  11006. }
  11007.  
  11008. public final function StandaloneEp1_2()
  11009. {
  11010. var horseId : SItemUniqueId;
  11011. var ids : array<SItemUniqueId>;
  11012. var ents : array< CJournalBase >;
  11013. var i : int;
  11014. var manager : CWitcherJournalManager;
  11015.  
  11016.  
  11017. inv.AddAnItem( 'Cows milk', 20 );
  11018. ids.Clear();
  11019. ids = inv.AddAnItem( 'Dumpling', 44 );
  11020. EquipItem(ids[0]);
  11021.  
  11022.  
  11023. inv.AddAnItem('Clearing Potion', 2, true, false, false);
  11024.  
  11025.  
  11026. GetHorseManager().RemoveAllItems();
  11027.  
  11028. ids.Clear();
  11029. ids = inv.AddAnItem('Horse Bag 2');
  11030. horseId = GetHorseManager().MoveItemToHorse(ids[0]);
  11031. GetHorseManager().EquipItem(horseId);
  11032.  
  11033. ids.Clear();
  11034. ids = inv.AddAnItem('Horse Blinder 2');
  11035. horseId = GetHorseManager().MoveItemToHorse(ids[0]);
  11036. GetHorseManager().EquipItem(horseId);
  11037.  
  11038. ids.Clear();
  11039. ids = inv.AddAnItem('Horse Saddle 2');
  11040. horseId = GetHorseManager().MoveItemToHorse(ids[0]);
  11041. GetHorseManager().EquipItem(horseId);
  11042.  
  11043. manager = theGame.GetJournalManager();
  11044.  
  11045.  
  11046. manager.GetActivatedOfType( 'CJournalCreature', ents );
  11047. for(i=0; i<ents.Size(); i+=1)
  11048. {
  11049. manager.ActivateEntry(ents[i], JS_Inactive, false, true);
  11050. }
  11051.  
  11052.  
  11053. ents.Clear();
  11054. manager.GetActivatedOfType( 'CJournalCharacter', ents );
  11055. for(i=0; i<ents.Size(); i+=1)
  11056. {
  11057. manager.ActivateEntry(ents[i], JS_Inactive, false, true);
  11058. }
  11059.  
  11060.  
  11061. ents.Clear();
  11062. manager.GetActivatedOfType( 'CJournalQuest', ents );
  11063. for(i=0; i<ents.Size(); i+=1)
  11064. {
  11065.  
  11066. if( StrStartsWith(ents[i].baseName, "q60"))
  11067. continue;
  11068.  
  11069. manager.ActivateEntry(ents[i], JS_Inactive, false, true);
  11070. }
  11071.  
  11072.  
  11073. manager.ActivateEntryByScriptTag('TutorialAard', JS_Active);
  11074. manager.ActivateEntryByScriptTag('TutorialAdrenaline', JS_Active);
  11075. manager.ActivateEntryByScriptTag('TutorialAxii', JS_Active);
  11076. manager.ActivateEntryByScriptTag('TutorialAxiiDialog', JS_Active);
  11077. manager.ActivateEntryByScriptTag('TutorialCamera', JS_Active);
  11078. manager.ActivateEntryByScriptTag('TutorialCamera_pad', JS_Active);
  11079. manager.ActivateEntryByScriptTag('TutorialCiriBlink', JS_Active);
  11080. manager.ActivateEntryByScriptTag('TutorialCiriCharge', JS_Active);
  11081. manager.ActivateEntryByScriptTag('TutorialCiriStamina', JS_Active);
  11082. manager.ActivateEntryByScriptTag('TutorialCounter', JS_Active);
  11083. manager.ActivateEntryByScriptTag('TutorialDialogClose', JS_Active);
  11084. manager.ActivateEntryByScriptTag('TutorialFallingRoll', JS_Active);
  11085. manager.ActivateEntryByScriptTag('TutorialFocus', JS_Active);
  11086. manager.ActivateEntryByScriptTag('TutorialFocusClues', JS_Active);
  11087. manager.ActivateEntryByScriptTag('TutorialFocusClues', JS_Active);
  11088. manager.ActivateEntryByScriptTag('TutorialHorseRoad', JS_Active);
  11089. manager.ActivateEntryByScriptTag('TutorialHorseSpeed0', JS_Active);
  11090. manager.ActivateEntryByScriptTag('TutorialHorseSpeed0_pad', JS_Active);
  11091. manager.ActivateEntryByScriptTag('TutorialHorseSpeed1', JS_Active);
  11092. manager.ActivateEntryByScriptTag('TutorialHorseSpeed2', JS_Active);
  11093. manager.ActivateEntryByScriptTag('TutorialHorseSummon', JS_Active);
  11094. manager.ActivateEntryByScriptTag('TutorialHorseSummon_pad', JS_Active);
  11095. manager.ActivateEntryByScriptTag('TutorialIgni', JS_Active);
  11096. manager.ActivateEntryByScriptTag('TutorialJournalAlternateSings', JS_Active);
  11097. manager.ActivateEntryByScriptTag('TutorialJournalBoatDamage', JS_Active);
  11098. manager.ActivateEntryByScriptTag('TutorialJournalBoatMount', JS_Active);
  11099. manager.ActivateEntryByScriptTag('TutorialJournalBuffs', JS_Active);
  11100. manager.ActivateEntryByScriptTag('TutorialJournalCharDevLeveling', JS_Active);
  11101. manager.ActivateEntryByScriptTag('TutorialJournalCharDevSkills', JS_Active);
  11102. manager.ActivateEntryByScriptTag('TutorialJournalCrafting', JS_Active);
  11103. manager.ActivateEntryByScriptTag('TutorialJournalCrossbow', JS_Active);
  11104. manager.ActivateEntryByScriptTag('TutorialJournalDialogGwint', JS_Active);
  11105. manager.ActivateEntryByScriptTag('TutorialJournalDialogShop', JS_Active);
  11106. manager.ActivateEntryByScriptTag('TutorialJournalDive', JS_Active);
  11107. manager.ActivateEntryByScriptTag('TutorialJournalDodge', JS_Active);
  11108. manager.ActivateEntryByScriptTag('TutorialJournalDodge_pad', JS_Active);
  11109. manager.ActivateEntryByScriptTag('TutorialJournalDrawWeapon', JS_Active);
  11110. manager.ActivateEntryByScriptTag('TutorialJournalDrawWeapon_pad', JS_Active);
  11111. manager.ActivateEntryByScriptTag('TutorialJournalDurability', JS_Active);
  11112. manager.ActivateEntryByScriptTag('TutorialJournalExplorations', JS_Active);
  11113. manager.ActivateEntryByScriptTag('TutorialJournalExplorations_pad', JS_Active);
  11114. manager.ActivateEntryByScriptTag('TutorialJournalFastTravel', JS_Active);
  11115. manager.ActivateEntryByScriptTag('TutorialJournalFocusRedObjects', JS_Active);
  11116. manager.ActivateEntryByScriptTag('TutorialJournalGasClouds', JS_Active);
  11117. manager.ActivateEntryByScriptTag('TutorialJournalHeavyAttacks', JS_Active);
  11118. manager.ActivateEntryByScriptTag('TutorialJournalHorse', JS_Active);
  11119. manager.ActivateEntryByScriptTag('TutorialJournalHorseStamina', JS_Active);
  11120. manager.ActivateEntryByScriptTag('TutorialJournalJump', JS_Active);
  11121. manager.ActivateEntryByScriptTag('TutorialJournalLightAttacks', JS_Active);
  11122. manager.ActivateEntryByScriptTag('TutorialJournalLightAttacks_pad', JS_Active);
  11123. manager.ActivateEntryByScriptTag('TutorialJournalMeditation', JS_Active);
  11124. manager.ActivateEntryByScriptTag('TutorialJournalMeditation_pad', JS_Active);
  11125. manager.ActivateEntryByScriptTag('TutorialJournalMonsterThreatLevels', JS_Active);
  11126. manager.ActivateEntryByScriptTag('TutorialJournalMovement', JS_Active);
  11127. manager.ActivateEntryByScriptTag('TutorialJournalMovement_pad', JS_Active);
  11128. manager.ActivateEntryByScriptTag('TutorialJournalMutagenIngredient', JS_Active);
  11129. manager.ActivateEntryByScriptTag('TutorialJournalMutagenPotion', JS_Active);
  11130. manager.ActivateEntryByScriptTag('TutorialJournalOils', JS_Active);
  11131. manager.ActivateEntryByScriptTag('TutorialJournalPetards', JS_Active);
  11132. manager.ActivateEntryByScriptTag('TutorialJournalPotions', JS_Active);
  11133. manager.ActivateEntryByScriptTag('TutorialJournalPotions_pad', JS_Active);
  11134. manager.ActivateEntryByScriptTag('TutorialJournalQuestArea', JS_Active);
  11135. manager.ActivateEntryByScriptTag('TutorialJournalRadial', JS_Active);
  11136. manager.ActivateEntryByScriptTag('TutorialJournalRifts', JS_Active);
  11137. manager.ActivateEntryByScriptTag('TutorialJournalRun', JS_Active);
  11138. manager.ActivateEntryByScriptTag('TutorialJournalShopDescription', JS_Active);
  11139. manager.ActivateEntryByScriptTag('TutorialJournalSignCast', JS_Active);
  11140. manager.ActivateEntryByScriptTag('TutorialJournalSignCast_pad', JS_Active);
  11141. manager.ActivateEntryByScriptTag('TutorialJournalSpecialAttacks', JS_Active);
  11142. manager.ActivateEntryByScriptTag('TutorialJournalStaminaExploration', JS_Active);
  11143. manager.ActivateEntryByScriptTag('TutorialJumpHang', JS_Active);
  11144. manager.ActivateEntryByScriptTag('TutorialLadder', JS_Active);
  11145. manager.ActivateEntryByScriptTag('TutorialLadderMove', JS_Active);
  11146. manager.ActivateEntryByScriptTag('TutorialLadderMove_pad', JS_Active);
  11147. manager.ActivateEntryByScriptTag('TutorialObjectiveSwitching', JS_Active);
  11148. manager.ActivateEntryByScriptTag('TutorialOxygen', JS_Active);
  11149. manager.ActivateEntryByScriptTag('TutorialParry', JS_Active);
  11150. manager.ActivateEntryByScriptTag('TutorialPOIUncovered', JS_Active);
  11151. manager.ActivateEntryByScriptTag('TutorialQuen', JS_Active);
  11152. manager.ActivateEntryByScriptTag('TutorialRoll', JS_Active);
  11153. manager.ActivateEntryByScriptTag('TutorialRoll_pad', JS_Active);
  11154. manager.ActivateEntryByScriptTag('TutorialSpeedPairing', JS_Active);
  11155. manager.ActivateEntryByScriptTag('TutorialSprint', JS_Active);
  11156. manager.ActivateEntryByScriptTag('TutorialStaminaSigns', JS_Active);
  11157. manager.ActivateEntryByScriptTag('TutorialStealing', JS_Active);
  11158. manager.ActivateEntryByScriptTag('TutorialSwimmingSpeed', JS_Active);
  11159. manager.ActivateEntryByScriptTag('TutorialTimedChoiceDialog', JS_Active);
  11160. manager.ActivateEntryByScriptTag('TutorialYrden', JS_Active);
  11161.  
  11162.  
  11163. FactsAdd('kill_base_tutorials');
  11164.  
  11165.  
  11166. theGame.GetTutorialSystem().RemoveAllQueuedTutorials();
  11167.  
  11168.  
  11169. FactsAdd('standalone_ep1');
  11170. FactsRemove("StandAloneEP1");
  11171.  
  11172. theGame.GetJournalManager().ForceUntrackingQuestForEP1Savegame();
  11173. }
  11174.  
  11175. final function Debug_FocusBoyFocusGain()
  11176. {
  11177. var focusGain : float;
  11178.  
  11179. focusGain = FactsQuerySum( "debug_fact_focus_boy" ) ;
  11180. GainStat( BCS_Focus, focusGain );
  11181. }
  11182.  
  11183. public final function StandaloneEp2_1()
  11184. {
  11185. var i, inc, quantityLow, randLow, quantityMedium, randMedium, quantityHigh, randHigh, startingMoney : int;
  11186. var pam : W3PlayerAbilityManager;
  11187. var ids : array<SItemUniqueId>;
  11188. var STARTING_LEVEL : int;
  11189.  
  11190. FactsAdd( "StandAloneEP2", 1 );
  11191.  
  11192.  
  11193. inv.RemoveAllItems();
  11194.  
  11195.  
  11196. inv.AddAnItem( 'Illusion Medallion', 1, true, true, false );
  11197. inv.AddAnItem( 'q103_safe_conduct', 1, true, true, false );
  11198.  
  11199.  
  11200. theGame.GetGamerProfile().ClearAllAchievementsForEP2();
  11201.  
  11202.  
  11203. levelManager.Hack_EP2StandaloneLevelShrink( 35 );
  11204.  
  11205.  
  11206. levelManager.ResetCharacterDev();
  11207. pam = ( W3PlayerAbilityManager )abilityManager;
  11208. if( pam )
  11209. {
  11210. pam.ResetCharacterDev();
  11211. }
  11212. levelManager.SetFreeSkillPoints( levelManager.GetLevel() - 1 + 11 );
  11213.  
  11214.  
  11215. inv.AddAnItem( 'Mutagen red', 4 );
  11216. inv.AddAnItem( 'Mutagen green', 4 );
  11217. inv.AddAnItem( 'Mutagen blue', 4 );
  11218. inv.AddAnItem( 'Lesser mutagen red', 2 );
  11219. inv.AddAnItem( 'Lesser mutagen green', 2 );
  11220. inv.AddAnItem( 'Lesser mutagen blue', 2 );
  11221. inv.AddAnItem( 'Greater mutagen red', 2 );
  11222. inv.AddAnItem( 'Greater mutagen green', 2 );
  11223. inv.AddAnItem( 'Greater mutagen blue', 2 );
  11224.  
  11225.  
  11226. startingMoney = 20000;
  11227. if( GetMoney() > startingMoney )
  11228. {
  11229. RemoveMoney( GetMoney() - startingMoney );
  11230. }
  11231. else
  11232. {
  11233. AddMoney( 20000 - GetMoney() );
  11234. }
  11235.  
  11236.  
  11237. ids.Clear();
  11238. ids = inv.AddAnItem( 'EP2 Standalone Starting Armor' );
  11239. EquipItem( ids[0] );
  11240. ids.Clear();
  11241. ids = inv.AddAnItem( 'EP2 Standalone Starting Boots' );
  11242. EquipItem( ids[0] );
  11243. ids.Clear();
  11244. ids = inv.AddAnItem( 'EP2 Standalone Starting Gloves' );
  11245. EquipItem( ids[0] );
  11246. ids.Clear();
  11247. ids = inv.AddAnItem( 'EP2 Standalone Starting Pants' );
  11248. EquipItem( ids[0] );
  11249.  
  11250.  
  11251. ids.Clear();
  11252. ids = inv.AddAnItem( 'EP2 Standalone Starting Steel Sword' );
  11253. EquipItem( ids[0] );
  11254. ids.Clear();
  11255. ids = inv.AddAnItem( 'EP2 Standalone Starting Silver Sword' );
  11256. EquipItem( ids[0] );
  11257.  
  11258.  
  11259. inv.AddAnItem( 'Torch', 1, true, true, false );
  11260.  
  11261.  
  11262. quantityLow = 1;
  11263. randLow = 3;
  11264. quantityMedium = 4;
  11265. randMedium = 4;
  11266. quantityHigh = 8;
  11267. randHigh = 6;
  11268.  
  11269. inv.AddAnItem( 'Alghoul bone marrow',quantityMedium+RandRange( randMedium ) );
  11270. inv.AddAnItem( 'Amethyst dust',quantityLow+RandRange( randLow ) );
  11271. inv.AddAnItem( 'Arachas eyes',quantityLow+RandRange( randLow ) );
  11272. inv.AddAnItem( 'Arachas venom',quantityLow+RandRange( randLow ) );
  11273. inv.AddAnItem( 'Basilisk hide',quantityLow+RandRange( randLow ) );
  11274. inv.AddAnItem( 'Basilisk venom',quantityLow+RandRange( randLow ) );
  11275. inv.AddAnItem( 'Bear pelt',quantityHigh+RandRange( randHigh ) );
  11276. inv.AddAnItem( 'Berserker pelt',quantityLow+RandRange( randLow ) );
  11277. inv.AddAnItem( 'Coal',quantityHigh+RandRange( randHigh ) );
  11278. inv.AddAnItem( 'Cotton',quantityHigh+RandRange( randHigh ) );
  11279.  
  11280.  
  11281. inv.AddAnItem( 'Deer hide',quantityHigh+RandRange( randHigh ) );
  11282. inv.AddAnItem( 'Diamond dust',quantityLow+RandRange( randLow ) );
  11283.  
  11284. inv.AddAnItem( 'Drowned dead tongue',quantityLow+RandRange( randLow ) );
  11285. inv.AddAnItem( 'Drowner brain',quantityMedium+RandRange( randMedium ) );
  11286.  
  11287.  
  11288.  
  11289. inv.AddAnItem( 'Endriag chitin plates',quantityMedium+RandRange( randMedium ) );
  11290. inv.AddAnItem( 'Endriag embryo',quantityLow+RandRange( randLow ) );
  11291. inv.AddAnItem( 'Ghoul blood',quantityMedium+RandRange( randMedium ) );
  11292. inv.AddAnItem( 'Goat hide',quantityMedium+RandRange( randMedium ) );
  11293. inv.AddAnItem( 'Hag teeth',quantityMedium+RandRange( randMedium ) );
  11294. inv.AddAnItem( 'Hardened leather',quantityMedium+RandRange( randMedium ) );
  11295. inv.AddAnItem( 'Hardened timber',quantityMedium+RandRange( randMedium ) );
  11296. inv.AddAnItem( 'Harpy feathers',quantityMedium+RandRange( randMedium ) );
  11297. inv.AddAnItem( 'Horse hide',quantityLow+RandRange( randLow ) );
  11298.  
  11299.  
  11300.  
  11301.  
  11302.  
  11303.  
  11304. inv.AddAnItem( 'Necrophage skin',quantityLow+RandRange( randLow ) );
  11305. inv.AddAnItem( 'Nekker blood',quantityHigh+RandRange( randHigh ) );
  11306. inv.AddAnItem( 'Nekker heart',quantityMedium+RandRange( randMedium ) );
  11307.  
  11308. inv.AddAnItem( 'Phosphorescent crystal',quantityLow+RandRange( randLow ) );
  11309. inv.AddAnItem( 'Pig hide',quantityMedium+RandRange( randMedium ) );
  11310.  
  11311. inv.AddAnItem( 'Rabbit pelt',quantityMedium+RandRange( randMedium ) );
  11312. inv.AddAnItem( 'Rotfiend blood',quantityMedium+RandRange( randMedium ) );
  11313. inv.AddAnItem( 'Sapphire dust',quantityLow+RandRange( randLow ) );
  11314.  
  11315.  
  11316.  
  11317. inv.AddAnItem( 'Specter dust',quantityMedium+RandRange( randMedium ) );
  11318.  
  11319.  
  11320.  
  11321.  
  11322.  
  11323.  
  11324.  
  11325. inv.AddAnItem( 'Water essence',quantityMedium+RandRange( randMedium ) );
  11326. inv.AddAnItem( 'Wolf liver',quantityHigh+RandRange( randHigh ) );
  11327. inv.AddAnItem( 'Wolf pelt',quantityMedium+RandRange( randMedium ) );
  11328.  
  11329. inv.AddAnItem( 'Alcohest', 5 );
  11330. inv.AddAnItem( 'Dwarven spirit', 5 );
  11331.  
  11332.  
  11333. ids.Clear();
  11334. ids = inv.AddAnItem( 'Crossbow 5' );
  11335. EquipItem( ids[0] );
  11336. ids.Clear();
  11337. ids = inv.AddAnItem( 'Blunt Bolt', 100 );
  11338. EquipItem( ids[0] );
  11339. inv.AddAnItem( 'Broadhead Bolt', 100 );
  11340. inv.AddAnItem( 'Split Bolt', 100 );
  11341.  
  11342.  
  11343. RemoveAllAlchemyRecipes();
  11344. RemoveAllCraftingSchematics();
  11345.  
  11346.  
  11347.  
  11348.  
  11349.  
  11350.  
  11351.  
  11352.  
  11353.  
  11354. AddAlchemyRecipe( 'Recipe for Petris Philtre 2' );
  11355. AddAlchemyRecipe( 'Recipe for Swallow 1' );
  11356. AddAlchemyRecipe( 'Recipe for Tawny Owl 1' );
  11357.  
  11358. AddAlchemyRecipe( 'Recipe for White Gull 1' );
  11359.  
  11360.  
  11361.  
  11362.  
  11363.  
  11364. AddAlchemyRecipe( 'Recipe for Beast Oil 1' );
  11365. AddAlchemyRecipe( 'Recipe for Cursed Oil 1' );
  11366. AddAlchemyRecipe( 'Recipe for Hanged Man Venom 1' );
  11367. AddAlchemyRecipe( 'Recipe for Hybrid Oil 1' );
  11368. AddAlchemyRecipe( 'Recipe for Insectoid Oil 2' );
  11369. AddAlchemyRecipe( 'Recipe for Magicals Oil 1' );
  11370. AddAlchemyRecipe( 'Recipe for Necrophage Oil 1' );
  11371. AddAlchemyRecipe( 'Recipe for Specter Oil 1' );
  11372. AddAlchemyRecipe( 'Recipe for Vampire Oil 2' );
  11373. AddAlchemyRecipe( 'Recipe for Draconide Oil 2' );
  11374. AddAlchemyRecipe( 'Recipe for Ogre Oil 1' );
  11375. AddAlchemyRecipe( 'Recipe for Relic Oil 1' );
  11376. AddAlchemyRecipe( 'Recipe for Beast Oil 2' );
  11377. AddAlchemyRecipe( 'Recipe for Cursed Oil 2' );
  11378. AddAlchemyRecipe( 'Recipe for Hanged Man Venom 2' );
  11379. AddAlchemyRecipe( 'Recipe for Hybrid Oil 2' );
  11380. AddAlchemyRecipe( 'Recipe for Insectoid Oil 2' );
  11381. AddAlchemyRecipe( 'Recipe for Magicals Oil 2' );
  11382. AddAlchemyRecipe( 'Recipe for Necrophage Oil 2' );
  11383. AddAlchemyRecipe( 'Recipe for Specter Oil 2' );
  11384. AddAlchemyRecipe( 'Recipe for Vampire Oil 2' );
  11385. AddAlchemyRecipe( 'Recipe for Draconide Oil 2' );
  11386. AddAlchemyRecipe( 'Recipe for Ogre Oil 2' );
  11387. AddAlchemyRecipe( 'Recipe for Relic Oil 2' );
  11388.  
  11389.  
  11390. AddAlchemyRecipe( 'Recipe for Dancing Star 1' );
  11391.  
  11392. AddAlchemyRecipe( 'Recipe for Dwimeritum Bomb 1' );
  11393.  
  11394. AddAlchemyRecipe( 'Recipe for Grapeshot 1' );
  11395. AddAlchemyRecipe( 'Recipe for Samum 1' );
  11396.  
  11397. AddAlchemyRecipe( 'Recipe for White Frost 1' );
  11398.  
  11399.  
  11400.  
  11401. AddAlchemyRecipe( 'Recipe for Dwarven spirit 1' );
  11402. AddAlchemyRecipe( 'Recipe for Alcohest 1' );
  11403. AddAlchemyRecipe( 'Recipe for White Gull 1' );
  11404.  
  11405.  
  11406. AddStartingSchematics();
  11407.  
  11408.  
  11409. ids.Clear();
  11410. ids = inv.AddAnItem( 'Swallow 2' );
  11411. EquipItem( ids[0] );
  11412. ids.Clear();
  11413. ids = inv.AddAnItem( 'Thunderbolt 2' );
  11414. EquipItem( ids[0] );
  11415. ids.Clear();
  11416. ids = inv.AddAnItem( 'Tawny Owl 2' );
  11417. EquipItem( ids[0] );
  11418. ids.Clear();
  11419.  
  11420. ids = inv.AddAnItem( 'Grapeshot 2' );
  11421. EquipItem( ids[0] );
  11422. ids.Clear();
  11423. ids = inv.AddAnItem( 'Samum 2' );
  11424. EquipItem( ids[0] );
  11425.  
  11426. inv.AddAnItem( 'Dwimeritum Bomb 1' );
  11427. inv.AddAnItem( 'Dragons Dream 1' );
  11428. inv.AddAnItem( 'Silver Dust Bomb 1' );
  11429. inv.AddAnItem( 'White Frost 2' );
  11430. inv.AddAnItem( 'Devils Puffball 2' );
  11431. inv.AddAnItem( 'Dancing Star 2' );
  11432. inv.AddAnItem( 'Beast Oil 1' );
  11433. inv.AddAnItem( 'Cursed Oil 1' );
  11434. inv.AddAnItem( 'Hanged Man Venom 2' );
  11435. inv.AddAnItem( 'Hybrid Oil 2' );
  11436. inv.AddAnItem( 'Insectoid Oil 2' );
  11437. inv.AddAnItem( 'Magicals Oil 1' );
  11438. inv.AddAnItem( 'Necrophage Oil 2' );
  11439. inv.AddAnItem( 'Ogre Oil 1' );
  11440. inv.AddAnItem( 'Specter Oil 1' );
  11441. inv.AddAnItem( 'Vampire Oil 2' );
  11442. inv.AddAnItem( 'Draconide Oil 2' );
  11443. inv.AddAnItem( 'Relic Oil 1' );
  11444. inv.AddAnItem( 'Black Blood 1' );
  11445. inv.AddAnItem( 'Blizzard 1' );
  11446. inv.AddAnItem( 'Cat 2' );
  11447. inv.AddAnItem( 'Full Moon 1' );
  11448. inv.AddAnItem( 'Golden Oriole 1' );
  11449. inv.AddAnItem( 'Killer Whale 1' );
  11450. inv.AddAnItem( 'Maribor Forest 1' );
  11451. inv.AddAnItem( 'Petris Philtre 2' );
  11452. inv.AddAnItem( 'White Gull 1', 3 );
  11453. inv.AddAnItem( 'White Honey 2' );
  11454. inv.AddAnItem( 'White Raffards Decoction 1' );
  11455.  
  11456.  
  11457. inv.AddAnItem( 'Mutagen 17' );
  11458. inv.AddAnItem( 'Mutagen 19' );
  11459. inv.AddAnItem( 'Mutagen 27' );
  11460. inv.AddAnItem( 'Mutagen 26' );
  11461.  
  11462.  
  11463. inv.AddAnItem( 'weapon_repair_kit_1', 5 );
  11464. inv.AddAnItem( 'weapon_repair_kit_2', 3 );
  11465. inv.AddAnItem( 'armor_repair_kit_1', 5 );
  11466. inv.AddAnItem( 'armor_repair_kit_2', 3 );
  11467.  
  11468.  
  11469. quantityMedium = 2;
  11470. quantityLow = 1;
  11471. inv.AddAnItem( 'Rune stribog lesser', quantityMedium );
  11472. inv.AddAnItem( 'Rune stribog', quantityLow );
  11473. inv.AddAnItem( 'Rune dazhbog lesser', quantityMedium );
  11474. inv.AddAnItem( 'Rune dazhbog', quantityLow );
  11475. inv.AddAnItem( 'Rune devana lesser', quantityMedium );
  11476. inv.AddAnItem( 'Rune devana', quantityLow );
  11477. inv.AddAnItem( 'Rune zoria lesser', quantityMedium );
  11478. inv.AddAnItem( 'Rune zoria', quantityLow );
  11479. inv.AddAnItem( 'Rune morana lesser', quantityMedium );
  11480. inv.AddAnItem( 'Rune morana', quantityLow );
  11481. inv.AddAnItem( 'Rune triglav lesser', quantityMedium );
  11482. inv.AddAnItem( 'Rune triglav', quantityLow );
  11483. inv.AddAnItem( 'Rune svarog lesser', quantityMedium );
  11484. inv.AddAnItem( 'Rune svarog', quantityLow );
  11485. inv.AddAnItem( 'Rune veles lesser', quantityMedium );
  11486. inv.AddAnItem( 'Rune veles', quantityLow );
  11487. inv.AddAnItem( 'Rune perun lesser', quantityMedium );
  11488. inv.AddAnItem( 'Rune perun', quantityLow );
  11489. inv.AddAnItem( 'Rune elemental lesser', quantityMedium );
  11490. inv.AddAnItem( 'Rune elemental', quantityLow );
  11491.  
  11492. inv.AddAnItem( 'Glyph aard lesser', quantityMedium );
  11493. inv.AddAnItem( 'Glyph aard', quantityLow );
  11494. inv.AddAnItem( 'Glyph axii lesser', quantityMedium );
  11495. inv.AddAnItem( 'Glyph axii', quantityLow );
  11496. inv.AddAnItem( 'Glyph igni lesser', quantityMedium );
  11497. inv.AddAnItem( 'Glyph igni', quantityLow );
  11498. inv.AddAnItem( 'Glyph quen lesser', quantityMedium );
  11499. inv.AddAnItem( 'Glyph quen', quantityLow );
  11500. inv.AddAnItem( 'Glyph yrden lesser', quantityMedium );
  11501. inv.AddAnItem( 'Glyph yrden', quantityLow );
  11502.  
  11503.  
  11504. StandaloneEp2_2();
  11505. }
  11506.  
  11507. public final function StandaloneEp2_2()
  11508. {
  11509. var horseId : SItemUniqueId;
  11510. var ids : array<SItemUniqueId>;
  11511. var ents : array< CJournalBase >;
  11512. var i : int;
  11513. var manager : CWitcherJournalManager;
  11514.  
  11515.  
  11516. inv.AddAnItem( 'Cows milk', 20 );
  11517. ids.Clear();
  11518. ids = inv.AddAnItem( 'Dumpling', 44 );
  11519. EquipItem( ids[0] );
  11520.  
  11521.  
  11522. inv.AddAnItem( 'Clearing Potion', 2, true, false, false );
  11523.  
  11524.  
  11525. GetHorseManager().RemoveAllItems();
  11526.  
  11527. ids.Clear();
  11528. ids = inv.AddAnItem( 'Horse Bag 2' );
  11529. horseId = GetHorseManager( ).MoveItemToHorse( ids[0] );
  11530. GetHorseManager().EquipItem( horseId );
  11531.  
  11532. ids.Clear();
  11533. ids = inv.AddAnItem( 'Horse Blinder 2' );
  11534. horseId = GetHorseManager().MoveItemToHorse( ids[0] );
  11535. GetHorseManager().EquipItem( horseId );
  11536.  
  11537. ids.Clear();
  11538. ids = inv.AddAnItem( 'Horse Saddle 2' );
  11539. horseId = GetHorseManager().MoveItemToHorse( ids[0] );
  11540. GetHorseManager().EquipItem( horseId );
  11541.  
  11542. manager = theGame.GetJournalManager();
  11543.  
  11544.  
  11545. manager.GetActivatedOfType( 'CJournalCreature', ents );
  11546. for(i=0; i<ents.Size(); i+=1)
  11547. {
  11548. manager.ActivateEntry( ents[i], JS_Inactive, false, true );
  11549. }
  11550.  
  11551.  
  11552. ents.Clear();
  11553. manager.GetActivatedOfType( 'CJournalCharacter', ents );
  11554. for(i=0; i<ents.Size(); i+=1)
  11555. {
  11556. manager.ActivateEntry( ents[i], JS_Inactive, false, true );
  11557. }
  11558.  
  11559.  
  11560. ents.Clear();
  11561. manager.GetActivatedOfType( 'CJournalQuest', ents );
  11562. for(i=0; i<ents.Size(); i+=1)
  11563. {
  11564.  
  11565. if( StrStartsWith( ents[i].baseName, "q60" ) )
  11566. continue;
  11567.  
  11568. manager.ActivateEntry( ents[i], JS_Inactive, false, true );
  11569. }
  11570.  
  11571.  
  11572. manager.ActivateEntryByScriptTag( 'TutorialAard', JS_Active );
  11573. manager.ActivateEntryByScriptTag( 'TutorialAdrenaline', JS_Active );
  11574. manager.ActivateEntryByScriptTag( 'TutorialAxii', JS_Active );
  11575. manager.ActivateEntryByScriptTag( 'TutorialAxiiDialog', JS_Active );
  11576. manager.ActivateEntryByScriptTag( 'TutorialCamera', JS_Active );
  11577. manager.ActivateEntryByScriptTag( 'TutorialCamera_pad', JS_Active );
  11578. manager.ActivateEntryByScriptTag( 'TutorialCiriBlink', JS_Active );
  11579. manager.ActivateEntryByScriptTag( 'TutorialCiriCharge', JS_Active );
  11580. manager.ActivateEntryByScriptTag( 'TutorialCiriStamina', JS_Active );
  11581. manager.ActivateEntryByScriptTag( 'TutorialCounter', JS_Active );
  11582. manager.ActivateEntryByScriptTag( 'TutorialDialogClose', JS_Active );
  11583. manager.ActivateEntryByScriptTag( 'TutorialFallingRoll', JS_Active );
  11584. manager.ActivateEntryByScriptTag( 'TutorialFocus', JS_Active );
  11585. manager.ActivateEntryByScriptTag( 'TutorialFocusClues', JS_Active );
  11586. manager.ActivateEntryByScriptTag( 'TutorialFocusClues', JS_Active );
  11587. manager.ActivateEntryByScriptTag( 'TutorialHorseRoad', JS_Active );
  11588. manager.ActivateEntryByScriptTag( 'TutorialHorseSpeed0', JS_Active );
  11589. manager.ActivateEntryByScriptTag( 'TutorialHorseSpeed0_pad', JS_Active );
  11590. manager.ActivateEntryByScriptTag( 'TutorialHorseSpeed1', JS_Active );
  11591. manager.ActivateEntryByScriptTag( 'TutorialHorseSpeed2', JS_Active );
  11592. manager.ActivateEntryByScriptTag( 'TutorialHorseSummon', JS_Active );
  11593. manager.ActivateEntryByScriptTag( 'TutorialHorseSummon_pad', JS_Active );
  11594. manager.ActivateEntryByScriptTag( 'TutorialIgni', JS_Active );
  11595. manager.ActivateEntryByScriptTag( 'TutorialJournalAlternateSings', JS_Active );
  11596. manager.ActivateEntryByScriptTag( 'TutorialJournalBoatDamage', JS_Active );
  11597. manager.ActivateEntryByScriptTag( 'TutorialJournalBoatMount', JS_Active );
  11598. manager.ActivateEntryByScriptTag( 'TutorialJournalBuffs', JS_Active );
  11599. manager.ActivateEntryByScriptTag( 'TutorialJournalCharDevLeveling', JS_Active );
  11600. manager.ActivateEntryByScriptTag( 'TutorialJournalCharDevSkills', JS_Active );
  11601. manager.ActivateEntryByScriptTag( 'TutorialJournalCrafting', JS_Active );
  11602. manager.ActivateEntryByScriptTag( 'TutorialJournalCrossbow', JS_Active );
  11603. manager.ActivateEntryByScriptTag( 'TutorialJournalDialogGwint', JS_Active );
  11604. manager.ActivateEntryByScriptTag( 'TutorialJournalDialogShop', JS_Active );
  11605. manager.ActivateEntryByScriptTag( 'TutorialJournalDive', JS_Active );
  11606. manager.ActivateEntryByScriptTag( 'TutorialJournalDodge', JS_Active );
  11607. manager.ActivateEntryByScriptTag( 'TutorialJournalDodge_pad', JS_Active );
  11608. manager.ActivateEntryByScriptTag( 'TutorialJournalDrawWeapon', JS_Active );
  11609. manager.ActivateEntryByScriptTag( 'TutorialJournalDrawWeapon_pad', JS_Active );
  11610. manager.ActivateEntryByScriptTag( 'TutorialJournalDurability', JS_Active );
  11611. manager.ActivateEntryByScriptTag( 'TutorialJournalExplorations', JS_Active );
  11612. manager.ActivateEntryByScriptTag( 'TutorialJournalExplorations_pad', JS_Active );
  11613. manager.ActivateEntryByScriptTag( 'TutorialJournalFastTravel', JS_Active );
  11614. manager.ActivateEntryByScriptTag( 'TutorialJournalFocusRedObjects', JS_Active );
  11615. manager.ActivateEntryByScriptTag( 'TutorialJournalGasClouds', JS_Active );
  11616. manager.ActivateEntryByScriptTag( 'TutorialJournalHeavyAttacks', JS_Active );
  11617. manager.ActivateEntryByScriptTag( 'TutorialJournalHorse', JS_Active );
  11618. manager.ActivateEntryByScriptTag( 'TutorialJournalHorseStamina', JS_Active );
  11619. manager.ActivateEntryByScriptTag( 'TutorialJournalJump', JS_Active );
  11620. manager.ActivateEntryByScriptTag( 'TutorialJournalLightAttacks', JS_Active );
  11621. manager.ActivateEntryByScriptTag( 'TutorialJournalLightAttacks_pad', JS_Active );
  11622. manager.ActivateEntryByScriptTag( 'TutorialJournalMeditation', JS_Active );
  11623. manager.ActivateEntryByScriptTag( 'TutorialJournalMeditation_pad', JS_Active );
  11624. manager.ActivateEntryByScriptTag( 'TutorialJournalMonsterThreatLevels', JS_Active );
  11625. manager.ActivateEntryByScriptTag( 'TutorialJournalMovement', JS_Active );
  11626. manager.ActivateEntryByScriptTag( 'TutorialJournalMovement_pad', JS_Active );
  11627. manager.ActivateEntryByScriptTag( 'TutorialJournalMutagenIngredient', JS_Active );
  11628. manager.ActivateEntryByScriptTag( 'TutorialJournalMutagenPotion', JS_Active );
  11629. manager.ActivateEntryByScriptTag( 'TutorialJournalOils', JS_Active );
  11630. manager.ActivateEntryByScriptTag( 'TutorialJournalPetards', JS_Active );
  11631. manager.ActivateEntryByScriptTag( 'TutorialJournalPotions', JS_Active );
  11632. manager.ActivateEntryByScriptTag( 'TutorialJournalPotions_pad', JS_Active );
  11633. manager.ActivateEntryByScriptTag( 'TutorialJournalQuestArea', JS_Active );
  11634. manager.ActivateEntryByScriptTag( 'TutorialJournalRadial', JS_Active );
  11635. manager.ActivateEntryByScriptTag( 'TutorialJournalRifts', JS_Active );
  11636. manager.ActivateEntryByScriptTag( 'TutorialJournalRun', JS_Active );
  11637. manager.ActivateEntryByScriptTag( 'TutorialJournalShopDescription', JS_Active );
  11638. manager.ActivateEntryByScriptTag( 'TutorialJournalSignCast', JS_Active );
  11639. manager.ActivateEntryByScriptTag( 'TutorialJournalSignCast_pad', JS_Active );
  11640. manager.ActivateEntryByScriptTag( 'TutorialJournalSpecialAttacks', JS_Active );
  11641. manager.ActivateEntryByScriptTag( 'TutorialJournalStaminaExploration', JS_Active );
  11642. manager.ActivateEntryByScriptTag( 'TutorialJumpHang', JS_Active );
  11643. manager.ActivateEntryByScriptTag( 'TutorialLadder', JS_Active );
  11644. manager.ActivateEntryByScriptTag( 'TutorialLadderMove', JS_Active );
  11645. manager.ActivateEntryByScriptTag( 'TutorialLadderMove_pad', JS_Active );
  11646. manager.ActivateEntryByScriptTag( 'TutorialObjectiveSwitching', JS_Active );
  11647. manager.ActivateEntryByScriptTag( 'TutorialOxygen', JS_Active );
  11648. manager.ActivateEntryByScriptTag( 'TutorialParry', JS_Active );
  11649. manager.ActivateEntryByScriptTag( 'TutorialPOIUncovered', JS_Active );
  11650. manager.ActivateEntryByScriptTag( 'TutorialQuen', JS_Active );
  11651. manager.ActivateEntryByScriptTag( 'TutorialRoll', JS_Active );
  11652. manager.ActivateEntryByScriptTag( 'TutorialRoll_pad', JS_Active );
  11653. manager.ActivateEntryByScriptTag( 'TutorialSpeedPairing', JS_Active );
  11654. manager.ActivateEntryByScriptTag( 'TutorialSprint', JS_Active );
  11655. manager.ActivateEntryByScriptTag( 'TutorialStaminaSigns', JS_Active );
  11656. manager.ActivateEntryByScriptTag( 'TutorialStealing', JS_Active );
  11657. manager.ActivateEntryByScriptTag( 'TutorialSwimmingSpeed', JS_Active );
  11658. manager.ActivateEntryByScriptTag( 'TutorialTimedChoiceDialog', JS_Active );
  11659. manager.ActivateEntryByScriptTag( 'TutorialYrden', JS_Active );
  11660.  
  11661. inv.AddAnItem( 'Geralt Shirt', 1 );
  11662. inv.AddAnItem( 'Thread', 13 );
  11663. inv.AddAnItem( 'String', 9 );
  11664. inv.AddAnItem( 'Linen', 4 );
  11665. inv.AddAnItem( 'Silk', 6 );
  11666. inv.AddAnItem( 'Nigredo', 3 );
  11667. inv.AddAnItem( 'Albedo', 1 );
  11668. inv.AddAnItem( 'Rubedo', 1 );
  11669. inv.AddAnItem( 'Rebis', 1 );
  11670. inv.AddAnItem( 'Dog tallow', 4 );
  11671. inv.AddAnItem( 'Lunar shards', 3 );
  11672. inv.AddAnItem( 'Quicksilver solution', 5 );
  11673. inv.AddAnItem( 'Aether', 1 );
  11674. inv.AddAnItem( 'Optima mater', 3 );
  11675. inv.AddAnItem( 'Fifth essence', 2 );
  11676. inv.AddAnItem( 'Hardened timber', 6 );
  11677. inv.AddAnItem( 'Fur square', 1 );
  11678. inv.AddAnItem( 'Leather straps', 11 );
  11679. inv.AddAnItem( 'Leather squares', 6 );
  11680. inv.AddAnItem( 'Leather', 3 );
  11681. inv.AddAnItem( 'Hardened leather', 14 );
  11682. inv.AddAnItem( 'Chitin scale', 8 );
  11683. inv.AddAnItem( 'Draconide leather', 5 );
  11684. inv.AddAnItem( 'Infused draconide leather', 0 );
  11685. inv.AddAnItem( 'Steel ingot', 5 );
  11686. inv.AddAnItem( 'Dark iron ore', 2 );
  11687. inv.AddAnItem( 'Dark iron ingot', 3 );
  11688. inv.AddAnItem( 'Dark iron plate', 1 );
  11689. inv.AddAnItem( 'Dark steel ingot', 10 );
  11690. inv.AddAnItem( 'Dark steel plate', 6 );
  11691. inv.AddAnItem( 'Silver ore', 2 );
  11692. inv.AddAnItem( 'Silver ingot', 6 );
  11693. inv.AddAnItem( 'Meteorite ore', 3 );
  11694. inv.AddAnItem( 'Meteorite ingot', 3 );
  11695. inv.AddAnItem( 'Meteorite plate', 2 );
  11696. inv.AddAnItem( 'Meteorite silver ingot', 6 );
  11697. inv.AddAnItem( 'Meteorite silver plate', 5 );
  11698. inv.AddAnItem( 'Orichalcum ingot', 0 );
  11699. inv.AddAnItem( 'Orichalcum plate', 1 );
  11700. inv.AddAnItem( 'Dwimeryte ingot', 6 );
  11701. inv.AddAnItem( 'Dwimeryte plate', 5 );
  11702. inv.AddAnItem( 'Dwimeryte enriched ingot', 0 );
  11703. inv.AddAnItem( 'Dwimeryte enriched plate', 0 );
  11704. inv.AddAnItem( 'Emerald dust', 0 );
  11705. inv.AddAnItem( 'Ruby dust', 4 );
  11706. inv.AddAnItem( 'Ruby', 2 );
  11707. inv.AddAnItem( 'Ruby flawless', 1 );
  11708. inv.AddAnItem( 'Sapphire dust', 0 );
  11709. inv.AddAnItem( 'Sapphire', 0 );
  11710. inv.AddAnItem( 'Monstrous brain', 8 );
  11711. inv.AddAnItem( 'Monstrous blood', 14 );
  11712. inv.AddAnItem( 'Monstrous bone', 9 );
  11713. inv.AddAnItem( 'Monstrous claw', 14 );
  11714. inv.AddAnItem( 'Monstrous dust', 9 );
  11715. inv.AddAnItem( 'Monstrous ear', 5 );
  11716. inv.AddAnItem( 'Monstrous egg', 1 );
  11717. inv.AddAnItem( 'Monstrous eye', 10 );
  11718. inv.AddAnItem( 'Monstrous essence', 7 );
  11719. inv.AddAnItem( 'Monstrous feather', 8 );
  11720. inv.AddAnItem( 'Monstrous hair', 12 );
  11721. inv.AddAnItem( 'Monstrous heart', 7 );
  11722. inv.AddAnItem( 'Monstrous hide', 4 );
  11723. inv.AddAnItem( 'Monstrous liver', 5 );
  11724. inv.AddAnItem( 'Monstrous plate', 1 );
  11725. inv.AddAnItem( 'Monstrous saliva', 6 );
  11726. inv.AddAnItem( 'Monstrous stomach', 3 );
  11727. inv.AddAnItem( 'Monstrous tongue', 5 );
  11728. inv.AddAnItem( 'Monstrous tooth', 9 );
  11729. inv.AddAnItem( 'Venom extract', 0 );
  11730. inv.AddAnItem( 'Siren vocal cords', 1 );
  11731.  
  11732.  
  11733. SelectQuickslotItem( EES_RangedWeapon );
  11734.  
  11735.  
  11736. FactsAdd( 'kill_base_tutorials' );
  11737.  
  11738.  
  11739. theGame.GetTutorialSystem().RemoveAllQueuedTutorials();
  11740.  
  11741.  
  11742. FactsAdd( 'standalone_ep2' );
  11743. FactsRemove( "StandAloneEP2" );
  11744.  
  11745. theGame.GetJournalManager().ForceUntrackingQuestForEP1Savegame();
  11746. }
  11747.  
  11748.  
  11749. private var radialPopupShown : bool;
  11750.  
  11751. private function ToggleRadialMenuInput(enable : bool)
  11752. {
  11753. var hud : CR4ScriptedHud;
  11754. var module : CR4HudModuleRadialMenu;
  11755.  
  11756. hud = ( CR4ScriptedHud )theGame.GetHud();
  11757.  
  11758. if ( hud )
  11759. {
  11760. module = (CR4HudModuleRadialMenu)hud.GetHudModule( "RadialMenuModule" );
  11761. if ( module )
  11762. {
  11763. module.DisableRadialMenuInput(!enable);
  11764. }
  11765. }
  11766. }
  11767. public function EnableRadialInput()
  11768. {
  11769. radialPopupShown = false;
  11770. AddTimer( 'EnableRadialMenuInput', 0.03f, false );
  11771. }
  11772.  
  11773. timer function EnableRadialMenuInput( delta : float , id : int)
  11774. {
  11775. ToggleRadialMenuInput(true);
  11776. }
  11777.  
  11778. timer function DrinkRadialPotionUpper( delta : float , id : int)
  11779. {
  11780. OnPotionDrinkInput(true);
  11781. GetInputHandler().SetRadialPotionUpperTimer(false);
  11782. }
  11783.  
  11784. timer function DrinkRadialPotionLower( delta : float , id : int)
  11785. {
  11786. OnPotionDrinkInput(false);
  11787. GetInputHandler().SetRadialPotionLowerTimer(false);
  11788. }
  11789.  
  11790. public function GetRadialPopupShown() : bool
  11791. {
  11792. return radialPopupShown;
  11793. }
  11794.  
  11795. public function PotionSelectionPopup( selectionMode : EItemSelectionPopupMode )
  11796. {
  11797. var cat : array<name>;
  11798. var m_popupData : W3ItemSelectionPopupData;
  11799.  
  11800. m_popupData = new W3ItemSelectionPopupData in theGame.GetGuiManager();
  11801. m_popupData.targetInventory = thePlayer.GetInventory();
  11802. m_popupData.overrideQuestItemRestrictions = true;
  11803.  
  11804. m_popupData.selectionMode = selectionMode;
  11805.  
  11806. cat.PushBack('potion');
  11807. cat.PushBack('edibles');
  11808. m_popupData.categoryFilterList = cat;
  11809.  
  11810. theGame.RequestPopup('ItemSelectionPopup', m_popupData);
  11811.  
  11812. ToggleRadialMenuInput(false);
  11813. radialPopupShown = true;
  11814. }
  11815.  
  11816. public function OilSelectionPopup( steel : bool )
  11817. {
  11818. var cat, tags : array<name>;
  11819. var m_popupData : W3ItemSelectionPopupData;
  11820.  
  11821. m_popupData = new W3ItemSelectionPopupData in theGame.GetGuiManager();
  11822. m_popupData.targetInventory = thePlayer.GetInventory();
  11823. m_popupData.overrideQuestItemRestrictions = true;
  11824.  
  11825. if(steel)
  11826. {
  11827. tags.PushBack('SteelOil');
  11828. m_popupData.selectionMode = EISPM_RadialMenuSteelOil;
  11829. }
  11830. else
  11831. {
  11832. tags.PushBack('SilverOil');
  11833. m_popupData.selectionMode = EISPM_RadialMenuSilverOil;
  11834. }
  11835. m_popupData.filterTagsList = tags;
  11836.  
  11837. cat.PushBack('oil');
  11838. m_popupData.categoryFilterList = cat;
  11839.  
  11840. theGame.RequestPopup('ItemSelectionPopup', m_popupData);
  11841.  
  11842. ToggleRadialMenuInput(false);
  11843. radialPopupShown = true;
  11844. }
  11845.  
  11846. private function CheckRadialMenu() : bool
  11847. {
  11848. var hud : CR4ScriptedHud;
  11849. var module : CR4HudModuleRadialMenu;
  11850.  
  11851. hud = ( CR4ScriptedHud )theGame.GetHud();
  11852.  
  11853. if ( hud )
  11854. {
  11855. module = (CR4HudModuleRadialMenu)hud.GetHudModule( "RadialMenuModule" );
  11856. if ( module )
  11857. {
  11858. return module.IsRadialMenuOpened();
  11859. }
  11860. }
  11861.  
  11862. return false;
  11863. }
  11864.  
  11865. //zur13 modSSS
  11866. public function SSS_GetEquippedMutationType() : array< EPlayerMutationType >
  11867. {
  11868. return ( ( W3PlayerAbilityManager ) abilityManager ).SSS_GetEquippedMutationType();
  11869. }
  11870.  
  11871. //zur13 modSSS mutTabs
  11872. public function SSS_FixEquippedMutagens()
  11873. {
  11874. var item : SItemUniqueId;
  11875. var i : int;
  11876. for( i = EES_SkillMutagen5 ; i < EES_SkillMutagen48; i=i+1 )
  11877. {
  11878. if( GetItemEquippedOnSlot( i, item ) )
  11879. {
  11880. inv.SetItemStackable( item, false );
  11881. }
  11882. }
  11883. }
  11884.  
  11885. //zur13 modSSS mutTabs
  11886. public function SSS_Patch_MutagenStacking(muts : array< SItemUniqueId >) : array< SItemUniqueId >
  11887. {
  11888. var i, j, quantity : int;
  11889. var item : SItemUniqueId;
  11890.  
  11891. for( i = EES_SkillMutagen5 ; i < EES_SkillMutagen48; i=i+1 )
  11892. {
  11893. if( GetItemEquippedOnSlot( i, item ) )
  11894. {
  11895. muts.Remove( item );
  11896. inv.SetItemStackable( item, false );
  11897. }
  11898. }
  11899. return muts;
  11900. }
  11901. }
  11902.  
  11903. exec function fuqfep1()
  11904. {
  11905. theGame.GetJournalManager().ForceUntrackingQuestForEP1Savegame();
  11906. }
  11907.  
  11908.  
  11909.  
  11910.  
  11911.  
  11912. function GetWitcherPlayer() : W3PlayerWitcher
  11913. {
  11914. return (W3PlayerWitcher)thePlayer;
  11915. }
  11916.  
Add Comment
Please, Sign In to add comment