Advertisement
Guest User

Untitled

a guest
Jul 19th, 2020
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 398.22 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. //Ice Breath
  169. var iceBreath : CIceBreath;
  170. var enableIceBreath : bool; default enableIceBreath = false;
  171. //Ice Breath*/
  172.  
  173. private var invUpdateTransaction : bool;
  174. default invUpdateTransaction = false;
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187. event OnSpawned( spawnData : SEntitySpawnData )
  188. {
  189. var i : int;
  190. var items : array<SItemUniqueId>;
  191. var items2 : array<SItemUniqueId>;
  192. var horseTemplate : CEntityTemplate;
  193. var horseManager : W3HorseManager;
  194.  
  195. AddAnimEventCallback( 'ActionBlend', 'OnAnimEvent_ActionBlend' );
  196. AddAnimEventCallback('cast_begin', 'OnAnimEvent_Sign');
  197. AddAnimEventCallback('cast_throw', 'OnAnimEvent_Sign');
  198. AddAnimEventCallback('cast_end', 'OnAnimEvent_Sign');
  199. AddAnimEventCallback('cast_friendly_begin', 'OnAnimEvent_Sign');
  200. AddAnimEventCallback('cast_friendly_throw', 'OnAnimEvent_Sign');
  201. AddAnimEventCallback('axii_ready', 'OnAnimEvent_Sign');
  202. AddAnimEventCallback('axii_alternate_ready', 'OnAnimEvent_Sign');
  203. AddAnimEventCallback('yrden_draw_ready', 'OnAnimEvent_Sign');
  204.  
  205. AddAnimEventCallback( 'ProjectileThrow', 'OnAnimEvent_Throwable' );
  206. AddAnimEventCallback( 'OnWeaponReload', 'OnAnimEvent_Throwable' );
  207. AddAnimEventCallback( 'ProjectileAttach', 'OnAnimEvent_Throwable' );
  208. AddAnimEventCallback( 'Mutation11AnimEnd', 'OnAnimEvent_Mutation11AnimEnd' );
  209. AddAnimEventCallback( 'Mutation11ShockWave', 'OnAnimEvent_Mutation11ShockWave' );
  210.  
  211. spawnMyLovelyStashes(); // Additional Stash Locations
  212.  
  213. amountOfSetPiecesEquipped.Resize( EnumGetMax( 'EItemSetType' ) + 1 );
  214.  
  215. runewordInfusionType = ST_None;
  216.  
  217.  
  218. inv = GetInventory();
  219.  
  220.  
  221. signOwner = new W3SignOwnerPlayer in this;
  222. signOwner.Init( this );
  223.  
  224. itemSlots.Resize( EnumGetMax('EEquipmentSlots')+1 );
  225.  
  226. //modSigns
  227. if( FactsQuerySum("ModSignsRecipesAdded") < 1 )
  228. {
  229. AddAlchemyRecipe('Recipe for Tawny Owl 1', true, true); // fix missing Tawny Owl recipe
  230. AddCraftingSchematic('Meteorite plate schematic', true, true); //add missing meteorite plate schematic
  231. FactsAdd("ModSignsRecipesAdded");
  232. }
  233.  
  234. FactsRemove("player_had_quen"); //remove, no need for this and never was
  235.  
  236. //modSigns
  237. if( FactsQuerySum("ModSignsKMSetSchematicsAdded") < 1 )
  238. {
  239. AddCraftingSchematic('Kaer Morhen Armor 1 schematic',true, true);
  240. AddCraftingSchematic('Kaer Morhen Armor 2 schematic',true, true);
  241. AddCraftingSchematic('Kaer Morhen Armor 3 schematic',true, true);
  242. AddCraftingSchematic('Kaer Morhen Pants schematic',true, true);
  243. AddCraftingSchematic('Kaer Morhen Pants 1 schematic',true, true);
  244. AddCraftingSchematic('Kaer Morhen Pants 2 schematic',true, true);
  245. AddCraftingSchematic('Kaer Morhen Pants 3 schematic',true, true);
  246. AddCraftingSchematic('Kaer Morhen Boots schematic',true, true);
  247. AddCraftingSchematic('Kaer Morhen Boots 1 schematic',true, true);
  248. AddCraftingSchematic('Kaer Morhen Boots 2 schematic',true, true);
  249. AddCraftingSchematic('Kaer Morhen Boots 3 schematic',true, true);
  250. AddCraftingSchematic('Kaer Morhen Gloves schematic',true, true);
  251. AddCraftingSchematic('Kaer Morhen Gloves 1 schematic',true, true);
  252. AddCraftingSchematic('Kaer Morhen Gloves 2 schematic',true, true);
  253. AddCraftingSchematic('Kaer Morhen Gloves 3 schematic',true, true);
  254. FactsAdd("ModSignsKMSetSchematicsAdded");
  255. }
  256.  
  257. if(!spawnData.restored)
  258. {
  259. levelManager = new W3LevelManager in this;
  260. levelManager.Initialize();
  261.  
  262.  
  263. inv.GetAllItems(items);
  264. for(i=0; i<items.Size(); i+=1)
  265. {
  266. if(inv.IsItemMounted(items[i]) && ( !inv.IsItemBody(items[i]) || inv.GetItemCategory(items[i]) == 'hair' ) )
  267. EquipItem(items[i]);
  268. }
  269.  
  270.  
  271.  
  272.  
  273.  
  274. AddAlchemyRecipe('Recipe for Swallow 1',true,true);
  275. AddAlchemyRecipe('Recipe for Cat 1',true,true);
  276. AddAlchemyRecipe('Recipe for White Honey 1',true,true);
  277.  
  278. AddAlchemyRecipe('Recipe for Samum 1',true,true);
  279. AddAlchemyRecipe('Recipe for Grapeshot 1',true,true);
  280.  
  281. AddAlchemyRecipe('Recipe for Specter Oil 1',true,true);
  282. AddAlchemyRecipe('Recipe for Necrophage Oil 1',true,true);
  283. AddAlchemyRecipe('Recipe for Alcohest 1',true,true);
  284. }
  285. else
  286. {
  287. AddTimer('DelayedOnItemMount', 0.1, true);
  288.  
  289.  
  290. CheckHairItem();
  291. }
  292.  
  293.  
  294. AddStartingSchematics();
  295.  
  296. super.OnSpawned( spawnData );
  297.  
  298.  
  299. AddAlchemyRecipe('Recipe for Mutagen red',true,true);
  300. AddAlchemyRecipe('Recipe for Mutagen green',true,true);
  301. AddAlchemyRecipe('Recipe for Mutagen blue',true,true);
  302. AddAlchemyRecipe('Recipe for Greater mutagen red',true,true);
  303. AddAlchemyRecipe('Recipe for Greater mutagen green',true,true);
  304. AddAlchemyRecipe('Recipe for Greater mutagen blue',true,true);
  305.  
  306. AddCraftingSchematic('Starting Armor Upgrade schematic 1',true,true);
  307.  
  308.  
  309. if( inputHandler )
  310. {
  311. inputHandler.BlockAllActions( 'being_ciri', false );
  312. }
  313. SetBehaviorVariable( 'test_ciri_replacer', 0.0f);
  314.  
  315. if(!spawnData.restored)
  316. {
  317.  
  318. abilityManager.GainStat(BCS_Toxicity, 0);
  319. }
  320.  
  321. levelManager.PostInit(this, spawnData.restored, true);
  322.  
  323. SetBIsCombatActionAllowed( true );
  324. SetBIsInputAllowed( true, 'OnSpawned' );
  325.  
  326.  
  327. if ( !reputationManager )
  328. {
  329. reputationManager = new W3Reputation in this;
  330. reputationManager.Initialize();
  331. }
  332.  
  333. theSound.SoundParameter( "focus_aim", 1.0f, 1.0f );
  334. theSound.SoundParameter( "focus_distance", 0.0f, 1.0f );
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  
  341. currentlyCastSign = ST_None;
  342.  
  343.  
  344. if(!spawnData.restored)
  345. {
  346. horseTemplate = (CEntityTemplate)LoadResource("horse_manager");
  347. horseManager = (W3HorseManager)theGame.CreateEntity(horseTemplate, GetWorldPosition(),,,,,PM_Persist);
  348. horseManager.CreateAttachment(this);
  349. horseManager.OnCreated();
  350. EntityHandleSet( horseManagerHandle, horseManager );
  351. }
  352. //else //modFriendlyStash
  353. //{
  354. // AddTimer('DelayedHorseUpdate', 0.01, true);
  355. //}
  356.  
  357. //---=== modFriendlyMeditation ===---
  358. fMeditationConfig = new CModFMeditationConfig in this;
  359. fMeditationConfig.Init();
  360. //---=== modFriendlyMeditation ===---
  361.  
  362.  
  363. RemoveAbility('Ciri_CombatRegen');
  364. RemoveAbility('Ciri_Rage');
  365. RemoveAbility('CiriBlink');
  366. RemoveAbility('CiriCharge');
  367. RemoveAbility('Ciri_Q205');
  368. RemoveAbility('Ciri_Q305');
  369. RemoveAbility('Ciri_Q403');
  370. RemoveAbility('Ciri_Q111');
  371. RemoveAbility('Ciri_Q501');
  372. RemoveAbility('SkillCiri');
  373.  
  374. //modSigns: remove passive bonuses
  375. RemoveAbilityAll('sword_adrenalinegain');
  376. RemoveAbilityAll('magic_staminaregen');
  377. RemoveAbilityAll('alchemy_potionduration');
  378.  
  379. /*if(spawnData.restored)
  380. {
  381. RestoreQuen(savedQuenHealth, savedQuenDuration);
  382. }
  383. else
  384. {
  385. savedQuenHealth = 0.f;
  386. savedQuenDuration = 0.f;
  387. }*/ //modSigns: removed, params aren't saved properly anyway
  388. savedQuenHealth = 0.f;
  389. savedQuenDuration = 0.f;
  390.  
  391. if(spawnData.restored)
  392. {
  393. ApplyPatchFixes();
  394. }
  395. else
  396. {
  397.  
  398. FactsAdd( "new_game_started_in_1_20" );
  399. }
  400.  
  401. if ( spawnData.restored )
  402. {
  403. FixEquippedMutagens();
  404. }
  405.  
  406. //modFriendlyStash begin
  407. fStashConfig = new CModFriendlyStashConfig in this;
  408. fStashConfig.Init();
  409. //modFriendlyStash end
  410.  
  411. if ( FactsQuerySum("NewGamePlus") > 0 )
  412. {
  413. NewGamePlusAdjustDLC1TemerianSet(inv);
  414. NewGamePlusAdjustDLC5NilfgardianSet(inv);
  415. NewGamePlusAdjustDLC10WolfSet(inv);
  416. NewGamePlusAdjustDLC14SkelligeSet(inv);
  417. if(horseManager)
  418. {
  419. NewGamePlusAdjustDLC1TemerianSet(horseManager.GetInventoryComponent());
  420. NewGamePlusAdjustDLC5NilfgardianSet(horseManager.GetInventoryComponent());
  421. NewGamePlusAdjustDLC10WolfSet(horseManager.GetInventoryComponent());
  422. NewGamePlusAdjustDLC14SkelligeSet(horseManager.GetInventoryComponent());
  423. }
  424. }
  425.  
  426. //modSigns: load sound banks for mutations
  427. ((W3PlayerAbilityManager)abilityManager).LoadCurrentMutationSoundBank();
  428. //modSigns: load sound banks for sets
  429. LoadCurrentSetBonusSoundbank();
  430. //modSigns: add mutation trigger recipe
  431. if(IsMutationResearched(EPMT_Mutation11) || IsMutationResearched(EPMT_Mutation12))
  432. {
  433. if(!alchemyRecipes.Contains('Recipe for Mutation Trigger'))
  434. AddAlchemyRecipe('Recipe for Mutation Trigger', true, true);
  435. }
  436.  
  437.  
  438. ResumeStaminaRegen('WhirlSkill');
  439. ResumeStaminaRegen('RendSkill'); //modSigns
  440. ResumeStaminaRegen('IsPerformingFinisher'); //modSigns
  441.  
  442. ResumeHPRegenEffects('FistFightMinigame'); //modSigns
  443.  
  444. if(HasRunewordActive('Runeword 4 _Stats')) //modSigns
  445. StartVitalityRegen();
  446.  
  447. if(HasAbility('sword_s19'))
  448. {
  449. RemoveTemporarySkills();
  450. }
  451.  
  452. //HACK_UnequipWolfLiver(); //modSigns
  453.  
  454. if( enemiesKilledByType.Size() == 0 )
  455. {
  456. enemiesKilledByType.Resize(EENT_MAX_TYPES);
  457. }
  458.  
  459.  
  460. if( HasBuff( EET_GryphonSetBonusYrden ) )
  461. {
  462. RemoveBuff( EET_GryphonSetBonusYrden, false, "GryphonSetBonusYrden" );
  463. }
  464.  
  465. if( HasBuff( EET_GryphonSetBonus ) ) //modSigns: remove on spawn
  466. {
  467. RemoveBuff( EET_GryphonSetBonus );
  468. }
  469.  
  470. if( HasBuff(EET_KaerMorhenSetBonus) ) //modSigns: remove on spawn
  471. {
  472. RemoveBuff(EET_KaerMorhenSetBonus);
  473. }
  474.  
  475. if( HasBuff( EET_Aerondight ) ) //modSigns: remove Aerondight effect
  476. RemoveBuff( EET_Aerondight );
  477.  
  478. if( HasBuff( EET_PhantomWeapon ) ) //modSigns: remove Iris effect
  479. RemoveBuff( EET_PhantomWeapon );
  480.  
  481. RemoveBuff(EET_Runeword4); //modSigns
  482. RemoveBuff(EET_Runeword11); //modSigns
  483. RemoveAbilityAll('Glyphword 14 _Stats'); //modSigns
  484. RemoveAbilityAll('Glyphword 10 _Stats'); //modSigns
  485.  
  486. //modSigns
  487. if( FactsQuerySum("standalone_ep1") > 0 && FactsQuerySum("standalone_ep1_inv") < 1 )
  488. {
  489. AddTimer('GiveStandAloneEP1Items', 0.00001, true, , , true);
  490. }
  491. //modSigns
  492. if( FactsQuerySum("standalone_ep2") > 0 && FactsQuerySum("standalone_ep2_inv") < 1 )
  493. {
  494. AddTimer('GiveStandAloneEP2Items', 0.00001, true, , , true);
  495. }
  496.  
  497. if( spawnData.restored )
  498. {
  499.  
  500. //UpdateEncumbrance(); //modFriendlyStash
  501. AddTimer('DelayedEncumbranceUpdate', 0.1, true); //modFriendlyStash
  502.  
  503.  
  504. RemoveBuff( EET_Mutation11Immortal );
  505. RemoveBuff( EET_Mutation11Buff );
  506.  
  507. //modSigns:
  508. RemoveBuff( EET_UndyingSkillImmortal );
  509. }
  510.  
  511.  
  512. theGame.GameplayFactsAdd( "PlayerIsGeralt" );
  513.  
  514. // -= WMK:modQuickSlots =-
  515. if (WmkGetQuickInventoryInstance()) {
  516. WmkGetQuickInventoryInstance().OnPlayerWitcherSpawned();
  517. }
  518. // -= WMK:modQuickSlots =-
  519.  
  520. isInitialized = true;
  521.  
  522.  
  523. //Ice Breath
  524. iceBreath = new CIceBreath in this;
  525. AddTimer('IceBreathTimer',5.0,true);
  526. //Ice Breath*/
  527.  
  528. }
  529.  
  530.  
  531. //Ice Breath+
  532. timer function NPCbreathTimer(deltaTime : float , id : int){
  533.  
  534. if(enableIceBreath){
  535. iceBreath.IceBreathEnable();
  536. }
  537. else{
  538. iceBreath.IceBreathDisable();
  539. }
  540. }
  541.  
  542. timer function HorseBreathTimer(deltaTime : float , id : int){
  543.  
  544. iceBreath.HorseBreathEnable();
  545. }
  546.  
  547. timer function IceBreathTimer(deltaTime : float , id : int){
  548.  
  549. if(iceBreath.isCold()){
  550. if(!enableIceBreath){
  551. //theGame.GetGuiManager().ShowNotification("True");
  552. enableIceBreath = true;
  553. thePlayer.PlayEffectSingle('ice_breath_gameplay');
  554. iceBreath.IceBreathEnable();
  555. iceBreath.HorseBreathEnable();
  556. AddTimer('HorseBreathTimer',1.5,true);
  557. AddTimer('NPCbreathTimer',10.0,true);
  558. }
  559. }
  560. else{
  561. if(theGame.GetCommonMapManager().GetCurrentArea() != AN_Spiral){
  562. if(enableIceBreath){
  563. enableIceBreath = false;
  564. //theGame.GetGuiManager().ShowNotification("False");
  565. thePlayer.StopEffect('ice_breath_gameplay');
  566. RemoveTimer( 'HorseBreathTimer' );
  567. }
  568. }
  569.  
  570. }
  571. {
  572.  
  573. }
  574. //Ice Breath-*/
  575. //AMM-
  576.  
  577.  
  578.  
  579. private function HACK_UnequipWolfLiver()
  580. {
  581. var itemName1, itemName2, itemName3, itemName4 : name;
  582. var item1, item2, item3, item4 : SItemUniqueId;
  583.  
  584. GetItemEquippedOnSlot( EES_Potion1, item1 );
  585. GetItemEquippedOnSlot( EES_Potion2, item2 );
  586. GetItemEquippedOnSlot( EES_Potion3, item3 );
  587. GetItemEquippedOnSlot( EES_Potion4, item4 );
  588.  
  589. if ( inv.IsIdValid( item1 ) )
  590. itemName1 = inv.GetItemName( item1 );
  591. if ( inv.IsIdValid( item2 ) )
  592. itemName2 = inv.GetItemName( item2 );
  593. if ( inv.IsIdValid( item3 ) )
  594. itemName3 = inv.GetItemName( item3 );
  595. if ( inv.IsIdValid( item4 ) )
  596. itemName4 = inv.GetItemName( item4 );
  597.  
  598. if ( itemName1 == 'Wolf liver' || itemName3 == 'Wolf liver' )
  599. {
  600. if ( inv.IsIdValid( item1 ) )
  601. UnequipItem( item1 );
  602. if ( inv.IsIdValid( item3 ) )
  603. UnequipItem( item3 );
  604. }
  605. else if ( itemName2 == 'Wolf liver' || itemName4 == 'Wolf liver' )
  606. {
  607. if ( inv.IsIdValid( item2 ) )
  608. UnequipItem( item2 );
  609. if ( inv.IsIdValid( item4 ) )
  610. UnequipItem( item4 );
  611. }
  612. }
  613.  
  614. public function IncKills( et : EEnemyType ) //modSigns
  615. {
  616. enemiesKilledByType[et] += 1;
  617. //theGame.witcherLog.AddMessage(et + ": " + enemiesKilledByType[et]);
  618. }
  619.  
  620. public function GetKills( et : EEnemyType ) : int //modSigns
  621. {
  622. return enemiesKilledByType[et];
  623. }
  624.  
  625. public function GetExpModifierByEnemyType( et : EEnemyType ) : float //modSigns
  626. {
  627. switch(et)
  628. {
  629. case EENT_BOSS:
  630. return 1;
  631. case EENT_GENERIC:
  632. case EENT_ANIMAL:
  633. return 0;
  634. default:
  635. return 1 - MinF(100.0f, (float)GetKills(et))/100.0f;
  636. }
  637. }
  638.  
  639.  
  640.  
  641.  
  642.  
  643. timer function DelayedHorseUpdate( dt : float, id : int )
  644. {
  645. var man : W3HorseManager;
  646.  
  647. man = GetHorseManager();
  648. if(man)
  649. {
  650. if ( man.ApplyHorseUpdateOnSpawn() )
  651. {
  652.  
  653. UpdateEncumbrance();
  654.  
  655. RemoveTimer( 'DelayedHorseUpdate' );
  656. }
  657. }
  658. }
  659.  
  660. //modFriendlyStash begin
  661. timer function DelayedEncumbranceUpdate( dt : float, id : int )
  662. {
  663. if( !GetInventory() )
  664. return;
  665.  
  666. UpdateEncumbrance();
  667. RemoveTimer( 'DelayedEncumbranceUpdate' );
  668. }
  669. //modFriendlyStash end
  670.  
  671. event OnAbilityAdded( abilityName : name)
  672. {
  673. super.OnAbilityAdded(abilityName);
  674.  
  675. if( HasRunewordActive('Runeword 4 _Stats') ) //modSigns
  676. {
  677. StartVitalityRegen();
  678. }
  679.  
  680. if ( abilityName == 'Runeword 8 _Stats' && GetStat(BCS_Focus, true) >= GetStatMax(BCS_Focus) && !HasBuff(EET_Runeword8) ) //modSigns
  681. {
  682. AddEffectDefault(EET_Runeword8, this, "equipped item");
  683. }
  684.  
  685. }
  686.  
  687. private final function AddStartingSchematics()
  688. {
  689. AddCraftingSchematic('Starting Armor Upgrade schematic 1', true,true);
  690. AddCraftingSchematic('Thread schematic', true, true);
  691. AddCraftingSchematic('String schematic', true, true);
  692. AddCraftingSchematic('Linen schematic', true, true);
  693. AddCraftingSchematic('Silk schematic', true, true);
  694. AddCraftingSchematic('Resin schematic', true, true);
  695. AddCraftingSchematic('Blasting powder schematic', true, true);
  696. AddCraftingSchematic('Haft schematic', true, true);
  697. AddCraftingSchematic('Hardened timber schematic', true, true);
  698. AddCraftingSchematic('Leather squares schematic', true, true);
  699. AddCraftingSchematic('Leather schematic', true, true);
  700. AddCraftingSchematic('Hardened leather schematic', true, true);
  701. AddCraftingSchematic('Draconide leather schematic', true, true);
  702. AddCraftingSchematic('Iron ingot schematic', true, true);
  703. AddCraftingSchematic('Steel ingot schematic', true, true);
  704. AddCraftingSchematic('Steel ingot schematic 1', true, true);
  705. AddCraftingSchematic('Steel plate schematic', true, true);
  706. AddCraftingSchematic('Dark iron ingot schematic', true, true);
  707. AddCraftingSchematic('Dark iron plate schematic', true, true);
  708. AddCraftingSchematic('Dark steel ingot schematic', true, true);
  709. AddCraftingSchematic('Dark steel ingot schematic 1', true, true);
  710. AddCraftingSchematic('Dark steel plate schematic', true, true);
  711. AddCraftingSchematic('Silver ore schematic', true, true);
  712. AddCraftingSchematic('Silver ingot schematic', true, true);
  713. AddCraftingSchematic('Silver ingot schematic 1', true, true);
  714. AddCraftingSchematic('Silver plate schematic', true, true);
  715. AddCraftingSchematic('Meteorite ingot schematic', true, true);
  716. AddCraftingSchematic('Meteorite silver ingot schematic', true, true);
  717. AddCraftingSchematic('Meteorite silver plate schematic', true, true);
  718. AddCraftingSchematic('Glowing ingot schematic', true, true);
  719. AddCraftingSchematic('Dwimeryte ore schematic', true, true);
  720. AddCraftingSchematic('Dwimeryte ingot schematic', true, true);
  721. AddCraftingSchematic('Dwimeryte ingot schematic 1', true, true);
  722. AddCraftingSchematic('Dwimeryte plate schematic', true, true);
  723. AddCraftingSchematic('Infused dust schematic', true, true);
  724. AddCraftingSchematic('Infused shard schematic', true, true);
  725. AddCraftingSchematic('Infused crystal schematic', true, true);
  726.  
  727. if ( theGame.GetDLCManager().IsEP2Available() )
  728. {
  729. AddCraftingSchematic('Draconide infused leather schematic', true, true);
  730. AddCraftingSchematic('Nickel ore schematic', true, true);
  731. AddCraftingSchematic('Cupronickel ore schematic', true, true);
  732. AddCraftingSchematic('Copper ore schematic', true, true);
  733. AddCraftingSchematic('Copper ingot schematic', true, true);
  734. AddCraftingSchematic('Copper plate schematic', true, true);
  735. AddCraftingSchematic('Green gold ore schematic', true, true);
  736. AddCraftingSchematic('Green gold ore schematic 1', true, true);
  737. AddCraftingSchematic('Green gold ingot schematic', true, true);
  738. AddCraftingSchematic('Green gold plate schematic', true, true);
  739. AddCraftingSchematic('Orichalcum ore schematic', true, true);
  740. AddCraftingSchematic('Orichalcum ore schematic 1', true, true);
  741. AddCraftingSchematic('Orichalcum ingot schematic', true, true);
  742. AddCraftingSchematic('Orichalcum plate schematic', true, true);
  743. AddCraftingSchematic('Dwimeryte enriched ore schematic', true, true);
  744. AddCraftingSchematic('Dwimeryte enriched ingot schematic', true, true);
  745. AddCraftingSchematic('Dwimeryte enriched plate schematic', true, true);
  746. }
  747. }
  748.  
  749. private final function ApplyPatchFixes()
  750. {
  751. var cnt, transmutationCount, mutagenCount, i, slot : int;
  752. var transmutationAbility, itemName : name;
  753. var pam : W3PlayerAbilityManager;
  754. var slotId : int;
  755. var offset : float;
  756. var buffs : array<CBaseGameplayEffect>;
  757. var mutagen : W3Mutagen_Effect;
  758. var skill : SSimpleSkill;
  759. var spentSkillPoints, swordSkillPointsSpent, alchemySkillPointsSpent, perkSkillPointsSpent, pointsToAdd : int;
  760. var mutagens : array< W3Mutagen_Effect >;
  761.  
  762. /*if(FactsQuerySum("ClearingPotionPassiveBonusFix") < 1)
  763. {
  764. pam = (W3PlayerAbilityManager)abilityManager;
  765.  
  766. cnt = GetAbilityCount('sword_adrenalinegain') - pam.GetPathPointsSpent(ESP_Sword);
  767. if(cnt > 0)
  768. RemoveAbilityMultiple('sword_adrenalinegain', cnt);
  769.  
  770. cnt = GetAbilityCount('magic_staminaregen') - pam.GetPathPointsSpent(ESP_Signs);
  771. if(cnt > 0)
  772. RemoveAbilityMultiple('magic_staminaregen', cnt);
  773.  
  774. cnt = GetAbilityCount('alchemy_potionduration') - pam.GetPathPointsSpent(ESP_Alchemy);
  775. if(cnt > 0)
  776. RemoveAbilityMultiple('alchemy_potionduration', cnt);
  777.  
  778. FactsAdd("ClearingPotionPassiveBonusFix");
  779. }*/ //modSigns
  780.  
  781.  
  782. if(FactsQuerySum("DimeritiumSynergyFix") < 1)
  783. {
  784. slotId = GetSkillSlotID(S_Alchemy_s19);
  785. if(slotId != -1)
  786. UnequipSkill(S_Alchemy_s19);
  787.  
  788. RemoveAbilityAll('greater_mutagen_color_green_synergy_bonus');
  789. RemoveAbilityAll('mutagen_color_green_synergy_bonus');
  790. RemoveAbilityAll('mutagen_color_lesser_green_synergy_bonus');
  791.  
  792. RemoveAbilityAll('greater_mutagen_color_blue_synergy_bonus');
  793. RemoveAbilityAll('mutagen_color_blue_synergy_bonus');
  794. RemoveAbilityAll('mutagen_color_lesser_blue_synergy_bonus');
  795.  
  796. RemoveAbilityAll('greater_mutagen_color_red_synergy_bonus');
  797. RemoveAbilityAll('mutagen_color_red_synergy_bonus');
  798. RemoveAbilityAll('mutagen_color_lesser_red_synergy_bonus');
  799.  
  800. if(slotId != -1)
  801. EquipSkill(S_Alchemy_s19, slotId);
  802.  
  803. FactsAdd("DimeritiumSynergyFix");
  804. }
  805.  
  806.  
  807. if(FactsQuerySum("DontShowRecipePinTut") < 1)
  808. {
  809. FactsAdd( "DontShowRecipePinTut" );
  810. TutorialScript('alchemyRecipePin', '');
  811. TutorialScript('craftingRecipePin', '');
  812. }
  813.  
  814.  
  815. if(FactsQuerySum("LevelReqPotGiven") < 1)
  816. {
  817. FactsAdd("LevelReqPotGiven");
  818. inv.AddAnItem('Wolf Hour', 1, false, false, true);
  819. }
  820.  
  821.  
  822. if(!HasBuff(EET_AutoStaminaRegen))
  823. {
  824. AddEffectDefault(EET_AutoStaminaRegen, this, 'autobuff', false);
  825. }
  826.  
  827.  
  828.  
  829. buffs = GetBuffs();
  830. offset = 0;
  831. mutagenCount = 0;
  832. for(i=0; i<buffs.Size(); i+=1)
  833. {
  834. mutagen = (W3Mutagen_Effect)buffs[i];
  835. if(mutagen)
  836. {
  837. offset += mutagen.GetToxicityOffset();
  838. mutagenCount += 1;
  839. }
  840. }
  841.  
  842.  
  843. if(offset != (GetStat(BCS_Toxicity) - GetStat(BCS_Toxicity, true)))
  844. SetToxicityOffset(offset);
  845.  
  846.  
  847. /*mutagenCount *= GetSkillLevel(S_Alchemy_s13);
  848. transmutationAbility = GetSkillAbilityName(S_Alchemy_s13);
  849. transmutationCount = GetAbilityCount(transmutationAbility);
  850. if(mutagenCount < transmutationCount)
  851. {
  852. RemoveAbilityMultiple(transmutationAbility, transmutationCount - mutagenCount);
  853. }
  854. else if(mutagenCount > transmutationCount)
  855. {
  856. AddAbilityMultiple(transmutationAbility, mutagenCount - transmutationCount);
  857. }*/
  858. RecalcTransmutationAbilities(); //modSigns
  859.  
  860.  
  861. if(theGame.GetDLCManager().IsEP1Available())
  862. {
  863. theGame.GetJournalManager().ActivateEntryByScriptTag('TutorialJournalEnchanting', JS_Active);
  864. }
  865.  
  866.  
  867. if(HasAbility('sword_s19') && FactsQuerySum("Patch_Sword_s19") < 1)
  868. {
  869. pam = (W3PlayerAbilityManager)abilityManager;
  870.  
  871.  
  872. skill.level = 0;
  873. for(i = S_Magic_s01; i <= S_Magic_s20; i+=1)
  874. {
  875. skill.skillType = i;
  876. pam.RemoveTemporarySkill(skill);
  877. }
  878.  
  879.  
  880. spentSkillPoints = levelManager.GetPointsUsed(ESkillPoint);
  881. swordSkillPointsSpent = pam.GetPathPointsSpent(ESP_Sword);
  882. alchemySkillPointsSpent = pam.GetPathPointsSpent(ESP_Alchemy);
  883. perkSkillPointsSpent = pam.GetPathPointsSpent(ESP_Perks);
  884.  
  885. pointsToAdd = spentSkillPoints - swordSkillPointsSpent - alchemySkillPointsSpent - perkSkillPointsSpent;
  886. if(pointsToAdd > 0)
  887. levelManager.UnspendPoints(ESkillPoint, pointsToAdd);
  888.  
  889.  
  890. RemoveAbilityAll('sword_s19');
  891.  
  892.  
  893. FactsAdd("Patch_Sword_s19");
  894. }
  895.  
  896.  
  897. if( HasAbility( 'sword_s19' ) )
  898. {
  899. RemoveAbilityAll( 'sword_s19' );
  900. }
  901.  
  902.  
  903. if(FactsQuerySum("Patch_Armor_Type_Glyphwords") < 1)
  904. {
  905. pam = (W3PlayerAbilityManager)abilityManager;
  906.  
  907. pam.SetPerkArmorBonus( S_Perk_05, this );
  908. pam.SetPerkArmorBonus( S_Perk_06, this );
  909. pam.SetPerkArmorBonus( S_Perk_07, this );
  910.  
  911. FactsAdd("Patch_Armor_Type_Glyphwords");
  912. }
  913. else if( FactsQuerySum("154999") < 1 )
  914. {
  915.  
  916. pam = (W3PlayerAbilityManager)abilityManager;
  917.  
  918. pam.SetPerkArmorBonus( S_Perk_05, this );
  919. pam.SetPerkArmorBonus( S_Perk_06, this );
  920. pam.SetPerkArmorBonus( S_Perk_07, this );
  921.  
  922. FactsAdd("154999");
  923. }
  924.  
  925. if( FactsQuerySum( "Patch_Decoction_Buff_Icons" ) < 1 )
  926. {
  927. mutagens = GetMutagenBuffs();
  928. for( i=0; i<mutagens.Size(); i+=1 )
  929. {
  930. itemName = DecoctionEffectTypeToItemName( mutagens[i].GetEffectType() );
  931. mutagens[i].OverrideIcon( itemName );
  932. }
  933.  
  934. FactsAdd( "Patch_Decoction_Buff_Icons" );
  935. }
  936.  
  937.  
  938. if( FactsQuerySum( "154997" ) < 1 )
  939. {
  940. if( IsSkillEquipped( S_Alchemy_s18 ) )
  941. {
  942. slot = GetSkillSlotID( S_Alchemy_s18 );
  943. UnequipSkill( slot );
  944. EquipSkill( S_Alchemy_s18, slot );
  945. }
  946. FactsAdd( "154997" );
  947. }
  948. if( FactsQuerySum( "Patch_Mutagen_Ing_Stacking" ) < 1 )
  949. {
  950. Patch_MutagenStacking();
  951. FactsAdd( "Patch_Mutagen_Ing_Stacking" );
  952. }
  953.  
  954. //modSigns
  955. if( FactsQuerySum( "modSigns_S_Alchemy_s05_Fix_2" ) < 1 )
  956. {
  957. pam = (W3PlayerAbilityManager)abilityManager;
  958. pam.ResetAlchemy05SkillMaxLevel();
  959. FactsAdd( "modSigns_S_Alchemy_s05_Fix_2" );
  960. }
  961. //if( FactsQuerySum( "modSigns_S_Alchemy_s18_Fix" ) < 1 )
  962. //{
  963. // if( IsSkillEquipped( S_Alchemy_s18 ) )
  964. // {
  965. // slot = GetSkillSlotID( S_Alchemy_s18 );
  966. // UnequipSkill( slot );
  967. // EquipSkill( S_Alchemy_s18, slot );
  968. // }
  969. // FactsAdd( "modSigns_S_Alchemy_s18_Fix" );
  970. //}
  971. if( FactsQuerySum( "modSigns_ArmorTypeSetsIntroduced" ) < 1 )
  972. {
  973. pam = (W3PlayerAbilityManager)abilityManager;
  974. pam.ManageSetArmorTypeBonus();
  975. RecalcSetItemsEquipped();
  976. FactsAdd( "modSigns_ArmorTypeSetsIntroduced" );
  977. }
  978. if( FactsQuerySum( "modSigns_KMArmorTypeSetIntroduced" ) < 1 )
  979. {
  980. pam = (W3PlayerAbilityManager)abilityManager;
  981. pam.ManageSetArmorTypeBonus();
  982. RecalcSetItemsEquipped();
  983. FactsAdd( "modSigns_KMArmorTypeSetIntroduced" );
  984. }
  985. }
  986.  
  987. private final function Patch_MutagenStacking()
  988. {
  989. var i, j, quantity : int;
  990. var muts : array< SItemUniqueId >;
  991. var item : SItemUniqueId;
  992. var mutName : name;
  993. var wasInArray : bool;
  994. var mutsToAdd : array< SItemParts >;
  995. var mutToAdd : SItemParts;
  996.  
  997. muts = inv.GetItemsByTag( 'MutagenIngredient' );
  998. if( GetItemEquippedOnSlot( EES_SkillMutagen1, item ) )
  999. {
  1000. muts.Remove( item );
  1001. inv.SetItemStackable( item, false );
  1002. }
  1003. if( GetItemEquippedOnSlot( EES_SkillMutagen2, item ) )
  1004. {
  1005. muts.Remove( item );
  1006. inv.SetItemStackable( item, false );
  1007. }
  1008. if( GetItemEquippedOnSlot( EES_SkillMutagen3, item ) )
  1009. {
  1010. muts.Remove( item );
  1011. inv.SetItemStackable( item, false );
  1012. }
  1013. if( GetItemEquippedOnSlot( EES_SkillMutagen4, item ) )
  1014. {
  1015. muts.Remove( item );
  1016. inv.SetItemStackable( item, false );
  1017. }
  1018.  
  1019. for( i=0; i<muts.Size(); i+=1 )
  1020. {
  1021. mutName = inv.GetItemName( muts[i] );
  1022. quantity = inv.GetItemQuantity( muts[i] );
  1023.  
  1024. wasInArray = false;
  1025. for( j=0; j<mutsToAdd.Size(); j+=1 )
  1026. {
  1027. if( mutsToAdd[j].itemName == mutName )
  1028. {
  1029. mutsToAdd[j].quantity += quantity;
  1030. wasInArray = true;
  1031. break;
  1032. }
  1033. }
  1034.  
  1035. if( !wasInArray )
  1036. {
  1037. mutToAdd.itemName = mutName;
  1038. mutToAdd.quantity = quantity;
  1039. mutsToAdd.PushBack( mutToAdd );
  1040. }
  1041.  
  1042. inv.RemoveItem( muts[i], quantity );
  1043. }
  1044.  
  1045. for( i=0; i<mutsToAdd.Size(); i+=1 )
  1046. {
  1047. inv.AddAnItem( mutsToAdd[i].itemName, mutsToAdd[i].quantity, true, true );
  1048. }
  1049. }
  1050.  
  1051. private function FixEquippedMutagens()
  1052. {
  1053. var item : SItemUniqueId;
  1054. if( GetItemEquippedOnSlot( EES_SkillMutagen1, item ) )
  1055. {
  1056. inv.SetItemStackable( item, false );
  1057. }
  1058. if( GetItemEquippedOnSlot( EES_SkillMutagen2, item ) )
  1059. {
  1060. inv.SetItemStackable( item, false );
  1061. }
  1062. if( GetItemEquippedOnSlot( EES_SkillMutagen3, item ) )
  1063. {
  1064. inv.SetItemStackable( item, false );
  1065. }
  1066. if( GetItemEquippedOnSlot( EES_SkillMutagen4, item ) )
  1067. {
  1068. inv.SetItemStackable( item, false );
  1069. }
  1070. }
  1071.  
  1072. public final function RestoreQuen( quenHealth : float, quenDuration : float, optional alternate : bool ) : bool
  1073. {
  1074. var restoredQuen : W3QuenEntity;
  1075.  
  1076. if(quenHealth > 0.f && quenDuration >= 3.f)
  1077. {
  1078. restoredQuen = (W3QuenEntity)theGame.CreateEntity( signs[ST_Quen].template, GetWorldPosition(), GetWorldRotation() );
  1079. restoredQuen.Init( signOwner, signs[ST_Quen].entity, true );
  1080.  
  1081. if( alternate )
  1082. {
  1083. restoredQuen.SetAlternateCast( S_Magic_s04 );
  1084. }
  1085.  
  1086. restoredQuen.freeCast = true; //modSigns
  1087. restoredQuen.OnStarted();
  1088. restoredQuen.OnThrowing();
  1089.  
  1090. if( !alternate )
  1091. {
  1092. restoredQuen.OnEnded();
  1093. }
  1094.  
  1095. restoredQuen.SetDataFromRestore(quenHealth, quenDuration);
  1096.  
  1097. return true;
  1098. }
  1099.  
  1100. return false;
  1101. }
  1102.  
  1103. public function IsInitialized() : bool
  1104. {
  1105. return isInitialized;
  1106. }
  1107.  
  1108. private function NewGamePlusInitialize()
  1109. {
  1110. var questItems : array<name>;
  1111. var horseManager : W3HorseManager;
  1112. var horseInventory : CInventoryComponent;
  1113. var i, missingLevels, expDiff : int;
  1114.  
  1115. super.NewGamePlusInitialize();
  1116.  
  1117.  
  1118. horseManager = (W3HorseManager)EntityHandleGet(horseManagerHandle);
  1119. if(horseManager)
  1120. horseInventory = horseManager.GetInventoryComponent();
  1121.  
  1122.  
  1123. theGame.params.SetNewGamePlusLevel(GetLevel());
  1124.  
  1125.  
  1126. if (theGame.GetDLCManager().IsDLCAvailable('ep1'))
  1127. missingLevels = theGame.params.NEW_GAME_PLUS_EP1_MIN_LEVEL - GetLevel();
  1128. else
  1129. missingLevels = theGame.params.NEW_GAME_PLUS_MIN_LEVEL - GetLevel();
  1130.  
  1131. for(i=0; i<missingLevels; i+=1)
  1132. {
  1133.  
  1134. expDiff = levelManager.GetTotalExpForNextLevel() - levelManager.GetPointsTotal(EExperiencePoint);
  1135. expDiff = CeilF( ((float)expDiff) / 2 );
  1136. AddPoints(EExperiencePoint, expDiff, false);
  1137. }
  1138.  
  1139.  
  1140.  
  1141.  
  1142.  
  1143. inv.RemoveItemByTag('Quest', -1);
  1144. horseInventory.RemoveItemByTag('Quest', -1);
  1145.  
  1146.  
  1147.  
  1148. questItems = theGame.GetDefinitionsManager().GetItemsWithTag('Quest');
  1149. for(i=0; i<questItems.Size(); i+=1)
  1150. {
  1151. inv.RemoveItemByName(questItems[i], -1);
  1152. horseInventory.RemoveItemByName(questItems[i], -1);
  1153. }
  1154.  
  1155.  
  1156. inv.RemoveItemByName('mq1002_artifact_3', -1);
  1157. horseInventory.RemoveItemByName('mq1002_artifact_3', -1);
  1158.  
  1159.  
  1160. inv.RemoveItemByTag('NotTransferableToNGP', -1);
  1161. horseInventory.RemoveItemByTag('NotTransferableToNGP', -1);
  1162.  
  1163.  
  1164. inv.RemoveItemByTag('NoticeBoardNote', -1);
  1165. horseInventory.RemoveItemByTag('NoticeBoardNote', -1);
  1166.  
  1167.  
  1168. RemoveAllNonAutoBuffs();
  1169.  
  1170.  
  1171. RemoveAlchemyRecipe('Recipe for Trial Potion Kit');
  1172. RemoveAlchemyRecipe('Recipe for Pops Antidote');
  1173. RemoveAlchemyRecipe('Recipe for Czart Lure');
  1174. RemoveAlchemyRecipe('q603_diarrhea_potion_recipe');
  1175.  
  1176.  
  1177. inv.RemoveItemByTag('Trophy', -1);
  1178. horseInventory.RemoveItemByTag('Trophy', -1);
  1179.  
  1180.  
  1181. inv.RemoveItemByCategory('usable', -1);
  1182. horseInventory.RemoveItemByCategory('usable', -1);
  1183.  
  1184.  
  1185. RemoveAbility('StaminaTutorialProlog');
  1186. RemoveAbility('TutorialStaminaRegenHack');
  1187. RemoveAbility('area_novigrad');
  1188. RemoveAbility('NoRegenEffect');
  1189. RemoveAbility('HeavySwimmingStaminaDrain');
  1190. RemoveAbility('AirBoost');
  1191. RemoveAbility('area_nml');
  1192. RemoveAbility('area_skellige');
  1193.  
  1194.  
  1195. inv.RemoveItemByTag('GwintCard', -1);
  1196. horseInventory.RemoveItemByTag('GwintCard', -1);
  1197.  
  1198.  
  1199.  
  1200. inv.RemoveItemByTag('ReadableItem', -1);
  1201. horseInventory.RemoveItemByTag('ReadableItem', -1);
  1202.  
  1203.  
  1204. abilityManager.RestoreStats();
  1205.  
  1206.  
  1207. ((W3PlayerAbilityManager)abilityManager).RemoveToxicityOffset(10000);
  1208.  
  1209.  
  1210. GetInventory().SingletonItemsRefillAmmo();
  1211.  
  1212.  
  1213. craftingSchematics.Clear();
  1214. AddStartingSchematics();
  1215.  
  1216.  
  1217. for( i=0; i<amountOfSetPiecesEquipped.Size(); i+=1 )
  1218. {
  1219. amountOfSetPiecesEquipped[i] = 0;
  1220. }
  1221.  
  1222.  
  1223. inv.AddAnItem('Clearing Potion', 1, true, false, false);
  1224.  
  1225.  
  1226. inv.RemoveItemByName('q203_broken_eyeofloki', -1);
  1227. horseInventory.RemoveItemByName('q203_broken_eyeofloki', -1);
  1228.  
  1229.  
  1230. //modSigns
  1231. if( FactsQuerySum("ModSignsKMSetSchematicsAdded") < 1 )
  1232. {
  1233. AddCraftingSchematic('Kaer Morhen Armor 1 schematic',true, true);
  1234. AddCraftingSchematic('Kaer Morhen Armor 2 schematic',true, true);
  1235. AddCraftingSchematic('Kaer Morhen Armor 3 schematic',true, true);
  1236. AddCraftingSchematic('Kaer Morhen Pants schematic',true, true);
  1237. AddCraftingSchematic('Kaer Morhen Pants 1 schematic',true, true);
  1238. AddCraftingSchematic('Kaer Morhen Pants 2 schematic',true, true);
  1239. AddCraftingSchematic('Kaer Morhen Pants 3 schematic',true, true);
  1240. AddCraftingSchematic('Kaer Morhen Boots schematic',true, true);
  1241. AddCraftingSchematic('Kaer Morhen Boots 1 schematic',true, true);
  1242. AddCraftingSchematic('Kaer Morhen Boots 2 schematic',true, true);
  1243. AddCraftingSchematic('Kaer Morhen Boots 3 schematic',true, true);
  1244. AddCraftingSchematic('Kaer Morhen Gloves schematic',true, true);
  1245. AddCraftingSchematic('Kaer Morhen Gloves 1 schematic',true, true);
  1246. AddCraftingSchematic('Kaer Morhen Gloves 2 schematic',true, true);
  1247. AddCraftingSchematic('Kaer Morhen Gloves 3 schematic',true, true);
  1248. FactsAdd("ModSignsKMSetSchematicsAdded");
  1249. }
  1250.  
  1251. NewGamePlusReplaceViperSet(inv);
  1252. NewGamePlusReplaceViperSet(horseInventory);
  1253. NewGamePlusReplaceKaerMorhenSet(inv); //modSigns
  1254. NewGamePlusReplaceKaerMorhenSet(horseInventory); //modSigns
  1255. NewGamePlusReplaceLynxSet(inv);
  1256. NewGamePlusReplaceLynxSet(horseInventory);
  1257. NewGamePlusReplaceGryphonSet(inv);
  1258. NewGamePlusReplaceGryphonSet(horseInventory);
  1259. NewGamePlusReplaceBearSet(inv);
  1260. NewGamePlusReplaceBearSet(horseInventory);
  1261. NewGamePlusReplaceEP1(inv);
  1262. NewGamePlusReplaceEP1(horseInventory);
  1263. NewGamePlusReplaceEP2WitcherSets(inv);
  1264. NewGamePlusReplaceEP2WitcherSets(horseInventory);
  1265. NewGamePlusReplaceEP2Items(inv);
  1266. NewGamePlusReplaceEP2Items(horseInventory);
  1267. NewGamePlusMarkItemsToNotAdjust(inv);
  1268. NewGamePlusMarkItemsToNotAdjust(horseInventory);
  1269.  
  1270.  
  1271. inputHandler.ClearLocksForNGP();
  1272.  
  1273.  
  1274. buffImmunities.Clear();
  1275. buffRemovedImmunities.Clear();
  1276.  
  1277. newGamePlusInitialized = true;
  1278.  
  1279.  
  1280. m_quenReappliedCount = 1;
  1281. }
  1282.  
  1283. private final function NewGamePlusMarkItemsToNotAdjust(out inv : CInventoryComponent)
  1284. {
  1285. var ids : array<SItemUniqueId>;
  1286. var i : int;
  1287. var n : name;
  1288.  
  1289. inv.GetAllItems(ids);
  1290. for( i=0; i<ids.Size(); i+=1 )
  1291. {
  1292. inv.SetItemModifierInt(ids[i], 'NGPItemAdjusted', 1);
  1293. }
  1294. }
  1295.  
  1296. private final function NewGamePlusReplaceItem( item : name, new_item : name, out inv : CInventoryComponent)
  1297. {
  1298. var i, j : int;
  1299. var ids, new_ids, enh_ids : array<SItemUniqueId>;
  1300. var dye_ids : array<SItemUniqueId>;
  1301. var enh : array<name>;
  1302. var wasEquipped : bool;
  1303. var wasEnchanted : bool;
  1304. var wasDyed : bool;
  1305. var enchantName, colorName : name;
  1306.  
  1307. if ( inv.HasItem( item ) )
  1308. {
  1309. ids = inv.GetItemsIds(item);
  1310. for (i = 0; i < ids.Size(); i += 1)
  1311. {
  1312. inv.GetItemEnhancementItems( ids[i], enh );
  1313. wasEnchanted = inv.IsItemEnchanted( ids[i] );
  1314. if ( wasEnchanted )
  1315. enchantName = inv.GetEnchantment( ids[i] );
  1316. wasEquipped = IsItemEquipped( ids[i] );
  1317. wasDyed = inv.IsItemColored( ids[i] );
  1318. if ( wasDyed )
  1319. {
  1320. colorName = inv.GetItemColor( ids[i] );
  1321. }
  1322.  
  1323. inv.RemoveItem( ids[i], 1 );
  1324. new_ids = inv.AddAnItem( new_item, 1, true, true, false );
  1325. if ( wasEquipped )
  1326. {
  1327. EquipItem( new_ids[0] );
  1328. }
  1329. if ( wasEnchanted )
  1330. {
  1331. inv.EnchantItem( new_ids[0], enchantName, getEnchamtmentStatName(enchantName) );
  1332. }
  1333. for (j = 0; j < enh.Size(); j += 1)
  1334. {
  1335. enh_ids = inv.AddAnItem( enh[j], 1, true, true, false );
  1336. inv.EnhanceItemScript( new_ids[0], enh_ids[0] );
  1337. }
  1338. if ( wasDyed )
  1339. {
  1340. dye_ids = inv.AddAnItem( colorName, 1, true, true, false );
  1341. inv.ColorItem( new_ids[0], dye_ids[0] );
  1342. inv.RemoveItem( dye_ids[0], 1 );
  1343. }
  1344.  
  1345. inv.SetItemModifierInt( new_ids[0], 'NGPItemAdjusted', 1 );
  1346. }
  1347. }
  1348. }
  1349.  
  1350. private final function NewGamePlusAdjustDLCItem(item : name, mod : name, inv : CInventoryComponent)
  1351. {
  1352. var ids : array<SItemUniqueId>;
  1353. var i : int;
  1354.  
  1355. if( inv.HasItem(item) )
  1356. {
  1357. ids = inv.GetItemsIds(item);
  1358. for (i = 0; i < ids.Size(); i += 1)
  1359. {
  1360. if ( inv.GetItemModifierInt(ids[i], 'DoNotAdjustNGPDLC') <= 0 )
  1361. {
  1362. inv.AddItemBaseAbility(ids[i], mod);
  1363. inv.SetItemModifierInt(ids[i], 'DoNotAdjustNGPDLC', 1);
  1364. }
  1365. }
  1366. }
  1367.  
  1368. }
  1369.  
  1370. private final function NewGamePlusAdjustDLC1TemerianSet(inv : CInventoryComponent)
  1371. {
  1372. NewGamePlusAdjustDLCItem('NGP DLC1 Temerian Armor', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1373. NewGamePlusAdjustDLCItem('NGP DLC1 Temerian Gloves', 'NGP DLC Compatibility Armor Mod', inv);
  1374. NewGamePlusAdjustDLCItem('NGP DLC1 Temerian Pants', 'NGP DLC Compatibility Armor Mod', inv);
  1375. NewGamePlusAdjustDLCItem('NGP DLC1 Temerian Boots', 'NGP DLC Compatibility Armor Mod', inv);
  1376. }
  1377.  
  1378. private final function NewGamePlusAdjustDLC5NilfgardianSet(inv : CInventoryComponent)
  1379. {
  1380. NewGamePlusAdjustDLCItem('NGP DLC5 Nilfgaardian Armor', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1381. NewGamePlusAdjustDLCItem('NGP DLC5 Nilfgaardian Gloves', 'NGP DLC Compatibility Armor Mod', inv);
  1382. NewGamePlusAdjustDLCItem('NGP DLC5 Nilfgaardian Pants', 'NGP DLC Compatibility Armor Mod', inv);
  1383. NewGamePlusAdjustDLCItem('NGP DLC5 Nilfgaardian Boots', 'NGP DLC Compatibility Armor Mod', inv);
  1384. }
  1385.  
  1386. private final function NewGamePlusAdjustDLC10WolfSet(inv : CInventoryComponent)
  1387. {
  1388. NewGamePlusAdjustDLCItem('NGP Wolf Armor', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1389. NewGamePlusAdjustDLCItem('NGP Wolf Armor 1', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1390. NewGamePlusAdjustDLCItem('NGP Wolf Armor 2', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1391. NewGamePlusAdjustDLCItem('NGP Wolf Armor 3', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1392.  
  1393. NewGamePlusAdjustDLCItem('NGP Wolf Boots 1', 'NGP DLC Compatibility Armor Mod', inv);
  1394. NewGamePlusAdjustDLCItem('NGP Wolf Boots 2', 'NGP DLC Compatibility Armor Mod', inv);
  1395. NewGamePlusAdjustDLCItem('NGP Wolf Boots 3', 'NGP DLC Compatibility Armor Mod', inv);
  1396. NewGamePlusAdjustDLCItem('NGP Wolf Boots 4', 'NGP DLC Compatibility Armor Mod', inv);
  1397.  
  1398. NewGamePlusAdjustDLCItem('NGP Wolf Gloves 1', 'NGP DLC Compatibility Armor Mod', inv);
  1399. NewGamePlusAdjustDLCItem('NGP Wolf Gloves 2', 'NGP DLC Compatibility Armor Mod', inv);
  1400. NewGamePlusAdjustDLCItem('NGP Wolf Gloves 3', 'NGP DLC Compatibility Armor Mod', inv);
  1401. NewGamePlusAdjustDLCItem('NGP Wolf Gloves 4', 'NGP DLC Compatibility Armor Mod', inv);
  1402.  
  1403. NewGamePlusAdjustDLCItem('NGP Wolf Pants 1', 'NGP DLC Compatibility Armor Mod', inv);
  1404. NewGamePlusAdjustDLCItem('NGP Wolf Pants 2', 'NGP DLC Compatibility Armor Mod', inv);
  1405. NewGamePlusAdjustDLCItem('NGP Wolf Pants 3', 'NGP DLC Compatibility Armor Mod', inv);
  1406. NewGamePlusAdjustDLCItem('NGP Wolf Pants 4', 'NGP DLC Compatibility Armor Mod', inv);
  1407.  
  1408. NewGamePlusAdjustDLCItem('NGP Wolf School steel sword', 'NGP Wolf Steel Sword Mod', inv);
  1409. NewGamePlusAdjustDLCItem('NGP Wolf School steel sword 1', 'NGP Wolf Steel Sword Mod', inv);
  1410. NewGamePlusAdjustDLCItem('NGP Wolf School steel sword 2', 'NGP Wolf Steel Sword Mod', inv);
  1411. NewGamePlusAdjustDLCItem('NGP Wolf School steel sword 3', 'NGP Wolf Steel Sword Mod', inv);
  1412.  
  1413. NewGamePlusAdjustDLCItem('NGP Wolf School silver sword', 'NGP Wolf Silver Sword Mod', inv);
  1414. NewGamePlusAdjustDLCItem('NGP Wolf School silver sword 1', 'NGP Wolf Silver Sword Mod', inv);
  1415. NewGamePlusAdjustDLCItem('NGP Wolf School silver sword 2', 'NGP Wolf Silver Sword Mod', inv);
  1416. NewGamePlusAdjustDLCItem('NGP Wolf School silver sword 3', 'NGP Wolf Silver Sword Mod', inv);
  1417. }
  1418.  
  1419. private final function NewGamePlusAdjustDLC14SkelligeSet(inv : CInventoryComponent)
  1420. {
  1421. NewGamePlusAdjustDLCItem('NGP DLC14 Skellige Armor', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1422. NewGamePlusAdjustDLCItem('NGP DLC14 Skellige Gloves', 'NGP DLC Compatibility Armor Mod', inv);
  1423. NewGamePlusAdjustDLCItem('NGP DLC14 Skellige Pants', 'NGP DLC Compatibility Armor Mod', inv);
  1424. NewGamePlusAdjustDLCItem('NGP DLC14 Skellige Boots', 'NGP DLC Compatibility Armor Mod', inv);
  1425. }
  1426.  
  1427. //modSigns
  1428. private final function NewGamePlusReplaceKaerMorhenSet(out inv : CInventoryComponent)
  1429. {
  1430. NewGamePlusReplaceItem('Kaer Morhen Armor','NGP Kaer Morhen Armor', inv);
  1431. NewGamePlusReplaceItem('Kaer Morhen Armor 1','NGP Kaer Morhen Armor 1', inv);
  1432. NewGamePlusReplaceItem('Kaer Morhen Armor 2','NGP Kaer Morhen Armor 2', inv);
  1433. NewGamePlusReplaceItem('Kaer Morhen Armor 3','NGP Kaer Morhen Armor 3', inv);
  1434. NewGamePlusReplaceItem('Kaer Morhen Pants','NGP Kaer Morhen Pants', inv);
  1435. NewGamePlusReplaceItem('Kaer Morhen Pants 1','NGP Kaer Morhen Pants 1', inv);
  1436. NewGamePlusReplaceItem('Kaer Morhen Pants 2','NGP Kaer Morhen Pants 2', inv);
  1437. NewGamePlusReplaceItem('Kaer Morhen Pants 3','NGP Kaer Morhen Pants 3', inv);
  1438. NewGamePlusReplaceItem('Kaer Morhen Boots','NGP Kaer Morhen Boots', inv);
  1439. NewGamePlusReplaceItem('Kaer Morhen Boots 1','NGP Kaer Morhen Boots 1', inv);
  1440. NewGamePlusReplaceItem('Kaer Morhen Boots 2','NGP Kaer Morhen Boots 2', inv);
  1441. NewGamePlusReplaceItem('Kaer Morhen Boots 3','NGP Kaer Morhen Boots 3', inv);
  1442. NewGamePlusReplaceItem('Kaer Morhen Gloves','NGP Kaer Morhen Gloves', inv);
  1443. NewGamePlusReplaceItem('Kaer Morhen Gloves 1','NGP Kaer Morhen Gloves 1', inv);
  1444. NewGamePlusReplaceItem('Kaer Morhen Gloves 2','NGP Kaer Morhen Gloves 2', inv);
  1445. NewGamePlusReplaceItem('Kaer Morhen Gloves 3','NGP Kaer Morhen Gloves 3', inv);
  1446. }
  1447.  
  1448. private final function NewGamePlusReplaceViperSet(out inv : CInventoryComponent)
  1449. {
  1450. NewGamePlusReplaceItem('Viper School steel sword', 'NGP Viper School steel sword', inv);
  1451.  
  1452. NewGamePlusReplaceItem('Viper School silver sword', 'NGP Viper School silver sword', inv);
  1453. }
  1454.  
  1455. private final function NewGamePlusReplaceLynxSet(out inv : CInventoryComponent)
  1456. {
  1457. NewGamePlusReplaceItem('Lynx Armor', 'NGP Lynx Armor', inv);
  1458. NewGamePlusReplaceItem('Lynx Armor 1', 'NGP Lynx Armor 1', inv);
  1459. NewGamePlusReplaceItem('Lynx Armor 2', 'NGP Lynx Armor 2', inv);
  1460. NewGamePlusReplaceItem('Lynx Armor 3', 'NGP Lynx Armor 3', inv);
  1461.  
  1462. NewGamePlusReplaceItem('Lynx Gloves 1', 'NGP Lynx Gloves 1', inv);
  1463. NewGamePlusReplaceItem('Lynx Gloves 2', 'NGP Lynx Gloves 2', inv);
  1464. NewGamePlusReplaceItem('Lynx Gloves 3', 'NGP Lynx Gloves 3', inv);
  1465. NewGamePlusReplaceItem('Lynx Gloves 4', 'NGP Lynx Gloves 4', inv);
  1466.  
  1467. NewGamePlusReplaceItem('Lynx Pants 1', 'NGP Lynx Pants 1', inv);
  1468. NewGamePlusReplaceItem('Lynx Pants 2', 'NGP Lynx Pants 2', inv);
  1469. NewGamePlusReplaceItem('Lynx Pants 3', 'NGP Lynx Pants 3', inv);
  1470. NewGamePlusReplaceItem('Lynx Pants 4', 'NGP Lynx Pants 4', inv);
  1471.  
  1472. NewGamePlusReplaceItem('Lynx Boots 1', 'NGP Lynx Boots 1', inv);
  1473. NewGamePlusReplaceItem('Lynx Boots 2', 'NGP Lynx Boots 2', inv);
  1474. NewGamePlusReplaceItem('Lynx Boots 3', 'NGP Lynx Boots 3', inv);
  1475. NewGamePlusReplaceItem('Lynx Boots 4', 'NGP Lynx Boots 4', inv);
  1476.  
  1477. NewGamePlusReplaceItem('Lynx School steel sword', 'NGP Lynx School steel sword', inv);
  1478. NewGamePlusReplaceItem('Lynx School steel sword 1', 'NGP Lynx School steel sword 1', inv);
  1479. NewGamePlusReplaceItem('Lynx School steel sword 2', 'NGP Lynx School steel sword 2', inv);
  1480. NewGamePlusReplaceItem('Lynx School steel sword 3', 'NGP Lynx School steel sword 3', inv);
  1481.  
  1482. NewGamePlusReplaceItem('Lynx School silver sword', 'NGP Lynx School silver sword', inv);
  1483. NewGamePlusReplaceItem('Lynx School silver sword 1', 'NGP Lynx School silver sword 1', inv);
  1484. NewGamePlusReplaceItem('Lynx School silver sword 2', 'NGP Lynx School silver sword 2', inv);
  1485. NewGamePlusReplaceItem('Lynx School silver sword 3', 'NGP Lynx School silver sword 3', inv);
  1486. }
  1487.  
  1488. private final function NewGamePlusReplaceGryphonSet(out inv : CInventoryComponent)
  1489. {
  1490. NewGamePlusReplaceItem('Gryphon Armor', 'NGP Gryphon Armor', inv);
  1491. NewGamePlusReplaceItem('Gryphon Armor 1', 'NGP Gryphon Armor 1', inv);
  1492. NewGamePlusReplaceItem('Gryphon Armor 2', 'NGP Gryphon Armor 2', inv);
  1493. NewGamePlusReplaceItem('Gryphon Armor 3', 'NGP Gryphon Armor 3', inv);
  1494.  
  1495. NewGamePlusReplaceItem('Gryphon Gloves 1', 'NGP Gryphon Gloves 1', inv);
  1496. NewGamePlusReplaceItem('Gryphon Gloves 2', 'NGP Gryphon Gloves 2', inv);
  1497. NewGamePlusReplaceItem('Gryphon Gloves 3', 'NGP Gryphon Gloves 3', inv);
  1498. NewGamePlusReplaceItem('Gryphon Gloves 4', 'NGP Gryphon Gloves 4', inv);
  1499.  
  1500. NewGamePlusReplaceItem('Gryphon Pants 1', 'NGP Gryphon Pants 1', inv);
  1501. NewGamePlusReplaceItem('Gryphon Pants 2', 'NGP Gryphon Pants 2', inv);
  1502. NewGamePlusReplaceItem('Gryphon Pants 3', 'NGP Gryphon Pants 3', inv);
  1503. NewGamePlusReplaceItem('Gryphon Pants 4', 'NGP Gryphon Pants 4', inv);
  1504.  
  1505. NewGamePlusReplaceItem('Gryphon Boots 1', 'NGP Gryphon Boots 1', inv);
  1506. NewGamePlusReplaceItem('Gryphon Boots 2', 'NGP Gryphon Boots 2', inv);
  1507. NewGamePlusReplaceItem('Gryphon Boots 3', 'NGP Gryphon Boots 3', inv);
  1508. NewGamePlusReplaceItem('Gryphon Boots 4', 'NGP Gryphon Boots 4', inv);
  1509.  
  1510. NewGamePlusReplaceItem('Gryphon School steel sword', 'NGP Gryphon School steel sword', inv);
  1511. NewGamePlusReplaceItem('Gryphon School steel sword 1', 'NGP Gryphon School steel sword 1', inv);
  1512. NewGamePlusReplaceItem('Gryphon School steel sword 2', 'NGP Gryphon School steel sword 2', inv);
  1513. NewGamePlusReplaceItem('Gryphon School steel sword 3', 'NGP Gryphon School steel sword 3', inv);
  1514.  
  1515. NewGamePlusReplaceItem('Gryphon School silver sword', 'NGP Gryphon School silver sword', inv);
  1516. NewGamePlusReplaceItem('Gryphon School silver sword 1', 'NGP Gryphon School silver sword 1', inv);
  1517. NewGamePlusReplaceItem('Gryphon School silver sword 2', 'NGP Gryphon School silver sword 2', inv);
  1518. NewGamePlusReplaceItem('Gryphon School silver sword 3', 'NGP Gryphon School silver sword 3', inv);
  1519. }
  1520.  
  1521. private final function NewGamePlusReplaceBearSet(out inv : CInventoryComponent)
  1522. {
  1523. NewGamePlusReplaceItem('Bear Armor', 'NGP Bear Armor', inv);
  1524. NewGamePlusReplaceItem('Bear Armor 1', 'NGP Bear Armor 1', inv);
  1525. NewGamePlusReplaceItem('Bear Armor 2', 'NGP Bear Armor 2', inv);
  1526. NewGamePlusReplaceItem('Bear Armor 3', 'NGP Bear Armor 3', inv);
  1527.  
  1528. NewGamePlusReplaceItem('Bear Gloves 1', 'NGP Bear Gloves 1', inv);
  1529. NewGamePlusReplaceItem('Bear Gloves 2', 'NGP Bear Gloves 2', inv);
  1530. NewGamePlusReplaceItem('Bear Gloves 3', 'NGP Bear Gloves 3', inv);
  1531. NewGamePlusReplaceItem('Bear Gloves 4', 'NGP Bear Gloves 4', inv);
  1532.  
  1533. NewGamePlusReplaceItem('Bear Pants 1', 'NGP Bear Pants 1', inv);
  1534. NewGamePlusReplaceItem('Bear Pants 2', 'NGP Bear Pants 2', inv);
  1535. NewGamePlusReplaceItem('Bear Pants 3', 'NGP Bear Pants 3', inv);
  1536. NewGamePlusReplaceItem('Bear Pants 4', 'NGP Bear Pants 4', inv);
  1537.  
  1538. NewGamePlusReplaceItem('Bear Boots 1', 'NGP Bear Boots 1', inv);
  1539. NewGamePlusReplaceItem('Bear Boots 2', 'NGP Bear Boots 2', inv);
  1540. NewGamePlusReplaceItem('Bear Boots 3', 'NGP Bear Boots 3', inv);
  1541. NewGamePlusReplaceItem('Bear Boots 4', 'NGP Bear Boots 4', inv);
  1542.  
  1543. NewGamePlusReplaceItem('Bear School steel sword', 'NGP Bear School steel sword', inv);
  1544. NewGamePlusReplaceItem('Bear School steel sword 1', 'NGP Bear School steel sword 1', inv);
  1545. NewGamePlusReplaceItem('Bear School steel sword 2', 'NGP Bear School steel sword 2', inv);
  1546. NewGamePlusReplaceItem('Bear School steel sword 3', 'NGP Bear School steel sword 3', inv);
  1547.  
  1548. NewGamePlusReplaceItem('Bear School silver sword', 'NGP Bear School silver sword', inv);
  1549. NewGamePlusReplaceItem('Bear School silver sword 1', 'NGP Bear School silver sword 1', inv);
  1550. NewGamePlusReplaceItem('Bear School silver sword 2', 'NGP Bear School silver sword 2', inv);
  1551. NewGamePlusReplaceItem('Bear School silver sword 3', 'NGP Bear School silver sword 3', inv);
  1552. }
  1553.  
  1554. private final function NewGamePlusReplaceEP1(out inv : CInventoryComponent)
  1555. {
  1556. NewGamePlusReplaceItem('Ofir Armor', 'NGP Ofir Armor', inv);
  1557. NewGamePlusReplaceItem('Ofir Sabre 2', 'NGP Ofir Sabre 2', inv);
  1558.  
  1559. NewGamePlusReplaceItem('Crafted Burning Rose Armor', 'NGP Crafted Burning Rose Armor', inv);
  1560. NewGamePlusReplaceItem('Crafted Burning Rose Gloves', 'NGP Crafted Burning Rose Gloves', inv);
  1561. NewGamePlusReplaceItem('Crafted Burning Rose Sword', 'NGP Crafted Burning Rose Sword', inv);
  1562.  
  1563. NewGamePlusReplaceItem('Crafted Ofir Armor', 'NGP Crafted Ofir Armor', inv);
  1564. NewGamePlusReplaceItem('Crafted Ofir Boots', 'NGP Crafted Ofir Boots', inv);
  1565. NewGamePlusReplaceItem('Crafted Ofir Gloves', 'NGP Crafted Ofir Gloves', inv);
  1566. NewGamePlusReplaceItem('Crafted Ofir Pants', 'NGP Crafted Ofir Pants', inv);
  1567. NewGamePlusReplaceItem('Crafted Ofir Steel Sword', 'NGP Crafted Ofir Steel Sword', inv);
  1568.  
  1569. NewGamePlusReplaceItem('EP1 Crafted Witcher Silver Sword', 'NGP EP1 Crafted Witcher Silver Sword', inv);
  1570. //NewGamePlusReplaceItem('Olgierd Sabre', 'NGP Olgierd Sabre', inv);
  1571.  
  1572. NewGamePlusReplaceItem('EP1 Witcher Armor', 'NGP EP1 Witcher Armor', inv);
  1573. NewGamePlusReplaceItem('EP1 Witcher Boots', 'NGP EP1 Witcher Boots', inv);
  1574. NewGamePlusReplaceItem('EP1 Witcher Gloves', 'NGP EP1 Witcher Gloves', inv);
  1575. NewGamePlusReplaceItem('EP1 Witcher Pants', 'NGP EP1 Witcher Pants', inv);
  1576. NewGamePlusReplaceItem('EP1 Viper School steel sword', 'NGP EP1 Viper School steel sword', inv);
  1577. NewGamePlusReplaceItem('EP1 Viper School silver sword', 'NGP EP1 Viper School silver sword', inv);
  1578. }
  1579.  
  1580. private final function NewGamePlusReplaceEP2WitcherSets(out inv : CInventoryComponent)
  1581. {
  1582. NewGamePlusReplaceItem('Lynx Armor 4', 'NGP Lynx Armor 4', inv);
  1583. NewGamePlusReplaceItem('Gryphon Armor 4', 'NGP Gryphon Armor 4', inv);
  1584. NewGamePlusReplaceItem('Bear Armor 4', 'NGP Bear Armor 4', inv);
  1585. NewGamePlusReplaceItem('Wolf Armor 4', 'NGP Wolf Armor 4', inv);
  1586. NewGamePlusReplaceItem('Red Wolf Armor 1', 'NGP Red Wolf Armor 1', inv);
  1587.  
  1588. NewGamePlusReplaceItem('Lynx Gloves 5', 'NGP Lynx Gloves 5', inv);
  1589. NewGamePlusReplaceItem('Gryphon Gloves 5', 'NGP Gryphon Gloves 5', inv);
  1590. NewGamePlusReplaceItem('Bear Gloves 5', 'NGP Bear Gloves 5', inv);
  1591. NewGamePlusReplaceItem('Wolf Gloves 5', 'NGP Wolf Gloves 5', inv);
  1592. NewGamePlusReplaceItem('Red Wolf Gloves 1', 'NGP Red Wolf Gloves 1', inv);
  1593.  
  1594. NewGamePlusReplaceItem('Lynx Pants 5', 'NGP Lynx Pants 5', inv);
  1595. NewGamePlusReplaceItem('Gryphon Pants 5', 'NGP Gryphon Pants 5', inv);
  1596. NewGamePlusReplaceItem('Bear Pants 5', 'NGP Bear Pants 5', inv);
  1597. NewGamePlusReplaceItem('Wolf Pants 5', 'NGP Wolf Pants 5', inv);
  1598. NewGamePlusReplaceItem('Red Wolf Pants 1', 'NGP Red Wolf Pants 1', inv);
  1599.  
  1600. NewGamePlusReplaceItem('Lynx Boots 5', 'NGP Lynx Boots 5', inv);
  1601. NewGamePlusReplaceItem('Gryphon Boots 5', 'NGP Gryphon Boots 5', inv);
  1602. NewGamePlusReplaceItem('Bear Boots 5', 'NGP Bear Boots 5', inv);
  1603. NewGamePlusReplaceItem('Wolf Boots 5', 'NGP Wolf Boots 5', inv);
  1604. NewGamePlusReplaceItem('Red Wolf Boots 1', 'NGP Red Wolf Boots 1', inv);
  1605.  
  1606.  
  1607. NewGamePlusReplaceItem('Lynx School steel sword 4', 'NGP Lynx School steel sword 4', inv);
  1608. NewGamePlusReplaceItem('Gryphon School steel sword 4', 'NGP Gryphon School steel sword 4', inv);
  1609. NewGamePlusReplaceItem('Bear School steel sword 4', 'NGP Bear School steel sword 4', inv);
  1610. NewGamePlusReplaceItem('Wolf School steel sword 4', 'NGP Wolf School steel sword 4', inv);
  1611. NewGamePlusReplaceItem('Red Wolf School steel sword 1', 'NGP Red Wolf School steel sword 1', inv);
  1612.  
  1613. NewGamePlusReplaceItem('Lynx School silver sword 4', 'NGP Lynx School silver sword 4', inv);
  1614. NewGamePlusReplaceItem('Gryphon School silver sword 4', 'NGP Gryphon School silver sword 4', inv);
  1615. NewGamePlusReplaceItem('Bear School silver sword 4', 'NGP Bear School silver sword 4', inv);
  1616. NewGamePlusReplaceItem('Wolf School silver sword 4', 'NGP Wolf School silver sword 4', inv);
  1617. NewGamePlusReplaceItem('Red Wolf School silver sword 1', 'NGP Red Wolf School silver sword 1', inv);
  1618. }
  1619.  
  1620. private final function NewGamePlusReplaceEP2Items(out inv : CInventoryComponent)
  1621. {
  1622. NewGamePlusReplaceItem('Guard Lvl1 Armor 3', 'NGP Guard Lvl1 Armor 3', inv);
  1623. NewGamePlusReplaceItem('Guard Lvl1 A Armor 3', 'NGP Guard Lvl1 A Armor 3', inv);
  1624. NewGamePlusReplaceItem('Guard Lvl2 Armor 3', 'NGP Guard Lvl2 Armor 3', inv);
  1625. NewGamePlusReplaceItem('Guard Lvl2 A Armor 3', 'NGP Guard Lvl2 A Armor 3', inv);
  1626. NewGamePlusReplaceItem('Knight Geralt Armor 3', 'NGP Knight Geralt Armor 3', inv);
  1627. NewGamePlusReplaceItem('Knight Geralt A Armor 3', 'NGP Knight Geralt A Armor 3', inv);
  1628. //NewGamePlusReplaceItem('q702_vampire_armor', 'NGP q702_vampire_armor', inv);
  1629.  
  1630. NewGamePlusReplaceItem('Guard Lvl1 Gloves 3', 'NGP Guard Lvl1 Gloves 3', inv);
  1631. NewGamePlusReplaceItem('Guard Lvl1 A Gloves 3', 'NGP Guard Lvl1 A Gloves 3', inv);
  1632. NewGamePlusReplaceItem('Guard Lvl2 Gloves 3', 'NGP Guard Lvl2 Gloves 3', inv);
  1633. NewGamePlusReplaceItem('Guard Lvl2 A Gloves 3', 'NGP Guard Lvl2 A Gloves 3', inv);
  1634. NewGamePlusReplaceItem('Knight Geralt Gloves 3', 'NGP Knight Geralt Gloves 3', inv);
  1635. NewGamePlusReplaceItem('Knight Geralt A Gloves 3', 'NGP Knight Geralt A Gloves 3', inv);
  1636. //NewGamePlusReplaceItem('q702_vampire_gloves', 'NGP q702_vampire_gloves', inv);
  1637.  
  1638. NewGamePlusReplaceItem('Guard Lvl1 Pants 3', 'NGP Guard Lvl1 Pants 3', inv);
  1639. NewGamePlusReplaceItem('Guard Lvl1 A Pants 3', 'NGP Guard Lvl1 A Pants 3', inv);
  1640. NewGamePlusReplaceItem('Guard Lvl2 Pants 3', 'NGP Guard Lvl2 Pants 3', inv);
  1641. NewGamePlusReplaceItem('Guard Lvl2 A Pants 3', 'NGP Guard Lvl2 A Pants 3', inv);
  1642. NewGamePlusReplaceItem('Knight Geralt Pants 3', 'NGP Knight Geralt Pants 3', inv);
  1643. NewGamePlusReplaceItem('Knight Geralt A Pants 3', 'NGP Knight Geralt A Pants 3', inv);
  1644. //NewGamePlusReplaceItem('q702_vampire_pants', 'NGP q702_vampire_pants', inv);
  1645.  
  1646. NewGamePlusReplaceItem('Guard Lvl1 Boots 3', 'NGP Guard Lvl1 Boots 3', inv);
  1647. NewGamePlusReplaceItem('Guard Lvl1 A Boots 3', 'NGP Guard Lvl1 A Boots 3', inv);
  1648. NewGamePlusReplaceItem('Guard Lvl2 Boots 3', 'NGP Guard Lvl2 Boots 3', inv);
  1649. NewGamePlusReplaceItem('Guard Lvl2 A Boots 3', 'NGP Guard Lvl2 A Boots 3', inv);
  1650. NewGamePlusReplaceItem('Knight Geralt Boots 3', 'NGP Knight Geralt Boots 3', inv);
  1651. NewGamePlusReplaceItem('Knight Geralt A Boots 3', 'NGP Knight Geralt A Boots 3', inv);
  1652. //NewGamePlusReplaceItem('q702_vampire_boots', 'NGP q702_vampire_boots', inv);
  1653.  
  1654. NewGamePlusReplaceItem('Serpent Steel Sword 1', 'NGP Serpent Steel Sword 1', inv);
  1655. NewGamePlusReplaceItem('Serpent Steel Sword 2', 'NGP Serpent Steel Sword 2', inv);
  1656. NewGamePlusReplaceItem('Serpent Steel Sword 3', 'NGP Serpent Steel Sword 3', inv);
  1657. NewGamePlusReplaceItem('Guard lvl1 steel sword 3', 'NGP Guard lvl1 steel sword 3', inv);
  1658. NewGamePlusReplaceItem('Guard lvl2 steel sword 3', 'NGP Guard lvl2 steel sword 3', inv);
  1659. NewGamePlusReplaceItem('Knights steel sword 3', 'NGP Knights steel sword 3', inv);
  1660. NewGamePlusReplaceItem('Hanza steel sword 3', 'NGP Hanza steel sword 3', inv);
  1661. NewGamePlusReplaceItem('Toussaint steel sword 3', 'NGP Toussaint steel sword 3', inv);
  1662. //NewGamePlusReplaceItem('q702 vampire steel sword', 'NGP q702 vampire steel sword', inv);
  1663.  
  1664. NewGamePlusReplaceItem('Serpent Silver Sword 1', 'NGP Serpent Silver Sword 1', inv);
  1665. NewGamePlusReplaceItem('Serpent Silver Sword 2', 'NGP Serpent Silver Sword 2', inv);
  1666. NewGamePlusReplaceItem('Serpent Silver Sword 3', 'NGP Serpent Silver Sword 3', inv);
  1667. }
  1668.  
  1669. public function GetEquippedSword(steel : bool) : SItemUniqueId
  1670. {
  1671. var item : SItemUniqueId;
  1672.  
  1673. if(steel)
  1674. GetItemEquippedOnSlot(EES_SteelSword, item);
  1675. else
  1676. GetItemEquippedOnSlot(EES_SilverSword, item);
  1677.  
  1678. return item;
  1679. }
  1680.  
  1681. timer function BroadcastRain( deltaTime : float, id : int )
  1682. {
  1683. var rainStrength : float = 0;
  1684. rainStrength = GetRainStrength();
  1685. if( rainStrength > 0.5 )
  1686. {
  1687. theGame.GetBehTreeReactionManager().CreateReactionEventIfPossible( thePlayer, 'RainAction', 2.0f , 50.0f, -1.f, -1, true);
  1688. LogReactionSystem( "'RainAction' was sent by Player - single broadcast - distance: 50.0" );
  1689. }
  1690. }
  1691.  
  1692. function InitializeParryType()
  1693. {
  1694. var i, j : int;
  1695.  
  1696. parryTypeTable.Resize( EnumGetMax('EAttackSwingType')+1 );
  1697. for( i = 0; i < EnumGetMax('EAttackSwingType')+1; i += 1 )
  1698. {
  1699. parryTypeTable[i].Resize( EnumGetMax('EAttackSwingDirection')+1 );
  1700. }
  1701. parryTypeTable[AST_Horizontal][ASD_UpDown] = PT_None;
  1702. parryTypeTable[AST_Horizontal][ASD_DownUp] = PT_None;
  1703. parryTypeTable[AST_Horizontal][ASD_LeftRight] = PT_Left;
  1704. parryTypeTable[AST_Horizontal][ASD_RightLeft] = PT_Right;
  1705. parryTypeTable[AST_Vertical][ASD_UpDown] = PT_Up;
  1706. parryTypeTable[AST_Vertical][ASD_DownUp] = PT_Down;
  1707. parryTypeTable[AST_Vertical][ASD_LeftRight] = PT_None;
  1708. parryTypeTable[AST_Vertical][ASD_RightLeft] = PT_None;
  1709. parryTypeTable[AST_DiagonalUp][ASD_UpDown] = PT_None;
  1710. parryTypeTable[AST_DiagonalUp][ASD_DownUp] = PT_None;
  1711. parryTypeTable[AST_DiagonalUp][ASD_LeftRight] = PT_UpLeft;
  1712. parryTypeTable[AST_DiagonalUp][ASD_RightLeft] = PT_RightUp;
  1713. parryTypeTable[AST_DiagonalDown][ASD_UpDown] = PT_None;
  1714. parryTypeTable[AST_DiagonalDown][ASD_DownUp] = PT_None;
  1715. parryTypeTable[AST_DiagonalDown][ASD_LeftRight] = PT_LeftDown;
  1716. parryTypeTable[AST_DiagonalDown][ASD_RightLeft] = PT_DownRight;
  1717. parryTypeTable[AST_Jab][ASD_UpDown] = PT_Jab;
  1718. parryTypeTable[AST_Jab][ASD_DownUp] = PT_Jab;
  1719. parryTypeTable[AST_Jab][ASD_LeftRight] = PT_Jab;
  1720. parryTypeTable[AST_Jab][ASD_RightLeft] = PT_Jab;
  1721. }
  1722.  
  1723.  
  1724.  
  1725.  
  1726.  
  1727.  
  1728. event OnDeath( damageAction : W3DamageAction )
  1729. {
  1730. var items : array< SItemUniqueId >;
  1731. var i, size : int;
  1732. var slot : EEquipmentSlots;
  1733. var holdSlot : name;
  1734.  
  1735. super.OnDeath( damageAction );
  1736.  
  1737. items = GetHeldItems();
  1738.  
  1739. if( rangedWeapon && rangedWeapon.GetCurrentStateName() != 'State_WeaponWait')
  1740. {
  1741. OnRangedForceHolster( true, true, true );
  1742. rangedWeapon.ClearDeployedEntity(true);
  1743. }
  1744.  
  1745. size = items.Size();
  1746.  
  1747. if ( size > 0 )
  1748. {
  1749. for ( i = 0; i < size; i += 1 )
  1750. {
  1751. if ( this.inv.IsIdValid( items[i] ) && !( this.inv.IsItemCrossbow( items[i] ) ) )
  1752. {
  1753. holdSlot = this.inv.GetItemHoldSlot( items[i] );
  1754.  
  1755. if ( holdSlot == 'l_weapon' && this.IsHoldingItemInLHand() )
  1756. {
  1757. this.OnUseSelectedItem( true );
  1758. }
  1759.  
  1760. DropItemFromSlot( holdSlot, false );
  1761.  
  1762. if ( holdSlot == 'r_weapon' )
  1763. {
  1764. slot = this.GetItemSlot( items[i] );
  1765. if ( UnequipItemFromSlot( slot ) )
  1766. Log( "Unequip" );
  1767. }
  1768. }
  1769. }
  1770. }
  1771. }
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.  
  1779. function HandleMovement( deltaTime : float )
  1780. {
  1781. super.HandleMovement( deltaTime );
  1782.  
  1783. rawCameraHeading = theCamera.GetCameraHeading();
  1784. }
  1785.  
  1786.  
  1787.  
  1788.  
  1789.  
  1790.  
  1791.  
  1792. function ToggleSpecialAttackHeavyAllowed( toggle : bool)
  1793. {
  1794. specialAttackHeavyAllowed = toggle;
  1795. }
  1796.  
  1797. function GetReputationManager() : W3Reputation
  1798. {
  1799. return reputationManager;
  1800. }
  1801.  
  1802. function OnRadialMenuItemChoose( selectedItem : string )
  1803. {
  1804. var iSlotId : int;
  1805. var item : SItemUniqueId;
  1806.  
  1807. if ( selectedItem != "Crossbow" )
  1808. {
  1809. if ( rangedWeapon && rangedWeapon.GetCurrentStateName() != 'State_WeaponWait' )
  1810. OnRangedForceHolster( true, false );
  1811. }
  1812.  
  1813.  
  1814. switch(selectedItem)
  1815. {
  1816.  
  1817. case "Meditation":
  1818. theGame.RequestMenuWithBackground( 'MeditationClockMenu', 'CommonMenu' );
  1819. break;
  1820. // -= WMK:modQuickSlots =-
  1821. /*
  1822. case "Slot1":
  1823. GetItemEquippedOnSlot( EES_Petard1, item );
  1824. if( thePlayer.inv.IsIdValid( item ) )
  1825. {
  1826. SelectQuickslotItem( EES_Petard1 );
  1827. }
  1828. else
  1829. {
  1830. SelectQuickslotItem( EES_Petard2 );
  1831. }
  1832. break;
  1833.  
  1834. case "Slot2":
  1835. GetItemEquippedOnSlot( EES_Petard2, item );
  1836. if( thePlayer.inv.IsIdValid( item ) )
  1837. {
  1838. SelectQuickslotItem( EES_Petard2 );
  1839. }
  1840. else
  1841. {
  1842. SelectQuickslotItem( EES_Petard1 );
  1843. }
  1844. break;
  1845. */
  1846. case "Slot1":
  1847. SelectQuickslotItem(EES_Petard1);
  1848. break;
  1849. case "Slot2":
  1850. SelectQuickslotItem(EES_Petard2);
  1851. break;
  1852. case "Slot5":
  1853. SelectQuickslotItem(EES_Petard3);
  1854. break;
  1855. case "Slot6":
  1856. SelectQuickslotItem(EES_Petard4);
  1857. break;
  1858. // -= WMK:modQuickSlots =-
  1859.  
  1860. case "Crossbow":
  1861. SelectQuickslotItem(EES_RangedWeapon);
  1862. break;
  1863.  
  1864. case "Slot3":
  1865. GetItemEquippedOnSlot( EES_Quickslot1, item );
  1866. if( thePlayer.inv.IsIdValid( item ) )
  1867. {
  1868. SelectQuickslotItem( EES_Quickslot1 );
  1869. }
  1870. else
  1871. {
  1872. SelectQuickslotItem( EES_Quickslot2 );
  1873. }
  1874. break;
  1875.  
  1876. case "Slot4":
  1877. GetItemEquippedOnSlot( EES_Quickslot2, item );
  1878. if( thePlayer.inv.IsIdValid( item ) )
  1879. {
  1880. SelectQuickslotItem( EES_Quickslot2 );
  1881. }
  1882. else
  1883. {
  1884. SelectQuickslotItem( EES_Quickslot1 );
  1885. }
  1886. break;
  1887.  
  1888. default:
  1889. SetEquippedSign(SignStringToEnum( selectedItem ));
  1890. FactsRemove("SignToggled");
  1891. break;
  1892. }
  1893. }
  1894.  
  1895. function ToggleNextItem()
  1896. {
  1897. var quickSlotItems : array< EEquipmentSlots >;
  1898. var currentSelectedItem : SItemUniqueId;
  1899. var item : SItemUniqueId;
  1900. var i : int;
  1901.  
  1902. for( i = EES_Quickslot2; i > EES_Petard1 - 1; i -= 1 )
  1903. {
  1904. GetItemEquippedOnSlot( i, item );
  1905. if( inv.IsIdValid( item ) )
  1906. {
  1907. quickSlotItems.PushBack( i );
  1908. }
  1909. }
  1910. if( !quickSlotItems.Size() )
  1911. {
  1912. return;
  1913. }
  1914.  
  1915. currentSelectedItem = GetSelectedItemId();
  1916.  
  1917. if( inv.IsIdValid( currentSelectedItem ) )
  1918. {
  1919. for( i = 0; i < quickSlotItems.Size(); i += 1 )
  1920. {
  1921. GetItemEquippedOnSlot( quickSlotItems[i], item );
  1922. if( currentSelectedItem == item )
  1923. {
  1924. if( i == quickSlotItems.Size() - 1 )
  1925. {
  1926. SelectQuickslotItem( quickSlotItems[ 0 ] );
  1927. }
  1928. else
  1929. {
  1930. SelectQuickslotItem( quickSlotItems[ i + 1 ] );
  1931. }
  1932. return;
  1933. }
  1934. }
  1935. }
  1936. else
  1937. {
  1938. SelectQuickslotItem( quickSlotItems[ 0 ] );
  1939. }
  1940. }
  1941.  
  1942.  
  1943. function SetEquippedSign( signType : ESignType )
  1944. {
  1945. if(!IsSignBlocked(signType))
  1946. {
  1947. equippedSign = signType;
  1948. FactsSet("CurrentlySelectedSign", equippedSign);
  1949. }
  1950. }
  1951.  
  1952. function GetEquippedSign() : ESignType
  1953. {
  1954. return equippedSign;
  1955. }
  1956.  
  1957. function GetCurrentlyCastSign() : ESignType
  1958. {
  1959. return currentlyCastSign;
  1960. }
  1961.  
  1962. function SetCurrentlyCastSign( type : ESignType, entity : W3SignEntity )
  1963. {
  1964. currentlyCastSign = type;
  1965.  
  1966. if( type != ST_None )
  1967. {
  1968. signs[currentlyCastSign].entity = entity;
  1969. }
  1970. }
  1971.  
  1972. function GetCurrentSignEntity() : W3SignEntity
  1973. {
  1974. if(currentlyCastSign == ST_None)
  1975. return NULL;
  1976.  
  1977. return signs[currentlyCastSign].entity;
  1978. }
  1979.  
  1980. public function GetSignEntity(type : ESignType) : W3SignEntity
  1981. {
  1982. if(type == ST_None)
  1983. return NULL;
  1984.  
  1985. return signs[type].entity;
  1986. }
  1987.  
  1988. public function GetSignTemplate(type : ESignType) : CEntityTemplate
  1989. {
  1990. if(type == ST_None)
  1991. return NULL;
  1992.  
  1993. return signs[type].template;
  1994. }
  1995.  
  1996. public function IsCurrentSignChanneled() : bool
  1997. {
  1998. if( currentlyCastSign != ST_None && signs[currentlyCastSign].entity)
  1999. return signs[currentlyCastSign].entity.OnCheckChanneling();
  2000.  
  2001. return false;
  2002. }
  2003.  
  2004. function IsCastingSign() : bool
  2005. {
  2006. return currentlyCastSign != ST_None;
  2007. }
  2008.  
  2009.  
  2010. protected function IsInCombatActionCameraRotationEnabled() : bool
  2011. {
  2012. if( IsInCombatAction() && ( GetCombatAction() == EBAT_EMPTY || GetCombatAction() == EBAT_Parry ) )
  2013. {
  2014. return true;
  2015. }
  2016.  
  2017. return !bIsInCombatAction;
  2018. }
  2019.  
  2020. function SetHoldBeforeOpenRadialMenuTime ( time : float )
  2021. {
  2022. _HoldBeforeOpenRadialMenuTime = time;
  2023. }
  2024.  
  2025.  
  2026.  
  2027.  
  2028.  
  2029.  
  2030.  
  2031. public function RepairItem ( rapairKitId : SItemUniqueId, usedOnItem : SItemUniqueId )
  2032. {
  2033. var itemMaxDurablity : float;
  2034. var itemCurrDurablity : float;
  2035. var baseRepairValue : float;
  2036. var reapirValue : float;
  2037. var itemAttribute : SAbilityAttributeValue;
  2038. var dmgBoost : float; //modSigns
  2039.  
  2040. itemMaxDurablity = inv.GetItemMaxDurability(usedOnItem);
  2041. itemCurrDurablity = inv.GetItemDurability(usedOnItem);
  2042. itemAttribute = inv.GetItemAttributeValue ( rapairKitId, 'repairValue' );
  2043.  
  2044. /*if( itemCurrDurablity >= itemMaxDurablity )
  2045. {
  2046. return;
  2047. }*/ //modSigns
  2048.  
  2049. if ( inv.IsItemAnyArmor ( usedOnItem )|| inv.IsItemWeapon( usedOnItem ) )
  2050. {
  2051. //modSigns: master repair kits increase item level
  2052. if( inv.ItemHasTag( rapairKitId, 'ArmorReapairKit_Master' ) || inv.ItemHasTag( rapairKitId, 'WeaponReapairKit_Master' ) )
  2053. {
  2054. inv.AddItemLevelAbility( usedOnItem );
  2055. //if( inv.ItemHasTag( usedOnItem, 'Aerondight' ) )
  2056. //{
  2057. // dmgBoost = inv.GetItemModifierFloat( usedOnItem, 'PermDamageBoost' );
  2058. // if( dmgBoost > 10 )
  2059. // inv.SetItemModifierFloat( usedOnItem, 'PermDamageBoost', dmgBoost - 10 );
  2060. //}
  2061. }
  2062.  
  2063. baseRepairValue = itemMaxDurablity * itemAttribute.valueMultiplicative;
  2064. reapirValue = MinF( itemCurrDurablity + baseRepairValue, itemMaxDurablity );
  2065.  
  2066. inv.SetItemDurabilityScript ( usedOnItem, MinF ( reapirValue, itemMaxDurablity ));
  2067. }
  2068.  
  2069. inv.RemoveItem ( rapairKitId, 1 );
  2070.  
  2071. }
  2072. public function HasRepairAbleGearEquiped ( ) : bool
  2073. {
  2074. var curEquipedItem : SItemUniqueId;
  2075.  
  2076. return ( GetItemEquippedOnSlot(EES_Armor, curEquipedItem) || GetItemEquippedOnSlot(EES_Boots, curEquipedItem) || GetItemEquippedOnSlot(EES_Pants, curEquipedItem) || GetItemEquippedOnSlot(EES_Gloves, curEquipedItem)) == true;
  2077. }
  2078. public function HasRepairAbleWaponEquiped () : bool
  2079. {
  2080. var curEquipedItem : SItemUniqueId;
  2081.  
  2082. return ( GetItemEquippedOnSlot(EES_SilverSword, curEquipedItem) || GetItemEquippedOnSlot(EES_SteelSword, curEquipedItem) ) == true;
  2083. }
  2084. public function IsItemRepairAble ( item : SItemUniqueId ) : bool
  2085. {
  2086. return inv.HasItemDurability(item); //inv.GetItemDurabilityRatio(item) <= 0.99999f; //modSigns
  2087. }
  2088.  
  2089.  
  2090.  
  2091.  
  2092.  
  2093.  
  2094.  
  2095.  
  2096. public function ApplyOil( oilId : SItemUniqueId, usedOnItem : SItemUniqueId ) : bool
  2097. {
  2098. var tutStateOil : W3TutorialManagerUIHandlerStateOils;
  2099.  
  2100. // CA
  2101. if( !super.CanApplyOilOnItem( oilId, usedOnItem ) )
  2102. {
  2103. return false;
  2104. }
  2105.  
  2106. if (CAOilAnimOn() && ((thePlayer.IsInCombat() && CAOilCombat() ) || thePlayer.GetCurrentStateName() == 'Exploration')) {
  2107. completeAnims.SetOil( oilId );
  2108. completeAnims.SetOilOnItem( usedOnItem );
  2109. completeAnims.OilAnim(inv.GetItemCategory(usedOnItem));
  2110. } else {
  2111. super.ApplyOil( oilId, usedOnItem );
  2112. }
  2113. // CA
  2114.  
  2115. if(ShouldProcessTutorial('TutorialOilCanEquip3'))
  2116. {
  2117. tutStateOil = (W3TutorialManagerUIHandlerStateOils)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
  2118. if(tutStateOil)
  2119. {
  2120. tutStateOil.OnOilApplied();
  2121. }
  2122. }
  2123.  
  2124. return true;
  2125. }
  2126.  
  2127. private final function RemoveExtraOilsFromItem( item : SItemUniqueId )
  2128. {
  2129. var oils : array< CBaseGameplayEffect >;
  2130. var i, cnt : int;
  2131. var buff : W3Effect_Oil;
  2132.  
  2133. oils = GetBuffs( EET_Oil );
  2134. for( i=0; i<oils.Size(); i+=1 )
  2135. {
  2136. buff = (W3Effect_Oil) oils[ i ];
  2137. if( buff && buff.GetSwordItemId() == item )
  2138. {
  2139. cnt += 1;
  2140. }
  2141. }
  2142. while( cnt > 1 )
  2143. {
  2144. inv.RemoveOldestOilFromItem( item );
  2145. cnt -= 1;
  2146. }
  2147. }
  2148.  
  2149.  
  2150.  
  2151.  
  2152.  
  2153.  
  2154.  
  2155.  
  2156. //modSigns: separate function for dodge
  2157. function DodgeDamage(out damageData : W3DamageAction)
  2158. {
  2159. var actorAttacker : CActor;
  2160. var attackRange : CAIAttackRange;
  2161. var safeAngleDist, angleDist, distToAttacker, damageReduction : float;
  2162. var attackName : name;
  2163. var isDodging, isIceGiantSpecial : bool;
  2164.  
  2165. super.DodgeDamage(damageData);
  2166.  
  2167. actorAttacker = (CActor)damageData.attacker;
  2168. //modSigns: fix dodge detection bug - shouldn't be needed anymore, but leaving it here just in case
  2169. isDodging = IsCurrentlyDodging() || IsInCombatAction() && ((int)GetBehaviorVariable( 'combatActionType' ) == CAT_Dodge || (int)GetBehaviorVariable( 'combatActionType' ) == CAT_Roll);
  2170.  
  2171. //modSigns: debug
  2172. if( FactsQuerySum( "modSigns_debug_reduce_damage" ) > 0 )
  2173. {
  2174. theGame.witcherLog.AddMessage("Is in combat action: " + (int)IsInCombatAction());
  2175. theGame.witcherLog.AddMessage("Player action: " + GetBehaviorVariable( 'combatActionType' ));
  2176. theGame.witcherLog.AddMessage("Player is dodging: " + isDodging);
  2177. }
  2178.  
  2179. if(actorAttacker && isDodging && !(damageData.IsActionEnvironment() || damageData.IsDoTDamage()))
  2180. {
  2181. attackName = actorAttacker.GetLastAttackRangeName();
  2182. angleDist = AbsF(AngleDistance(evadeHeading, actorAttacker.GetHeading()));
  2183. attackRange = theGame.GetAttackRangeForEntity(actorAttacker, attackName);
  2184. distToAttacker = VecDistance(this.GetWorldPosition(), damageData.attacker.GetWorldPosition());
  2185. isIceGiantSpecial = ( attackName == 'stomp' || attackName == 'anchor_special_far' || attackName == 'anchor_far' );
  2186. //Fleet Footed graze damage reduction
  2187. if( CanUseSkill(S_Sword_s09) )
  2188. damageReduction = CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s09, 's9_damage_reduction', false, true)) * GetSkillLevel(S_Sword_s09);
  2189. else
  2190. damageReduction = 0;
  2191. //attack can be dodged
  2192. if( damageData.CanBeDodged() )
  2193. {
  2194. //set up safe angle distance
  2195. safeAngleDist = 120;
  2196. if( HasAbility('ArmorTypeLightSetBonusAbility') )
  2197. safeAngleDist += CalculateAttributeValue(GetAbilityAttributeValue('ArmorTypeLightSetBonusAbility', 'dodge_safe_ange_dist_deg'));
  2198. safeAngleDist = ClampF( safeAngleDist, 0, 180 );
  2199. //check dodge success
  2200. if( angleDist <= safeAngleDist && !isIceGiantSpecial || isIceGiantSpecial && distToAttacker > attackRange.rangeMax * 0.75 )
  2201. {
  2202. if( theGame.CanLog() )
  2203. {
  2204. LogDMHits("W3PlayerWitcher.DodgeDamage: Attack dodged by player - no damage done", damageData);
  2205. }
  2206. damageData.SetWasDodged();
  2207. }
  2208. }
  2209. //graze damage reduction
  2210. if( !damageData.WasDodged() && damageReduction > 0 )
  2211. {
  2212. if( theGame.CanLog() )
  2213. {
  2214. LogDMHits("W3PlayerWitcher.DodgeDamage: reduced damage while dodging an attack", damageData );
  2215. }
  2216. damageData.SetGrazeDamageReduction(damageReduction);
  2217. }
  2218. //modSigns: debug
  2219. if( FactsQuerySum( "modSigns_debug_reduce_damage" ) > 0 )
  2220. {
  2221. theGame.witcherLog.AddMessage("Fleet Footed damage reduction: " + damageReduction);
  2222. theGame.witcherLog.AddMessage("Attack name: " + attackName);
  2223. theGame.witcherLog.AddMessage("Attack can be dodged: " + damageData.CanBeDodged());
  2224. theGame.witcherLog.AddMessage("Safe angle distance: " + safeAngleDist);
  2225. theGame.witcherLog.AddMessage("Attacker and evade angle distance: " + angleDist);
  2226. theGame.witcherLog.AddMessage("Attack range: " + attackRange.rangeMax);
  2227. theGame.witcherLog.AddMessage("Distance to attacker: " + distToAttacker);
  2228. theGame.witcherLog.AddMessage("Damage was dodged completely: " + damageData.WasDodged());
  2229. }
  2230. }
  2231. }
  2232.  
  2233. //modSigns: rewritten
  2234. function ReduceDamage(out damageData : W3DamageAction)
  2235. {
  2236. var quen : W3QuenEntity;
  2237. var min, max : SAbilityAttributeValue;
  2238. var /*currAdrenaline, adrenReducedDmg, focus,*/ chance : float;
  2239. var whirlDmgReduction : SAbilityAttributeValue;
  2240.  
  2241. super.ReduceDamage(damageData);
  2242.  
  2243. //new mutagen27 effect: prevent chain damage
  2244. if(HasBuff(EET_Mutagen27) && !(damageData.IsActionEnvironment() || damageData.IsDoTDamage()))
  2245. {
  2246. ((W3Mutagen27_Effect)GetBuff(EET_Mutagen27)).ReduceDamage(damageData);
  2247. }
  2248.  
  2249. //damage prevented
  2250. if(!damageData.DealsAnyDamage())
  2251. return;
  2252.  
  2253. //modSigns: dodge detection moved to separate function!
  2254. //reduce damage from dodging, if was partially dodged
  2255. if(damageData.IsGrazeDamage())
  2256. {
  2257. damageData.processedDmg.vitalityDamage *= ClampF( 1 - damageData.GetGrazeDamageReduction(), 0.05, 1 );
  2258. //modSigns: debug
  2259. if( FactsQuerySum( "modSigns_debug_reduce_damage" ) > 0 )
  2260. {
  2261. theGame.witcherLog.AddMessage("Is graze damage: " + damageData.IsGrazeDamage());
  2262. theGame.witcherLog.AddMessage("Graze damage reduction: " + damageData.GetGrazeDamageReduction());
  2263. }
  2264. }
  2265.  
  2266. quen = (W3QuenEntity)signs[ST_Quen].entity;
  2267.  
  2268. //Protective Coating damage reduction
  2269. if( !damageData.IsDoTDamage() && CanUseSkill(S_Alchemy_s05) )
  2270. {
  2271. damageData.processedDmg.vitalityDamage *= ClampF(1 - GetOilProtectionAgainstMonster(damageData), 0.f, 1.f);
  2272. //modSigns: debug
  2273. if( FactsQuerySum( "modSigns_debug_reduce_damage" ) > 0 )
  2274. {
  2275. theGame.witcherLog.AddMessage("Oil protection against monster: " + GetOilProtectionAgainstMonster(damageData));
  2276. }
  2277. }
  2278.  
  2279. //Mutated Skin passive ability -> changed
  2280. //if( IsMutationActive( EPMT_Mutation5 ) && !IsAnyQuenActive() && !damageData.IsDoTDamage() )
  2281. //{
  2282. // focus = GetStat( BCS_Focus );
  2283. // currAdrenaline = FloorF( focus );
  2284. // if( currAdrenaline >= 1 )
  2285. // {
  2286. // theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation5', 'mut5_dmg_red_perc', min, max );
  2287. // adrenReducedDmg = ( currAdrenaline * min.valueAdditive );
  2288. // damageData.processedDmg.vitalityDamage *= ClampF(1 - adrenReducedDmg, 0, 1);
  2289. //
  2290. //
  2291. // theGame.MutationHUDFeedback( MFT_PlayOnce );
  2292. //
  2293. // if( focus >= 3.f )
  2294. // {
  2295. // PlayEffect( 'mutation_5_stage_03' );
  2296. // }
  2297. // else if( focus >= 2.f )
  2298. // {
  2299. // PlayEffect( 'mutation_5_stage_02' );
  2300. // }
  2301. // else
  2302. // {
  2303. // PlayEffect( 'mutation_5_stage_01' );
  2304. // }
  2305. // }
  2306. //}
  2307.  
  2308. //modSigns: whirl incoming damage reduction
  2309. if( !damageData.IsDoTDamage() && GetStat(BCS_Focus) >= 1 && IsDoingSpecialAttack(false) )
  2310. {
  2311. whirlDmgReduction = GetSkillAttributeValue(S_Sword_s01, 'whirl_dmg_reduction', false, true)
  2312. + GetSkillAttributeValue(S_Sword_s01, 'whirl_dmg_reduction_bonus_after_1', false, true) * (GetSkillLevel(S_Sword_s01) - 1);
  2313. damageData.processedDmg.vitalityDamage *= ClampF(1 - whirlDmgReduction.valueMultiplicative, 0.f, 1.f);
  2314. DrainFocus(1);
  2315. PauseFocusGain( true );
  2316. AddTimer( 'ResumeFocusGain', 1.f );
  2317. //theGame.witcherLog.AddMessage("Whirl damage reduction."); //modSigns: debug
  2318. }
  2319.  
  2320. //modSigns: cast quen on projectile ability, moved here
  2321. if((!quen || !quen.IsAnyQuenActive()) && damageData.IsActionRanged() && !damageData.IsActionWitcherSign() && !damageData.IsDoTDamage() && !damageData.WasDodged())
  2322. {
  2323. chance = CalculateAttributeValue(GetAttributeValue('quen_chance_on_projectile'));
  2324. if(chance > 0)
  2325. {
  2326. chance = ClampF(chance, 0, 1);
  2327.  
  2328. if(RandF() < chance)
  2329. {
  2330. if(!quen)
  2331. {
  2332. quen = (W3QuenEntity)theGame.CreateEntity(signs[ST_Quen].template, GetWorldPosition(), GetWorldRotation() );
  2333. }
  2334. quen.Init(signOwner, signs[ST_Quen].entity, true );
  2335. quen.freeCast = true;
  2336. quen.OnStarted();
  2337. quen.OnThrowing();
  2338. quen.OnEnded();
  2339. if ( theGame.CanLog() )
  2340. {
  2341. LogDMHits("W3PlayerWitcher.ReduceDamage: Processing Quen On Projectile armor ability...", damageData);
  2342. }
  2343. //quen.OnTargetHit( damageData );
  2344. quen.ShowHitFX(); //modSigns: play FX
  2345. damageData.SetAllProcessedDamageAs(0);
  2346. damageData.SetEndsQuen(true);
  2347. }
  2348. }
  2349. }
  2350. //damage reduction from signs
  2351. //else if((quen && quen.IsAnyQuenActive()) && damageData.GetBuffSourceName() != "FallingDamage")
  2352. //{
  2353. // if ( theGame.CanLog() )
  2354. // {
  2355. // LogDMHits("W3PlayerWitcher.ReduceDamage: Processing Quen sign damage reduction...", damageData);
  2356. // }
  2357. // quen.OnTargetHit( damageData );
  2358. //} //modSigns: moved to damage manager to decrease raw damage
  2359.  
  2360. //modSigns: gryphon set tier 2 damage reduction - removed, adds resistances instead
  2361. /*if( HasBuff( EET_GryphonSetBonusYrden ) )
  2362. {
  2363. min = GetAttributeValue( 'gryphon_set_bns_dmg_reduction' );
  2364. damageData.processedDmg.vitalityDamage *= ClampF(1 - min.valueAdditive, 0, 1);
  2365. }*/
  2366.  
  2367.  
  2368. //if you need to copy-paste a part of a parent function
  2369. //and do some shitty dancing around a part of the code,
  2370. //this probably means that the code doesn't belong here
  2371. //and should be placed somewhere else instead... yeah?
  2372. //if(!damageData.GetIgnoreImmortalityMode())
  2373. //{
  2374. // if(!((W3PlayerWitcher)this))
  2375. // Log("");
  2376. //
  2377. //
  2378. // if( IsInvulnerable() )
  2379. // {
  2380. // if ( theGame.CanLog() )
  2381. // {
  2382. // LogDMHits("CActor.ReduceDamage: victim Invulnerable - no damage will be dealt", damageData );
  2383. // }
  2384. // damageData.SetAllProcessedDamageAs(0);
  2385. // return;
  2386. // }
  2387. //
  2388. // if(actorAttacker && damageData.DealsAnyDamage() )
  2389. // actorAttacker.SignalGameplayEventParamObject( 'DamageInstigated', damageData );
  2390. //
  2391. //
  2392. // if( IsImmortal() )
  2393. // {
  2394. // if ( theGame.CanLog() )
  2395. // {
  2396. // LogDMHits("CActor.ReduceDamage: victim is Immortal, clamping damage", damageData );
  2397. // }
  2398. // damageData.processedDmg.vitalityDamage = ClampF(damageData.processedDmg.vitalityDamage, 0, GetStat(BCS_Vitality)-1 );
  2399. // damageData.processedDmg.essenceDamage = ClampF(damageData.processedDmg.essenceDamage, 0, GetStat(BCS_Essence)-1 );
  2400. // return;
  2401. // }
  2402. //}
  2403. //else
  2404. //{
  2405. //
  2406. // if(actorAttacker && damageData.DealsAnyDamage() )
  2407. // actorAttacker.SignalGameplayEventParamObject( 'DamageInstigated', damageData );
  2408. //}
  2409. }
  2410.  
  2411. //modSigns
  2412. private function GetOilProtectionAgainstMonster(damageData : W3DamageAction) : float
  2413. {
  2414. var i : int;
  2415. var heldWeapons : array< SItemUniqueId >;
  2416. var weapon : SItemUniqueId;
  2417. var resist : float;
  2418. var attackerMonsterCategory : EMonsterCategory;
  2419. var tmpName : name;
  2420. var tmpBool : bool;
  2421.  
  2422. if( !((CActor)damageData.attacker) )
  2423. return 0;
  2424.  
  2425. resist = 0;
  2426. heldWeapons = inv.GetHeldWeapons();
  2427.  
  2428. for( i = 0; i < heldWeapons.Size(); i += 1 )
  2429. {
  2430. if( !inv.IsItemFists( heldWeapons[ i ] ) )
  2431. {
  2432. weapon = heldWeapons[ i ];
  2433. break;
  2434. }
  2435. }
  2436.  
  2437. if( !inv.IsIdValid( weapon ) )
  2438. return 0;
  2439.  
  2440. theGame.GetMonsterParamsForActor((CActor)damageData.attacker, attackerMonsterCategory, tmpName, tmpBool, tmpBool, tmpBool);
  2441.  
  2442. resist = inv.GetOilProtectionAgainstMonster(weapon, attackerMonsterCategory);
  2443.  
  2444. return resist;
  2445. }
  2446.  
  2447. /*timer function UndyingSkillCooldown(dt : float, id : int)
  2448. {
  2449. cannotUseUndyingSkill = false;
  2450. }*/
  2451.  
  2452. //modSigns
  2453. public function CastFreeQuen()
  2454. {
  2455. var quen : W3QuenEntity;
  2456.  
  2457. quen = (W3QuenEntity)signs[ST_Quen].entity;
  2458.  
  2459. if(!quen)
  2460. quen = (W3QuenEntity)theGame.CreateEntity(signs[ST_Quen].template, GetWorldPosition(), GetWorldRotation());
  2461.  
  2462. PlayEffect( 'quen_lasting_shield_back' ); //make use of vanilla bear set effect
  2463.  
  2464. quen.Init(signOwner, signs[ST_Quen].entity, true);
  2465. quen.freeCast = true;
  2466. quen.OnStarted();
  2467. quen.OnThrowing();
  2468. quen.OnEnded();
  2469. }
  2470.  
  2471. event OnTakeDamage( action : W3DamageAction)
  2472. {
  2473. var currVitality, rgnVitality, hpTriggerTreshold : float;
  2474. //var healingFactor : float;
  2475. var abilityName : name;
  2476. var abilityCount, maxStack, itemDurability : float;
  2477. var addAbility : bool;
  2478. var min, max : SAbilityAttributeValue;
  2479. //var mutagenQuen : W3SignEntity; //modSigns
  2480. var equipped : array<SItemUniqueId>;
  2481. var i : int;
  2482. var killSourceName : string;
  2483. var aerondight : W3Effect_Aerondight;
  2484. var phantomWeapon : W3Effect_PhantomWeapon; //modSigns
  2485. //var quen : W3QuenEntity; //modSigns
  2486. var mutation5CustomEffect : SCustomEffectParams; //modSigns
  2487.  
  2488. currVitality = GetStat(BCS_Vitality);
  2489. killSourceName = action.GetBuffSourceName();
  2490.  
  2491.  
  2492. if(action.processedDmg.vitalityDamage >= currVitality)
  2493. {
  2494. //killSourceName = action.GetBuffSourceName();
  2495.  
  2496.  
  2497. if( killSourceName != "Quest" && killSourceName != "Kill Trigger" && killSourceName != "Trap" && killSourceName != "FallingDamage" )
  2498. {
  2499. //modSigns: Second Life mutation will now have priority over Undying skill -> mutation changed
  2500. /*if( IsMutationActive( EPMT_Mutation11 ) && !HasBuff( EET_Mutation11Debuff ) && !IsInAir() )
  2501. {
  2502. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation11', 'health_prc', min, max );
  2503.  
  2504. action.SetAllProcessedDamageAs( 0 );
  2505.  
  2506. OnMutation11Triggered();
  2507. }
  2508. else*/ if(/*!cannotUseUndyingSkill*/ !HasBuff( EET_UndyingSkillImmortal ) && !HasBuff( EET_UndyingSkillCooldown ) && GetStat(BCS_Focus) >= 1 && CanUseSkill(S_Sword_s18) /*&& HasBuff(EET_BattleTrance)*/ )
  2509. {
  2510. //healingFactor = CalculateAttributeValue( GetSkillAttributeValue(S_Sword_s18, 'healing_factor', false, true) );
  2511. //healingFactor *= GetStatMax(BCS_Vitality);
  2512. //healingFactor *= GetStat(BCS_Focus);
  2513. //healingFactor *= 1 + CalculateAttributeValue( GetSkillAttributeValue(S_Sword_s18, 'healing_bonus', false, true) ) * (GetSkillLevel(S_Sword_s18) - 1);
  2514. action.SetAllProcessedDamageAs( 0 ); //modSigns
  2515. ForceSetStat(BCS_Vitality, 1); //modSigns: heal 1 point of damage
  2516. //DrainFocus(GetStat(BCS_Focus));
  2517. //RemoveBuff(EET_BattleTrance);
  2518. //cannotUseUndyingSkill = true;
  2519. AddEffectDefault( EET_UndyingSkillImmortal, NULL, "UndyingSkill" ); //modSigns: brief immortality
  2520. //AddTimer('UndyingSkillCooldown', CalculateAttributeValue( GetSkillAttributeValue(S_Sword_s18, 'trigger_delay', false, true) ), false, , , true);
  2521. }
  2522. else
  2523. {
  2524.  
  2525. equipped = GetEquippedItems();
  2526.  
  2527. for(i=0; i<equipped.Size(); i+=1)
  2528. {
  2529. if ( !inv.IsIdValid( equipped[i] ) )
  2530. {
  2531. continue;
  2532. }
  2533. itemDurability = inv.GetItemDurability(equipped[i]);
  2534. if(inv.ItemHasAbility(equipped[i], 'MA_Reinforced') && itemDurability > 0)
  2535. {
  2536.  
  2537. inv.SetItemDurabilityScript(equipped[i], MaxF(0, itemDurability - action.processedDmg.vitalityDamage) );
  2538.  
  2539.  
  2540. action.processedDmg.vitalityDamage = 0;
  2541. ForceSetStat(BCS_Vitality, 1);
  2542.  
  2543. break;
  2544. }
  2545. }
  2546. }
  2547. }
  2548. }
  2549.  
  2550. //modSigns: new Mutated Skin ability
  2551. if(IsMutationActive(EPMT_Mutation5) && !action.IsDoTDamage() && action.processedDmg.vitalityDamage > 0.0 && GetStat(BCS_Focus) >= 1.0)
  2552. {
  2553. if(action.processedDmg.vitalityDamage < currVitality || killSourceName != "Quest" && killSourceName != "Kill Trigger" && killSourceName != "Trap" && killSourceName != "FallingDamage")
  2554. {
  2555. theGame.GetDefinitionsManager().GetAbilityAttributeValue('Mutation5', 'mut5_duration_per_point', min, max);
  2556. //custom effect params
  2557. mutation5CustomEffect.effectType = EET_Mutation5;
  2558. mutation5CustomEffect.creator = this;
  2559. mutation5CustomEffect.sourceName = "mutation5";
  2560. mutation5CustomEffect.duration = min.valueAdditive * GetStat(BCS_Focus);
  2561. mutation5CustomEffect.effectValue.valueAdditive = action.processedDmg.vitalityDamage / mutation5CustomEffect.duration;
  2562. AddEffectCustom(mutation5CustomEffect);
  2563. //the damage is considered to be dealt by the rest of the code (for the swords,
  2564. //mutagens, etc to work as usual), but DrainVitality is actually omitted
  2565. action.SetMutation5Triggered();
  2566. }
  2567. }
  2568.  
  2569.  
  2570. //if(action.DealsAnyDamage() && !((W3Effect_Toxicity)action.causer) )
  2571. //{
  2572. // //if(HasBuff(EET_Mutagen10))
  2573. // // RemoveAbilityAll( GetBuff(EET_Mutagen10).GetAbilityName() ); //modSigns: changed
  2574. //
  2575. // //if(HasBuff(EET_Mutagen15))
  2576. // // RemoveAbilityAll( GetBuff(EET_Mutagen15).GetAbilityName() ); //modSigns: changed
  2577. //}
  2578.  
  2579.  
  2580. /*quen = (W3QuenEntity)signs[ST_Quen].entity; //modSigns
  2581. if(HasBuff(EET_Mutagen19) && (!quen || !quen.IsAnyQuenActive())) //modSigns
  2582. {
  2583. theGame.GetDefinitionsManager().GetAbilityAttributeValue(GetBuff(EET_Mutagen19).GetAbilityName(), 'max_hp_perc_trigger', min, max);
  2584. hpTriggerTreshold = GetStatMax(BCS_Vitality) * CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  2585.  
  2586. //theGame.witcherLog.AddMessage( "hpTriggerTreshold = " + hpTriggerTreshold );
  2587. //theGame.witcherLog.AddMessage( "damage = " + action.GetDamageDealt() );
  2588.  
  2589. if(action.GetDamageDealt() >= hpTriggerTreshold)
  2590. {
  2591. if(!quen) //modSigns
  2592. {
  2593. quen = (W3QuenEntity)theGame.CreateEntity( signs[ST_Quen].template, GetWorldPosition(), GetWorldRotation() );
  2594. }
  2595. quen.Init( signOwner, signs[ST_Quen].entity, true );
  2596. quen.freeCast = true; //modSigns
  2597. quen.OnStarted();
  2598. quen.OnThrowing();
  2599. quen.OnEnded();
  2600. }
  2601. }*/ //modSigns: reworked
  2602.  
  2603.  
  2604. /*if(action.DealsAnyDamage() && !action.IsDoTDamage() && HasBuff(EET_Mutagen27))
  2605. {
  2606. abilityName = GetBuff(EET_Mutagen27).GetAbilityName();
  2607. abilityCount = GetAbilityCount(abilityName);
  2608.  
  2609. if(abilityCount == 0)
  2610. {
  2611. addAbility = true;
  2612. }
  2613. else
  2614. {
  2615. theGame.GetDefinitionsManager().GetAbilityAttributeValue(abilityName, 'mutagen27_max_stack', min, max);
  2616. maxStack = CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  2617.  
  2618. if(maxStack >= 0)
  2619. {
  2620. addAbility = (abilityCount < maxStack);
  2621. }
  2622. else
  2623. {
  2624. addAbility = true;
  2625. }
  2626. }
  2627.  
  2628. if(addAbility)
  2629. {
  2630. AddAbility(abilityName, true);
  2631. }
  2632. }*/ //modSigns: reworked
  2633.  
  2634. if(HasBuff(EET_Trap) && !action.IsDoTDamage() && action.attacker.HasAbility( 'mon_dettlaff_monster_base' ))
  2635. {
  2636. action.AddEffectInfo(EET_Knockdown);
  2637. RemoveBuff(EET_Trap, true);
  2638. }
  2639.  
  2640. super.OnTakeDamage(action);
  2641.  
  2642.  
  2643. //modSigns: Aerondight and Iris
  2644. if( !action.WasDodged() && action.DealtDamage() && !action.IsDoTDamage() && !( (W3Effect_Toxicity) action.causer ) )
  2645. {
  2646. if( inv.ItemHasTag( inv.GetCurrentlyHeldSword(), 'Aerondight' ) )
  2647. {
  2648. aerondight = (W3Effect_Aerondight)GetBuff( EET_Aerondight );
  2649. if( aerondight /*&& aerondight.GetCurrentCount() != 0*/ )
  2650. {
  2651. //aerondight.ReduceAerondightStacks();
  2652. //modSigns: now resets on damage taken
  2653. aerondight.ResetCharges();
  2654. }
  2655. }
  2656. if( inv.ItemHasTag( inv.GetCurrentlyHeldSword(), 'PhantomWeapon' ) )
  2657. {
  2658. phantomWeapon = (W3Effect_PhantomWeapon)GetBuff( EET_PhantomWeapon );
  2659. if( phantomWeapon )
  2660. phantomWeapon.ResetCharges();
  2661. }
  2662. }
  2663.  
  2664. //if( !action.WasDodged() && action.DealtDamage() && !( (W3Effect_Toxicity) action.causer ) )
  2665. //{
  2666. // RemoveBuff( EET_Mutation3 );
  2667. //} //modSigns: reworked
  2668.  
  2669.  
  2670. //modSigns: new mutation3 (Bloodbath effect)
  2671. if(HasBuff(EET_Mutation3))
  2672. ((W3Effect_Mutation3)GetBuff(EET_Mutation3)).ManageMutation3Bonus(action);
  2673. //modSigns: new Mutagen02 effect
  2674. if(HasBuff(EET_Mutagen02) && !action.WasDodged() && action.DealtDamage() && action.IsActionMelee())
  2675. ((W3Mutagen02_Effect)GetBuff(EET_Mutagen02)).AddDebuffToEnemy((CActor)action.attacker);
  2676. //modSigns: new mutagen05 effect
  2677. if(HasBuff(EET_Mutagen05))
  2678. ((W3Mutagen05_Effect)GetBuff(EET_Mutagen05)).ManageMutagen05Bonus(action);
  2679. //modSigns: new mutagen15 effect
  2680. if(HasBuff(EET_Mutagen15))
  2681. ((W3Mutagen15_Effect)GetBuff(EET_Mutagen15)).ManageMutagen15Bonus(action);
  2682. //modSigns: new mutagen22 effect
  2683. if(HasBuff(EET_Mutagen22))
  2684. ((W3Mutagen22_Effect)GetBuff(EET_Mutagen22)).RemoveMutagen22Abilities(action);
  2685. //modSigns: new Mutagen27 effect
  2686. if(HasBuff(EET_Mutagen27) && !action.WasDodged() && action.DealtDamage() && !(action.IsActionEnvironment() || action.IsDoTDamage()))
  2687. ((W3Mutagen27_Effect)GetBuff(EET_Mutagen27)).AccumulateHits();
  2688. }
  2689.  
  2690.  
  2691.  
  2692.  
  2693.  
  2694.  
  2695.  
  2696. event OnStartFistfightMinigame()
  2697. {
  2698. var i : int;
  2699. var buffs : array< CBaseGameplayEffect >;
  2700.  
  2701.  
  2702. effectManager.RemoveAllPotionEffects();
  2703.  
  2704. abilityManager.DrainToxicity(GetStatMax( BCS_Toxicity ));
  2705.  
  2706. buffs = GetBuffs( EET_WellFed );
  2707. for( i=buffs.Size()-1; i>=0; i-=1 )
  2708. {
  2709. RemoveEffect( buffs[i] );
  2710. }
  2711.  
  2712.  
  2713. buffs.Clear();
  2714. buffs = GetBuffs( EET_WellHydrated );
  2715. for( i=buffs.Size()-1; i>=0; i-=1 )
  2716. {
  2717. RemoveEffect( buffs[i] );
  2718. }
  2719.  
  2720. super.OnStartFistfightMinigame();
  2721. }
  2722.  
  2723. event OnEndFistfightMinigame()
  2724. {
  2725. super.OnEndFistfightMinigame();
  2726. }
  2727.  
  2728.  
  2729. public function GetCriticalHitChance( isLightAttack : bool, isHeavyAttack : bool, target : CActor, victimMonsterCategory : EMonsterCategory, isBolt : bool ) : float
  2730. {
  2731. var ret : float;
  2732. var thunder : W3Potion_Thunderbolt;
  2733. var min, max : SAbilityAttributeValue;
  2734.  
  2735. ret = super.GetCriticalHitChance( isLightAttack, isHeavyAttack, target, victimMonsterCategory, isBolt );
  2736.  
  2737.  
  2738.  
  2739.  
  2740.  
  2741.  
  2742.  
  2743. thunder = ( W3Potion_Thunderbolt )GetBuff( EET_Thunderbolt );
  2744. if( thunder && thunder.GetBuffLevel() == 3 && GetCurWeather() == EWE_Storm )
  2745. {
  2746. ret += 1.0f;
  2747. }
  2748.  
  2749.  
  2750. if( isBolt && IsMutationActive( EPMT_Mutation9 ) )
  2751. {
  2752. theGame.GetDefinitionsManager().GetAbilityAttributeValue('Mutation9', 'critical_hit_chance', min, max);
  2753. ret += min.valueMultiplicative;
  2754. }
  2755.  
  2756.  
  2757. if( isBolt && CanUseSkill( S_Sword_s07 ) )
  2758. {
  2759. ret += CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s07, theGame.params.CRITICAL_HIT_CHANCE, false, true)) * GetSkillLevel(S_Sword_s07);
  2760. }
  2761.  
  2762. return ret;
  2763. }
  2764.  
  2765.  
  2766. public function GetCriticalHitDamageBonus(weaponId : SItemUniqueId, victimMonsterCategory : EMonsterCategory, isStrikeAtBack : bool) : SAbilityAttributeValue
  2767. {
  2768. var min, max, bonus, null, oilBonus : SAbilityAttributeValue;
  2769. var mutagen : CBaseGameplayEffect;
  2770. var monsterBonusType : name;
  2771.  
  2772. bonus = super.GetCriticalHitDamageBonus(weaponId, victimMonsterCategory, isStrikeAtBack);
  2773.  
  2774. if( inv.ItemHasActiveOilApplied( weaponId, victimMonsterCategory ) && GetStat( BCS_Focus ) >= 3 && CanUseSkill( S_Alchemy_s07 ) )
  2775. {
  2776. monsterBonusType = MonsterCategoryToAttackPowerBonus( victimMonsterCategory );
  2777. oilBonus = inv.GetItemAttributeValue( weaponId, monsterBonusType );
  2778. if(oilBonus != null)
  2779. {
  2780. //bonus += GetSkillAttributeValue(S_Alchemy_s07, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, true);
  2781. //modSigns: fix crit bonus
  2782. bonus += GetSkillAttributeValue(S_Alchemy_s07, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, false) * GetSkillLevel(S_Alchemy_s07);
  2783. }
  2784. //combat log
  2785. //theGame.witcherLog.AddCombatMessage("Crit dmg bonus: " + FloatToString(bonus.valueAdditive), thePlayer, NULL);
  2786. }
  2787.  
  2788. // Mutagen 11 - back strike bonus
  2789. if (isStrikeAtBack && HasBuff(EET_Mutagen11))
  2790. {
  2791. mutagen = GetBuff(EET_Mutagen11);
  2792. theGame.GetDefinitionsManager().GetAbilityAttributeValue(mutagen.GetAbilityName(), 'damageIncrease', min, max);
  2793. bonus += GetAttributeRandomizedValue(min, max);
  2794. }
  2795.  
  2796. return bonus;
  2797. }
  2798.  
  2799. public function ProcessLockTarget( optional newLockTarget : CActor, optional checkLeftStickHeading : bool ) : bool
  2800. {
  2801. var newLockTargetFound : bool;
  2802.  
  2803. newLockTargetFound = super.ProcessLockTarget(newLockTarget, checkLeftStickHeading);
  2804.  
  2805. if(GetCurrentlyCastSign() == ST_Axii)
  2806. {
  2807. ((W3AxiiEntity)GetCurrentSignEntity()).OnDisplayTargetChange(newLockTarget);
  2808. }
  2809.  
  2810. return newLockTargetFound;
  2811. }
  2812.  
  2813.  
  2814.  
  2815.  
  2816.  
  2817.  
  2818.  
  2819. event OnProcessActionPost(action : W3DamageAction)
  2820. {
  2821. var attackAction : W3Action_Attack;
  2822. var rendLoad, focusVal, stamCost, rendTimeRatio : float; //modSigns
  2823. var value : SAbilityAttributeValue;
  2824. var actorVictim : CActor;
  2825. var weaponId : SItemUniqueId;
  2826. var usesSteel, usesSilver, usesVitality, usesEssence : bool;
  2827. var abs : array<name>;
  2828. var i : int;
  2829. var dm : CDefinitionsManagerAccessor;
  2830. var items : array<SItemUniqueId>;
  2831. var weaponEnt : CEntity;
  2832. var lynxSetBuff : W3Effect_LynxSetBonus;
  2833. var min, max, nullBonus, oilBonus : SAbilityAttributeValue; //modSigns
  2834. var victimMonsterCategory : EMonsterCategory; //modSigns
  2835. var monsterBonusType : name; //modSigns
  2836. var tmpName : name; //modSigns
  2837. var tmpBool : bool; //modSigns
  2838.  
  2839. super.OnProcessActionPost(action);
  2840.  
  2841. attackAction = (W3Action_Attack)action;
  2842. actorVictim = (CActor)action.victim;
  2843.  
  2844. if(attackAction)
  2845. {
  2846. if(attackAction.IsActionMelee())
  2847. {
  2848.  
  2849. if(SkillNameToEnum(attackAction.GetAttackTypeName()) == S_Sword_s02)
  2850. {
  2851. //rendLoad = GetSpecialAttackTimeRatio();
  2852.  
  2853.  
  2854. //rendLoad = MinF(rendLoad * GetStatMax(BCS_Focus), GetStat(BCS_Focus));
  2855.  
  2856.  
  2857. //rendLoad = FloorF(rendLoad);
  2858.  
  2859. //modSigns
  2860. RendAoE(attackAction);
  2861.  
  2862. rendTimeRatio = GetSpecialAttackTimeRatio(); //save for bear tier 2
  2863.  
  2864. rendLoad = GetStat(BCS_Focus);
  2865.  
  2866. DrainFocus(rendLoad);
  2867.  
  2868. OnSpecialAttackHeavyActionProcess();
  2869. }
  2870. else if(actorVictim && IsRequiredAttitudeBetween(this, actorVictim, true)
  2871. && attackAction.DealsAnyDamage() && !attackAction.WasDodged() && !attackAction.IsParried() && !attackAction.IsCountered()) //modSigns: only gain adrenaline for actual damage dealt
  2872. {
  2873.  
  2874.  
  2875. value = GetAttributeValue('focus_gain');
  2876.  
  2877. if( FactsQuerySum("debug_fact_focus_boy") > 0 )
  2878. {
  2879. Debug_FocusBoyFocusGain();
  2880. }
  2881.  
  2882.  
  2883. if ( CanUseSkill(S_Sword_s20) )
  2884. {
  2885. value += GetSkillAttributeValue(S_Sword_s20, 'focus_gain', false, true) * GetSkillLevel(S_Sword_s20);
  2886. }
  2887.  
  2888. //modSigns
  2889. if( CanUseSkill(S_Sword_s21) && attackAction && attackAction.IsActionMelee() &&
  2890. IsLightAttack(attackAction.GetAttackName()) && !inv.IsItemFists(attackAction.GetWeaponId()) )
  2891. {
  2892. value += GetSkillAttributeValue(S_Sword_s21, 'light_focus_gain', false, true) * GetSkillLevel(S_Sword_s21);
  2893. }
  2894. if( CanUseSkill(S_Sword_s04) && attackAction && attackAction.IsActionMelee() &&
  2895. IsHeavyAttack(attackAction.GetAttackName()) && !inv.IsItemFists(attackAction.GetWeaponId()) )
  2896. {
  2897. value += GetSkillAttributeValue(S_Sword_s04, 'heavy_focus_gain', false, true) * GetSkillLevel(S_Sword_s04);
  2898. }
  2899.  
  2900. //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() )
  2901. //{
  2902. // AddEffectDefault( EET_Mutation3, this, "", false );
  2903. //} //modSigns: reworked
  2904.  
  2905. focusVal = 0.1f * (1 + CalculateAttributeValue(value));
  2906.  
  2907. if(!inv.IsItemFists(attackAction.GetWeaponId()))
  2908. {
  2909. //modSigns: lynx set tier 2 bonus - doubled adrenaline gain for critical hits
  2910. if( attackAction.IsCriticalHit() && IsSetBonusActive( EISB_Lynx_2 ) )
  2911. {
  2912. focusVal *= 2;
  2913. }
  2914.  
  2915. //modSigns: additional adrenaline for bear school perk
  2916. focusVal += CalculateAttributeValue(GetAttributeValue('bonus_focus_gain'));
  2917. }
  2918.  
  2919. //modSigns: new mutation7 (Adrenaline Rush)
  2920. //theGame.witcherLog.AddMessage("focus before adjustments: " + focusVal);
  2921. if(HasBuff(EET_Mutation7Buff))
  2922. focusVal *= 2;
  2923. else if(HasBuff(EET_Mutation7Debuff))
  2924. focusVal /= 2;
  2925.  
  2926. //theGame.witcherLog.AddMessage("focus gained: " + focusVal);
  2927.  
  2928. GainStat(BCS_Focus, focusVal);
  2929. }
  2930.  
  2931. //modSigns: bear tier 2 stamina restore
  2932. if(IsSetBonusActive(EISB_Bear_2) && attackAction.DealsAnyDamage() && !attackAction.WasDodged() && !attackAction.IsParried() && !attackAction.IsCountered())
  2933. {
  2934. if(SkillNameToEnum(attackAction.GetAttackTypeName()) == S_Sword_s02)
  2935. stamCost = rendTimeRatio * GetStatMax(BCS_Stamina);
  2936. else if(IsHeavyAttack(attackAction.GetAttackName()))
  2937. stamCost = GetStaminaActionCost(ESAT_HeavyAttack);
  2938. if(stamCost > 0)
  2939. {
  2940. theGame.GetDefinitionsManager().GetAbilityAttributeValue(GetSetBonusAbility(EISB_Bear_2), 'stamina_attack', min, max);
  2941. GainStat(BCS_Stamina, stamCost * min.valueAdditive);
  2942. //theGame.witcherLog.AddMessage("stamina gain: " + (stamCost * min.valueAdditive));
  2943. }
  2944. }
  2945.  
  2946. weaponId = attackAction.GetWeaponId();
  2947. if(actorVictim && (ShouldProcessTutorial('TutorialWrongSwordSteel') || ShouldProcessTutorial('TutorialWrongSwordSilver')) && GetAttitudeBetween(actorVictim, this) == AIA_Hostile)
  2948. {
  2949. usesSteel = inv.IsItemSteelSwordUsableByPlayer(weaponId);
  2950. usesSilver = inv.IsItemSilverSwordUsableByPlayer(weaponId);
  2951. usesVitality = actorVictim.UsesVitality();
  2952. usesEssence = actorVictim.UsesEssence();
  2953.  
  2954. if(usesSilver && usesVitality)
  2955. {
  2956. FactsAdd('tut_wrong_sword_silver',1);
  2957. }
  2958. else if(usesSteel && usesEssence)
  2959. {
  2960. FactsAdd('tut_wrong_sword_steel',1);
  2961. }
  2962. else if(FactsQuerySum('tut_wrong_sword_steel') && usesSilver && usesEssence)
  2963. {
  2964. FactsAdd('tut_proper_sword_silver',1);
  2965. FactsRemove('tut_wrong_sword_steel');
  2966. }
  2967. else if(FactsQuerySum('tut_wrong_sword_silver') && usesSteel && usesVitality)
  2968. {
  2969. FactsAdd('tut_proper_sword_steel',1);
  2970. FactsRemove('tut_wrong_sword_silver');
  2971. }
  2972. }
  2973.  
  2974.  
  2975. if(!action.WasDodged() && HasRunewordActive('Runeword 1 _Stats')) //modSigns
  2976. {
  2977. if(runewordInfusionType == ST_Axii)
  2978. {
  2979. actorVictim.SoundEvent('sign_axii_release');
  2980. }
  2981. else if(runewordInfusionType == ST_Igni)
  2982. {
  2983. actorVictim.SoundEvent('sign_igni_charge_begin');
  2984. }
  2985. else if(runewordInfusionType == ST_Quen)
  2986. {
  2987. value = GetAttributeValue('runeword1_quen_heal');
  2988. Heal( action.GetDamageDealt() * value.valueMultiplicative );
  2989. PlayEffectSingle('drain_energy_caretaker_shovel');
  2990. }
  2991. else if(runewordInfusionType == ST_Yrden)
  2992. {
  2993. actorVictim.SoundEvent('sign_yrden_shock_activate');
  2994. }
  2995. runewordInfusionType = ST_None;
  2996.  
  2997.  
  2998. items = inv.GetHeldWeapons();
  2999. weaponEnt = inv.GetItemEntityUnsafe(items[0]);
  3000. weaponEnt.StopEffect('runeword_aard');
  3001. weaponEnt.StopEffect('runeword_axii');
  3002. weaponEnt.StopEffect('runeword_igni');
  3003. weaponEnt.StopEffect('runeword_quen');
  3004. weaponEnt.StopEffect('runeword_yrden');
  3005. }
  3006.  
  3007. //modSigns: Invigoration
  3008. if(HasBuff(EET_Runeword4) && (action.IsActionMelee() || action.IsActionWitcherSign() && IsMutationActive(EPMT_Mutation1)) && action.DealsAnyDamage() && !action.IsDoTDamage())
  3009. {
  3010. RemoveBuff(EET_Runeword4);
  3011. actorVictim.CreateFXEntityAtPelvis( 'runeword_4', true );
  3012. }
  3013.  
  3014. if(ShouldProcessTutorial('TutorialLightAttacks') || ShouldProcessTutorial('TutorialHeavyAttacks'))
  3015. {
  3016. if(IsLightAttack(attackAction.GetAttackName()))
  3017. {
  3018. theGame.GetTutorialSystem().IncreaseGeraltsLightAttacksCount(action.victim.GetTags());
  3019. }
  3020. else if(IsHeavyAttack(attackAction.GetAttackName()))
  3021. {
  3022. theGame.GetTutorialSystem().IncreaseGeraltsHeavyAttacksCount(action.victim.GetTags());
  3023. }
  3024. }
  3025. }
  3026. else if(attackAction.IsActionRanged())
  3027. {
  3028.  
  3029. if(CanUseSkill(S_Sword_s15) && attackAction.DealsAnyDamage() && !attackAction.WasDodged() && !attackAction.IsParried() && !attackAction.IsCountered()) //modSigns: only gain adrenaline for actual damage dealt
  3030. {
  3031. value = GetSkillAttributeValue(S_Sword_s15, 'focus_gain', false, true) * GetSkillLevel(S_Sword_s15) ;
  3032.  
  3033. //modSigns: new mutation7 (Adrenaline Rush)
  3034. focusVal = CalculateAttributeValue(value);
  3035. if(HasBuff(EET_Mutation7Buff))
  3036. focusVal *= 2;
  3037. else if(HasBuff(EET_Mutation7Debuff))
  3038. focusVal /= 2;
  3039.  
  3040. GainStat(BCS_Focus, focusVal);
  3041. }
  3042.  
  3043.  
  3044. if(CanUseSkill(S_Sword_s12) && attackAction.IsCriticalHit() && actorVictim)
  3045. {
  3046.  
  3047. actorVictim.GetCharacterStats().GetAbilities(abs, false);
  3048. dm = theGame.GetDefinitionsManager();
  3049. for(i=abs.Size()-1; i>=0; i-=1)
  3050. {
  3051. if(!dm.AbilityHasTag(abs[i], theGame.params.TAG_MONSTER_SKILL) || actorVictim.IsAbilityBlocked(abs[i]))
  3052. {
  3053. abs.EraseFast(i);
  3054. }
  3055. }
  3056.  
  3057.  
  3058. if(abs.Size() > 0)
  3059. {
  3060. value = GetSkillAttributeValue(S_Sword_s12, 'duration', true, true) * GetSkillLevel(S_Sword_s12);
  3061. actorVictim.BlockAbility(abs[ RandRange(abs.Size()) ], true, CalculateAttributeValue(value));
  3062. }
  3063. }
  3064. }
  3065. }
  3066.  
  3067.  
  3068. //modSigns: moved sign fx to signEntity to ensure it's triggered only once per cast (and alt cast)
  3069. if( IsMutationActive( EPMT_Mutation10 ) && ( action.IsActionMelee() /*|| action.IsActionWitcherSign()*/ ) )
  3070. {
  3071. PlayEffect( 'mutation_10_energy' );
  3072. }
  3073.  
  3074.  
  3075. if(CanUseSkill(S_Perk_18) && ((W3Petard)action.causer) && action.DealsAnyDamage() && !action.IsDoTDamage())
  3076. {
  3077. value = GetSkillAttributeValue(S_Perk_18, 'focus_gain', false, true);
  3078.  
  3079. //modSigns: new mutation7 (Adrenaline Rush)
  3080. focusVal = CalculateAttributeValue(value);
  3081. if(HasBuff(EET_Mutation7Buff))
  3082. focusVal *= 2;
  3083. else if(HasBuff(EET_Mutation7Debuff))
  3084. focusVal /= 2;
  3085.  
  3086. GainStat(BCS_Focus, focusVal);
  3087. }
  3088.  
  3089. //modSigns: new mutagen01 effect
  3090. if(HasBuff(EET_Mutagen01) && attackAction)
  3091. {
  3092. ((W3Mutagen01_Effect)GetBuff(EET_Mutagen01)).ManageMutagen01Bonus(attackAction);
  3093. }
  3094.  
  3095. //modSigns: new mutagen05 effect
  3096. if(HasBuff(EET_Mutagen05))
  3097. {
  3098. ((W3Mutagen05_Effect)GetBuff(EET_Mutagen05)).ManageMutagen05Bonus(action);
  3099. }
  3100.  
  3101. //modSigns: new mutagen10 effect
  3102. if(HasBuff(EET_Mutagen10) && attackAction)
  3103. {
  3104. ((W3Mutagen10_Effect)GetBuff(EET_Mutagen10)).ManageMutagen10Bonus(attackAction);
  3105. }
  3106.  
  3107. //modSigns: new mutagen15 effect
  3108. if(HasBuff(EET_Mutagen15))
  3109. {
  3110. ((W3Mutagen15_Effect)GetBuff(EET_Mutagen15)).ManageMutagen15Bonus(action);
  3111. }
  3112.  
  3113. //modSigns: new mutagen17 effect
  3114. if(HasBuff(EET_Mutagen17) && attackAction)
  3115. {
  3116. ((W3Mutagen17_Effect)GetBuff(EET_Mutagen17)).ManageMutagen17Bonus(attackAction);
  3117. }
  3118.  
  3119. //modSigns: new lynx set tier1 bonus
  3120. if( IsSetBonusActive( EISB_Lynx_1 ) && attackAction && attackAction.IsActionMelee() && !attackAction.WasDodged() )
  3121. {
  3122. //theGame.witcherLog.AddMessage("Lynx set tier 1 post action"); //debug
  3123. if( !HasBuff( EET_LynxSetBonus ) )
  3124. {
  3125. AddEffectDefault( EET_LynxSetBonus, NULL, "LynxSetBuff" );
  3126. SoundEvent( "ep2_setskill_lynx_activate" );
  3127. }
  3128. lynxSetBuff = (W3Effect_LynxSetBonus)GetBuff( EET_LynxSetBonus );
  3129. lynxSetBuff.ManageLynxBonus( IsHeavyAttack( attackAction.GetAttackName() ) );
  3130. }
  3131. }
  3132.  
  3133. //modSigns: rend AoE
  3134. private function RendAoE(attackAction : W3Action_Attack)
  3135. {
  3136. var dmgTypes : array< name >;
  3137. var dmgValues : array< float >;
  3138. var ents : array<CGameplayEntity>;
  3139. var rendAoEAction : W3DamageAction;
  3140. var i, j : int;
  3141.  
  3142. if(GetStat(BCS_Focus) < 3)
  3143. return;
  3144.  
  3145. inv.GetWeaponDTNames(attackAction.GetWeaponId(), dmgTypes);
  3146. for(i = 0; i < dmgTypes.Size(); i += 1)
  3147. dmgValues.PushBack(GetTotalWeaponDamage(attackAction.GetWeaponId(), dmgTypes[i], GetInvalidUniqueId()));
  3148.  
  3149. FindGameplayEntitiesInCylinder(ents, attackAction.victim.GetWorldPosition(), 3, 10, 100, , FLAG_OnlyAliveActors + FLAG_ExcludeTarget + FLAG_Attitude_Hostile, this);
  3150.  
  3151. for(i = 0; i < ents.Size(); i += 1)
  3152. {
  3153. if(ents[i] == attackAction.victim)
  3154. continue;
  3155. rendAoEAction = new W3DamageAction in theGame;
  3156. rendAoEAction.Initialize(attackAction.attacker, ents[i], attackAction.causer, "RendAoE", EHRT_Heavy, CPS_AttackPower, false, false, false, false);
  3157. rendAoEAction.SetCannotReturnDamage(true);
  3158. rendAoEAction.SetProcessBuffsIfNoDamage(true);
  3159. for(j = 0; j < dmgTypes.Size(); j += 1)
  3160. rendAoEAction.AddDamage(dmgTypes[j], dmgValues[j]);
  3161. rendAoEAction.AddEffectInfo(EET_KnockdownTypeApplicator);
  3162. theGame.damageMgr.ProcessAction(rendAoEAction);
  3163. ents[i].PlayEffect('yrden_shock');
  3164. delete rendAoEAction;
  3165. }
  3166. }
  3167.  
  3168.  
  3169. timer function Mutagen14Timer(dt : float, id : int)
  3170. {
  3171. var abilityName : name;
  3172. var abilityCount, maxStack : float;
  3173. var min, max : SAbilityAttributeValue;
  3174. var addAbility : bool;
  3175.  
  3176. abilityName = GetBuff(EET_Mutagen14).GetAbilityName();
  3177. abilityCount = GetAbilityCount(abilityName);
  3178.  
  3179. if(abilityCount == 0)
  3180. {
  3181. addAbility = true;
  3182. }
  3183. else
  3184. {
  3185. theGame.GetDefinitionsManager().GetAbilityAttributeValue(abilityName, 'mutagen14_max_stack', min, max);
  3186. maxStack = CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  3187.  
  3188. if(maxStack >= 0)
  3189. {
  3190. addAbility = (abilityCount < maxStack);
  3191. }
  3192. else
  3193. {
  3194. addAbility = true;
  3195. }
  3196. }
  3197.  
  3198. if(addAbility)
  3199. {
  3200. AddAbility(abilityName, true);
  3201. }
  3202. else
  3203. {
  3204.  
  3205. RemoveTimer('Mutagen14Timer');
  3206. }
  3207. }
  3208.  
  3209. public final function FailFundamentalsFirstAchievementCondition()
  3210. {
  3211. SetFailedFundamentalsFirstAchievementCondition(true);
  3212. }
  3213.  
  3214. public final function SetUsedQuenInCombat()
  3215. {
  3216. usedQuenInCombat = true;
  3217. }
  3218.  
  3219. public final function UsedQuenInCombat() : bool
  3220. {
  3221. return usedQuenInCombat;
  3222. }
  3223.  
  3224. event OnCombatStart()
  3225. {
  3226. var quenEntity/*, glyphQuen*/ : W3QuenEntity; //modSigns
  3227. var focus, stamina, focusMax : float; //modSigns
  3228. var glowTargets, moTargets, actors : array< CActor >;
  3229. var delays : array< float >;
  3230. var rand, i : int;
  3231. var isHostile, isAlive, isUnconscious : bool;
  3232.  
  3233. super.OnCombatStart();
  3234.  
  3235. if ( IsInCombatActionFriendly() )
  3236. {
  3237. SetBIsCombatActionAllowed(true);
  3238. SetBIsInputAllowed(true, 'OnCombatActionStart' );
  3239. }
  3240.  
  3241.  
  3242. if(HasBuff(EET_Mutagen14))
  3243. {
  3244. AddTimer('Mutagen14Timer', 2, true);
  3245. }
  3246.  
  3247.  
  3248. //if(HasBuff(EET_Mutagen15)) //modSigns: changed
  3249. //{
  3250. // AddAbility(GetBuff(EET_Mutagen15).GetAbilityName(), false);
  3251. //}
  3252.  
  3253. //modSigns: new mutagen24 effect
  3254. if(HasBuff(EET_Mutagen24))
  3255. ((W3Mutagen24_Effect)GetBuff(EET_Mutagen24)).ManageMutagen24Bonus();
  3256.  
  3257. //modSigns
  3258. if( IsSetBonusActive(EISB_KaerMorhen) && !HasBuff(EET_KaerMorhenSetBonus) )
  3259. {
  3260. AddEffectDefault(EET_KaerMorhenSetBonus, this, "KaerMorhenSetBonus");
  3261. }
  3262.  
  3263. ManageAerondightBuff( true ); //modSigns
  3264. ManageIrisBuff( true ); //modSigns
  3265.  
  3266.  
  3267. mutation12IsOnCooldown = false;
  3268.  
  3269.  
  3270. quenEntity = (W3QuenEntity)signs[ST_Quen].entity;
  3271.  
  3272.  
  3273. if(quenEntity)
  3274. {
  3275. usedQuenInCombat = quenEntity.IsAnyQuenActive();
  3276. }
  3277. else
  3278. {
  3279. usedQuenInCombat = false;
  3280. }
  3281.  
  3282. if(usedQuenInCombat || HasPotionBuff() || IsEquippedSwordUpgradedWithOil(true) || IsEquippedSwordUpgradedWithOil(false))
  3283. {
  3284. SetFailedFundamentalsFirstAchievementCondition(true);
  3285. }
  3286. else
  3287. {
  3288. if(IsAnyItemEquippedOnSlot(EES_PotionMutagen1) || IsAnyItemEquippedOnSlot(EES_PotionMutagen2) || IsAnyItemEquippedOnSlot(EES_PotionMutagen3) || IsAnyItemEquippedOnSlot(EES_PotionMutagen4))
  3289. SetFailedFundamentalsFirstAchievementCondition(true);
  3290. else
  3291. SetFailedFundamentalsFirstAchievementCondition(false);
  3292. }
  3293.  
  3294. if(CanUseSkill(S_Sword_s20) && IsThreatened())
  3295. {
  3296. focus = GetStat(BCS_Focus);
  3297. //modSigns
  3298. focusMax = CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s20, 'focus_add', false, true)) * GetSkillLevel(S_Sword_s20);
  3299. if(focus < focusMax)
  3300. {
  3301. GainStat(BCS_Focus, focusMax - focus);
  3302. }
  3303. }
  3304.  
  3305. if ( HasGlyphwordActive('Glyphword 17 _Stats') && (!quenEntity || !quenEntity.IsAnyQuenActive()) ) //modSigns
  3306. {
  3307. //stamina = GetStat(BCS_Stamina); //modSigns
  3308. if(!quenEntity)
  3309. {
  3310. quenEntity = (W3QuenEntity)theGame.CreateEntity( signs[ST_Quen].template, GetWorldPosition(), GetWorldRotation() );
  3311. }
  3312. quenEntity.glyphword17Cast = true; //modSigns
  3313. quenEntity.Init( signOwner, signs[ST_Quen].entity, true );
  3314. quenEntity.freeCast = true; //modSigns
  3315. quenEntity.OnStarted();
  3316. quenEntity.OnThrowing();
  3317. quenEntity.OnEnded();
  3318. //ForceSetStat(BCS_Stamina, stamina); //modSigns
  3319. }
  3320.  
  3321.  
  3322. MeditationForceAbort(true);
  3323.  
  3324.  
  3325.  
  3326.  
  3327.  
  3328. if( IsMutationActive( EPMT_Mutation3 ) ) //modSigns: now added at combat start
  3329. {
  3330. AddEffectDefault( EET_Mutation3, this, "", false );
  3331. }
  3332. else if( IsMutationActive( EPMT_Mutation4 ) )
  3333. {
  3334. AddEffectDefault( EET_Mutation4, this, "combat start", false );
  3335. }
  3336. //else if( IsMutationActive( EPMT_Mutation5 ) && GetStat( BCS_Focus ) >= 1.f )
  3337. //{
  3338. // AddEffectDefault( EET_Mutation5, this, "", false );
  3339. //} //modSigns: mutation changed
  3340.  
  3341. else if( IsMutationActive( EPMT_Mutation7 ) )
  3342. {
  3343. //
  3344. //
  3345. // RemoveTimer( 'Mutation7CombatStartHackFixGo' );
  3346. //
  3347. //
  3348. // AddTimer( 'Mutation7CombatStartHackFix', 1.f, true, , , , true );
  3349. //
  3350. //modSigns
  3351. AddEffectDefault( EET_Mutation7Buff, this, "Mutation 7 buff phase" );
  3352. theGame.MutationHUDFeedback( MFT_PlayRepeat );
  3353. }
  3354. else if( IsMutationActive( EPMT_Mutation8 ) )
  3355. {
  3356. theGame.MutationHUDFeedback( MFT_PlayRepeat );
  3357. }
  3358.  
  3359. else if( IsMutationActive( EPMT_Mutation10 ) )
  3360. {
  3361. /*if( !HasBuff( EET_Mutation10 ) && GetStat( BCS_Toxicity ) > 0.f )
  3362. {
  3363. AddEffectDefault( EET_Mutation10, this, "Mutation 10" );
  3364. }*/
  3365.  
  3366.  
  3367. //PlayEffect( 'mutation_10' );
  3368. //
  3369. //
  3370. //PlayEffect( 'critical_toxicity' );
  3371. //AddTimer( 'Mutation10StopEffect', 5.f );
  3372. ////modSigns
  3373. //if( !HasBuff( EET_Mutation10 ) )
  3374. //{
  3375. // AddEffectDefault( EET_Mutation10, NULL, "Mutation 10" );
  3376. //}
  3377.  
  3378. //modSigns: Euphoria rework
  3379. if( GetStatPercents(BCS_Toxicity) >= GetToxicityDamageThreshold() )
  3380. AddEffectDefault( EET_Mutation10, NULL, "Mutation 10" );
  3381. }
  3382. }
  3383.  
  3384. //timer function Mutation7CombatStartHackFix( dt : float, id : int )
  3385. //{
  3386. // var actors : array< CActor >;
  3387. //
  3388. // actors = GetEnemies();
  3389. //
  3390. // if( actors.Size() > 0 )
  3391. // {
  3392. //
  3393. // AddTimer( 'Mutation7CombatStartHackFixGo', 0.5f );
  3394. // RemoveTimer( 'Mutation7CombatStartHackFix' );
  3395. // }
  3396. //}
  3397. //
  3398. //timer function Mutation7CombatStartHackFixGo( dt : float, id : int )
  3399. //{
  3400. // var actors : array< CActor >;
  3401. //
  3402. // if( IsMutationActive( EPMT_Mutation7 ) )
  3403. // {
  3404. // actors = GetEnemies();
  3405. //
  3406. // if( actors.Size() > 1 )
  3407. // {
  3408. // AddEffectDefault( EET_Mutation7Buff, this, "Mutation 7, combat start" );
  3409. // }
  3410. // }
  3411. //} //modSigns: redone
  3412.  
  3413. public final function IsInFistFight() : bool
  3414. {
  3415. var enemies : array< CActor >;
  3416. var i, j : int;
  3417. var invent : CInventoryComponent;
  3418. var weapons : array< SItemUniqueId >;
  3419.  
  3420. if( IsInFistFightMiniGame() )
  3421. {
  3422. return true;
  3423. }
  3424.  
  3425. enemies = GetEnemies();
  3426. for( i=0; i<enemies.Size(); i+=1 )
  3427. {
  3428. weapons.Clear();
  3429. invent = enemies[i].GetInventory();
  3430. weapons = invent.GetHeldWeapons();
  3431.  
  3432. for( j=0; j<weapons.Size(); j+=1 )
  3433. {
  3434. if( invent.IsItemFists( weapons[j] ) )
  3435. {
  3436. return true;
  3437. }
  3438. }
  3439. }
  3440.  
  3441. return false;
  3442. }
  3443.  
  3444. timer function Mutation10StopEffect( dt : float, id : int )
  3445. {
  3446. StopEffect( 'critical_toxicity' );
  3447. }
  3448.  
  3449.  
  3450. event OnCombatFinished()
  3451. {
  3452. var inGameConfigWrapper : CInGameConfigWrapper;
  3453. var disableAutoSheathe : bool;
  3454.  
  3455. super.OnCombatFinished();
  3456.  
  3457. //modSigns: cleanup mutagens
  3458. if(HasBuff(EET_Mutagen01))
  3459. ((W3Mutagen01_Effect)GetBuff(EET_Mutagen01)).RemoveMutagen01Abilities();
  3460. if(HasBuff(EET_Mutagen05))
  3461. ((W3Mutagen05_Effect)GetBuff(EET_Mutagen05)).RemoveMutagen05AbilitiesAll();
  3462. if(HasBuff(EET_Mutagen10))
  3463. ((W3Mutagen10_Effect)GetBuff(EET_Mutagen10)).RemoveMutagen10Abilities();
  3464. if(HasBuff(EET_Mutagen12))
  3465. ((W3Mutagen12_Effect)GetBuff(EET_Mutagen12)).ManageAdditionalBonus();
  3466. if(HasBuff(EET_Mutagen13))
  3467. ((W3Mutagen13_Effect)GetBuff(EET_Mutagen13)).ManageMutagen13Bonus();
  3468. if(HasBuff(EET_Mutagen15))
  3469. ((W3Mutagen15_Effect)GetBuff(EET_Mutagen15)).RemoveMutagen15AbilitiesAll();
  3470. if(HasBuff(EET_Mutagen17))
  3471. ((W3Mutagen17_Effect)GetBuff(EET_Mutagen17)).RemoveMutagen17Abilities();
  3472. if(HasBuff(EET_Mutagen18))
  3473. ((W3Mutagen18_Effect)GetBuff(EET_Mutagen18)).ManageMutagen18Bonus();
  3474. if(HasBuff(EET_Mutagen22))
  3475. ((W3Mutagen22_Effect)GetBuff(EET_Mutagen22)).RemoveMutagen22AbilitiesAll();
  3476. if(HasBuff(EET_Mutagen24))
  3477. ((W3Mutagen24_Effect)GetBuff(EET_Mutagen24)).ResetMutagen24Bonus();
  3478.  
  3479. //cleanup mutations
  3480. RemoveBuff( EET_Mutation3 );
  3481. RemoveBuff( EET_Mutation4 );
  3482. //RemoveBuff( EET_Mutation5 ); //modSigns: mutation changed
  3483. RemoveBuff( EET_Mutation7Buff );
  3484. RemoveBuff( EET_Mutation7Debuff );
  3485. if( IsMutationActive( EPMT_Mutation7 ) )
  3486. {
  3487. theGame.MutationHUDFeedback( MFT_PlayHide );
  3488. }
  3489. else if( IsMutationActive( EPMT_Mutation8 ) )
  3490. {
  3491. theGame.MutationHUDFeedback( MFT_PlayHide );
  3492. }
  3493. RemoveBuff( EET_Mutation10 );
  3494.  
  3495. //cleanup set bonuses
  3496. RemoveBuff( EET_LynxSetBonus );
  3497. RemoveBuff( EET_KaerMorhenSetBonus ); //modSigns
  3498.  
  3499. if( HasBuff( EET_Aerondight ) ) //modSigns
  3500. RemoveBuff( EET_Aerondight );
  3501.  
  3502. if( HasBuff( EET_PhantomWeapon ) ) //modSigns
  3503. RemoveBuff( EET_PhantomWeapon );
  3504.  
  3505. //cleanup runewords
  3506. RemoveAbilityAll('Runeword 10 Buff');
  3507. //thePlayer.abilityManager.ResetOverhealBonus();
  3508. RemoveBuff(EET_Runeword4); //modSigns
  3509. runewordInfusionType = ST_None;
  3510. RemoveBuff(EET_Runeword11); //modSigns
  3511.  
  3512. RemoveAbilityAll('Glyphword 14 _Stats'); //modSigns
  3513. RemoveAbilityAll('Glyphword 10 _Stats'); //modSigns
  3514.  
  3515. //begin out of combat adrenaline drain
  3516. if(GetStat(BCS_Focus) > 0)
  3517. {
  3518. AddTimer('DelayedAdrenalineDrain', theGame.params.ADRENALINE_DRAIN_AFTER_COMBAT_DELAY, , , , true);
  3519. }
  3520.  
  3521. //profile tracker
  3522. usedQuenInCombat = false;
  3523. theGame.GetGamerProfile().ResetStat(ES_FinesseKills);
  3524.  
  3525. //sword sheathing
  3526. LogChannel( 'OnCombatFinished', "OnCombatFinished: DelayedSheathSword timer added" );
  3527. inGameConfigWrapper = (CInGameConfigWrapper)theGame.GetInGameConfigWrapper();
  3528. disableAutoSheathe = inGameConfigWrapper.GetVarValue( 'Gameplay', 'DisableAutomaticSwordSheathe' );
  3529. if( !disableAutoSheathe )
  3530. {
  3531. if ( ShouldAutoSheathSwordInstantly() )
  3532. AddTimer( 'DelayedSheathSword', 0.5f );
  3533. else
  3534. AddTimer( 'DelayedSheathSword', 2.f );
  3535. }
  3536.  
  3537. OnBlockAllCombatTickets( false );
  3538. }
  3539.  
  3540. public function PlayHitEffect( damageAction : W3DamageAction )
  3541. {
  3542. var hitReactionType : EHitReactionType;
  3543. var isAtBack : bool;
  3544.  
  3545.  
  3546. if( damageAction.GetMutation4Triggered() )
  3547. {
  3548. hitReactionType = damageAction.GetHitReactionType();
  3549. isAtBack = IsAttackerAtBack( damageAction.attacker );
  3550.  
  3551. if( hitReactionType != EHRT_Heavy )
  3552. {
  3553. if( isAtBack )
  3554. {
  3555. damageAction.SetHitEffect( 'light_hit_back_toxic', true );
  3556. }
  3557. else
  3558. {
  3559. damageAction.SetHitEffect( 'light_hit_toxic' );
  3560. }
  3561. }
  3562. else
  3563. {
  3564. if( isAtBack )
  3565. {
  3566. damageAction.SetHitEffect( 'heavy_hit_back_toxic' ,true );
  3567. }
  3568. else
  3569. {
  3570. damageAction.SetHitEffect( 'heavy_hit_toxic' );
  3571. }
  3572. }
  3573. }
  3574.  
  3575. super.PlayHitEffect( damageAction );
  3576. }
  3577.  
  3578. timer function DelayedAdrenalineDrain(dt : float, id : int)
  3579. {
  3580. if ( !HasBuff(EET_Runeword8) )
  3581. AddEffectDefault(EET_AdrenalineDrain, this, "after_combat_adrenaline_drain");
  3582. }
  3583.  
  3584.  
  3585. protected function Attack( hitTarget : CGameplayEntity, animData : CPreAttackEventData, weaponId : SItemUniqueId, parried : bool, countered : bool, parriedBy : array<CActor>, attackAnimationName : name, hitTime : float, weaponEntity : CItemEntity)
  3586. {
  3587. //var mutagen17 : W3Mutagen17_Effect;
  3588.  
  3589. //modSigns: check for mutagen17 activation
  3590. //if(HasBuff(EET_Mutagen17))
  3591. //{
  3592. // mutagen17 = (W3Mutagen17_Effect)GetBuff(EET_Mutagen17);
  3593. // if(mutagen17.IsBoostAvailable())
  3594. // {
  3595. // mutagen17.ActivateBoost();
  3596. // //theGame.witcherLog.AddMessage("mutagen17 boost activated: attack"); //modSigns: debug
  3597. // }
  3598. //}
  3599.  
  3600. super.Attack(hitTarget, animData, weaponId, parried, countered, parriedBy, attackAnimationName, hitTime, weaponEntity);
  3601.  
  3602. /*if( (CActor)hitTarget && HasBuff(EET_Mutagen17) )
  3603. {
  3604. mutagen17 = (W3Mutagen17_Effect)GetBuff(EET_Mutagen17);
  3605. if(mutagen17.HasBoost())
  3606. {
  3607. mutagen17.ClearBoost();
  3608. }
  3609. }*/ //modSigns: move to other place
  3610. }
  3611.  
  3612. //modSigns: redone completely
  3613. public final timer function SpecialAttackLightSustainCost(dt : float, id : int)
  3614. {
  3615. if(abilityManager && abilityManager.IsInitialized() && IsAlive() && HasResourcesForWhirl(dt))
  3616. {
  3617. PauseStaminaRegen('WhirlSkill');
  3618. WhirlDrainResources(dt);
  3619. }
  3620. else
  3621. {
  3622. OnPerformSpecialAttack(true, false);
  3623. }
  3624. /*var focusPerSec, cost, delay : float;
  3625. var reduction : SAbilityAttributeValue;
  3626. var skillLevel : int;
  3627.  
  3628. if(abilityManager && abilityManager.IsInitialized() && IsAlive())
  3629. {
  3630. PauseStaminaRegen('WhirlSkill');
  3631.  
  3632. if(GetStat(BCS_Stamina) > 0)
  3633. {
  3634. cost = GetStaminaActionCost(ESAT_Ability, GetSkillAbilityName(S_Sword_s01), dt);
  3635. delay = GetStaminaActionDelay(ESAT_Ability, GetSkillAbilityName(S_Sword_s01), dt);
  3636. skillLevel = GetSkillLevel(S_Sword_s01);
  3637.  
  3638. if(skillLevel > 1)
  3639. {
  3640. reduction = GetSkillAttributeValue(S_Sword_s01, 'cost_reduction', false, true) * (skillLevel - 1);
  3641. cost = MaxF(0, cost * (1 - reduction.valueMultiplicative) - reduction.valueAdditive);
  3642. }
  3643.  
  3644. DrainStamina(ESAT_FixedValue, cost, delay, GetSkillAbilityName(S_Sword_s01));
  3645. }
  3646. else
  3647. {
  3648. GetSkillAttributeValue(S_Sword_s01, 'focus_cost_per_sec', false, true);
  3649. focusPerSec = GetWhirlFocusCostPerSec();
  3650. DrainFocus(focusPerSec * dt);
  3651. }
  3652. }
  3653.  
  3654. if(GetStat(BCS_Stamina) <= 0 && GetStat(BCS_Focus) <= 0)
  3655. {
  3656. OnPerformSpecialAttack(true, false);
  3657. }*/
  3658. }
  3659.  
  3660. /*public final function GetWhirlFocusCostPerSec() : float
  3661. {
  3662. var ability : SAbilityAttributeValue;
  3663. var val : float;
  3664. var skillLevel : int;
  3665.  
  3666. ability = GetSkillAttributeValue(S_Sword_s01, 'focus_cost_per_sec_initial', false, false);
  3667. skillLevel = GetSkillLevel(S_Sword_s01);
  3668.  
  3669. if(skillLevel > 1)
  3670. ability -= GetSkillAttributeValue(S_Sword_s01, 'cost_reduction', false, false) * (skillLevel-1);
  3671.  
  3672. val = CalculateAttributeValue(ability);
  3673.  
  3674. return val;
  3675. }*/ //modSigns: redone
  3676.  
  3677. //modSigns
  3678. public final function HasResourcesForWhirl(dt : float) : bool
  3679. {
  3680. return GetStat(BCS_Stamina) >= GetWhirlStaminaCost(dt);
  3681. }
  3682.  
  3683. public final function GetWhirlStaminaCost(dt : float) : float
  3684. {
  3685. var cost : float;
  3686. cost = GetStaminaActionCost(ESAT_Ability, GetSkillAbilityName(S_Sword_s01), dt);
  3687. cost *= 1 - CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s01, 'stamina_cost_reduction_after_1', false, false)) * (GetSkillLevel(S_Sword_s01) - 1);
  3688. if(HasBuff(EET_Mutagen04))
  3689. cost *= 1 + ((W3Mutagen04_Effect)GetBuff(EET_Mutagen04)).GetAttackCostIncrease();
  3690. return cost;
  3691. }
  3692.  
  3693. //modSigns
  3694. private final function WhirlDrainResources(dt : float)
  3695. {
  3696. var delay : float;
  3697. delay = GetStaminaActionDelay(ESAT_Ability, GetSkillAbilityName(S_Sword_s01), dt);
  3698. DrainStamina(ESAT_FixedValue, GetWhirlStaminaCost(dt), delay, GetSkillAbilityName(S_Sword_s01));
  3699. }
  3700.  
  3701. //modSigns
  3702. public final function GetNumHostilesInRange() : int
  3703. {
  3704. var ents : array<CGameplayEntity>;
  3705.  
  3706. FindGameplayEntitiesInRange(ents, this, 30, 100, , FLAG_OnlyAliveActors + FLAG_ExcludeTarget + FLAG_Attitude_Hostile, this);
  3707.  
  3708. return ents.Size();
  3709. }
  3710.  
  3711. //modSigns
  3712. public final function GetWhirlDamageBonus() : float
  3713. {
  3714. var bonusCount : int;
  3715. var ability : SAbilityAttributeValue;
  3716. var damageBonus : float;
  3717.  
  3718. bonusCount = Clamp(GetNumHostilesInRange() - 1, 0, 5);
  3719. ability = GetSkillAttributeValue(S_Sword_s01, 'whirl_dmg_bonus', false, true) * GetSkillLevel(S_Sword_s01);
  3720. damageBonus = ability.valueMultiplicative * bonusCount;
  3721.  
  3722. return damageBonus;
  3723. }
  3724.  
  3725. //modSigns
  3726. public final function GetRendPowerBonus() : float
  3727. {
  3728. var rendLoad, rendBonus, rendRatio : float;
  3729. var attackBonus, rendBonusPerPoint, staminaRendBonus : SAbilityAttributeValue;
  3730.  
  3731. rendBonus = 0;
  3732. //unconditional bonus
  3733. attackBonus = GetSkillAttributeValue(S_Sword_s02, 'attack_damage_bonus', false, true) * GetSkillLevel(S_Sword_s02);
  3734. rendBonus += attackBonus.valueMultiplicative;
  3735. //check how much of the 'gauge' player channeled
  3736. rendRatio = GetSpecialAttackTimeRatio();
  3737. if(rendRatio > 0)
  3738. {
  3739. //bonus for stamina usage (per skill level, per stamina point)
  3740. staminaRendBonus = GetSkillAttributeValue(S_Sword_s02, 'stamina_max_dmg_bonus', false, true) * GetSkillLevel(S_Sword_s02);
  3741. rendBonus += rendRatio * GetStatMax(BCS_Stamina) * staminaRendBonus.valueMultiplicative;
  3742. }
  3743. //adrenaline points
  3744. rendLoad = GetStat(BCS_Focus);
  3745. //do not round adrenaline points, use as many as possible
  3746. if(rendLoad > 0)
  3747. {
  3748. //bonus for adrenaline usage (per skill level)
  3749. rendBonusPerPoint = GetSkillAttributeValue(S_Sword_s02, 'adrenaline_final_damage_bonus', false, true) * GetSkillLevel(S_Sword_s02);
  3750. rendBonus += rendLoad * rendBonusPerPoint.valueMultiplicative;
  3751. }
  3752. //theGame.witcherLog.AddMessage("Rend ratio: " + rendRatio);
  3753. //theGame.witcherLog.AddMessage("Rend load: " + rendLoad);
  3754. //theGame.witcherLog.AddMessage("Rend bonus: " + rendBonus);
  3755. return rendBonus;
  3756. }
  3757.  
  3758. //modSigns
  3759. public final function GetRendStaminaCost(dt : float) : float
  3760. {
  3761. return GetStaminaActionCost(ESAT_Ability, GetSkillAbilityName(S_Sword_s02), dt);
  3762. }
  3763.  
  3764. public final timer function SpecialAttackHeavySustainCost(dt : float, id : int)
  3765. {
  3766. var focusHighlight, ratio : float;
  3767. var hud : CR4ScriptedHud;
  3768. var hudWolfHeadModule : CR4HudModuleWolfHead;
  3769.  
  3770. PauseStaminaRegen('RendSkill'); //modSigns
  3771.  
  3772. DrainStamina(ESAT_Ability, 0, 0, GetSkillAbilityName(S_Sword_s02), dt);
  3773.  
  3774.  
  3775. if(GetStat(BCS_Stamina) <= 0)
  3776. OnPerformSpecialAttack(false, false);
  3777.  
  3778.  
  3779. ratio = EngineTimeToFloat(theGame.GetEngineTime() - specialHeavyStartEngineTime) / specialHeavyChargeDuration;
  3780.  
  3781. if(ratio > 0.99) //modSigns
  3782. ratio = 1;
  3783.  
  3784. SetSpecialAttackTimeRatio(ratio);
  3785.  
  3786.  
  3787. //focusHighlight = ratio * GetStatMax(BCS_Focus);
  3788. //focusHighlight = MinF(focusHighlight, GetStat(BCS_Focus));
  3789. //focusHighlight = FloorF(focusHighlight);
  3790. //modSigns
  3791. /*focusHighlight = FloorF(ratio * GetStat(BCS_Focus));
  3792.  
  3793. hud = (CR4ScriptedHud)theGame.GetHud();
  3794. if ( hud )
  3795. {
  3796. hudWolfHeadModule = (CR4HudModuleWolfHead)hud.GetHudModule( "WolfHeadModule" );
  3797. if ( hudWolfHeadModule )
  3798. {
  3799. hudWolfHeadModule.LockFocusPoints((int)focusHighlight);
  3800. }
  3801. }*/
  3802. }
  3803.  
  3804. public function OnSpecialAttackHeavyActionProcess()
  3805. {
  3806. var hud : CR4ScriptedHud;
  3807. var hudWolfHeadModule : CR4HudModuleWolfHead;
  3808.  
  3809. super.OnSpecialAttackHeavyActionProcess();
  3810.  
  3811. hud = (CR4ScriptedHud)theGame.GetHud();
  3812. if ( hud )
  3813. {
  3814. hudWolfHeadModule = (CR4HudModuleWolfHead)hud.GetHudModule( "WolfHeadModule" );
  3815. if ( hudWolfHeadModule )
  3816. {
  3817. hudWolfHeadModule.ResetFocusPoints();
  3818. }
  3819. }
  3820. }
  3821.  
  3822. timer function IsSpecialLightAttackInputHeld ( time : float, id : int )
  3823. {
  3824. var hasResource : bool;
  3825.  
  3826. if ( GetCurrentStateName() == 'CombatSteel' || GetCurrentStateName() == 'CombatSilver' )
  3827. {
  3828. if ( GetBIsCombatActionAllowed() && inputHandler.IsActionAllowed(EIAB_SwordAttack))
  3829. {
  3830. /*if(GetStat(BCS_Stamina) > 0)
  3831. {
  3832. hasResource = true;
  3833. }
  3834. else
  3835. {
  3836. hasResource = (GetStat(BCS_Focus) >= GetWhirlFocusCostPerSec() * time);
  3837. }*/ //modSigns: redone
  3838. hasResource = HasResourcesForWhirl(0.5f);
  3839.  
  3840. if(hasResource)
  3841. {
  3842. SetupCombatAction( EBAT_SpecialAttack_Light, BS_Pressed );
  3843. RemoveTimer('IsSpecialLightAttackInputHeld');
  3844. }
  3845. else if(!playedSpecialAttackMissingResourceSound)
  3846. {
  3847. //IndicateTooLowAdrenaline(); //modSigns
  3848. SetShowToLowStaminaIndication(GetWhirlStaminaCost(0.5f));
  3849. SoundEvent("gui_no_stamina");
  3850. playedSpecialAttackMissingResourceSound = true;
  3851. }
  3852. }
  3853. }
  3854. else
  3855. {
  3856. RemoveTimer('IsSpecialLightAttackInputHeld');
  3857. }
  3858. }
  3859.  
  3860. timer function IsSpecialHeavyAttackInputHeld ( time : float, id : int )
  3861. {
  3862. var cost : float;
  3863.  
  3864. if ( GetCurrentStateName() == 'CombatSteel' || GetCurrentStateName() == 'CombatSilver' )
  3865. {
  3866. //cost = CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s02, 'stamina_cost_per_sec', false, false));
  3867. cost = GetRendStaminaCost(0.5f); //modSigns
  3868.  
  3869. if( GetBIsCombatActionAllowed() && inputHandler.IsActionAllowed(EIAB_SwordAttack))
  3870. {
  3871. if(GetStat(BCS_Stamina) >= cost)
  3872. {
  3873. SetupCombatAction( EBAT_SpecialAttack_Heavy, BS_Pressed );
  3874. RemoveTimer('IsSpecialHeavyAttackInputHeld');
  3875. }
  3876. else if(!playedSpecialAttackMissingResourceSound)
  3877. {
  3878. //IndicateTooLowAdrenaline(); //modSigns
  3879. SetShowToLowStaminaIndication(cost);
  3880. SoundEvent("gui_no_stamina");
  3881. playedSpecialAttackMissingResourceSound = true;
  3882. }
  3883. }
  3884. }
  3885. else
  3886. {
  3887. RemoveTimer('IsSpecialHeavyAttackInputHeld');
  3888. }
  3889. }
  3890.  
  3891. public function EvadePressed( bufferAction : EBufferActionType )
  3892. {
  3893. var cat : float;
  3894.  
  3895. if( (bufferAction == EBAT_Dodge && IsActionAllowed(EIAB_Dodge)) || (bufferAction == EBAT_Roll && IsActionAllowed(EIAB_Roll)) )
  3896. {
  3897. //modSigns: check for stamina
  3898. if( bufferAction == EBAT_Dodge && !HasStaminaToUseAction(ESAT_Dodge, '', 0, 0 ) ||
  3899. bufferAction == EBAT_Roll && !HasStaminaToUseAction(ESAT_Roll, '', 0, 0 ) )
  3900. {
  3901. SoundEvent("gui_no_stamina");
  3902. return;
  3903. }
  3904.  
  3905. if(bufferAction != EBAT_Roll && ShouldProcessTutorial('TutorialDodge'))
  3906. {
  3907. FactsAdd("tut_in_dodge", 1, 2);
  3908.  
  3909. if(FactsQuerySum("tut_fight_use_slomo") > 0)
  3910. {
  3911. theGame.RemoveTimeScale( theGame.GetTimescaleSource(ETS_TutorialFight) );
  3912. FactsRemove("tut_fight_slomo_ON");
  3913. }
  3914. }
  3915. else if(bufferAction == EBAT_Roll && ShouldProcessTutorial('TutorialRoll'))
  3916. {
  3917. FactsAdd("tut_in_roll", 1, 2);
  3918.  
  3919. if(FactsQuerySum("tut_fight_use_slomo") > 0)
  3920. {
  3921. theGame.RemoveTimeScale( theGame.GetTimescaleSource(ETS_TutorialFight) );
  3922. FactsRemove("tut_fight_slomo_ON");
  3923. }
  3924. }
  3925.  
  3926. if ( GetBIsInputAllowed() )
  3927. {
  3928. if ( GetBIsCombatActionAllowed() )
  3929. {
  3930. CriticalEffectAnimationInterrupted("Dodge 2");
  3931. PushCombatActionOnBuffer( bufferAction, BS_Released );
  3932. ProcessCombatActionBuffer();
  3933. }
  3934. else if ( IsInCombatAction() && GetBehaviorVariable( 'combatActionType' ) == (int)CAT_Attack )
  3935. {
  3936. if ( CanPlayHitAnim() && IsThreatened() )
  3937. {
  3938. CriticalEffectAnimationInterrupted("Dodge 1");
  3939. PushCombatActionOnBuffer( bufferAction, BS_Released );
  3940. ProcessCombatActionBuffer();
  3941. }
  3942. else
  3943. PushCombatActionOnBuffer( bufferAction, BS_Released );
  3944. }
  3945.  
  3946. else if ( !( IsCurrentSignChanneled() ) )
  3947. {
  3948.  
  3949. PushCombatActionOnBuffer( bufferAction, BS_Released );
  3950. }
  3951. }
  3952. else
  3953. {
  3954. if ( IsInCombatAction() && GetBehaviorVariable( 'combatActionType' ) == (int)CAT_Attack )
  3955. {
  3956. if ( CanPlayHitAnim() && IsThreatened() )
  3957. {
  3958. CriticalEffectAnimationInterrupted("Dodge 3");
  3959. PushCombatActionOnBuffer( bufferAction, BS_Released );
  3960. ProcessCombatActionBuffer();
  3961. }
  3962. else
  3963. PushCombatActionOnBuffer( bufferAction, BS_Released );
  3964. }
  3965. LogChannel( 'InputNotAllowed', "InputNotAllowed" );
  3966. }
  3967. }
  3968. else
  3969. {
  3970. DisplayActionDisallowedHudMessage(EIAB_Dodge);
  3971. }
  3972. }
  3973.  
  3974. //modSigns
  3975. public saved var isLowStaminaSFXPlaying : bool;
  3976.  
  3977. public function CheckForLowStamina()
  3978. {
  3979. var sfxThreshold : float = theGame.params.GetLowStaminaSFXThreshold();
  3980. var staminaPrc : float = GetStatPercents(BCS_Stamina);
  3981. var rate : float;
  3982.  
  3983. if(staminaPrc < sfxThreshold && !isLowStaminaSFXPlaying)
  3984. {
  3985. isLowStaminaSFXPlaying = true;
  3986. //PlayEffectSingle('focus_sound_red_fx');
  3987. if(!theSound.SoundIsBankLoaded("heartbeat02a.bnk"))
  3988. theSound.SoundLoadBank("heartbeat02a.bnk", false);
  3989. theSound.SoundEvent("play_heartbeat_02a_loop");
  3990. theSound.SoundParameter("heartbeat_rate", theGame.params.GetLowStaminaSFXRate());
  3991. theSound.SoundParameter("heartbeat_volume", theGame.params.GetLowStaminaSFXVolume());
  3992. }
  3993. else if(staminaPrc >= sfxThreshold && isLowStaminaSFXPlaying)
  3994. {
  3995. isLowStaminaSFXPlaying = false;
  3996. //StopEffectIfActive('focus_sound_red_fx');
  3997. theSound.SoundEvent("stop_heartbeat_02a_loop");
  3998. }
  3999. if(isLowStaminaSFXPlaying)
  4000. {
  4001. rate = (1.0f - staminaPrc / sfxThreshold) * 100.0f;
  4002. if(theGame.params.GetLowStaminaSFXDynRate())
  4003. theSound.SoundParameter("heartbeat_rate", rate);
  4004. if(theGame.params.GetLowStaminaSFXDynVol())
  4005. theSound.SoundParameter("heartbeat_volume", rate);
  4006. }
  4007. }
  4008.  
  4009. public function StopLowStaminaSFX() //modSigns
  4010. {
  4011. isLowStaminaSFXPlaying = false;
  4012. //StopEffectIfActive('focus_sound_red_fx');
  4013. theSound.SoundEvent("stop_heartbeat_02a_loop");
  4014. }
  4015.  
  4016. public function ProcessCombatActionBuffer() : bool
  4017. {
  4018. var action : EBufferActionType = this.BufferCombatAction;
  4019. var stage : EButtonStage = this.BufferButtonStage;
  4020. var throwStage : EThrowStage;
  4021. var actionResult : bool = true;
  4022.  
  4023.  
  4024. if( isInFinisher )
  4025. {
  4026. return false;
  4027. }
  4028.  
  4029. if ( action != EBAT_SpecialAttack_Heavy )
  4030. specialAttackCamera = false;
  4031.  
  4032.  
  4033. if(super.ProcessCombatActionBuffer())
  4034. return true;
  4035.  
  4036. switch ( action )
  4037. {
  4038. case EBAT_CastSign :
  4039. {
  4040. switch ( stage )
  4041. {
  4042. case BS_Pressed :
  4043. {
  4044.  
  4045.  
  4046.  
  4047.  
  4048.  
  4049.  
  4050. actionResult = this.CastSign();
  4051. LogChannel('SignDebug', "CastSign()");
  4052.  
  4053.  
  4054. } break;
  4055.  
  4056. default :
  4057. {
  4058. actionResult = false;
  4059. } break;
  4060. }
  4061. } break;
  4062.  
  4063. case EBAT_SpecialAttack_Light :
  4064. {
  4065. switch ( stage )
  4066. {
  4067. case BS_Pressed :
  4068. {
  4069.  
  4070. actionResult = this.OnPerformSpecialAttack( true, true );
  4071. } break;
  4072.  
  4073. case BS_Released :
  4074. {
  4075. actionResult = this.OnPerformSpecialAttack( true, false );
  4076. } break;
  4077.  
  4078. default :
  4079. {
  4080. actionResult = false;
  4081. } break;
  4082. }
  4083. } break;
  4084.  
  4085. case EBAT_SpecialAttack_Heavy :
  4086. {
  4087. switch ( stage )
  4088. {
  4089. case BS_Pressed :
  4090. {
  4091.  
  4092. actionResult = this.OnPerformSpecialAttack( false, true );
  4093. } break;
  4094.  
  4095. case BS_Released :
  4096. {
  4097. actionResult = this.OnPerformSpecialAttack( false, false );
  4098. } break;
  4099.  
  4100. default :
  4101. {
  4102. actionResult = false;
  4103. } break;
  4104. }
  4105. } break;
  4106.  
  4107. default:
  4108. return false;
  4109. }
  4110.  
  4111.  
  4112. this.CleanCombatActionBuffer();
  4113.  
  4114. if (actionResult)
  4115. {
  4116. SetCombatAction( action ) ;
  4117. }
  4118.  
  4119. return true;
  4120. }
  4121.  
  4122.  
  4123. event OnPerformSpecialAttack( isLightAttack : bool, enableAttack : bool ){}
  4124.  
  4125. public final function GetEnemies() : array< CActor >
  4126. {
  4127. var actors, actors2 : array<CActor>;
  4128. var i : int;
  4129.  
  4130.  
  4131. actors = GetWitcherPlayer().GetHostileEnemies();
  4132. ArrayOfActorsAppendUnique( actors, GetWitcherPlayer().GetMoveTargets() );
  4133.  
  4134.  
  4135. thePlayer.GetVisibleEnemies( actors2 );
  4136. ArrayOfActorsAppendUnique( actors, actors2 );
  4137.  
  4138. for( i=actors.Size()-1; i>=0; i-=1 )
  4139. {
  4140. if( !IsRequiredAttitudeBetween( actors[i], this, true ) )
  4141. {
  4142. actors.EraseFast( i );
  4143. }
  4144. }
  4145.  
  4146. return actors;
  4147. }
  4148.  
  4149. event OnPlayerTickTimer( deltaTime : float )
  4150. {
  4151. super.OnPlayerTickTimer( deltaTime );
  4152.  
  4153. if ( !IsInCombat() )
  4154. {
  4155. fastAttackCounter = 0;
  4156. heavyAttackCounter = 0;
  4157. }
  4158. WmkGetMapMenuInstance().OnTick(deltaTime); // -= WMK:modAQOOM =-
  4159. }
  4160.  
  4161.  
  4162.  
  4163.  
  4164.  
  4165. 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
  4166. {
  4167. var ret : bool;
  4168. var skill : ESkill;
  4169.  
  4170. ret = super.PrepareAttackAction(hitTarget, animData, weaponId, parried, countered, parriedBy, attackAnimationName, hitTime, weaponEntity, attackAction);
  4171.  
  4172. if(!ret)
  4173. return false;
  4174.  
  4175.  
  4176. if(attackAction.IsActionMelee())
  4177. {
  4178. skill = SkillNameToEnum( attackAction.GetAttackTypeName() );
  4179. if( skill != S_SUndefined && CanUseSkill(skill))
  4180. {
  4181. if(IsLightAttack(animData.attackName))
  4182. fastAttackCounter += 1;
  4183. else
  4184. fastAttackCounter = 0;
  4185.  
  4186. if(IsHeavyAttack(animData.attackName))
  4187. heavyAttackCounter += 1;
  4188. else
  4189. heavyAttackCounter = 0;
  4190. }
  4191. }
  4192.  
  4193. AddTimer('FastAttackCounterDecay',5.0);
  4194. AddTimer('HeavyAttackCounterDecay',5.0);
  4195.  
  4196. return true;
  4197. }
  4198.  
  4199. protected function TestParryAndCounter(data : CPreAttackEventData, weaponId : SItemUniqueId, out parried : bool, out countered : bool) : array<CActor>
  4200. {
  4201.  
  4202. if(SkillNameToEnum(attackActionName) == S_Sword_s02)
  4203. data.Can_Parry_Attack = false;
  4204.  
  4205. return super.TestParryAndCounter(data, weaponId, parried, countered);
  4206. }
  4207.  
  4208. private timer function FastAttackCounterDecay(delta : float, id : int)
  4209. {
  4210. fastAttackCounter = 0;
  4211. }
  4212.  
  4213. private timer function HeavyAttackCounterDecay(delta : float, id : int)
  4214. {
  4215. heavyAttackCounter = 0;
  4216. }
  4217.  
  4218.  
  4219. public function GetCraftingSchematicsNames() : array<name> {return craftingSchematics;}
  4220.  
  4221. public function RemoveAllCraftingSchematics()
  4222. {
  4223. craftingSchematics.Clear();
  4224. }
  4225.  
  4226.  
  4227. function AddCraftingSchematic( nam : name, optional isSilent : bool, optional skipTutorialUpdate : bool ) : bool
  4228. {
  4229. var i : int;
  4230.  
  4231. if(!skipTutorialUpdate && ShouldProcessTutorial('TutorialCraftingGotRecipe'))
  4232. {
  4233. FactsAdd("tut_received_schematic");
  4234. }
  4235.  
  4236. for(i=0; i<craftingSchematics.Size(); i+=1)
  4237. {
  4238. if(craftingSchematics[i] == nam)
  4239. return false;
  4240.  
  4241.  
  4242. if(StrCmp(craftingSchematics[i],nam) > 0)
  4243. {
  4244. craftingSchematics.Insert(i,nam);
  4245. AddCraftingHudNotification( nam, isSilent );
  4246. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_CraftingSchematics );
  4247. return true;
  4248. }
  4249. }
  4250.  
  4251.  
  4252. craftingSchematics.PushBack(nam);
  4253. AddCraftingHudNotification( nam, isSilent );
  4254. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_CraftingSchematics );
  4255. return true;
  4256. }
  4257.  
  4258. function AddCraftingHudNotification( nam : name, isSilent : bool )
  4259. {
  4260. var hud : CR4ScriptedHud;
  4261. if( !isSilent )
  4262. {
  4263. hud = (CR4ScriptedHud)theGame.GetHud();
  4264. if( hud )
  4265. {
  4266. hud.OnCraftingSchematicUpdate( nam );
  4267. }
  4268. }
  4269. }
  4270.  
  4271. function AddAlchemyHudNotification( nam : name, isSilent : bool )
  4272. {
  4273. var hud : CR4ScriptedHud;
  4274. if( !isSilent )
  4275. {
  4276. hud = (CR4ScriptedHud)theGame.GetHud();
  4277. if( hud )
  4278. {
  4279. hud.OnAlchemySchematicUpdate( nam );
  4280. }
  4281. }
  4282. }
  4283.  
  4284. public function GetExpandedCraftingCategories() : array< name >
  4285. {
  4286. return expandedCraftingCategories;
  4287. }
  4288.  
  4289. public function AddExpandedCraftingCategory( category : name )
  4290. {
  4291. if ( IsNameValid( category ) )
  4292. {
  4293. ArrayOfNamesPushBackUnique( expandedCraftingCategories, category );
  4294. }
  4295. }
  4296.  
  4297. public function RemoveExpandedCraftingCategory( category : name )
  4298. {
  4299. if ( IsNameValid( category ) )
  4300. {
  4301. expandedCraftingCategories.Remove( category );
  4302. }
  4303. }
  4304.  
  4305. public function SetCraftingFilters(showHasIngre : bool, showMissingIngre : bool, showAlreadyCrafted : bool )
  4306. {
  4307. craftingFilters.showCraftable = showHasIngre;
  4308. craftingFilters.showMissingIngre = showMissingIngre;
  4309. craftingFilters.showAlreadyCrafted = showAlreadyCrafted;
  4310. }
  4311.  
  4312. public function GetCraftingFilters() : SCraftingFilters
  4313. {
  4314.  
  4315. if ( craftingFilters.showCraftable == false && craftingFilters.showMissingIngre == false && craftingFilters.showAlreadyCrafted == false )
  4316. {
  4317. craftingFilters.showCraftable = true;
  4318. craftingFilters.showMissingIngre = true;
  4319. craftingFilters.showAlreadyCrafted = false;
  4320. }
  4321.  
  4322. return craftingFilters;
  4323. }
  4324.  
  4325.  
  4326.  
  4327.  
  4328.  
  4329. event OnMutation11Triggered()
  4330. {
  4331. var min, max : SAbilityAttributeValue;
  4332. var healValue : float;
  4333. var quenEntity : W3QuenEntity;
  4334.  
  4335.  
  4336. if( IsSwimming() || IsDiving() || IsSailing() || IsUsingHorse() || IsUsingBoat() || IsUsingVehicle() || IsUsingExploration() )
  4337. {
  4338.  
  4339. //ForceSetStat( BCS_Vitality, GetStatMax( BCS_Vitality ) );
  4340. //
  4341. //
  4342. //theGame.MutationHUDFeedback( MFT_PlayOnce );
  4343. //
  4344. //
  4345. //GCameraShake( 1.0f, , , , true, 'camera_shake_loop_lvl1_1' );
  4346. //AddTimer( 'StopMutation11CamShake', 2.f );
  4347. //
  4348. //
  4349. //theGame.VibrateControllerVeryHard( 2.f );
  4350. //
  4351. //
  4352. //Mutation11ShockWave( true );
  4353.  
  4354.  
  4355. AddEffectDefault( EET_Mutation11Debuff, NULL, "Mutation 11 Debuff", false );
  4356. }
  4357. else
  4358. {
  4359. AddEffectDefault( EET_Mutation11Buff, this, "Mutation 11", false );
  4360. }
  4361. }
  4362.  
  4363. timer function StopMutation11CamShake( dt : float, id : int )
  4364. {
  4365. theGame.GetGameCamera().StopAnimation( 'camera_shake_loop_lvl1_1' );
  4366. }
  4367.  
  4368. private var mutation12IsOnCooldown : bool;
  4369.  
  4370. public final function AddMutation12Decoction()
  4371. {
  4372. var params : SCustomEffectParams;
  4373. var buffs : array< EEffectType >;
  4374. var existingDecoctionBuffs : array<CBaseGameplayEffect>;
  4375. var i : int;
  4376. var effectType : EEffectType;
  4377. var decoctions : array< SItemUniqueId >;
  4378. var tmpName : name;
  4379. var min, max : SAbilityAttributeValue;
  4380.  
  4381. if( mutation12IsOnCooldown )
  4382. {
  4383. return;
  4384. }
  4385.  
  4386.  
  4387. existingDecoctionBuffs = GetDrunkMutagens( "Mutation12" );
  4388. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation12', 'maxcap', min, max );
  4389. if( existingDecoctionBuffs.Size() >= min.valueAdditive )
  4390. {
  4391. return;
  4392. }
  4393.  
  4394.  
  4395. mutation12IsOnCooldown = true;
  4396. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation12', 'cooldown', min, max );
  4397. AddTimer( 'Mutation12Cooldown', CalculateAttributeValue( min ) );
  4398.  
  4399.  
  4400. decoctions = inv.GetItemsByTag( 'Mutagen' );
  4401.  
  4402.  
  4403. for( i=decoctions.Size()-1; i>=0; i-=1 )
  4404. {
  4405. inv.GetPotionItemBuffData( decoctions[i], effectType, tmpName );
  4406. if( HasBuff( effectType ) )
  4407. {
  4408. decoctions.EraseFast( i );
  4409. continue;
  4410. }
  4411. buffs.PushBack( effectType );
  4412. }
  4413.  
  4414.  
  4415. if( buffs.Size() == 0 )
  4416. {
  4417. for( i=EET_Mutagen01; i<=EET_Mutagen28; i+=1 )
  4418. {
  4419. if( !HasBuff( i ) )
  4420. {
  4421. buffs.PushBack( i );
  4422. }
  4423. }
  4424. }
  4425.  
  4426.  
  4427. //buffs.Remove( EET_Mutagen16 ); //modSigns
  4428. //buffs.Remove( EET_Mutagen24 ); //modSigns
  4429.  
  4430.  
  4431. if( buffs.Size() == 0 )
  4432. {
  4433. return;
  4434. }
  4435.  
  4436.  
  4437. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation12', 'duration', min, max );
  4438. params.effectType = buffs[ RandRange( buffs.Size() ) ];
  4439. params.creator = this;
  4440. params.sourceName = "Mutation12";
  4441. params.duration = min.valueAdditive;
  4442. AddEffectCustom( params );
  4443. ( ( W3Mutagen_Effect ) GetBuff( params.effectType, params.sourceName ) ).OverrideIcon( DecoctionEffectTypeToItemName( params.effectType ) );
  4444.  
  4445.  
  4446. if ( !IsEffectActive( 'invisible' ) )
  4447. {
  4448. PlayEffect( 'use_potion' );
  4449. }
  4450.  
  4451. theGame.MutationHUDFeedback( MFT_PlayOnce );
  4452. }
  4453.  
  4454. timer function Mutation12Cooldown( dt : float, id : int )
  4455. {
  4456. mutation12IsOnCooldown = false;
  4457. }
  4458.  
  4459.  
  4460. public final function HasResourcesToStartAnyMutationResearch() : bool
  4461. {
  4462. var greenPoints, redPoints, bluePoints, count : int;
  4463. var itemIDs : array< SItemUniqueId >;
  4464.  
  4465. if( levelManager.GetPointsFree( ESkillPoint ) > 0 )
  4466. {
  4467. return true;
  4468. }
  4469.  
  4470.  
  4471. count = inv.GetItemQuantityByName( 'Greater mutagen green' );
  4472. if( count > 0 )
  4473. {
  4474. itemIDs = inv.GetItemsByName( 'Greater mutagen green' );
  4475. greenPoints = inv.GetMutationResearchPoints( SC_Green, itemIDs[0] );
  4476. if( greenPoints > 0 )
  4477. {
  4478. return true;
  4479. }
  4480. }
  4481. count = inv.GetItemQuantityByName( 'Greater mutagen red' );
  4482. if( count > 0 )
  4483. {
  4484. itemIDs.Clear();
  4485. itemIDs = inv.GetItemsByName( 'Greater mutagen red' );
  4486. redPoints = inv.GetMutationResearchPoints( SC_Red, itemIDs[0] );
  4487. if( redPoints > 0 )
  4488. {
  4489. return true;
  4490. }
  4491. }
  4492. count = inv.GetItemQuantityByName( 'Greater mutagen blue' );
  4493. if( count > 0 )
  4494. {
  4495. itemIDs.Clear();
  4496. itemIDs = inv.GetItemsByName( 'Greater mutagen blue' );
  4497. bluePoints = inv.GetMutationResearchPoints( SC_Blue, itemIDs[0] );
  4498. if( bluePoints > 0 )
  4499. {
  4500. return true;
  4501. }
  4502. }
  4503.  
  4504. return false;
  4505. }
  4506.  
  4507.  
  4508. public final function Mutation11StartAnimation()
  4509. {
  4510.  
  4511. thePlayer.ActionPlaySlotAnimationAsync( 'PLAYER_SLOT', 'geralt_mutation_11', 0.2, 0.2 );
  4512.  
  4513.  
  4514. BlockAllActions( 'Mutation11', true );
  4515.  
  4516.  
  4517. loopingCameraShakeAnimName = 'camera_shake_loop_lvl1_1';
  4518. GCameraShake( 1.0f, , , , true, loopingCameraShakeAnimName );
  4519.  
  4520.  
  4521. theGame.VibrateControllerVeryHard( 15.f );
  4522.  
  4523.  
  4524. storedInteractionPriority = GetInteractionPriority();
  4525. SetInteractionPriority( IP_Max_Unpushable );
  4526. }
  4527.  
  4528. event OnAnimEvent_Mutation11ShockWave( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4529. {
  4530. Mutation11ShockWave( false );
  4531. }
  4532.  
  4533. private final function Mutation11ShockWave( skipQuenSign : bool )
  4534. {
  4535. var action : W3DamageAction;
  4536. var ents : array< CGameplayEntity >;
  4537. var i, j : int;
  4538. var damages : array< SRawDamage >;
  4539.  
  4540.  
  4541. FindGameplayEntitiesInSphere(ents, GetWorldPosition(), 5.f, 1000, '', FLAG_OnlyAliveActors + FLAG_ExcludeTarget + FLAG_Attitude_Hostile + FLAG_Attitude_Neutral, this);
  4542.  
  4543. if( ents.Size() > 0 )
  4544. {
  4545. damages = theGame.GetDefinitionsManager().GetDamagesFromAbility( 'Mutation11' );
  4546. }
  4547.  
  4548.  
  4549. for(i=0; i<ents.Size(); i+=1)
  4550. {
  4551. action = new W3DamageAction in theGame;
  4552. action.Initialize( this, ents[i], NULL, "Mutation11", EHRT_Heavy, CPS_SpellPower, false, false, true, false );
  4553.  
  4554. for( j=0; j<damages.Size(); j+=1 )
  4555. {
  4556. action.AddDamage( damages[j].dmgType, damages[j].dmgVal );
  4557. }
  4558.  
  4559. action.SetCannotReturnDamage( true );
  4560. action.SetProcessBuffsIfNoDamage( true );
  4561. action.AddEffectInfo( EET_KnockdownTypeApplicator );
  4562. action.SetHitAnimationPlayType( EAHA_ForceYes );
  4563. action.SetCanPlayHitParticle( false );
  4564.  
  4565. theGame.damageMgr.ProcessAction( action );
  4566. delete action;
  4567. }
  4568.  
  4569.  
  4570.  
  4571.  
  4572.  
  4573. mutation11QuenEntity = ( W3QuenEntity )GetSignEntity( ST_Quen );
  4574. if( !mutation11QuenEntity )
  4575. {
  4576. mutation11QuenEntity = (W3QuenEntity)theGame.CreateEntity( GetSignTemplate( ST_Quen ), GetWorldPosition(), GetWorldRotation() );
  4577. mutation11QuenEntity.CreateAttachment( this, 'quen_sphere' );
  4578. AddTimer( 'DestroyMutation11QuenEntity', 2.f );
  4579. }
  4580. mutation11QuenEntity.PlayHitEffect( 'quen_impulse_explode', mutation11QuenEntity.GetWorldRotation() );
  4581.  
  4582. if( !skipQuenSign )
  4583. {
  4584.  
  4585. PlayEffect( 'mutation_11_second_life' );
  4586.  
  4587.  
  4588. RestoreQuen( 1000000.f, 10.f, true );
  4589. }
  4590. }
  4591.  
  4592. private var mutation11QuenEntity : W3QuenEntity;
  4593. private var storedInteractionPriority : EInteractionPriority;
  4594.  
  4595. timer function DestroyMutation11QuenEntity( dt : float, id : int )
  4596. {
  4597. if( mutation11QuenEntity )
  4598. {
  4599. mutation11QuenEntity.Destroy();
  4600. }
  4601. }
  4602.  
  4603. event OnAnimEvent_Mutation11AnimEnd( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4604. {
  4605. if( animEventType == AET_DurationEnd )
  4606. {
  4607.  
  4608. BlockAllActions( 'Mutation11', false );
  4609.  
  4610.  
  4611. theGame.GetGameCamera().StopAnimation( 'camera_shake_loop_lvl1_1' );
  4612.  
  4613.  
  4614. theGame.StopVibrateController();
  4615.  
  4616.  
  4617. SetInteractionPriority( storedInteractionPriority );
  4618.  
  4619.  
  4620. RemoveBuff( EET_Mutation11Buff, true );
  4621. }
  4622. else if ( animEventType == AET_DurationStart || animEventType == AET_DurationStartInTheMiddle )
  4623. {
  4624.  
  4625. SetBehaviorVariable( 'AIControlled', 0.f );
  4626. }
  4627. }
  4628.  
  4629. //modSigns
  4630. public final function Mutation11GetBaseStrength() : float
  4631. {
  4632. var drainStrength : float;
  4633. var swordDmg, avAP, avSI : float;
  4634. var abl : SAbilityAttributeValue;
  4635. var curStats : SPlayerOffenseStats;
  4636. var sword : SItemUniqueId;
  4637.  
  4638. //avSI
  4639. abl = GetTotalSignSpellPower(S_Magic_1);
  4640. abl += GetTotalSignSpellPower(S_Magic_2);
  4641. abl += GetTotalSignSpellPower(S_Magic_3);
  4642. abl += GetTotalSignSpellPower(S_Magic_4);
  4643. abl += GetTotalSignSpellPower(S_Magic_5);
  4644. avSI = MaxF(0.0, abl.valueMultiplicative / 5.0 - 1.0) * 100;
  4645. //theGame.witcherLog.AddMessage("Mutation11 avSI = " + avSI);
  4646. //avAP
  4647. curStats = GetOffenseStatsList();
  4648. avAP = MaxF(0.0,
  4649. ( curStats.steelFastAP * (1 - curStats.steelFastCritChance/100.0) + curStats.steelFastCritAP * curStats.steelFastCritChance/100.0
  4650. + curStats.silverFastAP * (1 - curStats.silverFastCritChance/100.0) + curStats.silverFastCritAP * curStats.silverFastCritChance/100.0
  4651. + curStats.steelStrongAP * (1 - curStats.steelStrongCritChance/100.0) + curStats.steelStrongCritAP * curStats.steelStrongCritChance/100.0
  4652. + curStats.silverStrongAP * (1 - curStats.silverStrongCritChance/100.0) + curStats.silverStrongCritAP * curStats.silverStrongCritChance/100.0
  4653. )/4.0
  4654. ) * 100;
  4655. //theGame.witcherLog.AddMessage("Mutation11 avAP = " + avAP);
  4656. //swordDmg
  4657. sword = inv.GetCurrentlyHeldSword();
  4658. if( sword == GetInvalidUniqueId() )
  4659. {
  4660. GetItemEquippedOnSlot(EES_SteelSword, sword);
  4661. if( sword == GetInvalidUniqueId() )
  4662. GetItemEquippedOnSlot(EES_SilverSword, sword);
  4663. }
  4664. if( sword != GetInvalidUniqueId() )
  4665. {
  4666. if( inv.GetItemCategory(sword) == 'steelsword' )
  4667. swordDmg = GetTotalWeaponDamage(sword, theGame.params.DAMAGE_NAME_SLASHING, GetInvalidUniqueId());
  4668. else if( inv.GetItemCategory(sword) == 'silversword' )
  4669. swordDmg = GetTotalWeaponDamage(sword, theGame.params.DAMAGE_NAME_SILVER, GetInvalidUniqueId());
  4670. }
  4671. //theGame.witcherLog.AddMessage("Mutation11 swordDmg = " + swordDmg);
  4672. drainStrength = swordDmg + avAP + avSI;
  4673. //theGame.witcherLog.AddMessage("Mutation11 drainStrength = " + drainStrength);
  4674. return drainStrength;
  4675. }
  4676.  
  4677. public final function MutationSystemEnable( enable : bool )
  4678. {
  4679. ( ( W3PlayerAbilityManager ) abilityManager ).MutationSystemEnable( enable );
  4680. }
  4681.  
  4682. public final function IsMutationSystemEnabled() : bool
  4683. {
  4684. return ( ( W3PlayerAbilityManager ) abilityManager ).IsMutationSystemEnabled();
  4685. }
  4686.  
  4687. public final function GetMutation( mutationType : EPlayerMutationType ) : SMutation
  4688. {
  4689. return ( ( W3PlayerAbilityManager ) abilityManager ).GetMutation( mutationType );
  4690. }
  4691.  
  4692. public final function IsMutationActive( mutationType : EPlayerMutationType) : bool
  4693. {
  4694. var swordQuality : int;
  4695. var sword : SItemUniqueId;
  4696.  
  4697. if( GetEquippedMutationType() != mutationType )
  4698. {
  4699. return false;
  4700. }
  4701.  
  4702. switch( mutationType )
  4703. {
  4704. case EPMT_Mutation4 :
  4705. case EPMT_Mutation5 :
  4706. case EPMT_Mutation7 :
  4707. case EPMT_Mutation8 :
  4708. case EPMT_Mutation10 :
  4709. case EPMT_Mutation11 :
  4710. case EPMT_Mutation12 :
  4711. if( IsInFistFight() )
  4712. {
  4713. return false;
  4714. }
  4715. }
  4716.  
  4717. if( mutationType == EPMT_Mutation1 )
  4718. {
  4719. sword = inv.GetCurrentlyHeldSword();
  4720. swordQuality = inv.GetItemQuality( sword );
  4721.  
  4722.  
  4723. if( swordQuality < 3 )
  4724. {
  4725. return false;
  4726. }
  4727. }
  4728.  
  4729. return true;
  4730. }
  4731.  
  4732. public final function SetEquippedMutation( mutationType : EPlayerMutationType ) : bool
  4733. {
  4734. return ( ( W3PlayerAbilityManager ) abilityManager ).SetEquippedMutation( mutationType );
  4735. }
  4736.  
  4737. public final function GetEquippedMutationType() : EPlayerMutationType
  4738. {
  4739. return ( ( W3PlayerAbilityManager ) abilityManager ).GetEquippedMutationType();
  4740. }
  4741.  
  4742. // CA
  4743. timer function CAApplyOil( dt : float, id : int ) { super.ApplyOil( completeAnims.oilId, completeAnims.usedOnItem ); }
  4744. timer function CAContainerProcessLoot( dt : float, id : int ) { var lootData : W3LootPopupData; lootData = new W3LootPopupData in completeAnims.container; lootData.targetContainer = completeAnims.container; theGame.RequestPopup('LootPopup', lootData); }
  4745. timer function CAConsume( time : float, id : int ) { ConsumeItem( completeAnims.ItemToConsume ); }
  4746. timer function CADrinkPotion( time : float, id : int ) { DrinkPreparedPotion(completeAnims.SlotToConsume); }
  4747. timer function CADrinkPotionInv( time : float, id : int ) { DrinkPreparedPotion(completeAnims.SlotToConsume, completeAnims.ItemToConsume ); }
  4748. timer function CARepairBuffWeapon( dt : float, id : int ) {
  4749. AddEffectDefault(EET_EnhancedWeapon, this, "repair_object", false);
  4750. DisplayHudMessage(GetLocStringByKeyExt("panel_hud_message_repair_done"));
  4751. SoundEvent("gui_inventory_silversword_attach");
  4752. }
  4753. timer function CARepairBuffArmor( dt : float, id : int ) {
  4754. AddEffectDefault(EET_EnhancedArmor, this, "repair_object", false);
  4755. DisplayHudMessage(GetLocStringByKeyExt("panel_hud_message_repair_done"));
  4756. SoundEvent("gui_inventory_armor_attach");
  4757. }
  4758. // CA
  4759.  
  4760. public final function CanEquipMutation(mutationType : EPlayerMutationType) : bool
  4761. {
  4762. return ( ( W3PlayerAbilityManager ) abilityManager ).CanEquipMutation( mutationType );
  4763. }
  4764.  
  4765. public final function CanResearchMutation( mutationType : EPlayerMutationType ) : bool
  4766. {
  4767. return ( ( W3PlayerAbilityManager ) abilityManager ).CanResearchMutation( mutationType );
  4768. }
  4769.  
  4770. public final function IsMutationResearched(mutationType : EPlayerMutationType) : bool
  4771. {
  4772. return ( ( W3PlayerAbilityManager ) abilityManager ).IsMutationResearched( mutationType );
  4773. }
  4774.  
  4775. public final function GetMutationResearchProgress(mutationType : EPlayerMutationType) : int
  4776. {
  4777. return ( ( W3PlayerAbilityManager ) abilityManager ).GetMutationResearchProgress( mutationType );
  4778. }
  4779.  
  4780. public final function GetMasterMutationStage() : int
  4781. {
  4782. return ( ( W3PlayerAbilityManager ) abilityManager ).GetMasterMutationStage();
  4783. }
  4784.  
  4785. public final function MutationResearchWithSkillPoints(mutation : EPlayerMutationType, skillPoints : int) : bool
  4786. {
  4787. return ( ( W3PlayerAbilityManager ) abilityManager ).MutationResearchWithSkillPoints( mutation, skillPoints );
  4788. }
  4789.  
  4790. public final function MutationResearchWithItem(mutation : EPlayerMutationType, item : SItemUniqueId, optional count: int) : bool
  4791. {
  4792. return ( ( W3PlayerAbilityManager ) abilityManager ).MutationResearchWithItem( mutation, item, count );
  4793. }
  4794.  
  4795. public final function GetMutationLocalizedName( mutationType : EPlayerMutationType ) : string
  4796. {
  4797. var pam : W3PlayerAbilityManager;
  4798. var locKey : name;
  4799.  
  4800. pam = (W3PlayerAbilityManager)GetWitcherPlayer().abilityManager;
  4801. locKey = pam.GetMutationNameLocalizationKey( mutationType );
  4802.  
  4803. return GetLocStringByKeyExt( locKey );
  4804. }
  4805.  
  4806. public final function GetMutationLocalizedDescription( mutationType : EPlayerMutationType ) : string
  4807. {
  4808. var pam : W3PlayerAbilityManager;
  4809. var locKey : name;
  4810. var arrStr : array< string >;
  4811. var dm : CDefinitionsManagerAccessor;
  4812. var min, max, sp : SAbilityAttributeValue;
  4813. var tmp, tmp2, tox, critBonusDamage, val : float;
  4814. var stats, stats2 : SPlayerOffenseStats;
  4815. var buffPerc, exampleEnemyCount, debuffPerc : int;
  4816.  
  4817. pam = (W3PlayerAbilityManager)GetWitcherPlayer().abilityManager;
  4818. locKey = pam.GetMutationDescriptionLocalizationKey( mutationType );
  4819. dm = theGame.GetDefinitionsManager();
  4820.  
  4821. switch( mutationType )
  4822. {
  4823. case EPMT_Mutation1 :
  4824. dm.GetAbilityAttributeValue('Mutation1', 'dmg_bonus_factor', min, max);
  4825. arrStr.PushBack( NoTrailZeros( RoundMath( 100 * min.valueAdditive ) ) );
  4826. break;
  4827.  
  4828. case EPMT_Mutation2 :
  4829. sp = GetPowerStatValue( CPS_SpellPower );
  4830.  
  4831.  
  4832. dm.GetAbilityAttributeValue( 'Mutation2', 'crit_chance_factor', min, max );
  4833. //arrStr.PushBack( NoTrailZeros( RoundMath( 100 * ( min.valueAdditive + sp.valueMultiplicative * min.valueMultiplicative ) ) ) );
  4834. //modSigns: changing the formula
  4835. arrStr.PushBack( NoTrailZeros( RoundMath( 100 * ( ClampF(min.valueAdditive + SignPowerStatToPowerBonus(sp.valueMultiplicative) * min.valueMultiplicative, 0.f, 1.f) ) ) ) );
  4836.  
  4837.  
  4838. dm.GetAbilityAttributeValue( 'Mutation2', 'crit_damage_factor', min, max );
  4839. //critBonusDamage = sp.valueMultiplicative * min.valueMultiplicative;
  4840. //modSigns: changing the formula
  4841. critBonusDamage = min.valueAdditive + SignPowerStatToPowerBonus(sp.valueMultiplicative) * min.valueMultiplicative;
  4842.  
  4843. arrStr.PushBack( NoTrailZeros( RoundMath( 100 * critBonusDamage ) ) );
  4844. break;
  4845.  
  4846. case EPMT_Mutation3 : //modSigns: mutation reworked
  4847.  
  4848. dm.GetAbilityAttributeValue('Mutation3', 'attack_power', min, max);
  4849. tmp = min.valueMultiplicative;
  4850.  
  4851. dm.GetAbilityAttributeValue('Mutation3', 'mutation3_buff_rate_sword', min, max);
  4852. tmp2 = tmp * min.valueAdditive;
  4853. arrStr.PushBack( NoTrailZeros( 100 * tmp2 ) );
  4854. dm.GetAbilityAttributeValue('Mutation3', 'mutation3_buff_rate_other', min, max);
  4855. tmp2 = tmp * min.valueAdditive;
  4856. arrStr.PushBack( NoTrailZeros( 100 * tmp2 ) );
  4857. dm.GetAbilityAttributeValue('Mutation3', 'mutation3_debuff_rate', min, max);
  4858. tmp2 = tmp * min.valueAdditive;
  4859. arrStr.PushBack( NoTrailZeros( 100 * tmp2 ) );
  4860. dm.GetAbilityAttributeValue('Mutation3', 'mutation3_buff_rate_kill', min, max);
  4861. tmp2 = tmp * min.valueAdditive;
  4862. arrStr.PushBack( NoTrailZeros( 100 * tmp2 ) );
  4863. dm.GetAbilityAttributeValue('Mutation3', 'mutation3_maxcap', min, max);
  4864. tmp2 = tmp * min.valueAdditive;
  4865. arrStr.PushBack( NoTrailZeros( 100 * tmp2 ) );
  4866.  
  4867. //dm.GetAbilityAttributeValue( 'Mutation3', 'attack_power', min, max );
  4868. //tmp = min.valueMultiplicative;
  4869. //arrStr.PushBack( NoTrailZeros( RoundMath( 100 * tmp ) ) );
  4870. //dm.GetAbilityAttributeValue( 'Mutation3', 'maxcap', min, max );
  4871. //arrStr.PushBack( NoTrailZeros( RoundMath( 100 * tmp * min.valueAdditive ) ) );
  4872. break;
  4873.  
  4874. case EPMT_Mutation4 : //modSigns: mutation reworked
  4875.  
  4876. dm.GetAbilityAttributeValue( 'Mutation4', 'toxicityRegenFactor', min, max );
  4877. tmp = min.valueAdditive;
  4878. arrStr.PushBack( NoTrailZeros( tmp * 100 ) );
  4879.  
  4880. dm.GetAbilityAttributeValue( 'AcidEffect', 'DirectDamage', min, max );
  4881. tmp = min.valueAdditive;
  4882. arrStr.PushBack( NoTrailZeros( tmp ) );
  4883.  
  4884. arrStr.PushBack( NoTrailZeros( RoundMath( tmp * GetStat( BCS_Toxicity ) ) ) );
  4885. arrStr.PushBack( NoTrailZeros( RoundMath( tmp * GetStatMax( BCS_Toxicity ) ) ) );
  4886.  
  4887. dm.GetAbilityAttributeValue( 'AcidEffect', 'duration', min, max );
  4888. tmp = min.valueAdditive;
  4889. arrStr.PushBack( NoTrailZeros( tmp ) );
  4890.  
  4891. dm.GetAbilityAttributeValue( 'Mutation4BloodDebuff', 'staminaRegen', min, max );
  4892. tmp = AbsF( min.valueMultiplicative ) * 100;
  4893. arrStr.PushBack( NoTrailZeros( tmp ) );
  4894. break;
  4895.  
  4896. case EPMT_Mutation5 :
  4897.  
  4898. //dm.GetAbilityAttributeValue( 'Mutation5', 'mut5_dmg_red_perc', min, max );
  4899. //tmp = min.valueAdditive;
  4900. //arrStr.PushBack( NoTrailZeros( 100 * tmp ) );
  4901. //
  4902. //
  4903. //arrStr.PushBack( NoTrailZeros( 100 * tmp * 3 ) );
  4904.  
  4905. //modSigns: mutation changed
  4906. dm.GetAbilityAttributeValue( 'Mutation5', 'mut5_duration_per_point', min, max );
  4907. arrStr.PushBack( NoTrailZeros( min.valueAdditive ) );
  4908. arrStr.PushBack( NoTrailZeros( min.valueAdditive * GetStatMax(BCS_Focus) ) );
  4909. arrStr.PushBack( NoTrailZeros( min.valueAdditive ) );
  4910.  
  4911. break;
  4912.  
  4913. case EPMT_Mutation6 :
  4914. //modSigns: raw and total damage
  4915. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation6', 'full_freeze_chance', min, max );
  4916. arrStr.PushBack( RoundMath( 100 * min.valueMultiplicative ) );
  4917. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation6', 'ForceDamage', min, max );
  4918. val = CalculateAttributeValue( min );
  4919. arrStr.PushBack( RoundMath( val ) );
  4920. sp = GetTotalSignSpellPower( S_Magic_1 );
  4921. arrStr.PushBack( RoundMath( val * sp.valueMultiplicative ) );
  4922.  
  4923. break;
  4924.  
  4925. case EPMT_Mutation7 : //modSigns: changed
  4926.  
  4927. dm.GetAbilityAttributeValue( 'Mutation7BuffEffect', 'duration', min, max );
  4928. arrStr.PushBack( NoTrailZeros( min.valueAdditive ) );
  4929.  
  4930. dm.GetAbilityAttributeValue( 'Mutation7Buff', 'attack_power', min, max );
  4931. buffPerc = RoundMath( 100 * min.valueMultiplicative );
  4932. arrStr.PushBack( NoTrailZeros( buffPerc ) );
  4933.  
  4934. dm.GetAbilityAttributeValue( 'Mutation7DebuffEffect', 'duration', min, max );
  4935. arrStr.PushBack( NoTrailZeros( min.valueAdditive ) );
  4936.  
  4937. dm.GetAbilityAttributeValue( 'Mutation7Debuff', 'attack_power', min, max );
  4938. buffPerc = RoundMath( -100 * min.valueMultiplicative );
  4939. arrStr.PushBack( NoTrailZeros( buffPerc ) );
  4940.  
  4941. break;
  4942.  
  4943. case EPMT_Mutation8 : //modSigns: changed
  4944.  
  4945. dm.GetAbilityAttributeValue( 'Mutation8', 'hp_perc_trigger', min, max );
  4946. arrStr.PushBack( NoTrailZeros( 100 * min.valueMultiplicative ) );
  4947.  
  4948. dm.GetAbilityAttributeValue( 'Mutation8', 'dmg_bonus', min, max );
  4949. arrStr.PushBack( FloatToStringPrec( 100 * min.valueMultiplicative, 0 ) );
  4950.  
  4951. arrStr.PushBack( FloatToStringPrec( 100 * min.valueMultiplicative * GetStatMax(BCS_Focus), 0 ) );
  4952.  
  4953. break;
  4954.  
  4955. case EPMT_Mutation9 : //modSigns: changed
  4956.  
  4957.  
  4958.  
  4959.  
  4960. //stats = GetOffenseStatsList( 1 );
  4961. //arrStr.PushBack( NoTrailZeros( RoundMath( stats.crossbowSteelDmg ) ) );
  4962.  
  4963.  
  4964. //stats2 = GetOffenseStatsList( 2 );
  4965. //arrStr.PushBack( NoTrailZeros( RoundMath( stats2.crossbowSteelDmg ) ) );
  4966.  
  4967.  
  4968. //dm.GetAbilityAttributeValue( 'Mutation9', 'critical_hit_chance', min, max );
  4969. //arrStr.PushBack( NoTrailZeros( 100 * min.valueMultiplicative ) );
  4970.  
  4971. //dm.GetAbilityAttributeValue( 'Mutation9', 'critical_damage', min, max );
  4972. //arrStr.PushBack( NoTrailZeros( 100 * min.valueAdditive ) );
  4973.  
  4974. dm.GetAbilityAttributeValue( 'Mutation9', 'mut9_damage', min, max );
  4975. arrStr.PushBack( NoTrailZeros( 100 * min.valueMultiplicative ) );
  4976.  
  4977. dm.GetAbilityAttributeValue( 'Mutation9', 'health_reduction', min, max );
  4978. arrStr.PushBack( NoTrailZeros( 100 * min.valueMultiplicative ) );
  4979.  
  4980. dm.GetAbilityAttributeValue( 'Mutation9', 'mut9_slowdown', min, max );
  4981. arrStr.PushBack( NoTrailZeros( 100 * min.valueAdditive ) );
  4982.  
  4983. break;
  4984.  
  4985. case EPMT_Mutation10 : //modSigns: redone
  4986.  
  4987. //dm.GetAbilityAttributeValue( 'Mutation10Effect', 'mutation10_stat_boost', min, max );
  4988. dm.GetAbilityAttributeValue( 'Mutation10Effect', 'mutation10_factor', min, max );
  4989. arrStr.PushBack( NoTrailZeros( min.valueMultiplicative ) );
  4990. arrStr.PushBack( NoTrailZeros( RoundMath(GetToxicityDamage())) );
  4991.  
  4992. theGame.GetDefinitionsManager().GetAbilityAttributeValue('ToxicityEffect', 'DirectDamage', min, max);
  4993. tmp = min.valueMultiplicative * GetStatMax(BCS_Vitality);
  4994. theGame.GetDefinitionsManager().GetAbilityAttributeValue('Mutation10Effect', 'mutation10_factor', min, max);
  4995. tmp *= 1 + min.valueMultiplicative * GetStatMax(BCS_Toxicity)/100.0;
  4996. arrStr.PushBack( NoTrailZeros( RoundMath(tmp)) );
  4997.  
  4998.  
  4999. //arrStr.PushBack( NoTrailZeros( 100 * min.valueMultiplicative * GetStatMax( BCS_Toxicity ) ) );
  5000.  
  5001. break;
  5002.  
  5003. case EPMT_Mutation11 : //modSigns: redone
  5004.  
  5005. dm.GetAbilityAttributeValue( 'Mutation11BuffEffect', 'duration', min, max);
  5006. arrStr.PushBack( NoTrailZeros( min.valueAdditive ) );
  5007.  
  5008. dm.GetAbilityAttributeValue( 'Mutation11DebuffEffect', 'duration', min, max);
  5009. arrStr.PushBack( NoTrailZeros( min.valueAdditive ) );
  5010.  
  5011. arrStr.PushBack( NoTrailZeros( MaxF(1, Mutation11GetBaseStrength()) * GetStatMax(BCS_Focus) ) );
  5012.  
  5013. break;
  5014.  
  5015. case EPMT_Mutation12 :
  5016.  
  5017. dm.GetAbilityAttributeValue( 'Mutation12', 'duration', min, max );
  5018. arrStr.PushBack( NoTrailZeros( min.valueAdditive ) );
  5019.  
  5020.  
  5021. dm.GetAbilityAttributeValue( 'Mutation12', 'maxcap', min, max );
  5022. arrStr.PushBack( NoTrailZeros( min.valueAdditive ) );
  5023. break;
  5024.  
  5025. case EPMT_MutationMaster :
  5026.  
  5027. arrStr.PushBack( "4" );
  5028.  
  5029. break;
  5030. }
  5031.  
  5032. return GetLocStringByKeyExtWithParams( locKey, , , arrStr );
  5033. }
  5034.  
  5035. //public final function ApplyMutation10StatBoost( out statValue : SAbilityAttributeValue )
  5036. //{
  5037. // var attValue : SAbilityAttributeValue;
  5038. // var currToxicity : float;
  5039. //
  5040. // if( IsMutationActive( EPMT_Mutation10 ) )
  5041. // {
  5042. // currToxicity = GetStat( BCS_Toxicity );
  5043. // if( currToxicity > 0.f )
  5044. // {
  5045. // attValue = GetAttributeValue( 'mutation10_stat_boost' );
  5046. // currToxicity *= attValue.valueMultiplicative;
  5047. // statValue.valueMultiplicative += currToxicity;
  5048. // }
  5049. // }
  5050. //} //modSigns: redone
  5051.  
  5052.  
  5053.  
  5054.  
  5055.  
  5056.  
  5057.  
  5058. public final function IsBookRead( bookName : name ):bool
  5059. {
  5060. return booksRead.Contains( bookName );
  5061. }
  5062.  
  5063. public final function AddReadBook( bookName : name ):void
  5064. {
  5065. if( !booksRead.Contains( bookName ) )
  5066. {
  5067. booksRead.PushBack( bookName );
  5068. }
  5069. }
  5070.  
  5071. public final function RemoveReadBook( bookName : name ):void
  5072. {
  5073. var idx : int = booksRead.FindFirst( bookName );
  5074.  
  5075. if( idx > -1 )
  5076. {
  5077. booksRead.Erase( idx );
  5078. }
  5079. }
  5080.  
  5081.  
  5082.  
  5083.  
  5084.  
  5085.  
  5086.  
  5087. public final function GetMutagenBuffs() : array< W3Mutagen_Effect >
  5088. {
  5089. var null : array< W3Mutagen_Effect >;
  5090.  
  5091. if(effectManager)
  5092. {
  5093. return effectManager.GetMutagenBuffs();
  5094. }
  5095.  
  5096. return null;
  5097. }
  5098.  
  5099. public function GetAlchemyRecipes() : array<name>
  5100. {
  5101. return alchemyRecipes;
  5102. }
  5103.  
  5104. public function CanLearnAlchemyRecipe(recipeName : name) : bool
  5105. {
  5106. var dm : CDefinitionsManagerAccessor;
  5107. var recipeNode : SCustomNode;
  5108. var i, tmpInt : int;
  5109. var tmpName : name;
  5110.  
  5111. dm = theGame.GetDefinitionsManager();
  5112. if ( dm.GetSubNodeByAttributeValueAsCName( recipeNode, 'alchemy_recipes', 'name_name', recipeName ) )
  5113. {
  5114. return true;
  5115.  
  5116. }
  5117.  
  5118. return false;
  5119. }
  5120.  
  5121. private final function RemoveAlchemyRecipe(recipeName : name)
  5122. {
  5123. alchemyRecipes.Remove(recipeName);
  5124. }
  5125.  
  5126. private final function RemoveAllAlchemyRecipes()
  5127. {
  5128. alchemyRecipes.Clear();
  5129. }
  5130.  
  5131. //modSigns: skill changed
  5132. public function CountAlchemy18Abilities(skillLevel : int) : int
  5133. {
  5134. var absToAdd : int;
  5135. var maxAbsAllowed : int;
  5136. var names : array<name>;
  5137. var m_alchemyManager : W3AlchemyManager;
  5138. var recipe : SAlchemyRecipe;
  5139. var i : int;
  5140.  
  5141. absToAdd = 0;
  5142. maxAbsAllowed = skillLevel * RoundMath(CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s18, 'max_abs_per_lvl_s18', false, false)));
  5143. m_alchemyManager = new W3AlchemyManager in this;
  5144. m_alchemyManager.Init();
  5145. names = GetAlchemyRecipes();
  5146. for(i = 0; i < names.Size(); i += 1)
  5147. {
  5148. m_alchemyManager.GetRecipe(names[i], recipe);
  5149. //if(IsAlchemy18Recipe(recipe.cookedItemType) && GetAlchemy18RecipeLevel(recipe) <= skillLevel)
  5150. if(absToAdd < maxAbsAllowed && IsAlchemy18Recipe(recipe.cookedItemType))
  5151. absToAdd += 1;
  5152. }
  5153.  
  5154. return absToAdd;
  5155. }
  5156.  
  5157. //modSigns
  5158. public function RecalcAlchemy18Abilities()
  5159. {
  5160. var absToAdd, curAbs : int;
  5161. var skillName : name = SkillEnumToName(S_Alchemy_s18);
  5162.  
  5163. if(CanUseSkill(S_Alchemy_s18))
  5164. absToAdd = CountAlchemy18Abilities(GetSkillLevel(S_Alchemy_s18));
  5165. else
  5166. absToAdd = 0;
  5167. curAbs = GetAbilityCount(skillName);
  5168.  
  5169. if(absToAdd == 0)
  5170. RemoveAbilityAll(skillName);
  5171. else if(absToAdd > curAbs)
  5172. AddAbilityMultiple(skillName, absToAdd - curAbs);
  5173. else if(absToAdd < curAbs)
  5174. RemoveAbilityMultiple(skillName, curAbs - absToAdd);
  5175. }
  5176.  
  5177. function AddAlchemyRecipe(nam : name, optional isSilent : bool, optional skipTutorialUpdate : bool) : bool
  5178. {
  5179. var i, potions, bombs : int;
  5180. var found : bool;
  5181. var m_alchemyManager : W3AlchemyManager;
  5182. var recipe : SAlchemyRecipe;
  5183. var knownBombTypes : array<string>;
  5184. var strRecipeName, recipeNameWithoutLevel : string;
  5185.  
  5186. if(!IsAlchemyRecipe(nam))
  5187. return false;
  5188.  
  5189. found = false;
  5190. for(i=0; i<alchemyRecipes.Size(); i+=1)
  5191. {
  5192. if(alchemyRecipes[i] == nam)
  5193. return false;
  5194.  
  5195.  
  5196. if(StrCmp(alchemyRecipes[i],nam) > 0)
  5197. {
  5198. alchemyRecipes.Insert(i,nam);
  5199. found = true;
  5200. AddAlchemyHudNotification(nam,isSilent);
  5201. break;
  5202. }
  5203. }
  5204.  
  5205. if(!found)
  5206. {
  5207. alchemyRecipes.PushBack(nam);
  5208. AddAlchemyHudNotification(nam,isSilent);
  5209. }
  5210.  
  5211. m_alchemyManager = new W3AlchemyManager in this;
  5212. m_alchemyManager.Init(alchemyRecipes);
  5213. m_alchemyManager.GetRecipe(nam, recipe);
  5214.  
  5215.  
  5216. //if(CanUseSkill(S_Alchemy_s18))
  5217. //{
  5218. // //modSigns
  5219. // //if ((recipe.cookedItemType != EACIT_Bolt) && (recipe.cookedItemType != EACIT_Undefined) && (recipe.cookedItemType != EACIT_Dye) && (recipe.level <= GetSkillLevel(S_Alchemy_s18)))
  5220. // if(IsAlchemy18Recipe(recipe.cookedItemType) && recipe.level <= GetSkillLevel(S_Alchemy_s18))
  5221. // AddAbility(SkillEnumToName(S_Alchemy_s18), true);
  5222. //
  5223. //}
  5224. //modSigns: moved to another place
  5225. RecalcAlchemy18Abilities();
  5226.  
  5227.  
  5228. if(recipe.cookedItemType == EACIT_Bomb)
  5229. {
  5230. bombs = 0;
  5231. for(i=0; i<alchemyRecipes.Size(); i+=1)
  5232. {
  5233. m_alchemyManager.GetRecipe(alchemyRecipes[i], recipe);
  5234.  
  5235.  
  5236. if(recipe.cookedItemType == EACIT_Bomb)
  5237. {
  5238. strRecipeName = NameToString(alchemyRecipes[i]);
  5239. recipeNameWithoutLevel = StrLeft(strRecipeName, StrLen(strRecipeName)-2);
  5240. if(!knownBombTypes.Contains(recipeNameWithoutLevel))
  5241. {
  5242. bombs += 1;
  5243. knownBombTypes.PushBack(recipeNameWithoutLevel);
  5244. }
  5245. }
  5246. }
  5247.  
  5248. theGame.GetGamerProfile().SetStat(ES_KnownBombRecipes, bombs);
  5249. }
  5250.  
  5251. else if(recipe.cookedItemType == EACIT_Potion || recipe.cookedItemType == EACIT_MutagenPotion || recipe.cookedItemType == EACIT_Alcohol || recipe.cookedItemType == EACIT_Quest)
  5252. {
  5253. potions = 0;
  5254. for(i=0; i<alchemyRecipes.Size(); i+=1)
  5255. {
  5256. m_alchemyManager.GetRecipe(alchemyRecipes[i], recipe);
  5257.  
  5258.  
  5259. if(recipe.cookedItemType == EACIT_Potion || recipe.cookedItemType == EACIT_MutagenPotion || recipe.cookedItemType == EACIT_Alcohol || recipe.cookedItemType == EACIT_Quest)
  5260. {
  5261. potions += 1;
  5262. }
  5263. }
  5264. theGame.GetGamerProfile().SetStat(ES_KnownPotionRecipes, potions);
  5265. }
  5266.  
  5267. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_AlchemyRecipe );
  5268.  
  5269. return true;
  5270. }
  5271.  
  5272. public function GetExpandedAlchemyCategories() : array< name >
  5273. {
  5274. return expandedAlchemyCategories;
  5275. }
  5276.  
  5277. public function AddExpandedAlchemyCategory( category : name )
  5278. {
  5279. if ( IsNameValid( category ) )
  5280. {
  5281. ArrayOfNamesPushBackUnique( expandedAlchemyCategories, category );
  5282. }
  5283. }
  5284.  
  5285. public function RemoveExpandedAlchemyCategory( category : name )
  5286. {
  5287. if ( IsNameValid( category ) )
  5288. {
  5289. expandedAlchemyCategories.Remove( category );
  5290. }
  5291. }
  5292.  
  5293. public function SetAlchemyFilters(showHasIngre : bool, showMissingIngre : bool, showAlreadyCrafted : bool )
  5294. {
  5295. alchemyFilters.showCraftable = showHasIngre;
  5296. alchemyFilters.showMissingIngre = showMissingIngre;
  5297. alchemyFilters.showAlreadyCrafted = showAlreadyCrafted;
  5298. }
  5299.  
  5300. public function GetAlchemyFilters() : SCraftingFilters
  5301. {
  5302.  
  5303. if ( alchemyFilters.showCraftable == false && alchemyFilters.showMissingIngre == false && alchemyFilters.showAlreadyCrafted == false )
  5304. {
  5305. alchemyFilters.showCraftable = true;
  5306. alchemyFilters.showMissingIngre = true;
  5307. alchemyFilters.showAlreadyCrafted = false;
  5308. }
  5309.  
  5310. return alchemyFilters;
  5311. }
  5312.  
  5313.  
  5314.  
  5315.  
  5316.  
  5317.  
  5318.  
  5319. public function GetExpandedBestiaryCategories() : array< name >
  5320. {
  5321. return expandedBestiaryCategories;
  5322. }
  5323.  
  5324. public function AddExpandedBestiaryCategory( category : name )
  5325. {
  5326. if ( IsNameValid( category ) )
  5327. {
  5328. ArrayOfNamesPushBackUnique( expandedBestiaryCategories, category );
  5329. }
  5330. }
  5331.  
  5332. public function RemoveExpandedBestiaryCategory( category : name )
  5333. {
  5334. if ( IsNameValid( category ) )
  5335. {
  5336. expandedBestiaryCategories.Remove( category );
  5337. }
  5338. }
  5339.  
  5340.  
  5341.  
  5342.  
  5343.  
  5344.  
  5345.  
  5346. public function GetDisplayHeavyAttackIndicator() : bool
  5347. {
  5348. return bDispalyHeavyAttackIndicator;
  5349. }
  5350.  
  5351. public function SetDisplayHeavyAttackIndicator( val : bool )
  5352. {
  5353. bDispalyHeavyAttackIndicator = val;
  5354. }
  5355.  
  5356. public function GetDisplayHeavyAttackFirstLevelTimer() : bool
  5357. {
  5358. return bDisplayHeavyAttackFirstLevelTimer;
  5359. }
  5360.  
  5361. public function SetDisplayHeavyAttackFirstLevelTimer( val : bool )
  5362. {
  5363. bDisplayHeavyAttackFirstLevelTimer = val;
  5364. }
  5365.  
  5366.  
  5367.  
  5368.  
  5369.  
  5370.  
  5371.  
  5372. public function SelectQuickslotItem( slot : EEquipmentSlots )
  5373. {
  5374. var item : SItemUniqueId;
  5375.  
  5376. GetItemEquippedOnSlot(slot, item);
  5377. selectedItemId = item;
  5378. }
  5379.  
  5380.  
  5381.  
  5382.  
  5383.  
  5384.  
  5385.  
  5386. public function GetMedallion() : W3MedallionController
  5387. {
  5388. if ( !medallionController )
  5389. {
  5390. medallionController = new W3MedallionController in this;
  5391. }
  5392. return medallionController;
  5393. }
  5394.  
  5395.  
  5396. public final function HighlightObjects(range : float, optional highlightTime : float )
  5397. {
  5398. var ents : array<CGameplayEntity>;
  5399. var i : int;
  5400.  
  5401. FindGameplayEntitiesInSphere(ents, GetWorldPosition(), range, 100, 'HighlightedByMedalionFX', FLAG_ExcludePlayer);
  5402.  
  5403. if(highlightTime == 0)
  5404. highlightTime = 30;
  5405.  
  5406. for(i=0; i<ents.Size(); i+=1)
  5407. {
  5408. if(!ents[i].IsHighlighted())
  5409. {
  5410. ents[i].SetHighlighted( true );
  5411. ents[i].PlayEffectSingle( 'medalion_detection_fx' );
  5412. ents[i].AddTimer( 'MedallionEffectOff', highlightTime );
  5413. }
  5414. }
  5415. }
  5416.  
  5417.  
  5418. public final function HighlightEnemies(range : float, optional highlightTime : float )
  5419. {
  5420. var ents : array<CGameplayEntity>;
  5421. var i : int;
  5422. var catComponent : CGameplayEffectsComponent;
  5423.  
  5424. FindGameplayEntitiesInSphere(ents, GetWorldPosition(), range, 100, , FLAG_ExcludePlayer + FLAG_OnlyAliveActors);
  5425.  
  5426. if(highlightTime == 0)
  5427. highlightTime = 5;
  5428.  
  5429. for(i=0; i<ents.Size(); i+=1)
  5430. {
  5431. if(IsRequiredAttitudeBetween(this, ents[i], true))
  5432. {
  5433. catComponent = GetGameplayEffectsComponent(ents[i]);
  5434. if(catComponent)
  5435. {
  5436. catComponent.SetGameplayEffectFlag(EGEF_CatViewHiglight, true);
  5437. ents[i].AddTimer( 'EnemyHighlightOff', highlightTime, , , , , true );
  5438. }
  5439. }
  5440. }
  5441. }
  5442.  
  5443. function SpawnMedallionEntity()
  5444. {
  5445. var rot : EulerAngles;
  5446. var spawnedMedallion : CEntity;
  5447.  
  5448. spawnedMedallion = theGame.GetEntityByTag( 'new_Witcher_medallion_FX' );
  5449.  
  5450. if ( !spawnedMedallion )
  5451. theGame.CreateEntity( medallionEntity, GetWorldPosition(), rot, true, false );
  5452. }
  5453.  
  5454.  
  5455.  
  5456.  
  5457.  
  5458.  
  5459.  
  5460.  
  5461.  
  5462. public final function InterruptCombatFocusMode()
  5463. {
  5464. if( this.GetCurrentStateName() == 'CombatFocusMode_SelectSpot' )
  5465. {
  5466. SetCanPlayHitAnim( true );
  5467. PopState();
  5468. }
  5469. }
  5470.  
  5471. public final function IsInDarkPlace() : bool
  5472. {
  5473. var envs : array< string >;
  5474.  
  5475. if( FactsQuerySum( "tut_in_dark_place" ) )
  5476. {
  5477. return true;
  5478. }
  5479.  
  5480. GetActiveAreaEnvironmentDefinitions( envs );
  5481.  
  5482. if( envs.Contains( 'env_novigrad_cave' ) || envs.Contains( 'cave_catacombs' ) )
  5483. {
  5484. return true;
  5485. }
  5486.  
  5487. return false;
  5488. }
  5489.  
  5490.  
  5491.  
  5492.  
  5493.  
  5494. private saved var selectedPotionSlotUpper, selectedPotionSlotLower : EEquipmentSlots;
  5495. private var potionDoubleTapTimerRunning, potionDoubleTapSlotIsUpper : bool;
  5496. default selectedPotionSlotUpper = EES_Potion1;
  5497. default selectedPotionSlotLower = EES_Potion2;
  5498. default potionDoubleTapTimerRunning = false;
  5499.  
  5500. public final function SetPotionDoubleTapRunning(b : bool, optional isUpperSlot : bool)
  5501. {
  5502. if(b)
  5503. {
  5504. AddTimer('PotionDoubleTap', 0.3);
  5505. }
  5506. else
  5507. {
  5508. RemoveTimer('PotionDoubleTap');
  5509. }
  5510.  
  5511. potionDoubleTapTimerRunning = b;
  5512. potionDoubleTapSlotIsUpper = isUpperSlot;
  5513. }
  5514.  
  5515. public final function IsPotionDoubleTapRunning() : bool
  5516. {
  5517. return potionDoubleTapTimerRunning;
  5518. }
  5519.  
  5520. timer function PotionDoubleTap(dt : float, id : int)
  5521. {
  5522. potionDoubleTapTimerRunning = false;
  5523. OnPotionDrinkInput(potionDoubleTapSlotIsUpper);
  5524. }
  5525.  
  5526. public final function OnPotionDrinkInput(fromUpperSlot : bool)
  5527. {
  5528. var slot : EEquipmentSlots;
  5529.  
  5530. if(fromUpperSlot)
  5531. slot = GetSelectedPotionSlotUpper();
  5532. else
  5533. slot = GetSelectedPotionSlotLower();
  5534.  
  5535. DrinkPotionFromSlot(slot);
  5536. }
  5537.  
  5538. public final function OnPotionDrinkKeyboardsInput(slot : EEquipmentSlots)
  5539. {
  5540. DrinkPotionFromSlot(slot);
  5541. }
  5542.  
  5543. private function DrinkPotionFromSlot(slot : EEquipmentSlots):void
  5544. {
  5545. var item : SItemUniqueId;
  5546. var hud : CR4ScriptedHud;
  5547. var module : CR4HudModuleItemInfo;
  5548.  
  5549. // CA
  5550. if (GetCurrentStateName() == 'Swimming') {
  5551. CAHudNotify(GetLocStringByKeyExt( "menu_cannot_perform_action_here" ));
  5552. return;
  5553. }
  5554. // CA
  5555.  
  5556. GetItemEquippedOnSlot(slot, item);
  5557. //modSigns: disable drinking mid action
  5558. if(IsInCombatAction() && (((int)GetBehaviorVariable('combatActionType')) == CAT_SpecialAttack || ((int)GetBehaviorVariable('combatActionType')) == CAT_CastSign && IsCurrentSignChanneled()))
  5559. {
  5560. DisplayHudMessage(GetLocStringByKeyExt( "menu_cannot_perform_action_now" ));
  5561. }
  5562. //modSigns: handle toxic food and drinks
  5563. else if(!CanUseSkill(S_Perk_15) && (inv.ItemHasTag(item, 'Alcohol') || inv.ItemHasTag(item, 'Uncooked')) && !ToxicityLowEnoughToDrinkPotion(slot))
  5564. {
  5565. SendToxicityTooHighMessage();
  5566. }
  5567. else if(inv.ItemHasTag(item, 'Edibles'))
  5568. {
  5569. // CA
  5570. if (!CAAllowAnimsInCombat() && thePlayer.IsInCombat()) {
  5571. ConsumeItem(item);
  5572. return;
  5573. }
  5574. completeAnims.SetItemToConsume( item );
  5575. if ( inv.ItemHasTag(item, 'Drinks')) {
  5576. if (CADrinkAnimOn()) {
  5577. completeAnims.DrinkAnim('CAConsume');
  5578. } else {
  5579. ConsumeItem(item);
  5580. }
  5581. } else {
  5582. if (CAEatAnimOn()) {
  5583. completeAnims.EatAnim();
  5584. } else {
  5585. ConsumeItem(item);
  5586. }
  5587. }
  5588. // CA
  5589. }
  5590. else
  5591. {
  5592. if (ToxicityLowEnoughToDrinkPotion(slot))
  5593. {
  5594. // CA
  5595. if (!CAAllowAnimsInCombat() && thePlayer.IsInCombat()) {
  5596. DrinkPreparedPotion(slot);
  5597. return;
  5598. }
  5599.  
  5600. if (CADrinkAnimOn()) {
  5601. completeAnims.SetSlotToConsumeOne( slot );
  5602. completeAnims.DrinkAnim('CADrinkPotion', slot);
  5603. } else {
  5604. DrinkPreparedPotion(slot);
  5605. }
  5606. // CA
  5607. }
  5608. else
  5609. {
  5610. SendToxicityTooHighMessage();
  5611. }
  5612. }
  5613.  
  5614. hud = (CR4ScriptedHud)theGame.GetHud();
  5615. if ( hud )
  5616. {
  5617. module = (CR4HudModuleItemInfo)hud.GetHudModule("ItemInfoModule");
  5618. if( module )
  5619. {
  5620. module.ForceShowElement();
  5621. }
  5622. }
  5623. }
  5624. // CA
  5625. public function SendToxicityTooHighMessage(optional always : bool) // -= WMK:modQuickSlots =-
  5626. {
  5627. var messageText : string;
  5628. var language : string;
  5629. var audioLanguage : string;
  5630.  
  5631. if ((GetHudMessagesSize() < 2) || always) // -= WMK:modQuickSlots =-
  5632. {
  5633. messageText = GetLocStringByKeyExt("menu_cannot_perform_action_now") + " " + GetLocStringByKeyExt("panel_common_statistics_tooltip_current_toxicity");
  5634.  
  5635. theGame.GetGameLanguageName(audioLanguage,language);
  5636. if (language == "AR")
  5637. {
  5638. messageText += (int)(abilityManager.GetStat(BCS_Toxicity, false)) + " / " + (int)(abilityManager.GetStatMax(BCS_Toxicity)) + " :";
  5639. }
  5640. else
  5641. {
  5642. messageText += ": " + (int)(abilityManager.GetStat(BCS_Toxicity, false)) + " / " + (int)(abilityManager.GetStatMax(BCS_Toxicity));
  5643. }
  5644.  
  5645. DisplayHudMessage(messageText);
  5646. }
  5647. theSound.SoundEvent("gui_global_denied");
  5648. }
  5649.  
  5650. public final function GetSelectedPotionSlotUpper() : EEquipmentSlots
  5651. {
  5652. return selectedPotionSlotUpper;
  5653. }
  5654.  
  5655. public final function GetSelectedPotionSlotLower() : EEquipmentSlots
  5656. {
  5657. return selectedPotionSlotLower;
  5658. }
  5659.  
  5660.  
  5661. public final function FlipSelectedPotion(isUpperSlot : bool) : bool
  5662. {
  5663. if(isUpperSlot)
  5664. {
  5665. if(selectedPotionSlotUpper == EES_Potion1 && IsAnyItemEquippedOnSlot(EES_Potion3))
  5666. {
  5667. selectedPotionSlotUpper = EES_Potion3;
  5668. return true;
  5669. }
  5670. else if(selectedPotionSlotUpper == EES_Potion3 && IsAnyItemEquippedOnSlot(EES_Potion1))
  5671. {
  5672. selectedPotionSlotUpper = EES_Potion1;
  5673. return true;
  5674. }
  5675. }
  5676. else
  5677. {
  5678. if(selectedPotionSlotLower == EES_Potion2 && IsAnyItemEquippedOnSlot(EES_Potion4))
  5679. {
  5680. selectedPotionSlotLower = EES_Potion4;
  5681. return true;
  5682. }
  5683. else if(selectedPotionSlotLower == EES_Potion4 && IsAnyItemEquippedOnSlot(EES_Potion2))
  5684. {
  5685. selectedPotionSlotLower = EES_Potion2;
  5686. return true;
  5687. }
  5688. }
  5689.  
  5690. return false;
  5691. }
  5692.  
  5693. public final function AddBombThrowDelay( bombId : SItemUniqueId )
  5694. {
  5695. var slot : EEquipmentSlots;
  5696.  
  5697. slot = GetItemSlot( bombId );
  5698.  
  5699. if( slot == EES_Unused )
  5700. {
  5701. return;
  5702. }
  5703.  
  5704. if( slot == EES_Petard1 || slot == EES_Quickslot1 || slot == EES_Petard3 ) // -= WMK:modQuickSlots =-
  5705. {
  5706. remainingBombThrowDelaySlot1 = theGame.params.BOMB_THROW_DELAY;
  5707. AddTimer( 'BombDelay', 0.0f, true );
  5708. }
  5709. else if( slot == EES_Petard2 || slot == EES_Quickslot2 || slot == EES_Petard4 ) // -= WMK:modQuickSlots =-
  5710. {
  5711. remainingBombThrowDelaySlot2 = theGame.params.BOMB_THROW_DELAY;
  5712. AddTimer( 'BombDelay', 0.0f, true );
  5713. }
  5714. else
  5715. {
  5716. return;
  5717. }
  5718. }
  5719.  
  5720. public final function GetBombDelay( slot : EEquipmentSlots ) : float
  5721. {
  5722. if( slot == EES_Petard1 || slot == EES_Quickslot1 || slot == EES_Petard3 ) // -= WMK:modQuickSlots =-
  5723. {
  5724. return remainingBombThrowDelaySlot1;
  5725. }
  5726. else if( slot == EES_Petard2 || slot == EES_Quickslot2 || slot == EES_Petard4 ) // -= WMK:modQuickSlots =-
  5727. {
  5728. return remainingBombThrowDelaySlot2;
  5729. }
  5730.  
  5731. return 0;
  5732. }
  5733.  
  5734. timer function BombDelay( dt : float, id : int )
  5735. {
  5736. remainingBombThrowDelaySlot1 = MaxF( 0.f , remainingBombThrowDelaySlot1 - dt );
  5737. remainingBombThrowDelaySlot2 = MaxF( 0.f , remainingBombThrowDelaySlot2 - dt );
  5738.  
  5739. if( remainingBombThrowDelaySlot1 <= 0.0f && remainingBombThrowDelaySlot2 <= 0.0f )
  5740. {
  5741. RemoveTimer('BombDelay');
  5742. }
  5743. }
  5744.  
  5745. public function ResetCharacterDev()
  5746. {
  5747. ForceSetStat(BCS_Toxicity, 0); //modSigns: reset toxicity
  5748.  
  5749. UnequipItemFromSlot(EES_SkillMutagen1);
  5750. UnequipItemFromSlot(EES_SkillMutagen2);
  5751. UnequipItemFromSlot(EES_SkillMutagen3);
  5752. UnequipItemFromSlot(EES_SkillMutagen4);
  5753.  
  5754. levelManager.ResetCharacterDev();
  5755. ((W3PlayerAbilityManager)abilityManager).ResetCharacterDev();
  5756. }
  5757.  
  5758. public final function ResetMutationsDev()
  5759. {
  5760. levelManager.ResetMutationsDev();
  5761. ((W3PlayerAbilityManager)abilityManager).ResetMutationsDev();
  5762. }
  5763.  
  5764. public final function GetHeldSword() : SItemUniqueId
  5765. {
  5766. var i : int;
  5767. var weapons : array< SItemUniqueId >;
  5768.  
  5769. weapons = inv.GetHeldWeapons();
  5770. for( i=0; i<weapons.Size(); i+=1 )
  5771. {
  5772. if( inv.IsItemSilverSwordUsableByPlayer( weapons[i] ) || inv.IsItemSteelSwordUsableByPlayer( weapons[i] ) )
  5773. {
  5774. return weapons[i];
  5775. }
  5776. }
  5777.  
  5778. return GetInvalidUniqueId();
  5779. }
  5780.  
  5781. public function ConsumeItem( itemId : SItemUniqueId ) : bool
  5782. {
  5783. var itemName : name;
  5784. var removedItem, willRemoveItem : bool;
  5785. var edibles : array<SItemUniqueId>;
  5786. var toSlot : EEquipmentSlots;
  5787. var i : int;
  5788. var equippedNewEdible : bool;
  5789.  
  5790. itemName = inv.GetItemName( itemId );
  5791.  
  5792. if (itemName == 'q111_imlerith_acorn' )
  5793. {
  5794. AddPoints(ESkillPoint, 2, true);
  5795. removedItem = inv.RemoveItem( itemId, 1 );
  5796. theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt("panel_character_popup_title_buy_skill") + "<br>" + GetLocStringByKeyExt("panel_character_availablepoints") + " +2");
  5797. theSound.SoundEvent("gui_character_buy_skill");
  5798. }
  5799. else if ( itemName == 'Clearing Potion' )
  5800. {
  5801. ResetCharacterDev();
  5802. removedItem = inv.RemoveItem( itemId, 1 );
  5803. theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt("panel_character_popup_character_cleared") );
  5804. theSound.SoundEvent("gui_character_synergy_effect");
  5805. }
  5806. else if ( itemName == 'Restoring Potion' )
  5807. {
  5808. ResetMutationsDev();
  5809. removedItem = inv.RemoveItem( itemId, 1 );
  5810. theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt("panel_character_popup_character_cleared") );
  5811. theSound.SoundEvent("gui_character_synergy_effect");
  5812. }
  5813. else if(itemName == 'Wolf Hour')
  5814. {
  5815. removedItem = inv.RemoveItem( itemId, 1 );
  5816. theSound.SoundEvent("gui_character_synergy_effect");
  5817. AddEffectDefault(EET_WolfHour, thePlayer, 'wolf hour');
  5818. }
  5819. else if ( itemName == 'q704_ft_golden_egg' )
  5820. {
  5821. AddPoints(ESkillPoint, 1, true);
  5822. removedItem = inv.RemoveItem( itemId, 1 );
  5823. theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt("panel_character_popup_title_buy_skill") + "<br>" + GetLocStringByKeyExt("panel_character_availablepoints") + " +1");
  5824. theSound.SoundEvent("gui_character_buy_skill");
  5825. }
  5826. else if ( itemName == 'mq7023_cake' )
  5827. {
  5828. this.AddAbility('mq7023_cake_vitality_bonus');
  5829. removedItem = inv.RemoveItem( itemId, 1 );
  5830. theSound.SoundEvent("gui_character_synergy_effect");
  5831. }
  5832. else
  5833. {
  5834. willRemoveItem = inv.GetItemQuantity(itemId) == 1 && !inv.ItemHasTag(itemId, 'InfiniteUse');
  5835.  
  5836. if(willRemoveItem)
  5837. toSlot = GetItemSlot(itemId);
  5838.  
  5839. removedItem = super.ConsumeItem(itemId);
  5840.  
  5841. if(willRemoveItem && removedItem)
  5842. {
  5843. edibles = inv.GetItemsByTag('Edibles');
  5844. equippedNewEdible = false;
  5845.  
  5846.  
  5847. for(i=0; i<edibles.Size(); i+=1)
  5848. {
  5849. if(!IsItemEquipped(edibles[i]) && !inv.ItemHasTag(edibles[i], 'Alcohol') && inv.GetItemName(edibles[i]) != 'Clearing Potion' && inv.GetItemName(edibles[i]) != 'Wolf Hour')
  5850. {
  5851. EquipItemInGivenSlot(edibles[i], toSlot, true, false);
  5852. equippedNewEdible = true;
  5853. break;
  5854. }
  5855. }
  5856.  
  5857.  
  5858. if(!equippedNewEdible)
  5859. {
  5860. for(i=0; i<edibles.Size(); i+=1)
  5861. {
  5862. if(!IsItemEquipped(edibles[i]) && inv.GetItemName(edibles[i]) != 'Clearing Potion' && inv.GetItemName(edibles[i]) != 'Wolf Hour')
  5863. {
  5864. EquipItemInGivenSlot(edibles[i], toSlot, true, false);
  5865. break;
  5866. }
  5867. }
  5868. }
  5869. }
  5870. }
  5871.  
  5872. return removedItem;
  5873. }
  5874.  
  5875.  
  5876. public final function GetAlcoholForAlchemicalItemsRefill() : SItemUniqueId
  5877. {
  5878. var alcos : array<SItemUniqueId>;
  5879. var id : SItemUniqueId;
  5880. var i, price, minPrice : int;
  5881.  
  5882. alcos = inv.GetItemsByTag(theGame.params.TAG_ALCHEMY_REFILL_ALCO);
  5883.  
  5884. if(alcos.Size() > 0)
  5885. {
  5886. if(inv.ItemHasTag(alcos[0], theGame.params.TAG_INFINITE_USE))
  5887. return alcos[0];
  5888.  
  5889. minPrice = inv.GetItemPrice(alcos[0]);
  5890. price = minPrice;
  5891. id = alcos[0];
  5892.  
  5893. for(i=1; i<alcos.Size(); i+=1)
  5894. {
  5895. if(inv.ItemHasTag(alcos[i], theGame.params.TAG_INFINITE_USE))
  5896. return alcos[i];
  5897.  
  5898. price = inv.GetItemPrice(alcos[i]);
  5899.  
  5900. if(price < minPrice)
  5901. {
  5902. minPrice = price;
  5903. id = alcos[i];
  5904. }
  5905. }
  5906.  
  5907. return id;
  5908. }
  5909.  
  5910. return GetInvalidUniqueId();
  5911. }
  5912.  
  5913. public final function ClearPreviouslyUsedBolt()
  5914. {
  5915. previouslyUsedBolt = GetInvalidUniqueId();
  5916. }
  5917.  
  5918. public function ShouldUseInfiniteWaterBolts() : bool
  5919. {
  5920. return GetCurrentStateName() == 'Swimming' || IsSwimming() || IsDiving();
  5921. }
  5922.  
  5923. public function GetCurrentInfiniteBoltName( optional forceBodkin : bool, optional forceHarpoon : bool ) : name
  5924. {
  5925. if(!forceBodkin && (forceHarpoon || ShouldUseInfiniteWaterBolts()) )
  5926. {
  5927. return 'Harpoon Bolt';
  5928. }
  5929. return 'Bodkin Bolt';
  5930. }
  5931.  
  5932.  
  5933. public final function AddAndEquipInfiniteBolt(optional forceBodkin : bool, optional forceHarpoon : bool)
  5934. {
  5935. var bolt, bodkins, harpoons : array<SItemUniqueId>;
  5936. var boltItemName : name;
  5937. var i : int;
  5938.  
  5939.  
  5940. bodkins = inv.GetItemsByName('Bodkin Bolt');
  5941. harpoons = inv.GetItemsByName('Harpoon Bolt');
  5942.  
  5943. for(i=bodkins.Size()-1; i>=0; i-=1)
  5944. inv.RemoveItem(bodkins[i], inv.GetItemQuantity(bodkins[i]) );
  5945.  
  5946. for(i=harpoons.Size()-1; i>=0; i-=1)
  5947. inv.RemoveItem(harpoons[i], inv.GetItemQuantity(harpoons[i]) );
  5948.  
  5949.  
  5950.  
  5951. boltItemName = GetCurrentInfiniteBoltName( forceBodkin, forceHarpoon );
  5952.  
  5953.  
  5954. if(boltItemName == 'Bodkin Bolt' && inv.IsIdValid(previouslyUsedBolt))
  5955. {
  5956. bolt.PushBack(previouslyUsedBolt);
  5957. }
  5958. else
  5959. {
  5960.  
  5961. bolt = inv.AddAnItem(boltItemName, 1, true, true);
  5962.  
  5963.  
  5964. if(boltItemName == 'Harpoon Bolt')
  5965. {
  5966. GetItemEquippedOnSlot(EES_Bolt, previouslyUsedBolt);
  5967. }
  5968. }
  5969.  
  5970. EquipItem(bolt[0], EES_Bolt);
  5971.  
  5972. }
  5973.  
  5974.  
  5975. event OnItemGiven(data : SItemChangedData)
  5976. {
  5977. var m_guiManager : CR4GuiManager;
  5978.  
  5979. super.OnItemGiven(data);
  5980.  
  5981.  
  5982. if(!inv)
  5983. inv = GetInventory();
  5984.  
  5985.  
  5986. if(inv.IsItemEncumbranceItem(data.ids[0]))
  5987. UpdateEncumbrance();
  5988.  
  5989. m_guiManager = theGame.GetGuiManager();
  5990. if(m_guiManager)
  5991. m_guiManager.RegisterNewItem(data.ids[0]);
  5992.  
  5993. // -= WMK:modQuickSlots =-
  5994. if (WmkGetQuickInventoryInstance()) {
  5995. WmkGetQuickInventoryInstance().RegisterNewItem(data.ids[0]);
  5996. }
  5997. // -= WMK:modQuickSlots =-
  5998. }
  5999.  
  6000.  
  6001. public final function CheckForFullyArmedAchievement()
  6002. {
  6003. if( HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_BEAR) || HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_GRYPHON) ||
  6004. HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_LYNX) || HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_WOLF) ||
  6005. /* modSigns */
  6006. /*HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_VIPER)*/
  6007. HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_BEAR_MINOR) || HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_GRYPHON_MINOR) ||
  6008. HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_LYNX_MINOR) || HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_WOLF_MINOR)
  6009. )
  6010. {
  6011. theGame.GetGamerProfile().AddAchievement(EA_FullyArmed);
  6012. }
  6013. }
  6014.  
  6015.  
  6016. public final function HasAllItemsFromSet(setItemTag : name) : bool
  6017. {
  6018. var item : SItemUniqueId;
  6019.  
  6020. if(!GetItemEquippedOnSlot(EES_SteelSword, item) || !inv.ItemHasTag(item, setItemTag))
  6021. return false;
  6022.  
  6023. if(!GetItemEquippedOnSlot(EES_SilverSword, item) || !inv.ItemHasTag(item, setItemTag))
  6024. return false;
  6025.  
  6026. if(!GetItemEquippedOnSlot(EES_Boots, item) || !inv.ItemHasTag(item, setItemTag))
  6027. return false;
  6028.  
  6029. if(!GetItemEquippedOnSlot(EES_Pants, item) || !inv.ItemHasTag(item, setItemTag))
  6030. return false;
  6031.  
  6032. if(!GetItemEquippedOnSlot(EES_Gloves, item) || !inv.ItemHasTag(item, setItemTag))
  6033. return false;
  6034.  
  6035. if(!GetItemEquippedOnSlot(EES_Armor, item) || !inv.ItemHasTag(item, setItemTag))
  6036. return false;
  6037.  
  6038.  
  6039. /*if(setItemTag == theGame.params.ITEM_SET_TAG_BEAR || setItemTag == theGame.params.ITEM_SET_TAG_LYNX)
  6040. {
  6041. if(!GetItemEquippedOnSlot(EES_RangedWeapon, item) || !inv.ItemHasTag(item, setItemTag))
  6042. return false;
  6043. }*/ //modSigns: removed due to set changes
  6044.  
  6045. return true;
  6046. }
  6047.  
  6048.  
  6049.  
  6050.  
  6051. public function GetTotalArmor() : SAbilityAttributeValue
  6052. {
  6053. var armor : SAbilityAttributeValue;
  6054. var armorItem : SItemUniqueId;
  6055.  
  6056. armor = super.GetTotalArmor();
  6057.  
  6058. if(GetItemEquippedOnSlot(EES_Armor, armorItem))
  6059. {
  6060.  
  6061. armor -= inv.GetItemAttributeValue(armorItem, theGame.params.ARMOR_VALUE_NAME);
  6062.  
  6063.  
  6064. armor += inv.GetItemArmorTotal(armorItem);
  6065. }
  6066.  
  6067. if(GetItemEquippedOnSlot(EES_Pants, armorItem))
  6068. {
  6069.  
  6070. armor -= inv.GetItemAttributeValue(armorItem, theGame.params.ARMOR_VALUE_NAME);
  6071.  
  6072.  
  6073. armor += inv.GetItemArmorTotal(armorItem);
  6074. }
  6075.  
  6076. if(GetItemEquippedOnSlot(EES_Boots, armorItem))
  6077. {
  6078.  
  6079. armor -= inv.GetItemAttributeValue(armorItem, theGame.params.ARMOR_VALUE_NAME);
  6080.  
  6081.  
  6082. armor += inv.GetItemArmorTotal(armorItem);
  6083. }
  6084.  
  6085. if(GetItemEquippedOnSlot(EES_Gloves, armorItem))
  6086. {
  6087.  
  6088. armor -= inv.GetItemAttributeValue(armorItem, theGame.params.ARMOR_VALUE_NAME);
  6089.  
  6090.  
  6091. armor += inv.GetItemArmorTotal(armorItem);
  6092. }
  6093.  
  6094. return armor;
  6095. }
  6096.  
  6097.  
  6098.  
  6099. public function ReduceArmorDurability() : EEquipmentSlots
  6100. {
  6101. var r, sum : int;
  6102. var slot : EEquipmentSlots;
  6103. var id : SItemUniqueId;
  6104. var prevDurMult, currDurMult, ratio : float;
  6105.  
  6106.  
  6107. sum = theGame.params.DURABILITY_ARMOR_CHEST_WEIGHT;
  6108. sum += theGame.params.DURABILITY_ARMOR_PANTS_WEIGHT;
  6109. sum += theGame.params.DURABILITY_ARMOR_GLOVES_WEIGHT;
  6110. sum += theGame.params.DURABILITY_ARMOR_BOOTS_WEIGHT;
  6111. sum += theGame.params.DURABILITY_ARMOR_MISS_WEIGHT;
  6112.  
  6113. r = RandRange(sum);
  6114.  
  6115. if(r < theGame.params.DURABILITY_ARMOR_CHEST_WEIGHT)
  6116. slot = EES_Armor;
  6117. else if (r < theGame.params.DURABILITY_ARMOR_CHEST_WEIGHT + theGame.params.DURABILITY_ARMOR_PANTS_WEIGHT)
  6118. slot = EES_Pants;
  6119. else if (r < theGame.params.DURABILITY_ARMOR_CHEST_WEIGHT + theGame.params.DURABILITY_ARMOR_PANTS_WEIGHT + theGame.params.DURABILITY_ARMOR_GLOVES_WEIGHT)
  6120. slot = EES_Gloves;
  6121. 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)
  6122. slot = EES_Boots;
  6123. else
  6124. return EES_InvalidSlot;
  6125.  
  6126. GetItemEquippedOnSlot(slot, id);
  6127. ratio = inv.GetItemDurabilityRatio(id);
  6128. if(inv.ReduceItemDurability(id))
  6129. {
  6130. prevDurMult = theGame.params.GetDurabilityMultiplier(ratio, false);
  6131.  
  6132. ratio = inv.GetItemDurabilityRatio(id);
  6133. currDurMult = theGame.params.GetDurabilityMultiplier(ratio, false);
  6134.  
  6135. if(currDurMult != prevDurMult)
  6136. {
  6137.  
  6138.  
  6139.  
  6140.  
  6141. }
  6142.  
  6143. return slot;
  6144. }
  6145.  
  6146. return EES_InvalidSlot;
  6147. }
  6148.  
  6149.  
  6150. public function DismantleItem(dismantledItem : SItemUniqueId, toolItem : SItemUniqueId) : bool
  6151. {
  6152. var parts : array<SItemParts>;
  6153. var i : int;
  6154.  
  6155. if(!inv.IsItemDismantleKit(toolItem))
  6156. return false;
  6157.  
  6158. parts = inv.GetItemRecyclingParts(dismantledItem);
  6159.  
  6160. if(parts.Size() <= 0)
  6161. return false;
  6162.  
  6163. for(i=0; i<parts.Size(); i+=1)
  6164. inv.AddAnItem(parts[i].itemName, parts[i].quantity, true, false);
  6165.  
  6166. inv.RemoveItem(toolItem);
  6167. inv.RemoveItem(dismantledItem);
  6168. return true;
  6169. }
  6170.  
  6171.  
  6172. public function GetItemEquippedOnSlot(slot : EEquipmentSlots, out item : SItemUniqueId) : bool
  6173. {
  6174. if(slot == EES_InvalidSlot || slot < 0 || slot > EnumGetMax('EEquipmentSlots'))
  6175. return false;
  6176.  
  6177. item = itemSlots[slot];
  6178.  
  6179. return inv.IsIdValid(item);
  6180. }
  6181.  
  6182.  
  6183. public function GetItemSlotByItemName(itemName : name) : EEquipmentSlots
  6184. {
  6185. var ids : array<SItemUniqueId>;
  6186. var i : int;
  6187. var slot : EEquipmentSlots;
  6188.  
  6189. ids = inv.GetItemsByName(itemName);
  6190. for(i=0; i<ids.Size(); i+=1)
  6191. {
  6192. slot = GetItemSlot(ids[i]);
  6193. if(slot != EES_InvalidSlot)
  6194. return slot;
  6195. }
  6196.  
  6197. return EES_InvalidSlot;
  6198. }
  6199.  
  6200.  
  6201. public function GetItemSlot(item : SItemUniqueId) : EEquipmentSlots
  6202. {
  6203. var i : int;
  6204.  
  6205. if(!inv.IsIdValid(item))
  6206. return EES_InvalidSlot;
  6207.  
  6208. for(i=0; i<itemSlots.Size(); i+=1)
  6209. if(itemSlots[i] == item)
  6210. return i;
  6211.  
  6212. return EES_InvalidSlot;
  6213. }
  6214.  
  6215. public function GetEquippedItems() : array<SItemUniqueId>
  6216. {
  6217. return itemSlots;
  6218. }
  6219.  
  6220. public function IsItemEquipped(item : SItemUniqueId) : bool
  6221. {
  6222. if(!inv.IsIdValid(item))
  6223. return false;
  6224.  
  6225. return itemSlots.Contains(item);
  6226. }
  6227.  
  6228. public function IsItemHeld(item : SItemUniqueId) : bool
  6229. {
  6230. if(!inv.IsIdValid(item))
  6231. return false;
  6232.  
  6233. return inv.IsItemHeld(item);
  6234. }
  6235.  
  6236.  
  6237. public function IsAnyItemEquippedOnSlot(slot : EEquipmentSlots) : bool
  6238. {
  6239. if(slot == EES_InvalidSlot || slot < 0 || slot > EnumGetMax('EEquipmentSlots'))
  6240. return false;
  6241.  
  6242. return inv.IsIdValid(itemSlots[slot]);
  6243. }
  6244.  
  6245.  
  6246. public function GetFreeQuickslot() : EEquipmentSlots
  6247. {
  6248. if(!inv.IsIdValid(itemSlots[EES_Quickslot1])) return EES_Quickslot1;
  6249. if(!inv.IsIdValid(itemSlots[EES_Quickslot2])) return EES_Quickslot2;
  6250.  
  6251.  
  6252. return EES_InvalidSlot;
  6253. }
  6254.  
  6255.  
  6256. event OnEquipItemRequested(item : SItemUniqueId, ignoreMount : bool)
  6257. {
  6258. var slot : EEquipmentSlots;
  6259.  
  6260. if(inv.IsIdValid(item))
  6261. {
  6262. slot = inv.GetSlotForItemId(item);
  6263.  
  6264. if (slot != EES_InvalidSlot)
  6265. {
  6266.  
  6267.  
  6268. EquipItemInGivenSlot(item, slot, ignoreMount);
  6269. }
  6270. }
  6271. }
  6272.  
  6273. event OnUnequipItemRequested(item : SItemUniqueId)
  6274. {
  6275. UnequipItem(item);
  6276. }
  6277.  
  6278.  
  6279. public function EquipItem(item : SItemUniqueId, optional slot : EEquipmentSlots, optional toHand : bool) : bool
  6280. {
  6281. if(!inv.IsIdValid(item))
  6282. return false;
  6283.  
  6284. if(slot == EES_InvalidSlot)
  6285. {
  6286. slot = inv.GetSlotForItemId(item);
  6287.  
  6288. if(slot == EES_InvalidSlot)
  6289. return false;
  6290. }
  6291.  
  6292. ForceSoundAppearanceUpdate();
  6293.  
  6294. return EquipItemInGivenSlot(item, slot, false, toHand);
  6295. }
  6296.  
  6297. protected function ShouldMount(slot : EEquipmentSlots, item : SItemUniqueId, category : name):bool
  6298. {
  6299.  
  6300.  
  6301. return !IsSlotPotionMutagen(slot) && category != 'usable' && category != 'potion' && category != 'petard' && !inv.ItemHasTag(item, 'PlayerUnwearable');
  6302. }
  6303.  
  6304. protected function ShouldMountItemWithName( itemName: name ): bool
  6305. {
  6306. var slot : EEquipmentSlots;
  6307. var items : array<SItemUniqueId>;
  6308. var category : name;
  6309. var i : int;
  6310.  
  6311. items = inv.GetItemsByName( itemName );
  6312.  
  6313. category = inv.GetItemCategory( items[0] );
  6314.  
  6315. slot = GetItemSlot( items[0] );
  6316.  
  6317. return ShouldMount( slot, items[0], category );
  6318. }
  6319.  
  6320. public function GetMountableItems( out items : array< SItemUniqueId > )
  6321. {
  6322. var i : int;
  6323. var mountable : bool;
  6324. var mountableItems : array< SItemUniqueId >;
  6325. var slot : EEquipmentSlots;
  6326. var category : name;
  6327. var item: SItemUniqueId;
  6328.  
  6329. for ( i = 0; i < items.Size(); i += 1 )
  6330. {
  6331. item = items[i];
  6332.  
  6333. category = inv.GetItemCategory( item );
  6334.  
  6335. slot = GetItemSlot( item );
  6336.  
  6337. mountable = ShouldMount( slot, item, category );
  6338.  
  6339. if ( mountable )
  6340. {
  6341. mountableItems.PushBack( items[ i ] );
  6342. }
  6343. }
  6344. items = mountableItems;
  6345. }
  6346.  
  6347. public final function AddAndEquipItem( item : name ) : bool
  6348. {
  6349. var ids : array< SItemUniqueId >;
  6350.  
  6351. ids = inv.AddAnItem( item );
  6352. if( inv.IsIdValid( ids[ 0 ] ) )
  6353. {
  6354. return EquipItem( ids[ 0 ] );
  6355. }
  6356.  
  6357. return false;
  6358. }
  6359.  
  6360. public final function AddQuestMarkedSelectedQuickslotItem( sel : SSelectedQuickslotItem )
  6361. {
  6362. questMarkedSelectedQuickslotItems.PushBack( sel );
  6363. }
  6364.  
  6365. public final function GetQuestMarkedSelectedQuickslotItem( sourceName : name ) : SItemUniqueId
  6366. {
  6367. var i : int;
  6368.  
  6369. for( i=0; i<questMarkedSelectedQuickslotItems.Size(); i+=1 )
  6370. {
  6371. if( questMarkedSelectedQuickslotItems[i].sourceName == sourceName )
  6372. {
  6373. return questMarkedSelectedQuickslotItems[i].itemID;
  6374. }
  6375. }
  6376.  
  6377. return GetInvalidUniqueId();
  6378. }
  6379.  
  6380. public final function SwapEquippedItems(slot1 : EEquipmentSlots, slot2 : EEquipmentSlots)
  6381. {
  6382. var temp : SItemUniqueId;
  6383. var pam : W3PlayerAbilityManager;
  6384.  
  6385. temp = itemSlots[slot1];
  6386. itemSlots[slot1] = itemSlots[slot2];
  6387. itemSlots[slot2] = temp;
  6388.  
  6389. if(IsSlotSkillMutagen(slot1))
  6390. {
  6391. pam = (W3PlayerAbilityManager)abilityManager;
  6392. if(pam)
  6393. pam.OnSwappedMutagensPost(itemSlots[slot1], itemSlots[slot2]);
  6394. }
  6395. }
  6396.  
  6397. public final function GetSlotForEquippedItem( itemID : SItemUniqueId ) : EEquipmentSlots
  6398. {
  6399. var i : int;
  6400.  
  6401. for( i=0; i<itemSlots.Size(); i+=1 )
  6402. {
  6403. if( itemSlots[i] == itemID )
  6404. {
  6405. return i;
  6406. }
  6407. }
  6408.  
  6409. return EES_InvalidSlot;
  6410. }
  6411.  
  6412. public function EquipItemInGivenSlot(item : SItemUniqueId, slot : EEquipmentSlots, ignoreMounting : bool, optional toHand : bool) : bool
  6413. {
  6414. var i, groupID, quantity : int;
  6415. var fistsID : array<SItemUniqueId>;
  6416. var pam : W3PlayerAbilityManager;
  6417. var isSkillMutagen : bool;
  6418. var armorEntity : CItemEntity;
  6419. var armorMeshComponent : CComponent;
  6420. var armorSoundIdentification : name;
  6421. var category : name;
  6422. var prevSkillColor : ESkillColor;
  6423. var containedAbilities : array<name>;
  6424. var dm : CDefinitionsManagerAccessor;
  6425. var armorType : EArmorType;
  6426. var otherMask, previousItemInSlot : SItemUniqueId;
  6427. var tutStatePot : W3TutorialManagerUIHandlerStatePotions;
  6428. var tutStateFood : W3TutorialManagerUIHandlerStateFood;
  6429. var tutStateSecondPotionEquip : W3TutorialManagerUIHandlerStateSecondPotionEquip;
  6430. var boltItem : SItemUniqueId;
  6431. var aerondight : W3Effect_Aerondight;
  6432. var phantomWeapon : W3Effect_PhantomWeapon; //modSigns
  6433.  
  6434. if(!inv.IsIdValid(item))
  6435. {
  6436. LogAssert(false, "W3PlayerWitcher.EquipItemInGivenSlot: invalid item");
  6437. return false;
  6438. }
  6439. if(slot == EES_InvalidSlot || slot == EES_HorseBlinders || slot == EES_HorseSaddle || slot == EES_HorseBag || slot == EES_HorseTrophy)
  6440. {
  6441. LogAssert(false, "W3PlayerWitcher.EquipItem: Cannot equip item <<" + inv.GetItemName(item) + ">> - provided slot <<" + slot + ">> is invalid");
  6442. return false;
  6443. }
  6444. if(itemSlots[slot] == item)
  6445. {
  6446. return true;
  6447. }
  6448.  
  6449. if(!HasRequiredLevelToEquipItem(item))
  6450. {
  6451.  
  6452. return false;
  6453. }
  6454.  
  6455. //if(inv.ItemHasTag(item, 'PhantomWeapon') && !GetPhantomWeaponMgr())
  6456. //{
  6457. // InitPhantomWeaponMgr();
  6458. //} //modSigns
  6459.  
  6460.  
  6461. if( slot == EES_SilverSword && inv.ItemHasTag( item, 'Aerondight' ) )
  6462. {
  6463. //modSigns: only in combat
  6464. if(IsInCombat())
  6465. {
  6466. AddEffectDefault( EET_Aerondight, this, "Aerondight" );
  6467. aerondight = (W3Effect_Aerondight)GetBuff( EET_Aerondight );
  6468. aerondight.Pause( 'ManageAerondightBuff' );
  6469. }
  6470. }
  6471.  
  6472. if( slot == EES_SteelSword && inv.ItemHasTag( item, 'PhantomWeapon' ) ) //modSigns
  6473. {
  6474. if(IsInCombat())
  6475. {
  6476. AddEffectDefault( EET_PhantomWeapon, this, "PhantomWeapon" );
  6477. phantomWeapon = (W3Effect_PhantomWeapon)GetBuff( EET_PhantomWeapon );
  6478. phantomWeapon.Pause( 'ManageIrisBuff' );
  6479. }
  6480. }
  6481.  
  6482.  
  6483. previousItemInSlot = itemSlots[slot];
  6484. if( IsItemEquipped(item))
  6485. {
  6486. SwapEquippedItems(slot, GetItemSlot(item));
  6487. return true;
  6488. }
  6489.  
  6490.  
  6491. isSkillMutagen = IsSlotSkillMutagen(slot);
  6492. if(isSkillMutagen)
  6493. {
  6494. pam = (W3PlayerAbilityManager)abilityManager;
  6495. if(!pam.IsSkillMutagenSlotUnlocked(slot))
  6496. {
  6497. return false;
  6498. }
  6499. }
  6500.  
  6501.  
  6502. if(inv.IsIdValid(previousItemInSlot))
  6503. {
  6504. if(!UnequipItemFromSlot(slot, true))
  6505. {
  6506. LogAssert(false, "W3PlayerWitcher.EquipItem: Cannot equip item <<" + inv.GetItemName(item) + ">> !!");
  6507. return false;
  6508. }
  6509. }
  6510.  
  6511.  
  6512. if(inv.IsItemMask(item))
  6513. {
  6514. if(slot == EES_Quickslot1)
  6515. GetItemEquippedOnSlot(EES_Quickslot2, otherMask);
  6516. else
  6517. GetItemEquippedOnSlot(EES_Quickslot1, otherMask);
  6518.  
  6519. if(inv.IsItemMask(otherMask))
  6520. UnequipItem(otherMask);
  6521. }
  6522.  
  6523. if(isSkillMutagen)
  6524. {
  6525. groupID = pam.GetSkillGroupIdOfMutagenSlot(slot);
  6526. prevSkillColor = pam.GetSkillGroupColor(groupID);
  6527. }
  6528.  
  6529. itemSlots[slot] = item;
  6530.  
  6531. category = inv.GetItemCategory( item );
  6532.  
  6533.  
  6534. if( !ignoreMounting && ShouldMount(slot, item, category) )
  6535. {
  6536.  
  6537. inv.MountItem( item, toHand, IsSlotSkillMutagen( slot ) );
  6538. }
  6539.  
  6540. theTelemetry.LogWithLabelAndValue( TE_INV_ITEM_EQUIPPED, inv.GetItemName(item), slot );
  6541.  
  6542. if(slot == EES_RangedWeapon)
  6543. {
  6544. rangedWeapon = ( Crossbow )( inv.GetItemEntityUnsafe(item) );
  6545. if(!rangedWeapon)
  6546. AddTimer('DelayedOnItemMount', 0.1, true);
  6547.  
  6548. if ( IsSwimming() || IsDiving() )
  6549. {
  6550. GetItemEquippedOnSlot(EES_Bolt, boltItem);
  6551.  
  6552. if(inv.IsIdValid(boltItem))
  6553. {
  6554. if ( !inv.ItemHasTag(boltItem, 'UnderwaterAmmo' ))
  6555. {
  6556. AddAndEquipInfiniteBolt(false, true);
  6557. }
  6558. }
  6559. else if(!IsAnyItemEquippedOnSlot(EES_Bolt))
  6560. {
  6561. AddAndEquipInfiniteBolt(false, true);
  6562. }
  6563. }
  6564.  
  6565. else if(!IsAnyItemEquippedOnSlot(EES_Bolt))
  6566. AddAndEquipInfiniteBolt();
  6567. }
  6568. else if(slot == EES_Bolt)
  6569. {
  6570. if(rangedWeapon)
  6571. { if ( !IsSwimming() || !IsDiving() )
  6572. {
  6573. rangedWeapon.OnReplaceAmmo();
  6574. rangedWeapon.OnWeaponReload();
  6575. }
  6576. else
  6577. {
  6578. DisplayHudMessage(GetLocStringByKeyExt( "menu_cannot_perform_action_now" ));
  6579. }
  6580. }
  6581. }
  6582.  
  6583. else if(isSkillMutagen)
  6584. {
  6585. theGame.GetGuiManager().IgnoreNewItemNotifications( true );
  6586.  
  6587.  
  6588. quantity = inv.GetItemQuantity( item );
  6589. if( quantity > 1 )
  6590. {
  6591. inv.SplitItem( item, quantity - 1 );
  6592. }
  6593.  
  6594. pam.OnSkillMutagenEquipped(item, slot, prevSkillColor);
  6595. LogSkillColors("Mutagen <<" + inv.GetItemName(item) + ">> equipped to slot <<" + slot + ">>");
  6596. LogSkillColors("Group bonus color is now <<" + pam.GetSkillGroupColor(groupID) + ">>");
  6597. LogSkillColors("");
  6598.  
  6599. theGame.GetGuiManager().IgnoreNewItemNotifications( false );
  6600. }
  6601. else if(slot == EES_Gloves && HasWeaponDrawn(false))
  6602. {
  6603. //PlayRuneword4FX(PW_Steel);
  6604. //PlayRuneword4FX(PW_Silver);
  6605. //modSigns
  6606. if(HasBuff(EET_Runeword4))
  6607. ((W3Effect_Runeword4)GetBuff(EET_Runeword4)).PlayRuneword4FX();
  6608. }
  6609.  
  6610. else if( ( slot == EES_Petard1 || slot == EES_Petard2 ) && inv.IsItemBomb( GetSelectedItemId() ) )
  6611. {
  6612. SelectQuickslotItem( slot );
  6613. }
  6614.  
  6615.  
  6616. if(inv.ItemHasAbility(item, 'MA_HtH'))
  6617. {
  6618. inv.GetItemContainedAbilities(item, containedAbilities);
  6619. fistsID = inv.GetItemsByName('fists');
  6620. dm = theGame.GetDefinitionsManager();
  6621. for(i=0; i<containedAbilities.Size(); i+=1)
  6622. {
  6623. if(dm.AbilityHasTag(containedAbilities[i], 'MA_HtH'))
  6624. {
  6625. inv.AddItemCraftedAbility(fistsID[0], containedAbilities[i], true);
  6626. }
  6627. }
  6628. }
  6629.  
  6630.  
  6631. if(inv.IsItemAnyArmor(item))
  6632. {
  6633. armorType = inv.GetArmorType(item);
  6634. pam = (W3PlayerAbilityManager)abilityManager;
  6635.  
  6636. pam.ManageSetArmorTypeBonus(); //modSigns
  6637.  
  6638. if(armorType == EAT_Light)
  6639. {
  6640. if(CanUseSkill(S_Perk_05))
  6641. pam.SetPerkArmorBonus(S_Perk_05);
  6642. }
  6643. else if(armorType == EAT_Medium)
  6644. {
  6645. if(CanUseSkill(S_Perk_06))
  6646. pam.SetPerkArmorBonus(S_Perk_06);
  6647. }
  6648. else if(armorType == EAT_Heavy)
  6649. {
  6650. if(CanUseSkill(S_Perk_07))
  6651. pam.SetPerkArmorBonus(S_Perk_07);
  6652. }
  6653. }
  6654.  
  6655.  
  6656. UpdateItemSetBonuses( item, true );
  6657.  
  6658.  
  6659. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_OnItemEquipped );
  6660.  
  6661.  
  6662. if(ShouldProcessTutorial('TutorialPotionCanEquip3'))
  6663. {
  6664. if(IsSlotPotionSlot(slot))
  6665. {
  6666. tutStatePot = (W3TutorialManagerUIHandlerStatePotions)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
  6667. if(tutStatePot)
  6668. {
  6669. tutStatePot.OnPotionEquipped(inv.GetItemName(item));
  6670. }
  6671.  
  6672. tutStateSecondPotionEquip = (W3TutorialManagerUIHandlerStateSecondPotionEquip)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
  6673. if(tutStateSecondPotionEquip)
  6674. {
  6675. tutStateSecondPotionEquip.OnPotionEquipped(inv.GetItemName(item));
  6676. }
  6677.  
  6678. }
  6679. }
  6680.  
  6681. if(ShouldProcessTutorial('TutorialFoodSelectTab'))
  6682. {
  6683. if( IsSlotPotionSlot(slot) && inv.IsItemFood(item))
  6684. {
  6685. tutStateFood = (W3TutorialManagerUIHandlerStateFood)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
  6686. if(tutStateFood)
  6687. {
  6688. tutStateFood.OnFoodEquipped();
  6689. }
  6690. }
  6691. }
  6692.  
  6693.  
  6694. if(inv.IsItemSetItem(item))
  6695. {
  6696. CheckForFullyArmedAchievement();
  6697. }
  6698.  
  6699. return true;
  6700. }
  6701.  
  6702. private function CheckHairItem()
  6703. {
  6704. var ids : array<SItemUniqueId>;
  6705. var i : int;
  6706. var itemName : name;
  6707. var hairApplied : bool;
  6708.  
  6709. ids = inv.GetItemsByCategory('hair');
  6710.  
  6711. for(i=0; i<ids.Size(); i+= 1)
  6712. {
  6713. itemName = inv.GetItemName( ids[i] );
  6714.  
  6715. if( itemName != 'Preview Hair' )
  6716. {
  6717. if( hairApplied == false )
  6718. {
  6719. inv.MountItem( ids[i], false );
  6720. hairApplied = true;
  6721. }
  6722. else
  6723. {
  6724. inv.RemoveItem( ids[i], 1 );
  6725. }
  6726.  
  6727. }
  6728. }
  6729.  
  6730. if( hairApplied == false )
  6731. {
  6732. ids = inv.AddAnItem('Half With Tail Hairstyle', 1, true, false);
  6733. inv.MountItem( ids[0], false );
  6734. }
  6735.  
  6736. }
  6737.  
  6738.  
  6739. timer function DelayedOnItemMount( dt : float, id : int )
  6740. {
  6741. var crossbowID : SItemUniqueId;
  6742. var invent : CInventoryComponent;
  6743.  
  6744. invent = GetInventory();
  6745. if(!invent)
  6746. return;
  6747.  
  6748.  
  6749. GetItemEquippedOnSlot(EES_RangedWeapon, crossbowID);
  6750.  
  6751. if(invent.IsIdValid(crossbowID))
  6752. {
  6753.  
  6754. rangedWeapon = ( Crossbow )(invent.GetItemEntityUnsafe(crossbowID) );
  6755.  
  6756. if(rangedWeapon)
  6757. {
  6758.  
  6759. RemoveTimer('DelayedOnItemMount');
  6760. }
  6761. }
  6762. else
  6763. {
  6764.  
  6765. RemoveTimer('DelayedOnItemMount');
  6766. }
  6767. }
  6768.  
  6769. public function GetHeldItems() : array<SItemUniqueId>
  6770. {
  6771. var items : array<SItemUniqueId>;
  6772. var item : SItemUniqueId;
  6773.  
  6774. if( inv.GetItemEquippedOnSlot(EES_SilverSword, item) && inv.IsItemHeld(item))
  6775. items.PushBack(item);
  6776.  
  6777. if( inv.GetItemEquippedOnSlot(EES_SteelSword, item) && inv.IsItemHeld(item))
  6778. items.PushBack(item);
  6779.  
  6780. if( inv.GetItemEquippedOnSlot(EES_RangedWeapon, item) && inv.IsItemHeld(item))
  6781. items.PushBack(item);
  6782.  
  6783. if( inv.GetItemEquippedOnSlot(EES_Quickslot1, item) && inv.IsItemHeld(item))
  6784. items.PushBack(item);
  6785.  
  6786. if( inv.GetItemEquippedOnSlot(EES_Quickslot2, item) && inv.IsItemHeld(item))
  6787. items.PushBack(item);
  6788.  
  6789. if( inv.GetItemEquippedOnSlot(EES_Petard1, item) && inv.IsItemHeld(item))
  6790. items.PushBack(item);
  6791.  
  6792. if( inv.GetItemEquippedOnSlot(EES_Petard2, item) && inv.IsItemHeld(item))
  6793. items.PushBack(item);
  6794.  
  6795. // -= WMK:modQuickSlots =-
  6796. if (inv.GetItemEquippedOnSlot(EES_Petard3, item) && inv.IsItemHeld(item))
  6797. items.PushBack(item);
  6798. if (inv.GetItemEquippedOnSlot(EES_Petard4, item) && inv.IsItemHeld(item))
  6799. items.PushBack(item);
  6800. // -= WMK:modQuickSlots =-
  6801.  
  6802. return items;
  6803. }
  6804.  
  6805. public function MoveMutagenToSlot( item : SItemUniqueId, slotFrom : EEquipmentSlots, slotTo : EEquipmentSlots )
  6806. {
  6807. var pam : W3PlayerAbilityManager;
  6808. var prevSkillColor : ESkillColor;
  6809. var groupID : int;
  6810.  
  6811. if( IsSlotSkillMutagen( slotTo ) )
  6812. {
  6813. itemSlots[slotFrom] = GetInvalidUniqueId();
  6814.  
  6815.  
  6816. groupID = pam.GetSkillGroupIdOfMutagenSlot(slotFrom);
  6817. prevSkillColor = pam.GetSkillGroupColor(groupID);
  6818. pam = (W3PlayerAbilityManager)abilityManager;
  6819. pam.OnSkillMutagenUnequipped(item, slotFrom, prevSkillColor, true);
  6820.  
  6821.  
  6822.  
  6823. EquipItemInGivenSlot( item, slotTo, false );
  6824. }
  6825. }
  6826.  
  6827.  
  6828. public function UnequipItemFromSlot(slot : EEquipmentSlots, optional reequipped : bool) : bool
  6829. {
  6830. var item, bolts, id : SItemUniqueId;
  6831. var items : array<SItemUniqueId>;
  6832. var retBool : bool;
  6833. var fistsID, bolt : array<SItemUniqueId>;
  6834. var i, groupID : int;
  6835. var pam : W3PlayerAbilityManager;
  6836. var prevSkillColor : ESkillColor;
  6837. var containedAbilities : array<name>;
  6838. var dm : CDefinitionsManagerAccessor;
  6839. var armorType : EArmorType;
  6840. var isSwimming : bool;
  6841. var hud : CR4ScriptedHud;
  6842. var damagedItemModule : CR4HudModuleDamagedItems;
  6843.  
  6844. if(slot == EES_InvalidSlot || slot < 0 || slot > EnumGetMax('EEquipmentSlots') || !inv.IsIdValid(itemSlots[slot]))
  6845. return false;
  6846.  
  6847.  
  6848. if(IsSlotSkillMutagen(slot))
  6849. {
  6850.  
  6851. pam = (W3PlayerAbilityManager)abilityManager;
  6852. groupID = pam.GetSkillGroupIdOfMutagenSlot(slot);
  6853. prevSkillColor = pam.GetSkillGroupColor(groupID);
  6854. }
  6855.  
  6856.  
  6857. if(slot == EES_SilverSword || slot == EES_SteelSword)
  6858. {
  6859. PauseOilBuffs( slot == EES_SteelSword );
  6860. }
  6861.  
  6862. item = itemSlots[slot];
  6863. itemSlots[slot] = GetInvalidUniqueId();
  6864.  
  6865.  
  6866. //if(inv.ItemHasTag( item, 'PhantomWeapon' ) && GetPhantomWeaponMgr())
  6867. //{
  6868. // DestroyPhantomWeaponMgr();
  6869. //} //modSigns
  6870.  
  6871.  
  6872.  
  6873.  
  6874. if( slot == EES_SilverSword && inv.ItemHasTag( item, 'Aerondight' ) )
  6875. {
  6876. RemoveBuff( EET_Aerondight );
  6877. }
  6878.  
  6879. if( slot == EES_SteelSword && inv.ItemHasTag( item, 'PhantomWeapon' ) ) //modSigns
  6880. {
  6881. RemoveBuff( EET_PhantomWeapon );
  6882. }
  6883.  
  6884.  
  6885. if(slot == EES_RangedWeapon)
  6886. {
  6887.  
  6888. this.OnRangedForceHolster( true, true );
  6889. rangedWeapon.ClearDeployedEntity(true);
  6890. rangedWeapon = NULL;
  6891.  
  6892.  
  6893. if(GetItemEquippedOnSlot(EES_Bolt, bolts))
  6894. {
  6895. if(inv.ItemHasTag(bolts, theGame.params.TAG_INFINITE_AMMO))
  6896. {
  6897. inv.RemoveItem(bolts, inv.GetItemQuantity(bolts) );
  6898. }
  6899. }
  6900. }
  6901. else if(IsSlotSkillMutagen(slot))
  6902. {
  6903. pam.OnSkillMutagenUnequipped(item, slot, prevSkillColor);
  6904. LogSkillColors("Mutagen <<" + inv.GetItemName(item) + ">> unequipped from slot <<" + slot + ">>");
  6905. LogSkillColors("Group bonus color is now <<" + pam.GetSkillGroupColor(groupID) + ">>");
  6906. LogSkillColors("");
  6907. }
  6908.  
  6909.  
  6910. if(currentlyEquipedItem == item)
  6911. {
  6912. currentlyEquipedItem = GetInvalidUniqueId();
  6913. RaiseEvent('ForcedUsableItemUnequip');
  6914. }
  6915. if(currentlyEquipedItemL == item)
  6916. {
  6917. if ( currentlyUsedItemL )
  6918. {
  6919. currentlyUsedItemL.OnHidden( this );
  6920. }
  6921. HideUsableItem ( true );
  6922. }
  6923.  
  6924.  
  6925. if( !IsSlotPotionMutagen(slot) )
  6926. {
  6927. GetInventory().UnmountItem(item, true);
  6928. }
  6929.  
  6930. retBool = true;
  6931.  
  6932.  
  6933. if(IsAnyItemEquippedOnSlot(EES_RangedWeapon) && slot == EES_Bolt)
  6934. {
  6935. if(inv.ItemHasTag(item, theGame.params.TAG_INFINITE_AMMO))
  6936. {
  6937.  
  6938. inv.RemoveItem(item, inv.GetItemQuantityByName( inv.GetItemName(item) ) );
  6939. }
  6940. else if (!reequipped)
  6941. {
  6942.  
  6943. AddAndEquipInfiniteBolt();
  6944. }
  6945. }
  6946.  
  6947.  
  6948. if(slot == EES_SilverSword || slot == EES_SteelSword)
  6949. {
  6950. OnEquipMeleeWeapon(PW_None, true);
  6951. }
  6952.  
  6953. if( GetSelectedItemId() == item )
  6954. {
  6955. ClearSelectedItemId();
  6956. }
  6957.  
  6958. if(inv.IsItemBody(item))
  6959. {
  6960. retBool = true;
  6961. }
  6962.  
  6963. /*if(retBool && !reequipped)
  6964. {
  6965. theTelemetry.LogWithLabelAndValue( TE_INV_ITEM_UNEQUIPPED, inv.GetItemName(item), slot );
  6966.  
  6967.  
  6968. if(slot == EES_SteelSword && !IsAnyItemEquippedOnSlot(EES_SilverSword))
  6969. {
  6970. RemoveBuff(EET_EnhancedWeapon);
  6971. }
  6972. else if(slot == EES_SilverSword && !IsAnyItemEquippedOnSlot(EES_SteelSword))
  6973. {
  6974. RemoveBuff(EET_EnhancedWeapon);
  6975. }
  6976. else if(inv.IsItemAnyArmor(item))
  6977. {
  6978. if( !IsAnyItemEquippedOnSlot(EES_Armor) && !IsAnyItemEquippedOnSlot(EES_Gloves) && !IsAnyItemEquippedOnSlot(EES_Boots) && !IsAnyItemEquippedOnSlot(EES_Pants))
  6979. RemoveBuff(EET_EnhancedArmor);
  6980. }
  6981. }*/ //modSigns: removed
  6982.  
  6983.  
  6984. if(inv.ItemHasAbility(item, 'MA_HtH'))
  6985. {
  6986. inv.GetItemContainedAbilities(item, containedAbilities);
  6987. fistsID = inv.GetItemsByName('fists');
  6988. dm = theGame.GetDefinitionsManager();
  6989. for(i=0; i<containedAbilities.Size(); i+=1)
  6990. {
  6991. if(dm.AbilityHasTag(containedAbilities[i], 'MA_HtH'))
  6992. {
  6993. inv.RemoveItemCraftedAbility(fistsID[0], containedAbilities[i]);
  6994. }
  6995. }
  6996. }
  6997.  
  6998.  
  6999. if(inv.IsItemAnyArmor(item))
  7000. {
  7001. armorType = inv.GetArmorType(item);
  7002. pam = (W3PlayerAbilityManager)abilityManager;
  7003.  
  7004. pam.ManageSetArmorTypeBonus(); //modSigns
  7005.  
  7006. if(CanUseSkill(S_Perk_05) && (armorType == EAT_Light /*|| GetCharacterStats().HasAbility('Glyphword 2 _Stats', true) || inv.ItemHasAbility(item, 'Glyphword 2 _Stats')*/))
  7007. {
  7008. pam.SetPerkArmorBonus(S_Perk_05);
  7009. }
  7010. if(CanUseSkill(S_Perk_06) && (armorType == EAT_Medium /*|| GetCharacterStats().HasAbility('Glyphword 3 _Stats', true) || inv.ItemHasAbility(item, 'Glyphword 3 _Stats')*/))
  7011. {
  7012. pam.SetPerkArmorBonus(S_Perk_06);
  7013. }
  7014. if(CanUseSkill(S_Perk_07) && (armorType == EAT_Heavy /*|| GetCharacterStats().HasAbility('Glyphword 4 _Stats', true) || inv.ItemHasAbility(item, 'Glyphword 4 _Stats')*/))
  7015. {
  7016. pam.SetPerkArmorBonus(S_Perk_07);
  7017. }
  7018. }
  7019.  
  7020.  
  7021. UpdateItemSetBonuses( item, false );
  7022.  
  7023.  
  7024. if( inv.ItemHasTag( item, theGame.params.ITEM_SET_TAG_BONUS ) && !IsSetBonusActive( EISB_RedWolf_2 ) )
  7025. {
  7026. SkillReduceBombAmmoBonus();
  7027. }
  7028.  
  7029. if( slot == EES_Gloves )
  7030. {
  7031. thePlayer.DestroyEffect('runeword_4');
  7032. }
  7033.  
  7034.  
  7035. hud = (CR4ScriptedHud)theGame.GetHud();
  7036. if ( hud )
  7037. {
  7038. damagedItemModule = hud.GetDamagedItemModule();
  7039. if ( damagedItemModule )
  7040. {
  7041. damagedItemModule.OnItemUnequippedFromSlot( slot );
  7042. }
  7043. }
  7044.  
  7045.  
  7046. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_OnItemEquipped );
  7047.  
  7048. return retBool;
  7049. }
  7050.  
  7051. public function UnequipItem(item : SItemUniqueId) : bool
  7052. {
  7053. if(!inv.IsIdValid(item))
  7054. return false;
  7055.  
  7056. return UnequipItemFromSlot( itemSlots.FindFirst(item) );
  7057. }
  7058.  
  7059. public function DropItem( item : SItemUniqueId, quantity : int ) : bool
  7060. {
  7061. if(!inv.IsIdValid(item))
  7062. return false;
  7063. if(IsItemEquipped(item))
  7064. return UnequipItem(item);
  7065.  
  7066. return true;
  7067. }
  7068.  
  7069.  
  7070. public function IsItemEquippedByName(itemName : name) : bool
  7071. {
  7072. var i : int;
  7073.  
  7074. for(i=0; i<itemSlots.Size(); i+=1)
  7075. if(inv.GetItemName(itemSlots[i]) == itemName)
  7076. return true;
  7077.  
  7078. return false;
  7079. }
  7080.  
  7081.  
  7082. public function IsItemEquippedByCategoryName(categoryName : name) : bool
  7083. {
  7084. var i : int;
  7085.  
  7086. for(i=0; i<itemSlots.Size(); i+=1)
  7087. if(inv.GetItemCategory(itemSlots[i]) == categoryName)
  7088. return true;
  7089.  
  7090. return false;
  7091. }
  7092.  
  7093. //modFriendlyStash begin
  7094. //Not actually used by Preparations (allowStash == false), but needed for modFriendlyStash compatibility
  7095. //Used by modFriendlyStash to allow using stash items for crafting and alchemy
  7096. public function GetItemQuantityByNameForCrafting(itemName : name, allowStash : bool) : int
  7097. {
  7098. if( allowStash )
  7099. {
  7100. return inv.GetItemQuantityByName(itemName) + GetHorseManager().GetInventoryComponent().GetItemQuantityByName(itemName);
  7101. }
  7102. return inv.GetItemQuantityByName(itemName);
  7103. }
  7104.  
  7105. public function GetMutagenQuantityByNameForCrafting(itemName : name, allowStash : bool) : int
  7106. {
  7107. if( allowStash )
  7108. {
  7109. return inv.GetUnusedMutagensCount(itemName) + GetHorseManager().GetInventoryComponent().GetItemQuantityByName(itemName);
  7110. }
  7111. return inv.GetUnusedMutagensCount(itemName);
  7112. }
  7113.  
  7114. public function RemoveItemByNameForCrafting(itemName : name, quantity : int, allowStash : bool) : bool
  7115. {
  7116. var playerQuantity, horseQuantity, quantityToRemove, removedQuantity : int;
  7117. if( allowStash )
  7118. {
  7119. quantityToRemove = quantity;
  7120. playerQuantity = inv.GetItemQuantityByName(itemName);
  7121. if( playerQuantity < quantityToRemove )
  7122. {
  7123. quantityToRemove = playerQuantity;
  7124. }
  7125. if( quantityToRemove > 0 && inv.RemoveItemByName(itemName, quantityToRemove) )
  7126. {
  7127. removedQuantity = quantityToRemove;
  7128. }
  7129. quantityToRemove = quantity - removedQuantity;
  7130. if( quantityToRemove > 0 )
  7131. {
  7132. horseQuantity = GetHorseManager().GetInventoryComponent().GetItemQuantityByName(itemName);
  7133. if( horseQuantity < quantityToRemove )
  7134. {
  7135. quantityToRemove = horseQuantity;
  7136. }
  7137. if( quantityToRemove > 0 && GetHorseManager().GetInventoryComponent().RemoveItemByName(itemName, quantityToRemove) )
  7138. {
  7139. removedQuantity += quantityToRemove;
  7140. }
  7141. }
  7142. if( removedQuantity == quantity )
  7143. {
  7144. return true;
  7145. }
  7146. return false;
  7147. }
  7148. return inv.RemoveItemByName(itemName, quantity);
  7149. }
  7150.  
  7151. public function RemoveMutagenByNameForCrafting(itemName : name, quantity : int, allowStash : bool) : bool
  7152. {
  7153. var playerQuantity, horseQuantity, quantityToRemove, removedQuantity : int;
  7154. if( allowStash )
  7155. {
  7156. quantityToRemove = quantity;
  7157. playerQuantity = inv.GetUnusedMutagensCount(itemName);
  7158. if( playerQuantity < quantityToRemove )
  7159. {
  7160. quantityToRemove = playerQuantity;
  7161. }
  7162. if( quantityToRemove > 0 && inv.RemoveUnusedMutagensCount(itemName, quantityToRemove) )
  7163. {
  7164. removedQuantity = quantityToRemove;
  7165. }
  7166. quantityToRemove = quantity - removedQuantity;
  7167. if( quantityToRemove > 0 )
  7168. {
  7169. horseQuantity = GetHorseManager().GetInventoryComponent().GetItemQuantityByName(itemName);
  7170. if( horseQuantity < quantityToRemove )
  7171. {
  7172. quantityToRemove = horseQuantity;
  7173. }
  7174. if( quantityToRemove > 0 && GetHorseManager().GetInventoryComponent().RemoveItemByName(itemName, quantityToRemove) )
  7175. {
  7176. removedQuantity += quantityToRemove;
  7177. }
  7178. }
  7179. if( removedQuantity == quantity )
  7180. {
  7181. return true;
  7182. }
  7183. return false;
  7184. }
  7185. return inv.RemoveUnusedMutagensCount(itemName, quantity);
  7186. }
  7187. //modFriendlyStash end
  7188.  
  7189. public function GetMaxRunEncumbrance(out usesHorseBonus : bool) : float
  7190. {
  7191. var value : float;
  7192.  
  7193. //modFriendlyStash begin
  7194. if( fStashConfig.bagsRoach == false )
  7195. value = GetHorseManager().GetMaxEncumbrance();
  7196. usesHorseBonus = (value > 0);
  7197. value += CalculateAttributeValue( GetAttributeValue('encumbrance') - GetAbilityAttributeValue('ConGeralt', 'encumbrance') );
  7198. value += fStashConfig.baseWeightGeralt;
  7199. //modFriendlyStash end
  7200.  
  7201. return value;
  7202. }
  7203.  
  7204. public function GetEncumbrance() : float
  7205. {
  7206. var i: int;
  7207. var encumbrance : float;
  7208. var items : array<SItemUniqueId>;
  7209. var inve : CInventoryComponent;
  7210.  
  7211. inve = GetInventory();
  7212. inve.GetAllItems(items);
  7213.  
  7214. for(i=0; i<items.Size(); i+=1)
  7215. {
  7216. encumbrance += inve.GetItemEncumbrance( items[i] );
  7217.  
  7218.  
  7219.  
  7220. }
  7221. return encumbrance;
  7222. }
  7223.  
  7224.  
  7225.  
  7226. public function StartInvUpdateTransaction():void
  7227. {
  7228. invUpdateTransaction = true;
  7229. }
  7230.  
  7231. public function FinishInvUpdateTransaction():void
  7232. {
  7233. invUpdateTransaction = false;
  7234.  
  7235.  
  7236.  
  7237. UpdateEncumbrance();
  7238. }
  7239.  
  7240.  
  7241. public function UpdateEncumbrance()
  7242. {
  7243. var temp : bool;
  7244.  
  7245. if (invUpdateTransaction)
  7246. {
  7247.  
  7248. return;
  7249. }
  7250.  
  7251.  
  7252.  
  7253. if ( GetEncumbrance() >= (GetMaxRunEncumbrance(temp) + 1) )
  7254. {
  7255. if( !HasBuff(EET_OverEncumbered) && FactsQuerySum( "DEBUG_EncumbranceBoy" ) == 0 )
  7256. {
  7257. AddEffectDefault(EET_OverEncumbered, NULL, "OverEncumbered");
  7258. }
  7259. }
  7260. else if(HasBuff(EET_OverEncumbered))
  7261. {
  7262. RemoveAllBuffsOfType(EET_OverEncumbered);
  7263. }
  7264.  
  7265. GetWitcherPlayer().GetHorseManager().UpdateHorseEncumbrance(); //modFriendlyStash
  7266. }
  7267.  
  7268. public final function GetSkillGroupIDFromIndex(idx : int) : int
  7269. {
  7270. var pam : W3PlayerAbilityManager;
  7271.  
  7272. pam = (W3PlayerAbilityManager)abilityManager;
  7273. if(pam && pam.IsInitialized())
  7274. return pam.GetSkillGroupIDFromIndex(idx);
  7275.  
  7276. return -1;
  7277. }
  7278.  
  7279. public final function GetSkillGroupColor(groupID : int) : ESkillColor
  7280. {
  7281. var pam : W3PlayerAbilityManager;
  7282.  
  7283. pam = (W3PlayerAbilityManager)abilityManager;
  7284. if(pam && pam.IsInitialized())
  7285. return pam.GetSkillGroupColor(groupID);
  7286.  
  7287. return SC_None;
  7288. }
  7289.  
  7290. public final function GetSkillGroupsCount() : int
  7291. {
  7292. var pam : W3PlayerAbilityManager;
  7293.  
  7294. pam = (W3PlayerAbilityManager)abilityManager;
  7295. if(pam && pam.IsInitialized())
  7296. return pam.GetSkillGroupsCount();
  7297.  
  7298. return 0;
  7299. }
  7300.  
  7301.  
  7302.  
  7303.  
  7304.  
  7305.  
  7306.  
  7307.  
  7308. function CycleSelectSign( bIsCyclingLeft : bool ) : ESignType
  7309. {
  7310. var signOrder : array<ESignType>;
  7311. var i : int;
  7312.  
  7313. signOrder.PushBack( ST_Yrden );
  7314. signOrder.PushBack( ST_Quen );
  7315. signOrder.PushBack( ST_Igni );
  7316. signOrder.PushBack( ST_Axii );
  7317. signOrder.PushBack( ST_Aard );
  7318.  
  7319. for( i = 0; i < signOrder.Size(); i += 1 )
  7320. if( signOrder[i] == equippedSign )
  7321. break;
  7322.  
  7323. if(bIsCyclingLeft)
  7324. return signOrder[ (4 + i) % 5 ];
  7325. else
  7326. return signOrder[ (6 + i) % 5 ];
  7327. }
  7328.  
  7329. function ToggleNextSign()
  7330. {
  7331. SetEquippedSign(CycleSelectSign( false ));
  7332. FactsAdd("SignToggled", 1, 1);
  7333. }
  7334.  
  7335. function TogglePreviousSign()
  7336. {
  7337. SetEquippedSign(CycleSelectSign( true ));
  7338. FactsAdd("SignToggled", 1, 1);
  7339. }
  7340.  
  7341. function ProcessSignEvent( eventName : name ) : bool
  7342. {
  7343. if( currentlyCastSign != ST_None && signs[currentlyCastSign].entity)
  7344. {
  7345. return signs[currentlyCastSign].entity.OnProcessSignEvent( eventName );
  7346. }
  7347.  
  7348. return false;
  7349. }
  7350.  
  7351. var findActorTargetTimeStamp : float;
  7352. var pcModeChanneledSignTimeStamp : float;
  7353. event OnProcessCastingOrientation( isContinueCasting : bool )
  7354. {
  7355. var customOrientationTarget : EOrientationTarget;
  7356. var checkHeading : float;
  7357. var rotHeading : float;
  7358. var playerToHeadingDist : float;
  7359. var slideTargetActor : CActor;
  7360. var newLockTarget : CActor;
  7361.  
  7362. var enableNoTargetOrientation : bool;
  7363.  
  7364. var currTime : float;
  7365.  
  7366. enableNoTargetOrientation = true;
  7367. if ( GetDisplayTarget() && this.IsDisplayTargetTargetable() )
  7368. {
  7369. enableNoTargetOrientation = false;
  7370. if ( /*theInput.GetActionValue( 'CastSignHold' ) > 0*/ TestCastSignHold() /* modSigns */ || this.IsCurrentSignChanneled() )
  7371. {
  7372. if ( IsPCModeEnabled() )
  7373. {
  7374. if ( EngineTimeToFloat( theGame.GetEngineTime() ) > pcModeChanneledSignTimeStamp + 1.f )
  7375. enableNoTargetOrientation = true;
  7376. }
  7377. else
  7378. {
  7379. if ( GetCurrentlyCastSign() == ST_Igni || GetCurrentlyCastSign() == ST_Axii )
  7380. {
  7381. slideTargetActor = (CActor)GetDisplayTarget();
  7382. if ( slideTargetActor
  7383. && ( !slideTargetActor.GetGameplayVisibility() || !CanBeTargetedIfSwimming( slideTargetActor ) || !slideTargetActor.IsAlive() ) )
  7384. {
  7385. SetSlideTarget( NULL );
  7386. if ( ProcessLockTarget() )
  7387. slideTargetActor = (CActor)slideTarget;
  7388. }
  7389.  
  7390. if ( !slideTargetActor )
  7391. {
  7392. LockToTarget( false );
  7393. enableNoTargetOrientation = true;
  7394. }
  7395. else if ( IsThreat( slideTargetActor ) || GetCurrentlyCastSign() == ST_Axii )
  7396. LockToTarget( true );
  7397. else
  7398. {
  7399. LockToTarget( false );
  7400. enableNoTargetOrientation = true;
  7401. }
  7402. }
  7403. }
  7404. }
  7405.  
  7406. if ( !enableNoTargetOrientation )
  7407. {
  7408. customOrientationTarget = OT_Actor;
  7409. }
  7410. }
  7411.  
  7412. if ( enableNoTargetOrientation )
  7413. {
  7414. if ( GetPlayerCombatStance() == PCS_AlertNear && /*theInput.GetActionValue( 'CastSignHold' ) > 0*/ TestCastSignHold() /* modSigns */ )
  7415. {
  7416. if ( GetDisplayTarget() && !slideTargetActor )
  7417. {
  7418. currTime = EngineTimeToFloat( theGame.GetEngineTime() );
  7419. if ( currTime > findActorTargetTimeStamp + 1.5f )
  7420. {
  7421. findActorTargetTimeStamp = currTime;
  7422.  
  7423. newLockTarget = GetScreenSpaceLockTarget( GetDisplayTarget(), 180.f, 1.f, 0.f, true );
  7424.  
  7425. if ( newLockTarget && IsThreat( newLockTarget ) && IsCombatMusicEnabled() )
  7426. {
  7427. SetTarget( newLockTarget, true );
  7428. SetMoveTargetChangeAllowed( true );
  7429. SetMoveTarget( newLockTarget );
  7430. SetMoveTargetChangeAllowed( false );
  7431. SetSlideTarget( newLockTarget );
  7432. }
  7433. }
  7434. }
  7435. else
  7436. ProcessLockTarget();
  7437. }
  7438.  
  7439. if ( wasBRAxisPushed )
  7440. customOrientationTarget = OT_CameraOffset;
  7441. else
  7442. {
  7443. if ( !lastAxisInputIsMovement || theInput.LastUsedPCInput() )
  7444. customOrientationTarget = OT_CameraOffset;
  7445. else if ( /*theInput.GetActionValue( 'CastSignHold' ) > 0*/ TestCastSignHold() /* modSigns */ )
  7446. {
  7447. if ( GetOrientationTarget() == OT_CameraOffset )
  7448. customOrientationTarget = OT_CameraOffset;
  7449. else if ( GetPlayerCombatStance() == PCS_AlertNear || GetPlayerCombatStance() == PCS_Guarded )
  7450. customOrientationTarget = OT_CameraOffset;
  7451. else
  7452. customOrientationTarget = OT_Player;
  7453. }
  7454. else
  7455. customOrientationTarget = OT_CustomHeading;
  7456. }
  7457. }
  7458.  
  7459. if ( GetCurrentlyCastSign() == ST_Quen )
  7460. {
  7461. if ( theInput.LastUsedPCInput() )
  7462. {
  7463. customOrientationTarget = OT_Camera;
  7464. }
  7465. else if ( IsCurrentSignChanneled() )
  7466. {
  7467. if ( bLAxisReleased )
  7468. customOrientationTarget = OT_Player;
  7469. else
  7470. customOrientationTarget = OT_Camera;
  7471. }
  7472. else
  7473. customOrientationTarget = OT_Player;
  7474. }
  7475.  
  7476. if ( GetCurrentlyCastSign() == ST_Axii && IsCurrentSignChanneled() )
  7477. {
  7478. if ( slideTarget && (CActor)slideTarget )
  7479. {
  7480. checkHeading = VecHeading( slideTarget.GetWorldPosition() - this.GetWorldPosition() );
  7481. rotHeading = checkHeading;
  7482. playerToHeadingDist = AngleDistance( GetHeading(), checkHeading );
  7483.  
  7484. if ( playerToHeadingDist > 45 )
  7485. SetCustomRotation( 'ChanneledSignAxii', rotHeading, 0.0, 0.5, false );
  7486. else if ( playerToHeadingDist < -45 )
  7487. SetCustomRotation( 'ChanneledSignAxii', rotHeading, 0.0, 0.5, false );
  7488. }
  7489. else
  7490. {
  7491. checkHeading = VecHeading( theCamera.GetCameraDirection() );
  7492. rotHeading = GetHeading();
  7493. playerToHeadingDist = AngleDistance( GetHeading(), checkHeading );
  7494.  
  7495. if ( playerToHeadingDist > 45 )
  7496. SetCustomRotation( 'ChanneledSignAxii', rotHeading - 22.5, 0.0, 0.5, false );
  7497. else if ( playerToHeadingDist < -45 )
  7498. SetCustomRotation( 'ChanneledSignAxii', rotHeading + 22.5, 0.0, 0.5, false );
  7499. }
  7500. }
  7501.  
  7502. if ( IsActorLockedToTarget() )
  7503. customOrientationTarget = OT_Actor;
  7504.  
  7505. AddCustomOrientationTarget( customOrientationTarget, 'Signs' );
  7506.  
  7507. if ( customOrientationTarget == OT_CustomHeading )
  7508. SetOrientationTargetCustomHeading( GetCombatActionHeading(), 'Signs' );
  7509. }
  7510.  
  7511. event OnRaiseSignEvent()
  7512. {
  7513. var newTarget : CActor;
  7514.  
  7515. if ( ( !IsCombatMusicEnabled() && !CanAttackWhenNotInCombat( EBAT_CastSign, false, newTarget ) ) || ( IsOnBoat() && !IsCombatMusicEnabled() ) )
  7516. {
  7517. if ( CastSignFriendly() )
  7518. return true;
  7519. }
  7520. else
  7521. {
  7522. RaiseEvent('CombatActionFriendlyEnd');
  7523. SetBehaviorVariable( 'SignNum', (int)equippedSign );
  7524. SetBehaviorVariable( 'combatActionType', (int)CAT_CastSign );
  7525.  
  7526. if ( IsPCModeEnabled() )
  7527. pcModeChanneledSignTimeStamp = EngineTimeToFloat( theGame.GetEngineTime() );
  7528.  
  7529. if( RaiseForceEvent('CombatAction') )
  7530. {
  7531. OnCombatActionStart();
  7532. findActorTargetTimeStamp = EngineTimeToFloat( theGame.GetEngineTime() );
  7533. theTelemetry.LogWithValueStr(TE_FIGHT_PLAYER_USE_SIGN, SignEnumToString( equippedSign ));
  7534. return true;
  7535. }
  7536. }
  7537.  
  7538. return false;
  7539. }
  7540.  
  7541. function CastSignFriendly() : bool
  7542. {
  7543. var actor : CActor;
  7544.  
  7545. SetBehaviorVariable( 'combatActionTypeForOverlay', (int)CAT_CastSign );
  7546. if ( RaiseCombatActionFriendlyEvent() )
  7547. {
  7548.  
  7549. return true;
  7550. }
  7551.  
  7552. return false;
  7553. }
  7554.  
  7555. function CastSign() : bool
  7556. {
  7557. var equippedSignStr : string;
  7558. var newSignEnt : W3SignEntity;
  7559. var spawnPos : Vector;
  7560. var slotMatrix : Matrix;
  7561. var target : CActor;
  7562. //var mutagen17 : W3Mutagen17_Effect; //modSigns
  7563.  
  7564. if ( IsInAir() )
  7565. {
  7566. return false;
  7567. }
  7568.  
  7569. //AddTemporarySkills(); // moved to sign entity init
  7570.  
  7571. //modSigns: check for mutagen17 activation
  7572. //if(HasBuff(EET_Mutagen17))
  7573. //{
  7574. // mutagen17 = (W3Mutagen17_Effect)GetBuff(EET_Mutagen17);
  7575. // if(mutagen17.IsBoostAvailable())
  7576. // {
  7577. // mutagen17.ActivateBoost();
  7578. // //theGame.witcherLog.AddMessage("mutagen17 boost activated: sign"); //modSigns: debug
  7579. // }
  7580. //}
  7581.  
  7582.  
  7583.  
  7584. if(equippedSign == ST_Aard)
  7585. {
  7586. CalcEntitySlotMatrix('l_weapon', slotMatrix);
  7587. spawnPos = MatrixGetTranslation(slotMatrix);
  7588. }
  7589. else
  7590. {
  7591. spawnPos = GetWorldPosition();
  7592. }
  7593.  
  7594. if( equippedSign == ST_Aard || equippedSign == ST_Igni )
  7595. {
  7596. target = GetTarget();
  7597. if(target)
  7598. target.SignalGameplayEvent( 'DodgeSign' );
  7599. }
  7600.  
  7601. newSignEnt = (W3SignEntity)theGame.CreateEntity( signs[equippedSign].template, spawnPos, GetWorldRotation() );
  7602. return newSignEnt.Init( signOwner, signs[equippedSign].entity );
  7603. }
  7604.  
  7605.  
  7606. private function HAX_SignToThrowItemRestore()
  7607. {
  7608. var action : SInputAction;
  7609.  
  7610. action.value = theInput.GetActionValue('ThrowItemHold');
  7611. action.lastFrameValue = 0;
  7612.  
  7613. if(IsPressed(action) && CanSetupCombatAction_Throw())
  7614. {
  7615. if(inv.IsItemBomb(selectedItemId))
  7616. {
  7617. BombThrowStart();
  7618. }
  7619. else
  7620. {
  7621. UsableItemStart();
  7622. }
  7623.  
  7624. SetThrowHold( true );
  7625. }
  7626. }
  7627.  
  7628. event OnCFMCameraZoomFail(){}
  7629.  
  7630.  
  7631.  
  7632. public final function GetDrunkMutagens( optional sourceName : string ) : array<CBaseGameplayEffect>
  7633. {
  7634. return effectManager.GetDrunkMutagens( sourceName );
  7635. }
  7636.  
  7637. public final function GetPotionBuffs() : array<CBaseGameplayEffect>
  7638. {
  7639. return effectManager.GetPotionBuffs();
  7640. }
  7641.  
  7642. public final function RecalcPotionsDurations()
  7643. {
  7644. var i : int;
  7645. var buffs : array<CBaseGameplayEffect>;
  7646.  
  7647. buffs = GetPotionBuffs();
  7648. for(i=0; i<buffs.Size(); i+=1)
  7649. {
  7650. buffs[i].RecalcPotionDuration();
  7651. }
  7652. }
  7653.  
  7654. public function StartFrenzy()
  7655. {
  7656. //modSigns: reworked
  7657. var dm : CDefinitionsManagerAccessor = theGame.GetDefinitionsManager();
  7658. var min, max : SAbilityAttributeValue;
  7659. var skillAbilityName : name;
  7660. var skillLevel : int;
  7661. var ratio, duration : float;
  7662.  
  7663. isInFrenzy = true;
  7664. skillLevel = GetSkillLevel(S_Alchemy_s16);
  7665. skillAbilityName = SkillEnumToName(S_Alchemy_s16);
  7666. dm.GetAbilityAttributeValue(skillAbilityName, 'slowdown_ratio', min, max);
  7667. ratio = 1.0f - skillLevel * CalculateAttributeValue(min);
  7668. dm.GetAbilityAttributeValue(skillAbilityName, 'slowdown_duration', min, max);
  7669. duration = CalculateAttributeValue(min);
  7670.  
  7671. theGame.SetTimeScale(ratio, theGame.GetTimescaleSource(ETS_SkillFrenzy), theGame.GetTimescalePriority(ETS_SkillFrenzy) );
  7672. AddTimer('SkillFrenzyFinish', duration * ratio, , , , true);
  7673. }
  7674.  
  7675. timer function SkillFrenzyFinish(dt : float, optional id : int)
  7676. {
  7677. theGame.RemoveTimeScale( theGame.GetTimescaleSource(ETS_SkillFrenzy) );
  7678. isInFrenzy = false;
  7679. }
  7680.  
  7681. public function GetToxicityDamageThreshold() : float
  7682. {
  7683. var ret : float;
  7684.  
  7685. ret = theGame.params.TOXICITY_DAMAGE_THRESHOLD;
  7686.  
  7687. //if(CanUseSkill(S_Alchemy_s01)) //modSigns -> skill changed
  7688. // ret += CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s01, 'threshold', false, true)) * GetSkillLevel(S_Alchemy_s01);
  7689.  
  7690. return ret;
  7691. }
  7692.  
  7693. //modSigns
  7694. private var cachedToxDmg : float;
  7695. public function GetToxicityDamage() : float
  7696. {
  7697. var min, max : SAbilityAttributeValue;
  7698. var dmg : float;
  7699.  
  7700. if(cachedToxDmg == 0)
  7701. {
  7702. theGame.GetDefinitionsManager().GetAbilityAttributeValue('ToxicityEffect', 'DirectDamage', min, max);
  7703. cachedToxDmg = min.valueMultiplicative;
  7704. }
  7705. dmg = cachedToxDmg * GetStatMax(BCS_Vitality);
  7706. if(HasBuff(EET_Mutation10))
  7707. dmg *= ((W3Effect_Mutation10)GetBuff(EET_Mutation10)).GetDrainMult();
  7708.  
  7709. return dmg;
  7710. }
  7711.  
  7712.  
  7713.  
  7714. public final function AddToxicityOffset( val : float)
  7715. {
  7716. ((W3PlayerAbilityManager)abilityManager).AddToxicityOffset(val);
  7717. }
  7718.  
  7719. public final function SetToxicityOffset( val : float)
  7720. {
  7721. ((W3PlayerAbilityManager)abilityManager).SetToxicityOffset(val);
  7722. }
  7723.  
  7724. public final function RemoveToxicityOffset( val : float)
  7725. {
  7726. ((W3PlayerAbilityManager)abilityManager).RemoveToxicityOffset(val);
  7727. }
  7728.  
  7729. //modSigns
  7730. public final function RecalcTransmutationAbilities()
  7731. {
  7732. var ablName : name = GetSkillAbilityName(S_Alchemy_s13);
  7733. var offset : float = GetStat(BCS_Toxicity) - GetStat(BCS_Toxicity, true);
  7734. var numAbls : int = GetAbilityCount(ablName);
  7735. var targetNumAbls : int;
  7736.  
  7737. if(!CanUseSkill(S_Alchemy_s13))
  7738. {
  7739. RemoveAbilityAll(ablName);
  7740. return;
  7741. }
  7742.  
  7743. targetNumAbls = RoundMath(offset) * GetSkillLevel(S_Alchemy_s13);
  7744. if(numAbls < targetNumAbls)
  7745. AddAbilityMultiple(ablName, targetNumAbls - numAbls);
  7746. else if(numAbls > targetNumAbls)
  7747. RemoveAbilityMultiple(ablName, numAbls - targetNumAbls);
  7748. }
  7749.  
  7750.  
  7751. public final function CalculatePotionDuration(item : SItemUniqueId, isMutagenPotion : bool, optional itemName : name) : float
  7752. {
  7753. var duration, skillPassiveMod, mutagenSkillMod : float;
  7754. var val, min, max : SAbilityAttributeValue;
  7755.  
  7756.  
  7757. if(inv.IsIdValid(item))
  7758. {
  7759. duration = CalculateAttributeValue(inv.GetItemAttributeValue(item, 'duration'));
  7760. }
  7761. else
  7762. {
  7763. theGame.GetDefinitionsManager().GetItemAttributeValueNoRandom(itemName, true, 'duration', min, max);
  7764. duration = CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  7765. }
  7766.  
  7767. skillPassiveMod = CalculateAttributeValue(GetAttributeValue('potion_duration'));
  7768.  
  7769. if(isMutagenPotion && CanUseSkill(S_Alchemy_s14))
  7770. {
  7771. val = GetSkillAttributeValue(S_Alchemy_s14, 'duration', false, true);
  7772. mutagenSkillMod = val.valueMultiplicative * GetSkillLevel(S_Alchemy_s14);
  7773. }
  7774.  
  7775. //modSigns: don't add passive skill mod to mutagen potions
  7776. //duration = duration * (1 + skillPassiveMod + mutagenSkillMod);
  7777. if(isMutagenPotion)
  7778. duration = duration * (1 + mutagenSkillMod);
  7779. else
  7780. duration = duration * (1 + skillPassiveMod);
  7781.  
  7782. return duration;
  7783. }
  7784.  
  7785. public function ToxicityLowEnoughToDrinkPotion( slotid : EEquipmentSlots, optional itemId : SItemUniqueId ) : bool
  7786. {
  7787. var item : SItemUniqueId;
  7788. var maxTox : float;
  7789. var potionToxicity : float;
  7790. var toxicityOffset : float;
  7791. var effectType : EEffectType;
  7792. var customAbilityName : name;
  7793. var adrenaline : float; //modSigns
  7794. var costReduction : SAbilityAttributeValue; //modSigns
  7795.  
  7796. if(itemId != GetInvalidUniqueId())
  7797. item = itemId;
  7798. else
  7799. item = itemSlots[slotid];
  7800.  
  7801. inv.GetPotionItemBuffData(item, effectType, customAbilityName);
  7802. maxTox = abilityManager.GetStatMax(BCS_Toxicity);
  7803. potionToxicity = CalculateAttributeValue(inv.GetItemAttributeValue(item, 'toxicity'));
  7804. //modSigns begin
  7805. if(CanUseSkill(S_Alchemy_s03))
  7806. {
  7807. potionToxicity -= CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s03, 'toxicityReduction', false, false)) * GetSkillLevel(S_Alchemy_s03);
  7808. }
  7809. //modSigns end
  7810. toxicityOffset = CalculateAttributeValue(inv.GetItemAttributeValue(item, 'toxicity_offset'));
  7811.  
  7812. //modSigns
  7813. if(CanUseSkill(S_Perk_13))
  7814. {
  7815. costReduction = GetSkillAttributeValue(S_Perk_13, 'cost_reduction', false, true);
  7816. adrenaline = FloorF(GetStat(BCS_Focus));
  7817. costReduction = costReduction * adrenaline;
  7818. potionToxicity = (potionToxicity - costReduction.valueBase) * (1 - costReduction.valueMultiplicative) - costReduction.valueAdditive;
  7819. potionToxicity = MaxF(0.f, potionToxicity);
  7820. }
  7821.  
  7822. if(effectType != EET_WhiteHoney)
  7823. {
  7824. if(abilityManager.GetStat(BCS_Toxicity, false) + potionToxicity + toxicityOffset > maxTox )
  7825. {
  7826. return false;
  7827. }
  7828. }
  7829.  
  7830. return true;
  7831. }
  7832.  
  7833. public final function HasFreeToxicityToDrinkPotion( item : SItemUniqueId, effectType : EEffectType, out finalPotionToxicity : float ) : bool
  7834. {
  7835. var i : int;
  7836. var maxTox, toxicityOffset, adrenaline : float;
  7837. var costReduction : SAbilityAttributeValue;
  7838.  
  7839.  
  7840. if( effectType == EET_WhiteHoney )
  7841. {
  7842. return true;
  7843. }
  7844.  
  7845.  
  7846. maxTox = abilityManager.GetStatMax(BCS_Toxicity);
  7847. finalPotionToxicity = CalculateAttributeValue(inv.GetItemAttributeValue(item, 'toxicity'));
  7848. //modSigns begin
  7849. if(CanUseSkill(S_Alchemy_s03))
  7850. {
  7851. finalPotionToxicity -= CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s03, 'toxicityReduction', false, false)) * GetSkillLevel(S_Alchemy_s03);
  7852. }
  7853. //modSigns end
  7854. toxicityOffset = CalculateAttributeValue(inv.GetItemAttributeValue(item, 'toxicity_offset'));
  7855.  
  7856.  
  7857. if(CanUseSkill(S_Perk_13))
  7858. {
  7859. costReduction = GetSkillAttributeValue(S_Perk_13, 'cost_reduction', false, true);
  7860. adrenaline = FloorF(GetStat(BCS_Focus));
  7861. costReduction = costReduction * adrenaline;
  7862. finalPotionToxicity = (finalPotionToxicity - costReduction.valueBase) * (1 - costReduction.valueMultiplicative) - costReduction.valueAdditive;
  7863. finalPotionToxicity = MaxF(0.f, finalPotionToxicity);
  7864. }
  7865.  
  7866.  
  7867. if(abilityManager.GetStat(BCS_Toxicity, false) + finalPotionToxicity + toxicityOffset > maxTox )
  7868. {
  7869. return false;
  7870. }
  7871.  
  7872. return true;
  7873. }
  7874.  
  7875. public function DrinkPreparedPotion( slotid : EEquipmentSlots, optional itemId : SItemUniqueId )
  7876. {
  7877. var potParams : W3PotionParams;
  7878. var potionParams : SCustomEffectParams;
  7879. var factPotionParams : W3Potion_Fact_Params;
  7880. var adrenaline, hpGainValue, staminaGainValue, duration, finalPotionToxicity : float; //modSigns
  7881. var toxicity : float = GetWitcherPlayer().GetStat(BCS_Toxicity, false) / GetWitcherPlayer().GetStatMax(BCS_Toxicity);
  7882. var ret : EEffectInteract;
  7883. var effectType : EEffectType;
  7884. var item : SItemUniqueId;
  7885. var customAbilityName, factId : name;
  7886. var atts : array<name>;
  7887. var i : int;
  7888. var mutagenParams : W3MutagenBuffCustomParams;
  7889.  
  7890.  
  7891. if(itemId != GetInvalidUniqueId())
  7892. item = itemId;
  7893. else
  7894. item = itemSlots[slotid];
  7895.  
  7896.  
  7897. if(!inv.IsIdValid(item))
  7898. return;
  7899.  
  7900.  
  7901. if( inv.SingletonItemGetAmmo(item) == 0 )
  7902. return;
  7903.  
  7904.  
  7905. inv.GetPotionItemBuffData(item, effectType, customAbilityName);
  7906.  
  7907.  
  7908. if( !HasFreeToxicityToDrinkPotion( item, effectType, finalPotionToxicity ) )
  7909. {
  7910. return;
  7911. }
  7912.  
  7913. if(effectType == EET_Fact)
  7914. {
  7915. inv.GetItemAttributes(item, atts);
  7916.  
  7917. for(i=0; i<atts.Size(); i+=1)
  7918. {
  7919. if(StrBeginsWith(NameToString(atts[i]), "fact_"))
  7920. {
  7921. factId = atts[i];
  7922. break;
  7923. }
  7924. }
  7925.  
  7926. factPotionParams = new W3Potion_Fact_Params in theGame;
  7927. factPotionParams.factName = factId;
  7928. factPotionParams.potionItemName = inv.GetItemName(item);
  7929.  
  7930. potionParams.buffSpecificParams = factPotionParams;
  7931. }
  7932.  
  7933. else if(inv.ItemHasTag( item, 'Mutagen' ))
  7934. {
  7935. mutagenParams = new W3MutagenBuffCustomParams in theGame;
  7936. mutagenParams.toxicityOffset = CalculateAttributeValue(inv.GetItemAttributeValue(item, 'toxicity_offset'));
  7937. mutagenParams.potionItemName = inv.GetItemName(item);
  7938.  
  7939. potionParams.buffSpecificParams = mutagenParams;
  7940.  
  7941. //if( IsMutationActive( EPMT_Mutation10 ) && !HasBuff( EET_Mutation10 ) && IsInCombat() ) //modSigns
  7942. //{
  7943. // AddEffectDefault( EET_Mutation10, this, "Mutation 10" );
  7944. //} //modSigns: reworked
  7945. }
  7946.  
  7947. else
  7948. {
  7949. potParams = new W3PotionParams in theGame;
  7950. potParams.potionItemName = inv.GetItemName(item);
  7951.  
  7952. potionParams.buffSpecificParams = potParams;
  7953. }
  7954.  
  7955.  
  7956. duration = CalculatePotionDuration(item, inv.ItemHasTag( item, 'Mutagen' ));
  7957.  
  7958.  
  7959. potionParams.effectType = effectType;
  7960. potionParams.creator = this;
  7961. potionParams.sourceName = "drank_potion";
  7962. potionParams.duration = duration;
  7963. potionParams.customAbilityName = customAbilityName;
  7964. ret = AddEffectCustom(potionParams);
  7965.  
  7966.  
  7967. if(factPotionParams)
  7968. delete factPotionParams;
  7969.  
  7970. if(mutagenParams)
  7971. delete mutagenParams;
  7972.  
  7973.  
  7974. inv.SingletonItemRemoveAmmo(item);
  7975.  
  7976.  
  7977. if(ret == EI_Pass || ret == EI_Override || ret == EI_Cumulate)
  7978. {
  7979. if( finalPotionToxicity > 0.f || toxicity > 0.f )
  7980. {
  7981. abilityManager.GainStat(BCS_Toxicity, finalPotionToxicity );
  7982. }
  7983.  
  7984.  
  7985. if(CanUseSkill(S_Perk_13))
  7986. {
  7987. adrenaline = FloorF(GetStat(BCS_Focus)); //modSigns
  7988. abilityManager.DrainFocus(adrenaline);
  7989. }
  7990.  
  7991. if (!IsEffectActive('invisible'))
  7992. {
  7993. PlayEffect('use_potion');
  7994. }
  7995.  
  7996. if ( inv.ItemHasTag( item, 'Mutagen' ) )
  7997. {
  7998.  
  7999. theGame.GetGamerProfile().CheckTrialOfGrasses();
  8000.  
  8001.  
  8002. SetFailedFundamentalsFirstAchievementCondition(true);
  8003. }
  8004.  
  8005.  
  8006. if(CanUseSkill(S_Alchemy_s01)) //modSigns
  8007. {
  8008. staminaGainValue = ClampF(GetStatMax(BCS_Stamina) * CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s01, 'stamina_gain_perc', false, true)) * GetSkillLevel(S_Alchemy_s01), 0, GetStatMax(BCS_Stamina));
  8009. GainStat(BCS_Stamina, staminaGainValue);
  8010. }
  8011.  
  8012. if(CanUseSkill(S_Alchemy_s02))
  8013. {
  8014. hpGainValue = ClampF(GetStatMax(BCS_Vitality) * CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s02, 'vitality_gain_perc', false, true)) * GetSkillLevel(S_Alchemy_s02), 0, GetStatMax(BCS_Vitality));
  8015. GainStat(BCS_Vitality, hpGainValue);
  8016. }
  8017.  
  8018.  
  8019. /*if(CanUseSkill(S_Alchemy_s04) && !skillBonusPotionEffect && (RandF() < CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s04, 'apply_chance', false, true)) * GetSkillLevel(S_Alchemy_s04)))
  8020. {
  8021. AddRandomPotionEffectFromAlch4Skill( effectType );
  8022. }*/ //modSigns: removed
  8023.  
  8024. theGame.GetGamerProfile().SetStat(ES_ActivePotions, effectManager.GetPotionBuffsCount());
  8025. }
  8026.  
  8027. theTelemetry.LogWithLabel(TE_ELIXIR_USED, inv.GetItemName(item));
  8028.  
  8029. if(ShouldProcessTutorial('TutorialPotionAmmo'))
  8030. {
  8031. FactsAdd("tut_used_potion");
  8032. }
  8033.  
  8034. SetFailedFundamentalsFirstAchievementCondition(true);
  8035. }
  8036.  
  8037.  
  8038. /*private final function AddRandomPotionEffectFromAlch4Skill( currentlyDrankPotion : EEffectType )
  8039. {
  8040. var randomPotions : array<EEffectType>;
  8041. var currentPotion : CBaseGameplayEffect;
  8042. var effectsOld, effectsNew : array<CBaseGameplayEffect>;
  8043. var i, ind : int;
  8044. var duration : float;
  8045. var params : SCustomEffectParams;
  8046. var ret : EEffectInteract;
  8047.  
  8048.  
  8049. randomPotions.PushBack( EET_BlackBlood );
  8050. randomPotions.PushBack( EET_Blizzard );
  8051. randomPotions.PushBack( EET_FullMoon );
  8052. randomPotions.PushBack( EET_GoldenOriole );
  8053. //randomPotions.PushBack( EET_KillerWhale ); //modSigns
  8054. randomPotions.PushBack( EET_MariborForest );
  8055. randomPotions.PushBack( EET_PetriPhiltre );
  8056. randomPotions.PushBack( EET_Swallow );
  8057. randomPotions.PushBack( EET_TawnyOwl );
  8058. randomPotions.PushBack( EET_Thunderbolt );
  8059.  
  8060.  
  8061. randomPotions.Remove( currentlyDrankPotion );
  8062.  
  8063.  
  8064. ind = RandRange( randomPotions.Size() );
  8065.  
  8066.  
  8067. if( HasBuff( randomPotions[ ind ] ) )
  8068. {
  8069. currentPotion = GetBuff( randomPotions[ ind ] );
  8070. currentPotion.SetTimeLeft( currentPotion.GetInitialDurationAfterResists() );
  8071. }
  8072.  
  8073. else
  8074. {
  8075. duration = BonusPotionGetDurationFromXML( randomPotions[ ind ] );
  8076.  
  8077. if(duration > 0)
  8078. {
  8079. effectsOld = GetCurrentEffects();
  8080.  
  8081. params.effectType = randomPotions[ ind ];
  8082. params.creator = this;
  8083. params.sourceName = SkillEnumToName( S_Alchemy_s04 );
  8084. params.duration = duration;
  8085. ret = AddEffectCustom( params );
  8086.  
  8087.  
  8088. if( ret != EI_Undefined && ret != EI_Deny )
  8089. {
  8090. effectsNew = GetCurrentEffects();
  8091.  
  8092. ind = -1;
  8093. for( i=effectsNew.Size()-1; i>=0; i-=1)
  8094. {
  8095. if( !effectsOld.Contains( effectsNew[i] ) )
  8096. {
  8097. ind = i;
  8098. break;
  8099. }
  8100. }
  8101.  
  8102. if(ind > -1)
  8103. {
  8104. skillBonusPotionEffect = effectsNew[ind];
  8105. }
  8106. }
  8107. }
  8108. }
  8109. }*/ //modSigns: removed
  8110.  
  8111.  
  8112. private function BonusPotionGetDurationFromXML(type : EEffectType) : float
  8113. {
  8114. var dm : CDefinitionsManagerAccessor;
  8115. var main, ingredients : SCustomNode;
  8116. var tmpName, typeName, itemName : name;
  8117. var abs : array<name>;
  8118. var min, max : SAbilityAttributeValue;
  8119. var tmpInt : int;
  8120. var temp : array<float>;
  8121. var i, temp2, temp3 : int;
  8122.  
  8123. dm = theGame.GetDefinitionsManager();
  8124. main = dm.GetCustomDefinition('alchemy_recipes');
  8125. typeName = EffectTypeToName(type);
  8126.  
  8127.  
  8128. for(i=0; i<main.subNodes.Size(); i+=1)
  8129. {
  8130. if(dm.GetCustomNodeAttributeValueName(main.subNodes[i], 'type_name', tmpName))
  8131. {
  8132.  
  8133. if(tmpName == typeName)
  8134. {
  8135. if(dm.GetCustomNodeAttributeValueInt(main.subNodes[i], 'level', tmpInt))
  8136. {
  8137.  
  8138. if(tmpInt == 1)
  8139. {
  8140. if(dm.GetCustomNodeAttributeValueName(main.subNodes[i], 'cookedItem_name', itemName))
  8141. {
  8142.  
  8143. if(IsNameValid(itemName))
  8144. {
  8145. break;
  8146. }
  8147. }
  8148. }
  8149. }
  8150. }
  8151. }
  8152. }
  8153.  
  8154. if(!IsNameValid(itemName))
  8155. return 0;
  8156.  
  8157.  
  8158. dm.GetItemAbilitiesWithWeights(itemName, true, abs, temp, temp2, temp3);
  8159. dm.GetAbilitiesAttributeValue(abs, 'duration', min, max);
  8160. return CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  8161. }
  8162.  
  8163. public function ClearSkillBonusPotionEffect()
  8164. {
  8165. skillBonusPotionEffect = NULL;
  8166. }
  8167.  
  8168. public function GetSkillBonusPotionEffect() : CBaseGameplayEffect
  8169. {
  8170. return skillBonusPotionEffect;
  8171. }
  8172.  
  8173.  
  8174.  
  8175.  
  8176.  
  8177.  
  8178.  
  8179. public final function HasRunewordActive(abilityName : name) : bool
  8180. {
  8181. var item : SItemUniqueId;
  8182. var hasRuneword : bool;
  8183.  
  8184. hasRuneword = false;
  8185.  
  8186. 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)
  8187. {
  8188. hasRuneword = inv.ItemHasAbility(item, abilityName);
  8189. }
  8190.  
  8191. if(!hasRuneword)
  8192. {
  8193. 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)
  8194. {
  8195. hasRuneword = inv.ItemHasAbility(item, abilityName);
  8196. }
  8197. }
  8198.  
  8199. return hasRuneword;
  8200. }
  8201.  
  8202. public final function HasGlyphwordActive(abilityName : name) : bool //modSigns
  8203. {
  8204. var item : SItemUniqueId;
  8205. var hasGlyphword : bool;
  8206.  
  8207. hasGlyphword = false;
  8208.  
  8209. if(GetItemEquippedOnSlot(EES_Armor, item))
  8210. {
  8211. hasGlyphword = inv.ItemHasAbility(item, abilityName);
  8212. }
  8213.  
  8214. return hasGlyphword;
  8215. }
  8216.  
  8217. public final function GetShrineBuffs() : array<CBaseGameplayEffect>
  8218. {
  8219. var null : array<CBaseGameplayEffect>;
  8220.  
  8221. if(effectManager && effectManager.IsReady())
  8222. return effectManager.GetShrineBuffs();
  8223.  
  8224. return null;
  8225. }
  8226.  
  8227. public final function AddRepairObjectBuff(armor : bool, weapon : bool) : bool
  8228. {
  8229. var added : bool;
  8230. // CA
  8231. var wpn : EPlayerWeapon;
  8232. // CA
  8233.  
  8234. added = false;
  8235.  
  8236. if(weapon /*&& (IsAnyItemEquippedOnSlot(EES_SilverSword) || IsAnyItemEquippedOnSlot(EES_SteelSword))*/ ) //modSigns: restrictions removed
  8237. {
  8238. // CA
  8239. if (CAGrindstoneAnimOn()) {
  8240. completeAnims.GrindstoneAnim();
  8241. } else {
  8242. AddEffectDefault(EET_EnhancedWeapon, this, "repair_object", false);
  8243. DisplayHudMessage(GetLocStringByKeyExt("panel_hud_message_repair_done"));
  8244. SoundEvent("gui_inventory_silversword_attach");
  8245. }
  8246. // CA
  8247. added = true;
  8248. }
  8249.  
  8250. if(armor /*&& (IsAnyItemEquippedOnSlot(EES_Armor) || IsAnyItemEquippedOnSlot(EES_Gloves) || IsAnyItemEquippedOnSlot(EES_Boots) || IsAnyItemEquippedOnSlot(EES_Pants))*/ ) //modSigns: restrictions removed
  8251. {
  8252. // CA
  8253. if (CAWorkbenchAnimOn()) {
  8254. completeAnims.WorkbenchAnim();
  8255. } else {
  8256. AddEffectDefault(EET_EnhancedArmor, this, "repair_object", false);
  8257. DisplayHudMessage(GetLocStringByKeyExt("panel_hud_message_repair_done"));
  8258. SoundEvent("gui_inventory_armor_attach");
  8259. }
  8260. // CA
  8261. added = true;
  8262. }
  8263.  
  8264. return added;
  8265. }
  8266.  
  8267. public function StartCSAnim(buff : CBaseGameplayEffect) : bool
  8268. {
  8269.  
  8270. if(IsAnyQuenActive() && (W3CriticalDOTEffect)buff)
  8271. return false;
  8272.  
  8273. return super.StartCSAnim(buff);
  8274. }
  8275.  
  8276. public function GetPotionBuffLevel(effectType : EEffectType) : int
  8277. {
  8278. if(effectManager && effectManager.IsReady())
  8279. return effectManager.GetPotionBuffLevel(effectType);
  8280.  
  8281. return 0;
  8282. }
  8283.  
  8284.  
  8285.  
  8286.  
  8287.  
  8288.  
  8289.  
  8290. event OnLevelGained(currentLevel : int, show : bool)
  8291. {
  8292. var hud : CR4ScriptedHud;
  8293. hud = (CR4ScriptedHud)theGame.GetHud();
  8294.  
  8295. if(abilityManager && abilityManager.IsInitialized())
  8296. {
  8297. ((W3PlayerAbilityManager)abilityManager).OnLevelGained(currentLevel);
  8298. }
  8299.  
  8300. if ( theGame.GetDifficultyMode() != EDM_Hardcore )
  8301. {
  8302. Heal(GetStatMax(BCS_Vitality));
  8303. }
  8304.  
  8305.  
  8306. if(currentLevel >= 35)
  8307. {
  8308. theGame.GetGamerProfile().AddAchievement(EA_Immortal);
  8309. }
  8310.  
  8311. if ( hud && currentLevel < levelManager.GetMaxLevel() && FactsQuerySum( "DebugNoLevelUpUpdates" ) == 0 )
  8312. {
  8313. hud.OnLevelUpUpdate(currentLevel, show);
  8314. }
  8315.  
  8316. theGame.RequestAutoSave( "level gained", false );
  8317. }
  8318.  
  8319. public function GetSignStats(skill : ESkill, out damageType : name, out damageVal : float, out spellPower : SAbilityAttributeValue)
  8320. {
  8321. var i, size : int;
  8322. var dm : CDefinitionsManagerAccessor;
  8323. var attrs : array<name>;
  8324.  
  8325. spellPower = GetPowerStatValue(CPS_SpellPower);
  8326.  
  8327. dm = theGame.GetDefinitionsManager();
  8328. dm.GetAbilityAttributes(GetSkillAbilityName(skill), attrs);
  8329. size = attrs.Size();
  8330.  
  8331. for( i = 0; i < size; i += 1 )
  8332. {
  8333. if( IsDamageTypeNameValid(attrs[i]) )
  8334. {
  8335. damageVal = CalculateAttributeValue(GetSkillAttributeValue(skill, attrs[i], false, true));
  8336. damageType = attrs[i];
  8337. break;
  8338. }
  8339. }
  8340. }
  8341.  
  8342.  
  8343. public function SetIgnorePainMaxVitality(val : float)
  8344. {
  8345. if(abilityManager && abilityManager.IsInitialized())
  8346. abilityManager.SetStatPointMax(BCS_Vitality, val);
  8347. }
  8348.  
  8349. event OnAnimEvent_ActionBlend( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  8350. {
  8351. if ( animEventType == AET_DurationStart && !disableActionBlend )
  8352. {
  8353. if ( this.IsCastingSign() )
  8354. ProcessSignEvent( 'cast_end' );
  8355.  
  8356.  
  8357. FindMoveTarget();
  8358. SetCanPlayHitAnim( true );
  8359. this.SetBIsCombatActionAllowed( true );
  8360.  
  8361. if ( this.GetFinisherVictim() && this.GetFinisherVictim().HasAbility( 'ForceFinisher' ) && !isInFinisher )
  8362. {
  8363. this.GetFinisherVictim().SignalGameplayEvent( 'Finisher' );
  8364. }
  8365. else if (this.BufferCombatAction != EBAT_EMPTY )
  8366. {
  8367.  
  8368.  
  8369.  
  8370. if ( !IsCombatMusicEnabled() )
  8371. {
  8372. SetCombatActionHeading( ProcessCombatActionHeading( this.BufferCombatAction ) );
  8373. FindTarget();
  8374. UpdateDisplayTarget( true );
  8375. }
  8376.  
  8377. if ( AllowAttack( GetTarget(), this.BufferCombatAction ) )
  8378. this.ProcessCombatActionBuffer();
  8379. }
  8380. else
  8381. {
  8382.  
  8383. ResumeStaminaRegen( 'InsideCombatAction' );
  8384.  
  8385.  
  8386.  
  8387. }
  8388. }
  8389. else if ( disableActionBlend )
  8390. {
  8391. disableActionBlend = false;
  8392. }
  8393. }
  8394.  
  8395.  
  8396. event OnAnimEvent_Sign( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  8397. {
  8398. if( animEventType == AET_Tick )
  8399. {
  8400. ProcessSignEvent( animEventName );
  8401. }
  8402. }
  8403.  
  8404. event OnAnimEvent_Throwable( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  8405. {
  8406. var thrownEntity : CThrowable;
  8407.  
  8408. thrownEntity = (CThrowable)EntityHandleGet( thrownEntityHandle );
  8409.  
  8410. if ( inv.IsItemCrossbow( inv.GetItemFromSlot('l_weapon') ) && rangedWeapon.OnProcessThrowEvent( animEventName ) )
  8411. {
  8412. return true;
  8413. }
  8414. else if( thrownEntity && IsThrowingItem() && thrownEntity.OnProcessThrowEvent( animEventName ) )
  8415. {
  8416. return true;
  8417. }
  8418. }
  8419.  
  8420. event OnTaskSyncAnim( npc : CNewNPC, animNameLeft : name )
  8421. {
  8422. var tmpBool : bool;
  8423. var tmpName : name;
  8424. var damage, points, resistance : float;
  8425. var min, max : SAbilityAttributeValue;
  8426. var mc : EMonsterCategory;
  8427.  
  8428. super.OnTaskSyncAnim( npc, animNameLeft );
  8429.  
  8430. if( animNameLeft == 'BruxaBite' && IsMutationActive( EPMT_Mutation4 ) )
  8431. {
  8432. theGame.GetMonsterParamsForActor( npc, mc, tmpName, tmpBool, tmpBool, tmpBool );
  8433.  
  8434. if( mc == MC_Vampire )
  8435. {
  8436. GetResistValue( CDS_BleedingRes, points, resistance );
  8437.  
  8438. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'BleedingEffect', 'DirectDamage', min, max );
  8439. damage = MaxF( 0.f, max.valueMultiplicative * GetMaxHealth() - points );
  8440.  
  8441. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'BleedingEffect', 'duration', min, max );
  8442. damage *= min.valueAdditive * ( 1 - MinF( 1.f, resistance ) );
  8443.  
  8444. if( damage > 0.f )
  8445. {
  8446. //npc.AddAbility( 'Mutation4BloodDebuff' ); //modSigns: moved to acid effect
  8447. ProcessActionMutation4ReturnedDamage( damage, npc, EAHA_ForceNo );
  8448. //npc.AddTimer( 'RemoveMutation4BloodDebuff', 15.f, , , , , true ); //modSigns: moved to acid effect
  8449. }
  8450. }
  8451. }
  8452. }
  8453.  
  8454.  
  8455. //modSigns: redone
  8456. public function ProcessActionMutation4ReturnedDamage( damageDealt : float, attacker : CActor, hitAnimationType : EActionHitAnim, optional action : W3DamageAction ) : bool
  8457. {
  8458. var customParams : SCustomEffectParams;
  8459. var currToxicity : float;
  8460. var min, max, customDamageValue : SAbilityAttributeValue;
  8461. var dm : CDefinitionsManagerAccessor;
  8462. var animAction : W3DamageAction;
  8463. var customDuration : float; //modSigns
  8464.  
  8465. if( damageDealt <= 0 )
  8466. {
  8467. return false;
  8468. }
  8469.  
  8470. currToxicity = GetStat( BCS_Toxicity );
  8471.  
  8472. if( currToxicity <= 0 )
  8473. {
  8474. return false;
  8475. }
  8476.  
  8477. dm = theGame.GetDefinitionsManager();
  8478. dm.GetAbilityAttributeValue( 'AcidEffect', 'DirectDamage', min, max );
  8479. customDamageValue.valueAdditive = currToxicity * min.valueAdditive;
  8480. dm.GetAbilityAttributeValue( 'AcidEffect', 'duration', min, max );
  8481. customDuration = min.valueAdditive;
  8482.  
  8483. if( customDamageValue.valueAdditive <= 0 || customDuration <= 0 )
  8484. {
  8485. return false;
  8486. }
  8487.  
  8488. if( action )
  8489. {
  8490. action.SetMutation4Triggered();
  8491. }
  8492.  
  8493. //dm.GetAbilityAttributeValue( 'AcidEffect', 'DirectDamage', min, max );
  8494. //customDamageValue.valueAdditive = damageDealt * min.valueAdditive;
  8495. //
  8496. //if( currToxicity > 0 )
  8497. //{
  8498. // customDamageValue.valueAdditive *= currToxicity;
  8499. //}
  8500. //
  8501. //dm.GetAbilityAttributeValue( 'AcidEffect', 'duration', min, max );
  8502. //customDamageValue.valueAdditive /= min.valueAdditive;
  8503.  
  8504. customParams.effectType = EET_Acid;
  8505. customParams.effectValue = customDamageValue;
  8506. customParams.duration = customDuration;
  8507. customParams.creator = this;
  8508. customParams.sourceName = 'Mutation4';
  8509.  
  8510. attacker.AddEffectCustom( customParams );
  8511.  
  8512.  
  8513. animAction = new W3DamageAction in theGame;
  8514. animAction.Initialize( this, attacker, NULL, 'Mutation4', EHRT_Reflect, CPS_Undefined, true, false, false, false );
  8515. animAction.SetCannotReturnDamage( true );
  8516. animAction.SetCanPlayHitParticle( false );
  8517. animAction.SetHitAnimationPlayType( hitAnimationType );
  8518. theGame.damageMgr.ProcessAction( animAction );
  8519. delete animAction;
  8520.  
  8521. theGame.MutationHUDFeedback( MFT_PlayOnce );
  8522.  
  8523. return true;
  8524. }
  8525.  
  8526. event OnPlayerActionEnd()
  8527. {
  8528. var l_i : int;
  8529. var l_bed : W3WitcherBed;
  8530.  
  8531. l_i = (int)GetBehaviorVariable( 'playerExplorationAction' );
  8532.  
  8533. if( l_i == PEA_GoToSleep )
  8534. {
  8535. l_bed = (W3WitcherBed)theGame.GetEntityByTag( 'witcherBed' );
  8536. BlockAllActions( 'WitcherBed', false );
  8537. l_bed.ApplyAppearance( "collision" );
  8538. l_bed.GotoState( 'WakeUp' );
  8539. theGame.ReleaseNoSaveLock( l_bed.m_bedSaveLock );
  8540.  
  8541.  
  8542. substateManager.m_MovementCorrectorO.disallowRotWhenGoingToSleep = false;
  8543. }
  8544.  
  8545. super.OnPlayerActionEnd();
  8546. }
  8547.  
  8548. event OnPlayerActionStartFinished()
  8549. {
  8550. var l_initData : W3SingleMenuInitData;
  8551. var l_i : int;
  8552.  
  8553. l_i = (int)GetBehaviorVariable( 'playerExplorationAction' );
  8554.  
  8555. if( l_i == PEA_GoToSleep )
  8556. {
  8557. //modFriendlyMeditation begin
  8558. UnblockAction( EIAB_OpenMeditation, 'WitcherBed' );
  8559. UnblockAction( EIAB_MeditationWaiting, 'WitcherBed' );
  8560. //modFriendlyMeditation end
  8561.  
  8562. l_initData = new W3SingleMenuInitData in this;
  8563. l_initData.SetBlockOtherPanels( true );
  8564. l_initData.ignoreSaveSystem = true;
  8565. l_initData.ignoreMeditationCheck = true;
  8566. l_initData.setDefaultState( '' );
  8567. l_initData.isBonusMeditationAvailable = true;
  8568. l_initData.fixedMenuName = 'MeditationClockMenu';
  8569.  
  8570. theGame.RequestMenuWithBackground( 'MeditationClockMenu', 'CommonMenu', l_initData );
  8571. }
  8572.  
  8573. super.OnPlayerActionStartFinished();
  8574. }
  8575.  
  8576. public function IsInCombatAction_SpecialAttack() : bool
  8577. {
  8578. if ( IsInCombatAction() && ( GetCombatAction() == EBAT_SpecialAttack_Light || GetCombatAction() == EBAT_SpecialAttack_Heavy ) )
  8579. return true;
  8580. else
  8581. return false;
  8582. }
  8583.  
  8584. public function IsInCombatAction_SpecialAttackHeavy() : bool
  8585. {
  8586. if ( IsInCombatAction() && GetCombatAction() == EBAT_SpecialAttack_Heavy )
  8587. return true;
  8588. else
  8589. return false;
  8590. }
  8591.  
  8592. protected function WhenCombatActionIsFinished()
  8593. {
  8594. super.WhenCombatActionIsFinished();
  8595. RemoveTimer( 'ProcessAttackTimer' );
  8596. RemoveTimer( 'AttackTimerEnd' );
  8597. CastSignAbort();
  8598. specialAttackCamera = false;
  8599. this.OnPerformSpecialAttack( true, false );
  8600. }
  8601.  
  8602. //modSigns: RemoveTemporarySkills should never happen on combat action end,
  8603. //as if sign casting interrupts any other action, temp skills are removed
  8604. //by the end of interrupted action and before the sign is actually cast!
  8605. event OnCombatActionEnd()
  8606. {
  8607. this.CleanCombatActionBuffer();
  8608. super.OnCombatActionEnd();
  8609.  
  8610. //RemoveTemporarySkills();
  8611. }
  8612.  
  8613. event OnCombatActionFriendlyEnd()
  8614. {
  8615. if ( IsCastingSign() )
  8616. {
  8617. SetBehaviorVariable( 'IsCastingSign', 0 );
  8618. SetCurrentlyCastSign( ST_None, NULL );
  8619. LogChannel( 'ST_None', "ST_None" );
  8620. }
  8621.  
  8622. super.OnCombatActionFriendlyEnd();
  8623. }
  8624.  
  8625. public function GetPowerStatValue( stat : ECharacterPowerStats, optional ablName : name, optional ignoreDeath : bool ) : SAbilityAttributeValue
  8626. {
  8627. var result : SAbilityAttributeValue;
  8628.  
  8629.  
  8630. result = super.GetPowerStatValue( stat, ablName, ignoreDeath );
  8631. //modSigns: W3DamageAction.GetPowerStatValue calls for actor.GetPowerStatValue twice:
  8632. //second time with attackName as ablName to obtain attack specific boosts, so Euphoria boost ends up
  8633. //being applied twice. Character stats for popup menu don't use ablName as there is no attack and no attackName,
  8634. //so bonus is displayed properly there, but gets doubled when actual damage is calculated in combat.
  8635. //To fix this we need to check for non-ability specific calls:
  8636. //if( !IsNameValid(ablName) && stat != CPS_Undefined )
  8637. // ApplyMutation10StatBoost( result ); //modSigns: reworked
  8638.  
  8639. return result;
  8640. }
  8641.  
  8642.  
  8643.  
  8644. timer function OpenRadialMenu( time: float, id : int )
  8645. {
  8646.  
  8647. if( GetBIsCombatActionAllowed() && !IsUITakeInput() )
  8648. {
  8649. bShowRadialMenu = true;
  8650. }
  8651.  
  8652. this.RemoveTimer('OpenRadialMenu');
  8653. }
  8654.  
  8655. public function OnAddRadialMenuOpenTimer( )
  8656. {
  8657.  
  8658.  
  8659.  
  8660.  
  8661.  
  8662. this.AddTimer('OpenRadialMenu', _HoldBeforeOpenRadialMenuTime * theGame.GetTimeScale() );
  8663.  
  8664. }
  8665.  
  8666. public function SetShowRadialMenuOpenFlag( bSet : bool )
  8667. {
  8668.  
  8669. bShowRadialMenu = bSet;
  8670. }
  8671.  
  8672. public function OnRemoveRadialMenuOpenTimer()
  8673. {
  8674.  
  8675. this.RemoveTimer('OpenRadialMenu');
  8676. }
  8677.  
  8678. public function ResetRadialMenuOpenTimer()
  8679. {
  8680.  
  8681. this.RemoveTimer('OpenRadialMenu');
  8682. if( GetBIsCombatActionAllowed() )
  8683. {
  8684.  
  8685.  
  8686. AddTimer('OpenRadialMenu', _HoldBeforeOpenRadialMenuTime * theGame.GetTimeScale() );
  8687. }
  8688. }
  8689.  
  8690.  
  8691.  
  8692. timer function ResendCompanionDisplayName(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.ResendDisplayName();
  8704. }
  8705. }
  8706. }
  8707.  
  8708. timer function ResendCompanionDisplayNameSecond(dt : float, id : int)
  8709. {
  8710. var hud : CR4ScriptedHud;
  8711. var companionModule : CR4HudModuleCompanion;
  8712.  
  8713. hud = (CR4ScriptedHud)theGame.GetHud();
  8714. if( hud )
  8715. {
  8716. companionModule = (CR4HudModuleCompanion)hud.GetHudModule("CompanionModule");
  8717. if( companionModule )
  8718. {
  8719. companionModule.ResendDisplayNameSecond();
  8720. }
  8721. }
  8722. }
  8723.  
  8724. public function RemoveCompanionDisplayNameTimer()
  8725. {
  8726. this.RemoveTimer('ResendCompanionDisplayName');
  8727. }
  8728.  
  8729. public function RemoveCompanionDisplayNameTimerSecond()
  8730. {
  8731. this.RemoveTimer('ResendCompanionDisplayNameSecond');
  8732. }
  8733.  
  8734.  
  8735. public function GetCompanionNPCTag() : name
  8736. {
  8737. return companionNPCTag;
  8738. }
  8739.  
  8740. public function SetCompanionNPCTag( value : name )
  8741. {
  8742. companionNPCTag = value;
  8743. }
  8744.  
  8745. public function GetCompanionNPCTag2() : name
  8746. {
  8747. return companionNPCTag2;
  8748. }
  8749.  
  8750. public function SetCompanionNPCTag2( value : name )
  8751. {
  8752. companionNPCTag2 = value;
  8753. }
  8754.  
  8755. public function GetCompanionNPCIconPath() : string
  8756. {
  8757. return companionNPCIconPath;
  8758. }
  8759.  
  8760. public function SetCompanionNPCIconPath( value : string )
  8761. {
  8762. companionNPCIconPath = value;
  8763. }
  8764.  
  8765. public function GetCompanionNPCIconPath2() : string
  8766. {
  8767. return companionNPCIconPath2;
  8768. }
  8769.  
  8770. public function SetCompanionNPCIconPath2( value : string )
  8771. {
  8772. companionNPCIconPath2 = value;
  8773. }
  8774.  
  8775.  
  8776.  
  8777. //modSigns: chance to ignore hit anim
  8778. /*public function GetChanceToIgnoreHitAnim() : float
  8779. {
  8780. var armorPieces : array<int>;
  8781.  
  8782. inv.CountArmorPieces(armorPieces);
  8783. return armorPieces[0] * 0 + armorPieces[1] * 2.5 + armorPieces[2] * 10;
  8784. }*/
  8785.  
  8786. public function ReactToBeingHit(damageAction : W3DamageAction, optional buffNotApplied : bool) : bool
  8787. {
  8788. //var chance : float;
  8789. //var procQuen : W3SignEntity;
  8790.  
  8791. if(IsThrowingItem() || IsThrowingItemWithAim()) //modSigns: no need to abort throwing if not in fact throwing
  8792. {
  8793. if(!damageAction.IsDoTDamage() && damageAction.DealsAnyDamage() && damageAction.GetHitAnimationPlayType() != EAHA_ForceNo) //modSigns
  8794. {
  8795. if(inv.IsItemBomb(selectedItemId))
  8796. {
  8797. BombThrowAbort();
  8798. }
  8799. else
  8800. {
  8801. ThrowingAbort();
  8802. }
  8803. }
  8804. }
  8805.  
  8806.  
  8807. /*if(damageAction.IsActionRanged())
  8808. {
  8809. chance = CalculateAttributeValue(GetAttributeValue('quen_chance_on_projectile'));
  8810. if(chance > 0)
  8811. {
  8812. chance = ClampF(chance, 0, 1);
  8813.  
  8814. if(RandF() < chance)
  8815. {
  8816. procQuen = (W3SignEntity)theGame.CreateEntity(signs[ST_Quen].template, GetWorldPosition(), GetWorldRotation() );
  8817. procQuen.Init(signOwner, signs[ST_Quen].entity, true );
  8818. procQuen.OnStarted();
  8819. procQuen.OnThrowing();
  8820. procQuen.OnEnded();
  8821. }
  8822. }
  8823. }*/ //modSigns: moved to reduce damage
  8824.  
  8825.  
  8826. if( !((W3Effect_Toxicity)damageAction.causer) )
  8827. MeditationForceAbort(true);
  8828.  
  8829.  
  8830. if(IsDoingSpecialAttack(false))
  8831. damageAction.SetHitAnimationPlayType(EAHA_ForceNo);
  8832.  
  8833. return super.ReactToBeingHit(damageAction, buffNotApplied);
  8834. }
  8835.  
  8836. protected function ShouldPauseHealthRegenOnHit() : bool
  8837. {
  8838.  
  8839. if( ( HasBuff( EET_Swallow ) && GetPotionBuffLevel( EET_Swallow ) >= 3 ) || HasBuff( EET_Runeword8 ) || HasBuff( EET_Mutation11Buff ) || HasBuff( EET_UndyingSkillImmortal ) ) //modSigns
  8840. {
  8841. return false;
  8842. }
  8843.  
  8844. return true;
  8845. }
  8846.  
  8847. public function SetMappinToHighlight( mappinName : name, mappinState : bool )
  8848. {
  8849. var mappinDef : SHighlightMappin;
  8850. mappinDef.MappinName = mappinName;
  8851. mappinDef.MappinState = mappinState;
  8852. MappinToHighlight.PushBack(mappinDef);
  8853. }
  8854.  
  8855. public function ClearMappinToHighlight()
  8856. {
  8857. MappinToHighlight.Clear();
  8858. }
  8859.  
  8860. public function CastSignAbort()
  8861. {
  8862. if( currentlyCastSign != ST_None && signs[currentlyCastSign].entity)
  8863. {
  8864. signs[currentlyCastSign].entity.OnSignAborted();
  8865. }
  8866.  
  8867.  
  8868. }
  8869.  
  8870. event OnBlockingSceneStarted( scene: CStoryScene )
  8871. {
  8872. //---=== modFriendlyMeditation ===---
  8873. //var med : W3PlayerWitcherStateMeditationWaiting;
  8874. //
  8875. //
  8876. //med = (W3PlayerWitcherStateMeditationWaiting)GetCurrentState();
  8877. //if(med)
  8878. //{
  8879. // med.StopRequested(true);
  8880. //}
  8881. ModEndMeditation();
  8882. //---=== modFriendlyMeditation ===---
  8883.  
  8884.  
  8885. super.OnBlockingSceneStarted( scene );
  8886. }
  8887.  
  8888.  
  8889.  
  8890.  
  8891.  
  8892. public function GetHorseManager() : W3HorseManager
  8893. {
  8894. return (W3HorseManager)EntityHandleGet( horseManagerHandle );
  8895. }
  8896.  
  8897.  
  8898. public function HorseEquipItem(horsesItemId : SItemUniqueId) : bool
  8899. {
  8900. var man : W3HorseManager;
  8901.  
  8902. man = GetHorseManager();
  8903. if(man)
  8904. return man.EquipItem(horsesItemId) != GetInvalidUniqueId();
  8905.  
  8906. return false;
  8907. }
  8908.  
  8909.  
  8910. public function HorseUnequipItem(slot : EEquipmentSlots) : bool
  8911. {
  8912. var man : W3HorseManager;
  8913.  
  8914. man = GetHorseManager();
  8915. if(man)
  8916. return man.UnequipItem(slot) != GetInvalidUniqueId();
  8917.  
  8918. return false;
  8919. }
  8920.  
  8921.  
  8922. public final function HorseRemoveItemByName(itemName : name, quantity : int)
  8923. {
  8924. var man : W3HorseManager;
  8925.  
  8926. man = GetHorseManager();
  8927. if(man)
  8928. man.HorseRemoveItemByName(itemName, quantity);
  8929. }
  8930.  
  8931.  
  8932. public final function HorseRemoveItemByCategory(itemCategory : name, quantity : int)
  8933. {
  8934. var man : W3HorseManager;
  8935.  
  8936. man = GetHorseManager();
  8937. if(man)
  8938. man.HorseRemoveItemByCategory(itemCategory, quantity);
  8939. }
  8940.  
  8941.  
  8942. public final function HorseRemoveItemByTag(itemTag : name, quantity : int)
  8943. {
  8944. var man : W3HorseManager;
  8945.  
  8946. man = GetHorseManager();
  8947. if(man)
  8948. man.HorseRemoveItemByTag(itemTag, quantity);
  8949. }
  8950.  
  8951. public function GetAssociatedInventory() : CInventoryComponent
  8952. {
  8953. var man : W3HorseManager;
  8954.  
  8955. man = GetHorseManager();
  8956. if(man)
  8957. return man.GetInventoryComponent();
  8958.  
  8959. return NULL;
  8960. }
  8961.  
  8962.  
  8963.  
  8964.  
  8965.  
  8966. public final function TutorialMutagensUnequipPlayerSkills() : array<STutorialSavedSkill>
  8967. {
  8968. var pam : W3PlayerAbilityManager;
  8969.  
  8970. pam = (W3PlayerAbilityManager)abilityManager;
  8971. return pam.TutorialMutagensUnequipPlayerSkills();
  8972. }
  8973.  
  8974. public final function TutorialMutagensEquipOneGoodSkill()
  8975. {
  8976. var pam : W3PlayerAbilityManager;
  8977.  
  8978. pam = (W3PlayerAbilityManager)abilityManager;
  8979. pam.TutorialMutagensEquipOneGoodSkill();
  8980. }
  8981.  
  8982. public final function TutorialMutagensEquipOneGoodOneBadSkill()
  8983. {
  8984. var pam : W3PlayerAbilityManager;
  8985.  
  8986. pam = (W3PlayerAbilityManager)abilityManager;
  8987. if(pam)
  8988. pam.TutorialMutagensEquipOneGoodOneBadSkill();
  8989. }
  8990.  
  8991. public final function TutorialMutagensEquipThreeGoodSkills()
  8992. {
  8993. var pam : W3PlayerAbilityManager;
  8994.  
  8995. pam = (W3PlayerAbilityManager)abilityManager;
  8996. if(pam)
  8997. pam.TutorialMutagensEquipThreeGoodSkills();
  8998. }
  8999.  
  9000. public final function TutorialMutagensCleanupTempSkills(savedEquippedSkills : array<STutorialSavedSkill>)
  9001. {
  9002. var pam : W3PlayerAbilityManager;
  9003.  
  9004. pam = (W3PlayerAbilityManager)abilityManager;
  9005. return pam.TutorialMutagensCleanupTempSkills(savedEquippedSkills);
  9006. }
  9007.  
  9008.  
  9009.  
  9010.  
  9011.  
  9012. //modSigns: redone
  9013. //modSigns: by default, there's no armor stamina penalty as armor class already
  9014. //affects action cost, but you can enable it in options
  9015. public final function CalculatedArmorStaminaRegenBonus() : float
  9016. {
  9017. var armorEq, glovesEq, pantsEq, bootsEq : bool;
  9018. var armorId, glovesId, pantsId, bootsId : SItemUniqueId;
  9019. var staminaRegenVal : float;
  9020. var armorRegenVal : SAbilityAttributeValue;
  9021.  
  9022. if(!theGame.params.IsArmorRegenPenaltyEnabled())
  9023. return 0.0f;
  9024.  
  9025. //base armor stamina regen bonus/penalty
  9026. armorRegenVal = GetAttributeValue('staminaRegen_armor_mod');
  9027. staminaRegenVal = armorRegenVal.valueMultiplicative;
  9028.  
  9029. //equipped pieces
  9030. armorEq = inv.GetItemEquippedOnSlot( EES_Armor, armorId );
  9031. glovesEq = inv.GetItemEquippedOnSlot( EES_Gloves, glovesId );
  9032. pantsEq = inv.GetItemEquippedOnSlot( EES_Pants, pantsId );
  9033. bootsEq = inv.GetItemEquippedOnSlot( EES_Boots, bootsId );
  9034.  
  9035. //glyphwords change stamina, not replace it
  9036. //if( HasGlyphwordActive( 'Glyphword 2 _Stats' ) )
  9037. //{
  9038. // if ( armorEq && !inv.ItemHasTag(armorId, 'LightArmor') )
  9039. // staminaRegenVal += 0.07;
  9040. // if ( glovesEq && !inv.ItemHasTag(glovesId, 'LightArmor') )
  9041. // staminaRegenVal += 0.01;
  9042. // if ( pantsEq && !inv.ItemHasTag(pantsId, 'LightArmor') )
  9043. // staminaRegenVal += 0.01;
  9044. // if ( bootsEq && !inv.ItemHasTag(bootsId, 'LightArmor') )
  9045. // staminaRegenVal += 0.01;
  9046. //}
  9047. //else if( HasGlyphwordActive( 'Glyphword 3 _Stats' ) )
  9048. //{
  9049. //}
  9050. //else if( HasGlyphwordActive( 'Glyphword 4 _Stats' ) )
  9051. //{
  9052. // if ( armorEq && !inv.ItemHasTag(armorId, 'HeavyArmor') )
  9053. // staminaRegenVal -= 0.20;
  9054. // if ( glovesEq && !inv.ItemHasTag(glovesId, 'HeavyArmor') )
  9055. // staminaRegenVal -= 0.025;
  9056. // if ( pantsEq && !inv.ItemHasTag(pantsId, 'HeavyArmor') )
  9057. // staminaRegenVal -= 0.025;
  9058. // if ( bootsEq && !inv.ItemHasTag(bootsId, 'HeavyArmor') )
  9059. // staminaRegenVal -= 0.05;
  9060. //} //modSigns: reworked
  9061.  
  9062. //stamina regen bonus for missing armor pieces
  9063. if ( !armorEq )
  9064. staminaRegenVal += 0.11;
  9065. if ( !glovesEq )
  9066. staminaRegenVal += 0.02;
  9067. if ( !pantsEq )
  9068. staminaRegenVal += 0.03;
  9069. if ( !bootsEq )
  9070. staminaRegenVal += 0.04;
  9071.  
  9072. //debug
  9073. //theGame.witcherLog.AddMessage( "staminaRegenVal = " + staminaRegenVal );
  9074.  
  9075. return staminaRegenVal;
  9076. }
  9077.  
  9078. //modSigns: reworked
  9079. public function GetOffenseStatsList( optional hackMode : int ) : SPlayerOffenseStats
  9080. {
  9081. var playerOffenseStats : SPlayerOffenseStats;
  9082. var min, max, value : SAbilityAttributeValue;
  9083. var attackPower : SAbilityAttributeValue;
  9084. var fastAPBonus, strongAPBonus, steelAPBonus, silverAPBonus : SAbilityAttributeValue;
  9085. var critChance, critPowerBonus, fastCritChanceBonus, strongCritChanceBonus, fastCritPowerBonus, strongCritPowerBonus : float;
  9086. var steelCritChanceBonus, silverCritChanceBonus, steelCritPowerBonus, silverCritPowerBonus : float;
  9087. var steelDmg, silverDmg, elementalSteel, elementalSilver : float;
  9088. var attackPowerCrossbow : SAbilityAttributeValue;
  9089. var silverSword, steelSword, crossbow, bolt : SItemUniqueId;
  9090. var mutagen : CBaseGameplayEffect;
  9091. var thunder : W3Potion_Thunderbolt;
  9092. var strongDmgMult, bonusDmgMult, bonusDmgMultCrossbow, bonusDmgMultSteel, bonusDmgMultSilver : float;
  9093. var steelFastAP, silverFastAP, steelStrongAP, silverStrongAP, steelFastCritAP, silverFastCritAP, steelStrongCritAP, silverStrongCritAP : SAbilityAttributeValue;
  9094. var steelFastCritChance, silverFastCritChance, steelStrongCritChance, silverStrongCritChance : float;
  9095.  
  9096. if(!abilityManager || !abilityManager.IsInitialized())
  9097. return playerOffenseStats;
  9098.  
  9099. //base damage increase for heavy attacks
  9100. value = GetSkillAttributeValue(S_Sword_2, 'heavy_attack_dmg_boost', false, true);
  9101. strongDmgMult = 1 + value.valueMultiplicative;
  9102.  
  9103. //generic bonuses
  9104. attackPower = GetPowerStatValue(CPS_AttackPower);
  9105. //Bear tier 1 power bonus
  9106. if(IsSetBonusActive(EISB_Bear_1))
  9107. {
  9108. theGame.GetDefinitionsManager().GetAbilityAttributeValue(GetSetBonusAbility(EISB_Bear_1), 'attack_power', min, max);
  9109. attackPower.valueMultiplicative += min.valueMultiplicative * GetSetPartsEquipped(EIST_Bear) * FloorF(GetStat(BCS_Focus));
  9110. }
  9111. critChance = CalculateAttributeValue(GetAttributeValue(theGame.params.CRITICAL_HIT_CHANCE));
  9112. critPowerBonus = CalculateAttributeValue(GetAttributeValue(theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  9113.  
  9114. //attack type specific bonuses
  9115. fastAPBonus = GetSkillAttributeValue(S_Sword_1, PowerStatEnumToName(CPS_AttackPower), false, true);
  9116. strongAPBonus = GetSkillAttributeValue(S_Sword_2, PowerStatEnumToName(CPS_AttackPower), false, true);
  9117. if (CanUseSkill(S_Sword_s21))
  9118. fastAPBonus += GetSkillAttributeValue(S_Sword_s21, PowerStatEnumToName(CPS_AttackPower), false, true) * GetSkillLevel(S_Sword_s21);
  9119. if (CanUseSkill(S_Sword_s04))
  9120. strongAPBonus += GetSkillAttributeValue(S_Sword_s04, PowerStatEnumToName(CPS_AttackPower), false, true) * GetSkillLevel(S_Sword_s04);
  9121. if (HasBuff(EET_LynxSetBonus)) //lynx tier 1 attack type specific bonuses
  9122. {
  9123. fastAPBonus.valueMultiplicative += ((W3Effect_LynxSetBonus)GetBuff(EET_LynxSetBonus)).GetLynxBonus(false);
  9124. strongAPBonus.valueMultiplicative += ((W3Effect_LynxSetBonus)GetBuff(EET_LynxSetBonus)).GetLynxBonus(true);
  9125. }
  9126. if (CanUseSkill(S_Sword_s17))
  9127. {
  9128. fastCritChanceBonus = CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s17, theGame.params.CRITICAL_HIT_CHANCE, false, true)) * GetSkillLevel(S_Sword_s17);
  9129. fastCritPowerBonus = CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s17, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, true)) * GetSkillLevel(S_Sword_s17);
  9130. }
  9131. if (CanUseSkill(S_Sword_s08))
  9132. {
  9133. strongCritChanceBonus = CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s08, theGame.params.CRITICAL_HIT_CHANCE, false, true)) * GetSkillLevel(S_Sword_s08);
  9134. strongCritPowerBonus = CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s08, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, true)) * GetSkillLevel(S_Sword_s08);
  9135. }
  9136.  
  9137. //steel sword specific bonuses
  9138. if (GetItemEquippedOnSlot(EES_SteelSword, steelSword))
  9139. {
  9140. steelDmg = GetTotalWeaponDamage(steelSword, theGame.params.DAMAGE_NAME_SLASHING, GetInvalidUniqueId());
  9141. steelDmg += GetTotalWeaponDamage(steelSword, theGame.params.DAMAGE_NAME_PIERCING, GetInvalidUniqueId());
  9142. steelDmg += GetTotalWeaponDamage(steelSword, theGame.params.DAMAGE_NAME_BLUDGEONING, GetInvalidUniqueId());
  9143. elementalSteel = CalculateAttributeValue(GetInventory().GetItemAttributeValue(steelSword, theGame.params.DAMAGE_NAME_FIRE));
  9144. elementalSteel += CalculateAttributeValue(GetInventory().GetItemAttributeValue(steelSword, theGame.params.DAMAGE_NAME_FROST));
  9145. elementalSteel += CalculateAttributeValue(GetInventory().GetItemAttributeValue(steelSword, theGame.params.DAMAGE_NAME_POISON)); //modSigns
  9146. //weapon bonuses are added OnHold, so we need to retrieve them specifically if we want to show them
  9147. if (!GetInventory().IsItemHeld(steelSword))
  9148. {
  9149. steelCritChanceBonus += CalculateAttributeValue(GetInventory().GetItemAttributeValue(steelSword, theGame.params.CRITICAL_HIT_CHANCE));
  9150. steelCritPowerBonus += CalculateAttributeValue(GetInventory().GetItemAttributeValue(steelSword, theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  9151. steelAPBonus += GetInventory().GetItemAttributeValue(steelSword, 'attack_power');
  9152. }
  9153. //bonus damage
  9154. bonusDmgMultSteel += CalculateAttributeValue(GetInventory().GetItemAttributeValue(steelSword, 'sword_dmg_bonus'));
  9155. //tier 2 wolf oil bonuses
  9156. steelCritChanceBonus += CalculateAttributeValue(inv.GetOilCriticalChanceBonus(steelSword, MC_NotSet));
  9157. steelCritPowerBonus += CalculateAttributeValue(inv.GetOilCriticalDamageBonus(steelSword, MC_NotSet));
  9158. }
  9159.  
  9160. //silver sword specific bonuses
  9161. if (GetItemEquippedOnSlot(EES_SilverSword, silverSword))
  9162. {
  9163. silverDmg = GetTotalWeaponDamage(silverSword, theGame.params.DAMAGE_NAME_SILVER, GetInvalidUniqueId());
  9164. elementalSilver = CalculateAttributeValue(GetInventory().GetItemAttributeValue(silverSword, theGame.params.DAMAGE_NAME_FIRE));
  9165. elementalSilver += CalculateAttributeValue(GetInventory().GetItemAttributeValue(silverSword, theGame.params.DAMAGE_NAME_FROST));
  9166. elementalSilver += CalculateAttributeValue(GetInventory().GetItemAttributeValue(silverSword, theGame.params.DAMAGE_NAME_POISON)); //modSigns
  9167. //weapon bonuses are added OnHold, so we need to retrieve them specifically if we want to show them
  9168. if (!GetInventory().IsItemHeld(silverSword))
  9169. {
  9170. silverCritChanceBonus += CalculateAttributeValue(GetInventory().GetItemAttributeValue(silverSword, theGame.params.CRITICAL_HIT_CHANCE));
  9171. silverCritPowerBonus += CalculateAttributeValue(GetInventory().GetItemAttributeValue(silverSword, theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  9172. silverAPBonus += GetInventory().GetItemAttributeValue(silverSword, 'attack_power');
  9173. }
  9174. //bonus damage
  9175. bonusDmgMultSilver += CalculateAttributeValue(GetInventory().GetItemAttributeValue(silverSword, 'sword_dmg_bonus'));
  9176. //tier 2 wolf oil bonuses
  9177. silverCritChanceBonus += CalculateAttributeValue(inv.GetOilCriticalChanceBonus(silverSword, MC_NotSet));
  9178. silverCritPowerBonus += CalculateAttributeValue(inv.GetOilCriticalDamageBonus(silverSword, MC_NotSet));
  9179. }
  9180.  
  9181. //since drawn sword adds its stats to character stats, we now need to do this hackiest shit ever
  9182. if (GetInventory().IsItemHeld(steelSword))
  9183. {
  9184. //remove steel bonuses from silver stats
  9185. silverCritChanceBonus -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(steelSword, theGame.params.CRITICAL_HIT_CHANCE));
  9186. silverCritPowerBonus -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(steelSword, theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  9187. silverAPBonus -= GetInventory().GetItemAttributeValue(steelSword, 'attack_power');
  9188. }
  9189. if (GetInventory().IsItemHeld(silverSword))
  9190. {
  9191. //remove silver bonuses from steel stats
  9192. steelCritChanceBonus -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(silverSword, theGame.params.CRITICAL_HIT_CHANCE));
  9193. steelCritPowerBonus -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(silverSword, theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  9194. steelAPBonus -= GetInventory().GetItemAttributeValue(silverSword, 'attack_power');
  9195. }
  9196.  
  9197. //Thunderbolt lvl 3 crit chance
  9198. thunder = (W3Potion_Thunderbolt)GetBuff(EET_Thunderbolt);
  9199. if(thunder && thunder.GetBuffLevel() == 3 && GetCurWeather() == EWE_Storm)
  9200. {
  9201. critPowerBonus += 1.0f;
  9202. }
  9203.  
  9204. //heft damage increase
  9205. if(HasGlyphwordActive('Glyphword 4 _Stats'))
  9206. {
  9207. theGame.GetDefinitionsManager().GetAbilityAttributeValue('Glyphword 4 _Stats', 'glyphword4_mod', min, max);
  9208. bonusDmgMult += CalculateAttributeValue(min);
  9209. }
  9210.  
  9211. //Euphoria damage bonus
  9212. if(HasBuff(EET_Mutation10))
  9213. {
  9214. steelDmg += GetToxicityDamage();
  9215. silverDmg += GetToxicityDamage();
  9216. }
  9217.  
  9218. //final attributes
  9219. steelFastAP = attackPower + fastAPBonus + steelAPBonus;
  9220. silverFastAP = attackPower + fastAPBonus + silverAPBonus;
  9221. steelStrongAP = attackPower + strongAPBonus + steelAPBonus;
  9222. silverStrongAP = attackPower + strongAPBonus + silverAPBonus;
  9223. steelFastCritAP = steelFastAP;
  9224. steelFastCritAP.valueMultiplicative += critPowerBonus + fastCritPowerBonus + steelCritPowerBonus;
  9225. silverFastCritAP = silverFastAP;
  9226. silverFastCritAP.valueMultiplicative += critPowerBonus + fastCritPowerBonus + silverCritPowerBonus;
  9227. steelStrongCritAP = steelStrongAP;
  9228. steelStrongCritAP.valueMultiplicative += critPowerBonus + strongCritPowerBonus + steelCritPowerBonus;
  9229. silverStrongCritAP = silverStrongAP;
  9230. silverStrongCritAP.valueMultiplicative += critPowerBonus + strongCritPowerBonus + silverCritPowerBonus;
  9231. steelFastCritChance = critChance + fastCritChanceBonus + steelCritChanceBonus;
  9232. silverFastCritChance = critChance + fastCritChanceBonus + silverCritChanceBonus;
  9233. steelStrongCritChance = critChance + strongCritChanceBonus + steelCritChanceBonus;
  9234. silverStrongCritChance = critChance + strongCritChanceBonus + silverCritChanceBonus;
  9235.  
  9236. //fill offense stats
  9237. playerOffenseStats.steelFastAP = steelFastAP.valueMultiplicative;
  9238. playerOffenseStats.silverFastAP = silverFastAP.valueMultiplicative;
  9239. playerOffenseStats.steelStrongAP = steelStrongAP.valueMultiplicative;
  9240. playerOffenseStats.silverStrongAP = silverStrongAP.valueMultiplicative;
  9241. playerOffenseStats.steelFastCritAP = steelFastCritAP.valueMultiplicative;
  9242. playerOffenseStats.silverFastCritAP = silverFastCritAP.valueMultiplicative;
  9243. playerOffenseStats.steelStrongCritAP = steelStrongCritAP.valueMultiplicative;
  9244. playerOffenseStats.silverStrongCritAP = silverStrongCritAP.valueMultiplicative;
  9245. playerOffenseStats.steelFastCritChance = steelFastCritChance * 100;
  9246. playerOffenseStats.silverFastCritChance = silverFastCritChance * 100;
  9247. playerOffenseStats.steelStrongCritChance = steelStrongCritChance * 100;
  9248. playerOffenseStats.silverStrongCritChance = silverStrongCritChance * 100;
  9249. if ( steelDmg != 0 )
  9250. {
  9251. playerOffenseStats.steelFastDmg = ((steelDmg + elementalSteel) * (1 + bonusDmgMult + bonusDmgMultSteel) + steelFastAP.valueBase) * steelFastAP.valueMultiplicative + steelFastAP.valueAdditive;
  9252. playerOffenseStats.steelFastCritDmg = ((steelDmg + elementalSteel) * (1 + bonusDmgMult + bonusDmgMultSteel) + steelFastCritAP.valueBase) * steelFastCritAP.valueMultiplicative + steelFastCritAP.valueAdditive;
  9253. playerOffenseStats.steelFastDPS = playerOffenseStats.steelFastDmg * (1 - steelFastCritChance) + playerOffenseStats.steelFastCritDmg * steelFastCritChance;
  9254. playerOffenseStats.steelStrongDmg = ((steelDmg + elementalSteel) * (strongDmgMult + bonusDmgMult + bonusDmgMultSteel) + steelStrongAP.valueBase) * steelStrongAP.valueMultiplicative + steelStrongAP.valueAdditive;
  9255. playerOffenseStats.steelStrongCritDmg = ((steelDmg + elementalSteel) * (strongDmgMult + bonusDmgMult + bonusDmgMultSteel) + steelStrongCritAP.valueBase) * steelStrongCritAP.valueMultiplicative + steelStrongCritAP.valueAdditive;
  9256. playerOffenseStats.steelStrongDPS = playerOffenseStats.steelStrongDmg * (1 - steelStrongCritChance) + playerOffenseStats.steelStrongCritDmg * steelStrongCritChance;
  9257. }
  9258. if ( silverDmg != 0 )
  9259. {
  9260. playerOffenseStats.silverFastDmg = ((silverDmg + elementalSilver) * (1 + bonusDmgMult + bonusDmgMultSilver) + silverFastAP.valueBase) * silverFastAP.valueMultiplicative + silverFastAP.valueAdditive;
  9261. playerOffenseStats.silverFastCritDmg = ((silverDmg + elementalSilver) * (1 + bonusDmgMult + bonusDmgMultSilver) + silverFastCritAP.valueBase) * silverFastCritAP.valueMultiplicative + silverFastCritAP.valueAdditive;
  9262. playerOffenseStats.silverFastDPS = playerOffenseStats.silverFastDmg * (1 - silverFastCritChance) + playerOffenseStats.silverFastCritDmg * silverFastCritChance;
  9263. playerOffenseStats.silverStrongDmg = ((silverDmg + elementalSilver) * (strongDmgMult + bonusDmgMult + bonusDmgMultSilver) + silverStrongAP.valueBase) * silverStrongAP.valueMultiplicative + silverStrongAP.valueAdditive;
  9264. playerOffenseStats.silverStrongCritDmg = ((silverDmg + elementalSilver) * (strongDmgMult + bonusDmgMult + bonusDmgMultSilver) + silverStrongCritAP.valueBase) * silverStrongCritAP.valueMultiplicative + silverStrongCritAP.valueAdditive;
  9265. playerOffenseStats.silverStrongDPS = playerOffenseStats.silverStrongDmg * (1 - silverStrongCritChance) + playerOffenseStats.silverStrongCritDmg * silverStrongCritChance;
  9266. }
  9267.  
  9268. //modSigns: crossbow redone
  9269. playerOffenseStats.crossbowSteelDmgType = theGame.params.DAMAGE_NAME_PIERCING;
  9270. playerOffenseStats.crossbowElementaDmgType = '';
  9271. if (GetItemEquippedOnSlot(EES_RangedWeapon, crossbow))
  9272. {
  9273. attackPowerCrossbow = attackPower + GetInventory().GetItemAttributeValue(crossbow, PowerStatEnumToName(CPS_AttackPower));
  9274. playerOffenseStats.crossbowAttackPower = attackPowerCrossbow.valueMultiplicative;
  9275. playerOffenseStats.crossbowCritChance = GetCriticalHitChance( false, false, NULL, MC_NotSet, true );
  9276.  
  9277. value = GetCriticalHitDamageBonus( crossbow, MC_NotSet, false ) + inv.GetItemAttributeValue( crossbow, theGame.params.CRITICAL_HIT_DAMAGE_BONUS );
  9278. //Cat Eyes mutation crit damage boost
  9279. if( IsMutationActive( EPMT_Mutation9 ) )
  9280. {
  9281. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation9', 'critical_damage', min, max );
  9282. value += min;
  9283. }
  9284. if( CanUseSkill(S_Sword_s07) )
  9285. {
  9286. value += GetSkillAttributeValue(S_Sword_s07, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, true) * GetSkillLevel(S_Sword_s07);
  9287. }
  9288. playerOffenseStats.crossbowCritDmgBonus = CalculateAttributeValue(value);
  9289.  
  9290. //bolt stats
  9291. if (GetItemEquippedOnSlot(EES_Bolt, bolt))
  9292. {
  9293. playerOffenseStats.crossbowSteelDmgType = GetCrossbowSteelDmgName();
  9294. inv.GetItemStatByName(inv.GetItemName(bolt), playerOffenseStats.crossbowSteelDmgType, playerOffenseStats.crossbowSteelDmg);
  9295. inv.GetItemStatByName(inv.GetItemName(bolt), 'SilverDamage', playerOffenseStats.crossbowSilverDmg);
  9296. playerOffenseStats.crossbowElementaDmgType = GetCrossbowElementaDmgName();
  9297. if(IsNameValid(playerOffenseStats.crossbowElementaDmgType))
  9298. inv.GetItemStatByName(inv.GetItemName(bolt), playerOffenseStats.crossbowElementaDmgType, playerOffenseStats.crossbowElementaDmg);
  9299. }
  9300.  
  9301. //perk 2
  9302. if( CanUseSkill(S_Perk_02) )
  9303. {
  9304. min = GetSkillAttributeValue(S_Perk_02, 'xbow_dmg_bonus', false, true);
  9305. bonusDmgMultCrossbow += min.valueMultiplicative;
  9306. }
  9307.  
  9308. //modSigns: mutation9 base damage boost
  9309. if( IsMutationActive( EPMT_Mutation9 ) )
  9310. {
  9311. theGame.GetDefinitionsManager().GetAbilityAttributeValue('Mutation9', 'mut9_damage', min, max);
  9312. playerOffenseStats.crossbowSteelDmg *= 1 + min.valueMultiplicative;
  9313. playerOffenseStats.crossbowSilverDmg *= 1 + min.valueMultiplicative;
  9314. playerOffenseStats.crossbowElementaDmg *= 1 + min.valueMultiplicative;
  9315. }
  9316.  
  9317. playerOffenseStats.crossbowSteelDmg = (playerOffenseStats.crossbowSteelDmg * (1 + bonusDmgMultCrossbow) + attackPowerCrossbow.valueBase) * attackPowerCrossbow.valueMultiplicative;
  9318. playerOffenseStats.crossbowSilverDmg = (playerOffenseStats.crossbowSilverDmg * (1 + bonusDmgMultCrossbow) + attackPowerCrossbow.valueBase) * attackPowerCrossbow.valueMultiplicative;
  9319. playerOffenseStats.crossbowElementaDmg = (playerOffenseStats.crossbowElementaDmg * (1 + bonusDmgMultCrossbow) + attackPowerCrossbow.valueBase) * attackPowerCrossbow.valueMultiplicative;
  9320. }
  9321.  
  9322. return playerOffenseStats;
  9323. }
  9324.  
  9325. public function GetTotalWeaponDamage(weaponId : SItemUniqueId, damageTypeName : name, crossbowId : SItemUniqueId) : float
  9326. {
  9327. var damage, durRatio, durMod, itemMod : float;
  9328. var repairObjectBonus, min, max : SAbilityAttributeValue;
  9329. var aerondight : W3Effect_Aerondight; //modSigns
  9330. var phantomWeapon : W3Effect_PhantomWeapon; //modSigns
  9331.  
  9332. //durMod = 0;
  9333. durMod = 1; //modSigns: zero value effectively removes all non-physical damages from weapon
  9334. damage = super.GetTotalWeaponDamage(weaponId, damageTypeName, crossbowId);
  9335.  
  9336.  
  9337. //modSigns: changed -> moved
  9338. //if( IsMutationActive( EPMT_Mutation9 ) && inv.IsItemBolt( weaponId ) /*&& IsDamageTypeAnyPhysicalType( damageTypeName )*/ )
  9339. //{
  9340. // theGame.GetDefinitionsManager().GetAbilityAttributeValue('Mutation9', 'mut9_damage', min, max);
  9341. // damage *= 1 + min.valueMultiplicative;
  9342. //}
  9343.  
  9344.  
  9345. if(IsPhysicalResistStat(GetResistForDamage(damageTypeName, false)))
  9346. {
  9347. repairObjectBonus = inv.GetItemAttributeValue(weaponId, theGame.params.REPAIR_OBJECT_BONUS);
  9348. durRatio = -1;
  9349.  
  9350. if(inv.IsIdValid(crossbowId) && inv.HasItemDurability(crossbowId))
  9351. {
  9352. durRatio = inv.GetItemDurabilityRatio(crossbowId);
  9353. }
  9354. else if(inv.IsIdValid(weaponId) && inv.HasItemDurability(weaponId))
  9355. {
  9356. durRatio = inv.GetItemDurabilityRatio(weaponId);
  9357. }
  9358.  
  9359.  
  9360. if(durRatio >= 0)
  9361. durMod = theGame.params.GetDurabilityMultiplier(durRatio, true);
  9362. else
  9363. durMod = 1;
  9364. }
  9365.  
  9366.  
  9367. if( damageTypeName == 'SilverDamage' && inv.ItemHasTag( weaponId, 'Aerondight' ) )
  9368. {
  9369. //itemMod = inv.GetItemModifierFloat( weaponId, 'PermDamageBoost' );
  9370. //if( itemMod > 0.f )
  9371. //{
  9372. // damage += itemMod;
  9373. //}
  9374. //modSigns: damage boost per enemy
  9375. aerondight = (W3Effect_Aerondight)GetBuff(EET_Aerondight);
  9376. if(aerondight)
  9377. damage += aerondight.GetDamageBoost();
  9378. }
  9379.  
  9380. //modSigns
  9381. if( damageTypeName == 'SlashingDamage' && inv.ItemHasTag( weaponId, 'PhantomWeapon' ) )
  9382. {
  9383. phantomWeapon = (W3Effect_PhantomWeapon)GetBuff(EET_PhantomWeapon);
  9384. if(phantomWeapon && phantomWeapon.IsFullyCharged())
  9385. {
  9386. damage += phantomWeapon.GetDamageBoost();
  9387. //theGame.witcherLog.AddMessage("Phantom dmg boost = " + phantomWeapon.GetDamageBoost());
  9388. }
  9389. }
  9390.  
  9391. //modSigns: Invigoration
  9392. if( HasBuff(EET_Runeword4) && ( damageTypeName == 'SilverDamage' || damageTypeName == 'SlashingDamage' ) )
  9393. damage *= 1 + ((W3Effect_Runeword4)GetBuff(EET_Runeword4)).GetDamageBonus();
  9394.  
  9395. return damage * (durMod + repairObjectBonus.valueMultiplicative);
  9396. }
  9397.  
  9398.  
  9399.  
  9400.  
  9401.  
  9402. public final function GetSkillPathType(skill : ESkill) : ESkillPath
  9403. {
  9404. if(abilityManager && abilityManager.IsInitialized())
  9405. return ((W3PlayerAbilityManager)abilityManager).GetSkillPathType(skill);
  9406.  
  9407. return ESP_NotSet;
  9408. }
  9409.  
  9410. public function GetSkillLevel(s : ESkill) : int
  9411. {
  9412. if(abilityManager && abilityManager.IsInitialized())
  9413. return ((W3PlayerAbilityManager)abilityManager).GetSkillLevel(s);
  9414.  
  9415. return -1;
  9416. }
  9417.  
  9418. public function GetSkillMaxLevel(s : ESkill) : int
  9419. {
  9420. if(abilityManager && abilityManager.IsInitialized())
  9421. return ((W3PlayerAbilityManager)abilityManager).GetSkillMaxLevel(s);
  9422.  
  9423. return -1;
  9424. }
  9425.  
  9426. public function GetBoughtSkillLevel(s : ESkill) : int
  9427. {
  9428. if(abilityManager && abilityManager.IsInitialized())
  9429. return ((W3PlayerAbilityManager)abilityManager).GetBoughtSkillLevel(s);
  9430.  
  9431. return -1;
  9432. }
  9433.  
  9434.  
  9435. public function GetAxiiLevel() : int
  9436. {
  9437. var level : int;
  9438.  
  9439. level = 1;
  9440.  
  9441. if(CanUseSkill(S_Magic_s17)) level += GetSkillLevel(S_Magic_s17);
  9442.  
  9443. return Clamp(level, 1, 4);
  9444. }
  9445.  
  9446. public function IsInFrenzy() : bool
  9447. {
  9448. return isInFrenzy;
  9449. }
  9450.  
  9451. public function HasRecentlyCountered() : bool
  9452. {
  9453. return hasRecentlyCountered;
  9454. }
  9455.  
  9456. public function SetRecentlyCountered(counter : bool)
  9457. {
  9458. hasRecentlyCountered = counter;
  9459. }
  9460.  
  9461. //modSigns
  9462. timer function ResetRecentlyCountered(dt : float, id : int)
  9463. {
  9464. hasRecentlyCountered = false;
  9465. }
  9466.  
  9467. timer function CheckBlockedSkills(dt : float, id : int)
  9468. {
  9469. var nextCallTime : float;
  9470.  
  9471. nextCallTime = ((W3PlayerAbilityManager)abilityManager).CheckBlockedSkills(dt);
  9472. if(nextCallTime != -1)
  9473. AddTimer('CheckBlockedSkills', nextCallTime, , , , true);
  9474. }
  9475.  
  9476. //modSigns: reworked
  9477. public function RemoveTemporarySkills()
  9478. {
  9479. var i : int;
  9480. var pam : W3PlayerAbilityManager;
  9481.  
  9482. if(tempLearnedSignSkills.Size() > 0)
  9483. {
  9484. pam = (W3PlayerAbilityManager)abilityManager;
  9485. for(i=0; i<tempLearnedSignSkills.Size(); i+=1)
  9486. {
  9487. pam.RemoveTemporarySkill(tempLearnedSignSkills[i]);
  9488. }
  9489.  
  9490. tempLearnedSignSkills.Clear();
  9491. //theGame.witcherLog.AddMessage("Temp skills removed");
  9492. }
  9493. RemoveAbilityAll(SkillEnumToName(S_Sword_s19));
  9494. }
  9495.  
  9496. public function RemoveTemporarySkill(skill : SSimpleSkill) : bool
  9497. {
  9498. var pam : W3PlayerAbilityManager;
  9499.  
  9500. pam = (W3PlayerAbilityManager)abilityManager;
  9501. if(pam && pam.IsInitialized())
  9502. return pam.RemoveTemporarySkill(skill);
  9503.  
  9504. return false;
  9505. }
  9506.  
  9507.  
  9508. //modSigns: reworked, focus is drained in sign entity
  9509. public function AddTemporarySkills() : bool
  9510. {
  9511. tempLearnedSignSkills.Clear();
  9512. if(CanUseSkill(S_Sword_s19) && GetStat(BCS_Focus) >= 3)
  9513. {
  9514. tempLearnedSignSkills = ((W3PlayerAbilityManager)abilityManager).AddTempNonAlchemySkills();
  9515. AddAbilityMultiple(SkillEnumToName(S_Sword_s19), GetSkillLevel(S_Sword_s19));
  9516. }
  9517. return tempLearnedSignSkills.Size();
  9518. }
  9519.  
  9520.  
  9521.  
  9522. public function HasAlternateQuen() : bool
  9523. {
  9524. var quenEntity : W3QuenEntity;
  9525.  
  9526. quenEntity = (W3QuenEntity)GetCurrentSignEntity();
  9527. if(quenEntity)
  9528. {
  9529. return quenEntity.IsAlternateCast();
  9530. }
  9531.  
  9532. return false;
  9533. }
  9534.  
  9535.  
  9536.  
  9537.  
  9538.  
  9539. public function AddPoints(type : ESpendablePointType, amount : int, show : bool)
  9540. {
  9541. levelManager.AddPoints(type, amount, show);
  9542. }
  9543.  
  9544. public function GetLevel() : int {return levelManager.GetLevel();}
  9545. public function GetMaxLevel() : int {return levelManager.GetMaxLevel();}
  9546. public function GetTotalExpForNextLevel() : int {return levelManager.GetTotalExpForNextLevel();}
  9547. public function GetPointsTotal(type : ESpendablePointType) : int {return levelManager.GetPointsTotal(type);}
  9548. public function IsAutoLeveling() : bool {return autoLevel;}
  9549. public function SetAutoLeveling( b : bool ) {autoLevel = b;}
  9550.  
  9551. public function GetMissingExpForNextLevel() : int
  9552. {
  9553. return Max(0, GetTotalExpForNextLevel() - GetPointsTotal(EExperiencePoint));
  9554. }
  9555.  
  9556.  
  9557.  
  9558.  
  9559. private saved var runewordInfusionType : ESignType;
  9560. default runewordInfusionType = ST_None;
  9561.  
  9562. public final function GetRunewordInfusionType() : ESignType
  9563. {
  9564. return runewordInfusionType;
  9565. }
  9566.  
  9567.  
  9568. //modSigns: reworked
  9569. public function QuenImpulse( isAlternate : bool, signEntity : W3QuenEntity, source : string, optional forceSkillLevel : int, optional forceSpellPower : SAbilityAttributeValue )
  9570. {
  9571. var level, i, j : int;
  9572. var atts, damages : array<name>;
  9573. var ents : array<CGameplayEntity>;
  9574. var action : W3DamageAction;
  9575. var dm : CDefinitionsManagerAccessor;
  9576. var skillAbilityName : name;
  9577. var dmg : float;
  9578. var min, max : SAbilityAttributeValue;
  9579. var pos : Vector;
  9580. var spellPower : SAbilityAttributeValue;
  9581. var staminaPrc : float;
  9582.  
  9583. //forced level (for Flood of Anger)
  9584. if(forceSkillLevel > 0)
  9585. level = forceSkillLevel;
  9586. else
  9587. level = GetSkillLevel(S_Magic_s13);
  9588.  
  9589. //forced spell power (for Flood of Anger)
  9590. if(forceSpellPower.valueMultiplicative > 0)
  9591. spellPower = forceSpellPower;
  9592. else
  9593. spellPower = GetTotalSignSpellPower(S_Magic_4);
  9594.  
  9595. dm = theGame.GetDefinitionsManager();
  9596. skillAbilityName = GetSkillAbilityName(S_Magic_s13);
  9597.  
  9598. //add damage
  9599. if(level >= 2)
  9600. {
  9601. dm.GetAbilityAttributes(skillAbilityName, atts);
  9602. for(i = 0; i < atts.Size(); i += 1)
  9603. {
  9604. if(IsDamageTypeNameValid(atts[i]))
  9605. damages.PushBack(atts[i]);
  9606. }
  9607. }
  9608.  
  9609. //find enemies in range
  9610. //pos = signEntity.GetWorldPosition();
  9611. //FindGameplayEntitiesInSphere(ents, pos, 3, 1000, '', FLAG_OnlyAliveActors + FLAG_ExcludeTarget + FLAG_Attitude_Hostile + FLAG_Attitude_Neutral + FLAG_TestLineOfSight, this);
  9612. //modSigns: the above variant doesn't work properly. Use box instead of a sphere.
  9613. FindGameplayEntitiesInRange(ents, this, 3, 100, , FLAG_OnlyAliveActors + FLAG_ExcludeTarget + FLAG_Attitude_Hostile, this);
  9614.  
  9615. for(i = 0; i < ents.Size(); i += 1)
  9616. {
  9617. //debug log
  9618. //theGame.witcherLog.AddMessage("Quen impulse:");
  9619. //theGame.witcherLog.AddMessage("Target # " + (i + 1) + ": " + ents[i].GetDisplayName());
  9620.  
  9621. //init damage action, use spell power and light hit reaction
  9622. action = new W3DamageAction in theGame;
  9623. action.Initialize(this, ents[i], signEntity, source, EHRT_Light, CPS_SpellPower, false, false, true, false);
  9624. action.SetSignSkill(S_Magic_s13);
  9625. action.SetCannotReturnDamage(true);
  9626. action.SetProcessBuffsIfNoDamage(true);
  9627.  
  9628. //add damages
  9629. if(level >= 2)
  9630. {
  9631. for(j = 0; j < damages.Size(); j += 1)
  9632. {
  9633. dm.GetAbilityAttributeValue(skillAbilityName, damages[j], min, max);
  9634. //damage scales with ability level
  9635. dmg = CalculateAttributeValue(GetAttributeRandomizedValue(min, max)) * (level - 1);
  9636. if( HasGlyphwordActive( 'Glyphword 5 _Stats' ) ) //modSigns
  9637. {
  9638. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Glyphword 5 _Stats', 'glyphword5_dmg_boost', min, max );
  9639. dmg *= 1 + min.valueMultiplicative;
  9640. }
  9641.  
  9642. //debug log
  9643. //theGame.witcherLog.AddMessage("Quen impulse dmg: " + dmg + " (" + damages[j] + ")");
  9644.  
  9645. if(dmg > 0)
  9646. {
  9647. action.SetHitEffectAllTypes('hit_electric_quen');
  9648. action.AddDamage(damages[j], dmg);
  9649. }
  9650. }
  9651. }
  9652.  
  9653. //add knockdown applicator (spell power will affect knockdown chances)
  9654. if(level == 3)
  9655. action.AddEffectInfo(EET_KnockdownTypeApplicator);
  9656. //add stagger
  9657. else if(level >= 1)
  9658. action.AddEffectInfo(EET_Stagger);
  9659.  
  9660. theGame.damageMgr.ProcessAction( action );
  9661. delete action;
  9662. }
  9663.  
  9664. if(isAlternate)
  9665. {
  9666. signEntity.PlayHitEffect('quen_impulse_explode', signEntity.GetWorldRotation());
  9667. signEntity.EraseFirstTimeStamp();
  9668.  
  9669. if(level >= 2)
  9670. {
  9671. //if(IsSetBonusActive( EISB_Bear_2 ))
  9672. //{
  9673. // signEntity.PlayHitEffect('quen_electric_explode_bear_abl2', signEntity.GetWorldRotation());
  9674. //}
  9675. //else //ability changed
  9676. signEntity.PlayHitEffect('quen_electric_explode', signEntity.GetWorldRotation());
  9677. }
  9678. }
  9679. else
  9680. {
  9681. signEntity.PlayEffect('lasting_shield_impulse');
  9682. }
  9683. }
  9684.  
  9685. //modSigns
  9686. public function PlayGlyphword5FX(ent : CGameplayEntity)
  9687. {
  9688. var template : CEntityTemplate;
  9689. var component : CComponent;
  9690.  
  9691. template = (CEntityTemplate)LoadResource('glyphword_5');
  9692.  
  9693. component = ent.GetComponent('torso3effect');
  9694. if(component)
  9695. thePlayer.PlayEffect('reflection_damge', component);
  9696. else
  9697. thePlayer.PlayEffect('reflection_damge', ent);
  9698. }
  9699.  
  9700. //called after both Aard casts, after normal Igni cast, for alt Igni called at the beginning of channeling,
  9701. //after normal Yrden cast, for alt Yrden - at the end of the channeling, if it wasn't aborted,
  9702. //after normal Quen cast, for alt Quen - at the beginning of the channeling,
  9703. //after normal Axii cast, for alt Axii - at the end of the channeling, if it wasn't aborted.
  9704. //modSigns: alt Igni and alt Quen calls moved to the end of channeling.
  9705. public function OnSignCastPerformed(signType : ESignType, isAlternate : bool)
  9706. {
  9707. var items : array<SItemUniqueId>;
  9708. var weaponEnt : CEntity;
  9709. var fxName : name;
  9710. var pos : Vector;
  9711. //modSigns: new vars
  9712. //var abilityName : name;
  9713. //var abilityCount, maxStack : float;
  9714. //var min, max : SAbilityAttributeValue;
  9715. //var addAbility : bool;
  9716.  
  9717. super.OnSignCastPerformed(signType, isAlternate);
  9718.  
  9719. if(HasRunewordActive('Runeword 1 _Stats') && GetStat(BCS_Focus) >= 1.0f) //modSigns
  9720. {
  9721. DrainFocus(1.0f);
  9722. runewordInfusionType = signType;
  9723. items = inv.GetHeldWeapons();
  9724. weaponEnt = inv.GetItemEntityUnsafe(items[0]);
  9725.  
  9726.  
  9727. weaponEnt.StopEffect('runeword_aard');
  9728. weaponEnt.StopEffect('runeword_axii');
  9729. weaponEnt.StopEffect('runeword_igni');
  9730. weaponEnt.StopEffect('runeword_quen');
  9731. weaponEnt.StopEffect('runeword_yrden');
  9732.  
  9733.  
  9734. if(signType == ST_Aard)
  9735. fxName = 'runeword_aard';
  9736. else if(signType == ST_Axii)
  9737. fxName = 'runeword_axii';
  9738. else if(signType == ST_Igni)
  9739. fxName = 'runeword_igni';
  9740. else if(signType == ST_Quen)
  9741. fxName = 'runeword_quen';
  9742. else if(signType == ST_Yrden)
  9743. fxName = 'runeword_yrden';
  9744.  
  9745. weaponEnt.PlayEffect(fxName);
  9746. }
  9747.  
  9748.  
  9749. if( IsMutationActive( EPMT_Mutation6 ) && signType == ST_Aard && !isAlternate )
  9750. {
  9751. pos = GetWorldPosition() + GetWorldForward() * 2;
  9752.  
  9753. theGame.GetSurfacePostFX().AddSurfacePostFXGroup( pos, 0.f, 3.f, 2.f, 5.f, 0 );
  9754. }
  9755.  
  9756. //modSigns: ancient leshed decoction fix -> decoction changed
  9757. /*if(HasBuff(EET_Mutagen22) && IsInCombat() && IsThreatened() && !isAlternate)
  9758. {
  9759. abilityName = GetBuff(EET_Mutagen22).GetAbilityName();
  9760. abilityCount = GetAbilityCount(abilityName);
  9761.  
  9762. if(abilityCount == 0)
  9763. {
  9764. addAbility = true;
  9765. }
  9766. else
  9767. {
  9768. theGame.GetDefinitionsManager().GetAbilityAttributeValue(abilityName, 'mutagen22_max_stack', min, max);
  9769. maxStack = CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  9770.  
  9771. if(maxStack >= 0)
  9772. {
  9773. addAbility = (abilityCount < maxStack);
  9774. }
  9775. else
  9776. {
  9777. addAbility = true;
  9778. }
  9779. }
  9780.  
  9781. if(addAbility)
  9782. {
  9783. AddAbility(abilityName, true);
  9784. }
  9785. }*/
  9786.  
  9787. //modSigns
  9788. if(!HasBuff(EET_GryphonSetBonus) && IsSetBonusActive( EISB_Gryphon_1 ))
  9789. {
  9790. AddEffectDefault( EET_GryphonSetBonus, NULL, signType );
  9791. }
  9792.  
  9793. //theGame.witcherLog.AddMessage("OnSignCastPerformed: " + signType + "; isAlternate: " + isAlternate); //modSigns: debug
  9794. }
  9795.  
  9796. public saved var savedQuenHealth, savedQuenDuration : float;
  9797.  
  9798. timer function HACK_QuenSaveStatus(dt : float, id : int)
  9799. {
  9800. var quenEntity : W3QuenEntity;
  9801.  
  9802. quenEntity = (W3QuenEntity)signs[ST_Quen].entity;
  9803. savedQuenHealth = quenEntity.GetShieldHealth();
  9804. savedQuenDuration = quenEntity.GetShieldRemainingDuration();
  9805. }
  9806.  
  9807. timer function DelayedRestoreQuen(dt : float, id : int)
  9808. {
  9809. RestoreQuen(savedQuenHealth, savedQuenDuration);
  9810. }
  9811.  
  9812. public final function OnBasicQuenFinishing()
  9813. {
  9814. RemoveTimer('HACK_QuenSaveStatus');
  9815. savedQuenHealth = 0.f;
  9816. savedQuenDuration = 0.f;
  9817. }
  9818.  
  9819. public final function IsAnyQuenActive() : bool
  9820. {
  9821. var quen : W3QuenEntity;
  9822.  
  9823. quen = (W3QuenEntity)GetSignEntity(ST_Quen);
  9824. if(quen)
  9825. return quen.IsAnyQuenActive();
  9826.  
  9827. return false;
  9828. }
  9829.  
  9830. public final function IsQuenActive(alternateMode : bool) : bool
  9831. {
  9832. if(IsAnyQuenActive() && GetSignEntity(ST_Quen).IsAlternateCast() == alternateMode)
  9833. return true;
  9834.  
  9835. return false;
  9836. }
  9837.  
  9838. public function FinishQuen( skipVisuals : bool, optional forceNoBearSetBonus : bool )
  9839. {
  9840. var quen : W3QuenEntity;
  9841.  
  9842. quen = (W3QuenEntity)GetSignEntity(ST_Quen);
  9843. if(quen)
  9844. quen.ForceFinishQuen( skipVisuals, forceNoBearSetBonus );
  9845. }
  9846.  
  9847.  
  9848. public function GetTotalSignSpellPower(signSkill : ESkill) : SAbilityAttributeValue
  9849. {
  9850. var sp : SAbilityAttributeValue;
  9851. var penalty : SAbilityAttributeValue;
  9852. var penaltyReduction : float;
  9853. var penaltyReductionLevel : int;
  9854. var mutagen : CBaseGameplayEffect; //modSigns
  9855. var min, max : SAbilityAttributeValue; //modSigns
  9856.  
  9857. //character SP + spell specific skills
  9858. sp = GetSkillAttributeValue(signSkill, PowerStatEnumToName(CPS_SpellPower), true, true);
  9859.  
  9860. //skill custom
  9861. if ( signSkill == S_Magic_s01 )
  9862. {
  9863. //wave leveling penalty reduction
  9864. /*penaltyReductionLevel = GetSkillLevel(S_Magic_s01) + 1;
  9865. if(penaltyReductionLevel > 0)
  9866. {
  9867. penaltyReduction = 1 - penaltyReductionLevel * CalculateAttributeValue(GetSkillAttributeValue(S_Magic_s01, 'spell_power_penalty_reduction', true, true));
  9868. penalty = GetSkillAttributeValue(S_Magic_s01, PowerStatEnumToName(CPS_SpellPower), false, false);
  9869. sp += penalty * penaltyReduction; //add amount equal to penalty reduction (since full penalty is already applied)
  9870. }*/
  9871. //modSigns: fix percentages as they are completely off from what skill description says
  9872. penaltyReductionLevel = GetSkillLevel(S_Magic_s01) - 1;
  9873. if(penaltyReductionLevel > 0)
  9874. {
  9875. penaltyReduction = penaltyReductionLevel * CalculateAttributeValue(GetSkillAttributeValue(S_Magic_s01, 'spell_power_penalty_reduction', false, false));
  9876. //penalty was already applied, so we revert it based on penalty reduction and skill level
  9877. sp.valueMultiplicative += penaltyReduction;
  9878. }
  9879. }
  9880.  
  9881.  
  9882. if(signSkill == S_Magic_1 || signSkill == S_Magic_s01)
  9883. {
  9884. sp += GetAttributeValue('spell_power_aard');
  9885. }
  9886. else if(signSkill == S_Magic_2 || signSkill == S_Magic_s02)
  9887. {
  9888. sp += GetAttributeValue('spell_power_igni');
  9889. }
  9890. else if(signSkill == S_Magic_3 || signSkill == S_Magic_s03)
  9891. {
  9892. sp += GetAttributeValue('spell_power_yrden');
  9893. }
  9894. else if(signSkill == S_Magic_4 || signSkill == S_Magic_s04)
  9895. {
  9896. sp += GetAttributeValue('spell_power_quen');
  9897. }
  9898. else if(signSkill == S_Magic_5 || signSkill == S_Magic_s05)
  9899. {
  9900. sp += GetAttributeValue('spell_power_axii');
  9901. }
  9902.  
  9903.  
  9904. //ApplyMutation10StatBoost( sp ); //modSigns: reworked
  9905.  
  9906. //modSigns: prevent negatives
  9907. sp.valueBase = MaxF(sp.valueBase, 0);
  9908. sp.valueMultiplicative = MaxF(sp.valueMultiplicative, 0);
  9909. sp.valueAdditive = MaxF(sp.valueAdditive, 0);
  9910.  
  9911. return sp;
  9912. }
  9913.  
  9914.  
  9915.  
  9916.  
  9917.  
  9918. public final function GetGwentCardIndex( cardName : name ) : int
  9919. {
  9920. var dm : CDefinitionsManagerAccessor;
  9921.  
  9922. dm = theGame.GetDefinitionsManager();
  9923.  
  9924. if(dm.ItemHasTag( cardName , 'GwintCardLeader' ))
  9925. {
  9926. return theGame.GetGwintManager().GwentLeadersNametoInt( cardName );
  9927. }
  9928. else if(dm.ItemHasTag( cardName , 'GwintCardNrkd' ))
  9929. {
  9930. return theGame.GetGwintManager().GwentNrkdNameToInt( cardName );
  9931. }
  9932. else if(dm.ItemHasTag( cardName , 'GwintCardNlfg' ))
  9933. {
  9934. return theGame.GetGwintManager().GwentNlfgNameToInt( cardName );
  9935. }
  9936. else if(dm.ItemHasTag( cardName , 'GwintCardSctl' ))
  9937. {
  9938. return theGame.GetGwintManager().GwentSctlNameToInt( cardName );
  9939. }
  9940. else if(dm.ItemHasTag( cardName , 'GwintCardMstr' ))
  9941. {
  9942. return theGame.GetGwintManager().GwentMstrNameToInt( cardName );
  9943. }
  9944. else if(dm.ItemHasTag( cardName , 'GwintCardSke' ))
  9945. {
  9946. return theGame.GetGwintManager().GwentSkeNameToInt( cardName );
  9947. }
  9948. else if(dm.ItemHasTag( cardName , 'GwintCardNeutral' ))
  9949. {
  9950. return theGame.GetGwintManager().GwentNeutralNameToInt( cardName );
  9951. }
  9952. else if(dm.ItemHasTag( cardName , 'GwintCardSpcl' ))
  9953. {
  9954. return theGame.GetGwintManager().GwentSpecialNameToInt( cardName );
  9955. }
  9956.  
  9957. return -1;
  9958. }
  9959.  
  9960. public final function AddGwentCard(cardName : name, amount : int) : bool
  9961. {
  9962. var dm : CDefinitionsManagerAccessor;
  9963. var cardIndex, i : int;
  9964. var tut : STutorialMessage;
  9965. var gwintManager : CR4GwintManager;
  9966.  
  9967.  
  9968.  
  9969. if(FactsQuerySum("q001_nightmare_ended") > 0 && ShouldProcessTutorial('TutorialGwentDeckBuilder2'))
  9970. {
  9971. tut.type = ETMT_Hint;
  9972. tut.tutorialScriptTag = 'TutorialGwentDeckBuilder2';
  9973. tut.journalEntryName = 'TutorialGwentDeckBuilder2';
  9974. tut.hintPositionType = ETHPT_DefaultGlobal;
  9975. tut.markAsSeenOnShow = true;
  9976. tut.hintDurationType = ETHDT_Long;
  9977.  
  9978. theGame.GetTutorialSystem().DisplayTutorial(tut);
  9979. }
  9980.  
  9981. dm = theGame.GetDefinitionsManager();
  9982.  
  9983. cardIndex = GetGwentCardIndex(cardName);
  9984.  
  9985. if (cardIndex != -1)
  9986. {
  9987. FactsAdd("Gwint_Card_Looted");
  9988.  
  9989. for(i = 0; i < amount; i += 1)
  9990. {
  9991. theGame.GetGwintManager().AddCardToCollection( cardIndex );
  9992. }
  9993. }
  9994.  
  9995. if( dm.ItemHasTag( cardName, 'GwentTournament' ) )
  9996. {
  9997. if ( dm.ItemHasTag( cardName, 'GT1' ) )
  9998. {
  9999. FactsAdd( "GwentTournament", 1 );
  10000. }
  10001.  
  10002. else if ( dm.ItemHasTag( cardName, 'GT2' ) )
  10003. {
  10004. FactsAdd( "GwentTournament", 2 );
  10005. }
  10006.  
  10007. else if ( dm.ItemHasTag( cardName, 'GT3' ) )
  10008. {
  10009. FactsAdd( "GwentTournament", 3 );
  10010. }
  10011.  
  10012. else if ( dm.ItemHasTag( cardName, 'GT4' ) )
  10013. {
  10014. FactsAdd( "GwentTournament", 4 );
  10015. }
  10016.  
  10017. else if ( dm.ItemHasTag( cardName, 'GT5' ) )
  10018. {
  10019. FactsAdd( "GwentTournament", 5 );
  10020. }
  10021.  
  10022. else if ( dm.ItemHasTag( cardName, 'GT6' ) )
  10023. {
  10024. FactsAdd( "GwentTournament", 6 );
  10025. }
  10026.  
  10027. else if ( dm.ItemHasTag( cardName, 'GT7' ) )
  10028. {
  10029. FactsAdd( "GwentTournament", 7 );
  10030. }
  10031.  
  10032. CheckGwentTournamentDeck();
  10033. }
  10034.  
  10035. if( dm.ItemHasTag( cardName, 'EP2Tournament' ) )
  10036. {
  10037. if ( dm.ItemHasTag( cardName, 'GT1' ) )
  10038. {
  10039. FactsAdd( "EP2Tournament", 1 );
  10040. }
  10041.  
  10042. else if ( dm.ItemHasTag( cardName, 'GT2' ) )
  10043. {
  10044. FactsAdd( "EP2Tournament", 2 );
  10045. }
  10046.  
  10047. else if ( dm.ItemHasTag( cardName, 'GT3' ) )
  10048. {
  10049. FactsAdd( "EP2Tournament", 3 );
  10050. }
  10051.  
  10052. else if ( dm.ItemHasTag( cardName, 'GT4' ) )
  10053. {
  10054. FactsAdd( "EP2Tournament", 4 );
  10055. }
  10056.  
  10057. else if ( dm.ItemHasTag( cardName, 'GT5' ) )
  10058. {
  10059. FactsAdd( "EP2Tournament", 5 );
  10060. }
  10061.  
  10062. else if ( dm.ItemHasTag( cardName, 'GT6' ) )
  10063. {
  10064. FactsAdd( "EP2Tournament", 6 );
  10065. }
  10066.  
  10067. else if ( dm.ItemHasTag( cardName, 'GT7' ) )
  10068. {
  10069. FactsAdd( "EP2Tournament", 7 );
  10070. }
  10071.  
  10072. CheckEP2TournamentDeck();
  10073. }
  10074.  
  10075. gwintManager = theGame.GetGwintManager();
  10076. if( !gwintManager.IsDeckUnlocked( GwintFaction_Skellige ) &&
  10077. gwintManager.HasCardsOfFactionInCollection( GwintFaction_Skellige, false ) )
  10078. {
  10079. gwintManager.UnlockDeck( GwintFaction_Skellige );
  10080. }
  10081.  
  10082. return true;
  10083. }
  10084.  
  10085.  
  10086. public final function RemoveGwentCard(cardName : name, amount : int) : bool
  10087. {
  10088. var dm : CDefinitionsManagerAccessor;
  10089. var cardIndex, i : int;
  10090.  
  10091. dm = theGame.GetDefinitionsManager();
  10092.  
  10093. if(dm.ItemHasTag( cardName , 'GwintCardLeader' ))
  10094. {
  10095. cardIndex = theGame.GetGwintManager().GwentLeadersNametoInt( cardName );
  10096. for(i=0; i<amount; i+=1)
  10097. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  10098. }
  10099. else if(dm.ItemHasTag( cardName , 'GwintCardNrkd' ))
  10100. {
  10101. cardIndex = theGame.GetGwintManager().GwentNrkdNameToInt( cardName );
  10102. for(i=0; i<amount; i+=1)
  10103. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  10104. }
  10105. else if(dm.ItemHasTag( cardName , 'GwintCardNlfg' ))
  10106. {
  10107. cardIndex = theGame.GetGwintManager().GwentNlfgNameToInt( cardName );
  10108. for(i=0; i<amount; i+=1)
  10109. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  10110. }
  10111. else if(dm.ItemHasTag( cardName , 'GwintCardSctl' ))
  10112. {
  10113. cardIndex = theGame.GetGwintManager().GwentSctlNameToInt( cardName );
  10114. for(i=0; i<amount; i+=1)
  10115. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  10116. }
  10117. else if(dm.ItemHasTag( cardName , 'GwintCardMstr' ))
  10118. {
  10119. cardIndex = theGame.GetGwintManager().GwentMstrNameToInt( cardName );
  10120. for(i=0; i<amount; i+=1)
  10121. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  10122. }
  10123. else if(dm.ItemHasTag( cardName , 'GwintCardNeutral' ))
  10124. {
  10125. cardIndex = theGame.GetGwintManager().GwentNeutralNameToInt( cardName );
  10126. for(i=0; i<amount; i+=1)
  10127. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  10128. }
  10129. else if(dm.ItemHasTag( cardName , 'GwintCardSpcl' ))
  10130. {
  10131. cardIndex = theGame.GetGwintManager().GwentSpecialNameToInt( cardName );
  10132. for(i=0; i<amount; i+=1)
  10133. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  10134. }
  10135.  
  10136. if( dm.ItemHasTag( cardName, 'GwentTournament' ) )
  10137. {
  10138. if ( dm.ItemHasTag( cardName, 'GT1' ) )
  10139. {
  10140. FactsSubstract( "GwentTournament", 1 );
  10141. }
  10142.  
  10143. else if ( dm.ItemHasTag( cardName, 'GT2' ) )
  10144. {
  10145. FactsSubstract( "GwentTournament", 2 );
  10146. }
  10147.  
  10148. else if ( dm.ItemHasTag( cardName, 'GT3' ) )
  10149. {
  10150. FactsSubstract( "GwentTournament", 3 );
  10151. }
  10152.  
  10153. else if ( dm.ItemHasTag( cardName, 'GT4' ) )
  10154. {
  10155. FactsSubstract( "GwentTournament", 4 );
  10156. }
  10157.  
  10158. else if ( dm.ItemHasTag( cardName, 'GT5' ) )
  10159. {
  10160. FactsSubstract( "GwentTournament", 5 );
  10161. }
  10162.  
  10163. else if ( dm.ItemHasTag( cardName, 'GT6' ) )
  10164. {
  10165. FactsSubstract( "GwentTournament", 6 );
  10166. }
  10167.  
  10168. else if ( dm.ItemHasTag( cardName, 'GT7' ) )
  10169. {
  10170. FactsSubstract( "GwentTournament", 7 );
  10171. }
  10172.  
  10173. CheckGwentTournamentDeck();
  10174. }
  10175.  
  10176.  
  10177. if( dm.ItemHasTag( cardName, 'EP2Tournament' ) )
  10178. {
  10179. if ( dm.ItemHasTag( cardName, 'GT1' ) )
  10180. {
  10181. FactsSubstract( "EP2Tournament", 1 );
  10182. }
  10183.  
  10184. else if ( dm.ItemHasTag( cardName, 'GT2' ) )
  10185. {
  10186. FactsSubstract( "EP2Tournament", 2 );
  10187. }
  10188.  
  10189. else if ( dm.ItemHasTag( cardName, 'GT3' ) )
  10190. {
  10191. FactsSubstract( "EP2Tournament", 3 );
  10192. }
  10193.  
  10194. else if ( dm.ItemHasTag( cardName, 'GT4' ) )
  10195. {
  10196. FactsSubstract( "EP2Tournament", 4 );
  10197. }
  10198.  
  10199. else if ( dm.ItemHasTag( cardName, 'GT5' ) )
  10200. {
  10201. FactsSubstract( "EP2Tournament", 5 );
  10202. }
  10203.  
  10204. else if ( dm.ItemHasTag( cardName, 'GT6' ) )
  10205. {
  10206. FactsSubstract( "EP2Tournament", 6 );
  10207. }
  10208.  
  10209. else if ( dm.ItemHasTag( cardName, 'GT7' ) )
  10210. {
  10211. FactsSubstract( "EP2Tournament", 7 );
  10212. }
  10213.  
  10214. CheckEP2TournamentDeck();
  10215. }
  10216.  
  10217. return true;
  10218. }
  10219.  
  10220. function CheckGwentTournamentDeck()
  10221. {
  10222. var gwentPower : int;
  10223. var neededGwentPower : int;
  10224. var checkBreakpoint : int;
  10225.  
  10226. neededGwentPower = 70;
  10227.  
  10228. checkBreakpoint = neededGwentPower/5;
  10229. gwentPower = FactsQuerySum( "GwentTournament" );
  10230.  
  10231. if ( gwentPower >= neededGwentPower )
  10232. {
  10233. FactsAdd( "HasGwentTournamentDeck", 1 );
  10234. }
  10235. else
  10236. {
  10237. if( FactsDoesExist( "HasGwentTournamentDeck" ) )
  10238. {
  10239. FactsRemove( "HasGwentTournamentDeck" );
  10240. }
  10241.  
  10242. if ( gwentPower >= checkBreakpoint )
  10243. {
  10244. FactsAdd( "GwentTournamentObjective1", 1 );
  10245. }
  10246. else if ( FactsDoesExist( "GwentTournamentObjective1" ) )
  10247. {
  10248. FactsRemove( "GwentTournamentObjective1" );
  10249. }
  10250.  
  10251. if ( gwentPower >= checkBreakpoint*2 )
  10252. {
  10253. FactsAdd( "GwentTournamentObjective2", 1 );
  10254. }
  10255. else if ( FactsDoesExist( "GwentTournamentObjective2" ) )
  10256. {
  10257. FactsRemove( "GwentTournamentObjective2" );
  10258. }
  10259.  
  10260. if ( gwentPower >= checkBreakpoint*3 )
  10261. {
  10262. FactsAdd( "GwentTournamentObjective3", 1 );
  10263. }
  10264. else if ( FactsDoesExist( "GwentTournamentObjective3" ) )
  10265. {
  10266. FactsRemove( "GwentTournamentObjective3" );
  10267. }
  10268.  
  10269. if ( gwentPower >= checkBreakpoint*4 )
  10270. {
  10271. FactsAdd( "GwentTournamentObjective4", 1 );
  10272. }
  10273. else if ( FactsDoesExist( "GwentTournamentObjective4" ) )
  10274. {
  10275. FactsRemove( "GwentTournamentObjective4" );
  10276. }
  10277. }
  10278. }
  10279.  
  10280. function CheckEP2TournamentDeck()
  10281. {
  10282. var gwentPower : int;
  10283. var neededGwentPower : int;
  10284. var checkBreakpoint : int;
  10285.  
  10286. neededGwentPower = 24;
  10287.  
  10288. checkBreakpoint = neededGwentPower/5;
  10289. gwentPower = FactsQuerySum( "EP2Tournament" );
  10290.  
  10291. if ( gwentPower >= neededGwentPower )
  10292. {
  10293. if( FactsQuerySum( "HasEP2TournamentDeck") == 0 )
  10294. {
  10295. FactsAdd( "HasEP2TournamentDeck", 1 );
  10296. }
  10297.  
  10298. }
  10299. else
  10300. {
  10301. if( FactsDoesExist( "HasEP2TournamentDeck" ) )
  10302. {
  10303. FactsRemove( "HasEP2TournamentDeck" );
  10304. }
  10305.  
  10306. if ( gwentPower >= checkBreakpoint )
  10307. {
  10308. FactsAdd( "EP2TournamentObjective1", 1 );
  10309. }
  10310. else if ( FactsDoesExist( "EP2TournamentObjective1" ) )
  10311. {
  10312. FactsRemove( "EP2TournamentObjective1" );
  10313. }
  10314.  
  10315. if ( gwentPower >= checkBreakpoint*2 )
  10316. {
  10317. FactsAdd( "EP2TournamentObjective2", 1 );
  10318. }
  10319. else if ( FactsDoesExist( "EP2TournamentObjective2" ) )
  10320. {
  10321. FactsRemove( "EP2TournamentObjective2" );
  10322. }
  10323.  
  10324. if ( gwentPower >= checkBreakpoint*3 )
  10325. {
  10326. FactsAdd( "EP2TournamentObjective3", 1 );
  10327. }
  10328. else if ( FactsDoesExist( "EP2TournamentObjective3" ) )
  10329. {
  10330. FactsRemove( "EP2TournamentObjective3" );
  10331. }
  10332.  
  10333. if ( gwentPower >= checkBreakpoint*4 )
  10334. {
  10335. FactsAdd( "EP2TournamentObjective4", 1 );
  10336. }
  10337. else if ( FactsDoesExist( "EP2TournamentObjective4" ) )
  10338. {
  10339. FactsRemove( "EP2TournamentObjective4" );
  10340. }
  10341. }
  10342. }
  10343.  
  10344.  
  10345.  
  10346.  
  10347.  
  10348.  
  10349. //---=== modFriendlyMeditation ===---
  10350. public function IsMeditating() : bool
  10351. {
  10352. return ( GetCurrentStateName() == 'Meditation' );
  10353. }
  10354.  
  10355. public function IsSkippingTime() : bool
  10356. {
  10357. return ( GetCurrentStateName() == 'MeditationWaiting' );
  10358. }
  10359.  
  10360. public function UpdateEffectsAccelerated( realTimeSecs, acceleration : float )
  10361. {
  10362. effectManager.PerformUpdate( realTimeSecs * acceleration );
  10363. }
  10364. //---=== modFriendlyMeditation ===---
  10365.  
  10366. public function SimulateBuffTimePassing(simulatedTime : float)
  10367. {
  10368. super.SimulateBuffTimePassing(simulatedTime);
  10369.  
  10370. FinishQuen(true);
  10371. }
  10372.  
  10373.  
  10374. public function CanMeditate() : bool
  10375. {
  10376. var currentStateName : name;
  10377.  
  10378. currentStateName = GetCurrentStateName();
  10379.  
  10380.  
  10381. if(currentStateName == 'Exploration' && !CanPerformPlayerAction())
  10382. return false;
  10383.  
  10384.  
  10385. if(GetCurrentStateName() != 'Exploration' && GetCurrentStateName() != 'Meditation' && GetCurrentStateName() != 'MeditationWaiting')
  10386. return false;
  10387.  
  10388.  
  10389. if(GetUsedVehicle())
  10390. return false;
  10391.  
  10392.  
  10393. return CanMeditateHere();
  10394. }
  10395.  
  10396.  
  10397. public final function CanMeditateWait(optional skipMeditationStateCheck : bool) : bool
  10398. {
  10399. var currState : name;
  10400.  
  10401. currState = GetCurrentStateName();
  10402.  
  10403.  
  10404.  
  10405. if(!skipMeditationStateCheck && currState != 'Meditation')
  10406. return false;
  10407.  
  10408.  
  10409. if(theGame.IsGameTimePaused())
  10410. return false;
  10411.  
  10412. if(!IsActionAllowed( EIAB_MeditationWaiting ))
  10413. return false;
  10414.  
  10415. return true;
  10416. }
  10417.  
  10418.  
  10419. public final function CanMeditateHere() : bool
  10420. {
  10421. var pos : Vector;
  10422.  
  10423. pos = GetWorldPosition();
  10424. if(pos.Z <= theGame.GetWorld().GetWaterLevel(pos, true) && IsInShallowWater())
  10425. return false;
  10426.  
  10427. if(IsThreatened())
  10428. return false;
  10429.  
  10430. return true;
  10431. }
  10432.  
  10433.  
  10434. public function Meditate() : bool
  10435. {
  10436. //---=== modFriendlyMeditation ===---
  10437. //var medState : W3PlayerWitcherStateMeditation;
  10438. //var stateName : name;
  10439. //
  10440. //stateName = GetCurrentStateName();
  10441. //
  10442. //
  10443. //if (!CanMeditate() || stateName == 'MeditationWaiting' )
  10444. // return false;
  10445. //
  10446. //GotoState('Meditation');
  10447. //medState = (W3PlayerWitcherStateMeditation)GetState('Meditation');
  10448. //medState.SetMeditationPointHeading(GetHeading());
  10449. //
  10450. //return true;
  10451.  
  10452. if ( !ModCanMeditate() )
  10453. return false;
  10454.  
  10455. theGame.RequestMenuWithBackground( 'MeditationClockMenu', 'CommonMenu' );
  10456.  
  10457. return true;
  10458. //---=== modFriendlyMeditation ===---
  10459. }
  10460.  
  10461.  
  10462. public final function MeditationRestoring(simulatedTime : float)
  10463. {
  10464.  
  10465. if ( theGame.GetDifficultyMode() != EDM_Hard && theGame.GetDifficultyMode() != EDM_Hardcore )
  10466. {
  10467. Heal(GetStatMax(BCS_Vitality));
  10468. }
  10469.  
  10470.  
  10471. abilityManager.DrainToxicity( abilityManager.GetStat( BCS_Toxicity ) );
  10472. abilityManager.DrainFocus( abilityManager.GetStat( BCS_Focus ) );
  10473.  
  10474.  
  10475. inv.SingletonItemsRefillAmmo();
  10476.  
  10477.  
  10478. SimulateBuffTimePassing(simulatedTime);
  10479.  
  10480.  
  10481. ApplyWitcherHouseBuffs();
  10482. }
  10483.  
  10484. var clockMenu : CR4MeditationClockMenu;
  10485.  
  10486. public function MeditationClockStart(m : CR4MeditationClockMenu)
  10487. {
  10488. clockMenu = m;
  10489. AddTimer('UpdateClockTime',0.1,true);
  10490. }
  10491.  
  10492. public function MeditationClockStop()
  10493. {
  10494. clockMenu = NULL;
  10495. RemoveTimer('UpdateClockTime');
  10496. }
  10497.  
  10498. public timer function UpdateClockTime(dt : float, id : int)
  10499. {
  10500. if(clockMenu)
  10501. clockMenu.UpdateCurrentHours();
  10502. else
  10503. RemoveTimer('UpdateClockTime');
  10504. }
  10505.  
  10506. private var waitTimeHour : int;
  10507. public function SetWaitTargetHour(t : int)
  10508. {
  10509. waitTimeHour = t;
  10510. }
  10511. public function GetWaitTargetHour() : int
  10512. {
  10513. return waitTimeHour;
  10514. }
  10515.  
  10516. public function MeditationForceAbort(forceCloseUI : bool)
  10517. {
  10518. //---=== modFriendlyMeditation ===---
  10519. //var waitt : W3PlayerWitcherStateMeditationWaiting;
  10520. //var medd : W3PlayerWitcherStateMeditation;
  10521. //var currentStateName : name;
  10522. //
  10523. //currentStateName = GetCurrentStateName();
  10524. //
  10525. //if(currentStateName == 'MeditationWaiting')
  10526. //{
  10527. // waitt = (W3PlayerWitcherStateMeditationWaiting)GetCurrentState();
  10528. // if(waitt)
  10529. // {
  10530. // waitt.StopRequested(forceCloseUI);
  10531. // }
  10532. //}
  10533. //else if(currentStateName == 'Meditation')
  10534. //{
  10535. // medd = (W3PlayerWitcherStateMeditation)GetCurrentState();
  10536. // if(medd)
  10537. // {
  10538. // medd.StopRequested(forceCloseUI);
  10539. // }
  10540. //}
  10541. ModEndMeditation();
  10542. //---=== modFriendlyMeditation ===---
  10543.  
  10544.  
  10545.  
  10546. if(forceCloseUI && theGame.GetGuiManager().IsAnyMenu())
  10547. {
  10548. theGame.GetGuiManager().GetRootMenu().CloseMenu();
  10549. DisplayActionDisallowedHudMessage(EIAB_MeditationWaiting, false, false, true, false);
  10550. }
  10551. }
  10552.  
  10553. //---=== modFriendlyMeditation ===---
  10554. public function ModCanMeditate(optional isPlayerMeditatingInBed : bool) : bool
  10555. {
  10556. if( isPlayerMeditatingInBed )
  10557. return true;
  10558.  
  10559. //checking everything for Preparations compatibility
  10560. if( !CanMeditate() )
  10561. return false;
  10562.  
  10563. if( !CanMeditateWait(true) )
  10564. return false;
  10565.  
  10566. if( !CanMeditateHere() )
  10567. return false;
  10568.  
  10569. if( !ModCanMeditateHereExt() )
  10570. return false;
  10571.  
  10572. return true;
  10573. }
  10574.  
  10575. public function ModCanMeditateHereExt() : bool
  10576. {
  10577. if( IsUsingVehicle() || IsSwimming () || IsDiving() )
  10578. return false;
  10579.  
  10580. if( ((CMovingPhysicalAgentComponent)GetMovingAgentComponent()).GetSubmergeDepth() < 0 )
  10581. return false;
  10582.  
  10583. return true;
  10584. }
  10585.  
  10586. public function ModStartMeditation(optional isPlayerMeditatingInBed : bool, optional isFromClock : bool, optional endTime : float) : bool
  10587. {
  10588. if( !ModCanMeditate(isPlayerMeditatingInBed) )
  10589. return false;
  10590.  
  10591. if( theGame.GetGuiManager().IsAnyMenu() )
  10592. theGame.GetGuiManager().GetRootMenu().CloseMenu();
  10593.  
  10594. if( !IsMeditating() && !IsSkippingTime() )
  10595. {
  10596. medIsPlayerMeditatingInBed = isPlayerMeditatingInBed;
  10597. medIsFromClock = isFromClock;
  10598. medEndTime = endTime;
  10599. SetBehaviorVariable('MeditateAbort', 0);
  10600. PushState('Meditation');
  10601. return true;
  10602. }
  10603. else
  10604. {
  10605. if( IsSkippingTime() )
  10606. {
  10607. MeditationEndFastforward();
  10608. }
  10609. if( IsMeditating() )
  10610. {
  10611. medIsPlayerMeditatingInBed = isPlayerMeditatingInBed;
  10612. medIsFromClock = isFromClock;
  10613. medEndTime = endTime;
  10614. SetBehaviorVariable('MeditateAbort', 0);
  10615. if( isFromClock )
  10616. ((W3PlayerWitcherStateMeditation)GetState( 'Meditation' )).StartFastforward();
  10617. return true;
  10618. }
  10619. }
  10620.  
  10621. return false;
  10622. }
  10623.  
  10624. public function ModEndMeditation()
  10625. {
  10626. if( IsMeditating() || IsSkippingTime() )
  10627. {
  10628. SetBehaviorVariable('MeditateAbort', 1);
  10629. PopState();
  10630. medIsPlayerMeditatingInBed = false;
  10631. medIsFromClock = false;
  10632. medEndTime = -1;
  10633. if( theGame.GetGuiManager().IsAnyMenu() )
  10634. theGame.GetGuiManager().GetRootMenu().CloseMenu();
  10635. }
  10636. }
  10637.  
  10638. private var medIsPlayerMeditatingInBed : bool;
  10639. default medIsPlayerMeditatingInBed = false;
  10640. public function GetIsPlayerMeditatingInBed() : bool
  10641. {
  10642. return medIsPlayerMeditatingInBed;
  10643. }
  10644.  
  10645. private var medEndTime : float;
  10646. default medEndTime = -1;
  10647. public function GetMeditationTargetTime() : float
  10648. {
  10649. return medEndTime;
  10650. }
  10651.  
  10652. private var medIsFromClock : bool;
  10653. default medIsFromClock = false;
  10654. public function GetMeditationStartedByClock() : bool
  10655. {
  10656. return medIsFromClock;
  10657. }
  10658.  
  10659. public function MeditationRefill( gameTimeSecs : float ) : bool
  10660. {
  10661. if ( fmedAutorefillAlchemy && gameTimeSecs >= fmedRefillIntervalSeconds )
  10662. {
  10663. inv.SingletonItemsRefillAmmo();
  10664. return true;
  10665. }
  10666. return false;
  10667. }
  10668.  
  10669. public function CheckWitcherHouseBuffs( gameTimeSecs : float ) : bool
  10670. {
  10671. if ( fmedApplyWitcherHouseBuffs && GetIsPlayerMeditatingInBed() && CeilF(gameTimeSecs/3600.0) >= fmedWitcherHouseBuffsHours )
  10672. {
  10673. ApplyWitcherHouseBuffs();
  10674. return true;
  10675. }
  10676. return false;
  10677. }
  10678.  
  10679. timer function DeSpawnCampFireTimer(dt : float, id : int)
  10680. {
  10681. spawnedCampFire.ToggleFire( false );
  10682. spawnedCampFire.Destroy();
  10683. spawnedCampFire = NULL;
  10684. }
  10685.  
  10686. public function MeditationStartFastforward()
  10687. {
  10688. if( IsMeditating() )
  10689. {
  10690. medIsFromClock = false;
  10691. ((W3PlayerWitcherStateMeditation)GetState( 'Meditation' )).StartFastforward();
  10692. }
  10693. }
  10694.  
  10695. public function MeditationEndFastforward()
  10696. {
  10697. if( IsSkippingTime() )
  10698. {
  10699. ((W3PlayerWitcherStateMeditation)GetState( 'Meditation' )).EndFastforward();
  10700. medIsFromClock = false;
  10701. }
  10702. }
  10703. //---=== modFriendlyMeditation ===---
  10704.  
  10705. public function Runeword10Triggerred()
  10706. {
  10707. var min, max : SAbilityAttributeValue;
  10708.  
  10709. //modSigns
  10710. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Runeword 10 _Stats', 'health', min, max );
  10711. GainStat(BCS_Vitality, min.valueMultiplicative * GetStatMax(BCS_Vitality));
  10712. PlayEffect('runeword_10_stamina');
  10713. }
  10714.  
  10715. public function Runeword12Triggerred()
  10716. {
  10717. var min, max : SAbilityAttributeValue;
  10718.  
  10719. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Runeword 12 _Stats', 'focus', min, max );
  10720. //GainStat(BCS_Focus, RandRangeF(max.valueAdditive, min.valueAdditive));
  10721. GainStat(BCS_Focus, min.valueAdditive); //modSigns
  10722. PlayEffect('runeword_20_adrenaline');
  10723. }
  10724.  
  10725. /*var runeword10TriggerredOnFinisher, runeword12TriggerredOnFinisher : bool;
  10726.  
  10727. event OnFinisherStart()
  10728. {
  10729. super.OnFinisherStart();
  10730.  
  10731. runeword10TriggerredOnFinisher = false;
  10732. runeword12TriggerredOnFinisher = false;
  10733. }*/ //modSigns
  10734.  
  10735. public function ApplyWitcherHouseBuffs()
  10736. {
  10737. var l_bed : W3WitcherBed;
  10738.  
  10739. if( FactsQuerySum( "PlayerInsideInnerWitcherHouse" ) > 0 )
  10740. {
  10741. l_bed = (W3WitcherBed)theGame.GetEntityByTag( 'witcherBed' );
  10742.  
  10743. if( l_bed.GetWasUsed() )
  10744. {
  10745. if( l_bed.GetBedLevel() != 0 )
  10746. {
  10747. AddEffectDefault( EET_WellRested, this, "Bed Buff" );
  10748. }
  10749.  
  10750. if( FactsQuerySum( "StablesExists" ) )
  10751. {
  10752. AddEffectDefault( EET_HorseStableBuff, this, "Stables" );
  10753. }
  10754.  
  10755. if( l_bed.GetWereItemsRefilled() )
  10756. {
  10757. theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt( "message_common_alchemy_table_buff_applied" ),, true );
  10758. l_bed.SetWereItemsRefilled( false );
  10759. }
  10760.  
  10761. AddEffectDefault( EET_BookshelfBuff, this, "Bookshelf" );
  10762.  
  10763. Heal( GetStatMax( BCS_Vitality ) );
  10764. }
  10765. }
  10766. }
  10767.  
  10768.  
  10769.  
  10770.  
  10771.  
  10772. public function CheatResurrect()
  10773. {
  10774. super.CheatResurrect();
  10775. theGame.ReleaseNoSaveLock(theGame.deathSaveLockId);
  10776. theInput.RestoreContext( 'Exploration', true );
  10777. }
  10778.  
  10779.  
  10780. public function Debug_EquipTestingSkills(equip : bool, force : bool)
  10781. {
  10782. var skills : array<ESkill>;
  10783. var i, slot : int;
  10784.  
  10785.  
  10786. ((W3PlayerAbilityManager)abilityManager).OnLevelGained(36);
  10787.  
  10788. skills.PushBack(S_Magic_s01);
  10789. skills.PushBack(S_Magic_s02);
  10790. skills.PushBack(S_Magic_s03);
  10791. skills.PushBack(S_Magic_s04);
  10792. skills.PushBack(S_Magic_s05);
  10793. skills.PushBack(S_Sword_s01);
  10794. skills.PushBack(S_Sword_s02);
  10795.  
  10796.  
  10797. if(equip)
  10798. {
  10799. for(i=0; i<skills.Size(); i+=1)
  10800. {
  10801. if(!force && IsSkillEquipped(skills[i]))
  10802. continue;
  10803.  
  10804.  
  10805. if(GetSkillLevel(skills[i]) == 0)
  10806. AddSkill(skills[i]);
  10807.  
  10808.  
  10809. if(force)
  10810. slot = i+1;
  10811. else
  10812. slot = GetFreeSkillSlot();
  10813.  
  10814.  
  10815. EquipSkill(skills[i], slot);
  10816. }
  10817. }
  10818. else
  10819. {
  10820. for(i=0; i<skills.Size(); i+=1)
  10821. {
  10822. UnequipSkill(GetSkillSlotID(skills[i]));
  10823. }
  10824. }
  10825. }
  10826.  
  10827. //modSigns
  10828. public function Debug_RestoreMutagensSpent()
  10829. {
  10830. var total : array<int>;
  10831.  
  10832. total = ((W3PlayerAbilityManager)abilityManager).GetMutationsUsedMutagens();
  10833.  
  10834. if(total[0] > 0) inv.AddAnItem('Greater mutagen red', total[0]);
  10835. if(total[1] > 0) inv.AddAnItem('Greater mutagen blue', total[1]);
  10836. if(total[2] > 0) inv.AddAnItem('Greater mutagen green', total[2]);
  10837. }
  10838.  
  10839. //modSigns
  10840. public function Debug_ClearCharacterDevelopment( optional resetLevels : bool )
  10841. {
  10842. var template : CEntityTemplate;
  10843. var entity : CEntity;
  10844. var invTesting : CInventoryComponent;
  10845. var i, totalExp, currentLevel, totalSkillPoints : int;
  10846. var items : array<SItemUniqueId>;
  10847. var abs : array<name>;
  10848. var isMutationSystemEnabled : bool;
  10849.  
  10850. ForceSetStat(BCS_Toxicity, 0);
  10851.  
  10852. UnequipItemFromSlot(EES_SilverSword);
  10853. UnequipItemFromSlot(EES_SteelSword);
  10854. UnequipItemFromSlot(EES_Bolt);
  10855. UnequipItemFromSlot(EES_RangedWeapon);
  10856. UnequipItemFromSlot(EES_Armor);
  10857. UnequipItemFromSlot(EES_Boots);
  10858. UnequipItemFromSlot(EES_Pants);
  10859. UnequipItemFromSlot(EES_Gloves);
  10860. UnequipItemFromSlot(EES_Petard1);
  10861. UnequipItemFromSlot(EES_Petard2);
  10862. UnequipItemFromSlot(EES_Quickslot1);
  10863. UnequipItemFromSlot(EES_Quickslot2);
  10864. UnequipItemFromSlot(EES_Potion1);
  10865. UnequipItemFromSlot(EES_Potion2);
  10866. UnequipItemFromSlot(EES_Potion3);
  10867. UnequipItemFromSlot(EES_Potion4);
  10868. UnequipItemFromSlot(EES_Mask);
  10869. UnequipItemFromSlot(EES_SkillMutagen1);
  10870. UnequipItemFromSlot(EES_SkillMutagen2);
  10871. UnequipItemFromSlot(EES_SkillMutagen3);
  10872. UnequipItemFromSlot(EES_SkillMutagen4);
  10873. HorseUnequipItem(EES_HorseBlinders);
  10874. HorseUnequipItem(EES_HorseSaddle);
  10875. HorseUnequipItem(EES_HorseBag);
  10876. HorseUnequipItem(EES_HorseTrophy);
  10877.  
  10878. currentLevel = levelManager.GetLevel();
  10879. totalExp = levelManager.GetPointsTotal(EExperiencePoint);
  10880. totalSkillPoints = levelManager.GetPointsTotal(ESkillPoint);
  10881. isMutationSystemEnabled = ((W3PlayerAbilityManager)abilityManager).IsMutationSystemEnabled();
  10882.  
  10883. Debug_RestoreMutagensSpent();
  10884.  
  10885. GetCharacterStats().GetAbilities(abs, false);
  10886. for(i = 0; i < abs.Size(); i+=1)
  10887. RemoveAbility(abs[i]);
  10888.  
  10889. abs.Clear();
  10890. GetCharacterStatsParam(abs);
  10891. for(i = 0; i < abs.Size(); i +=1 )
  10892. AddAbility(abs[i]);
  10893.  
  10894. delete levelManager;
  10895. levelManager = new W3LevelManager in this;
  10896. levelManager.Initialize();
  10897. levelManager.PostInit(this, false, true);
  10898.  
  10899. if(!resetLevels)
  10900. {
  10901. levelManager.AddPoints(EExperiencePoint, totalExp, false, true);
  10902. levelManager.AddPoints(ESkillPoint, Max(0, totalSkillPoints - levelManager.GetPointsTotal(ESkillPoint)), false);
  10903. }
  10904.  
  10905. delete abilityManager;
  10906. SetAbilityManager();
  10907. abilityManager.Init(this, GetCharacterStats(), false, theGame.GetDifficultyMode());
  10908.  
  10909. delete effectManager;
  10910. SetEffectManager();
  10911.  
  10912. abilityManager.PostInit();
  10913. ((W3PlayerAbilityManager)abilityManager).MutationSystemEnable(isMutationSystemEnabled);
  10914. }
  10915.  
  10916. function Debug_BearSetBonusQuenSkills()
  10917. {
  10918. var skills : array<ESkill>;
  10919. var i, slot : int;
  10920.  
  10921. skills.PushBack(S_Magic_s04);
  10922. skills.PushBack(S_Magic_s14);
  10923.  
  10924. for(i=0; i<skills.Size(); i+=1)
  10925. {
  10926.  
  10927. if(GetSkillLevel(skills[i]) == 0)
  10928. {
  10929. AddSkill(skills[i]);
  10930. }
  10931.  
  10932. slot = GetFreeSkillSlot();
  10933.  
  10934.  
  10935. EquipSkill(skills[i], slot);
  10936. }
  10937. }
  10938.  
  10939. final function Debug_HAX_UnlockSkillSlot(slotIndex : int) : bool
  10940. {
  10941. if(abilityManager && abilityManager.IsInitialized())
  10942. return ((W3PlayerAbilityManager)abilityManager).Debug_HAX_UnlockSkillSlot(slotIndex);
  10943.  
  10944. return false;
  10945. }
  10946.  
  10947.  
  10948. public function GetLevelupAbility( id : int) : name
  10949. {
  10950. switch(id)
  10951. {
  10952. case 1: return 'Lvl1';
  10953. case 2: return 'Lvl2';
  10954. case 3: return 'Lvl3';
  10955. case 4: return 'Lvl4';
  10956. case 5: return 'Lvl5';
  10957. case 6: return 'Lvl6';
  10958. case 7: return 'Lvl7';
  10959. case 8: return 'Lvl8';
  10960. case 9: return 'Lvl9';
  10961. case 10: return 'Lvl10';
  10962. case 11: return 'Lvl11';
  10963. case 12: return 'Lvl12';
  10964. case 13: return 'Lvl13';
  10965. case 14: return 'Lvl14';
  10966. case 15: return 'Lvl15';
  10967. case 16: return 'Lvl16';
  10968. case 17: return 'Lvl17';
  10969. case 18: return 'Lvl18';
  10970. case 19: return 'Lvl19';
  10971. case 20: return 'Lvl20';
  10972. case 21: return 'Lvl21';
  10973. case 22: return 'Lvl22';
  10974. case 23: return 'Lvl23';
  10975. case 24: return 'Lvl24';
  10976. case 25: return 'Lvl25';
  10977. case 26: return 'Lvl26';
  10978. case 27: return 'Lvl27';
  10979. case 28: return 'Lvl28';
  10980. case 29: return 'Lvl29';
  10981. case 30: return 'Lvl30';
  10982. case 31: return 'Lvl31';
  10983. case 32: return 'Lvl32';
  10984. case 33: return 'Lvl33';
  10985. case 34: return 'Lvl34';
  10986. case 35: return 'Lvl35';
  10987. case 36: return 'Lvl36';
  10988. case 37: return 'Lvl37';
  10989. case 38: return 'Lvl38';
  10990. case 39: return 'Lvl39';
  10991. case 40: return 'Lvl40';
  10992. case 41: return 'Lvl41';
  10993. case 42: return 'Lvl42';
  10994. case 43: return 'Lvl43';
  10995. case 44: return 'Lvl44';
  10996. case 45: return 'Lvl45';
  10997. case 46: return 'Lvl46';
  10998. case 47: return 'Lvl47';
  10999. case 48: return 'Lvl48';
  11000. case 49: return 'Lvl49';
  11001. case 50: return 'Lvl50';
  11002.  
  11003. default: return '';
  11004. }
  11005.  
  11006. return '';
  11007. }
  11008.  
  11009. public function CanSprint( speed : float ) : bool
  11010. {
  11011. /*if( !super.CanSprint( speed ) )
  11012. {
  11013. return false;
  11014. } */ //modSings
  11015. if(theGame.GetEngineTimeAsSeconds() - blockSprintTimestamp < 2) //modSigns
  11016. {
  11017. return false;
  11018. }
  11019. if( rangedWeapon && rangedWeapon.GetCurrentStateName() != 'State_WeaponWait' )
  11020. {
  11021. if ( this.GetPlayerCombatStance() == PCS_AlertNear )
  11022. {
  11023. if ( IsSprintActionPressed() )
  11024. OnRangedForceHolster( true, false );
  11025. }
  11026. else
  11027. return false;
  11028. }
  11029. if( GetCurrentStateName() != 'Swimming' && GetStat(BCS_Stamina) <= 0 )
  11030. {
  11031. SetSprintActionPressed(false,true);
  11032. blockSprintTimestamp = theGame.GetEngineTimeAsSeconds(); //modSings
  11033. return false;
  11034. }
  11035.  
  11036. return super.CanSprint( speed ); //modSigns: moved here
  11037. }
  11038.  
  11039. var blockSprintTimestamp : float; //modSings
  11040.  
  11041. public function ManageSleeping()
  11042. {
  11043. thePlayer.RemoveBuffImmunity_AllCritical( 'Bed' );
  11044. thePlayer.RemoveBuffImmunity_AllNegative( 'Bed' );
  11045.  
  11046. thePlayer.PlayerStopAction( PEA_GoToSleep );
  11047. }
  11048.  
  11049.  
  11050.  
  11051. public function RestoreHorseManager() : bool
  11052. {
  11053. var horseTemplate : CEntityTemplate;
  11054. var horseManager : W3HorseManager;
  11055.  
  11056. if ( GetHorseManager() )
  11057. {
  11058. return false;
  11059. }
  11060.  
  11061. horseTemplate = (CEntityTemplate)LoadResource("horse_manager");
  11062. horseManager = (W3HorseManager)theGame.CreateEntity(horseTemplate, GetWorldPosition(),,,,,PM_Persist);
  11063. horseManager.CreateAttachment(this);
  11064. horseManager.OnCreated();
  11065. EntityHandleSet( horseManagerHandle, horseManager );
  11066.  
  11067. return true;
  11068. }
  11069.  
  11070.  
  11071.  
  11072.  
  11073.  
  11074.  
  11075. final function PerformParryCheck( parryInfo : SParryInfo ) : bool
  11076. {
  11077. if( super.PerformParryCheck( parryInfo ) )
  11078. {
  11079. //GainAdrenalineFromPerk21( 'parry' ); //modSigns
  11080. return true;
  11081. }
  11082. return false;
  11083. }
  11084.  
  11085. protected final function PerformCounterCheck( parryInfo: SParryInfo ) : bool
  11086. {
  11087. var fistFightCheck, isInFistFight : bool;
  11088.  
  11089. if( super.PerformCounterCheck( parryInfo ) )
  11090. {
  11091. //GainAdrenalineFromPerk21( 'counter' ); //modSigns
  11092.  
  11093. isInFistFight = FistFightCheck( parryInfo.target, parryInfo.attacker, fistFightCheck );
  11094.  
  11095. if( isInFistFight && fistFightCheck )
  11096. {
  11097. FactsAdd( "statistics_fist_fight_counter" );
  11098. AddTimer( 'FistFightCounterTimer', 0.5f, , , , true );
  11099. }
  11100.  
  11101. return true;
  11102. }
  11103. return false;
  11104. }
  11105.  
  11106. /*public function GainAdrenalineFromPerk21( n : name )
  11107. {
  11108. var perkStats, perkTime : SAbilityAttributeValue;
  11109. var targets : array<CActor>;
  11110.  
  11111. targets = GetHostileEnemies();
  11112.  
  11113. if( !CanUseSkill( S_Perk_21 ) || targets.Size() == 0 )
  11114. {
  11115. return;
  11116. }
  11117.  
  11118. perkTime = GetSkillAttributeValue( S_Perk_21, 'perk21Time', false, false );
  11119.  
  11120. if( theGame.GetEngineTimeAsSeconds() >= timeForPerk21 + perkTime.valueAdditive )
  11121. {
  11122. perkStats = GetSkillAttributeValue( S_Perk_21, n , false, false );
  11123. GainStat( BCS_Focus, perkStats.valueAdditive );
  11124. timeForPerk21 = theGame.GetEngineTimeAsSeconds();
  11125.  
  11126. AddEffectDefault( EET_Perk21InternalCooldown, this, "Perk21", false );
  11127. }
  11128. }*/ //modSigns
  11129.  
  11130. public function Perk21GainStamina(action : name) //modSigns
  11131. {
  11132. var min, max : SAbilityAttributeValue;
  11133.  
  11134. if(!HasBuff(EET_Perk21InternalCooldown) || action == 'kill')
  11135. {
  11136. switch(action)
  11137. {
  11138. case 'kill':
  11139. theGame.GetDefinitionsManager().GetAbilityAttributeValue('perk_21', 'stamina_kill', min, max);
  11140. GainStat(BCS_Stamina, min.valueMultiplicative * GetStatMax(BCS_Stamina));
  11141. break;
  11142. case 'crit':
  11143. case 'counter':
  11144. theGame.GetDefinitionsManager().GetAbilityAttributeValue('perk_21', 'stamina_other', min, max);
  11145. GainStat(BCS_Stamina, min.valueMultiplicative * GetStatMax(BCS_Stamina));
  11146. break;
  11147. default:
  11148. break;
  11149. }
  11150. AddEffectDefault(EET_Perk21InternalCooldown, this, "Perk21");
  11151. }
  11152. }
  11153.  
  11154. timer function FistFightCounterTimer( dt : float, id : int )
  11155. {
  11156. FactsRemove( "statistics_fist_fight_counter" );
  11157. }
  11158.  
  11159. public final function IsSignBlocked(signType : ESignType) : bool
  11160. {
  11161. switch( signType )
  11162. {
  11163. case ST_Aard :
  11164. return IsRadialSlotBlocked ( 'Aard');
  11165. break;
  11166. case ST_Axii :
  11167. return IsRadialSlotBlocked ( 'Axii');
  11168. break;
  11169. case ST_Igni :
  11170. return IsRadialSlotBlocked ( 'Igni');
  11171. break;
  11172. case ST_Quen :
  11173. return IsRadialSlotBlocked ( 'Quen');
  11174. break;
  11175. case ST_Yrden :
  11176. return IsRadialSlotBlocked ( 'Yrden');
  11177. break;
  11178. default:
  11179. break;
  11180. }
  11181. return false;
  11182.  
  11183. }
  11184.  
  11185. public final function AddAnItemWithAutogenLevelAndQuality(itemName : name, desiredLevel : int, minQuality : int, optional equipItem : bool)
  11186. {
  11187. var itemLevel, quality : int;
  11188. var ids : array<SItemUniqueId>;
  11189. var attemptCounter : int;
  11190.  
  11191. itemLevel = 0;
  11192. quality = 0;
  11193. attemptCounter = 0;
  11194. while(itemLevel != desiredLevel || quality < minQuality)
  11195. {
  11196. attemptCounter += 1;
  11197. ids.Clear();
  11198. ids = inv.AddAnItem(itemName, 1, true);
  11199. itemLevel = inv.GetItemLevel(ids[0]);
  11200. quality = RoundMath(CalculateAttributeValue(inv.GetItemAttributeValue(ids[0], 'quality')));
  11201.  
  11202.  
  11203. if(attemptCounter >= 1000)
  11204. break;
  11205.  
  11206. if(itemLevel != desiredLevel || quality < minQuality)
  11207. inv.RemoveItem(ids[0]);
  11208. }
  11209.  
  11210. if(equipItem)
  11211. EquipItem(ids[0]);
  11212. }
  11213.  
  11214. public final function AddAnItemWithAutogenLevel(itemName : name, desiredLevel : int)
  11215. {
  11216. var itemLevel : int;
  11217. var ids : array<SItemUniqueId>;
  11218. var attemptCounter : int;
  11219.  
  11220. itemLevel = 0;
  11221. while(itemLevel != desiredLevel)
  11222. {
  11223. attemptCounter += 1;
  11224. ids.Clear();
  11225. ids = inv.AddAnItem(itemName, 1, true);
  11226. itemLevel = inv.GetItemLevel(ids[0]);
  11227.  
  11228.  
  11229. if(attemptCounter >= 1000)
  11230. break;
  11231.  
  11232. if(itemLevel != desiredLevel)
  11233. inv.RemoveItem(ids[0]);
  11234. }
  11235. }
  11236.  
  11237. public final function AddAnItemWithMinQuality(itemName : name, minQuality : int, optional equip : bool)
  11238. {
  11239. var quality : int;
  11240. var ids : array<SItemUniqueId>;
  11241. var attemptCounter : int;
  11242.  
  11243. quality = 0;
  11244. while(quality < minQuality)
  11245. {
  11246. attemptCounter += 1;
  11247. ids.Clear();
  11248. ids = inv.AddAnItem(itemName, 1, true);
  11249. quality = RoundMath(CalculateAttributeValue(inv.GetItemAttributeValue(ids[0], 'quality')));
  11250.  
  11251.  
  11252. if(attemptCounter >= 1000)
  11253. break;
  11254.  
  11255. if(quality < minQuality)
  11256. inv.RemoveItem(ids[0]);
  11257. }
  11258.  
  11259. if(equip)
  11260. EquipItem(ids[0]);
  11261. }
  11262.  
  11263.  
  11264.  
  11265.  
  11266.  
  11267.  
  11268. //modSigns: fix equipped, only once
  11269. private function RecalcSetItemsEquipped()
  11270. {
  11271. var slotsToCheck : array<EEquipmentSlots>;
  11272. var setType : EItemSetType;
  11273. var item : SItemUniqueId;
  11274. var i : int;
  11275.  
  11276. for(i = 0; i < amountOfSetPiecesEquipped.Size(); i += 1)
  11277. amountOfSetPiecesEquipped[i] = 0;
  11278.  
  11279. slotsToCheck.PushBack(EES_Armor);
  11280. slotsToCheck.PushBack(EES_Boots);
  11281. slotsToCheck.PushBack(EES_Pants);
  11282. slotsToCheck.PushBack(EES_Gloves);
  11283. slotsToCheck.PushBack(EES_SilverSword);
  11284. slotsToCheck.PushBack(EES_SteelSword);
  11285.  
  11286. for(i = 0; i < slotsToCheck.Size(); i += 1)
  11287. {
  11288. if(GetItemEquippedOnSlot(slotsToCheck[i], item) && inv.ItemHasTag(item, 'SetBonusPiece'))
  11289. {
  11290. setType = CheckSetType( item );
  11291. amountOfSetPiecesEquipped[ setType ] += 1;
  11292. ManageSetBonusesSoundbanks( setType );
  11293. }
  11294. }
  11295. }
  11296.  
  11297. //modSigns: minor sets added
  11298. public function IsSetBonusActive( bonus : EItemSetBonus ) : bool
  11299. {
  11300. switch(bonus)
  11301. {
  11302. case EISB_Lynx_1:
  11303. return amountOfSetPiecesEquipped[ EIST_Lynx ] + amountOfSetPiecesEquipped[ EIST_Lynx_Minor ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  11304. case EISB_Lynx_2:
  11305. return amountOfSetPiecesEquipped[ EIST_Lynx ] >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS;
  11306. case EISB_Gryphon_1:
  11307. return amountOfSetPiecesEquipped[ EIST_Gryphon ] + amountOfSetPiecesEquipped[ EIST_Gryphon_Minor ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  11308. case EISB_Gryphon_2:
  11309. return amountOfSetPiecesEquipped[ EIST_Gryphon ] >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS;
  11310. case EISB_Bear_1:
  11311. return amountOfSetPiecesEquipped[ EIST_Bear ] + amountOfSetPiecesEquipped[ EIST_Bear_Minor ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  11312. case EISB_Bear_2:
  11313. return amountOfSetPiecesEquipped[ EIST_Bear ] >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS;
  11314. case EISB_Wolf_1:
  11315. return amountOfSetPiecesEquipped[ EIST_Wolf ] + amountOfSetPiecesEquipped[ EIST_Wolf_Minor ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  11316. case EISB_Wolf_2:
  11317. return amountOfSetPiecesEquipped[ EIST_Wolf ] >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS;
  11318. case EISB_RedWolf_1:
  11319. return amountOfSetPiecesEquipped[ EIST_RedWolf ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  11320. case EISB_RedWolf_2:
  11321. return amountOfSetPiecesEquipped[ EIST_RedWolf ] >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS;
  11322. case EISB_Vampire:
  11323. return amountOfSetPiecesEquipped[ EIST_Vampire ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  11324. //modSigns
  11325. case EISB_Viper:
  11326. return amountOfSetPiecesEquipped[ EIST_Viper ] >= GetNumItemsRequiredForSetActivation(EIST_Viper);
  11327. case EISB_KaerMorhen:
  11328. return amountOfSetPiecesEquipped[ EIST_KaerMorhen ] >= GetNumItemsRequiredForSetActivation(EIST_KaerMorhen);
  11329. default: return false;
  11330. }
  11331. }
  11332.  
  11333. //modSigns: minor sets
  11334. public function GetSetPartsEquipped( setType : EItemSetType ) : int
  11335. {
  11336. switch( setType )
  11337. {
  11338. case EIST_Lynx:
  11339. case EIST_Lynx_Minor:
  11340. return amountOfSetPiecesEquipped[ EIST_Lynx ] + amountOfSetPiecesEquipped[ EIST_Lynx_Minor ];
  11341. case EIST_Gryphon:
  11342. case EIST_Gryphon_Minor:
  11343. return amountOfSetPiecesEquipped[ EIST_Gryphon ] + amountOfSetPiecesEquipped[ EIST_Gryphon_Minor ];
  11344. case EIST_Bear:
  11345. case EIST_Bear_Minor:
  11346. return amountOfSetPiecesEquipped[ EIST_Bear ] + amountOfSetPiecesEquipped[ EIST_Bear_Minor ];
  11347. case EIST_Wolf:
  11348. case EIST_Wolf_Minor:
  11349. return amountOfSetPiecesEquipped[ EIST_Wolf ] + amountOfSetPiecesEquipped[ EIST_Wolf_Minor ];
  11350. default:
  11351. return amountOfSetPiecesEquipped[ setType ];
  11352. }
  11353. }
  11354.  
  11355. //modSigns
  11356. public function GetSetPartsEquippedRaw( setType : EItemSetType ) : int
  11357. {
  11358. return amountOfSetPiecesEquipped[ setType ];
  11359. }
  11360.  
  11361. //modSigns
  11362. public function HasMixedSetsEquipped() : bool
  11363. {
  11364. return amountOfSetPiecesEquipped[ EIST_Lynx ] > 0 && amountOfSetPiecesEquipped[ EIST_Lynx_Minor ] > 0 ||
  11365. amountOfSetPiecesEquipped[ EIST_Gryphon ] > 0 && amountOfSetPiecesEquipped[ EIST_Gryphon_Minor ] > 0 ||
  11366. amountOfSetPiecesEquipped[ EIST_Bear ] > 0 && amountOfSetPiecesEquipped[ EIST_Bear_Minor ] > 0 ||
  11367. amountOfSetPiecesEquipped[ EIST_Wolf ] > 0 && amountOfSetPiecesEquipped[ EIST_Wolf_Minor ] > 0;
  11368. }
  11369.  
  11370. protected function UpdateItemSetBonuses( item : SItemUniqueId, increment : bool )
  11371. {
  11372. var setType : EItemSetType;
  11373. var tutorialStateSets : W3TutorialManagerUIHandlerStateSetItemsUnlocked;
  11374. var id : SItemUniqueId;
  11375.  
  11376. if( !inv.IsIdValid( item ) || !inv.ItemHasTag(item, theGame.params.ITEM_SET_TAG_BONUS ) )
  11377. {
  11378.  
  11379. if( !IsSetBonusActive( EISB_Wolf_2 ) ) //modSigns
  11380. {
  11381. if( GetItemEquippedOnSlot( EES_SteelSword, id ) )
  11382. {
  11383. RemoveExtraOilsFromItem( id );
  11384. }
  11385. if( GetItemEquippedOnSlot( EES_SilverSword, id ) )
  11386. {
  11387. RemoveExtraOilsFromItem( id );
  11388. }
  11389. }
  11390.  
  11391. return;
  11392. }
  11393.  
  11394. setType = CheckSetType( item );
  11395.  
  11396. if( increment )
  11397. {
  11398. amountOfSetPiecesEquipped[ setType ] += 1;
  11399.  
  11400. //modSigns
  11401. if( GetSetPartsEquipped(setType) >= GetNumItemsRequiredForSetActivation(setType) && ShouldProcessTutorial( 'TutorialSetBonusesUnlocked' ) && theGame.GetTutorialSystem().uiHandler && theGame.GetTutorialSystem().uiHandler.GetCurrentStateName() == 'SetItemsUnlocked' )
  11402. {
  11403. tutorialStateSets = ( W3TutorialManagerUIHandlerStateSetItemsUnlocked )theGame.GetTutorialSystem().uiHandler.GetCurrentState();
  11404. tutorialStateSets.OnSetBonusCompleted();
  11405. }
  11406. }
  11407. else if( amountOfSetPiecesEquipped[ setType ] > 0 )
  11408. {
  11409. amountOfSetPiecesEquipped[ setType ] -= 1;
  11410. }
  11411.  
  11412.  
  11413. //modSigns
  11414. //if( setType < EIST_Viper && amountOfSetPiecesEquipped[ setType ] == theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS )
  11415. if( IsSetBonusActive(EISB_Lynx_2) || IsSetBonusActive(EISB_Gryphon_2) || IsSetBonusActive(EISB_Bear_2) || IsSetBonusActive(EISB_Wolf_2) || IsSetBonusActive(EISB_RedWolf_2) )
  11416. {
  11417. theGame.GetGamerProfile().AddAchievement( EA_ReadyToRoll );
  11418. }
  11419.  
  11420.  
  11421. if( !IsSetBonusActive( EISB_Wolf_2 ) ) //modSigns
  11422. {
  11423. if( GetItemEquippedOnSlot( EES_SteelSword, id ) )
  11424. {
  11425. RemoveExtraOilsFromItem( id );
  11426. }
  11427. if( GetItemEquippedOnSlot( EES_SilverSword, id ) )
  11428. {
  11429. RemoveExtraOilsFromItem( id );
  11430. }
  11431. }
  11432.  
  11433. ManageActiveSetBonuses( setType );
  11434.  
  11435.  
  11436. ManageSetBonusesSoundbanks( setType );
  11437. }
  11438.  
  11439. public function ManageActiveSetBonuses( setType : EItemSetType )
  11440. {
  11441. var l_i : int;
  11442.  
  11443.  
  11444. if( setType == EIST_Lynx || setType == EIST_Lynx_Minor ) //modSigns
  11445. {
  11446.  
  11447. if( HasBuff( EET_LynxSetBonus ) && !IsSetBonusActive( EISB_Lynx_1 ) )
  11448. {
  11449. RemoveBuff( EET_LynxSetBonus );
  11450. }
  11451. }
  11452.  
  11453. else if( setType == EIST_Gryphon )
  11454. {
  11455.  
  11456. if( !IsSetBonusActive( EISB_Gryphon_1 ) )
  11457. {
  11458. RemoveBuff( EET_GryphonSetBonus );
  11459. }
  11460.  
  11461. if( IsSetBonusActive( EISB_Gryphon_2 ) && !HasBuff( EET_GryphonSetBonusYrden ) )
  11462. {
  11463. for( l_i = 0 ; l_i < yrdenEntities.Size() ; l_i += 1 )
  11464. {
  11465. if( yrdenEntities[ l_i ].GetIsPlayerInside() && !yrdenEntities[ l_i ].IsAlternateCast() )
  11466. {
  11467. AddEffectDefault( EET_GryphonSetBonusYrden, this, "GryphonSetBonusYrden" );
  11468. break;
  11469. }
  11470. }
  11471. }
  11472. else
  11473. {
  11474. RemoveBuff( EET_GryphonSetBonusYrden );
  11475. }
  11476. }
  11477.  
  11478. //modSigns
  11479. else if( setType == EIST_KaerMorhen )
  11480. {
  11481. if( !IsSetBonusActive(EISB_KaerMorhen) && HasBuff(EET_KaerMorhenSetBonus) )
  11482. {
  11483. RemoveBuff(EET_KaerMorhenSetBonus);
  11484. }
  11485. else if( IsSetBonusActive(EISB_KaerMorhen) && !HasBuff(EET_KaerMorhenSetBonus) && IsInCombat() )
  11486. {
  11487. AddEffectDefault(EET_KaerMorhenSetBonus, this, "KaerMorhenSetBonus");
  11488. }
  11489. }
  11490. }
  11491.  
  11492. public function CheckSetTypeByName( itemName : name ) : EItemSetType
  11493. {
  11494. var dm : CDefinitionsManagerAccessor;
  11495.  
  11496. dm = theGame.GetDefinitionsManager();
  11497.  
  11498. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_LYNX ) )
  11499. {
  11500. return EIST_Lynx;
  11501. }
  11502. else
  11503. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_GRYPHON ) )
  11504. {
  11505. return EIST_Gryphon;
  11506. }
  11507. else
  11508. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_BEAR ) )
  11509. {
  11510. return EIST_Bear;
  11511. }
  11512. else
  11513. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_WOLF ) )
  11514. {
  11515. return EIST_Wolf;
  11516. }
  11517. else
  11518. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_RED_WOLF ) )
  11519. {
  11520. return EIST_RedWolf;
  11521. }
  11522. else
  11523. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_VAMPIRE ) )
  11524. {
  11525. return EIST_Vampire;
  11526. }
  11527. else
  11528. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_VIPER ) )
  11529. {
  11530. return EIST_Viper;
  11531. }
  11532. else
  11533. //modSigns
  11534. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_KAER_MORHEN ) )
  11535. {
  11536. return EIST_KaerMorhen;
  11537. }
  11538. else
  11539. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_LYNX_MINOR ) )
  11540. {
  11541. return EIST_Lynx_Minor;
  11542. }
  11543. else
  11544. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_GRYPHON_MINOR ) )
  11545. {
  11546. return EIST_Gryphon_Minor;
  11547. }
  11548. else
  11549. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_BEAR_MINOR ) )
  11550. {
  11551. return EIST_Bear_Minor;
  11552. }
  11553. else
  11554. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_WOLF_MINOR ) )
  11555. {
  11556. return EIST_Wolf_Minor;
  11557. }
  11558. else
  11559. {
  11560. return EIST_Undefined;
  11561. }
  11562. }
  11563.  
  11564. public function CheckSetType( item : SItemUniqueId ) : EItemSetType
  11565. {
  11566. var stopLoop : bool;
  11567. var tags : array<name>;
  11568. var i : int;
  11569. var setType : EItemSetType;
  11570.  
  11571. stopLoop = false;
  11572.  
  11573. inv.GetItemTags( item, tags );
  11574.  
  11575.  
  11576. for( i=0; i<tags.Size(); i+=1 )
  11577. {
  11578. switch( tags[i] )
  11579. {
  11580. case theGame.params.ITEM_SET_TAG_LYNX:
  11581. case theGame.params.ITEM_SET_TAG_GRYPHON:
  11582. case theGame.params.ITEM_SET_TAG_BEAR:
  11583. case theGame.params.ITEM_SET_TAG_WOLF:
  11584. case theGame.params.ITEM_SET_TAG_RED_WOLF:
  11585. case theGame.params.ITEM_SET_TAG_VAMPIRE:
  11586. case theGame.params.ITEM_SET_TAG_VIPER:
  11587. //modSigns
  11588. case theGame.params.ITEM_SET_TAG_KAER_MORHEN:
  11589. case theGame.params.ITEM_SET_TAG_LYNX_MINOR:
  11590. case theGame.params.ITEM_SET_TAG_GRYPHON_MINOR:
  11591. case theGame.params.ITEM_SET_TAG_BEAR_MINOR:
  11592. case theGame.params.ITEM_SET_TAG_WOLF_MINOR:
  11593. setType = SetItemNameToType( tags[i] );
  11594. stopLoop = true;
  11595. break;
  11596. }
  11597. if ( stopLoop )
  11598. {
  11599. break;
  11600. }
  11601. }
  11602.  
  11603. return setType;
  11604. }
  11605.  
  11606. public function GetSetBonusStatusByName( itemName : name, out desc1, desc2 : string, out isActive1, isActive2 : bool ) : EItemSetType
  11607. {
  11608. var setType : EItemSetType;
  11609.  
  11610. if( theGame.GetDLCManager().IsEP2Enabled() )
  11611. {
  11612. setType = CheckSetTypeByName( itemName );
  11613. SetBonusStatusByType( setType, desc1, desc2, isActive1, isActive2 );
  11614.  
  11615. return setType;
  11616. }
  11617. else
  11618. {
  11619. return EIST_Undefined;
  11620. }
  11621. }
  11622.  
  11623. public function GetSetBonusStatus( item : SItemUniqueId, out desc1, desc2 : string, out isActive1, isActive2 : bool ) : EItemSetType
  11624. {
  11625. var setType : EItemSetType;
  11626.  
  11627. if( theGame.GetDLCManager().IsEP2Enabled() )
  11628. {
  11629. setType = CheckSetType( item );
  11630. SetBonusStatusByType( setType, desc1, desc2, isActive1, isActive2 );
  11631.  
  11632. return setType;
  11633. }
  11634. else
  11635. {
  11636. return EIST_Undefined;
  11637. }
  11638. }
  11639.  
  11640. private function SetBonusStatusByType(setType : EItemSetType, out desc1, desc2 : string, out isActive1, isActive2 : bool):void
  11641. {
  11642. var setBonus : EItemSetBonus;
  11643.  
  11644. //modSigns
  11645. isActive1 = (GetSetPartsEquipped(setType) >= GetNumItemsRequiredForSetActivation(setType));
  11646. isActive2 = (amountOfSetPiecesEquipped[ setType ] >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS);
  11647.  
  11648. setBonus = ItemSetTypeToItemSetBonus( setType, 1 );
  11649. desc1 = GetSetBonusTooltipDescription( setBonus );
  11650.  
  11651. setBonus = ItemSetTypeToItemSetBonus( setType, 2 );
  11652. desc2 = GetSetBonusTooltipDescription( setBonus );
  11653. }
  11654.  
  11655. public function ItemSetTypeToItemSetBonus( setType : EItemSetType, nr : int ) : EItemSetBonus
  11656. {
  11657. var setBonus : EItemSetBonus;
  11658.  
  11659. if( nr == 1 )
  11660. {
  11661. switch( setType )
  11662. {
  11663. case EIST_Lynx: setBonus = EISB_Lynx_1; break;
  11664. case EIST_Gryphon: setBonus = EISB_Gryphon_1; break;
  11665. case EIST_Bear: setBonus = EISB_Bear_1; break;
  11666. case EIST_Wolf: setBonus = EISB_Wolf_1; break;
  11667. case EIST_RedWolf: setBonus = EISB_RedWolf_1; break;
  11668. case EIST_Vampire: setBonus = EISB_Vampire; break;
  11669. //modSigns
  11670. case EIST_Viper: setBonus = EISB_Viper; break;
  11671. case EIST_KaerMorhen: setBonus = EISB_KaerMorhen; break;
  11672. case EIST_Lynx_Minor: setBonus = EISB_Lynx_1; break;
  11673. case EIST_Gryphon_Minor: setBonus = EISB_Gryphon_1; break;
  11674. case EIST_Bear_Minor: setBonus = EISB_Bear_1; break;
  11675. case EIST_Wolf_Minor: setBonus = EISB_Wolf_1; break;
  11676. }
  11677. }
  11678. else
  11679. {
  11680. switch( setType )
  11681. {
  11682. case EIST_Lynx: setBonus = EISB_Lynx_2; break;
  11683. case EIST_Gryphon: setBonus = EISB_Gryphon_2; break;
  11684. case EIST_Bear: setBonus = EISB_Bear_2; break;
  11685. case EIST_Wolf: setBonus = EISB_Wolf_2; break;
  11686. case EIST_RedWolf: setBonus = EISB_RedWolf_2; break;
  11687. case EIST_Vampire: setBonus = EISB_Undefined; break;
  11688. //modSigns
  11689. case EIST_Viper: setBonus = EISB_Undefined; break;
  11690. case EIST_KaerMorhen: setBonus = EISB_Undefined; break;
  11691. case EIST_Lynx_Minor: setBonus = EISB_Undefined; break;
  11692. case EIST_Gryphon_Minor: setBonus = EISB_Undefined; break;
  11693. case EIST_Bear_Minor: setBonus = EISB_Undefined; break;
  11694. case EIST_Wolf_Minor: setBonus = EISB_Undefined; break;
  11695. }
  11696. }
  11697.  
  11698. return setBonus;
  11699. }
  11700.  
  11701. public function GetSetBonusTooltipDescription( bonus : EItemSetBonus ) : string
  11702. {
  11703. var finalString : string;
  11704. var arrString : array<string>;
  11705. var dm : CDefinitionsManagerAccessor;
  11706. var min, max : SAbilityAttributeValue;
  11707. var tempString : string;
  11708. var tmpVal : float; //modSigns
  11709.  
  11710. switch( bonus )
  11711. {
  11712. case EISB_Lynx_1: tempString = "skill_desc_lynx_set_ability1"; break;
  11713. case EISB_Lynx_2: tempString = "skill_desc_lynx_set_ability2"; break;
  11714. case EISB_Gryphon_1: tempString = "skill_desc_gryphon_set_ability1"; break;
  11715. case EISB_Gryphon_2: tempString = "skill_desc_gryphon_set_ability2"; break;
  11716. case EISB_Bear_1: tempString = "skill_desc_bear_set_ability1"; break;
  11717. case EISB_Bear_2: tempString = "skill_desc_bear_set_ability2"; break;
  11718. case EISB_Wolf_1: tempString = "skill_desc_wolf_set_ability1"; break;
  11719. case EISB_Wolf_2: tempString = "skill_desc_wolf_set_ability2"; break;
  11720. case EISB_RedWolf_1: tempString = "skill_desc_red_wolf_set_ability1"; break;
  11721. case EISB_RedWolf_2: tempString = "skill_desc_red_wolf_set_ability2"; break;
  11722. case EISB_Vampire: tempString = "skill_desc_vampire_set_ability1"; break;
  11723. //modSigns
  11724. case EISB_Viper: tempString = "skill_desc_viper_set_ability1"; break;
  11725. case EISB_KaerMorhen: tempString = "skill_desc_kaer_morhen_set_ability1"; break;
  11726. default: tempString = ""; break;
  11727. }
  11728.  
  11729. dm = theGame.GetDefinitionsManager();
  11730.  
  11731. switch( bonus )
  11732. {
  11733. case EISB_Lynx_1:
  11734. dm.GetAbilityAttributeValue( 'LynxSetBonusEffect', 'lynx_ap_boost', min, max );
  11735. arrString.PushBack( FloatToString( min.valueAdditive * 100 ) );
  11736. arrString.PushBack( FloatToString( min.valueAdditive * 100 * GetSetPartsEquipped( EIST_Lynx ) ) );
  11737. dm.GetAbilityAttributeValue( 'LynxSetBonusEffect', 'lynx_boost_max', min, max );
  11738. arrString.PushBack( FloatToString( min.valueAdditive * 100 ) );
  11739. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  11740. break;
  11741. case EISB_Lynx_2:
  11742. //modSigns: changed
  11743. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  11744. break;
  11745. case EISB_Gryphon_1:
  11746. //modSigns: new mechanic
  11747. dm.GetAbilityAttributeValue( 'GryphonSetBonusEffect', 'gryphon_tier1_bonus', min, max );
  11748. arrString.PushBack( FloatToString( min.valueAdditive * 100 ) );
  11749. arrString.PushBack( FloatToString( min.valueAdditive * 100 * GetSetPartsEquipped( EIST_Gryphon ) ) );
  11750. dm.GetAbilityAttributeValue( 'GryphonSetBonusEffect', 'duration', min, max );
  11751. arrString.PushBack( FloatToString( min.valueAdditive ) );
  11752. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  11753. break;
  11754. case EISB_Gryphon_2:
  11755. dm.GetAbilityAttributeValue( 'GryphonSetBonusYrdenEffect', 'trigger_scale', min, max );
  11756. arrString.PushBack( FloatToString( ( min.valueAdditive - 1 )* 100) );
  11757. //dm.GetAbilityAttributeValue( 'GryphonSetBonusYrdenEffect', 'staminaRegen', min, max ); //modSigns: removed
  11758. //arrString.PushBack( FloatToString( min.valueMultiplicative * 100) );
  11759. dm.GetAbilityAttributeValue( 'GryphonSetBonusYrdenEffect', 'spell_power', min, max );
  11760. arrString.PushBack( FloatToString( min.valueMultiplicative * 100) );
  11761. dm.GetAbilityAttributeValue( 'GryphonSetBonusYrdenEffect', 'slashing_resistance_perc', min, max );
  11762. arrString.PushBack( FloatToString( min.valueAdditive * 100) );
  11763. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  11764. break;
  11765. case EISB_Bear_1: //modSigns: full set redesign
  11766. dm.GetAbilityAttributeValue( 'setBonusAbilityBear_1', 'bonus_focus_gain', min, max );
  11767. arrString.PushBack( NoTrailZeros( CalculateAttributeValue(min) ) );
  11768. arrString.PushBack( NoTrailZeros( CalculateAttributeValue(min) * GetSetPartsEquipped( EIST_Bear ) ) );
  11769. dm.GetAbilityAttributeValue( 'setBonusAbilityBear_1', 'attack_power', min, max );
  11770. arrString.PushBack( NoTrailZeros( min.valueMultiplicative * 100 ) );
  11771. arrString.PushBack( NoTrailZeros( min.valueMultiplicative * 100 * GetSetPartsEquipped( EIST_Bear ) ) );
  11772. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  11773. break;
  11774. case EISB_Bear_2: //modSigns: full set redesign
  11775. dm.GetAbilityAttributeValue( 'setBonusAbilityBear_2', 'stamina_attack', min, max );
  11776. arrString.PushBack( NoTrailZeros( CalculateAttributeValue(min) * 100 ) );
  11777. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  11778. break;
  11779. //modSigns
  11780. case EISB_Wolf_1:
  11781. dm.GetAbilityAttributeValue( 'SetBonusAbilityWolf_1', 'per_piece_oil_bonus', min, max );
  11782. arrString.PushBack( RoundMath( CalculateAttributeValue(min) * 100 ) );
  11783. arrString.PushBack( RoundMath( CalculateAttributeValue(min) * 100 * GetSetPartsEquipped( EIST_Wolf ) ) );
  11784. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  11785. break;
  11786. case EISB_Wolf_2:
  11787. dm.GetAbilityAttributeValue( 'SetBonusAbilityWolf_2', 'per_oil_crit_chance_bonus', min, max );
  11788. arrString.PushBack( FloatToString( CalculateAttributeValue(min) * 100 ) );
  11789. dm.GetAbilityAttributeValue( 'SetBonusAbilityWolf_2', 'per_oil_crit_power_bonus', min, max );
  11790. arrString.PushBack( FloatToString( CalculateAttributeValue(min) * 100 ) );
  11791. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  11792. break;
  11793. case EISB_RedWolf_1:
  11794. dm.GetAbilityAttributeValue( 'setBonusAbilityRedWolf_1', 'per_redwolf_piece_crit_chance_bonus', min, max );
  11795. arrString.PushBack( FloatToString( CalculateAttributeValue(min) * 100 ) );
  11796. arrString.PushBack( FloatToString( CalculateAttributeValue(min) * 100 * GetSetPartsEquipped( EIST_RedWolf ) ) );
  11797. dm.GetAbilityAttributeValue( 'setBonusAbilityRedWolf_1', 'per_redwolf_piece_crit_power_bonus', min, max );
  11798. arrString.PushBack( FloatToString( CalculateAttributeValue(min) * 100 ) );
  11799. arrString.PushBack( FloatToString( CalculateAttributeValue(min) * 100 * GetSetPartsEquipped( EIST_RedWolf ) ) );
  11800. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  11801. break;
  11802. case EISB_RedWolf_2:
  11803. dm.GetAbilityAttributeValue( 'setBonusAbilityRedWolf_2', 'amount', min, max );
  11804. arrString.PushBack( FloatToString( min.valueAdditive ) );
  11805. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  11806. break;
  11807. case EISB_Vampire:
  11808. dm.GetAbilityAttributeValue( 'setBonusAbilityVampire', 'life_percent', min, max );
  11809. arrString.PushBack( FloatToString( min.valueAdditive ) );
  11810. arrString.PushBack( FloatToString( min.valueAdditive * GetSetPartsEquipped( EIST_Vampire ) ) );
  11811. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  11812. break;
  11813. //modSigns
  11814. case EISB_Viper:
  11815. dm.GetAbilityAttributeValue( 'setBonusAbilityViper_1', 'per_viper_piece_poison_healing_rate', min, max );
  11816. arrString.PushBack( FloatToString( CalculateAttributeValue(min) * 100 ) );
  11817. arrString.PushBack( FloatToString( CalculateAttributeValue(min) * 100 * GetSetPartsEquipped( EIST_Viper ) ) );
  11818. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  11819. break;
  11820. case EISB_KaerMorhen:
  11821. dm.GetAbilityAttributeValue( 'KaerMorhenSetBonusEffect', 'staminaRegen', min, max );
  11822. tmpVal = CalculateAttributeValue(min);
  11823. arrString.PushBack( FloatToString( tmpVal ) );
  11824. dm.GetAbilityAttributeValue( 'KaerMorhenSetBonusEffect', 'maxStacks', min, max );
  11825. arrString.PushBack( FloatToString( tmpVal * CalculateAttributeValue(min) ) );
  11826. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  11827. break;
  11828. default:
  11829. finalString = GetLocStringByKeyExtWithParams( tempString );
  11830. }
  11831.  
  11832. return finalString;
  11833. }
  11834.  
  11835. //modSigns
  11836. public function LoadCurrentSetBonusSoundbank()
  11837. {
  11838. if(IsSetBonusActive(EISB_Lynx_1) || IsSetBonusActive(EISB_Lynx_2))
  11839. {
  11840. LoadSetBonusSoundBank( "ep2_setbonus_lynx.bnk" );
  11841. }
  11842. if(IsSetBonusActive(EISB_Gryphon_1) || IsSetBonusActive(EISB_Gryphon_2))
  11843. {
  11844. LoadSetBonusSoundBank( "ep2_setbonus_gryphon.bnk" );
  11845. }
  11846. //if(IsSetBonusActive(EISB_Bear_1) || IsSetBonusActive(EISB_Bear_2))
  11847. //{
  11848. LoadSetBonusSoundBank( "ep2_setbonus_bear.bnk" );
  11849. //} //should always be loaded as it's used by regular Quen now!
  11850. }
  11851.  
  11852. public function ManageSetBonusesSoundbanks( setType : EItemSetType )
  11853. {
  11854. //modSigns
  11855. if( GetSetPartsEquipped(setType) >= GetNumItemsRequiredForSetActivation(setType) )
  11856. {
  11857. switch( setType )
  11858. {
  11859. case EIST_Lynx:
  11860. LoadSetBonusSoundBank( "ep2_setbonus_lynx.bnk" );
  11861. break;
  11862. case EIST_Gryphon:
  11863. LoadSetBonusSoundBank( "ep2_setbonus_gryphon.bnk" );
  11864. break;
  11865. case EIST_Bear:
  11866. LoadSetBonusSoundBank( "ep2_setbonus_bear.bnk" );
  11867. break;
  11868. }
  11869. }
  11870. else
  11871. {
  11872. switch( setType )
  11873. {
  11874. case EIST_Lynx:
  11875. UnloadSetBonusSoundBank( "ep2_setbonus_lynx.bnk" );
  11876. break;
  11877. case EIST_Gryphon:
  11878. UnloadSetBonusSoundBank( "ep2_setbonus_gryphon.bnk" );
  11879. break;
  11880. case EIST_Bear:
  11881. UnloadSetBonusSoundBank( "ep2_setbonus_bear.bnk" );
  11882. break;
  11883. }
  11884. }
  11885. }
  11886.  
  11887. public function VampiricSetAbilityRegeneration()
  11888. {
  11889. var healthMax : float;
  11890. var healthToReg : float;
  11891. var healthPrc : float; //modSigns
  11892. var min, max : SAbilityAttributeValue; //modSigns
  11893.  
  11894. healthMax = GetStatMax( BCS_Vitality );
  11895.  
  11896. //modSigns: whoever decided that assuming no one will ever change xml values
  11897. //should be thrown to harpies
  11898. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'setBonusAbilityVampire', 'life_percent', min, max );
  11899. healthPrc = min.valueAdditive;
  11900.  
  11901. healthToReg = ( healthPrc * GetSetPartsEquipped(EIST_Vampire) * healthMax ) / 100;
  11902.  
  11903. //PlayEffect('drain_energy_caretaker_shovel');
  11904. GainStat( BCS_Vitality, healthToReg );
  11905. }
  11906.  
  11907. private function LoadSetBonusSoundBank( bankName : string )
  11908. {
  11909. if( !theSound.SoundIsBankLoaded( bankName ) )
  11910. {
  11911. theSound.SoundLoadBank( bankName, true );
  11912. }
  11913. }
  11914.  
  11915. private function UnloadSetBonusSoundBank( bankName : string )
  11916. {
  11917. if( theSound.SoundIsBankLoaded( bankName ) )
  11918. {
  11919. theSound.SoundUnloadBank( bankName );
  11920. }
  11921. }
  11922.  
  11923. timer function BearSetBonusQuenReapply( dt : float, id : int )
  11924. {
  11925. var newQuen : W3QuenEntity;
  11926.  
  11927. newQuen = (W3QuenEntity)theGame.CreateEntity( GetSignTemplate( ST_Quen ), GetWorldPosition(), GetWorldRotation() );
  11928. newQuen.Init( signOwner, GetSignEntity( ST_Quen ), true );
  11929. newQuen.freeCast = true; //modSigns
  11930. newQuen.OnStarted();
  11931. newQuen.OnThrowing();
  11932. newQuen.OnEnded();
  11933.  
  11934. m_quenReappliedCount += 1;
  11935.  
  11936. RemoveTimer( 'BearSetBonusQuenReapply');
  11937. }
  11938.  
  11939. //modSigns: gryphon set tier 1 bonus
  11940. public function GetGryphonSetTier1Bonus() : float
  11941. {
  11942. var abl : SAbilityAttributeValue;
  11943.  
  11944. abl = GetAttributeValue( 'gryphon_tier1_bonus' );
  11945. return abl.valueAdditive * GetSetPartsEquipped( EIST_Gryphon );
  11946. }
  11947.  
  11948. //modSigns: griffin school perk bonus
  11949. public function GetPerk6StaminaCostReduction() : float
  11950. {
  11951. var abl : SAbilityAttributeValue;
  11952. var bonus : float;
  11953.  
  11954. abl = GetAttributeValue('perk_6_stamina_cost_reduction');
  11955. bonus = abl.valueMultiplicative;
  11956. bonus = ClampF(bonus, 0, 1);
  11957.  
  11958. //theGame.witcherLog.AddMessage("stamina reduction bonus: " + bonus);
  11959.  
  11960. return bonus;
  11961. }
  11962.  
  11963. //modSigns
  11964. timer function GiveStandAloneEP1Items(dt : float, timerId : int)
  11965. {
  11966. var items : array<SItemUniqueId>;
  11967.  
  11968. if( inv )
  11969. {
  11970. inv.GetAllItems(items);
  11971. if( items.Size() <= 0 )
  11972. return;
  11973. }
  11974. else
  11975. return;
  11976.  
  11977. StandaloneEp1_1();
  11978.  
  11979. FactsAdd("standalone_ep1_inv", 1);
  11980.  
  11981. RemoveTimer('GiveStandAloneEP1Items');
  11982. }
  11983.  
  11984. //modSigns
  11985. timer function GiveStandAloneEP2Items(dt : float, timerId : int)
  11986. {
  11987. var items : array<SItemUniqueId>;
  11988.  
  11989. if( inv )
  11990. {
  11991. inv.GetAllItems(items);
  11992. if( items.Size() <= 0 )
  11993. return;
  11994. }
  11995. else
  11996. return;
  11997.  
  11998. StandaloneEp2_1();
  11999.  
  12000. FactsAdd("standalone_ep2_inv", 1);
  12001.  
  12002. RemoveTimer('GiveStandAloneEP2Items');
  12003. }
  12004.  
  12005. public final function StandaloneEp1_1()
  12006. {
  12007. var i, inc, quantityLow, randLow, quantityMedium, randMedium, quantityHigh, randHigh, startingMoney : int;
  12008. var pam : W3PlayerAbilityManager;
  12009. var ids : array<SItemUniqueId>;
  12010. var STARTING_LEVEL : int;
  12011.  
  12012. FactsAdd("StandAloneEP1", 1);
  12013.  
  12014.  
  12015. inv.RemoveAllItems();
  12016.  
  12017.  
  12018. inv.AddAnItem('Illusion Medallion', 1, true, true, false);
  12019. inv.AddAnItem('q103_safe_conduct', 1, true, true, false);
  12020.  
  12021.  
  12022. theGame.GetGamerProfile().ClearAllAchievementsForEP1();
  12023.  
  12024.  
  12025. STARTING_LEVEL = 32;
  12026. inc = STARTING_LEVEL - GetLevel();
  12027. for(i=0; i<inc; i+=1)
  12028. {
  12029. levelManager.AddPoints(EExperiencePoint, levelManager.GetTotalExpForNextLevel() - levelManager.GetPointsTotal(EExperiencePoint), false);
  12030. }
  12031.  
  12032.  
  12033. levelManager.ResetCharacterDev();
  12034. pam = (W3PlayerAbilityManager)abilityManager;
  12035. if(pam)
  12036. {
  12037. pam.ResetCharacterDev();
  12038. }
  12039. levelManager.SetFreeSkillPoints(levelManager.GetLevel() - 1 + 11);
  12040.  
  12041.  
  12042. //modSigns
  12043. inv.AddAnItem('Greater mutagen red', 1);
  12044. inv.AddAnItem('Greater mutagen green', 1);
  12045. inv.AddAnItem('Greater mutagen blue', 1);
  12046. inv.AddAnItem('Mutagen red', 2);
  12047. inv.AddAnItem('Mutagen green', 2);
  12048. inv.AddAnItem('Mutagen blue', 2);
  12049. inv.AddAnItem('Lesser mutagen red', 2);
  12050. inv.AddAnItem('Lesser mutagen green', 2);
  12051. inv.AddAnItem('Lesser mutagen blue', 2);
  12052.  
  12053.  
  12054. startingMoney = 4000;
  12055. if(GetMoney() > startingMoney)
  12056. {
  12057. RemoveMoney(GetMoney() - startingMoney);
  12058. }
  12059. else
  12060. {
  12061. AddMoney( 4000 - GetMoney() );
  12062. }
  12063.  
  12064.  
  12065.  
  12066.  
  12067.  
  12068. ids.Clear();
  12069. ids = inv.AddAnItem('EP1 Standalone Starting Armor');
  12070. EquipItem(ids[0]);
  12071. ids.Clear();
  12072. ids = inv.AddAnItem('EP1 Standalone Starting Boots');
  12073. EquipItem(ids[0]);
  12074. ids.Clear();
  12075. ids = inv.AddAnItem('EP1 Standalone Starting Gloves');
  12076. EquipItem(ids[0]);
  12077. ids.Clear();
  12078. ids = inv.AddAnItem('EP1 Standalone Starting Pants');
  12079. EquipItem(ids[0]);
  12080.  
  12081.  
  12082. ids.Clear();
  12083. ids = inv.AddAnItem('EP1 Standalone Starting Steel Sword');
  12084. EquipItem(ids[0]);
  12085. ids.Clear();
  12086. ids = inv.AddAnItem('EP1 Standalone Starting Silver Sword');
  12087. EquipItem(ids[0]);
  12088.  
  12089.  
  12090. inv.AddAnItem('Torch', 1, true, true, false);
  12091.  
  12092.  
  12093. //modSigns
  12094. quantityLow = 1;
  12095. randLow = 2;
  12096. quantityMedium = 2;
  12097. randMedium = 2;
  12098. quantityHigh = 3;
  12099. randHigh = 2;
  12100.  
  12101. inv.AddAnItem('Alghoul bone marrow',quantityMedium+RandRange(randMedium));
  12102. inv.AddAnItem('Amethyst dust',quantityLow+RandRange(randLow));
  12103. inv.AddAnItem('Arachas eyes',quantityLow+RandRange(randLow));
  12104. inv.AddAnItem('Arachas venom',quantityLow+RandRange(randLow));
  12105. inv.AddAnItem('Basilisk hide',quantityLow+RandRange(randLow));
  12106. inv.AddAnItem('Basilisk venom',quantityLow+RandRange(randLow));
  12107. inv.AddAnItem('Berserker pelt',quantityLow+RandRange(randLow));
  12108. inv.AddAnItem('Coal',quantityHigh+RandRange(randHigh));
  12109. inv.AddAnItem('Cotton',quantityHigh+RandRange(randHigh));
  12110. inv.AddAnItem('Dark iron ingot',quantityLow+RandRange(randLow));
  12111. inv.AddAnItem('Dark iron ore',quantityLow+RandRange(randLow));
  12112. inv.AddAnItem('Diamond dust',quantityLow+RandRange(randLow));
  12113. inv.AddAnItem('Draconide leather',quantityLow+RandRange(randLow));
  12114. inv.AddAnItem('Drowned dead tongue',quantityLow+RandRange(randLow));
  12115. inv.AddAnItem('Drowner brain',quantityMedium+RandRange(randMedium));
  12116. inv.AddAnItem('Dwimeryte ingot',quantityLow+RandRange(randLow));
  12117. inv.AddAnItem('Dwimeryte ore',quantityLow+RandRange(randLow));
  12118. inv.AddAnItem('Emerald dust',quantityLow+RandRange(randLow));
  12119. inv.AddAnItem('Endriag chitin plates',quantityMedium+RandRange(randMedium));
  12120. inv.AddAnItem('Endriag embryo',quantityLow+RandRange(randLow));
  12121. inv.AddAnItem('Ghoul blood',quantityMedium+RandRange(randMedium));
  12122. inv.AddAnItem('Hag teeth',quantityMedium+RandRange(randMedium));
  12123. inv.AddAnItem('Hardened leather',quantityMedium+RandRange(randMedium));
  12124. inv.AddAnItem('Hardened timber',quantityMedium+RandRange(randMedium));
  12125. inv.AddAnItem('Harpy feathers',quantityMedium+RandRange(randMedium));
  12126. inv.AddAnItem('Iron ore',quantityHigh+RandRange(randHigh));
  12127. inv.AddAnItem('Leather straps',quantityHigh+RandRange(randHigh));
  12128. inv.AddAnItem('Leather',quantityHigh+RandRange(randHigh));
  12129. inv.AddAnItem('Linen',quantityMedium+RandRange(randMedium));
  12130. inv.AddAnItem('Meteorite ingot',quantityLow+RandRange(randLow));
  12131. inv.AddAnItem('Meteorite ore',quantityMedium+RandRange(randMedium));
  12132. inv.AddAnItem('Necrophage skin',quantityLow+RandRange(randLow));
  12133. inv.AddAnItem('Nekker blood',quantityHigh+RandRange(randHigh));
  12134. inv.AddAnItem('Nekker heart',quantityMedium+RandRange(randMedium));
  12135. inv.AddAnItem('Oil',quantityHigh+RandRange(randHigh));
  12136. inv.AddAnItem('Phosphorescent crystal',quantityLow+RandRange(randLow));
  12137. inv.AddAnItem('Pure silver',quantityMedium+RandRange(randMedium));
  12138. inv.AddAnItem('Rotfiend blood',quantityMedium+RandRange(randMedium));
  12139. inv.AddAnItem('Sapphire dust',quantityLow+RandRange(randLow));
  12140. inv.AddAnItem('Silk',quantityHigh+RandRange(randHigh));
  12141. inv.AddAnItem('Silver ingot',quantityMedium+RandRange(randMedium));
  12142. inv.AddAnItem('Silver ore',quantityHigh+RandRange(randHigh));
  12143. inv.AddAnItem('Specter dust',quantityMedium+RandRange(randMedium));
  12144. inv.AddAnItem('Steel ingot',quantityHigh+RandRange(randHigh));
  12145. inv.AddAnItem('String',quantityHigh+RandRange(randHigh));
  12146. inv.AddAnItem('Thread',quantityHigh+RandRange(randHigh));
  12147. inv.AddAnItem('Timber',quantityHigh+RandRange(randHigh));
  12148. inv.AddAnItem('Twine',quantityMedium+RandRange(randMedium));
  12149. inv.AddAnItem('Venom extract',quantityMedium+RandRange(randMedium));
  12150. inv.AddAnItem('Water essence',quantityMedium+RandRange(randMedium));
  12151. inv.AddAnItem('Wolf liver',quantityHigh+RandRange(randHigh));
  12152. inv.AddAnItem('Alcohest', 3);
  12153. inv.AddAnItem('Dwarven spirit', 4);
  12154.  
  12155.  
  12156. ids.Clear();
  12157. ids = inv.AddAnItem('Crossbow 5');
  12158. EquipItem(ids[0]);
  12159. ids.Clear();
  12160. ids = inv.AddAnItem('Blunt Bolt', 20);
  12161. EquipItem(ids[0]);
  12162. inv.AddAnItem('Broadhead Bolt', 20);
  12163. inv.AddAnItem('Split Bolt', 20);
  12164.  
  12165.  
  12166. RemoveAllAlchemyRecipes();
  12167. RemoveAllCraftingSchematics();
  12168.  
  12169.  
  12170.  
  12171.  
  12172. AddAlchemyRecipe('Recipe for Cat 1');
  12173.  
  12174.  
  12175.  
  12176. AddAlchemyRecipe('Recipe for Maribor Forest 1');
  12177. AddAlchemyRecipe('Recipe for Petris Philtre 1');
  12178. AddAlchemyRecipe('Recipe for Swallow 1');
  12179. AddAlchemyRecipe('Recipe for Tawny Owl 1');
  12180.  
  12181. AddAlchemyRecipe('Recipe for White Gull 1');
  12182. AddAlchemyRecipe('Recipe for White Honey 1');
  12183. AddAlchemyRecipe('Recipe for White Raffards Decoction 1');
  12184.  
  12185.  
  12186.  
  12187. AddAlchemyRecipe('Recipe for Beast Oil 1');
  12188. AddAlchemyRecipe('Recipe for Cursed Oil 1');
  12189. AddAlchemyRecipe('Recipe for Hanged Man Venom 1');
  12190. AddAlchemyRecipe('Recipe for Hybrid Oil 1');
  12191. AddAlchemyRecipe('Recipe for Insectoid Oil 1');
  12192. AddAlchemyRecipe('Recipe for Magicals Oil 1');
  12193. AddAlchemyRecipe('Recipe for Necrophage Oil 1');
  12194. AddAlchemyRecipe('Recipe for Specter Oil 1');
  12195. AddAlchemyRecipe('Recipe for Vampire Oil 1');
  12196. AddAlchemyRecipe('Recipe for Draconide Oil 1');
  12197. AddAlchemyRecipe('Recipe for Ogre Oil 1');
  12198. AddAlchemyRecipe('Recipe for Relic Oil 1');
  12199. AddAlchemyRecipe('Recipe for Beast Oil 2');
  12200. AddAlchemyRecipe('Recipe for Cursed Oil 2');
  12201. AddAlchemyRecipe('Recipe for Hanged Man Venom 2');
  12202. AddAlchemyRecipe('Recipe for Hybrid Oil 2');
  12203. AddAlchemyRecipe('Recipe for Insectoid Oil 2');
  12204. AddAlchemyRecipe('Recipe for Magicals Oil 2');
  12205. AddAlchemyRecipe('Recipe for Necrophage Oil 2');
  12206. AddAlchemyRecipe('Recipe for Specter Oil 2');
  12207. AddAlchemyRecipe('Recipe for Vampire Oil 2');
  12208. AddAlchemyRecipe('Recipe for Draconide Oil 2');
  12209. AddAlchemyRecipe('Recipe for Ogre Oil 2');
  12210. AddAlchemyRecipe('Recipe for Relic Oil 2');
  12211.  
  12212.  
  12213. AddAlchemyRecipe('Recipe for Dancing Star 1');
  12214.  
  12215. AddAlchemyRecipe('Recipe for Dwimeritum Bomb 1');
  12216.  
  12217. AddAlchemyRecipe('Recipe for Grapeshot 1');
  12218. AddAlchemyRecipe('Recipe for Samum 1');
  12219.  
  12220. AddAlchemyRecipe('Recipe for White Frost 1');
  12221.  
  12222.  
  12223.  
  12224. AddAlchemyRecipe('Recipe for Dwarven spirit 1');
  12225. AddAlchemyRecipe('Recipe for Alcohest 1');
  12226. AddAlchemyRecipe('Recipe for White Gull 1');
  12227.  
  12228.  
  12229. AddStartingSchematics();
  12230.  
  12231.  
  12232. ids.Clear();
  12233. ids = inv.AddAnItem('Swallow 2');
  12234. EquipItem(ids[0]);
  12235. ids.Clear();
  12236. ids = inv.AddAnItem('Thunderbolt 2');
  12237. EquipItem(ids[0]);
  12238. ids.Clear();
  12239. ids = inv.AddAnItem('Tawny Owl 2');
  12240. EquipItem(ids[0]);
  12241. ids.Clear();
  12242.  
  12243. ids = inv.AddAnItem('Grapeshot 2');
  12244. EquipItem(ids[0]);
  12245. ids.Clear();
  12246. ids = inv.AddAnItem('Samum 2');
  12247. EquipItem(ids[0]);
  12248.  
  12249. inv.AddAnItem('Dwimeritum Bomb 1');
  12250. inv.AddAnItem('Dragons Dream 1');
  12251. inv.AddAnItem('Silver Dust Bomb 1');
  12252. inv.AddAnItem('White Frost 2');
  12253. inv.AddAnItem('Devils Puffball 2');
  12254. inv.AddAnItem('Dancing Star 2');
  12255. inv.AddAnItem('Beast Oil 1');
  12256. inv.AddAnItem('Cursed Oil 1');
  12257. inv.AddAnItem('Hanged Man Venom 2');
  12258. inv.AddAnItem('Hybrid Oil 1');
  12259. inv.AddAnItem('Insectoid Oil 1');
  12260. inv.AddAnItem('Magicals Oil 1');
  12261. inv.AddAnItem('Necrophage Oil 2');
  12262. inv.AddAnItem('Specter Oil 1');
  12263. inv.AddAnItem('Vampire Oil 1');
  12264. inv.AddAnItem('Draconide Oil 1');
  12265. inv.AddAnItem('Relic Oil 1');
  12266. inv.AddAnItem('Black Blood 1');
  12267. inv.AddAnItem('Blizzard 1');
  12268. inv.AddAnItem('Cat 2');
  12269. inv.AddAnItem('Full Moon 1');
  12270. inv.AddAnItem('Maribor Forest 1');
  12271. inv.AddAnItem('Petris Philtre 1');
  12272. inv.AddAnItem('White Gull 1', 2);
  12273. inv.AddAnItem('White Honey 2');
  12274. inv.AddAnItem('White Raffards Decoction 1');
  12275.  
  12276.  
  12277. inv.AddAnItem('Mutagen 17');
  12278. inv.AddAnItem('Mutagen 19');
  12279. inv.AddAnItem('Mutagen 27');
  12280. inv.AddAnItem('Mutagen 26');
  12281.  
  12282.  
  12283. inv.AddAnItem('weapon_repair_kit_1', 3);
  12284. inv.AddAnItem('weapon_repair_kit_2', 2);
  12285. inv.AddAnItem('armor_repair_kit_1', 3);
  12286. inv.AddAnItem('armor_repair_kit_2', 2);
  12287.  
  12288.  
  12289. quantityMedium = 1;
  12290. quantityLow = 1;
  12291. inv.AddAnItem('Rune stribog lesser', quantityMedium);
  12292. inv.AddAnItem('Rune stribog', quantityLow);
  12293. inv.AddAnItem('Rune dazhbog lesser', quantityMedium);
  12294. inv.AddAnItem('Rune dazhbog', quantityLow);
  12295. inv.AddAnItem('Rune devana lesser', quantityMedium);
  12296. inv.AddAnItem('Rune devana', quantityLow);
  12297. inv.AddAnItem('Rune zoria lesser', quantityMedium);
  12298. inv.AddAnItem('Rune zoria', quantityLow);
  12299. inv.AddAnItem('Rune morana lesser', quantityMedium);
  12300. inv.AddAnItem('Rune morana', quantityLow);
  12301. inv.AddAnItem('Rune triglav lesser', quantityMedium);
  12302. inv.AddAnItem('Rune triglav', quantityLow);
  12303. inv.AddAnItem('Rune svarog lesser', quantityMedium);
  12304. inv.AddAnItem('Rune svarog', quantityLow);
  12305. inv.AddAnItem('Rune veles lesser', quantityMedium);
  12306. inv.AddAnItem('Rune veles', quantityLow);
  12307. inv.AddAnItem('Rune perun lesser', quantityMedium);
  12308. inv.AddAnItem('Rune perun', quantityLow);
  12309. inv.AddAnItem('Rune elemental lesser', quantityMedium);
  12310. inv.AddAnItem('Rune elemental', quantityLow);
  12311.  
  12312. inv.AddAnItem('Glyph aard lesser', quantityMedium);
  12313. inv.AddAnItem('Glyph aard', quantityLow);
  12314. inv.AddAnItem('Glyph axii lesser', quantityMedium);
  12315. inv.AddAnItem('Glyph axii', quantityLow);
  12316. inv.AddAnItem('Glyph igni lesser', quantityMedium);
  12317. inv.AddAnItem('Glyph igni', quantityLow);
  12318. inv.AddAnItem('Glyph quen lesser', quantityMedium);
  12319. inv.AddAnItem('Glyph quen', quantityLow);
  12320. inv.AddAnItem('Glyph yrden lesser', quantityMedium);
  12321. inv.AddAnItem('Glyph yrden', quantityLow);
  12322.  
  12323.  
  12324. StandaloneEp1_2();
  12325. }
  12326.  
  12327. public final function StandaloneEp1_2()
  12328. {
  12329. var horseId : SItemUniqueId;
  12330. var ids : array<SItemUniqueId>;
  12331. var ents : array< CJournalBase >;
  12332. var i : int;
  12333. var manager : CWitcherJournalManager;
  12334.  
  12335.  
  12336. inv.AddAnItem( 'Cows milk', 5 );
  12337. ids.Clear();
  12338. ids = inv.AddAnItem( 'Dumpling', 5 );
  12339. EquipItem(ids[0]);
  12340.  
  12341.  
  12342. inv.AddAnItem('Clearing Potion', 2, true, false, false);
  12343.  
  12344.  
  12345. GetHorseManager().RemoveAllItems();
  12346.  
  12347. ids.Clear();
  12348. ids = inv.AddAnItem('Horse Bag 2');
  12349. horseId = GetHorseManager().MoveItemToHorse(ids[0]);
  12350. GetHorseManager().EquipItem(horseId);
  12351.  
  12352. ids.Clear();
  12353. ids = inv.AddAnItem('Horse Blinder 2');
  12354. horseId = GetHorseManager().MoveItemToHorse(ids[0]);
  12355. GetHorseManager().EquipItem(horseId);
  12356.  
  12357. ids.Clear();
  12358. ids = inv.AddAnItem('Horse Saddle 2');
  12359. horseId = GetHorseManager().MoveItemToHorse(ids[0]);
  12360. GetHorseManager().EquipItem(horseId);
  12361.  
  12362. manager = theGame.GetJournalManager();
  12363.  
  12364.  
  12365. manager.GetActivatedOfType( 'CJournalCreature', ents );
  12366. for(i=0; i<ents.Size(); i+=1)
  12367. {
  12368. manager.ActivateEntry(ents[i], JS_Inactive, false, true);
  12369. }
  12370.  
  12371.  
  12372. ents.Clear();
  12373. manager.GetActivatedOfType( 'CJournalCharacter', ents );
  12374. for(i=0; i<ents.Size(); i+=1)
  12375. {
  12376. manager.ActivateEntry(ents[i], JS_Inactive, false, true);
  12377. }
  12378.  
  12379.  
  12380. ents.Clear();
  12381. manager.GetActivatedOfType( 'CJournalQuest', ents );
  12382. for(i=0; i<ents.Size(); i+=1)
  12383. {
  12384.  
  12385. if( StrStartsWith(ents[i].baseName, "q60"))
  12386. continue;
  12387.  
  12388. manager.ActivateEntry(ents[i], JS_Inactive, false, true);
  12389. }
  12390.  
  12391.  
  12392. manager.ActivateEntryByScriptTag('TutorialAard', JS_Active);
  12393. manager.ActivateEntryByScriptTag('TutorialAdrenaline', JS_Active);
  12394. manager.ActivateEntryByScriptTag('TutorialAxii', JS_Active);
  12395. manager.ActivateEntryByScriptTag('TutorialAxiiDialog', JS_Active);
  12396. manager.ActivateEntryByScriptTag('TutorialCamera', JS_Active);
  12397. manager.ActivateEntryByScriptTag('TutorialCamera_pad', JS_Active);
  12398. manager.ActivateEntryByScriptTag('TutorialCiriBlink', JS_Active);
  12399. manager.ActivateEntryByScriptTag('TutorialCiriCharge', JS_Active);
  12400. manager.ActivateEntryByScriptTag('TutorialCiriStamina', JS_Active);
  12401. manager.ActivateEntryByScriptTag('TutorialCounter', JS_Active);
  12402. manager.ActivateEntryByScriptTag('TutorialDialogClose', JS_Active);
  12403. manager.ActivateEntryByScriptTag('TutorialFallingRoll', JS_Active);
  12404. manager.ActivateEntryByScriptTag('TutorialFocus', JS_Active);
  12405. manager.ActivateEntryByScriptTag('TutorialFocusClues', JS_Active);
  12406. manager.ActivateEntryByScriptTag('TutorialFocusClues', JS_Active);
  12407. manager.ActivateEntryByScriptTag('TutorialHorseRoad', JS_Active);
  12408. manager.ActivateEntryByScriptTag('TutorialHorseSpeed0', JS_Active);
  12409. manager.ActivateEntryByScriptTag('TutorialHorseSpeed0_pad', JS_Active);
  12410. manager.ActivateEntryByScriptTag('TutorialHorseSpeed1', JS_Active);
  12411. manager.ActivateEntryByScriptTag('TutorialHorseSpeed2', JS_Active);
  12412. manager.ActivateEntryByScriptTag('TutorialHorseSummon', JS_Active);
  12413. manager.ActivateEntryByScriptTag('TutorialHorseSummon_pad', JS_Active);
  12414. manager.ActivateEntryByScriptTag('TutorialIgni', JS_Active);
  12415. manager.ActivateEntryByScriptTag('TutorialJournalAlternateSings', JS_Active);
  12416. manager.ActivateEntryByScriptTag('TutorialJournalBoatDamage', JS_Active);
  12417. manager.ActivateEntryByScriptTag('TutorialJournalBoatMount', JS_Active);
  12418. manager.ActivateEntryByScriptTag('TutorialJournalBuffs', JS_Active);
  12419. manager.ActivateEntryByScriptTag('TutorialJournalCharDevLeveling', JS_Active);
  12420. manager.ActivateEntryByScriptTag('TutorialJournalCharDevSkills', JS_Active);
  12421. manager.ActivateEntryByScriptTag('TutorialJournalCrafting', JS_Active);
  12422. manager.ActivateEntryByScriptTag('TutorialJournalCrossbow', JS_Active);
  12423. manager.ActivateEntryByScriptTag('TutorialJournalDialogGwint', JS_Active);
  12424. manager.ActivateEntryByScriptTag('TutorialJournalDialogShop', JS_Active);
  12425. manager.ActivateEntryByScriptTag('TutorialJournalDive', JS_Active);
  12426. manager.ActivateEntryByScriptTag('TutorialJournalDodge', JS_Active);
  12427. manager.ActivateEntryByScriptTag('TutorialJournalDodge_pad', JS_Active);
  12428. manager.ActivateEntryByScriptTag('TutorialJournalDrawWeapon', JS_Active);
  12429. manager.ActivateEntryByScriptTag('TutorialJournalDrawWeapon_pad', JS_Active);
  12430. manager.ActivateEntryByScriptTag('TutorialJournalDurability', JS_Active);
  12431. manager.ActivateEntryByScriptTag('TutorialJournalExplorations', JS_Active);
  12432. manager.ActivateEntryByScriptTag('TutorialJournalExplorations_pad', JS_Active);
  12433. manager.ActivateEntryByScriptTag('TutorialJournalFastTravel', JS_Active);
  12434. manager.ActivateEntryByScriptTag('TutorialJournalFocusRedObjects', JS_Active);
  12435. manager.ActivateEntryByScriptTag('TutorialJournalGasClouds', JS_Active);
  12436. manager.ActivateEntryByScriptTag('TutorialJournalHeavyAttacks', JS_Active);
  12437. manager.ActivateEntryByScriptTag('TutorialJournalHorse', JS_Active);
  12438. manager.ActivateEntryByScriptTag('TutorialJournalHorseStamina', JS_Active);
  12439. manager.ActivateEntryByScriptTag('TutorialJournalJump', JS_Active);
  12440. manager.ActivateEntryByScriptTag('TutorialJournalLightAttacks', JS_Active);
  12441. manager.ActivateEntryByScriptTag('TutorialJournalLightAttacks_pad', JS_Active);
  12442. manager.ActivateEntryByScriptTag('TutorialJournalMeditation', JS_Active);
  12443. manager.ActivateEntryByScriptTag('TutorialJournalMeditation_pad', JS_Active);
  12444. manager.ActivateEntryByScriptTag('TutorialJournalMonsterThreatLevels', JS_Active);
  12445. manager.ActivateEntryByScriptTag('TutorialJournalMovement', JS_Active);
  12446. manager.ActivateEntryByScriptTag('TutorialJournalMovement_pad', JS_Active);
  12447. manager.ActivateEntryByScriptTag('TutorialJournalMutagenIngredient', JS_Active);
  12448. manager.ActivateEntryByScriptTag('TutorialJournalMutagenPotion', JS_Active);
  12449. manager.ActivateEntryByScriptTag('TutorialJournalOils', JS_Active);
  12450. manager.ActivateEntryByScriptTag('TutorialJournalPetards', JS_Active);
  12451. manager.ActivateEntryByScriptTag('TutorialJournalPotions', JS_Active);
  12452. manager.ActivateEntryByScriptTag('TutorialJournalPotions_pad', JS_Active);
  12453. manager.ActivateEntryByScriptTag('TutorialJournalQuestArea', JS_Active);
  12454. manager.ActivateEntryByScriptTag('TutorialJournalRadial', JS_Active);
  12455. manager.ActivateEntryByScriptTag('TutorialJournalRifts', JS_Active);
  12456. manager.ActivateEntryByScriptTag('TutorialJournalRun', JS_Active);
  12457. manager.ActivateEntryByScriptTag('TutorialJournalShopDescription', JS_Active);
  12458. manager.ActivateEntryByScriptTag('TutorialJournalSignCast', JS_Active);
  12459. manager.ActivateEntryByScriptTag('TutorialJournalSignCast_pad', JS_Active);
  12460. manager.ActivateEntryByScriptTag('TutorialJournalSpecialAttacks', JS_Active);
  12461. manager.ActivateEntryByScriptTag('TutorialJournalStaminaExploration', JS_Active);
  12462. manager.ActivateEntryByScriptTag('TutorialJumpHang', JS_Active);
  12463. manager.ActivateEntryByScriptTag('TutorialLadder', JS_Active);
  12464. manager.ActivateEntryByScriptTag('TutorialLadderMove', JS_Active);
  12465. manager.ActivateEntryByScriptTag('TutorialLadderMove_pad', JS_Active);
  12466. manager.ActivateEntryByScriptTag('TutorialObjectiveSwitching', JS_Active);
  12467. manager.ActivateEntryByScriptTag('TutorialOxygen', JS_Active);
  12468. manager.ActivateEntryByScriptTag('TutorialParry', JS_Active);
  12469. manager.ActivateEntryByScriptTag('TutorialPOIUncovered', JS_Active);
  12470. manager.ActivateEntryByScriptTag('TutorialQuen', JS_Active);
  12471. manager.ActivateEntryByScriptTag('TutorialRoll', JS_Active);
  12472. manager.ActivateEntryByScriptTag('TutorialRoll_pad', JS_Active);
  12473. manager.ActivateEntryByScriptTag('TutorialSpeedPairing', JS_Active);
  12474. manager.ActivateEntryByScriptTag('TutorialSprint', JS_Active);
  12475. manager.ActivateEntryByScriptTag('TutorialStaminaSigns', JS_Active);
  12476. manager.ActivateEntryByScriptTag('TutorialStealing', JS_Active);
  12477. manager.ActivateEntryByScriptTag('TutorialSwimmingSpeed', JS_Active);
  12478. manager.ActivateEntryByScriptTag('TutorialTimedChoiceDialog', JS_Active);
  12479. manager.ActivateEntryByScriptTag('TutorialYrden', JS_Active);
  12480.  
  12481.  
  12482. FactsAdd('kill_base_tutorials');
  12483.  
  12484.  
  12485. theGame.GetTutorialSystem().RemoveAllQueuedTutorials();
  12486.  
  12487. if( FactsQuerySum("standalone_ep1") < 1 ) //modSigns
  12488. FactsAdd("standalone_ep1");
  12489. FactsRemove("StandAloneEP1");
  12490.  
  12491. theGame.GetJournalManager().ForceUntrackingQuestForEP1Savegame();
  12492. }
  12493.  
  12494. final function Debug_FocusBoyFocusGain()
  12495. {
  12496. var focusGain : float;
  12497.  
  12498. focusGain = FactsQuerySum( "debug_fact_focus_boy" ) ;
  12499. GainStat( BCS_Focus, focusGain );
  12500. }
  12501.  
  12502. public final function StandaloneEp2_1()
  12503. {
  12504. var i, inc, quantityLow, randLow, quantityMedium, randMedium, quantityHigh, randHigh, startingMoney : int;
  12505. var pam : W3PlayerAbilityManager;
  12506. var ids : array<SItemUniqueId>;
  12507. var STARTING_LEVEL : int;
  12508.  
  12509. FactsAdd( "StandAloneEP2", 1 );
  12510.  
  12511.  
  12512. inv.RemoveAllItems();
  12513.  
  12514.  
  12515. inv.AddAnItem( 'Illusion Medallion', 1, true, true, false );
  12516. inv.AddAnItem( 'q103_safe_conduct', 1, true, true, false );
  12517.  
  12518.  
  12519. theGame.GetGamerProfile().ClearAllAchievementsForEP2();
  12520.  
  12521.  
  12522. levelManager.Hack_EP2StandaloneLevelShrink( 35 );
  12523.  
  12524.  
  12525. levelManager.ResetCharacterDev();
  12526. pam = ( W3PlayerAbilityManager )abilityManager;
  12527. if( pam )
  12528. {
  12529. pam.ResetCharacterDev();
  12530. }
  12531. levelManager.SetFreeSkillPoints( levelManager.GetLevel() - 1 + 11 );
  12532.  
  12533.  
  12534. //modSigns
  12535. inv.AddAnItem('Greater mutagen red', 1);
  12536. inv.AddAnItem('Greater mutagen green', 1);
  12537. inv.AddAnItem('Greater mutagen blue', 1);
  12538. inv.AddAnItem('Mutagen red', 2);
  12539. inv.AddAnItem('Mutagen green', 2);
  12540. inv.AddAnItem('Mutagen blue', 2);
  12541. inv.AddAnItem('Lesser mutagen red', 2);
  12542. inv.AddAnItem('Lesser mutagen green', 2);
  12543. inv.AddAnItem('Lesser mutagen blue', 2);
  12544.  
  12545.  
  12546. startingMoney = 5000;
  12547. if( GetMoney() > startingMoney )
  12548. {
  12549. RemoveMoney( GetMoney() - startingMoney );
  12550. }
  12551. else
  12552. {
  12553. AddMoney( 5000 - GetMoney() );
  12554. }
  12555.  
  12556.  
  12557. ids.Clear();
  12558. ids = inv.AddAnItem( 'EP2 Standalone Starting Armor' );
  12559. EquipItem( ids[0] );
  12560. ids.Clear();
  12561. ids = inv.AddAnItem( 'EP2 Standalone Starting Boots' );
  12562. EquipItem( ids[0] );
  12563. ids.Clear();
  12564. ids = inv.AddAnItem( 'EP2 Standalone Starting Gloves' );
  12565. EquipItem( ids[0] );
  12566. ids.Clear();
  12567. ids = inv.AddAnItem( 'EP2 Standalone Starting Pants' );
  12568. EquipItem( ids[0] );
  12569.  
  12570.  
  12571. ids.Clear();
  12572. ids = inv.AddAnItem( 'EP2 Standalone Starting Steel Sword' );
  12573. EquipItem( ids[0] );
  12574. ids.Clear();
  12575. ids = inv.AddAnItem( 'EP2 Standalone Starting Silver Sword' );
  12576. EquipItem( ids[0] );
  12577.  
  12578.  
  12579. inv.AddAnItem( 'Torch', 1, true, true, false );
  12580.  
  12581.  
  12582. //modSigns
  12583. quantityLow = 1;
  12584. randLow = 2;
  12585. quantityMedium = 2;
  12586. randMedium = 2;
  12587. quantityHigh = 3;
  12588. randHigh = 2;
  12589.  
  12590. inv.AddAnItem( 'Alghoul bone marrow',quantityMedium+RandRange( randMedium ) );
  12591. inv.AddAnItem( 'Amethyst dust',quantityLow+RandRange( randLow ) );
  12592. inv.AddAnItem( 'Arachas eyes',quantityLow+RandRange( randLow ) );
  12593. inv.AddAnItem( 'Arachas venom',quantityLow+RandRange( randLow ) );
  12594. inv.AddAnItem( 'Basilisk hide',quantityLow+RandRange( randLow ) );
  12595. inv.AddAnItem( 'Basilisk venom',quantityLow+RandRange( randLow ) );
  12596. inv.AddAnItem( 'Berserker pelt',quantityLow+RandRange( randLow ) );
  12597. inv.AddAnItem( 'Coal',quantityHigh+RandRange( randHigh ) );
  12598. inv.AddAnItem( 'Cotton',quantityHigh+RandRange( randHigh ) );
  12599. inv.AddAnItem( 'Diamond dust',quantityLow+RandRange( randLow ) );
  12600. inv.AddAnItem( 'Drowned dead tongue',quantityLow+RandRange( randLow ) );
  12601. inv.AddAnItem( 'Drowner brain',quantityMedium+RandRange( randMedium ) );
  12602. inv.AddAnItem( 'Endriag chitin plates',quantityMedium+RandRange( randMedium ) );
  12603. inv.AddAnItem( 'Endriag embryo',quantityLow+RandRange( randLow ) );
  12604. inv.AddAnItem( 'Ghoul blood',quantityMedium+RandRange( randMedium ) );
  12605. inv.AddAnItem( 'Hag teeth',quantityMedium+RandRange( randMedium ) );
  12606. inv.AddAnItem( 'Hardened leather',quantityMedium+RandRange( randMedium ) );
  12607. inv.AddAnItem( 'Hardened timber',quantityMedium+RandRange( randMedium ) );
  12608. inv.AddAnItem( 'Harpy feathers',quantityMedium+RandRange( randMedium ) );
  12609. inv.AddAnItem( 'Necrophage skin',quantityLow+RandRange( randLow ) );
  12610. inv.AddAnItem( 'Nekker blood',quantityHigh+RandRange( randHigh ) );
  12611. inv.AddAnItem( 'Nekker heart',quantityMedium+RandRange( randMedium ) );
  12612. inv.AddAnItem( 'Phosphorescent crystal',quantityLow+RandRange( randLow ) );
  12613. inv.AddAnItem( 'Rotfiend blood',quantityMedium+RandRange( randMedium ) );
  12614. inv.AddAnItem( 'Sapphire dust',quantityLow+RandRange( randLow ) );
  12615. inv.AddAnItem( 'Specter dust',quantityMedium+RandRange( randMedium ) );
  12616. inv.AddAnItem( 'Water essence',quantityMedium+RandRange( randMedium ) );
  12617. inv.AddAnItem( 'Wolf liver',quantityHigh+RandRange( randHigh ) );
  12618. inv.AddAnItem( 'Alcohest', 3 );
  12619. inv.AddAnItem( 'Dwarven spirit', 4 );
  12620.  
  12621.  
  12622. ids.Clear();
  12623. ids = inv.AddAnItem( 'Crossbow 5' );
  12624. EquipItem( ids[0] );
  12625. ids.Clear();
  12626. ids = inv.AddAnItem( 'Blunt Bolt', 20 );
  12627. EquipItem( ids[0] );
  12628. inv.AddAnItem( 'Broadhead Bolt', 20 );
  12629. inv.AddAnItem( 'Split Bolt', 20 );
  12630.  
  12631.  
  12632. RemoveAllAlchemyRecipes();
  12633. RemoveAllCraftingSchematics();
  12634.  
  12635.  
  12636.  
  12637.  
  12638.  
  12639.  
  12640.  
  12641.  
  12642.  
  12643. AddAlchemyRecipe( 'Recipe for Petris Philtre 2' );
  12644. AddAlchemyRecipe( 'Recipe for Swallow 1' );
  12645. AddAlchemyRecipe( 'Recipe for Tawny Owl 1' );
  12646.  
  12647. AddAlchemyRecipe( 'Recipe for White Gull 1' );
  12648.  
  12649.  
  12650.  
  12651.  
  12652.  
  12653. AddAlchemyRecipe( 'Recipe for Beast Oil 1' );
  12654. AddAlchemyRecipe( 'Recipe for Cursed Oil 1' );
  12655. AddAlchemyRecipe( 'Recipe for Hanged Man Venom 1' );
  12656. AddAlchemyRecipe( 'Recipe for Hybrid Oil 1' );
  12657. AddAlchemyRecipe( 'Recipe for Insectoid Oil 2' );
  12658. AddAlchemyRecipe( 'Recipe for Magicals Oil 1' );
  12659. AddAlchemyRecipe( 'Recipe for Necrophage Oil 1' );
  12660. AddAlchemyRecipe( 'Recipe for Specter Oil 1' );
  12661. AddAlchemyRecipe( 'Recipe for Vampire Oil 2' );
  12662. AddAlchemyRecipe( 'Recipe for Draconide Oil 2' );
  12663. AddAlchemyRecipe( 'Recipe for Ogre Oil 1' );
  12664. AddAlchemyRecipe( 'Recipe for Relic Oil 1' );
  12665. AddAlchemyRecipe( 'Recipe for Beast Oil 2' );
  12666. AddAlchemyRecipe( 'Recipe for Cursed Oil 2' );
  12667. AddAlchemyRecipe( 'Recipe for Hanged Man Venom 2' );
  12668. AddAlchemyRecipe( 'Recipe for Hybrid Oil 2' );
  12669. AddAlchemyRecipe( 'Recipe for Insectoid Oil 2' );
  12670. AddAlchemyRecipe( 'Recipe for Magicals Oil 2' );
  12671. AddAlchemyRecipe( 'Recipe for Necrophage Oil 2' );
  12672. AddAlchemyRecipe( 'Recipe for Specter Oil 2' );
  12673. AddAlchemyRecipe( 'Recipe for Vampire Oil 2' );
  12674. AddAlchemyRecipe( 'Recipe for Draconide Oil 2' );
  12675. AddAlchemyRecipe( 'Recipe for Ogre Oil 2' );
  12676. AddAlchemyRecipe( 'Recipe for Relic Oil 2' );
  12677.  
  12678.  
  12679. AddAlchemyRecipe( 'Recipe for Dancing Star 1' );
  12680.  
  12681. AddAlchemyRecipe( 'Recipe for Dwimeritum Bomb 1' );
  12682.  
  12683. AddAlchemyRecipe( 'Recipe for Grapeshot 1' );
  12684. AddAlchemyRecipe( 'Recipe for Samum 1' );
  12685.  
  12686. AddAlchemyRecipe( 'Recipe for White Frost 1' );
  12687.  
  12688.  
  12689.  
  12690. AddAlchemyRecipe( 'Recipe for Dwarven spirit 1' );
  12691. AddAlchemyRecipe( 'Recipe for Alcohest 1' );
  12692. AddAlchemyRecipe( 'Recipe for White Gull 1' );
  12693.  
  12694.  
  12695. AddStartingSchematics();
  12696.  
  12697.  
  12698. ids.Clear();
  12699. ids = inv.AddAnItem( 'Swallow 2' );
  12700. EquipItem( ids[0] );
  12701. ids.Clear();
  12702. ids = inv.AddAnItem( 'Thunderbolt 2' );
  12703. EquipItem( ids[0] );
  12704. ids.Clear();
  12705. ids = inv.AddAnItem( 'Tawny Owl 2' );
  12706. EquipItem( ids[0] );
  12707. ids.Clear();
  12708.  
  12709. ids = inv.AddAnItem( 'Grapeshot 2' );
  12710. EquipItem( ids[0] );
  12711. ids.Clear();
  12712. ids = inv.AddAnItem( 'Samum 2' );
  12713. EquipItem( ids[0] );
  12714.  
  12715. inv.AddAnItem( 'Dwimeritum Bomb 1' );
  12716. inv.AddAnItem( 'Dragons Dream 1' );
  12717. inv.AddAnItem( 'Silver Dust Bomb 1' );
  12718. inv.AddAnItem( 'White Frost 2' );
  12719. inv.AddAnItem( 'Devils Puffball 2' );
  12720. inv.AddAnItem( 'Dancing Star 2' );
  12721. inv.AddAnItem( 'Beast Oil 1' );
  12722. inv.AddAnItem( 'Cursed Oil 1' );
  12723. inv.AddAnItem( 'Hanged Man Venom 2' );
  12724. inv.AddAnItem( 'Hybrid Oil 2' );
  12725. inv.AddAnItem( 'Insectoid Oil 2' );
  12726. inv.AddAnItem( 'Magicals Oil 1' );
  12727. inv.AddAnItem( 'Necrophage Oil 2' );
  12728. inv.AddAnItem( 'Ogre Oil 1' );
  12729. inv.AddAnItem( 'Specter Oil 1' );
  12730. inv.AddAnItem( 'Vampire Oil 2' );
  12731. inv.AddAnItem( 'Draconide Oil 2' );
  12732. inv.AddAnItem( 'Relic Oil 1' );
  12733. inv.AddAnItem( 'Black Blood 1' );
  12734. inv.AddAnItem( 'Blizzard 1' );
  12735. inv.AddAnItem( 'Cat 2' );
  12736. inv.AddAnItem( 'Full Moon 1' );
  12737. inv.AddAnItem( 'Golden Oriole 1' );
  12738. inv.AddAnItem( 'Killer Whale 1' );
  12739. inv.AddAnItem( 'Maribor Forest 1' );
  12740. inv.AddAnItem( 'Petris Philtre 2' );
  12741. inv.AddAnItem( 'White Gull 1', 2 );
  12742. inv.AddAnItem( 'White Honey 2' );
  12743. inv.AddAnItem( 'White Raffards Decoction 1' );
  12744.  
  12745.  
  12746. inv.AddAnItem( 'Mutagen 17' );
  12747. inv.AddAnItem( 'Mutagen 19' );
  12748. inv.AddAnItem( 'Mutagen 27' );
  12749. inv.AddAnItem( 'Mutagen 26' );
  12750.  
  12751.  
  12752. inv.AddAnItem( 'weapon_repair_kit_1', 3 );
  12753. inv.AddAnItem( 'weapon_repair_kit_2', 2 );
  12754. inv.AddAnItem( 'armor_repair_kit_1', 3 );
  12755. inv.AddAnItem( 'armor_repair_kit_2', 2 );
  12756.  
  12757.  
  12758. quantityMedium = 1;
  12759. quantityLow = 1;
  12760. inv.AddAnItem( 'Rune stribog lesser', quantityMedium );
  12761. inv.AddAnItem( 'Rune stribog', quantityLow );
  12762. inv.AddAnItem( 'Rune dazhbog lesser', quantityMedium );
  12763. inv.AddAnItem( 'Rune dazhbog', quantityLow );
  12764. inv.AddAnItem( 'Rune devana lesser', quantityMedium );
  12765. inv.AddAnItem( 'Rune devana', quantityLow );
  12766. inv.AddAnItem( 'Rune zoria lesser', quantityMedium );
  12767. inv.AddAnItem( 'Rune zoria', quantityLow );
  12768. inv.AddAnItem( 'Rune morana lesser', quantityMedium );
  12769. inv.AddAnItem( 'Rune morana', quantityLow );
  12770. inv.AddAnItem( 'Rune triglav lesser', quantityMedium );
  12771. inv.AddAnItem( 'Rune triglav', quantityLow );
  12772. inv.AddAnItem( 'Rune svarog lesser', quantityMedium );
  12773. inv.AddAnItem( 'Rune svarog', quantityLow );
  12774. inv.AddAnItem( 'Rune veles lesser', quantityMedium );
  12775. inv.AddAnItem( 'Rune veles', quantityLow );
  12776. inv.AddAnItem( 'Rune perun lesser', quantityMedium );
  12777. inv.AddAnItem( 'Rune perun', quantityLow );
  12778. inv.AddAnItem( 'Rune elemental lesser', quantityMedium );
  12779. inv.AddAnItem( 'Rune elemental', quantityLow );
  12780.  
  12781. inv.AddAnItem( 'Glyph aard lesser', quantityMedium );
  12782. inv.AddAnItem( 'Glyph aard', quantityLow );
  12783. inv.AddAnItem( 'Glyph axii lesser', quantityMedium );
  12784. inv.AddAnItem( 'Glyph axii', quantityLow );
  12785. inv.AddAnItem( 'Glyph igni lesser', quantityMedium );
  12786. inv.AddAnItem( 'Glyph igni', quantityLow );
  12787. inv.AddAnItem( 'Glyph quen lesser', quantityMedium );
  12788. inv.AddAnItem( 'Glyph quen', quantityLow );
  12789. inv.AddAnItem( 'Glyph yrden lesser', quantityMedium );
  12790. inv.AddAnItem( 'Glyph yrden', quantityLow );
  12791.  
  12792.  
  12793. StandaloneEp2_2();
  12794. }
  12795.  
  12796. public final function StandaloneEp2_2()
  12797. {
  12798. var horseId : SItemUniqueId;
  12799. var ids : array<SItemUniqueId>;
  12800. var ents : array< CJournalBase >;
  12801. var i : int;
  12802. var manager : CWitcherJournalManager;
  12803.  
  12804.  
  12805. inv.AddAnItem( 'Cows milk', 5 );
  12806. ids.Clear();
  12807. ids = inv.AddAnItem( 'Dumpling', 5 );
  12808. EquipItem( ids[0] );
  12809.  
  12810.  
  12811. inv.AddAnItem( 'Clearing Potion', 2, true, false, false );
  12812.  
  12813.  
  12814. GetHorseManager().RemoveAllItems();
  12815.  
  12816. ids.Clear();
  12817. ids = inv.AddAnItem( 'Horse Bag 2' );
  12818. horseId = GetHorseManager( ).MoveItemToHorse( ids[0] );
  12819. GetHorseManager().EquipItem( horseId );
  12820.  
  12821. ids.Clear();
  12822. ids = inv.AddAnItem( 'Horse Blinder 2' );
  12823. horseId = GetHorseManager().MoveItemToHorse( ids[0] );
  12824. GetHorseManager().EquipItem( horseId );
  12825.  
  12826. ids.Clear();
  12827. ids = inv.AddAnItem( 'Horse Saddle 2' );
  12828. horseId = GetHorseManager().MoveItemToHorse( ids[0] );
  12829. GetHorseManager().EquipItem( horseId );
  12830.  
  12831. manager = theGame.GetJournalManager();
  12832.  
  12833.  
  12834. manager.GetActivatedOfType( 'CJournalCreature', ents );
  12835. for(i=0; i<ents.Size(); i+=1)
  12836. {
  12837. manager.ActivateEntry( ents[i], JS_Inactive, false, true );
  12838. }
  12839.  
  12840.  
  12841. ents.Clear();
  12842. manager.GetActivatedOfType( 'CJournalCharacter', ents );
  12843. for(i=0; i<ents.Size(); i+=1)
  12844. {
  12845. manager.ActivateEntry( ents[i], JS_Inactive, false, true );
  12846. }
  12847.  
  12848.  
  12849. ents.Clear();
  12850. manager.GetActivatedOfType( 'CJournalQuest', ents );
  12851. for(i=0; i<ents.Size(); i+=1)
  12852. {
  12853.  
  12854. if( StrStartsWith( ents[i].baseName, "q60" ) )
  12855. continue;
  12856.  
  12857. manager.ActivateEntry( ents[i], JS_Inactive, false, true );
  12858. }
  12859.  
  12860.  
  12861. manager.ActivateEntryByScriptTag( 'TutorialAard', JS_Active );
  12862. manager.ActivateEntryByScriptTag( 'TutorialAdrenaline', JS_Active );
  12863. manager.ActivateEntryByScriptTag( 'TutorialAxii', JS_Active );
  12864. manager.ActivateEntryByScriptTag( 'TutorialAxiiDialog', JS_Active );
  12865. manager.ActivateEntryByScriptTag( 'TutorialCamera', JS_Active );
  12866. manager.ActivateEntryByScriptTag( 'TutorialCamera_pad', JS_Active );
  12867. manager.ActivateEntryByScriptTag( 'TutorialCiriBlink', JS_Active );
  12868. manager.ActivateEntryByScriptTag( 'TutorialCiriCharge', JS_Active );
  12869. manager.ActivateEntryByScriptTag( 'TutorialCiriStamina', JS_Active );
  12870. manager.ActivateEntryByScriptTag( 'TutorialCounter', JS_Active );
  12871. manager.ActivateEntryByScriptTag( 'TutorialDialogClose', JS_Active );
  12872. manager.ActivateEntryByScriptTag( 'TutorialFallingRoll', JS_Active );
  12873. manager.ActivateEntryByScriptTag( 'TutorialFocus', JS_Active );
  12874. manager.ActivateEntryByScriptTag( 'TutorialFocusClues', JS_Active );
  12875. manager.ActivateEntryByScriptTag( 'TutorialFocusClues', JS_Active );
  12876. manager.ActivateEntryByScriptTag( 'TutorialHorseRoad', JS_Active );
  12877. manager.ActivateEntryByScriptTag( 'TutorialHorseSpeed0', JS_Active );
  12878. manager.ActivateEntryByScriptTag( 'TutorialHorseSpeed0_pad', JS_Active );
  12879. manager.ActivateEntryByScriptTag( 'TutorialHorseSpeed1', JS_Active );
  12880. manager.ActivateEntryByScriptTag( 'TutorialHorseSpeed2', JS_Active );
  12881. manager.ActivateEntryByScriptTag( 'TutorialHorseSummon', JS_Active );
  12882. manager.ActivateEntryByScriptTag( 'TutorialHorseSummon_pad', JS_Active );
  12883. manager.ActivateEntryByScriptTag( 'TutorialIgni', JS_Active );
  12884. manager.ActivateEntryByScriptTag( 'TutorialJournalAlternateSings', JS_Active );
  12885. manager.ActivateEntryByScriptTag( 'TutorialJournalBoatDamage', JS_Active );
  12886. manager.ActivateEntryByScriptTag( 'TutorialJournalBoatMount', JS_Active );
  12887. manager.ActivateEntryByScriptTag( 'TutorialJournalBuffs', JS_Active );
  12888. manager.ActivateEntryByScriptTag( 'TutorialJournalCharDevLeveling', JS_Active );
  12889. manager.ActivateEntryByScriptTag( 'TutorialJournalCharDevSkills', JS_Active );
  12890. manager.ActivateEntryByScriptTag( 'TutorialJournalCrafting', JS_Active );
  12891. manager.ActivateEntryByScriptTag( 'TutorialJournalCrossbow', JS_Active );
  12892. manager.ActivateEntryByScriptTag( 'TutorialJournalDialogGwint', JS_Active );
  12893. manager.ActivateEntryByScriptTag( 'TutorialJournalDialogShop', JS_Active );
  12894. manager.ActivateEntryByScriptTag( 'TutorialJournalDive', JS_Active );
  12895. manager.ActivateEntryByScriptTag( 'TutorialJournalDodge', JS_Active );
  12896. manager.ActivateEntryByScriptTag( 'TutorialJournalDodge_pad', JS_Active );
  12897. manager.ActivateEntryByScriptTag( 'TutorialJournalDrawWeapon', JS_Active );
  12898. manager.ActivateEntryByScriptTag( 'TutorialJournalDrawWeapon_pad', JS_Active );
  12899. manager.ActivateEntryByScriptTag( 'TutorialJournalDurability', JS_Active );
  12900. manager.ActivateEntryByScriptTag( 'TutorialJournalExplorations', JS_Active );
  12901. manager.ActivateEntryByScriptTag( 'TutorialJournalExplorations_pad', JS_Active );
  12902. manager.ActivateEntryByScriptTag( 'TutorialJournalFastTravel', JS_Active );
  12903. manager.ActivateEntryByScriptTag( 'TutorialJournalFocusRedObjects', JS_Active );
  12904. manager.ActivateEntryByScriptTag( 'TutorialJournalGasClouds', JS_Active );
  12905. manager.ActivateEntryByScriptTag( 'TutorialJournalHeavyAttacks', JS_Active );
  12906. manager.ActivateEntryByScriptTag( 'TutorialJournalHorse', JS_Active );
  12907. manager.ActivateEntryByScriptTag( 'TutorialJournalHorseStamina', JS_Active );
  12908. manager.ActivateEntryByScriptTag( 'TutorialJournalJump', JS_Active );
  12909. manager.ActivateEntryByScriptTag( 'TutorialJournalLightAttacks', JS_Active );
  12910. manager.ActivateEntryByScriptTag( 'TutorialJournalLightAttacks_pad', JS_Active );
  12911. manager.ActivateEntryByScriptTag( 'TutorialJournalMeditation', JS_Active );
  12912. manager.ActivateEntryByScriptTag( 'TutorialJournalMeditation_pad', JS_Active );
  12913. manager.ActivateEntryByScriptTag( 'TutorialJournalMonsterThreatLevels', JS_Active );
  12914. manager.ActivateEntryByScriptTag( 'TutorialJournalMovement', JS_Active );
  12915. manager.ActivateEntryByScriptTag( 'TutorialJournalMovement_pad', JS_Active );
  12916. manager.ActivateEntryByScriptTag( 'TutorialJournalMutagenIngredient', JS_Active );
  12917. manager.ActivateEntryByScriptTag( 'TutorialJournalMutagenPotion', JS_Active );
  12918. manager.ActivateEntryByScriptTag( 'TutorialJournalOils', JS_Active );
  12919. manager.ActivateEntryByScriptTag( 'TutorialJournalPetards', JS_Active );
  12920. manager.ActivateEntryByScriptTag( 'TutorialJournalPotions', JS_Active );
  12921. manager.ActivateEntryByScriptTag( 'TutorialJournalPotions_pad', JS_Active );
  12922. manager.ActivateEntryByScriptTag( 'TutorialJournalQuestArea', JS_Active );
  12923. manager.ActivateEntryByScriptTag( 'TutorialJournalRadial', JS_Active );
  12924. manager.ActivateEntryByScriptTag( 'TutorialJournalRifts', JS_Active );
  12925. manager.ActivateEntryByScriptTag( 'TutorialJournalRun', JS_Active );
  12926. manager.ActivateEntryByScriptTag( 'TutorialJournalShopDescription', JS_Active );
  12927. manager.ActivateEntryByScriptTag( 'TutorialJournalSignCast', JS_Active );
  12928. manager.ActivateEntryByScriptTag( 'TutorialJournalSignCast_pad', JS_Active );
  12929. manager.ActivateEntryByScriptTag( 'TutorialJournalSpecialAttacks', JS_Active );
  12930. manager.ActivateEntryByScriptTag( 'TutorialJournalStaminaExploration', JS_Active );
  12931. manager.ActivateEntryByScriptTag( 'TutorialJumpHang', JS_Active );
  12932. manager.ActivateEntryByScriptTag( 'TutorialLadder', JS_Active );
  12933. manager.ActivateEntryByScriptTag( 'TutorialLadderMove', JS_Active );
  12934. manager.ActivateEntryByScriptTag( 'TutorialLadderMove_pad', JS_Active );
  12935. manager.ActivateEntryByScriptTag( 'TutorialObjectiveSwitching', JS_Active );
  12936. manager.ActivateEntryByScriptTag( 'TutorialOxygen', JS_Active );
  12937. manager.ActivateEntryByScriptTag( 'TutorialParry', JS_Active );
  12938. manager.ActivateEntryByScriptTag( 'TutorialPOIUncovered', JS_Active );
  12939. manager.ActivateEntryByScriptTag( 'TutorialQuen', JS_Active );
  12940. manager.ActivateEntryByScriptTag( 'TutorialRoll', JS_Active );
  12941. manager.ActivateEntryByScriptTag( 'TutorialRoll_pad', JS_Active );
  12942. manager.ActivateEntryByScriptTag( 'TutorialSpeedPairing', JS_Active );
  12943. manager.ActivateEntryByScriptTag( 'TutorialSprint', JS_Active );
  12944. manager.ActivateEntryByScriptTag( 'TutorialStaminaSigns', JS_Active );
  12945. manager.ActivateEntryByScriptTag( 'TutorialStealing', JS_Active );
  12946. manager.ActivateEntryByScriptTag( 'TutorialSwimmingSpeed', JS_Active );
  12947. manager.ActivateEntryByScriptTag( 'TutorialTimedChoiceDialog', JS_Active );
  12948. manager.ActivateEntryByScriptTag( 'TutorialYrden', JS_Active );
  12949.  
  12950. //modSigns
  12951. inv.AddAnItem( 'Geralt Shirt', 1 );
  12952. inv.AddAnItem( 'Thread', 3 );
  12953. inv.AddAnItem( 'String', 3 );
  12954. inv.AddAnItem( 'Linen', 2 );
  12955. inv.AddAnItem( 'Silk', 1 );
  12956. inv.AddAnItem( 'Nigredo', 1 );
  12957. inv.AddAnItem( 'Albedo', 1 );
  12958. inv.AddAnItem( 'Rubedo', 1 );
  12959. inv.AddAnItem( 'Rebis', 1 );
  12960. inv.AddAnItem( 'Dog tallow', 3 );
  12961. inv.AddAnItem( 'Lunar shards', 1 );
  12962. inv.AddAnItem( 'Quicksilver solution', 1 );
  12963. inv.AddAnItem( 'Aether', 1 );
  12964. inv.AddAnItem( 'Optima mater', 1 );
  12965. inv.AddAnItem( 'Fifth essence', 1 );
  12966. inv.AddAnItem( 'Hardened timber', 2 );
  12967. inv.AddAnItem( 'Fur square', 1 );
  12968. inv.AddAnItem( 'Leather straps', 4 );
  12969. inv.AddAnItem( 'Leather squares', 1 );
  12970. inv.AddAnItem( 'Leather', 2 );
  12971. inv.AddAnItem( 'Hardened leather', 2 );
  12972. inv.AddAnItem( 'Chitin scale', 2 );
  12973. inv.AddAnItem( 'Draconide leather', 1 );
  12974. inv.AddAnItem( 'Infused draconide leather', 0 );
  12975. inv.AddAnItem( 'Steel ingot', 2 );
  12976. inv.AddAnItem( 'Dark iron ore', 2 );
  12977. inv.AddAnItem( 'Dark iron ingot', 1 );
  12978. inv.AddAnItem( 'Dark steel ingot', 1 );
  12979. inv.AddAnItem( 'Silver ore', 2 );
  12980. inv.AddAnItem( 'Silver ingot', 2 );
  12981. inv.AddAnItem( 'Meteorite ore', 2 );
  12982. inv.AddAnItem( 'Meteorite ingot', 1 );
  12983. inv.AddAnItem( 'Meteorite silver ingot', 1 );
  12984. inv.AddAnItem( 'Dwimeryte ingot', 2 );
  12985. inv.AddAnItem( 'Emerald dust', 2 );
  12986. inv.AddAnItem( 'Ruby dust', 2 );
  12987. inv.AddAnItem( 'Ruby', 1 );
  12988. inv.AddAnItem( 'Sapphire dust', 2 );
  12989. inv.AddAnItem( 'Sapphire', 1 );
  12990. inv.AddAnItem( 'Monstrous brain', 4 );
  12991. inv.AddAnItem( 'Monstrous blood', 3 );
  12992. inv.AddAnItem( 'Monstrous bone', 4 );
  12993. inv.AddAnItem( 'Monstrous claw', 3 );
  12994. inv.AddAnItem( 'Monstrous dust', 3 );
  12995. inv.AddAnItem( 'Monstrous ear', 4 );
  12996. inv.AddAnItem( 'Monstrous egg', 2 );
  12997. inv.AddAnItem( 'Monstrous eye', 2 );
  12998. inv.AddAnItem( 'Monstrous essence', 3 );
  12999. inv.AddAnItem( 'Monstrous feather', 4 );
  13000. inv.AddAnItem( 'Monstrous hair', 3 );
  13001. inv.AddAnItem( 'Monstrous heart', 2 );
  13002. inv.AddAnItem( 'Monstrous hide', 3 );
  13003. inv.AddAnItem( 'Monstrous liver', 2 );
  13004. inv.AddAnItem( 'Monstrous plate', 1 );
  13005. inv.AddAnItem( 'Monstrous saliva', 4 );
  13006. inv.AddAnItem( 'Monstrous stomach', 2 );
  13007. inv.AddAnItem( 'Monstrous tongue', 2 );
  13008. inv.AddAnItem( 'Monstrous tooth', 3 );
  13009. inv.AddAnItem( 'Venom extract', 1 );
  13010. inv.AddAnItem( 'Siren vocal cords', 1 );
  13011.  
  13012.  
  13013. SelectQuickslotItem( EES_RangedWeapon );
  13014.  
  13015.  
  13016. FactsAdd( 'kill_base_tutorials' );
  13017.  
  13018.  
  13019. theGame.GetTutorialSystem().RemoveAllQueuedTutorials();
  13020.  
  13021.  
  13022. if( FactsQuerySum("standalone_ep2") < 1 ) //modSigns
  13023. FactsAdd("standalone_ep2");
  13024. FactsRemove( "StandAloneEP2" );
  13025.  
  13026. theGame.GetJournalManager().ForceUntrackingQuestForEP1Savegame();
  13027. }
  13028. }
  13029.  
  13030. exec function fuqfep1()
  13031. {
  13032. theGame.GetJournalManager().ForceUntrackingQuestForEP1Savegame();
  13033. }
  13034.  
  13035.  
  13036.  
  13037.  
  13038.  
  13039. function GetWitcherPlayer() : W3PlayerWitcher
  13040. {
  13041. return (W3PlayerWitcher)thePlayer;
  13042. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement