Guest User

Untitled

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