Advertisement
Guest User

Untitled

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