Advertisement
Guest User

playerWitcher

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