Gideon111

Error [mod0000_mergedfiles]game\player\playerwitcher.ws(12336): Found unexpected '}'

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