Advertisement
Guest User

Untitled

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