Advertisement
gogetaemi94

Untitled

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