Guest User

Untitled

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