Advertisement
Guest User

Untitled

a guest
Jul 19th, 2020
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 398.58 KB | None | 0 0
  1. /***********************************************************************/
  2. /** © 2015 CD PROJEKT S.A. All rights reserved.
  3. /** THE WITCHER® is a trademark of CD PROJEKT S. A.
  4. /** The Witcher game is based on the prose of Andrzej Sapkowski.
  5. /***********************************************************************/
  6.  
  7.  
  8.  
  9.  
  10. statemachine class W3PlayerWitcher extends CR4Player
  11. {
  12.  
  13. var weatherControl : WeatherControl;
  14. private saved var craftingSchematics : array<name>;
  15. private saved var expandedCraftingCategories : array<name>;
  16. private saved var craftingFilters : SCraftingFilters;
  17.  
  18.  
  19. private saved var alchemyRecipes : array<name>;
  20. private saved var expandedAlchemyCategories : array<name>;
  21. private saved var alchemyFilters : SCraftingFilters;
  22.  
  23. // -= WMK:modAQOOM =-
  24. public saved var wmkMapMenuData : WmkMapMenuData;
  25. public var wmkMapMenu : WmkMapMenuEx;
  26. // -= WMK:modAQOOM =-
  27.  
  28. private saved var expandedBestiaryCategories : array<name>;
  29.  
  30.  
  31. private saved var booksRead : array<name>;
  32.  
  33. private saved var enemiesKilledByType : array<int>; //modSigns
  34.  
  35.  
  36. //---=== modFriendlyMeditation ===---
  37. public var fMeditationConfig : CModFMeditationConfig;
  38. //---=== modFriendlyMeditation ===---
  39.  
  40. private var fastAttackCounter, heavyAttackCounter : int;
  41. private var isInFrenzy : bool;
  42. private var hasRecentlyCountered : bool;
  43. //private saved var cannotUseUndyingSkill : bool;
  44.  
  45.  
  46. protected saved var amountOfSetPiecesEquipped : array<int>;
  47.  
  48.  
  49. //---=== modFriendlyMeditation ===---
  50. var spawnedCampFire : W3Campfire;
  51. var fmedCanSpawnCampfire : bool;
  52. default fmedCanSpawnCampfire = true;
  53. var fmedAutorefillAlchemy : bool;
  54. default fmedAutorefillAlchemy = true;
  55. var fmedRefillIntervalSeconds : float;
  56. default fmedRefillIntervalSeconds = 3600.0;
  57. var fmedApplyWitcherHouseBuffs : bool;
  58. default fmedApplyWitcherHouseBuffs = true;
  59. var fmedWitcherHouseBuffsHours : int;
  60. default fmedWitcherHouseBuffsHours = 1;
  61. //---=== modFriendlyMeditation ===---
  62.  
  63.  
  64. public var canSwitchFocusModeTarget : bool;
  65. protected var switchFocusModeTargetAllowed : bool;
  66. default canSwitchFocusModeTarget = true;
  67. default switchFocusModeTargetAllowed = true;
  68.  
  69.  
  70. private editable var signs : array< SWitcherSign >;
  71. private saved var equippedSign : ESignType;
  72. private var currentlyCastSign : ESignType; default currentlyCastSign = ST_None;
  73. private var signOwner : W3SignOwnerPlayer;
  74. private var usedQuenInCombat : bool;
  75. public var yrdenEntities : array<W3YrdenEntity>;
  76. public saved var m_quenReappliedCount : int;
  77. public saved var m_quickInventorySaveData : WmkQuickInventorySaveData; // -= WMK:modQuickSlots =-
  78.  
  79. default equippedSign = ST_Aard;
  80. default m_quenReappliedCount = 1;
  81.  
  82.  
  83.  
  84. private var bDispalyHeavyAttackIndicator : bool;
  85. private var bDisplayHeavyAttackFirstLevelTimer : bool;
  86. public var specialAttackHeavyAllowed : bool;
  87.  
  88. default bIsCombatActionAllowed = true;
  89. default bDispalyHeavyAttackIndicator = false;
  90. default bDisplayHeavyAttackFirstLevelTimer = true;
  91.  
  92. //modFriendlyStash begin
  93. public var fStashConfig : CModFriendlyStashConfig;
  94. //modFriendlyStash end
  95.  
  96.  
  97.  
  98. default explorationInputContext = 'Exploration';
  99. default combatInputContext = 'Combat';
  100. default combatFistsInputContext = 'Combat';
  101.  
  102.  
  103. private saved var companionNPCTag : name;
  104. private saved var companionNPCTag2 : name;
  105.  
  106. private saved var companionNPCIconPath : string;
  107. private saved var companionNPCIconPath2 : string;
  108.  
  109.  
  110. private saved var itemSlots : array<SItemUniqueId>;
  111. private var remainingBombThrowDelaySlot1 : float;
  112. private var remainingBombThrowDelaySlot2 : float;
  113. private var previouslyUsedBolt : SItemUniqueId;
  114. private saved var questMarkedSelectedQuickslotItems : array< SSelectedQuickslotItem >;
  115.  
  116. default isThrowingItem = false;
  117. default remainingBombThrowDelaySlot1 = 0.f;
  118. default remainingBombThrowDelaySlot2 = 0.f;
  119.  
  120.  
  121.  
  122.  
  123.  
  124. private saved var tempLearnedSignSkills : array<SSimpleSkill>;
  125. public saved var autoLevel : bool;
  126.  
  127.  
  128.  
  129.  
  130. protected saved var skillBonusPotionEffect : CBaseGameplayEffect;
  131.  
  132.  
  133. public saved var levelManager : W3LevelManager;
  134.  
  135. //---=== modFriendlyHUD ===---
  136. public var prepDisallowOilsInCombat : bool; default prepDisallowOilsInCombat = false;
  137. public var prepOilsHaveAmmo : bool; default prepOilsHaveAmmo = false;
  138. //---=== modFriendlyHUD ===---
  139.  
  140.  
  141. saved var reputationManager : W3Reputation;
  142.  
  143.  
  144. private editable var medallionEntity : CEntityTemplate;
  145. private var medallionController : W3MedallionController;
  146.  
  147.  
  148.  
  149.  
  150. public var bShowRadialMenu : bool;
  151.  
  152. private var _HoldBeforeOpenRadialMenuTime : float;
  153.  
  154. default _HoldBeforeOpenRadialMenuTime = 0.5f;
  155.  
  156. public var MappinToHighlight : array<SHighlightMappin>;
  157.  
  158.  
  159. protected saved var horseManagerHandle : EntityHandle;
  160.  
  161.  
  162. private var isInitialized : bool;
  163. private var timeForPerk21 : float;
  164.  
  165. default isInitialized = false;
  166.  
  167.  
  168. //AMM
  169. var vAMM : CAMM;
  170. //AMM
  171.  
  172. //Ice Breath
  173. var iceBreath : CIceBreath;
  174. var enableIceBreath : bool; default enableIceBreath = false;
  175. //Ice Breath*/
  176.  
  177. private var invUpdateTransaction : bool;
  178. default invUpdateTransaction = false;
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191. event OnSpawned( spawnData : SEntitySpawnData )
  192. {
  193. var i : int;
  194. var items : array<SItemUniqueId>;
  195. var items2 : array<SItemUniqueId>;
  196. var horseTemplate : CEntityTemplate;
  197. var horseManager : W3HorseManager;
  198.  
  199. AddAnimEventCallback( 'ActionBlend', 'OnAnimEvent_ActionBlend' );
  200. AddAnimEventCallback('cast_begin', 'OnAnimEvent_Sign');
  201. AddAnimEventCallback('cast_throw', 'OnAnimEvent_Sign');
  202. AddAnimEventCallback('cast_end', 'OnAnimEvent_Sign');
  203. AddAnimEventCallback('cast_friendly_begin', 'OnAnimEvent_Sign');
  204. AddAnimEventCallback('cast_friendly_throw', 'OnAnimEvent_Sign');
  205. AddAnimEventCallback('axii_ready', 'OnAnimEvent_Sign');
  206. AddAnimEventCallback('axii_alternate_ready', 'OnAnimEvent_Sign');
  207. AddAnimEventCallback('yrden_draw_ready', 'OnAnimEvent_Sign');
  208.  
  209. AddAnimEventCallback( 'ProjectileThrow', 'OnAnimEvent_Throwable' );
  210. AddAnimEventCallback( 'OnWeaponReload', 'OnAnimEvent_Throwable' );
  211. AddAnimEventCallback( 'ProjectileAttach', 'OnAnimEvent_Throwable' );
  212. AddAnimEventCallback( 'Mutation11AnimEnd', 'OnAnimEvent_Mutation11AnimEnd' );
  213. AddAnimEventCallback( 'Mutation11ShockWave', 'OnAnimEvent_Mutation11ShockWave' );
  214.  
  215. spawnMyLovelyStashes(); // Additional Stash Locations
  216.  
  217. amountOfSetPiecesEquipped.Resize( EnumGetMax( 'EItemSetType' ) + 1 );
  218.  
  219. runewordInfusionType = ST_None;
  220.  
  221.  
  222. inv = GetInventory();
  223.  
  224.  
  225. signOwner = new W3SignOwnerPlayer in this;
  226. signOwner.Init( this );
  227.  
  228. itemSlots.Resize( EnumGetMax('EEquipmentSlots')+1 );
  229.  
  230. //modSigns
  231. if( FactsQuerySum("ModSignsRecipesAdded") < 1 )
  232. {
  233. AddAlchemyRecipe('Recipe for Tawny Owl 1', true, true); // fix missing Tawny Owl recipe
  234. AddCraftingSchematic('Meteorite plate schematic', true, true); //add missing meteorite plate schematic
  235. FactsAdd("ModSignsRecipesAdded");
  236. }
  237.  
  238. FactsRemove("player_had_quen"); //remove, no need for this and never was
  239.  
  240. //modSigns
  241. if( FactsQuerySum("ModSignsKMSetSchematicsAdded") < 1 )
  242. {
  243. AddCraftingSchematic('Kaer Morhen Armor 1 schematic',true, true);
  244. AddCraftingSchematic('Kaer Morhen Armor 2 schematic',true, true);
  245. AddCraftingSchematic('Kaer Morhen Armor 3 schematic',true, true);
  246. AddCraftingSchematic('Kaer Morhen Pants schematic',true, true);
  247. AddCraftingSchematic('Kaer Morhen Pants 1 schematic',true, true);
  248. AddCraftingSchematic('Kaer Morhen Pants 2 schematic',true, true);
  249. AddCraftingSchematic('Kaer Morhen Pants 3 schematic',true, true);
  250. AddCraftingSchematic('Kaer Morhen Boots schematic',true, true);
  251. AddCraftingSchematic('Kaer Morhen Boots 1 schematic',true, true);
  252. AddCraftingSchematic('Kaer Morhen Boots 2 schematic',true, true);
  253. AddCraftingSchematic('Kaer Morhen Boots 3 schematic',true, true);
  254. AddCraftingSchematic('Kaer Morhen Gloves schematic',true, true);
  255. AddCraftingSchematic('Kaer Morhen Gloves 1 schematic',true, true);
  256. AddCraftingSchematic('Kaer Morhen Gloves 2 schematic',true, true);
  257. AddCraftingSchematic('Kaer Morhen Gloves 3 schematic',true, true);
  258. FactsAdd("ModSignsKMSetSchematicsAdded");
  259. }
  260.  
  261. if(!spawnData.restored)
  262. {
  263. levelManager = new W3LevelManager in this;
  264. levelManager.Initialize();
  265.  
  266.  
  267. inv.GetAllItems(items);
  268. for(i=0; i<items.Size(); i+=1)
  269. {
  270. if(inv.IsItemMounted(items[i]) && ( !inv.IsItemBody(items[i]) || inv.GetItemCategory(items[i]) == 'hair' ) )
  271. EquipItem(items[i]);
  272. }
  273.  
  274.  
  275.  
  276.  
  277.  
  278. AddAlchemyRecipe('Recipe for Swallow 1',true,true);
  279. AddAlchemyRecipe('Recipe for Cat 1',true,true);
  280. AddAlchemyRecipe('Recipe for White Honey 1',true,true);
  281.  
  282. AddAlchemyRecipe('Recipe for Samum 1',true,true);
  283. AddAlchemyRecipe('Recipe for Grapeshot 1',true,true);
  284.  
  285. AddAlchemyRecipe('Recipe for Specter Oil 1',true,true);
  286. AddAlchemyRecipe('Recipe for Necrophage Oil 1',true,true);
  287. AddAlchemyRecipe('Recipe for Alcohest 1',true,true);
  288. }
  289. else
  290. {
  291. AddTimer('DelayedOnItemMount', 0.1, true);
  292.  
  293.  
  294. CheckHairItem();
  295. }
  296.  
  297.  
  298. AddStartingSchematics();
  299.  
  300. super.OnSpawned( spawnData );
  301.  
  302.  
  303. AddAlchemyRecipe('Recipe for Mutagen red',true,true);
  304. AddAlchemyRecipe('Recipe for Mutagen green',true,true);
  305. AddAlchemyRecipe('Recipe for Mutagen blue',true,true);
  306. AddAlchemyRecipe('Recipe for Greater mutagen red',true,true);
  307. AddAlchemyRecipe('Recipe for Greater mutagen green',true,true);
  308. AddAlchemyRecipe('Recipe for Greater mutagen blue',true,true);
  309.  
  310. AddCraftingSchematic('Starting Armor Upgrade schematic 1',true,true);
  311.  
  312.  
  313. if( inputHandler )
  314. {
  315. inputHandler.BlockAllActions( 'being_ciri', false );
  316. }
  317. SetBehaviorVariable( 'test_ciri_replacer', 0.0f);
  318.  
  319. if(!spawnData.restored)
  320. {
  321.  
  322. abilityManager.GainStat(BCS_Toxicity, 0);
  323. }
  324.  
  325. levelManager.PostInit(this, spawnData.restored, true);
  326.  
  327. SetBIsCombatActionAllowed( true );
  328. SetBIsInputAllowed( true, 'OnSpawned' );
  329.  
  330.  
  331. if ( !reputationManager )
  332. {
  333. reputationManager = new W3Reputation in this;
  334. reputationManager.Initialize();
  335. }
  336.  
  337. theSound.SoundParameter( "focus_aim", 1.0f, 1.0f );
  338. theSound.SoundParameter( "focus_distance", 0.0f, 1.0f );
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345. currentlyCastSign = ST_None;
  346.  
  347.  
  348. if(!spawnData.restored)
  349. {
  350. horseTemplate = (CEntityTemplate)LoadResource("horse_manager");
  351. horseManager = (W3HorseManager)theGame.CreateEntity(horseTemplate, GetWorldPosition(),,,,,PM_Persist);
  352. horseManager.CreateAttachment(this);
  353. horseManager.OnCreated();
  354. EntityHandleSet( horseManagerHandle, horseManager );
  355. }
  356. //else //modFriendlyStash
  357. //{
  358. // AddTimer('DelayedHorseUpdate', 0.01, true);
  359. //}
  360.  
  361. //---=== modFriendlyMeditation ===---
  362. fMeditationConfig = new CModFMeditationConfig in this;
  363. fMeditationConfig.Init();
  364. //---=== modFriendlyMeditation ===---
  365.  
  366.  
  367. RemoveAbility('Ciri_CombatRegen');
  368. RemoveAbility('Ciri_Rage');
  369. RemoveAbility('CiriBlink');
  370. RemoveAbility('CiriCharge');
  371. RemoveAbility('Ciri_Q205');
  372. RemoveAbility('Ciri_Q305');
  373. RemoveAbility('Ciri_Q403');
  374. RemoveAbility('Ciri_Q111');
  375. RemoveAbility('Ciri_Q501');
  376. RemoveAbility('SkillCiri');
  377.  
  378. //modSigns: remove passive bonuses
  379. RemoveAbilityAll('sword_adrenalinegain');
  380. RemoveAbilityAll('magic_staminaregen');
  381. RemoveAbilityAll('alchemy_potionduration');
  382.  
  383. /*if(spawnData.restored)
  384. {
  385. RestoreQuen(savedQuenHealth, savedQuenDuration);
  386. }
  387. else
  388. {
  389. savedQuenHealth = 0.f;
  390. savedQuenDuration = 0.f;
  391. }*/ //modSigns: removed, params aren't saved properly anyway
  392. savedQuenHealth = 0.f;
  393. savedQuenDuration = 0.f;
  394.  
  395. if(spawnData.restored)
  396. {
  397. ApplyPatchFixes();
  398. }
  399. else
  400. {
  401.  
  402. FactsAdd( "new_game_started_in_1_20" );
  403. }
  404.  
  405. if ( spawnData.restored )
  406. {
  407. FixEquippedMutagens();
  408. }
  409.  
  410. //modFriendlyStash begin
  411. fStashConfig = new CModFriendlyStashConfig in this;
  412. fStashConfig.Init();
  413. //modFriendlyStash end
  414.  
  415. if ( FactsQuerySum("NewGamePlus") > 0 )
  416. {
  417. NewGamePlusAdjustDLC1TemerianSet(inv);
  418. NewGamePlusAdjustDLC5NilfgardianSet(inv);
  419. NewGamePlusAdjustDLC10WolfSet(inv);
  420. NewGamePlusAdjustDLC14SkelligeSet(inv);
  421. if(horseManager)
  422. {
  423. NewGamePlusAdjustDLC1TemerianSet(horseManager.GetInventoryComponent());
  424. NewGamePlusAdjustDLC5NilfgardianSet(horseManager.GetInventoryComponent());
  425. NewGamePlusAdjustDLC10WolfSet(horseManager.GetInventoryComponent());
  426. NewGamePlusAdjustDLC14SkelligeSet(horseManager.GetInventoryComponent());
  427. }
  428. }
  429.  
  430. //modSigns: load sound banks for mutations
  431. ((W3PlayerAbilityManager)abilityManager).LoadCurrentMutationSoundBank();
  432. //modSigns: load sound banks for sets
  433. LoadCurrentSetBonusSoundbank();
  434. //modSigns: add mutation trigger recipe
  435. if(IsMutationResearched(EPMT_Mutation11) || IsMutationResearched(EPMT_Mutation12))
  436. {
  437. if(!alchemyRecipes.Contains('Recipe for Mutation Trigger'))
  438. AddAlchemyRecipe('Recipe for Mutation Trigger', true, true);
  439. }
  440.  
  441.  
  442. ResumeStaminaRegen('WhirlSkill');
  443. ResumeStaminaRegen('RendSkill'); //modSigns
  444. ResumeStaminaRegen('IsPerformingFinisher'); //modSigns
  445.  
  446. ResumeHPRegenEffects('FistFightMinigame'); //modSigns
  447.  
  448. if(HasRunewordActive('Runeword 4 _Stats')) //modSigns
  449. StartVitalityRegen();
  450.  
  451. if(HasAbility('sword_s19'))
  452. {
  453. RemoveTemporarySkills();
  454. }
  455.  
  456. //HACK_UnequipWolfLiver(); //modSigns
  457.  
  458. if( enemiesKilledByType.Size() == 0 )
  459. {
  460. enemiesKilledByType.Resize(EENT_MAX_TYPES);
  461. }
  462.  
  463.  
  464. if( HasBuff( EET_GryphonSetBonusYrden ) )
  465. {
  466. RemoveBuff( EET_GryphonSetBonusYrden, false, "GryphonSetBonusYrden" );
  467. }
  468.  
  469. if( HasBuff( EET_GryphonSetBonus ) ) //modSigns: remove on spawn
  470. {
  471. RemoveBuff( EET_GryphonSetBonus );
  472. }
  473.  
  474. if( HasBuff(EET_KaerMorhenSetBonus) ) //modSigns: remove on spawn
  475. {
  476. RemoveBuff(EET_KaerMorhenSetBonus);
  477. }
  478.  
  479. if( HasBuff( EET_Aerondight ) ) //modSigns: remove Aerondight effect
  480. RemoveBuff( EET_Aerondight );
  481.  
  482. if( HasBuff( EET_PhantomWeapon ) ) //modSigns: remove Iris effect
  483. RemoveBuff( EET_PhantomWeapon );
  484.  
  485. RemoveBuff(EET_Runeword4); //modSigns
  486. RemoveBuff(EET_Runeword11); //modSigns
  487. RemoveAbilityAll('Glyphword 14 _Stats'); //modSigns
  488. RemoveAbilityAll('Glyphword 10 _Stats'); //modSigns
  489.  
  490. //modSigns
  491. if( FactsQuerySum("standalone_ep1") > 0 && FactsQuerySum("standalone_ep1_inv") < 1 )
  492. {
  493. AddTimer('GiveStandAloneEP1Items', 0.00001, true, , , true);
  494. }
  495. //modSigns
  496. if( FactsQuerySum("standalone_ep2") > 0 && FactsQuerySum("standalone_ep2_inv") < 1 )
  497. {
  498. AddTimer('GiveStandAloneEP2Items', 0.00001, true, , , true);
  499. }
  500.  
  501. if( spawnData.restored )
  502. {
  503.  
  504. //UpdateEncumbrance(); //modFriendlyStash
  505. AddTimer('DelayedEncumbranceUpdate', 0.1, true); //modFriendlyStash
  506.  
  507.  
  508. RemoveBuff( EET_Mutation11Immortal );
  509. RemoveBuff( EET_Mutation11Buff );
  510.  
  511. //modSigns:
  512. RemoveBuff( EET_UndyingSkillImmortal );
  513. }
  514.  
  515.  
  516. theGame.GameplayFactsAdd( "PlayerIsGeralt" );
  517.  
  518. // -= WMK:modQuickSlots =-
  519. if (WmkGetQuickInventoryInstance()) {
  520. WmkGetQuickInventoryInstance().OnPlayerWitcherSpawned();
  521. }
  522. // -= WMK:modQuickSlots =-
  523.  
  524. isInitialized = true;
  525.  
  526. //AMM
  527. vAMM = new CAMM in this;
  528. AddTimer('InitAMM', 2.0, false);
  529. //AMM
  530.  
  531.  
  532.  
  533.  
  534. weatherControl = new WeatherControl in this;
  535. weatherControl.Init();
  536.  
  537. }
  538.  
  539. //Ice Breath
  540. iceBreath = new CIceBreath in this;
  541. AddTimer('IceBreathTimer',5.0,true);
  542. //Ice Breath*/
  543.  
  544.  
  545.  
  546. //AMM+
  547. timer function InitAMM(dt : float, id : int)
  548. {
  549.  
  550. vAMM.Init();
  551.  
  552. }
  553.  
  554. public function GetAMM() : CAMM
  555. {
  556.  
  557. return this.vAMM;
  558. }
  559. //AMM-
  560.  
  561.  
  562.  
  563. private function HACK_UnequipWolfLiver()
  564. {
  565. var itemName1, itemName2, itemName3, itemName4 : name;
  566. var item1, item2, item3, item4 : SItemUniqueId;
  567.  
  568. GetItemEquippedOnSlot( EES_Potion1, item1 );
  569. GetItemEquippedOnSlot( EES_Potion2, item2 );
  570. GetItemEquippedOnSlot( EES_Potion3, item3 );
  571. GetItemEquippedOnSlot( EES_Potion4, item4 );
  572.  
  573. if ( inv.IsIdValid( item1 ) )
  574. itemName1 = inv.GetItemName( item1 );
  575. if ( inv.IsIdValid( item2 ) )
  576. itemName2 = inv.GetItemName( item2 );
  577. if ( inv.IsIdValid( item3 ) )
  578. itemName3 = inv.GetItemName( item3 );
  579. if ( inv.IsIdValid( item4 ) )
  580. itemName4 = inv.GetItemName( item4 );
  581.  
  582. if ( itemName1 == 'Wolf liver' || itemName3 == 'Wolf liver' )
  583. {
  584. if ( inv.IsIdValid( item1 ) )
  585. UnequipItem( item1 );
  586. if ( inv.IsIdValid( item3 ) )
  587. UnequipItem( item3 );
  588. }
  589. else if ( itemName2 == 'Wolf liver' || itemName4 == 'Wolf liver' )
  590. {
  591. if ( inv.IsIdValid( item2 ) )
  592. UnequipItem( item2 );
  593. if ( inv.IsIdValid( item4 ) )
  594. UnequipItem( item4 );
  595. }
  596. }
  597.  
  598. public function IncKills( et : EEnemyType ) //modSigns
  599. {
  600. enemiesKilledByType[et] += 1;
  601. //theGame.witcherLog.AddMessage(et + ": " + enemiesKilledByType[et]);
  602. }
  603.  
  604. public function GetKills( et : EEnemyType ) : int //modSigns
  605. {
  606. return enemiesKilledByType[et];
  607. }
  608.  
  609. public function GetExpModifierByEnemyType( et : EEnemyType ) : float //modSigns
  610. {
  611. switch(et)
  612. {
  613. case EENT_BOSS:
  614. return 1;
  615. case EENT_GENERIC:
  616. case EENT_ANIMAL:
  617. return 0;
  618. default:
  619. return 1 - MinF(100.0f, (float)GetKills(et))/100.0f;
  620. }
  621. }
  622.  
  623.  
  624.  
  625.  
  626.  
  627. timer function DelayedHorseUpdate( dt : float, id : int )
  628. {
  629. var man : W3HorseManager;
  630.  
  631. man = GetHorseManager();
  632. if(man)
  633. {
  634. if ( man.ApplyHorseUpdateOnSpawn() )
  635. {
  636.  
  637. UpdateEncumbrance();
  638.  
  639. RemoveTimer( 'DelayedHorseUpdate' );
  640. }
  641. }
  642. }
  643.  
  644. //modFriendlyStash begin
  645. timer function DelayedEncumbranceUpdate( dt : float, id : int )
  646. {
  647. if( !GetInventory() )
  648. return;
  649.  
  650. UpdateEncumbrance();
  651. RemoveTimer( 'DelayedEncumbranceUpdate' );
  652. }
  653. //modFriendlyStash end
  654.  
  655. event OnAbilityAdded( abilityName : name)
  656. {
  657. super.OnAbilityAdded(abilityName);
  658.  
  659. if( HasRunewordActive('Runeword 4 _Stats') ) //modSigns
  660. {
  661. StartVitalityRegen();
  662. }
  663.  
  664. if ( abilityName == 'Runeword 8 _Stats' && GetStat(BCS_Focus, true) >= GetStatMax(BCS_Focus) && !HasBuff(EET_Runeword8) ) //modSigns
  665. {
  666. AddEffectDefault(EET_Runeword8, this, "equipped item");
  667. }
  668.  
  669. }
  670.  
  671. private final function AddStartingSchematics()
  672. {
  673. AddCraftingSchematic('Starting Armor Upgrade schematic 1', true,true);
  674. AddCraftingSchematic('Thread schematic', true, true);
  675. AddCraftingSchematic('String schematic', true, true);
  676. AddCraftingSchematic('Linen schematic', true, true);
  677. AddCraftingSchematic('Silk schematic', true, true);
  678. AddCraftingSchematic('Resin schematic', true, true);
  679. AddCraftingSchematic('Blasting powder schematic', true, true);
  680. AddCraftingSchematic('Haft schematic', true, true);
  681. AddCraftingSchematic('Hardened timber schematic', true, true);
  682. AddCraftingSchematic('Leather squares schematic', true, true);
  683. AddCraftingSchematic('Leather schematic', true, true);
  684. AddCraftingSchematic('Hardened leather schematic', true, true);
  685. AddCraftingSchematic('Draconide leather schematic', true, true);
  686. AddCraftingSchematic('Iron ingot schematic', true, true);
  687. AddCraftingSchematic('Steel ingot schematic', true, true);
  688. AddCraftingSchematic('Steel ingot schematic 1', true, true);
  689. AddCraftingSchematic('Steel plate schematic', true, true);
  690. AddCraftingSchematic('Dark iron ingot schematic', true, true);
  691. AddCraftingSchematic('Dark iron plate schematic', true, true);
  692. AddCraftingSchematic('Dark steel ingot schematic', true, true);
  693. AddCraftingSchematic('Dark steel ingot schematic 1', true, true);
  694. AddCraftingSchematic('Dark steel plate schematic', true, true);
  695. AddCraftingSchematic('Silver ore schematic', true, true);
  696. AddCraftingSchematic('Silver ingot schematic', true, true);
  697. AddCraftingSchematic('Silver ingot schematic 1', true, true);
  698. AddCraftingSchematic('Silver plate schematic', true, true);
  699. AddCraftingSchematic('Meteorite ingot schematic', true, true);
  700. AddCraftingSchematic('Meteorite silver ingot schematic', true, true);
  701. AddCraftingSchematic('Meteorite silver plate schematic', true, true);
  702. AddCraftingSchematic('Glowing ingot schematic', true, true);
  703. AddCraftingSchematic('Dwimeryte ore schematic', true, true);
  704. AddCraftingSchematic('Dwimeryte ingot schematic', true, true);
  705. AddCraftingSchematic('Dwimeryte ingot schematic 1', true, true);
  706. AddCraftingSchematic('Dwimeryte plate schematic', true, true);
  707. AddCraftingSchematic('Infused dust schematic', true, true);
  708. AddCraftingSchematic('Infused shard schematic', true, true);
  709. AddCraftingSchematic('Infused crystal schematic', true, true);
  710.  
  711. if ( theGame.GetDLCManager().IsEP2Available() )
  712. {
  713. AddCraftingSchematic('Draconide infused leather schematic', true, true);
  714. AddCraftingSchematic('Nickel ore schematic', true, true);
  715. AddCraftingSchematic('Cupronickel ore schematic', true, true);
  716. AddCraftingSchematic('Copper ore schematic', true, true);
  717. AddCraftingSchematic('Copper ingot schematic', true, true);
  718. AddCraftingSchematic('Copper plate schematic', true, true);
  719. AddCraftingSchematic('Green gold ore schematic', true, true);
  720. AddCraftingSchematic('Green gold ore schematic 1', true, true);
  721. AddCraftingSchematic('Green gold ingot schematic', true, true);
  722. AddCraftingSchematic('Green gold plate schematic', true, true);
  723. AddCraftingSchematic('Orichalcum ore schematic', true, true);
  724. AddCraftingSchematic('Orichalcum ore schematic 1', true, true);
  725. AddCraftingSchematic('Orichalcum ingot schematic', true, true);
  726. AddCraftingSchematic('Orichalcum plate schematic', true, true);
  727. AddCraftingSchematic('Dwimeryte enriched ore schematic', true, true);
  728. AddCraftingSchematic('Dwimeryte enriched ingot schematic', true, true);
  729. AddCraftingSchematic('Dwimeryte enriched plate schematic', true, true);
  730. }
  731. }
  732.  
  733. private final function ApplyPatchFixes()
  734. {
  735. var cnt, transmutationCount, mutagenCount, i, slot : int;
  736. var transmutationAbility, itemName : name;
  737. var pam : W3PlayerAbilityManager;
  738. var slotId : int;
  739. var offset : float;
  740. var buffs : array<CBaseGameplayEffect>;
  741. var mutagen : W3Mutagen_Effect;
  742. var skill : SSimpleSkill;
  743. var spentSkillPoints, swordSkillPointsSpent, alchemySkillPointsSpent, perkSkillPointsSpent, pointsToAdd : int;
  744. var mutagens : array< W3Mutagen_Effect >;
  745.  
  746. /*if(FactsQuerySum("ClearingPotionPassiveBonusFix") < 1)
  747. {
  748. pam = (W3PlayerAbilityManager)abilityManager;
  749.  
  750. cnt = GetAbilityCount('sword_adrenalinegain') - pam.GetPathPointsSpent(ESP_Sword);
  751. if(cnt > 0)
  752. RemoveAbilityMultiple('sword_adrenalinegain', cnt);
  753.  
  754. cnt = GetAbilityCount('magic_staminaregen') - pam.GetPathPointsSpent(ESP_Signs);
  755. if(cnt > 0)
  756. RemoveAbilityMultiple('magic_staminaregen', cnt);
  757.  
  758. cnt = GetAbilityCount('alchemy_potionduration') - pam.GetPathPointsSpent(ESP_Alchemy);
  759. if(cnt > 0)
  760. RemoveAbilityMultiple('alchemy_potionduration', cnt);
  761.  
  762. FactsAdd("ClearingPotionPassiveBonusFix");
  763. }*/ //modSigns
  764.  
  765.  
  766. if(FactsQuerySum("DimeritiumSynergyFix") < 1)
  767. {
  768. slotId = GetSkillSlotID(S_Alchemy_s19);
  769. if(slotId != -1)
  770. UnequipSkill(S_Alchemy_s19);
  771.  
  772. RemoveAbilityAll('greater_mutagen_color_green_synergy_bonus');
  773. RemoveAbilityAll('mutagen_color_green_synergy_bonus');
  774. RemoveAbilityAll('mutagen_color_lesser_green_synergy_bonus');
  775.  
  776. RemoveAbilityAll('greater_mutagen_color_blue_synergy_bonus');
  777. RemoveAbilityAll('mutagen_color_blue_synergy_bonus');
  778. RemoveAbilityAll('mutagen_color_lesser_blue_synergy_bonus');
  779.  
  780. RemoveAbilityAll('greater_mutagen_color_red_synergy_bonus');
  781. RemoveAbilityAll('mutagen_color_red_synergy_bonus');
  782. RemoveAbilityAll('mutagen_color_lesser_red_synergy_bonus');
  783.  
  784. if(slotId != -1)
  785. EquipSkill(S_Alchemy_s19, slotId);
  786.  
  787. FactsAdd("DimeritiumSynergyFix");
  788. }
  789.  
  790.  
  791. if(FactsQuerySum("DontShowRecipePinTut") < 1)
  792. {
  793. FactsAdd( "DontShowRecipePinTut" );
  794. TutorialScript('alchemyRecipePin', '');
  795. TutorialScript('craftingRecipePin', '');
  796. }
  797.  
  798.  
  799. if(FactsQuerySum("LevelReqPotGiven") < 1)
  800. {
  801. FactsAdd("LevelReqPotGiven");
  802. inv.AddAnItem('Wolf Hour', 1, false, false, true);
  803. }
  804.  
  805.  
  806. if(!HasBuff(EET_AutoStaminaRegen))
  807. {
  808. AddEffectDefault(EET_AutoStaminaRegen, this, 'autobuff', false);
  809. }
  810.  
  811.  
  812.  
  813. buffs = GetBuffs();
  814. offset = 0;
  815. mutagenCount = 0;
  816. for(i=0; i<buffs.Size(); i+=1)
  817. {
  818. mutagen = (W3Mutagen_Effect)buffs[i];
  819. if(mutagen)
  820. {
  821. offset += mutagen.GetToxicityOffset();
  822. mutagenCount += 1;
  823. }
  824. }
  825.  
  826.  
  827. if(offset != (GetStat(BCS_Toxicity) - GetStat(BCS_Toxicity, true)))
  828. SetToxicityOffset(offset);
  829.  
  830.  
  831. /*mutagenCount *= GetSkillLevel(S_Alchemy_s13);
  832. transmutationAbility = GetSkillAbilityName(S_Alchemy_s13);
  833. transmutationCount = GetAbilityCount(transmutationAbility);
  834. if(mutagenCount < transmutationCount)
  835. {
  836. RemoveAbilityMultiple(transmutationAbility, transmutationCount - mutagenCount);
  837. }
  838. else if(mutagenCount > transmutationCount)
  839. {
  840. AddAbilityMultiple(transmutationAbility, mutagenCount - transmutationCount);
  841. }*/
  842. RecalcTransmutationAbilities(); //modSigns
  843.  
  844.  
  845. if(theGame.GetDLCManager().IsEP1Available())
  846. {
  847. theGame.GetJournalManager().ActivateEntryByScriptTag('TutorialJournalEnchanting', JS_Active);
  848. }
  849.  
  850.  
  851. if(HasAbility('sword_s19') && FactsQuerySum("Patch_Sword_s19") < 1)
  852. {
  853. pam = (W3PlayerAbilityManager)abilityManager;
  854.  
  855.  
  856. skill.level = 0;
  857. for(i = S_Magic_s01; i <= S_Magic_s20; i+=1)
  858. {
  859. skill.skillType = i;
  860. pam.RemoveTemporarySkill(skill);
  861. }
  862.  
  863.  
  864. spentSkillPoints = levelManager.GetPointsUsed(ESkillPoint);
  865. swordSkillPointsSpent = pam.GetPathPointsSpent(ESP_Sword);
  866. alchemySkillPointsSpent = pam.GetPathPointsSpent(ESP_Alchemy);
  867. perkSkillPointsSpent = pam.GetPathPointsSpent(ESP_Perks);
  868.  
  869. pointsToAdd = spentSkillPoints - swordSkillPointsSpent - alchemySkillPointsSpent - perkSkillPointsSpent;
  870. if(pointsToAdd > 0)
  871. levelManager.UnspendPoints(ESkillPoint, pointsToAdd);
  872.  
  873.  
  874. RemoveAbilityAll('sword_s19');
  875.  
  876.  
  877. FactsAdd("Patch_Sword_s19");
  878. }
  879.  
  880.  
  881. if( HasAbility( 'sword_s19' ) )
  882. {
  883. RemoveAbilityAll( 'sword_s19' );
  884. }
  885.  
  886.  
  887. if(FactsQuerySum("Patch_Armor_Type_Glyphwords") < 1)
  888. {
  889. pam = (W3PlayerAbilityManager)abilityManager;
  890.  
  891. pam.SetPerkArmorBonus( S_Perk_05, this );
  892. pam.SetPerkArmorBonus( S_Perk_06, this );
  893. pam.SetPerkArmorBonus( S_Perk_07, this );
  894.  
  895. FactsAdd("Patch_Armor_Type_Glyphwords");
  896. }
  897. else if( FactsQuerySum("154999") < 1 )
  898. {
  899.  
  900. pam = (W3PlayerAbilityManager)abilityManager;
  901.  
  902. pam.SetPerkArmorBonus( S_Perk_05, this );
  903. pam.SetPerkArmorBonus( S_Perk_06, this );
  904. pam.SetPerkArmorBonus( S_Perk_07, this );
  905.  
  906. FactsAdd("154999");
  907. }
  908.  
  909. if( FactsQuerySum( "Patch_Decoction_Buff_Icons" ) < 1 )
  910. {
  911. mutagens = GetMutagenBuffs();
  912. for( i=0; i<mutagens.Size(); i+=1 )
  913. {
  914. itemName = DecoctionEffectTypeToItemName( mutagens[i].GetEffectType() );
  915. mutagens[i].OverrideIcon( itemName );
  916. }
  917.  
  918. FactsAdd( "Patch_Decoction_Buff_Icons" );
  919. }
  920.  
  921.  
  922. if( FactsQuerySum( "154997" ) < 1 )
  923. {
  924. if( IsSkillEquipped( S_Alchemy_s18 ) )
  925. {
  926. slot = GetSkillSlotID( S_Alchemy_s18 );
  927. UnequipSkill( slot );
  928. EquipSkill( S_Alchemy_s18, slot );
  929. }
  930. FactsAdd( "154997" );
  931. }
  932. if( FactsQuerySum( "Patch_Mutagen_Ing_Stacking" ) < 1 )
  933. {
  934. Patch_MutagenStacking();
  935. FactsAdd( "Patch_Mutagen_Ing_Stacking" );
  936. }
  937.  
  938. //modSigns
  939. if( FactsQuerySum( "modSigns_S_Alchemy_s05_Fix_2" ) < 1 )
  940. {
  941. pam = (W3PlayerAbilityManager)abilityManager;
  942. pam.ResetAlchemy05SkillMaxLevel();
  943. FactsAdd( "modSigns_S_Alchemy_s05_Fix_2" );
  944. }
  945. //if( FactsQuerySum( "modSigns_S_Alchemy_s18_Fix" ) < 1 )
  946. //{
  947. // if( IsSkillEquipped( S_Alchemy_s18 ) )
  948. // {
  949. // slot = GetSkillSlotID( S_Alchemy_s18 );
  950. // UnequipSkill( slot );
  951. // EquipSkill( S_Alchemy_s18, slot );
  952. // }
  953. // FactsAdd( "modSigns_S_Alchemy_s18_Fix" );
  954. //}
  955. if( FactsQuerySum( "modSigns_ArmorTypeSetsIntroduced" ) < 1 )
  956. {
  957. pam = (W3PlayerAbilityManager)abilityManager;
  958. pam.ManageSetArmorTypeBonus();
  959. RecalcSetItemsEquipped();
  960. FactsAdd( "modSigns_ArmorTypeSetsIntroduced" );
  961. }
  962. if( FactsQuerySum( "modSigns_KMArmorTypeSetIntroduced" ) < 1 )
  963. {
  964. pam = (W3PlayerAbilityManager)abilityManager;
  965. pam.ManageSetArmorTypeBonus();
  966. RecalcSetItemsEquipped();
  967. FactsAdd( "modSigns_KMArmorTypeSetIntroduced" );
  968. }
  969. }
  970.  
  971. private final function Patch_MutagenStacking()
  972. {
  973. var i, j, quantity : int;
  974. var muts : array< SItemUniqueId >;
  975. var item : SItemUniqueId;
  976. var mutName : name;
  977. var wasInArray : bool;
  978. var mutsToAdd : array< SItemParts >;
  979. var mutToAdd : SItemParts;
  980.  
  981. muts = inv.GetItemsByTag( 'MutagenIngredient' );
  982. if( GetItemEquippedOnSlot( EES_SkillMutagen1, item ) )
  983. {
  984. muts.Remove( item );
  985. inv.SetItemStackable( item, false );
  986. }
  987. if( GetItemEquippedOnSlot( EES_SkillMutagen2, item ) )
  988. {
  989. muts.Remove( item );
  990. inv.SetItemStackable( item, false );
  991. }
  992. if( GetItemEquippedOnSlot( EES_SkillMutagen3, item ) )
  993. {
  994. muts.Remove( item );
  995. inv.SetItemStackable( item, false );
  996. }
  997. if( GetItemEquippedOnSlot( EES_SkillMutagen4, item ) )
  998. {
  999. muts.Remove( item );
  1000. inv.SetItemStackable( item, false );
  1001. }
  1002.  
  1003. for( i=0; i<muts.Size(); i+=1 )
  1004. {
  1005. mutName = inv.GetItemName( muts[i] );
  1006. quantity = inv.GetItemQuantity( muts[i] );
  1007.  
  1008. wasInArray = false;
  1009. for( j=0; j<mutsToAdd.Size(); j+=1 )
  1010. {
  1011. if( mutsToAdd[j].itemName == mutName )
  1012. {
  1013. mutsToAdd[j].quantity += quantity;
  1014. wasInArray = true;
  1015. break;
  1016. }
  1017. }
  1018.  
  1019. if( !wasInArray )
  1020. {
  1021. mutToAdd.itemName = mutName;
  1022. mutToAdd.quantity = quantity;
  1023. mutsToAdd.PushBack( mutToAdd );
  1024. }
  1025.  
  1026. inv.RemoveItem( muts[i], quantity );
  1027. }
  1028.  
  1029. for( i=0; i<mutsToAdd.Size(); i+=1 )
  1030. {
  1031. inv.AddAnItem( mutsToAdd[i].itemName, mutsToAdd[i].quantity, true, true );
  1032. }
  1033. }
  1034.  
  1035. private function FixEquippedMutagens()
  1036. {
  1037. var item : SItemUniqueId;
  1038. if( GetItemEquippedOnSlot( EES_SkillMutagen1, item ) )
  1039. {
  1040. inv.SetItemStackable( item, false );
  1041. }
  1042. if( GetItemEquippedOnSlot( EES_SkillMutagen2, item ) )
  1043. {
  1044. inv.SetItemStackable( item, false );
  1045. }
  1046. if( GetItemEquippedOnSlot( EES_SkillMutagen3, item ) )
  1047. {
  1048. inv.SetItemStackable( item, false );
  1049. }
  1050. if( GetItemEquippedOnSlot( EES_SkillMutagen4, item ) )
  1051. {
  1052. inv.SetItemStackable( item, false );
  1053. }
  1054. }
  1055.  
  1056. public final function RestoreQuen( quenHealth : float, quenDuration : float, optional alternate : bool ) : bool
  1057. {
  1058. var restoredQuen : W3QuenEntity;
  1059.  
  1060. if(quenHealth > 0.f && quenDuration >= 3.f)
  1061. {
  1062. restoredQuen = (W3QuenEntity)theGame.CreateEntity( signs[ST_Quen].template, GetWorldPosition(), GetWorldRotation() );
  1063. restoredQuen.Init( signOwner, signs[ST_Quen].entity, true );
  1064.  
  1065. if( alternate )
  1066. {
  1067. restoredQuen.SetAlternateCast( S_Magic_s04 );
  1068. }
  1069.  
  1070. restoredQuen.freeCast = true; //modSigns
  1071. restoredQuen.OnStarted();
  1072. restoredQuen.OnThrowing();
  1073.  
  1074. if( !alternate )
  1075. {
  1076. restoredQuen.OnEnded();
  1077. }
  1078.  
  1079. restoredQuen.SetDataFromRestore(quenHealth, quenDuration);
  1080.  
  1081. return true;
  1082. }
  1083.  
  1084. return false;
  1085. }
  1086.  
  1087. public function IsInitialized() : bool
  1088. {
  1089. return isInitialized;
  1090. }
  1091.  
  1092. private function NewGamePlusInitialize()
  1093. {
  1094. var questItems : array<name>;
  1095. var horseManager : W3HorseManager;
  1096. var horseInventory : CInventoryComponent;
  1097. var i, missingLevels, expDiff : int;
  1098.  
  1099. super.NewGamePlusInitialize();
  1100.  
  1101.  
  1102. horseManager = (W3HorseManager)EntityHandleGet(horseManagerHandle);
  1103. if(horseManager)
  1104. horseInventory = horseManager.GetInventoryComponent();
  1105.  
  1106.  
  1107. theGame.params.SetNewGamePlusLevel(GetLevel());
  1108.  
  1109.  
  1110. if (theGame.GetDLCManager().IsDLCAvailable('ep1'))
  1111. missingLevels = theGame.params.NEW_GAME_PLUS_EP1_MIN_LEVEL - GetLevel();
  1112. else
  1113. missingLevels = theGame.params.NEW_GAME_PLUS_MIN_LEVEL - GetLevel();
  1114.  
  1115. for(i=0; i<missingLevels; i+=1)
  1116. {
  1117.  
  1118. expDiff = levelManager.GetTotalExpForNextLevel() - levelManager.GetPointsTotal(EExperiencePoint);
  1119. expDiff = CeilF( ((float)expDiff) / 2 );
  1120. AddPoints(EExperiencePoint, expDiff, false);
  1121. }
  1122.  
  1123.  
  1124.  
  1125.  
  1126.  
  1127. inv.RemoveItemByTag('Quest', -1);
  1128. horseInventory.RemoveItemByTag('Quest', -1);
  1129.  
  1130.  
  1131.  
  1132. questItems = theGame.GetDefinitionsManager().GetItemsWithTag('Quest');
  1133. for(i=0; i<questItems.Size(); i+=1)
  1134. {
  1135. inv.RemoveItemByName(questItems[i], -1);
  1136. horseInventory.RemoveItemByName(questItems[i], -1);
  1137. }
  1138.  
  1139.  
  1140. inv.RemoveItemByName('mq1002_artifact_3', -1);
  1141. horseInventory.RemoveItemByName('mq1002_artifact_3', -1);
  1142.  
  1143.  
  1144. inv.RemoveItemByTag('NotTransferableToNGP', -1);
  1145. horseInventory.RemoveItemByTag('NotTransferableToNGP', -1);
  1146.  
  1147.  
  1148. inv.RemoveItemByTag('NoticeBoardNote', -1);
  1149. horseInventory.RemoveItemByTag('NoticeBoardNote', -1);
  1150.  
  1151.  
  1152. RemoveAllNonAutoBuffs();
  1153.  
  1154.  
  1155. RemoveAlchemyRecipe('Recipe for Trial Potion Kit');
  1156. RemoveAlchemyRecipe('Recipe for Pops Antidote');
  1157. RemoveAlchemyRecipe('Recipe for Czart Lure');
  1158. RemoveAlchemyRecipe('q603_diarrhea_potion_recipe');
  1159.  
  1160.  
  1161. inv.RemoveItemByTag('Trophy', -1);
  1162. horseInventory.RemoveItemByTag('Trophy', -1);
  1163.  
  1164.  
  1165. inv.RemoveItemByCategory('usable', -1);
  1166. horseInventory.RemoveItemByCategory('usable', -1);
  1167.  
  1168.  
  1169. RemoveAbility('StaminaTutorialProlog');
  1170. RemoveAbility('TutorialStaminaRegenHack');
  1171. RemoveAbility('area_novigrad');
  1172. RemoveAbility('NoRegenEffect');
  1173. RemoveAbility('HeavySwimmingStaminaDrain');
  1174. RemoveAbility('AirBoost');
  1175. RemoveAbility('area_nml');
  1176. RemoveAbility('area_skellige');
  1177.  
  1178.  
  1179. inv.RemoveItemByTag('GwintCard', -1);
  1180. horseInventory.RemoveItemByTag('GwintCard', -1);
  1181.  
  1182.  
  1183.  
  1184. inv.RemoveItemByTag('ReadableItem', -1);
  1185. horseInventory.RemoveItemByTag('ReadableItem', -1);
  1186.  
  1187.  
  1188. abilityManager.RestoreStats();
  1189.  
  1190.  
  1191. ((W3PlayerAbilityManager)abilityManager).RemoveToxicityOffset(10000);
  1192.  
  1193.  
  1194. GetInventory().SingletonItemsRefillAmmo();
  1195.  
  1196.  
  1197. craftingSchematics.Clear();
  1198. AddStartingSchematics();
  1199.  
  1200.  
  1201. for( i=0; i<amountOfSetPiecesEquipped.Size(); i+=1 )
  1202. {
  1203. amountOfSetPiecesEquipped[i] = 0;
  1204. }
  1205.  
  1206.  
  1207. inv.AddAnItem('Clearing Potion', 1, true, false, false);
  1208.  
  1209.  
  1210. inv.RemoveItemByName('q203_broken_eyeofloki', -1);
  1211. horseInventory.RemoveItemByName('q203_broken_eyeofloki', -1);
  1212.  
  1213.  
  1214. //modSigns
  1215. if( FactsQuerySum("ModSignsKMSetSchematicsAdded") < 1 )
  1216. {
  1217. AddCraftingSchematic('Kaer Morhen Armor 1 schematic',true, true);
  1218. AddCraftingSchematic('Kaer Morhen Armor 2 schematic',true, true);
  1219. AddCraftingSchematic('Kaer Morhen Armor 3 schematic',true, true);
  1220. AddCraftingSchematic('Kaer Morhen Pants schematic',true, true);
  1221. AddCraftingSchematic('Kaer Morhen Pants 1 schematic',true, true);
  1222. AddCraftingSchematic('Kaer Morhen Pants 2 schematic',true, true);
  1223. AddCraftingSchematic('Kaer Morhen Pants 3 schematic',true, true);
  1224. AddCraftingSchematic('Kaer Morhen Boots schematic',true, true);
  1225. AddCraftingSchematic('Kaer Morhen Boots 1 schematic',true, true);
  1226. AddCraftingSchematic('Kaer Morhen Boots 2 schematic',true, true);
  1227. AddCraftingSchematic('Kaer Morhen Boots 3 schematic',true, true);
  1228. AddCraftingSchematic('Kaer Morhen Gloves schematic',true, true);
  1229. AddCraftingSchematic('Kaer Morhen Gloves 1 schematic',true, true);
  1230. AddCraftingSchematic('Kaer Morhen Gloves 2 schematic',true, true);
  1231. AddCraftingSchematic('Kaer Morhen Gloves 3 schematic',true, true);
  1232. FactsAdd("ModSignsKMSetSchematicsAdded");
  1233. }
  1234.  
  1235. NewGamePlusReplaceViperSet(inv);
  1236. NewGamePlusReplaceViperSet(horseInventory);
  1237. NewGamePlusReplaceKaerMorhenSet(inv); //modSigns
  1238. NewGamePlusReplaceKaerMorhenSet(horseInventory); //modSigns
  1239. NewGamePlusReplaceLynxSet(inv);
  1240. NewGamePlusReplaceLynxSet(horseInventory);
  1241. NewGamePlusReplaceGryphonSet(inv);
  1242. NewGamePlusReplaceGryphonSet(horseInventory);
  1243. NewGamePlusReplaceBearSet(inv);
  1244. NewGamePlusReplaceBearSet(horseInventory);
  1245. NewGamePlusReplaceEP1(inv);
  1246. NewGamePlusReplaceEP1(horseInventory);
  1247. NewGamePlusReplaceEP2WitcherSets(inv);
  1248. NewGamePlusReplaceEP2WitcherSets(horseInventory);
  1249. NewGamePlusReplaceEP2Items(inv);
  1250. NewGamePlusReplaceEP2Items(horseInventory);
  1251. NewGamePlusMarkItemsToNotAdjust(inv);
  1252. NewGamePlusMarkItemsToNotAdjust(horseInventory);
  1253.  
  1254.  
  1255. inputHandler.ClearLocksForNGP();
  1256.  
  1257.  
  1258. buffImmunities.Clear();
  1259. buffRemovedImmunities.Clear();
  1260.  
  1261. newGamePlusInitialized = true;
  1262.  
  1263.  
  1264. m_quenReappliedCount = 1;
  1265. }
  1266.  
  1267. private final function NewGamePlusMarkItemsToNotAdjust(out inv : CInventoryComponent)
  1268. {
  1269. var ids : array<SItemUniqueId>;
  1270. var i : int;
  1271. var n : name;
  1272.  
  1273. inv.GetAllItems(ids);
  1274. for( i=0; i<ids.Size(); i+=1 )
  1275. {
  1276. inv.SetItemModifierInt(ids[i], 'NGPItemAdjusted', 1);
  1277. }
  1278. }
  1279.  
  1280. private final function NewGamePlusReplaceItem( item : name, new_item : name, out inv : CInventoryComponent)
  1281. {
  1282. var i, j : int;
  1283. var ids, new_ids, enh_ids : array<SItemUniqueId>;
  1284. var dye_ids : array<SItemUniqueId>;
  1285. var enh : array<name>;
  1286. var wasEquipped : bool;
  1287. var wasEnchanted : bool;
  1288. var wasDyed : bool;
  1289. var enchantName, colorName : name;
  1290.  
  1291. if ( inv.HasItem( item ) )
  1292. {
  1293. ids = inv.GetItemsIds(item);
  1294. for (i = 0; i < ids.Size(); i += 1)
  1295. {
  1296. inv.GetItemEnhancementItems( ids[i], enh );
  1297. wasEnchanted = inv.IsItemEnchanted( ids[i] );
  1298. if ( wasEnchanted )
  1299. enchantName = inv.GetEnchantment( ids[i] );
  1300. wasEquipped = IsItemEquipped( ids[i] );
  1301. wasDyed = inv.IsItemColored( ids[i] );
  1302. if ( wasDyed )
  1303. {
  1304. colorName = inv.GetItemColor( ids[i] );
  1305. }
  1306.  
  1307. inv.RemoveItem( ids[i], 1 );
  1308. new_ids = inv.AddAnItem( new_item, 1, true, true, false );
  1309. if ( wasEquipped )
  1310. {
  1311. EquipItem( new_ids[0] );
  1312. }
  1313. if ( wasEnchanted )
  1314. {
  1315. inv.EnchantItem( new_ids[0], enchantName, getEnchamtmentStatName(enchantName) );
  1316. }
  1317. for (j = 0; j < enh.Size(); j += 1)
  1318. {
  1319. enh_ids = inv.AddAnItem( enh[j], 1, true, true, false );
  1320. inv.EnhanceItemScript( new_ids[0], enh_ids[0] );
  1321. }
  1322. if ( wasDyed )
  1323. {
  1324. dye_ids = inv.AddAnItem( colorName, 1, true, true, false );
  1325. inv.ColorItem( new_ids[0], dye_ids[0] );
  1326. inv.RemoveItem( dye_ids[0], 1 );
  1327. }
  1328.  
  1329. inv.SetItemModifierInt( new_ids[0], 'NGPItemAdjusted', 1 );
  1330. }
  1331. }
  1332. }
  1333.  
  1334. private final function NewGamePlusAdjustDLCItem(item : name, mod : name, inv : CInventoryComponent)
  1335. {
  1336. var ids : array<SItemUniqueId>;
  1337. var i : int;
  1338.  
  1339. if( inv.HasItem(item) )
  1340. {
  1341. ids = inv.GetItemsIds(item);
  1342. for (i = 0; i < ids.Size(); i += 1)
  1343. {
  1344. if ( inv.GetItemModifierInt(ids[i], 'DoNotAdjustNGPDLC') <= 0 )
  1345. {
  1346. inv.AddItemBaseAbility(ids[i], mod);
  1347. inv.SetItemModifierInt(ids[i], 'DoNotAdjustNGPDLC', 1);
  1348. }
  1349. }
  1350. }
  1351.  
  1352. }
  1353.  
  1354. private final function NewGamePlusAdjustDLC1TemerianSet(inv : CInventoryComponent)
  1355. {
  1356. NewGamePlusAdjustDLCItem('NGP DLC1 Temerian Armor', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1357. NewGamePlusAdjustDLCItem('NGP DLC1 Temerian Gloves', 'NGP DLC Compatibility Armor Mod', inv);
  1358. NewGamePlusAdjustDLCItem('NGP DLC1 Temerian Pants', 'NGP DLC Compatibility Armor Mod', inv);
  1359. NewGamePlusAdjustDLCItem('NGP DLC1 Temerian Boots', 'NGP DLC Compatibility Armor Mod', inv);
  1360. }
  1361.  
  1362. private final function NewGamePlusAdjustDLC5NilfgardianSet(inv : CInventoryComponent)
  1363. {
  1364. NewGamePlusAdjustDLCItem('NGP DLC5 Nilfgaardian Armor', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1365. NewGamePlusAdjustDLCItem('NGP DLC5 Nilfgaardian Gloves', 'NGP DLC Compatibility Armor Mod', inv);
  1366. NewGamePlusAdjustDLCItem('NGP DLC5 Nilfgaardian Pants', 'NGP DLC Compatibility Armor Mod', inv);
  1367. NewGamePlusAdjustDLCItem('NGP DLC5 Nilfgaardian Boots', 'NGP DLC Compatibility Armor Mod', inv);
  1368. }
  1369.  
  1370. private final function NewGamePlusAdjustDLC10WolfSet(inv : CInventoryComponent)
  1371. {
  1372. NewGamePlusAdjustDLCItem('NGP Wolf Armor', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1373. NewGamePlusAdjustDLCItem('NGP Wolf Armor 1', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1374. NewGamePlusAdjustDLCItem('NGP Wolf Armor 2', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1375. NewGamePlusAdjustDLCItem('NGP Wolf Armor 3', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1376.  
  1377. NewGamePlusAdjustDLCItem('NGP Wolf Boots 1', 'NGP DLC Compatibility Armor Mod', inv);
  1378. NewGamePlusAdjustDLCItem('NGP Wolf Boots 2', 'NGP DLC Compatibility Armor Mod', inv);
  1379. NewGamePlusAdjustDLCItem('NGP Wolf Boots 3', 'NGP DLC Compatibility Armor Mod', inv);
  1380. NewGamePlusAdjustDLCItem('NGP Wolf Boots 4', 'NGP DLC Compatibility Armor Mod', inv);
  1381.  
  1382. NewGamePlusAdjustDLCItem('NGP Wolf Gloves 1', 'NGP DLC Compatibility Armor Mod', inv);
  1383. NewGamePlusAdjustDLCItem('NGP Wolf Gloves 2', 'NGP DLC Compatibility Armor Mod', inv);
  1384. NewGamePlusAdjustDLCItem('NGP Wolf Gloves 3', 'NGP DLC Compatibility Armor Mod', inv);
  1385. NewGamePlusAdjustDLCItem('NGP Wolf Gloves 4', 'NGP DLC Compatibility Armor Mod', inv);
  1386.  
  1387. NewGamePlusAdjustDLCItem('NGP Wolf Pants 1', 'NGP DLC Compatibility Armor Mod', inv);
  1388. NewGamePlusAdjustDLCItem('NGP Wolf Pants 2', 'NGP DLC Compatibility Armor Mod', inv);
  1389. NewGamePlusAdjustDLCItem('NGP Wolf Pants 3', 'NGP DLC Compatibility Armor Mod', inv);
  1390. NewGamePlusAdjustDLCItem('NGP Wolf Pants 4', 'NGP DLC Compatibility Armor Mod', inv);
  1391.  
  1392. NewGamePlusAdjustDLCItem('NGP Wolf School steel sword', 'NGP Wolf Steel Sword Mod', inv);
  1393. NewGamePlusAdjustDLCItem('NGP Wolf School steel sword 1', 'NGP Wolf Steel Sword Mod', inv);
  1394. NewGamePlusAdjustDLCItem('NGP Wolf School steel sword 2', 'NGP Wolf Steel Sword Mod', inv);
  1395. NewGamePlusAdjustDLCItem('NGP Wolf School steel sword 3', 'NGP Wolf Steel Sword Mod', inv);
  1396.  
  1397. NewGamePlusAdjustDLCItem('NGP Wolf School silver sword', 'NGP Wolf Silver Sword Mod', inv);
  1398. NewGamePlusAdjustDLCItem('NGP Wolf School silver sword 1', 'NGP Wolf Silver Sword Mod', inv);
  1399. NewGamePlusAdjustDLCItem('NGP Wolf School silver sword 2', 'NGP Wolf Silver Sword Mod', inv);
  1400. NewGamePlusAdjustDLCItem('NGP Wolf School silver sword 3', 'NGP Wolf Silver Sword Mod', inv);
  1401. }
  1402.  
  1403. private final function NewGamePlusAdjustDLC14SkelligeSet(inv : CInventoryComponent)
  1404. {
  1405. NewGamePlusAdjustDLCItem('NGP DLC14 Skellige Armor', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1406. NewGamePlusAdjustDLCItem('NGP DLC14 Skellige Gloves', 'NGP DLC Compatibility Armor Mod', inv);
  1407. NewGamePlusAdjustDLCItem('NGP DLC14 Skellige Pants', 'NGP DLC Compatibility Armor Mod', inv);
  1408. NewGamePlusAdjustDLCItem('NGP DLC14 Skellige Boots', 'NGP DLC Compatibility Armor Mod', inv);
  1409. }
  1410.  
  1411. //modSigns
  1412. private final function NewGamePlusReplaceKaerMorhenSet(out inv : CInventoryComponent)
  1413. {
  1414. NewGamePlusReplaceItem('Kaer Morhen Armor','NGP Kaer Morhen Armor', inv);
  1415. NewGamePlusReplaceItem('Kaer Morhen Armor 1','NGP Kaer Morhen Armor 1', inv);
  1416. NewGamePlusReplaceItem('Kaer Morhen Armor 2','NGP Kaer Morhen Armor 2', inv);
  1417. NewGamePlusReplaceItem('Kaer Morhen Armor 3','NGP Kaer Morhen Armor 3', inv);
  1418. NewGamePlusReplaceItem('Kaer Morhen Pants','NGP Kaer Morhen Pants', inv);
  1419. NewGamePlusReplaceItem('Kaer Morhen Pants 1','NGP Kaer Morhen Pants 1', inv);
  1420. NewGamePlusReplaceItem('Kaer Morhen Pants 2','NGP Kaer Morhen Pants 2', inv);
  1421. NewGamePlusReplaceItem('Kaer Morhen Pants 3','NGP Kaer Morhen Pants 3', inv);
  1422. NewGamePlusReplaceItem('Kaer Morhen Boots','NGP Kaer Morhen Boots', inv);
  1423. NewGamePlusReplaceItem('Kaer Morhen Boots 1','NGP Kaer Morhen Boots 1', inv);
  1424. NewGamePlusReplaceItem('Kaer Morhen Boots 2','NGP Kaer Morhen Boots 2', inv);
  1425. NewGamePlusReplaceItem('Kaer Morhen Boots 3','NGP Kaer Morhen Boots 3', inv);
  1426. NewGamePlusReplaceItem('Kaer Morhen Gloves','NGP Kaer Morhen Gloves', inv);
  1427. NewGamePlusReplaceItem('Kaer Morhen Gloves 1','NGP Kaer Morhen Gloves 1', inv);
  1428. NewGamePlusReplaceItem('Kaer Morhen Gloves 2','NGP Kaer Morhen Gloves 2', inv);
  1429. NewGamePlusReplaceItem('Kaer Morhen Gloves 3','NGP Kaer Morhen Gloves 3', inv);
  1430. }
  1431.  
  1432. private final function NewGamePlusReplaceViperSet(out inv : CInventoryComponent)
  1433. {
  1434. NewGamePlusReplaceItem('Viper School steel sword', 'NGP Viper School steel sword', inv);
  1435.  
  1436. NewGamePlusReplaceItem('Viper School silver sword', 'NGP Viper School silver sword', inv);
  1437. }
  1438.  
  1439. private final function NewGamePlusReplaceLynxSet(out inv : CInventoryComponent)
  1440. {
  1441. NewGamePlusReplaceItem('Lynx Armor', 'NGP Lynx Armor', inv);
  1442. NewGamePlusReplaceItem('Lynx Armor 1', 'NGP Lynx Armor 1', inv);
  1443. NewGamePlusReplaceItem('Lynx Armor 2', 'NGP Lynx Armor 2', inv);
  1444. NewGamePlusReplaceItem('Lynx Armor 3', 'NGP Lynx Armor 3', inv);
  1445.  
  1446. NewGamePlusReplaceItem('Lynx Gloves 1', 'NGP Lynx Gloves 1', inv);
  1447. NewGamePlusReplaceItem('Lynx Gloves 2', 'NGP Lynx Gloves 2', inv);
  1448. NewGamePlusReplaceItem('Lynx Gloves 3', 'NGP Lynx Gloves 3', inv);
  1449. NewGamePlusReplaceItem('Lynx Gloves 4', 'NGP Lynx Gloves 4', inv);
  1450.  
  1451. NewGamePlusReplaceItem('Lynx Pants 1', 'NGP Lynx Pants 1', inv);
  1452. NewGamePlusReplaceItem('Lynx Pants 2', 'NGP Lynx Pants 2', inv);
  1453. NewGamePlusReplaceItem('Lynx Pants 3', 'NGP Lynx Pants 3', inv);
  1454. NewGamePlusReplaceItem('Lynx Pants 4', 'NGP Lynx Pants 4', inv);
  1455.  
  1456. NewGamePlusReplaceItem('Lynx Boots 1', 'NGP Lynx Boots 1', inv);
  1457. NewGamePlusReplaceItem('Lynx Boots 2', 'NGP Lynx Boots 2', inv);
  1458. NewGamePlusReplaceItem('Lynx Boots 3', 'NGP Lynx Boots 3', inv);
  1459. NewGamePlusReplaceItem('Lynx Boots 4', 'NGP Lynx Boots 4', inv);
  1460.  
  1461. NewGamePlusReplaceItem('Lynx School steel sword', 'NGP Lynx School steel sword', inv);
  1462. NewGamePlusReplaceItem('Lynx School steel sword 1', 'NGP Lynx School steel sword 1', inv);
  1463. NewGamePlusReplaceItem('Lynx School steel sword 2', 'NGP Lynx School steel sword 2', inv);
  1464. NewGamePlusReplaceItem('Lynx School steel sword 3', 'NGP Lynx School steel sword 3', inv);
  1465.  
  1466. NewGamePlusReplaceItem('Lynx School silver sword', 'NGP Lynx School silver sword', inv);
  1467. NewGamePlusReplaceItem('Lynx School silver sword 1', 'NGP Lynx School silver sword 1', inv);
  1468. NewGamePlusReplaceItem('Lynx School silver sword 2', 'NGP Lynx School silver sword 2', inv);
  1469. NewGamePlusReplaceItem('Lynx School silver sword 3', 'NGP Lynx School silver sword 3', inv);
  1470. }
  1471.  
  1472. private final function NewGamePlusReplaceGryphonSet(out inv : CInventoryComponent)
  1473. {
  1474. NewGamePlusReplaceItem('Gryphon Armor', 'NGP Gryphon Armor', inv);
  1475. NewGamePlusReplaceItem('Gryphon Armor 1', 'NGP Gryphon Armor 1', inv);
  1476. NewGamePlusReplaceItem('Gryphon Armor 2', 'NGP Gryphon Armor 2', inv);
  1477. NewGamePlusReplaceItem('Gryphon Armor 3', 'NGP Gryphon Armor 3', inv);
  1478.  
  1479. NewGamePlusReplaceItem('Gryphon Gloves 1', 'NGP Gryphon Gloves 1', inv);
  1480. NewGamePlusReplaceItem('Gryphon Gloves 2', 'NGP Gryphon Gloves 2', inv);
  1481. NewGamePlusReplaceItem('Gryphon Gloves 3', 'NGP Gryphon Gloves 3', inv);
  1482. NewGamePlusReplaceItem('Gryphon Gloves 4', 'NGP Gryphon Gloves 4', inv);
  1483.  
  1484. NewGamePlusReplaceItem('Gryphon Pants 1', 'NGP Gryphon Pants 1', inv);
  1485. NewGamePlusReplaceItem('Gryphon Pants 2', 'NGP Gryphon Pants 2', inv);
  1486. NewGamePlusReplaceItem('Gryphon Pants 3', 'NGP Gryphon Pants 3', inv);
  1487. NewGamePlusReplaceItem('Gryphon Pants 4', 'NGP Gryphon Pants 4', inv);
  1488.  
  1489. NewGamePlusReplaceItem('Gryphon Boots 1', 'NGP Gryphon Boots 1', inv);
  1490. NewGamePlusReplaceItem('Gryphon Boots 2', 'NGP Gryphon Boots 2', inv);
  1491. NewGamePlusReplaceItem('Gryphon Boots 3', 'NGP Gryphon Boots 3', inv);
  1492. NewGamePlusReplaceItem('Gryphon Boots 4', 'NGP Gryphon Boots 4', inv);
  1493.  
  1494. NewGamePlusReplaceItem('Gryphon School steel sword', 'NGP Gryphon School steel sword', inv);
  1495. NewGamePlusReplaceItem('Gryphon School steel sword 1', 'NGP Gryphon School steel sword 1', inv);
  1496. NewGamePlusReplaceItem('Gryphon School steel sword 2', 'NGP Gryphon School steel sword 2', inv);
  1497. NewGamePlusReplaceItem('Gryphon School steel sword 3', 'NGP Gryphon School steel sword 3', inv);
  1498.  
  1499. NewGamePlusReplaceItem('Gryphon School silver sword', 'NGP Gryphon School silver sword', inv);
  1500. NewGamePlusReplaceItem('Gryphon School silver sword 1', 'NGP Gryphon School silver sword 1', inv);
  1501. NewGamePlusReplaceItem('Gryphon School silver sword 2', 'NGP Gryphon School silver sword 2', inv);
  1502. NewGamePlusReplaceItem('Gryphon School silver sword 3', 'NGP Gryphon School silver sword 3', inv);
  1503. }
  1504.  
  1505. private final function NewGamePlusReplaceBearSet(out inv : CInventoryComponent)
  1506. {
  1507. NewGamePlusReplaceItem('Bear Armor', 'NGP Bear Armor', inv);
  1508. NewGamePlusReplaceItem('Bear Armor 1', 'NGP Bear Armor 1', inv);
  1509. NewGamePlusReplaceItem('Bear Armor 2', 'NGP Bear Armor 2', inv);
  1510. NewGamePlusReplaceItem('Bear Armor 3', 'NGP Bear Armor 3', inv);
  1511.  
  1512. NewGamePlusReplaceItem('Bear Gloves 1', 'NGP Bear Gloves 1', inv);
  1513. NewGamePlusReplaceItem('Bear Gloves 2', 'NGP Bear Gloves 2', inv);
  1514. NewGamePlusReplaceItem('Bear Gloves 3', 'NGP Bear Gloves 3', inv);
  1515. NewGamePlusReplaceItem('Bear Gloves 4', 'NGP Bear Gloves 4', inv);
  1516.  
  1517. NewGamePlusReplaceItem('Bear Pants 1', 'NGP Bear Pants 1', inv);
  1518. NewGamePlusReplaceItem('Bear Pants 2', 'NGP Bear Pants 2', inv);
  1519. NewGamePlusReplaceItem('Bear Pants 3', 'NGP Bear Pants 3', inv);
  1520. NewGamePlusReplaceItem('Bear Pants 4', 'NGP Bear Pants 4', inv);
  1521.  
  1522. NewGamePlusReplaceItem('Bear Boots 1', 'NGP Bear Boots 1', inv);
  1523. NewGamePlusReplaceItem('Bear Boots 2', 'NGP Bear Boots 2', inv);
  1524. NewGamePlusReplaceItem('Bear Boots 3', 'NGP Bear Boots 3', inv);
  1525. NewGamePlusReplaceItem('Bear Boots 4', 'NGP Bear Boots 4', inv);
  1526.  
  1527. NewGamePlusReplaceItem('Bear School steel sword', 'NGP Bear School steel sword', inv);
  1528. NewGamePlusReplaceItem('Bear School steel sword 1', 'NGP Bear School steel sword 1', inv);
  1529. NewGamePlusReplaceItem('Bear School steel sword 2', 'NGP Bear School steel sword 2', inv);
  1530. NewGamePlusReplaceItem('Bear School steel sword 3', 'NGP Bear School steel sword 3', inv);
  1531.  
  1532. NewGamePlusReplaceItem('Bear School silver sword', 'NGP Bear School silver sword', inv);
  1533. NewGamePlusReplaceItem('Bear School silver sword 1', 'NGP Bear School silver sword 1', inv);
  1534. NewGamePlusReplaceItem('Bear School silver sword 2', 'NGP Bear School silver sword 2', inv);
  1535. NewGamePlusReplaceItem('Bear School silver sword 3', 'NGP Bear School silver sword 3', inv);
  1536. }
  1537.  
  1538. private final function NewGamePlusReplaceEP1(out inv : CInventoryComponent)
  1539. {
  1540. NewGamePlusReplaceItem('Ofir Armor', 'NGP Ofir Armor', inv);
  1541. NewGamePlusReplaceItem('Ofir Sabre 2', 'NGP Ofir Sabre 2', inv);
  1542.  
  1543. NewGamePlusReplaceItem('Crafted Burning Rose Armor', 'NGP Crafted Burning Rose Armor', inv);
  1544. NewGamePlusReplaceItem('Crafted Burning Rose Gloves', 'NGP Crafted Burning Rose Gloves', inv);
  1545. NewGamePlusReplaceItem('Crafted Burning Rose Sword', 'NGP Crafted Burning Rose Sword', inv);
  1546.  
  1547. NewGamePlusReplaceItem('Crafted Ofir Armor', 'NGP Crafted Ofir Armor', inv);
  1548. NewGamePlusReplaceItem('Crafted Ofir Boots', 'NGP Crafted Ofir Boots', inv);
  1549. NewGamePlusReplaceItem('Crafted Ofir Gloves', 'NGP Crafted Ofir Gloves', inv);
  1550. NewGamePlusReplaceItem('Crafted Ofir Pants', 'NGP Crafted Ofir Pants', inv);
  1551. NewGamePlusReplaceItem('Crafted Ofir Steel Sword', 'NGP Crafted Ofir Steel Sword', inv);
  1552.  
  1553. NewGamePlusReplaceItem('EP1 Crafted Witcher Silver Sword', 'NGP EP1 Crafted Witcher Silver Sword', inv);
  1554. //NewGamePlusReplaceItem('Olgierd Sabre', 'NGP Olgierd Sabre', inv);
  1555.  
  1556. NewGamePlusReplaceItem('EP1 Witcher Armor', 'NGP EP1 Witcher Armor', inv);
  1557. NewGamePlusReplaceItem('EP1 Witcher Boots', 'NGP EP1 Witcher Boots', inv);
  1558. NewGamePlusReplaceItem('EP1 Witcher Gloves', 'NGP EP1 Witcher Gloves', inv);
  1559. NewGamePlusReplaceItem('EP1 Witcher Pants', 'NGP EP1 Witcher Pants', inv);
  1560. NewGamePlusReplaceItem('EP1 Viper School steel sword', 'NGP EP1 Viper School steel sword', inv);
  1561. NewGamePlusReplaceItem('EP1 Viper School silver sword', 'NGP EP1 Viper School silver sword', inv);
  1562. }
  1563.  
  1564. private final function NewGamePlusReplaceEP2WitcherSets(out inv : CInventoryComponent)
  1565. {
  1566. NewGamePlusReplaceItem('Lynx Armor 4', 'NGP Lynx Armor 4', inv);
  1567. NewGamePlusReplaceItem('Gryphon Armor 4', 'NGP Gryphon Armor 4', inv);
  1568. NewGamePlusReplaceItem('Bear Armor 4', 'NGP Bear Armor 4', inv);
  1569. NewGamePlusReplaceItem('Wolf Armor 4', 'NGP Wolf Armor 4', inv);
  1570. NewGamePlusReplaceItem('Red Wolf Armor 1', 'NGP Red Wolf Armor 1', inv);
  1571.  
  1572. NewGamePlusReplaceItem('Lynx Gloves 5', 'NGP Lynx Gloves 5', inv);
  1573. NewGamePlusReplaceItem('Gryphon Gloves 5', 'NGP Gryphon Gloves 5', inv);
  1574. NewGamePlusReplaceItem('Bear Gloves 5', 'NGP Bear Gloves 5', inv);
  1575. NewGamePlusReplaceItem('Wolf Gloves 5', 'NGP Wolf Gloves 5', inv);
  1576. NewGamePlusReplaceItem('Red Wolf Gloves 1', 'NGP Red Wolf Gloves 1', inv);
  1577.  
  1578. NewGamePlusReplaceItem('Lynx Pants 5', 'NGP Lynx Pants 5', inv);
  1579. NewGamePlusReplaceItem('Gryphon Pants 5', 'NGP Gryphon Pants 5', inv);
  1580. NewGamePlusReplaceItem('Bear Pants 5', 'NGP Bear Pants 5', inv);
  1581. NewGamePlusReplaceItem('Wolf Pants 5', 'NGP Wolf Pants 5', inv);
  1582. NewGamePlusReplaceItem('Red Wolf Pants 1', 'NGP Red Wolf Pants 1', inv);
  1583.  
  1584. NewGamePlusReplaceItem('Lynx Boots 5', 'NGP Lynx Boots 5', inv);
  1585. NewGamePlusReplaceItem('Gryphon Boots 5', 'NGP Gryphon Boots 5', inv);
  1586. NewGamePlusReplaceItem('Bear Boots 5', 'NGP Bear Boots 5', inv);
  1587. NewGamePlusReplaceItem('Wolf Boots 5', 'NGP Wolf Boots 5', inv);
  1588. NewGamePlusReplaceItem('Red Wolf Boots 1', 'NGP Red Wolf Boots 1', inv);
  1589.  
  1590.  
  1591. NewGamePlusReplaceItem('Lynx School steel sword 4', 'NGP Lynx School steel sword 4', inv);
  1592. NewGamePlusReplaceItem('Gryphon School steel sword 4', 'NGP Gryphon School steel sword 4', inv);
  1593. NewGamePlusReplaceItem('Bear School steel sword 4', 'NGP Bear School steel sword 4', inv);
  1594. NewGamePlusReplaceItem('Wolf School steel sword 4', 'NGP Wolf School steel sword 4', inv);
  1595. NewGamePlusReplaceItem('Red Wolf School steel sword 1', 'NGP Red Wolf School steel sword 1', inv);
  1596.  
  1597. NewGamePlusReplaceItem('Lynx School silver sword 4', 'NGP Lynx School silver sword 4', inv);
  1598. NewGamePlusReplaceItem('Gryphon School silver sword 4', 'NGP Gryphon School silver sword 4', inv);
  1599. NewGamePlusReplaceItem('Bear School silver sword 4', 'NGP Bear School silver sword 4', inv);
  1600. NewGamePlusReplaceItem('Wolf School silver sword 4', 'NGP Wolf School silver sword 4', inv);
  1601. NewGamePlusReplaceItem('Red Wolf School silver sword 1', 'NGP Red Wolf School silver sword 1', inv);
  1602. }
  1603.  
  1604. private final function NewGamePlusReplaceEP2Items(out inv : CInventoryComponent)
  1605. {
  1606. NewGamePlusReplaceItem('Guard Lvl1 Armor 3', 'NGP Guard Lvl1 Armor 3', inv);
  1607. NewGamePlusReplaceItem('Guard Lvl1 A Armor 3', 'NGP Guard Lvl1 A Armor 3', inv);
  1608. NewGamePlusReplaceItem('Guard Lvl2 Armor 3', 'NGP Guard Lvl2 Armor 3', inv);
  1609. NewGamePlusReplaceItem('Guard Lvl2 A Armor 3', 'NGP Guard Lvl2 A Armor 3', inv);
  1610. NewGamePlusReplaceItem('Knight Geralt Armor 3', 'NGP Knight Geralt Armor 3', inv);
  1611. NewGamePlusReplaceItem('Knight Geralt A Armor 3', 'NGP Knight Geralt A Armor 3', inv);
  1612. //NewGamePlusReplaceItem('q702_vampire_armor', 'NGP q702_vampire_armor', inv);
  1613.  
  1614. NewGamePlusReplaceItem('Guard Lvl1 Gloves 3', 'NGP Guard Lvl1 Gloves 3', inv);
  1615. NewGamePlusReplaceItem('Guard Lvl1 A Gloves 3', 'NGP Guard Lvl1 A Gloves 3', inv);
  1616. NewGamePlusReplaceItem('Guard Lvl2 Gloves 3', 'NGP Guard Lvl2 Gloves 3', inv);
  1617. NewGamePlusReplaceItem('Guard Lvl2 A Gloves 3', 'NGP Guard Lvl2 A Gloves 3', inv);
  1618. NewGamePlusReplaceItem('Knight Geralt Gloves 3', 'NGP Knight Geralt Gloves 3', inv);
  1619. NewGamePlusReplaceItem('Knight Geralt A Gloves 3', 'NGP Knight Geralt A Gloves 3', inv);
  1620. //NewGamePlusReplaceItem('q702_vampire_gloves', 'NGP q702_vampire_gloves', inv);
  1621.  
  1622. NewGamePlusReplaceItem('Guard Lvl1 Pants 3', 'NGP Guard Lvl1 Pants 3', inv);
  1623. NewGamePlusReplaceItem('Guard Lvl1 A Pants 3', 'NGP Guard Lvl1 A Pants 3', inv);
  1624. NewGamePlusReplaceItem('Guard Lvl2 Pants 3', 'NGP Guard Lvl2 Pants 3', inv);
  1625. NewGamePlusReplaceItem('Guard Lvl2 A Pants 3', 'NGP Guard Lvl2 A Pants 3', inv);
  1626. NewGamePlusReplaceItem('Knight Geralt Pants 3', 'NGP Knight Geralt Pants 3', inv);
  1627. NewGamePlusReplaceItem('Knight Geralt A Pants 3', 'NGP Knight Geralt A Pants 3', inv);
  1628. //NewGamePlusReplaceItem('q702_vampire_pants', 'NGP q702_vampire_pants', inv);
  1629.  
  1630. NewGamePlusReplaceItem('Guard Lvl1 Boots 3', 'NGP Guard Lvl1 Boots 3', inv);
  1631. NewGamePlusReplaceItem('Guard Lvl1 A Boots 3', 'NGP Guard Lvl1 A Boots 3', inv);
  1632. NewGamePlusReplaceItem('Guard Lvl2 Boots 3', 'NGP Guard Lvl2 Boots 3', inv);
  1633. NewGamePlusReplaceItem('Guard Lvl2 A Boots 3', 'NGP Guard Lvl2 A Boots 3', inv);
  1634. NewGamePlusReplaceItem('Knight Geralt Boots 3', 'NGP Knight Geralt Boots 3', inv);
  1635. NewGamePlusReplaceItem('Knight Geralt A Boots 3', 'NGP Knight Geralt A Boots 3', inv);
  1636. //NewGamePlusReplaceItem('q702_vampire_boots', 'NGP q702_vampire_boots', inv);
  1637.  
  1638. NewGamePlusReplaceItem('Serpent Steel Sword 1', 'NGP Serpent Steel Sword 1', inv);
  1639. NewGamePlusReplaceItem('Serpent Steel Sword 2', 'NGP Serpent Steel Sword 2', inv);
  1640. NewGamePlusReplaceItem('Serpent Steel Sword 3', 'NGP Serpent Steel Sword 3', inv);
  1641. NewGamePlusReplaceItem('Guard lvl1 steel sword 3', 'NGP Guard lvl1 steel sword 3', inv);
  1642. NewGamePlusReplaceItem('Guard lvl2 steel sword 3', 'NGP Guard lvl2 steel sword 3', inv);
  1643. NewGamePlusReplaceItem('Knights steel sword 3', 'NGP Knights steel sword 3', inv);
  1644. NewGamePlusReplaceItem('Hanza steel sword 3', 'NGP Hanza steel sword 3', inv);
  1645. NewGamePlusReplaceItem('Toussaint steel sword 3', 'NGP Toussaint steel sword 3', inv);
  1646. //NewGamePlusReplaceItem('q702 vampire steel sword', 'NGP q702 vampire steel sword', inv);
  1647.  
  1648. NewGamePlusReplaceItem('Serpent Silver Sword 1', 'NGP Serpent Silver Sword 1', inv);
  1649. NewGamePlusReplaceItem('Serpent Silver Sword 2', 'NGP Serpent Silver Sword 2', inv);
  1650. NewGamePlusReplaceItem('Serpent Silver Sword 3', 'NGP Serpent Silver Sword 3', inv);
  1651. }
  1652.  
  1653. public function GetEquippedSword(steel : bool) : SItemUniqueId
  1654. {
  1655. var item : SItemUniqueId;
  1656.  
  1657. if(steel)
  1658. GetItemEquippedOnSlot(EES_SteelSword, item);
  1659. else
  1660. GetItemEquippedOnSlot(EES_SilverSword, item);
  1661.  
  1662. return item;
  1663. }
  1664.  
  1665. timer function BroadcastRain( deltaTime : float, id : int )
  1666. {
  1667. var rainStrength : float = 0;
  1668. rainStrength = GetRainStrength();
  1669. if( rainStrength > 0.5 )
  1670. {
  1671. theGame.GetBehTreeReactionManager().CreateReactionEventIfPossible( thePlayer, 'RainAction', 2.0f , 50.0f, -1.f, -1, true);
  1672. LogReactionSystem( "'RainAction' was sent by Player - single broadcast - distance: 50.0" );
  1673. }
  1674. }
  1675.  
  1676. function InitializeParryType()
  1677. {
  1678. var i, j : int;
  1679.  
  1680. parryTypeTable.Resize( EnumGetMax('EAttackSwingType')+1 );
  1681. for( i = 0; i < EnumGetMax('EAttackSwingType')+1; i += 1 )
  1682. {
  1683. parryTypeTable[i].Resize( EnumGetMax('EAttackSwingDirection')+1 );
  1684. }
  1685. parryTypeTable[AST_Horizontal][ASD_UpDown] = PT_None;
  1686. parryTypeTable[AST_Horizontal][ASD_DownUp] = PT_None;
  1687. parryTypeTable[AST_Horizontal][ASD_LeftRight] = PT_Left;
  1688. parryTypeTable[AST_Horizontal][ASD_RightLeft] = PT_Right;
  1689. parryTypeTable[AST_Vertical][ASD_UpDown] = PT_Up;
  1690. parryTypeTable[AST_Vertical][ASD_DownUp] = PT_Down;
  1691. parryTypeTable[AST_Vertical][ASD_LeftRight] = PT_None;
  1692. parryTypeTable[AST_Vertical][ASD_RightLeft] = PT_None;
  1693. parryTypeTable[AST_DiagonalUp][ASD_UpDown] = PT_None;
  1694. parryTypeTable[AST_DiagonalUp][ASD_DownUp] = PT_None;
  1695. parryTypeTable[AST_DiagonalUp][ASD_LeftRight] = PT_UpLeft;
  1696. parryTypeTable[AST_DiagonalUp][ASD_RightLeft] = PT_RightUp;
  1697. parryTypeTable[AST_DiagonalDown][ASD_UpDown] = PT_None;
  1698. parryTypeTable[AST_DiagonalDown][ASD_DownUp] = PT_None;
  1699. parryTypeTable[AST_DiagonalDown][ASD_LeftRight] = PT_LeftDown;
  1700. parryTypeTable[AST_DiagonalDown][ASD_RightLeft] = PT_DownRight;
  1701. parryTypeTable[AST_Jab][ASD_UpDown] = PT_Jab;
  1702. parryTypeTable[AST_Jab][ASD_DownUp] = PT_Jab;
  1703. parryTypeTable[AST_Jab][ASD_LeftRight] = PT_Jab;
  1704. parryTypeTable[AST_Jab][ASD_RightLeft] = PT_Jab;
  1705. }
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.  
  1712. event OnDeath( damageAction : W3DamageAction )
  1713. {
  1714. var items : array< SItemUniqueId >;
  1715. var i, size : int;
  1716. var slot : EEquipmentSlots;
  1717. var holdSlot : name;
  1718.  
  1719. super.OnDeath( damageAction );
  1720.  
  1721. items = GetHeldItems();
  1722.  
  1723. if( rangedWeapon && rangedWeapon.GetCurrentStateName() != 'State_WeaponWait')
  1724. {
  1725. OnRangedForceHolster( true, true, true );
  1726. rangedWeapon.ClearDeployedEntity(true);
  1727. }
  1728.  
  1729. size = items.Size();
  1730.  
  1731. if ( size > 0 )
  1732. {
  1733. for ( i = 0; i < size; i += 1 )
  1734. {
  1735. if ( this.inv.IsIdValid( items[i] ) && !( this.inv.IsItemCrossbow( items[i] ) ) )
  1736. {
  1737. holdSlot = this.inv.GetItemHoldSlot( items[i] );
  1738.  
  1739. if ( holdSlot == 'l_weapon' && this.IsHoldingItemInLHand() )
  1740. {
  1741. this.OnUseSelectedItem( true );
  1742. }
  1743.  
  1744. DropItemFromSlot( holdSlot, false );
  1745.  
  1746. if ( holdSlot == 'r_weapon' )
  1747. {
  1748. slot = this.GetItemSlot( items[i] );
  1749. if ( UnequipItemFromSlot( slot ) )
  1750. Log( "Unequip" );
  1751. }
  1752. }
  1753. }
  1754. }
  1755. }
  1756.  
  1757.  
  1758.  
  1759.  
  1760.  
  1761.  
  1762.  
  1763. function HandleMovement( deltaTime : float )
  1764. {
  1765. super.HandleMovement( deltaTime );
  1766.  
  1767. rawCameraHeading = theCamera.GetCameraHeading();
  1768. }
  1769.  
  1770.  
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776. function ToggleSpecialAttackHeavyAllowed( toggle : bool)
  1777. {
  1778. specialAttackHeavyAllowed = toggle;
  1779. }
  1780.  
  1781. function GetReputationManager() : W3Reputation
  1782. {
  1783. return reputationManager;
  1784. }
  1785.  
  1786. function OnRadialMenuItemChoose( selectedItem : string )
  1787. {
  1788. var iSlotId : int;
  1789. var item : SItemUniqueId;
  1790.  
  1791. if ( selectedItem != "Crossbow" )
  1792. {
  1793. if ( rangedWeapon && rangedWeapon.GetCurrentStateName() != 'State_WeaponWait' )
  1794. OnRangedForceHolster( true, false );
  1795. }
  1796.  
  1797.  
  1798. switch(selectedItem)
  1799. {
  1800.  
  1801. case "Meditation":
  1802. theGame.RequestMenuWithBackground( 'MeditationClockMenu', 'CommonMenu' );
  1803. break;
  1804. // -= WMK:modQuickSlots =-
  1805. /*
  1806. case "Slot1":
  1807. GetItemEquippedOnSlot( EES_Petard1, item );
  1808. if( thePlayer.inv.IsIdValid( item ) )
  1809. {
  1810. SelectQuickslotItem( EES_Petard1 );
  1811. }
  1812. else
  1813. {
  1814. SelectQuickslotItem( EES_Petard2 );
  1815. }
  1816. break;
  1817.  
  1818. case "Slot2":
  1819. GetItemEquippedOnSlot( EES_Petard2, item );
  1820. if( thePlayer.inv.IsIdValid( item ) )
  1821. {
  1822. SelectQuickslotItem( EES_Petard2 );
  1823. }
  1824. else
  1825. {
  1826. SelectQuickslotItem( EES_Petard1 );
  1827. }
  1828. break;
  1829. */
  1830. case "Slot1":
  1831. SelectQuickslotItem(EES_Petard1);
  1832. break;
  1833. case "Slot2":
  1834. SelectQuickslotItem(EES_Petard2);
  1835. break;
  1836. case "Slot5":
  1837. SelectQuickslotItem(EES_Petard3);
  1838. break;
  1839. case "Slot6":
  1840. SelectQuickslotItem(EES_Petard4);
  1841. break;
  1842. // -= WMK:modQuickSlots =-
  1843.  
  1844. case "Crossbow":
  1845. SelectQuickslotItem(EES_RangedWeapon);
  1846. break;
  1847.  
  1848. case "Slot3":
  1849. GetItemEquippedOnSlot( EES_Quickslot1, item );
  1850. if( thePlayer.inv.IsIdValid( item ) )
  1851. {
  1852. SelectQuickslotItem( EES_Quickslot1 );
  1853. }
  1854. else
  1855. {
  1856. SelectQuickslotItem( EES_Quickslot2 );
  1857. }
  1858. break;
  1859.  
  1860. case "Slot4":
  1861. GetItemEquippedOnSlot( EES_Quickslot2, item );
  1862. if( thePlayer.inv.IsIdValid( item ) )
  1863. {
  1864. SelectQuickslotItem( EES_Quickslot2 );
  1865. }
  1866. else
  1867. {
  1868. SelectQuickslotItem( EES_Quickslot1 );
  1869. }
  1870. break;
  1871.  
  1872. default:
  1873. SetEquippedSign(SignStringToEnum( selectedItem ));
  1874. FactsRemove("SignToggled");
  1875. break;
  1876. }
  1877. }
  1878.  
  1879. function ToggleNextItem()
  1880. {
  1881. var quickSlotItems : array< EEquipmentSlots >;
  1882. var currentSelectedItem : SItemUniqueId;
  1883. var item : SItemUniqueId;
  1884. var i : int;
  1885.  
  1886. for( i = EES_Quickslot2; i > EES_Petard1 - 1; i -= 1 )
  1887. {
  1888. GetItemEquippedOnSlot( i, item );
  1889. if( inv.IsIdValid( item ) )
  1890. {
  1891. quickSlotItems.PushBack( i );
  1892. }
  1893. }
  1894. if( !quickSlotItems.Size() )
  1895. {
  1896. return;
  1897. }
  1898.  
  1899. currentSelectedItem = GetSelectedItemId();
  1900.  
  1901. if( inv.IsIdValid( currentSelectedItem ) )
  1902. {
  1903. for( i = 0; i < quickSlotItems.Size(); i += 1 )
  1904. {
  1905. GetItemEquippedOnSlot( quickSlotItems[i], item );
  1906. if( currentSelectedItem == item )
  1907. {
  1908. if( i == quickSlotItems.Size() - 1 )
  1909. {
  1910. SelectQuickslotItem( quickSlotItems[ 0 ] );
  1911. }
  1912. else
  1913. {
  1914. SelectQuickslotItem( quickSlotItems[ i + 1 ] );
  1915. }
  1916. return;
  1917. }
  1918. }
  1919. }
  1920. else
  1921. {
  1922. SelectQuickslotItem( quickSlotItems[ 0 ] );
  1923. }
  1924. }
  1925.  
  1926.  
  1927. function SetEquippedSign( signType : ESignType )
  1928. {
  1929. if(!IsSignBlocked(signType))
  1930. {
  1931. equippedSign = signType;
  1932. FactsSet("CurrentlySelectedSign", equippedSign);
  1933. }
  1934. }
  1935.  
  1936. function GetEquippedSign() : ESignType
  1937. {
  1938. return equippedSign;
  1939. }
  1940.  
  1941. function GetCurrentlyCastSign() : ESignType
  1942. {
  1943. return currentlyCastSign;
  1944. }
  1945.  
  1946. function SetCurrentlyCastSign( type : ESignType, entity : W3SignEntity )
  1947. {
  1948. currentlyCastSign = type;
  1949.  
  1950. if( type != ST_None )
  1951. {
  1952. signs[currentlyCastSign].entity = entity;
  1953. }
  1954. }
  1955.  
  1956. function GetCurrentSignEntity() : W3SignEntity
  1957. {
  1958. if(currentlyCastSign == ST_None)
  1959. return NULL;
  1960.  
  1961. return signs[currentlyCastSign].entity;
  1962. }
  1963.  
  1964. public function GetSignEntity(type : ESignType) : W3SignEntity
  1965. {
  1966. if(type == ST_None)
  1967. return NULL;
  1968.  
  1969. return signs[type].entity;
  1970. }
  1971.  
  1972. public function GetSignTemplate(type : ESignType) : CEntityTemplate
  1973. {
  1974. if(type == ST_None)
  1975. return NULL;
  1976.  
  1977. return signs[type].template;
  1978. }
  1979.  
  1980. public function IsCurrentSignChanneled() : bool
  1981. {
  1982. if( currentlyCastSign != ST_None && signs[currentlyCastSign].entity)
  1983. return signs[currentlyCastSign].entity.OnCheckChanneling();
  1984.  
  1985. return false;
  1986. }
  1987.  
  1988. function IsCastingSign() : bool
  1989. {
  1990. return currentlyCastSign != ST_None;
  1991. }
  1992.  
  1993.  
  1994. protected function IsInCombatActionCameraRotationEnabled() : bool
  1995. {
  1996. if( IsInCombatAction() && ( GetCombatAction() == EBAT_EMPTY || GetCombatAction() == EBAT_Parry ) )
  1997. {
  1998. return true;
  1999. }
  2000.  
  2001. return !bIsInCombatAction;
  2002. }
  2003.  
  2004. function SetHoldBeforeOpenRadialMenuTime ( time : float )
  2005. {
  2006. _HoldBeforeOpenRadialMenuTime = time;
  2007. }
  2008.  
  2009.  
  2010.  
  2011.  
  2012.  
  2013.  
  2014.  
  2015. public function RepairItem ( rapairKitId : SItemUniqueId, usedOnItem : SItemUniqueId )
  2016. {
  2017. var itemMaxDurablity : float;
  2018. var itemCurrDurablity : float;
  2019. var baseRepairValue : float;
  2020. var reapirValue : float;
  2021. var itemAttribute : SAbilityAttributeValue;
  2022. var dmgBoost : float; //modSigns
  2023.  
  2024. itemMaxDurablity = inv.GetItemMaxDurability(usedOnItem);
  2025. itemCurrDurablity = inv.GetItemDurability(usedOnItem);
  2026. itemAttribute = inv.GetItemAttributeValue ( rapairKitId, 'repairValue' );
  2027.  
  2028. /*if( itemCurrDurablity >= itemMaxDurablity )
  2029. {
  2030. return;
  2031. }*/ //modSigns
  2032.  
  2033. if ( inv.IsItemAnyArmor ( usedOnItem )|| inv.IsItemWeapon( usedOnItem ) )
  2034. {
  2035. //modSigns: master repair kits increase item level
  2036. if( inv.ItemHasTag( rapairKitId, 'ArmorReapairKit_Master' ) || inv.ItemHasTag( rapairKitId, 'WeaponReapairKit_Master' ) )
  2037. {
  2038. inv.AddItemLevelAbility( usedOnItem );
  2039. //if( inv.ItemHasTag( usedOnItem, 'Aerondight' ) )
  2040. //{
  2041. // dmgBoost = inv.GetItemModifierFloat( usedOnItem, 'PermDamageBoost' );
  2042. // if( dmgBoost > 10 )
  2043. // inv.SetItemModifierFloat( usedOnItem, 'PermDamageBoost', dmgBoost - 10 );
  2044. //}
  2045. }
  2046.  
  2047. baseRepairValue = itemMaxDurablity * itemAttribute.valueMultiplicative;
  2048. reapirValue = MinF( itemCurrDurablity + baseRepairValue, itemMaxDurablity );
  2049.  
  2050. inv.SetItemDurabilityScript ( usedOnItem, MinF ( reapirValue, itemMaxDurablity ));
  2051. }
  2052.  
  2053. inv.RemoveItem ( rapairKitId, 1 );
  2054.  
  2055. }
  2056. public function HasRepairAbleGearEquiped ( ) : bool
  2057. {
  2058. var curEquipedItem : SItemUniqueId;
  2059.  
  2060. return ( GetItemEquippedOnSlot(EES_Armor, curEquipedItem) || GetItemEquippedOnSlot(EES_Boots, curEquipedItem) || GetItemEquippedOnSlot(EES_Pants, curEquipedItem) || GetItemEquippedOnSlot(EES_Gloves, curEquipedItem)) == true;
  2061. }
  2062. public function HasRepairAbleWaponEquiped () : bool
  2063. {
  2064. var curEquipedItem : SItemUniqueId;
  2065.  
  2066. return ( GetItemEquippedOnSlot(EES_SilverSword, curEquipedItem) || GetItemEquippedOnSlot(EES_SteelSword, curEquipedItem) ) == true;
  2067. }
  2068. public function IsItemRepairAble ( item : SItemUniqueId ) : bool
  2069. {
  2070. return inv.HasItemDurability(item); //inv.GetItemDurabilityRatio(item) <= 0.99999f; //modSigns
  2071. }
  2072.  
  2073.  
  2074.  
  2075.  
  2076.  
  2077.  
  2078.  
  2079.  
  2080. public function ApplyOil( oilId : SItemUniqueId, usedOnItem : SItemUniqueId ) : bool
  2081. {
  2082. var tutStateOil : W3TutorialManagerUIHandlerStateOils;
  2083.  
  2084. // CA
  2085. if( !super.CanApplyOilOnItem( oilId, usedOnItem ) )
  2086. {
  2087. return false;
  2088. }
  2089.  
  2090. if (CAOilAnimOn() && ((thePlayer.IsInCombat() && CAOilCombat() ) || thePlayer.GetCurrentStateName() == 'Exploration')) {
  2091. completeAnims.SetOil( oilId );
  2092. completeAnims.SetOilOnItem( usedOnItem );
  2093. completeAnims.OilAnim(inv.GetItemCategory(usedOnItem));
  2094. } else {
  2095. super.ApplyOil( oilId, usedOnItem );
  2096. }
  2097. // CA
  2098.  
  2099. if(ShouldProcessTutorial('TutorialOilCanEquip3'))
  2100. {
  2101. tutStateOil = (W3TutorialManagerUIHandlerStateOils)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
  2102. if(tutStateOil)
  2103. {
  2104. tutStateOil.OnOilApplied();
  2105. }
  2106. }
  2107.  
  2108. return true;
  2109. }
  2110.  
  2111. private final function RemoveExtraOilsFromItem( item : SItemUniqueId )
  2112. {
  2113. var oils : array< CBaseGameplayEffect >;
  2114. var i, cnt : int;
  2115. var buff : W3Effect_Oil;
  2116.  
  2117. oils = GetBuffs( EET_Oil );
  2118. for( i=0; i<oils.Size(); i+=1 )
  2119. {
  2120. buff = (W3Effect_Oil) oils[ i ];
  2121. if( buff && buff.GetSwordItemId() == item )
  2122. {
  2123. cnt += 1;
  2124. }
  2125. }
  2126. while( cnt > 1 )
  2127. {
  2128. inv.RemoveOldestOilFromItem( item );
  2129. cnt -= 1;
  2130. }
  2131. }
  2132.  
  2133.  
  2134.  
  2135.  
  2136.  
  2137.  
  2138.  
  2139.  
  2140. //modSigns: separate function for dodge
  2141. function DodgeDamage(out damageData : W3DamageAction)
  2142. {
  2143. var actorAttacker : CActor;
  2144. var attackRange : CAIAttackRange;
  2145. var safeAngleDist, angleDist, distToAttacker, damageReduction : float;
  2146. var attackName : name;
  2147. var isDodging, isIceGiantSpecial : bool;
  2148.  
  2149. super.DodgeDamage(damageData);
  2150.  
  2151. actorAttacker = (CActor)damageData.attacker;
  2152. //modSigns: fix dodge detection bug - shouldn't be needed anymore, but leaving it here just in case
  2153. isDodging = IsCurrentlyDodging() || IsInCombatAction() && ((int)GetBehaviorVariable( 'combatActionType' ) == CAT_Dodge || (int)GetBehaviorVariable( 'combatActionType' ) == CAT_Roll);
  2154.  
  2155. //modSigns: debug
  2156. if( FactsQuerySum( "modSigns_debug_reduce_damage" ) > 0 )
  2157. {
  2158. theGame.witcherLog.AddMessage("Is in combat action: " + (int)IsInCombatAction());
  2159. theGame.witcherLog.AddMessage("Player action: " + GetBehaviorVariable( 'combatActionType' ));
  2160. theGame.witcherLog.AddMessage("Player is dodging: " + isDodging);
  2161. }
  2162.  
  2163. if(actorAttacker && isDodging && !(damageData.IsActionEnvironment() || damageData.IsDoTDamage()))
  2164. {
  2165. attackName = actorAttacker.GetLastAttackRangeName();
  2166. angleDist = AbsF(AngleDistance(evadeHeading, actorAttacker.GetHeading()));
  2167. attackRange = theGame.GetAttackRangeForEntity(actorAttacker, attackName);
  2168. distToAttacker = VecDistance(this.GetWorldPosition(), damageData.attacker.GetWorldPosition());
  2169. isIceGiantSpecial = ( attackName == 'stomp' || attackName == 'anchor_special_far' || attackName == 'anchor_far' );
  2170. //Fleet Footed graze damage reduction
  2171. if( CanUseSkill(S_Sword_s09) )
  2172. damageReduction = CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s09, 's9_damage_reduction', false, true)) * GetSkillLevel(S_Sword_s09);
  2173. else
  2174. damageReduction = 0;
  2175. //attack can be dodged
  2176. if( damageData.CanBeDodged() )
  2177. {
  2178. //set up safe angle distance
  2179. safeAngleDist = 120;
  2180. if( HasAbility('ArmorTypeLightSetBonusAbility') )
  2181. safeAngleDist += CalculateAttributeValue(GetAbilityAttributeValue('ArmorTypeLightSetBonusAbility', 'dodge_safe_ange_dist_deg'));
  2182. safeAngleDist = ClampF( safeAngleDist, 0, 180 );
  2183. //check dodge success
  2184. if( angleDist <= safeAngleDist && !isIceGiantSpecial || isIceGiantSpecial && distToAttacker > attackRange.rangeMax * 0.75 )
  2185. {
  2186. if( theGame.CanLog() )
  2187. {
  2188. LogDMHits("W3PlayerWitcher.DodgeDamage: Attack dodged by player - no damage done", damageData);
  2189. }
  2190. damageData.SetWasDodged();
  2191. }
  2192. }
  2193. //graze damage reduction
  2194. if( !damageData.WasDodged() && damageReduction > 0 )
  2195. {
  2196. if( theGame.CanLog() )
  2197. {
  2198. LogDMHits("W3PlayerWitcher.DodgeDamage: reduced damage while dodging an attack", damageData );
  2199. }
  2200. damageData.SetGrazeDamageReduction(damageReduction);
  2201. }
  2202. //modSigns: debug
  2203. if( FactsQuerySum( "modSigns_debug_reduce_damage" ) > 0 )
  2204. {
  2205. theGame.witcherLog.AddMessage("Fleet Footed damage reduction: " + damageReduction);
  2206. theGame.witcherLog.AddMessage("Attack name: " + attackName);
  2207. theGame.witcherLog.AddMessage("Attack can be dodged: " + damageData.CanBeDodged());
  2208. theGame.witcherLog.AddMessage("Safe angle distance: " + safeAngleDist);
  2209. theGame.witcherLog.AddMessage("Attacker and evade angle distance: " + angleDist);
  2210. theGame.witcherLog.AddMessage("Attack range: " + attackRange.rangeMax);
  2211. theGame.witcherLog.AddMessage("Distance to attacker: " + distToAttacker);
  2212. theGame.witcherLog.AddMessage("Damage was dodged completely: " + damageData.WasDodged());
  2213. }
  2214. }
  2215. }
  2216.  
  2217. //modSigns: rewritten
  2218. function ReduceDamage(out damageData : W3DamageAction)
  2219. {
  2220. var quen : W3QuenEntity;
  2221. var min, max : SAbilityAttributeValue;
  2222. var /*currAdrenaline, adrenReducedDmg, focus,*/ chance : float;
  2223. var whirlDmgReduction : SAbilityAttributeValue;
  2224.  
  2225. super.ReduceDamage(damageData);
  2226.  
  2227. //new mutagen27 effect: prevent chain damage
  2228. if(HasBuff(EET_Mutagen27) && !(damageData.IsActionEnvironment() || damageData.IsDoTDamage()))
  2229. {
  2230. ((W3Mutagen27_Effect)GetBuff(EET_Mutagen27)).ReduceDamage(damageData);
  2231. }
  2232.  
  2233. //damage prevented
  2234. if(!damageData.DealsAnyDamage())
  2235. return;
  2236.  
  2237. //modSigns: dodge detection moved to separate function!
  2238. //reduce damage from dodging, if was partially dodged
  2239. if(damageData.IsGrazeDamage())
  2240. {
  2241. damageData.processedDmg.vitalityDamage *= ClampF( 1 - damageData.GetGrazeDamageReduction(), 0.05, 1 );
  2242. //modSigns: debug
  2243. if( FactsQuerySum( "modSigns_debug_reduce_damage" ) > 0 )
  2244. {
  2245. theGame.witcherLog.AddMessage("Is graze damage: " + damageData.IsGrazeDamage());
  2246. theGame.witcherLog.AddMessage("Graze damage reduction: " + damageData.GetGrazeDamageReduction());
  2247. }
  2248. }
  2249.  
  2250. quen = (W3QuenEntity)signs[ST_Quen].entity;
  2251.  
  2252. //Protective Coating damage reduction
  2253. if( !damageData.IsDoTDamage() && CanUseSkill(S_Alchemy_s05) )
  2254. {
  2255. damageData.processedDmg.vitalityDamage *= ClampF(1 - GetOilProtectionAgainstMonster(damageData), 0.f, 1.f);
  2256. //modSigns: debug
  2257. if( FactsQuerySum( "modSigns_debug_reduce_damage" ) > 0 )
  2258. {
  2259. theGame.witcherLog.AddMessage("Oil protection against monster: " + GetOilProtectionAgainstMonster(damageData));
  2260. }
  2261. }
  2262.  
  2263. //Mutated Skin passive ability -> changed
  2264. //if( IsMutationActive( EPMT_Mutation5 ) && !IsAnyQuenActive() && !damageData.IsDoTDamage() )
  2265. //{
  2266. // focus = GetStat( BCS_Focus );
  2267. // currAdrenaline = FloorF( focus );
  2268. // if( currAdrenaline >= 1 )
  2269. // {
  2270. // theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation5', 'mut5_dmg_red_perc', min, max );
  2271. // adrenReducedDmg = ( currAdrenaline * min.valueAdditive );
  2272. // damageData.processedDmg.vitalityDamage *= ClampF(1 - adrenReducedDmg, 0, 1);
  2273. //
  2274. //
  2275. // theGame.MutationHUDFeedback( MFT_PlayOnce );
  2276. //
  2277. // if( focus >= 3.f )
  2278. // {
  2279. // PlayEffect( 'mutation_5_stage_03' );
  2280. // }
  2281. // else if( focus >= 2.f )
  2282. // {
  2283. // PlayEffect( 'mutation_5_stage_02' );
  2284. // }
  2285. // else
  2286. // {
  2287. // PlayEffect( 'mutation_5_stage_01' );
  2288. // }
  2289. // }
  2290. //}
  2291.  
  2292. //modSigns: whirl incoming damage reduction
  2293. if( !damageData.IsDoTDamage() && GetStat(BCS_Focus) >= 1 && IsDoingSpecialAttack(false) )
  2294. {
  2295. whirlDmgReduction = GetSkillAttributeValue(S_Sword_s01, 'whirl_dmg_reduction', false, true)
  2296. + GetSkillAttributeValue(S_Sword_s01, 'whirl_dmg_reduction_bonus_after_1', false, true) * (GetSkillLevel(S_Sword_s01) - 1);
  2297. damageData.processedDmg.vitalityDamage *= ClampF(1 - whirlDmgReduction.valueMultiplicative, 0.f, 1.f);
  2298. DrainFocus(1);
  2299. PauseFocusGain( true );
  2300. AddTimer( 'ResumeFocusGain', 1.f );
  2301. //theGame.witcherLog.AddMessage("Whirl damage reduction."); //modSigns: debug
  2302. }
  2303.  
  2304. //modSigns: cast quen on projectile ability, moved here
  2305. if((!quen || !quen.IsAnyQuenActive()) && damageData.IsActionRanged() && !damageData.IsActionWitcherSign() && !damageData.IsDoTDamage() && !damageData.WasDodged())
  2306. {
  2307. chance = CalculateAttributeValue(GetAttributeValue('quen_chance_on_projectile'));
  2308. if(chance > 0)
  2309. {
  2310. chance = ClampF(chance, 0, 1);
  2311.  
  2312. if(RandF() < chance)
  2313. {
  2314. if(!quen)
  2315. {
  2316. quen = (W3QuenEntity)theGame.CreateEntity(signs[ST_Quen].template, GetWorldPosition(), GetWorldRotation() );
  2317. }
  2318. quen.Init(signOwner, signs[ST_Quen].entity, true );
  2319. quen.freeCast = true;
  2320. quen.OnStarted();
  2321. quen.OnThrowing();
  2322. quen.OnEnded();
  2323. if ( theGame.CanLog() )
  2324. {
  2325. LogDMHits("W3PlayerWitcher.ReduceDamage: Processing Quen On Projectile armor ability...", damageData);
  2326. }
  2327. //quen.OnTargetHit( damageData );
  2328. quen.ShowHitFX(); //modSigns: play FX
  2329. damageData.SetAllProcessedDamageAs(0);
  2330. damageData.SetEndsQuen(true);
  2331. }
  2332. }
  2333. }
  2334. //damage reduction from signs
  2335. //else if((quen && quen.IsAnyQuenActive()) && damageData.GetBuffSourceName() != "FallingDamage")
  2336. //{
  2337. // if ( theGame.CanLog() )
  2338. // {
  2339. // LogDMHits("W3PlayerWitcher.ReduceDamage: Processing Quen sign damage reduction...", damageData);
  2340. // }
  2341. // quen.OnTargetHit( damageData );
  2342. //} //modSigns: moved to damage manager to decrease raw damage
  2343.  
  2344. //modSigns: gryphon set tier 2 damage reduction - removed, adds resistances instead
  2345. /*if( HasBuff( EET_GryphonSetBonusYrden ) )
  2346. {
  2347. min = GetAttributeValue( 'gryphon_set_bns_dmg_reduction' );
  2348. damageData.processedDmg.vitalityDamage *= ClampF(1 - min.valueAdditive, 0, 1);
  2349. }*/
  2350.  
  2351.  
  2352. //if you need to copy-paste a part of a parent function
  2353. //and do some shitty dancing around a part of the code,
  2354. //this probably means that the code doesn't belong here
  2355. //and should be placed somewhere else instead... yeah?
  2356. //if(!damageData.GetIgnoreImmortalityMode())
  2357. //{
  2358. // if(!((W3PlayerWitcher)this))
  2359. // Log("");
  2360. //
  2361. //
  2362. // if( IsInvulnerable() )
  2363. // {
  2364. // if ( theGame.CanLog() )
  2365. // {
  2366. // LogDMHits("CActor.ReduceDamage: victim Invulnerable - no damage will be dealt", damageData );
  2367. // }
  2368. // damageData.SetAllProcessedDamageAs(0);
  2369. // return;
  2370. // }
  2371. //
  2372. // if(actorAttacker && damageData.DealsAnyDamage() )
  2373. // actorAttacker.SignalGameplayEventParamObject( 'DamageInstigated', damageData );
  2374. //
  2375. //
  2376. // if( IsImmortal() )
  2377. // {
  2378. // if ( theGame.CanLog() )
  2379. // {
  2380. // LogDMHits("CActor.ReduceDamage: victim is Immortal, clamping damage", damageData );
  2381. // }
  2382. // damageData.processedDmg.vitalityDamage = ClampF(damageData.processedDmg.vitalityDamage, 0, GetStat(BCS_Vitality)-1 );
  2383. // damageData.processedDmg.essenceDamage = ClampF(damageData.processedDmg.essenceDamage, 0, GetStat(BCS_Essence)-1 );
  2384. // return;
  2385. // }
  2386. //}
  2387. //else
  2388. //{
  2389. //
  2390. // if(actorAttacker && damageData.DealsAnyDamage() )
  2391. // actorAttacker.SignalGameplayEventParamObject( 'DamageInstigated', damageData );
  2392. //}
  2393. }
  2394.  
  2395. //modSigns
  2396. private function GetOilProtectionAgainstMonster(damageData : W3DamageAction) : float
  2397. {
  2398. var i : int;
  2399. var heldWeapons : array< SItemUniqueId >;
  2400. var weapon : SItemUniqueId;
  2401. var resist : float;
  2402. var attackerMonsterCategory : EMonsterCategory;
  2403. var tmpName : name;
  2404. var tmpBool : bool;
  2405.  
  2406. if( !((CActor)damageData.attacker) )
  2407. return 0;
  2408.  
  2409. resist = 0;
  2410. heldWeapons = inv.GetHeldWeapons();
  2411.  
  2412. for( i = 0; i < heldWeapons.Size(); i += 1 )
  2413. {
  2414. if( !inv.IsItemFists( heldWeapons[ i ] ) )
  2415. {
  2416. weapon = heldWeapons[ i ];
  2417. break;
  2418. }
  2419. }
  2420.  
  2421. if( !inv.IsIdValid( weapon ) )
  2422. return 0;
  2423.  
  2424. theGame.GetMonsterParamsForActor((CActor)damageData.attacker, attackerMonsterCategory, tmpName, tmpBool, tmpBool, tmpBool);
  2425.  
  2426. resist = inv.GetOilProtectionAgainstMonster(weapon, attackerMonsterCategory);
  2427.  
  2428. return resist;
  2429. }
  2430.  
  2431. /*timer function UndyingSkillCooldown(dt : float, id : int)
  2432. {
  2433. cannotUseUndyingSkill = false;
  2434. }*/
  2435.  
  2436. //modSigns
  2437. public function CastFreeQuen()
  2438. {
  2439. var quen : W3QuenEntity;
  2440.  
  2441. quen = (W3QuenEntity)signs[ST_Quen].entity;
  2442.  
  2443. if(!quen)
  2444. quen = (W3QuenEntity)theGame.CreateEntity(signs[ST_Quen].template, GetWorldPosition(), GetWorldRotation());
  2445.  
  2446. PlayEffect( 'quen_lasting_shield_back' ); //make use of vanilla bear set effect
  2447.  
  2448. quen.Init(signOwner, signs[ST_Quen].entity, true);
  2449. quen.freeCast = true;
  2450. quen.OnStarted();
  2451. quen.OnThrowing();
  2452. quen.OnEnded();
  2453. }
  2454.  
  2455. event OnTakeDamage( action : W3DamageAction)
  2456. {
  2457. var currVitality, rgnVitality, hpTriggerTreshold : float;
  2458. //var healingFactor : float;
  2459. var abilityName : name;
  2460. var abilityCount, maxStack, itemDurability : float;
  2461. var addAbility : bool;
  2462. var min, max : SAbilityAttributeValue;
  2463. //var mutagenQuen : W3SignEntity; //modSigns
  2464. var equipped : array<SItemUniqueId>;
  2465. var i : int;
  2466. var killSourceName : string;
  2467. var aerondight : W3Effect_Aerondight;
  2468. var phantomWeapon : W3Effect_PhantomWeapon; //modSigns
  2469. //var quen : W3QuenEntity; //modSigns
  2470. var mutation5CustomEffect : SCustomEffectParams; //modSigns
  2471.  
  2472. currVitality = GetStat(BCS_Vitality);
  2473. killSourceName = action.GetBuffSourceName();
  2474.  
  2475.  
  2476. if(action.processedDmg.vitalityDamage >= currVitality)
  2477. {
  2478. //killSourceName = action.GetBuffSourceName();
  2479.  
  2480.  
  2481. if( killSourceName != "Quest" && killSourceName != "Kill Trigger" && killSourceName != "Trap" && killSourceName != "FallingDamage" )
  2482. {
  2483. //modSigns: Second Life mutation will now have priority over Undying skill -> mutation changed
  2484. /*if( IsMutationActive( EPMT_Mutation11 ) && !HasBuff( EET_Mutation11Debuff ) && !IsInAir() )
  2485. {
  2486. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation11', 'health_prc', min, max );
  2487.  
  2488. action.SetAllProcessedDamageAs( 0 );
  2489.  
  2490. OnMutation11Triggered();
  2491. }
  2492. else*/ if(/*!cannotUseUndyingSkill*/ !HasBuff( EET_UndyingSkillImmortal ) && !HasBuff( EET_UndyingSkillCooldown ) && GetStat(BCS_Focus) >= 1 && CanUseSkill(S_Sword_s18) /*&& HasBuff(EET_BattleTrance)*/ )
  2493. {
  2494. //healingFactor = CalculateAttributeValue( GetSkillAttributeValue(S_Sword_s18, 'healing_factor', false, true) );
  2495. //healingFactor *= GetStatMax(BCS_Vitality);
  2496. //healingFactor *= GetStat(BCS_Focus);
  2497. //healingFactor *= 1 + CalculateAttributeValue( GetSkillAttributeValue(S_Sword_s18, 'healing_bonus', false, true) ) * (GetSkillLevel(S_Sword_s18) - 1);
  2498. action.SetAllProcessedDamageAs( 0 ); //modSigns
  2499. ForceSetStat(BCS_Vitality, 1); //modSigns: heal 1 point of damage
  2500. //DrainFocus(GetStat(BCS_Focus));
  2501. //RemoveBuff(EET_BattleTrance);
  2502. //cannotUseUndyingSkill = true;
  2503. AddEffectDefault( EET_UndyingSkillImmortal, NULL, "UndyingSkill" ); //modSigns: brief immortality
  2504. //AddTimer('UndyingSkillCooldown', CalculateAttributeValue( GetSkillAttributeValue(S_Sword_s18, 'trigger_delay', false, true) ), false, , , true);
  2505. }
  2506. else
  2507. {
  2508.  
  2509. equipped = GetEquippedItems();
  2510.  
  2511. for(i=0; i<equipped.Size(); i+=1)
  2512. {
  2513. if ( !inv.IsIdValid( equipped[i] ) )
  2514. {
  2515. continue;
  2516. }
  2517. itemDurability = inv.GetItemDurability(equipped[i]);
  2518. if(inv.ItemHasAbility(equipped[i], 'MA_Reinforced') && itemDurability > 0)
  2519. {
  2520.  
  2521. inv.SetItemDurabilityScript(equipped[i], MaxF(0, itemDurability - action.processedDmg.vitalityDamage) );
  2522.  
  2523.  
  2524. action.processedDmg.vitalityDamage = 0;
  2525. ForceSetStat(BCS_Vitality, 1);
  2526.  
  2527. break;
  2528. }
  2529. }
  2530. }
  2531. }
  2532. }
  2533.  
  2534. //modSigns: new Mutated Skin ability
  2535. if(IsMutationActive(EPMT_Mutation5) && !action.IsDoTDamage() && action.processedDmg.vitalityDamage > 0.0 && GetStat(BCS_Focus) >= 1.0)
  2536. {
  2537. if(action.processedDmg.vitalityDamage < currVitality || killSourceName != "Quest" && killSourceName != "Kill Trigger" && killSourceName != "Trap" && killSourceName != "FallingDamage")
  2538. {
  2539. theGame.GetDefinitionsManager().GetAbilityAttributeValue('Mutation5', 'mut5_duration_per_point', min, max);
  2540. //custom effect params
  2541. mutation5CustomEffect.effectType = EET_Mutation5;
  2542. mutation5CustomEffect.creator = this;
  2543. mutation5CustomEffect.sourceName = "mutation5";
  2544. mutation5CustomEffect.duration = min.valueAdditive * GetStat(BCS_Focus);
  2545. mutation5CustomEffect.effectValue.valueAdditive = action.processedDmg.vitalityDamage / mutation5CustomEffect.duration;
  2546. AddEffectCustom(mutation5CustomEffect);
  2547. //the damage is considered to be dealt by the rest of the code (for the swords,
  2548. //mutagens, etc to work as usual), but DrainVitality is actually omitted
  2549. action.SetMutation5Triggered();
  2550. }
  2551. }
  2552.  
  2553.  
  2554. //if(action.DealsAnyDamage() && !((W3Effect_Toxicity)action.causer) )
  2555. //{
  2556. // //if(HasBuff(EET_Mutagen10))
  2557. // // RemoveAbilityAll( GetBuff(EET_Mutagen10).GetAbilityName() ); //modSigns: changed
  2558. //
  2559. // //if(HasBuff(EET_Mutagen15))
  2560. // // RemoveAbilityAll( GetBuff(EET_Mutagen15).GetAbilityName() ); //modSigns: changed
  2561. //}
  2562.  
  2563.  
  2564. /*quen = (W3QuenEntity)signs[ST_Quen].entity; //modSigns
  2565. if(HasBuff(EET_Mutagen19) && (!quen || !quen.IsAnyQuenActive())) //modSigns
  2566. {
  2567. theGame.GetDefinitionsManager().GetAbilityAttributeValue(GetBuff(EET_Mutagen19).GetAbilityName(), 'max_hp_perc_trigger', min, max);
  2568. hpTriggerTreshold = GetStatMax(BCS_Vitality) * CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  2569.  
  2570. //theGame.witcherLog.AddMessage( "hpTriggerTreshold = " + hpTriggerTreshold );
  2571. //theGame.witcherLog.AddMessage( "damage = " + action.GetDamageDealt() );
  2572.  
  2573. if(action.GetDamageDealt() >= hpTriggerTreshold)
  2574. {
  2575. if(!quen) //modSigns
  2576. {
  2577. quen = (W3QuenEntity)theGame.CreateEntity( signs[ST_Quen].template, GetWorldPosition(), GetWorldRotation() );
  2578. }
  2579. quen.Init( signOwner, signs[ST_Quen].entity, true );
  2580. quen.freeCast = true; //modSigns
  2581. quen.OnStarted();
  2582. quen.OnThrowing();
  2583. quen.OnEnded();
  2584. }
  2585. }*/ //modSigns: reworked
  2586.  
  2587.  
  2588. /*if(action.DealsAnyDamage() && !action.IsDoTDamage() && HasBuff(EET_Mutagen27))
  2589. {
  2590. abilityName = GetBuff(EET_Mutagen27).GetAbilityName();
  2591. abilityCount = GetAbilityCount(abilityName);
  2592.  
  2593. if(abilityCount == 0)
  2594. {
  2595. addAbility = true;
  2596. }
  2597. else
  2598. {
  2599. theGame.GetDefinitionsManager().GetAbilityAttributeValue(abilityName, 'mutagen27_max_stack', min, max);
  2600. maxStack = CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  2601.  
  2602. if(maxStack >= 0)
  2603. {
  2604. addAbility = (abilityCount < maxStack);
  2605. }
  2606. else
  2607. {
  2608. addAbility = true;
  2609. }
  2610. }
  2611.  
  2612. if(addAbility)
  2613. {
  2614. AddAbility(abilityName, true);
  2615. }
  2616. }*/ //modSigns: reworked
  2617.  
  2618. if(HasBuff(EET_Trap) && !action.IsDoTDamage() && action.attacker.HasAbility( 'mon_dettlaff_monster_base' ))
  2619. {
  2620. action.AddEffectInfo(EET_Knockdown);
  2621. RemoveBuff(EET_Trap, true);
  2622. }
  2623.  
  2624. super.OnTakeDamage(action);
  2625.  
  2626.  
  2627. //modSigns: Aerondight and Iris
  2628. if( !action.WasDodged() && action.DealtDamage() && !action.IsDoTDamage() && !( (W3Effect_Toxicity) action.causer ) )
  2629. {
  2630. if( inv.ItemHasTag( inv.GetCurrentlyHeldSword(), 'Aerondight' ) )
  2631. {
  2632. aerondight = (W3Effect_Aerondight)GetBuff( EET_Aerondight );
  2633. if( aerondight /*&& aerondight.GetCurrentCount() != 0*/ )
  2634. {
  2635. //aerondight.ReduceAerondightStacks();
  2636. //modSigns: now resets on damage taken
  2637. aerondight.ResetCharges();
  2638. }
  2639. }
  2640. if( inv.ItemHasTag( inv.GetCurrentlyHeldSword(), 'PhantomWeapon' ) )
  2641. {
  2642. phantomWeapon = (W3Effect_PhantomWeapon)GetBuff( EET_PhantomWeapon );
  2643. if( phantomWeapon )
  2644. phantomWeapon.ResetCharges();
  2645. }
  2646. }
  2647.  
  2648. //if( !action.WasDodged() && action.DealtDamage() && !( (W3Effect_Toxicity) action.causer ) )
  2649. //{
  2650. // RemoveBuff( EET_Mutation3 );
  2651. //} //modSigns: reworked
  2652.  
  2653.  
  2654. //modSigns: new mutation3 (Bloodbath effect)
  2655. if(HasBuff(EET_Mutation3))
  2656. ((W3Effect_Mutation3)GetBuff(EET_Mutation3)).ManageMutation3Bonus(action);
  2657. //modSigns: new Mutagen02 effect
  2658. if(HasBuff(EET_Mutagen02) && !action.WasDodged() && action.DealtDamage() && action.IsActionMelee())
  2659. ((W3Mutagen02_Effect)GetBuff(EET_Mutagen02)).AddDebuffToEnemy((CActor)action.attacker);
  2660. //modSigns: new mutagen05 effect
  2661. if(HasBuff(EET_Mutagen05))
  2662. ((W3Mutagen05_Effect)GetBuff(EET_Mutagen05)).ManageMutagen05Bonus(action);
  2663. //modSigns: new mutagen15 effect
  2664. if(HasBuff(EET_Mutagen15))
  2665. ((W3Mutagen15_Effect)GetBuff(EET_Mutagen15)).ManageMutagen15Bonus(action);
  2666. //modSigns: new mutagen22 effect
  2667. if(HasBuff(EET_Mutagen22))
  2668. ((W3Mutagen22_Effect)GetBuff(EET_Mutagen22)).RemoveMutagen22Abilities(action);
  2669. //modSigns: new Mutagen27 effect
  2670. if(HasBuff(EET_Mutagen27) && !action.WasDodged() && action.DealtDamage() && !(action.IsActionEnvironment() || action.IsDoTDamage()))
  2671. ((W3Mutagen27_Effect)GetBuff(EET_Mutagen27)).AccumulateHits();
  2672. }
  2673.  
  2674.  
  2675.  
  2676.  
  2677.  
  2678.  
  2679.  
  2680. event OnStartFistfightMinigame()
  2681. {
  2682. var i : int;
  2683. var buffs : array< CBaseGameplayEffect >;
  2684.  
  2685.  
  2686. effectManager.RemoveAllPotionEffects();
  2687.  
  2688. abilityManager.DrainToxicity(GetStatMax( BCS_Toxicity ));
  2689.  
  2690. buffs = GetBuffs( EET_WellFed );
  2691. for( i=buffs.Size()-1; i>=0; i-=1 )
  2692. {
  2693. RemoveEffect( buffs[i] );
  2694. }
  2695.  
  2696.  
  2697. buffs.Clear();
  2698. buffs = GetBuffs( EET_WellHydrated );
  2699. for( i=buffs.Size()-1; i>=0; i-=1 )
  2700. {
  2701. RemoveEffect( buffs[i] );
  2702. }
  2703.  
  2704. super.OnStartFistfightMinigame();
  2705. }
  2706.  
  2707. event OnEndFistfightMinigame()
  2708. {
  2709. super.OnEndFistfightMinigame();
  2710. }
  2711.  
  2712.  
  2713. public function GetCriticalHitChance( isLightAttack : bool, isHeavyAttack : bool, target : CActor, victimMonsterCategory : EMonsterCategory, isBolt : bool ) : float
  2714. {
  2715. var ret : float;
  2716. var thunder : W3Potion_Thunderbolt;
  2717. var min, max : SAbilityAttributeValue;
  2718.  
  2719. ret = super.GetCriticalHitChance( isLightAttack, isHeavyAttack, target, victimMonsterCategory, isBolt );
  2720.  
  2721.  
  2722.  
  2723.  
  2724.  
  2725.  
  2726.  
  2727. thunder = ( W3Potion_Thunderbolt )GetBuff( EET_Thunderbolt );
  2728. if( thunder && thunder.GetBuffLevel() == 3 && GetCurWeather() == EWE_Storm )
  2729. {
  2730. ret += 1.0f;
  2731. }
  2732.  
  2733.  
  2734. if( isBolt && IsMutationActive( EPMT_Mutation9 ) )
  2735. {
  2736. theGame.GetDefinitionsManager().GetAbilityAttributeValue('Mutation9', 'critical_hit_chance', min, max);
  2737. ret += min.valueMultiplicative;
  2738. }
  2739.  
  2740.  
  2741. if( isBolt && CanUseSkill( S_Sword_s07 ) )
  2742. {
  2743. ret += CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s07, theGame.params.CRITICAL_HIT_CHANCE, false, true)) * GetSkillLevel(S_Sword_s07);
  2744. }
  2745.  
  2746. return ret;
  2747. }
  2748.  
  2749.  
  2750. public function GetCriticalHitDamageBonus(weaponId : SItemUniqueId, victimMonsterCategory : EMonsterCategory, isStrikeAtBack : bool) : SAbilityAttributeValue
  2751. {
  2752. var min, max, bonus, null, oilBonus : SAbilityAttributeValue;
  2753. var mutagen : CBaseGameplayEffect;
  2754. var monsterBonusType : name;
  2755.  
  2756. bonus = super.GetCriticalHitDamageBonus(weaponId, victimMonsterCategory, isStrikeAtBack);
  2757.  
  2758. if( inv.ItemHasActiveOilApplied( weaponId, victimMonsterCategory ) && GetStat( BCS_Focus ) >= 3 && CanUseSkill( S_Alchemy_s07 ) )
  2759. {
  2760. monsterBonusType = MonsterCategoryToAttackPowerBonus( victimMonsterCategory );
  2761. oilBonus = inv.GetItemAttributeValue( weaponId, monsterBonusType );
  2762. if(oilBonus != null)
  2763. {
  2764. //bonus += GetSkillAttributeValue(S_Alchemy_s07, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, true);
  2765. //modSigns: fix crit bonus
  2766. bonus += GetSkillAttributeValue(S_Alchemy_s07, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, false) * GetSkillLevel(S_Alchemy_s07);
  2767. }
  2768. //combat log
  2769. //theGame.witcherLog.AddCombatMessage("Crit dmg bonus: " + FloatToString(bonus.valueAdditive), thePlayer, NULL);
  2770. }
  2771.  
  2772. // Mutagen 11 - back strike bonus
  2773. if (isStrikeAtBack && HasBuff(EET_Mutagen11))
  2774. {
  2775. mutagen = GetBuff(EET_Mutagen11);
  2776. theGame.GetDefinitionsManager().GetAbilityAttributeValue(mutagen.GetAbilityName(), 'damageIncrease', min, max);
  2777. bonus += GetAttributeRandomizedValue(min, max);
  2778. }
  2779.  
  2780. return bonus;
  2781. }
  2782.  
  2783. public function ProcessLockTarget( optional newLockTarget : CActor, optional checkLeftStickHeading : bool ) : bool
  2784. {
  2785. var newLockTargetFound : bool;
  2786.  
  2787. newLockTargetFound = super.ProcessLockTarget(newLockTarget, checkLeftStickHeading);
  2788.  
  2789. if(GetCurrentlyCastSign() == ST_Axii)
  2790. {
  2791. ((W3AxiiEntity)GetCurrentSignEntity()).OnDisplayTargetChange(newLockTarget);
  2792. }
  2793.  
  2794. return newLockTargetFound;
  2795. }
  2796.  
  2797.  
  2798.  
  2799.  
  2800.  
  2801.  
  2802.  
  2803. event OnProcessActionPost(action : W3DamageAction)
  2804. {
  2805. var attackAction : W3Action_Attack;
  2806. var rendLoad, focusVal, stamCost, rendTimeRatio : float; //modSigns
  2807. var value : SAbilityAttributeValue;
  2808. var actorVictim : CActor;
  2809. var weaponId : SItemUniqueId;
  2810. var usesSteel, usesSilver, usesVitality, usesEssence : bool;
  2811. var abs : array<name>;
  2812. var i : int;
  2813. var dm : CDefinitionsManagerAccessor;
  2814. var items : array<SItemUniqueId>;
  2815. var weaponEnt : CEntity;
  2816. var lynxSetBuff : W3Effect_LynxSetBonus;
  2817. var min, max, nullBonus, oilBonus : SAbilityAttributeValue; //modSigns
  2818. var victimMonsterCategory : EMonsterCategory; //modSigns
  2819. var monsterBonusType : name; //modSigns
  2820. var tmpName : name; //modSigns
  2821. var tmpBool : bool; //modSigns
  2822.  
  2823. super.OnProcessActionPost(action);
  2824.  
  2825. attackAction = (W3Action_Attack)action;
  2826. actorVictim = (CActor)action.victim;
  2827.  
  2828. if(attackAction)
  2829. {
  2830. if(attackAction.IsActionMelee())
  2831. {
  2832.  
  2833. if(SkillNameToEnum(attackAction.GetAttackTypeName()) == S_Sword_s02)
  2834. {
  2835. //rendLoad = GetSpecialAttackTimeRatio();
  2836.  
  2837.  
  2838. //rendLoad = MinF(rendLoad * GetStatMax(BCS_Focus), GetStat(BCS_Focus));
  2839.  
  2840.  
  2841. //rendLoad = FloorF(rendLoad);
  2842.  
  2843. //modSigns
  2844. RendAoE(attackAction);
  2845.  
  2846. rendTimeRatio = GetSpecialAttackTimeRatio(); //save for bear tier 2
  2847.  
  2848. rendLoad = GetStat(BCS_Focus);
  2849.  
  2850. DrainFocus(rendLoad);
  2851.  
  2852. OnSpecialAttackHeavyActionProcess();
  2853. }
  2854. else if(actorVictim && IsRequiredAttitudeBetween(this, actorVictim, true)
  2855. && attackAction.DealsAnyDamage() && !attackAction.WasDodged() && !attackAction.IsParried() && !attackAction.IsCountered()) //modSigns: only gain adrenaline for actual damage dealt
  2856. {
  2857.  
  2858.  
  2859. value = GetAttributeValue('focus_gain');
  2860.  
  2861. if( FactsQuerySum("debug_fact_focus_boy") > 0 )
  2862. {
  2863. Debug_FocusBoyFocusGain();
  2864. }
  2865.  
  2866.  
  2867. if ( CanUseSkill(S_Sword_s20) )
  2868. {
  2869. value += GetSkillAttributeValue(S_Sword_s20, 'focus_gain', false, true) * GetSkillLevel(S_Sword_s20);
  2870. }
  2871.  
  2872. //modSigns
  2873. if( CanUseSkill(S_Sword_s21) && attackAction && attackAction.IsActionMelee() &&
  2874. IsLightAttack(attackAction.GetAttackName()) && !inv.IsItemFists(attackAction.GetWeaponId()) )
  2875. {
  2876. value += GetSkillAttributeValue(S_Sword_s21, 'light_focus_gain', false, true) * GetSkillLevel(S_Sword_s21);
  2877. }
  2878. if( CanUseSkill(S_Sword_s04) && attackAction && attackAction.IsActionMelee() &&
  2879. IsHeavyAttack(attackAction.GetAttackName()) && !inv.IsItemFists(attackAction.GetWeaponId()) )
  2880. {
  2881. value += GetSkillAttributeValue(S_Sword_s04, 'heavy_focus_gain', false, true) * GetSkillLevel(S_Sword_s04);
  2882. }
  2883.  
  2884. //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() )
  2885. //{
  2886. // AddEffectDefault( EET_Mutation3, this, "", false );
  2887. //} //modSigns: reworked
  2888.  
  2889. focusVal = 0.1f * (1 + CalculateAttributeValue(value));
  2890.  
  2891. if(!inv.IsItemFists(attackAction.GetWeaponId()))
  2892. {
  2893. //modSigns: lynx set tier 2 bonus - doubled adrenaline gain for critical hits
  2894. if( attackAction.IsCriticalHit() && IsSetBonusActive( EISB_Lynx_2 ) )
  2895. {
  2896. focusVal *= 2;
  2897. }
  2898.  
  2899. //modSigns: additional adrenaline for bear school perk
  2900. focusVal += CalculateAttributeValue(GetAttributeValue('bonus_focus_gain'));
  2901. }
  2902.  
  2903. //modSigns: new mutation7 (Adrenaline Rush)
  2904. //theGame.witcherLog.AddMessage("focus before adjustments: " + focusVal);
  2905. if(HasBuff(EET_Mutation7Buff))
  2906. focusVal *= 2;
  2907. else if(HasBuff(EET_Mutation7Debuff))
  2908. focusVal /= 2;
  2909.  
  2910. //theGame.witcherLog.AddMessage("focus gained: " + focusVal);
  2911.  
  2912. GainStat(BCS_Focus, focusVal);
  2913. }
  2914.  
  2915. //modSigns: bear tier 2 stamina restore
  2916. if(IsSetBonusActive(EISB_Bear_2) && attackAction.DealsAnyDamage() && !attackAction.WasDodged() && !attackAction.IsParried() && !attackAction.IsCountered())
  2917. {
  2918. if(SkillNameToEnum(attackAction.GetAttackTypeName()) == S_Sword_s02)
  2919. stamCost = rendTimeRatio * GetStatMax(BCS_Stamina);
  2920. else if(IsHeavyAttack(attackAction.GetAttackName()))
  2921. stamCost = GetStaminaActionCost(ESAT_HeavyAttack);
  2922. if(stamCost > 0)
  2923. {
  2924. theGame.GetDefinitionsManager().GetAbilityAttributeValue(GetSetBonusAbility(EISB_Bear_2), 'stamina_attack', min, max);
  2925. GainStat(BCS_Stamina, stamCost * min.valueAdditive);
  2926. //theGame.witcherLog.AddMessage("stamina gain: " + (stamCost * min.valueAdditive));
  2927. }
  2928. }
  2929.  
  2930. weaponId = attackAction.GetWeaponId();
  2931. if(actorVictim && (ShouldProcessTutorial('TutorialWrongSwordSteel') || ShouldProcessTutorial('TutorialWrongSwordSilver')) && GetAttitudeBetween(actorVictim, this) == AIA_Hostile)
  2932. {
  2933. usesSteel = inv.IsItemSteelSwordUsableByPlayer(weaponId);
  2934. usesSilver = inv.IsItemSilverSwordUsableByPlayer(weaponId);
  2935. usesVitality = actorVictim.UsesVitality();
  2936. usesEssence = actorVictim.UsesEssence();
  2937.  
  2938. if(usesSilver && usesVitality)
  2939. {
  2940. FactsAdd('tut_wrong_sword_silver',1);
  2941. }
  2942. else if(usesSteel && usesEssence)
  2943. {
  2944. FactsAdd('tut_wrong_sword_steel',1);
  2945. }
  2946. else if(FactsQuerySum('tut_wrong_sword_steel') && usesSilver && usesEssence)
  2947. {
  2948. FactsAdd('tut_proper_sword_silver',1);
  2949. FactsRemove('tut_wrong_sword_steel');
  2950. }
  2951. else if(FactsQuerySum('tut_wrong_sword_silver') && usesSteel && usesVitality)
  2952. {
  2953. FactsAdd('tut_proper_sword_steel',1);
  2954. FactsRemove('tut_wrong_sword_silver');
  2955. }
  2956. }
  2957.  
  2958.  
  2959. if(!action.WasDodged() && HasRunewordActive('Runeword 1 _Stats')) //modSigns
  2960. {
  2961. if(runewordInfusionType == ST_Axii)
  2962. {
  2963. actorVictim.SoundEvent('sign_axii_release');
  2964. }
  2965. else if(runewordInfusionType == ST_Igni)
  2966. {
  2967. actorVictim.SoundEvent('sign_igni_charge_begin');
  2968. }
  2969. else if(runewordInfusionType == ST_Quen)
  2970. {
  2971. value = GetAttributeValue('runeword1_quen_heal');
  2972. Heal( action.GetDamageDealt() * value.valueMultiplicative );
  2973. PlayEffectSingle('drain_energy_caretaker_shovel');
  2974. }
  2975. else if(runewordInfusionType == ST_Yrden)
  2976. {
  2977. actorVictim.SoundEvent('sign_yrden_shock_activate');
  2978. }
  2979. runewordInfusionType = ST_None;
  2980.  
  2981.  
  2982. items = inv.GetHeldWeapons();
  2983. weaponEnt = inv.GetItemEntityUnsafe(items[0]);
  2984. weaponEnt.StopEffect('runeword_aard');
  2985. weaponEnt.StopEffect('runeword_axii');
  2986. weaponEnt.StopEffect('runeword_igni');
  2987. weaponEnt.StopEffect('runeword_quen');
  2988. weaponEnt.StopEffect('runeword_yrden');
  2989. }
  2990.  
  2991. //modSigns: Invigoration
  2992. if(HasBuff(EET_Runeword4) && (action.IsActionMelee() || action.IsActionWitcherSign() && IsMutationActive(EPMT_Mutation1)) && action.DealsAnyDamage() && !action.IsDoTDamage())
  2993. {
  2994. RemoveBuff(EET_Runeword4);
  2995. actorVictim.CreateFXEntityAtPelvis( 'runeword_4', true );
  2996. }
  2997.  
  2998. if(ShouldProcessTutorial('TutorialLightAttacks') || ShouldProcessTutorial('TutorialHeavyAttacks'))
  2999. {
  3000. if(IsLightAttack(attackAction.GetAttackName()))
  3001. {
  3002. theGame.GetTutorialSystem().IncreaseGeraltsLightAttacksCount(action.victim.GetTags());
  3003. }
  3004. else if(IsHeavyAttack(attackAction.GetAttackName()))
  3005. {
  3006. theGame.GetTutorialSystem().IncreaseGeraltsHeavyAttacksCount(action.victim.GetTags());
  3007. }
  3008. }
  3009. }
  3010. else if(attackAction.IsActionRanged())
  3011. {
  3012.  
  3013. if(CanUseSkill(S_Sword_s15) && attackAction.DealsAnyDamage() && !attackAction.WasDodged() && !attackAction.IsParried() && !attackAction.IsCountered()) //modSigns: only gain adrenaline for actual damage dealt
  3014. {
  3015. value = GetSkillAttributeValue(S_Sword_s15, 'focus_gain', false, true) * GetSkillLevel(S_Sword_s15) ;
  3016.  
  3017. //modSigns: new mutation7 (Adrenaline Rush)
  3018. focusVal = CalculateAttributeValue(value);
  3019. if(HasBuff(EET_Mutation7Buff))
  3020. focusVal *= 2;
  3021. else if(HasBuff(EET_Mutation7Debuff))
  3022. focusVal /= 2;
  3023.  
  3024. GainStat(BCS_Focus, focusVal);
  3025. }
  3026.  
  3027.  
  3028. if(CanUseSkill(S_Sword_s12) && attackAction.IsCriticalHit() && actorVictim)
  3029. {
  3030.  
  3031. actorVictim.GetCharacterStats().GetAbilities(abs, false);
  3032. dm = theGame.GetDefinitionsManager();
  3033. for(i=abs.Size()-1; i>=0; i-=1)
  3034. {
  3035. if(!dm.AbilityHasTag(abs[i], theGame.params.TAG_MONSTER_SKILL) || actorVictim.IsAbilityBlocked(abs[i]))
  3036. {
  3037. abs.EraseFast(i);
  3038. }
  3039. }
  3040.  
  3041.  
  3042. if(abs.Size() > 0)
  3043. {
  3044. value = GetSkillAttributeValue(S_Sword_s12, 'duration', true, true) * GetSkillLevel(S_Sword_s12);
  3045. actorVictim.BlockAbility(abs[ RandRange(abs.Size()) ], true, CalculateAttributeValue(value));
  3046. }
  3047. }
  3048. }
  3049. }
  3050.  
  3051.  
  3052. //modSigns: moved sign fx to signEntity to ensure it's triggered only once per cast (and alt cast)
  3053. if( IsMutationActive( EPMT_Mutation10 ) && ( action.IsActionMelee() /*|| action.IsActionWitcherSign()*/ ) )
  3054. {
  3055. PlayEffect( 'mutation_10_energy' );
  3056. }
  3057.  
  3058.  
  3059. if(CanUseSkill(S_Perk_18) && ((W3Petard)action.causer) && action.DealsAnyDamage() && !action.IsDoTDamage())
  3060. {
  3061. value = GetSkillAttributeValue(S_Perk_18, 'focus_gain', false, true);
  3062.  
  3063. //modSigns: new mutation7 (Adrenaline Rush)
  3064. focusVal = CalculateAttributeValue(value);
  3065. if(HasBuff(EET_Mutation7Buff))
  3066. focusVal *= 2;
  3067. else if(HasBuff(EET_Mutation7Debuff))
  3068. focusVal /= 2;
  3069.  
  3070. GainStat(BCS_Focus, focusVal);
  3071. }
  3072.  
  3073. //modSigns: new mutagen01 effect
  3074. if(HasBuff(EET_Mutagen01) && attackAction)
  3075. {
  3076. ((W3Mutagen01_Effect)GetBuff(EET_Mutagen01)).ManageMutagen01Bonus(attackAction);
  3077. }
  3078.  
  3079. //modSigns: new mutagen05 effect
  3080. if(HasBuff(EET_Mutagen05))
  3081. {
  3082. ((W3Mutagen05_Effect)GetBuff(EET_Mutagen05)).ManageMutagen05Bonus(action);
  3083. }
  3084.  
  3085. //modSigns: new mutagen10 effect
  3086. if(HasBuff(EET_Mutagen10) && attackAction)
  3087. {
  3088. ((W3Mutagen10_Effect)GetBuff(EET_Mutagen10)).ManageMutagen10Bonus(attackAction);
  3089. }
  3090.  
  3091. //modSigns: new mutagen15 effect
  3092. if(HasBuff(EET_Mutagen15))
  3093. {
  3094. ((W3Mutagen15_Effect)GetBuff(EET_Mutagen15)).ManageMutagen15Bonus(action);
  3095. }
  3096.  
  3097. //modSigns: new mutagen17 effect
  3098. if(HasBuff(EET_Mutagen17) && attackAction)
  3099. {
  3100. ((W3Mutagen17_Effect)GetBuff(EET_Mutagen17)).ManageMutagen17Bonus(attackAction);
  3101. }
  3102.  
  3103. //modSigns: new lynx set tier1 bonus
  3104. if( IsSetBonusActive( EISB_Lynx_1 ) && attackAction && attackAction.IsActionMelee() && !attackAction.WasDodged() )
  3105. {
  3106. //theGame.witcherLog.AddMessage("Lynx set tier 1 post action"); //debug
  3107. if( !HasBuff( EET_LynxSetBonus ) )
  3108. {
  3109. AddEffectDefault( EET_LynxSetBonus, NULL, "LynxSetBuff" );
  3110. SoundEvent( "ep2_setskill_lynx_activate" );
  3111. }
  3112. lynxSetBuff = (W3Effect_LynxSetBonus)GetBuff( EET_LynxSetBonus );
  3113. lynxSetBuff.ManageLynxBonus( IsHeavyAttack( attackAction.GetAttackName() ) );
  3114. }
  3115. }
  3116.  
  3117. //modSigns: rend AoE
  3118. private function RendAoE(attackAction : W3Action_Attack)
  3119. {
  3120. var dmgTypes : array< name >;
  3121. var dmgValues : array< float >;
  3122. var ents : array<CGameplayEntity>;
  3123. var rendAoEAction : W3DamageAction;
  3124. var i, j : int;
  3125.  
  3126. if(GetStat(BCS_Focus) < 3)
  3127. return;
  3128.  
  3129. inv.GetWeaponDTNames(attackAction.GetWeaponId(), dmgTypes);
  3130. for(i = 0; i < dmgTypes.Size(); i += 1)
  3131. dmgValues.PushBack(GetTotalWeaponDamage(attackAction.GetWeaponId(), dmgTypes[i], GetInvalidUniqueId()));
  3132.  
  3133. FindGameplayEntitiesInCylinder(ents, attackAction.victim.GetWorldPosition(), 3, 10, 100, , FLAG_OnlyAliveActors + FLAG_ExcludeTarget + FLAG_Attitude_Hostile, this);
  3134.  
  3135. for(i = 0; i < ents.Size(); i += 1)
  3136. {
  3137. if(ents[i] == attackAction.victim)
  3138. continue;
  3139. rendAoEAction = new W3DamageAction in theGame;
  3140. rendAoEAction.Initialize(attackAction.attacker, ents[i], attackAction.causer, "RendAoE", EHRT_Heavy, CPS_AttackPower, false, false, false, false);
  3141. rendAoEAction.SetCannotReturnDamage(true);
  3142. rendAoEAction.SetProcessBuffsIfNoDamage(true);
  3143. for(j = 0; j < dmgTypes.Size(); j += 1)
  3144. rendAoEAction.AddDamage(dmgTypes[j], dmgValues[j]);
  3145. rendAoEAction.AddEffectInfo(EET_KnockdownTypeApplicator);
  3146. theGame.damageMgr.ProcessAction(rendAoEAction);
  3147. ents[i].PlayEffect('yrden_shock');
  3148. delete rendAoEAction;
  3149. }
  3150. }
  3151.  
  3152.  
  3153. timer function Mutagen14Timer(dt : float, id : int)
  3154. {
  3155. var abilityName : name;
  3156. var abilityCount, maxStack : float;
  3157. var min, max : SAbilityAttributeValue;
  3158. var addAbility : bool;
  3159.  
  3160. abilityName = GetBuff(EET_Mutagen14).GetAbilityName();
  3161. abilityCount = GetAbilityCount(abilityName);
  3162.  
  3163. if(abilityCount == 0)
  3164. {
  3165. addAbility = true;
  3166. }
  3167. else
  3168. {
  3169. theGame.GetDefinitionsManager().GetAbilityAttributeValue(abilityName, 'mutagen14_max_stack', min, max);
  3170. maxStack = CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  3171.  
  3172. if(maxStack >= 0)
  3173. {
  3174. addAbility = (abilityCount < maxStack);
  3175. }
  3176. else
  3177. {
  3178. addAbility = true;
  3179. }
  3180. }
  3181.  
  3182. if(addAbility)
  3183. {
  3184. AddAbility(abilityName, true);
  3185. }
  3186. else
  3187. {
  3188.  
  3189. RemoveTimer('Mutagen14Timer');
  3190. }
  3191. }
  3192.  
  3193. public final function FailFundamentalsFirstAchievementCondition()
  3194. {
  3195. SetFailedFundamentalsFirstAchievementCondition(true);
  3196. }
  3197.  
  3198. public final function SetUsedQuenInCombat()
  3199. {
  3200. usedQuenInCombat = true;
  3201. }
  3202.  
  3203. public final function UsedQuenInCombat() : bool
  3204. {
  3205. return usedQuenInCombat;
  3206. }
  3207.  
  3208. event OnCombatStart()
  3209. {
  3210. var quenEntity/*, glyphQuen*/ : W3QuenEntity; //modSigns
  3211. var focus, stamina, focusMax : float; //modSigns
  3212. var glowTargets, moTargets, actors : array< CActor >;
  3213. var delays : array< float >;
  3214. var rand, i : int;
  3215. var isHostile, isAlive, isUnconscious : bool;
  3216.  
  3217. super.OnCombatStart();
  3218.  
  3219. if ( IsInCombatActionFriendly() )
  3220. {
  3221. SetBIsCombatActionAllowed(true);
  3222. SetBIsInputAllowed(true, 'OnCombatActionStart' );
  3223. }
  3224.  
  3225.  
  3226. if(HasBuff(EET_Mutagen14))
  3227. {
  3228. AddTimer('Mutagen14Timer', 2, true);
  3229. }
  3230.  
  3231.  
  3232. //if(HasBuff(EET_Mutagen15)) //modSigns: changed
  3233. //{
  3234. // AddAbility(GetBuff(EET_Mutagen15).GetAbilityName(), false);
  3235. //}
  3236.  
  3237. //modSigns: new mutagen24 effect
  3238. if(HasBuff(EET_Mutagen24))
  3239. ((W3Mutagen24_Effect)GetBuff(EET_Mutagen24)).ManageMutagen24Bonus();
  3240.  
  3241. //modSigns
  3242. if( IsSetBonusActive(EISB_KaerMorhen) && !HasBuff(EET_KaerMorhenSetBonus) )
  3243. {
  3244. AddEffectDefault(EET_KaerMorhenSetBonus, this, "KaerMorhenSetBonus");
  3245. }
  3246.  
  3247. ManageAerondightBuff( true ); //modSigns
  3248. ManageIrisBuff( true ); //modSigns
  3249.  
  3250.  
  3251. mutation12IsOnCooldown = false;
  3252.  
  3253.  
  3254. quenEntity = (W3QuenEntity)signs[ST_Quen].entity;
  3255.  
  3256.  
  3257. if(quenEntity)
  3258. {
  3259. usedQuenInCombat = quenEntity.IsAnyQuenActive();
  3260. }
  3261. else
  3262. {
  3263. usedQuenInCombat = false;
  3264. }
  3265.  
  3266. if(usedQuenInCombat || HasPotionBuff() || IsEquippedSwordUpgradedWithOil(true) || IsEquippedSwordUpgradedWithOil(false))
  3267. {
  3268. SetFailedFundamentalsFirstAchievementCondition(true);
  3269. }
  3270. else
  3271. {
  3272. if(IsAnyItemEquippedOnSlot(EES_PotionMutagen1) || IsAnyItemEquippedOnSlot(EES_PotionMutagen2) || IsAnyItemEquippedOnSlot(EES_PotionMutagen3) || IsAnyItemEquippedOnSlot(EES_PotionMutagen4))
  3273. SetFailedFundamentalsFirstAchievementCondition(true);
  3274. else
  3275. SetFailedFundamentalsFirstAchievementCondition(false);
  3276. }
  3277.  
  3278. if(CanUseSkill(S_Sword_s20) && IsThreatened())
  3279. {
  3280. focus = GetStat(BCS_Focus);
  3281. //modSigns
  3282. focusMax = CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s20, 'focus_add', false, true)) * GetSkillLevel(S_Sword_s20);
  3283. if(focus < focusMax)
  3284. {
  3285. GainStat(BCS_Focus, focusMax - focus);
  3286. }
  3287. }
  3288.  
  3289. if ( HasGlyphwordActive('Glyphword 17 _Stats') && (!quenEntity || !quenEntity.IsAnyQuenActive()) ) //modSigns
  3290. {
  3291. //stamina = GetStat(BCS_Stamina); //modSigns
  3292. if(!quenEntity)
  3293. {
  3294. quenEntity = (W3QuenEntity)theGame.CreateEntity( signs[ST_Quen].template, GetWorldPosition(), GetWorldRotation() );
  3295. }
  3296. quenEntity.glyphword17Cast = true; //modSigns
  3297. quenEntity.Init( signOwner, signs[ST_Quen].entity, true );
  3298. quenEntity.freeCast = true; //modSigns
  3299. quenEntity.OnStarted();
  3300. quenEntity.OnThrowing();
  3301. quenEntity.OnEnded();
  3302. //ForceSetStat(BCS_Stamina, stamina); //modSigns
  3303. }
  3304.  
  3305.  
  3306. MeditationForceAbort(true);
  3307.  
  3308.  
  3309.  
  3310.  
  3311.  
  3312. if( IsMutationActive( EPMT_Mutation3 ) ) //modSigns: now added at combat start
  3313. {
  3314. AddEffectDefault( EET_Mutation3, this, "", false );
  3315. }
  3316. else if( IsMutationActive( EPMT_Mutation4 ) )
  3317. {
  3318. AddEffectDefault( EET_Mutation4, this, "combat start", false );
  3319. }
  3320. //else if( IsMutationActive( EPMT_Mutation5 ) && GetStat( BCS_Focus ) >= 1.f )
  3321. //{
  3322. // AddEffectDefault( EET_Mutation5, this, "", false );
  3323. //} //modSigns: mutation changed
  3324.  
  3325. else if( IsMutationActive( EPMT_Mutation7 ) )
  3326. {
  3327. //
  3328. //
  3329. // RemoveTimer( 'Mutation7CombatStartHackFixGo' );
  3330. //
  3331. //
  3332. // AddTimer( 'Mutation7CombatStartHackFix', 1.f, true, , , , true );
  3333. //
  3334. //modSigns
  3335. AddEffectDefault( EET_Mutation7Buff, this, "Mutation 7 buff phase" );
  3336. theGame.MutationHUDFeedback( MFT_PlayRepeat );
  3337. }
  3338. else if( IsMutationActive( EPMT_Mutation8 ) )
  3339. {
  3340. theGame.MutationHUDFeedback( MFT_PlayRepeat );
  3341. }
  3342.  
  3343. else if( IsMutationActive( EPMT_Mutation10 ) )
  3344. {
  3345. /*if( !HasBuff( EET_Mutation10 ) && GetStat( BCS_Toxicity ) > 0.f )
  3346. {
  3347. AddEffectDefault( EET_Mutation10, this, "Mutation 10" );
  3348. }*/
  3349.  
  3350.  
  3351. //PlayEffect( 'mutation_10' );
  3352. //
  3353. //
  3354. //PlayEffect( 'critical_toxicity' );
  3355. //AddTimer( 'Mutation10StopEffect', 5.f );
  3356. ////modSigns
  3357. //if( !HasBuff( EET_Mutation10 ) )
  3358. //{
  3359. // AddEffectDefault( EET_Mutation10, NULL, "Mutation 10" );
  3360. //}
  3361.  
  3362. //modSigns: Euphoria rework
  3363. if( GetStatPercents(BCS_Toxicity) >= GetToxicityDamageThreshold() )
  3364. AddEffectDefault( EET_Mutation10, NULL, "Mutation 10" );
  3365. }
  3366. }
  3367.  
  3368. //timer function Mutation7CombatStartHackFix( dt : float, id : int )
  3369. //{
  3370. // var actors : array< CActor >;
  3371. //
  3372. // actors = GetEnemies();
  3373. //
  3374. // if( actors.Size() > 0 )
  3375. // {
  3376. //
  3377. // AddTimer( 'Mutation7CombatStartHackFixGo', 0.5f );
  3378. // RemoveTimer( 'Mutation7CombatStartHackFix' );
  3379. // }
  3380. //}
  3381. //
  3382. //timer function Mutation7CombatStartHackFixGo( dt : float, id : int )
  3383. //{
  3384. // var actors : array< CActor >;
  3385. //
  3386. // if( IsMutationActive( EPMT_Mutation7 ) )
  3387. // {
  3388. // actors = GetEnemies();
  3389. //
  3390. // if( actors.Size() > 1 )
  3391. // {
  3392. // AddEffectDefault( EET_Mutation7Buff, this, "Mutation 7, combat start" );
  3393. // }
  3394. // }
  3395. //} //modSigns: redone
  3396.  
  3397. public final function IsInFistFight() : bool
  3398. {
  3399. var enemies : array< CActor >;
  3400. var i, j : int;
  3401. var invent : CInventoryComponent;
  3402. var weapons : array< SItemUniqueId >;
  3403.  
  3404. if( IsInFistFightMiniGame() )
  3405. {
  3406. return true;
  3407. }
  3408.  
  3409. enemies = GetEnemies();
  3410. for( i=0; i<enemies.Size(); i+=1 )
  3411. {
  3412. weapons.Clear();
  3413. invent = enemies[i].GetInventory();
  3414. weapons = invent.GetHeldWeapons();
  3415.  
  3416. for( j=0; j<weapons.Size(); j+=1 )
  3417. {
  3418. if( invent.IsItemFists( weapons[j] ) )
  3419. {
  3420. return true;
  3421. }
  3422. }
  3423. }
  3424.  
  3425. return false;
  3426. }
  3427.  
  3428. timer function Mutation10StopEffect( dt : float, id : int )
  3429. {
  3430. StopEffect( 'critical_toxicity' );
  3431. }
  3432.  
  3433.  
  3434. event OnCombatFinished()
  3435. {
  3436. var inGameConfigWrapper : CInGameConfigWrapper;
  3437. var disableAutoSheathe : bool;
  3438.  
  3439. super.OnCombatFinished();
  3440.  
  3441. //modSigns: cleanup mutagens
  3442. if(HasBuff(EET_Mutagen01))
  3443. ((W3Mutagen01_Effect)GetBuff(EET_Mutagen01)).RemoveMutagen01Abilities();
  3444. if(HasBuff(EET_Mutagen05))
  3445. ((W3Mutagen05_Effect)GetBuff(EET_Mutagen05)).RemoveMutagen05AbilitiesAll();
  3446. if(HasBuff(EET_Mutagen10))
  3447. ((W3Mutagen10_Effect)GetBuff(EET_Mutagen10)).RemoveMutagen10Abilities();
  3448. if(HasBuff(EET_Mutagen12))
  3449. ((W3Mutagen12_Effect)GetBuff(EET_Mutagen12)).ManageAdditionalBonus();
  3450. if(HasBuff(EET_Mutagen13))
  3451. ((W3Mutagen13_Effect)GetBuff(EET_Mutagen13)).ManageMutagen13Bonus();
  3452. if(HasBuff(EET_Mutagen15))
  3453. ((W3Mutagen15_Effect)GetBuff(EET_Mutagen15)).RemoveMutagen15AbilitiesAll();
  3454. if(HasBuff(EET_Mutagen17))
  3455. ((W3Mutagen17_Effect)GetBuff(EET_Mutagen17)).RemoveMutagen17Abilities();
  3456. if(HasBuff(EET_Mutagen18))
  3457. ((W3Mutagen18_Effect)GetBuff(EET_Mutagen18)).ManageMutagen18Bonus();
  3458. if(HasBuff(EET_Mutagen22))
  3459. ((W3Mutagen22_Effect)GetBuff(EET_Mutagen22)).RemoveMutagen22AbilitiesAll();
  3460. if(HasBuff(EET_Mutagen24))
  3461. ((W3Mutagen24_Effect)GetBuff(EET_Mutagen24)).ResetMutagen24Bonus();
  3462.  
  3463. //cleanup mutations
  3464. RemoveBuff( EET_Mutation3 );
  3465. RemoveBuff( EET_Mutation4 );
  3466. //RemoveBuff( EET_Mutation5 ); //modSigns: mutation changed
  3467. RemoveBuff( EET_Mutation7Buff );
  3468. RemoveBuff( EET_Mutation7Debuff );
  3469. if( IsMutationActive( EPMT_Mutation7 ) )
  3470. {
  3471. theGame.MutationHUDFeedback( MFT_PlayHide );
  3472. }
  3473. else if( IsMutationActive( EPMT_Mutation8 ) )
  3474. {
  3475. theGame.MutationHUDFeedback( MFT_PlayHide );
  3476. }
  3477. RemoveBuff( EET_Mutation10 );
  3478.  
  3479. //cleanup set bonuses
  3480. RemoveBuff( EET_LynxSetBonus );
  3481. RemoveBuff( EET_KaerMorhenSetBonus ); //modSigns
  3482.  
  3483. if( HasBuff( EET_Aerondight ) ) //modSigns
  3484. RemoveBuff( EET_Aerondight );
  3485.  
  3486. if( HasBuff( EET_PhantomWeapon ) ) //modSigns
  3487. RemoveBuff( EET_PhantomWeapon );
  3488.  
  3489. //cleanup runewords
  3490. RemoveAbilityAll('Runeword 10 Buff');
  3491. //thePlayer.abilityManager.ResetOverhealBonus();
  3492. RemoveBuff(EET_Runeword4); //modSigns
  3493. runewordInfusionType = ST_None;
  3494. RemoveBuff(EET_Runeword11); //modSigns
  3495.  
  3496. RemoveAbilityAll('Glyphword 14 _Stats'); //modSigns
  3497. RemoveAbilityAll('Glyphword 10 _Stats'); //modSigns
  3498.  
  3499. //begin out of combat adrenaline drain
  3500. if(GetStat(BCS_Focus) > 0)
  3501. {
  3502. AddTimer('DelayedAdrenalineDrain', theGame.params.ADRENALINE_DRAIN_AFTER_COMBAT_DELAY, , , , true);
  3503. }
  3504.  
  3505. //profile tracker
  3506. usedQuenInCombat = false;
  3507. theGame.GetGamerProfile().ResetStat(ES_FinesseKills);
  3508.  
  3509. //sword sheathing
  3510. LogChannel( 'OnCombatFinished', "OnCombatFinished: DelayedSheathSword timer added" );
  3511. inGameConfigWrapper = (CInGameConfigWrapper)theGame.GetInGameConfigWrapper();
  3512. disableAutoSheathe = inGameConfigWrapper.GetVarValue( 'Gameplay', 'DisableAutomaticSwordSheathe' );
  3513. if( !disableAutoSheathe )
  3514. {
  3515. if ( ShouldAutoSheathSwordInstantly() )
  3516. AddTimer( 'DelayedSheathSword', 0.5f );
  3517. else
  3518. AddTimer( 'DelayedSheathSword', 2.f );
  3519. }
  3520.  
  3521. OnBlockAllCombatTickets( false );
  3522. }
  3523.  
  3524. public function PlayHitEffect( damageAction : W3DamageAction )
  3525. {
  3526. var hitReactionType : EHitReactionType;
  3527. var isAtBack : bool;
  3528.  
  3529.  
  3530. if( damageAction.GetMutation4Triggered() )
  3531. {
  3532. hitReactionType = damageAction.GetHitReactionType();
  3533. isAtBack = IsAttackerAtBack( damageAction.attacker );
  3534.  
  3535. if( hitReactionType != EHRT_Heavy )
  3536. {
  3537. if( isAtBack )
  3538. {
  3539. damageAction.SetHitEffect( 'light_hit_back_toxic', true );
  3540. }
  3541. else
  3542. {
  3543. damageAction.SetHitEffect( 'light_hit_toxic' );
  3544. }
  3545. }
  3546. else
  3547. {
  3548. if( isAtBack )
  3549. {
  3550. damageAction.SetHitEffect( 'heavy_hit_back_toxic' ,true );
  3551. }
  3552. else
  3553. {
  3554. damageAction.SetHitEffect( 'heavy_hit_toxic' );
  3555. }
  3556. }
  3557. }
  3558.  
  3559. super.PlayHitEffect( damageAction );
  3560. }
  3561.  
  3562. timer function DelayedAdrenalineDrain(dt : float, id : int)
  3563. {
  3564. if ( !HasBuff(EET_Runeword8) )
  3565. AddEffectDefault(EET_AdrenalineDrain, this, "after_combat_adrenaline_drain");
  3566. }
  3567.  
  3568.  
  3569. protected function Attack( hitTarget : CGameplayEntity, animData : CPreAttackEventData, weaponId : SItemUniqueId, parried : bool, countered : bool, parriedBy : array<CActor>, attackAnimationName : name, hitTime : float, weaponEntity : CItemEntity)
  3570. {
  3571. //var mutagen17 : W3Mutagen17_Effect;
  3572.  
  3573. //modSigns: check for mutagen17 activation
  3574. //if(HasBuff(EET_Mutagen17))
  3575. //{
  3576. // mutagen17 = (W3Mutagen17_Effect)GetBuff(EET_Mutagen17);
  3577. // if(mutagen17.IsBoostAvailable())
  3578. // {
  3579. // mutagen17.ActivateBoost();
  3580. // //theGame.witcherLog.AddMessage("mutagen17 boost activated: attack"); //modSigns: debug
  3581. // }
  3582. //}
  3583.  
  3584. super.Attack(hitTarget, animData, weaponId, parried, countered, parriedBy, attackAnimationName, hitTime, weaponEntity);
  3585.  
  3586. /*if( (CActor)hitTarget && HasBuff(EET_Mutagen17) )
  3587. {
  3588. mutagen17 = (W3Mutagen17_Effect)GetBuff(EET_Mutagen17);
  3589. if(mutagen17.HasBoost())
  3590. {
  3591. mutagen17.ClearBoost();
  3592. }
  3593. }*/ //modSigns: move to other place
  3594. }
  3595.  
  3596. //modSigns: redone completely
  3597. public final timer function SpecialAttackLightSustainCost(dt : float, id : int)
  3598. {
  3599. if(abilityManager && abilityManager.IsInitialized() && IsAlive() && HasResourcesForWhirl(dt))
  3600. {
  3601. PauseStaminaRegen('WhirlSkill');
  3602. WhirlDrainResources(dt);
  3603. }
  3604. else
  3605. {
  3606. OnPerformSpecialAttack(true, false);
  3607. }
  3608. /*var focusPerSec, cost, delay : float;
  3609. var reduction : SAbilityAttributeValue;
  3610. var skillLevel : int;
  3611.  
  3612. if(abilityManager && abilityManager.IsInitialized() && IsAlive())
  3613. {
  3614. PauseStaminaRegen('WhirlSkill');
  3615.  
  3616. if(GetStat(BCS_Stamina) > 0)
  3617. {
  3618. cost = GetStaminaActionCost(ESAT_Ability, GetSkillAbilityName(S_Sword_s01), dt);
  3619. delay = GetStaminaActionDelay(ESAT_Ability, GetSkillAbilityName(S_Sword_s01), dt);
  3620. skillLevel = GetSkillLevel(S_Sword_s01);
  3621.  
  3622. if(skillLevel > 1)
  3623. {
  3624. reduction = GetSkillAttributeValue(S_Sword_s01, 'cost_reduction', false, true) * (skillLevel - 1);
  3625. cost = MaxF(0, cost * (1 - reduction.valueMultiplicative) - reduction.valueAdditive);
  3626. }
  3627.  
  3628. DrainStamina(ESAT_FixedValue, cost, delay, GetSkillAbilityName(S_Sword_s01));
  3629. }
  3630. else
  3631. {
  3632. GetSkillAttributeValue(S_Sword_s01, 'focus_cost_per_sec', false, true);
  3633. focusPerSec = GetWhirlFocusCostPerSec();
  3634. DrainFocus(focusPerSec * dt);
  3635. }
  3636. }
  3637.  
  3638. if(GetStat(BCS_Stamina) <= 0 && GetStat(BCS_Focus) <= 0)
  3639. {
  3640. OnPerformSpecialAttack(true, false);
  3641. }*/
  3642. }
  3643.  
  3644. /*public final function GetWhirlFocusCostPerSec() : float
  3645. {
  3646. var ability : SAbilityAttributeValue;
  3647. var val : float;
  3648. var skillLevel : int;
  3649.  
  3650. ability = GetSkillAttributeValue(S_Sword_s01, 'focus_cost_per_sec_initial', false, false);
  3651. skillLevel = GetSkillLevel(S_Sword_s01);
  3652.  
  3653. if(skillLevel > 1)
  3654. ability -= GetSkillAttributeValue(S_Sword_s01, 'cost_reduction', false, false) * (skillLevel-1);
  3655.  
  3656. val = CalculateAttributeValue(ability);
  3657.  
  3658. return val;
  3659. }*/ //modSigns: redone
  3660.  
  3661. //modSigns
  3662. public final function HasResourcesForWhirl(dt : float) : bool
  3663. {
  3664. return GetStat(BCS_Stamina) >= GetWhirlStaminaCost(dt);
  3665. }
  3666.  
  3667. public final function GetWhirlStaminaCost(dt : float) : float
  3668. {
  3669. var cost : float;
  3670. cost = GetStaminaActionCost(ESAT_Ability, GetSkillAbilityName(S_Sword_s01), dt);
  3671. cost *= 1 - CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s01, 'stamina_cost_reduction_after_1', false, false)) * (GetSkillLevel(S_Sword_s01) - 1);
  3672. if(HasBuff(EET_Mutagen04))
  3673. cost *= 1 + ((W3Mutagen04_Effect)GetBuff(EET_Mutagen04)).GetAttackCostIncrease();
  3674. return cost;
  3675. }
  3676.  
  3677. //modSigns
  3678. private final function WhirlDrainResources(dt : float)
  3679. {
  3680. var delay : float;
  3681. delay = GetStaminaActionDelay(ESAT_Ability, GetSkillAbilityName(S_Sword_s01), dt);
  3682. DrainStamina(ESAT_FixedValue, GetWhirlStaminaCost(dt), delay, GetSkillAbilityName(S_Sword_s01));
  3683. }
  3684.  
  3685. //modSigns
  3686. public final function GetNumHostilesInRange() : int
  3687. {
  3688. var ents : array<CGameplayEntity>;
  3689.  
  3690. FindGameplayEntitiesInRange(ents, this, 30, 100, , FLAG_OnlyAliveActors + FLAG_ExcludeTarget + FLAG_Attitude_Hostile, this);
  3691.  
  3692. return ents.Size();
  3693. }
  3694.  
  3695. //modSigns
  3696. public final function GetWhirlDamageBonus() : float
  3697. {
  3698. var bonusCount : int;
  3699. var ability : SAbilityAttributeValue;
  3700. var damageBonus : float;
  3701.  
  3702. bonusCount = Clamp(GetNumHostilesInRange() - 1, 0, 5);
  3703. ability = GetSkillAttributeValue(S_Sword_s01, 'whirl_dmg_bonus', false, true) * GetSkillLevel(S_Sword_s01);
  3704. damageBonus = ability.valueMultiplicative * bonusCount;
  3705.  
  3706. return damageBonus;
  3707. }
  3708.  
  3709. //modSigns
  3710. public final function GetRendPowerBonus() : float
  3711. {
  3712. var rendLoad, rendBonus, rendRatio : float;
  3713. var attackBonus, rendBonusPerPoint, staminaRendBonus : SAbilityAttributeValue;
  3714.  
  3715. rendBonus = 0;
  3716. //unconditional bonus
  3717. attackBonus = GetSkillAttributeValue(S_Sword_s02, 'attack_damage_bonus', false, true) * GetSkillLevel(S_Sword_s02);
  3718. rendBonus += attackBonus.valueMultiplicative;
  3719. //check how much of the 'gauge' player channeled
  3720. rendRatio = GetSpecialAttackTimeRatio();
  3721. if(rendRatio > 0)
  3722. {
  3723. //bonus for stamina usage (per skill level, per stamina point)
  3724. staminaRendBonus = GetSkillAttributeValue(S_Sword_s02, 'stamina_max_dmg_bonus', false, true) * GetSkillLevel(S_Sword_s02);
  3725. rendBonus += rendRatio * GetStatMax(BCS_Stamina) * staminaRendBonus.valueMultiplicative;
  3726. }
  3727. //adrenaline points
  3728. rendLoad = GetStat(BCS_Focus);
  3729. //do not round adrenaline points, use as many as possible
  3730. if(rendLoad > 0)
  3731. {
  3732. //bonus for adrenaline usage (per skill level)
  3733. rendBonusPerPoint = GetSkillAttributeValue(S_Sword_s02, 'adrenaline_final_damage_bonus', false, true) * GetSkillLevel(S_Sword_s02);
  3734. rendBonus += rendLoad * rendBonusPerPoint.valueMultiplicative;
  3735. }
  3736. //theGame.witcherLog.AddMessage("Rend ratio: " + rendRatio);
  3737. //theGame.witcherLog.AddMessage("Rend load: " + rendLoad);
  3738. //theGame.witcherLog.AddMessage("Rend bonus: " + rendBonus);
  3739. return rendBonus;
  3740. }
  3741.  
  3742. //modSigns
  3743. public final function GetRendStaminaCost(dt : float) : float
  3744. {
  3745. return GetStaminaActionCost(ESAT_Ability, GetSkillAbilityName(S_Sword_s02), dt);
  3746. }
  3747.  
  3748. public final timer function SpecialAttackHeavySustainCost(dt : float, id : int)
  3749. {
  3750. var focusHighlight, ratio : float;
  3751. var hud : CR4ScriptedHud;
  3752. var hudWolfHeadModule : CR4HudModuleWolfHead;
  3753.  
  3754. PauseStaminaRegen('RendSkill'); //modSigns
  3755.  
  3756. DrainStamina(ESAT_Ability, 0, 0, GetSkillAbilityName(S_Sword_s02), dt);
  3757.  
  3758.  
  3759. if(GetStat(BCS_Stamina) <= 0)
  3760. OnPerformSpecialAttack(false, false);
  3761.  
  3762.  
  3763. ratio = EngineTimeToFloat(theGame.GetEngineTime() - specialHeavyStartEngineTime) / specialHeavyChargeDuration;
  3764.  
  3765. if(ratio > 0.99) //modSigns
  3766. ratio = 1;
  3767.  
  3768. SetSpecialAttackTimeRatio(ratio);
  3769.  
  3770.  
  3771. //focusHighlight = ratio * GetStatMax(BCS_Focus);
  3772. //focusHighlight = MinF(focusHighlight, GetStat(BCS_Focus));
  3773. //focusHighlight = FloorF(focusHighlight);
  3774. //modSigns
  3775. /*focusHighlight = FloorF(ratio * GetStat(BCS_Focus));
  3776.  
  3777. hud = (CR4ScriptedHud)theGame.GetHud();
  3778. if ( hud )
  3779. {
  3780. hudWolfHeadModule = (CR4HudModuleWolfHead)hud.GetHudModule( "WolfHeadModule" );
  3781. if ( hudWolfHeadModule )
  3782. {
  3783. hudWolfHeadModule.LockFocusPoints((int)focusHighlight);
  3784. }
  3785. }*/
  3786. }
  3787.  
  3788. public function OnSpecialAttackHeavyActionProcess()
  3789. {
  3790. var hud : CR4ScriptedHud;
  3791. var hudWolfHeadModule : CR4HudModuleWolfHead;
  3792.  
  3793. super.OnSpecialAttackHeavyActionProcess();
  3794.  
  3795. hud = (CR4ScriptedHud)theGame.GetHud();
  3796. if ( hud )
  3797. {
  3798. hudWolfHeadModule = (CR4HudModuleWolfHead)hud.GetHudModule( "WolfHeadModule" );
  3799. if ( hudWolfHeadModule )
  3800. {
  3801. hudWolfHeadModule.ResetFocusPoints();
  3802. }
  3803. }
  3804. }
  3805.  
  3806. timer function IsSpecialLightAttackInputHeld ( time : float, id : int )
  3807. {
  3808. var hasResource : bool;
  3809.  
  3810. if ( GetCurrentStateName() == 'CombatSteel' || GetCurrentStateName() == 'CombatSilver' )
  3811. {
  3812. if ( GetBIsCombatActionAllowed() && inputHandler.IsActionAllowed(EIAB_SwordAttack))
  3813. {
  3814. /*if(GetStat(BCS_Stamina) > 0)
  3815. {
  3816. hasResource = true;
  3817. }
  3818. else
  3819. {
  3820. hasResource = (GetStat(BCS_Focus) >= GetWhirlFocusCostPerSec() * time);
  3821. }*/ //modSigns: redone
  3822. hasResource = HasResourcesForWhirl(0.5f);
  3823.  
  3824. if(hasResource)
  3825. {
  3826. SetupCombatAction( EBAT_SpecialAttack_Light, BS_Pressed );
  3827. RemoveTimer('IsSpecialLightAttackInputHeld');
  3828. }
  3829. else if(!playedSpecialAttackMissingResourceSound)
  3830. {
  3831. //IndicateTooLowAdrenaline(); //modSigns
  3832. SetShowToLowStaminaIndication(GetWhirlStaminaCost(0.5f));
  3833. SoundEvent("gui_no_stamina");
  3834. playedSpecialAttackMissingResourceSound = true;
  3835. }
  3836. }
  3837. }
  3838. else
  3839. {
  3840. RemoveTimer('IsSpecialLightAttackInputHeld');
  3841. }
  3842. }
  3843.  
  3844. timer function IsSpecialHeavyAttackInputHeld ( time : float, id : int )
  3845. {
  3846. var cost : float;
  3847.  
  3848. if ( GetCurrentStateName() == 'CombatSteel' || GetCurrentStateName() == 'CombatSilver' )
  3849. {
  3850. //cost = CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s02, 'stamina_cost_per_sec', false, false));
  3851. cost = GetRendStaminaCost(0.5f); //modSigns
  3852.  
  3853. if( GetBIsCombatActionAllowed() && inputHandler.IsActionAllowed(EIAB_SwordAttack))
  3854. {
  3855. if(GetStat(BCS_Stamina) >= cost)
  3856. {
  3857. SetupCombatAction( EBAT_SpecialAttack_Heavy, BS_Pressed );
  3858. RemoveTimer('IsSpecialHeavyAttackInputHeld');
  3859. }
  3860. else if(!playedSpecialAttackMissingResourceSound)
  3861. {
  3862. //IndicateTooLowAdrenaline(); //modSigns
  3863. SetShowToLowStaminaIndication(cost);
  3864. SoundEvent("gui_no_stamina");
  3865. playedSpecialAttackMissingResourceSound = true;
  3866. }
  3867. }
  3868. }
  3869. else
  3870. {
  3871. RemoveTimer('IsSpecialHeavyAttackInputHeld');
  3872. }
  3873. }
  3874.  
  3875. public function EvadePressed( bufferAction : EBufferActionType )
  3876. {
  3877. var cat : float;
  3878.  
  3879. if( (bufferAction == EBAT_Dodge && IsActionAllowed(EIAB_Dodge)) || (bufferAction == EBAT_Roll && IsActionAllowed(EIAB_Roll)) )
  3880. {
  3881. //modSigns: check for stamina
  3882. if( bufferAction == EBAT_Dodge && !HasStaminaToUseAction(ESAT_Dodge, '', 0, 0 ) ||
  3883. bufferAction == EBAT_Roll && !HasStaminaToUseAction(ESAT_Roll, '', 0, 0 ) )
  3884. {
  3885. SoundEvent("gui_no_stamina");
  3886. return;
  3887. }
  3888.  
  3889. if(bufferAction != EBAT_Roll && ShouldProcessTutorial('TutorialDodge'))
  3890. {
  3891. FactsAdd("tut_in_dodge", 1, 2);
  3892.  
  3893. if(FactsQuerySum("tut_fight_use_slomo") > 0)
  3894. {
  3895. theGame.RemoveTimeScale( theGame.GetTimescaleSource(ETS_TutorialFight) );
  3896. FactsRemove("tut_fight_slomo_ON");
  3897. }
  3898. }
  3899. else if(bufferAction == EBAT_Roll && ShouldProcessTutorial('TutorialRoll'))
  3900. {
  3901. FactsAdd("tut_in_roll", 1, 2);
  3902.  
  3903. if(FactsQuerySum("tut_fight_use_slomo") > 0)
  3904. {
  3905. theGame.RemoveTimeScale( theGame.GetTimescaleSource(ETS_TutorialFight) );
  3906. FactsRemove("tut_fight_slomo_ON");
  3907. }
  3908. }
  3909.  
  3910. if ( GetBIsInputAllowed() )
  3911. {
  3912. if ( GetBIsCombatActionAllowed() )
  3913. {
  3914. CriticalEffectAnimationInterrupted("Dodge 2");
  3915. PushCombatActionOnBuffer( bufferAction, BS_Released );
  3916. ProcessCombatActionBuffer();
  3917. }
  3918. else if ( IsInCombatAction() && GetBehaviorVariable( 'combatActionType' ) == (int)CAT_Attack )
  3919. {
  3920. if ( CanPlayHitAnim() && IsThreatened() )
  3921. {
  3922. CriticalEffectAnimationInterrupted("Dodge 1");
  3923. PushCombatActionOnBuffer( bufferAction, BS_Released );
  3924. ProcessCombatActionBuffer();
  3925. }
  3926. else
  3927. PushCombatActionOnBuffer( bufferAction, BS_Released );
  3928. }
  3929.  
  3930. else if ( !( IsCurrentSignChanneled() ) )
  3931. {
  3932.  
  3933. PushCombatActionOnBuffer( bufferAction, BS_Released );
  3934. }
  3935. }
  3936. else
  3937. {
  3938. if ( IsInCombatAction() && GetBehaviorVariable( 'combatActionType' ) == (int)CAT_Attack )
  3939. {
  3940. if ( CanPlayHitAnim() && IsThreatened() )
  3941. {
  3942. CriticalEffectAnimationInterrupted("Dodge 3");
  3943. PushCombatActionOnBuffer( bufferAction, BS_Released );
  3944. ProcessCombatActionBuffer();
  3945. }
  3946. else
  3947. PushCombatActionOnBuffer( bufferAction, BS_Released );
  3948. }
  3949. LogChannel( 'InputNotAllowed', "InputNotAllowed" );
  3950. }
  3951. }
  3952. else
  3953. {
  3954. DisplayActionDisallowedHudMessage(EIAB_Dodge);
  3955. }
  3956. }
  3957.  
  3958. //modSigns
  3959. public saved var isLowStaminaSFXPlaying : bool;
  3960.  
  3961. public function CheckForLowStamina()
  3962. {
  3963. var sfxThreshold : float = theGame.params.GetLowStaminaSFXThreshold();
  3964. var staminaPrc : float = GetStatPercents(BCS_Stamina);
  3965. var rate : float;
  3966.  
  3967. if(staminaPrc < sfxThreshold && !isLowStaminaSFXPlaying)
  3968. {
  3969. isLowStaminaSFXPlaying = true;
  3970. //PlayEffectSingle('focus_sound_red_fx');
  3971. if(!theSound.SoundIsBankLoaded("heartbeat02a.bnk"))
  3972. theSound.SoundLoadBank("heartbeat02a.bnk", false);
  3973. theSound.SoundEvent("play_heartbeat_02a_loop");
  3974. theSound.SoundParameter("heartbeat_rate", theGame.params.GetLowStaminaSFXRate());
  3975. theSound.SoundParameter("heartbeat_volume", theGame.params.GetLowStaminaSFXVolume());
  3976. }
  3977. else if(staminaPrc >= sfxThreshold && isLowStaminaSFXPlaying)
  3978. {
  3979. isLowStaminaSFXPlaying = false;
  3980. //StopEffectIfActive('focus_sound_red_fx');
  3981. theSound.SoundEvent("stop_heartbeat_02a_loop");
  3982. }
  3983. if(isLowStaminaSFXPlaying)
  3984. {
  3985. rate = (1.0f - staminaPrc / sfxThreshold) * 100.0f;
  3986. if(theGame.params.GetLowStaminaSFXDynRate())
  3987. theSound.SoundParameter("heartbeat_rate", rate);
  3988. if(theGame.params.GetLowStaminaSFXDynVol())
  3989. theSound.SoundParameter("heartbeat_volume", rate);
  3990. }
  3991. }
  3992.  
  3993. public function StopLowStaminaSFX() //modSigns
  3994. {
  3995. isLowStaminaSFXPlaying = false;
  3996. //StopEffectIfActive('focus_sound_red_fx');
  3997. theSound.SoundEvent("stop_heartbeat_02a_loop");
  3998. }
  3999.  
  4000. public function ProcessCombatActionBuffer() : bool
  4001. {
  4002. var action : EBufferActionType = this.BufferCombatAction;
  4003. var stage : EButtonStage = this.BufferButtonStage;
  4004. var throwStage : EThrowStage;
  4005. var actionResult : bool = true;
  4006.  
  4007.  
  4008. if( isInFinisher )
  4009. {
  4010. return false;
  4011. }
  4012.  
  4013. if ( action != EBAT_SpecialAttack_Heavy )
  4014. specialAttackCamera = false;
  4015.  
  4016.  
  4017. if(super.ProcessCombatActionBuffer())
  4018. return true;
  4019.  
  4020. switch ( action )
  4021. {
  4022. case EBAT_CastSign :
  4023. {
  4024. switch ( stage )
  4025. {
  4026. case BS_Pressed :
  4027. {
  4028.  
  4029.  
  4030.  
  4031.  
  4032.  
  4033.  
  4034. actionResult = this.CastSign();
  4035. LogChannel('SignDebug', "CastSign()");
  4036.  
  4037.  
  4038. } break;
  4039.  
  4040. default :
  4041. {
  4042. actionResult = false;
  4043. } break;
  4044. }
  4045. } break;
  4046.  
  4047. case EBAT_SpecialAttack_Light :
  4048. {
  4049. switch ( stage )
  4050. {
  4051. case BS_Pressed :
  4052. {
  4053.  
  4054. actionResult = this.OnPerformSpecialAttack( true, true );
  4055. } break;
  4056.  
  4057. case BS_Released :
  4058. {
  4059. actionResult = this.OnPerformSpecialAttack( true, false );
  4060. } break;
  4061.  
  4062. default :
  4063. {
  4064. actionResult = false;
  4065. } break;
  4066. }
  4067. } break;
  4068.  
  4069. case EBAT_SpecialAttack_Heavy :
  4070. {
  4071. switch ( stage )
  4072. {
  4073. case BS_Pressed :
  4074. {
  4075.  
  4076. actionResult = this.OnPerformSpecialAttack( false, true );
  4077. } break;
  4078.  
  4079. case BS_Released :
  4080. {
  4081. actionResult = this.OnPerformSpecialAttack( false, false );
  4082. } break;
  4083.  
  4084. default :
  4085. {
  4086. actionResult = false;
  4087. } break;
  4088. }
  4089. } break;
  4090.  
  4091. default:
  4092. return false;
  4093. }
  4094.  
  4095.  
  4096. this.CleanCombatActionBuffer();
  4097.  
  4098. if (actionResult)
  4099. {
  4100. SetCombatAction( action ) ;
  4101. }
  4102.  
  4103. return true;
  4104. }
  4105.  
  4106.  
  4107. event OnPerformSpecialAttack( isLightAttack : bool, enableAttack : bool ){}
  4108.  
  4109. public final function GetEnemies() : array< CActor >
  4110. {
  4111. var actors, actors2 : array<CActor>;
  4112. var i : int;
  4113.  
  4114.  
  4115. actors = GetWitcherPlayer().GetHostileEnemies();
  4116. ArrayOfActorsAppendUnique( actors, GetWitcherPlayer().GetMoveTargets() );
  4117.  
  4118.  
  4119. thePlayer.GetVisibleEnemies( actors2 );
  4120. ArrayOfActorsAppendUnique( actors, actors2 );
  4121.  
  4122. for( i=actors.Size()-1; i>=0; i-=1 )
  4123. {
  4124. if( !IsRequiredAttitudeBetween( actors[i], this, true ) )
  4125. {
  4126. actors.EraseFast( i );
  4127. }
  4128. }
  4129.  
  4130. return actors;
  4131. }
  4132.  
  4133. event OnPlayerTickTimer( deltaTime : float )
  4134. {
  4135. super.OnPlayerTickTimer( deltaTime );
  4136.  
  4137. if ( !IsInCombat() )
  4138. {
  4139. fastAttackCounter = 0;
  4140. heavyAttackCounter = 0;
  4141. }
  4142. WmkGetMapMenuInstance().OnTick(deltaTime); // -= WMK:modAQOOM =-
  4143. }
  4144.  
  4145.  
  4146.  
  4147.  
  4148.  
  4149. 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
  4150. {
  4151. var ret : bool;
  4152. var skill : ESkill;
  4153.  
  4154. ret = super.PrepareAttackAction(hitTarget, animData, weaponId, parried, countered, parriedBy, attackAnimationName, hitTime, weaponEntity, attackAction);
  4155.  
  4156. if(!ret)
  4157. return false;
  4158.  
  4159.  
  4160. if(attackAction.IsActionMelee())
  4161. {
  4162. skill = SkillNameToEnum( attackAction.GetAttackTypeName() );
  4163. if( skill != S_SUndefined && CanUseSkill(skill))
  4164. {
  4165. if(IsLightAttack(animData.attackName))
  4166. fastAttackCounter += 1;
  4167. else
  4168. fastAttackCounter = 0;
  4169.  
  4170. if(IsHeavyAttack(animData.attackName))
  4171. heavyAttackCounter += 1;
  4172. else
  4173. heavyAttackCounter = 0;
  4174. }
  4175. }
  4176.  
  4177. AddTimer('FastAttackCounterDecay',5.0);
  4178. AddTimer('HeavyAttackCounterDecay',5.0);
  4179.  
  4180. return true;
  4181. }
  4182.  
  4183. protected function TestParryAndCounter(data : CPreAttackEventData, weaponId : SItemUniqueId, out parried : bool, out countered : bool) : array<CActor>
  4184. {
  4185.  
  4186. if(SkillNameToEnum(attackActionName) == S_Sword_s02)
  4187. data.Can_Parry_Attack = false;
  4188.  
  4189. return super.TestParryAndCounter(data, weaponId, parried, countered);
  4190. }
  4191.  
  4192. private timer function FastAttackCounterDecay(delta : float, id : int)
  4193. {
  4194. fastAttackCounter = 0;
  4195. }
  4196.  
  4197. private timer function HeavyAttackCounterDecay(delta : float, id : int)
  4198. {
  4199. heavyAttackCounter = 0;
  4200. }
  4201.  
  4202.  
  4203. public function GetCraftingSchematicsNames() : array<name> {return craftingSchematics;}
  4204.  
  4205. public function RemoveAllCraftingSchematics()
  4206. {
  4207. craftingSchematics.Clear();
  4208. }
  4209.  
  4210.  
  4211. function AddCraftingSchematic( nam : name, optional isSilent : bool, optional skipTutorialUpdate : bool ) : bool
  4212. {
  4213. var i : int;
  4214.  
  4215. if(!skipTutorialUpdate && ShouldProcessTutorial('TutorialCraftingGotRecipe'))
  4216. {
  4217. FactsAdd("tut_received_schematic");
  4218. }
  4219.  
  4220. for(i=0; i<craftingSchematics.Size(); i+=1)
  4221. {
  4222. if(craftingSchematics[i] == nam)
  4223. return false;
  4224.  
  4225.  
  4226. if(StrCmp(craftingSchematics[i],nam) > 0)
  4227. {
  4228. craftingSchematics.Insert(i,nam);
  4229. AddCraftingHudNotification( nam, isSilent );
  4230. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_CraftingSchematics );
  4231. return true;
  4232. }
  4233. }
  4234.  
  4235.  
  4236. craftingSchematics.PushBack(nam);
  4237. AddCraftingHudNotification( nam, isSilent );
  4238. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_CraftingSchematics );
  4239. return true;
  4240. }
  4241.  
  4242. function AddCraftingHudNotification( nam : name, isSilent : bool )
  4243. {
  4244. var hud : CR4ScriptedHud;
  4245. if( !isSilent )
  4246. {
  4247. hud = (CR4ScriptedHud)theGame.GetHud();
  4248. if( hud )
  4249. {
  4250. hud.OnCraftingSchematicUpdate( nam );
  4251. }
  4252. }
  4253. }
  4254.  
  4255. function AddAlchemyHudNotification( nam : name, isSilent : bool )
  4256. {
  4257. var hud : CR4ScriptedHud;
  4258. if( !isSilent )
  4259. {
  4260. hud = (CR4ScriptedHud)theGame.GetHud();
  4261. if( hud )
  4262. {
  4263. hud.OnAlchemySchematicUpdate( nam );
  4264. }
  4265. }
  4266. }
  4267.  
  4268. public function GetExpandedCraftingCategories() : array< name >
  4269. {
  4270. return expandedCraftingCategories;
  4271. }
  4272.  
  4273. public function AddExpandedCraftingCategory( category : name )
  4274. {
  4275. if ( IsNameValid( category ) )
  4276. {
  4277. ArrayOfNamesPushBackUnique( expandedCraftingCategories, category );
  4278. }
  4279. }
  4280.  
  4281. public function RemoveExpandedCraftingCategory( category : name )
  4282. {
  4283. if ( IsNameValid( category ) )
  4284. {
  4285. expandedCraftingCategories.Remove( category );
  4286. }
  4287. }
  4288.  
  4289. public function SetCraftingFilters(showHasIngre : bool, showMissingIngre : bool, showAlreadyCrafted : bool )
  4290. {
  4291. craftingFilters.showCraftable = showHasIngre;
  4292. craftingFilters.showMissingIngre = showMissingIngre;
  4293. craftingFilters.showAlreadyCrafted = showAlreadyCrafted;
  4294. }
  4295.  
  4296. public function GetCraftingFilters() : SCraftingFilters
  4297. {
  4298.  
  4299. if ( craftingFilters.showCraftable == false && craftingFilters.showMissingIngre == false && craftingFilters.showAlreadyCrafted == false )
  4300. {
  4301. craftingFilters.showCraftable = true;
  4302. craftingFilters.showMissingIngre = true;
  4303. craftingFilters.showAlreadyCrafted = false;
  4304. }
  4305.  
  4306. return craftingFilters;
  4307. }
  4308.  
  4309.  
  4310.  
  4311.  
  4312.  
  4313. event OnMutation11Triggered()
  4314. {
  4315. var min, max : SAbilityAttributeValue;
  4316. var healValue : float;
  4317. var quenEntity : W3QuenEntity;
  4318.  
  4319.  
  4320. if( IsSwimming() || IsDiving() || IsSailing() || IsUsingHorse() || IsUsingBoat() || IsUsingVehicle() || IsUsingExploration() )
  4321. {
  4322.  
  4323. //ForceSetStat( BCS_Vitality, GetStatMax( BCS_Vitality ) );
  4324. //
  4325. //
  4326. //theGame.MutationHUDFeedback( MFT_PlayOnce );
  4327. //
  4328. //
  4329. //GCameraShake( 1.0f, , , , true, 'camera_shake_loop_lvl1_1' );
  4330. //AddTimer( 'StopMutation11CamShake', 2.f );
  4331. //
  4332. //
  4333. //theGame.VibrateControllerVeryHard( 2.f );
  4334. //
  4335. //
  4336. //Mutation11ShockWave( true );
  4337.  
  4338.  
  4339. AddEffectDefault( EET_Mutation11Debuff, NULL, "Mutation 11 Debuff", false );
  4340. }
  4341. else
  4342. {
  4343. AddEffectDefault( EET_Mutation11Buff, this, "Mutation 11", false );
  4344. }
  4345. }
  4346.  
  4347. timer function StopMutation11CamShake( dt : float, id : int )
  4348. {
  4349. theGame.GetGameCamera().StopAnimation( 'camera_shake_loop_lvl1_1' );
  4350. }
  4351.  
  4352. private var mutation12IsOnCooldown : bool;
  4353.  
  4354. public final function AddMutation12Decoction()
  4355. {
  4356. var params : SCustomEffectParams;
  4357. var buffs : array< EEffectType >;
  4358. var existingDecoctionBuffs : array<CBaseGameplayEffect>;
  4359. var i : int;
  4360. var effectType : EEffectType;
  4361. var decoctions : array< SItemUniqueId >;
  4362. var tmpName : name;
  4363. var min, max : SAbilityAttributeValue;
  4364.  
  4365. if( mutation12IsOnCooldown )
  4366. {
  4367. return;
  4368. }
  4369.  
  4370.  
  4371. existingDecoctionBuffs = GetDrunkMutagens( "Mutation12" );
  4372. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation12', 'maxcap', min, max );
  4373. if( existingDecoctionBuffs.Size() >= min.valueAdditive )
  4374. {
  4375. return;
  4376. }
  4377.  
  4378.  
  4379. mutation12IsOnCooldown = true;
  4380. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation12', 'cooldown', min, max );
  4381. AddTimer( 'Mutation12Cooldown', CalculateAttributeValue( min ) );
  4382.  
  4383.  
  4384. decoctions = inv.GetItemsByTag( 'Mutagen' );
  4385.  
  4386.  
  4387. for( i=decoctions.Size()-1; i>=0; i-=1 )
  4388. {
  4389. inv.GetPotionItemBuffData( decoctions[i], effectType, tmpName );
  4390. if( HasBuff( effectType ) )
  4391. {
  4392. decoctions.EraseFast( i );
  4393. continue;
  4394. }
  4395. buffs.PushBack( effectType );
  4396. }
  4397.  
  4398.  
  4399. if( buffs.Size() == 0 )
  4400. {
  4401. for( i=EET_Mutagen01; i<=EET_Mutagen28; i+=1 )
  4402. {
  4403. if( !HasBuff( i ) )
  4404. {
  4405. buffs.PushBack( i );
  4406. }
  4407. }
  4408. }
  4409.  
  4410.  
  4411. //buffs.Remove( EET_Mutagen16 ); //modSigns
  4412. //buffs.Remove( EET_Mutagen24 ); //modSigns
  4413.  
  4414.  
  4415. if( buffs.Size() == 0 )
  4416. {
  4417. return;
  4418. }
  4419.  
  4420.  
  4421. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation12', 'duration', min, max );
  4422. params.effectType = buffs[ RandRange( buffs.Size() ) ];
  4423. params.creator = this;
  4424. params.sourceName = "Mutation12";
  4425. params.duration = min.valueAdditive;
  4426. AddEffectCustom( params );
  4427. ( ( W3Mutagen_Effect ) GetBuff( params.effectType, params.sourceName ) ).OverrideIcon( DecoctionEffectTypeToItemName( params.effectType ) );
  4428.  
  4429.  
  4430. if ( !IsEffectActive( 'invisible' ) )
  4431. {
  4432. PlayEffect( 'use_potion' );
  4433. }
  4434.  
  4435. theGame.MutationHUDFeedback( MFT_PlayOnce );
  4436. }
  4437.  
  4438. timer function Mutation12Cooldown( dt : float, id : int )
  4439. {
  4440. mutation12IsOnCooldown = false;
  4441. }
  4442.  
  4443.  
  4444. public final function HasResourcesToStartAnyMutationResearch() : bool
  4445. {
  4446. var greenPoints, redPoints, bluePoints, count : int;
  4447. var itemIDs : array< SItemUniqueId >;
  4448.  
  4449. if( levelManager.GetPointsFree( ESkillPoint ) > 0 )
  4450. {
  4451. return true;
  4452. }
  4453.  
  4454.  
  4455. count = inv.GetItemQuantityByName( 'Greater mutagen green' );
  4456. if( count > 0 )
  4457. {
  4458. itemIDs = inv.GetItemsByName( 'Greater mutagen green' );
  4459. greenPoints = inv.GetMutationResearchPoints( SC_Green, itemIDs[0] );
  4460. if( greenPoints > 0 )
  4461. {
  4462. return true;
  4463. }
  4464. }
  4465. count = inv.GetItemQuantityByName( 'Greater mutagen red' );
  4466. if( count > 0 )
  4467. {
  4468. itemIDs.Clear();
  4469. itemIDs = inv.GetItemsByName( 'Greater mutagen red' );
  4470. redPoints = inv.GetMutationResearchPoints( SC_Red, itemIDs[0] );
  4471. if( redPoints > 0 )
  4472. {
  4473. return true;
  4474. }
  4475. }
  4476. count = inv.GetItemQuantityByName( 'Greater mutagen blue' );
  4477. if( count > 0 )
  4478. {
  4479. itemIDs.Clear();
  4480. itemIDs = inv.GetItemsByName( 'Greater mutagen blue' );
  4481. bluePoints = inv.GetMutationResearchPoints( SC_Blue, itemIDs[0] );
  4482. if( bluePoints > 0 )
  4483. {
  4484. return true;
  4485. }
  4486. }
  4487.  
  4488. return false;
  4489. }
  4490.  
  4491.  
  4492. public final function Mutation11StartAnimation()
  4493. {
  4494.  
  4495. thePlayer.ActionPlaySlotAnimationAsync( 'PLAYER_SLOT', 'geralt_mutation_11', 0.2, 0.2 );
  4496.  
  4497.  
  4498. BlockAllActions( 'Mutation11', true );
  4499.  
  4500.  
  4501. loopingCameraShakeAnimName = 'camera_shake_loop_lvl1_1';
  4502. GCameraShake( 1.0f, , , , true, loopingCameraShakeAnimName );
  4503.  
  4504.  
  4505. theGame.VibrateControllerVeryHard( 15.f );
  4506.  
  4507.  
  4508. storedInteractionPriority = GetInteractionPriority();
  4509. SetInteractionPriority( IP_Max_Unpushable );
  4510. }
  4511.  
  4512. event OnAnimEvent_Mutation11ShockWave( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4513. {
  4514. Mutation11ShockWave( false );
  4515. }
  4516.  
  4517. private final function Mutation11ShockWave( skipQuenSign : bool )
  4518. {
  4519. var action : W3DamageAction;
  4520. var ents : array< CGameplayEntity >;
  4521. var i, j : int;
  4522. var damages : array< SRawDamage >;
  4523.  
  4524.  
  4525. FindGameplayEntitiesInSphere(ents, GetWorldPosition(), 5.f, 1000, '', FLAG_OnlyAliveActors + FLAG_ExcludeTarget + FLAG_Attitude_Hostile + FLAG_Attitude_Neutral, this);
  4526.  
  4527. if( ents.Size() > 0 )
  4528. {
  4529. damages = theGame.GetDefinitionsManager().GetDamagesFromAbility( 'Mutation11' );
  4530. }
  4531.  
  4532.  
  4533. for(i=0; i<ents.Size(); i+=1)
  4534. {
  4535. action = new W3DamageAction in theGame;
  4536. action.Initialize( this, ents[i], NULL, "Mutation11", EHRT_Heavy, CPS_SpellPower, false, false, true, false );
  4537.  
  4538. for( j=0; j<damages.Size(); j+=1 )
  4539. {
  4540. action.AddDamage( damages[j].dmgType, damages[j].dmgVal );
  4541. }
  4542.  
  4543. action.SetCannotReturnDamage( true );
  4544. action.SetProcessBuffsIfNoDamage( true );
  4545. action.AddEffectInfo( EET_KnockdownTypeApplicator );
  4546. action.SetHitAnimationPlayType( EAHA_ForceYes );
  4547. action.SetCanPlayHitParticle( false );
  4548.  
  4549. theGame.damageMgr.ProcessAction( action );
  4550. delete action;
  4551. }
  4552.  
  4553.  
  4554.  
  4555.  
  4556.  
  4557. mutation11QuenEntity = ( W3QuenEntity )GetSignEntity( ST_Quen );
  4558. if( !mutation11QuenEntity )
  4559. {
  4560. mutation11QuenEntity = (W3QuenEntity)theGame.CreateEntity( GetSignTemplate( ST_Quen ), GetWorldPosition(), GetWorldRotation() );
  4561. mutation11QuenEntity.CreateAttachment( this, 'quen_sphere' );
  4562. AddTimer( 'DestroyMutation11QuenEntity', 2.f );
  4563. }
  4564. mutation11QuenEntity.PlayHitEffect( 'quen_impulse_explode', mutation11QuenEntity.GetWorldRotation() );
  4565.  
  4566. if( !skipQuenSign )
  4567. {
  4568.  
  4569. PlayEffect( 'mutation_11_second_life' );
  4570.  
  4571.  
  4572. RestoreQuen( 1000000.f, 10.f, true );
  4573. }
  4574. }
  4575.  
  4576. private var mutation11QuenEntity : W3QuenEntity;
  4577. private var storedInteractionPriority : EInteractionPriority;
  4578.  
  4579. timer function DestroyMutation11QuenEntity( dt : float, id : int )
  4580. {
  4581. if( mutation11QuenEntity )
  4582. {
  4583. mutation11QuenEntity.Destroy();
  4584. }
  4585. }
  4586.  
  4587. event OnAnimEvent_Mutation11AnimEnd( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4588. {
  4589. if( animEventType == AET_DurationEnd )
  4590. {
  4591.  
  4592. BlockAllActions( 'Mutation11', false );
  4593.  
  4594.  
  4595. theGame.GetGameCamera().StopAnimation( 'camera_shake_loop_lvl1_1' );
  4596.  
  4597.  
  4598. theGame.StopVibrateController();
  4599.  
  4600.  
  4601. SetInteractionPriority( storedInteractionPriority );
  4602.  
  4603.  
  4604. RemoveBuff( EET_Mutation11Buff, true );
  4605. }
  4606. else if ( animEventType == AET_DurationStart || animEventType == AET_DurationStartInTheMiddle )
  4607. {
  4608.  
  4609. SetBehaviorVariable( 'AIControlled', 0.f );
  4610. }
  4611. }
  4612.  
  4613. //modSigns
  4614. public final function Mutation11GetBaseStrength() : float
  4615. {
  4616. var drainStrength : float;
  4617. var swordDmg, avAP, avSI : float;
  4618. var abl : SAbilityAttributeValue;
  4619. var curStats : SPlayerOffenseStats;
  4620. var sword : SItemUniqueId;
  4621.  
  4622. //avSI
  4623. abl = GetTotalSignSpellPower(S_Magic_1);
  4624. abl += GetTotalSignSpellPower(S_Magic_2);
  4625. abl += GetTotalSignSpellPower(S_Magic_3);
  4626. abl += GetTotalSignSpellPower(S_Magic_4);
  4627. abl += GetTotalSignSpellPower(S_Magic_5);
  4628. avSI = MaxF(0.0, abl.valueMultiplicative / 5.0 - 1.0) * 100;
  4629. //theGame.witcherLog.AddMessage("Mutation11 avSI = " + avSI);
  4630. //avAP
  4631. curStats = GetOffenseStatsList();
  4632. avAP = MaxF(0.0,
  4633. ( curStats.steelFastAP * (1 - curStats.steelFastCritChance/100.0) + curStats.steelFastCritAP * curStats.steelFastCritChance/100.0
  4634. + curStats.silverFastAP * (1 - curStats.silverFastCritChance/100.0) + curStats.silverFastCritAP * curStats.silverFastCritChance/100.0
  4635. + curStats.steelStrongAP * (1 - curStats.steelStrongCritChance/100.0) + curStats.steelStrongCritAP * curStats.steelStrongCritChance/100.0
  4636. + curStats.silverStrongAP * (1 - curStats.silverStrongCritChance/100.0) + curStats.silverStrongCritAP * curStats.silverStrongCritChance/100.0
  4637. )/4.0
  4638. ) * 100;
  4639. //theGame.witcherLog.AddMessage("Mutation11 avAP = " + avAP);
  4640. //swordDmg
  4641. sword = inv.GetCurrentlyHeldSword();
  4642. if( sword == GetInvalidUniqueId() )
  4643. {
  4644. GetItemEquippedOnSlot(EES_SteelSword, sword);
  4645. if( sword == GetInvalidUniqueId() )
  4646. GetItemEquippedOnSlot(EES_SilverSword, sword);
  4647. }
  4648. if( sword != GetInvalidUniqueId() )
  4649. {
  4650. if( inv.GetItemCategory(sword) == 'steelsword' )
  4651. swordDmg = GetTotalWeaponDamage(sword, theGame.params.DAMAGE_NAME_SLASHING, GetInvalidUniqueId());
  4652. else if( inv.GetItemCategory(sword) == 'silversword' )
  4653. swordDmg = GetTotalWeaponDamage(sword, theGame.params.DAMAGE_NAME_SILVER, GetInvalidUniqueId());
  4654. }
  4655. //theGame.witcherLog.AddMessage("Mutation11 swordDmg = " + swordDmg);
  4656. drainStrength = swordDmg + avAP + avSI;
  4657. //theGame.witcherLog.AddMessage("Mutation11 drainStrength = " + drainStrength);
  4658. return drainStrength;
  4659. }
  4660.  
  4661. public final function MutationSystemEnable( enable : bool )
  4662. {
  4663. ( ( W3PlayerAbilityManager ) abilityManager ).MutationSystemEnable( enable );
  4664. }
  4665.  
  4666. public final function IsMutationSystemEnabled() : bool
  4667. {
  4668. return ( ( W3PlayerAbilityManager ) abilityManager ).IsMutationSystemEnabled();
  4669. }
  4670.  
  4671. public final function GetMutation( mutationType : EPlayerMutationType ) : SMutation
  4672. {
  4673. return ( ( W3PlayerAbilityManager ) abilityManager ).GetMutation( mutationType );
  4674. }
  4675.  
  4676. public final function IsMutationActive( mutationType : EPlayerMutationType) : bool
  4677. {
  4678. var swordQuality : int;
  4679. var sword : SItemUniqueId;
  4680.  
  4681. if( GetEquippedMutationType() != mutationType )
  4682. {
  4683. return false;
  4684. }
  4685.  
  4686. switch( mutationType )
  4687. {
  4688. case EPMT_Mutation4 :
  4689. case EPMT_Mutation5 :
  4690. case EPMT_Mutation7 :
  4691. case EPMT_Mutation8 :
  4692. case EPMT_Mutation10 :
  4693. case EPMT_Mutation11 :
  4694. case EPMT_Mutation12 :
  4695. if( IsInFistFight() )
  4696. {
  4697. return false;
  4698. }
  4699. }
  4700.  
  4701. if( mutationType == EPMT_Mutation1 )
  4702. {
  4703. sword = inv.GetCurrentlyHeldSword();
  4704. swordQuality = inv.GetItemQuality( sword );
  4705.  
  4706.  
  4707. if( swordQuality < 3 )
  4708. {
  4709. return false;
  4710. }
  4711. }
  4712.  
  4713. return true;
  4714. }
  4715.  
  4716. public final function SetEquippedMutation( mutationType : EPlayerMutationType ) : bool
  4717. {
  4718. return ( ( W3PlayerAbilityManager ) abilityManager ).SetEquippedMutation( mutationType );
  4719. }
  4720.  
  4721. public final function GetEquippedMutationType() : EPlayerMutationType
  4722. {
  4723. return ( ( W3PlayerAbilityManager ) abilityManager ).GetEquippedMutationType();
  4724. }
  4725.  
  4726. // CA
  4727. timer function CAApplyOil( dt : float, id : int ) { super.ApplyOil( completeAnims.oilId, completeAnims.usedOnItem ); }
  4728. timer function CAContainerProcessLoot( dt : float, id : int ) { var lootData : W3LootPopupData; lootData = new W3LootPopupData in completeAnims.container; lootData.targetContainer = completeAnims.container; theGame.RequestPopup('LootPopup', lootData); }
  4729. timer function CAConsume( time : float, id : int ) { ConsumeItem( completeAnims.ItemToConsume ); }
  4730. timer function CADrinkPotion( time : float, id : int ) { DrinkPreparedPotion(completeAnims.SlotToConsume); }
  4731. timer function CADrinkPotionInv( time : float, id : int ) { DrinkPreparedPotion(completeAnims.SlotToConsume, completeAnims.ItemToConsume ); }
  4732. timer function CARepairBuffWeapon( dt : float, id : int ) {
  4733. AddEffectDefault(EET_EnhancedWeapon, this, "repair_object", false);
  4734. DisplayHudMessage(GetLocStringByKeyExt("panel_hud_message_repair_done"));
  4735. SoundEvent("gui_inventory_silversword_attach");
  4736. }
  4737. timer function CARepairBuffArmor( dt : float, id : int ) {
  4738. AddEffectDefault(EET_EnhancedArmor, this, "repair_object", false);
  4739. DisplayHudMessage(GetLocStringByKeyExt("panel_hud_message_repair_done"));
  4740. SoundEvent("gui_inventory_armor_attach");
  4741. }
  4742. // CA
  4743.  
  4744. public final function CanEquipMutation(mutationType : EPlayerMutationType) : bool
  4745. {
  4746. return ( ( W3PlayerAbilityManager ) abilityManager ).CanEquipMutation( mutationType );
  4747. }
  4748.  
  4749. public final function CanResearchMutation( mutationType : EPlayerMutationType ) : bool
  4750. {
  4751. return ( ( W3PlayerAbilityManager ) abilityManager ).CanResearchMutation( mutationType );
  4752. }
  4753.  
  4754. public final function IsMutationResearched(mutationType : EPlayerMutationType) : bool
  4755. {
  4756. return ( ( W3PlayerAbilityManager ) abilityManager ).IsMutationResearched( mutationType );
  4757. }
  4758.  
  4759. public final function GetMutationResearchProgress(mutationType : EPlayerMutationType) : int
  4760. {
  4761. return ( ( W3PlayerAbilityManager ) abilityManager ).GetMutationResearchProgress( mutationType );
  4762. }
  4763.  
  4764. public final function GetMasterMutationStage() : int
  4765. {
  4766. return ( ( W3PlayerAbilityManager ) abilityManager ).GetMasterMutationStage();
  4767. }
  4768.  
  4769. public final function MutationResearchWithSkillPoints(mutation : EPlayerMutationType, skillPoints : int) : bool
  4770. {
  4771. return ( ( W3PlayerAbilityManager ) abilityManager ).MutationResearchWithSkillPoints( mutation, skillPoints );
  4772. }
  4773.  
  4774. public final function MutationResearchWithItem(mutation : EPlayerMutationType, item : SItemUniqueId, optional count: int) : bool
  4775. {
  4776. return ( ( W3PlayerAbilityManager ) abilityManager ).MutationResearchWithItem( mutation, item, count );
  4777. }
  4778.  
  4779. public final function GetMutationLocalizedName( mutationType : EPlayerMutationType ) : string
  4780. {
  4781. var pam : W3PlayerAbilityManager;
  4782. var locKey : name;
  4783.  
  4784. pam = (W3PlayerAbilityManager)GetWitcherPlayer().abilityManager;
  4785. locKey = pam.GetMutationNameLocalizationKey( mutationType );
  4786.  
  4787. return GetLocStringByKeyExt( locKey );
  4788. }
  4789.  
  4790. public final function GetMutationLocalizedDescription( mutationType : EPlayerMutationType ) : string
  4791. {
  4792. var pam : W3PlayerAbilityManager;
  4793. var locKey : name;
  4794. var arrStr : array< string >;
  4795. var dm : CDefinitionsManagerAccessor;
  4796. var min, max, sp : SAbilityAttributeValue;
  4797. var tmp, tmp2, tox, critBonusDamage, val : float;
  4798. var stats, stats2 : SPlayerOffenseStats;
  4799. var buffPerc, exampleEnemyCount, debuffPerc : int;
  4800.  
  4801. pam = (W3PlayerAbilityManager)GetWitcherPlayer().abilityManager;
  4802. locKey = pam.GetMutationDescriptionLocalizationKey( mutationType );
  4803. dm = theGame.GetDefinitionsManager();
  4804.  
  4805. switch( mutationType )
  4806. {
  4807. case EPMT_Mutation1 :
  4808. dm.GetAbilityAttributeValue('Mutation1', 'dmg_bonus_factor', min, max);
  4809. arrStr.PushBack( NoTrailZeros( RoundMath( 100 * min.valueAdditive ) ) );
  4810. break;
  4811.  
  4812. case EPMT_Mutation2 :
  4813. sp = GetPowerStatValue( CPS_SpellPower );
  4814.  
  4815.  
  4816. dm.GetAbilityAttributeValue( 'Mutation2', 'crit_chance_factor', min, max );
  4817. //arrStr.PushBack( NoTrailZeros( RoundMath( 100 * ( min.valueAdditive + sp.valueMultiplicative * min.valueMultiplicative ) ) ) );
  4818. //modSigns: changing the formula
  4819. arrStr.PushBack( NoTrailZeros( RoundMath( 100 * ( ClampF(min.valueAdditive + SignPowerStatToPowerBonus(sp.valueMultiplicative) * min.valueMultiplicative, 0.f, 1.f) ) ) ) );
  4820.  
  4821.  
  4822. dm.GetAbilityAttributeValue( 'Mutation2', 'crit_damage_factor', min, max );
  4823. //critBonusDamage = sp.valueMultiplicative * min.valueMultiplicative;
  4824. //modSigns: changing the formula
  4825. critBonusDamage = min.valueAdditive + SignPowerStatToPowerBonus(sp.valueMultiplicative) * min.valueMultiplicative;
  4826.  
  4827. arrStr.PushBack( NoTrailZeros( RoundMath( 100 * critBonusDamage ) ) );
  4828. break;
  4829.  
  4830. case EPMT_Mutation3 : //modSigns: mutation reworked
  4831.  
  4832. dm.GetAbilityAttributeValue('Mutation3', 'attack_power', min, max);
  4833. tmp = min.valueMultiplicative;
  4834.  
  4835. dm.GetAbilityAttributeValue('Mutation3', 'mutation3_buff_rate_sword', min, max);
  4836. tmp2 = tmp * min.valueAdditive;
  4837. arrStr.PushBack( NoTrailZeros( 100 * tmp2 ) );
  4838. dm.GetAbilityAttributeValue('Mutation3', 'mutation3_buff_rate_other', min, max);
  4839. tmp2 = tmp * min.valueAdditive;
  4840. arrStr.PushBack( NoTrailZeros( 100 * tmp2 ) );
  4841. dm.GetAbilityAttributeValue('Mutation3', 'mutation3_debuff_rate', min, max);
  4842. tmp2 = tmp * min.valueAdditive;
  4843. arrStr.PushBack( NoTrailZeros( 100 * tmp2 ) );
  4844. dm.GetAbilityAttributeValue('Mutation3', 'mutation3_buff_rate_kill', min, max);
  4845. tmp2 = tmp * min.valueAdditive;
  4846. arrStr.PushBack( NoTrailZeros( 100 * tmp2 ) );
  4847. dm.GetAbilityAttributeValue('Mutation3', 'mutation3_maxcap', min, max);
  4848. tmp2 = tmp * min.valueAdditive;
  4849. arrStr.PushBack( NoTrailZeros( 100 * tmp2 ) );
  4850.  
  4851. //dm.GetAbilityAttributeValue( 'Mutation3', 'attack_power', min, max );
  4852. //tmp = min.valueMultiplicative;
  4853. //arrStr.PushBack( NoTrailZeros( RoundMath( 100 * tmp ) ) );
  4854. //dm.GetAbilityAttributeValue( 'Mutation3', 'maxcap', min, max );
  4855. //arrStr.PushBack( NoTrailZeros( RoundMath( 100 * tmp * min.valueAdditive ) ) );
  4856. break;
  4857.  
  4858. case EPMT_Mutation4 : //modSigns: mutation reworked
  4859.  
  4860. dm.GetAbilityAttributeValue( 'Mutation4', 'toxicityRegenFactor', min, max );
  4861. tmp = min.valueAdditive;
  4862. arrStr.PushBack( NoTrailZeros( tmp * 100 ) );
  4863.  
  4864. dm.GetAbilityAttributeValue( 'AcidEffect', 'DirectDamage', min, max );
  4865. tmp = min.valueAdditive;
  4866. arrStr.PushBack( NoTrailZeros( tmp ) );
  4867.  
  4868. arrStr.PushBack( NoTrailZeros( RoundMath( tmp * GetStat( BCS_Toxicity ) ) ) );
  4869. arrStr.PushBack( NoTrailZeros( RoundMath( tmp * GetStatMax( BCS_Toxicity ) ) ) );
  4870.  
  4871. dm.GetAbilityAttributeValue( 'AcidEffect', 'duration', min, max );
  4872. tmp = min.valueAdditive;
  4873. arrStr.PushBack( NoTrailZeros( tmp ) );
  4874.  
  4875. dm.GetAbilityAttributeValue( 'Mutation4BloodDebuff', 'staminaRegen', min, max );
  4876. tmp = AbsF( min.valueMultiplicative ) * 100;
  4877. arrStr.PushBack( NoTrailZeros( tmp ) );
  4878. break;
  4879.  
  4880. case EPMT_Mutation5 :
  4881.  
  4882. //dm.GetAbilityAttributeValue( 'Mutation5', 'mut5_dmg_red_perc', min, max );
  4883. //tmp = min.valueAdditive;
  4884. //arrStr.PushBack( NoTrailZeros( 100 * tmp ) );
  4885. //
  4886. //
  4887. //arrStr.PushBack( NoTrailZeros( 100 * tmp * 3 ) );
  4888.  
  4889. //modSigns: mutation changed
  4890. dm.GetAbilityAttributeValue( 'Mutation5', 'mut5_duration_per_point', min, max );
  4891. arrStr.PushBack( NoTrailZeros( min.valueAdditive ) );
  4892. arrStr.PushBack( NoTrailZeros( min.valueAdditive * GetStatMax(BCS_Focus) ) );
  4893. arrStr.PushBack( NoTrailZeros( min.valueAdditive ) );
  4894.  
  4895. break;
  4896.  
  4897. case EPMT_Mutation6 :
  4898. //modSigns: raw and total damage
  4899. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation6', 'full_freeze_chance', min, max );
  4900. arrStr.PushBack( RoundMath( 100 * min.valueMultiplicative ) );
  4901. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation6', 'ForceDamage', min, max );
  4902. val = CalculateAttributeValue( min );
  4903. arrStr.PushBack( RoundMath( val ) );
  4904. sp = GetTotalSignSpellPower( S_Magic_1 );
  4905. arrStr.PushBack( RoundMath( val * sp.valueMultiplicative ) );
  4906.  
  4907. break;
  4908.  
  4909. case EPMT_Mutation7 : //modSigns: changed
  4910.  
  4911. dm.GetAbilityAttributeValue( 'Mutation7BuffEffect', 'duration', min, max );
  4912. arrStr.PushBack( NoTrailZeros( min.valueAdditive ) );
  4913.  
  4914. dm.GetAbilityAttributeValue( 'Mutation7Buff', 'attack_power', min, max );
  4915. buffPerc = RoundMath( 100 * min.valueMultiplicative );
  4916. arrStr.PushBack( NoTrailZeros( buffPerc ) );
  4917.  
  4918. dm.GetAbilityAttributeValue( 'Mutation7DebuffEffect', 'duration', min, max );
  4919. arrStr.PushBack( NoTrailZeros( min.valueAdditive ) );
  4920.  
  4921. dm.GetAbilityAttributeValue( 'Mutation7Debuff', 'attack_power', min, max );
  4922. buffPerc = RoundMath( -100 * min.valueMultiplicative );
  4923. arrStr.PushBack( NoTrailZeros( buffPerc ) );
  4924.  
  4925. break;
  4926.  
  4927. case EPMT_Mutation8 : //modSigns: changed
  4928.  
  4929. dm.GetAbilityAttributeValue( 'Mutation8', 'hp_perc_trigger', min, max );
  4930. arrStr.PushBack( NoTrailZeros( 100 * min.valueMultiplicative ) );
  4931.  
  4932. dm.GetAbilityAttributeValue( 'Mutation8', 'dmg_bonus', min, max );
  4933. arrStr.PushBack( FloatToStringPrec( 100 * min.valueMultiplicative, 0 ) );
  4934.  
  4935. arrStr.PushBack( FloatToStringPrec( 100 * min.valueMultiplicative * GetStatMax(BCS_Focus), 0 ) );
  4936.  
  4937. break;
  4938.  
  4939. case EPMT_Mutation9 : //modSigns: changed
  4940.  
  4941.  
  4942.  
  4943.  
  4944. //stats = GetOffenseStatsList( 1 );
  4945. //arrStr.PushBack( NoTrailZeros( RoundMath( stats.crossbowSteelDmg ) ) );
  4946.  
  4947.  
  4948. //stats2 = GetOffenseStatsList( 2 );
  4949. //arrStr.PushBack( NoTrailZeros( RoundMath( stats2.crossbowSteelDmg ) ) );
  4950.  
  4951.  
  4952. //dm.GetAbilityAttributeValue( 'Mutation9', 'critical_hit_chance', min, max );
  4953. //arrStr.PushBack( NoTrailZeros( 100 * min.valueMultiplicative ) );
  4954.  
  4955. //dm.GetAbilityAttributeValue( 'Mutation9', 'critical_damage', min, max );
  4956. //arrStr.PushBack( NoTrailZeros( 100 * min.valueAdditive ) );
  4957.  
  4958. dm.GetAbilityAttributeValue( 'Mutation9', 'mut9_damage', min, max );
  4959. arrStr.PushBack( NoTrailZeros( 100 * min.valueMultiplicative ) );
  4960.  
  4961. dm.GetAbilityAttributeValue( 'Mutation9', 'health_reduction', min, max );
  4962. arrStr.PushBack( NoTrailZeros( 100 * min.valueMultiplicative ) );
  4963.  
  4964. dm.GetAbilityAttributeValue( 'Mutation9', 'mut9_slowdown', min, max );
  4965. arrStr.PushBack( NoTrailZeros( 100 * min.valueAdditive ) );
  4966.  
  4967. break;
  4968.  
  4969. case EPMT_Mutation10 : //modSigns: redone
  4970.  
  4971. //dm.GetAbilityAttributeValue( 'Mutation10Effect', 'mutation10_stat_boost', min, max );
  4972. dm.GetAbilityAttributeValue( 'Mutation10Effect', 'mutation10_factor', min, max );
  4973. arrStr.PushBack( NoTrailZeros( min.valueMultiplicative ) );
  4974. arrStr.PushBack( NoTrailZeros( RoundMath(GetToxicityDamage())) );
  4975.  
  4976. theGame.GetDefinitionsManager().GetAbilityAttributeValue('ToxicityEffect', 'DirectDamage', min, max);
  4977. tmp = min.valueMultiplicative * GetStatMax(BCS_Vitality);
  4978. theGame.GetDefinitionsManager().GetAbilityAttributeValue('Mutation10Effect', 'mutation10_factor', min, max);
  4979. tmp *= 1 + min.valueMultiplicative * GetStatMax(BCS_Toxicity)/100.0;
  4980. arrStr.PushBack( NoTrailZeros( RoundMath(tmp)) );
  4981.  
  4982.  
  4983. //arrStr.PushBack( NoTrailZeros( 100 * min.valueMultiplicative * GetStatMax( BCS_Toxicity ) ) );
  4984.  
  4985. break;
  4986.  
  4987. case EPMT_Mutation11 : //modSigns: redone
  4988.  
  4989. dm.GetAbilityAttributeValue( 'Mutation11BuffEffect', 'duration', min, max);
  4990. arrStr.PushBack( NoTrailZeros( min.valueAdditive ) );
  4991.  
  4992. dm.GetAbilityAttributeValue( 'Mutation11DebuffEffect', 'duration', min, max);
  4993. arrStr.PushBack( NoTrailZeros( min.valueAdditive ) );
  4994.  
  4995. arrStr.PushBack( NoTrailZeros( MaxF(1, Mutation11GetBaseStrength()) * GetStatMax(BCS_Focus) ) );
  4996.  
  4997. break;
  4998.  
  4999. case EPMT_Mutation12 :
  5000.  
  5001. dm.GetAbilityAttributeValue( 'Mutation12', 'duration', min, max );
  5002. arrStr.PushBack( NoTrailZeros( min.valueAdditive ) );
  5003.  
  5004.  
  5005. dm.GetAbilityAttributeValue( 'Mutation12', 'maxcap', min, max );
  5006. arrStr.PushBack( NoTrailZeros( min.valueAdditive ) );
  5007. break;
  5008.  
  5009. case EPMT_MutationMaster :
  5010.  
  5011. arrStr.PushBack( "4" );
  5012.  
  5013. break;
  5014. }
  5015.  
  5016. return GetLocStringByKeyExtWithParams( locKey, , , arrStr );
  5017. }
  5018.  
  5019. //public final function ApplyMutation10StatBoost( out statValue : SAbilityAttributeValue )
  5020. //{
  5021. // var attValue : SAbilityAttributeValue;
  5022. // var currToxicity : float;
  5023. //
  5024. // if( IsMutationActive( EPMT_Mutation10 ) )
  5025. // {
  5026. // currToxicity = GetStat( BCS_Toxicity );
  5027. // if( currToxicity > 0.f )
  5028. // {
  5029. // attValue = GetAttributeValue( 'mutation10_stat_boost' );
  5030. // currToxicity *= attValue.valueMultiplicative;
  5031. // statValue.valueMultiplicative += currToxicity;
  5032. // }
  5033. // }
  5034. //} //modSigns: redone
  5035.  
  5036.  
  5037.  
  5038.  
  5039.  
  5040.  
  5041.  
  5042. public final function IsBookRead( bookName : name ):bool
  5043. {
  5044. return booksRead.Contains( bookName );
  5045. }
  5046.  
  5047. public final function AddReadBook( bookName : name ):void
  5048. {
  5049. if( !booksRead.Contains( bookName ) )
  5050. {
  5051. booksRead.PushBack( bookName );
  5052. }
  5053. }
  5054.  
  5055. public final function RemoveReadBook( bookName : name ):void
  5056. {
  5057. var idx : int = booksRead.FindFirst( bookName );
  5058.  
  5059. if( idx > -1 )
  5060. {
  5061. booksRead.Erase( idx );
  5062. }
  5063. }
  5064.  
  5065.  
  5066.  
  5067.  
  5068.  
  5069.  
  5070.  
  5071. public final function GetMutagenBuffs() : array< W3Mutagen_Effect >
  5072. {
  5073. var null : array< W3Mutagen_Effect >;
  5074.  
  5075. if(effectManager)
  5076. {
  5077. return effectManager.GetMutagenBuffs();
  5078. }
  5079.  
  5080. return null;
  5081. }
  5082.  
  5083. public function GetAlchemyRecipes() : array<name>
  5084. {
  5085. return alchemyRecipes;
  5086. }
  5087.  
  5088. public function CanLearnAlchemyRecipe(recipeName : name) : bool
  5089. {
  5090. var dm : CDefinitionsManagerAccessor;
  5091. var recipeNode : SCustomNode;
  5092. var i, tmpInt : int;
  5093. var tmpName : name;
  5094.  
  5095. dm = theGame.GetDefinitionsManager();
  5096. if ( dm.GetSubNodeByAttributeValueAsCName( recipeNode, 'alchemy_recipes', 'name_name', recipeName ) )
  5097. {
  5098. return true;
  5099.  
  5100. }
  5101.  
  5102. return false;
  5103. }
  5104.  
  5105. private final function RemoveAlchemyRecipe(recipeName : name)
  5106. {
  5107. alchemyRecipes.Remove(recipeName);
  5108. }
  5109.  
  5110. private final function RemoveAllAlchemyRecipes()
  5111. {
  5112. alchemyRecipes.Clear();
  5113. }
  5114.  
  5115. //modSigns: skill changed
  5116. public function CountAlchemy18Abilities(skillLevel : int) : int
  5117. {
  5118. var absToAdd : int;
  5119. var maxAbsAllowed : int;
  5120. var names : array<name>;
  5121. var m_alchemyManager : W3AlchemyManager;
  5122. var recipe : SAlchemyRecipe;
  5123. var i : int;
  5124.  
  5125. absToAdd = 0;
  5126. maxAbsAllowed = skillLevel * RoundMath(CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s18, 'max_abs_per_lvl_s18', false, false)));
  5127. m_alchemyManager = new W3AlchemyManager in this;
  5128. m_alchemyManager.Init();
  5129. names = GetAlchemyRecipes();
  5130. for(i = 0; i < names.Size(); i += 1)
  5131. {
  5132. m_alchemyManager.GetRecipe(names[i], recipe);
  5133. //if(IsAlchemy18Recipe(recipe.cookedItemType) && GetAlchemy18RecipeLevel(recipe) <= skillLevel)
  5134. if(absToAdd < maxAbsAllowed && IsAlchemy18Recipe(recipe.cookedItemType))
  5135. absToAdd += 1;
  5136. }
  5137.  
  5138. return absToAdd;
  5139. }
  5140.  
  5141. //modSigns
  5142. public function RecalcAlchemy18Abilities()
  5143. {
  5144. var absToAdd, curAbs : int;
  5145. var skillName : name = SkillEnumToName(S_Alchemy_s18);
  5146.  
  5147. if(CanUseSkill(S_Alchemy_s18))
  5148. absToAdd = CountAlchemy18Abilities(GetSkillLevel(S_Alchemy_s18));
  5149. else
  5150. absToAdd = 0;
  5151. curAbs = GetAbilityCount(skillName);
  5152.  
  5153. if(absToAdd == 0)
  5154. RemoveAbilityAll(skillName);
  5155. else if(absToAdd > curAbs)
  5156. AddAbilityMultiple(skillName, absToAdd - curAbs);
  5157. else if(absToAdd < curAbs)
  5158. RemoveAbilityMultiple(skillName, curAbs - absToAdd);
  5159. }
  5160.  
  5161. function AddAlchemyRecipe(nam : name, optional isSilent : bool, optional skipTutorialUpdate : bool) : bool
  5162. {
  5163. var i, potions, bombs : int;
  5164. var found : bool;
  5165. var m_alchemyManager : W3AlchemyManager;
  5166. var recipe : SAlchemyRecipe;
  5167. var knownBombTypes : array<string>;
  5168. var strRecipeName, recipeNameWithoutLevel : string;
  5169.  
  5170. if(!IsAlchemyRecipe(nam))
  5171. return false;
  5172.  
  5173. found = false;
  5174. for(i=0; i<alchemyRecipes.Size(); i+=1)
  5175. {
  5176. if(alchemyRecipes[i] == nam)
  5177. return false;
  5178.  
  5179.  
  5180. if(StrCmp(alchemyRecipes[i],nam) > 0)
  5181. {
  5182. alchemyRecipes.Insert(i,nam);
  5183. found = true;
  5184. AddAlchemyHudNotification(nam,isSilent);
  5185. break;
  5186. }
  5187. }
  5188.  
  5189. if(!found)
  5190. {
  5191. alchemyRecipes.PushBack(nam);
  5192. AddAlchemyHudNotification(nam,isSilent);
  5193. }
  5194.  
  5195. m_alchemyManager = new W3AlchemyManager in this;
  5196. m_alchemyManager.Init(alchemyRecipes);
  5197. m_alchemyManager.GetRecipe(nam, recipe);
  5198.  
  5199.  
  5200. //if(CanUseSkill(S_Alchemy_s18))
  5201. //{
  5202. // //modSigns
  5203. // //if ((recipe.cookedItemType != EACIT_Bolt) && (recipe.cookedItemType != EACIT_Undefined) && (recipe.cookedItemType != EACIT_Dye) && (recipe.level <= GetSkillLevel(S_Alchemy_s18)))
  5204. // if(IsAlchemy18Recipe(recipe.cookedItemType) && recipe.level <= GetSkillLevel(S_Alchemy_s18))
  5205. // AddAbility(SkillEnumToName(S_Alchemy_s18), true);
  5206. //
  5207. //}
  5208. //modSigns: moved to another place
  5209. RecalcAlchemy18Abilities();
  5210.  
  5211.  
  5212. if(recipe.cookedItemType == EACIT_Bomb)
  5213. {
  5214. bombs = 0;
  5215. for(i=0; i<alchemyRecipes.Size(); i+=1)
  5216. {
  5217. m_alchemyManager.GetRecipe(alchemyRecipes[i], recipe);
  5218.  
  5219.  
  5220. if(recipe.cookedItemType == EACIT_Bomb)
  5221. {
  5222. strRecipeName = NameToString(alchemyRecipes[i]);
  5223. recipeNameWithoutLevel = StrLeft(strRecipeName, StrLen(strRecipeName)-2);
  5224. if(!knownBombTypes.Contains(recipeNameWithoutLevel))
  5225. {
  5226. bombs += 1;
  5227. knownBombTypes.PushBack(recipeNameWithoutLevel);
  5228. }
  5229. }
  5230. }
  5231.  
  5232. theGame.GetGamerProfile().SetStat(ES_KnownBombRecipes, bombs);
  5233. }
  5234.  
  5235. else if(recipe.cookedItemType == EACIT_Potion || recipe.cookedItemType == EACIT_MutagenPotion || recipe.cookedItemType == EACIT_Alcohol || recipe.cookedItemType == EACIT_Quest)
  5236. {
  5237. potions = 0;
  5238. for(i=0; i<alchemyRecipes.Size(); i+=1)
  5239. {
  5240. m_alchemyManager.GetRecipe(alchemyRecipes[i], recipe);
  5241.  
  5242.  
  5243. if(recipe.cookedItemType == EACIT_Potion || recipe.cookedItemType == EACIT_MutagenPotion || recipe.cookedItemType == EACIT_Alcohol || recipe.cookedItemType == EACIT_Quest)
  5244. {
  5245. potions += 1;
  5246. }
  5247. }
  5248. theGame.GetGamerProfile().SetStat(ES_KnownPotionRecipes, potions);
  5249. }
  5250.  
  5251. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_AlchemyRecipe );
  5252.  
  5253. return true;
  5254. }
  5255.  
  5256. public function GetExpandedAlchemyCategories() : array< name >
  5257. {
  5258. return expandedAlchemyCategories;
  5259. }
  5260.  
  5261. public function AddExpandedAlchemyCategory( category : name )
  5262. {
  5263. if ( IsNameValid( category ) )
  5264. {
  5265. ArrayOfNamesPushBackUnique( expandedAlchemyCategories, category );
  5266. }
  5267. }
  5268.  
  5269. public function RemoveExpandedAlchemyCategory( category : name )
  5270. {
  5271. if ( IsNameValid( category ) )
  5272. {
  5273. expandedAlchemyCategories.Remove( category );
  5274. }
  5275. }
  5276.  
  5277. public function SetAlchemyFilters(showHasIngre : bool, showMissingIngre : bool, showAlreadyCrafted : bool )
  5278. {
  5279. alchemyFilters.showCraftable = showHasIngre;
  5280. alchemyFilters.showMissingIngre = showMissingIngre;
  5281. alchemyFilters.showAlreadyCrafted = showAlreadyCrafted;
  5282. }
  5283.  
  5284. public function GetAlchemyFilters() : SCraftingFilters
  5285. {
  5286.  
  5287. if ( alchemyFilters.showCraftable == false && alchemyFilters.showMissingIngre == false && alchemyFilters.showAlreadyCrafted == false )
  5288. {
  5289. alchemyFilters.showCraftable = true;
  5290. alchemyFilters.showMissingIngre = true;
  5291. alchemyFilters.showAlreadyCrafted = false;
  5292. }
  5293.  
  5294. return alchemyFilters;
  5295. }
  5296.  
  5297.  
  5298.  
  5299.  
  5300.  
  5301.  
  5302.  
  5303. public function GetExpandedBestiaryCategories() : array< name >
  5304. {
  5305. return expandedBestiaryCategories;
  5306. }
  5307.  
  5308. public function AddExpandedBestiaryCategory( category : name )
  5309. {
  5310. if ( IsNameValid( category ) )
  5311. {
  5312. ArrayOfNamesPushBackUnique( expandedBestiaryCategories, category );
  5313. }
  5314. }
  5315.  
  5316. public function RemoveExpandedBestiaryCategory( category : name )
  5317. {
  5318. if ( IsNameValid( category ) )
  5319. {
  5320. expandedBestiaryCategories.Remove( category );
  5321. }
  5322. }
  5323.  
  5324.  
  5325.  
  5326.  
  5327.  
  5328.  
  5329.  
  5330. public function GetDisplayHeavyAttackIndicator() : bool
  5331. {
  5332. return bDispalyHeavyAttackIndicator;
  5333. }
  5334.  
  5335. public function SetDisplayHeavyAttackIndicator( val : bool )
  5336. {
  5337. bDispalyHeavyAttackIndicator = val;
  5338. }
  5339.  
  5340. public function GetDisplayHeavyAttackFirstLevelTimer() : bool
  5341. {
  5342. return bDisplayHeavyAttackFirstLevelTimer;
  5343. }
  5344.  
  5345. public function SetDisplayHeavyAttackFirstLevelTimer( val : bool )
  5346. {
  5347. bDisplayHeavyAttackFirstLevelTimer = val;
  5348. }
  5349.  
  5350.  
  5351.  
  5352.  
  5353.  
  5354.  
  5355.  
  5356. public function SelectQuickslotItem( slot : EEquipmentSlots )
  5357. {
  5358. var item : SItemUniqueId;
  5359.  
  5360. GetItemEquippedOnSlot(slot, item);
  5361. selectedItemId = item;
  5362. }
  5363.  
  5364.  
  5365.  
  5366.  
  5367.  
  5368.  
  5369.  
  5370. public function GetMedallion() : W3MedallionController
  5371. {
  5372. if ( !medallionController )
  5373. {
  5374. medallionController = new W3MedallionController in this;
  5375. }
  5376. return medallionController;
  5377. }
  5378.  
  5379.  
  5380. public final function HighlightObjects(range : float, optional highlightTime : float )
  5381. {
  5382. var ents : array<CGameplayEntity>;
  5383. var i : int;
  5384.  
  5385. FindGameplayEntitiesInSphere(ents, GetWorldPosition(), range, 100, 'HighlightedByMedalionFX', FLAG_ExcludePlayer);
  5386.  
  5387. if(highlightTime == 0)
  5388. highlightTime = 30;
  5389.  
  5390. for(i=0; i<ents.Size(); i+=1)
  5391. {
  5392. if(!ents[i].IsHighlighted())
  5393. {
  5394. ents[i].SetHighlighted( true );
  5395. ents[i].PlayEffectSingle( 'medalion_detection_fx' );
  5396. ents[i].AddTimer( 'MedallionEffectOff', highlightTime );
  5397. }
  5398. }
  5399. }
  5400.  
  5401.  
  5402. public final function HighlightEnemies(range : float, optional highlightTime : float )
  5403. {
  5404. var ents : array<CGameplayEntity>;
  5405. var i : int;
  5406. var catComponent : CGameplayEffectsComponent;
  5407.  
  5408. FindGameplayEntitiesInSphere(ents, GetWorldPosition(), range, 100, , FLAG_ExcludePlayer + FLAG_OnlyAliveActors);
  5409.  
  5410. if(highlightTime == 0)
  5411. highlightTime = 5;
  5412.  
  5413. for(i=0; i<ents.Size(); i+=1)
  5414. {
  5415. if(IsRequiredAttitudeBetween(this, ents[i], true))
  5416. {
  5417. catComponent = GetGameplayEffectsComponent(ents[i]);
  5418. if(catComponent)
  5419. {
  5420. catComponent.SetGameplayEffectFlag(EGEF_CatViewHiglight, true);
  5421. ents[i].AddTimer( 'EnemyHighlightOff', highlightTime, , , , , true );
  5422. }
  5423. }
  5424. }
  5425. }
  5426.  
  5427. function SpawnMedallionEntity()
  5428. {
  5429. var rot : EulerAngles;
  5430. var spawnedMedallion : CEntity;
  5431.  
  5432. spawnedMedallion = theGame.GetEntityByTag( 'new_Witcher_medallion_FX' );
  5433.  
  5434. if ( !spawnedMedallion )
  5435. theGame.CreateEntity( medallionEntity, GetWorldPosition(), rot, true, false );
  5436. }
  5437.  
  5438.  
  5439.  
  5440.  
  5441.  
  5442.  
  5443.  
  5444.  
  5445.  
  5446. public final function InterruptCombatFocusMode()
  5447. {
  5448. if( this.GetCurrentStateName() == 'CombatFocusMode_SelectSpot' )
  5449. {
  5450. SetCanPlayHitAnim( true );
  5451. PopState();
  5452. }
  5453. }
  5454.  
  5455. public final function IsInDarkPlace() : bool
  5456. {
  5457. var envs : array< string >;
  5458.  
  5459. if( FactsQuerySum( "tut_in_dark_place" ) )
  5460. {
  5461. return true;
  5462. }
  5463.  
  5464. GetActiveAreaEnvironmentDefinitions( envs );
  5465.  
  5466. if( envs.Contains( 'env_novigrad_cave' ) || envs.Contains( 'cave_catacombs' ) )
  5467. {
  5468. return true;
  5469. }
  5470.  
  5471. return false;
  5472. }
  5473.  
  5474.  
  5475.  
  5476.  
  5477.  
  5478. private saved var selectedPotionSlotUpper, selectedPotionSlotLower : EEquipmentSlots;
  5479. private var potionDoubleTapTimerRunning, potionDoubleTapSlotIsUpper : bool;
  5480. default selectedPotionSlotUpper = EES_Potion1;
  5481. default selectedPotionSlotLower = EES_Potion2;
  5482. default potionDoubleTapTimerRunning = false;
  5483.  
  5484. public final function SetPotionDoubleTapRunning(b : bool, optional isUpperSlot : bool)
  5485. {
  5486. if(b)
  5487. {
  5488. AddTimer('PotionDoubleTap', 0.3);
  5489. }
  5490. else
  5491. {
  5492. RemoveTimer('PotionDoubleTap');
  5493. }
  5494.  
  5495. potionDoubleTapTimerRunning = b;
  5496. potionDoubleTapSlotIsUpper = isUpperSlot;
  5497. }
  5498.  
  5499. public final function IsPotionDoubleTapRunning() : bool
  5500. {
  5501. return potionDoubleTapTimerRunning;
  5502. }
  5503.  
  5504. timer function PotionDoubleTap(dt : float, id : int)
  5505. {
  5506. potionDoubleTapTimerRunning = false;
  5507. OnPotionDrinkInput(potionDoubleTapSlotIsUpper);
  5508. }
  5509.  
  5510. public final function OnPotionDrinkInput(fromUpperSlot : bool)
  5511. {
  5512. var slot : EEquipmentSlots;
  5513.  
  5514. if(fromUpperSlot)
  5515. slot = GetSelectedPotionSlotUpper();
  5516. else
  5517. slot = GetSelectedPotionSlotLower();
  5518.  
  5519. DrinkPotionFromSlot(slot);
  5520. }
  5521.  
  5522. public final function OnPotionDrinkKeyboardsInput(slot : EEquipmentSlots)
  5523. {
  5524. DrinkPotionFromSlot(slot);
  5525. }
  5526.  
  5527. private function DrinkPotionFromSlot(slot : EEquipmentSlots):void
  5528. {
  5529. var item : SItemUniqueId;
  5530. var hud : CR4ScriptedHud;
  5531. var module : CR4HudModuleItemInfo;
  5532.  
  5533. // CA
  5534. if (GetCurrentStateName() == 'Swimming') {
  5535. CAHudNotify(GetLocStringByKeyExt( "menu_cannot_perform_action_here" ));
  5536. return;
  5537. }
  5538. // CA
  5539.  
  5540. GetItemEquippedOnSlot(slot, item);
  5541. //modSigns: disable drinking mid action
  5542. if(IsInCombatAction() && (((int)GetBehaviorVariable('combatActionType')) == CAT_SpecialAttack || ((int)GetBehaviorVariable('combatActionType')) == CAT_CastSign && IsCurrentSignChanneled()))
  5543. {
  5544. DisplayHudMessage(GetLocStringByKeyExt( "menu_cannot_perform_action_now" ));
  5545. }
  5546. //modSigns: handle toxic food and drinks
  5547. else if(!CanUseSkill(S_Perk_15) && (inv.ItemHasTag(item, 'Alcohol') || inv.ItemHasTag(item, 'Uncooked')) && !ToxicityLowEnoughToDrinkPotion(slot))
  5548. {
  5549. SendToxicityTooHighMessage();
  5550. }
  5551. else if(inv.ItemHasTag(item, 'Edibles'))
  5552. {
  5553. // CA
  5554. if (!CAAllowAnimsInCombat() && thePlayer.IsInCombat()) {
  5555. ConsumeItem(item);
  5556. return;
  5557. }
  5558. completeAnims.SetItemToConsume( item );
  5559. if ( inv.ItemHasTag(item, 'Drinks')) {
  5560. if (CADrinkAnimOn()) {
  5561. completeAnims.DrinkAnim('CAConsume');
  5562. } else {
  5563. ConsumeItem(item);
  5564. }
  5565. } else {
  5566. if (CAEatAnimOn()) {
  5567. completeAnims.EatAnim();
  5568. } else {
  5569. ConsumeItem(item);
  5570. }
  5571. }
  5572. // CA
  5573. }
  5574. else
  5575. {
  5576. if (ToxicityLowEnoughToDrinkPotion(slot))
  5577. {
  5578. // CA
  5579. if (!CAAllowAnimsInCombat() && thePlayer.IsInCombat()) {
  5580. DrinkPreparedPotion(slot);
  5581. return;
  5582. }
  5583.  
  5584. if (CADrinkAnimOn()) {
  5585. completeAnims.SetSlotToConsumeOne( slot );
  5586. completeAnims.DrinkAnim('CADrinkPotion', slot);
  5587. } else {
  5588. DrinkPreparedPotion(slot);
  5589. }
  5590. // CA
  5591. }
  5592. else
  5593. {
  5594. SendToxicityTooHighMessage();
  5595. }
  5596. }
  5597.  
  5598. hud = (CR4ScriptedHud)theGame.GetHud();
  5599. if ( hud )
  5600. {
  5601. module = (CR4HudModuleItemInfo)hud.GetHudModule("ItemInfoModule");
  5602. if( module )
  5603. {
  5604. module.ForceShowElement();
  5605. }
  5606. }
  5607. }
  5608. // CA
  5609. public function SendToxicityTooHighMessage(optional always : bool) // -= WMK:modQuickSlots =-
  5610. {
  5611. var messageText : string;
  5612. var language : string;
  5613. var audioLanguage : string;
  5614.  
  5615. if ((GetHudMessagesSize() < 2) || always) // -= WMK:modQuickSlots =-
  5616. {
  5617. messageText = GetLocStringByKeyExt("menu_cannot_perform_action_now") + " " + GetLocStringByKeyExt("panel_common_statistics_tooltip_current_toxicity");
  5618.  
  5619. theGame.GetGameLanguageName(audioLanguage,language);
  5620. if (language == "AR")
  5621. {
  5622. messageText += (int)(abilityManager.GetStat(BCS_Toxicity, false)) + " / " + (int)(abilityManager.GetStatMax(BCS_Toxicity)) + " :";
  5623. }
  5624. else
  5625. {
  5626. messageText += ": " + (int)(abilityManager.GetStat(BCS_Toxicity, false)) + " / " + (int)(abilityManager.GetStatMax(BCS_Toxicity));
  5627. }
  5628.  
  5629. DisplayHudMessage(messageText);
  5630. }
  5631. theSound.SoundEvent("gui_global_denied");
  5632. }
  5633.  
  5634. public final function GetSelectedPotionSlotUpper() : EEquipmentSlots
  5635. {
  5636. return selectedPotionSlotUpper;
  5637. }
  5638.  
  5639. public final function GetSelectedPotionSlotLower() : EEquipmentSlots
  5640. {
  5641. return selectedPotionSlotLower;
  5642. }
  5643.  
  5644.  
  5645. public final function FlipSelectedPotion(isUpperSlot : bool) : bool
  5646. {
  5647. if(isUpperSlot)
  5648. {
  5649. if(selectedPotionSlotUpper == EES_Potion1 && IsAnyItemEquippedOnSlot(EES_Potion3))
  5650. {
  5651. selectedPotionSlotUpper = EES_Potion3;
  5652. return true;
  5653. }
  5654. else if(selectedPotionSlotUpper == EES_Potion3 && IsAnyItemEquippedOnSlot(EES_Potion1))
  5655. {
  5656. selectedPotionSlotUpper = EES_Potion1;
  5657. return true;
  5658. }
  5659. }
  5660. else
  5661. {
  5662. if(selectedPotionSlotLower == EES_Potion2 && IsAnyItemEquippedOnSlot(EES_Potion4))
  5663. {
  5664. selectedPotionSlotLower = EES_Potion4;
  5665. return true;
  5666. }
  5667. else if(selectedPotionSlotLower == EES_Potion4 && IsAnyItemEquippedOnSlot(EES_Potion2))
  5668. {
  5669. selectedPotionSlotLower = EES_Potion2;
  5670. return true;
  5671. }
  5672. }
  5673.  
  5674. return false;
  5675. }
  5676.  
  5677. public final function AddBombThrowDelay( bombId : SItemUniqueId )
  5678. {
  5679. var slot : EEquipmentSlots;
  5680.  
  5681. slot = GetItemSlot( bombId );
  5682.  
  5683. if( slot == EES_Unused )
  5684. {
  5685. return;
  5686. }
  5687.  
  5688. if( slot == EES_Petard1 || slot == EES_Quickslot1 || slot == EES_Petard3 ) // -= WMK:modQuickSlots =-
  5689. {
  5690. remainingBombThrowDelaySlot1 = theGame.params.BOMB_THROW_DELAY;
  5691. AddTimer( 'BombDelay', 0.0f, true );
  5692. }
  5693. else if( slot == EES_Petard2 || slot == EES_Quickslot2 || slot == EES_Petard4 ) // -= WMK:modQuickSlots =-
  5694. {
  5695. remainingBombThrowDelaySlot2 = theGame.params.BOMB_THROW_DELAY;
  5696. AddTimer( 'BombDelay', 0.0f, true );
  5697. }
  5698. else
  5699. {
  5700. return;
  5701. }
  5702. }
  5703.  
  5704. public final function GetBombDelay( slot : EEquipmentSlots ) : float
  5705. {
  5706. if( slot == EES_Petard1 || slot == EES_Quickslot1 || slot == EES_Petard3 ) // -= WMK:modQuickSlots =-
  5707. {
  5708. return remainingBombThrowDelaySlot1;
  5709. }
  5710. else if( slot == EES_Petard2 || slot == EES_Quickslot2 || slot == EES_Petard4 ) // -= WMK:modQuickSlots =-
  5711. {
  5712. return remainingBombThrowDelaySlot2;
  5713. }
  5714.  
  5715. return 0;
  5716. }
  5717.  
  5718. timer function BombDelay( dt : float, id : int )
  5719. {
  5720. remainingBombThrowDelaySlot1 = MaxF( 0.f , remainingBombThrowDelaySlot1 - dt );
  5721. remainingBombThrowDelaySlot2 = MaxF( 0.f , remainingBombThrowDelaySlot2 - dt );
  5722.  
  5723. if( remainingBombThrowDelaySlot1 <= 0.0f && remainingBombThrowDelaySlot2 <= 0.0f )
  5724. {
  5725. RemoveTimer('BombDelay');
  5726. }
  5727. }
  5728.  
  5729. public function ResetCharacterDev()
  5730. {
  5731. ForceSetStat(BCS_Toxicity, 0); //modSigns: reset toxicity
  5732.  
  5733. UnequipItemFromSlot(EES_SkillMutagen1);
  5734. UnequipItemFromSlot(EES_SkillMutagen2);
  5735. UnequipItemFromSlot(EES_SkillMutagen3);
  5736. UnequipItemFromSlot(EES_SkillMutagen4);
  5737.  
  5738. levelManager.ResetCharacterDev();
  5739. ((W3PlayerAbilityManager)abilityManager).ResetCharacterDev();
  5740. }
  5741.  
  5742. public final function ResetMutationsDev()
  5743. {
  5744. levelManager.ResetMutationsDev();
  5745. ((W3PlayerAbilityManager)abilityManager).ResetMutationsDev();
  5746. }
  5747.  
  5748. public final function GetHeldSword() : SItemUniqueId
  5749. {
  5750. var i : int;
  5751. var weapons : array< SItemUniqueId >;
  5752.  
  5753. weapons = inv.GetHeldWeapons();
  5754. for( i=0; i<weapons.Size(); i+=1 )
  5755. {
  5756. if( inv.IsItemSilverSwordUsableByPlayer( weapons[i] ) || inv.IsItemSteelSwordUsableByPlayer( weapons[i] ) )
  5757. {
  5758. return weapons[i];
  5759. }
  5760. }
  5761.  
  5762. return GetInvalidUniqueId();
  5763. }
  5764.  
  5765. public function ConsumeItem( itemId : SItemUniqueId ) : bool
  5766. {
  5767. var itemName : name;
  5768. var removedItem, willRemoveItem : bool;
  5769. var edibles : array<SItemUniqueId>;
  5770. var toSlot : EEquipmentSlots;
  5771. var i : int;
  5772. var equippedNewEdible : bool;
  5773.  
  5774. itemName = inv.GetItemName( itemId );
  5775.  
  5776. if (itemName == 'q111_imlerith_acorn' )
  5777. {
  5778. AddPoints(ESkillPoint, 2, true);
  5779. removedItem = inv.RemoveItem( itemId, 1 );
  5780. theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt("panel_character_popup_title_buy_skill") + "<br>" + GetLocStringByKeyExt("panel_character_availablepoints") + " +2");
  5781. theSound.SoundEvent("gui_character_buy_skill");
  5782. }
  5783. else if ( itemName == 'Clearing Potion' )
  5784. {
  5785. ResetCharacterDev();
  5786. removedItem = inv.RemoveItem( itemId, 1 );
  5787. theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt("panel_character_popup_character_cleared") );
  5788. theSound.SoundEvent("gui_character_synergy_effect");
  5789. }
  5790. else if ( itemName == 'Restoring Potion' )
  5791. {
  5792. ResetMutationsDev();
  5793. removedItem = inv.RemoveItem( itemId, 1 );
  5794. theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt("panel_character_popup_character_cleared") );
  5795. theSound.SoundEvent("gui_character_synergy_effect");
  5796. }
  5797. else if(itemName == 'Wolf Hour')
  5798. {
  5799. removedItem = inv.RemoveItem( itemId, 1 );
  5800. theSound.SoundEvent("gui_character_synergy_effect");
  5801. AddEffectDefault(EET_WolfHour, thePlayer, 'wolf hour');
  5802. }
  5803. else if ( itemName == 'q704_ft_golden_egg' )
  5804. {
  5805. AddPoints(ESkillPoint, 1, true);
  5806. removedItem = inv.RemoveItem( itemId, 1 );
  5807. theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt("panel_character_popup_title_buy_skill") + "<br>" + GetLocStringByKeyExt("panel_character_availablepoints") + " +1");
  5808. theSound.SoundEvent("gui_character_buy_skill");
  5809. }
  5810. else if ( itemName == 'mq7023_cake' )
  5811. {
  5812. this.AddAbility('mq7023_cake_vitality_bonus');
  5813. removedItem = inv.RemoveItem( itemId, 1 );
  5814. theSound.SoundEvent("gui_character_synergy_effect");
  5815. }
  5816. else
  5817. {
  5818. willRemoveItem = inv.GetItemQuantity(itemId) == 1 && !inv.ItemHasTag(itemId, 'InfiniteUse');
  5819.  
  5820. if(willRemoveItem)
  5821. toSlot = GetItemSlot(itemId);
  5822.  
  5823. removedItem = super.ConsumeItem(itemId);
  5824.  
  5825. if(willRemoveItem && removedItem)
  5826. {
  5827. edibles = inv.GetItemsByTag('Edibles');
  5828. equippedNewEdible = false;
  5829.  
  5830.  
  5831. for(i=0; i<edibles.Size(); i+=1)
  5832. {
  5833. if(!IsItemEquipped(edibles[i]) && !inv.ItemHasTag(edibles[i], 'Alcohol') && inv.GetItemName(edibles[i]) != 'Clearing Potion' && inv.GetItemName(edibles[i]) != 'Wolf Hour')
  5834. {
  5835. EquipItemInGivenSlot(edibles[i], toSlot, true, false);
  5836. equippedNewEdible = true;
  5837. break;
  5838. }
  5839. }
  5840.  
  5841.  
  5842. if(!equippedNewEdible)
  5843. {
  5844. for(i=0; i<edibles.Size(); i+=1)
  5845. {
  5846. if(!IsItemEquipped(edibles[i]) && inv.GetItemName(edibles[i]) != 'Clearing Potion' && inv.GetItemName(edibles[i]) != 'Wolf Hour')
  5847. {
  5848. EquipItemInGivenSlot(edibles[i], toSlot, true, false);
  5849. break;
  5850. }
  5851. }
  5852. }
  5853. }
  5854. }
  5855.  
  5856. return removedItem;
  5857. }
  5858.  
  5859.  
  5860. public final function GetAlcoholForAlchemicalItemsRefill() : SItemUniqueId
  5861. {
  5862. var alcos : array<SItemUniqueId>;
  5863. var id : SItemUniqueId;
  5864. var i, price, minPrice : int;
  5865.  
  5866. alcos = inv.GetItemsByTag(theGame.params.TAG_ALCHEMY_REFILL_ALCO);
  5867.  
  5868. if(alcos.Size() > 0)
  5869. {
  5870. if(inv.ItemHasTag(alcos[0], theGame.params.TAG_INFINITE_USE))
  5871. return alcos[0];
  5872.  
  5873. minPrice = inv.GetItemPrice(alcos[0]);
  5874. price = minPrice;
  5875. id = alcos[0];
  5876.  
  5877. for(i=1; i<alcos.Size(); i+=1)
  5878. {
  5879. if(inv.ItemHasTag(alcos[i], theGame.params.TAG_INFINITE_USE))
  5880. return alcos[i];
  5881.  
  5882. price = inv.GetItemPrice(alcos[i]);
  5883.  
  5884. if(price < minPrice)
  5885. {
  5886. minPrice = price;
  5887. id = alcos[i];
  5888. }
  5889. }
  5890.  
  5891. return id;
  5892. }
  5893.  
  5894. return GetInvalidUniqueId();
  5895. }
  5896.  
  5897. public final function ClearPreviouslyUsedBolt()
  5898. {
  5899. previouslyUsedBolt = GetInvalidUniqueId();
  5900. }
  5901.  
  5902. public function ShouldUseInfiniteWaterBolts() : bool
  5903. {
  5904. return GetCurrentStateName() == 'Swimming' || IsSwimming() || IsDiving();
  5905. }
  5906.  
  5907. public function GetCurrentInfiniteBoltName( optional forceBodkin : bool, optional forceHarpoon : bool ) : name
  5908. {
  5909. if(!forceBodkin && (forceHarpoon || ShouldUseInfiniteWaterBolts()) )
  5910. {
  5911. return 'Harpoon Bolt';
  5912. }
  5913. return 'Bodkin Bolt';
  5914. }
  5915.  
  5916.  
  5917. public final function AddAndEquipInfiniteBolt(optional forceBodkin : bool, optional forceHarpoon : bool)
  5918. {
  5919. var bolt, bodkins, harpoons : array<SItemUniqueId>;
  5920. var boltItemName : name;
  5921. var i : int;
  5922.  
  5923.  
  5924. bodkins = inv.GetItemsByName('Bodkin Bolt');
  5925. harpoons = inv.GetItemsByName('Harpoon Bolt');
  5926.  
  5927. for(i=bodkins.Size()-1; i>=0; i-=1)
  5928. inv.RemoveItem(bodkins[i], inv.GetItemQuantity(bodkins[i]) );
  5929.  
  5930. for(i=harpoons.Size()-1; i>=0; i-=1)
  5931. inv.RemoveItem(harpoons[i], inv.GetItemQuantity(harpoons[i]) );
  5932.  
  5933.  
  5934.  
  5935. boltItemName = GetCurrentInfiniteBoltName( forceBodkin, forceHarpoon );
  5936.  
  5937.  
  5938. if(boltItemName == 'Bodkin Bolt' && inv.IsIdValid(previouslyUsedBolt))
  5939. {
  5940. bolt.PushBack(previouslyUsedBolt);
  5941. }
  5942. else
  5943. {
  5944.  
  5945. bolt = inv.AddAnItem(boltItemName, 1, true, true);
  5946.  
  5947.  
  5948. if(boltItemName == 'Harpoon Bolt')
  5949. {
  5950. GetItemEquippedOnSlot(EES_Bolt, previouslyUsedBolt);
  5951. }
  5952. }
  5953.  
  5954. EquipItem(bolt[0], EES_Bolt);
  5955.  
  5956. }
  5957.  
  5958.  
  5959. event OnItemGiven(data : SItemChangedData)
  5960. {
  5961. var m_guiManager : CR4GuiManager;
  5962.  
  5963. super.OnItemGiven(data);
  5964.  
  5965.  
  5966. if(!inv)
  5967. inv = GetInventory();
  5968.  
  5969.  
  5970. if(inv.IsItemEncumbranceItem(data.ids[0]))
  5971. UpdateEncumbrance();
  5972.  
  5973. m_guiManager = theGame.GetGuiManager();
  5974. if(m_guiManager)
  5975. m_guiManager.RegisterNewItem(data.ids[0]);
  5976.  
  5977. // -= WMK:modQuickSlots =-
  5978. if (WmkGetQuickInventoryInstance()) {
  5979. WmkGetQuickInventoryInstance().RegisterNewItem(data.ids[0]);
  5980. }
  5981. // -= WMK:modQuickSlots =-
  5982. }
  5983.  
  5984.  
  5985. public final function CheckForFullyArmedAchievement()
  5986. {
  5987. if( HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_BEAR) || HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_GRYPHON) ||
  5988. HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_LYNX) || HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_WOLF) ||
  5989. /* modSigns */
  5990. /*HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_VIPER)*/
  5991. HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_BEAR_MINOR) || HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_GRYPHON_MINOR) ||
  5992. HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_LYNX_MINOR) || HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_WOLF_MINOR)
  5993. )
  5994. {
  5995. theGame.GetGamerProfile().AddAchievement(EA_FullyArmed);
  5996. }
  5997. }
  5998.  
  5999.  
  6000. public final function HasAllItemsFromSet(setItemTag : name) : bool
  6001. {
  6002. var item : SItemUniqueId;
  6003.  
  6004. if(!GetItemEquippedOnSlot(EES_SteelSword, item) || !inv.ItemHasTag(item, setItemTag))
  6005. return false;
  6006.  
  6007. if(!GetItemEquippedOnSlot(EES_SilverSword, item) || !inv.ItemHasTag(item, setItemTag))
  6008. return false;
  6009.  
  6010. if(!GetItemEquippedOnSlot(EES_Boots, item) || !inv.ItemHasTag(item, setItemTag))
  6011. return false;
  6012.  
  6013. if(!GetItemEquippedOnSlot(EES_Pants, item) || !inv.ItemHasTag(item, setItemTag))
  6014. return false;
  6015.  
  6016. if(!GetItemEquippedOnSlot(EES_Gloves, item) || !inv.ItemHasTag(item, setItemTag))
  6017. return false;
  6018.  
  6019. if(!GetItemEquippedOnSlot(EES_Armor, item) || !inv.ItemHasTag(item, setItemTag))
  6020. return false;
  6021.  
  6022.  
  6023. /*if(setItemTag == theGame.params.ITEM_SET_TAG_BEAR || setItemTag == theGame.params.ITEM_SET_TAG_LYNX)
  6024. {
  6025. if(!GetItemEquippedOnSlot(EES_RangedWeapon, item) || !inv.ItemHasTag(item, setItemTag))
  6026. return false;
  6027. }*/ //modSigns: removed due to set changes
  6028.  
  6029. return true;
  6030. }
  6031.  
  6032.  
  6033.  
  6034.  
  6035. public function GetTotalArmor() : SAbilityAttributeValue
  6036. {
  6037. var armor : SAbilityAttributeValue;
  6038. var armorItem : SItemUniqueId;
  6039.  
  6040. armor = super.GetTotalArmor();
  6041.  
  6042. if(GetItemEquippedOnSlot(EES_Armor, armorItem))
  6043. {
  6044.  
  6045. armor -= inv.GetItemAttributeValue(armorItem, theGame.params.ARMOR_VALUE_NAME);
  6046.  
  6047.  
  6048. armor += inv.GetItemArmorTotal(armorItem);
  6049. }
  6050.  
  6051. if(GetItemEquippedOnSlot(EES_Pants, armorItem))
  6052. {
  6053.  
  6054. armor -= inv.GetItemAttributeValue(armorItem, theGame.params.ARMOR_VALUE_NAME);
  6055.  
  6056.  
  6057. armor += inv.GetItemArmorTotal(armorItem);
  6058. }
  6059.  
  6060. if(GetItemEquippedOnSlot(EES_Boots, armorItem))
  6061. {
  6062.  
  6063. armor -= inv.GetItemAttributeValue(armorItem, theGame.params.ARMOR_VALUE_NAME);
  6064.  
  6065.  
  6066. armor += inv.GetItemArmorTotal(armorItem);
  6067. }
  6068.  
  6069. if(GetItemEquippedOnSlot(EES_Gloves, armorItem))
  6070. {
  6071.  
  6072. armor -= inv.GetItemAttributeValue(armorItem, theGame.params.ARMOR_VALUE_NAME);
  6073.  
  6074.  
  6075. armor += inv.GetItemArmorTotal(armorItem);
  6076. }
  6077.  
  6078. return armor;
  6079. }
  6080.  
  6081.  
  6082.  
  6083. public function ReduceArmorDurability() : EEquipmentSlots
  6084. {
  6085. var r, sum : int;
  6086. var slot : EEquipmentSlots;
  6087. var id : SItemUniqueId;
  6088. var prevDurMult, currDurMult, ratio : float;
  6089.  
  6090.  
  6091. sum = theGame.params.DURABILITY_ARMOR_CHEST_WEIGHT;
  6092. sum += theGame.params.DURABILITY_ARMOR_PANTS_WEIGHT;
  6093. sum += theGame.params.DURABILITY_ARMOR_GLOVES_WEIGHT;
  6094. sum += theGame.params.DURABILITY_ARMOR_BOOTS_WEIGHT;
  6095. sum += theGame.params.DURABILITY_ARMOR_MISS_WEIGHT;
  6096.  
  6097. r = RandRange(sum);
  6098.  
  6099. if(r < theGame.params.DURABILITY_ARMOR_CHEST_WEIGHT)
  6100. slot = EES_Armor;
  6101. else if (r < theGame.params.DURABILITY_ARMOR_CHEST_WEIGHT + theGame.params.DURABILITY_ARMOR_PANTS_WEIGHT)
  6102. slot = EES_Pants;
  6103. else if (r < theGame.params.DURABILITY_ARMOR_CHEST_WEIGHT + theGame.params.DURABILITY_ARMOR_PANTS_WEIGHT + theGame.params.DURABILITY_ARMOR_GLOVES_WEIGHT)
  6104. slot = EES_Gloves;
  6105. 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)
  6106. slot = EES_Boots;
  6107. else
  6108. return EES_InvalidSlot;
  6109.  
  6110. GetItemEquippedOnSlot(slot, id);
  6111. ratio = inv.GetItemDurabilityRatio(id);
  6112. if(inv.ReduceItemDurability(id))
  6113. {
  6114. prevDurMult = theGame.params.GetDurabilityMultiplier(ratio, false);
  6115.  
  6116. ratio = inv.GetItemDurabilityRatio(id);
  6117. currDurMult = theGame.params.GetDurabilityMultiplier(ratio, false);
  6118.  
  6119. if(currDurMult != prevDurMult)
  6120. {
  6121.  
  6122.  
  6123.  
  6124.  
  6125. }
  6126.  
  6127. return slot;
  6128. }
  6129.  
  6130. return EES_InvalidSlot;
  6131. }
  6132.  
  6133.  
  6134. public function DismantleItem(dismantledItem : SItemUniqueId, toolItem : SItemUniqueId) : bool
  6135. {
  6136. var parts : array<SItemParts>;
  6137. var i : int;
  6138.  
  6139. if(!inv.IsItemDismantleKit(toolItem))
  6140. return false;
  6141.  
  6142. parts = inv.GetItemRecyclingParts(dismantledItem);
  6143.  
  6144. if(parts.Size() <= 0)
  6145. return false;
  6146.  
  6147. for(i=0; i<parts.Size(); i+=1)
  6148. inv.AddAnItem(parts[i].itemName, parts[i].quantity, true, false);
  6149.  
  6150. inv.RemoveItem(toolItem);
  6151. inv.RemoveItem(dismantledItem);
  6152. return true;
  6153. }
  6154.  
  6155.  
  6156. public function GetItemEquippedOnSlot(slot : EEquipmentSlots, out item : SItemUniqueId) : bool
  6157. {
  6158. if(slot == EES_InvalidSlot || slot < 0 || slot > EnumGetMax('EEquipmentSlots'))
  6159. return false;
  6160.  
  6161. item = itemSlots[slot];
  6162.  
  6163. return inv.IsIdValid(item);
  6164. }
  6165.  
  6166.  
  6167. public function GetItemSlotByItemName(itemName : name) : EEquipmentSlots
  6168. {
  6169. var ids : array<SItemUniqueId>;
  6170. var i : int;
  6171. var slot : EEquipmentSlots;
  6172.  
  6173. ids = inv.GetItemsByName(itemName);
  6174. for(i=0; i<ids.Size(); i+=1)
  6175. {
  6176. slot = GetItemSlot(ids[i]);
  6177. if(slot != EES_InvalidSlot)
  6178. return slot;
  6179. }
  6180.  
  6181. return EES_InvalidSlot;
  6182. }
  6183.  
  6184.  
  6185. public function GetItemSlot(item : SItemUniqueId) : EEquipmentSlots
  6186. {
  6187. var i : int;
  6188.  
  6189. if(!inv.IsIdValid(item))
  6190. return EES_InvalidSlot;
  6191.  
  6192. for(i=0; i<itemSlots.Size(); i+=1)
  6193. if(itemSlots[i] == item)
  6194. return i;
  6195.  
  6196. return EES_InvalidSlot;
  6197. }
  6198.  
  6199. public function GetEquippedItems() : array<SItemUniqueId>
  6200. {
  6201. return itemSlots;
  6202. }
  6203.  
  6204. public function IsItemEquipped(item : SItemUniqueId) : bool
  6205. {
  6206. if(!inv.IsIdValid(item))
  6207. return false;
  6208.  
  6209. return itemSlots.Contains(item);
  6210. }
  6211.  
  6212. public function IsItemHeld(item : SItemUniqueId) : bool
  6213. {
  6214. if(!inv.IsIdValid(item))
  6215. return false;
  6216.  
  6217. return inv.IsItemHeld(item);
  6218. }
  6219.  
  6220.  
  6221. public function IsAnyItemEquippedOnSlot(slot : EEquipmentSlots) : bool
  6222. {
  6223. if(slot == EES_InvalidSlot || slot < 0 || slot > EnumGetMax('EEquipmentSlots'))
  6224. return false;
  6225.  
  6226. return inv.IsIdValid(itemSlots[slot]);
  6227. }
  6228.  
  6229.  
  6230. public function GetFreeQuickslot() : EEquipmentSlots
  6231. {
  6232. if(!inv.IsIdValid(itemSlots[EES_Quickslot1])) return EES_Quickslot1;
  6233. if(!inv.IsIdValid(itemSlots[EES_Quickslot2])) return EES_Quickslot2;
  6234.  
  6235.  
  6236. return EES_InvalidSlot;
  6237. }
  6238.  
  6239.  
  6240. event OnEquipItemRequested(item : SItemUniqueId, ignoreMount : bool)
  6241. {
  6242. var slot : EEquipmentSlots;
  6243.  
  6244. if(inv.IsIdValid(item))
  6245. {
  6246. slot = inv.GetSlotForItemId(item);
  6247.  
  6248. if (slot != EES_InvalidSlot)
  6249. {
  6250.  
  6251.  
  6252. EquipItemInGivenSlot(item, slot, ignoreMount);
  6253. }
  6254. }
  6255. }
  6256.  
  6257. event OnUnequipItemRequested(item : SItemUniqueId)
  6258. {
  6259. UnequipItem(item);
  6260. }
  6261.  
  6262.  
  6263. public function EquipItem(item : SItemUniqueId, optional slot : EEquipmentSlots, optional toHand : bool) : bool
  6264. {
  6265. if(!inv.IsIdValid(item))
  6266. return false;
  6267.  
  6268. if(slot == EES_InvalidSlot)
  6269. {
  6270. slot = inv.GetSlotForItemId(item);
  6271.  
  6272. if(slot == EES_InvalidSlot)
  6273. return false;
  6274. }
  6275.  
  6276. ForceSoundAppearanceUpdate();
  6277.  
  6278. return EquipItemInGivenSlot(item, slot, false, toHand);
  6279. }
  6280.  
  6281. protected function ShouldMount(slot : EEquipmentSlots, item : SItemUniqueId, category : name):bool
  6282. {
  6283.  
  6284.  
  6285. return !IsSlotPotionMutagen(slot) && category != 'usable' && category != 'potion' && category != 'petard' && !inv.ItemHasTag(item, 'PlayerUnwearable');
  6286. }
  6287.  
  6288. protected function ShouldMountItemWithName( itemName: name ): bool
  6289. {
  6290. var slot : EEquipmentSlots;
  6291. var items : array<SItemUniqueId>;
  6292. var category : name;
  6293. var i : int;
  6294.  
  6295. items = inv.GetItemsByName( itemName );
  6296.  
  6297. category = inv.GetItemCategory( items[0] );
  6298.  
  6299. slot = GetItemSlot( items[0] );
  6300.  
  6301. return ShouldMount( slot, items[0], category );
  6302. }
  6303.  
  6304. public function GetMountableItems( out items : array< SItemUniqueId > )
  6305. {
  6306. var i : int;
  6307. var mountable : bool;
  6308. var mountableItems : array< SItemUniqueId >;
  6309. var slot : EEquipmentSlots;
  6310. var category : name;
  6311. var item: SItemUniqueId;
  6312.  
  6313. for ( i = 0; i < items.Size(); i += 1 )
  6314. {
  6315. item = items[i];
  6316.  
  6317. category = inv.GetItemCategory( item );
  6318.  
  6319. slot = GetItemSlot( item );
  6320.  
  6321. mountable = ShouldMount( slot, item, category );
  6322.  
  6323. if ( mountable )
  6324. {
  6325. mountableItems.PushBack( items[ i ] );
  6326. }
  6327. }
  6328. items = mountableItems;
  6329. }
  6330.  
  6331. public final function AddAndEquipItem( item : name ) : bool
  6332. {
  6333. var ids : array< SItemUniqueId >;
  6334.  
  6335. ids = inv.AddAnItem( item );
  6336. if( inv.IsIdValid( ids[ 0 ] ) )
  6337. {
  6338. return EquipItem( ids[ 0 ] );
  6339. }
  6340.  
  6341. return false;
  6342. }
  6343.  
  6344. public final function AddQuestMarkedSelectedQuickslotItem( sel : SSelectedQuickslotItem )
  6345. {
  6346. questMarkedSelectedQuickslotItems.PushBack( sel );
  6347. }
  6348.  
  6349. public final function GetQuestMarkedSelectedQuickslotItem( sourceName : name ) : SItemUniqueId
  6350. {
  6351. var i : int;
  6352.  
  6353. for( i=0; i<questMarkedSelectedQuickslotItems.Size(); i+=1 )
  6354. {
  6355. if( questMarkedSelectedQuickslotItems[i].sourceName == sourceName )
  6356. {
  6357. return questMarkedSelectedQuickslotItems[i].itemID;
  6358. }
  6359. }
  6360.  
  6361. return GetInvalidUniqueId();
  6362. }
  6363.  
  6364. public final function SwapEquippedItems(slot1 : EEquipmentSlots, slot2 : EEquipmentSlots)
  6365. {
  6366. var temp : SItemUniqueId;
  6367. var pam : W3PlayerAbilityManager;
  6368.  
  6369. temp = itemSlots[slot1];
  6370. itemSlots[slot1] = itemSlots[slot2];
  6371. itemSlots[slot2] = temp;
  6372.  
  6373. if(IsSlotSkillMutagen(slot1))
  6374. {
  6375. pam = (W3PlayerAbilityManager)abilityManager;
  6376. if(pam)
  6377. pam.OnSwappedMutagensPost(itemSlots[slot1], itemSlots[slot2]);
  6378. }
  6379. }
  6380.  
  6381. public final function GetSlotForEquippedItem( itemID : SItemUniqueId ) : EEquipmentSlots
  6382. {
  6383. var i : int;
  6384.  
  6385. for( i=0; i<itemSlots.Size(); i+=1 )
  6386. {
  6387. if( itemSlots[i] == itemID )
  6388. {
  6389. return i;
  6390. }
  6391. }
  6392.  
  6393. return EES_InvalidSlot;
  6394. }
  6395.  
  6396. public function EquipItemInGivenSlot(item : SItemUniqueId, slot : EEquipmentSlots, ignoreMounting : bool, optional toHand : bool) : bool
  6397. {
  6398. var i, groupID, quantity : int;
  6399. var fistsID : array<SItemUniqueId>;
  6400. var pam : W3PlayerAbilityManager;
  6401. var isSkillMutagen : bool;
  6402. var armorEntity : CItemEntity;
  6403. var armorMeshComponent : CComponent;
  6404. var armorSoundIdentification : name;
  6405. var category : name;
  6406. var prevSkillColor : ESkillColor;
  6407. var containedAbilities : array<name>;
  6408. var dm : CDefinitionsManagerAccessor;
  6409. var armorType : EArmorType;
  6410. var otherMask, previousItemInSlot : SItemUniqueId;
  6411. var tutStatePot : W3TutorialManagerUIHandlerStatePotions;
  6412. var tutStateFood : W3TutorialManagerUIHandlerStateFood;
  6413. var tutStateSecondPotionEquip : W3TutorialManagerUIHandlerStateSecondPotionEquip;
  6414. var boltItem : SItemUniqueId;
  6415. var aerondight : W3Effect_Aerondight;
  6416. var phantomWeapon : W3Effect_PhantomWeapon; //modSigns
  6417.  
  6418. if(!inv.IsIdValid(item))
  6419. {
  6420. LogAssert(false, "W3PlayerWitcher.EquipItemInGivenSlot: invalid item");
  6421. return false;
  6422. }
  6423. if(slot == EES_InvalidSlot || slot == EES_HorseBlinders || slot == EES_HorseSaddle || slot == EES_HorseBag || slot == EES_HorseTrophy)
  6424. {
  6425. LogAssert(false, "W3PlayerWitcher.EquipItem: Cannot equip item <<" + inv.GetItemName(item) + ">> - provided slot <<" + slot + ">> is invalid");
  6426. return false;
  6427. }
  6428. if(itemSlots[slot] == item)
  6429. {
  6430. return true;
  6431. }
  6432.  
  6433. if(!HasRequiredLevelToEquipItem(item))
  6434. {
  6435.  
  6436. return false;
  6437. }
  6438.  
  6439. //if(inv.ItemHasTag(item, 'PhantomWeapon') && !GetPhantomWeaponMgr())
  6440. //{
  6441. // InitPhantomWeaponMgr();
  6442. //} //modSigns
  6443.  
  6444.  
  6445. if( slot == EES_SilverSword && inv.ItemHasTag( item, 'Aerondight' ) )
  6446. {
  6447. //modSigns: only in combat
  6448. if(IsInCombat())
  6449. {
  6450. AddEffectDefault( EET_Aerondight, this, "Aerondight" );
  6451. aerondight = (W3Effect_Aerondight)GetBuff( EET_Aerondight );
  6452. aerondight.Pause( 'ManageAerondightBuff' );
  6453. }
  6454. }
  6455.  
  6456. if( slot == EES_SteelSword && inv.ItemHasTag( item, 'PhantomWeapon' ) ) //modSigns
  6457. {
  6458. if(IsInCombat())
  6459. {
  6460. AddEffectDefault( EET_PhantomWeapon, this, "PhantomWeapon" );
  6461. phantomWeapon = (W3Effect_PhantomWeapon)GetBuff( EET_PhantomWeapon );
  6462. phantomWeapon.Pause( 'ManageIrisBuff' );
  6463. }
  6464. }
  6465.  
  6466.  
  6467. previousItemInSlot = itemSlots[slot];
  6468. if( IsItemEquipped(item))
  6469. {
  6470. SwapEquippedItems(slot, GetItemSlot(item));
  6471. return true;
  6472. }
  6473.  
  6474.  
  6475. isSkillMutagen = IsSlotSkillMutagen(slot);
  6476. if(isSkillMutagen)
  6477. {
  6478. pam = (W3PlayerAbilityManager)abilityManager;
  6479. if(!pam.IsSkillMutagenSlotUnlocked(slot))
  6480. {
  6481. return false;
  6482. }
  6483. }
  6484.  
  6485.  
  6486. if(inv.IsIdValid(previousItemInSlot))
  6487. {
  6488. if(!UnequipItemFromSlot(slot, true))
  6489. {
  6490. LogAssert(false, "W3PlayerWitcher.EquipItem: Cannot equip item <<" + inv.GetItemName(item) + ">> !!");
  6491. return false;
  6492. }
  6493. }
  6494.  
  6495.  
  6496. if(inv.IsItemMask(item))
  6497. {
  6498. if(slot == EES_Quickslot1)
  6499. GetItemEquippedOnSlot(EES_Quickslot2, otherMask);
  6500. else
  6501. GetItemEquippedOnSlot(EES_Quickslot1, otherMask);
  6502.  
  6503. if(inv.IsItemMask(otherMask))
  6504. UnequipItem(otherMask);
  6505. }
  6506.  
  6507. if(isSkillMutagen)
  6508. {
  6509. groupID = pam.GetSkillGroupIdOfMutagenSlot(slot);
  6510. prevSkillColor = pam.GetSkillGroupColor(groupID);
  6511. }
  6512.  
  6513. itemSlots[slot] = item;
  6514.  
  6515. category = inv.GetItemCategory( item );
  6516.  
  6517.  
  6518. if( !ignoreMounting && ShouldMount(slot, item, category) )
  6519. {
  6520.  
  6521. inv.MountItem( item, toHand, IsSlotSkillMutagen( slot ) );
  6522. }
  6523.  
  6524. theTelemetry.LogWithLabelAndValue( TE_INV_ITEM_EQUIPPED, inv.GetItemName(item), slot );
  6525.  
  6526. if(slot == EES_RangedWeapon)
  6527. {
  6528. rangedWeapon = ( Crossbow )( inv.GetItemEntityUnsafe(item) );
  6529. if(!rangedWeapon)
  6530. AddTimer('DelayedOnItemMount', 0.1, true);
  6531.  
  6532. if ( IsSwimming() || IsDiving() )
  6533. {
  6534. GetItemEquippedOnSlot(EES_Bolt, boltItem);
  6535.  
  6536. if(inv.IsIdValid(boltItem))
  6537. {
  6538. if ( !inv.ItemHasTag(boltItem, 'UnderwaterAmmo' ))
  6539. {
  6540. AddAndEquipInfiniteBolt(false, true);
  6541. }
  6542. }
  6543. else if(!IsAnyItemEquippedOnSlot(EES_Bolt))
  6544. {
  6545. AddAndEquipInfiniteBolt(false, true);
  6546. }
  6547. }
  6548.  
  6549. else if(!IsAnyItemEquippedOnSlot(EES_Bolt))
  6550. AddAndEquipInfiniteBolt();
  6551. }
  6552. else if(slot == EES_Bolt)
  6553. {
  6554. if(rangedWeapon)
  6555. { if ( !IsSwimming() || !IsDiving() )
  6556. {
  6557. rangedWeapon.OnReplaceAmmo();
  6558. rangedWeapon.OnWeaponReload();
  6559. }
  6560. else
  6561. {
  6562. DisplayHudMessage(GetLocStringByKeyExt( "menu_cannot_perform_action_now" ));
  6563. }
  6564. }
  6565. }
  6566.  
  6567. else if(isSkillMutagen)
  6568. {
  6569. theGame.GetGuiManager().IgnoreNewItemNotifications( true );
  6570.  
  6571.  
  6572. quantity = inv.GetItemQuantity( item );
  6573. if( quantity > 1 )
  6574. {
  6575. inv.SplitItem( item, quantity - 1 );
  6576. }
  6577.  
  6578. pam.OnSkillMutagenEquipped(item, slot, prevSkillColor);
  6579. LogSkillColors("Mutagen <<" + inv.GetItemName(item) + ">> equipped to slot <<" + slot + ">>");
  6580. LogSkillColors("Group bonus color is now <<" + pam.GetSkillGroupColor(groupID) + ">>");
  6581. LogSkillColors("");
  6582.  
  6583. theGame.GetGuiManager().IgnoreNewItemNotifications( false );
  6584. }
  6585. else if(slot == EES_Gloves && HasWeaponDrawn(false))
  6586. {
  6587. //PlayRuneword4FX(PW_Steel);
  6588. //PlayRuneword4FX(PW_Silver);
  6589. //modSigns
  6590. if(HasBuff(EET_Runeword4))
  6591. ((W3Effect_Runeword4)GetBuff(EET_Runeword4)).PlayRuneword4FX();
  6592. }
  6593.  
  6594. else if( ( slot == EES_Petard1 || slot == EES_Petard2 ) && inv.IsItemBomb( GetSelectedItemId() ) )
  6595. {
  6596. SelectQuickslotItem( slot );
  6597. }
  6598.  
  6599.  
  6600. if(inv.ItemHasAbility(item, 'MA_HtH'))
  6601. {
  6602. inv.GetItemContainedAbilities(item, containedAbilities);
  6603. fistsID = inv.GetItemsByName('fists');
  6604. dm = theGame.GetDefinitionsManager();
  6605. for(i=0; i<containedAbilities.Size(); i+=1)
  6606. {
  6607. if(dm.AbilityHasTag(containedAbilities[i], 'MA_HtH'))
  6608. {
  6609. inv.AddItemCraftedAbility(fistsID[0], containedAbilities[i], true);
  6610. }
  6611. }
  6612. }
  6613.  
  6614.  
  6615. if(inv.IsItemAnyArmor(item))
  6616. {
  6617. armorType = inv.GetArmorType(item);
  6618. pam = (W3PlayerAbilityManager)abilityManager;
  6619.  
  6620. pam.ManageSetArmorTypeBonus(); //modSigns
  6621.  
  6622. if(armorType == EAT_Light)
  6623. {
  6624. if(CanUseSkill(S_Perk_05))
  6625. pam.SetPerkArmorBonus(S_Perk_05);
  6626. }
  6627. else if(armorType == EAT_Medium)
  6628. {
  6629. if(CanUseSkill(S_Perk_06))
  6630. pam.SetPerkArmorBonus(S_Perk_06);
  6631. }
  6632. else if(armorType == EAT_Heavy)
  6633. {
  6634. if(CanUseSkill(S_Perk_07))
  6635. pam.SetPerkArmorBonus(S_Perk_07);
  6636. }
  6637. }
  6638.  
  6639.  
  6640. UpdateItemSetBonuses( item, true );
  6641.  
  6642.  
  6643. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_OnItemEquipped );
  6644.  
  6645.  
  6646. if(ShouldProcessTutorial('TutorialPotionCanEquip3'))
  6647. {
  6648. if(IsSlotPotionSlot(slot))
  6649. {
  6650. tutStatePot = (W3TutorialManagerUIHandlerStatePotions)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
  6651. if(tutStatePot)
  6652. {
  6653. tutStatePot.OnPotionEquipped(inv.GetItemName(item));
  6654. }
  6655.  
  6656. tutStateSecondPotionEquip = (W3TutorialManagerUIHandlerStateSecondPotionEquip)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
  6657. if(tutStateSecondPotionEquip)
  6658. {
  6659. tutStateSecondPotionEquip.OnPotionEquipped(inv.GetItemName(item));
  6660. }
  6661.  
  6662. }
  6663. }
  6664.  
  6665. if(ShouldProcessTutorial('TutorialFoodSelectTab'))
  6666. {
  6667. if( IsSlotPotionSlot(slot) && inv.IsItemFood(item))
  6668. {
  6669. tutStateFood = (W3TutorialManagerUIHandlerStateFood)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
  6670. if(tutStateFood)
  6671. {
  6672. tutStateFood.OnFoodEquipped();
  6673. }
  6674. }
  6675. }
  6676.  
  6677.  
  6678. if(inv.IsItemSetItem(item))
  6679. {
  6680. CheckForFullyArmedAchievement();
  6681. }
  6682.  
  6683. return true;
  6684. }
  6685.  
  6686. private function CheckHairItem()
  6687. {
  6688. var ids : array<SItemUniqueId>;
  6689. var i : int;
  6690. var itemName : name;
  6691. var hairApplied : bool;
  6692.  
  6693. ids = inv.GetItemsByCategory('hair');
  6694.  
  6695. for(i=0; i<ids.Size(); i+= 1)
  6696. {
  6697. itemName = inv.GetItemName( ids[i] );
  6698.  
  6699. if( itemName != 'Preview Hair' )
  6700. {
  6701. if( hairApplied == false )
  6702. {
  6703. inv.MountItem( ids[i], false );
  6704. hairApplied = true;
  6705. }
  6706. else
  6707. {
  6708. inv.RemoveItem( ids[i], 1 );
  6709. }
  6710.  
  6711. }
  6712. }
  6713.  
  6714. if( hairApplied == false )
  6715. {
  6716. ids = inv.AddAnItem('Half With Tail Hairstyle', 1, true, false);
  6717. inv.MountItem( ids[0], false );
  6718. }
  6719.  
  6720. }
  6721.  
  6722.  
  6723. timer function DelayedOnItemMount( dt : float, id : int )
  6724. {
  6725. var crossbowID : SItemUniqueId;
  6726. var invent : CInventoryComponent;
  6727.  
  6728. invent = GetInventory();
  6729. if(!invent)
  6730. return;
  6731.  
  6732.  
  6733. GetItemEquippedOnSlot(EES_RangedWeapon, crossbowID);
  6734.  
  6735. if(invent.IsIdValid(crossbowID))
  6736. {
  6737.  
  6738. rangedWeapon = ( Crossbow )(invent.GetItemEntityUnsafe(crossbowID) );
  6739.  
  6740. if(rangedWeapon)
  6741. {
  6742.  
  6743. RemoveTimer('DelayedOnItemMount');
  6744. }
  6745. }
  6746. else
  6747. {
  6748.  
  6749. RemoveTimer('DelayedOnItemMount');
  6750. }
  6751. }
  6752.  
  6753. public function GetHeldItems() : array<SItemUniqueId>
  6754. {
  6755. var items : array<SItemUniqueId>;
  6756. var item : SItemUniqueId;
  6757.  
  6758. if( inv.GetItemEquippedOnSlot(EES_SilverSword, item) && inv.IsItemHeld(item))
  6759. items.PushBack(item);
  6760.  
  6761. if( inv.GetItemEquippedOnSlot(EES_SteelSword, item) && inv.IsItemHeld(item))
  6762. items.PushBack(item);
  6763.  
  6764. if( inv.GetItemEquippedOnSlot(EES_RangedWeapon, item) && inv.IsItemHeld(item))
  6765. items.PushBack(item);
  6766.  
  6767. if( inv.GetItemEquippedOnSlot(EES_Quickslot1, item) && inv.IsItemHeld(item))
  6768. items.PushBack(item);
  6769.  
  6770. if( inv.GetItemEquippedOnSlot(EES_Quickslot2, item) && inv.IsItemHeld(item))
  6771. items.PushBack(item);
  6772.  
  6773. if( inv.GetItemEquippedOnSlot(EES_Petard1, item) && inv.IsItemHeld(item))
  6774. items.PushBack(item);
  6775.  
  6776. if( inv.GetItemEquippedOnSlot(EES_Petard2, item) && inv.IsItemHeld(item))
  6777. items.PushBack(item);
  6778.  
  6779. // -= WMK:modQuickSlots =-
  6780. if (inv.GetItemEquippedOnSlot(EES_Petard3, item) && inv.IsItemHeld(item))
  6781. items.PushBack(item);
  6782. if (inv.GetItemEquippedOnSlot(EES_Petard4, item) && inv.IsItemHeld(item))
  6783. items.PushBack(item);
  6784. // -= WMK:modQuickSlots =-
  6785.  
  6786. return items;
  6787. }
  6788.  
  6789. public function MoveMutagenToSlot( item : SItemUniqueId, slotFrom : EEquipmentSlots, slotTo : EEquipmentSlots )
  6790. {
  6791. var pam : W3PlayerAbilityManager;
  6792. var prevSkillColor : ESkillColor;
  6793. var groupID : int;
  6794.  
  6795. if( IsSlotSkillMutagen( slotTo ) )
  6796. {
  6797. itemSlots[slotFrom] = GetInvalidUniqueId();
  6798.  
  6799.  
  6800. groupID = pam.GetSkillGroupIdOfMutagenSlot(slotFrom);
  6801. prevSkillColor = pam.GetSkillGroupColor(groupID);
  6802. pam = (W3PlayerAbilityManager)abilityManager;
  6803. pam.OnSkillMutagenUnequipped(item, slotFrom, prevSkillColor, true);
  6804.  
  6805.  
  6806.  
  6807. EquipItemInGivenSlot( item, slotTo, false );
  6808. }
  6809. }
  6810.  
  6811.  
  6812. public function UnequipItemFromSlot(slot : EEquipmentSlots, optional reequipped : bool) : bool
  6813. {
  6814. var item, bolts, id : SItemUniqueId;
  6815. var items : array<SItemUniqueId>;
  6816. var retBool : bool;
  6817. var fistsID, bolt : array<SItemUniqueId>;
  6818. var i, groupID : int;
  6819. var pam : W3PlayerAbilityManager;
  6820. var prevSkillColor : ESkillColor;
  6821. var containedAbilities : array<name>;
  6822. var dm : CDefinitionsManagerAccessor;
  6823. var armorType : EArmorType;
  6824. var isSwimming : bool;
  6825. var hud : CR4ScriptedHud;
  6826. var damagedItemModule : CR4HudModuleDamagedItems;
  6827.  
  6828. if(slot == EES_InvalidSlot || slot < 0 || slot > EnumGetMax('EEquipmentSlots') || !inv.IsIdValid(itemSlots[slot]))
  6829. return false;
  6830.  
  6831.  
  6832. if(IsSlotSkillMutagen(slot))
  6833. {
  6834.  
  6835. pam = (W3PlayerAbilityManager)abilityManager;
  6836. groupID = pam.GetSkillGroupIdOfMutagenSlot(slot);
  6837. prevSkillColor = pam.GetSkillGroupColor(groupID);
  6838. }
  6839.  
  6840.  
  6841. if(slot == EES_SilverSword || slot == EES_SteelSword)
  6842. {
  6843. PauseOilBuffs( slot == EES_SteelSword );
  6844. }
  6845.  
  6846. item = itemSlots[slot];
  6847. itemSlots[slot] = GetInvalidUniqueId();
  6848.  
  6849.  
  6850. //if(inv.ItemHasTag( item, 'PhantomWeapon' ) && GetPhantomWeaponMgr())
  6851. //{
  6852. // DestroyPhantomWeaponMgr();
  6853. //} //modSigns
  6854.  
  6855.  
  6856.  
  6857.  
  6858. if( slot == EES_SilverSword && inv.ItemHasTag( item, 'Aerondight' ) )
  6859. {
  6860. RemoveBuff( EET_Aerondight );
  6861. }
  6862.  
  6863. if( slot == EES_SteelSword && inv.ItemHasTag( item, 'PhantomWeapon' ) ) //modSigns
  6864. {
  6865. RemoveBuff( EET_PhantomWeapon );
  6866. }
  6867.  
  6868.  
  6869. if(slot == EES_RangedWeapon)
  6870. {
  6871.  
  6872. this.OnRangedForceHolster( true, true );
  6873. rangedWeapon.ClearDeployedEntity(true);
  6874. rangedWeapon = NULL;
  6875.  
  6876.  
  6877. if(GetItemEquippedOnSlot(EES_Bolt, bolts))
  6878. {
  6879. if(inv.ItemHasTag(bolts, theGame.params.TAG_INFINITE_AMMO))
  6880. {
  6881. inv.RemoveItem(bolts, inv.GetItemQuantity(bolts) );
  6882. }
  6883. }
  6884. }
  6885. else if(IsSlotSkillMutagen(slot))
  6886. {
  6887. pam.OnSkillMutagenUnequipped(item, slot, prevSkillColor);
  6888. LogSkillColors("Mutagen <<" + inv.GetItemName(item) + ">> unequipped from slot <<" + slot + ">>");
  6889. LogSkillColors("Group bonus color is now <<" + pam.GetSkillGroupColor(groupID) + ">>");
  6890. LogSkillColors("");
  6891. }
  6892.  
  6893.  
  6894. if(currentlyEquipedItem == item)
  6895. {
  6896. currentlyEquipedItem = GetInvalidUniqueId();
  6897. RaiseEvent('ForcedUsableItemUnequip');
  6898. }
  6899. if(currentlyEquipedItemL == item)
  6900. {
  6901. if ( currentlyUsedItemL )
  6902. {
  6903. currentlyUsedItemL.OnHidden( this );
  6904. }
  6905. HideUsableItem ( true );
  6906. }
  6907.  
  6908.  
  6909. if( !IsSlotPotionMutagen(slot) )
  6910. {
  6911. GetInventory().UnmountItem(item, true);
  6912. }
  6913.  
  6914. retBool = true;
  6915.  
  6916.  
  6917. if(IsAnyItemEquippedOnSlot(EES_RangedWeapon) && slot == EES_Bolt)
  6918. {
  6919. if(inv.ItemHasTag(item, theGame.params.TAG_INFINITE_AMMO))
  6920. {
  6921.  
  6922. inv.RemoveItem(item, inv.GetItemQuantityByName( inv.GetItemName(item) ) );
  6923. }
  6924. else if (!reequipped)
  6925. {
  6926.  
  6927. AddAndEquipInfiniteBolt();
  6928. }
  6929. }
  6930.  
  6931.  
  6932. if(slot == EES_SilverSword || slot == EES_SteelSword)
  6933. {
  6934. OnEquipMeleeWeapon(PW_None, true);
  6935. }
  6936.  
  6937. if( GetSelectedItemId() == item )
  6938. {
  6939. ClearSelectedItemId();
  6940. }
  6941.  
  6942. if(inv.IsItemBody(item))
  6943. {
  6944. retBool = true;
  6945. }
  6946.  
  6947. /*if(retBool && !reequipped)
  6948. {
  6949. theTelemetry.LogWithLabelAndValue( TE_INV_ITEM_UNEQUIPPED, inv.GetItemName(item), slot );
  6950.  
  6951.  
  6952. if(slot == EES_SteelSword && !IsAnyItemEquippedOnSlot(EES_SilverSword))
  6953. {
  6954. RemoveBuff(EET_EnhancedWeapon);
  6955. }
  6956. else if(slot == EES_SilverSword && !IsAnyItemEquippedOnSlot(EES_SteelSword))
  6957. {
  6958. RemoveBuff(EET_EnhancedWeapon);
  6959. }
  6960. else if(inv.IsItemAnyArmor(item))
  6961. {
  6962. if( !IsAnyItemEquippedOnSlot(EES_Armor) && !IsAnyItemEquippedOnSlot(EES_Gloves) && !IsAnyItemEquippedOnSlot(EES_Boots) && !IsAnyItemEquippedOnSlot(EES_Pants))
  6963. RemoveBuff(EET_EnhancedArmor);
  6964. }
  6965. }*/ //modSigns: removed
  6966.  
  6967.  
  6968. if(inv.ItemHasAbility(item, 'MA_HtH'))
  6969. {
  6970. inv.GetItemContainedAbilities(item, containedAbilities);
  6971. fistsID = inv.GetItemsByName('fists');
  6972. dm = theGame.GetDefinitionsManager();
  6973. for(i=0; i<containedAbilities.Size(); i+=1)
  6974. {
  6975. if(dm.AbilityHasTag(containedAbilities[i], 'MA_HtH'))
  6976. {
  6977. inv.RemoveItemCraftedAbility(fistsID[0], containedAbilities[i]);
  6978. }
  6979. }
  6980. }
  6981.  
  6982.  
  6983. if(inv.IsItemAnyArmor(item))
  6984. {
  6985. armorType = inv.GetArmorType(item);
  6986. pam = (W3PlayerAbilityManager)abilityManager;
  6987.  
  6988. pam.ManageSetArmorTypeBonus(); //modSigns
  6989.  
  6990. if(CanUseSkill(S_Perk_05) && (armorType == EAT_Light /*|| GetCharacterStats().HasAbility('Glyphword 2 _Stats', true) || inv.ItemHasAbility(item, 'Glyphword 2 _Stats')*/))
  6991. {
  6992. pam.SetPerkArmorBonus(S_Perk_05);
  6993. }
  6994. if(CanUseSkill(S_Perk_06) && (armorType == EAT_Medium /*|| GetCharacterStats().HasAbility('Glyphword 3 _Stats', true) || inv.ItemHasAbility(item, 'Glyphword 3 _Stats')*/))
  6995. {
  6996. pam.SetPerkArmorBonus(S_Perk_06);
  6997. }
  6998. if(CanUseSkill(S_Perk_07) && (armorType == EAT_Heavy /*|| GetCharacterStats().HasAbility('Glyphword 4 _Stats', true) || inv.ItemHasAbility(item, 'Glyphword 4 _Stats')*/))
  6999. {
  7000. pam.SetPerkArmorBonus(S_Perk_07);
  7001. }
  7002. }
  7003.  
  7004.  
  7005. UpdateItemSetBonuses( item, false );
  7006.  
  7007.  
  7008. if( inv.ItemHasTag( item, theGame.params.ITEM_SET_TAG_BONUS ) && !IsSetBonusActive( EISB_RedWolf_2 ) )
  7009. {
  7010. SkillReduceBombAmmoBonus();
  7011. }
  7012.  
  7013. if( slot == EES_Gloves )
  7014. {
  7015. thePlayer.DestroyEffect('runeword_4');
  7016. }
  7017.  
  7018.  
  7019. hud = (CR4ScriptedHud)theGame.GetHud();
  7020. if ( hud )
  7021. {
  7022. damagedItemModule = hud.GetDamagedItemModule();
  7023. if ( damagedItemModule )
  7024. {
  7025. damagedItemModule.OnItemUnequippedFromSlot( slot );
  7026. }
  7027. }
  7028.  
  7029.  
  7030. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_OnItemEquipped );
  7031.  
  7032. return retBool;
  7033. }
  7034.  
  7035. public function UnequipItem(item : SItemUniqueId) : bool
  7036. {
  7037. if(!inv.IsIdValid(item))
  7038. return false;
  7039.  
  7040. return UnequipItemFromSlot( itemSlots.FindFirst(item) );
  7041. }
  7042.  
  7043. public function DropItem( item : SItemUniqueId, quantity : int ) : bool
  7044. {
  7045. if(!inv.IsIdValid(item))
  7046. return false;
  7047. if(IsItemEquipped(item))
  7048. return UnequipItem(item);
  7049.  
  7050. return true;
  7051. }
  7052.  
  7053.  
  7054. public function IsItemEquippedByName(itemName : name) : bool
  7055. {
  7056. var i : int;
  7057.  
  7058. for(i=0; i<itemSlots.Size(); i+=1)
  7059. if(inv.GetItemName(itemSlots[i]) == itemName)
  7060. return true;
  7061.  
  7062. return false;
  7063. }
  7064.  
  7065.  
  7066. public function IsItemEquippedByCategoryName(categoryName : name) : bool
  7067. {
  7068. var i : int;
  7069.  
  7070. for(i=0; i<itemSlots.Size(); i+=1)
  7071. if(inv.GetItemCategory(itemSlots[i]) == categoryName)
  7072. return true;
  7073.  
  7074. return false;
  7075. }
  7076.  
  7077. //modFriendlyStash begin
  7078. //Not actually used by Preparations (allowStash == false), but needed for modFriendlyStash compatibility
  7079. //Used by modFriendlyStash to allow using stash items for crafting and alchemy
  7080. public function GetItemQuantityByNameForCrafting(itemName : name, allowStash : bool) : int
  7081. {
  7082. if( allowStash )
  7083. {
  7084. return inv.GetItemQuantityByName(itemName) + GetHorseManager().GetInventoryComponent().GetItemQuantityByName(itemName);
  7085. }
  7086. return inv.GetItemQuantityByName(itemName);
  7087. }
  7088.  
  7089. public function GetMutagenQuantityByNameForCrafting(itemName : name, allowStash : bool) : int
  7090. {
  7091. if( allowStash )
  7092. {
  7093. return inv.GetUnusedMutagensCount(itemName) + GetHorseManager().GetInventoryComponent().GetItemQuantityByName(itemName);
  7094. }
  7095. return inv.GetUnusedMutagensCount(itemName);
  7096. }
  7097.  
  7098. public function RemoveItemByNameForCrafting(itemName : name, quantity : int, allowStash : bool) : bool
  7099. {
  7100. var playerQuantity, horseQuantity, quantityToRemove, removedQuantity : int;
  7101. if( allowStash )
  7102. {
  7103. quantityToRemove = quantity;
  7104. playerQuantity = inv.GetItemQuantityByName(itemName);
  7105. if( playerQuantity < quantityToRemove )
  7106. {
  7107. quantityToRemove = playerQuantity;
  7108. }
  7109. if( quantityToRemove > 0 && inv.RemoveItemByName(itemName, quantityToRemove) )
  7110. {
  7111. removedQuantity = quantityToRemove;
  7112. }
  7113. quantityToRemove = quantity - removedQuantity;
  7114. if( quantityToRemove > 0 )
  7115. {
  7116. horseQuantity = GetHorseManager().GetInventoryComponent().GetItemQuantityByName(itemName);
  7117. if( horseQuantity < quantityToRemove )
  7118. {
  7119. quantityToRemove = horseQuantity;
  7120. }
  7121. if( quantityToRemove > 0 && GetHorseManager().GetInventoryComponent().RemoveItemByName(itemName, quantityToRemove) )
  7122. {
  7123. removedQuantity += quantityToRemove;
  7124. }
  7125. }
  7126. if( removedQuantity == quantity )
  7127. {
  7128. return true;
  7129. }
  7130. return false;
  7131. }
  7132. return inv.RemoveItemByName(itemName, quantity);
  7133. }
  7134.  
  7135. public function RemoveMutagenByNameForCrafting(itemName : name, quantity : int, allowStash : bool) : bool
  7136. {
  7137. var playerQuantity, horseQuantity, quantityToRemove, removedQuantity : int;
  7138. if( allowStash )
  7139. {
  7140. quantityToRemove = quantity;
  7141. playerQuantity = inv.GetUnusedMutagensCount(itemName);
  7142. if( playerQuantity < quantityToRemove )
  7143. {
  7144. quantityToRemove = playerQuantity;
  7145. }
  7146. if( quantityToRemove > 0 && inv.RemoveUnusedMutagensCount(itemName, quantityToRemove) )
  7147. {
  7148. removedQuantity = quantityToRemove;
  7149. }
  7150. quantityToRemove = quantity - removedQuantity;
  7151. if( quantityToRemove > 0 )
  7152. {
  7153. horseQuantity = GetHorseManager().GetInventoryComponent().GetItemQuantityByName(itemName);
  7154. if( horseQuantity < quantityToRemove )
  7155. {
  7156. quantityToRemove = horseQuantity;
  7157. }
  7158. if( quantityToRemove > 0 && GetHorseManager().GetInventoryComponent().RemoveItemByName(itemName, quantityToRemove) )
  7159. {
  7160. removedQuantity += quantityToRemove;
  7161. }
  7162. }
  7163. if( removedQuantity == quantity )
  7164. {
  7165. return true;
  7166. }
  7167. return false;
  7168. }
  7169. return inv.RemoveUnusedMutagensCount(itemName, quantity);
  7170. }
  7171. //modFriendlyStash end
  7172.  
  7173. public function GetMaxRunEncumbrance(out usesHorseBonus : bool) : float
  7174. {
  7175. var value : float;
  7176.  
  7177. //modFriendlyStash begin
  7178. if( fStashConfig.bagsRoach == false )
  7179. value = GetHorseManager().GetMaxEncumbrance();
  7180. usesHorseBonus = (value > 0);
  7181. value += CalculateAttributeValue( GetAttributeValue('encumbrance') - GetAbilityAttributeValue('ConGeralt', 'encumbrance') );
  7182. value += fStashConfig.baseWeightGeralt;
  7183. //modFriendlyStash end
  7184.  
  7185. return value;
  7186. }
  7187.  
  7188. public function GetEncumbrance() : float
  7189. {
  7190. var i: int;
  7191. var encumbrance : float;
  7192. var items : array<SItemUniqueId>;
  7193. var inve : CInventoryComponent;
  7194.  
  7195. inve = GetInventory();
  7196. inve.GetAllItems(items);
  7197.  
  7198. for(i=0; i<items.Size(); i+=1)
  7199. {
  7200. encumbrance += inve.GetItemEncumbrance( items[i] );
  7201.  
  7202.  
  7203.  
  7204. }
  7205. return encumbrance;
  7206. }
  7207.  
  7208.  
  7209.  
  7210. public function StartInvUpdateTransaction():void
  7211. {
  7212. invUpdateTransaction = true;
  7213. }
  7214.  
  7215. public function FinishInvUpdateTransaction():void
  7216. {
  7217. invUpdateTransaction = false;
  7218.  
  7219.  
  7220.  
  7221. UpdateEncumbrance();
  7222. }
  7223.  
  7224.  
  7225. public function UpdateEncumbrance()
  7226. {
  7227. var temp : bool;
  7228.  
  7229. if (invUpdateTransaction)
  7230. {
  7231.  
  7232. return;
  7233. }
  7234.  
  7235.  
  7236.  
  7237. if ( GetEncumbrance() >= (GetMaxRunEncumbrance(temp) + 1) )
  7238. {
  7239. if( !HasBuff(EET_OverEncumbered) && FactsQuerySum( "DEBUG_EncumbranceBoy" ) == 0 )
  7240. {
  7241. AddEffectDefault(EET_OverEncumbered, NULL, "OverEncumbered");
  7242. }
  7243. }
  7244. else if(HasBuff(EET_OverEncumbered))
  7245. {
  7246. RemoveAllBuffsOfType(EET_OverEncumbered);
  7247. }
  7248.  
  7249. GetWitcherPlayer().GetHorseManager().UpdateHorseEncumbrance(); //modFriendlyStash
  7250. }
  7251.  
  7252. public final function GetSkillGroupIDFromIndex(idx : int) : int
  7253. {
  7254. var pam : W3PlayerAbilityManager;
  7255.  
  7256. pam = (W3PlayerAbilityManager)abilityManager;
  7257. if(pam && pam.IsInitialized())
  7258. return pam.GetSkillGroupIDFromIndex(idx);
  7259.  
  7260. return -1;
  7261. }
  7262.  
  7263. public final function GetSkillGroupColor(groupID : int) : ESkillColor
  7264. {
  7265. var pam : W3PlayerAbilityManager;
  7266.  
  7267. pam = (W3PlayerAbilityManager)abilityManager;
  7268. if(pam && pam.IsInitialized())
  7269. return pam.GetSkillGroupColor(groupID);
  7270.  
  7271. return SC_None;
  7272. }
  7273.  
  7274. public final function GetSkillGroupsCount() : int
  7275. {
  7276. var pam : W3PlayerAbilityManager;
  7277.  
  7278. pam = (W3PlayerAbilityManager)abilityManager;
  7279. if(pam && pam.IsInitialized())
  7280. return pam.GetSkillGroupsCount();
  7281.  
  7282. return 0;
  7283. }
  7284.  
  7285.  
  7286.  
  7287.  
  7288.  
  7289.  
  7290.  
  7291.  
  7292. function CycleSelectSign( bIsCyclingLeft : bool ) : ESignType
  7293. {
  7294. var signOrder : array<ESignType>;
  7295. var i : int;
  7296.  
  7297. signOrder.PushBack( ST_Yrden );
  7298. signOrder.PushBack( ST_Quen );
  7299. signOrder.PushBack( ST_Igni );
  7300. signOrder.PushBack( ST_Axii );
  7301. signOrder.PushBack( ST_Aard );
  7302.  
  7303. for( i = 0; i < signOrder.Size(); i += 1 )
  7304. if( signOrder[i] == equippedSign )
  7305. break;
  7306.  
  7307. if(bIsCyclingLeft)
  7308. return signOrder[ (4 + i) % 5 ];
  7309. else
  7310. return signOrder[ (6 + i) % 5 ];
  7311. }
  7312.  
  7313. function ToggleNextSign()
  7314. {
  7315. SetEquippedSign(CycleSelectSign( false ));
  7316. FactsAdd("SignToggled", 1, 1);
  7317. }
  7318.  
  7319. function TogglePreviousSign()
  7320. {
  7321. SetEquippedSign(CycleSelectSign( true ));
  7322. FactsAdd("SignToggled", 1, 1);
  7323. }
  7324.  
  7325. function ProcessSignEvent( eventName : name ) : bool
  7326. {
  7327. if( currentlyCastSign != ST_None && signs[currentlyCastSign].entity)
  7328. {
  7329. return signs[currentlyCastSign].entity.OnProcessSignEvent( eventName );
  7330. }
  7331.  
  7332. return false;
  7333. }
  7334.  
  7335. var findActorTargetTimeStamp : float;
  7336. var pcModeChanneledSignTimeStamp : float;
  7337. event OnProcessCastingOrientation( isContinueCasting : bool )
  7338. {
  7339. var customOrientationTarget : EOrientationTarget;
  7340. var checkHeading : float;
  7341. var rotHeading : float;
  7342. var playerToHeadingDist : float;
  7343. var slideTargetActor : CActor;
  7344. var newLockTarget : CActor;
  7345.  
  7346. var enableNoTargetOrientation : bool;
  7347.  
  7348. var currTime : float;
  7349.  
  7350. enableNoTargetOrientation = true;
  7351. if ( GetDisplayTarget() && this.IsDisplayTargetTargetable() )
  7352. {
  7353. enableNoTargetOrientation = false;
  7354. if ( /*theInput.GetActionValue( 'CastSignHold' ) > 0*/ TestCastSignHold() /* modSigns */ || this.IsCurrentSignChanneled() )
  7355. {
  7356. if ( IsPCModeEnabled() )
  7357. {
  7358. if ( EngineTimeToFloat( theGame.GetEngineTime() ) > pcModeChanneledSignTimeStamp + 1.f )
  7359. enableNoTargetOrientation = true;
  7360. }
  7361. else
  7362. {
  7363. if ( GetCurrentlyCastSign() == ST_Igni || GetCurrentlyCastSign() == ST_Axii )
  7364. {
  7365. slideTargetActor = (CActor)GetDisplayTarget();
  7366. if ( slideTargetActor
  7367. && ( !slideTargetActor.GetGameplayVisibility() || !CanBeTargetedIfSwimming( slideTargetActor ) || !slideTargetActor.IsAlive() ) )
  7368. {
  7369. SetSlideTarget( NULL );
  7370. if ( ProcessLockTarget() )
  7371. slideTargetActor = (CActor)slideTarget;
  7372. }
  7373.  
  7374. if ( !slideTargetActor )
  7375. {
  7376. LockToTarget( false );
  7377. enableNoTargetOrientation = true;
  7378. }
  7379. else if ( IsThreat( slideTargetActor ) || GetCurrentlyCastSign() == ST_Axii )
  7380. LockToTarget( true );
  7381. else
  7382. {
  7383. LockToTarget( false );
  7384. enableNoTargetOrientation = true;
  7385. }
  7386. }
  7387. }
  7388. }
  7389.  
  7390. if ( !enableNoTargetOrientation )
  7391. {
  7392. customOrientationTarget = OT_Actor;
  7393. }
  7394. }
  7395.  
  7396. if ( enableNoTargetOrientation )
  7397. {
  7398. if ( GetPlayerCombatStance() == PCS_AlertNear && /*theInput.GetActionValue( 'CastSignHold' ) > 0*/ TestCastSignHold() /* modSigns */ )
  7399. {
  7400. if ( GetDisplayTarget() && !slideTargetActor )
  7401. {
  7402. currTime = EngineTimeToFloat( theGame.GetEngineTime() );
  7403. if ( currTime > findActorTargetTimeStamp + 1.5f )
  7404. {
  7405. findActorTargetTimeStamp = currTime;
  7406.  
  7407. newLockTarget = GetScreenSpaceLockTarget( GetDisplayTarget(), 180.f, 1.f, 0.f, true );
  7408.  
  7409. if ( newLockTarget && IsThreat( newLockTarget ) && IsCombatMusicEnabled() )
  7410. {
  7411. SetTarget( newLockTarget, true );
  7412. SetMoveTargetChangeAllowed( true );
  7413. SetMoveTarget( newLockTarget );
  7414. SetMoveTargetChangeAllowed( false );
  7415. SetSlideTarget( newLockTarget );
  7416. }
  7417. }
  7418. }
  7419. else
  7420. ProcessLockTarget();
  7421. }
  7422.  
  7423. if ( wasBRAxisPushed )
  7424. customOrientationTarget = OT_CameraOffset;
  7425. else
  7426. {
  7427. if ( !lastAxisInputIsMovement || theInput.LastUsedPCInput() )
  7428. customOrientationTarget = OT_CameraOffset;
  7429. else if ( /*theInput.GetActionValue( 'CastSignHold' ) > 0*/ TestCastSignHold() /* modSigns */ )
  7430. {
  7431. if ( GetOrientationTarget() == OT_CameraOffset )
  7432. customOrientationTarget = OT_CameraOffset;
  7433. else if ( GetPlayerCombatStance() == PCS_AlertNear || GetPlayerCombatStance() == PCS_Guarded )
  7434. customOrientationTarget = OT_CameraOffset;
  7435. else
  7436. customOrientationTarget = OT_Player;
  7437. }
  7438. else
  7439. customOrientationTarget = OT_CustomHeading;
  7440. }
  7441. }
  7442.  
  7443. if ( GetCurrentlyCastSign() == ST_Quen )
  7444. {
  7445. if ( theInput.LastUsedPCInput() )
  7446. {
  7447. customOrientationTarget = OT_Camera;
  7448. }
  7449. else if ( IsCurrentSignChanneled() )
  7450. {
  7451. if ( bLAxisReleased )
  7452. customOrientationTarget = OT_Player;
  7453. else
  7454. customOrientationTarget = OT_Camera;
  7455. }
  7456. else
  7457. customOrientationTarget = OT_Player;
  7458. }
  7459.  
  7460. if ( GetCurrentlyCastSign() == ST_Axii && IsCurrentSignChanneled() )
  7461. {
  7462. if ( slideTarget && (CActor)slideTarget )
  7463. {
  7464. checkHeading = VecHeading( slideTarget.GetWorldPosition() - this.GetWorldPosition() );
  7465. rotHeading = checkHeading;
  7466. playerToHeadingDist = AngleDistance( GetHeading(), checkHeading );
  7467.  
  7468. if ( playerToHeadingDist > 45 )
  7469. SetCustomRotation( 'ChanneledSignAxii', rotHeading, 0.0, 0.5, false );
  7470. else if ( playerToHeadingDist < -45 )
  7471. SetCustomRotation( 'ChanneledSignAxii', rotHeading, 0.0, 0.5, false );
  7472. }
  7473. else
  7474. {
  7475. checkHeading = VecHeading( theCamera.GetCameraDirection() );
  7476. rotHeading = GetHeading();
  7477. playerToHeadingDist = AngleDistance( GetHeading(), checkHeading );
  7478.  
  7479. if ( playerToHeadingDist > 45 )
  7480. SetCustomRotation( 'ChanneledSignAxii', rotHeading - 22.5, 0.0, 0.5, false );
  7481. else if ( playerToHeadingDist < -45 )
  7482. SetCustomRotation( 'ChanneledSignAxii', rotHeading + 22.5, 0.0, 0.5, false );
  7483. }
  7484. }
  7485.  
  7486. if ( IsActorLockedToTarget() )
  7487. customOrientationTarget = OT_Actor;
  7488.  
  7489. AddCustomOrientationTarget( customOrientationTarget, 'Signs' );
  7490.  
  7491. if ( customOrientationTarget == OT_CustomHeading )
  7492. SetOrientationTargetCustomHeading( GetCombatActionHeading(), 'Signs' );
  7493. }
  7494.  
  7495. event OnRaiseSignEvent()
  7496. {
  7497. var newTarget : CActor;
  7498.  
  7499. if ( ( !IsCombatMusicEnabled() && !CanAttackWhenNotInCombat( EBAT_CastSign, false, newTarget ) ) || ( IsOnBoat() && !IsCombatMusicEnabled() ) )
  7500. {
  7501. if ( CastSignFriendly() )
  7502. return true;
  7503. }
  7504. else
  7505. {
  7506. RaiseEvent('CombatActionFriendlyEnd');
  7507. SetBehaviorVariable( 'SignNum', (int)equippedSign );
  7508. SetBehaviorVariable( 'combatActionType', (int)CAT_CastSign );
  7509.  
  7510. if ( IsPCModeEnabled() )
  7511. pcModeChanneledSignTimeStamp = EngineTimeToFloat( theGame.GetEngineTime() );
  7512.  
  7513. if( RaiseForceEvent('CombatAction') )
  7514. {
  7515. OnCombatActionStart();
  7516. findActorTargetTimeStamp = EngineTimeToFloat( theGame.GetEngineTime() );
  7517. theTelemetry.LogWithValueStr(TE_FIGHT_PLAYER_USE_SIGN, SignEnumToString( equippedSign ));
  7518. return true;
  7519. }
  7520. }
  7521.  
  7522. return false;
  7523. }
  7524.  
  7525. function CastSignFriendly() : bool
  7526. {
  7527. var actor : CActor;
  7528.  
  7529. SetBehaviorVariable( 'combatActionTypeForOverlay', (int)CAT_CastSign );
  7530. if ( RaiseCombatActionFriendlyEvent() )
  7531. {
  7532.  
  7533. return true;
  7534. }
  7535.  
  7536. return false;
  7537. }
  7538.  
  7539. function CastSign() : bool
  7540. {
  7541. var equippedSignStr : string;
  7542. var newSignEnt : W3SignEntity;
  7543. var spawnPos : Vector;
  7544. var slotMatrix : Matrix;
  7545. var target : CActor;
  7546. //var mutagen17 : W3Mutagen17_Effect; //modSigns
  7547.  
  7548. if ( IsInAir() )
  7549. {
  7550. return false;
  7551. }
  7552.  
  7553. //AddTemporarySkills(); // moved to sign entity init
  7554.  
  7555. //modSigns: check for mutagen17 activation
  7556. //if(HasBuff(EET_Mutagen17))
  7557. //{
  7558. // mutagen17 = (W3Mutagen17_Effect)GetBuff(EET_Mutagen17);
  7559. // if(mutagen17.IsBoostAvailable())
  7560. // {
  7561. // mutagen17.ActivateBoost();
  7562. // //theGame.witcherLog.AddMessage("mutagen17 boost activated: sign"); //modSigns: debug
  7563. // }
  7564. //}
  7565.  
  7566.  
  7567.  
  7568. if(equippedSign == ST_Aard)
  7569. {
  7570. CalcEntitySlotMatrix('l_weapon', slotMatrix);
  7571. spawnPos = MatrixGetTranslation(slotMatrix);
  7572. }
  7573. else
  7574. {
  7575. spawnPos = GetWorldPosition();
  7576. }
  7577.  
  7578. if( equippedSign == ST_Aard || equippedSign == ST_Igni )
  7579. {
  7580. target = GetTarget();
  7581. if(target)
  7582. target.SignalGameplayEvent( 'DodgeSign' );
  7583. }
  7584.  
  7585. newSignEnt = (W3SignEntity)theGame.CreateEntity( signs[equippedSign].template, spawnPos, GetWorldRotation() );
  7586. return newSignEnt.Init( signOwner, signs[equippedSign].entity );
  7587. }
  7588.  
  7589.  
  7590. private function HAX_SignToThrowItemRestore()
  7591. {
  7592. var action : SInputAction;
  7593.  
  7594. action.value = theInput.GetActionValue('ThrowItemHold');
  7595. action.lastFrameValue = 0;
  7596.  
  7597. if(IsPressed(action) && CanSetupCombatAction_Throw())
  7598. {
  7599. if(inv.IsItemBomb(selectedItemId))
  7600. {
  7601. BombThrowStart();
  7602. }
  7603. else
  7604. {
  7605. UsableItemStart();
  7606. }
  7607.  
  7608. SetThrowHold( true );
  7609. }
  7610. }
  7611.  
  7612. event OnCFMCameraZoomFail(){}
  7613.  
  7614.  
  7615.  
  7616. public final function GetDrunkMutagens( optional sourceName : string ) : array<CBaseGameplayEffect>
  7617. {
  7618. return effectManager.GetDrunkMutagens( sourceName );
  7619. }
  7620.  
  7621. public final function GetPotionBuffs() : array<CBaseGameplayEffect>
  7622. {
  7623. return effectManager.GetPotionBuffs();
  7624. }
  7625.  
  7626. public final function RecalcPotionsDurations()
  7627. {
  7628. var i : int;
  7629. var buffs : array<CBaseGameplayEffect>;
  7630.  
  7631. buffs = GetPotionBuffs();
  7632. for(i=0; i<buffs.Size(); i+=1)
  7633. {
  7634. buffs[i].RecalcPotionDuration();
  7635. }
  7636. }
  7637.  
  7638. public function StartFrenzy()
  7639. {
  7640. //modSigns: reworked
  7641. var dm : CDefinitionsManagerAccessor = theGame.GetDefinitionsManager();
  7642. var min, max : SAbilityAttributeValue;
  7643. var skillAbilityName : name;
  7644. var skillLevel : int;
  7645. var ratio, duration : float;
  7646.  
  7647. isInFrenzy = true;
  7648. skillLevel = GetSkillLevel(S_Alchemy_s16);
  7649. skillAbilityName = SkillEnumToName(S_Alchemy_s16);
  7650. dm.GetAbilityAttributeValue(skillAbilityName, 'slowdown_ratio', min, max);
  7651. ratio = 1.0f - skillLevel * CalculateAttributeValue(min);
  7652. dm.GetAbilityAttributeValue(skillAbilityName, 'slowdown_duration', min, max);
  7653. duration = CalculateAttributeValue(min);
  7654.  
  7655. theGame.SetTimeScale(ratio, theGame.GetTimescaleSource(ETS_SkillFrenzy), theGame.GetTimescalePriority(ETS_SkillFrenzy) );
  7656. AddTimer('SkillFrenzyFinish', duration * ratio, , , , true);
  7657. }
  7658.  
  7659. timer function SkillFrenzyFinish(dt : float, optional id : int)
  7660. {
  7661. theGame.RemoveTimeScale( theGame.GetTimescaleSource(ETS_SkillFrenzy) );
  7662. isInFrenzy = false;
  7663. }
  7664.  
  7665. public function GetToxicityDamageThreshold() : float
  7666. {
  7667. var ret : float;
  7668.  
  7669. ret = theGame.params.TOXICITY_DAMAGE_THRESHOLD;
  7670.  
  7671. //if(CanUseSkill(S_Alchemy_s01)) //modSigns -> skill changed
  7672. // ret += CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s01, 'threshold', false, true)) * GetSkillLevel(S_Alchemy_s01);
  7673.  
  7674. return ret;
  7675. }
  7676.  
  7677. //modSigns
  7678. private var cachedToxDmg : float;
  7679. public function GetToxicityDamage() : float
  7680. {
  7681. var min, max : SAbilityAttributeValue;
  7682. var dmg : float;
  7683.  
  7684. if(cachedToxDmg == 0)
  7685. {
  7686. theGame.GetDefinitionsManager().GetAbilityAttributeValue('ToxicityEffect', 'DirectDamage', min, max);
  7687. cachedToxDmg = min.valueMultiplicative;
  7688. }
  7689. dmg = cachedToxDmg * GetStatMax(BCS_Vitality);
  7690. if(HasBuff(EET_Mutation10))
  7691. dmg *= ((W3Effect_Mutation10)GetBuff(EET_Mutation10)).GetDrainMult();
  7692.  
  7693. return dmg;
  7694. }
  7695.  
  7696.  
  7697.  
  7698. public final function AddToxicityOffset( val : float)
  7699. {
  7700. ((W3PlayerAbilityManager)abilityManager).AddToxicityOffset(val);
  7701. }
  7702.  
  7703. public final function SetToxicityOffset( val : float)
  7704. {
  7705. ((W3PlayerAbilityManager)abilityManager).SetToxicityOffset(val);
  7706. }
  7707.  
  7708. public final function RemoveToxicityOffset( val : float)
  7709. {
  7710. ((W3PlayerAbilityManager)abilityManager).RemoveToxicityOffset(val);
  7711. }
  7712.  
  7713. //modSigns
  7714. public final function RecalcTransmutationAbilities()
  7715. {
  7716. var ablName : name = GetSkillAbilityName(S_Alchemy_s13);
  7717. var offset : float = GetStat(BCS_Toxicity) - GetStat(BCS_Toxicity, true);
  7718. var numAbls : int = GetAbilityCount(ablName);
  7719. var targetNumAbls : int;
  7720.  
  7721. if(!CanUseSkill(S_Alchemy_s13))
  7722. {
  7723. RemoveAbilityAll(ablName);
  7724. return;
  7725. }
  7726.  
  7727. targetNumAbls = RoundMath(offset) * GetSkillLevel(S_Alchemy_s13);
  7728. if(numAbls < targetNumAbls)
  7729. AddAbilityMultiple(ablName, targetNumAbls - numAbls);
  7730. else if(numAbls > targetNumAbls)
  7731. RemoveAbilityMultiple(ablName, numAbls - targetNumAbls);
  7732. }
  7733.  
  7734.  
  7735. public final function CalculatePotionDuration(item : SItemUniqueId, isMutagenPotion : bool, optional itemName : name) : float
  7736. {
  7737. var duration, skillPassiveMod, mutagenSkillMod : float;
  7738. var val, min, max : SAbilityAttributeValue;
  7739.  
  7740.  
  7741. if(inv.IsIdValid(item))
  7742. {
  7743. duration = CalculateAttributeValue(inv.GetItemAttributeValue(item, 'duration'));
  7744. }
  7745. else
  7746. {
  7747. theGame.GetDefinitionsManager().GetItemAttributeValueNoRandom(itemName, true, 'duration', min, max);
  7748. duration = CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  7749. }
  7750.  
  7751. skillPassiveMod = CalculateAttributeValue(GetAttributeValue('potion_duration'));
  7752.  
  7753. if(isMutagenPotion && CanUseSkill(S_Alchemy_s14))
  7754. {
  7755. val = GetSkillAttributeValue(S_Alchemy_s14, 'duration', false, true);
  7756. mutagenSkillMod = val.valueMultiplicative * GetSkillLevel(S_Alchemy_s14);
  7757. }
  7758.  
  7759. //modSigns: don't add passive skill mod to mutagen potions
  7760. //duration = duration * (1 + skillPassiveMod + mutagenSkillMod);
  7761. if(isMutagenPotion)
  7762. duration = duration * (1 + mutagenSkillMod);
  7763. else
  7764. duration = duration * (1 + skillPassiveMod);
  7765.  
  7766. return duration;
  7767. }
  7768.  
  7769. public function ToxicityLowEnoughToDrinkPotion( slotid : EEquipmentSlots, optional itemId : SItemUniqueId ) : bool
  7770. {
  7771. var item : SItemUniqueId;
  7772. var maxTox : float;
  7773. var potionToxicity : float;
  7774. var toxicityOffset : float;
  7775. var effectType : EEffectType;
  7776. var customAbilityName : name;
  7777. var adrenaline : float; //modSigns
  7778. var costReduction : SAbilityAttributeValue; //modSigns
  7779.  
  7780. if(itemId != GetInvalidUniqueId())
  7781. item = itemId;
  7782. else
  7783. item = itemSlots[slotid];
  7784.  
  7785. inv.GetPotionItemBuffData(item, effectType, customAbilityName);
  7786. maxTox = abilityManager.GetStatMax(BCS_Toxicity);
  7787. potionToxicity = CalculateAttributeValue(inv.GetItemAttributeValue(item, 'toxicity'));
  7788. //modSigns begin
  7789. if(CanUseSkill(S_Alchemy_s03))
  7790. {
  7791. potionToxicity -= CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s03, 'toxicityReduction', false, false)) * GetSkillLevel(S_Alchemy_s03);
  7792. }
  7793. //modSigns end
  7794. toxicityOffset = CalculateAttributeValue(inv.GetItemAttributeValue(item, 'toxicity_offset'));
  7795.  
  7796. //modSigns
  7797. if(CanUseSkill(S_Perk_13))
  7798. {
  7799. costReduction = GetSkillAttributeValue(S_Perk_13, 'cost_reduction', false, true);
  7800. adrenaline = FloorF(GetStat(BCS_Focus));
  7801. costReduction = costReduction * adrenaline;
  7802. potionToxicity = (potionToxicity - costReduction.valueBase) * (1 - costReduction.valueMultiplicative) - costReduction.valueAdditive;
  7803. potionToxicity = MaxF(0.f, potionToxicity);
  7804. }
  7805.  
  7806. if(effectType != EET_WhiteHoney)
  7807. {
  7808. if(abilityManager.GetStat(BCS_Toxicity, false) + potionToxicity + toxicityOffset > maxTox )
  7809. {
  7810. return false;
  7811. }
  7812. }
  7813.  
  7814. return true;
  7815. }
  7816.  
  7817. public final function HasFreeToxicityToDrinkPotion( item : SItemUniqueId, effectType : EEffectType, out finalPotionToxicity : float ) : bool
  7818. {
  7819. var i : int;
  7820. var maxTox, toxicityOffset, adrenaline : float;
  7821. var costReduction : SAbilityAttributeValue;
  7822.  
  7823.  
  7824. if( effectType == EET_WhiteHoney )
  7825. {
  7826. return true;
  7827. }
  7828.  
  7829.  
  7830. maxTox = abilityManager.GetStatMax(BCS_Toxicity);
  7831. finalPotionToxicity = CalculateAttributeValue(inv.GetItemAttributeValue(item, 'toxicity'));
  7832. //modSigns begin
  7833. if(CanUseSkill(S_Alchemy_s03))
  7834. {
  7835. finalPotionToxicity -= CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s03, 'toxicityReduction', false, false)) * GetSkillLevel(S_Alchemy_s03);
  7836. }
  7837. //modSigns end
  7838. toxicityOffset = CalculateAttributeValue(inv.GetItemAttributeValue(item, 'toxicity_offset'));
  7839.  
  7840.  
  7841. if(CanUseSkill(S_Perk_13))
  7842. {
  7843. costReduction = GetSkillAttributeValue(S_Perk_13, 'cost_reduction', false, true);
  7844. adrenaline = FloorF(GetStat(BCS_Focus));
  7845. costReduction = costReduction * adrenaline;
  7846. finalPotionToxicity = (finalPotionToxicity - costReduction.valueBase) * (1 - costReduction.valueMultiplicative) - costReduction.valueAdditive;
  7847. finalPotionToxicity = MaxF(0.f, finalPotionToxicity);
  7848. }
  7849.  
  7850.  
  7851. if(abilityManager.GetStat(BCS_Toxicity, false) + finalPotionToxicity + toxicityOffset > maxTox )
  7852. {
  7853. return false;
  7854. }
  7855.  
  7856. return true;
  7857. }
  7858.  
  7859. public function DrinkPreparedPotion( slotid : EEquipmentSlots, optional itemId : SItemUniqueId )
  7860. {
  7861. var potParams : W3PotionParams;
  7862. var potionParams : SCustomEffectParams;
  7863. var factPotionParams : W3Potion_Fact_Params;
  7864. var adrenaline, hpGainValue, staminaGainValue, duration, finalPotionToxicity : float; //modSigns
  7865. var toxicity : float = GetWitcherPlayer().GetStat(BCS_Toxicity, false) / GetWitcherPlayer().GetStatMax(BCS_Toxicity);
  7866. var ret : EEffectInteract;
  7867. var effectType : EEffectType;
  7868. var item : SItemUniqueId;
  7869. var customAbilityName, factId : name;
  7870. var atts : array<name>;
  7871. var i : int;
  7872. var mutagenParams : W3MutagenBuffCustomParams;
  7873.  
  7874.  
  7875. if(itemId != GetInvalidUniqueId())
  7876. item = itemId;
  7877. else
  7878. item = itemSlots[slotid];
  7879.  
  7880.  
  7881. if(!inv.IsIdValid(item))
  7882. return;
  7883.  
  7884.  
  7885. if( inv.SingletonItemGetAmmo(item) == 0 )
  7886. return;
  7887.  
  7888.  
  7889. inv.GetPotionItemBuffData(item, effectType, customAbilityName);
  7890.  
  7891.  
  7892. if( !HasFreeToxicityToDrinkPotion( item, effectType, finalPotionToxicity ) )
  7893. {
  7894. return;
  7895. }
  7896.  
  7897. if(effectType == EET_Fact)
  7898. {
  7899. inv.GetItemAttributes(item, atts);
  7900.  
  7901. for(i=0; i<atts.Size(); i+=1)
  7902. {
  7903. if(StrBeginsWith(NameToString(atts[i]), "fact_"))
  7904. {
  7905. factId = atts[i];
  7906. break;
  7907. }
  7908. }
  7909.  
  7910. factPotionParams = new W3Potion_Fact_Params in theGame;
  7911. factPotionParams.factName = factId;
  7912. factPotionParams.potionItemName = inv.GetItemName(item);
  7913.  
  7914. potionParams.buffSpecificParams = factPotionParams;
  7915. }
  7916.  
  7917. else if(inv.ItemHasTag( item, 'Mutagen' ))
  7918. {
  7919. mutagenParams = new W3MutagenBuffCustomParams in theGame;
  7920. mutagenParams.toxicityOffset = CalculateAttributeValue(inv.GetItemAttributeValue(item, 'toxicity_offset'));
  7921. mutagenParams.potionItemName = inv.GetItemName(item);
  7922.  
  7923. potionParams.buffSpecificParams = mutagenParams;
  7924.  
  7925. //if( IsMutationActive( EPMT_Mutation10 ) && !HasBuff( EET_Mutation10 ) && IsInCombat() ) //modSigns
  7926. //{
  7927. // AddEffectDefault( EET_Mutation10, this, "Mutation 10" );
  7928. //} //modSigns: reworked
  7929. }
  7930.  
  7931. else
  7932. {
  7933. potParams = new W3PotionParams in theGame;
  7934. potParams.potionItemName = inv.GetItemName(item);
  7935.  
  7936. potionParams.buffSpecificParams = potParams;
  7937. }
  7938.  
  7939.  
  7940. duration = CalculatePotionDuration(item, inv.ItemHasTag( item, 'Mutagen' ));
  7941.  
  7942.  
  7943. potionParams.effectType = effectType;
  7944. potionParams.creator = this;
  7945. potionParams.sourceName = "drank_potion";
  7946. potionParams.duration = duration;
  7947. potionParams.customAbilityName = customAbilityName;
  7948. ret = AddEffectCustom(potionParams);
  7949.  
  7950.  
  7951. if(factPotionParams)
  7952. delete factPotionParams;
  7953.  
  7954. if(mutagenParams)
  7955. delete mutagenParams;
  7956.  
  7957.  
  7958. inv.SingletonItemRemoveAmmo(item);
  7959.  
  7960.  
  7961. if(ret == EI_Pass || ret == EI_Override || ret == EI_Cumulate)
  7962. {
  7963. if( finalPotionToxicity > 0.f || toxicity > 0.f )
  7964. {
  7965. abilityManager.GainStat(BCS_Toxicity, finalPotionToxicity );
  7966. }
  7967.  
  7968.  
  7969. if(CanUseSkill(S_Perk_13))
  7970. {
  7971. adrenaline = FloorF(GetStat(BCS_Focus)); //modSigns
  7972. abilityManager.DrainFocus(adrenaline);
  7973. }
  7974.  
  7975. if (!IsEffectActive('invisible'))
  7976. {
  7977. PlayEffect('use_potion');
  7978. }
  7979.  
  7980. if ( inv.ItemHasTag( item, 'Mutagen' ) )
  7981. {
  7982.  
  7983. theGame.GetGamerProfile().CheckTrialOfGrasses();
  7984.  
  7985.  
  7986. SetFailedFundamentalsFirstAchievementCondition(true);
  7987. }
  7988.  
  7989.  
  7990. if(CanUseSkill(S_Alchemy_s01)) //modSigns
  7991. {
  7992. staminaGainValue = ClampF(GetStatMax(BCS_Stamina) * CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s01, 'stamina_gain_perc', false, true)) * GetSkillLevel(S_Alchemy_s01), 0, GetStatMax(BCS_Stamina));
  7993. GainStat(BCS_Stamina, staminaGainValue);
  7994. }
  7995.  
  7996. if(CanUseSkill(S_Alchemy_s02))
  7997. {
  7998. hpGainValue = ClampF(GetStatMax(BCS_Vitality) * CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s02, 'vitality_gain_perc', false, true)) * GetSkillLevel(S_Alchemy_s02), 0, GetStatMax(BCS_Vitality));
  7999. GainStat(BCS_Vitality, hpGainValue);
  8000. }
  8001.  
  8002.  
  8003. /*if(CanUseSkill(S_Alchemy_s04) && !skillBonusPotionEffect && (RandF() < CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s04, 'apply_chance', false, true)) * GetSkillLevel(S_Alchemy_s04)))
  8004. {
  8005. AddRandomPotionEffectFromAlch4Skill( effectType );
  8006. }*/ //modSigns: removed
  8007.  
  8008. theGame.GetGamerProfile().SetStat(ES_ActivePotions, effectManager.GetPotionBuffsCount());
  8009. }
  8010.  
  8011. theTelemetry.LogWithLabel(TE_ELIXIR_USED, inv.GetItemName(item));
  8012.  
  8013. if(ShouldProcessTutorial('TutorialPotionAmmo'))
  8014. {
  8015. FactsAdd("tut_used_potion");
  8016. }
  8017.  
  8018. SetFailedFundamentalsFirstAchievementCondition(true);
  8019. }
  8020.  
  8021.  
  8022. /*private final function AddRandomPotionEffectFromAlch4Skill( currentlyDrankPotion : EEffectType )
  8023. {
  8024. var randomPotions : array<EEffectType>;
  8025. var currentPotion : CBaseGameplayEffect;
  8026. var effectsOld, effectsNew : array<CBaseGameplayEffect>;
  8027. var i, ind : int;
  8028. var duration : float;
  8029. var params : SCustomEffectParams;
  8030. var ret : EEffectInteract;
  8031.  
  8032.  
  8033. randomPotions.PushBack( EET_BlackBlood );
  8034. randomPotions.PushBack( EET_Blizzard );
  8035. randomPotions.PushBack( EET_FullMoon );
  8036. randomPotions.PushBack( EET_GoldenOriole );
  8037. //randomPotions.PushBack( EET_KillerWhale ); //modSigns
  8038. randomPotions.PushBack( EET_MariborForest );
  8039. randomPotions.PushBack( EET_PetriPhiltre );
  8040. randomPotions.PushBack( EET_Swallow );
  8041. randomPotions.PushBack( EET_TawnyOwl );
  8042. randomPotions.PushBack( EET_Thunderbolt );
  8043.  
  8044.  
  8045. randomPotions.Remove( currentlyDrankPotion );
  8046.  
  8047.  
  8048. ind = RandRange( randomPotions.Size() );
  8049.  
  8050.  
  8051. if( HasBuff( randomPotions[ ind ] ) )
  8052. {
  8053. currentPotion = GetBuff( randomPotions[ ind ] );
  8054. currentPotion.SetTimeLeft( currentPotion.GetInitialDurationAfterResists() );
  8055. }
  8056.  
  8057. else
  8058. {
  8059. duration = BonusPotionGetDurationFromXML( randomPotions[ ind ] );
  8060.  
  8061. if(duration > 0)
  8062. {
  8063. effectsOld = GetCurrentEffects();
  8064.  
  8065. params.effectType = randomPotions[ ind ];
  8066. params.creator = this;
  8067. params.sourceName = SkillEnumToName( S_Alchemy_s04 );
  8068. params.duration = duration;
  8069. ret = AddEffectCustom( params );
  8070.  
  8071.  
  8072. if( ret != EI_Undefined && ret != EI_Deny )
  8073. {
  8074. effectsNew = GetCurrentEffects();
  8075.  
  8076. ind = -1;
  8077. for( i=effectsNew.Size()-1; i>=0; i-=1)
  8078. {
  8079. if( !effectsOld.Contains( effectsNew[i] ) )
  8080. {
  8081. ind = i;
  8082. break;
  8083. }
  8084. }
  8085.  
  8086. if(ind > -1)
  8087. {
  8088. skillBonusPotionEffect = effectsNew[ind];
  8089. }
  8090. }
  8091. }
  8092. }
  8093. }*/ //modSigns: removed
  8094.  
  8095.  
  8096. private function BonusPotionGetDurationFromXML(type : EEffectType) : float
  8097. {
  8098. var dm : CDefinitionsManagerAccessor;
  8099. var main, ingredients : SCustomNode;
  8100. var tmpName, typeName, itemName : name;
  8101. var abs : array<name>;
  8102. var min, max : SAbilityAttributeValue;
  8103. var tmpInt : int;
  8104. var temp : array<float>;
  8105. var i, temp2, temp3 : int;
  8106.  
  8107. dm = theGame.GetDefinitionsManager();
  8108. main = dm.GetCustomDefinition('alchemy_recipes');
  8109. typeName = EffectTypeToName(type);
  8110.  
  8111.  
  8112. for(i=0; i<main.subNodes.Size(); i+=1)
  8113. {
  8114. if(dm.GetCustomNodeAttributeValueName(main.subNodes[i], 'type_name', tmpName))
  8115. {
  8116.  
  8117. if(tmpName == typeName)
  8118. {
  8119. if(dm.GetCustomNodeAttributeValueInt(main.subNodes[i], 'level', tmpInt))
  8120. {
  8121.  
  8122. if(tmpInt == 1)
  8123. {
  8124. if(dm.GetCustomNodeAttributeValueName(main.subNodes[i], 'cookedItem_name', itemName))
  8125. {
  8126.  
  8127. if(IsNameValid(itemName))
  8128. {
  8129. break;
  8130. }
  8131. }
  8132. }
  8133. }
  8134. }
  8135. }
  8136. }
  8137.  
  8138. if(!IsNameValid(itemName))
  8139. return 0;
  8140.  
  8141.  
  8142. dm.GetItemAbilitiesWithWeights(itemName, true, abs, temp, temp2, temp3);
  8143. dm.GetAbilitiesAttributeValue(abs, 'duration', min, max);
  8144. return CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  8145. }
  8146.  
  8147. public function ClearSkillBonusPotionEffect()
  8148. {
  8149. skillBonusPotionEffect = NULL;
  8150. }
  8151.  
  8152. public function GetSkillBonusPotionEffect() : CBaseGameplayEffect
  8153. {
  8154. return skillBonusPotionEffect;
  8155. }
  8156.  
  8157.  
  8158.  
  8159.  
  8160.  
  8161.  
  8162.  
  8163. public final function HasRunewordActive(abilityName : name) : bool
  8164. {
  8165. var item : SItemUniqueId;
  8166. var hasRuneword : bool;
  8167.  
  8168. hasRuneword = false;
  8169.  
  8170. if(GetItemEquippedOnSlot(EES_SteelSword, item) && (IsItemHeld(item) || abilityName == 'Runeword 5 _Stats' || abilityName == 'Runeword 6 _Stats')) //modSigns: only drawn sword (or equipped - for runeword 5 and 6)
  8171. {
  8172. hasRuneword = inv.ItemHasAbility(item, abilityName);
  8173. }
  8174.  
  8175. if(!hasRuneword)
  8176. {
  8177. if(GetItemEquippedOnSlot(EES_SilverSword, item) && (IsItemHeld(item) || abilityName == 'Runeword 5 _Stats' || abilityName == 'Runeword 6 _Stats')) //modSigns: only drawn sword (or equipped - for runeword 5 and 6)
  8178. {
  8179. hasRuneword = inv.ItemHasAbility(item, abilityName);
  8180. }
  8181. }
  8182.  
  8183. return hasRuneword;
  8184. }
  8185.  
  8186. public final function HasGlyphwordActive(abilityName : name) : bool //modSigns
  8187. {
  8188. var item : SItemUniqueId;
  8189. var hasGlyphword : bool;
  8190.  
  8191. hasGlyphword = false;
  8192.  
  8193. if(GetItemEquippedOnSlot(EES_Armor, item))
  8194. {
  8195. hasGlyphword = inv.ItemHasAbility(item, abilityName);
  8196. }
  8197.  
  8198. return hasGlyphword;
  8199. }
  8200.  
  8201. public final function GetShrineBuffs() : array<CBaseGameplayEffect>
  8202. {
  8203. var null : array<CBaseGameplayEffect>;
  8204.  
  8205. if(effectManager && effectManager.IsReady())
  8206. return effectManager.GetShrineBuffs();
  8207.  
  8208. return null;
  8209. }
  8210.  
  8211. public final function AddRepairObjectBuff(armor : bool, weapon : bool) : bool
  8212. {
  8213. var added : bool;
  8214. // CA
  8215. var wpn : EPlayerWeapon;
  8216. // CA
  8217.  
  8218. added = false;
  8219.  
  8220. if(weapon /*&& (IsAnyItemEquippedOnSlot(EES_SilverSword) || IsAnyItemEquippedOnSlot(EES_SteelSword))*/ ) //modSigns: restrictions removed
  8221. {
  8222. // CA
  8223. if (CAGrindstoneAnimOn()) {
  8224. completeAnims.GrindstoneAnim();
  8225. } else {
  8226. AddEffectDefault(EET_EnhancedWeapon, this, "repair_object", false);
  8227. DisplayHudMessage(GetLocStringByKeyExt("panel_hud_message_repair_done"));
  8228. SoundEvent("gui_inventory_silversword_attach");
  8229. }
  8230. // CA
  8231. added = true;
  8232. }
  8233.  
  8234. if(armor /*&& (IsAnyItemEquippedOnSlot(EES_Armor) || IsAnyItemEquippedOnSlot(EES_Gloves) || IsAnyItemEquippedOnSlot(EES_Boots) || IsAnyItemEquippedOnSlot(EES_Pants))*/ ) //modSigns: restrictions removed
  8235. {
  8236. // CA
  8237. if (CAWorkbenchAnimOn()) {
  8238. completeAnims.WorkbenchAnim();
  8239. } else {
  8240. AddEffectDefault(EET_EnhancedArmor, this, "repair_object", false);
  8241. DisplayHudMessage(GetLocStringByKeyExt("panel_hud_message_repair_done"));
  8242. SoundEvent("gui_inventory_armor_attach");
  8243. }
  8244. // CA
  8245. added = true;
  8246. }
  8247.  
  8248. return added;
  8249. }
  8250.  
  8251. public function StartCSAnim(buff : CBaseGameplayEffect) : bool
  8252. {
  8253.  
  8254. if(IsAnyQuenActive() && (W3CriticalDOTEffect)buff)
  8255. return false;
  8256.  
  8257. return super.StartCSAnim(buff);
  8258. }
  8259.  
  8260. public function GetPotionBuffLevel(effectType : EEffectType) : int
  8261. {
  8262. if(effectManager && effectManager.IsReady())
  8263. return effectManager.GetPotionBuffLevel(effectType);
  8264.  
  8265. return 0;
  8266. }
  8267.  
  8268.  
  8269.  
  8270.  
  8271.  
  8272.  
  8273.  
  8274. event OnLevelGained(currentLevel : int, show : bool)
  8275. {
  8276. var hud : CR4ScriptedHud;
  8277. hud = (CR4ScriptedHud)theGame.GetHud();
  8278.  
  8279. if(abilityManager && abilityManager.IsInitialized())
  8280. {
  8281. ((W3PlayerAbilityManager)abilityManager).OnLevelGained(currentLevel);
  8282. }
  8283.  
  8284. if ( theGame.GetDifficultyMode() != EDM_Hardcore )
  8285. {
  8286. Heal(GetStatMax(BCS_Vitality));
  8287. }
  8288.  
  8289.  
  8290. if(currentLevel >= 35)
  8291. {
  8292. theGame.GetGamerProfile().AddAchievement(EA_Immortal);
  8293. }
  8294.  
  8295. if ( hud && currentLevel < levelManager.GetMaxLevel() && FactsQuerySum( "DebugNoLevelUpUpdates" ) == 0 )
  8296. {
  8297. hud.OnLevelUpUpdate(currentLevel, show);
  8298. }
  8299.  
  8300. theGame.RequestAutoSave( "level gained", false );
  8301. }
  8302.  
  8303. public function GetSignStats(skill : ESkill, out damageType : name, out damageVal : float, out spellPower : SAbilityAttributeValue)
  8304. {
  8305. var i, size : int;
  8306. var dm : CDefinitionsManagerAccessor;
  8307. var attrs : array<name>;
  8308.  
  8309. spellPower = GetPowerStatValue(CPS_SpellPower);
  8310.  
  8311. dm = theGame.GetDefinitionsManager();
  8312. dm.GetAbilityAttributes(GetSkillAbilityName(skill), attrs);
  8313. size = attrs.Size();
  8314.  
  8315. for( i = 0; i < size; i += 1 )
  8316. {
  8317. if( IsDamageTypeNameValid(attrs[i]) )
  8318. {
  8319. damageVal = CalculateAttributeValue(GetSkillAttributeValue(skill, attrs[i], false, true));
  8320. damageType = attrs[i];
  8321. break;
  8322. }
  8323. }
  8324. }
  8325.  
  8326.  
  8327. public function SetIgnorePainMaxVitality(val : float)
  8328. {
  8329. if(abilityManager && abilityManager.IsInitialized())
  8330. abilityManager.SetStatPointMax(BCS_Vitality, val);
  8331. }
  8332.  
  8333. event OnAnimEvent_ActionBlend( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  8334. {
  8335. if ( animEventType == AET_DurationStart && !disableActionBlend )
  8336. {
  8337. if ( this.IsCastingSign() )
  8338. ProcessSignEvent( 'cast_end' );
  8339.  
  8340.  
  8341. FindMoveTarget();
  8342. SetCanPlayHitAnim( true );
  8343. this.SetBIsCombatActionAllowed( true );
  8344.  
  8345. if ( this.GetFinisherVictim() && this.GetFinisherVictim().HasAbility( 'ForceFinisher' ) && !isInFinisher )
  8346. {
  8347. this.GetFinisherVictim().SignalGameplayEvent( 'Finisher' );
  8348. }
  8349. else if (this.BufferCombatAction != EBAT_EMPTY )
  8350. {
  8351.  
  8352.  
  8353.  
  8354. if ( !IsCombatMusicEnabled() )
  8355. {
  8356. SetCombatActionHeading( ProcessCombatActionHeading( this.BufferCombatAction ) );
  8357. FindTarget();
  8358. UpdateDisplayTarget( true );
  8359. }
  8360.  
  8361. if ( AllowAttack( GetTarget(), this.BufferCombatAction ) )
  8362. this.ProcessCombatActionBuffer();
  8363. }
  8364. else
  8365. {
  8366.  
  8367. ResumeStaminaRegen( 'InsideCombatAction' );
  8368.  
  8369.  
  8370.  
  8371. }
  8372. }
  8373. else if ( disableActionBlend )
  8374. {
  8375. disableActionBlend = false;
  8376. }
  8377. }
  8378.  
  8379.  
  8380. event OnAnimEvent_Sign( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  8381. {
  8382. if( animEventType == AET_Tick )
  8383. {
  8384. ProcessSignEvent( animEventName );
  8385. }
  8386. }
  8387.  
  8388. event OnAnimEvent_Throwable( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  8389. {
  8390. var thrownEntity : CThrowable;
  8391.  
  8392. thrownEntity = (CThrowable)EntityHandleGet( thrownEntityHandle );
  8393.  
  8394. if ( inv.IsItemCrossbow( inv.GetItemFromSlot('l_weapon') ) && rangedWeapon.OnProcessThrowEvent( animEventName ) )
  8395. {
  8396. return true;
  8397. }
  8398. else if( thrownEntity && IsThrowingItem() && thrownEntity.OnProcessThrowEvent( animEventName ) )
  8399. {
  8400. return true;
  8401. }
  8402. }
  8403.  
  8404. event OnTaskSyncAnim( npc : CNewNPC, animNameLeft : name )
  8405. {
  8406. var tmpBool : bool;
  8407. var tmpName : name;
  8408. var damage, points, resistance : float;
  8409. var min, max : SAbilityAttributeValue;
  8410. var mc : EMonsterCategory;
  8411.  
  8412. super.OnTaskSyncAnim( npc, animNameLeft );
  8413.  
  8414. if( animNameLeft == 'BruxaBite' && IsMutationActive( EPMT_Mutation4 ) )
  8415. {
  8416. theGame.GetMonsterParamsForActor( npc, mc, tmpName, tmpBool, tmpBool, tmpBool );
  8417.  
  8418. if( mc == MC_Vampire )
  8419. {
  8420. GetResistValue( CDS_BleedingRes, points, resistance );
  8421.  
  8422. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'BleedingEffect', 'DirectDamage', min, max );
  8423. damage = MaxF( 0.f, max.valueMultiplicative * GetMaxHealth() - points );
  8424.  
  8425. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'BleedingEffect', 'duration', min, max );
  8426. damage *= min.valueAdditive * ( 1 - MinF( 1.f, resistance ) );
  8427.  
  8428. if( damage > 0.f )
  8429. {
  8430. //npc.AddAbility( 'Mutation4BloodDebuff' ); //modSigns: moved to acid effect
  8431. ProcessActionMutation4ReturnedDamage( damage, npc, EAHA_ForceNo );
  8432. //npc.AddTimer( 'RemoveMutation4BloodDebuff', 15.f, , , , , true ); //modSigns: moved to acid effect
  8433. }
  8434. }
  8435. }
  8436. }
  8437.  
  8438.  
  8439. //modSigns: redone
  8440. public function ProcessActionMutation4ReturnedDamage( damageDealt : float, attacker : CActor, hitAnimationType : EActionHitAnim, optional action : W3DamageAction ) : bool
  8441. {
  8442. var customParams : SCustomEffectParams;
  8443. var currToxicity : float;
  8444. var min, max, customDamageValue : SAbilityAttributeValue;
  8445. var dm : CDefinitionsManagerAccessor;
  8446. var animAction : W3DamageAction;
  8447. var customDuration : float; //modSigns
  8448.  
  8449. if( damageDealt <= 0 )
  8450. {
  8451. return false;
  8452. }
  8453.  
  8454. currToxicity = GetStat( BCS_Toxicity );
  8455.  
  8456. if( currToxicity <= 0 )
  8457. {
  8458. return false;
  8459. }
  8460.  
  8461. dm = theGame.GetDefinitionsManager();
  8462. dm.GetAbilityAttributeValue( 'AcidEffect', 'DirectDamage', min, max );
  8463. customDamageValue.valueAdditive = currToxicity * min.valueAdditive;
  8464. dm.GetAbilityAttributeValue( 'AcidEffect', 'duration', min, max );
  8465. customDuration = min.valueAdditive;
  8466.  
  8467. if( customDamageValue.valueAdditive <= 0 || customDuration <= 0 )
  8468. {
  8469. return false;
  8470. }
  8471.  
  8472. if( action )
  8473. {
  8474. action.SetMutation4Triggered();
  8475. }
  8476.  
  8477. //dm.GetAbilityAttributeValue( 'AcidEffect', 'DirectDamage', min, max );
  8478. //customDamageValue.valueAdditive = damageDealt * min.valueAdditive;
  8479. //
  8480. //if( currToxicity > 0 )
  8481. //{
  8482. // customDamageValue.valueAdditive *= currToxicity;
  8483. //}
  8484. //
  8485. //dm.GetAbilityAttributeValue( 'AcidEffect', 'duration', min, max );
  8486. //customDamageValue.valueAdditive /= min.valueAdditive;
  8487.  
  8488. customParams.effectType = EET_Acid;
  8489. customParams.effectValue = customDamageValue;
  8490. customParams.duration = customDuration;
  8491. customParams.creator = this;
  8492. customParams.sourceName = 'Mutation4';
  8493.  
  8494. attacker.AddEffectCustom( customParams );
  8495.  
  8496.  
  8497. animAction = new W3DamageAction in theGame;
  8498. animAction.Initialize( this, attacker, NULL, 'Mutation4', EHRT_Reflect, CPS_Undefined, true, false, false, false );
  8499. animAction.SetCannotReturnDamage( true );
  8500. animAction.SetCanPlayHitParticle( false );
  8501. animAction.SetHitAnimationPlayType( hitAnimationType );
  8502. theGame.damageMgr.ProcessAction( animAction );
  8503. delete animAction;
  8504.  
  8505. theGame.MutationHUDFeedback( MFT_PlayOnce );
  8506.  
  8507. return true;
  8508. }
  8509.  
  8510. event OnPlayerActionEnd()
  8511. {
  8512. var l_i : int;
  8513. var l_bed : W3WitcherBed;
  8514.  
  8515. l_i = (int)GetBehaviorVariable( 'playerExplorationAction' );
  8516.  
  8517. if( l_i == PEA_GoToSleep )
  8518. {
  8519. l_bed = (W3WitcherBed)theGame.GetEntityByTag( 'witcherBed' );
  8520. BlockAllActions( 'WitcherBed', false );
  8521. l_bed.ApplyAppearance( "collision" );
  8522. l_bed.GotoState( 'WakeUp' );
  8523. theGame.ReleaseNoSaveLock( l_bed.m_bedSaveLock );
  8524.  
  8525.  
  8526. substateManager.m_MovementCorrectorO.disallowRotWhenGoingToSleep = false;
  8527. }
  8528.  
  8529. super.OnPlayerActionEnd();
  8530. }
  8531.  
  8532. event OnPlayerActionStartFinished()
  8533. {
  8534. var l_initData : W3SingleMenuInitData;
  8535. var l_i : int;
  8536.  
  8537. l_i = (int)GetBehaviorVariable( 'playerExplorationAction' );
  8538.  
  8539. if( l_i == PEA_GoToSleep )
  8540. {
  8541. //modFriendlyMeditation begin
  8542. UnblockAction( EIAB_OpenMeditation, 'WitcherBed' );
  8543. UnblockAction( EIAB_MeditationWaiting, 'WitcherBed' );
  8544. //modFriendlyMeditation end
  8545.  
  8546. l_initData = new W3SingleMenuInitData in this;
  8547. l_initData.SetBlockOtherPanels( true );
  8548. l_initData.ignoreSaveSystem = true;
  8549. l_initData.ignoreMeditationCheck = true;
  8550. l_initData.setDefaultState( '' );
  8551. l_initData.isBonusMeditationAvailable = true;
  8552. l_initData.fixedMenuName = 'MeditationClockMenu';
  8553.  
  8554. theGame.RequestMenuWithBackground( 'MeditationClockMenu', 'CommonMenu', l_initData );
  8555. }
  8556.  
  8557. super.OnPlayerActionStartFinished();
  8558. }
  8559.  
  8560. public function IsInCombatAction_SpecialAttack() : bool
  8561. {
  8562. if ( IsInCombatAction() && ( GetCombatAction() == EBAT_SpecialAttack_Light || GetCombatAction() == EBAT_SpecialAttack_Heavy ) )
  8563. return true;
  8564. else
  8565. return false;
  8566. }
  8567.  
  8568. public function IsInCombatAction_SpecialAttackHeavy() : bool
  8569. {
  8570. if ( IsInCombatAction() && GetCombatAction() == EBAT_SpecialAttack_Heavy )
  8571. return true;
  8572. else
  8573. return false;
  8574. }
  8575.  
  8576. protected function WhenCombatActionIsFinished()
  8577. {
  8578. super.WhenCombatActionIsFinished();
  8579. RemoveTimer( 'ProcessAttackTimer' );
  8580. RemoveTimer( 'AttackTimerEnd' );
  8581. CastSignAbort();
  8582. specialAttackCamera = false;
  8583. this.OnPerformSpecialAttack( true, false );
  8584. }
  8585.  
  8586. //modSigns: RemoveTemporarySkills should never happen on combat action end,
  8587. //as if sign casting interrupts any other action, temp skills are removed
  8588. //by the end of interrupted action and before the sign is actually cast!
  8589. event OnCombatActionEnd()
  8590. {
  8591. this.CleanCombatActionBuffer();
  8592. super.OnCombatActionEnd();
  8593.  
  8594. //RemoveTemporarySkills();
  8595. }
  8596.  
  8597. event OnCombatActionFriendlyEnd()
  8598. {
  8599. if ( IsCastingSign() )
  8600. {
  8601. SetBehaviorVariable( 'IsCastingSign', 0 );
  8602. SetCurrentlyCastSign( ST_None, NULL );
  8603. LogChannel( 'ST_None', "ST_None" );
  8604. }
  8605.  
  8606. super.OnCombatActionFriendlyEnd();
  8607. }
  8608.  
  8609. public function GetPowerStatValue( stat : ECharacterPowerStats, optional ablName : name, optional ignoreDeath : bool ) : SAbilityAttributeValue
  8610. {
  8611. var result : SAbilityAttributeValue;
  8612.  
  8613.  
  8614. result = super.GetPowerStatValue( stat, ablName, ignoreDeath );
  8615. //modSigns: W3DamageAction.GetPowerStatValue calls for actor.GetPowerStatValue twice:
  8616. //second time with attackName as ablName to obtain attack specific boosts, so Euphoria boost ends up
  8617. //being applied twice. Character stats for popup menu don't use ablName as there is no attack and no attackName,
  8618. //so bonus is displayed properly there, but gets doubled when actual damage is calculated in combat.
  8619. //To fix this we need to check for non-ability specific calls:
  8620. //if( !IsNameValid(ablName) && stat != CPS_Undefined )
  8621. // ApplyMutation10StatBoost( result ); //modSigns: reworked
  8622.  
  8623. return result;
  8624. }
  8625.  
  8626.  
  8627.  
  8628. timer function OpenRadialMenu( time: float, id : int )
  8629. {
  8630.  
  8631. if( GetBIsCombatActionAllowed() && !IsUITakeInput() )
  8632. {
  8633. bShowRadialMenu = true;
  8634. }
  8635.  
  8636. this.RemoveTimer('OpenRadialMenu');
  8637. }
  8638.  
  8639. public function OnAddRadialMenuOpenTimer( )
  8640. {
  8641.  
  8642.  
  8643.  
  8644.  
  8645.  
  8646. this.AddTimer('OpenRadialMenu', _HoldBeforeOpenRadialMenuTime * theGame.GetTimeScale() );
  8647.  
  8648. }
  8649.  
  8650. public function SetShowRadialMenuOpenFlag( bSet : bool )
  8651. {
  8652.  
  8653. bShowRadialMenu = bSet;
  8654. }
  8655.  
  8656. public function OnRemoveRadialMenuOpenTimer()
  8657. {
  8658.  
  8659. this.RemoveTimer('OpenRadialMenu');
  8660. }
  8661.  
  8662. public function ResetRadialMenuOpenTimer()
  8663. {
  8664.  
  8665. this.RemoveTimer('OpenRadialMenu');
  8666. if( GetBIsCombatActionAllowed() )
  8667. {
  8668.  
  8669.  
  8670. AddTimer('OpenRadialMenu', _HoldBeforeOpenRadialMenuTime * theGame.GetTimeScale() );
  8671. }
  8672. }
  8673.  
  8674.  
  8675.  
  8676. timer function ResendCompanionDisplayName(dt : float, id : int)
  8677. {
  8678. var hud : CR4ScriptedHud;
  8679. var companionModule : CR4HudModuleCompanion;
  8680.  
  8681. hud = (CR4ScriptedHud)theGame.GetHud();
  8682. if( hud )
  8683. {
  8684. companionModule = (CR4HudModuleCompanion)hud.GetHudModule("CompanionModule");
  8685. if( companionModule )
  8686. {
  8687. companionModule.ResendDisplayName();
  8688. }
  8689. }
  8690. }
  8691.  
  8692. timer function ResendCompanionDisplayNameSecond(dt : float, id : int)
  8693. {
  8694. var hud : CR4ScriptedHud;
  8695. var companionModule : CR4HudModuleCompanion;
  8696.  
  8697. hud = (CR4ScriptedHud)theGame.GetHud();
  8698. if( hud )
  8699. {
  8700. companionModule = (CR4HudModuleCompanion)hud.GetHudModule("CompanionModule");
  8701. if( companionModule )
  8702. {
  8703. companionModule.ResendDisplayNameSecond();
  8704. }
  8705. }
  8706. }
  8707.  
  8708. public function RemoveCompanionDisplayNameTimer()
  8709. {
  8710. this.RemoveTimer('ResendCompanionDisplayName');
  8711. }
  8712.  
  8713. public function RemoveCompanionDisplayNameTimerSecond()
  8714. {
  8715. this.RemoveTimer('ResendCompanionDisplayNameSecond');
  8716. }
  8717.  
  8718.  
  8719. public function GetCompanionNPCTag() : name
  8720. {
  8721. return companionNPCTag;
  8722. }
  8723.  
  8724. public function SetCompanionNPCTag( value : name )
  8725. {
  8726. companionNPCTag = value;
  8727. }
  8728.  
  8729. public function GetCompanionNPCTag2() : name
  8730. {
  8731. return companionNPCTag2;
  8732. }
  8733.  
  8734. public function SetCompanionNPCTag2( value : name )
  8735. {
  8736. companionNPCTag2 = value;
  8737. }
  8738.  
  8739. public function GetCompanionNPCIconPath() : string
  8740. {
  8741. return companionNPCIconPath;
  8742. }
  8743.  
  8744. public function SetCompanionNPCIconPath( value : string )
  8745. {
  8746. companionNPCIconPath = value;
  8747. }
  8748.  
  8749. public function GetCompanionNPCIconPath2() : string
  8750. {
  8751. return companionNPCIconPath2;
  8752. }
  8753.  
  8754. public function SetCompanionNPCIconPath2( value : string )
  8755. {
  8756. companionNPCIconPath2 = value;
  8757. }
  8758.  
  8759.  
  8760.  
  8761. //modSigns: chance to ignore hit anim
  8762. /*public function GetChanceToIgnoreHitAnim() : float
  8763. {
  8764. var armorPieces : array<int>;
  8765.  
  8766. inv.CountArmorPieces(armorPieces);
  8767. return armorPieces[0] * 0 + armorPieces[1] * 2.5 + armorPieces[2] * 10;
  8768. }*/
  8769.  
  8770. public function ReactToBeingHit(damageAction : W3DamageAction, optional buffNotApplied : bool) : bool
  8771. {
  8772. //var chance : float;
  8773. //var procQuen : W3SignEntity;
  8774.  
  8775. if(IsThrowingItem() || IsThrowingItemWithAim()) //modSigns: no need to abort throwing if not in fact throwing
  8776. {
  8777. if(!damageAction.IsDoTDamage() && damageAction.DealsAnyDamage() && damageAction.GetHitAnimationPlayType() != EAHA_ForceNo) //modSigns
  8778. {
  8779. if(inv.IsItemBomb(selectedItemId))
  8780. {
  8781. BombThrowAbort();
  8782. }
  8783. else
  8784. {
  8785. ThrowingAbort();
  8786. }
  8787. }
  8788. }
  8789.  
  8790.  
  8791. /*if(damageAction.IsActionRanged())
  8792. {
  8793. chance = CalculateAttributeValue(GetAttributeValue('quen_chance_on_projectile'));
  8794. if(chance > 0)
  8795. {
  8796. chance = ClampF(chance, 0, 1);
  8797.  
  8798. if(RandF() < chance)
  8799. {
  8800. procQuen = (W3SignEntity)theGame.CreateEntity(signs[ST_Quen].template, GetWorldPosition(), GetWorldRotation() );
  8801. procQuen.Init(signOwner, signs[ST_Quen].entity, true );
  8802. procQuen.OnStarted();
  8803. procQuen.OnThrowing();
  8804. procQuen.OnEnded();
  8805. }
  8806. }
  8807. }*/ //modSigns: moved to reduce damage
  8808.  
  8809.  
  8810. if( !((W3Effect_Toxicity)damageAction.causer) )
  8811. MeditationForceAbort(true);
  8812.  
  8813.  
  8814. if(IsDoingSpecialAttack(false))
  8815. damageAction.SetHitAnimationPlayType(EAHA_ForceNo);
  8816.  
  8817. return super.ReactToBeingHit(damageAction, buffNotApplied);
  8818. }
  8819.  
  8820. protected function ShouldPauseHealthRegenOnHit() : bool
  8821. {
  8822.  
  8823. if( ( HasBuff( EET_Swallow ) && GetPotionBuffLevel( EET_Swallow ) >= 3 ) || HasBuff( EET_Runeword8 ) || HasBuff( EET_Mutation11Buff ) || HasBuff( EET_UndyingSkillImmortal ) ) //modSigns
  8824. {
  8825. return false;
  8826. }
  8827.  
  8828. return true;
  8829. }
  8830.  
  8831. public function SetMappinToHighlight( mappinName : name, mappinState : bool )
  8832. {
  8833. var mappinDef : SHighlightMappin;
  8834. mappinDef.MappinName = mappinName;
  8835. mappinDef.MappinState = mappinState;
  8836. MappinToHighlight.PushBack(mappinDef);
  8837. }
  8838.  
  8839. public function ClearMappinToHighlight()
  8840. {
  8841. MappinToHighlight.Clear();
  8842. }
  8843.  
  8844. public function CastSignAbort()
  8845. {
  8846. if( currentlyCastSign != ST_None && signs[currentlyCastSign].entity)
  8847. {
  8848. signs[currentlyCastSign].entity.OnSignAborted();
  8849. }
  8850.  
  8851.  
  8852. }
  8853.  
  8854. event OnBlockingSceneStarted( scene: CStoryScene )
  8855. {
  8856. //---=== modFriendlyMeditation ===---
  8857. //var med : W3PlayerWitcherStateMeditationWaiting;
  8858. //
  8859. //
  8860. //med = (W3PlayerWitcherStateMeditationWaiting)GetCurrentState();
  8861. //if(med)
  8862. //{
  8863. // med.StopRequested(true);
  8864. //}
  8865. ModEndMeditation();
  8866. //---=== modFriendlyMeditation ===---
  8867.  
  8868.  
  8869. super.OnBlockingSceneStarted( scene );
  8870. }
  8871.  
  8872.  
  8873.  
  8874.  
  8875.  
  8876. public function GetHorseManager() : W3HorseManager
  8877. {
  8878. return (W3HorseManager)EntityHandleGet( horseManagerHandle );
  8879. }
  8880.  
  8881.  
  8882. public function HorseEquipItem(horsesItemId : SItemUniqueId) : bool
  8883. {
  8884. var man : W3HorseManager;
  8885.  
  8886. man = GetHorseManager();
  8887. if(man)
  8888. return man.EquipItem(horsesItemId) != GetInvalidUniqueId();
  8889.  
  8890. return false;
  8891. }
  8892.  
  8893.  
  8894. public function HorseUnequipItem(slot : EEquipmentSlots) : bool
  8895. {
  8896. var man : W3HorseManager;
  8897.  
  8898. man = GetHorseManager();
  8899. if(man)
  8900. return man.UnequipItem(slot) != GetInvalidUniqueId();
  8901.  
  8902. return false;
  8903. }
  8904.  
  8905.  
  8906. public final function HorseRemoveItemByName(itemName : name, quantity : int)
  8907. {
  8908. var man : W3HorseManager;
  8909.  
  8910. man = GetHorseManager();
  8911. if(man)
  8912. man.HorseRemoveItemByName(itemName, quantity);
  8913. }
  8914.  
  8915.  
  8916. public final function HorseRemoveItemByCategory(itemCategory : name, quantity : int)
  8917. {
  8918. var man : W3HorseManager;
  8919.  
  8920. man = GetHorseManager();
  8921. if(man)
  8922. man.HorseRemoveItemByCategory(itemCategory, quantity);
  8923. }
  8924.  
  8925.  
  8926. public final function HorseRemoveItemByTag(itemTag : name, quantity : int)
  8927. {
  8928. var man : W3HorseManager;
  8929.  
  8930. man = GetHorseManager();
  8931. if(man)
  8932. man.HorseRemoveItemByTag(itemTag, quantity);
  8933. }
  8934.  
  8935. public function GetAssociatedInventory() : CInventoryComponent
  8936. {
  8937. var man : W3HorseManager;
  8938.  
  8939. man = GetHorseManager();
  8940. if(man)
  8941. return man.GetInventoryComponent();
  8942.  
  8943. return NULL;
  8944. }
  8945.  
  8946.  
  8947.  
  8948.  
  8949.  
  8950. public final function TutorialMutagensUnequipPlayerSkills() : array<STutorialSavedSkill>
  8951. {
  8952. var pam : W3PlayerAbilityManager;
  8953.  
  8954. pam = (W3PlayerAbilityManager)abilityManager;
  8955. return pam.TutorialMutagensUnequipPlayerSkills();
  8956. }
  8957.  
  8958. public final function TutorialMutagensEquipOneGoodSkill()
  8959. {
  8960. var pam : W3PlayerAbilityManager;
  8961.  
  8962. pam = (W3PlayerAbilityManager)abilityManager;
  8963. pam.TutorialMutagensEquipOneGoodSkill();
  8964. }
  8965.  
  8966. public final function TutorialMutagensEquipOneGoodOneBadSkill()
  8967. {
  8968. var pam : W3PlayerAbilityManager;
  8969.  
  8970. pam = (W3PlayerAbilityManager)abilityManager;
  8971. if(pam)
  8972. pam.TutorialMutagensEquipOneGoodOneBadSkill();
  8973. }
  8974.  
  8975. public final function TutorialMutagensEquipThreeGoodSkills()
  8976. {
  8977. var pam : W3PlayerAbilityManager;
  8978.  
  8979. pam = (W3PlayerAbilityManager)abilityManager;
  8980. if(pam)
  8981. pam.TutorialMutagensEquipThreeGoodSkills();
  8982. }
  8983.  
  8984. public final function TutorialMutagensCleanupTempSkills(savedEquippedSkills : array<STutorialSavedSkill>)
  8985. {
  8986. var pam : W3PlayerAbilityManager;
  8987.  
  8988. pam = (W3PlayerAbilityManager)abilityManager;
  8989. return pam.TutorialMutagensCleanupTempSkills(savedEquippedSkills);
  8990. }
  8991.  
  8992.  
  8993.  
  8994.  
  8995.  
  8996. //modSigns: redone
  8997. //modSigns: by default, there's no armor stamina penalty as armor class already
  8998. //affects action cost, but you can enable it in options
  8999. public final function CalculatedArmorStaminaRegenBonus() : float
  9000. {
  9001. var armorEq, glovesEq, pantsEq, bootsEq : bool;
  9002. var armorId, glovesId, pantsId, bootsId : SItemUniqueId;
  9003. var staminaRegenVal : float;
  9004. var armorRegenVal : SAbilityAttributeValue;
  9005.  
  9006. if(!theGame.params.IsArmorRegenPenaltyEnabled())
  9007. return 0.0f;
  9008.  
  9009. //base armor stamina regen bonus/penalty
  9010. armorRegenVal = GetAttributeValue('staminaRegen_armor_mod');
  9011. staminaRegenVal = armorRegenVal.valueMultiplicative;
  9012.  
  9013. //equipped pieces
  9014. armorEq = inv.GetItemEquippedOnSlot( EES_Armor, armorId );
  9015. glovesEq = inv.GetItemEquippedOnSlot( EES_Gloves, glovesId );
  9016. pantsEq = inv.GetItemEquippedOnSlot( EES_Pants, pantsId );
  9017. bootsEq = inv.GetItemEquippedOnSlot( EES_Boots, bootsId );
  9018.  
  9019. //glyphwords change stamina, not replace it
  9020. //if( HasGlyphwordActive( 'Glyphword 2 _Stats' ) )
  9021. //{
  9022. // if ( armorEq && !inv.ItemHasTag(armorId, 'LightArmor') )
  9023. // staminaRegenVal += 0.07;
  9024. // if ( glovesEq && !inv.ItemHasTag(glovesId, 'LightArmor') )
  9025. // staminaRegenVal += 0.01;
  9026. // if ( pantsEq && !inv.ItemHasTag(pantsId, 'LightArmor') )
  9027. // staminaRegenVal += 0.01;
  9028. // if ( bootsEq && !inv.ItemHasTag(bootsId, 'LightArmor') )
  9029. // staminaRegenVal += 0.01;
  9030. //}
  9031. //else if( HasGlyphwordActive( 'Glyphword 3 _Stats' ) )
  9032. //{
  9033. //}
  9034. //else if( HasGlyphwordActive( 'Glyphword 4 _Stats' ) )
  9035. //{
  9036. // if ( armorEq && !inv.ItemHasTag(armorId, 'HeavyArmor') )
  9037. // staminaRegenVal -= 0.20;
  9038. // if ( glovesEq && !inv.ItemHasTag(glovesId, 'HeavyArmor') )
  9039. // staminaRegenVal -= 0.025;
  9040. // if ( pantsEq && !inv.ItemHasTag(pantsId, 'HeavyArmor') )
  9041. // staminaRegenVal -= 0.025;
  9042. // if ( bootsEq && !inv.ItemHasTag(bootsId, 'HeavyArmor') )
  9043. // staminaRegenVal -= 0.05;
  9044. //} //modSigns: reworked
  9045.  
  9046. //stamina regen bonus for missing armor pieces
  9047. if ( !armorEq )
  9048. staminaRegenVal += 0.11;
  9049. if ( !glovesEq )
  9050. staminaRegenVal += 0.02;
  9051. if ( !pantsEq )
  9052. staminaRegenVal += 0.03;
  9053. if ( !bootsEq )
  9054. staminaRegenVal += 0.04;
  9055.  
  9056. //debug
  9057. //theGame.witcherLog.AddMessage( "staminaRegenVal = " + staminaRegenVal );
  9058.  
  9059. return staminaRegenVal;
  9060. }
  9061.  
  9062. //modSigns: reworked
  9063. public function GetOffenseStatsList( optional hackMode : int ) : SPlayerOffenseStats
  9064. {
  9065. var playerOffenseStats : SPlayerOffenseStats;
  9066. var min, max, value : SAbilityAttributeValue;
  9067. var attackPower : SAbilityAttributeValue;
  9068. var fastAPBonus, strongAPBonus, steelAPBonus, silverAPBonus : SAbilityAttributeValue;
  9069. var critChance, critPowerBonus, fastCritChanceBonus, strongCritChanceBonus, fastCritPowerBonus, strongCritPowerBonus : float;
  9070. var steelCritChanceBonus, silverCritChanceBonus, steelCritPowerBonus, silverCritPowerBonus : float;
  9071. var steelDmg, silverDmg, elementalSteel, elementalSilver : float;
  9072. var attackPowerCrossbow : SAbilityAttributeValue;
  9073. var silverSword, steelSword, crossbow, bolt : SItemUniqueId;
  9074. var mutagen : CBaseGameplayEffect;
  9075. var thunder : W3Potion_Thunderbolt;
  9076. var strongDmgMult, bonusDmgMult, bonusDmgMultCrossbow, bonusDmgMultSteel, bonusDmgMultSilver : float;
  9077. var steelFastAP, silverFastAP, steelStrongAP, silverStrongAP, steelFastCritAP, silverFastCritAP, steelStrongCritAP, silverStrongCritAP : SAbilityAttributeValue;
  9078. var steelFastCritChance, silverFastCritChance, steelStrongCritChance, silverStrongCritChance : float;
  9079.  
  9080. if(!abilityManager || !abilityManager.IsInitialized())
  9081. return playerOffenseStats;
  9082.  
  9083. //base damage increase for heavy attacks
  9084. value = GetSkillAttributeValue(S_Sword_2, 'heavy_attack_dmg_boost', false, true);
  9085. strongDmgMult = 1 + value.valueMultiplicative;
  9086.  
  9087. //generic bonuses
  9088. attackPower = GetPowerStatValue(CPS_AttackPower);
  9089. //Bear tier 1 power bonus
  9090. if(IsSetBonusActive(EISB_Bear_1))
  9091. {
  9092. theGame.GetDefinitionsManager().GetAbilityAttributeValue(GetSetBonusAbility(EISB_Bear_1), 'attack_power', min, max);
  9093. attackPower.valueMultiplicative += min.valueMultiplicative * GetSetPartsEquipped(EIST_Bear) * FloorF(GetStat(BCS_Focus));
  9094. }
  9095. critChance = CalculateAttributeValue(GetAttributeValue(theGame.params.CRITICAL_HIT_CHANCE));
  9096. critPowerBonus = CalculateAttributeValue(GetAttributeValue(theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  9097.  
  9098. //attack type specific bonuses
  9099. fastAPBonus = GetSkillAttributeValue(S_Sword_1, PowerStatEnumToName(CPS_AttackPower), false, true);
  9100. strongAPBonus = GetSkillAttributeValue(S_Sword_2, PowerStatEnumToName(CPS_AttackPower), false, true);
  9101. if (CanUseSkill(S_Sword_s21))
  9102. fastAPBonus += GetSkillAttributeValue(S_Sword_s21, PowerStatEnumToName(CPS_AttackPower), false, true) * GetSkillLevel(S_Sword_s21);
  9103. if (CanUseSkill(S_Sword_s04))
  9104. strongAPBonus += GetSkillAttributeValue(S_Sword_s04, PowerStatEnumToName(CPS_AttackPower), false, true) * GetSkillLevel(S_Sword_s04);
  9105. if (HasBuff(EET_LynxSetBonus)) //lynx tier 1 attack type specific bonuses
  9106. {
  9107. fastAPBonus.valueMultiplicative += ((W3Effect_LynxSetBonus)GetBuff(EET_LynxSetBonus)).GetLynxBonus(false);
  9108. strongAPBonus.valueMultiplicative += ((W3Effect_LynxSetBonus)GetBuff(EET_LynxSetBonus)).GetLynxBonus(true);
  9109. }
  9110. if (CanUseSkill(S_Sword_s17))
  9111. {
  9112. fastCritChanceBonus = CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s17, theGame.params.CRITICAL_HIT_CHANCE, false, true)) * GetSkillLevel(S_Sword_s17);
  9113. fastCritPowerBonus = CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s17, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, true)) * GetSkillLevel(S_Sword_s17);
  9114. }
  9115. if (CanUseSkill(S_Sword_s08))
  9116. {
  9117. strongCritChanceBonus = CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s08, theGame.params.CRITICAL_HIT_CHANCE, false, true)) * GetSkillLevel(S_Sword_s08);
  9118. strongCritPowerBonus = CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s08, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, true)) * GetSkillLevel(S_Sword_s08);
  9119. }
  9120.  
  9121. //steel sword specific bonuses
  9122. if (GetItemEquippedOnSlot(EES_SteelSword, steelSword))
  9123. {
  9124. steelDmg = GetTotalWeaponDamage(steelSword, theGame.params.DAMAGE_NAME_SLASHING, GetInvalidUniqueId());
  9125. steelDmg += GetTotalWeaponDamage(steelSword, theGame.params.DAMAGE_NAME_PIERCING, GetInvalidUniqueId());
  9126. steelDmg += GetTotalWeaponDamage(steelSword, theGame.params.DAMAGE_NAME_BLUDGEONING, GetInvalidUniqueId());
  9127. elementalSteel = CalculateAttributeValue(GetInventory().GetItemAttributeValue(steelSword, theGame.params.DAMAGE_NAME_FIRE));
  9128. elementalSteel += CalculateAttributeValue(GetInventory().GetItemAttributeValue(steelSword, theGame.params.DAMAGE_NAME_FROST));
  9129. elementalSteel += CalculateAttributeValue(GetInventory().GetItemAttributeValue(steelSword, theGame.params.DAMAGE_NAME_POISON)); //modSigns
  9130. //weapon bonuses are added OnHold, so we need to retrieve them specifically if we want to show them
  9131. if (!GetInventory().IsItemHeld(steelSword))
  9132. {
  9133. steelCritChanceBonus += CalculateAttributeValue(GetInventory().GetItemAttributeValue(steelSword, theGame.params.CRITICAL_HIT_CHANCE));
  9134. steelCritPowerBonus += CalculateAttributeValue(GetInventory().GetItemAttributeValue(steelSword, theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  9135. steelAPBonus += GetInventory().GetItemAttributeValue(steelSword, 'attack_power');
  9136. }
  9137. //bonus damage
  9138. bonusDmgMultSteel += CalculateAttributeValue(GetInventory().GetItemAttributeValue(steelSword, 'sword_dmg_bonus'));
  9139. //tier 2 wolf oil bonuses
  9140. steelCritChanceBonus += CalculateAttributeValue(inv.GetOilCriticalChanceBonus(steelSword, MC_NotSet));
  9141. steelCritPowerBonus += CalculateAttributeValue(inv.GetOilCriticalDamageBonus(steelSword, MC_NotSet));
  9142. }
  9143.  
  9144. //silver sword specific bonuses
  9145. if (GetItemEquippedOnSlot(EES_SilverSword, silverSword))
  9146. {
  9147. silverDmg = GetTotalWeaponDamage(silverSword, theGame.params.DAMAGE_NAME_SILVER, GetInvalidUniqueId());
  9148. elementalSilver = CalculateAttributeValue(GetInventory().GetItemAttributeValue(silverSword, theGame.params.DAMAGE_NAME_FIRE));
  9149. elementalSilver += CalculateAttributeValue(GetInventory().GetItemAttributeValue(silverSword, theGame.params.DAMAGE_NAME_FROST));
  9150. elementalSilver += CalculateAttributeValue(GetInventory().GetItemAttributeValue(silverSword, theGame.params.DAMAGE_NAME_POISON)); //modSigns
  9151. //weapon bonuses are added OnHold, so we need to retrieve them specifically if we want to show them
  9152. if (!GetInventory().IsItemHeld(silverSword))
  9153. {
  9154. silverCritChanceBonus += CalculateAttributeValue(GetInventory().GetItemAttributeValue(silverSword, theGame.params.CRITICAL_HIT_CHANCE));
  9155. silverCritPowerBonus += CalculateAttributeValue(GetInventory().GetItemAttributeValue(silverSword, theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  9156. silverAPBonus += GetInventory().GetItemAttributeValue(silverSword, 'attack_power');
  9157. }
  9158. //bonus damage
  9159. bonusDmgMultSilver += CalculateAttributeValue(GetInventory().GetItemAttributeValue(silverSword, 'sword_dmg_bonus'));
  9160. //tier 2 wolf oil bonuses
  9161. silverCritChanceBonus += CalculateAttributeValue(inv.GetOilCriticalChanceBonus(silverSword, MC_NotSet));
  9162. silverCritPowerBonus += CalculateAttributeValue(inv.GetOilCriticalDamageBonus(silverSword, MC_NotSet));
  9163. }
  9164.  
  9165. //since drawn sword adds its stats to character stats, we now need to do this hackiest shit ever
  9166. if (GetInventory().IsItemHeld(steelSword))
  9167. {
  9168. //remove steel bonuses from silver stats
  9169. silverCritChanceBonus -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(steelSword, theGame.params.CRITICAL_HIT_CHANCE));
  9170. silverCritPowerBonus -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(steelSword, theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  9171. silverAPBonus -= GetInventory().GetItemAttributeValue(steelSword, 'attack_power');
  9172. }
  9173. if (GetInventory().IsItemHeld(silverSword))
  9174. {
  9175. //remove silver bonuses from steel stats
  9176. steelCritChanceBonus -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(silverSword, theGame.params.CRITICAL_HIT_CHANCE));
  9177. steelCritPowerBonus -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(silverSword, theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  9178. steelAPBonus -= GetInventory().GetItemAttributeValue(silverSword, 'attack_power');
  9179. }
  9180.  
  9181. //Thunderbolt lvl 3 crit chance
  9182. thunder = (W3Potion_Thunderbolt)GetBuff(EET_Thunderbolt);
  9183. if(thunder && thunder.GetBuffLevel() == 3 && GetCurWeather() == EWE_Storm)
  9184. {
  9185. critPowerBonus += 1.0f;
  9186. }
  9187.  
  9188. //heft damage increase
  9189. if(HasGlyphwordActive('Glyphword 4 _Stats'))
  9190. {
  9191. theGame.GetDefinitionsManager().GetAbilityAttributeValue('Glyphword 4 _Stats', 'glyphword4_mod', min, max);
  9192. bonusDmgMult += CalculateAttributeValue(min);
  9193. }
  9194.  
  9195. //Euphoria damage bonus
  9196. if(HasBuff(EET_Mutation10))
  9197. {
  9198. steelDmg += GetToxicityDamage();
  9199. silverDmg += GetToxicityDamage();
  9200. }
  9201.  
  9202. //final attributes
  9203. steelFastAP = attackPower + fastAPBonus + steelAPBonus;
  9204. silverFastAP = attackPower + fastAPBonus + silverAPBonus;
  9205. steelStrongAP = attackPower + strongAPBonus + steelAPBonus;
  9206. silverStrongAP = attackPower + strongAPBonus + silverAPBonus;
  9207. steelFastCritAP = steelFastAP;
  9208. steelFastCritAP.valueMultiplicative += critPowerBonus + fastCritPowerBonus + steelCritPowerBonus;
  9209. silverFastCritAP = silverFastAP;
  9210. silverFastCritAP.valueMultiplicative += critPowerBonus + fastCritPowerBonus + silverCritPowerBonus;
  9211. steelStrongCritAP = steelStrongAP;
  9212. steelStrongCritAP.valueMultiplicative += critPowerBonus + strongCritPowerBonus + steelCritPowerBonus;
  9213. silverStrongCritAP = silverStrongAP;
  9214. silverStrongCritAP.valueMultiplicative += critPowerBonus + strongCritPowerBonus + silverCritPowerBonus;
  9215. steelFastCritChance = critChance + fastCritChanceBonus + steelCritChanceBonus;
  9216. silverFastCritChance = critChance + fastCritChanceBonus + silverCritChanceBonus;
  9217. steelStrongCritChance = critChance + strongCritChanceBonus + steelCritChanceBonus;
  9218. silverStrongCritChance = critChance + strongCritChanceBonus + silverCritChanceBonus;
  9219.  
  9220. //fill offense stats
  9221. playerOffenseStats.steelFastAP = steelFastAP.valueMultiplicative;
  9222. playerOffenseStats.silverFastAP = silverFastAP.valueMultiplicative;
  9223. playerOffenseStats.steelStrongAP = steelStrongAP.valueMultiplicative;
  9224. playerOffenseStats.silverStrongAP = silverStrongAP.valueMultiplicative;
  9225. playerOffenseStats.steelFastCritAP = steelFastCritAP.valueMultiplicative;
  9226. playerOffenseStats.silverFastCritAP = silverFastCritAP.valueMultiplicative;
  9227. playerOffenseStats.steelStrongCritAP = steelStrongCritAP.valueMultiplicative;
  9228. playerOffenseStats.silverStrongCritAP = silverStrongCritAP.valueMultiplicative;
  9229. playerOffenseStats.steelFastCritChance = steelFastCritChance * 100;
  9230. playerOffenseStats.silverFastCritChance = silverFastCritChance * 100;
  9231. playerOffenseStats.steelStrongCritChance = steelStrongCritChance * 100;
  9232. playerOffenseStats.silverStrongCritChance = silverStrongCritChance * 100;
  9233. if ( steelDmg != 0 )
  9234. {
  9235. playerOffenseStats.steelFastDmg = ((steelDmg + elementalSteel) * (1 + bonusDmgMult + bonusDmgMultSteel) + steelFastAP.valueBase) * steelFastAP.valueMultiplicative + steelFastAP.valueAdditive;
  9236. playerOffenseStats.steelFastCritDmg = ((steelDmg + elementalSteel) * (1 + bonusDmgMult + bonusDmgMultSteel) + steelFastCritAP.valueBase) * steelFastCritAP.valueMultiplicative + steelFastCritAP.valueAdditive;
  9237. playerOffenseStats.steelFastDPS = playerOffenseStats.steelFastDmg * (1 - steelFastCritChance) + playerOffenseStats.steelFastCritDmg * steelFastCritChance;
  9238. playerOffenseStats.steelStrongDmg = ((steelDmg + elementalSteel) * (strongDmgMult + bonusDmgMult + bonusDmgMultSteel) + steelStrongAP.valueBase) * steelStrongAP.valueMultiplicative + steelStrongAP.valueAdditive;
  9239. playerOffenseStats.steelStrongCritDmg = ((steelDmg + elementalSteel) * (strongDmgMult + bonusDmgMult + bonusDmgMultSteel) + steelStrongCritAP.valueBase) * steelStrongCritAP.valueMultiplicative + steelStrongCritAP.valueAdditive;
  9240. playerOffenseStats.steelStrongDPS = playerOffenseStats.steelStrongDmg * (1 - steelStrongCritChance) + playerOffenseStats.steelStrongCritDmg * steelStrongCritChance;
  9241. }
  9242. if ( silverDmg != 0 )
  9243. {
  9244. playerOffenseStats.silverFastDmg = ((silverDmg + elementalSilver) * (1 + bonusDmgMult + bonusDmgMultSilver) + silverFastAP.valueBase) * silverFastAP.valueMultiplicative + silverFastAP.valueAdditive;
  9245. playerOffenseStats.silverFastCritDmg = ((silverDmg + elementalSilver) * (1 + bonusDmgMult + bonusDmgMultSilver) + silverFastCritAP.valueBase) * silverFastCritAP.valueMultiplicative + silverFastCritAP.valueAdditive;
  9246. playerOffenseStats.silverFastDPS = playerOffenseStats.silverFastDmg * (1 - silverFastCritChance) + playerOffenseStats.silverFastCritDmg * silverFastCritChance;
  9247. playerOffenseStats.silverStrongDmg = ((silverDmg + elementalSilver) * (strongDmgMult + bonusDmgMult + bonusDmgMultSilver) + silverStrongAP.valueBase) * silverStrongAP.valueMultiplicative + silverStrongAP.valueAdditive;
  9248. playerOffenseStats.silverStrongCritDmg = ((silverDmg + elementalSilver) * (strongDmgMult + bonusDmgMult + bonusDmgMultSilver) + silverStrongCritAP.valueBase) * silverStrongCritAP.valueMultiplicative + silverStrongCritAP.valueAdditive;
  9249. playerOffenseStats.silverStrongDPS = playerOffenseStats.silverStrongDmg * (1 - silverStrongCritChance) + playerOffenseStats.silverStrongCritDmg * silverStrongCritChance;
  9250. }
  9251.  
  9252. //modSigns: crossbow redone
  9253. playerOffenseStats.crossbowSteelDmgType = theGame.params.DAMAGE_NAME_PIERCING;
  9254. playerOffenseStats.crossbowElementaDmgType = '';
  9255. if (GetItemEquippedOnSlot(EES_RangedWeapon, crossbow))
  9256. {
  9257. attackPowerCrossbow = attackPower + GetInventory().GetItemAttributeValue(crossbow, PowerStatEnumToName(CPS_AttackPower));
  9258. playerOffenseStats.crossbowAttackPower = attackPowerCrossbow.valueMultiplicative;
  9259. playerOffenseStats.crossbowCritChance = GetCriticalHitChance( false, false, NULL, MC_NotSet, true );
  9260.  
  9261. value = GetCriticalHitDamageBonus( crossbow, MC_NotSet, false ) + inv.GetItemAttributeValue( crossbow, theGame.params.CRITICAL_HIT_DAMAGE_BONUS );
  9262. //Cat Eyes mutation crit damage boost
  9263. if( IsMutationActive( EPMT_Mutation9 ) )
  9264. {
  9265. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation9', 'critical_damage', min, max );
  9266. value += min;
  9267. }
  9268. if( CanUseSkill(S_Sword_s07) )
  9269. {
  9270. value += GetSkillAttributeValue(S_Sword_s07, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, true) * GetSkillLevel(S_Sword_s07);
  9271. }
  9272. playerOffenseStats.crossbowCritDmgBonus = CalculateAttributeValue(value);
  9273.  
  9274. //bolt stats
  9275. if (GetItemEquippedOnSlot(EES_Bolt, bolt))
  9276. {
  9277. playerOffenseStats.crossbowSteelDmgType = GetCrossbowSteelDmgName();
  9278. inv.GetItemStatByName(inv.GetItemName(bolt), playerOffenseStats.crossbowSteelDmgType, playerOffenseStats.crossbowSteelDmg);
  9279. inv.GetItemStatByName(inv.GetItemName(bolt), 'SilverDamage', playerOffenseStats.crossbowSilverDmg);
  9280. playerOffenseStats.crossbowElementaDmgType = GetCrossbowElementaDmgName();
  9281. if(IsNameValid(playerOffenseStats.crossbowElementaDmgType))
  9282. inv.GetItemStatByName(inv.GetItemName(bolt), playerOffenseStats.crossbowElementaDmgType, playerOffenseStats.crossbowElementaDmg);
  9283. }
  9284.  
  9285. //perk 2
  9286. if( CanUseSkill(S_Perk_02) )
  9287. {
  9288. min = GetSkillAttributeValue(S_Perk_02, 'xbow_dmg_bonus', false, true);
  9289. bonusDmgMultCrossbow += min.valueMultiplicative;
  9290. }
  9291.  
  9292. //modSigns: mutation9 base damage boost
  9293. if( IsMutationActive( EPMT_Mutation9 ) )
  9294. {
  9295. theGame.GetDefinitionsManager().GetAbilityAttributeValue('Mutation9', 'mut9_damage', min, max);
  9296. playerOffenseStats.crossbowSteelDmg *= 1 + min.valueMultiplicative;
  9297. playerOffenseStats.crossbowSilverDmg *= 1 + min.valueMultiplicative;
  9298. playerOffenseStats.crossbowElementaDmg *= 1 + min.valueMultiplicative;
  9299. }
  9300.  
  9301. playerOffenseStats.crossbowSteelDmg = (playerOffenseStats.crossbowSteelDmg * (1 + bonusDmgMultCrossbow) + attackPowerCrossbow.valueBase) * attackPowerCrossbow.valueMultiplicative;
  9302. playerOffenseStats.crossbowSilverDmg = (playerOffenseStats.crossbowSilverDmg * (1 + bonusDmgMultCrossbow) + attackPowerCrossbow.valueBase) * attackPowerCrossbow.valueMultiplicative;
  9303. playerOffenseStats.crossbowElementaDmg = (playerOffenseStats.crossbowElementaDmg * (1 + bonusDmgMultCrossbow) + attackPowerCrossbow.valueBase) * attackPowerCrossbow.valueMultiplicative;
  9304. }
  9305.  
  9306. return playerOffenseStats;
  9307. }
  9308.  
  9309. public function GetTotalWeaponDamage(weaponId : SItemUniqueId, damageTypeName : name, crossbowId : SItemUniqueId) : float
  9310. {
  9311. var damage, durRatio, durMod, itemMod : float;
  9312. var repairObjectBonus, min, max : SAbilityAttributeValue;
  9313. var aerondight : W3Effect_Aerondight; //modSigns
  9314. var phantomWeapon : W3Effect_PhantomWeapon; //modSigns
  9315.  
  9316. //durMod = 0;
  9317. durMod = 1; //modSigns: zero value effectively removes all non-physical damages from weapon
  9318. damage = super.GetTotalWeaponDamage(weaponId, damageTypeName, crossbowId);
  9319.  
  9320.  
  9321. //modSigns: changed -> moved
  9322. //if( IsMutationActive( EPMT_Mutation9 ) && inv.IsItemBolt( weaponId ) /*&& IsDamageTypeAnyPhysicalType( damageTypeName )*/ )
  9323. //{
  9324. // theGame.GetDefinitionsManager().GetAbilityAttributeValue('Mutation9', 'mut9_damage', min, max);
  9325. // damage *= 1 + min.valueMultiplicative;
  9326. //}
  9327.  
  9328.  
  9329. if(IsPhysicalResistStat(GetResistForDamage(damageTypeName, false)))
  9330. {
  9331. repairObjectBonus = inv.GetItemAttributeValue(weaponId, theGame.params.REPAIR_OBJECT_BONUS);
  9332. durRatio = -1;
  9333.  
  9334. if(inv.IsIdValid(crossbowId) && inv.HasItemDurability(crossbowId))
  9335. {
  9336. durRatio = inv.GetItemDurabilityRatio(crossbowId);
  9337. }
  9338. else if(inv.IsIdValid(weaponId) && inv.HasItemDurability(weaponId))
  9339. {
  9340. durRatio = inv.GetItemDurabilityRatio(weaponId);
  9341. }
  9342.  
  9343.  
  9344. if(durRatio >= 0)
  9345. durMod = theGame.params.GetDurabilityMultiplier(durRatio, true);
  9346. else
  9347. durMod = 1;
  9348. }
  9349.  
  9350.  
  9351. if( damageTypeName == 'SilverDamage' && inv.ItemHasTag( weaponId, 'Aerondight' ) )
  9352. {
  9353. //itemMod = inv.GetItemModifierFloat( weaponId, 'PermDamageBoost' );
  9354. //if( itemMod > 0.f )
  9355. //{
  9356. // damage += itemMod;
  9357. //}
  9358. //modSigns: damage boost per enemy
  9359. aerondight = (W3Effect_Aerondight)GetBuff(EET_Aerondight);
  9360. if(aerondight)
  9361. damage += aerondight.GetDamageBoost();
  9362. }
  9363.  
  9364. //modSigns
  9365. if( damageTypeName == 'SlashingDamage' && inv.ItemHasTag( weaponId, 'PhantomWeapon' ) )
  9366. {
  9367. phantomWeapon = (W3Effect_PhantomWeapon)GetBuff(EET_PhantomWeapon);
  9368. if(phantomWeapon && phantomWeapon.IsFullyCharged())
  9369. {
  9370. damage += phantomWeapon.GetDamageBoost();
  9371. //theGame.witcherLog.AddMessage("Phantom dmg boost = " + phantomWeapon.GetDamageBoost());
  9372. }
  9373. }
  9374.  
  9375. //modSigns: Invigoration
  9376. if( HasBuff(EET_Runeword4) && ( damageTypeName == 'SilverDamage' || damageTypeName == 'SlashingDamage' ) )
  9377. damage *= 1 + ((W3Effect_Runeword4)GetBuff(EET_Runeword4)).GetDamageBonus();
  9378.  
  9379. return damage * (durMod + repairObjectBonus.valueMultiplicative);
  9380. }
  9381.  
  9382.  
  9383.  
  9384.  
  9385.  
  9386. public final function GetSkillPathType(skill : ESkill) : ESkillPath
  9387. {
  9388. if(abilityManager && abilityManager.IsInitialized())
  9389. return ((W3PlayerAbilityManager)abilityManager).GetSkillPathType(skill);
  9390.  
  9391. return ESP_NotSet;
  9392. }
  9393.  
  9394. public function GetSkillLevel(s : ESkill) : int
  9395. {
  9396. if(abilityManager && abilityManager.IsInitialized())
  9397. return ((W3PlayerAbilityManager)abilityManager).GetSkillLevel(s);
  9398.  
  9399. return -1;
  9400. }
  9401.  
  9402. public function GetSkillMaxLevel(s : ESkill) : int
  9403. {
  9404. if(abilityManager && abilityManager.IsInitialized())
  9405. return ((W3PlayerAbilityManager)abilityManager).GetSkillMaxLevel(s);
  9406.  
  9407. return -1;
  9408. }
  9409.  
  9410. public function GetBoughtSkillLevel(s : ESkill) : int
  9411. {
  9412. if(abilityManager && abilityManager.IsInitialized())
  9413. return ((W3PlayerAbilityManager)abilityManager).GetBoughtSkillLevel(s);
  9414.  
  9415. return -1;
  9416. }
  9417.  
  9418.  
  9419. public function GetAxiiLevel() : int
  9420. {
  9421. var level : int;
  9422.  
  9423. level = 1;
  9424.  
  9425. if(CanUseSkill(S_Magic_s17)) level += GetSkillLevel(S_Magic_s17);
  9426.  
  9427. return Clamp(level, 1, 4);
  9428. }
  9429.  
  9430. public function IsInFrenzy() : bool
  9431. {
  9432. return isInFrenzy;
  9433. }
  9434.  
  9435. public function HasRecentlyCountered() : bool
  9436. {
  9437. return hasRecentlyCountered;
  9438. }
  9439.  
  9440. public function SetRecentlyCountered(counter : bool)
  9441. {
  9442. hasRecentlyCountered = counter;
  9443. }
  9444.  
  9445. //modSigns
  9446. timer function ResetRecentlyCountered(dt : float, id : int)
  9447. {
  9448. hasRecentlyCountered = false;
  9449. }
  9450.  
  9451. timer function CheckBlockedSkills(dt : float, id : int)
  9452. {
  9453. var nextCallTime : float;
  9454.  
  9455. nextCallTime = ((W3PlayerAbilityManager)abilityManager).CheckBlockedSkills(dt);
  9456. if(nextCallTime != -1)
  9457. AddTimer('CheckBlockedSkills', nextCallTime, , , , true);
  9458. }
  9459.  
  9460. //modSigns: reworked
  9461. public function RemoveTemporarySkills()
  9462. {
  9463. var i : int;
  9464. var pam : W3PlayerAbilityManager;
  9465.  
  9466. if(tempLearnedSignSkills.Size() > 0)
  9467. {
  9468. pam = (W3PlayerAbilityManager)abilityManager;
  9469. for(i=0; i<tempLearnedSignSkills.Size(); i+=1)
  9470. {
  9471. pam.RemoveTemporarySkill(tempLearnedSignSkills[i]);
  9472. }
  9473.  
  9474. tempLearnedSignSkills.Clear();
  9475. //theGame.witcherLog.AddMessage("Temp skills removed");
  9476. }
  9477. RemoveAbilityAll(SkillEnumToName(S_Sword_s19));
  9478. }
  9479.  
  9480. public function RemoveTemporarySkill(skill : SSimpleSkill) : bool
  9481. {
  9482. var pam : W3PlayerAbilityManager;
  9483.  
  9484. pam = (W3PlayerAbilityManager)abilityManager;
  9485. if(pam && pam.IsInitialized())
  9486. return pam.RemoveTemporarySkill(skill);
  9487.  
  9488. return false;
  9489. }
  9490.  
  9491.  
  9492. //modSigns: reworked, focus is drained in sign entity
  9493. public function AddTemporarySkills() : bool
  9494. {
  9495. tempLearnedSignSkills.Clear();
  9496. if(CanUseSkill(S_Sword_s19) && GetStat(BCS_Focus) >= 3)
  9497. {
  9498. tempLearnedSignSkills = ((W3PlayerAbilityManager)abilityManager).AddTempNonAlchemySkills();
  9499. AddAbilityMultiple(SkillEnumToName(S_Sword_s19), GetSkillLevel(S_Sword_s19));
  9500. }
  9501. return tempLearnedSignSkills.Size();
  9502. }
  9503.  
  9504.  
  9505.  
  9506. public function HasAlternateQuen() : bool
  9507. {
  9508. var quenEntity : W3QuenEntity;
  9509.  
  9510. quenEntity = (W3QuenEntity)GetCurrentSignEntity();
  9511. if(quenEntity)
  9512. {
  9513. return quenEntity.IsAlternateCast();
  9514. }
  9515.  
  9516. return false;
  9517. }
  9518.  
  9519.  
  9520.  
  9521.  
  9522.  
  9523. public function AddPoints(type : ESpendablePointType, amount : int, show : bool)
  9524. {
  9525. levelManager.AddPoints(type, amount, show);
  9526. }
  9527.  
  9528. public function GetLevel() : int {return levelManager.GetLevel();}
  9529. public function GetMaxLevel() : int {return levelManager.GetMaxLevel();}
  9530. public function GetTotalExpForNextLevel() : int {return levelManager.GetTotalExpForNextLevel();}
  9531. public function GetPointsTotal(type : ESpendablePointType) : int {return levelManager.GetPointsTotal(type);}
  9532. public function IsAutoLeveling() : bool {return autoLevel;}
  9533. public function SetAutoLeveling( b : bool ) {autoLevel = b;}
  9534.  
  9535. public function GetMissingExpForNextLevel() : int
  9536. {
  9537. return Max(0, GetTotalExpForNextLevel() - GetPointsTotal(EExperiencePoint));
  9538. }
  9539.  
  9540.  
  9541.  
  9542.  
  9543. private saved var runewordInfusionType : ESignType;
  9544. default runewordInfusionType = ST_None;
  9545.  
  9546. public final function GetRunewordInfusionType() : ESignType
  9547. {
  9548. return runewordInfusionType;
  9549. }
  9550.  
  9551.  
  9552. //modSigns: reworked
  9553. public function QuenImpulse( isAlternate : bool, signEntity : W3QuenEntity, source : string, optional forceSkillLevel : int, optional forceSpellPower : SAbilityAttributeValue )
  9554. {
  9555. var level, i, j : int;
  9556. var atts, damages : array<name>;
  9557. var ents : array<CGameplayEntity>;
  9558. var action : W3DamageAction;
  9559. var dm : CDefinitionsManagerAccessor;
  9560. var skillAbilityName : name;
  9561. var dmg : float;
  9562. var min, max : SAbilityAttributeValue;
  9563. var pos : Vector;
  9564. var spellPower : SAbilityAttributeValue;
  9565. var staminaPrc : float;
  9566.  
  9567. //forced level (for Flood of Anger)
  9568. if(forceSkillLevel > 0)
  9569. level = forceSkillLevel;
  9570. else
  9571. level = GetSkillLevel(S_Magic_s13);
  9572.  
  9573. //forced spell power (for Flood of Anger)
  9574. if(forceSpellPower.valueMultiplicative > 0)
  9575. spellPower = forceSpellPower;
  9576. else
  9577. spellPower = GetTotalSignSpellPower(S_Magic_4);
  9578.  
  9579. dm = theGame.GetDefinitionsManager();
  9580. skillAbilityName = GetSkillAbilityName(S_Magic_s13);
  9581.  
  9582. //add damage
  9583. if(level >= 2)
  9584. {
  9585. dm.GetAbilityAttributes(skillAbilityName, atts);
  9586. for(i = 0; i < atts.Size(); i += 1)
  9587. {
  9588. if(IsDamageTypeNameValid(atts[i]))
  9589. damages.PushBack(atts[i]);
  9590. }
  9591. }
  9592.  
  9593. //find enemies in range
  9594. //pos = signEntity.GetWorldPosition();
  9595. //FindGameplayEntitiesInSphere(ents, pos, 3, 1000, '', FLAG_OnlyAliveActors + FLAG_ExcludeTarget + FLAG_Attitude_Hostile + FLAG_Attitude_Neutral + FLAG_TestLineOfSight, this);
  9596. //modSigns: the above variant doesn't work properly. Use box instead of a sphere.
  9597. FindGameplayEntitiesInRange(ents, this, 3, 100, , FLAG_OnlyAliveActors + FLAG_ExcludeTarget + FLAG_Attitude_Hostile, this);
  9598.  
  9599. for(i = 0; i < ents.Size(); i += 1)
  9600. {
  9601. //debug log
  9602. //theGame.witcherLog.AddMessage("Quen impulse:");
  9603. //theGame.witcherLog.AddMessage("Target # " + (i + 1) + ": " + ents[i].GetDisplayName());
  9604.  
  9605. //init damage action, use spell power and light hit reaction
  9606. action = new W3DamageAction in theGame;
  9607. action.Initialize(this, ents[i], signEntity, source, EHRT_Light, CPS_SpellPower, false, false, true, false);
  9608. action.SetSignSkill(S_Magic_s13);
  9609. action.SetCannotReturnDamage(true);
  9610. action.SetProcessBuffsIfNoDamage(true);
  9611.  
  9612. //add damages
  9613. if(level >= 2)
  9614. {
  9615. for(j = 0; j < damages.Size(); j += 1)
  9616. {
  9617. dm.GetAbilityAttributeValue(skillAbilityName, damages[j], min, max);
  9618. //damage scales with ability level
  9619. dmg = CalculateAttributeValue(GetAttributeRandomizedValue(min, max)) * (level - 1);
  9620. if( HasGlyphwordActive( 'Glyphword 5 _Stats' ) ) //modSigns
  9621. {
  9622. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Glyphword 5 _Stats', 'glyphword5_dmg_boost', min, max );
  9623. dmg *= 1 + min.valueMultiplicative;
  9624. }
  9625.  
  9626. //debug log
  9627. //theGame.witcherLog.AddMessage("Quen impulse dmg: " + dmg + " (" + damages[j] + ")");
  9628.  
  9629. if(dmg > 0)
  9630. {
  9631. action.SetHitEffectAllTypes('hit_electric_quen');
  9632. action.AddDamage(damages[j], dmg);
  9633. }
  9634. }
  9635. }
  9636.  
  9637. //add knockdown applicator (spell power will affect knockdown chances)
  9638. if(level == 3)
  9639. action.AddEffectInfo(EET_KnockdownTypeApplicator);
  9640. //add stagger
  9641. else if(level >= 1)
  9642. action.AddEffectInfo(EET_Stagger);
  9643.  
  9644. theGame.damageMgr.ProcessAction( action );
  9645. delete action;
  9646. }
  9647.  
  9648. if(isAlternate)
  9649. {
  9650. signEntity.PlayHitEffect('quen_impulse_explode', signEntity.GetWorldRotation());
  9651. signEntity.EraseFirstTimeStamp();
  9652.  
  9653. if(level >= 2)
  9654. {
  9655. //if(IsSetBonusActive( EISB_Bear_2 ))
  9656. //{
  9657. // signEntity.PlayHitEffect('quen_electric_explode_bear_abl2', signEntity.GetWorldRotation());
  9658. //}
  9659. //else //ability changed
  9660. signEntity.PlayHitEffect('quen_electric_explode', signEntity.GetWorldRotation());
  9661. }
  9662. }
  9663. else
  9664. {
  9665. signEntity.PlayEffect('lasting_shield_impulse');
  9666. }
  9667. }
  9668.  
  9669. //modSigns
  9670. public function PlayGlyphword5FX(ent : CGameplayEntity)
  9671. {
  9672. var template : CEntityTemplate;
  9673. var component : CComponent;
  9674.  
  9675. template = (CEntityTemplate)LoadResource('glyphword_5');
  9676.  
  9677. component = ent.GetComponent('torso3effect');
  9678. if(component)
  9679. thePlayer.PlayEffect('reflection_damge', component);
  9680. else
  9681. thePlayer.PlayEffect('reflection_damge', ent);
  9682. }
  9683.  
  9684. //called after both Aard casts, after normal Igni cast, for alt Igni called at the beginning of channeling,
  9685. //after normal Yrden cast, for alt Yrden - at the end of the channeling, if it wasn't aborted,
  9686. //after normal Quen cast, for alt Quen - at the beginning of the channeling,
  9687. //after normal Axii cast, for alt Axii - at the end of the channeling, if it wasn't aborted.
  9688. //modSigns: alt Igni and alt Quen calls moved to the end of channeling.
  9689. public function OnSignCastPerformed(signType : ESignType, isAlternate : bool)
  9690. {
  9691. var items : array<SItemUniqueId>;
  9692. var weaponEnt : CEntity;
  9693. var fxName : name;
  9694. var pos : Vector;
  9695. //modSigns: new vars
  9696. //var abilityName : name;
  9697. //var abilityCount, maxStack : float;
  9698. //var min, max : SAbilityAttributeValue;
  9699. //var addAbility : bool;
  9700.  
  9701. super.OnSignCastPerformed(signType, isAlternate);
  9702.  
  9703. if(HasRunewordActive('Runeword 1 _Stats') && GetStat(BCS_Focus) >= 1.0f) //modSigns
  9704. {
  9705. DrainFocus(1.0f);
  9706. runewordInfusionType = signType;
  9707. items = inv.GetHeldWeapons();
  9708. weaponEnt = inv.GetItemEntityUnsafe(items[0]);
  9709.  
  9710.  
  9711. weaponEnt.StopEffect('runeword_aard');
  9712. weaponEnt.StopEffect('runeword_axii');
  9713. weaponEnt.StopEffect('runeword_igni');
  9714. weaponEnt.StopEffect('runeword_quen');
  9715. weaponEnt.StopEffect('runeword_yrden');
  9716.  
  9717.  
  9718. if(signType == ST_Aard)
  9719. fxName = 'runeword_aard';
  9720. else if(signType == ST_Axii)
  9721. fxName = 'runeword_axii';
  9722. else if(signType == ST_Igni)
  9723. fxName = 'runeword_igni';
  9724. else if(signType == ST_Quen)
  9725. fxName = 'runeword_quen';
  9726. else if(signType == ST_Yrden)
  9727. fxName = 'runeword_yrden';
  9728.  
  9729. weaponEnt.PlayEffect(fxName);
  9730. }
  9731.  
  9732.  
  9733. if( IsMutationActive( EPMT_Mutation6 ) && signType == ST_Aard && !isAlternate )
  9734. {
  9735. pos = GetWorldPosition() + GetWorldForward() * 2;
  9736.  
  9737. theGame.GetSurfacePostFX().AddSurfacePostFXGroup( pos, 0.f, 3.f, 2.f, 5.f, 0 );
  9738. }
  9739.  
  9740. //modSigns: ancient leshed decoction fix -> decoction changed
  9741. /*if(HasBuff(EET_Mutagen22) && IsInCombat() && IsThreatened() && !isAlternate)
  9742. {
  9743. abilityName = GetBuff(EET_Mutagen22).GetAbilityName();
  9744. abilityCount = GetAbilityCount(abilityName);
  9745.  
  9746. if(abilityCount == 0)
  9747. {
  9748. addAbility = true;
  9749. }
  9750. else
  9751. {
  9752. theGame.GetDefinitionsManager().GetAbilityAttributeValue(abilityName, 'mutagen22_max_stack', min, max);
  9753. maxStack = CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  9754.  
  9755. if(maxStack >= 0)
  9756. {
  9757. addAbility = (abilityCount < maxStack);
  9758. }
  9759. else
  9760. {
  9761. addAbility = true;
  9762. }
  9763. }
  9764.  
  9765. if(addAbility)
  9766. {
  9767. AddAbility(abilityName, true);
  9768. }
  9769. }*/
  9770.  
  9771. //modSigns
  9772. if(!HasBuff(EET_GryphonSetBonus) && IsSetBonusActive( EISB_Gryphon_1 ))
  9773. {
  9774. AddEffectDefault( EET_GryphonSetBonus, NULL, signType );
  9775. }
  9776.  
  9777. //theGame.witcherLog.AddMessage("OnSignCastPerformed: " + signType + "; isAlternate: " + isAlternate); //modSigns: debug
  9778. }
  9779.  
  9780. public saved var savedQuenHealth, savedQuenDuration : float;
  9781.  
  9782. timer function HACK_QuenSaveStatus(dt : float, id : int)
  9783. {
  9784. var quenEntity : W3QuenEntity;
  9785.  
  9786. quenEntity = (W3QuenEntity)signs[ST_Quen].entity;
  9787. savedQuenHealth = quenEntity.GetShieldHealth();
  9788. savedQuenDuration = quenEntity.GetShieldRemainingDuration();
  9789. }
  9790.  
  9791. timer function DelayedRestoreQuen(dt : float, id : int)
  9792. {
  9793. RestoreQuen(savedQuenHealth, savedQuenDuration);
  9794. }
  9795.  
  9796. public final function OnBasicQuenFinishing()
  9797. {
  9798. RemoveTimer('HACK_QuenSaveStatus');
  9799. savedQuenHealth = 0.f;
  9800. savedQuenDuration = 0.f;
  9801. }
  9802.  
  9803. public final function IsAnyQuenActive() : bool
  9804. {
  9805. var quen : W3QuenEntity;
  9806.  
  9807. quen = (W3QuenEntity)GetSignEntity(ST_Quen);
  9808. if(quen)
  9809. return quen.IsAnyQuenActive();
  9810.  
  9811. return false;
  9812. }
  9813.  
  9814. public final function IsQuenActive(alternateMode : bool) : bool
  9815. {
  9816. if(IsAnyQuenActive() && GetSignEntity(ST_Quen).IsAlternateCast() == alternateMode)
  9817. return true;
  9818.  
  9819. return false;
  9820. }
  9821.  
  9822. public function FinishQuen( skipVisuals : bool, optional forceNoBearSetBonus : bool )
  9823. {
  9824. var quen : W3QuenEntity;
  9825.  
  9826. quen = (W3QuenEntity)GetSignEntity(ST_Quen);
  9827. if(quen)
  9828. quen.ForceFinishQuen( skipVisuals, forceNoBearSetBonus );
  9829. }
  9830.  
  9831.  
  9832. public function GetTotalSignSpellPower(signSkill : ESkill) : SAbilityAttributeValue
  9833. {
  9834. var sp : SAbilityAttributeValue;
  9835. var penalty : SAbilityAttributeValue;
  9836. var penaltyReduction : float;
  9837. var penaltyReductionLevel : int;
  9838. var mutagen : CBaseGameplayEffect; //modSigns
  9839. var min, max : SAbilityAttributeValue; //modSigns
  9840.  
  9841. //character SP + spell specific skills
  9842. sp = GetSkillAttributeValue(signSkill, PowerStatEnumToName(CPS_SpellPower), true, true);
  9843.  
  9844. //skill custom
  9845. if ( signSkill == S_Magic_s01 )
  9846. {
  9847. //wave leveling penalty reduction
  9848. /*penaltyReductionLevel = GetSkillLevel(S_Magic_s01) + 1;
  9849. if(penaltyReductionLevel > 0)
  9850. {
  9851. penaltyReduction = 1 - penaltyReductionLevel * CalculateAttributeValue(GetSkillAttributeValue(S_Magic_s01, 'spell_power_penalty_reduction', true, true));
  9852. penalty = GetSkillAttributeValue(S_Magic_s01, PowerStatEnumToName(CPS_SpellPower), false, false);
  9853. sp += penalty * penaltyReduction; //add amount equal to penalty reduction (since full penalty is already applied)
  9854. }*/
  9855. //modSigns: fix percentages as they are completely off from what skill description says
  9856. penaltyReductionLevel = GetSkillLevel(S_Magic_s01) - 1;
  9857. if(penaltyReductionLevel > 0)
  9858. {
  9859. penaltyReduction = penaltyReductionLevel * CalculateAttributeValue(GetSkillAttributeValue(S_Magic_s01, 'spell_power_penalty_reduction', false, false));
  9860. //penalty was already applied, so we revert it based on penalty reduction and skill level
  9861. sp.valueMultiplicative += penaltyReduction;
  9862. }
  9863. }
  9864.  
  9865.  
  9866. if(signSkill == S_Magic_1 || signSkill == S_Magic_s01)
  9867. {
  9868. sp += GetAttributeValue('spell_power_aard');
  9869. }
  9870. else if(signSkill == S_Magic_2 || signSkill == S_Magic_s02)
  9871. {
  9872. sp += GetAttributeValue('spell_power_igni');
  9873. }
  9874. else if(signSkill == S_Magic_3 || signSkill == S_Magic_s03)
  9875. {
  9876. sp += GetAttributeValue('spell_power_yrden');
  9877. }
  9878. else if(signSkill == S_Magic_4 || signSkill == S_Magic_s04)
  9879. {
  9880. sp += GetAttributeValue('spell_power_quen');
  9881. }
  9882. else if(signSkill == S_Magic_5 || signSkill == S_Magic_s05)
  9883. {
  9884. sp += GetAttributeValue('spell_power_axii');
  9885. }
  9886.  
  9887.  
  9888. //ApplyMutation10StatBoost( sp ); //modSigns: reworked
  9889.  
  9890. //modSigns: prevent negatives
  9891. sp.valueBase = MaxF(sp.valueBase, 0);
  9892. sp.valueMultiplicative = MaxF(sp.valueMultiplicative, 0);
  9893. sp.valueAdditive = MaxF(sp.valueAdditive, 0);
  9894.  
  9895. return sp;
  9896. }
  9897.  
  9898.  
  9899.  
  9900.  
  9901.  
  9902. public final function GetGwentCardIndex( cardName : name ) : int
  9903. {
  9904. var dm : CDefinitionsManagerAccessor;
  9905.  
  9906. dm = theGame.GetDefinitionsManager();
  9907.  
  9908. if(dm.ItemHasTag( cardName , 'GwintCardLeader' ))
  9909. {
  9910. return theGame.GetGwintManager().GwentLeadersNametoInt( cardName );
  9911. }
  9912. else if(dm.ItemHasTag( cardName , 'GwintCardNrkd' ))
  9913. {
  9914. return theGame.GetGwintManager().GwentNrkdNameToInt( cardName );
  9915. }
  9916. else if(dm.ItemHasTag( cardName , 'GwintCardNlfg' ))
  9917. {
  9918. return theGame.GetGwintManager().GwentNlfgNameToInt( cardName );
  9919. }
  9920. else if(dm.ItemHasTag( cardName , 'GwintCardSctl' ))
  9921. {
  9922. return theGame.GetGwintManager().GwentSctlNameToInt( cardName );
  9923. }
  9924. else if(dm.ItemHasTag( cardName , 'GwintCardMstr' ))
  9925. {
  9926. return theGame.GetGwintManager().GwentMstrNameToInt( cardName );
  9927. }
  9928. else if(dm.ItemHasTag( cardName , 'GwintCardSke' ))
  9929. {
  9930. return theGame.GetGwintManager().GwentSkeNameToInt( cardName );
  9931. }
  9932. else if(dm.ItemHasTag( cardName , 'GwintCardNeutral' ))
  9933. {
  9934. return theGame.GetGwintManager().GwentNeutralNameToInt( cardName );
  9935. }
  9936. else if(dm.ItemHasTag( cardName , 'GwintCardSpcl' ))
  9937. {
  9938. return theGame.GetGwintManager().GwentSpecialNameToInt( cardName );
  9939. }
  9940.  
  9941. return -1;
  9942. }
  9943.  
  9944. public final function AddGwentCard(cardName : name, amount : int) : bool
  9945. {
  9946. var dm : CDefinitionsManagerAccessor;
  9947. var cardIndex, i : int;
  9948. var tut : STutorialMessage;
  9949. var gwintManager : CR4GwintManager;
  9950.  
  9951.  
  9952.  
  9953. if(FactsQuerySum("q001_nightmare_ended") > 0 && ShouldProcessTutorial('TutorialGwentDeckBuilder2'))
  9954. {
  9955. tut.type = ETMT_Hint;
  9956. tut.tutorialScriptTag = 'TutorialGwentDeckBuilder2';
  9957. tut.journalEntryName = 'TutorialGwentDeckBuilder2';
  9958. tut.hintPositionType = ETHPT_DefaultGlobal;
  9959. tut.markAsSeenOnShow = true;
  9960. tut.hintDurationType = ETHDT_Long;
  9961.  
  9962. theGame.GetTutorialSystem().DisplayTutorial(tut);
  9963. }
  9964.  
  9965. dm = theGame.GetDefinitionsManager();
  9966.  
  9967. cardIndex = GetGwentCardIndex(cardName);
  9968.  
  9969. if (cardIndex != -1)
  9970. {
  9971. FactsAdd("Gwint_Card_Looted");
  9972.  
  9973. for(i = 0; i < amount; i += 1)
  9974. {
  9975. theGame.GetGwintManager().AddCardToCollection( cardIndex );
  9976. }
  9977. }
  9978.  
  9979. if( dm.ItemHasTag( cardName, 'GwentTournament' ) )
  9980. {
  9981. if ( dm.ItemHasTag( cardName, 'GT1' ) )
  9982. {
  9983. FactsAdd( "GwentTournament", 1 );
  9984. }
  9985.  
  9986. else if ( dm.ItemHasTag( cardName, 'GT2' ) )
  9987. {
  9988. FactsAdd( "GwentTournament", 2 );
  9989. }
  9990.  
  9991. else if ( dm.ItemHasTag( cardName, 'GT3' ) )
  9992. {
  9993. FactsAdd( "GwentTournament", 3 );
  9994. }
  9995.  
  9996. else if ( dm.ItemHasTag( cardName, 'GT4' ) )
  9997. {
  9998. FactsAdd( "GwentTournament", 4 );
  9999. }
  10000.  
  10001. else if ( dm.ItemHasTag( cardName, 'GT5' ) )
  10002. {
  10003. FactsAdd( "GwentTournament", 5 );
  10004. }
  10005.  
  10006. else if ( dm.ItemHasTag( cardName, 'GT6' ) )
  10007. {
  10008. FactsAdd( "GwentTournament", 6 );
  10009. }
  10010.  
  10011. else if ( dm.ItemHasTag( cardName, 'GT7' ) )
  10012. {
  10013. FactsAdd( "GwentTournament", 7 );
  10014. }
  10015.  
  10016. CheckGwentTournamentDeck();
  10017. }
  10018.  
  10019. if( dm.ItemHasTag( cardName, 'EP2Tournament' ) )
  10020. {
  10021. if ( dm.ItemHasTag( cardName, 'GT1' ) )
  10022. {
  10023. FactsAdd( "EP2Tournament", 1 );
  10024. }
  10025.  
  10026. else if ( dm.ItemHasTag( cardName, 'GT2' ) )
  10027. {
  10028. FactsAdd( "EP2Tournament", 2 );
  10029. }
  10030.  
  10031. else if ( dm.ItemHasTag( cardName, 'GT3' ) )
  10032. {
  10033. FactsAdd( "EP2Tournament", 3 );
  10034. }
  10035.  
  10036. else if ( dm.ItemHasTag( cardName, 'GT4' ) )
  10037. {
  10038. FactsAdd( "EP2Tournament", 4 );
  10039. }
  10040.  
  10041. else if ( dm.ItemHasTag( cardName, 'GT5' ) )
  10042. {
  10043. FactsAdd( "EP2Tournament", 5 );
  10044. }
  10045.  
  10046. else if ( dm.ItemHasTag( cardName, 'GT6' ) )
  10047. {
  10048. FactsAdd( "EP2Tournament", 6 );
  10049. }
  10050.  
  10051. else if ( dm.ItemHasTag( cardName, 'GT7' ) )
  10052. {
  10053. FactsAdd( "EP2Tournament", 7 );
  10054. }
  10055.  
  10056. CheckEP2TournamentDeck();
  10057. }
  10058.  
  10059. gwintManager = theGame.GetGwintManager();
  10060. if( !gwintManager.IsDeckUnlocked( GwintFaction_Skellige ) &&
  10061. gwintManager.HasCardsOfFactionInCollection( GwintFaction_Skellige, false ) )
  10062. {
  10063. gwintManager.UnlockDeck( GwintFaction_Skellige );
  10064. }
  10065.  
  10066. return true;
  10067. }
  10068.  
  10069.  
  10070. public final function RemoveGwentCard(cardName : name, amount : int) : bool
  10071. {
  10072. var dm : CDefinitionsManagerAccessor;
  10073. var cardIndex, i : int;
  10074.  
  10075. dm = theGame.GetDefinitionsManager();
  10076.  
  10077. if(dm.ItemHasTag( cardName , 'GwintCardLeader' ))
  10078. {
  10079. cardIndex = theGame.GetGwintManager().GwentLeadersNametoInt( cardName );
  10080. for(i=0; i<amount; i+=1)
  10081. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  10082. }
  10083. else if(dm.ItemHasTag( cardName , 'GwintCardNrkd' ))
  10084. {
  10085. cardIndex = theGame.GetGwintManager().GwentNrkdNameToInt( cardName );
  10086. for(i=0; i<amount; i+=1)
  10087. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  10088. }
  10089. else if(dm.ItemHasTag( cardName , 'GwintCardNlfg' ))
  10090. {
  10091. cardIndex = theGame.GetGwintManager().GwentNlfgNameToInt( cardName );
  10092. for(i=0; i<amount; i+=1)
  10093. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  10094. }
  10095. else if(dm.ItemHasTag( cardName , 'GwintCardSctl' ))
  10096. {
  10097. cardIndex = theGame.GetGwintManager().GwentSctlNameToInt( cardName );
  10098. for(i=0; i<amount; i+=1)
  10099. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  10100. }
  10101. else if(dm.ItemHasTag( cardName , 'GwintCardMstr' ))
  10102. {
  10103. cardIndex = theGame.GetGwintManager().GwentMstrNameToInt( cardName );
  10104. for(i=0; i<amount; i+=1)
  10105. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  10106. }
  10107. else if(dm.ItemHasTag( cardName , 'GwintCardNeutral' ))
  10108. {
  10109. cardIndex = theGame.GetGwintManager().GwentNeutralNameToInt( cardName );
  10110. for(i=0; i<amount; i+=1)
  10111. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  10112. }
  10113. else if(dm.ItemHasTag( cardName , 'GwintCardSpcl' ))
  10114. {
  10115. cardIndex = theGame.GetGwintManager().GwentSpecialNameToInt( cardName );
  10116. for(i=0; i<amount; i+=1)
  10117. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  10118. }
  10119.  
  10120. if( dm.ItemHasTag( cardName, 'GwentTournament' ) )
  10121. {
  10122. if ( dm.ItemHasTag( cardName, 'GT1' ) )
  10123. {
  10124. FactsSubstract( "GwentTournament", 1 );
  10125. }
  10126.  
  10127. else if ( dm.ItemHasTag( cardName, 'GT2' ) )
  10128. {
  10129. FactsSubstract( "GwentTournament", 2 );
  10130. }
  10131.  
  10132. else if ( dm.ItemHasTag( cardName, 'GT3' ) )
  10133. {
  10134. FactsSubstract( "GwentTournament", 3 );
  10135. }
  10136.  
  10137. else if ( dm.ItemHasTag( cardName, 'GT4' ) )
  10138. {
  10139. FactsSubstract( "GwentTournament", 4 );
  10140. }
  10141.  
  10142. else if ( dm.ItemHasTag( cardName, 'GT5' ) )
  10143. {
  10144. FactsSubstract( "GwentTournament", 5 );
  10145. }
  10146.  
  10147. else if ( dm.ItemHasTag( cardName, 'GT6' ) )
  10148. {
  10149. FactsSubstract( "GwentTournament", 6 );
  10150. }
  10151.  
  10152. else if ( dm.ItemHasTag( cardName, 'GT7' ) )
  10153. {
  10154. FactsSubstract( "GwentTournament", 7 );
  10155. }
  10156.  
  10157. CheckGwentTournamentDeck();
  10158. }
  10159.  
  10160.  
  10161. if( dm.ItemHasTag( cardName, 'EP2Tournament' ) )
  10162. {
  10163. if ( dm.ItemHasTag( cardName, 'GT1' ) )
  10164. {
  10165. FactsSubstract( "EP2Tournament", 1 );
  10166. }
  10167.  
  10168. else if ( dm.ItemHasTag( cardName, 'GT2' ) )
  10169. {
  10170. FactsSubstract( "EP2Tournament", 2 );
  10171. }
  10172.  
  10173. else if ( dm.ItemHasTag( cardName, 'GT3' ) )
  10174. {
  10175. FactsSubstract( "EP2Tournament", 3 );
  10176. }
  10177.  
  10178. else if ( dm.ItemHasTag( cardName, 'GT4' ) )
  10179. {
  10180. FactsSubstract( "EP2Tournament", 4 );
  10181. }
  10182.  
  10183. else if ( dm.ItemHasTag( cardName, 'GT5' ) )
  10184. {
  10185. FactsSubstract( "EP2Tournament", 5 );
  10186. }
  10187.  
  10188. else if ( dm.ItemHasTag( cardName, 'GT6' ) )
  10189. {
  10190. FactsSubstract( "EP2Tournament", 6 );
  10191. }
  10192.  
  10193. else if ( dm.ItemHasTag( cardName, 'GT7' ) )
  10194. {
  10195. FactsSubstract( "EP2Tournament", 7 );
  10196. }
  10197.  
  10198. CheckEP2TournamentDeck();
  10199. }
  10200.  
  10201. return true;
  10202. }
  10203.  
  10204. function CheckGwentTournamentDeck()
  10205. {
  10206. var gwentPower : int;
  10207. var neededGwentPower : int;
  10208. var checkBreakpoint : int;
  10209.  
  10210. neededGwentPower = 70;
  10211.  
  10212. checkBreakpoint = neededGwentPower/5;
  10213. gwentPower = FactsQuerySum( "GwentTournament" );
  10214.  
  10215. if ( gwentPower >= neededGwentPower )
  10216. {
  10217. FactsAdd( "HasGwentTournamentDeck", 1 );
  10218. }
  10219. else
  10220. {
  10221. if( FactsDoesExist( "HasGwentTournamentDeck" ) )
  10222. {
  10223. FactsRemove( "HasGwentTournamentDeck" );
  10224. }
  10225.  
  10226. if ( gwentPower >= checkBreakpoint )
  10227. {
  10228. FactsAdd( "GwentTournamentObjective1", 1 );
  10229. }
  10230. else if ( FactsDoesExist( "GwentTournamentObjective1" ) )
  10231. {
  10232. FactsRemove( "GwentTournamentObjective1" );
  10233. }
  10234.  
  10235. if ( gwentPower >= checkBreakpoint*2 )
  10236. {
  10237. FactsAdd( "GwentTournamentObjective2", 1 );
  10238. }
  10239. else if ( FactsDoesExist( "GwentTournamentObjective2" ) )
  10240. {
  10241. FactsRemove( "GwentTournamentObjective2" );
  10242. }
  10243.  
  10244. if ( gwentPower >= checkBreakpoint*3 )
  10245. {
  10246. FactsAdd( "GwentTournamentObjective3", 1 );
  10247. }
  10248. else if ( FactsDoesExist( "GwentTournamentObjective3" ) )
  10249. {
  10250. FactsRemove( "GwentTournamentObjective3" );
  10251. }
  10252.  
  10253. if ( gwentPower >= checkBreakpoint*4 )
  10254. {
  10255. FactsAdd( "GwentTournamentObjective4", 1 );
  10256. }
  10257. else if ( FactsDoesExist( "GwentTournamentObjective4" ) )
  10258. {
  10259. FactsRemove( "GwentTournamentObjective4" );
  10260. }
  10261. }
  10262. }
  10263.  
  10264. function CheckEP2TournamentDeck()
  10265. {
  10266. var gwentPower : int;
  10267. var neededGwentPower : int;
  10268. var checkBreakpoint : int;
  10269.  
  10270. neededGwentPower = 24;
  10271.  
  10272. checkBreakpoint = neededGwentPower/5;
  10273. gwentPower = FactsQuerySum( "EP2Tournament" );
  10274.  
  10275. if ( gwentPower >= neededGwentPower )
  10276. {
  10277. if( FactsQuerySum( "HasEP2TournamentDeck") == 0 )
  10278. {
  10279. FactsAdd( "HasEP2TournamentDeck", 1 );
  10280. }
  10281.  
  10282. }
  10283. else
  10284. {
  10285. if( FactsDoesExist( "HasEP2TournamentDeck" ) )
  10286. {
  10287. FactsRemove( "HasEP2TournamentDeck" );
  10288. }
  10289.  
  10290. if ( gwentPower >= checkBreakpoint )
  10291. {
  10292. FactsAdd( "EP2TournamentObjective1", 1 );
  10293. }
  10294. else if ( FactsDoesExist( "EP2TournamentObjective1" ) )
  10295. {
  10296. FactsRemove( "EP2TournamentObjective1" );
  10297. }
  10298.  
  10299. if ( gwentPower >= checkBreakpoint*2 )
  10300. {
  10301. FactsAdd( "EP2TournamentObjective2", 1 );
  10302. }
  10303. else if ( FactsDoesExist( "EP2TournamentObjective2" ) )
  10304. {
  10305. FactsRemove( "EP2TournamentObjective2" );
  10306. }
  10307.  
  10308. if ( gwentPower >= checkBreakpoint*3 )
  10309. {
  10310. FactsAdd( "EP2TournamentObjective3", 1 );
  10311. }
  10312. else if ( FactsDoesExist( "EP2TournamentObjective3" ) )
  10313. {
  10314. FactsRemove( "EP2TournamentObjective3" );
  10315. }
  10316.  
  10317. if ( gwentPower >= checkBreakpoint*4 )
  10318. {
  10319. FactsAdd( "EP2TournamentObjective4", 1 );
  10320. }
  10321. else if ( FactsDoesExist( "EP2TournamentObjective4" ) )
  10322. {
  10323. FactsRemove( "EP2TournamentObjective4" );
  10324. }
  10325. }
  10326. }
  10327.  
  10328.  
  10329.  
  10330.  
  10331.  
  10332.  
  10333. //---=== modFriendlyMeditation ===---
  10334. public function IsMeditating() : bool
  10335. {
  10336. return ( GetCurrentStateName() == 'Meditation' );
  10337. }
  10338.  
  10339. public function IsSkippingTime() : bool
  10340. {
  10341. return ( GetCurrentStateName() == 'MeditationWaiting' );
  10342. }
  10343.  
  10344. public function UpdateEffectsAccelerated( realTimeSecs, acceleration : float )
  10345. {
  10346. effectManager.PerformUpdate( realTimeSecs * acceleration );
  10347. }
  10348. //---=== modFriendlyMeditation ===---
  10349.  
  10350. public function SimulateBuffTimePassing(simulatedTime : float)
  10351. {
  10352. super.SimulateBuffTimePassing(simulatedTime);
  10353.  
  10354. FinishQuen(true);
  10355. }
  10356.  
  10357.  
  10358. public function CanMeditate() : bool
  10359. {
  10360. var currentStateName : name;
  10361.  
  10362. currentStateName = GetCurrentStateName();
  10363.  
  10364.  
  10365. if(currentStateName == 'Exploration' && !CanPerformPlayerAction())
  10366. return false;
  10367.  
  10368.  
  10369. if(GetCurrentStateName() != 'Exploration' && GetCurrentStateName() != 'Meditation' && GetCurrentStateName() != 'MeditationWaiting')
  10370. return false;
  10371.  
  10372.  
  10373. if(GetUsedVehicle())
  10374. return false;
  10375.  
  10376.  
  10377. return CanMeditateHere();
  10378. }
  10379.  
  10380.  
  10381. public final function CanMeditateWait(optional skipMeditationStateCheck : bool) : bool
  10382. {
  10383. var currState : name;
  10384.  
  10385. currState = GetCurrentStateName();
  10386.  
  10387.  
  10388.  
  10389. if(!skipMeditationStateCheck && currState != 'Meditation')
  10390. return false;
  10391.  
  10392.  
  10393. if(theGame.IsGameTimePaused())
  10394. return false;
  10395.  
  10396. if(!IsActionAllowed( EIAB_MeditationWaiting ))
  10397. return false;
  10398.  
  10399. return true;
  10400. }
  10401.  
  10402.  
  10403. public final function CanMeditateHere() : bool
  10404. {
  10405. var pos : Vector;
  10406.  
  10407. pos = GetWorldPosition();
  10408. if(pos.Z <= theGame.GetWorld().GetWaterLevel(pos, true) && IsInShallowWater())
  10409. return false;
  10410.  
  10411. if(IsThreatened())
  10412. return false;
  10413.  
  10414. return true;
  10415. }
  10416.  
  10417.  
  10418. public function Meditate() : bool
  10419. {
  10420. //---=== modFriendlyMeditation ===---
  10421. //var medState : W3PlayerWitcherStateMeditation;
  10422. //var stateName : name;
  10423. //
  10424. //stateName = GetCurrentStateName();
  10425. //
  10426. //
  10427. //if (!CanMeditate() || stateName == 'MeditationWaiting' )
  10428. // return false;
  10429. //
  10430. //GotoState('Meditation');
  10431. //medState = (W3PlayerWitcherStateMeditation)GetState('Meditation');
  10432. //medState.SetMeditationPointHeading(GetHeading());
  10433. //
  10434. //return true;
  10435.  
  10436. if ( !ModCanMeditate() )
  10437. return false;
  10438.  
  10439. theGame.RequestMenuWithBackground( 'MeditationClockMenu', 'CommonMenu' );
  10440.  
  10441. return true;
  10442. //---=== modFriendlyMeditation ===---
  10443. }
  10444.  
  10445.  
  10446. public final function MeditationRestoring(simulatedTime : float)
  10447. {
  10448.  
  10449. if ( theGame.GetDifficultyMode() != EDM_Hard && theGame.GetDifficultyMode() != EDM_Hardcore )
  10450. {
  10451. Heal(GetStatMax(BCS_Vitality));
  10452. }
  10453.  
  10454.  
  10455. abilityManager.DrainToxicity( abilityManager.GetStat( BCS_Toxicity ) );
  10456. abilityManager.DrainFocus( abilityManager.GetStat( BCS_Focus ) );
  10457.  
  10458.  
  10459. inv.SingletonItemsRefillAmmo();
  10460.  
  10461.  
  10462. SimulateBuffTimePassing(simulatedTime);
  10463.  
  10464.  
  10465. ApplyWitcherHouseBuffs();
  10466. }
  10467.  
  10468. var clockMenu : CR4MeditationClockMenu;
  10469.  
  10470. public function MeditationClockStart(m : CR4MeditationClockMenu)
  10471. {
  10472. clockMenu = m;
  10473. AddTimer('UpdateClockTime',0.1,true);
  10474. }
  10475.  
  10476. public function MeditationClockStop()
  10477. {
  10478. clockMenu = NULL;
  10479. RemoveTimer('UpdateClockTime');
  10480. }
  10481.  
  10482. public timer function UpdateClockTime(dt : float, id : int)
  10483. {
  10484. if(clockMenu)
  10485. clockMenu.UpdateCurrentHours();
  10486. else
  10487. RemoveTimer('UpdateClockTime');
  10488. }
  10489.  
  10490. private var waitTimeHour : int;
  10491. public function SetWaitTargetHour(t : int)
  10492. {
  10493. waitTimeHour = t;
  10494. }
  10495. public function GetWaitTargetHour() : int
  10496. {
  10497. return waitTimeHour;
  10498. }
  10499.  
  10500. public function MeditationForceAbort(forceCloseUI : bool)
  10501. {
  10502. //---=== modFriendlyMeditation ===---
  10503. //var waitt : W3PlayerWitcherStateMeditationWaiting;
  10504. //var medd : W3PlayerWitcherStateMeditation;
  10505. //var currentStateName : name;
  10506. //
  10507. //currentStateName = GetCurrentStateName();
  10508. //
  10509. //if(currentStateName == 'MeditationWaiting')
  10510. //{
  10511. // waitt = (W3PlayerWitcherStateMeditationWaiting)GetCurrentState();
  10512. // if(waitt)
  10513. // {
  10514. // waitt.StopRequested(forceCloseUI);
  10515. // }
  10516. //}
  10517. //else if(currentStateName == 'Meditation')
  10518. //{
  10519. // medd = (W3PlayerWitcherStateMeditation)GetCurrentState();
  10520. // if(medd)
  10521. // {
  10522. // medd.StopRequested(forceCloseUI);
  10523. // }
  10524. //}
  10525. ModEndMeditation();
  10526. //---=== modFriendlyMeditation ===---
  10527.  
  10528.  
  10529.  
  10530. if(forceCloseUI && theGame.GetGuiManager().IsAnyMenu())
  10531. {
  10532. theGame.GetGuiManager().GetRootMenu().CloseMenu();
  10533. DisplayActionDisallowedHudMessage(EIAB_MeditationWaiting, false, false, true, false);
  10534. }
  10535. }
  10536.  
  10537. //---=== modFriendlyMeditation ===---
  10538. public function ModCanMeditate(optional isPlayerMeditatingInBed : bool) : bool
  10539. {
  10540. if( isPlayerMeditatingInBed )
  10541. return true;
  10542.  
  10543. //checking everything for Preparations compatibility
  10544. if( !CanMeditate() )
  10545. return false;
  10546.  
  10547. if( !CanMeditateWait(true) )
  10548. return false;
  10549.  
  10550. if( !CanMeditateHere() )
  10551. return false;
  10552.  
  10553. if( !ModCanMeditateHereExt() )
  10554. return false;
  10555.  
  10556. return true;
  10557. }
  10558.  
  10559. public function ModCanMeditateHereExt() : bool
  10560. {
  10561. if( IsUsingVehicle() || IsSwimming () || IsDiving() )
  10562. return false;
  10563.  
  10564. if( ((CMovingPhysicalAgentComponent)GetMovingAgentComponent()).GetSubmergeDepth() < 0 )
  10565. return false;
  10566.  
  10567. return true;
  10568. }
  10569.  
  10570. public function ModStartMeditation(optional isPlayerMeditatingInBed : bool, optional isFromClock : bool, optional endTime : float) : bool
  10571. {
  10572. if( !ModCanMeditate(isPlayerMeditatingInBed) )
  10573. return false;
  10574.  
  10575. if( theGame.GetGuiManager().IsAnyMenu() )
  10576. theGame.GetGuiManager().GetRootMenu().CloseMenu();
  10577.  
  10578. if( !IsMeditating() && !IsSkippingTime() )
  10579. {
  10580. medIsPlayerMeditatingInBed = isPlayerMeditatingInBed;
  10581. medIsFromClock = isFromClock;
  10582. medEndTime = endTime;
  10583. SetBehaviorVariable('MeditateAbort', 0);
  10584. PushState('Meditation');
  10585. return true;
  10586. }
  10587. else
  10588. {
  10589. if( IsSkippingTime() )
  10590. {
  10591. MeditationEndFastforward();
  10592. }
  10593. if( IsMeditating() )
  10594. {
  10595. medIsPlayerMeditatingInBed = isPlayerMeditatingInBed;
  10596. medIsFromClock = isFromClock;
  10597. medEndTime = endTime;
  10598. SetBehaviorVariable('MeditateAbort', 0);
  10599. if( isFromClock )
  10600. ((W3PlayerWitcherStateMeditation)GetState( 'Meditation' )).StartFastforward();
  10601. return true;
  10602. }
  10603. }
  10604.  
  10605. return false;
  10606. }
  10607.  
  10608. public function ModEndMeditation()
  10609. {
  10610. if( IsMeditating() || IsSkippingTime() )
  10611. {
  10612. SetBehaviorVariable('MeditateAbort', 1);
  10613. PopState();
  10614. medIsPlayerMeditatingInBed = false;
  10615. medIsFromClock = false;
  10616. medEndTime = -1;
  10617. if( theGame.GetGuiManager().IsAnyMenu() )
  10618. theGame.GetGuiManager().GetRootMenu().CloseMenu();
  10619. }
  10620. }
  10621.  
  10622. private var medIsPlayerMeditatingInBed : bool;
  10623. default medIsPlayerMeditatingInBed = false;
  10624. public function GetIsPlayerMeditatingInBed() : bool
  10625. {
  10626. return medIsPlayerMeditatingInBed;
  10627. }
  10628.  
  10629. private var medEndTime : float;
  10630. default medEndTime = -1;
  10631. public function GetMeditationTargetTime() : float
  10632. {
  10633. return medEndTime;
  10634. }
  10635.  
  10636. private var medIsFromClock : bool;
  10637. default medIsFromClock = false;
  10638. public function GetMeditationStartedByClock() : bool
  10639. {
  10640. return medIsFromClock;
  10641. }
  10642.  
  10643. public function MeditationRefill( gameTimeSecs : float ) : bool
  10644. {
  10645. if ( fmedAutorefillAlchemy && gameTimeSecs >= fmedRefillIntervalSeconds )
  10646. {
  10647. inv.SingletonItemsRefillAmmo();
  10648. return true;
  10649. }
  10650. return false;
  10651. }
  10652.  
  10653. public function CheckWitcherHouseBuffs( gameTimeSecs : float ) : bool
  10654. {
  10655. if ( fmedApplyWitcherHouseBuffs && GetIsPlayerMeditatingInBed() && CeilF(gameTimeSecs/3600.0) >= fmedWitcherHouseBuffsHours )
  10656. {
  10657. ApplyWitcherHouseBuffs();
  10658. return true;
  10659. }
  10660. return false;
  10661. }
  10662.  
  10663. timer function DeSpawnCampFireTimer(dt : float, id : int)
  10664. {
  10665. spawnedCampFire.ToggleFire( false );
  10666. spawnedCampFire.Destroy();
  10667. spawnedCampFire = NULL;
  10668. }
  10669.  
  10670. public function MeditationStartFastforward()
  10671. {
  10672. if( IsMeditating() )
  10673. {
  10674. medIsFromClock = false;
  10675. ((W3PlayerWitcherStateMeditation)GetState( 'Meditation' )).StartFastforward();
  10676. }
  10677. }
  10678.  
  10679. public function MeditationEndFastforward()
  10680. {
  10681. if( IsSkippingTime() )
  10682. {
  10683. ((W3PlayerWitcherStateMeditation)GetState( 'Meditation' )).EndFastforward();
  10684. medIsFromClock = false;
  10685. }
  10686. }
  10687. //---=== modFriendlyMeditation ===---
  10688.  
  10689. public function Runeword10Triggerred()
  10690. {
  10691. var min, max : SAbilityAttributeValue;
  10692.  
  10693. //modSigns
  10694. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Runeword 10 _Stats', 'health', min, max );
  10695. GainStat(BCS_Vitality, min.valueMultiplicative * GetStatMax(BCS_Vitality));
  10696. PlayEffect('runeword_10_stamina');
  10697. }
  10698.  
  10699. public function Runeword12Triggerred()
  10700. {
  10701. var min, max : SAbilityAttributeValue;
  10702.  
  10703. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Runeword 12 _Stats', 'focus', min, max );
  10704. //GainStat(BCS_Focus, RandRangeF(max.valueAdditive, min.valueAdditive));
  10705. GainStat(BCS_Focus, min.valueAdditive); //modSigns
  10706. PlayEffect('runeword_20_adrenaline');
  10707. }
  10708.  
  10709. /*var runeword10TriggerredOnFinisher, runeword12TriggerredOnFinisher : bool;
  10710.  
  10711. event OnFinisherStart()
  10712. {
  10713. super.OnFinisherStart();
  10714.  
  10715. runeword10TriggerredOnFinisher = false;
  10716. runeword12TriggerredOnFinisher = false;
  10717. }*/ //modSigns
  10718.  
  10719. public function ApplyWitcherHouseBuffs()
  10720. {
  10721. var l_bed : W3WitcherBed;
  10722.  
  10723. if( FactsQuerySum( "PlayerInsideInnerWitcherHouse" ) > 0 )
  10724. {
  10725. l_bed = (W3WitcherBed)theGame.GetEntityByTag( 'witcherBed' );
  10726.  
  10727. if( l_bed.GetWasUsed() )
  10728. {
  10729. if( l_bed.GetBedLevel() != 0 )
  10730. {
  10731. AddEffectDefault( EET_WellRested, this, "Bed Buff" );
  10732. }
  10733.  
  10734. if( FactsQuerySum( "StablesExists" ) )
  10735. {
  10736. AddEffectDefault( EET_HorseStableBuff, this, "Stables" );
  10737. }
  10738.  
  10739. if( l_bed.GetWereItemsRefilled() )
  10740. {
  10741. theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt( "message_common_alchemy_table_buff_applied" ),, true );
  10742. l_bed.SetWereItemsRefilled( false );
  10743. }
  10744.  
  10745. AddEffectDefault( EET_BookshelfBuff, this, "Bookshelf" );
  10746.  
  10747. Heal( GetStatMax( BCS_Vitality ) );
  10748. }
  10749. }
  10750. }
  10751.  
  10752.  
  10753.  
  10754.  
  10755.  
  10756. public function CheatResurrect()
  10757. {
  10758. super.CheatResurrect();
  10759. theGame.ReleaseNoSaveLock(theGame.deathSaveLockId);
  10760. theInput.RestoreContext( 'Exploration', true );
  10761. }
  10762.  
  10763.  
  10764. public function Debug_EquipTestingSkills(equip : bool, force : bool)
  10765. {
  10766. var skills : array<ESkill>;
  10767. var i, slot : int;
  10768.  
  10769.  
  10770. ((W3PlayerAbilityManager)abilityManager).OnLevelGained(36);
  10771.  
  10772. skills.PushBack(S_Magic_s01);
  10773. skills.PushBack(S_Magic_s02);
  10774. skills.PushBack(S_Magic_s03);
  10775. skills.PushBack(S_Magic_s04);
  10776. skills.PushBack(S_Magic_s05);
  10777. skills.PushBack(S_Sword_s01);
  10778. skills.PushBack(S_Sword_s02);
  10779.  
  10780.  
  10781. if(equip)
  10782. {
  10783. for(i=0; i<skills.Size(); i+=1)
  10784. {
  10785. if(!force && IsSkillEquipped(skills[i]))
  10786. continue;
  10787.  
  10788.  
  10789. if(GetSkillLevel(skills[i]) == 0)
  10790. AddSkill(skills[i]);
  10791.  
  10792.  
  10793. if(force)
  10794. slot = i+1;
  10795. else
  10796. slot = GetFreeSkillSlot();
  10797.  
  10798.  
  10799. EquipSkill(skills[i], slot);
  10800. }
  10801. }
  10802. else
  10803. {
  10804. for(i=0; i<skills.Size(); i+=1)
  10805. {
  10806. UnequipSkill(GetSkillSlotID(skills[i]));
  10807. }
  10808. }
  10809. }
  10810.  
  10811. //modSigns
  10812. public function Debug_RestoreMutagensSpent()
  10813. {
  10814. var total : array<int>;
  10815.  
  10816. total = ((W3PlayerAbilityManager)abilityManager).GetMutationsUsedMutagens();
  10817.  
  10818. if(total[0] > 0) inv.AddAnItem('Greater mutagen red', total[0]);
  10819. if(total[1] > 0) inv.AddAnItem('Greater mutagen blue', total[1]);
  10820. if(total[2] > 0) inv.AddAnItem('Greater mutagen green', total[2]);
  10821. }
  10822.  
  10823. //modSigns
  10824. public function Debug_ClearCharacterDevelopment( optional resetLevels : bool )
  10825. {
  10826. var template : CEntityTemplate;
  10827. var entity : CEntity;
  10828. var invTesting : CInventoryComponent;
  10829. var i, totalExp, currentLevel, totalSkillPoints : int;
  10830. var items : array<SItemUniqueId>;
  10831. var abs : array<name>;
  10832. var isMutationSystemEnabled : bool;
  10833.  
  10834. ForceSetStat(BCS_Toxicity, 0);
  10835.  
  10836. UnequipItemFromSlot(EES_SilverSword);
  10837. UnequipItemFromSlot(EES_SteelSword);
  10838. UnequipItemFromSlot(EES_Bolt);
  10839. UnequipItemFromSlot(EES_RangedWeapon);
  10840. UnequipItemFromSlot(EES_Armor);
  10841. UnequipItemFromSlot(EES_Boots);
  10842. UnequipItemFromSlot(EES_Pants);
  10843. UnequipItemFromSlot(EES_Gloves);
  10844. UnequipItemFromSlot(EES_Petard1);
  10845. UnequipItemFromSlot(EES_Petard2);
  10846. UnequipItemFromSlot(EES_Quickslot1);
  10847. UnequipItemFromSlot(EES_Quickslot2);
  10848. UnequipItemFromSlot(EES_Potion1);
  10849. UnequipItemFromSlot(EES_Potion2);
  10850. UnequipItemFromSlot(EES_Potion3);
  10851. UnequipItemFromSlot(EES_Potion4);
  10852. UnequipItemFromSlot(EES_Mask);
  10853. UnequipItemFromSlot(EES_SkillMutagen1);
  10854. UnequipItemFromSlot(EES_SkillMutagen2);
  10855. UnequipItemFromSlot(EES_SkillMutagen3);
  10856. UnequipItemFromSlot(EES_SkillMutagen4);
  10857. HorseUnequipItem(EES_HorseBlinders);
  10858. HorseUnequipItem(EES_HorseSaddle);
  10859. HorseUnequipItem(EES_HorseBag);
  10860. HorseUnequipItem(EES_HorseTrophy);
  10861.  
  10862. currentLevel = levelManager.GetLevel();
  10863. totalExp = levelManager.GetPointsTotal(EExperiencePoint);
  10864. totalSkillPoints = levelManager.GetPointsTotal(ESkillPoint);
  10865. isMutationSystemEnabled = ((W3PlayerAbilityManager)abilityManager).IsMutationSystemEnabled();
  10866.  
  10867. Debug_RestoreMutagensSpent();
  10868.  
  10869. GetCharacterStats().GetAbilities(abs, false);
  10870. for(i = 0; i < abs.Size(); i+=1)
  10871. RemoveAbility(abs[i]);
  10872.  
  10873. abs.Clear();
  10874. GetCharacterStatsParam(abs);
  10875. for(i = 0; i < abs.Size(); i +=1 )
  10876. AddAbility(abs[i]);
  10877.  
  10878. delete levelManager;
  10879. levelManager = new W3LevelManager in this;
  10880. levelManager.Initialize();
  10881. levelManager.PostInit(this, false, true);
  10882.  
  10883. if(!resetLevels)
  10884. {
  10885. levelManager.AddPoints(EExperiencePoint, totalExp, false, true);
  10886. levelManager.AddPoints(ESkillPoint, Max(0, totalSkillPoints - levelManager.GetPointsTotal(ESkillPoint)), false);
  10887. }
  10888.  
  10889. delete abilityManager;
  10890. SetAbilityManager();
  10891. abilityManager.Init(this, GetCharacterStats(), false, theGame.GetDifficultyMode());
  10892.  
  10893. delete effectManager;
  10894. SetEffectManager();
  10895.  
  10896. abilityManager.PostInit();
  10897. ((W3PlayerAbilityManager)abilityManager).MutationSystemEnable(isMutationSystemEnabled);
  10898. }
  10899.  
  10900. function Debug_BearSetBonusQuenSkills()
  10901. {
  10902. var skills : array<ESkill>;
  10903. var i, slot : int;
  10904.  
  10905. skills.PushBack(S_Magic_s04);
  10906. skills.PushBack(S_Magic_s14);
  10907.  
  10908. for(i=0; i<skills.Size(); i+=1)
  10909. {
  10910.  
  10911. if(GetSkillLevel(skills[i]) == 0)
  10912. {
  10913. AddSkill(skills[i]);
  10914. }
  10915.  
  10916. slot = GetFreeSkillSlot();
  10917.  
  10918.  
  10919. EquipSkill(skills[i], slot);
  10920. }
  10921. }
  10922.  
  10923. final function Debug_HAX_UnlockSkillSlot(slotIndex : int) : bool
  10924. {
  10925. if(abilityManager && abilityManager.IsInitialized())
  10926. return ((W3PlayerAbilityManager)abilityManager).Debug_HAX_UnlockSkillSlot(slotIndex);
  10927.  
  10928. return false;
  10929. }
  10930.  
  10931.  
  10932. public function GetLevelupAbility( id : int) : name
  10933. {
  10934. switch(id)
  10935. {
  10936. case 1: return 'Lvl1';
  10937. case 2: return 'Lvl2';
  10938. case 3: return 'Lvl3';
  10939. case 4: return 'Lvl4';
  10940. case 5: return 'Lvl5';
  10941. case 6: return 'Lvl6';
  10942. case 7: return 'Lvl7';
  10943. case 8: return 'Lvl8';
  10944. case 9: return 'Lvl9';
  10945. case 10: return 'Lvl10';
  10946. case 11: return 'Lvl11';
  10947. case 12: return 'Lvl12';
  10948. case 13: return 'Lvl13';
  10949. case 14: return 'Lvl14';
  10950. case 15: return 'Lvl15';
  10951. case 16: return 'Lvl16';
  10952. case 17: return 'Lvl17';
  10953. case 18: return 'Lvl18';
  10954. case 19: return 'Lvl19';
  10955. case 20: return 'Lvl20';
  10956. case 21: return 'Lvl21';
  10957. case 22: return 'Lvl22';
  10958. case 23: return 'Lvl23';
  10959. case 24: return 'Lvl24';
  10960. case 25: return 'Lvl25';
  10961. case 26: return 'Lvl26';
  10962. case 27: return 'Lvl27';
  10963. case 28: return 'Lvl28';
  10964. case 29: return 'Lvl29';
  10965. case 30: return 'Lvl30';
  10966. case 31: return 'Lvl31';
  10967. case 32: return 'Lvl32';
  10968. case 33: return 'Lvl33';
  10969. case 34: return 'Lvl34';
  10970. case 35: return 'Lvl35';
  10971. case 36: return 'Lvl36';
  10972. case 37: return 'Lvl37';
  10973. case 38: return 'Lvl38';
  10974. case 39: return 'Lvl39';
  10975. case 40: return 'Lvl40';
  10976. case 41: return 'Lvl41';
  10977. case 42: return 'Lvl42';
  10978. case 43: return 'Lvl43';
  10979. case 44: return 'Lvl44';
  10980. case 45: return 'Lvl45';
  10981. case 46: return 'Lvl46';
  10982. case 47: return 'Lvl47';
  10983. case 48: return 'Lvl48';
  10984. case 49: return 'Lvl49';
  10985. case 50: return 'Lvl50';
  10986.  
  10987. default: return '';
  10988. }
  10989.  
  10990. return '';
  10991. }
  10992.  
  10993. public function CanSprint( speed : float ) : bool
  10994. {
  10995. /*if( !super.CanSprint( speed ) )
  10996. {
  10997. return false;
  10998. } */ //modSings
  10999. if(theGame.GetEngineTimeAsSeconds() - blockSprintTimestamp < 2) //modSigns
  11000. {
  11001. return false;
  11002. }
  11003. if( rangedWeapon && rangedWeapon.GetCurrentStateName() != 'State_WeaponWait' )
  11004. {
  11005. if ( this.GetPlayerCombatStance() == PCS_AlertNear )
  11006. {
  11007. if ( IsSprintActionPressed() )
  11008. OnRangedForceHolster( true, false );
  11009. }
  11010. else
  11011. return false;
  11012. }
  11013. if( GetCurrentStateName() != 'Swimming' && GetStat(BCS_Stamina) <= 0 )
  11014. {
  11015. SetSprintActionPressed(false,true);
  11016. blockSprintTimestamp = theGame.GetEngineTimeAsSeconds(); //modSings
  11017. return false;
  11018. }
  11019.  
  11020. return super.CanSprint( speed ); //modSigns: moved here
  11021. }
  11022.  
  11023. var blockSprintTimestamp : float; //modSings
  11024.  
  11025. public function ManageSleeping()
  11026. {
  11027. thePlayer.RemoveBuffImmunity_AllCritical( 'Bed' );
  11028. thePlayer.RemoveBuffImmunity_AllNegative( 'Bed' );
  11029.  
  11030. thePlayer.PlayerStopAction( PEA_GoToSleep );
  11031. }
  11032.  
  11033.  
  11034.  
  11035. public function RestoreHorseManager() : bool
  11036. {
  11037. var horseTemplate : CEntityTemplate;
  11038. var horseManager : W3HorseManager;
  11039.  
  11040. if ( GetHorseManager() )
  11041. {
  11042. return false;
  11043. }
  11044.  
  11045. horseTemplate = (CEntityTemplate)LoadResource("horse_manager");
  11046. horseManager = (W3HorseManager)theGame.CreateEntity(horseTemplate, GetWorldPosition(),,,,,PM_Persist);
  11047. horseManager.CreateAttachment(this);
  11048. horseManager.OnCreated();
  11049. EntityHandleSet( horseManagerHandle, horseManager );
  11050.  
  11051. return true;
  11052. }
  11053.  
  11054.  
  11055.  
  11056.  
  11057.  
  11058.  
  11059. final function PerformParryCheck( parryInfo : SParryInfo ) : bool
  11060. {
  11061. if( super.PerformParryCheck( parryInfo ) )
  11062. {
  11063. //GainAdrenalineFromPerk21( 'parry' ); //modSigns
  11064. return true;
  11065. }
  11066. return false;
  11067. }
  11068.  
  11069. protected final function PerformCounterCheck( parryInfo: SParryInfo ) : bool
  11070. {
  11071. var fistFightCheck, isInFistFight : bool;
  11072.  
  11073. if( super.PerformCounterCheck( parryInfo ) )
  11074. {
  11075. //GainAdrenalineFromPerk21( 'counter' ); //modSigns
  11076.  
  11077. isInFistFight = FistFightCheck( parryInfo.target, parryInfo.attacker, fistFightCheck );
  11078.  
  11079. if( isInFistFight && fistFightCheck )
  11080. {
  11081. FactsAdd( "statistics_fist_fight_counter" );
  11082. AddTimer( 'FistFightCounterTimer', 0.5f, , , , true );
  11083. }
  11084.  
  11085. return true;
  11086. }
  11087. return false;
  11088. }
  11089.  
  11090. /*public function GainAdrenalineFromPerk21( n : name )
  11091. {
  11092. var perkStats, perkTime : SAbilityAttributeValue;
  11093. var targets : array<CActor>;
  11094.  
  11095. targets = GetHostileEnemies();
  11096.  
  11097. if( !CanUseSkill( S_Perk_21 ) || targets.Size() == 0 )
  11098. {
  11099. return;
  11100. }
  11101.  
  11102. perkTime = GetSkillAttributeValue( S_Perk_21, 'perk21Time', false, false );
  11103.  
  11104. if( theGame.GetEngineTimeAsSeconds() >= timeForPerk21 + perkTime.valueAdditive )
  11105. {
  11106. perkStats = GetSkillAttributeValue( S_Perk_21, n , false, false );
  11107. GainStat( BCS_Focus, perkStats.valueAdditive );
  11108. timeForPerk21 = theGame.GetEngineTimeAsSeconds();
  11109.  
  11110. AddEffectDefault( EET_Perk21InternalCooldown, this, "Perk21", false );
  11111. }
  11112. }*/ //modSigns
  11113.  
  11114. public function Perk21GainStamina(action : name) //modSigns
  11115. {
  11116. var min, max : SAbilityAttributeValue;
  11117.  
  11118. if(!HasBuff(EET_Perk21InternalCooldown) || action == 'kill')
  11119. {
  11120. switch(action)
  11121. {
  11122. case 'kill':
  11123. theGame.GetDefinitionsManager().GetAbilityAttributeValue('perk_21', 'stamina_kill', min, max);
  11124. GainStat(BCS_Stamina, min.valueMultiplicative * GetStatMax(BCS_Stamina));
  11125. break;
  11126. case 'crit':
  11127. case 'counter':
  11128. theGame.GetDefinitionsManager().GetAbilityAttributeValue('perk_21', 'stamina_other', min, max);
  11129. GainStat(BCS_Stamina, min.valueMultiplicative * GetStatMax(BCS_Stamina));
  11130. break;
  11131. default:
  11132. break;
  11133. }
  11134. AddEffectDefault(EET_Perk21InternalCooldown, this, "Perk21");
  11135. }
  11136. }
  11137.  
  11138. timer function FistFightCounterTimer( dt : float, id : int )
  11139. {
  11140. FactsRemove( "statistics_fist_fight_counter" );
  11141. }
  11142.  
  11143. public final function IsSignBlocked(signType : ESignType) : bool
  11144. {
  11145. switch( signType )
  11146. {
  11147. case ST_Aard :
  11148. return IsRadialSlotBlocked ( 'Aard');
  11149. break;
  11150. case ST_Axii :
  11151. return IsRadialSlotBlocked ( 'Axii');
  11152. break;
  11153. case ST_Igni :
  11154. return IsRadialSlotBlocked ( 'Igni');
  11155. break;
  11156. case ST_Quen :
  11157. return IsRadialSlotBlocked ( 'Quen');
  11158. break;
  11159. case ST_Yrden :
  11160. return IsRadialSlotBlocked ( 'Yrden');
  11161. break;
  11162. default:
  11163. break;
  11164. }
  11165. return false;
  11166.  
  11167. }
  11168.  
  11169. public final function AddAnItemWithAutogenLevelAndQuality(itemName : name, desiredLevel : int, minQuality : int, optional equipItem : bool)
  11170. {
  11171. var itemLevel, quality : int;
  11172. var ids : array<SItemUniqueId>;
  11173. var attemptCounter : int;
  11174.  
  11175. itemLevel = 0;
  11176. quality = 0;
  11177. attemptCounter = 0;
  11178. while(itemLevel != desiredLevel || quality < minQuality)
  11179. {
  11180. attemptCounter += 1;
  11181. ids.Clear();
  11182. ids = inv.AddAnItem(itemName, 1, true);
  11183. itemLevel = inv.GetItemLevel(ids[0]);
  11184. quality = RoundMath(CalculateAttributeValue(inv.GetItemAttributeValue(ids[0], 'quality')));
  11185.  
  11186.  
  11187. if(attemptCounter >= 1000)
  11188. break;
  11189.  
  11190. if(itemLevel != desiredLevel || quality < minQuality)
  11191. inv.RemoveItem(ids[0]);
  11192. }
  11193.  
  11194. if(equipItem)
  11195. EquipItem(ids[0]);
  11196. }
  11197.  
  11198. public final function AddAnItemWithAutogenLevel(itemName : name, desiredLevel : int)
  11199. {
  11200. var itemLevel : int;
  11201. var ids : array<SItemUniqueId>;
  11202. var attemptCounter : int;
  11203.  
  11204. itemLevel = 0;
  11205. while(itemLevel != desiredLevel)
  11206. {
  11207. attemptCounter += 1;
  11208. ids.Clear();
  11209. ids = inv.AddAnItem(itemName, 1, true);
  11210. itemLevel = inv.GetItemLevel(ids[0]);
  11211.  
  11212.  
  11213. if(attemptCounter >= 1000)
  11214. break;
  11215.  
  11216. if(itemLevel != desiredLevel)
  11217. inv.RemoveItem(ids[0]);
  11218. }
  11219. }
  11220.  
  11221. public final function AddAnItemWithMinQuality(itemName : name, minQuality : int, optional equip : bool)
  11222. {
  11223. var quality : int;
  11224. var ids : array<SItemUniqueId>;
  11225. var attemptCounter : int;
  11226.  
  11227. quality = 0;
  11228. while(quality < minQuality)
  11229. {
  11230. attemptCounter += 1;
  11231. ids.Clear();
  11232. ids = inv.AddAnItem(itemName, 1, true);
  11233. quality = RoundMath(CalculateAttributeValue(inv.GetItemAttributeValue(ids[0], 'quality')));
  11234.  
  11235.  
  11236. if(attemptCounter >= 1000)
  11237. break;
  11238.  
  11239. if(quality < minQuality)
  11240. inv.RemoveItem(ids[0]);
  11241. }
  11242.  
  11243. if(equip)
  11244. EquipItem(ids[0]);
  11245. }
  11246.  
  11247.  
  11248.  
  11249.  
  11250.  
  11251.  
  11252. //modSigns: fix equipped, only once
  11253. private function RecalcSetItemsEquipped()
  11254. {
  11255. var slotsToCheck : array<EEquipmentSlots>;
  11256. var setType : EItemSetType;
  11257. var item : SItemUniqueId;
  11258. var i : int;
  11259.  
  11260. for(i = 0; i < amountOfSetPiecesEquipped.Size(); i += 1)
  11261. amountOfSetPiecesEquipped[i] = 0;
  11262.  
  11263. slotsToCheck.PushBack(EES_Armor);
  11264. slotsToCheck.PushBack(EES_Boots);
  11265. slotsToCheck.PushBack(EES_Pants);
  11266. slotsToCheck.PushBack(EES_Gloves);
  11267. slotsToCheck.PushBack(EES_SilverSword);
  11268. slotsToCheck.PushBack(EES_SteelSword);
  11269.  
  11270. for(i = 0; i < slotsToCheck.Size(); i += 1)
  11271. {
  11272. if(GetItemEquippedOnSlot(slotsToCheck[i], item) && inv.ItemHasTag(item, 'SetBonusPiece'))
  11273. {
  11274. setType = CheckSetType( item );
  11275. amountOfSetPiecesEquipped[ setType ] += 1;
  11276. ManageSetBonusesSoundbanks( setType );
  11277. }
  11278. }
  11279. }
  11280.  
  11281. //modSigns: minor sets added
  11282. public function IsSetBonusActive( bonus : EItemSetBonus ) : bool
  11283. {
  11284. switch(bonus)
  11285. {
  11286. case EISB_Lynx_1:
  11287. return amountOfSetPiecesEquipped[ EIST_Lynx ] + amountOfSetPiecesEquipped[ EIST_Lynx_Minor ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  11288. case EISB_Lynx_2:
  11289. return amountOfSetPiecesEquipped[ EIST_Lynx ] >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS;
  11290. case EISB_Gryphon_1:
  11291. return amountOfSetPiecesEquipped[ EIST_Gryphon ] + amountOfSetPiecesEquipped[ EIST_Gryphon_Minor ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  11292. case EISB_Gryphon_2:
  11293. return amountOfSetPiecesEquipped[ EIST_Gryphon ] >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS;
  11294. case EISB_Bear_1:
  11295. return amountOfSetPiecesEquipped[ EIST_Bear ] + amountOfSetPiecesEquipped[ EIST_Bear_Minor ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  11296. case EISB_Bear_2:
  11297. return amountOfSetPiecesEquipped[ EIST_Bear ] >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS;
  11298. case EISB_Wolf_1:
  11299. return amountOfSetPiecesEquipped[ EIST_Wolf ] + amountOfSetPiecesEquipped[ EIST_Wolf_Minor ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  11300. case EISB_Wolf_2:
  11301. return amountOfSetPiecesEquipped[ EIST_Wolf ] >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS;
  11302. case EISB_RedWolf_1:
  11303. return amountOfSetPiecesEquipped[ EIST_RedWolf ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  11304. case EISB_RedWolf_2:
  11305. return amountOfSetPiecesEquipped[ EIST_RedWolf ] >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS;
  11306. case EISB_Vampire:
  11307. return amountOfSetPiecesEquipped[ EIST_Vampire ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  11308. //modSigns
  11309. case EISB_Viper:
  11310. return amountOfSetPiecesEquipped[ EIST_Viper ] >= GetNumItemsRequiredForSetActivation(EIST_Viper);
  11311. case EISB_KaerMorhen:
  11312. return amountOfSetPiecesEquipped[ EIST_KaerMorhen ] >= GetNumItemsRequiredForSetActivation(EIST_KaerMorhen);
  11313. default: return false;
  11314. }
  11315. }
  11316.  
  11317. //modSigns: minor sets
  11318. public function GetSetPartsEquipped( setType : EItemSetType ) : int
  11319. {
  11320. switch( setType )
  11321. {
  11322. case EIST_Lynx:
  11323. case EIST_Lynx_Minor:
  11324. return amountOfSetPiecesEquipped[ EIST_Lynx ] + amountOfSetPiecesEquipped[ EIST_Lynx_Minor ];
  11325. case EIST_Gryphon:
  11326. case EIST_Gryphon_Minor:
  11327. return amountOfSetPiecesEquipped[ EIST_Gryphon ] + amountOfSetPiecesEquipped[ EIST_Gryphon_Minor ];
  11328. case EIST_Bear:
  11329. case EIST_Bear_Minor:
  11330. return amountOfSetPiecesEquipped[ EIST_Bear ] + amountOfSetPiecesEquipped[ EIST_Bear_Minor ];
  11331. case EIST_Wolf:
  11332. case EIST_Wolf_Minor:
  11333. return amountOfSetPiecesEquipped[ EIST_Wolf ] + amountOfSetPiecesEquipped[ EIST_Wolf_Minor ];
  11334. default:
  11335. return amountOfSetPiecesEquipped[ setType ];
  11336. }
  11337. }
  11338.  
  11339. //modSigns
  11340. public function GetSetPartsEquippedRaw( setType : EItemSetType ) : int
  11341. {
  11342. return amountOfSetPiecesEquipped[ setType ];
  11343. }
  11344.  
  11345. //modSigns
  11346. public function HasMixedSetsEquipped() : bool
  11347. {
  11348. return amountOfSetPiecesEquipped[ EIST_Lynx ] > 0 && amountOfSetPiecesEquipped[ EIST_Lynx_Minor ] > 0 ||
  11349. amountOfSetPiecesEquipped[ EIST_Gryphon ] > 0 && amountOfSetPiecesEquipped[ EIST_Gryphon_Minor ] > 0 ||
  11350. amountOfSetPiecesEquipped[ EIST_Bear ] > 0 && amountOfSetPiecesEquipped[ EIST_Bear_Minor ] > 0 ||
  11351. amountOfSetPiecesEquipped[ EIST_Wolf ] > 0 && amountOfSetPiecesEquipped[ EIST_Wolf_Minor ] > 0;
  11352. }
  11353.  
  11354. protected function UpdateItemSetBonuses( item : SItemUniqueId, increment : bool )
  11355. {
  11356. var setType : EItemSetType;
  11357. var tutorialStateSets : W3TutorialManagerUIHandlerStateSetItemsUnlocked;
  11358. var id : SItemUniqueId;
  11359.  
  11360. if( !inv.IsIdValid( item ) || !inv.ItemHasTag(item, theGame.params.ITEM_SET_TAG_BONUS ) )
  11361. {
  11362.  
  11363. if( !IsSetBonusActive( EISB_Wolf_2 ) ) //modSigns
  11364. {
  11365. if( GetItemEquippedOnSlot( EES_SteelSword, id ) )
  11366. {
  11367. RemoveExtraOilsFromItem( id );
  11368. }
  11369. if( GetItemEquippedOnSlot( EES_SilverSword, id ) )
  11370. {
  11371. RemoveExtraOilsFromItem( id );
  11372. }
  11373. }
  11374.  
  11375. return;
  11376. }
  11377.  
  11378. setType = CheckSetType( item );
  11379.  
  11380. if( increment )
  11381. {
  11382. amountOfSetPiecesEquipped[ setType ] += 1;
  11383.  
  11384. //modSigns
  11385. if( GetSetPartsEquipped(setType) >= GetNumItemsRequiredForSetActivation(setType) && ShouldProcessTutorial( 'TutorialSetBonusesUnlocked' ) && theGame.GetTutorialSystem().uiHandler && theGame.GetTutorialSystem().uiHandler.GetCurrentStateName() == 'SetItemsUnlocked' )
  11386. {
  11387. tutorialStateSets = ( W3TutorialManagerUIHandlerStateSetItemsUnlocked )theGame.GetTutorialSystem().uiHandler.GetCurrentState();
  11388. tutorialStateSets.OnSetBonusCompleted();
  11389. }
  11390. }
  11391. else if( amountOfSetPiecesEquipped[ setType ] > 0 )
  11392. {
  11393. amountOfSetPiecesEquipped[ setType ] -= 1;
  11394. }
  11395.  
  11396.  
  11397. //modSigns
  11398. //if( setType < EIST_Viper && amountOfSetPiecesEquipped[ setType ] == theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS )
  11399. if( IsSetBonusActive(EISB_Lynx_2) || IsSetBonusActive(EISB_Gryphon_2) || IsSetBonusActive(EISB_Bear_2) || IsSetBonusActive(EISB_Wolf_2) || IsSetBonusActive(EISB_RedWolf_2) )
  11400. {
  11401. theGame.GetGamerProfile().AddAchievement( EA_ReadyToRoll );
  11402. }
  11403.  
  11404.  
  11405. if( !IsSetBonusActive( EISB_Wolf_2 ) ) //modSigns
  11406. {
  11407. if( GetItemEquippedOnSlot( EES_SteelSword, id ) )
  11408. {
  11409. RemoveExtraOilsFromItem( id );
  11410. }
  11411. if( GetItemEquippedOnSlot( EES_SilverSword, id ) )
  11412. {
  11413. RemoveExtraOilsFromItem( id );
  11414. }
  11415. }
  11416.  
  11417. ManageActiveSetBonuses( setType );
  11418.  
  11419.  
  11420. ManageSetBonusesSoundbanks( setType );
  11421. }
  11422.  
  11423. public function ManageActiveSetBonuses( setType : EItemSetType )
  11424. {
  11425. var l_i : int;
  11426.  
  11427.  
  11428. if( setType == EIST_Lynx || setType == EIST_Lynx_Minor ) //modSigns
  11429. {
  11430.  
  11431. if( HasBuff( EET_LynxSetBonus ) && !IsSetBonusActive( EISB_Lynx_1 ) )
  11432. {
  11433. RemoveBuff( EET_LynxSetBonus );
  11434. }
  11435. }
  11436.  
  11437. else if( setType == EIST_Gryphon )
  11438. {
  11439.  
  11440. if( !IsSetBonusActive( EISB_Gryphon_1 ) )
  11441. {
  11442. RemoveBuff( EET_GryphonSetBonus );
  11443. }
  11444.  
  11445. if( IsSetBonusActive( EISB_Gryphon_2 ) && !HasBuff( EET_GryphonSetBonusYrden ) )
  11446. {
  11447. for( l_i = 0 ; l_i < yrdenEntities.Size() ; l_i += 1 )
  11448. {
  11449. if( yrdenEntities[ l_i ].GetIsPlayerInside() && !yrdenEntities[ l_i ].IsAlternateCast() )
  11450. {
  11451. AddEffectDefault( EET_GryphonSetBonusYrden, this, "GryphonSetBonusYrden" );
  11452. break;
  11453. }
  11454. }
  11455. }
  11456. else
  11457. {
  11458. RemoveBuff( EET_GryphonSetBonusYrden );
  11459. }
  11460. }
  11461.  
  11462. //modSigns
  11463. else if( setType == EIST_KaerMorhen )
  11464. {
  11465. if( !IsSetBonusActive(EISB_KaerMorhen) && HasBuff(EET_KaerMorhenSetBonus) )
  11466. {
  11467. RemoveBuff(EET_KaerMorhenSetBonus);
  11468. }
  11469. else if( IsSetBonusActive(EISB_KaerMorhen) && !HasBuff(EET_KaerMorhenSetBonus) && IsInCombat() )
  11470. {
  11471. AddEffectDefault(EET_KaerMorhenSetBonus, this, "KaerMorhenSetBonus");
  11472. }
  11473. }
  11474. }
  11475.  
  11476. public function CheckSetTypeByName( itemName : name ) : EItemSetType
  11477. {
  11478. var dm : CDefinitionsManagerAccessor;
  11479.  
  11480. dm = theGame.GetDefinitionsManager();
  11481.  
  11482. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_LYNX ) )
  11483. {
  11484. return EIST_Lynx;
  11485. }
  11486. else
  11487. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_GRYPHON ) )
  11488. {
  11489. return EIST_Gryphon;
  11490. }
  11491. else
  11492. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_BEAR ) )
  11493. {
  11494. return EIST_Bear;
  11495. }
  11496. else
  11497. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_WOLF ) )
  11498. {
  11499. return EIST_Wolf;
  11500. }
  11501. else
  11502. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_RED_WOLF ) )
  11503. {
  11504. return EIST_RedWolf;
  11505. }
  11506. else
  11507. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_VAMPIRE ) )
  11508. {
  11509. return EIST_Vampire;
  11510. }
  11511. else
  11512. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_VIPER ) )
  11513. {
  11514. return EIST_Viper;
  11515. }
  11516. else
  11517. //modSigns
  11518. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_KAER_MORHEN ) )
  11519. {
  11520. return EIST_KaerMorhen;
  11521. }
  11522. else
  11523. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_LYNX_MINOR ) )
  11524. {
  11525. return EIST_Lynx_Minor;
  11526. }
  11527. else
  11528. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_GRYPHON_MINOR ) )
  11529. {
  11530. return EIST_Gryphon_Minor;
  11531. }
  11532. else
  11533. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_BEAR_MINOR ) )
  11534. {
  11535. return EIST_Bear_Minor;
  11536. }
  11537. else
  11538. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_WOLF_MINOR ) )
  11539. {
  11540. return EIST_Wolf_Minor;
  11541. }
  11542. else
  11543. {
  11544. return EIST_Undefined;
  11545. }
  11546. }
  11547.  
  11548. public function CheckSetType( item : SItemUniqueId ) : EItemSetType
  11549. {
  11550. var stopLoop : bool;
  11551. var tags : array<name>;
  11552. var i : int;
  11553. var setType : EItemSetType;
  11554.  
  11555. stopLoop = false;
  11556.  
  11557. inv.GetItemTags( item, tags );
  11558.  
  11559.  
  11560. for( i=0; i<tags.Size(); i+=1 )
  11561. {
  11562. switch( tags[i] )
  11563. {
  11564. case theGame.params.ITEM_SET_TAG_LYNX:
  11565. case theGame.params.ITEM_SET_TAG_GRYPHON:
  11566. case theGame.params.ITEM_SET_TAG_BEAR:
  11567. case theGame.params.ITEM_SET_TAG_WOLF:
  11568. case theGame.params.ITEM_SET_TAG_RED_WOLF:
  11569. case theGame.params.ITEM_SET_TAG_VAMPIRE:
  11570. case theGame.params.ITEM_SET_TAG_VIPER:
  11571. //modSigns
  11572. case theGame.params.ITEM_SET_TAG_KAER_MORHEN:
  11573. case theGame.params.ITEM_SET_TAG_LYNX_MINOR:
  11574. case theGame.params.ITEM_SET_TAG_GRYPHON_MINOR:
  11575. case theGame.params.ITEM_SET_TAG_BEAR_MINOR:
  11576. case theGame.params.ITEM_SET_TAG_WOLF_MINOR:
  11577. setType = SetItemNameToType( tags[i] );
  11578. stopLoop = true;
  11579. break;
  11580. }
  11581. if ( stopLoop )
  11582. {
  11583. break;
  11584. }
  11585. }
  11586.  
  11587. return setType;
  11588. }
  11589.  
  11590. public function GetSetBonusStatusByName( itemName : name, out desc1, desc2 : string, out isActive1, isActive2 : bool ) : EItemSetType
  11591. {
  11592. var setType : EItemSetType;
  11593.  
  11594. if( theGame.GetDLCManager().IsEP2Enabled() )
  11595. {
  11596. setType = CheckSetTypeByName( itemName );
  11597. SetBonusStatusByType( setType, desc1, desc2, isActive1, isActive2 );
  11598.  
  11599. return setType;
  11600. }
  11601. else
  11602. {
  11603. return EIST_Undefined;
  11604. }
  11605. }
  11606.  
  11607. public function GetSetBonusStatus( item : SItemUniqueId, out desc1, desc2 : string, out isActive1, isActive2 : bool ) : EItemSetType
  11608. {
  11609. var setType : EItemSetType;
  11610.  
  11611. if( theGame.GetDLCManager().IsEP2Enabled() )
  11612. {
  11613. setType = CheckSetType( item );
  11614. SetBonusStatusByType( setType, desc1, desc2, isActive1, isActive2 );
  11615.  
  11616. return setType;
  11617. }
  11618. else
  11619. {
  11620. return EIST_Undefined;
  11621. }
  11622. }
  11623.  
  11624. private function SetBonusStatusByType(setType : EItemSetType, out desc1, desc2 : string, out isActive1, isActive2 : bool):void
  11625. {
  11626. var setBonus : EItemSetBonus;
  11627.  
  11628. //modSigns
  11629. isActive1 = (GetSetPartsEquipped(setType) >= GetNumItemsRequiredForSetActivation(setType));
  11630. isActive2 = (amountOfSetPiecesEquipped[ setType ] >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS);
  11631.  
  11632. setBonus = ItemSetTypeToItemSetBonus( setType, 1 );
  11633. desc1 = GetSetBonusTooltipDescription( setBonus );
  11634.  
  11635. setBonus = ItemSetTypeToItemSetBonus( setType, 2 );
  11636. desc2 = GetSetBonusTooltipDescription( setBonus );
  11637. }
  11638.  
  11639. public function ItemSetTypeToItemSetBonus( setType : EItemSetType, nr : int ) : EItemSetBonus
  11640. {
  11641. var setBonus : EItemSetBonus;
  11642.  
  11643. if( nr == 1 )
  11644. {
  11645. switch( setType )
  11646. {
  11647. case EIST_Lynx: setBonus = EISB_Lynx_1; break;
  11648. case EIST_Gryphon: setBonus = EISB_Gryphon_1; break;
  11649. case EIST_Bear: setBonus = EISB_Bear_1; break;
  11650. case EIST_Wolf: setBonus = EISB_Wolf_1; break;
  11651. case EIST_RedWolf: setBonus = EISB_RedWolf_1; break;
  11652. case EIST_Vampire: setBonus = EISB_Vampire; break;
  11653. //modSigns
  11654. case EIST_Viper: setBonus = EISB_Viper; break;
  11655. case EIST_KaerMorhen: setBonus = EISB_KaerMorhen; break;
  11656. case EIST_Lynx_Minor: setBonus = EISB_Lynx_1; break;
  11657. case EIST_Gryphon_Minor: setBonus = EISB_Gryphon_1; break;
  11658. case EIST_Bear_Minor: setBonus = EISB_Bear_1; break;
  11659. case EIST_Wolf_Minor: setBonus = EISB_Wolf_1; break;
  11660. }
  11661. }
  11662. else
  11663. {
  11664. switch( setType )
  11665. {
  11666. case EIST_Lynx: setBonus = EISB_Lynx_2; break;
  11667. case EIST_Gryphon: setBonus = EISB_Gryphon_2; break;
  11668. case EIST_Bear: setBonus = EISB_Bear_2; break;
  11669. case EIST_Wolf: setBonus = EISB_Wolf_2; break;
  11670. case EIST_RedWolf: setBonus = EISB_RedWolf_2; break;
  11671. case EIST_Vampire: setBonus = EISB_Undefined; break;
  11672. //modSigns
  11673. case EIST_Viper: setBonus = EISB_Undefined; break;
  11674. case EIST_KaerMorhen: setBonus = EISB_Undefined; break;
  11675. case EIST_Lynx_Minor: setBonus = EISB_Undefined; break;
  11676. case EIST_Gryphon_Minor: setBonus = EISB_Undefined; break;
  11677. case EIST_Bear_Minor: setBonus = EISB_Undefined; break;
  11678. case EIST_Wolf_Minor: setBonus = EISB_Undefined; break;
  11679. }
  11680. }
  11681.  
  11682. return setBonus;
  11683. }
  11684.  
  11685. public function GetSetBonusTooltipDescription( bonus : EItemSetBonus ) : string
  11686. {
  11687. var finalString : string;
  11688. var arrString : array<string>;
  11689. var dm : CDefinitionsManagerAccessor;
  11690. var min, max : SAbilityAttributeValue;
  11691. var tempString : string;
  11692. var tmpVal : float; //modSigns
  11693.  
  11694. switch( bonus )
  11695. {
  11696. case EISB_Lynx_1: tempString = "skill_desc_lynx_set_ability1"; break;
  11697. case EISB_Lynx_2: tempString = "skill_desc_lynx_set_ability2"; break;
  11698. case EISB_Gryphon_1: tempString = "skill_desc_gryphon_set_ability1"; break;
  11699. case EISB_Gryphon_2: tempString = "skill_desc_gryphon_set_ability2"; break;
  11700. case EISB_Bear_1: tempString = "skill_desc_bear_set_ability1"; break;
  11701. case EISB_Bear_2: tempString = "skill_desc_bear_set_ability2"; break;
  11702. case EISB_Wolf_1: tempString = "skill_desc_wolf_set_ability1"; break;
  11703. case EISB_Wolf_2: tempString = "skill_desc_wolf_set_ability2"; break;
  11704. case EISB_RedWolf_1: tempString = "skill_desc_red_wolf_set_ability1"; break;
  11705. case EISB_RedWolf_2: tempString = "skill_desc_red_wolf_set_ability2"; break;
  11706. case EISB_Vampire: tempString = "skill_desc_vampire_set_ability1"; break;
  11707. //modSigns
  11708. case EISB_Viper: tempString = "skill_desc_viper_set_ability1"; break;
  11709. case EISB_KaerMorhen: tempString = "skill_desc_kaer_morhen_set_ability1"; break;
  11710. default: tempString = ""; break;
  11711. }
  11712.  
  11713. dm = theGame.GetDefinitionsManager();
  11714.  
  11715. switch( bonus )
  11716. {
  11717. case EISB_Lynx_1:
  11718. dm.GetAbilityAttributeValue( 'LynxSetBonusEffect', 'lynx_ap_boost', min, max );
  11719. arrString.PushBack( FloatToString( min.valueAdditive * 100 ) );
  11720. arrString.PushBack( FloatToString( min.valueAdditive * 100 * GetSetPartsEquipped( EIST_Lynx ) ) );
  11721. dm.GetAbilityAttributeValue( 'LynxSetBonusEffect', 'lynx_boost_max', min, max );
  11722. arrString.PushBack( FloatToString( min.valueAdditive * 100 ) );
  11723. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  11724. break;
  11725. case EISB_Lynx_2:
  11726. //modSigns: changed
  11727. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  11728. break;
  11729. case EISB_Gryphon_1:
  11730. //modSigns: new mechanic
  11731. dm.GetAbilityAttributeValue( 'GryphonSetBonusEffect', 'gryphon_tier1_bonus', min, max );
  11732. arrString.PushBack( FloatToString( min.valueAdditive * 100 ) );
  11733. arrString.PushBack( FloatToString( min.valueAdditive * 100 * GetSetPartsEquipped( EIST_Gryphon ) ) );
  11734. dm.GetAbilityAttributeValue( 'GryphonSetBonusEffect', 'duration', min, max );
  11735. arrString.PushBack( FloatToString( min.valueAdditive ) );
  11736. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  11737. break;
  11738. case EISB_Gryphon_2:
  11739. dm.GetAbilityAttributeValue( 'GryphonSetBonusYrdenEffect', 'trigger_scale', min, max );
  11740. arrString.PushBack( FloatToString( ( min.valueAdditive - 1 )* 100) );
  11741. //dm.GetAbilityAttributeValue( 'GryphonSetBonusYrdenEffect', 'staminaRegen', min, max ); //modSigns: removed
  11742. //arrString.PushBack( FloatToString( min.valueMultiplicative * 100) );
  11743. dm.GetAbilityAttributeValue( 'GryphonSetBonusYrdenEffect', 'spell_power', min, max );
  11744. arrString.PushBack( FloatToString( min.valueMultiplicative * 100) );
  11745. dm.GetAbilityAttributeValue( 'GryphonSetBonusYrdenEffect', 'slashing_resistance_perc', min, max );
  11746. arrString.PushBack( FloatToString( min.valueAdditive * 100) );
  11747. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  11748. break;
  11749. case EISB_Bear_1: //modSigns: full set redesign
  11750. dm.GetAbilityAttributeValue( 'setBonusAbilityBear_1', 'bonus_focus_gain', min, max );
  11751. arrString.PushBack( NoTrailZeros( CalculateAttributeValue(min) ) );
  11752. arrString.PushBack( NoTrailZeros( CalculateAttributeValue(min) * GetSetPartsEquipped( EIST_Bear ) ) );
  11753. dm.GetAbilityAttributeValue( 'setBonusAbilityBear_1', 'attack_power', min, max );
  11754. arrString.PushBack( NoTrailZeros( min.valueMultiplicative * 100 ) );
  11755. arrString.PushBack( NoTrailZeros( min.valueMultiplicative * 100 * GetSetPartsEquipped( EIST_Bear ) ) );
  11756. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  11757. break;
  11758. case EISB_Bear_2: //modSigns: full set redesign
  11759. dm.GetAbilityAttributeValue( 'setBonusAbilityBear_2', 'stamina_attack', min, max );
  11760. arrString.PushBack( NoTrailZeros( CalculateAttributeValue(min) * 100 ) );
  11761. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  11762. break;
  11763. //modSigns
  11764. case EISB_Wolf_1:
  11765. dm.GetAbilityAttributeValue( 'SetBonusAbilityWolf_1', 'per_piece_oil_bonus', min, max );
  11766. arrString.PushBack( RoundMath( CalculateAttributeValue(min) * 100 ) );
  11767. arrString.PushBack( RoundMath( CalculateAttributeValue(min) * 100 * GetSetPartsEquipped( EIST_Wolf ) ) );
  11768. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  11769. break;
  11770. case EISB_Wolf_2:
  11771. dm.GetAbilityAttributeValue( 'SetBonusAbilityWolf_2', 'per_oil_crit_chance_bonus', min, max );
  11772. arrString.PushBack( FloatToString( CalculateAttributeValue(min) * 100 ) );
  11773. dm.GetAbilityAttributeValue( 'SetBonusAbilityWolf_2', 'per_oil_crit_power_bonus', min, max );
  11774. arrString.PushBack( FloatToString( CalculateAttributeValue(min) * 100 ) );
  11775. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  11776. break;
  11777. case EISB_RedWolf_1:
  11778. dm.GetAbilityAttributeValue( 'setBonusAbilityRedWolf_1', 'per_redwolf_piece_crit_chance_bonus', min, max );
  11779. arrString.PushBack( FloatToString( CalculateAttributeValue(min) * 100 ) );
  11780. arrString.PushBack( FloatToString( CalculateAttributeValue(min) * 100 * GetSetPartsEquipped( EIST_RedWolf ) ) );
  11781. dm.GetAbilityAttributeValue( 'setBonusAbilityRedWolf_1', 'per_redwolf_piece_crit_power_bonus', min, max );
  11782. arrString.PushBack( FloatToString( CalculateAttributeValue(min) * 100 ) );
  11783. arrString.PushBack( FloatToString( CalculateAttributeValue(min) * 100 * GetSetPartsEquipped( EIST_RedWolf ) ) );
  11784. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  11785. break;
  11786. case EISB_RedWolf_2:
  11787. dm.GetAbilityAttributeValue( 'setBonusAbilityRedWolf_2', 'amount', min, max );
  11788. arrString.PushBack( FloatToString( min.valueAdditive ) );
  11789. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  11790. break;
  11791. case EISB_Vampire:
  11792. dm.GetAbilityAttributeValue( 'setBonusAbilityVampire', 'life_percent', min, max );
  11793. arrString.PushBack( FloatToString( min.valueAdditive ) );
  11794. arrString.PushBack( FloatToString( min.valueAdditive * GetSetPartsEquipped( EIST_Vampire ) ) );
  11795. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  11796. break;
  11797. //modSigns
  11798. case EISB_Viper:
  11799. dm.GetAbilityAttributeValue( 'setBonusAbilityViper_1', 'per_viper_piece_poison_healing_rate', min, max );
  11800. arrString.PushBack( FloatToString( CalculateAttributeValue(min) * 100 ) );
  11801. arrString.PushBack( FloatToString( CalculateAttributeValue(min) * 100 * GetSetPartsEquipped( EIST_Viper ) ) );
  11802. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  11803. break;
  11804. case EISB_KaerMorhen:
  11805. dm.GetAbilityAttributeValue( 'KaerMorhenSetBonusEffect', 'staminaRegen', min, max );
  11806. tmpVal = CalculateAttributeValue(min);
  11807. arrString.PushBack( FloatToString( tmpVal ) );
  11808. dm.GetAbilityAttributeValue( 'KaerMorhenSetBonusEffect', 'maxStacks', min, max );
  11809. arrString.PushBack( FloatToString( tmpVal * CalculateAttributeValue(min) ) );
  11810. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  11811. break;
  11812. default:
  11813. finalString = GetLocStringByKeyExtWithParams( tempString );
  11814. }
  11815.  
  11816. return finalString;
  11817. }
  11818.  
  11819. //modSigns
  11820. public function LoadCurrentSetBonusSoundbank()
  11821. {
  11822. if(IsSetBonusActive(EISB_Lynx_1) || IsSetBonusActive(EISB_Lynx_2))
  11823. {
  11824. LoadSetBonusSoundBank( "ep2_setbonus_lynx.bnk" );
  11825. }
  11826. if(IsSetBonusActive(EISB_Gryphon_1) || IsSetBonusActive(EISB_Gryphon_2))
  11827. {
  11828. LoadSetBonusSoundBank( "ep2_setbonus_gryphon.bnk" );
  11829. }
  11830. //if(IsSetBonusActive(EISB_Bear_1) || IsSetBonusActive(EISB_Bear_2))
  11831. //{
  11832. LoadSetBonusSoundBank( "ep2_setbonus_bear.bnk" );
  11833. //} //should always be loaded as it's used by regular Quen now!
  11834. }
  11835.  
  11836. public function ManageSetBonusesSoundbanks( setType : EItemSetType )
  11837. {
  11838. //modSigns
  11839. if( GetSetPartsEquipped(setType) >= GetNumItemsRequiredForSetActivation(setType) )
  11840. {
  11841. switch( setType )
  11842. {
  11843. case EIST_Lynx:
  11844. LoadSetBonusSoundBank( "ep2_setbonus_lynx.bnk" );
  11845. break;
  11846. case EIST_Gryphon:
  11847. LoadSetBonusSoundBank( "ep2_setbonus_gryphon.bnk" );
  11848. break;
  11849. case EIST_Bear:
  11850. LoadSetBonusSoundBank( "ep2_setbonus_bear.bnk" );
  11851. break;
  11852. }
  11853. }
  11854. else
  11855. {
  11856. switch( setType )
  11857. {
  11858. case EIST_Lynx:
  11859. UnloadSetBonusSoundBank( "ep2_setbonus_lynx.bnk" );
  11860. break;
  11861. case EIST_Gryphon:
  11862. UnloadSetBonusSoundBank( "ep2_setbonus_gryphon.bnk" );
  11863. break;
  11864. case EIST_Bear:
  11865. UnloadSetBonusSoundBank( "ep2_setbonus_bear.bnk" );
  11866. break;
  11867. }
  11868. }
  11869. }
  11870.  
  11871. public function VampiricSetAbilityRegeneration()
  11872. {
  11873. var healthMax : float;
  11874. var healthToReg : float;
  11875. var healthPrc : float; //modSigns
  11876. var min, max : SAbilityAttributeValue; //modSigns
  11877.  
  11878. healthMax = GetStatMax( BCS_Vitality );
  11879.  
  11880. //modSigns: whoever decided that assuming no one will ever change xml values
  11881. //should be thrown to harpies
  11882. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'setBonusAbilityVampire', 'life_percent', min, max );
  11883. healthPrc = min.valueAdditive;
  11884.  
  11885. healthToReg = ( healthPrc * GetSetPartsEquipped(EIST_Vampire) * healthMax ) / 100;
  11886.  
  11887. //PlayEffect('drain_energy_caretaker_shovel');
  11888. GainStat( BCS_Vitality, healthToReg );
  11889. }
  11890.  
  11891. private function LoadSetBonusSoundBank( bankName : string )
  11892. {
  11893. if( !theSound.SoundIsBankLoaded( bankName ) )
  11894. {
  11895. theSound.SoundLoadBank( bankName, true );
  11896. }
  11897. }
  11898.  
  11899. private function UnloadSetBonusSoundBank( bankName : string )
  11900. {
  11901. if( theSound.SoundIsBankLoaded( bankName ) )
  11902. {
  11903. theSound.SoundUnloadBank( bankName );
  11904. }
  11905. }
  11906.  
  11907. timer function BearSetBonusQuenReapply( dt : float, id : int )
  11908. {
  11909. var newQuen : W3QuenEntity;
  11910.  
  11911. newQuen = (W3QuenEntity)theGame.CreateEntity( GetSignTemplate( ST_Quen ), GetWorldPosition(), GetWorldRotation() );
  11912. newQuen.Init( signOwner, GetSignEntity( ST_Quen ), true );
  11913. newQuen.freeCast = true; //modSigns
  11914. newQuen.OnStarted();
  11915. newQuen.OnThrowing();
  11916. newQuen.OnEnded();
  11917.  
  11918. m_quenReappliedCount += 1;
  11919.  
  11920. RemoveTimer( 'BearSetBonusQuenReapply');
  11921. }
  11922.  
  11923. //modSigns: gryphon set tier 1 bonus
  11924. public function GetGryphonSetTier1Bonus() : float
  11925. {
  11926. var abl : SAbilityAttributeValue;
  11927.  
  11928. abl = GetAttributeValue( 'gryphon_tier1_bonus' );
  11929. return abl.valueAdditive * GetSetPartsEquipped( EIST_Gryphon );
  11930. }
  11931.  
  11932. //modSigns: griffin school perk bonus
  11933. public function GetPerk6StaminaCostReduction() : float
  11934. {
  11935. var abl : SAbilityAttributeValue;
  11936. var bonus : float;
  11937.  
  11938. abl = GetAttributeValue('perk_6_stamina_cost_reduction');
  11939. bonus = abl.valueMultiplicative;
  11940. bonus = ClampF(bonus, 0, 1);
  11941.  
  11942. //theGame.witcherLog.AddMessage("stamina reduction bonus: " + bonus);
  11943.  
  11944. return bonus;
  11945. }
  11946.  
  11947. //modSigns
  11948. timer function GiveStandAloneEP1Items(dt : float, timerId : int)
  11949. {
  11950. var items : array<SItemUniqueId>;
  11951.  
  11952. if( inv )
  11953. {
  11954. inv.GetAllItems(items);
  11955. if( items.Size() <= 0 )
  11956. return;
  11957. }
  11958. else
  11959. return;
  11960.  
  11961. StandaloneEp1_1();
  11962.  
  11963. FactsAdd("standalone_ep1_inv", 1);
  11964.  
  11965. RemoveTimer('GiveStandAloneEP1Items');
  11966. }
  11967.  
  11968. //modSigns
  11969. timer function GiveStandAloneEP2Items(dt : float, timerId : int)
  11970. {
  11971. var items : array<SItemUniqueId>;
  11972.  
  11973. if( inv )
  11974. {
  11975. inv.GetAllItems(items);
  11976. if( items.Size() <= 0 )
  11977. return;
  11978. }
  11979. else
  11980. return;
  11981.  
  11982. StandaloneEp2_1();
  11983.  
  11984. FactsAdd("standalone_ep2_inv", 1);
  11985.  
  11986. RemoveTimer('GiveStandAloneEP2Items');
  11987. }
  11988.  
  11989. public final function StandaloneEp1_1()
  11990. {
  11991. var i, inc, quantityLow, randLow, quantityMedium, randMedium, quantityHigh, randHigh, startingMoney : int;
  11992. var pam : W3PlayerAbilityManager;
  11993. var ids : array<SItemUniqueId>;
  11994. var STARTING_LEVEL : int;
  11995.  
  11996. FactsAdd("StandAloneEP1", 1);
  11997.  
  11998.  
  11999. inv.RemoveAllItems();
  12000.  
  12001.  
  12002. inv.AddAnItem('Illusion Medallion', 1, true, true, false);
  12003. inv.AddAnItem('q103_safe_conduct', 1, true, true, false);
  12004.  
  12005.  
  12006. theGame.GetGamerProfile().ClearAllAchievementsForEP1();
  12007.  
  12008.  
  12009. STARTING_LEVEL = 32;
  12010. inc = STARTING_LEVEL - GetLevel();
  12011. for(i=0; i<inc; i+=1)
  12012. {
  12013. levelManager.AddPoints(EExperiencePoint, levelManager.GetTotalExpForNextLevel() - levelManager.GetPointsTotal(EExperiencePoint), false);
  12014. }
  12015.  
  12016.  
  12017. levelManager.ResetCharacterDev();
  12018. pam = (W3PlayerAbilityManager)abilityManager;
  12019. if(pam)
  12020. {
  12021. pam.ResetCharacterDev();
  12022. }
  12023. levelManager.SetFreeSkillPoints(levelManager.GetLevel() - 1 + 11);
  12024.  
  12025.  
  12026. //modSigns
  12027. inv.AddAnItem('Greater mutagen red', 1);
  12028. inv.AddAnItem('Greater mutagen green', 1);
  12029. inv.AddAnItem('Greater mutagen blue', 1);
  12030. inv.AddAnItem('Mutagen red', 2);
  12031. inv.AddAnItem('Mutagen green', 2);
  12032. inv.AddAnItem('Mutagen blue', 2);
  12033. inv.AddAnItem('Lesser mutagen red', 2);
  12034. inv.AddAnItem('Lesser mutagen green', 2);
  12035. inv.AddAnItem('Lesser mutagen blue', 2);
  12036.  
  12037.  
  12038. startingMoney = 4000;
  12039. if(GetMoney() > startingMoney)
  12040. {
  12041. RemoveMoney(GetMoney() - startingMoney);
  12042. }
  12043. else
  12044. {
  12045. AddMoney( 4000 - GetMoney() );
  12046. }
  12047.  
  12048.  
  12049.  
  12050.  
  12051.  
  12052. ids.Clear();
  12053. ids = inv.AddAnItem('EP1 Standalone Starting Armor');
  12054. EquipItem(ids[0]);
  12055. ids.Clear();
  12056. ids = inv.AddAnItem('EP1 Standalone Starting Boots');
  12057. EquipItem(ids[0]);
  12058. ids.Clear();
  12059. ids = inv.AddAnItem('EP1 Standalone Starting Gloves');
  12060. EquipItem(ids[0]);
  12061. ids.Clear();
  12062. ids = inv.AddAnItem('EP1 Standalone Starting Pants');
  12063. EquipItem(ids[0]);
  12064.  
  12065.  
  12066. ids.Clear();
  12067. ids = inv.AddAnItem('EP1 Standalone Starting Steel Sword');
  12068. EquipItem(ids[0]);
  12069. ids.Clear();
  12070. ids = inv.AddAnItem('EP1 Standalone Starting Silver Sword');
  12071. EquipItem(ids[0]);
  12072.  
  12073.  
  12074. inv.AddAnItem('Torch', 1, true, true, false);
  12075.  
  12076.  
  12077. //modSigns
  12078. quantityLow = 1;
  12079. randLow = 2;
  12080. quantityMedium = 2;
  12081. randMedium = 2;
  12082. quantityHigh = 3;
  12083. randHigh = 2;
  12084.  
  12085. inv.AddAnItem('Alghoul bone marrow',quantityMedium+RandRange(randMedium));
  12086. inv.AddAnItem('Amethyst dust',quantityLow+RandRange(randLow));
  12087. inv.AddAnItem('Arachas eyes',quantityLow+RandRange(randLow));
  12088. inv.AddAnItem('Arachas venom',quantityLow+RandRange(randLow));
  12089. inv.AddAnItem('Basilisk hide',quantityLow+RandRange(randLow));
  12090. inv.AddAnItem('Basilisk venom',quantityLow+RandRange(randLow));
  12091. inv.AddAnItem('Berserker pelt',quantityLow+RandRange(randLow));
  12092. inv.AddAnItem('Coal',quantityHigh+RandRange(randHigh));
  12093. inv.AddAnItem('Cotton',quantityHigh+RandRange(randHigh));
  12094. inv.AddAnItem('Dark iron ingot',quantityLow+RandRange(randLow));
  12095. inv.AddAnItem('Dark iron ore',quantityLow+RandRange(randLow));
  12096. inv.AddAnItem('Diamond dust',quantityLow+RandRange(randLow));
  12097. inv.AddAnItem('Draconide leather',quantityLow+RandRange(randLow));
  12098. inv.AddAnItem('Drowned dead tongue',quantityLow+RandRange(randLow));
  12099. inv.AddAnItem('Drowner brain',quantityMedium+RandRange(randMedium));
  12100. inv.AddAnItem('Dwimeryte ingot',quantityLow+RandRange(randLow));
  12101. inv.AddAnItem('Dwimeryte ore',quantityLow+RandRange(randLow));
  12102. inv.AddAnItem('Emerald dust',quantityLow+RandRange(randLow));
  12103. inv.AddAnItem('Endriag chitin plates',quantityMedium+RandRange(randMedium));
  12104. inv.AddAnItem('Endriag embryo',quantityLow+RandRange(randLow));
  12105. inv.AddAnItem('Ghoul blood',quantityMedium+RandRange(randMedium));
  12106. inv.AddAnItem('Hag teeth',quantityMedium+RandRange(randMedium));
  12107. inv.AddAnItem('Hardened leather',quantityMedium+RandRange(randMedium));
  12108. inv.AddAnItem('Hardened timber',quantityMedium+RandRange(randMedium));
  12109. inv.AddAnItem('Harpy feathers',quantityMedium+RandRange(randMedium));
  12110. inv.AddAnItem('Iron ore',quantityHigh+RandRange(randHigh));
  12111. inv.AddAnItem('Leather straps',quantityHigh+RandRange(randHigh));
  12112. inv.AddAnItem('Leather',quantityHigh+RandRange(randHigh));
  12113. inv.AddAnItem('Linen',quantityMedium+RandRange(randMedium));
  12114. inv.AddAnItem('Meteorite ingot',quantityLow+RandRange(randLow));
  12115. inv.AddAnItem('Meteorite ore',quantityMedium+RandRange(randMedium));
  12116. inv.AddAnItem('Necrophage skin',quantityLow+RandRange(randLow));
  12117. inv.AddAnItem('Nekker blood',quantityHigh+RandRange(randHigh));
  12118. inv.AddAnItem('Nekker heart',quantityMedium+RandRange(randMedium));
  12119. inv.AddAnItem('Oil',quantityHigh+RandRange(randHigh));
  12120. inv.AddAnItem('Phosphorescent crystal',quantityLow+RandRange(randLow));
  12121. inv.AddAnItem('Pure silver',quantityMedium+RandRange(randMedium));
  12122. inv.AddAnItem('Rotfiend blood',quantityMedium+RandRange(randMedium));
  12123. inv.AddAnItem('Sapphire dust',quantityLow+RandRange(randLow));
  12124. inv.AddAnItem('Silk',quantityHigh+RandRange(randHigh));
  12125. inv.AddAnItem('Silver ingot',quantityMedium+RandRange(randMedium));
  12126. inv.AddAnItem('Silver ore',quantityHigh+RandRange(randHigh));
  12127. inv.AddAnItem('Specter dust',quantityMedium+RandRange(randMedium));
  12128. inv.AddAnItem('Steel ingot',quantityHigh+RandRange(randHigh));
  12129. inv.AddAnItem('String',quantityHigh+RandRange(randHigh));
  12130. inv.AddAnItem('Thread',quantityHigh+RandRange(randHigh));
  12131. inv.AddAnItem('Timber',quantityHigh+RandRange(randHigh));
  12132. inv.AddAnItem('Twine',quantityMedium+RandRange(randMedium));
  12133. inv.AddAnItem('Venom extract',quantityMedium+RandRange(randMedium));
  12134. inv.AddAnItem('Water essence',quantityMedium+RandRange(randMedium));
  12135. inv.AddAnItem('Wolf liver',quantityHigh+RandRange(randHigh));
  12136. inv.AddAnItem('Alcohest', 3);
  12137. inv.AddAnItem('Dwarven spirit', 4);
  12138.  
  12139.  
  12140. ids.Clear();
  12141. ids = inv.AddAnItem('Crossbow 5');
  12142. EquipItem(ids[0]);
  12143. ids.Clear();
  12144. ids = inv.AddAnItem('Blunt Bolt', 20);
  12145. EquipItem(ids[0]);
  12146. inv.AddAnItem('Broadhead Bolt', 20);
  12147. inv.AddAnItem('Split Bolt', 20);
  12148.  
  12149.  
  12150. RemoveAllAlchemyRecipes();
  12151. RemoveAllCraftingSchematics();
  12152.  
  12153.  
  12154.  
  12155.  
  12156. AddAlchemyRecipe('Recipe for Cat 1');
  12157.  
  12158.  
  12159.  
  12160. AddAlchemyRecipe('Recipe for Maribor Forest 1');
  12161. AddAlchemyRecipe('Recipe for Petris Philtre 1');
  12162. AddAlchemyRecipe('Recipe for Swallow 1');
  12163. AddAlchemyRecipe('Recipe for Tawny Owl 1');
  12164.  
  12165. AddAlchemyRecipe('Recipe for White Gull 1');
  12166. AddAlchemyRecipe('Recipe for White Honey 1');
  12167. AddAlchemyRecipe('Recipe for White Raffards Decoction 1');
  12168.  
  12169.  
  12170.  
  12171. AddAlchemyRecipe('Recipe for Beast Oil 1');
  12172. AddAlchemyRecipe('Recipe for Cursed Oil 1');
  12173. AddAlchemyRecipe('Recipe for Hanged Man Venom 1');
  12174. AddAlchemyRecipe('Recipe for Hybrid Oil 1');
  12175. AddAlchemyRecipe('Recipe for Insectoid Oil 1');
  12176. AddAlchemyRecipe('Recipe for Magicals Oil 1');
  12177. AddAlchemyRecipe('Recipe for Necrophage Oil 1');
  12178. AddAlchemyRecipe('Recipe for Specter Oil 1');
  12179. AddAlchemyRecipe('Recipe for Vampire Oil 1');
  12180. AddAlchemyRecipe('Recipe for Draconide Oil 1');
  12181. AddAlchemyRecipe('Recipe for Ogre Oil 1');
  12182. AddAlchemyRecipe('Recipe for Relic Oil 1');
  12183. AddAlchemyRecipe('Recipe for Beast Oil 2');
  12184. AddAlchemyRecipe('Recipe for Cursed Oil 2');
  12185. AddAlchemyRecipe('Recipe for Hanged Man Venom 2');
  12186. AddAlchemyRecipe('Recipe for Hybrid Oil 2');
  12187. AddAlchemyRecipe('Recipe for Insectoid Oil 2');
  12188. AddAlchemyRecipe('Recipe for Magicals Oil 2');
  12189. AddAlchemyRecipe('Recipe for Necrophage Oil 2');
  12190. AddAlchemyRecipe('Recipe for Specter Oil 2');
  12191. AddAlchemyRecipe('Recipe for Vampire Oil 2');
  12192. AddAlchemyRecipe('Recipe for Draconide Oil 2');
  12193. AddAlchemyRecipe('Recipe for Ogre Oil 2');
  12194. AddAlchemyRecipe('Recipe for Relic Oil 2');
  12195.  
  12196.  
  12197. AddAlchemyRecipe('Recipe for Dancing Star 1');
  12198.  
  12199. AddAlchemyRecipe('Recipe for Dwimeritum Bomb 1');
  12200.  
  12201. AddAlchemyRecipe('Recipe for Grapeshot 1');
  12202. AddAlchemyRecipe('Recipe for Samum 1');
  12203.  
  12204. AddAlchemyRecipe('Recipe for White Frost 1');
  12205.  
  12206.  
  12207.  
  12208. AddAlchemyRecipe('Recipe for Dwarven spirit 1');
  12209. AddAlchemyRecipe('Recipe for Alcohest 1');
  12210. AddAlchemyRecipe('Recipe for White Gull 1');
  12211.  
  12212.  
  12213. AddStartingSchematics();
  12214.  
  12215.  
  12216. ids.Clear();
  12217. ids = inv.AddAnItem('Swallow 2');
  12218. EquipItem(ids[0]);
  12219. ids.Clear();
  12220. ids = inv.AddAnItem('Thunderbolt 2');
  12221. EquipItem(ids[0]);
  12222. ids.Clear();
  12223. ids = inv.AddAnItem('Tawny Owl 2');
  12224. EquipItem(ids[0]);
  12225. ids.Clear();
  12226.  
  12227. ids = inv.AddAnItem('Grapeshot 2');
  12228. EquipItem(ids[0]);
  12229. ids.Clear();
  12230. ids = inv.AddAnItem('Samum 2');
  12231. EquipItem(ids[0]);
  12232.  
  12233. inv.AddAnItem('Dwimeritum Bomb 1');
  12234. inv.AddAnItem('Dragons Dream 1');
  12235. inv.AddAnItem('Silver Dust Bomb 1');
  12236. inv.AddAnItem('White Frost 2');
  12237. inv.AddAnItem('Devils Puffball 2');
  12238. inv.AddAnItem('Dancing Star 2');
  12239. inv.AddAnItem('Beast Oil 1');
  12240. inv.AddAnItem('Cursed Oil 1');
  12241. inv.AddAnItem('Hanged Man Venom 2');
  12242. inv.AddAnItem('Hybrid Oil 1');
  12243. inv.AddAnItem('Insectoid Oil 1');
  12244. inv.AddAnItem('Magicals Oil 1');
  12245. inv.AddAnItem('Necrophage Oil 2');
  12246. inv.AddAnItem('Specter Oil 1');
  12247. inv.AddAnItem('Vampire Oil 1');
  12248. inv.AddAnItem('Draconide Oil 1');
  12249. inv.AddAnItem('Relic Oil 1');
  12250. inv.AddAnItem('Black Blood 1');
  12251. inv.AddAnItem('Blizzard 1');
  12252. inv.AddAnItem('Cat 2');
  12253. inv.AddAnItem('Full Moon 1');
  12254. inv.AddAnItem('Maribor Forest 1');
  12255. inv.AddAnItem('Petris Philtre 1');
  12256. inv.AddAnItem('White Gull 1', 2);
  12257. inv.AddAnItem('White Honey 2');
  12258. inv.AddAnItem('White Raffards Decoction 1');
  12259.  
  12260.  
  12261. inv.AddAnItem('Mutagen 17');
  12262. inv.AddAnItem('Mutagen 19');
  12263. inv.AddAnItem('Mutagen 27');
  12264. inv.AddAnItem('Mutagen 26');
  12265.  
  12266.  
  12267. inv.AddAnItem('weapon_repair_kit_1', 3);
  12268. inv.AddAnItem('weapon_repair_kit_2', 2);
  12269. inv.AddAnItem('armor_repair_kit_1', 3);
  12270. inv.AddAnItem('armor_repair_kit_2', 2);
  12271.  
  12272.  
  12273. quantityMedium = 1;
  12274. quantityLow = 1;
  12275. inv.AddAnItem('Rune stribog lesser', quantityMedium);
  12276. inv.AddAnItem('Rune stribog', quantityLow);
  12277. inv.AddAnItem('Rune dazhbog lesser', quantityMedium);
  12278. inv.AddAnItem('Rune dazhbog', quantityLow);
  12279. inv.AddAnItem('Rune devana lesser', quantityMedium);
  12280. inv.AddAnItem('Rune devana', quantityLow);
  12281. inv.AddAnItem('Rune zoria lesser', quantityMedium);
  12282. inv.AddAnItem('Rune zoria', quantityLow);
  12283. inv.AddAnItem('Rune morana lesser', quantityMedium);
  12284. inv.AddAnItem('Rune morana', quantityLow);
  12285. inv.AddAnItem('Rune triglav lesser', quantityMedium);
  12286. inv.AddAnItem('Rune triglav', quantityLow);
  12287. inv.AddAnItem('Rune svarog lesser', quantityMedium);
  12288. inv.AddAnItem('Rune svarog', quantityLow);
  12289. inv.AddAnItem('Rune veles lesser', quantityMedium);
  12290. inv.AddAnItem('Rune veles', quantityLow);
  12291. inv.AddAnItem('Rune perun lesser', quantityMedium);
  12292. inv.AddAnItem('Rune perun', quantityLow);
  12293. inv.AddAnItem('Rune elemental lesser', quantityMedium);
  12294. inv.AddAnItem('Rune elemental', quantityLow);
  12295.  
  12296. inv.AddAnItem('Glyph aard lesser', quantityMedium);
  12297. inv.AddAnItem('Glyph aard', quantityLow);
  12298. inv.AddAnItem('Glyph axii lesser', quantityMedium);
  12299. inv.AddAnItem('Glyph axii', quantityLow);
  12300. inv.AddAnItem('Glyph igni lesser', quantityMedium);
  12301. inv.AddAnItem('Glyph igni', quantityLow);
  12302. inv.AddAnItem('Glyph quen lesser', quantityMedium);
  12303. inv.AddAnItem('Glyph quen', quantityLow);
  12304. inv.AddAnItem('Glyph yrden lesser', quantityMedium);
  12305. inv.AddAnItem('Glyph yrden', quantityLow);
  12306.  
  12307.  
  12308. StandaloneEp1_2();
  12309. }
  12310.  
  12311. public final function StandaloneEp1_2()
  12312. {
  12313. var horseId : SItemUniqueId;
  12314. var ids : array<SItemUniqueId>;
  12315. var ents : array< CJournalBase >;
  12316. var i : int;
  12317. var manager : CWitcherJournalManager;
  12318.  
  12319.  
  12320. inv.AddAnItem( 'Cows milk', 5 );
  12321. ids.Clear();
  12322. ids = inv.AddAnItem( 'Dumpling', 5 );
  12323. EquipItem(ids[0]);
  12324.  
  12325.  
  12326. inv.AddAnItem('Clearing Potion', 2, true, false, false);
  12327.  
  12328.  
  12329. GetHorseManager().RemoveAllItems();
  12330.  
  12331. ids.Clear();
  12332. ids = inv.AddAnItem('Horse Bag 2');
  12333. horseId = GetHorseManager().MoveItemToHorse(ids[0]);
  12334. GetHorseManager().EquipItem(horseId);
  12335.  
  12336. ids.Clear();
  12337. ids = inv.AddAnItem('Horse Blinder 2');
  12338. horseId = GetHorseManager().MoveItemToHorse(ids[0]);
  12339. GetHorseManager().EquipItem(horseId);
  12340.  
  12341. ids.Clear();
  12342. ids = inv.AddAnItem('Horse Saddle 2');
  12343. horseId = GetHorseManager().MoveItemToHorse(ids[0]);
  12344. GetHorseManager().EquipItem(horseId);
  12345.  
  12346. manager = theGame.GetJournalManager();
  12347.  
  12348.  
  12349. manager.GetActivatedOfType( 'CJournalCreature', ents );
  12350. for(i=0; i<ents.Size(); i+=1)
  12351. {
  12352. manager.ActivateEntry(ents[i], JS_Inactive, false, true);
  12353. }
  12354.  
  12355.  
  12356. ents.Clear();
  12357. manager.GetActivatedOfType( 'CJournalCharacter', ents );
  12358. for(i=0; i<ents.Size(); i+=1)
  12359. {
  12360. manager.ActivateEntry(ents[i], JS_Inactive, false, true);
  12361. }
  12362.  
  12363.  
  12364. ents.Clear();
  12365. manager.GetActivatedOfType( 'CJournalQuest', ents );
  12366. for(i=0; i<ents.Size(); i+=1)
  12367. {
  12368.  
  12369. if( StrStartsWith(ents[i].baseName, "q60"))
  12370. continue;
  12371.  
  12372. manager.ActivateEntry(ents[i], JS_Inactive, false, true);
  12373. }
  12374.  
  12375.  
  12376. manager.ActivateEntryByScriptTag('TutorialAard', JS_Active);
  12377. manager.ActivateEntryByScriptTag('TutorialAdrenaline', JS_Active);
  12378. manager.ActivateEntryByScriptTag('TutorialAxii', JS_Active);
  12379. manager.ActivateEntryByScriptTag('TutorialAxiiDialog', JS_Active);
  12380. manager.ActivateEntryByScriptTag('TutorialCamera', JS_Active);
  12381. manager.ActivateEntryByScriptTag('TutorialCamera_pad', JS_Active);
  12382. manager.ActivateEntryByScriptTag('TutorialCiriBlink', JS_Active);
  12383. manager.ActivateEntryByScriptTag('TutorialCiriCharge', JS_Active);
  12384. manager.ActivateEntryByScriptTag('TutorialCiriStamina', JS_Active);
  12385. manager.ActivateEntryByScriptTag('TutorialCounter', JS_Active);
  12386. manager.ActivateEntryByScriptTag('TutorialDialogClose', JS_Active);
  12387. manager.ActivateEntryByScriptTag('TutorialFallingRoll', JS_Active);
  12388. manager.ActivateEntryByScriptTag('TutorialFocus', JS_Active);
  12389. manager.ActivateEntryByScriptTag('TutorialFocusClues', JS_Active);
  12390. manager.ActivateEntryByScriptTag('TutorialFocusClues', JS_Active);
  12391. manager.ActivateEntryByScriptTag('TutorialHorseRoad', JS_Active);
  12392. manager.ActivateEntryByScriptTag('TutorialHorseSpeed0', JS_Active);
  12393. manager.ActivateEntryByScriptTag('TutorialHorseSpeed0_pad', JS_Active);
  12394. manager.ActivateEntryByScriptTag('TutorialHorseSpeed1', JS_Active);
  12395. manager.ActivateEntryByScriptTag('TutorialHorseSpeed2', JS_Active);
  12396. manager.ActivateEntryByScriptTag('TutorialHorseSummon', JS_Active);
  12397. manager.ActivateEntryByScriptTag('TutorialHorseSummon_pad', JS_Active);
  12398. manager.ActivateEntryByScriptTag('TutorialIgni', JS_Active);
  12399. manager.ActivateEntryByScriptTag('TutorialJournalAlternateSings', JS_Active);
  12400. manager.ActivateEntryByScriptTag('TutorialJournalBoatDamage', JS_Active);
  12401. manager.ActivateEntryByScriptTag('TutorialJournalBoatMount', JS_Active);
  12402. manager.ActivateEntryByScriptTag('TutorialJournalBuffs', JS_Active);
  12403. manager.ActivateEntryByScriptTag('TutorialJournalCharDevLeveling', JS_Active);
  12404. manager.ActivateEntryByScriptTag('TutorialJournalCharDevSkills', JS_Active);
  12405. manager.ActivateEntryByScriptTag('TutorialJournalCrafting', JS_Active);
  12406. manager.ActivateEntryByScriptTag('TutorialJournalCrossbow', JS_Active);
  12407. manager.ActivateEntryByScriptTag('TutorialJournalDialogGwint', JS_Active);
  12408. manager.ActivateEntryByScriptTag('TutorialJournalDialogShop', JS_Active);
  12409. manager.ActivateEntryByScriptTag('TutorialJournalDive', JS_Active);
  12410. manager.ActivateEntryByScriptTag('TutorialJournalDodge', JS_Active);
  12411. manager.ActivateEntryByScriptTag('TutorialJournalDodge_pad', JS_Active);
  12412. manager.ActivateEntryByScriptTag('TutorialJournalDrawWeapon', JS_Active);
  12413. manager.ActivateEntryByScriptTag('TutorialJournalDrawWeapon_pad', JS_Active);
  12414. manager.ActivateEntryByScriptTag('TutorialJournalDurability', JS_Active);
  12415. manager.ActivateEntryByScriptTag('TutorialJournalExplorations', JS_Active);
  12416. manager.ActivateEntryByScriptTag('TutorialJournalExplorations_pad', JS_Active);
  12417. manager.ActivateEntryByScriptTag('TutorialJournalFastTravel', JS_Active);
  12418. manager.ActivateEntryByScriptTag('TutorialJournalFocusRedObjects', JS_Active);
  12419. manager.ActivateEntryByScriptTag('TutorialJournalGasClouds', JS_Active);
  12420. manager.ActivateEntryByScriptTag('TutorialJournalHeavyAttacks', JS_Active);
  12421. manager.ActivateEntryByScriptTag('TutorialJournalHorse', JS_Active);
  12422. manager.ActivateEntryByScriptTag('TutorialJournalHorseStamina', JS_Active);
  12423. manager.ActivateEntryByScriptTag('TutorialJournalJump', JS_Active);
  12424. manager.ActivateEntryByScriptTag('TutorialJournalLightAttacks', JS_Active);
  12425. manager.ActivateEntryByScriptTag('TutorialJournalLightAttacks_pad', JS_Active);
  12426. manager.ActivateEntryByScriptTag('TutorialJournalMeditation', JS_Active);
  12427. manager.ActivateEntryByScriptTag('TutorialJournalMeditation_pad', JS_Active);
  12428. manager.ActivateEntryByScriptTag('TutorialJournalMonsterThreatLevels', JS_Active);
  12429. manager.ActivateEntryByScriptTag('TutorialJournalMovement', JS_Active);
  12430. manager.ActivateEntryByScriptTag('TutorialJournalMovement_pad', JS_Active);
  12431. manager.ActivateEntryByScriptTag('TutorialJournalMutagenIngredient', JS_Active);
  12432. manager.ActivateEntryByScriptTag('TutorialJournalMutagenPotion', JS_Active);
  12433. manager.ActivateEntryByScriptTag('TutorialJournalOils', JS_Active);
  12434. manager.ActivateEntryByScriptTag('TutorialJournalPetards', JS_Active);
  12435. manager.ActivateEntryByScriptTag('TutorialJournalPotions', JS_Active);
  12436. manager.ActivateEntryByScriptTag('TutorialJournalPotions_pad', JS_Active);
  12437. manager.ActivateEntryByScriptTag('TutorialJournalQuestArea', JS_Active);
  12438. manager.ActivateEntryByScriptTag('TutorialJournalRadial', JS_Active);
  12439. manager.ActivateEntryByScriptTag('TutorialJournalRifts', JS_Active);
  12440. manager.ActivateEntryByScriptTag('TutorialJournalRun', JS_Active);
  12441. manager.ActivateEntryByScriptTag('TutorialJournalShopDescription', JS_Active);
  12442. manager.ActivateEntryByScriptTag('TutorialJournalSignCast', JS_Active);
  12443. manager.ActivateEntryByScriptTag('TutorialJournalSignCast_pad', JS_Active);
  12444. manager.ActivateEntryByScriptTag('TutorialJournalSpecialAttacks', JS_Active);
  12445. manager.ActivateEntryByScriptTag('TutorialJournalStaminaExploration', JS_Active);
  12446. manager.ActivateEntryByScriptTag('TutorialJumpHang', JS_Active);
  12447. manager.ActivateEntryByScriptTag('TutorialLadder', JS_Active);
  12448. manager.ActivateEntryByScriptTag('TutorialLadderMove', JS_Active);
  12449. manager.ActivateEntryByScriptTag('TutorialLadderMove_pad', JS_Active);
  12450. manager.ActivateEntryByScriptTag('TutorialObjectiveSwitching', JS_Active);
  12451. manager.ActivateEntryByScriptTag('TutorialOxygen', JS_Active);
  12452. manager.ActivateEntryByScriptTag('TutorialParry', JS_Active);
  12453. manager.ActivateEntryByScriptTag('TutorialPOIUncovered', JS_Active);
  12454. manager.ActivateEntryByScriptTag('TutorialQuen', JS_Active);
  12455. manager.ActivateEntryByScriptTag('TutorialRoll', JS_Active);
  12456. manager.ActivateEntryByScriptTag('TutorialRoll_pad', JS_Active);
  12457. manager.ActivateEntryByScriptTag('TutorialSpeedPairing', JS_Active);
  12458. manager.ActivateEntryByScriptTag('TutorialSprint', JS_Active);
  12459. manager.ActivateEntryByScriptTag('TutorialStaminaSigns', JS_Active);
  12460. manager.ActivateEntryByScriptTag('TutorialStealing', JS_Active);
  12461. manager.ActivateEntryByScriptTag('TutorialSwimmingSpeed', JS_Active);
  12462. manager.ActivateEntryByScriptTag('TutorialTimedChoiceDialog', JS_Active);
  12463. manager.ActivateEntryByScriptTag('TutorialYrden', JS_Active);
  12464.  
  12465.  
  12466. FactsAdd('kill_base_tutorials');
  12467.  
  12468.  
  12469. theGame.GetTutorialSystem().RemoveAllQueuedTutorials();
  12470.  
  12471. if( FactsQuerySum("standalone_ep1") < 1 ) //modSigns
  12472. FactsAdd("standalone_ep1");
  12473. FactsRemove("StandAloneEP1");
  12474.  
  12475. theGame.GetJournalManager().ForceUntrackingQuestForEP1Savegame();
  12476. }
  12477.  
  12478. final function Debug_FocusBoyFocusGain()
  12479. {
  12480. var focusGain : float;
  12481.  
  12482. focusGain = FactsQuerySum( "debug_fact_focus_boy" ) ;
  12483. GainStat( BCS_Focus, focusGain );
  12484. }
  12485.  
  12486. public final function StandaloneEp2_1()
  12487. {
  12488. var i, inc, quantityLow, randLow, quantityMedium, randMedium, quantityHigh, randHigh, startingMoney : int;
  12489. var pam : W3PlayerAbilityManager;
  12490. var ids : array<SItemUniqueId>;
  12491. var STARTING_LEVEL : int;
  12492.  
  12493. FactsAdd( "StandAloneEP2", 1 );
  12494.  
  12495.  
  12496. inv.RemoveAllItems();
  12497.  
  12498.  
  12499. inv.AddAnItem( 'Illusion Medallion', 1, true, true, false );
  12500. inv.AddAnItem( 'q103_safe_conduct', 1, true, true, false );
  12501.  
  12502.  
  12503. theGame.GetGamerProfile().ClearAllAchievementsForEP2();
  12504.  
  12505.  
  12506. levelManager.Hack_EP2StandaloneLevelShrink( 35 );
  12507.  
  12508.  
  12509. levelManager.ResetCharacterDev();
  12510. pam = ( W3PlayerAbilityManager )abilityManager;
  12511. if( pam )
  12512. {
  12513. pam.ResetCharacterDev();
  12514. }
  12515. levelManager.SetFreeSkillPoints( levelManager.GetLevel() - 1 + 11 );
  12516.  
  12517.  
  12518. //modSigns
  12519. inv.AddAnItem('Greater mutagen red', 1);
  12520. inv.AddAnItem('Greater mutagen green', 1);
  12521. inv.AddAnItem('Greater mutagen blue', 1);
  12522. inv.AddAnItem('Mutagen red', 2);
  12523. inv.AddAnItem('Mutagen green', 2);
  12524. inv.AddAnItem('Mutagen blue', 2);
  12525. inv.AddAnItem('Lesser mutagen red', 2);
  12526. inv.AddAnItem('Lesser mutagen green', 2);
  12527. inv.AddAnItem('Lesser mutagen blue', 2);
  12528.  
  12529.  
  12530. startingMoney = 5000;
  12531. if( GetMoney() > startingMoney )
  12532. {
  12533. RemoveMoney( GetMoney() - startingMoney );
  12534. }
  12535. else
  12536. {
  12537. AddMoney( 5000 - GetMoney() );
  12538. }
  12539.  
  12540.  
  12541. ids.Clear();
  12542. ids = inv.AddAnItem( 'EP2 Standalone Starting Armor' );
  12543. EquipItem( ids[0] );
  12544. ids.Clear();
  12545. ids = inv.AddAnItem( 'EP2 Standalone Starting Boots' );
  12546. EquipItem( ids[0] );
  12547. ids.Clear();
  12548. ids = inv.AddAnItem( 'EP2 Standalone Starting Gloves' );
  12549. EquipItem( ids[0] );
  12550. ids.Clear();
  12551. ids = inv.AddAnItem( 'EP2 Standalone Starting Pants' );
  12552. EquipItem( ids[0] );
  12553.  
  12554.  
  12555. ids.Clear();
  12556. ids = inv.AddAnItem( 'EP2 Standalone Starting Steel Sword' );
  12557. EquipItem( ids[0] );
  12558. ids.Clear();
  12559. ids = inv.AddAnItem( 'EP2 Standalone Starting Silver Sword' );
  12560. EquipItem( ids[0] );
  12561.  
  12562.  
  12563. inv.AddAnItem( 'Torch', 1, true, true, false );
  12564.  
  12565.  
  12566. //modSigns
  12567. quantityLow = 1;
  12568. randLow = 2;
  12569. quantityMedium = 2;
  12570. randMedium = 2;
  12571. quantityHigh = 3;
  12572. randHigh = 2;
  12573.  
  12574. inv.AddAnItem( 'Alghoul bone marrow',quantityMedium+RandRange( randMedium ) );
  12575. inv.AddAnItem( 'Amethyst dust',quantityLow+RandRange( randLow ) );
  12576. inv.AddAnItem( 'Arachas eyes',quantityLow+RandRange( randLow ) );
  12577. inv.AddAnItem( 'Arachas venom',quantityLow+RandRange( randLow ) );
  12578. inv.AddAnItem( 'Basilisk hide',quantityLow+RandRange( randLow ) );
  12579. inv.AddAnItem( 'Basilisk venom',quantityLow+RandRange( randLow ) );
  12580. inv.AddAnItem( 'Berserker pelt',quantityLow+RandRange( randLow ) );
  12581. inv.AddAnItem( 'Coal',quantityHigh+RandRange( randHigh ) );
  12582. inv.AddAnItem( 'Cotton',quantityHigh+RandRange( randHigh ) );
  12583. inv.AddAnItem( 'Diamond dust',quantityLow+RandRange( randLow ) );
  12584. inv.AddAnItem( 'Drowned dead tongue',quantityLow+RandRange( randLow ) );
  12585. inv.AddAnItem( 'Drowner brain',quantityMedium+RandRange( randMedium ) );
  12586. inv.AddAnItem( 'Endriag chitin plates',quantityMedium+RandRange( randMedium ) );
  12587. inv.AddAnItem( 'Endriag embryo',quantityLow+RandRange( randLow ) );
  12588. inv.AddAnItem( 'Ghoul blood',quantityMedium+RandRange( randMedium ) );
  12589. inv.AddAnItem( 'Hag teeth',quantityMedium+RandRange( randMedium ) );
  12590. inv.AddAnItem( 'Hardened leather',quantityMedium+RandRange( randMedium ) );
  12591. inv.AddAnItem( 'Hardened timber',quantityMedium+RandRange( randMedium ) );
  12592. inv.AddAnItem( 'Harpy feathers',quantityMedium+RandRange( randMedium ) );
  12593. inv.AddAnItem( 'Necrophage skin',quantityLow+RandRange( randLow ) );
  12594. inv.AddAnItem( 'Nekker blood',quantityHigh+RandRange( randHigh ) );
  12595. inv.AddAnItem( 'Nekker heart',quantityMedium+RandRange( randMedium ) );
  12596. inv.AddAnItem( 'Phosphorescent crystal',quantityLow+RandRange( randLow ) );
  12597. inv.AddAnItem( 'Rotfiend blood',quantityMedium+RandRange( randMedium ) );
  12598. inv.AddAnItem( 'Sapphire dust',quantityLow+RandRange( randLow ) );
  12599. inv.AddAnItem( 'Specter dust',quantityMedium+RandRange( randMedium ) );
  12600. inv.AddAnItem( 'Water essence',quantityMedium+RandRange( randMedium ) );
  12601. inv.AddAnItem( 'Wolf liver',quantityHigh+RandRange( randHigh ) );
  12602. inv.AddAnItem( 'Alcohest', 3 );
  12603. inv.AddAnItem( 'Dwarven spirit', 4 );
  12604.  
  12605.  
  12606. ids.Clear();
  12607. ids = inv.AddAnItem( 'Crossbow 5' );
  12608. EquipItem( ids[0] );
  12609. ids.Clear();
  12610. ids = inv.AddAnItem( 'Blunt Bolt', 20 );
  12611. EquipItem( ids[0] );
  12612. inv.AddAnItem( 'Broadhead Bolt', 20 );
  12613. inv.AddAnItem( 'Split Bolt', 20 );
  12614.  
  12615.  
  12616. RemoveAllAlchemyRecipes();
  12617. RemoveAllCraftingSchematics();
  12618.  
  12619.  
  12620.  
  12621.  
  12622.  
  12623.  
  12624.  
  12625.  
  12626.  
  12627. AddAlchemyRecipe( 'Recipe for Petris Philtre 2' );
  12628. AddAlchemyRecipe( 'Recipe for Swallow 1' );
  12629. AddAlchemyRecipe( 'Recipe for Tawny Owl 1' );
  12630.  
  12631. AddAlchemyRecipe( 'Recipe for White Gull 1' );
  12632.  
  12633.  
  12634.  
  12635.  
  12636.  
  12637. AddAlchemyRecipe( 'Recipe for Beast Oil 1' );
  12638. AddAlchemyRecipe( 'Recipe for Cursed Oil 1' );
  12639. AddAlchemyRecipe( 'Recipe for Hanged Man Venom 1' );
  12640. AddAlchemyRecipe( 'Recipe for Hybrid Oil 1' );
  12641. AddAlchemyRecipe( 'Recipe for Insectoid Oil 2' );
  12642. AddAlchemyRecipe( 'Recipe for Magicals Oil 1' );
  12643. AddAlchemyRecipe( 'Recipe for Necrophage Oil 1' );
  12644. AddAlchemyRecipe( 'Recipe for Specter Oil 1' );
  12645. AddAlchemyRecipe( 'Recipe for Vampire Oil 2' );
  12646. AddAlchemyRecipe( 'Recipe for Draconide Oil 2' );
  12647. AddAlchemyRecipe( 'Recipe for Ogre Oil 1' );
  12648. AddAlchemyRecipe( 'Recipe for Relic Oil 1' );
  12649. AddAlchemyRecipe( 'Recipe for Beast Oil 2' );
  12650. AddAlchemyRecipe( 'Recipe for Cursed Oil 2' );
  12651. AddAlchemyRecipe( 'Recipe for Hanged Man Venom 2' );
  12652. AddAlchemyRecipe( 'Recipe for Hybrid Oil 2' );
  12653. AddAlchemyRecipe( 'Recipe for Insectoid Oil 2' );
  12654. AddAlchemyRecipe( 'Recipe for Magicals Oil 2' );
  12655. AddAlchemyRecipe( 'Recipe for Necrophage Oil 2' );
  12656. AddAlchemyRecipe( 'Recipe for Specter Oil 2' );
  12657. AddAlchemyRecipe( 'Recipe for Vampire Oil 2' );
  12658. AddAlchemyRecipe( 'Recipe for Draconide Oil 2' );
  12659. AddAlchemyRecipe( 'Recipe for Ogre Oil 2' );
  12660. AddAlchemyRecipe( 'Recipe for Relic Oil 2' );
  12661.  
  12662.  
  12663. AddAlchemyRecipe( 'Recipe for Dancing Star 1' );
  12664.  
  12665. AddAlchemyRecipe( 'Recipe for Dwimeritum Bomb 1' );
  12666.  
  12667. AddAlchemyRecipe( 'Recipe for Grapeshot 1' );
  12668. AddAlchemyRecipe( 'Recipe for Samum 1' );
  12669.  
  12670. AddAlchemyRecipe( 'Recipe for White Frost 1' );
  12671.  
  12672.  
  12673.  
  12674. AddAlchemyRecipe( 'Recipe for Dwarven spirit 1' );
  12675. AddAlchemyRecipe( 'Recipe for Alcohest 1' );
  12676. AddAlchemyRecipe( 'Recipe for White Gull 1' );
  12677.  
  12678.  
  12679. AddStartingSchematics();
  12680.  
  12681.  
  12682. ids.Clear();
  12683. ids = inv.AddAnItem( 'Swallow 2' );
  12684. EquipItem( ids[0] );
  12685. ids.Clear();
  12686. ids = inv.AddAnItem( 'Thunderbolt 2' );
  12687. EquipItem( ids[0] );
  12688. ids.Clear();
  12689. ids = inv.AddAnItem( 'Tawny Owl 2' );
  12690. EquipItem( ids[0] );
  12691. ids.Clear();
  12692.  
  12693. ids = inv.AddAnItem( 'Grapeshot 2' );
  12694. EquipItem( ids[0] );
  12695. ids.Clear();
  12696. ids = inv.AddAnItem( 'Samum 2' );
  12697. EquipItem( ids[0] );
  12698.  
  12699. inv.AddAnItem( 'Dwimeritum Bomb 1' );
  12700. inv.AddAnItem( 'Dragons Dream 1' );
  12701. inv.AddAnItem( 'Silver Dust Bomb 1' );
  12702. inv.AddAnItem( 'White Frost 2' );
  12703. inv.AddAnItem( 'Devils Puffball 2' );
  12704. inv.AddAnItem( 'Dancing Star 2' );
  12705. inv.AddAnItem( 'Beast Oil 1' );
  12706. inv.AddAnItem( 'Cursed Oil 1' );
  12707. inv.AddAnItem( 'Hanged Man Venom 2' );
  12708. inv.AddAnItem( 'Hybrid Oil 2' );
  12709. inv.AddAnItem( 'Insectoid Oil 2' );
  12710. inv.AddAnItem( 'Magicals Oil 1' );
  12711. inv.AddAnItem( 'Necrophage Oil 2' );
  12712. inv.AddAnItem( 'Ogre Oil 1' );
  12713. inv.AddAnItem( 'Specter Oil 1' );
  12714. inv.AddAnItem( 'Vampire Oil 2' );
  12715. inv.AddAnItem( 'Draconide Oil 2' );
  12716. inv.AddAnItem( 'Relic Oil 1' );
  12717. inv.AddAnItem( 'Black Blood 1' );
  12718. inv.AddAnItem( 'Blizzard 1' );
  12719. inv.AddAnItem( 'Cat 2' );
  12720. inv.AddAnItem( 'Full Moon 1' );
  12721. inv.AddAnItem( 'Golden Oriole 1' );
  12722. inv.AddAnItem( 'Killer Whale 1' );
  12723. inv.AddAnItem( 'Maribor Forest 1' );
  12724. inv.AddAnItem( 'Petris Philtre 2' );
  12725. inv.AddAnItem( 'White Gull 1', 2 );
  12726. inv.AddAnItem( 'White Honey 2' );
  12727. inv.AddAnItem( 'White Raffards Decoction 1' );
  12728.  
  12729.  
  12730. inv.AddAnItem( 'Mutagen 17' );
  12731. inv.AddAnItem( 'Mutagen 19' );
  12732. inv.AddAnItem( 'Mutagen 27' );
  12733. inv.AddAnItem( 'Mutagen 26' );
  12734.  
  12735.  
  12736. inv.AddAnItem( 'weapon_repair_kit_1', 3 );
  12737. inv.AddAnItem( 'weapon_repair_kit_2', 2 );
  12738. inv.AddAnItem( 'armor_repair_kit_1', 3 );
  12739. inv.AddAnItem( 'armor_repair_kit_2', 2 );
  12740.  
  12741.  
  12742. quantityMedium = 1;
  12743. quantityLow = 1;
  12744. inv.AddAnItem( 'Rune stribog lesser', quantityMedium );
  12745. inv.AddAnItem( 'Rune stribog', quantityLow );
  12746. inv.AddAnItem( 'Rune dazhbog lesser', quantityMedium );
  12747. inv.AddAnItem( 'Rune dazhbog', quantityLow );
  12748. inv.AddAnItem( 'Rune devana lesser', quantityMedium );
  12749. inv.AddAnItem( 'Rune devana', quantityLow );
  12750. inv.AddAnItem( 'Rune zoria lesser', quantityMedium );
  12751. inv.AddAnItem( 'Rune zoria', quantityLow );
  12752. inv.AddAnItem( 'Rune morana lesser', quantityMedium );
  12753. inv.AddAnItem( 'Rune morana', quantityLow );
  12754. inv.AddAnItem( 'Rune triglav lesser', quantityMedium );
  12755. inv.AddAnItem( 'Rune triglav', quantityLow );
  12756. inv.AddAnItem( 'Rune svarog lesser', quantityMedium );
  12757. inv.AddAnItem( 'Rune svarog', quantityLow );
  12758. inv.AddAnItem( 'Rune veles lesser', quantityMedium );
  12759. inv.AddAnItem( 'Rune veles', quantityLow );
  12760. inv.AddAnItem( 'Rune perun lesser', quantityMedium );
  12761. inv.AddAnItem( 'Rune perun', quantityLow );
  12762. inv.AddAnItem( 'Rune elemental lesser', quantityMedium );
  12763. inv.AddAnItem( 'Rune elemental', quantityLow );
  12764.  
  12765. inv.AddAnItem( 'Glyph aard lesser', quantityMedium );
  12766. inv.AddAnItem( 'Glyph aard', quantityLow );
  12767. inv.AddAnItem( 'Glyph axii lesser', quantityMedium );
  12768. inv.AddAnItem( 'Glyph axii', quantityLow );
  12769. inv.AddAnItem( 'Glyph igni lesser', quantityMedium );
  12770. inv.AddAnItem( 'Glyph igni', quantityLow );
  12771. inv.AddAnItem( 'Glyph quen lesser', quantityMedium );
  12772. inv.AddAnItem( 'Glyph quen', quantityLow );
  12773. inv.AddAnItem( 'Glyph yrden lesser', quantityMedium );
  12774. inv.AddAnItem( 'Glyph yrden', quantityLow );
  12775.  
  12776.  
  12777. StandaloneEp2_2();
  12778. }
  12779.  
  12780. //Ice Breath+
  12781. timer function NPCbreathTimer(deltaTime : float , id : int){
  12782.  
  12783. if(enableIceBreath){
  12784. iceBreath.IceBreathEnable();
  12785. }
  12786. else{
  12787. iceBreath.IceBreathDisable();
  12788. }
  12789. }
  12790.  
  12791. timer function HorseBreathTimer(deltaTime : float , id : int){
  12792.  
  12793. iceBreath.HorseBreathEnable();
  12794. }
  12795.  
  12796. timer function IceBreathTimer(deltaTime : float , id : int){
  12797.  
  12798. if(iceBreath.isCold()){
  12799. if(!enableIceBreath){
  12800. //theGame.GetGuiManager().ShowNotification("True");
  12801. enableIceBreath = true;
  12802. thePlayer.PlayEffectSingle('ice_breath_gameplay');
  12803. iceBreath.IceBreathEnable();
  12804. iceBreath.HorseBreathEnable();
  12805. AddTimer('HorseBreathTimer',1.5,true);
  12806. AddTimer('NPCbreathTimer',10.0,true);
  12807. }
  12808. }
  12809. else{
  12810. if(theGame.GetCommonMapManager().GetCurrentArea() != AN_Spiral){
  12811. if(enableIceBreath){
  12812. enableIceBreath = false;
  12813. //theGame.GetGuiManager().ShowNotification("False");
  12814. thePlayer.StopEffect('ice_breath_gameplay');
  12815. RemoveTimer( 'HorseBreathTimer' );
  12816. }
  12817. }
  12818.  
  12819. }
  12820.  
  12821. }
  12822. //Ice Breath-*/
  12823.  
  12824. public final function StandaloneEp2_2()
  12825. {
  12826. var horseId : SItemUniqueId;
  12827. var ids : array<SItemUniqueId>;
  12828. var ents : array< CJournalBase >;
  12829. var i : int;
  12830. var manager : CWitcherJournalManager;
  12831.  
  12832.  
  12833. inv.AddAnItem( 'Cows milk', 5 );
  12834. ids.Clear();
  12835. ids = inv.AddAnItem( 'Dumpling', 5 );
  12836. EquipItem( ids[0] );
  12837.  
  12838.  
  12839. inv.AddAnItem( 'Clearing Potion', 2, true, false, false );
  12840.  
  12841.  
  12842. GetHorseManager().RemoveAllItems();
  12843.  
  12844. ids.Clear();
  12845. ids = inv.AddAnItem( 'Horse Bag 2' );
  12846. horseId = GetHorseManager( ).MoveItemToHorse( ids[0] );
  12847. GetHorseManager().EquipItem( horseId );
  12848.  
  12849. ids.Clear();
  12850. ids = inv.AddAnItem( 'Horse Blinder 2' );
  12851. horseId = GetHorseManager().MoveItemToHorse( ids[0] );
  12852. GetHorseManager().EquipItem( horseId );
  12853.  
  12854. ids.Clear();
  12855. ids = inv.AddAnItem( 'Horse Saddle 2' );
  12856. horseId = GetHorseManager().MoveItemToHorse( ids[0] );
  12857. GetHorseManager().EquipItem( horseId );
  12858.  
  12859. manager = theGame.GetJournalManager();
  12860.  
  12861.  
  12862. manager.GetActivatedOfType( 'CJournalCreature', ents );
  12863. for(i=0; i<ents.Size(); i+=1)
  12864. {
  12865. manager.ActivateEntry( ents[i], JS_Inactive, false, true );
  12866. }
  12867.  
  12868.  
  12869. ents.Clear();
  12870. manager.GetActivatedOfType( 'CJournalCharacter', ents );
  12871. for(i=0; i<ents.Size(); i+=1)
  12872. {
  12873. manager.ActivateEntry( ents[i], JS_Inactive, false, true );
  12874. }
  12875.  
  12876.  
  12877. ents.Clear();
  12878. manager.GetActivatedOfType( 'CJournalQuest', ents );
  12879. for(i=0; i<ents.Size(); i+=1)
  12880. {
  12881.  
  12882. if( StrStartsWith( ents[i].baseName, "q60" ) )
  12883. continue;
  12884.  
  12885. manager.ActivateEntry( ents[i], JS_Inactive, false, true );
  12886. }
  12887.  
  12888.  
  12889. manager.ActivateEntryByScriptTag( 'TutorialAard', JS_Active );
  12890. manager.ActivateEntryByScriptTag( 'TutorialAdrenaline', JS_Active );
  12891. manager.ActivateEntryByScriptTag( 'TutorialAxii', JS_Active );
  12892. manager.ActivateEntryByScriptTag( 'TutorialAxiiDialog', JS_Active );
  12893. manager.ActivateEntryByScriptTag( 'TutorialCamera', JS_Active );
  12894. manager.ActivateEntryByScriptTag( 'TutorialCamera_pad', JS_Active );
  12895. manager.ActivateEntryByScriptTag( 'TutorialCiriBlink', JS_Active );
  12896. manager.ActivateEntryByScriptTag( 'TutorialCiriCharge', JS_Active );
  12897. manager.ActivateEntryByScriptTag( 'TutorialCiriStamina', JS_Active );
  12898. manager.ActivateEntryByScriptTag( 'TutorialCounter', JS_Active );
  12899. manager.ActivateEntryByScriptTag( 'TutorialDialogClose', JS_Active );
  12900. manager.ActivateEntryByScriptTag( 'TutorialFallingRoll', JS_Active );
  12901. manager.ActivateEntryByScriptTag( 'TutorialFocus', JS_Active );
  12902. manager.ActivateEntryByScriptTag( 'TutorialFocusClues', JS_Active );
  12903. manager.ActivateEntryByScriptTag( 'TutorialFocusClues', JS_Active );
  12904. manager.ActivateEntryByScriptTag( 'TutorialHorseRoad', JS_Active );
  12905. manager.ActivateEntryByScriptTag( 'TutorialHorseSpeed0', JS_Active );
  12906. manager.ActivateEntryByScriptTag( 'TutorialHorseSpeed0_pad', JS_Active );
  12907. manager.ActivateEntryByScriptTag( 'TutorialHorseSpeed1', JS_Active );
  12908. manager.ActivateEntryByScriptTag( 'TutorialHorseSpeed2', JS_Active );
  12909. manager.ActivateEntryByScriptTag( 'TutorialHorseSummon', JS_Active );
  12910. manager.ActivateEntryByScriptTag( 'TutorialHorseSummon_pad', JS_Active );
  12911. manager.ActivateEntryByScriptTag( 'TutorialIgni', JS_Active );
  12912. manager.ActivateEntryByScriptTag( 'TutorialJournalAlternateSings', JS_Active );
  12913. manager.ActivateEntryByScriptTag( 'TutorialJournalBoatDamage', JS_Active );
  12914. manager.ActivateEntryByScriptTag( 'TutorialJournalBoatMount', JS_Active );
  12915. manager.ActivateEntryByScriptTag( 'TutorialJournalBuffs', JS_Active );
  12916. manager.ActivateEntryByScriptTag( 'TutorialJournalCharDevLeveling', JS_Active );
  12917. manager.ActivateEntryByScriptTag( 'TutorialJournalCharDevSkills', JS_Active );
  12918. manager.ActivateEntryByScriptTag( 'TutorialJournalCrafting', JS_Active );
  12919. manager.ActivateEntryByScriptTag( 'TutorialJournalCrossbow', JS_Active );
  12920. manager.ActivateEntryByScriptTag( 'TutorialJournalDialogGwint', JS_Active );
  12921. manager.ActivateEntryByScriptTag( 'TutorialJournalDialogShop', JS_Active );
  12922. manager.ActivateEntryByScriptTag( 'TutorialJournalDive', JS_Active );
  12923. manager.ActivateEntryByScriptTag( 'TutorialJournalDodge', JS_Active );
  12924. manager.ActivateEntryByScriptTag( 'TutorialJournalDodge_pad', JS_Active );
  12925. manager.ActivateEntryByScriptTag( 'TutorialJournalDrawWeapon', JS_Active );
  12926. manager.ActivateEntryByScriptTag( 'TutorialJournalDrawWeapon_pad', JS_Active );
  12927. manager.ActivateEntryByScriptTag( 'TutorialJournalDurability', JS_Active );
  12928. manager.ActivateEntryByScriptTag( 'TutorialJournalExplorations', JS_Active );
  12929. manager.ActivateEntryByScriptTag( 'TutorialJournalExplorations_pad', JS_Active );
  12930. manager.ActivateEntryByScriptTag( 'TutorialJournalFastTravel', JS_Active );
  12931. manager.ActivateEntryByScriptTag( 'TutorialJournalFocusRedObjects', JS_Active );
  12932. manager.ActivateEntryByScriptTag( 'TutorialJournalGasClouds', JS_Active );
  12933. manager.ActivateEntryByScriptTag( 'TutorialJournalHeavyAttacks', JS_Active );
  12934. manager.ActivateEntryByScriptTag( 'TutorialJournalHorse', JS_Active );
  12935. manager.ActivateEntryByScriptTag( 'TutorialJournalHorseStamina', JS_Active );
  12936. manager.ActivateEntryByScriptTag( 'TutorialJournalJump', JS_Active );
  12937. manager.ActivateEntryByScriptTag( 'TutorialJournalLightAttacks', JS_Active );
  12938. manager.ActivateEntryByScriptTag( 'TutorialJournalLightAttacks_pad', JS_Active );
  12939. manager.ActivateEntryByScriptTag( 'TutorialJournalMeditation', JS_Active );
  12940. manager.ActivateEntryByScriptTag( 'TutorialJournalMeditation_pad', JS_Active );
  12941. manager.ActivateEntryByScriptTag( 'TutorialJournalMonsterThreatLevels', JS_Active );
  12942. manager.ActivateEntryByScriptTag( 'TutorialJournalMovement', JS_Active );
  12943. manager.ActivateEntryByScriptTag( 'TutorialJournalMovement_pad', JS_Active );
  12944. manager.ActivateEntryByScriptTag( 'TutorialJournalMutagenIngredient', JS_Active );
  12945. manager.ActivateEntryByScriptTag( 'TutorialJournalMutagenPotion', JS_Active );
  12946. manager.ActivateEntryByScriptTag( 'TutorialJournalOils', JS_Active );
  12947. manager.ActivateEntryByScriptTag( 'TutorialJournalPetards', JS_Active );
  12948. manager.ActivateEntryByScriptTag( 'TutorialJournalPotions', JS_Active );
  12949. manager.ActivateEntryByScriptTag( 'TutorialJournalPotions_pad', JS_Active );
  12950. manager.ActivateEntryByScriptTag( 'TutorialJournalQuestArea', JS_Active );
  12951. manager.ActivateEntryByScriptTag( 'TutorialJournalRadial', JS_Active );
  12952. manager.ActivateEntryByScriptTag( 'TutorialJournalRifts', JS_Active );
  12953. manager.ActivateEntryByScriptTag( 'TutorialJournalRun', JS_Active );
  12954. manager.ActivateEntryByScriptTag( 'TutorialJournalShopDescription', JS_Active );
  12955. manager.ActivateEntryByScriptTag( 'TutorialJournalSignCast', JS_Active );
  12956. manager.ActivateEntryByScriptTag( 'TutorialJournalSignCast_pad', JS_Active );
  12957. manager.ActivateEntryByScriptTag( 'TutorialJournalSpecialAttacks', JS_Active );
  12958. manager.ActivateEntryByScriptTag( 'TutorialJournalStaminaExploration', JS_Active );
  12959. manager.ActivateEntryByScriptTag( 'TutorialJumpHang', JS_Active );
  12960. manager.ActivateEntryByScriptTag( 'TutorialLadder', JS_Active );
  12961. manager.ActivateEntryByScriptTag( 'TutorialLadderMove', JS_Active );
  12962. manager.ActivateEntryByScriptTag( 'TutorialLadderMove_pad', JS_Active );
  12963. manager.ActivateEntryByScriptTag( 'TutorialObjectiveSwitching', JS_Active );
  12964. manager.ActivateEntryByScriptTag( 'TutorialOxygen', JS_Active );
  12965. manager.ActivateEntryByScriptTag( 'TutorialParry', JS_Active );
  12966. manager.ActivateEntryByScriptTag( 'TutorialPOIUncovered', JS_Active );
  12967. manager.ActivateEntryByScriptTag( 'TutorialQuen', JS_Active );
  12968. manager.ActivateEntryByScriptTag( 'TutorialRoll', JS_Active );
  12969. manager.ActivateEntryByScriptTag( 'TutorialRoll_pad', JS_Active );
  12970. manager.ActivateEntryByScriptTag( 'TutorialSpeedPairing', JS_Active );
  12971. manager.ActivateEntryByScriptTag( 'TutorialSprint', JS_Active );
  12972. manager.ActivateEntryByScriptTag( 'TutorialStaminaSigns', JS_Active );
  12973. manager.ActivateEntryByScriptTag( 'TutorialStealing', JS_Active );
  12974. manager.ActivateEntryByScriptTag( 'TutorialSwimmingSpeed', JS_Active );
  12975. manager.ActivateEntryByScriptTag( 'TutorialTimedChoiceDialog', JS_Active );
  12976. manager.ActivateEntryByScriptTag( 'TutorialYrden', JS_Active );
  12977.  
  12978. //modSigns
  12979. inv.AddAnItem( 'Geralt Shirt', 1 );
  12980. inv.AddAnItem( 'Thread', 3 );
  12981. inv.AddAnItem( 'String', 3 );
  12982. inv.AddAnItem( 'Linen', 2 );
  12983. inv.AddAnItem( 'Silk', 1 );
  12984. inv.AddAnItem( 'Nigredo', 1 );
  12985. inv.AddAnItem( 'Albedo', 1 );
  12986. inv.AddAnItem( 'Rubedo', 1 );
  12987. inv.AddAnItem( 'Rebis', 1 );
  12988. inv.AddAnItem( 'Dog tallow', 3 );
  12989. inv.AddAnItem( 'Lunar shards', 1 );
  12990. inv.AddAnItem( 'Quicksilver solution', 1 );
  12991. inv.AddAnItem( 'Aether', 1 );
  12992. inv.AddAnItem( 'Optima mater', 1 );
  12993. inv.AddAnItem( 'Fifth essence', 1 );
  12994. inv.AddAnItem( 'Hardened timber', 2 );
  12995. inv.AddAnItem( 'Fur square', 1 );
  12996. inv.AddAnItem( 'Leather straps', 4 );
  12997. inv.AddAnItem( 'Leather squares', 1 );
  12998. inv.AddAnItem( 'Leather', 2 );
  12999. inv.AddAnItem( 'Hardened leather', 2 );
  13000. inv.AddAnItem( 'Chitin scale', 2 );
  13001. inv.AddAnItem( 'Draconide leather', 1 );
  13002. inv.AddAnItem( 'Infused draconide leather', 0 );
  13003. inv.AddAnItem( 'Steel ingot', 2 );
  13004. inv.AddAnItem( 'Dark iron ore', 2 );
  13005. inv.AddAnItem( 'Dark iron ingot', 1 );
  13006. inv.AddAnItem( 'Dark steel ingot', 1 );
  13007. inv.AddAnItem( 'Silver ore', 2 );
  13008. inv.AddAnItem( 'Silver ingot', 2 );
  13009. inv.AddAnItem( 'Meteorite ore', 2 );
  13010. inv.AddAnItem( 'Meteorite ingot', 1 );
  13011. inv.AddAnItem( 'Meteorite silver ingot', 1 );
  13012. inv.AddAnItem( 'Dwimeryte ingot', 2 );
  13013. inv.AddAnItem( 'Emerald dust', 2 );
  13014. inv.AddAnItem( 'Ruby dust', 2 );
  13015. inv.AddAnItem( 'Ruby', 1 );
  13016. inv.AddAnItem( 'Sapphire dust', 2 );
  13017. inv.AddAnItem( 'Sapphire', 1 );
  13018. inv.AddAnItem( 'Monstrous brain', 4 );
  13019. inv.AddAnItem( 'Monstrous blood', 3 );
  13020. inv.AddAnItem( 'Monstrous bone', 4 );
  13021. inv.AddAnItem( 'Monstrous claw', 3 );
  13022. inv.AddAnItem( 'Monstrous dust', 3 );
  13023. inv.AddAnItem( 'Monstrous ear', 4 );
  13024. inv.AddAnItem( 'Monstrous egg', 2 );
  13025. inv.AddAnItem( 'Monstrous eye', 2 );
  13026. inv.AddAnItem( 'Monstrous essence', 3 );
  13027. inv.AddAnItem( 'Monstrous feather', 4 );
  13028. inv.AddAnItem( 'Monstrous hair', 3 );
  13029. inv.AddAnItem( 'Monstrous heart', 2 );
  13030. inv.AddAnItem( 'Monstrous hide', 3 );
  13031. inv.AddAnItem( 'Monstrous liver', 2 );
  13032. inv.AddAnItem( 'Monstrous plate', 1 );
  13033. inv.AddAnItem( 'Monstrous saliva', 4 );
  13034. inv.AddAnItem( 'Monstrous stomach', 2 );
  13035. inv.AddAnItem( 'Monstrous tongue', 2 );
  13036. inv.AddAnItem( 'Monstrous tooth', 3 );
  13037. inv.AddAnItem( 'Venom extract', 1 );
  13038. inv.AddAnItem( 'Siren vocal cords', 1 );
  13039.  
  13040.  
  13041. SelectQuickslotItem( EES_RangedWeapon );
  13042.  
  13043.  
  13044. FactsAdd( 'kill_base_tutorials' );
  13045.  
  13046.  
  13047. theGame.GetTutorialSystem().RemoveAllQueuedTutorials();
  13048.  
  13049.  
  13050. if( FactsQuerySum("standalone_ep2") < 1 ) //modSigns
  13051. FactsAdd("standalone_ep2");
  13052. FactsRemove( "StandAloneEP2" );
  13053.  
  13054. theGame.GetJournalManager().ForceUntrackingQuestForEP1Savegame();
  13055. }
  13056. }
  13057.  
  13058. exec function fuqfep1()
  13059. {
  13060. theGame.GetJournalManager().ForceUntrackingQuestForEP1Savegame();
  13061. }
  13062.  
  13063.  
  13064.  
  13065.  
  13066.  
  13067. function GetWitcherPlayer() : W3PlayerWitcher
  13068. {
  13069. return (W3PlayerWitcher)thePlayer;
  13070. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement