Guest User

PlayerWitcher.ws

a guest
Jan 23rd, 2021
351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 414.36 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; //modSigns
  46. //private saved var cannotUseUndyingSkill : bool; //modSigns
  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.  
  96.  
  97. default explorationInputContext = 'Exploration';
  98. default combatInputContext = 'Combat';
  99. default combatFistsInputContext = 'Combat';
  100.  
  101.  
  102. private saved var companionNPCTag : name;
  103. private saved var companionNPCTag2 : name;
  104.  
  105. private saved var companionNPCIconPath : string;
  106. private saved var companionNPCIconPath2 : string;
  107.  
  108.  
  109. private saved var itemSlots : array<SItemUniqueId>;
  110. private var remainingBombThrowDelaySlot1 : float;
  111. private var remainingBombThrowDelaySlot2 : float;
  112. private var previouslyUsedBolt : SItemUniqueId;
  113. private saved var questMarkedSelectedQuickslotItems : array< SSelectedQuickslotItem >;
  114.  
  115. default isThrowingItem = false;
  116. default remainingBombThrowDelaySlot1 = 0.f;
  117. default remainingBombThrowDelaySlot2 = 0.f;
  118.  
  119.  
  120.  
  121.  
  122.  
  123. private saved var tempLearnedSignSkills : array<SSimpleSkill>;
  124. public saved var autoLevel : bool;
  125.  
  126.  
  127.  
  128.  
  129. protected saved var skillBonusPotionEffect : CBaseGameplayEffect;
  130.  
  131.  
  132. public saved var levelManager : W3LevelManager;
  133.  
  134. //---=== modFriendlyHUD ===---
  135. public var prepDisallowOilsInCombat : bool; default prepDisallowOilsInCombat = false;
  136. public var prepOilsHaveAmmo : bool; default prepOilsHaveAmmo = false;
  137. //---=== modFriendlyHUD ===---
  138.  
  139.  
  140. saved var reputationManager : W3Reputation;
  141.  
  142.  
  143. private editable var medallionEntity : CEntityTemplate;
  144. private var medallionController : W3MedallionController;
  145.  
  146.  
  147.  
  148.  
  149. public var bShowRadialMenu : bool;
  150.  
  151. private var _HoldBeforeOpenRadialMenuTime : float;
  152.  
  153. default _HoldBeforeOpenRadialMenuTime = 0.5f;
  154.  
  155. public var MappinToHighlight : array<SHighlightMappin>;
  156.  
  157.  
  158. protected saved var horseManagerHandle : EntityHandle;
  159.  
  160.  
  161. private var isInitialized : bool;
  162. private var timeForPerk21 : float;
  163.  
  164. default isInitialized = false;
  165.  
  166.  
  167. private var invUpdateTransaction : bool;
  168. default invUpdateTransaction = false;
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181. event OnSpawned( spawnData : SEntitySpawnData )
  182. {
  183. var i : int;
  184. var items : array<SItemUniqueId>;
  185. var items2 : array<SItemUniqueId>;
  186. var horseTemplate : CEntityTemplate;
  187. var horseManager : W3HorseManager;
  188.  
  189. AddAnimEventCallback( 'ActionBlend', 'OnAnimEvent_ActionBlend' );
  190. AddAnimEventCallback('cast_begin', 'OnAnimEvent_Sign');
  191. AddAnimEventCallback('cast_throw', 'OnAnimEvent_Sign');
  192. AddAnimEventCallback('cast_end', 'OnAnimEvent_Sign');
  193. AddAnimEventCallback('cast_friendly_begin', 'OnAnimEvent_Sign');
  194. AddAnimEventCallback('cast_friendly_throw', 'OnAnimEvent_Sign');
  195. AddAnimEventCallback('axii_ready', 'OnAnimEvent_Sign');
  196. AddAnimEventCallback('axii_alternate_ready', 'OnAnimEvent_Sign');
  197. AddAnimEventCallback('yrden_draw_ready', 'OnAnimEvent_Sign');
  198.  
  199. AddAnimEventCallback( 'ProjectileThrow', 'OnAnimEvent_Throwable' );
  200. AddAnimEventCallback( 'OnWeaponReload', 'OnAnimEvent_Throwable' );
  201. AddAnimEventCallback( 'ProjectileAttach', 'OnAnimEvent_Throwable' );
  202. AddAnimEventCallback( 'Mutation11AnimEnd', 'OnAnimEvent_Mutation11AnimEnd' );
  203. AddAnimEventCallback( 'Mutation11ShockWave', 'OnAnimEvent_Mutation11ShockWave' );
  204.  
  205. // Combat Anims - Begin
  206. AddAnimEventCallback( 'GeraltFastAttackAnimStart', 'OnAnimEvent_GeraltFastAttackAnimStart' );
  207. AddAnimEventCallback( 'GeraltStrongAttackAnimStart', 'OnAnimEvent_GeraltStrongAttackAnimStart' );
  208. AddAnimEventCallback( 'GeraltFastAttackFarAnimStart', 'OnAnimEvent_GeraltFastAttackFarAnimStart' );
  209. AddAnimEventCallback( 'GeraltStrongAttackFarAnimStart', 'OnAnimEvent_GeraltStrongAttackFarAnimStart' );
  210. AddAnimEventCallback( 'SecondaryAttackAnimStart', 'OnAnimEvent_SecondaryAttackAnimStart' );
  211. // Combat Anims - End
  212.  
  213.  
  214. amountOfSetPiecesEquipped.Resize( EnumGetMax( 'EItemSetType' ) + 1 );
  215.  
  216. runewordInfusionType = ST_None;
  217.  
  218.  
  219. inv = GetInventory();
  220.  
  221.  
  222. signOwner = new W3SignOwnerPlayer in this;
  223. signOwner.Init( this );
  224.  
  225. itemSlots.Resize( EnumGetMax('EEquipmentSlots')+1 );
  226.  
  227. //modSigns
  228. if( FactsQuerySum("ModSignsRecipesAdded") < 1 )
  229. {
  230. AddAlchemyRecipe('Recipe for Tawny Owl 1', true, true); // fix missing Tawny Owl recipe
  231. AddCraftingSchematic('Meteorite plate schematic', true, true); //add missing meteorite plate schematic
  232. FactsAdd("ModSignsRecipesAdded");
  233. }
  234.  
  235. FactsRemove("player_had_quen"); //remove, no need for this and never was
  236.  
  237. //modSigns
  238. if( FactsQuerySum("ModSignsKMSetSchematicsAdded") < 1 )
  239. {
  240. AddCraftingSchematic('Kaer Morhen Armor 1 schematic',true, true);
  241. AddCraftingSchematic('Kaer Morhen Armor 2 schematic',true, true);
  242. AddCraftingSchematic('Kaer Morhen Armor 3 schematic',true, true);
  243. AddCraftingSchematic('Kaer Morhen Pants schematic',true, true);
  244. AddCraftingSchematic('Kaer Morhen Pants 1 schematic',true, true);
  245. AddCraftingSchematic('Kaer Morhen Pants 2 schematic',true, true);
  246. AddCraftingSchematic('Kaer Morhen Pants 3 schematic',true, true);
  247. AddCraftingSchematic('Kaer Morhen Boots schematic',true, true);
  248. AddCraftingSchematic('Kaer Morhen Boots 1 schematic',true, true);
  249. AddCraftingSchematic('Kaer Morhen Boots 2 schematic',true, true);
  250. AddCraftingSchematic('Kaer Morhen Boots 3 schematic',true, true);
  251. AddCraftingSchematic('Kaer Morhen Gloves schematic',true, true);
  252. AddCraftingSchematic('Kaer Morhen Gloves 1 schematic',true, true);
  253. AddCraftingSchematic('Kaer Morhen Gloves 2 schematic',true, true);
  254. AddCraftingSchematic('Kaer Morhen Gloves 3 schematic',true, true);
  255. FactsAdd("ModSignsKMSetSchematicsAdded");
  256. }
  257.  
  258. if(!spawnData.restored)
  259. {
  260. levelManager = new W3LevelManager in this;
  261. levelManager.Initialize();
  262.  
  263.  
  264. inv.GetAllItems(items);
  265. for(i=0; i<items.Size(); i+=1)
  266. {
  267. if(inv.IsItemMounted(items[i]) && ( !inv.IsItemBody(items[i]) || inv.GetItemCategory(items[i]) == 'hair' ) )
  268. EquipItem(items[i]);
  269. }
  270.  
  271.  
  272.  
  273.  
  274.  
  275. AddAlchemyRecipe('Recipe for Swallow 1',true,true);
  276. AddAlchemyRecipe('Recipe for Cat 1',true,true);
  277. AddAlchemyRecipe('Recipe for White Honey 1',true,true);
  278.  
  279. AddAlchemyRecipe('Recipe for Samum 1',true,true);
  280. AddAlchemyRecipe('Recipe for Grapeshot 1',true,true);
  281.  
  282. AddAlchemyRecipe('Recipe for Specter Oil 1',true,true);
  283. AddAlchemyRecipe('Recipe for Necrophage Oil 1',true,true);
  284. AddAlchemyRecipe('Recipe for Alcohest 1',true,true);
  285. }
  286. else
  287. {
  288. AddTimer('DelayedOnItemMount', 0.1, true);
  289.  
  290.  
  291. CheckHairItem();
  292. }
  293.  
  294.  
  295. AddStartingSchematics();
  296.  
  297. super.OnSpawned( spawnData );
  298.  
  299.  
  300. AddAlchemyRecipe('Recipe for Mutagen red',true,true);
  301. AddAlchemyRecipe('Recipe for Mutagen green',true,true);
  302. AddAlchemyRecipe('Recipe for Mutagen blue',true,true);
  303. AddAlchemyRecipe('Recipe for Greater mutagen red',true,true);
  304. AddAlchemyRecipe('Recipe for Greater mutagen green',true,true);
  305. AddAlchemyRecipe('Recipe for Greater mutagen blue',true,true);
  306.  
  307. AddCraftingSchematic('Starting Armor Upgrade schematic 1',true,true);
  308.  
  309.  
  310. if( inputHandler )
  311. {
  312. inputHandler.BlockAllActions( 'being_ciri', false );
  313. }
  314. SetBehaviorVariable( 'test_ciri_replacer', 0.0f);
  315.  
  316. if(!spawnData.restored)
  317. {
  318.  
  319. abilityManager.GainStat(BCS_Toxicity, 0);
  320. }
  321.  
  322. levelManager.PostInit(this, spawnData.restored, true);
  323.  
  324. SetBIsCombatActionAllowed( true );
  325. SetBIsInputAllowed( true, 'OnSpawned' );
  326.  
  327.  
  328. if ( !reputationManager )
  329. {
  330. reputationManager = new W3Reputation in this;
  331. reputationManager.Initialize();
  332. }
  333.  
  334. theSound.SoundParameter( "focus_aim", 1.0f, 1.0f );
  335. theSound.SoundParameter( "focus_distance", 0.0f, 1.0f );
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342. currentlyCastSign = ST_None;
  343.  
  344.  
  345. if(!spawnData.restored)
  346. {
  347. horseTemplate = (CEntityTemplate)LoadResource("horse_manager");
  348. horseManager = (W3HorseManager)theGame.CreateEntity(horseTemplate, GetWorldPosition(),,,,,PM_Persist);
  349. horseManager.CreateAttachment(this);
  350. horseManager.OnCreated();
  351. EntityHandleSet( horseManagerHandle, horseManager );
  352. }
  353. else
  354. {
  355. AddTimer('DelayedHorseUpdate', 0.01, true);
  356. }
  357.  
  358. //---=== modFriendlyMeditation ===---
  359. fMeditationConfig = new CModFMeditationConfig in this;
  360. fMeditationConfig.Init();
  361. //---=== modFriendlyMeditation ===---
  362.  
  363.  
  364. RemoveAbility('Ciri_CombatRegen');
  365. RemoveAbility('Ciri_Rage');
  366. RemoveAbility('CiriBlink');
  367. RemoveAbility('CiriCharge');
  368. RemoveAbility('Ciri_Q205');
  369. RemoveAbility('Ciri_Q305');
  370. RemoveAbility('Ciri_Q403');
  371. RemoveAbility('Ciri_Q111');
  372. RemoveAbility('Ciri_Q501');
  373. RemoveAbility('SkillCiri');
  374.  
  375. //modSigns: remove passive bonuses
  376. RemoveAbilityAll('sword_adrenalinegain');
  377. RemoveAbilityAll('magic_staminaregen');
  378. RemoveAbilityAll('alchemy_potionduration');
  379. //++modAHW
  380. AHW = new CAHW in this;
  381. AddTimer('AHWInit', 1.0, false);
  382. //--modAHW
  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. FactsAdd( "new_game_started_with_GM_40" ); //modSigns
  406. }
  407.  
  408. if ( spawnData.restored )
  409. {
  410. FixEquippedMutagens();
  411. }
  412.  
  413. if ( FactsQuerySum("NewGamePlus") > 0 )
  414. {
  415. NewGamePlusAdjustDLC1TemerianSet(inv);
  416. NewGamePlusAdjustDLC5NilfgardianSet(inv);
  417. NewGamePlusAdjustDLC10WolfSet(inv);
  418. NewGamePlusAdjustDLC14SkelligeSet(inv);
  419. if(horseManager)
  420. {
  421. NewGamePlusAdjustDLC1TemerianSet(horseManager.GetInventoryComponent());
  422. NewGamePlusAdjustDLC5NilfgardianSet(horseManager.GetInventoryComponent());
  423. NewGamePlusAdjustDLC10WolfSet(horseManager.GetInventoryComponent());
  424. NewGamePlusAdjustDLC14SkelligeSet(horseManager.GetInventoryComponent());
  425. }
  426. }
  427.  
  428. //modSigns: load sound banks for mutations
  429. ((W3PlayerAbilityManager)abilityManager).LoadCurrentMutationSoundBank();
  430. //modSigns: load sound banks for sets
  431. LoadCurrentSetBonusSoundbank();
  432. //modSigns: add mutation trigger recipe
  433. if(IsMutationResearched(EPMT_Mutation11) /*|| IsMutationResearched(EPMT_Mutation12)*/)
  434. {
  435. if(!alchemyRecipes.Contains('Recipe for Mutation Trigger'))
  436. AddAlchemyRecipe('Recipe for Mutation Trigger', true, true);
  437. }
  438.  
  439.  
  440. ResumeStaminaRegen('WhirlSkill');
  441. ResumeStaminaRegen('RendSkill'); //modSigns
  442. ResumeStaminaRegen('IsPerformingFinisher'); //modSigns
  443.  
  444. ResumeHPRegenEffects('FistFightMinigame'); //modSigns
  445.  
  446. if(HasRunewordActive('Runeword 4 _Stats')) //modSigns
  447. StartVitalityRegen();
  448.  
  449. if(HasAbility('sword_s19'))
  450. {
  451. RemoveTemporarySkills();
  452. }
  453.  
  454. //HACK_UnequipWolfLiver(); //modSigns
  455.  
  456. if( enemiesKilledByType.Size() == 0 )
  457. {
  458. enemiesKilledByType.Resize(EENT_MAX_TYPES);
  459. }
  460.  
  461. //---=== modPreparations ===---
  462. prepConfig = new CModPreparationsConfig in this;
  463. //prepConfig.Init(this);
  464. //ApplyModPrepFixes();
  465. AddTimer('ModPrepDelayedInit', 0.00001, true, , , true);
  466. //---=== modPreparations ===---
  467.  
  468.  
  469. if( HasBuff( EET_GryphonSetBonusYrden ) )
  470. {
  471. RemoveBuff( EET_GryphonSetBonusYrden, false, "GryphonSetBonusYrden" );
  472. }
  473.  
  474. if( HasBuff( EET_GryphonSetBonus ) ) //modSigns: remove on spawn
  475. {
  476. RemoveBuff( EET_GryphonSetBonus );
  477. // -= WMK:modQuickSlots =-
  478. if (WmkGetQuickInventoryInstance()) {
  479. WmkGetQuickInventoryInstance().OnPlayerWitcherSpawned();
  480. }
  481.  
  482. if( HasBuff(EET_KaerMorhenSetBonus) ) //modSigns: remove on spawn
  483. // -= WMK:modQuickSlots =-
  484.  
  485. {
  486. RemoveBuff(EET_KaerMorhenSetBonus);
  487. }
  488.  
  489. if( HasBuff( EET_Aerondight ) ) //modSigns: remove Aerondight effect
  490. RemoveBuff( EET_Aerondight );
  491.  
  492. if( HasBuff( EET_PhantomWeapon ) ) //modSigns: remove Iris effect
  493. RemoveBuff( EET_PhantomWeapon );
  494.  
  495. RemoveBuff(EET_Runeword4); //modSigns
  496. RemoveBuff(EET_Runeword11); //modSigns
  497. RemoveAbilityAll('Glyphword 14 _Stats'); //modSigns
  498. RemoveAbilityAll('Glyphword 10 _Stats'); //modSigns
  499.  
  500. //modSigns
  501. if( FactsQuerySum("standalone_ep1") > 0 && FactsQuerySum("standalone_ep1_inv") < 1 )
  502. {
  503. AddTimer('GiveStandAloneEP1Items', 0.00001, true, , , true);
  504. }
  505. //modSigns
  506. if( FactsQuerySum("standalone_ep2") > 0 && FactsQuerySum("standalone_ep2_inv") < 1 )
  507. {
  508. AddTimer('GiveStandAloneEP2Items', 0.00001, true, , , true);
  509. }
  510.  
  511. if( spawnData.restored )
  512. {
  513.  
  514. UpdateEncumbrance();
  515.  
  516.  
  517. RemoveBuff( EET_Mutation11Immortal );
  518. RemoveBuff( EET_Mutation11Buff );
  519.  
  520. //modSigns:
  521. RemoveBuff( EET_UndyingSkillImmortal );
  522. }
  523.  
  524. //ModHoSBurningMark
  525. AddTimer('HoSBurningMark', 0.5f, true);
  526.  
  527. AddTimer('HoSBurningMarkStop', 90.f, true);
  528. //ModHoSBurningMark
  529.  
  530. theGame.GameplayFactsAdd( "PlayerIsGeralt" );
  531.  
  532. isInitialized = true;
  533. }
  534.  
  535. //ModHoSBurningMark
  536. timer function HoSBurningMark( dt : float, id : int )
  537. {
  538. var i : int;
  539. var items : array<SItemUniqueId>;
  540. var head : CEntity;
  541.  
  542. items = inv.GetItemsByCategory('head');
  543. for(i=0; i<items.Size(); i+=1)
  544. {
  545. head = inv.GetItemEntityUnsafe(items[i]);
  546. head.PlayEffect('geralt_face_mark_branding');
  547. }
  548. }
  549.  
  550. timer function HoSBurningMarkStop( dt : float, id : int )
  551. {
  552. var i : int;
  553. var items : array<SItemUniqueId>;
  554. var head : CEntity;
  555.  
  556. items = inv.GetItemsByCategory('head');
  557. for(i=0; i<items.Size(); i+=1)
  558. {
  559. head = inv.GetItemEntityUnsafe(items[i]);
  560. head.StopEffect('geralt_face_mark_branding');
  561. }
  562. }
  563. //ModHoSBurningMark
  564.  
  565.  
  566.  
  567. //---=== modPreparations ===---
  568. timer function ModPrepDelayedInit(dt : float, timerId : int)
  569. {
  570. if( !GetWitcherPlayer() ) //why on Earth is this even a thing?!?!?!
  571. return;
  572.  
  573. prepConfig.Init(this);
  574. ApplyModPrepFixes();
  575. RemoveTimer('ModPrepDelayedInit');
  576. }
  577.  
  578. private function ApplyModPrepFixes()
  579. {
  580. if( FactsQuerySum("MissingTawnyOwlRecipeAdded") < 1 )
  581. {
  582. AddAlchemyRecipe('Recipe for Tawny Owl 1', true, true); // fix missing Tawny Owl recipe
  583. FactsAdd("MissingTawnyOwlRecipeAdded");
  584. }
  585. }
  586.  
  587. public function SetupFHUD() //FHUD compatibility
  588. {
  589. prepDisallowOilsInCombat = prepConfig.disallowOilsInCombat;
  590. prepOilsHaveAmmo = prepConfig.OilsHaveAmmo();
  591. }
  592.  
  593. public function SetupFMed() //FMeditation compatibility
  594. {
  595. fmedCanSpawnCampfire = false;
  596. fmedAutorefillAlchemy = prepConfig.BombsAutorefillEnabled() ||
  597. prepConfig.OilsAutorefillEnabled() ||
  598. prepConfig.MutagensAutorefillEnabled() ||
  599. prepConfig.PotionsAutorefillEnabled();
  600. }
  601. //---=== modPreparations ===---
  602.  
  603.  
  604. private function HACK_UnequipWolfLiver()
  605. {
  606. var itemName1, itemName2, itemName3, itemName4 : name;
  607. var item1, item2, item3, item4 : SItemUniqueId;
  608.  
  609. GetItemEquippedOnSlot( EES_Potion1, item1 );
  610. GetItemEquippedOnSlot( EES_Potion2, item2 );
  611. GetItemEquippedOnSlot( EES_Potion3, item3 );
  612. GetItemEquippedOnSlot( EES_Potion4, item4 );
  613.  
  614. if ( inv.IsIdValid( item1 ) )
  615. itemName1 = inv.GetItemName( item1 );
  616. if ( inv.IsIdValid( item2 ) )
  617. itemName2 = inv.GetItemName( item2 );
  618. if ( inv.IsIdValid( item3 ) )
  619. itemName3 = inv.GetItemName( item3 );
  620. if ( inv.IsIdValid( item4 ) )
  621. itemName4 = inv.GetItemName( item4 );
  622.  
  623. if ( itemName1 == 'Wolf liver' || itemName3 == 'Wolf liver' )
  624. {
  625. if ( inv.IsIdValid( item1 ) )
  626. UnequipItem( item1 );
  627. if ( inv.IsIdValid( item3 ) )
  628. UnequipItem( item3 );
  629. }
  630. else if ( itemName2 == 'Wolf liver' || itemName4 == 'Wolf liver' )
  631. {
  632. if ( inv.IsIdValid( item2 ) )
  633. UnequipItem( item2 );
  634. if ( inv.IsIdValid( item4 ) )
  635. UnequipItem( item4 );
  636. }
  637. }
  638.  
  639. public function IncKills( et : EEnemyType ) //modSigns
  640. {
  641. enemiesKilledByType[et] += 1;
  642. //theGame.witcherLog.AddMessage(et + ": " + enemiesKilledByType[et]);
  643. }
  644.  
  645. public function GetKills( et : EEnemyType ) : int //modSigns
  646. {
  647. return enemiesKilledByType[et];
  648. }
  649.  
  650. public function GetExpModifierByEnemyType( et : EEnemyType ) : float //modSigns
  651. {
  652. switch(et)
  653. {
  654. case EENT_BOSS:
  655. return 1;
  656. case EENT_GENERIC:
  657. case EENT_ANIMAL:
  658. return 0;
  659. default:
  660. return 1 - MinF(100.0f, (float)GetKills(et))/100.0f;
  661. }
  662. }
  663.  
  664.  
  665.  
  666.  
  667.  
  668. timer function DelayedHorseUpdate( dt : float, id : int )
  669. {
  670. var man : W3HorseManager;
  671.  
  672. man = GetHorseManager();
  673. if(man)
  674. {
  675. if ( man.ApplyHorseUpdateOnSpawn() )
  676. {
  677.  
  678. UpdateEncumbrance();
  679.  
  680. RemoveTimer( 'DelayedHorseUpdate' );
  681. }
  682. }
  683. }
  684.  
  685. event OnAbilityAdded( abilityName : name)
  686. {
  687. super.OnAbilityAdded(abilityName);
  688.  
  689. if( HasRunewordActive('Runeword 4 _Stats') ) //modSigns
  690. {
  691. StartVitalityRegen();
  692. }
  693.  
  694. if ( abilityName == 'Runeword 8 _Stats' && GetStat(BCS_Focus, true) >= GetStatMax(BCS_Focus) && !HasBuff(EET_Runeword8) ) //modSigns
  695. {
  696. AddEffectDefault(EET_Runeword8, this, "equipped item");
  697. }
  698.  
  699. }
  700.  
  701. private final function AddStartingSchematics()
  702. {
  703. AddCraftingSchematic('Starting Armor Upgrade schematic 1', true,true);
  704. AddCraftingSchematic('Thread schematic', true, true);
  705. AddCraftingSchematic('String schematic', true, true);
  706. AddCraftingSchematic('Linen schematic', true, true);
  707. AddCraftingSchematic('Silk schematic', true, true);
  708. AddCraftingSchematic('Resin schematic', true, true);
  709. AddCraftingSchematic('Blasting powder schematic', true, true);
  710. AddCraftingSchematic('Haft schematic', true, true);
  711. AddCraftingSchematic('Hardened timber schematic', true, true);
  712. AddCraftingSchematic('Leather squares schematic', true, true);
  713. AddCraftingSchematic('Leather schematic', true, true);
  714. AddCraftingSchematic('Hardened leather schematic', true, true);
  715. AddCraftingSchematic('Draconide leather schematic', true, true);
  716. AddCraftingSchematic('Iron ingot schematic', true, true);
  717. AddCraftingSchematic('Steel ingot schematic', true, true);
  718. AddCraftingSchematic('Steel ingot schematic 1', true, true);
  719. AddCraftingSchematic('Steel plate schematic', true, true);
  720. AddCraftingSchematic('Dark iron ingot schematic', true, true);
  721. AddCraftingSchematic('Dark iron plate schematic', true, true);
  722. AddCraftingSchematic('Dark steel ingot schematic', true, true);
  723. AddCraftingSchematic('Dark steel ingot schematic 1', true, true);
  724. AddCraftingSchematic('Dark steel plate schematic', true, true);
  725. AddCraftingSchematic('Silver ore schematic', true, true);
  726. AddCraftingSchematic('Silver ingot schematic', true, true);
  727. AddCraftingSchematic('Silver ingot schematic 1', true, true);
  728. AddCraftingSchematic('Silver plate schematic', true, true);
  729. AddCraftingSchematic('Meteorite ingot schematic', true, true);
  730. AddCraftingSchematic('Meteorite silver ingot schematic', true, true);
  731. AddCraftingSchematic('Meteorite silver plate schematic', true, true);
  732. AddCraftingSchematic('Glowing ingot schematic', true, true);
  733. AddCraftingSchematic('Dwimeryte ore schematic', true, true);
  734. AddCraftingSchematic('Dwimeryte ingot schematic', true, true);
  735. AddCraftingSchematic('Dwimeryte ingot schematic 1', true, true);
  736. AddCraftingSchematic('Dwimeryte plate schematic', true, true);
  737. AddCraftingSchematic('Infused dust schematic', true, true);
  738. AddCraftingSchematic('Infused shard schematic', true, true);
  739. AddCraftingSchematic('Infused crystal schematic', true, true);
  740.  
  741. if ( theGame.GetDLCManager().IsEP2Available() )
  742. {
  743. AddCraftingSchematic('Draconide infused leather schematic', true, true);
  744. AddCraftingSchematic('Nickel ore schematic', true, true);
  745. AddCraftingSchematic('Cupronickel ore schematic', true, true);
  746. AddCraftingSchematic('Copper ore schematic', true, true);
  747. AddCraftingSchematic('Copper ingot schematic', true, true);
  748. AddCraftingSchematic('Copper plate schematic', true, true);
  749. AddCraftingSchematic('Green gold ore schematic', true, true);
  750. AddCraftingSchematic('Green gold ore schematic 1', true, true);
  751. AddCraftingSchematic('Green gold ingot schematic', true, true);
  752. AddCraftingSchematic('Green gold plate schematic', true, true);
  753. AddCraftingSchematic('Orichalcum ore schematic', true, true);
  754. AddCraftingSchematic('Orichalcum ore schematic 1', true, true);
  755. AddCraftingSchematic('Orichalcum ingot schematic', true, true);
  756. AddCraftingSchematic('Orichalcum plate schematic', true, true);
  757. AddCraftingSchematic('Dwimeryte enriched ore schematic', true, true);
  758. AddCraftingSchematic('Dwimeryte enriched ingot schematic', true, true);
  759. AddCraftingSchematic('Dwimeryte enriched plate schematic', true, true);
  760. }
  761. }
  762.  
  763. private final function ApplyPatchFixes()
  764. {
  765. var cnt, transmutationCount, mutagenCount, i, slot : int;
  766. var transmutationAbility, itemName : name;
  767. var pam : W3PlayerAbilityManager;
  768. var slotId : int;
  769. var offset : float;
  770. var buffs : array<CBaseGameplayEffect>;
  771. var mutagen : W3Mutagen_Effect;
  772. var skill : SSimpleSkill;
  773. var spentSkillPoints, swordSkillPointsSpent, alchemySkillPointsSpent, perkSkillPointsSpent, pointsToAdd : int;
  774. var mutagens : array< W3Mutagen_Effect >;
  775.  
  776. /*if(FactsQuerySum("ClearingPotionPassiveBonusFix") < 1)
  777. {
  778. pam = (W3PlayerAbilityManager)abilityManager;
  779.  
  780. cnt = GetAbilityCount('sword_adrenalinegain') - pam.GetPathPointsSpent(ESP_Sword);
  781. if(cnt > 0)
  782. RemoveAbilityMultiple('sword_adrenalinegain', cnt);
  783.  
  784. cnt = GetAbilityCount('magic_staminaregen') - pam.GetPathPointsSpent(ESP_Signs);
  785. if(cnt > 0)
  786. RemoveAbilityMultiple('magic_staminaregen', cnt);
  787.  
  788. cnt = GetAbilityCount('alchemy_potionduration') - pam.GetPathPointsSpent(ESP_Alchemy);
  789. if(cnt > 0)
  790. RemoveAbilityMultiple('alchemy_potionduration', cnt);
  791.  
  792. FactsAdd("ClearingPotionPassiveBonusFix");
  793. }*/ //modSigns
  794.  
  795.  
  796. /*if(FactsQuerySum("DimeritiumSynergyFix") < 1)
  797. {
  798. slotId = GetSkillSlotID(S_Alchemy_s19);
  799. if(slotId != -1)
  800. UnequipSkill(S_Alchemy_s19);
  801.  
  802. RemoveAbilityAll('greater_mutagen_color_green_synergy_bonus');
  803. RemoveAbilityAll('mutagen_color_green_synergy_bonus');
  804. RemoveAbilityAll('mutagen_color_lesser_green_synergy_bonus');
  805.  
  806. RemoveAbilityAll('greater_mutagen_color_blue_synergy_bonus');
  807. RemoveAbilityAll('mutagen_color_blue_synergy_bonus');
  808. RemoveAbilityAll('mutagen_color_lesser_blue_synergy_bonus');
  809.  
  810. RemoveAbilityAll('greater_mutagen_color_red_synergy_bonus');
  811. RemoveAbilityAll('mutagen_color_red_synergy_bonus');
  812. RemoveAbilityAll('mutagen_color_lesser_red_synergy_bonus');
  813.  
  814. if(slotId != -1)
  815. EquipSkill(S_Alchemy_s19, slotId);
  816.  
  817. FactsAdd("DimeritiumSynergyFix");
  818. }*/ //modSigns
  819.  
  820.  
  821. if(FactsQuerySum("DontShowRecipePinTut") < 1)
  822. {
  823. FactsAdd( "DontShowRecipePinTut" );
  824. TutorialScript('alchemyRecipePin', '');
  825. TutorialScript('craftingRecipePin', '');
  826. }
  827.  
  828.  
  829. if(FactsQuerySum("LevelReqPotGiven") < 1)
  830. {
  831. FactsAdd("LevelReqPotGiven");
  832. inv.AddAnItem('Wolf Hour', 1, false, false, true);
  833. }
  834.  
  835.  
  836. if(!HasBuff(EET_AutoStaminaRegen))
  837. {
  838. AddEffectDefault(EET_AutoStaminaRegen, this, 'autobuff', false);
  839. }
  840.  
  841.  
  842.  
  843. buffs = GetBuffs();
  844. offset = 0;
  845. mutagenCount = 0;
  846. for(i=0; i<buffs.Size(); i+=1)
  847. {
  848. mutagen = (W3Mutagen_Effect)buffs[i];
  849. if(mutagen)
  850. {
  851. offset += mutagen.GetToxicityOffset();
  852. mutagenCount += 1;
  853. }
  854. }
  855.  
  856.  
  857. if(offset != (GetStat(BCS_Toxicity) - GetStat(BCS_Toxicity, true)))
  858. SetToxicityOffset(offset);
  859.  
  860.  
  861. /*mutagenCount *= GetSkillLevel(S_Alchemy_s13);
  862. transmutationAbility = GetSkillAbilityName(S_Alchemy_s13);
  863. transmutationCount = GetAbilityCount(transmutationAbility);
  864. if(mutagenCount < transmutationCount)
  865. {
  866. RemoveAbilityMultiple(transmutationAbility, transmutationCount - mutagenCount);
  867. }
  868. else if(mutagenCount > transmutationCount)
  869. {
  870. AddAbilityMultiple(transmutationAbility, mutagenCount - transmutationCount);
  871. }*/ //modSigns: skill changed
  872. RecalcTransmutationAbilities();
  873.  
  874.  
  875. if(theGame.GetDLCManager().IsEP1Available())
  876. {
  877. theGame.GetJournalManager().ActivateEntryByScriptTag('TutorialJournalEnchanting', JS_Active);
  878. }
  879.  
  880.  
  881. if(HasAbility('sword_s19') && FactsQuerySum("Patch_Sword_s19") < 1)
  882. {
  883. pam = (W3PlayerAbilityManager)abilityManager;
  884.  
  885.  
  886. skill.level = 0;
  887. for(i = S_Magic_s01; i <= S_Magic_s20; i+=1)
  888. {
  889. skill.skillType = i;
  890. pam.RemoveTemporarySkill(skill);
  891. }
  892.  
  893.  
  894. spentSkillPoints = levelManager.GetPointsUsed(ESkillPoint);
  895. swordSkillPointsSpent = pam.GetPathPointsSpent(ESP_Sword);
  896. alchemySkillPointsSpent = pam.GetPathPointsSpent(ESP_Alchemy);
  897. perkSkillPointsSpent = pam.GetPathPointsSpent(ESP_Perks);
  898.  
  899. pointsToAdd = spentSkillPoints - swordSkillPointsSpent - alchemySkillPointsSpent - perkSkillPointsSpent;
  900. if(pointsToAdd > 0)
  901. levelManager.UnspendPoints(ESkillPoint, pointsToAdd);
  902.  
  903.  
  904. RemoveAbilityAll('sword_s19');
  905.  
  906.  
  907. FactsAdd("Patch_Sword_s19");
  908. }
  909.  
  910.  
  911. if( HasAbility( 'sword_s19' ) )
  912. {
  913. RemoveAbilityAll( 'sword_s19' );
  914. }
  915.  
  916.  
  917. //if(FactsQuerySum("Patch_Armor_Type_Glyphwords") < 1)
  918. //{
  919. // pam = (W3PlayerAbilityManager)abilityManager;
  920. //
  921. // pam.SetPerkArmorBonus( S_Perk_05, this );
  922. // pam.SetPerkArmorBonus( S_Perk_06, this );
  923. // pam.SetPerkArmorBonus( S_Perk_07, this );
  924. //
  925. // FactsAdd("Patch_Armor_Type_Glyphwords");
  926. //}
  927. //else if( FactsQuerySum("154999") < 1 )
  928. //{
  929. //
  930. // pam = (W3PlayerAbilityManager)abilityManager;
  931. //
  932. // pam.SetPerkArmorBonus( S_Perk_05, this );
  933. // pam.SetPerkArmorBonus( S_Perk_06, this );
  934. // pam.SetPerkArmorBonus( S_Perk_07, this );
  935. //
  936. // FactsAdd("154999");
  937. //}
  938.  
  939. if( FactsQuerySum( "Patch_Decoction_Buff_Icons" ) < 1 )
  940. {
  941. mutagens = GetMutagenBuffs();
  942. for( i=0; i<mutagens.Size(); i+=1 )
  943. {
  944. itemName = DecoctionEffectTypeToItemName( mutagens[i].GetEffectType() );
  945. mutagens[i].OverrideIcon( itemName );
  946. }
  947.  
  948. FactsAdd( "Patch_Decoction_Buff_Icons" );
  949. }
  950.  
  951.  
  952. //if( FactsQuerySum( "154997" ) < 1 )
  953. //{
  954. // if( IsSkillEquipped( S_Alchemy_s18 ) )
  955. // {
  956. // slot = GetSkillSlotID( S_Alchemy_s18 );
  957. // UnequipSkill( slot );
  958. // EquipSkill( S_Alchemy_s18, slot );
  959. // }
  960. // FactsAdd( "154997" );
  961. //}
  962. if( FactsQuerySum( "Patch_Mutagen_Ing_Stacking" ) < 1 )
  963. {
  964. Patch_MutagenStacking();
  965. FactsAdd( "Patch_Mutagen_Ing_Stacking" );
  966. }
  967.  
  968. //modSigns
  969. if(FactsQuerySum("new_game_started_with_GM_40") < 1 )
  970. {
  971. if( FactsQuerySum( "modSigns_ArmorTypeSetsIntroduced" ) < 1 )
  972. {
  973. pam = (W3PlayerAbilityManager)abilityManager;
  974. pam.ManageSetArmorTypeBonus();
  975. RecalcSetItemsEquipped();
  976. FactsAdd( "modSigns_ArmorTypeSetsIntroduced" );
  977. }
  978. if( FactsQuerySum( "modSigns_KMArmorTypeSetIntroduced" ) < 1 )
  979. {
  980. pam = (W3PlayerAbilityManager)abilityManager;
  981. pam.ManageSetArmorTypeBonus();
  982. RecalcSetItemsEquipped();
  983. FactsAdd( "modSigns_KMArmorTypeSetIntroduced" );
  984. }
  985. }
  986. }
  987.  
  988. //++modAHW
  989. timer function AHWInit(dt:float,id:int)
  990. {
  991. AHW.Init();
  992. }
  993. //--modAHW
  994.  
  995. private final function Patch_MutagenStacking()
  996. {
  997. var i, j, quantity : int;
  998. var muts : array< SItemUniqueId >;
  999. var item : SItemUniqueId;
  1000. var mutName : name;
  1001. var wasInArray : bool;
  1002. var mutsToAdd : array< SItemParts >;
  1003. var mutToAdd : SItemParts;
  1004.  
  1005. muts = inv.GetItemsByTag( 'MutagenIngredient' );
  1006. if( GetItemEquippedOnSlot( EES_SkillMutagen1, item ) )
  1007. {
  1008. muts.Remove( item );
  1009. inv.SetItemStackable( item, false );
  1010. }
  1011. if( GetItemEquippedOnSlot( EES_SkillMutagen2, item ) )
  1012. {
  1013. muts.Remove( item );
  1014. inv.SetItemStackable( item, false );
  1015. }
  1016. if( GetItemEquippedOnSlot( EES_SkillMutagen3, item ) )
  1017. {
  1018. muts.Remove( item );
  1019. inv.SetItemStackable( item, false );
  1020. }
  1021. if( GetItemEquippedOnSlot( EES_SkillMutagen4, item ) )
  1022. {
  1023. muts.Remove( item );
  1024. inv.SetItemStackable( item, false );
  1025. }
  1026. muts = SSS_Patch_MutagenStacking(muts); //zur13 modSSS mutTabs
  1027. for( i=0; i<muts.Size(); i+=1 )
  1028. {
  1029. mutName = inv.GetItemName( muts[i] );
  1030. quantity = inv.GetItemQuantity( muts[i] );
  1031.  
  1032. wasInArray = false;
  1033. for( j=0; j<mutsToAdd.Size(); j+=1 )
  1034. {
  1035. if( mutsToAdd[j].itemName == mutName )
  1036. {
  1037. mutsToAdd[j].quantity += quantity;
  1038. wasInArray = true;
  1039. break;
  1040. }
  1041. }
  1042.  
  1043. if( !wasInArray )
  1044. {
  1045. mutToAdd.itemName = mutName;
  1046. mutToAdd.quantity = quantity;
  1047. mutsToAdd.PushBack( mutToAdd );
  1048. }
  1049.  
  1050. inv.RemoveItem( muts[i], quantity );
  1051. }
  1052.  
  1053. for( i=0; i<mutsToAdd.Size(); i+=1 )
  1054. {
  1055. inv.AddAnItem( mutsToAdd[i].itemName, mutsToAdd[i].quantity, true, true );
  1056. }
  1057. }
  1058.  
  1059. private function FixEquippedMutagens()
  1060. {
  1061. var item : SItemUniqueId;
  1062. if( GetItemEquippedOnSlot( EES_SkillMutagen1, item ) )
  1063. {
  1064. inv.SetItemStackable( item, false );
  1065. }
  1066. if( GetItemEquippedOnSlot( EES_SkillMutagen2, item ) )
  1067. {
  1068. inv.SetItemStackable( item, false );
  1069. }
  1070. if( GetItemEquippedOnSlot( EES_SkillMutagen3, item ) )
  1071. {
  1072. inv.SetItemStackable( item, false );
  1073. }
  1074. if( GetItemEquippedOnSlot( EES_SkillMutagen4, item ) )
  1075. {
  1076. inv.SetItemStackable( item, false );
  1077. } SSS_FixEquippedMutagens(); //zur13 modSSS mutTabs
  1078. }
  1079.  
  1080. public final function RestoreQuen( quenHealth : float, quenDuration : float, optional alternate : bool ) : bool
  1081. {
  1082. var restoredQuen : W3QuenEntity;
  1083.  
  1084. if(quenHealth > 0.f && quenDuration >= 3.f)
  1085. {
  1086. restoredQuen = (W3QuenEntity)theGame.CreateEntity( signs[ST_Quen].template, GetWorldPosition(), GetWorldRotation() );
  1087. restoredQuen.Init( signOwner, signs[ST_Quen].entity, true );
  1088.  
  1089. if( alternate )
  1090. {
  1091. restoredQuen.SetAlternateCast( S_Magic_s04 );
  1092. }
  1093.  
  1094. restoredQuen.freeCast = true; //modSigns
  1095. restoredQuen.OnStarted();
  1096. restoredQuen.OnThrowing();
  1097.  
  1098. if( !alternate )
  1099. {
  1100. restoredQuen.OnEnded();
  1101. }
  1102.  
  1103. restoredQuen.SetDataFromRestore(quenHealth, quenDuration);
  1104.  
  1105. return true;
  1106. }
  1107.  
  1108. return false;
  1109. }
  1110.  
  1111. public function IsInitialized() : bool
  1112. {
  1113. return isInitialized;
  1114. }
  1115.  
  1116. private function NewGamePlusInitialize()
  1117. {
  1118. var questItems : array<name>;
  1119. var horseManager : W3HorseManager;
  1120. var horseInventory : CInventoryComponent;
  1121. var i, missingLevels, expDiff : int;
  1122.  
  1123. super.NewGamePlusInitialize();
  1124.  
  1125.  
  1126. horseManager = (W3HorseManager)EntityHandleGet(horseManagerHandle);
  1127. if(horseManager)
  1128. horseInventory = horseManager.GetInventoryComponent();
  1129.  
  1130.  
  1131. theGame.params.SetNewGamePlusLevel(GetLevel());
  1132.  
  1133.  
  1134. if (theGame.GetDLCManager().IsDLCAvailable('ep1'))
  1135. missingLevels = theGame.params.NEW_GAME_PLUS_EP1_MIN_LEVEL - GetLevel();
  1136. else
  1137. missingLevels = theGame.params.NEW_GAME_PLUS_MIN_LEVEL - GetLevel();
  1138.  
  1139. for(i=0; i<missingLevels; i+=1)
  1140. {
  1141.  
  1142. expDiff = levelManager.GetTotalExpForNextLevel() - levelManager.GetPointsTotal(EExperiencePoint);
  1143. expDiff = CeilF( ((float)expDiff) / 2 );
  1144. AddPoints(EExperiencePoint, expDiff, false);
  1145. }
  1146.  
  1147.  
  1148.  
  1149.  
  1150.  
  1151. inv.RemoveItemByTag('Quest', -1);
  1152. horseInventory.RemoveItemByTag('Quest', -1);
  1153.  
  1154.  
  1155.  
  1156. questItems = theGame.GetDefinitionsManager().GetItemsWithTag('Quest');
  1157. for(i=0; i<questItems.Size(); i+=1)
  1158. {
  1159. inv.RemoveItemByName(questItems[i], -1);
  1160. horseInventory.RemoveItemByName(questItems[i], -1);
  1161. }
  1162.  
  1163.  
  1164. inv.RemoveItemByName('mq1002_artifact_3', -1);
  1165. horseInventory.RemoveItemByName('mq1002_artifact_3', -1);
  1166.  
  1167.  
  1168. inv.RemoveItemByTag('NotTransferableToNGP', -1);
  1169. horseInventory.RemoveItemByTag('NotTransferableToNGP', -1);
  1170.  
  1171.  
  1172. inv.RemoveItemByTag('NoticeBoardNote', -1);
  1173. horseInventory.RemoveItemByTag('NoticeBoardNote', -1);
  1174.  
  1175.  
  1176. RemoveAllNonAutoBuffs();
  1177.  
  1178.  
  1179. RemoveAlchemyRecipe('Recipe for Trial Potion Kit');
  1180. RemoveAlchemyRecipe('Recipe for Pops Antidote');
  1181. RemoveAlchemyRecipe('Recipe for Czart Lure');
  1182. RemoveAlchemyRecipe('q603_diarrhea_potion_recipe');
  1183.  
  1184.  
  1185. inv.RemoveItemByTag('Trophy', -1);
  1186. horseInventory.RemoveItemByTag('Trophy', -1);
  1187.  
  1188.  
  1189. inv.RemoveItemByCategory('usable', -1);
  1190. horseInventory.RemoveItemByCategory('usable', -1);
  1191.  
  1192.  
  1193. RemoveAbility('StaminaTutorialProlog');
  1194. RemoveAbility('TutorialStaminaRegenHack');
  1195. RemoveAbility('area_novigrad');
  1196. RemoveAbility('NoRegenEffect');
  1197. RemoveAbility('HeavySwimmingStaminaDrain');
  1198. RemoveAbility('AirBoost');
  1199. RemoveAbility('area_nml');
  1200. RemoveAbility('area_skellige');
  1201.  
  1202.  
  1203. inv.RemoveItemByTag('GwintCard', -1);
  1204. horseInventory.RemoveItemByTag('GwintCard', -1);
  1205.  
  1206.  
  1207.  
  1208. inv.RemoveItemByTag('ReadableItem', -1);
  1209. horseInventory.RemoveItemByTag('ReadableItem', -1);
  1210.  
  1211.  
  1212. abilityManager.RestoreStats();
  1213.  
  1214.  
  1215. ((W3PlayerAbilityManager)abilityManager).RemoveToxicityOffset(10000);
  1216.  
  1217.  
  1218. //---=== modPreparations ===---
  1219. inv.SingletonItemsRefillAmmoNoAlco(true);
  1220. //---=== modPreparations ===---
  1221.  
  1222. craftingSchematics.Clear();
  1223. AddStartingSchematics();
  1224.  
  1225.  
  1226. for( i=0; i<amountOfSetPiecesEquipped.Size(); i+=1 )
  1227. {
  1228. amountOfSetPiecesEquipped[i] = 0;
  1229. }
  1230.  
  1231.  
  1232. inv.AddAnItem('Clearing Potion', 1, true, false, false);
  1233.  
  1234.  
  1235. inv.RemoveItemByName('q203_broken_eyeofloki', -1);
  1236. horseInventory.RemoveItemByName('q203_broken_eyeofloki', -1);
  1237.  
  1238.  
  1239. //modSigns
  1240. if( FactsQuerySum("ModSignsKMSetSchematicsAdded") < 1 )
  1241. {
  1242. AddCraftingSchematic('Kaer Morhen Armor 1 schematic',true, true);
  1243. AddCraftingSchematic('Kaer Morhen Armor 2 schematic',true, true);
  1244. AddCraftingSchematic('Kaer Morhen Armor 3 schematic',true, true);
  1245. AddCraftingSchematic('Kaer Morhen Pants schematic',true, true);
  1246. AddCraftingSchematic('Kaer Morhen Pants 1 schematic',true, true);
  1247. AddCraftingSchematic('Kaer Morhen Pants 2 schematic',true, true);
  1248. AddCraftingSchematic('Kaer Morhen Pants 3 schematic',true, true);
  1249. AddCraftingSchematic('Kaer Morhen Boots schematic',true, true);
  1250. AddCraftingSchematic('Kaer Morhen Boots 1 schematic',true, true);
  1251. AddCraftingSchematic('Kaer Morhen Boots 2 schematic',true, true);
  1252. AddCraftingSchematic('Kaer Morhen Boots 3 schematic',true, true);
  1253. AddCraftingSchematic('Kaer Morhen Gloves schematic',true, true);
  1254. AddCraftingSchematic('Kaer Morhen Gloves 1 schematic',true, true);
  1255. AddCraftingSchematic('Kaer Morhen Gloves 2 schematic',true, true);
  1256. AddCraftingSchematic('Kaer Morhen Gloves 3 schematic',true, true);
  1257. FactsAdd("ModSignsKMSetSchematicsAdded");
  1258. }
  1259.  
  1260. NewGamePlusReplaceViperSet(inv);
  1261. NewGamePlusReplaceViperSet(horseInventory);
  1262. NewGamePlusReplaceKaerMorhenSet(inv); //modSigns
  1263. NewGamePlusReplaceKaerMorhenSet(horseInventory); //modSigns
  1264. NewGamePlusReplaceLynxSet(inv);
  1265. NewGamePlusReplaceLynxSet(horseInventory);
  1266. NewGamePlusReplaceGryphonSet(inv);
  1267. NewGamePlusReplaceGryphonSet(horseInventory);
  1268. NewGamePlusReplaceBearSet(inv);
  1269. NewGamePlusReplaceBearSet(horseInventory);
  1270. NewGamePlusReplaceEP1(inv);
  1271. NewGamePlusReplaceEP1(horseInventory);
  1272. NewGamePlusReplaceEP2WitcherSets(inv);
  1273. NewGamePlusReplaceEP2WitcherSets(horseInventory);
  1274. NewGamePlusReplaceEP2Items(inv);
  1275. NewGamePlusReplaceEP2Items(horseInventory);
  1276. NewGamePlusMarkItemsToNotAdjust(inv);
  1277. NewGamePlusMarkItemsToNotAdjust(horseInventory);
  1278.  
  1279.  
  1280. inputHandler.ClearLocksForNGP();
  1281.  
  1282.  
  1283. buffImmunities.Clear();
  1284. buffRemovedImmunities.Clear();
  1285.  
  1286. newGamePlusInitialized = true;
  1287.  
  1288.  
  1289. m_quenReappliedCount = 1;
  1290. }
  1291.  
  1292. private final function NewGamePlusMarkItemsToNotAdjust(out inv : CInventoryComponent)
  1293. {
  1294. var ids : array<SItemUniqueId>;
  1295. var i : int;
  1296. var n : name;
  1297.  
  1298. inv.GetAllItems(ids);
  1299. for( i=0; i<ids.Size(); i+=1 )
  1300. {
  1301. inv.SetItemModifierInt(ids[i], 'NGPItemAdjusted', 1);
  1302. }
  1303. }
  1304.  
  1305. private final function NewGamePlusReplaceItem( item : name, new_item : name, out inv : CInventoryComponent)
  1306. {
  1307. var i, j : int;
  1308. var ids, new_ids, enh_ids : array<SItemUniqueId>;
  1309. var dye_ids : array<SItemUniqueId>;
  1310. var enh : array<name>;
  1311. var wasEquipped : bool;
  1312. var wasEnchanted : bool;
  1313. var wasDyed : bool;
  1314. var enchantName, colorName : name;
  1315.  
  1316. if ( inv.HasItem( item ) )
  1317. {
  1318. ids = inv.GetItemsIds(item);
  1319. for (i = 0; i < ids.Size(); i += 1)
  1320. {
  1321. inv.GetItemEnhancementItems( ids[i], enh );
  1322. wasEnchanted = inv.IsItemEnchanted( ids[i] );
  1323. if ( wasEnchanted )
  1324. enchantName = inv.GetEnchantment( ids[i] );
  1325. wasEquipped = IsItemEquipped( ids[i] );
  1326. wasDyed = inv.IsItemColored( ids[i] );
  1327. if ( wasDyed )
  1328. {
  1329. colorName = inv.GetItemColor( ids[i] );
  1330. }
  1331.  
  1332. inv.RemoveItem( ids[i], 1 );
  1333. new_ids = inv.AddAnItem( new_item, 1, true, true, false );
  1334. if ( wasEquipped )
  1335. {
  1336. EquipItem( new_ids[0] );
  1337. }
  1338. if ( wasEnchanted )
  1339. {
  1340. inv.EnchantItem( new_ids[0], enchantName, getEnchamtmentStatName(enchantName) );
  1341. }
  1342. for (j = 0; j < enh.Size(); j += 1)
  1343. {
  1344. enh_ids = inv.AddAnItem( enh[j], 1, true, true, false );
  1345. inv.EnhanceItemScript( new_ids[0], enh_ids[0] );
  1346. }
  1347. if ( wasDyed )
  1348. {
  1349. dye_ids = inv.AddAnItem( colorName, 1, true, true, false );
  1350. inv.ColorItem( new_ids[0], dye_ids[0] );
  1351. inv.RemoveItem( dye_ids[0], 1 );
  1352. }
  1353.  
  1354. inv.SetItemModifierInt( new_ids[0], 'NGPItemAdjusted', 1 );
  1355. }
  1356. }
  1357. }
  1358.  
  1359. private final function NewGamePlusAdjustDLCItem(item : name, mod : name, inv : CInventoryComponent)
  1360. {
  1361. var ids : array<SItemUniqueId>;
  1362. var i : int;
  1363.  
  1364. if( inv.HasItem(item) )
  1365. {
  1366. ids = inv.GetItemsIds(item);
  1367. for (i = 0; i < ids.Size(); i += 1)
  1368. {
  1369. if ( inv.GetItemModifierInt(ids[i], 'DoNotAdjustNGPDLC') <= 0 )
  1370. {
  1371. inv.AddItemBaseAbility(ids[i], mod);
  1372. inv.SetItemModifierInt(ids[i], 'DoNotAdjustNGPDLC', 1);
  1373. }
  1374. }
  1375. }
  1376.  
  1377. }
  1378.  
  1379. private final function NewGamePlusAdjustDLC1TemerianSet(inv : CInventoryComponent)
  1380. {
  1381. NewGamePlusAdjustDLCItem('NGP DLC1 Temerian Armor', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1382. NewGamePlusAdjustDLCItem('NGP DLC1 Temerian Gloves', 'NGP DLC Compatibility Armor Mod', inv);
  1383. NewGamePlusAdjustDLCItem('NGP DLC1 Temerian Pants', 'NGP DLC Compatibility Armor Mod', inv);
  1384. NewGamePlusAdjustDLCItem('NGP DLC1 Temerian Boots', 'NGP DLC Compatibility Armor Mod', inv);
  1385. }
  1386.  
  1387. private final function NewGamePlusAdjustDLC5NilfgardianSet(inv : CInventoryComponent)
  1388. {
  1389. NewGamePlusAdjustDLCItem('NGP DLC5 Nilfgaardian Armor', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1390. NewGamePlusAdjustDLCItem('NGP DLC5 Nilfgaardian Gloves', 'NGP DLC Compatibility Armor Mod', inv);
  1391. NewGamePlusAdjustDLCItem('NGP DLC5 Nilfgaardian Pants', 'NGP DLC Compatibility Armor Mod', inv);
  1392. NewGamePlusAdjustDLCItem('NGP DLC5 Nilfgaardian Boots', 'NGP DLC Compatibility Armor Mod', inv);
  1393. }
  1394.  
  1395. private final function NewGamePlusAdjustDLC10WolfSet(inv : CInventoryComponent)
  1396. {
  1397. NewGamePlusAdjustDLCItem('NGP Wolf Armor', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1398. NewGamePlusAdjustDLCItem('NGP Wolf Armor 1', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1399. NewGamePlusAdjustDLCItem('NGP Wolf Armor 2', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1400. NewGamePlusAdjustDLCItem('NGP Wolf Armor 3', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1401.  
  1402. NewGamePlusAdjustDLCItem('NGP Wolf Boots 1', 'NGP DLC Compatibility Armor Mod', inv);
  1403. NewGamePlusAdjustDLCItem('NGP Wolf Boots 2', 'NGP DLC Compatibility Armor Mod', inv);
  1404. NewGamePlusAdjustDLCItem('NGP Wolf Boots 3', 'NGP DLC Compatibility Armor Mod', inv);
  1405. NewGamePlusAdjustDLCItem('NGP Wolf Boots 4', 'NGP DLC Compatibility Armor Mod', inv);
  1406.  
  1407. NewGamePlusAdjustDLCItem('NGP Wolf Gloves 1', 'NGP DLC Compatibility Armor Mod', inv);
  1408. NewGamePlusAdjustDLCItem('NGP Wolf Gloves 2', 'NGP DLC Compatibility Armor Mod', inv);
  1409. NewGamePlusAdjustDLCItem('NGP Wolf Gloves 3', 'NGP DLC Compatibility Armor Mod', inv);
  1410. NewGamePlusAdjustDLCItem('NGP Wolf Gloves 4', 'NGP DLC Compatibility Armor Mod', inv);
  1411.  
  1412. NewGamePlusAdjustDLCItem('NGP Wolf Pants 1', 'NGP DLC Compatibility Armor Mod', inv);
  1413. NewGamePlusAdjustDLCItem('NGP Wolf Pants 2', 'NGP DLC Compatibility Armor Mod', inv);
  1414. NewGamePlusAdjustDLCItem('NGP Wolf Pants 3', 'NGP DLC Compatibility Armor Mod', inv);
  1415. NewGamePlusAdjustDLCItem('NGP Wolf Pants 4', 'NGP DLC Compatibility Armor Mod', inv);
  1416.  
  1417. NewGamePlusAdjustDLCItem('NGP Wolf School steel sword', 'NGP Wolf Steel Sword Mod', inv);
  1418. NewGamePlusAdjustDLCItem('NGP Wolf School steel sword 1', 'NGP Wolf Steel Sword Mod', inv);
  1419. NewGamePlusAdjustDLCItem('NGP Wolf School steel sword 2', 'NGP Wolf Steel Sword Mod', inv);
  1420. NewGamePlusAdjustDLCItem('NGP Wolf School steel sword 3', 'NGP Wolf Steel Sword Mod', inv);
  1421.  
  1422. NewGamePlusAdjustDLCItem('NGP Wolf School silver sword', 'NGP Wolf Silver Sword Mod', inv);
  1423. NewGamePlusAdjustDLCItem('NGP Wolf School silver sword 1', 'NGP Wolf Silver Sword Mod', inv);
  1424. NewGamePlusAdjustDLCItem('NGP Wolf School silver sword 2', 'NGP Wolf Silver Sword Mod', inv);
  1425. NewGamePlusAdjustDLCItem('NGP Wolf School silver sword 3', 'NGP Wolf Silver Sword Mod', inv);
  1426. }
  1427.  
  1428. private final function NewGamePlusAdjustDLC14SkelligeSet(inv : CInventoryComponent)
  1429. {
  1430. NewGamePlusAdjustDLCItem('NGP DLC14 Skellige Armor', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1431. NewGamePlusAdjustDLCItem('NGP DLC14 Skellige Gloves', 'NGP DLC Compatibility Armor Mod', inv);
  1432. NewGamePlusAdjustDLCItem('NGP DLC14 Skellige Pants', 'NGP DLC Compatibility Armor Mod', inv);
  1433. NewGamePlusAdjustDLCItem('NGP DLC14 Skellige Boots', 'NGP DLC Compatibility Armor Mod', inv);
  1434. }
  1435.  
  1436. //modSigns
  1437. private final function NewGamePlusReplaceKaerMorhenSet(out inv : CInventoryComponent)
  1438. {
  1439. NewGamePlusReplaceItem('Kaer Morhen Armor','NGP Kaer Morhen Armor', inv);
  1440. NewGamePlusReplaceItem('Kaer Morhen Armor 1','NGP Kaer Morhen Armor 1', inv);
  1441. NewGamePlusReplaceItem('Kaer Morhen Armor 2','NGP Kaer Morhen Armor 2', inv);
  1442. NewGamePlusReplaceItem('Kaer Morhen Armor 3','NGP Kaer Morhen Armor 3', inv);
  1443. NewGamePlusReplaceItem('Kaer Morhen Pants','NGP Kaer Morhen Pants', inv);
  1444. NewGamePlusReplaceItem('Kaer Morhen Pants 1','NGP Kaer Morhen Pants 1', inv);
  1445. NewGamePlusReplaceItem('Kaer Morhen Pants 2','NGP Kaer Morhen Pants 2', inv);
  1446. NewGamePlusReplaceItem('Kaer Morhen Pants 3','NGP Kaer Morhen Pants 3', inv);
  1447. NewGamePlusReplaceItem('Kaer Morhen Boots','NGP Kaer Morhen Boots', inv);
  1448. NewGamePlusReplaceItem('Kaer Morhen Boots 1','NGP Kaer Morhen Boots 1', inv);
  1449. NewGamePlusReplaceItem('Kaer Morhen Boots 2','NGP Kaer Morhen Boots 2', inv);
  1450. NewGamePlusReplaceItem('Kaer Morhen Boots 3','NGP Kaer Morhen Boots 3', inv);
  1451. NewGamePlusReplaceItem('Kaer Morhen Gloves','NGP Kaer Morhen Gloves', inv);
  1452. NewGamePlusReplaceItem('Kaer Morhen Gloves 1','NGP Kaer Morhen Gloves 1', inv);
  1453. NewGamePlusReplaceItem('Kaer Morhen Gloves 2','NGP Kaer Morhen Gloves 2', inv);
  1454. NewGamePlusReplaceItem('Kaer Morhen Gloves 3','NGP Kaer Morhen Gloves 3', inv);
  1455. }
  1456.  
  1457. private final function NewGamePlusReplaceViperSet(out inv : CInventoryComponent)
  1458. {
  1459. NewGamePlusReplaceItem('Viper School steel sword', 'NGP Viper School steel sword', inv);
  1460.  
  1461. NewGamePlusReplaceItem('Viper School silver sword', 'NGP Viper School silver sword', inv);
  1462. }
  1463.  
  1464. private final function NewGamePlusReplaceLynxSet(out inv : CInventoryComponent)
  1465. {
  1466. NewGamePlusReplaceItem('Lynx Armor', 'NGP Lynx Armor', inv);
  1467. NewGamePlusReplaceItem('Lynx Armor 1', 'NGP Lynx Armor 1', inv);
  1468. NewGamePlusReplaceItem('Lynx Armor 2', 'NGP Lynx Armor 2', inv);
  1469. NewGamePlusReplaceItem('Lynx Armor 3', 'NGP Lynx Armor 3', inv);
  1470.  
  1471. NewGamePlusReplaceItem('Lynx Gloves 1', 'NGP Lynx Gloves 1', inv);
  1472. NewGamePlusReplaceItem('Lynx Gloves 2', 'NGP Lynx Gloves 2', inv);
  1473. NewGamePlusReplaceItem('Lynx Gloves 3', 'NGP Lynx Gloves 3', inv);
  1474. NewGamePlusReplaceItem('Lynx Gloves 4', 'NGP Lynx Gloves 4', inv);
  1475.  
  1476. NewGamePlusReplaceItem('Lynx Pants 1', 'NGP Lynx Pants 1', inv);
  1477. NewGamePlusReplaceItem('Lynx Pants 2', 'NGP Lynx Pants 2', inv);
  1478. NewGamePlusReplaceItem('Lynx Pants 3', 'NGP Lynx Pants 3', inv);
  1479. NewGamePlusReplaceItem('Lynx Pants 4', 'NGP Lynx Pants 4', inv);
  1480.  
  1481. NewGamePlusReplaceItem('Lynx Boots 1', 'NGP Lynx Boots 1', inv);
  1482. NewGamePlusReplaceItem('Lynx Boots 2', 'NGP Lynx Boots 2', inv);
  1483. NewGamePlusReplaceItem('Lynx Boots 3', 'NGP Lynx Boots 3', inv);
  1484. NewGamePlusReplaceItem('Lynx Boots 4', 'NGP Lynx Boots 4', inv);
  1485.  
  1486. NewGamePlusReplaceItem('Lynx School steel sword', 'NGP Lynx School steel sword', inv);
  1487. NewGamePlusReplaceItem('Lynx School steel sword 1', 'NGP Lynx School steel sword 1', inv);
  1488. NewGamePlusReplaceItem('Lynx School steel sword 2', 'NGP Lynx School steel sword 2', inv);
  1489. NewGamePlusReplaceItem('Lynx School steel sword 3', 'NGP Lynx School steel sword 3', inv);
  1490.  
  1491. NewGamePlusReplaceItem('Lynx School silver sword', 'NGP Lynx School silver sword', inv);
  1492. NewGamePlusReplaceItem('Lynx School silver sword 1', 'NGP Lynx School silver sword 1', inv);
  1493. NewGamePlusReplaceItem('Lynx School silver sword 2', 'NGP Lynx School silver sword 2', inv);
  1494. NewGamePlusReplaceItem('Lynx School silver sword 3', 'NGP Lynx School silver sword 3', inv);
  1495. }
  1496.  
  1497. private final function NewGamePlusReplaceGryphonSet(out inv : CInventoryComponent)
  1498. {
  1499. NewGamePlusReplaceItem('Gryphon Armor', 'NGP Gryphon Armor', inv);
  1500. NewGamePlusReplaceItem('Gryphon Armor 1', 'NGP Gryphon Armor 1', inv);
  1501. NewGamePlusReplaceItem('Gryphon Armor 2', 'NGP Gryphon Armor 2', inv);
  1502. NewGamePlusReplaceItem('Gryphon Armor 3', 'NGP Gryphon Armor 3', inv);
  1503.  
  1504. NewGamePlusReplaceItem('Gryphon Gloves 1', 'NGP Gryphon Gloves 1', inv);
  1505. NewGamePlusReplaceItem('Gryphon Gloves 2', 'NGP Gryphon Gloves 2', inv);
  1506. NewGamePlusReplaceItem('Gryphon Gloves 3', 'NGP Gryphon Gloves 3', inv);
  1507. NewGamePlusReplaceItem('Gryphon Gloves 4', 'NGP Gryphon Gloves 4', inv);
  1508.  
  1509. NewGamePlusReplaceItem('Gryphon Pants 1', 'NGP Gryphon Pants 1', inv);
  1510. NewGamePlusReplaceItem('Gryphon Pants 2', 'NGP Gryphon Pants 2', inv);
  1511. NewGamePlusReplaceItem('Gryphon Pants 3', 'NGP Gryphon Pants 3', inv);
  1512. NewGamePlusReplaceItem('Gryphon Pants 4', 'NGP Gryphon Pants 4', inv);
  1513.  
  1514. NewGamePlusReplaceItem('Gryphon Boots 1', 'NGP Gryphon Boots 1', inv);
  1515. NewGamePlusReplaceItem('Gryphon Boots 2', 'NGP Gryphon Boots 2', inv);
  1516. NewGamePlusReplaceItem('Gryphon Boots 3', 'NGP Gryphon Boots 3', inv);
  1517. NewGamePlusReplaceItem('Gryphon Boots 4', 'NGP Gryphon Boots 4', inv);
  1518.  
  1519. NewGamePlusReplaceItem('Gryphon School steel sword', 'NGP Gryphon School steel sword', inv);
  1520. NewGamePlusReplaceItem('Gryphon School steel sword 1', 'NGP Gryphon School steel sword 1', inv);
  1521. NewGamePlusReplaceItem('Gryphon School steel sword 2', 'NGP Gryphon School steel sword 2', inv);
  1522. NewGamePlusReplaceItem('Gryphon School steel sword 3', 'NGP Gryphon School steel sword 3', inv);
  1523.  
  1524. NewGamePlusReplaceItem('Gryphon School silver sword', 'NGP Gryphon School silver sword', inv);
  1525. NewGamePlusReplaceItem('Gryphon School silver sword 1', 'NGP Gryphon School silver sword 1', inv);
  1526. NewGamePlusReplaceItem('Gryphon School silver sword 2', 'NGP Gryphon School silver sword 2', inv);
  1527. NewGamePlusReplaceItem('Gryphon School silver sword 3', 'NGP Gryphon School silver sword 3', inv);
  1528. }
  1529.  
  1530. private final function NewGamePlusReplaceBearSet(out inv : CInventoryComponent)
  1531. {
  1532. NewGamePlusReplaceItem('Bear Armor', 'NGP Bear Armor', inv);
  1533. NewGamePlusReplaceItem('Bear Armor 1', 'NGP Bear Armor 1', inv);
  1534. NewGamePlusReplaceItem('Bear Armor 2', 'NGP Bear Armor 2', inv);
  1535. NewGamePlusReplaceItem('Bear Armor 3', 'NGP Bear Armor 3', inv);
  1536.  
  1537. NewGamePlusReplaceItem('Bear Gloves 1', 'NGP Bear Gloves 1', inv);
  1538. NewGamePlusReplaceItem('Bear Gloves 2', 'NGP Bear Gloves 2', inv);
  1539. NewGamePlusReplaceItem('Bear Gloves 3', 'NGP Bear Gloves 3', inv);
  1540. NewGamePlusReplaceItem('Bear Gloves 4', 'NGP Bear Gloves 4', inv);
  1541.  
  1542. NewGamePlusReplaceItem('Bear Pants 1', 'NGP Bear Pants 1', inv);
  1543. NewGamePlusReplaceItem('Bear Pants 2', 'NGP Bear Pants 2', inv);
  1544. NewGamePlusReplaceItem('Bear Pants 3', 'NGP Bear Pants 3', inv);
  1545. NewGamePlusReplaceItem('Bear Pants 4', 'NGP Bear Pants 4', inv);
  1546.  
  1547. NewGamePlusReplaceItem('Bear Boots 1', 'NGP Bear Boots 1', inv);
  1548. NewGamePlusReplaceItem('Bear Boots 2', 'NGP Bear Boots 2', inv);
  1549. NewGamePlusReplaceItem('Bear Boots 3', 'NGP Bear Boots 3', inv);
  1550. NewGamePlusReplaceItem('Bear Boots 4', 'NGP Bear Boots 4', inv);
  1551.  
  1552. NewGamePlusReplaceItem('Bear School steel sword', 'NGP Bear School steel sword', inv);
  1553. NewGamePlusReplaceItem('Bear School steel sword 1', 'NGP Bear School steel sword 1', inv);
  1554. NewGamePlusReplaceItem('Bear School steel sword 2', 'NGP Bear School steel sword 2', inv);
  1555. NewGamePlusReplaceItem('Bear School steel sword 3', 'NGP Bear School steel sword 3', inv);
  1556.  
  1557. NewGamePlusReplaceItem('Bear School silver sword', 'NGP Bear School silver sword', inv);
  1558. NewGamePlusReplaceItem('Bear School silver sword 1', 'NGP Bear School silver sword 1', inv);
  1559. NewGamePlusReplaceItem('Bear School silver sword 2', 'NGP Bear School silver sword 2', inv);
  1560. NewGamePlusReplaceItem('Bear School silver sword 3', 'NGP Bear School silver sword 3', inv);
  1561. }
  1562.  
  1563. private final function NewGamePlusReplaceEP1(out inv : CInventoryComponent)
  1564. {
  1565. NewGamePlusReplaceItem('Ofir Armor', 'NGP Ofir Armor', inv);
  1566. NewGamePlusReplaceItem('Ofir Sabre 2', 'NGP Ofir Sabre 2', inv);
  1567.  
  1568. NewGamePlusReplaceItem('Crafted Burning Rose Armor', 'NGP Crafted Burning Rose Armor', inv);
  1569. NewGamePlusReplaceItem('Crafted Burning Rose Gloves', 'NGP Crafted Burning Rose Gloves', inv);
  1570. NewGamePlusReplaceItem('Crafted Burning Rose Sword', 'NGP Crafted Burning Rose Sword', inv);
  1571.  
  1572. NewGamePlusReplaceItem('Crafted Ofir Armor', 'NGP Crafted Ofir Armor', inv);
  1573. NewGamePlusReplaceItem('Crafted Ofir Boots', 'NGP Crafted Ofir Boots', inv);
  1574. NewGamePlusReplaceItem('Crafted Ofir Gloves', 'NGP Crafted Ofir Gloves', inv);
  1575. NewGamePlusReplaceItem('Crafted Ofir Pants', 'NGP Crafted Ofir Pants', inv);
  1576. NewGamePlusReplaceItem('Crafted Ofir Steel Sword', 'NGP Crafted Ofir Steel Sword', inv);
  1577.  
  1578. NewGamePlusReplaceItem('EP1 Crafted Witcher Silver Sword', 'NGP EP1 Crafted Witcher Silver Sword', inv);
  1579. //NewGamePlusReplaceItem('Olgierd Sabre', 'NGP Olgierd Sabre', inv);
  1580.  
  1581. NewGamePlusReplaceItem('EP1 Witcher Armor', 'NGP EP1 Witcher Armor', inv);
  1582. NewGamePlusReplaceItem('EP1 Witcher Boots', 'NGP EP1 Witcher Boots', inv);
  1583. NewGamePlusReplaceItem('EP1 Witcher Gloves', 'NGP EP1 Witcher Gloves', inv);
  1584. NewGamePlusReplaceItem('EP1 Witcher Pants', 'NGP EP1 Witcher Pants', inv);
  1585. NewGamePlusReplaceItem('EP1 Viper School steel sword', 'NGP EP1 Viper School steel sword', inv);
  1586. NewGamePlusReplaceItem('EP1 Viper School silver sword', 'NGP EP1 Viper School silver sword', inv);
  1587. }
  1588.  
  1589. private final function NewGamePlusReplaceEP2WitcherSets(out inv : CInventoryComponent)
  1590. {
  1591. NewGamePlusReplaceItem('Lynx Armor 4', 'NGP Lynx Armor 4', inv);
  1592. NewGamePlusReplaceItem('Gryphon Armor 4', 'NGP Gryphon Armor 4', inv);
  1593. NewGamePlusReplaceItem('Bear Armor 4', 'NGP Bear Armor 4', inv);
  1594. NewGamePlusReplaceItem('Wolf Armor 4', 'NGP Wolf Armor 4', inv);
  1595. NewGamePlusReplaceItem('Red Wolf Armor 1', 'NGP Red Wolf Armor 1', inv);
  1596.  
  1597. NewGamePlusReplaceItem('Lynx Gloves 5', 'NGP Lynx Gloves 5', inv);
  1598. NewGamePlusReplaceItem('Gryphon Gloves 5', 'NGP Gryphon Gloves 5', inv);
  1599. NewGamePlusReplaceItem('Bear Gloves 5', 'NGP Bear Gloves 5', inv);
  1600. NewGamePlusReplaceItem('Wolf Gloves 5', 'NGP Wolf Gloves 5', inv);
  1601. NewGamePlusReplaceItem('Red Wolf Gloves 1', 'NGP Red Wolf Gloves 1', inv);
  1602.  
  1603. NewGamePlusReplaceItem('Lynx Pants 5', 'NGP Lynx Pants 5', inv);
  1604. NewGamePlusReplaceItem('Gryphon Pants 5', 'NGP Gryphon Pants 5', inv);
  1605. NewGamePlusReplaceItem('Bear Pants 5', 'NGP Bear Pants 5', inv);
  1606. NewGamePlusReplaceItem('Wolf Pants 5', 'NGP Wolf Pants 5', inv);
  1607. NewGamePlusReplaceItem('Red Wolf Pants 1', 'NGP Red Wolf Pants 1', inv);
  1608.  
  1609. NewGamePlusReplaceItem('Lynx Boots 5', 'NGP Lynx Boots 5', inv);
  1610. NewGamePlusReplaceItem('Gryphon Boots 5', 'NGP Gryphon Boots 5', inv);
  1611. NewGamePlusReplaceItem('Bear Boots 5', 'NGP Bear Boots 5', inv);
  1612. NewGamePlusReplaceItem('Wolf Boots 5', 'NGP Wolf Boots 5', inv);
  1613. NewGamePlusReplaceItem('Red Wolf Boots 1', 'NGP Red Wolf Boots 1', inv);
  1614.  
  1615.  
  1616. NewGamePlusReplaceItem('Lynx School steel sword 4', 'NGP Lynx School steel sword 4', inv);
  1617. NewGamePlusReplaceItem('Gryphon School steel sword 4', 'NGP Gryphon School steel sword 4', inv);
  1618. NewGamePlusReplaceItem('Bear School steel sword 4', 'NGP Bear School steel sword 4', inv);
  1619. NewGamePlusReplaceItem('Wolf School steel sword 4', 'NGP Wolf School steel sword 4', inv);
  1620. NewGamePlusReplaceItem('Red Wolf School steel sword 1', 'NGP Red Wolf School steel sword 1', inv);
  1621.  
  1622. NewGamePlusReplaceItem('Lynx School silver sword 4', 'NGP Lynx School silver sword 4', inv);
  1623. NewGamePlusReplaceItem('Gryphon School silver sword 4', 'NGP Gryphon School silver sword 4', inv);
  1624. NewGamePlusReplaceItem('Bear School silver sword 4', 'NGP Bear School silver sword 4', inv);
  1625. NewGamePlusReplaceItem('Wolf School silver sword 4', 'NGP Wolf School silver sword 4', inv);
  1626. NewGamePlusReplaceItem('Red Wolf School silver sword 1', 'NGP Red Wolf School silver sword 1', inv);
  1627. }
  1628.  
  1629. private final function NewGamePlusReplaceEP2Items(out inv : CInventoryComponent)
  1630. {
  1631. NewGamePlusReplaceItem('Guard Lvl1 Armor 3', 'NGP Guard Lvl1 Armor 3', inv);
  1632. NewGamePlusReplaceItem('Guard Lvl1 A Armor 3', 'NGP Guard Lvl1 A Armor 3', inv);
  1633. NewGamePlusReplaceItem('Guard Lvl2 Armor 3', 'NGP Guard Lvl2 Armor 3', inv);
  1634. NewGamePlusReplaceItem('Guard Lvl2 A Armor 3', 'NGP Guard Lvl2 A Armor 3', inv);
  1635. NewGamePlusReplaceItem('Knight Geralt Armor 3', 'NGP Knight Geralt Armor 3', inv);
  1636. NewGamePlusReplaceItem('Knight Geralt A Armor 3', 'NGP Knight Geralt A Armor 3', inv);
  1637. //NewGamePlusReplaceItem('q702_vampire_armor', 'NGP q702_vampire_armor', inv);
  1638.  
  1639. NewGamePlusReplaceItem('Guard Lvl1 Gloves 3', 'NGP Guard Lvl1 Gloves 3', inv);
  1640. NewGamePlusReplaceItem('Guard Lvl1 A Gloves 3', 'NGP Guard Lvl1 A Gloves 3', inv);
  1641. NewGamePlusReplaceItem('Guard Lvl2 Gloves 3', 'NGP Guard Lvl2 Gloves 3', inv);
  1642. NewGamePlusReplaceItem('Guard Lvl2 A Gloves 3', 'NGP Guard Lvl2 A Gloves 3', inv);
  1643. NewGamePlusReplaceItem('Knight Geralt Gloves 3', 'NGP Knight Geralt Gloves 3', inv);
  1644. NewGamePlusReplaceItem('Knight Geralt A Gloves 3', 'NGP Knight Geralt A Gloves 3', inv);
  1645. //NewGamePlusReplaceItem('q702_vampire_gloves', 'NGP q702_vampire_gloves', inv);
  1646.  
  1647. NewGamePlusReplaceItem('Guard Lvl1 Pants 3', 'NGP Guard Lvl1 Pants 3', inv);
  1648. NewGamePlusReplaceItem('Guard Lvl1 A Pants 3', 'NGP Guard Lvl1 A Pants 3', inv);
  1649. NewGamePlusReplaceItem('Guard Lvl2 Pants 3', 'NGP Guard Lvl2 Pants 3', inv);
  1650. NewGamePlusReplaceItem('Guard Lvl2 A Pants 3', 'NGP Guard Lvl2 A Pants 3', inv);
  1651. NewGamePlusReplaceItem('Knight Geralt Pants 3', 'NGP Knight Geralt Pants 3', inv);
  1652. NewGamePlusReplaceItem('Knight Geralt A Pants 3', 'NGP Knight Geralt A Pants 3', inv);
  1653. //NewGamePlusReplaceItem('q702_vampire_pants', 'NGP q702_vampire_pants', inv);
  1654.  
  1655. NewGamePlusReplaceItem('Guard Lvl1 Boots 3', 'NGP Guard Lvl1 Boots 3', inv);
  1656. NewGamePlusReplaceItem('Guard Lvl1 A Boots 3', 'NGP Guard Lvl1 A Boots 3', inv);
  1657. NewGamePlusReplaceItem('Guard Lvl2 Boots 3', 'NGP Guard Lvl2 Boots 3', inv);
  1658. NewGamePlusReplaceItem('Guard Lvl2 A Boots 3', 'NGP Guard Lvl2 A Boots 3', inv);
  1659. NewGamePlusReplaceItem('Knight Geralt Boots 3', 'NGP Knight Geralt Boots 3', inv);
  1660. NewGamePlusReplaceItem('Knight Geralt A Boots 3', 'NGP Knight Geralt A Boots 3', inv);
  1661. //NewGamePlusReplaceItem('q702_vampire_boots', 'NGP q702_vampire_boots', inv);
  1662.  
  1663. NewGamePlusReplaceItem('Serpent Steel Sword 1', 'NGP Serpent Steel Sword 1', inv);
  1664. NewGamePlusReplaceItem('Serpent Steel Sword 2', 'NGP Serpent Steel Sword 2', inv);
  1665. NewGamePlusReplaceItem('Serpent Steel Sword 3', 'NGP Serpent Steel Sword 3', inv);
  1666. NewGamePlusReplaceItem('Guard lvl1 steel sword 3', 'NGP Guard lvl1 steel sword 3', inv);
  1667. NewGamePlusReplaceItem('Guard lvl2 steel sword 3', 'NGP Guard lvl2 steel sword 3', inv);
  1668. NewGamePlusReplaceItem('Knights steel sword 3', 'NGP Knights steel sword 3', inv);
  1669. NewGamePlusReplaceItem('Hanza steel sword 3', 'NGP Hanza steel sword 3', inv);
  1670. NewGamePlusReplaceItem('Toussaint steel sword 3', 'NGP Toussaint steel sword 3', inv);
  1671. //NewGamePlusReplaceItem('q702 vampire steel sword', 'NGP q702 vampire steel sword', inv);
  1672.  
  1673. NewGamePlusReplaceItem('Serpent Silver Sword 1', 'NGP Serpent Silver Sword 1', inv);
  1674. NewGamePlusReplaceItem('Serpent Silver Sword 2', 'NGP Serpent Silver Sword 2', inv);
  1675. NewGamePlusReplaceItem('Serpent Silver Sword 3', 'NGP Serpent Silver Sword 3', inv);
  1676. }
  1677.  
  1678. public function GetEquippedSword(steel : bool) : SItemUniqueId
  1679. {
  1680. var item : SItemUniqueId;
  1681.  
  1682. if(steel)
  1683. GetItemEquippedOnSlot(EES_SteelSword, item);
  1684. else
  1685. GetItemEquippedOnSlot(EES_SilverSword, item);
  1686.  
  1687. return item;
  1688. }
  1689.  
  1690. timer function BroadcastRain( deltaTime : float, id : int )
  1691. {
  1692. var rainStrength : float = 0;
  1693. rainStrength = GetRainStrength();
  1694. if( rainStrength > 0.5 )
  1695. {
  1696. theGame.GetBehTreeReactionManager().CreateReactionEventIfPossible( thePlayer, 'RainAction', 2.0f , 50.0f, -1.f, -1, true);
  1697. LogReactionSystem( "'RainAction' was sent by Player - single broadcast - distance: 50.0" );
  1698. }
  1699. }
  1700.  
  1701. function InitializeParryType()
  1702. {
  1703. var i, j : int;
  1704.  
  1705. parryTypeTable.Resize( EnumGetMax('EAttackSwingType')+1 );
  1706. for( i = 0; i < EnumGetMax('EAttackSwingType')+1; i += 1 )
  1707. {
  1708. parryTypeTable[i].Resize( EnumGetMax('EAttackSwingDirection')+1 );
  1709. }
  1710. parryTypeTable[AST_Horizontal][ASD_UpDown] = PT_None;
  1711. parryTypeTable[AST_Horizontal][ASD_DownUp] = PT_None;
  1712. parryTypeTable[AST_Horizontal][ASD_LeftRight] = PT_Left;
  1713. parryTypeTable[AST_Horizontal][ASD_RightLeft] = PT_Right;
  1714. parryTypeTable[AST_Vertical][ASD_UpDown] = PT_Up;
  1715. parryTypeTable[AST_Vertical][ASD_DownUp] = PT_Down;
  1716. parryTypeTable[AST_Vertical][ASD_LeftRight] = PT_None;
  1717. parryTypeTable[AST_Vertical][ASD_RightLeft] = PT_None;
  1718. parryTypeTable[AST_DiagonalUp][ASD_UpDown] = PT_None;
  1719. parryTypeTable[AST_DiagonalUp][ASD_DownUp] = PT_None;
  1720. parryTypeTable[AST_DiagonalUp][ASD_LeftRight] = PT_UpLeft;
  1721. parryTypeTable[AST_DiagonalUp][ASD_RightLeft] = PT_RightUp;
  1722. parryTypeTable[AST_DiagonalDown][ASD_UpDown] = PT_None;
  1723. parryTypeTable[AST_DiagonalDown][ASD_DownUp] = PT_None;
  1724. parryTypeTable[AST_DiagonalDown][ASD_LeftRight] = PT_LeftDown;
  1725. parryTypeTable[AST_DiagonalDown][ASD_RightLeft] = PT_DownRight;
  1726. parryTypeTable[AST_Jab][ASD_UpDown] = PT_Jab;
  1727. parryTypeTable[AST_Jab][ASD_DownUp] = PT_Jab;
  1728. parryTypeTable[AST_Jab][ASD_LeftRight] = PT_Jab;
  1729. parryTypeTable[AST_Jab][ASD_RightLeft] = PT_Jab;
  1730. }
  1731.  
  1732.  
  1733.  
  1734.  
  1735.  
  1736.  
  1737. event OnDeath( damageAction : W3DamageAction )
  1738. {
  1739. var items : array< SItemUniqueId >;
  1740. var i, size : int;
  1741. var slot : EEquipmentSlots;
  1742. var holdSlot : name;
  1743.  
  1744. super.OnDeath( damageAction );
  1745.  
  1746. items = GetHeldItems();
  1747.  
  1748. if( rangedWeapon && rangedWeapon.GetCurrentStateName() != 'State_WeaponWait')
  1749. {
  1750. OnRangedForceHolster( true, true, true );
  1751. rangedWeapon.ClearDeployedEntity(true);
  1752. }
  1753.  
  1754. size = items.Size();
  1755.  
  1756. if ( size > 0 )
  1757. {
  1758. for ( i = 0; i < size; i += 1 )
  1759. {
  1760. if ( this.inv.IsIdValid( items[i] ) && !( this.inv.IsItemCrossbow( items[i] ) ) )
  1761. {
  1762. holdSlot = this.inv.GetItemHoldSlot( items[i] );
  1763.  
  1764. if ( holdSlot == 'l_weapon' && this.IsHoldingItemInLHand() )
  1765. {
  1766. this.OnUseSelectedItem( true );
  1767. }
  1768.  
  1769. DropItemFromSlot( holdSlot, false );
  1770.  
  1771. if ( holdSlot == 'r_weapon' )
  1772. {
  1773. slot = this.GetItemSlot( items[i] );
  1774. if ( UnequipItemFromSlot( slot ) )
  1775. Log( "Unequip" );
  1776. }
  1777. }
  1778. }
  1779. }
  1780. }
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.  
  1787.  
  1788. function HandleMovement( deltaTime : float )
  1789. {
  1790. super.HandleMovement( deltaTime );
  1791.  
  1792. rawCameraHeading = theCamera.GetCameraHeading();
  1793. }
  1794.  
  1795.  
  1796.  
  1797.  
  1798.  
  1799.  
  1800.  
  1801. function ToggleSpecialAttackHeavyAllowed( toggle : bool)
  1802. {
  1803. specialAttackHeavyAllowed = toggle;
  1804. }
  1805.  
  1806. function GetReputationManager() : W3Reputation
  1807. {
  1808. return reputationManager;
  1809. }
  1810.  
  1811. function OnRadialMenuItemChoose( selectedItem : string )
  1812. {
  1813. var iSlotId : int;
  1814. var item : SItemUniqueId;
  1815.  
  1816. if ( selectedItem != "Crossbow" )
  1817. {
  1818. if ( rangedWeapon && rangedWeapon.GetCurrentStateName() != 'State_WeaponWait' )
  1819. OnRangedForceHolster( true, false );
  1820. }
  1821.  
  1822.  
  1823. switch(selectedItem)
  1824. {
  1825.  
  1826. case "Meditation":
  1827. theGame.RequestMenuWithBackground( 'MeditationClockMenu', 'CommonMenu' );
  1828. break;
  1829. // -= WMK:modQuickSlots =-
  1830. /*
  1831. case "Slot1":
  1832. GetItemEquippedOnSlot( EES_Petard1, item );
  1833. if( thePlayer.inv.IsIdValid( item ) )
  1834. {
  1835. SelectQuickslotItem( EES_Petard1 );
  1836. }
  1837. else
  1838. {
  1839. SelectQuickslotItem( EES_Petard2 );
  1840. }
  1841. break;
  1842.  
  1843. case "Slot2":
  1844. GetItemEquippedOnSlot( EES_Petard2, item );
  1845. if( thePlayer.inv.IsIdValid( item ) )
  1846. {
  1847. SelectQuickslotItem( EES_Petard2 );
  1848. }
  1849. else
  1850. {
  1851. SelectQuickslotItem( EES_Petard1 );
  1852. }
  1853. break;
  1854. */
  1855. case "Slot1":
  1856. SelectQuickslotItem(EES_Petard1);
  1857. break;
  1858. case "Slot2":
  1859. SelectQuickslotItem(EES_Petard2);
  1860. break;
  1861. case "Slot5":
  1862. SelectQuickslotItem(EES_Petard3);
  1863. break;
  1864. case "Slot6":
  1865. SelectQuickslotItem(EES_Petard4);
  1866. break;
  1867. // -= WMK:modQuickSlots =-
  1868.  
  1869. case "Crossbow":
  1870. SelectQuickslotItem(EES_RangedWeapon);
  1871. break;
  1872.  
  1873. case "Slot3":
  1874. GetItemEquippedOnSlot( EES_Quickslot1, item );
  1875. if( thePlayer.inv.IsIdValid( item ) )
  1876. {
  1877. SelectQuickslotItem( EES_Quickslot1 );
  1878. }
  1879. else
  1880. {
  1881. SelectQuickslotItem( EES_Quickslot2 );
  1882. }
  1883. break;
  1884.  
  1885. case "Slot4":
  1886. GetItemEquippedOnSlot( EES_Quickslot2, item );
  1887. if( thePlayer.inv.IsIdValid( item ) )
  1888. {
  1889. SelectQuickslotItem( EES_Quickslot2 );
  1890. }
  1891. else
  1892. {
  1893. SelectQuickslotItem( EES_Quickslot1 );
  1894. }
  1895. break;
  1896.  
  1897. default:
  1898. SetEquippedSign(SignStringToEnum( selectedItem ));
  1899. FactsRemove("SignToggled");
  1900. break;
  1901. }
  1902. }
  1903.  
  1904. function ToggleNextItem()
  1905. {
  1906. var quickSlotItems : array< EEquipmentSlots >;
  1907. var currentSelectedItem : SItemUniqueId;
  1908. var item : SItemUniqueId;
  1909. var i : int;
  1910.  
  1911. for( i = EES_Quickslot2; i > EES_Petard1 - 1; i -= 1 )
  1912. {
  1913. GetItemEquippedOnSlot( i, item );
  1914. if( inv.IsIdValid( item ) )
  1915. {
  1916. quickSlotItems.PushBack( i );
  1917. }
  1918. }
  1919. if( !quickSlotItems.Size() )
  1920. {
  1921. return;
  1922. }
  1923.  
  1924. currentSelectedItem = GetSelectedItemId();
  1925.  
  1926. if( inv.IsIdValid( currentSelectedItem ) )
  1927. {
  1928. for( i = 0; i < quickSlotItems.Size(); i += 1 )
  1929. {
  1930. GetItemEquippedOnSlot( quickSlotItems[i], item );
  1931. if( currentSelectedItem == item )
  1932. {
  1933. if( i == quickSlotItems.Size() - 1 )
  1934. {
  1935. SelectQuickslotItem( quickSlotItems[ 0 ] );
  1936. }
  1937. else
  1938. {
  1939. SelectQuickslotItem( quickSlotItems[ i + 1 ] );
  1940. }
  1941. return;
  1942. }
  1943. }
  1944. }
  1945. else
  1946. {
  1947. SelectQuickslotItem( quickSlotItems[ 0 ] );
  1948. }
  1949. }
  1950.  
  1951.  
  1952. function SetEquippedSign( signType : ESignType )
  1953. {
  1954. if(!IsSignBlocked(signType))
  1955. {
  1956. equippedSign = signType;
  1957. FactsSet("CurrentlySelectedSign", equippedSign);
  1958. }
  1959. }
  1960.  
  1961. function GetEquippedSign() : ESignType
  1962. {
  1963. return equippedSign;
  1964. }
  1965.  
  1966. function GetCurrentlyCastSign() : ESignType
  1967. {
  1968. return currentlyCastSign;
  1969. }
  1970.  
  1971. function SetCurrentlyCastSign( type : ESignType, entity : W3SignEntity )
  1972. {
  1973. currentlyCastSign = type;
  1974.  
  1975. if( type != ST_None )
  1976. {
  1977. signs[currentlyCastSign].entity = entity;
  1978. }
  1979. }
  1980.  
  1981. function GetCurrentSignEntity() : W3SignEntity
  1982. {
  1983. if(currentlyCastSign == ST_None)
  1984. return NULL;
  1985.  
  1986. return signs[currentlyCastSign].entity;
  1987. }
  1988.  
  1989. public function GetSignEntity(type : ESignType) : W3SignEntity
  1990. {
  1991. if(type == ST_None)
  1992. return NULL;
  1993.  
  1994. return signs[type].entity;
  1995. }
  1996.  
  1997. public function GetSignTemplate(type : ESignType) : CEntityTemplate
  1998. {
  1999. if(type == ST_None)
  2000. return NULL;
  2001.  
  2002. return signs[type].template;
  2003. }
  2004.  
  2005. public function IsCurrentSignChanneled() : bool
  2006. {
  2007. if( currentlyCastSign != ST_None && signs[currentlyCastSign].entity)
  2008. return signs[currentlyCastSign].entity.OnCheckChanneling();
  2009.  
  2010. return false;
  2011. }
  2012.  
  2013. function IsCastingSign() : bool
  2014. {
  2015. return currentlyCastSign != ST_None;
  2016. }
  2017.  
  2018.  
  2019. protected function IsInCombatActionCameraRotationEnabled() : bool
  2020. {
  2021. if( IsInCombatAction() && ( GetCombatAction() == EBAT_EMPTY || GetCombatAction() == EBAT_Parry ) )
  2022. {
  2023. return true;
  2024. }
  2025.  
  2026. return !bIsInCombatAction;
  2027. }
  2028.  
  2029. function SetHoldBeforeOpenRadialMenuTime ( time : float )
  2030. {
  2031. _HoldBeforeOpenRadialMenuTime = time;
  2032. }
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040. public function RepairItem ( rapairKitId : SItemUniqueId, usedOnItem : SItemUniqueId )
  2041. {
  2042. var itemMaxDurablity : float;
  2043. var itemCurrDurablity : float;
  2044. var baseRepairValue : float;
  2045. var reapirValue : float;
  2046. var itemAttribute : SAbilityAttributeValue;
  2047. //var dmgBoost : float; //modSigns
  2048.  
  2049. itemMaxDurablity = inv.GetItemMaxDurability(usedOnItem);
  2050. itemCurrDurablity = inv.GetItemDurability(usedOnItem);
  2051. itemAttribute = inv.GetItemAttributeValue ( rapairKitId, 'repairValue' );
  2052.  
  2053. /*if( itemCurrDurablity >= itemMaxDurablity )
  2054. {
  2055. return;
  2056. }*/ //modSigns
  2057.  
  2058. if ( inv.IsItemAnyArmor ( usedOnItem )|| inv.IsItemWeapon( usedOnItem ) )
  2059. {
  2060. //modSigns: master repair kits increase item level
  2061. if( inv.ItemHasTag( rapairKitId, 'ArmorReapairKit_Master' ) || inv.ItemHasTag( rapairKitId, 'WeaponReapairKit_Master' ) )
  2062. {
  2063. inv.AddItemLevelAbility( usedOnItem );
  2064. //if( inv.ItemHasTag( usedOnItem, 'Aerondight' ) )
  2065. //{
  2066. // dmgBoost = inv.GetItemModifierFloat( usedOnItem, 'PermDamageBoost' );
  2067. // if( dmgBoost > 10 )
  2068. // inv.SetItemModifierFloat( usedOnItem, 'PermDamageBoost', dmgBoost - 10 );
  2069. //}
  2070. }
  2071.  
  2072. baseRepairValue = itemMaxDurablity * itemAttribute.valueMultiplicative;
  2073. reapirValue = MinF( itemCurrDurablity + baseRepairValue, itemMaxDurablity );
  2074.  
  2075. inv.SetItemDurabilityScript ( usedOnItem, MinF ( reapirValue, itemMaxDurablity ));
  2076. }
  2077.  
  2078. inv.RemoveItem ( rapairKitId, 1 );
  2079.  
  2080. }
  2081. public function HasRepairAbleGearEquiped ( ) : bool
  2082. {
  2083. var curEquipedItem : SItemUniqueId;
  2084.  
  2085. return ( GetItemEquippedOnSlot(EES_Armor, curEquipedItem) || GetItemEquippedOnSlot(EES_Boots, curEquipedItem) || GetItemEquippedOnSlot(EES_Pants, curEquipedItem) || GetItemEquippedOnSlot(EES_Gloves, curEquipedItem)) == true;
  2086. }
  2087. public function HasRepairAbleWaponEquiped () : bool
  2088. {
  2089. var curEquipedItem : SItemUniqueId;
  2090.  
  2091. return ( GetItemEquippedOnSlot(EES_SilverSword, curEquipedItem) || GetItemEquippedOnSlot(EES_SteelSword, curEquipedItem) ) == true;
  2092. }
  2093. public function IsItemRepairAble ( item : SItemUniqueId ) : bool
  2094. {
  2095. return inv.HasItemDurability(item); //inv.GetItemDurabilityRatio(item) <= 0.99999f; //modSigns
  2096. }
  2097.  
  2098.  
  2099.  
  2100.  
  2101.  
  2102.  
  2103.  
  2104.  
  2105. public function ApplyOil( oilId : SItemUniqueId, usedOnItem : SItemUniqueId ) : bool
  2106. {
  2107. var tutStateOil : W3TutorialManagerUIHandlerStateOils;
  2108.  
  2109. if( !super.ApplyOil( oilId, usedOnItem ))
  2110. return false;
  2111.  
  2112.  
  2113. if(ShouldProcessTutorial('TutorialOilCanEquip3'))
  2114. {
  2115. tutStateOil = (W3TutorialManagerUIHandlerStateOils)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
  2116. if(tutStateOil)
  2117. {
  2118. tutStateOil.OnOilApplied();
  2119. }
  2120. }
  2121.  
  2122. return true;
  2123. }
  2124.  
  2125. private final function RemoveExtraOilsFromItem( item : SItemUniqueId )
  2126. {
  2127. var oils : array< CBaseGameplayEffect >;
  2128. var i, cnt : int;
  2129. var buff : W3Effect_Oil;
  2130.  
  2131. oils = GetBuffs( EET_Oil );
  2132. for( i=0; i<oils.Size(); i+=1 )
  2133. {
  2134. buff = (W3Effect_Oil) oils[ i ];
  2135. if( buff && buff.GetSwordItemId() == item )
  2136. {
  2137. cnt += 1;
  2138. }
  2139. }
  2140. while( cnt > 1 )
  2141. {
  2142. inv.RemoveOldestOilFromItem( item );
  2143. cnt -= 1;
  2144. }
  2145. }
  2146.  
  2147.  
  2148.  
  2149.  
  2150.  
  2151.  
  2152.  
  2153.  
  2154. //modSigns: separate function for dodge
  2155. function DodgeDamage(out damageData : W3DamageAction)
  2156. {
  2157. var actorAttacker : CActor;
  2158. var attackRange : CAIAttackRange;
  2159. var safeAngleDist, angleDist, distToAttacker, damageReduction : float;
  2160. var attackName : name;
  2161. var isDodging, isIceGiantSpecial : bool;
  2162.  
  2163. super.DodgeDamage(damageData);
  2164.  
  2165. actorAttacker = (CActor)damageData.attacker;
  2166. //modSigns: fix dodge detection bug - shouldn't be needed anymore, but leaving it here just in case
  2167. isDodging = IsCurrentlyDodging() || IsInCombatAction() && ((int)GetBehaviorVariable( 'combatActionType' ) == CAT_Dodge || (int)GetBehaviorVariable( 'combatActionType' ) == CAT_Roll);
  2168.  
  2169. //modSigns: debug
  2170. if( FactsQuerySum( "modSigns_debug_reduce_damage" ) > 0 )
  2171. {
  2172. theGame.witcherLog.AddMessage("Is in combat action: " + (int)IsInCombatAction());
  2173. theGame.witcherLog.AddMessage("Player action: " + GetBehaviorVariable( 'combatActionType' ));
  2174. theGame.witcherLog.AddMessage("Player is dodging: " + isDodging);
  2175. }
  2176.  
  2177. if(actorAttacker && isDodging && !(damageData.IsActionEnvironment() || damageData.IsDoTDamage()))
  2178. {
  2179. attackName = actorAttacker.GetLastAttackRangeName();
  2180. angleDist = AbsF(AngleDistance(evadeHeading, actorAttacker.GetHeading()));
  2181. attackRange = theGame.GetAttackRangeForEntity(actorAttacker, attackName);
  2182. distToAttacker = VecDistance(this.GetWorldPosition(), damageData.attacker.GetWorldPosition());
  2183. isIceGiantSpecial = ( attackName == 'stomp' || attackName == 'anchor_special_far' || attackName == 'anchor_far' );
  2184. //Fleet Footed graze damage reduction
  2185. if( CanUseSkill(S_Sword_s09) )
  2186. damageReduction = CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s09, 's9_damage_reduction', false, true)) * GetSkillLevel(S_Sword_s09);
  2187. else
  2188. damageReduction = 0;
  2189. //attack can be dodged
  2190. if( damageData.CanBeDodged() )
  2191. {
  2192. //set up safe angle distance
  2193. safeAngleDist = 120;
  2194. if( HasAbility('ArmorTypeLightSetBonusAbility') )
  2195. safeAngleDist += CalculateAttributeValue(GetAbilityAttributeValue('ArmorTypeLightSetBonusAbility', 'dodge_safe_ange_dist_deg'));
  2196. safeAngleDist = ClampF( safeAngleDist, 0, 180 );
  2197. //check dodge success
  2198. if( angleDist <= safeAngleDist && !isIceGiantSpecial || isIceGiantSpecial && distToAttacker > attackRange.rangeMax * 0.75 )
  2199. {
  2200. if( theGame.CanLog() )
  2201. {
  2202. LogDMHits("W3PlayerWitcher.DodgeDamage: Attack dodged by player - no damage done", damageData);
  2203. }
  2204. damageData.SetWasDodged();
  2205. }
  2206. }
  2207. //graze damage reduction
  2208. if( !damageData.WasDodged() && damageReduction > 0 )
  2209. {
  2210. if( theGame.CanLog() )
  2211. {
  2212. LogDMHits("W3PlayerWitcher.DodgeDamage: reduced damage while dodging an attack", damageData );
  2213. }
  2214. damageData.SetGrazeDamageReduction(damageReduction);
  2215. }
  2216. //modSigns: debug
  2217. if( FactsQuerySum( "modSigns_debug_reduce_damage" ) > 0 )
  2218. {
  2219. theGame.witcherLog.AddMessage("Fleet Footed damage reduction: " + damageReduction);
  2220. theGame.witcherLog.AddMessage("Attack name: " + attackName);
  2221. theGame.witcherLog.AddMessage("Attack can be dodged: " + damageData.CanBeDodged());
  2222. theGame.witcherLog.AddMessage("Safe angle distance: " + safeAngleDist);
  2223. theGame.witcherLog.AddMessage("Attacker and evade angle distance: " + angleDist);
  2224. theGame.witcherLog.AddMessage("Attack range: " + attackRange.rangeMax);
  2225. theGame.witcherLog.AddMessage("Distance to attacker: " + distToAttacker);
  2226. theGame.witcherLog.AddMessage("Damage was dodged completely: " + damageData.WasDodged());
  2227. }
  2228. }
  2229. }
  2230.  
  2231. //modSigns: rewritten
  2232. function ReduceDamage(out damageData : W3DamageAction)
  2233. {
  2234. var quen : W3QuenEntity;
  2235. var min, max : SAbilityAttributeValue;
  2236. var /*currAdrenaline, adrenReducedDmg, focus,*/ chance : float;
  2237. var whirlDmgReduction : SAbilityAttributeValue;
  2238.  
  2239. super.ReduceDamage(damageData);
  2240.  
  2241. //new mutagen27 effect: prevent chain damage
  2242. if(HasBuff(EET_Mutagen27) && !(damageData.IsActionEnvironment() || damageData.IsDoTDamage()))
  2243. {
  2244. ((W3Mutagen27_Effect)GetBuff(EET_Mutagen27)).ReduceDamage(damageData);
  2245. }
  2246.  
  2247. //damage prevented
  2248. if(!damageData.DealsAnyDamage())
  2249. return;
  2250.  
  2251. //modSigns: dodge detection moved to separate function!
  2252. //reduce damage from dodging, if was partially dodged
  2253. if(damageData.IsGrazeDamage())
  2254. {
  2255. damageData.processedDmg.vitalityDamage *= ClampF( 1 - damageData.GetGrazeDamageReduction(), 0.05, 1 );
  2256. //modSigns: debug
  2257. if( FactsQuerySum( "modSigns_debug_reduce_damage" ) > 0 )
  2258. {
  2259. theGame.witcherLog.AddMessage("Is graze damage: " + damageData.IsGrazeDamage());
  2260. theGame.witcherLog.AddMessage("Graze damage reduction: " + damageData.GetGrazeDamageReduction());
  2261. }
  2262. }
  2263.  
  2264. quen = (W3QuenEntity)signs[ST_Quen].entity;
  2265.  
  2266. //Protective Coating damage reduction
  2267. if( !damageData.IsDoTDamage() && CanUseSkill(S_Alchemy_s05) )
  2268. {
  2269. damageData.processedDmg.vitalityDamage *= ClampF(1 - GetOilProtectionAgainstMonster(damageData), 0.f, 1.f);
  2270. //modSigns: debug
  2271. if( FactsQuerySum( "modSigns_debug_reduce_damage" ) > 0 )
  2272. {
  2273. theGame.witcherLog.AddMessage("Oil protection against monster: " + GetOilProtectionAgainstMonster(damageData));
  2274. }
  2275. }
  2276.  
  2277. //Mutated Skin passive ability -> changed
  2278. //if( IsMutationActive( EPMT_Mutation5 ) && !IsAnyQuenActive() && !damageData.IsDoTDamage() )
  2279. //{
  2280. // focus = GetStat( BCS_Focus );
  2281. // currAdrenaline = FloorF( focus );
  2282. // if( currAdrenaline >= 1 )
  2283. // {
  2284. // theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation5', 'mut5_dmg_red_perc', min, max );
  2285. // adrenReducedDmg = ( currAdrenaline * min.valueAdditive );
  2286. // damageData.processedDmg.vitalityDamage *= ClampF(1 - adrenReducedDmg, 0, 1);
  2287. //
  2288. //
  2289. // theGame.MutationHUDFeedback( MFT_PlayOnce );
  2290. //
  2291. // if( focus >= 3.f )
  2292. // {
  2293. // PlayEffect( 'mutation_5_stage_03' );
  2294. // }
  2295. // else if( focus >= 2.f )
  2296. // {
  2297. // PlayEffect( 'mutation_5_stage_02' );
  2298. // }
  2299. // else
  2300. // {
  2301. // PlayEffect( 'mutation_5_stage_01' );
  2302. // }
  2303. // }
  2304. //}
  2305.  
  2306. //modSigns: whirl incoming damage reduction
  2307. if( !damageData.IsDoTDamage() && GetStat(BCS_Focus) > 0 && IsDoingSpecialAttack(false) )
  2308. {
  2309. whirlDmgReduction = GetSkillAttributeValue(S_Sword_s01, 'whirl_dmg_reduction', false, true)
  2310. + GetSkillAttributeValue(S_Sword_s01, 'whirl_dmg_reduction_bonus_after_1', false, true) * (GetSkillLevel(S_Sword_s01) - 1);
  2311. damageData.processedDmg.vitalityDamage *= ClampF(1 - whirlDmgReduction.valueMultiplicative, 0.f, 1.f);
  2312. //DrainFocus(1);
  2313. //PauseFocusGain( true );
  2314. //AddTimer( 'ResumeFocusGain', 1.f );
  2315. //theGame.witcherLog.AddMessage("Whirl damage reduction."); //modSigns: debug
  2316. }
  2317.  
  2318. //modSigns: cast quen on projectile ability, moved here
  2319. if((!quen || !quen.IsAnyQuenActive()) && damageData.IsActionRanged() && !damageData.IsActionWitcherSign() && !damageData.IsDoTDamage() && !damageData.WasDodged())
  2320. {
  2321. chance = CalculateAttributeValue(GetAttributeValue('quen_chance_on_projectile'));
  2322. if(chance > 0)
  2323. {
  2324. chance = ClampF(chance, 0, 1);
  2325.  
  2326. if(RandF() < chance)
  2327. {
  2328. if(!quen)
  2329. {
  2330. quen = (W3QuenEntity)theGame.CreateEntity(signs[ST_Quen].template, GetWorldPosition(), GetWorldRotation() );
  2331. }
  2332. quen.Init(signOwner, signs[ST_Quen].entity, true );
  2333. quen.freeCast = true;
  2334. quen.OnStarted();
  2335. quen.OnThrowing();
  2336. quen.OnEnded();
  2337. if ( theGame.CanLog() )
  2338. {
  2339. LogDMHits("W3PlayerWitcher.ReduceDamage: Processing Quen On Projectile armor ability...", damageData);
  2340. }
  2341. //quen.OnTargetHit( damageData );
  2342. quen.ShowHitFX(); //modSigns: play FX
  2343. damageData.SetAllProcessedDamageAs(0);
  2344. damageData.SetEndsQuen(true);
  2345. }
  2346. }
  2347. }
  2348. //damage reduction from signs
  2349. //else if((quen && quen.IsAnyQuenActive()) && damageData.GetBuffSourceName() != "FallingDamage")
  2350. //{
  2351. // if ( theGame.CanLog() )
  2352. // {
  2353. // LogDMHits("W3PlayerWitcher.ReduceDamage: Processing Quen sign damage reduction...", damageData);
  2354. // }
  2355. // quen.OnTargetHit( damageData );
  2356. //} //modSigns: moved to damage manager to decrease raw damage
  2357.  
  2358. //modSigns: gryphon set tier 2 damage reduction - removed, adds resistances instead
  2359. /*if( HasBuff( EET_GryphonSetBonusYrden ) )
  2360. {
  2361. min = GetAttributeValue( 'gryphon_set_bns_dmg_reduction' );
  2362. damageData.processedDmg.vitalityDamage *= ClampF(1 - min.valueAdditive, 0, 1);
  2363. }*/
  2364.  
  2365.  
  2366. //if you need to copy-paste a part of a parent function
  2367. //and do some shitty dancing around a part of the code,
  2368. //this probably means that the code doesn't belong here
  2369. //and should be placed somewhere else instead... yeah?
  2370. //if(!damageData.GetIgnoreImmortalityMode())
  2371. //{
  2372. // if(!((W3PlayerWitcher)this))
  2373. // Log("");
  2374. //
  2375. //
  2376. // if( IsInvulnerable() )
  2377. // {
  2378. // if ( theGame.CanLog() )
  2379. // {
  2380. // LogDMHits("CActor.ReduceDamage: victim Invulnerable - no damage will be dealt", damageData );
  2381. // }
  2382. // damageData.SetAllProcessedDamageAs(0);
  2383. // return;
  2384. // }
  2385. //
  2386. // if(actorAttacker && damageData.DealsAnyDamage() )
  2387. // actorAttacker.SignalGameplayEventParamObject( 'DamageInstigated', damageData );
  2388. //
  2389. //
  2390. // if( IsImmortal() )
  2391. // {
  2392. // if ( theGame.CanLog() )
  2393. // {
  2394. // LogDMHits("CActor.ReduceDamage: victim is Immortal, clamping damage", damageData );
  2395. // }
  2396. // damageData.processedDmg.vitalityDamage = ClampF(damageData.processedDmg.vitalityDamage, 0, GetStat(BCS_Vitality)-1 );
  2397. // damageData.processedDmg.essenceDamage = ClampF(damageData.processedDmg.essenceDamage, 0, GetStat(BCS_Essence)-1 );
  2398. // return;
  2399. // }
  2400. //}
  2401. //else
  2402. //{
  2403. //
  2404. // if(actorAttacker && damageData.DealsAnyDamage() )
  2405. // actorAttacker.SignalGameplayEventParamObject( 'DamageInstigated', damageData );
  2406. //}
  2407. }
  2408.  
  2409. //modSigns
  2410. private function GetOilProtectionAgainstMonster(damageData : W3DamageAction) : float
  2411. {
  2412. var i : int;
  2413. var heldWeapons : array< SItemUniqueId >;
  2414. var weapon : SItemUniqueId;
  2415. var resist : float;
  2416. var attackerMonsterCategory : EMonsterCategory;
  2417. var tmpName : name;
  2418. var tmpBool : bool;
  2419.  
  2420. if( !((CActor)damageData.attacker) )
  2421. return 0;
  2422.  
  2423. resist = 0;
  2424. heldWeapons = inv.GetHeldWeapons();
  2425.  
  2426. for( i = 0; i < heldWeapons.Size(); i += 1 )
  2427. {
  2428. if( !inv.IsItemFists( heldWeapons[ i ] ) )
  2429. {
  2430. weapon = heldWeapons[ i ];
  2431. break;
  2432. }
  2433. }
  2434.  
  2435. if( !inv.IsIdValid( weapon ) )
  2436. return 0;
  2437.  
  2438. theGame.GetMonsterParamsForActor((CActor)damageData.attacker, attackerMonsterCategory, tmpName, tmpBool, tmpBool, tmpBool);
  2439.  
  2440. resist = inv.GetOilProtectionAgainstMonster(weapon, attackerMonsterCategory);
  2441.  
  2442. return resist;
  2443. }
  2444.  
  2445. /*timer function UndyingSkillCooldown(dt : float, id : int)
  2446. {
  2447. cannotUseUndyingSkill = false;
  2448. }*/
  2449.  
  2450. //modSigns
  2451. public function CastFreeQuen()
  2452. {
  2453. var quen : W3QuenEntity;
  2454.  
  2455. quen = (W3QuenEntity)signs[ST_Quen].entity;
  2456.  
  2457. if(!quen)
  2458. quen = (W3QuenEntity)theGame.CreateEntity(signs[ST_Quen].template, GetWorldPosition(), GetWorldRotation());
  2459.  
  2460. PlayEffect( 'quen_lasting_shield_back' ); //make use of vanilla bear set effect
  2461.  
  2462. quen.Init(signOwner, signs[ST_Quen].entity, true);
  2463. quen.freeCast = true;
  2464. quen.OnStarted();
  2465. quen.OnThrowing();
  2466. quen.OnEnded();
  2467. }
  2468.  
  2469. event OnTakeDamage( action : W3DamageAction)
  2470. {
  2471. var currVitality, rgnVitality, hpTriggerTreshold : float;
  2472. //var healingFactor : float;
  2473. var abilityName : name;
  2474. var abilityCount, maxStack, itemDurability : float;
  2475. var addAbility : bool;
  2476. var min, max : SAbilityAttributeValue;
  2477. //var mutagenQuen : W3SignEntity; //modSigns
  2478. var equipped : array<SItemUniqueId>;
  2479. var i : int;
  2480. var killSourceName : string;
  2481. var aerondight : W3Effect_Aerondight;
  2482. var phantomWeapon : W3Effect_PhantomWeapon; //modSigns
  2483. //var quen : W3QuenEntity; //modSigns
  2484. var mutation5CustomEffect : SCustomEffectParams; //modSigns
  2485.  
  2486. // Combat Anims - Begin
  2487. if( action.GetHitReactionType() != EHRT_None && !action.IsDoTDamage() )
  2488. ResetCustomAnimationSpeedMult();
  2489. // Combat Anims - End
  2490.  
  2491. currVitality = GetStat(BCS_Vitality);
  2492. killSourceName = action.GetBuffSourceName();
  2493.  
  2494.  
  2495. if(action.processedDmg.vitalityDamage >= currVitality)
  2496. {
  2497. //killSourceName = action.GetBuffSourceName();
  2498.  
  2499.  
  2500. if( killSourceName != "Quest" && killSourceName != "Kill Trigger" && killSourceName != "Trap" && killSourceName != "FallingDamage" )
  2501. {
  2502. //modSigns: Second Life mutation will now have priority over Undying skill -> mutation changed
  2503. /*if( IsMutationActive( EPMT_Mutation11 ) && !HasBuff( EET_Mutation11Debuff ) && !IsInAir() )
  2504. {
  2505. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation11', 'health_prc', min, max );
  2506.  
  2507. action.SetAllProcessedDamageAs( 0 );
  2508.  
  2509. OnMutation11Triggered();
  2510. }
  2511. else*/ if(/*!cannotUseUndyingSkill*/ !HasBuff( EET_UndyingSkillImmortal ) && !HasBuff( EET_UndyingSkillCooldown ) && GetStat(BCS_Focus) >= 1 && CanUseSkill(S_Sword_s18) /*&& HasBuff(EET_BattleTrance)*/ )
  2512. {
  2513. //healingFactor = CalculateAttributeValue( GetSkillAttributeValue(S_Sword_s18, 'healing_factor', false, true) );
  2514. //healingFactor *= GetStatMax(BCS_Vitality);
  2515. //healingFactor *= GetStat(BCS_Focus);
  2516. //healingFactor *= 1 + CalculateAttributeValue( GetSkillAttributeValue(S_Sword_s18, 'healing_bonus', false, true) ) * (GetSkillLevel(S_Sword_s18) - 1);
  2517. action.SetAllProcessedDamageAs( 0 ); //modSigns
  2518. ForceSetStat(BCS_Vitality, 1); //modSigns: heal 1 point of damage
  2519. //DrainFocus(GetStat(BCS_Focus));
  2520. //RemoveBuff(EET_BattleTrance);
  2521. //cannotUseUndyingSkill = true;
  2522. AddEffectDefault( EET_UndyingSkillImmortal, NULL, "UndyingSkill" ); //modSigns: brief immortality
  2523. //AddTimer('UndyingSkillCooldown', CalculateAttributeValue( GetSkillAttributeValue(S_Sword_s18, 'trigger_delay', false, true) ), false, , , true);
  2524. }
  2525. else
  2526. {
  2527.  
  2528. equipped = GetEquippedItems();
  2529.  
  2530. for(i=0; i<equipped.Size(); i+=1)
  2531. {
  2532. if ( !inv.IsIdValid( equipped[i] ) )
  2533. {
  2534. continue;
  2535. }
  2536. itemDurability = inv.GetItemDurability(equipped[i]);
  2537. if(inv.ItemHasAbility(equipped[i], 'MA_Reinforced') && itemDurability > 0)
  2538. {
  2539.  
  2540. inv.SetItemDurabilityScript(equipped[i], MaxF(0, itemDurability - action.processedDmg.vitalityDamage) );
  2541.  
  2542.  
  2543. action.processedDmg.vitalityDamage = 0;
  2544. ForceSetStat(BCS_Vitality, 1);
  2545.  
  2546. break;
  2547. }
  2548. }
  2549. }
  2550. }
  2551. }
  2552.  
  2553. //modSigns: new Mutated Skin ability
  2554. if(IsMutationActive(EPMT_Mutation5) && !action.IsDoTDamage() && action.processedDmg.vitalityDamage > 0.0 && GetStat(BCS_Focus) >= 1.0)
  2555. {
  2556. if(action.processedDmg.vitalityDamage < currVitality || killSourceName != "Quest" && killSourceName != "Kill Trigger" && killSourceName != "Trap" && killSourceName != "FallingDamage")
  2557. {
  2558. theGame.GetDefinitionsManager().GetAbilityAttributeValue('Mutation5', 'mut5_duration_per_point', min, max);
  2559. //custom effect params
  2560. mutation5CustomEffect.effectType = EET_Mutation5;
  2561. mutation5CustomEffect.creator = this;
  2562. mutation5CustomEffect.sourceName = "mutation5";
  2563. mutation5CustomEffect.duration = min.valueAdditive * GetStat(BCS_Focus);
  2564. mutation5CustomEffect.effectValue.valueAdditive = action.processedDmg.vitalityDamage / mutation5CustomEffect.duration;
  2565. AddEffectCustom(mutation5CustomEffect);
  2566. //the damage is considered to be dealt by the rest of the code (for the swords,
  2567. //mutagens, etc to work as usual), but DrainVitality is actually omitted
  2568. action.SetMutation5Triggered();
  2569. }
  2570. }
  2571.  
  2572.  
  2573. //if(action.DealsAnyDamage() && !((W3Effect_Toxicity)action.causer) )
  2574. //{
  2575. // //if(HasBuff(EET_Mutagen10))
  2576. // // RemoveAbilityAll( GetBuff(EET_Mutagen10).GetAbilityName() ); //modSigns: changed
  2577. //
  2578. // //if(HasBuff(EET_Mutagen15))
  2579. // // RemoveAbilityAll( GetBuff(EET_Mutagen15).GetAbilityName() ); //modSigns: changed
  2580. //}
  2581.  
  2582.  
  2583. /*quen = (W3QuenEntity)signs[ST_Quen].entity; //modSigns
  2584. if(HasBuff(EET_Mutagen19) && (!quen || !quen.IsAnyQuenActive())) //modSigns
  2585. {
  2586. theGame.GetDefinitionsManager().GetAbilityAttributeValue(GetBuff(EET_Mutagen19).GetAbilityName(), 'max_hp_perc_trigger', min, max);
  2587. hpTriggerTreshold = GetStatMax(BCS_Vitality) * CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  2588.  
  2589. //theGame.witcherLog.AddMessage( "hpTriggerTreshold = " + hpTriggerTreshold );
  2590. //theGame.witcherLog.AddMessage( "damage = " + action.GetDamageDealt() );
  2591.  
  2592. if(action.GetDamageDealt() >= hpTriggerTreshold)
  2593. {
  2594. if(!quen) //modSigns
  2595. {
  2596. quen = (W3QuenEntity)theGame.CreateEntity( signs[ST_Quen].template, GetWorldPosition(), GetWorldRotation() );
  2597. }
  2598. quen.Init( signOwner, signs[ST_Quen].entity, true );
  2599. quen.freeCast = true; //modSigns
  2600. quen.OnStarted();
  2601. quen.OnThrowing();
  2602. quen.OnEnded();
  2603. }
  2604. }*/ //modSigns: reworked
  2605.  
  2606.  
  2607. /*if(action.DealsAnyDamage() && !action.IsDoTDamage() && HasBuff(EET_Mutagen27))
  2608. {
  2609. abilityName = GetBuff(EET_Mutagen27).GetAbilityName();
  2610. abilityCount = GetAbilityCount(abilityName);
  2611.  
  2612. if(abilityCount == 0)
  2613. {
  2614. addAbility = true;
  2615. }
  2616. else
  2617. {
  2618. theGame.GetDefinitionsManager().GetAbilityAttributeValue(abilityName, 'mutagen27_max_stack', min, max);
  2619. maxStack = CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  2620.  
  2621. if(maxStack >= 0)
  2622. {
  2623. addAbility = (abilityCount < maxStack);
  2624. }
  2625. else
  2626. {
  2627. addAbility = true;
  2628. }
  2629. }
  2630.  
  2631. if(addAbility)
  2632. {
  2633. AddAbility(abilityName, true);
  2634. }
  2635. }*/ //modSigns: reworked
  2636.  
  2637. if(HasBuff(EET_Trap) && !action.IsDoTDamage() && action.attacker.HasAbility( 'mon_dettlaff_monster_base' ))
  2638. {
  2639. action.AddEffectInfo(EET_Knockdown);
  2640. RemoveBuff(EET_Trap, true);
  2641. }
  2642.  
  2643. super.OnTakeDamage(action);
  2644.  
  2645.  
  2646. //modSigns: Aerondight and Iris
  2647. if( !action.WasDodged() && action.DealtDamage() && !action.IsDoTDamage() && !( (W3Effect_Toxicity) action.causer ) )
  2648. {
  2649. if( inv.ItemHasTag( inv.GetCurrentlyHeldSword(), 'Aerondight' ) )
  2650. {
  2651. aerondight = (W3Effect_Aerondight)GetBuff( EET_Aerondight );
  2652. if( aerondight /*&& aerondight.GetCurrentCount() != 0*/ )
  2653. {
  2654. //aerondight.ReduceAerondightStacks();
  2655. //modSigns: now resets on damage taken
  2656. aerondight.ResetCharges();
  2657. }
  2658. }
  2659. if( inv.ItemHasTag( inv.GetCurrentlyHeldSword(), 'PhantomWeapon' ) )
  2660. {
  2661. phantomWeapon = (W3Effect_PhantomWeapon)GetBuff( EET_PhantomWeapon );
  2662. if( phantomWeapon )
  2663. phantomWeapon.ResetCharges();
  2664. }
  2665. }
  2666.  
  2667. //if( !action.WasDodged() && action.DealtDamage() && !( (W3Effect_Toxicity) action.causer ) )
  2668. //{
  2669. // RemoveBuff( EET_Mutation3 );
  2670. //} //modSigns: reworked
  2671.  
  2672.  
  2673. //modSigns: new mutation3 (Bloodbath effect)
  2674. if(HasBuff(EET_Mutation3))
  2675. ((W3Effect_Mutation3)GetBuff(EET_Mutation3)).ManageMutation3Bonus(action);
  2676. //modSigns: new Mutagen02 effect
  2677. if(HasBuff(EET_Mutagen02) && !action.WasDodged() && action.DealtDamage() && action.IsActionMelee())
  2678. ((W3Mutagen02_Effect)GetBuff(EET_Mutagen02)).AddDebuffToEnemy((CActor)action.attacker);
  2679. //modSigns: new mutagen05 effect
  2680. if(HasBuff(EET_Mutagen05))
  2681. ((W3Mutagen05_Effect)GetBuff(EET_Mutagen05)).ManageMutagen05Bonus(action);
  2682. //modSigns: new mutagen15 effect
  2683. if(HasBuff(EET_Mutagen15))
  2684. ((W3Mutagen15_Effect)GetBuff(EET_Mutagen15)).ManageMutagen15Bonus(action);
  2685. //modSigns: new mutagen22 effect
  2686. if(HasBuff(EET_Mutagen22))
  2687. ((W3Mutagen22_Effect)GetBuff(EET_Mutagen22)).RemoveMutagen22Abilities(action);
  2688. //modSigns: new Mutagen27 effect
  2689. if(HasBuff(EET_Mutagen27) && !action.WasDodged() && action.DealtDamage() && !(action.IsActionEnvironment() || action.IsDoTDamage()))
  2690. ((W3Mutagen27_Effect)GetBuff(EET_Mutagen27)).AccumulateHits();
  2691. }
  2692.  
  2693.  
  2694.  
  2695.  
  2696.  
  2697.  
  2698.  
  2699. event OnStartFistfightMinigame()
  2700. {
  2701. var i : int;
  2702. var buffs : array< CBaseGameplayEffect >;
  2703.  
  2704.  
  2705. effectManager.RemoveAllPotionEffects();
  2706.  
  2707. abilityManager.DrainToxicity(GetStatMax( BCS_Toxicity ));
  2708.  
  2709. buffs = GetBuffs( EET_WellFed );
  2710. for( i=buffs.Size()-1; i>=0; i-=1 )
  2711. {
  2712. RemoveEffect( buffs[i] );
  2713. }
  2714.  
  2715.  
  2716. buffs.Clear();
  2717. buffs = GetBuffs( EET_WellHydrated );
  2718. for( i=buffs.Size()-1; i>=0; i-=1 )
  2719. {
  2720. RemoveEffect( buffs[i] );
  2721. }
  2722.  
  2723. super.OnStartFistfightMinigame();
  2724. }
  2725.  
  2726. event OnEndFistfightMinigame()
  2727. {
  2728. super.OnEndFistfightMinigame();
  2729. }
  2730.  
  2731.  
  2732. public function GetCriticalHitChance( isLightAttack : bool, isHeavyAttack : bool, target : CActor, victimMonsterCategory : EMonsterCategory, isBolt : bool ) : float
  2733. {
  2734. var ret : float;
  2735. var thunder : W3Potion_Thunderbolt;
  2736. var min, max : SAbilityAttributeValue;
  2737.  
  2738. ret = super.GetCriticalHitChance( isLightAttack, isHeavyAttack, target, victimMonsterCategory, isBolt );
  2739.  
  2740.  
  2741.  
  2742.  
  2743.  
  2744.  
  2745.  
  2746. thunder = ( W3Potion_Thunderbolt )GetBuff( EET_Thunderbolt );
  2747. if( thunder && thunder.GetBuffLevel() == 3 && GetCurWeather() == EWE_Storm )
  2748. {
  2749. ret += 1.0f;
  2750. }
  2751.  
  2752.  
  2753. if( isBolt && IsMutationActive( EPMT_Mutation9 ) )
  2754. {
  2755. theGame.GetDefinitionsManager().GetAbilityAttributeValue('Mutation9', 'critical_hit_chance', min, max);
  2756. ret += min.valueMultiplicative;
  2757. }
  2758.  
  2759.  
  2760. if( isBolt && CanUseSkill( S_Sword_s07 ) )
  2761. {
  2762. ret += CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s07, theGame.params.CRITICAL_HIT_CHANCE, false, true)) * GetSkillLevel(S_Sword_s07);
  2763. }
  2764.  
  2765. return ret;
  2766. }
  2767.  
  2768.  
  2769. public function GetCriticalHitDamageBonus(weaponId : SItemUniqueId, victimMonsterCategory : EMonsterCategory, isStrikeAtBack : bool) : SAbilityAttributeValue
  2770. {
  2771. var min, max, bonus, null, oilBonus : SAbilityAttributeValue;
  2772. var mutagen : CBaseGameplayEffect;
  2773. var monsterBonusType : name;
  2774.  
  2775. bonus = super.GetCriticalHitDamageBonus(weaponId, victimMonsterCategory, isStrikeAtBack);
  2776.  
  2777. if( inv.ItemHasActiveOilApplied( weaponId, victimMonsterCategory ) && GetStat( BCS_Focus ) >= 1 && CanUseSkill( S_Alchemy_s07 ) ) //modSigns
  2778. {
  2779. monsterBonusType = MonsterCategoryToAttackPowerBonus( victimMonsterCategory );
  2780. oilBonus = inv.GetItemAttributeValue( weaponId, monsterBonusType );
  2781. if(oilBonus != null)
  2782. {
  2783. //bonus += GetSkillAttributeValue(S_Alchemy_s07, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, true);
  2784. //modSigns: fix crit bonus
  2785. bonus += GetSkillAttributeValue(S_Alchemy_s07, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, false) * GetSkillLevel(S_Alchemy_s07) * FloorF(GetStat(BCS_Focus));
  2786. }
  2787. //debug log
  2788. //theGame.witcherLog.AddMessage("Crit dmg bonus: " + bonus.valueAdditive);
  2789. }
  2790.  
  2791. // Mutagen 11 - back strike bonus
  2792. if (isStrikeAtBack && HasBuff(EET_Mutagen11))
  2793. {
  2794. mutagen = GetBuff(EET_Mutagen11);
  2795. theGame.GetDefinitionsManager().GetAbilityAttributeValue(mutagen.GetAbilityName(), 'damageIncrease', min, max);
  2796. bonus += GetAttributeRandomizedValue(min, max);
  2797. }
  2798.  
  2799. return bonus;
  2800. }
  2801.  
  2802. public function ProcessLockTarget( optional newLockTarget : CActor, optional checkLeftStickHeading : bool ) : bool
  2803. {
  2804. var newLockTargetFound : bool;
  2805.  
  2806. newLockTargetFound = super.ProcessLockTarget(newLockTarget, checkLeftStickHeading);
  2807.  
  2808. if(GetCurrentlyCastSign() == ST_Axii)
  2809. {
  2810. ((W3AxiiEntity)GetCurrentSignEntity()).OnDisplayTargetChange(newLockTarget);
  2811. }
  2812.  
  2813. return newLockTargetFound;
  2814. }
  2815.  
  2816.  
  2817.  
  2818.  
  2819.  
  2820.  
  2821.  
  2822. event OnProcessActionPost(action : W3DamageAction)
  2823. {
  2824. var attackAction : W3Action_Attack;
  2825. var rendLoad, focusVal, stamCost, rendTimeRatio : float; //modSigns
  2826. var value : SAbilityAttributeValue;
  2827. var actorVictim : CActor;
  2828. var weaponId : SItemUniqueId;
  2829. var usesSteel, usesSilver, usesVitality, usesEssence : bool;
  2830. var abs : array<name>;
  2831. var i : int;
  2832. var dm : CDefinitionsManagerAccessor;
  2833. var items : array<SItemUniqueId>;
  2834. var weaponEnt : CEntity;
  2835. var lynxSetBuff : W3Effect_LynxSetBonus;
  2836. var min, max, nullBonus, oilBonus : SAbilityAttributeValue; //modSigns
  2837. var victimMonsterCategory : EMonsterCategory; //modSigns
  2838. var monsterBonusType : name; //modSigns
  2839. var tmpName : name; //modSigns
  2840. var tmpBool : bool; //modSigns
  2841. var splitCount : int; //modSigns
  2842.  
  2843. super.OnProcessActionPost(action);
  2844.  
  2845. attackAction = (W3Action_Attack)action;
  2846. actorVictim = (CActor)action.victim;
  2847.  
  2848. if(attackAction)
  2849. {
  2850. if(attackAction.IsActionMelee())
  2851. {
  2852.  
  2853. if(SkillNameToEnum(attackAction.GetAttackTypeName()) == S_Sword_s02)
  2854. {
  2855. //rendLoad = GetSpecialAttackTimeRatio();
  2856.  
  2857.  
  2858. //rendLoad = MinF(rendLoad * GetStatMax(BCS_Focus), GetStat(BCS_Focus));
  2859.  
  2860.  
  2861. //rendLoad = FloorF(rendLoad);
  2862.  
  2863. //modSigns
  2864. RendAoE(attackAction);
  2865.  
  2866. rendTimeRatio = GetSpecialAttackTimeRatio(); //save for bear tier 2
  2867.  
  2868. rendLoad = GetStat(BCS_Focus);
  2869.  
  2870. DrainFocus(rendLoad);
  2871.  
  2872. OnSpecialAttackHeavyActionProcess();
  2873. }
  2874. else if(actorVictim && IsRequiredAttitudeBetween(this, actorVictim, true)
  2875. && attackAction.DealsAnyDamage() && !attackAction.WasDodged() && !attackAction.IsParried() && !attackAction.IsCountered()) //modSigns: only gain adrenaline for actual damage dealt
  2876. {
  2877.  
  2878.  
  2879. value = GetAttributeValue('focus_gain');
  2880.  
  2881. if( FactsQuerySum("debug_fact_focus_boy") > 0 )
  2882. {
  2883. Debug_FocusBoyFocusGain();
  2884. }
  2885.  
  2886.  
  2887. if ( CanUseSkill(S_Sword_s20) )
  2888. {
  2889. value += GetSkillAttributeValue(S_Sword_s20, 'focus_gain', false, true) * GetSkillLevel(S_Sword_s20);
  2890. }
  2891.  
  2892. //modSigns
  2893. if( CanUseSkill(S_Sword_s21) && attackAction && attackAction.IsActionMelee() &&
  2894. IsLightAttack(attackAction.GetAttackName()) && !inv.IsItemFists(attackAction.GetWeaponId()) )
  2895. {
  2896. value += GetSkillAttributeValue(S_Sword_s21, 'light_focus_gain', false, true) * GetSkillLevel(S_Sword_s21);
  2897. }
  2898. if( CanUseSkill(S_Sword_s04) && attackAction && attackAction.IsActionMelee() &&
  2899. IsHeavyAttack(attackAction.GetAttackName()) && !inv.IsItemFists(attackAction.GetWeaponId()) )
  2900. {
  2901. value += GetSkillAttributeValue(S_Sword_s04, 'heavy_focus_gain', false, true) * GetSkillLevel(S_Sword_s04);
  2902. }
  2903.  
  2904. //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() )
  2905. //{
  2906. // AddEffectDefault( EET_Mutation3, this, "", false );
  2907. //} //modSigns: reworked
  2908.  
  2909. focusVal = 0.1f * (1 + CalculateAttributeValue(value));
  2910.  
  2911. if(!inv.IsItemFists(attackAction.GetWeaponId()))
  2912. {
  2913. //modSigns: lynx set tier 2 bonus - doubled adrenaline gain for critical hits
  2914. if( attackAction.IsCriticalHit() && IsSetBonusActive( EISB_Lynx_2 ) )
  2915. {
  2916. focusVal *= 2;
  2917. }
  2918.  
  2919. //modSigns: additional adrenaline for bear school perk
  2920. focusVal += CalculateAttributeValue(GetAttributeValue('bonus_focus_gain'));
  2921. }
  2922.  
  2923. //modSigns: new mutation7 (Adrenaline Rush)
  2924. //theGame.witcherLog.AddMessage("focus before adjustments: " + focusVal);
  2925. if(HasBuff(EET_Mutation7Buff))
  2926. focusVal *= 2;
  2927. else if(HasBuff(EET_Mutation7Debuff))
  2928. focusVal /= 2;
  2929.  
  2930. //theGame.witcherLog.AddMessage("melee focus gain: " + focusVal);
  2931.  
  2932. GainStat(BCS_Focus, focusVal);
  2933. }
  2934.  
  2935. //modSigns: bear tier 2 stamina restore
  2936. if(IsSetBonusActive(EISB_Bear_2) && attackAction.DealsAnyDamage() && !attackAction.WasDodged() && !attackAction.IsParried() && !attackAction.IsCountered())
  2937. {
  2938. if(SkillNameToEnum(attackAction.GetAttackTypeName()) == S_Sword_s02)
  2939. stamCost = rendTimeRatio * GetStatMax(BCS_Stamina);
  2940. else if(IsHeavyAttack(attackAction.GetAttackName()))
  2941. stamCost = GetStaminaActionCost(ESAT_HeavyAttack);
  2942. if(stamCost > 0)
  2943. {
  2944. theGame.GetDefinitionsManager().GetAbilityAttributeValue(GetSetBonusAbility(EISB_Bear_2), 'stamina_attack', min, max);
  2945. GainStat(BCS_Stamina, stamCost * min.valueAdditive);
  2946. //theGame.witcherLog.AddMessage("stamina gain: " + (stamCost * min.valueAdditive));
  2947. }
  2948. }
  2949.  
  2950. weaponId = attackAction.GetWeaponId();
  2951. if(actorVictim && (ShouldProcessTutorial('TutorialWrongSwordSteel') || ShouldProcessTutorial('TutorialWrongSwordSilver')) && GetAttitudeBetween(actorVictim, this) == AIA_Hostile)
  2952. {
  2953. usesSteel = inv.IsItemSteelSwordUsableByPlayer(weaponId);
  2954. usesSilver = inv.IsItemSilverSwordUsableByPlayer(weaponId);
  2955. usesVitality = actorVictim.UsesVitality();
  2956. usesEssence = actorVictim.UsesEssence();
  2957.  
  2958. if(usesSilver && usesVitality)
  2959. {
  2960. FactsAdd('tut_wrong_sword_silver',1);
  2961. }
  2962. else if(usesSteel && usesEssence)
  2963. {
  2964. FactsAdd('tut_wrong_sword_steel',1);
  2965. }
  2966. else if(FactsQuerySum('tut_wrong_sword_steel') && usesSilver && usesEssence)
  2967. {
  2968. FactsAdd('tut_proper_sword_silver',1);
  2969. FactsRemove('tut_wrong_sword_steel');
  2970. }
  2971. else if(FactsQuerySum('tut_wrong_sword_silver') && usesSteel && usesVitality)
  2972. {
  2973. FactsAdd('tut_proper_sword_steel',1);
  2974. FactsRemove('tut_wrong_sword_silver');
  2975. }
  2976. }
  2977.  
  2978.  
  2979. if(!action.WasDodged() && HasRunewordActive('Runeword 1 _Stats')) //modSigns
  2980. {
  2981. if(runewordInfusionType == ST_Axii)
  2982. {
  2983. actorVictim.SoundEvent('sign_axii_release');
  2984. }
  2985. else if(runewordInfusionType == ST_Igni)
  2986. {
  2987. actorVictim.SoundEvent('sign_igni_charge_begin');
  2988. }
  2989. else if(runewordInfusionType == ST_Quen)
  2990. {
  2991. value = GetAttributeValue('runeword1_quen_heal');
  2992. Heal( action.GetDamageDealt() * value.valueMultiplicative );
  2993. PlayEffectSingle('drain_energy_caretaker_shovel');
  2994. }
  2995. else if(runewordInfusionType == ST_Yrden)
  2996. {
  2997. actorVictim.SoundEvent('sign_yrden_shock_activate');
  2998. }
  2999. runewordInfusionType = ST_None;
  3000.  
  3001.  
  3002. items = inv.GetHeldWeapons();
  3003. weaponEnt = inv.GetItemEntityUnsafe(items[0]);
  3004. weaponEnt.StopEffect('runeword_aard');
  3005. weaponEnt.StopEffect('runeword_axii');
  3006. weaponEnt.StopEffect('runeword_igni');
  3007. weaponEnt.StopEffect('runeword_quen');
  3008. weaponEnt.StopEffect('runeword_yrden');
  3009. }
  3010.  
  3011. //modSigns: Invigoration
  3012. if(HasBuff(EET_Runeword4) && (action.IsActionMelee() || action.IsActionWitcherSign() && IsMutationActive(EPMT_Mutation1)) && action.DealsAnyDamage() && !action.IsDoTDamage())
  3013. {
  3014. RemoveBuff(EET_Runeword4);
  3015. actorVictim.CreateFXEntityAtPelvis( 'runeword_4', true );
  3016. }
  3017.  
  3018. if(ShouldProcessTutorial('TutorialLightAttacks') || ShouldProcessTutorial('TutorialHeavyAttacks'))
  3019. {
  3020. if(IsLightAttack(attackAction.GetAttackName()))
  3021. {
  3022. theGame.GetTutorialSystem().IncreaseGeraltsLightAttacksCount(action.victim.GetTags());
  3023. }
  3024. else if(IsHeavyAttack(attackAction.GetAttackName()))
  3025. {
  3026. theGame.GetTutorialSystem().IncreaseGeraltsHeavyAttacksCount(action.victim.GetTags());
  3027. }
  3028. }
  3029. }
  3030. else if(attackAction.IsActionRanged())
  3031. {
  3032.  
  3033. if(CanUseSkill(S_Perk_02) && !attackAction.IsDoTDamage() && attackAction.DealsAnyDamage() && !attackAction.WasDodged() && !attackAction.IsParried() && !attackAction.IsCountered()) //modSigns: only gain adrenaline for actual damage dealt
  3034. {
  3035. //value = GetSkillAttributeValue(S_Perk_02, 'focus_gain', false, true);
  3036. //focusVal = CalculateAttributeValue(value);
  3037.  
  3038. //modSigns: bolts give the same amount of focus as swords
  3039.  
  3040. value = GetAttributeValue('focus_gain');
  3041.  
  3042. if( FactsQuerySum("debug_fact_focus_boy") > 0 )
  3043. {
  3044. Debug_FocusBoyFocusGain();
  3045. }
  3046.  
  3047. if ( CanUseSkill(S_Sword_s20) )
  3048. {
  3049. value += GetSkillAttributeValue(S_Sword_s20, 'focus_gain', false, true) * GetSkillLevel(S_Sword_s20);
  3050. }
  3051.  
  3052. focusVal = 0.1f * (1 + CalculateAttributeValue(value));
  3053.  
  3054. //modSigns: new mutation7 (Adrenaline Rush)
  3055. if(HasBuff(EET_Mutation7Buff))
  3056. focusVal *= 2;
  3057. else if(HasBuff(EET_Mutation7Debuff))
  3058. focusVal /= 2;
  3059.  
  3060. //modSigns: split bolt
  3061. splitCount = (int)CalculateAttributeValue(inv.GetItemAttributeValue(attackAction.GetWeaponId(), 'split_count'));
  3062. if(splitCount > 0)
  3063. focusVal /= splitCount;
  3064.  
  3065. //theGame.witcherLog.AddMessage("xbow focus gain: " + focusVal);
  3066.  
  3067. GainStat(BCS_Focus, focusVal);
  3068. }
  3069.  
  3070.  
  3071. if(CanUseSkill(S_Sword_s12) && attackAction.IsCriticalHit() && actorVictim)
  3072. {
  3073.  
  3074. actorVictim.GetCharacterStats().GetAbilities(abs, false);
  3075. dm = theGame.GetDefinitionsManager();
  3076. for(i=abs.Size()-1; i>=0; i-=1)
  3077. {
  3078. if(!dm.AbilityHasTag(abs[i], theGame.params.TAG_MONSTER_SKILL) || actorVictim.IsAbilityBlocked(abs[i]))
  3079. {
  3080. abs.EraseFast(i);
  3081. }
  3082. }
  3083.  
  3084.  
  3085. if(abs.Size() > 0)
  3086. {
  3087. value = GetSkillAttributeValue(S_Sword_s12, 'duration', true, true) * GetSkillLevel(S_Sword_s12);
  3088. actorVictim.BlockAbility(abs[ RandRange(abs.Size()) ], true, CalculateAttributeValue(value));
  3089. }
  3090. }
  3091. }
  3092. }
  3093.  
  3094.  
  3095. //modSigns: moved sign fx to signEntity to ensure it's triggered only once per cast (and alt cast)
  3096. if( IsMutationActive( EPMT_Mutation10 ) && !IsEffectActive( 'mutation_10_energy' ) && ( action.IsActionMelee() || action.IsActionWitcherSign() ) )
  3097. if( IsMutationActive( EPMT_Mutation10 ) && ( action.IsActionMelee() /*|| action.IsActionWitcherSign()*/ ) )
  3098. {
  3099. PlayEffect( 'mutation_10_energy' );
  3100. }
  3101.  
  3102.  
  3103. if(CanUseSkill(S_Perk_18) && ((W3Petard)action.causer) && action.DealsAnyDamage() && !action.IsDoTDamage())
  3104. {
  3105. value = GetSkillAttributeValue(S_Perk_18, 'focus_gain', false, true);
  3106.  
  3107. //modSigns: new mutation7 (Adrenaline Rush)
  3108. focusVal = CalculateAttributeValue(value);
  3109. if(HasBuff(EET_Mutation7Buff))
  3110. focusVal *= 2;
  3111. else if(HasBuff(EET_Mutation7Debuff))
  3112. focusVal /= 2;
  3113.  
  3114. //modSigns: cluster bombs
  3115. if(CanUseSkill(S_Alchemy_s11))
  3116. {
  3117. splitCount = GetSkillLevel(S_Alchemy_s11) + 1;
  3118. if(splitCount > 0)
  3119. focusVal /= splitCount;
  3120. }
  3121.  
  3122. //theGame.witcherLog.AddMessage("petard focus gain: " + focusVal);
  3123.  
  3124. GainStat(BCS_Focus, focusVal);
  3125. }
  3126.  
  3127. //modSigns: new mutagen01 effect
  3128. if(HasBuff(EET_Mutagen01) && attackAction)
  3129. {
  3130. ((W3Mutagen01_Effect)GetBuff(EET_Mutagen01)).ManageMutagen01Bonus(attackAction);
  3131. }
  3132.  
  3133. //modSigns: new mutagen05 effect
  3134. if(HasBuff(EET_Mutagen05))
  3135. {
  3136. ((W3Mutagen05_Effect)GetBuff(EET_Mutagen05)).ManageMutagen05Bonus(action);
  3137. }
  3138.  
  3139. //modSigns: new mutagen10 effect
  3140. if(HasBuff(EET_Mutagen10) && attackAction)
  3141. {
  3142. ((W3Mutagen10_Effect)GetBuff(EET_Mutagen10)).ManageMutagen10Bonus(attackAction);
  3143. }
  3144.  
  3145. //modSigns: new mutagen15 effect
  3146. if(HasBuff(EET_Mutagen15))
  3147. {
  3148. ((W3Mutagen15_Effect)GetBuff(EET_Mutagen15)).ManageMutagen15Bonus(action);
  3149. }
  3150.  
  3151. //modSigns: new mutagen17 effect
  3152. if(HasBuff(EET_Mutagen17) && attackAction)
  3153. {
  3154. ((W3Mutagen17_Effect)GetBuff(EET_Mutagen17)).ManageMutagen17Bonus(attackAction);
  3155. }
  3156.  
  3157. //modSigns: new lynx set tier1 bonus
  3158. if( IsSetBonusActive( EISB_Lynx_1 ) && attackAction && attackAction.IsActionMelee() && !attackAction.WasDodged() )
  3159. {
  3160. //theGame.witcherLog.AddMessage("Lynx set tier 1 post action"); //debug
  3161. if( !HasBuff( EET_LynxSetBonus ) )
  3162. {
  3163. AddEffectDefault( EET_LynxSetBonus, NULL, "LynxSetBuff" );
  3164. SoundEvent( "ep2_setskill_lynx_activate" );
  3165. }
  3166. lynxSetBuff = (W3Effect_LynxSetBonus)GetBuff( EET_LynxSetBonus );
  3167. lynxSetBuff.ManageLynxBonus( IsHeavyAttack( attackAction.GetAttackName() ) );
  3168. }
  3169. }
  3170.  
  3171. //modSigns: rend AoE
  3172. private function RendAoE(attackAction : W3Action_Attack)
  3173. {
  3174. var dmgTypes : array< name >;
  3175. var dmgValues : array< float >;
  3176. var ents : array<CGameplayEntity>;
  3177. var rendAoEAction : W3DamageAction;
  3178. var i, j : int;
  3179.  
  3180. if(GetStat(BCS_Focus) < 3)
  3181. return;
  3182.  
  3183. inv.GetWeaponDTNames(attackAction.GetWeaponId(), dmgTypes);
  3184. for(i = 0; i < dmgTypes.Size(); i += 1)
  3185. dmgValues.PushBack(GetTotalWeaponDamage(attackAction.GetWeaponId(), dmgTypes[i], GetInvalidUniqueId()));
  3186.  
  3187. FindGameplayEntitiesInCylinder(ents, attackAction.victim.GetWorldPosition(), 3, 10, 100, , FLAG_OnlyAliveActors + FLAG_ExcludeTarget + FLAG_Attitude_Hostile, this);
  3188.  
  3189. for(i = 0; i < ents.Size(); i += 1)
  3190. {
  3191. if(ents[i] == attackAction.victim)
  3192. continue;
  3193. rendAoEAction = new W3DamageAction in theGame;
  3194. rendAoEAction.Initialize(attackAction.attacker, ents[i], attackAction.causer, "RendAoE", EHRT_Heavy, CPS_AttackPower, false, false, false, false);
  3195. rendAoEAction.SetCannotReturnDamage(true);
  3196. rendAoEAction.SetProcessBuffsIfNoDamage(true);
  3197. for(j = 0; j < dmgTypes.Size(); j += 1)
  3198. rendAoEAction.AddDamage(dmgTypes[j], dmgValues[j]);
  3199. rendAoEAction.AddEffectInfo(EET_KnockdownTypeApplicator);
  3200. theGame.damageMgr.ProcessAction(rendAoEAction);
  3201. ents[i].PlayEffect('yrden_shock');
  3202. delete rendAoEAction;
  3203. }
  3204. }
  3205.  
  3206.  
  3207. timer function Mutagen14Timer(dt : float, id : int)
  3208. {
  3209. var abilityName : name;
  3210. var abilityCount, maxStack : float;
  3211. var min, max : SAbilityAttributeValue;
  3212. var addAbility : bool;
  3213.  
  3214. abilityName = GetBuff(EET_Mutagen14).GetAbilityName();
  3215. abilityCount = GetAbilityCount(abilityName);
  3216.  
  3217. if(abilityCount == 0)
  3218. {
  3219. addAbility = true;
  3220. }
  3221. else
  3222. {
  3223. theGame.GetDefinitionsManager().GetAbilityAttributeValue(abilityName, 'mutagen14_max_stack', min, max);
  3224. maxStack = CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  3225.  
  3226. if(maxStack >= 0)
  3227. {
  3228. addAbility = (abilityCount < maxStack);
  3229. }
  3230. else
  3231. {
  3232. addAbility = true;
  3233. }
  3234. }
  3235.  
  3236. if(addAbility)
  3237. {
  3238. AddAbility(abilityName, true);
  3239. }
  3240. else
  3241. {
  3242.  
  3243. RemoveTimer('Mutagen14Timer');
  3244. }
  3245. }
  3246.  
  3247. public final function FailFundamentalsFirstAchievementCondition()
  3248. {
  3249. SetFailedFundamentalsFirstAchievementCondition(true);
  3250. }
  3251.  
  3252. public final function SetUsedQuenInCombat()
  3253. {
  3254. usedQuenInCombat = true;
  3255. }
  3256.  
  3257. public final function UsedQuenInCombat() : bool
  3258. {
  3259. return usedQuenInCombat;
  3260. }
  3261.  
  3262. event OnCombatStart()
  3263. {
  3264. var quenEntity/*, glyphQuen*/ : W3QuenEntity; //modSigns
  3265. var focus, stamina, focusMax : float; //modSigns
  3266. var glowTargets, moTargets, actors : array< CActor >;
  3267. var delays : array< float >;
  3268. var rand, i : int;
  3269. var isHostile, isAlive, isUnconscious : bool;
  3270.  
  3271.  
  3272. super.OnCombatStart();
  3273.  
  3274. if ( IsInCombatActionFriendly() )
  3275. {
  3276. SetBIsCombatActionAllowed(true);
  3277. SetBIsInputAllowed(true, 'OnCombatActionStart' );
  3278. }
  3279.  
  3280.  
  3281. if(HasBuff(EET_Mutagen14))
  3282. {
  3283. AddTimer('Mutagen14Timer', 2, true);
  3284. }
  3285.  
  3286.  
  3287. //if(HasBuff(EET_Mutagen15)) //modSigns: changed
  3288. //{
  3289. // AddAbility(GetBuff(EET_Mutagen15).GetAbilityName(), false);
  3290. //}
  3291.  
  3292. //modSigns: new mutagen24 effect
  3293. if(HasBuff(EET_Mutagen24))
  3294. ((W3Mutagen24_Effect)GetBuff(EET_Mutagen24)).ManageMutagen24Bonus();
  3295.  
  3296. //modSigns
  3297. if( IsSetBonusActive(EISB_KaerMorhen) && !HasBuff(EET_KaerMorhenSetBonus) )
  3298. {
  3299. AddEffectDefault(EET_KaerMorhenSetBonus, this, "KaerMorhenSetBonus");
  3300. }
  3301.  
  3302. ManageAerondightBuff( true ); //modSigns
  3303. ManageIrisBuff( true ); //modSigns
  3304.  
  3305.  
  3306. mutation12IsOnCooldown = false;
  3307.  
  3308.  
  3309. quenEntity = (W3QuenEntity)signs[ST_Quen].entity;
  3310.  
  3311.  
  3312. if(quenEntity)
  3313. {
  3314. usedQuenInCombat = quenEntity.IsAnyQuenActive();
  3315. }
  3316. else
  3317. {
  3318. usedQuenInCombat = false;
  3319. }
  3320.  
  3321. if(usedQuenInCombat || HasPotionBuff() || IsEquippedSwordUpgradedWithOil(true) || IsEquippedSwordUpgradedWithOil(false))
  3322. {
  3323. SetFailedFundamentalsFirstAchievementCondition(true);
  3324. }
  3325. else
  3326. {
  3327. if(IsAnyItemEquippedOnSlot(EES_PotionMutagen1) || IsAnyItemEquippedOnSlot(EES_PotionMutagen2) || IsAnyItemEquippedOnSlot(EES_PotionMutagen3) || IsAnyItemEquippedOnSlot(EES_PotionMutagen4))
  3328. SetFailedFundamentalsFirstAchievementCondition(true);
  3329. else
  3330. SetFailedFundamentalsFirstAchievementCondition(false);
  3331. }
  3332.  
  3333. if(CanUseSkill(S_Sword_s20) && IsThreatened())
  3334. {
  3335. focus = GetStat(BCS_Focus);
  3336. //modSigns
  3337. focusMax = CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s20, 'focus_add', false, true)) * GetSkillLevel(S_Sword_s20);
  3338. if(focus < focusMax)
  3339. {
  3340. GainStat(BCS_Focus, focusMax - focus);
  3341. }
  3342. }
  3343.  
  3344. if ( HasGlyphwordActive('Glyphword 17 _Stats') && (!quenEntity || !quenEntity.IsAnyQuenActive()) ) //modSigns
  3345. {
  3346. //stamina = GetStat(BCS_Stamina); //modSigns
  3347. if(!quenEntity)
  3348. {
  3349. quenEntity = (W3QuenEntity)theGame.CreateEntity( signs[ST_Quen].template, GetWorldPosition(), GetWorldRotation() );
  3350. }
  3351. quenEntity.glyphword17Cast = true; //modSigns
  3352. quenEntity.Init( signOwner, signs[ST_Quen].entity, true );
  3353. quenEntity.freeCast = true; //modSigns
  3354. quenEntity.OnStarted();
  3355. quenEntity.OnThrowing();
  3356. quenEntity.OnEnded();
  3357. //ForceSetStat(BCS_Stamina, stamina); //modSigns
  3358. }
  3359.  
  3360.  
  3361. MeditationForceAbort(true);
  3362.  
  3363.  
  3364.  
  3365.  
  3366.  
  3367. if( IsMutationActive( EPMT_Mutation3 ) ) //modSigns: now added at combat start
  3368. {
  3369. AddEffectDefault( EET_Mutation3, this, "", false );
  3370. }
  3371. else if( IsMutationActive( EPMT_Mutation4 ) )
  3372. if( IsMutationActive( EPMT_Mutation5 ) && GetStat( BCS_Focus ) >= 1.f ) //zur13 modSSS
  3373. {
  3374. AddEffectDefault( EET_Mutation4, this, "combat start", false );
  3375. }
  3376. //else if( IsMutationActive( EPMT_Mutation5 ) && GetStat( BCS_Focus ) >= 1.f )
  3377. //{
  3378. // AddEffectDefault( EET_Mutation5, this, "", false );
  3379. //} //modSigns: mutation changed
  3380.  
  3381. if( IsMutationActive( EPMT_Mutation7 ) ) //zur13 modSSS
  3382. {
  3383. //
  3384. //
  3385. // RemoveTimer( 'Mutation7CombatStartHackFixGo' );
  3386. //
  3387. //
  3388. // AddTimer( 'Mutation7CombatStartHackFix', 1.f, true, , , , true );
  3389. //
  3390. //modSigns
  3391. AddEffectDefault( EET_Mutation7Buff, this, "Mutation 7 buff phase" );
  3392. theGame.MutationHUDFeedback( MFT_PlayRepeat );
  3393. }
  3394. if( IsMutationActive( EPMT_Mutation8 ) ) //zur13 modSSS
  3395. {
  3396. theGame.MutationHUDFeedback( MFT_PlayRepeat );
  3397. }
  3398.  
  3399. if( IsMutationActive( EPMT_Mutation10 ) ) //zur13 modSSS
  3400. {
  3401. /*if( !HasBuff( EET_Mutation10 ) && GetStat( BCS_Toxicity ) > 0.f )
  3402. {
  3403. AddEffectDefault( EET_Mutation10, this, "Mutation 10" );
  3404. }*/
  3405.  
  3406.  
  3407. //PlayEffect( 'mutation_10' );
  3408. //
  3409. //
  3410. //PlayEffect( 'critical_toxicity' );
  3411. //AddTimer( 'Mutation10StopEffect', 5.f );
  3412. ////modSigns
  3413. //if( !HasBuff( EET_Mutation10 ) )
  3414. //{
  3415. // AddEffectDefault( EET_Mutation10, NULL, "Mutation 10" );
  3416. //}
  3417.  
  3418. //modSigns: Euphoria rework
  3419. if( GetStatPercents(BCS_Toxicity) >= GetToxicityDamageThreshold() )
  3420. AddEffectDefault( EET_Mutation10, NULL, "Mutation 10" );
  3421. }
  3422. }
  3423.  
  3424. //timer function Mutation7CombatStartHackFix( dt : float, id : int )
  3425. //{
  3426. // var actors : array< CActor >;
  3427. //
  3428. // actors = GetEnemies();
  3429. //
  3430. // if( actors.Size() > 0 )
  3431. // {
  3432. //
  3433. // AddTimer( 'Mutation7CombatStartHackFixGo', 0.5f );
  3434. // RemoveTimer( 'Mutation7CombatStartHackFix' );
  3435. // }
  3436. //}
  3437. //
  3438. //timer function Mutation7CombatStartHackFixGo( dt : float, id : int )
  3439. //{
  3440. // var actors : array< CActor >;
  3441. //
  3442. // if( IsMutationActive( EPMT_Mutation7 ) )
  3443. // {
  3444. // actors = GetEnemies();
  3445. //
  3446. // if( actors.Size() > 1 )
  3447. // {
  3448. // AddEffectDefault( EET_Mutation7Buff, this, "Mutation 7, combat start" );
  3449. // }
  3450. // }
  3451. //} //modSigns: redone
  3452.  
  3453. public final function IsInFistFight() : bool
  3454. {
  3455. var enemies : array< CActor >;
  3456. var i, j : int;
  3457. var invent : CInventoryComponent;
  3458. var weapons : array< SItemUniqueId >;
  3459.  
  3460. if( IsInFistFightMiniGame() )
  3461. {
  3462. return true;
  3463. }
  3464.  
  3465. enemies = GetEnemies();
  3466. for( i=0; i<enemies.Size(); i+=1 )
  3467. {
  3468. weapons.Clear();
  3469. invent = enemies[i].GetInventory();
  3470. weapons = invent.GetHeldWeapons();
  3471.  
  3472. for( j=0; j<weapons.Size(); j+=1 )
  3473. {
  3474. if( invent.IsItemFists( weapons[j] ) )
  3475. {
  3476. return true;
  3477. }
  3478. }
  3479. }
  3480.  
  3481. return false;
  3482. }
  3483.  
  3484. timer function Mutation10StopEffect( dt : float, id : int )
  3485. {
  3486. StopEffect( 'critical_toxicity' );
  3487. }
  3488.  
  3489.  
  3490. event OnCombatFinished()
  3491. {
  3492. var inGameConfigWrapper : CInGameConfigWrapper;
  3493. var disableAutoSheathe : bool;
  3494.  
  3495. super.OnCombatFinished();
  3496.  
  3497. //modSigns: cleanup mutagens
  3498. if(HasBuff(EET_Mutagen01))
  3499. ((W3Mutagen01_Effect)GetBuff(EET_Mutagen01)).RemoveMutagen01Abilities();
  3500. if(HasBuff(EET_Mutagen05))
  3501. ((W3Mutagen05_Effect)GetBuff(EET_Mutagen05)).RemoveMutagen05AbilitiesAll();
  3502. if(HasBuff(EET_Mutagen10))
  3503. ((W3Mutagen10_Effect)GetBuff(EET_Mutagen10)).RemoveMutagen10Abilities();
  3504. if(HasBuff(EET_Mutagen12))
  3505. ((W3Mutagen12_Effect)GetBuff(EET_Mutagen12)).ManageAdditionalBonus();
  3506. if(HasBuff(EET_Mutagen13))
  3507. ((W3Mutagen13_Effect)GetBuff(EET_Mutagen13)).ManageMutagen13Bonus();
  3508. if(HasBuff(EET_Mutagen15))
  3509. ((W3Mutagen15_Effect)GetBuff(EET_Mutagen15)).RemoveMutagen15AbilitiesAll();
  3510. if(HasBuff(EET_Mutagen17))
  3511. ((W3Mutagen17_Effect)GetBuff(EET_Mutagen17)).RemoveMutagen17Abilities();
  3512. if(HasBuff(EET_Mutagen18))
  3513. ((W3Mutagen18_Effect)GetBuff(EET_Mutagen18)).ManageMutagen18Bonus();
  3514. if(HasBuff(EET_Mutagen22))
  3515. ((W3Mutagen22_Effect)GetBuff(EET_Mutagen22)).RemoveMutagen22AbilitiesAll();
  3516. if(HasBuff(EET_Mutagen24))
  3517. ((W3Mutagen24_Effect)GetBuff(EET_Mutagen24)).ResetMutagen24Bonus();
  3518.  
  3519. //cleanup mutations
  3520. RemoveBuff( EET_Mutation3 );
  3521. RemoveBuff( EET_Mutation4 );
  3522. //RemoveBuff( EET_Mutation5 ); //modSigns: mutation changed
  3523. RemoveBuff( EET_Mutation7Buff );
  3524. RemoveBuff( EET_Mutation7Debuff );
  3525. if( IsMutationActive( EPMT_Mutation7 ) )
  3526. {
  3527. theGame.MutationHUDFeedback( MFT_PlayHide );
  3528. }
  3529. if( IsMutationActive( EPMT_Mutation8 ) ) //zur13 modSSS
  3530. {
  3531. theGame.MutationHUDFeedback( MFT_PlayHide );
  3532. }
  3533. RemoveBuff( EET_Mutation10 );
  3534.  
  3535. //cleanup set bonuses
  3536. RemoveBuff( EET_LynxSetBonus );
  3537. RemoveBuff( EET_KaerMorhenSetBonus ); //modSigns
  3538.  
  3539. if( HasBuff( EET_Aerondight ) ) //modSigns
  3540. RemoveBuff( EET_Aerondight );
  3541.  
  3542. if( HasBuff( EET_PhantomWeapon ) ) //modSigns
  3543. RemoveBuff( EET_PhantomWeapon );
  3544.  
  3545. //cleanup runewords
  3546. RemoveAbilityAll('Runeword 10 Buff');
  3547. //thePlayer.abilityManager.ResetOverhealBonus();
  3548. RemoveBuff(EET_Runeword4); //modSigns
  3549. runewordInfusionType = ST_None;
  3550. RemoveBuff(EET_Runeword11); //modSigns
  3551.  
  3552. RemoveAbilityAll('Glyphword 14 _Stats'); //modSigns
  3553. RemoveAbilityAll('Glyphword 10 _Stats'); //modSigns
  3554.  
  3555. //begin out of combat adrenaline drain
  3556. if(GetStat(BCS_Focus) > 0)
  3557. {
  3558. AddTimer('DelayedAdrenalineDrain', theGame.params.ADRENALINE_DRAIN_AFTER_COMBAT_DELAY, , , , true);
  3559. }
  3560.  
  3561. //profile tracker
  3562. usedQuenInCombat = false;
  3563. theGame.GetGamerProfile().ResetStat(ES_FinesseKills);
  3564.  
  3565. //sword sheathing
  3566. LogChannel( 'OnCombatFinished', "OnCombatFinished: DelayedSheathSword timer added" );
  3567. inGameConfigWrapper = (CInGameConfigWrapper)theGame.GetInGameConfigWrapper();
  3568. disableAutoSheathe = inGameConfigWrapper.GetVarValue( 'Gameplay', 'DisableAutomaticSwordSheathe' );
  3569. if( !disableAutoSheathe )
  3570. {
  3571. if ( ShouldAutoSheathSwordInstantly() )
  3572. AddTimer( 'DelayedSheathSword', 0.5f );
  3573. else
  3574. AddTimer( 'DelayedSheathSword', 2.f );
  3575. }
  3576.  
  3577. OnBlockAllCombatTickets( false );
  3578. }
  3579.  
  3580. public function PlayHitEffect( damageAction : W3DamageAction )
  3581. {
  3582. var hitReactionType : EHitReactionType;
  3583. var isAtBack : bool;
  3584.  
  3585.  
  3586. if( damageAction.GetMutation4Triggered() )
  3587. {
  3588. hitReactionType = damageAction.GetHitReactionType();
  3589. isAtBack = IsAttackerAtBack( damageAction.attacker );
  3590.  
  3591. if( hitReactionType != EHRT_Heavy )
  3592. {
  3593. if( isAtBack )
  3594. {
  3595. damageAction.SetHitEffect( 'light_hit_back_toxic', true );
  3596. }
  3597. else
  3598. {
  3599. damageAction.SetHitEffect( 'light_hit_toxic' );
  3600. }
  3601. }
  3602. else
  3603. {
  3604. if( isAtBack )
  3605. {
  3606. damageAction.SetHitEffect( 'heavy_hit_back_toxic' ,true );
  3607. }
  3608. else
  3609. {
  3610. damageAction.SetHitEffect( 'heavy_hit_toxic' );
  3611. }
  3612. }
  3613. }
  3614.  
  3615. super.PlayHitEffect( damageAction );
  3616. }
  3617.  
  3618. timer function DelayedAdrenalineDrain(dt : float, id : int)
  3619. {
  3620. if ( !HasBuff(EET_Runeword8) )
  3621. AddEffectDefault(EET_AdrenalineDrain, this, "after_combat_adrenaline_drain");
  3622. }
  3623.  
  3624.  
  3625. protected function Attack( hitTarget : CGameplayEntity, animData : CPreAttackEventData, weaponId : SItemUniqueId, parried : bool, countered : bool, parriedBy : array<CActor>, attackAnimationName : name, hitTime : float, weaponEntity : CItemEntity)
  3626. {
  3627. //var mutagen17 : W3Mutagen17_Effect;
  3628.  
  3629. //modSigns: check for mutagen17 activation
  3630. //if(HasBuff(EET_Mutagen17))
  3631. //{
  3632. // mutagen17 = (W3Mutagen17_Effect)GetBuff(EET_Mutagen17);
  3633. // if(mutagen17.IsBoostAvailable())
  3634. // {
  3635. // mutagen17.ActivateBoost();
  3636. // //theGame.witcherLog.AddMessage("mutagen17 boost activated: attack"); //modSigns: debug
  3637. // }
  3638. //}
  3639.  
  3640. super.Attack(hitTarget, animData, weaponId, parried, countered, parriedBy, attackAnimationName, hitTime, weaponEntity);
  3641.  
  3642. /*if( (CActor)hitTarget && HasBuff(EET_Mutagen17) )
  3643. {
  3644. mutagen17 = (W3Mutagen17_Effect)GetBuff(EET_Mutagen17);
  3645. if(mutagen17.HasBoost())
  3646. {
  3647. mutagen17.ClearBoost();
  3648. }
  3649. }*/ //modSigns: move to other place
  3650. }
  3651.  
  3652. //modSigns: redone completely
  3653. public final timer function SpecialAttackLightSustainCost(dt : float, id : int)
  3654. {
  3655. if(abilityManager && abilityManager.IsInitialized() && IsAlive() && HasResourcesForWhirl(dt))
  3656. {
  3657. PauseStaminaRegen('WhirlSkill');
  3658. PauseFocusGain(true);
  3659. AddTimer('ResumeFocusGain', 1.f);
  3660. WhirlDrainResources(dt);
  3661. }
  3662. else
  3663. {
  3664. OnPerformSpecialAttack(true, false);
  3665. }
  3666. /*var focusPerSec, cost, delay : float;
  3667. var reduction : SAbilityAttributeValue;
  3668. var skillLevel : int;
  3669.  
  3670. if(abilityManager && abilityManager.IsInitialized() && IsAlive())
  3671. {
  3672. PauseStaminaRegen('WhirlSkill');
  3673.  
  3674. if(GetStat(BCS_Stamina) > 0)
  3675. {
  3676. cost = GetStaminaActionCost(ESAT_Ability, GetSkillAbilityName(S_Sword_s01), dt);
  3677. delay = GetStaminaActionDelay(ESAT_Ability, GetSkillAbilityName(S_Sword_s01), dt);
  3678. skillLevel = GetSkillLevel(S_Sword_s01);
  3679.  
  3680. if(skillLevel > 1)
  3681. {
  3682. reduction = GetSkillAttributeValue(S_Sword_s01, 'cost_reduction', false, true) * (skillLevel - 1);
  3683. cost = MaxF(0, cost * (1 - reduction.valueMultiplicative) - reduction.valueAdditive);
  3684. }
  3685.  
  3686. DrainStamina(ESAT_FixedValue, cost, delay, GetSkillAbilityName(S_Sword_s01));
  3687. }
  3688. else
  3689. {
  3690. GetSkillAttributeValue(S_Sword_s01, 'focus_cost_per_sec', false, true);
  3691. focusPerSec = GetWhirlFocusCostPerSec();
  3692. DrainFocus(focusPerSec * dt);
  3693. }
  3694. }
  3695.  
  3696. if(GetStat(BCS_Stamina) <= 0 && GetStat(BCS_Focus) <= 0)
  3697. {
  3698. OnPerformSpecialAttack(true, false);
  3699. }*/
  3700. }
  3701.  
  3702. /*public final function GetWhirlFocusCostPerSec() : float
  3703. {
  3704. var ability : SAbilityAttributeValue;
  3705. var val : float;
  3706. var skillLevel : int;
  3707.  
  3708. ability = GetSkillAttributeValue(S_Sword_s01, 'focus_cost_per_sec_initial', false, false);
  3709. skillLevel = GetSkillLevel(S_Sword_s01);
  3710.  
  3711. if(skillLevel > 1)
  3712. ability -= GetSkillAttributeValue(S_Sword_s01, 'cost_reduction', false, false) * (skillLevel-1);
  3713.  
  3714. val = CalculateAttributeValue(ability);
  3715.  
  3716. return val;
  3717. }*/ //modSigns: redone
  3718.  
  3719. //modSigns
  3720. public final function HasResourcesForWhirl(dt : float) : bool
  3721. {
  3722. return GetStat(BCS_Stamina) >= GetWhirlStaminaCost(dt);
  3723. }
  3724.  
  3725. public final function GetWhirlStaminaCost(dt : float) : float
  3726. {
  3727. var cost : float;
  3728. cost = GetStaminaActionCost(ESAT_Ability, GetSkillAbilityName(S_Sword_s01), dt);
  3729. cost *= 1 - CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s01, 'stamina_cost_reduction_after_1', false, false)) * (GetSkillLevel(S_Sword_s01) - 1);
  3730. if(HasBuff(EET_Mutagen04))
  3731. cost *= 1 + ((W3Mutagen04_Effect)GetBuff(EET_Mutagen04)).GetAttackCostIncrease();
  3732. return cost;
  3733. }
  3734.  
  3735. //modSigns
  3736. private final function WhirlDrainResources(dt : float)
  3737. {
  3738. var delay : float;
  3739. var cost : float;
  3740. delay = GetStaminaActionDelay(ESAT_Ability, GetSkillAbilityName(S_Sword_s01), dt);
  3741. cost = GetWhirlStaminaCost(dt);
  3742. DrainStamina(ESAT_FixedValue, cost, delay, GetSkillAbilityName(S_Sword_s01));
  3743. //calculating adrenaline drain manually, so it's not affected by stamina bonuses/penalties
  3744. cost = CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s01, 'stamina_cost_per_sec', false, false))
  3745. * (1 - CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s01, 'stamina_cost_reduction_after_1', false, false)) * (GetSkillLevel(S_Sword_s01) - 1));
  3746. cost *= dt;
  3747. DrainFocus(cost/GetStatMax(BCS_Stamina));
  3748. }
  3749.  
  3750. //modSigns
  3751. public final function GetNumHostilesInRange() : int
  3752. {
  3753. var ents : array<CGameplayEntity>;
  3754.  
  3755. FindGameplayEntitiesInRange(ents, this, 30, 100, , FLAG_OnlyAliveActors + FLAG_ExcludeTarget + FLAG_Attitude_Hostile, this);
  3756.  
  3757. return ents.Size();
  3758. }
  3759.  
  3760. //modSigns
  3761. public final function GetWhirlDamageBonus() : float
  3762. {
  3763. var bonusCount : int;
  3764. var ability : SAbilityAttributeValue;
  3765. var damageBonus : float;
  3766.  
  3767. bonusCount = Clamp(GetNumHostilesInRange() - 1, 0, 5);
  3768. ability = GetSkillAttributeValue(S_Sword_s01, 'whirl_dmg_bonus', false, true) * GetSkillLevel(S_Sword_s01);
  3769. damageBonus = ability.valueMultiplicative * bonusCount;
  3770.  
  3771. return damageBonus;
  3772. }
  3773.  
  3774. //modSigns
  3775. public final function GetRendPowerBonus() : float
  3776. {
  3777. var rendLoad, rendBonus, rendRatio : float;
  3778. var attackBonus, rendBonusPerPoint, staminaRendBonus : SAbilityAttributeValue;
  3779.  
  3780. rendBonus = 0;
  3781. //unconditional bonus
  3782. attackBonus = GetSkillAttributeValue(S_Sword_s02, 'attack_damage_bonus', false, true) * GetSkillLevel(S_Sword_s02);
  3783. rendBonus += attackBonus.valueMultiplicative;
  3784. //check how much of the 'gauge' player channeled
  3785. rendRatio = GetSpecialAttackTimeRatio();
  3786. if(rendRatio > 0)
  3787. {
  3788. //bonus for stamina usage (per skill level, per stamina point)
  3789. staminaRendBonus = GetSkillAttributeValue(S_Sword_s02, 'stamina_max_dmg_bonus', false, true) * GetSkillLevel(S_Sword_s02);
  3790. rendBonus += rendRatio * GetStatMax(BCS_Stamina) * staminaRendBonus.valueMultiplicative;
  3791. }
  3792. //adrenaline points
  3793. rendLoad = GetStat(BCS_Focus);
  3794. //do not round adrenaline points, use as many as possible
  3795. if(rendLoad > 0)
  3796. {
  3797. //bonus for adrenaline usage (per skill level)
  3798. rendBonusPerPoint = GetSkillAttributeValue(S_Sword_s02, 'adrenaline_final_damage_bonus', false, true) * GetSkillLevel(S_Sword_s02);
  3799. rendBonus += rendLoad * rendBonusPerPoint.valueMultiplicative;
  3800. }
  3801. //theGame.witcherLog.AddMessage("Rend ratio: " + rendRatio);
  3802. //theGame.witcherLog.AddMessage("Rend load: " + rendLoad);
  3803. //theGame.witcherLog.AddMessage("Rend bonus: " + rendBonus);
  3804. return rendBonus;
  3805. }
  3806.  
  3807. //modSigns
  3808. public final function GetRendStaminaCost(dt : float) : float
  3809. {
  3810. return GetStaminaActionCost(ESAT_Ability, GetSkillAbilityName(S_Sword_s02), dt);
  3811. }
  3812.  
  3813. public final timer function SpecialAttackHeavySustainCost(dt : float, id : int)
  3814. {
  3815. var focusHighlight, ratio : float;
  3816. var hud : CR4ScriptedHud;
  3817. var hudWolfHeadModule : CR4HudModuleWolfHead;
  3818.  
  3819. PauseStaminaRegen('RendSkill'); //modSigns
  3820.  
  3821. DrainStamina(ESAT_Ability, 0, 0, GetSkillAbilityName(S_Sword_s02), dt);
  3822.  
  3823.  
  3824. if(GetStat(BCS_Stamina) <= 0)
  3825. OnPerformSpecialAttack(false, false);
  3826.  
  3827.  
  3828. ratio = EngineTimeToFloat(theGame.GetEngineTime() - specialHeavyStartEngineTime) / specialHeavyChargeDuration;
  3829.  
  3830. if(ratio > 0.99) //modSigns
  3831. ratio = 1;
  3832.  
  3833. SetSpecialAttackTimeRatio(ratio);
  3834.  
  3835.  
  3836. //focusHighlight = ratio * GetStatMax(BCS_Focus);
  3837. //focusHighlight = MinF(focusHighlight, GetStat(BCS_Focus));
  3838. //focusHighlight = FloorF(focusHighlight);
  3839. //modSigns
  3840. /*focusHighlight = FloorF(ratio * GetStat(BCS_Focus));
  3841.  
  3842. hud = (CR4ScriptedHud)theGame.GetHud();
  3843. if ( hud )
  3844. {
  3845. hudWolfHeadModule = (CR4HudModuleWolfHead)hud.GetHudModule( "WolfHeadModule" );
  3846. if ( hudWolfHeadModule )
  3847. {
  3848. hudWolfHeadModule.LockFocusPoints((int)focusHighlight);
  3849. }
  3850. }*/
  3851. }
  3852.  
  3853. public function OnSpecialAttackHeavyActionProcess()
  3854. {
  3855. var hud : CR4ScriptedHud;
  3856. var hudWolfHeadModule : CR4HudModuleWolfHead;
  3857.  
  3858. super.OnSpecialAttackHeavyActionProcess();
  3859.  
  3860. hud = (CR4ScriptedHud)theGame.GetHud();
  3861. if ( hud )
  3862. {
  3863. hudWolfHeadModule = (CR4HudModuleWolfHead)hud.GetHudModule( "WolfHeadModule" );
  3864. if ( hudWolfHeadModule )
  3865. {
  3866. hudWolfHeadModule.ResetFocusPoints();
  3867. }
  3868. }
  3869. }
  3870.  
  3871. timer function IsSpecialLightAttackInputHeld ( time : float, id : int )
  3872. {
  3873. var hasResource : bool;
  3874.  
  3875. if ( GetCurrentStateName() == 'CombatSteel' || GetCurrentStateName() == 'CombatSilver' )
  3876. {
  3877. if ( GetBIsCombatActionAllowed() && inputHandler.IsActionAllowed(EIAB_SwordAttack))
  3878. {
  3879. /*if(GetStat(BCS_Stamina) > 0)
  3880. {
  3881. hasResource = true;
  3882. }
  3883. else
  3884. {
  3885. hasResource = (GetStat(BCS_Focus) >= GetWhirlFocusCostPerSec() * time);
  3886. }*/ //modSigns: redone
  3887. hasResource = HasResourcesForWhirl(0.5f);
  3888.  
  3889. if(hasResource)
  3890. {
  3891. SetupCombatAction( EBAT_SpecialAttack_Light, BS_Pressed );
  3892. RemoveTimer('IsSpecialLightAttackInputHeld');
  3893. }
  3894. else if(!playedSpecialAttackMissingResourceSound)
  3895. {
  3896. //IndicateTooLowAdrenaline(); //modSigns
  3897. SetShowToLowStaminaIndication(GetWhirlStaminaCost(0.5f));
  3898. SoundEvent("gui_no_stamina");
  3899. playedSpecialAttackMissingResourceSound = true;
  3900. }
  3901. }
  3902. }
  3903. else
  3904. {
  3905. RemoveTimer('IsSpecialLightAttackInputHeld');
  3906. }
  3907. }
  3908.  
  3909. timer function IsSpecialHeavyAttackInputHeld ( time : float, id : int )
  3910. {
  3911. var cost : float;
  3912.  
  3913. if ( GetCurrentStateName() == 'CombatSteel' || GetCurrentStateName() == 'CombatSilver' )
  3914. {
  3915. //cost = CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s02, 'stamina_cost_per_sec', false, false));
  3916. cost = GetRendStaminaCost(0.5f); //modSigns
  3917.  
  3918. if( GetBIsCombatActionAllowed() && inputHandler.IsActionAllowed(EIAB_SwordAttack))
  3919. {
  3920. if(GetStat(BCS_Stamina) >= cost)
  3921. {
  3922. SetupCombatAction( EBAT_SpecialAttack_Heavy, BS_Pressed );
  3923. RemoveTimer('IsSpecialHeavyAttackInputHeld');
  3924. }
  3925. else if(!playedSpecialAttackMissingResourceSound)
  3926. {
  3927. //IndicateTooLowAdrenaline(); //modSigns
  3928. SetShowToLowStaminaIndication(cost);
  3929. SoundEvent("gui_no_stamina");
  3930. playedSpecialAttackMissingResourceSound = true;
  3931. }
  3932. }
  3933. }
  3934. else
  3935. {
  3936. RemoveTimer('IsSpecialHeavyAttackInputHeld');
  3937. }
  3938. }
  3939.  
  3940. public function EvadePressed( bufferAction : EBufferActionType )
  3941. {
  3942. var cat : float;
  3943.  
  3944. if( (bufferAction == EBAT_Dodge && IsActionAllowed(EIAB_Dodge)) || (bufferAction == EBAT_Roll && IsActionAllowed(EIAB_Roll)) )
  3945. {
  3946. //modSigns: check for stamina
  3947. if( bufferAction == EBAT_Dodge && !HasStaminaToUseAction(ESAT_Dodge, '', 0, 0 ) ||
  3948. bufferAction == EBAT_Roll && !HasStaminaToUseAction(ESAT_Roll, '', 0, 0 ) )
  3949. {
  3950. SoundEvent("gui_no_stamina");
  3951. return;
  3952. }
  3953.  
  3954. if(bufferAction != EBAT_Roll && ShouldProcessTutorial('TutorialDodge'))
  3955. {
  3956. FactsAdd("tut_in_dodge", 1, 2);
  3957.  
  3958. if(FactsQuerySum("tut_fight_use_slomo") > 0)
  3959. {
  3960. theGame.RemoveTimeScale( theGame.GetTimescaleSource(ETS_TutorialFight) );
  3961. FactsRemove("tut_fight_slomo_ON");
  3962. }
  3963. }
  3964. else if(bufferAction == EBAT_Roll && ShouldProcessTutorial('TutorialRoll'))
  3965. {
  3966. FactsAdd("tut_in_roll", 1, 2);
  3967.  
  3968. if(FactsQuerySum("tut_fight_use_slomo") > 0)
  3969. {
  3970. theGame.RemoveTimeScale( theGame.GetTimescaleSource(ETS_TutorialFight) );
  3971. FactsRemove("tut_fight_slomo_ON");
  3972. }
  3973. }
  3974.  
  3975. if ( GetBIsInputAllowed() )
  3976. {
  3977. if ( GetBIsCombatActionAllowed() )
  3978. {
  3979. CriticalEffectAnimationInterrupted("Dodge 2");
  3980. PushCombatActionOnBuffer( bufferAction, BS_Released );
  3981. ProcessCombatActionBuffer();
  3982. }
  3983. else if ( IsInCombatAction() && GetBehaviorVariable( 'combatActionType' ) == (int)CAT_Attack )
  3984. {
  3985. if ( CanPlayHitAnim() && IsThreatened() )
  3986. {
  3987. CriticalEffectAnimationInterrupted("Dodge 1");
  3988. PushCombatActionOnBuffer( bufferAction, BS_Released );
  3989. ProcessCombatActionBuffer();
  3990. }
  3991. else
  3992. PushCombatActionOnBuffer( bufferAction, BS_Released );
  3993. }
  3994.  
  3995. else if ( !( IsCurrentSignChanneled() ) )
  3996. {
  3997.  
  3998. PushCombatActionOnBuffer( bufferAction, BS_Released );
  3999. }
  4000. }
  4001. else
  4002. {
  4003. if ( IsInCombatAction() && GetBehaviorVariable( 'combatActionType' ) == (int)CAT_Attack )
  4004. {
  4005. if ( CanPlayHitAnim() && IsThreatened() )
  4006. {
  4007. CriticalEffectAnimationInterrupted("Dodge 3");
  4008. PushCombatActionOnBuffer( bufferAction, BS_Released );
  4009. ProcessCombatActionBuffer();
  4010. }
  4011. else
  4012. PushCombatActionOnBuffer( bufferAction, BS_Released );
  4013. }
  4014. LogChannel( 'InputNotAllowed', "InputNotAllowed" );
  4015. }
  4016. }
  4017. else
  4018. {
  4019. DisplayActionDisallowedHudMessage(EIAB_Dodge);
  4020. }
  4021. }
  4022.  
  4023. //modSigns
  4024. public saved var isLowStaminaSFXPlaying : bool;
  4025.  
  4026. public function CheckForLowStamina()
  4027. {
  4028. var sfxThreshold : float = theGame.params.GetLowStaminaSFXThreshold();
  4029. var staminaPrc : float = GetStatPercents(BCS_Stamina);
  4030. var rate : float;
  4031.  
  4032. if(staminaPrc < sfxThreshold && !isLowStaminaSFXPlaying)
  4033. {
  4034. isLowStaminaSFXPlaying = true;
  4035. //PlayEffectSingle('focus_sound_red_fx');
  4036. if(!theSound.SoundIsBankLoaded("heartbeat02a.bnk"))
  4037. theSound.SoundLoadBank("heartbeat02a.bnk", false);
  4038. theSound.SoundEvent("play_heartbeat_02a_loop");
  4039. theSound.SoundParameter("heartbeat_rate", theGame.params.GetLowStaminaSFXRate());
  4040. theSound.SoundParameter("heartbeat_volume", theGame.params.GetLowStaminaSFXVolume());
  4041. }
  4042. else if(staminaPrc >= sfxThreshold && isLowStaminaSFXPlaying)
  4043. {
  4044. isLowStaminaSFXPlaying = false;
  4045. //StopEffectIfActive('focus_sound_red_fx');
  4046. theSound.SoundEvent("stop_heartbeat_02a_loop");
  4047. }
  4048. if(isLowStaminaSFXPlaying)
  4049. {
  4050. rate = (1.0f - staminaPrc / sfxThreshold) * 100.0f;
  4051. if(theGame.params.GetLowStaminaSFXDynRate())
  4052. theSound.SoundParameter("heartbeat_rate", rate);
  4053. if(theGame.params.GetLowStaminaSFXDynVol())
  4054. theSound.SoundParameter("heartbeat_volume", rate);
  4055. }
  4056. }
  4057.  
  4058. public function StopLowStaminaSFX() //modSigns
  4059. {
  4060. isLowStaminaSFXPlaying = false;
  4061. //StopEffectIfActive('focus_sound_red_fx');
  4062. theSound.SoundEvent("stop_heartbeat_02a_loop");
  4063. }
  4064.  
  4065. public function ProcessCombatActionBuffer() : bool
  4066. {
  4067. var action : EBufferActionType = this.BufferCombatAction;
  4068. var stage : EButtonStage = this.BufferButtonStage;
  4069. var throwStage : EThrowStage;
  4070. var actionResult : bool = true;
  4071.  
  4072.  
  4073. if( isInFinisher )
  4074. {
  4075. return false;
  4076. }
  4077.  
  4078. if ( action != EBAT_SpecialAttack_Heavy )
  4079. specialAttackCamera = false;
  4080.  
  4081.  
  4082. if(super.ProcessCombatActionBuffer())
  4083. return true;
  4084.  
  4085. switch ( action )
  4086. {
  4087. case EBAT_CastSign :
  4088. {
  4089. switch ( stage )
  4090. {
  4091. case BS_Pressed :
  4092. {
  4093.  
  4094.  
  4095.  
  4096.  
  4097.  
  4098.  
  4099. actionResult = this.CastSign();
  4100. LogChannel('SignDebug', "CastSign()");
  4101.  
  4102.  
  4103. } break;
  4104.  
  4105. default :
  4106. {
  4107. actionResult = false;
  4108. } break;
  4109. }
  4110. } break;
  4111.  
  4112. case EBAT_SpecialAttack_Light :
  4113. {
  4114. switch ( stage )
  4115. {
  4116. case BS_Pressed :
  4117. {
  4118.  
  4119. actionResult = this.OnPerformSpecialAttack( true, true );
  4120. } break;
  4121.  
  4122. case BS_Released :
  4123. {
  4124. actionResult = this.OnPerformSpecialAttack( true, false );
  4125. } break;
  4126.  
  4127. default :
  4128. {
  4129. actionResult = false;
  4130. } break;
  4131. }
  4132. } break;
  4133.  
  4134. case EBAT_SpecialAttack_Heavy :
  4135. {
  4136. switch ( stage )
  4137. {
  4138. case BS_Pressed :
  4139. {
  4140.  
  4141. actionResult = this.OnPerformSpecialAttack( false, true );
  4142. } break;
  4143.  
  4144. case BS_Released :
  4145. {
  4146. actionResult = this.OnPerformSpecialAttack( false, false );
  4147. } break;
  4148.  
  4149. default :
  4150. {
  4151. actionResult = false;
  4152. } break;
  4153. }
  4154. } break;
  4155.  
  4156. default:
  4157. return false;
  4158. }
  4159.  
  4160.  
  4161. this.CleanCombatActionBuffer();
  4162.  
  4163. if (actionResult)
  4164. {
  4165. SetCombatAction( action ) ;
  4166. }
  4167.  
  4168. return true;
  4169. }
  4170.  
  4171.  
  4172. event OnPerformSpecialAttack( isLightAttack : bool, enableAttack : bool ){}
  4173.  
  4174. public final function GetEnemies() : array< CActor >
  4175. {
  4176. var actors, actors2 : array<CActor>;
  4177. var i : int;
  4178.  
  4179.  
  4180. actors = GetWitcherPlayer().GetHostileEnemies();
  4181. ArrayOfActorsAppendUnique( actors, GetWitcherPlayer().GetMoveTargets() );
  4182.  
  4183.  
  4184. thePlayer.GetVisibleEnemies( actors2 );
  4185. ArrayOfActorsAppendUnique( actors, actors2 );
  4186.  
  4187. for( i=actors.Size()-1; i>=0; i-=1 )
  4188. {
  4189. if( !IsRequiredAttitudeBetween( actors[i], this, true ) )
  4190. {
  4191. actors.EraseFast( i );
  4192. }
  4193. }
  4194.  
  4195. return actors;
  4196. }
  4197.  
  4198. event OnPlayerTickTimer( deltaTime : float )
  4199. {
  4200. super.OnPlayerTickTimer( deltaTime );
  4201.  
  4202. if ( !IsInCombat() )
  4203. {
  4204. fastAttackCounter = 0;
  4205. heavyAttackCounter = 0;
  4206. }
  4207. WmkGetMapMenuInstance().OnTick(deltaTime); // -= WMK:modAQOOM =-
  4208. }
  4209.  
  4210.  
  4211.  
  4212.  
  4213.  
  4214. 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
  4215. {
  4216. var ret : bool;
  4217. var skill : ESkill;
  4218.  
  4219. ret = super.PrepareAttackAction(hitTarget, animData, weaponId, parried, countered, parriedBy, attackAnimationName, hitTime, weaponEntity, attackAction);
  4220.  
  4221. if(!ret)
  4222. return false;
  4223.  
  4224.  
  4225. if(attackAction.IsActionMelee())
  4226. {
  4227. skill = SkillNameToEnum( attackAction.GetAttackTypeName() );
  4228. if( skill != S_SUndefined && CanUseSkill(skill))
  4229. {
  4230. if(IsLightAttack(animData.attackName))
  4231. fastAttackCounter += 1;
  4232. else
  4233. fastAttackCounter = 0;
  4234.  
  4235. if(IsHeavyAttack(animData.attackName))
  4236. heavyAttackCounter += 1;
  4237. else
  4238. heavyAttackCounter = 0;
  4239. }
  4240. }
  4241.  
  4242. AddTimer('FastAttackCounterDecay',5.0);
  4243. AddTimer('HeavyAttackCounterDecay',5.0);
  4244.  
  4245. return true;
  4246. }
  4247.  
  4248. protected function TestParryAndCounter(data : CPreAttackEventData, weaponId : SItemUniqueId, out parried : bool, out countered : bool) : array<CActor>
  4249. {
  4250.  
  4251. if(SkillNameToEnum(attackActionName) == S_Sword_s02)
  4252. data.Can_Parry_Attack = false;
  4253.  
  4254. return super.TestParryAndCounter(data, weaponId, parried, countered);
  4255. }
  4256.  
  4257. private timer function FastAttackCounterDecay(delta : float, id : int)
  4258. {
  4259. fastAttackCounter = 0;
  4260. }
  4261.  
  4262. private timer function HeavyAttackCounterDecay(delta : float, id : int)
  4263. {
  4264. heavyAttackCounter = 0;
  4265. }
  4266.  
  4267.  
  4268. public function GetCraftingSchematicsNames() : array<name> {return craftingSchematics;}
  4269.  
  4270. public function RemoveAllCraftingSchematics()
  4271. {
  4272. craftingSchematics.Clear();
  4273. }
  4274.  
  4275.  
  4276. function AddCraftingSchematic( nam : name, optional isSilent : bool, optional skipTutorialUpdate : bool ) : bool
  4277. {
  4278. var i : int;
  4279.  
  4280. if(!skipTutorialUpdate && ShouldProcessTutorial('TutorialCraftingGotRecipe'))
  4281. {
  4282. FactsAdd("tut_received_schematic");
  4283. }
  4284.  
  4285. for(i=0; i<craftingSchematics.Size(); i+=1)
  4286. {
  4287. if(craftingSchematics[i] == nam)
  4288. return false;
  4289.  
  4290.  
  4291. if(StrCmp(craftingSchematics[i],nam) > 0)
  4292. {
  4293. craftingSchematics.Insert(i,nam);
  4294. AddCraftingHudNotification( nam, isSilent );
  4295. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_CraftingSchematics );
  4296. return true;
  4297. }
  4298. }
  4299.  
  4300.  
  4301. craftingSchematics.PushBack(nam);
  4302. AddCraftingHudNotification( nam, isSilent );
  4303. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_CraftingSchematics );
  4304. return true;
  4305. }
  4306.  
  4307. function AddCraftingHudNotification( nam : name, isSilent : bool )
  4308. {
  4309. var hud : CR4ScriptedHud;
  4310. if( !isSilent )
  4311. {
  4312. hud = (CR4ScriptedHud)theGame.GetHud();
  4313. if( hud )
  4314. {
  4315. hud.OnCraftingSchematicUpdate( nam );
  4316. }
  4317. }
  4318. }
  4319.  
  4320. function AddAlchemyHudNotification( nam : name, isSilent : bool )
  4321. {
  4322. var hud : CR4ScriptedHud;
  4323. if( !isSilent )
  4324. {
  4325. hud = (CR4ScriptedHud)theGame.GetHud();
  4326. if( hud )
  4327. {
  4328. hud.OnAlchemySchematicUpdate( nam );
  4329. }
  4330. }
  4331. }
  4332.  
  4333. public function GetExpandedCraftingCategories() : array< name >
  4334. {
  4335. return expandedCraftingCategories;
  4336. }
  4337.  
  4338. public function AddExpandedCraftingCategory( category : name )
  4339. {
  4340. if ( IsNameValid( category ) )
  4341. {
  4342. ArrayOfNamesPushBackUnique( expandedCraftingCategories, category );
  4343. }
  4344. }
  4345.  
  4346. public function RemoveExpandedCraftingCategory( category : name )
  4347. {
  4348. if ( IsNameValid( category ) )
  4349. {
  4350. expandedCraftingCategories.Remove( category );
  4351. }
  4352. }
  4353.  
  4354. public function SetCraftingFilters(showHasIngre : bool, showMissingIngre : bool, showAlreadyCrafted : bool )
  4355. {
  4356. craftingFilters.showCraftable = showHasIngre;
  4357. craftingFilters.showMissingIngre = showMissingIngre;
  4358. craftingFilters.showAlreadyCrafted = showAlreadyCrafted;
  4359. }
  4360.  
  4361. public function GetCraftingFilters() : SCraftingFilters
  4362. {
  4363.  
  4364. if ( craftingFilters.showCraftable == false && craftingFilters.showMissingIngre == false && craftingFilters.showAlreadyCrafted == false )
  4365. {
  4366. craftingFilters.showCraftable = true;
  4367. craftingFilters.showMissingIngre = true;
  4368. craftingFilters.showAlreadyCrafted = false;
  4369. }
  4370.  
  4371. return craftingFilters;
  4372. }
  4373.  
  4374.  
  4375.  
  4376.  
  4377.  
  4378. event OnMutation11Triggered()
  4379. {
  4380. var min, max : SAbilityAttributeValue;
  4381. var healValue : float;
  4382. var quenEntity : W3QuenEntity;
  4383.  
  4384.  
  4385. if( IsSwimming() || IsDiving() || IsSailing() || IsUsingHorse() || IsUsingBoat() || IsUsingVehicle() || IsUsingExploration() )
  4386. {
  4387.  
  4388. //ForceSetStat( BCS_Vitality, GetStatMax( BCS_Vitality ) );
  4389. //
  4390. //
  4391. //theGame.MutationHUDFeedback( MFT_PlayOnce );
  4392. //
  4393. //
  4394. //GCameraShake( 1.0f, , , , true, 'camera_shake_loop_lvl1_1' );
  4395. //AddTimer( 'StopMutation11CamShake', 2.f );
  4396. //
  4397. //
  4398. //theGame.VibrateControllerVeryHard( 2.f );
  4399. //
  4400. //
  4401. //Mutation11ShockWave( true );
  4402.  
  4403.  
  4404. AddEffectDefault( EET_Mutation11Debuff, NULL, "Mutation 11 Debuff", false );
  4405. }
  4406. else
  4407. {
  4408. AddEffectDefault( EET_Mutation11Buff, this, "Mutation 11", false );
  4409. }
  4410. }
  4411.  
  4412. timer function StopMutation11CamShake( dt : float, id : int )
  4413. {
  4414. theGame.GetGameCamera().StopAnimation( 'camera_shake_loop_lvl1_1' );
  4415. }
  4416.  
  4417. public function Mutation12GetBonus() : float //modSigns
  4418. {
  4419. var min, max : SAbilityAttributeValue;
  4420. var buffs : array< CBaseGameplayEffect >;
  4421.  
  4422. buffs = GetDrunkMutagens("Mutation12");
  4423. if(buffs.Size() > 0)
  4424. {
  4425. theGame.GetDefinitionsManager().GetAbilityAttributeValue('Mutation12', 'mut12bonus', min, max);
  4426. return buffs.Size() * min.valueAdditive;
  4427. }
  4428. else
  4429. return 0;
  4430. }
  4431.  
  4432. private var mutation12IsOnCooldown : bool;
  4433.  
  4434. public final function AddMutation12Decoction() //modSigns: removed, mechanic changed
  4435. {
  4436. //var params : SCustomEffectParams;
  4437. //var buffs : array< EEffectType >;
  4438. //var existingDecoctionBuffs : array<CBaseGameplayEffect>;
  4439. //var i : int;
  4440. //var effectType : EEffectType;
  4441. //var decoctions : array< SItemUniqueId >;
  4442. //var tmpName : name;
  4443. //var min, max : SAbilityAttributeValue;
  4444. //
  4445. //if( mutation12IsOnCooldown )
  4446. //{
  4447. // return;
  4448. //}
  4449. //
  4450. //
  4451. //existingDecoctionBuffs = GetDrunkMutagens( "Mutation12" );
  4452. //theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation12', 'maxcap', min, max );
  4453. //if( existingDecoctionBuffs.Size() >= min.valueAdditive )
  4454. //{
  4455. // return;
  4456. //}
  4457. //
  4458. //
  4459. //mutation12IsOnCooldown = true;
  4460. //theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation12', 'cooldown', min, max );
  4461. //AddTimer( 'Mutation12Cooldown', CalculateAttributeValue( min ) );
  4462. //
  4463. //
  4464. //decoctions = inv.GetItemsByTag( 'Mutagen' );
  4465. //
  4466. //
  4467. //for( i=decoctions.Size()-1; i>=0; i-=1 )
  4468. //{
  4469. // inv.GetPotionItemBuffData( decoctions[i], effectType, tmpName );
  4470. // if( HasBuff( effectType ) )
  4471. // {
  4472. // decoctions.EraseFast( i );
  4473. // continue;
  4474. // }
  4475. // buffs.PushBack( effectType );
  4476. //}
  4477. //
  4478. //
  4479. //if( buffs.Size() == 0 )
  4480. //{
  4481. // for( i=EET_Mutagen01; i<=EET_Mutagen28; i+=1 )
  4482. // {
  4483. // if( !HasBuff( i ) )
  4484. // {
  4485. // buffs.PushBack( i );
  4486. // }
  4487. // }
  4488. //}
  4489. //
  4490. //
  4491. ////buffs.Remove( EET_Mutagen16 ); //modSigns
  4492. ////buffs.Remove( EET_Mutagen24 ); //modSigns
  4493. //
  4494. //
  4495. //if( buffs.Size() == 0 )
  4496. //{
  4497. // return;
  4498. //}
  4499. //
  4500. //
  4501. //theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation12', 'duration', min, max );
  4502. //params.effectType = buffs[ RandRange( buffs.Size() ) ];
  4503. //params.creator = this;
  4504. //params.sourceName = "Mutation12";
  4505. //params.duration = min.valueAdditive;
  4506. //AddEffectCustom( params );
  4507. //( ( W3Mutagen_Effect ) GetBuff( params.effectType, params.sourceName ) ).OverrideIcon( DecoctionEffectTypeToItemName( params.effectType ) );
  4508. //
  4509. //
  4510. //if ( !IsEffectActive( 'invisible' ) )
  4511. //{
  4512. // PlayEffect( 'use_potion' );
  4513. //}
  4514. //
  4515. //theGame.MutationHUDFeedback( MFT_PlayOnce );
  4516. }
  4517.  
  4518. timer function Mutation12Cooldown( dt : float, id : int )
  4519. {
  4520. mutation12IsOnCooldown = false;
  4521. }
  4522.  
  4523.  
  4524. public final function HasResourcesToStartAnyMutationResearch() : bool
  4525. {
  4526. var greenPoints, redPoints, bluePoints, count : int;
  4527. var itemIDs : array< SItemUniqueId >;
  4528.  
  4529. if( levelManager.GetPointsFree( ESkillPoint ) > 0 )
  4530. {
  4531. return true;
  4532. }
  4533.  
  4534.  
  4535. count = inv.GetItemQuantityByName( 'Greater mutagen green' );
  4536. if( count > 0 )
  4537. {
  4538. itemIDs = inv.GetItemsByName( 'Greater mutagen green' );
  4539. greenPoints = inv.GetMutationResearchPoints( SC_Green, itemIDs[0] );
  4540. if( greenPoints > 0 )
  4541. {
  4542. return true;
  4543. }
  4544. }
  4545. count = inv.GetItemQuantityByName( 'Greater mutagen red' );
  4546. if( count > 0 )
  4547. {
  4548. itemIDs.Clear();
  4549. itemIDs = inv.GetItemsByName( 'Greater mutagen red' );
  4550. redPoints = inv.GetMutationResearchPoints( SC_Red, itemIDs[0] );
  4551. if( redPoints > 0 )
  4552. {
  4553. return true;
  4554. }
  4555. }
  4556. count = inv.GetItemQuantityByName( 'Greater mutagen blue' );
  4557. if( count > 0 )
  4558. {
  4559. itemIDs.Clear();
  4560. itemIDs = inv.GetItemsByName( 'Greater mutagen blue' );
  4561. bluePoints = inv.GetMutationResearchPoints( SC_Blue, itemIDs[0] );
  4562. if( bluePoints > 0 )
  4563. {
  4564. return true;
  4565. }
  4566. }
  4567.  
  4568. return false;
  4569. }
  4570.  
  4571.  
  4572. public final function Mutation11StartAnimation()
  4573. {
  4574.  
  4575. thePlayer.ActionPlaySlotAnimationAsync( 'PLAYER_SLOT', 'geralt_mutation_11', 0.2, 0.2 );
  4576.  
  4577.  
  4578. BlockAllActions( 'Mutation11', true );
  4579.  
  4580.  
  4581. loopingCameraShakeAnimName = 'camera_shake_loop_lvl1_1';
  4582. GCameraShake( 1.0f, , , , true, loopingCameraShakeAnimName );
  4583.  
  4584.  
  4585. theGame.VibrateControllerVeryHard( 15.f );
  4586.  
  4587.  
  4588. storedInteractionPriority = GetInteractionPriority();
  4589. SetInteractionPriority( IP_Max_Unpushable );
  4590. }
  4591.  
  4592. event OnAnimEvent_Mutation11ShockWave( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4593. {
  4594. Mutation11ShockWave( false );
  4595. }
  4596.  
  4597. private final function Mutation11ShockWave( skipQuenSign : bool )
  4598. {
  4599. var action : W3DamageAction;
  4600. var ents : array< CGameplayEntity >;
  4601. var i, j : int;
  4602. var damages : array< SRawDamage >;
  4603. var quen : W3QuenEntity; //modSigns
  4604.  
  4605.  
  4606. FindGameplayEntitiesInSphere(ents, GetWorldPosition(), 5.f, 1000, '', FLAG_OnlyAliveActors + FLAG_ExcludeTarget + FLAG_Attitude_Hostile + FLAG_Attitude_Neutral, this);
  4607.  
  4608. if( ents.Size() > 0 )
  4609. {
  4610. damages = theGame.GetDefinitionsManager().GetDamagesFromAbility( 'Mutation11' );
  4611. }
  4612.  
  4613.  
  4614. for(i=0; i<ents.Size(); i+=1)
  4615. {
  4616. action = new W3DamageAction in theGame;
  4617. action.Initialize( this, ents[i], NULL, "Mutation11", EHRT_Heavy, CPS_SpellPower, false, false, true, false );
  4618.  
  4619. for( j=0; j<damages.Size(); j+=1 )
  4620. {
  4621. action.AddDamage( damages[j].dmgType, damages[j].dmgVal );
  4622. }
  4623.  
  4624. action.SetCannotReturnDamage( true );
  4625. action.SetProcessBuffsIfNoDamage( true );
  4626. action.AddEffectInfo( EET_KnockdownTypeApplicator );
  4627. action.SetHitAnimationPlayType( EAHA_ForceYes );
  4628. action.SetCanPlayHitParticle( false );
  4629.  
  4630. theGame.damageMgr.ProcessAction( action );
  4631. delete action;
  4632. }
  4633.  
  4634.  
  4635.  
  4636.  
  4637.  
  4638. mutation11QuenEntity = ( W3QuenEntity )GetSignEntity( ST_Quen );
  4639. if( !mutation11QuenEntity )
  4640. {
  4641. mutation11QuenEntity = (W3QuenEntity)theGame.CreateEntity( GetSignTemplate( ST_Quen ), GetWorldPosition(), GetWorldRotation() );
  4642. mutation11QuenEntity.CreateAttachment( this, 'quen_sphere' );
  4643. AddTimer( 'DestroyMutation11QuenEntity', 2.f );
  4644. }
  4645. mutation11QuenEntity.PlayHitEffect( 'quen_impulse_explode', mutation11QuenEntity.GetWorldRotation() );
  4646.  
  4647. if( !skipQuenSign )
  4648. {
  4649.  
  4650. PlayEffect( 'mutation_11_second_life' );
  4651.  
  4652.  
  4653. //RestoreQuen( 1000000.f, 10.f, true );
  4654.  
  4655. //modSigns
  4656. quen = (W3QuenEntity)theGame.CreateEntity( signs[ST_Quen].template, GetWorldPosition(), GetWorldRotation() );
  4657. quen.Init( signOwner, signs[ST_Quen].entity, true, true );
  4658. quen.SetAlternateCast( S_Magic_s04 );
  4659. quen.freeCast = true;
  4660. quen.OnStarted();
  4661. quen.OnThrowing();
  4662. quen.SetDataFromRestore(1000000.f, 10.f);
  4663. }
  4664. }
  4665.  
  4666. private var mutation11QuenEntity : W3QuenEntity;
  4667. private var storedInteractionPriority : EInteractionPriority;
  4668.  
  4669. timer function DestroyMutation11QuenEntity( dt : float, id : int )
  4670. {
  4671. if( mutation11QuenEntity )
  4672. {
  4673. mutation11QuenEntity.Destroy();
  4674. }
  4675. }
  4676.  
  4677. event OnAnimEvent_Mutation11AnimEnd( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4678. {
  4679. if( animEventType == AET_DurationEnd )
  4680. {
  4681.  
  4682. BlockAllActions( 'Mutation11', false );
  4683.  
  4684.  
  4685. theGame.GetGameCamera().StopAnimation( 'camera_shake_loop_lvl1_1' );
  4686.  
  4687.  
  4688. theGame.StopVibrateController();
  4689.  
  4690.  
  4691. SetInteractionPriority( storedInteractionPriority );
  4692.  
  4693.  
  4694. RemoveBuff( EET_Mutation11Buff, true );
  4695. }
  4696. else if ( animEventType == AET_DurationStart || animEventType == AET_DurationStartInTheMiddle )
  4697. {
  4698.  
  4699. SetBehaviorVariable( 'AIControlled', 0.f );
  4700. }
  4701. }
  4702.  
  4703. //modSigns
  4704. public final function Mutation11GetBaseStrength() : float
  4705. {
  4706. var drainStrength : float;
  4707. var swordDmg, avAP, avSI : float;
  4708. var abl : SAbilityAttributeValue;
  4709. var curStats : SPlayerOffenseStats;
  4710. var sword : SItemUniqueId;
  4711.  
  4712. //avSI
  4713. abl = GetTotalSignSpellPower(S_Magic_1);
  4714. abl += GetTotalSignSpellPower(S_Magic_2);
  4715. abl += GetTotalSignSpellPower(S_Magic_3);
  4716. abl += GetTotalSignSpellPower(S_Magic_4);
  4717. abl += GetTotalSignSpellPower(S_Magic_5);
  4718. avSI = MaxF(0.0, abl.valueMultiplicative / 5.0 - 1.0) * 100;
  4719. //theGame.witcherLog.AddMessage("Mutation11 avSI = " + avSI);
  4720. //avAP
  4721. curStats = GetOffenseStatsList();
  4722. avAP = MaxF(0.0,
  4723. ( curStats.steelFastAP * (1 - curStats.steelFastCritChance/100.0) + curStats.steelFastCritAP * curStats.steelFastCritChance/100.0
  4724. + curStats.silverFastAP * (1 - curStats.silverFastCritChance/100.0) + curStats.silverFastCritAP * curStats.silverFastCritChance/100.0
  4725. + curStats.steelStrongAP * (1 - curStats.steelStrongCritChance/100.0) + curStats.steelStrongCritAP * curStats.steelStrongCritChance/100.0
  4726. + curStats.silverStrongAP * (1 - curStats.silverStrongCritChance/100.0) + curStats.silverStrongCritAP * curStats.silverStrongCritChance/100.0
  4727. )/4.0
  4728. ) * 100;
  4729. //theGame.witcherLog.AddMessage("Mutation11 avAP = " + avAP);
  4730. //swordDmg
  4731. sword = inv.GetCurrentlyHeldSword();
  4732. if( sword == GetInvalidUniqueId() )
  4733. {
  4734. GetItemEquippedOnSlot(EES_SteelSword, sword);
  4735. if( sword == GetInvalidUniqueId() )
  4736. GetItemEquippedOnSlot(EES_SilverSword, sword);
  4737. }
  4738. if( sword != GetInvalidUniqueId() )
  4739. {
  4740. if( inv.GetItemCategory(sword) == 'steelsword' )
  4741. swordDmg = GetTotalWeaponDamage(sword, theGame.params.DAMAGE_NAME_SLASHING, GetInvalidUniqueId());
  4742. else if( inv.GetItemCategory(sword) == 'silversword' )
  4743. swordDmg = GetTotalWeaponDamage(sword, theGame.params.DAMAGE_NAME_SILVER, GetInvalidUniqueId());
  4744. }
  4745. //theGame.witcherLog.AddMessage("Mutation11 swordDmg = " + swordDmg);
  4746. drainStrength = swordDmg + avAP + avSI;
  4747. //theGame.witcherLog.AddMessage("Mutation11 drainStrength = " + drainStrength);
  4748. return drainStrength;
  4749. }
  4750.  
  4751. public final function MutationSystemEnable( enable : bool )
  4752. {
  4753. ( ( W3PlayerAbilityManager ) abilityManager ).MutationSystemEnable( enable );
  4754. }
  4755.  
  4756. public final function IsMutationSystemEnabled() : bool
  4757. {
  4758. return ( ( W3PlayerAbilityManager ) abilityManager ).IsMutationSystemEnabled();
  4759. }
  4760.  
  4761. public final function GetMutation( mutationType : EPlayerMutationType ) : SMutation
  4762. {
  4763. return ( ( W3PlayerAbilityManager ) abilityManager ).GetMutation( mutationType );
  4764. }
  4765.  
  4766. public final function IsMutationActive( mutationType : EPlayerMutationType) : bool
  4767. {
  4768. var swordQuality : int;
  4769. var sword : SItemUniqueId;
  4770.  
  4771. if( !SSS_IsMutationEquipped( mutationType, SSS_GetEquippedMutationType() ) ) //zur13 modSSS
  4772. {
  4773. return false;
  4774. }
  4775.  
  4776. switch( mutationType )
  4777. {
  4778. case EPMT_Mutation4 :
  4779. case EPMT_Mutation5 :
  4780. case EPMT_Mutation7 :
  4781. case EPMT_Mutation8 :
  4782. case EPMT_Mutation10 :
  4783. case EPMT_Mutation11 :
  4784. case EPMT_Mutation12 :
  4785. if( IsInFistFight() )
  4786. {
  4787. return false;
  4788. }
  4789. }
  4790.  
  4791. if( mutationType == EPMT_Mutation1 )
  4792. {
  4793. sword = inv.GetCurrentlyHeldSword();
  4794. swordQuality = inv.GetItemQuality( sword );
  4795.  
  4796.  
  4797. if( swordQuality < 3 )
  4798. {
  4799. return false;
  4800. }
  4801. }
  4802.  
  4803. return true;
  4804. }
  4805.  
  4806. public final function SetEquippedMutation( mutationType : EPlayerMutationType ) : bool
  4807. {
  4808. return ( ( W3PlayerAbilityManager ) abilityManager ).SetEquippedMutation( mutationType );
  4809. }
  4810.  
  4811. public final function GetEquippedMutationType() : EPlayerMutationType
  4812. {
  4813. return ( ( W3PlayerAbilityManager ) abilityManager ).GetEquippedMutationType();
  4814. }
  4815.  
  4816. public final function CanEquipMutation(mutationType : EPlayerMutationType) : bool
  4817. {
  4818. return ( ( W3PlayerAbilityManager ) abilityManager ).CanEquipMutation( mutationType );
  4819. }
  4820.  
  4821. public final function CanResearchMutation( mutationType : EPlayerMutationType ) : bool
  4822. {
  4823. return ( ( W3PlayerAbilityManager ) abilityManager ).CanResearchMutation( mutationType );
  4824. }
  4825.  
  4826. public final function IsMutationResearched(mutationType : EPlayerMutationType) : bool
  4827. {
  4828. return ( ( W3PlayerAbilityManager ) abilityManager ).IsMutationResearched( mutationType );
  4829. }
  4830.  
  4831. public final function GetMutationResearchProgress(mutationType : EPlayerMutationType) : int
  4832. {
  4833. return ( ( W3PlayerAbilityManager ) abilityManager ).GetMutationResearchProgress( mutationType );
  4834. }
  4835.  
  4836. public final function GetMasterMutationStage() : int
  4837. {
  4838. return ( ( W3PlayerAbilityManager ) abilityManager ).GetMasterMutationStage();
  4839. }
  4840.  
  4841. public final function MutationResearchWithSkillPoints(mutation : EPlayerMutationType, skillPoints : int) : bool
  4842. {
  4843. return ( ( W3PlayerAbilityManager ) abilityManager ).MutationResearchWithSkillPoints( mutation, skillPoints );
  4844. }
  4845.  
  4846. public final function MutationResearchWithItem(mutation : EPlayerMutationType, item : SItemUniqueId, optional count: int) : bool
  4847. {
  4848. return ( ( W3PlayerAbilityManager ) abilityManager ).MutationResearchWithItem( mutation, item, count );
  4849. }
  4850.  
  4851. public final function GetMutationLocalizedName( mutationType : EPlayerMutationType ) : string
  4852. {
  4853. var pam : W3PlayerAbilityManager;
  4854. var locKey : name;
  4855.  
  4856. pam = (W3PlayerAbilityManager)GetWitcherPlayer().abilityManager;
  4857. locKey = pam.GetMutationNameLocalizationKey( mutationType );
  4858.  
  4859. return GetLocStringByKeyExt( locKey );
  4860. }
  4861.  
  4862. public final function GetMutationLocalizedDescription( mutationType : EPlayerMutationType ) : string
  4863. {
  4864. var pam : W3PlayerAbilityManager;
  4865. var locKey : name;
  4866. var arrStr : array< string >;
  4867. var dm : CDefinitionsManagerAccessor;
  4868. var min, max, sp : SAbilityAttributeValue;
  4869. var tmp, tmp2, tox, critBonusDamage, val : float;
  4870. var stats, stats2 : SPlayerOffenseStats;
  4871. var buffPerc, exampleEnemyCount, debuffPerc : int;
  4872.  
  4873. pam = (W3PlayerAbilityManager)GetWitcherPlayer().abilityManager;
  4874. locKey = pam.GetMutationDescriptionLocalizationKey( mutationType );
  4875. dm = theGame.GetDefinitionsManager();
  4876.  
  4877. switch( mutationType )
  4878. {
  4879. case EPMT_Mutation1 :
  4880. dm.GetAbilityAttributeValue('Mutation1', 'dmg_bonus_factor', min, max);
  4881. arrStr.PushBack( NoTrailZeros( RoundMath( 100 * min.valueAdditive ) ) );
  4882. break;
  4883.  
  4884. case EPMT_Mutation2 :
  4885. sp = GetPowerStatValue( CPS_SpellPower );
  4886.  
  4887.  
  4888. dm.GetAbilityAttributeValue( 'Mutation2', 'crit_chance_factor', min, max );
  4889. //arrStr.PushBack( NoTrailZeros( RoundMath( 100 * ( min.valueAdditive + sp.valueMultiplicative * min.valueMultiplicative ) ) ) );
  4890. //modSigns: changing the formula
  4891. arrStr.PushBack( NoTrailZeros( RoundMath( 100 * ( ClampF(min.valueAdditive + SignPowerStatToPowerBonus(sp.valueMultiplicative) * min.valueMultiplicative, 0.f, 1.f) ) ) ) );
  4892.  
  4893.  
  4894. dm.GetAbilityAttributeValue( 'Mutation2', 'crit_damage_factor', min, max );
  4895. //critBonusDamage = sp.valueMultiplicative * min.valueMultiplicative;
  4896. //modSigns: changing the formula
  4897. critBonusDamage = min.valueAdditive + SignPowerStatToPowerBonus(sp.valueMultiplicative) * min.valueMultiplicative;
  4898.  
  4899. arrStr.PushBack( NoTrailZeros( RoundMath( 100 * critBonusDamage ) ) );
  4900. break;
  4901.  
  4902. case EPMT_Mutation3 : //modSigns: mutation reworked
  4903.  
  4904. dm.GetAbilityAttributeValue('Mutation3', 'attack_power', min, max);
  4905. tmp = min.valueMultiplicative;
  4906.  
  4907. dm.GetAbilityAttributeValue('Mutation3', 'mutation3_buff_rate_sword', min, max);
  4908. tmp2 = tmp * min.valueAdditive;
  4909. arrStr.PushBack( NoTrailZeros( 100 * tmp2 ) );
  4910. dm.GetAbilityAttributeValue('Mutation3', 'mutation3_buff_rate_other', min, max);
  4911. tmp2 = tmp * min.valueAdditive;
  4912. arrStr.PushBack( NoTrailZeros( 100 * tmp2 ) );
  4913. dm.GetAbilityAttributeValue('Mutation3', 'mutation3_debuff_rate', min, max);
  4914. tmp2 = tmp * min.valueAdditive;
  4915. arrStr.PushBack( NoTrailZeros( 100 * tmp2 ) );
  4916. dm.GetAbilityAttributeValue('Mutation3', 'mutation3_buff_rate_kill', min, max);
  4917. tmp2 = tmp * min.valueAdditive;
  4918. arrStr.PushBack( NoTrailZeros( 100 * tmp2 ) );
  4919. dm.GetAbilityAttributeValue('Mutation3', 'mutation3_maxcap', min, max);
  4920. tmp2 = tmp * min.valueAdditive;
  4921. arrStr.PushBack( NoTrailZeros( 100 * tmp2 ) );
  4922.  
  4923. //dm.GetAbilityAttributeValue( 'Mutation3', 'attack_power', min, max );
  4924. //tmp = min.valueMultiplicative;
  4925. //arrStr.PushBack( NoTrailZeros( RoundMath( 100 * tmp ) ) );
  4926. //dm.GetAbilityAttributeValue( 'Mutation3', 'maxcap', min, max );
  4927. //arrStr.PushBack( NoTrailZeros( RoundMath( 100 * tmp * min.valueAdditive ) ) );
  4928. break;
  4929.  
  4930. case EPMT_Mutation4 : //modSigns: mutation reworked
  4931.  
  4932. dm.GetAbilityAttributeValue( 'Mutation4', 'toxicityRegenFactor', min, max );
  4933. tmp = min.valueAdditive;
  4934. arrStr.PushBack( NoTrailZeros( tmp * 100 ) );
  4935.  
  4936. dm.GetAbilityAttributeValue( 'AcidEffect', 'DirectDamage', min, max );
  4937. tmp = min.valueAdditive;
  4938. arrStr.PushBack( NoTrailZeros( tmp ) );
  4939.  
  4940. arrStr.PushBack( NoTrailZeros( RoundMath( tmp * GetStat( BCS_Toxicity ) ) ) );
  4941. arrStr.PushBack( NoTrailZeros( RoundMath( tmp * GetStatMax( BCS_Toxicity ) ) ) );
  4942.  
  4943. dm.GetAbilityAttributeValue( 'AcidEffect', 'duration', min, max );
  4944. tmp = min.valueAdditive;
  4945. arrStr.PushBack( NoTrailZeros( tmp ) );
  4946.  
  4947. dm.GetAbilityAttributeValue( 'Mutation4BloodDebuff', 'staminaRegen', min, max );
  4948. tmp = AbsF( min.valueMultiplicative ) * 100;
  4949. arrStr.PushBack( NoTrailZeros( tmp ) );
  4950. break;
  4951.  
  4952. case EPMT_Mutation5 :
  4953.  
  4954. //dm.GetAbilityAttributeValue( 'Mutation5', 'mut5_dmg_red_perc', min, max );
  4955. //tmp = min.valueAdditive;
  4956. //arrStr.PushBack( NoTrailZeros( 100 * tmp ) );
  4957. //
  4958. //
  4959. //arrStr.PushBack( NoTrailZeros( 100 * tmp * 3 ) );
  4960.  
  4961. //modSigns: mutation changed
  4962. dm.GetAbilityAttributeValue( 'Mutation5', 'mut5_duration_per_point', min, max );
  4963. arrStr.PushBack( NoTrailZeros( min.valueAdditive ) );
  4964. arrStr.PushBack( NoTrailZeros( min.valueAdditive * GetStatMax(BCS_Focus) ) );
  4965. arrStr.PushBack( NoTrailZeros( min.valueAdditive ) );
  4966.  
  4967. break;
  4968.  
  4969. case EPMT_Mutation6 :
  4970. //modSigns: raw and total damage
  4971. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation6', 'full_freeze_chance', min, max );
  4972. arrStr.PushBack( RoundMath( 100 * min.valueMultiplicative ) );
  4973. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation6', 'ForceDamage', min, max );
  4974. val = CalculateAttributeValue( min );
  4975. arrStr.PushBack( RoundMath( val ) );
  4976. sp = GetTotalSignSpellPower( S_Magic_1 );
  4977. arrStr.PushBack( RoundMath( val * sp.valueMultiplicative ) );
  4978.  
  4979. break;
  4980.  
  4981. case EPMT_Mutation7 : //modSigns: changed
  4982.  
  4983. dm.GetAbilityAttributeValue( 'Mutation7BuffEffect', 'duration', min, max );
  4984. arrStr.PushBack( NoTrailZeros( min.valueAdditive ) );
  4985.  
  4986. dm.GetAbilityAttributeValue( 'Mutation7Buff', 'attack_power', min, max );
  4987. buffPerc = RoundMath( 100 * min.valueMultiplicative );
  4988. arrStr.PushBack( NoTrailZeros( buffPerc ) );
  4989.  
  4990. dm.GetAbilityAttributeValue( 'Mutation7DebuffEffect', 'duration', min, max );
  4991. arrStr.PushBack( NoTrailZeros( min.valueAdditive ) );
  4992.  
  4993. dm.GetAbilityAttributeValue( 'Mutation7Debuff', 'attack_power', min, max );
  4994. buffPerc = RoundMath( -100 * min.valueMultiplicative );
  4995. arrStr.PushBack( NoTrailZeros( buffPerc ) );
  4996.  
  4997. break;
  4998.  
  4999. case EPMT_Mutation8 : //modSigns: changed
  5000.  
  5001. dm.GetAbilityAttributeValue( 'Mutation8', 'hp_perc_trigger', min, max );
  5002. arrStr.PushBack( NoTrailZeros( 100 * min.valueMultiplicative ) );
  5003.  
  5004. dm.GetAbilityAttributeValue( 'Mutation8', 'dmg_bonus', min, max );
  5005. arrStr.PushBack( FloatToStringPrec( 100 * min.valueMultiplicative, 0 ) );
  5006.  
  5007. arrStr.PushBack( FloatToStringPrec( 100 * min.valueMultiplicative * GetStatMax(BCS_Focus), 0 ) );
  5008.  
  5009. break;
  5010.  
  5011. case EPMT_Mutation9 : //modSigns: changed
  5012.  
  5013.  
  5014.  
  5015.  
  5016. //stats = GetOffenseStatsList( 1 );
  5017. //arrStr.PushBack( NoTrailZeros( RoundMath( stats.crossbowSteelDmg ) ) );
  5018.  
  5019.  
  5020. //stats2 = GetOffenseStatsList( 2 );
  5021. //arrStr.PushBack( NoTrailZeros( RoundMath( stats2.crossbowSteelDmg ) ) );
  5022.  
  5023.  
  5024. //dm.GetAbilityAttributeValue( 'Mutation9', 'critical_hit_chance', min, max );
  5025. //arrStr.PushBack( NoTrailZeros( 100 * min.valueMultiplicative ) );
  5026.  
  5027. //dm.GetAbilityAttributeValue( 'Mutation9', 'critical_damage', min, max );
  5028. //arrStr.PushBack( NoTrailZeros( 100 * min.valueAdditive ) );
  5029.  
  5030. dm.GetAbilityAttributeValue( 'Mutation9', 'mut9_damage', min, max );
  5031. arrStr.PushBack( NoTrailZeros( 100 * min.valueMultiplicative ) );
  5032.  
  5033. dm.GetAbilityAttributeValue( 'Mutation9', 'health_reduction', min, max );
  5034. arrStr.PushBack( NoTrailZeros( 100 * min.valueMultiplicative ) );
  5035.  
  5036. dm.GetAbilityAttributeValue( 'Mutation9', 'mut9_slowdown', min, max );
  5037. arrStr.PushBack( NoTrailZeros( 100 * min.valueAdditive ) );
  5038.  
  5039. break;
  5040.  
  5041. case EPMT_Mutation10 : //modSigns: redone
  5042.  
  5043. //dm.GetAbilityAttributeValue( 'Mutation10Effect', 'mutation10_stat_boost', min, max );
  5044. dm.GetAbilityAttributeValue( 'Mutation10Effect', 'mutation10_factor', min, max );
  5045. arrStr.PushBack( NoTrailZeros( min.valueMultiplicative ) );
  5046. arrStr.PushBack( NoTrailZeros( RoundMath(GetToxicityDamage())) );
  5047.  
  5048. theGame.GetDefinitionsManager().GetAbilityAttributeValue('ToxicityEffect', 'DirectDamage', min, max);
  5049. tmp = min.valueMultiplicative * GetStatMax(BCS_Vitality);
  5050. theGame.GetDefinitionsManager().GetAbilityAttributeValue('Mutation10Effect', 'mutation10_factor', min, max);
  5051. tmp *= 1 + min.valueMultiplicative * GetStatMax(BCS_Toxicity)/100.0;
  5052. arrStr.PushBack( NoTrailZeros( RoundMath(tmp)) );
  5053.  
  5054.  
  5055. //arrStr.PushBack( NoTrailZeros( 100 * min.valueMultiplicative * GetStatMax( BCS_Toxicity ) ) );
  5056.  
  5057. break;
  5058.  
  5059. case EPMT_Mutation11 : //modSigns: redone
  5060.  
  5061. dm.GetAbilityAttributeValue( 'Mutation11BuffEffect', 'duration', min, max);
  5062. arrStr.PushBack( NoTrailZeros( min.valueAdditive ) );
  5063.  
  5064. dm.GetAbilityAttributeValue( 'Mutation11DebuffEffect', 'duration', min, max);
  5065. arrStr.PushBack( NoTrailZeros( min.valueAdditive ) );
  5066.  
  5067. arrStr.PushBack( NoTrailZeros( MaxF(1, Mutation11GetBaseStrength()) * GetStatMax(BCS_Focus) ) );
  5068.  
  5069. break;
  5070.  
  5071. case EPMT_Mutation12 : //modSigns: changed
  5072.  
  5073. //dm.GetAbilityAttributeValue( 'Mutation12', 'duration', min, max );
  5074. //arrStr.PushBack( NoTrailZeros( min.valueAdditive ) );
  5075.  
  5076.  
  5077. dm.GetAbilityAttributeValue( 'Mutation12', 'maxcap', min, max );
  5078. arrStr.PushBack( NoTrailZeros( min.valueAdditive ) );
  5079.  
  5080. dm.GetAbilityAttributeValue( 'Mutation12', 'mut12bonus', min, max );
  5081. arrStr.PushBack( NoTrailZeros( min.valueAdditive * 100 ) );
  5082.  
  5083. dm.GetAbilityAttributeValue( 'Mutation12', 'mut12bonus', min, max );
  5084. arrStr.PushBack( NoTrailZeros( 1 + min.valueAdditive * 3 ) );
  5085. break;
  5086.  
  5087. case EPMT_MutationMaster :
  5088.  
  5089. arrStr.PushBack( "4" );
  5090.  
  5091. break;
  5092. }
  5093.  
  5094. return GetLocStringByKeyExtWithParams( locKey, , , arrStr );
  5095. }
  5096.  
  5097. //public final function ApplyMutation10StatBoost( out statValue : SAbilityAttributeValue )
  5098. //{
  5099. // var attValue : SAbilityAttributeValue;
  5100. // var currToxicity : float;
  5101. //
  5102. // if( IsMutationActive( EPMT_Mutation10 ) )
  5103. // {
  5104. // currToxicity = GetStat( BCS_Toxicity );
  5105. // if( currToxicity > 0.f )
  5106. // {
  5107. // attValue = GetAttributeValue( 'mutation10_stat_boost' );
  5108. // currToxicity *= attValue.valueMultiplicative;
  5109. // statValue.valueMultiplicative += currToxicity;
  5110. // }
  5111. // }
  5112. //} //modSigns: redone
  5113.  
  5114.  
  5115.  
  5116.  
  5117.  
  5118.  
  5119.  
  5120. public final function IsBookRead( bookName : name ):bool
  5121. {
  5122. return booksRead.Contains( bookName );
  5123. }
  5124.  
  5125. public final function AddReadBook( bookName : name ):void
  5126. {
  5127. if( !booksRead.Contains( bookName ) )
  5128. {
  5129. booksRead.PushBack( bookName );
  5130. }
  5131. }
  5132.  
  5133. public final function RemoveReadBook( bookName : name ):void
  5134. {
  5135. var idx : int = booksRead.FindFirst( bookName );
  5136.  
  5137. if( idx > -1 )
  5138. {
  5139. booksRead.Erase( idx );
  5140. }
  5141. }
  5142.  
  5143.  
  5144.  
  5145.  
  5146.  
  5147.  
  5148.  
  5149. public final function GetMutagenBuffs() : array< W3Mutagen_Effect >
  5150. {
  5151. var null : array< W3Mutagen_Effect >;
  5152.  
  5153. if(effectManager)
  5154. {
  5155. return effectManager.GetMutagenBuffs();
  5156. }
  5157.  
  5158. return null;
  5159. }
  5160.  
  5161. public function GetAlchemyRecipes() : array<name>
  5162. {
  5163. return alchemyRecipes;
  5164. }
  5165.  
  5166. public function CanLearnAlchemyRecipe(recipeName : name) : bool
  5167. {
  5168. var dm : CDefinitionsManagerAccessor;
  5169. var recipeNode : SCustomNode;
  5170. var i, tmpInt : int;
  5171. var tmpName : name;
  5172.  
  5173. dm = theGame.GetDefinitionsManager();
  5174. if ( dm.GetSubNodeByAttributeValueAsCName( recipeNode, 'alchemy_recipes', 'name_name', recipeName ) )
  5175. {
  5176. return true;
  5177.  
  5178. }
  5179.  
  5180. return false;
  5181. }
  5182.  
  5183. private final function RemoveAlchemyRecipe(recipeName : name)
  5184. {
  5185. alchemyRecipes.Remove(recipeName);
  5186. }
  5187.  
  5188. private final function RemoveAllAlchemyRecipes()
  5189. {
  5190. alchemyRecipes.Clear();
  5191. }
  5192.  
  5193. //modSigns: skill changed
  5194. public function CountAlchemy18Abilities(skillLevel : int) : int
  5195. {
  5196. var absToAdd : int;
  5197. var maxAbsAllowed : int;
  5198. var names : array<name>;
  5199. var m_alchemyManager : W3AlchemyManager;
  5200. var recipe : SAlchemyRecipe;
  5201. var i : int;
  5202.  
  5203. absToAdd = 0;
  5204. maxAbsAllowed = skillLevel * RoundMath(CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s18, 'max_abs_per_lvl_s18', false, false)));
  5205. m_alchemyManager = new W3AlchemyManager in this;
  5206. m_alchemyManager.Init();
  5207. names = GetAlchemyRecipes();
  5208. for(i = 0; i < names.Size(); i += 1)
  5209. {
  5210. m_alchemyManager.GetRecipe(names[i], recipe);
  5211. //if(IsAlchemy18Recipe(recipe.cookedItemType) && GetAlchemy18RecipeLevel(recipe) <= skillLevel)
  5212. if(absToAdd < maxAbsAllowed && IsAlchemy18Recipe(recipe.cookedItemType))
  5213. absToAdd += 1;
  5214. }
  5215.  
  5216. return absToAdd;
  5217. }
  5218.  
  5219. //modSigns
  5220. public function RecalcAlchemy18Abilities()
  5221. {
  5222. var absToAdd, curAbs : int;
  5223. var skillName : name = SkillEnumToName(S_Alchemy_s18);
  5224.  
  5225. if(CanUseSkill(S_Alchemy_s18))
  5226. absToAdd = CountAlchemy18Abilities(GetSkillLevel(S_Alchemy_s18));
  5227. else
  5228. absToAdd = 0;
  5229. curAbs = GetAbilityCount(skillName);
  5230.  
  5231. if(absToAdd == 0)
  5232. RemoveAbilityAll(skillName);
  5233. else if(absToAdd > curAbs)
  5234. AddAbilityMultiple(skillName, absToAdd - curAbs);
  5235. else if(absToAdd < curAbs)
  5236. RemoveAbilityMultiple(skillName, curAbs - absToAdd);
  5237. }
  5238.  
  5239. function AddAlchemyRecipe(nam : name, optional isSilent : bool, optional skipTutorialUpdate : bool) : bool
  5240. {
  5241. var i, potions, bombs : int;
  5242. var found : bool;
  5243. var m_alchemyManager : W3AlchemyManager;
  5244. var recipe : SAlchemyRecipe;
  5245. var knownBombTypes : array<string>;
  5246. var strRecipeName, recipeNameWithoutLevel : string;
  5247.  
  5248. if(!IsAlchemyRecipe(nam))
  5249. return false;
  5250.  
  5251. found = false;
  5252. for(i=0; i<alchemyRecipes.Size(); i+=1)
  5253. {
  5254. if(alchemyRecipes[i] == nam)
  5255. return false;
  5256.  
  5257.  
  5258. if(StrCmp(alchemyRecipes[i],nam) > 0)
  5259. {
  5260. alchemyRecipes.Insert(i,nam);
  5261. found = true;
  5262. AddAlchemyHudNotification(nam,isSilent);
  5263. break;
  5264. }
  5265. }
  5266.  
  5267. if(!found)
  5268. {
  5269. alchemyRecipes.PushBack(nam);
  5270. AddAlchemyHudNotification(nam,isSilent);
  5271. }
  5272.  
  5273. m_alchemyManager = new W3AlchemyManager in this;
  5274. m_alchemyManager.Init(alchemyRecipes);
  5275. m_alchemyManager.GetRecipe(nam, recipe);
  5276.  
  5277.  
  5278. //if(CanUseSkill(S_Alchemy_s18))
  5279. //{
  5280. // //modSigns
  5281. // //if ((recipe.cookedItemType != EACIT_Bolt) && (recipe.cookedItemType != EACIT_Undefined) && (recipe.cookedItemType != EACIT_Dye) && (recipe.level <= GetSkillLevel(S_Alchemy_s18)))
  5282. // if(IsAlchemy18Recipe(recipe.cookedItemType) && recipe.level <= GetSkillLevel(S_Alchemy_s18))
  5283. // AddAbility(SkillEnumToName(S_Alchemy_s18), true);
  5284. //
  5285. //}
  5286. //modSigns: moved to another place
  5287. RecalcAlchemy18Abilities();
  5288.  
  5289.  
  5290. if(recipe.cookedItemType == EACIT_Bomb)
  5291. {
  5292. bombs = 0;
  5293. for(i=0; i<alchemyRecipes.Size(); i+=1)
  5294. {
  5295. m_alchemyManager.GetRecipe(alchemyRecipes[i], recipe);
  5296.  
  5297.  
  5298. if(recipe.cookedItemType == EACIT_Bomb)
  5299. {
  5300. strRecipeName = NameToString(alchemyRecipes[i]);
  5301. recipeNameWithoutLevel = StrLeft(strRecipeName, StrLen(strRecipeName)-2);
  5302. if(!knownBombTypes.Contains(recipeNameWithoutLevel))
  5303. {
  5304. bombs += 1;
  5305. knownBombTypes.PushBack(recipeNameWithoutLevel);
  5306. }
  5307. }
  5308. }
  5309.  
  5310. theGame.GetGamerProfile().SetStat(ES_KnownBombRecipes, bombs);
  5311. }
  5312.  
  5313. else if(recipe.cookedItemType == EACIT_Potion || recipe.cookedItemType == EACIT_MutagenPotion || recipe.cookedItemType == EACIT_Alcohol || recipe.cookedItemType == EACIT_Quest)
  5314. {
  5315. potions = 0;
  5316. for(i=0; i<alchemyRecipes.Size(); i+=1)
  5317. {
  5318. m_alchemyManager.GetRecipe(alchemyRecipes[i], recipe);
  5319.  
  5320.  
  5321. if(recipe.cookedItemType == EACIT_Potion || recipe.cookedItemType == EACIT_MutagenPotion || recipe.cookedItemType == EACIT_Alcohol || recipe.cookedItemType == EACIT_Quest)
  5322. {
  5323. potions += 1;
  5324. }
  5325. }
  5326. theGame.GetGamerProfile().SetStat(ES_KnownPotionRecipes, potions);
  5327. }
  5328.  
  5329. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_AlchemyRecipe );
  5330.  
  5331. return true;
  5332. }
  5333.  
  5334. public function GetExpandedAlchemyCategories() : array< name >
  5335. {
  5336. return expandedAlchemyCategories;
  5337. }
  5338.  
  5339. public function AddExpandedAlchemyCategory( category : name )
  5340. {
  5341. if ( IsNameValid( category ) )
  5342. {
  5343. ArrayOfNamesPushBackUnique( expandedAlchemyCategories, category );
  5344. }
  5345. }
  5346.  
  5347. public function RemoveExpandedAlchemyCategory( category : name )
  5348. {
  5349. if ( IsNameValid( category ) )
  5350. {
  5351. expandedAlchemyCategories.Remove( category );
  5352. }
  5353. }
  5354.  
  5355. public function SetAlchemyFilters(showHasIngre : bool, showMissingIngre : bool, showAlreadyCrafted : bool )
  5356. {
  5357. alchemyFilters.showCraftable = showHasIngre;
  5358. alchemyFilters.showMissingIngre = showMissingIngre;
  5359. alchemyFilters.showAlreadyCrafted = showAlreadyCrafted;
  5360. }
  5361.  
  5362. public function GetAlchemyFilters() : SCraftingFilters
  5363. {
  5364.  
  5365. if ( alchemyFilters.showCraftable == false && alchemyFilters.showMissingIngre == false && alchemyFilters.showAlreadyCrafted == false )
  5366. {
  5367. alchemyFilters.showCraftable = true;
  5368. alchemyFilters.showMissingIngre = true;
  5369. alchemyFilters.showAlreadyCrafted = false;
  5370. }
  5371.  
  5372. return alchemyFilters;
  5373. }
  5374.  
  5375.  
  5376.  
  5377.  
  5378.  
  5379.  
  5380.  
  5381. public function GetExpandedBestiaryCategories() : array< name >
  5382. {
  5383. return expandedBestiaryCategories;
  5384. }
  5385.  
  5386. public function AddExpandedBestiaryCategory( category : name )
  5387. {
  5388. if ( IsNameValid( category ) )
  5389. {
  5390. ArrayOfNamesPushBackUnique( expandedBestiaryCategories, category );
  5391. }
  5392. }
  5393.  
  5394. public function RemoveExpandedBestiaryCategory( category : name )
  5395. {
  5396. if ( IsNameValid( category ) )
  5397. {
  5398. expandedBestiaryCategories.Remove( category );
  5399. }
  5400. }
  5401.  
  5402.  
  5403.  
  5404.  
  5405.  
  5406.  
  5407.  
  5408. public function GetDisplayHeavyAttackIndicator() : bool
  5409. {
  5410. return bDispalyHeavyAttackIndicator;
  5411. }
  5412.  
  5413. public function SetDisplayHeavyAttackIndicator( val : bool )
  5414. {
  5415. bDispalyHeavyAttackIndicator = val;
  5416. }
  5417.  
  5418. public function GetDisplayHeavyAttackFirstLevelTimer() : bool
  5419. {
  5420. return bDisplayHeavyAttackFirstLevelTimer;
  5421. }
  5422.  
  5423. public function SetDisplayHeavyAttackFirstLevelTimer( val : bool )
  5424. {
  5425. bDisplayHeavyAttackFirstLevelTimer = val;
  5426. }
  5427.  
  5428.  
  5429.  
  5430.  
  5431.  
  5432.  
  5433.  
  5434. public function SelectQuickslotItem( slot : EEquipmentSlots )
  5435. {
  5436. var item : SItemUniqueId;
  5437.  
  5438. GetItemEquippedOnSlot(slot, item);
  5439. selectedItemId = item;
  5440. }
  5441.  
  5442.  
  5443.  
  5444.  
  5445.  
  5446.  
  5447.  
  5448. public function GetMedallion() : W3MedallionController
  5449. {
  5450. if ( !medallionController )
  5451. {
  5452. medallionController = new W3MedallionController in this;
  5453. }
  5454. return medallionController;
  5455. }
  5456.  
  5457.  
  5458. public final function HighlightObjects(range : float, optional highlightTime : float )
  5459. {
  5460. var ents : array<CGameplayEntity>;
  5461. var i : int;
  5462.  
  5463. FindGameplayEntitiesInSphere(ents, GetWorldPosition(), range, 100, 'HighlightedByMedalionFX', FLAG_ExcludePlayer);
  5464.  
  5465. if(highlightTime == 0)
  5466. highlightTime = 30;
  5467.  
  5468. for(i=0; i<ents.Size(); i+=1)
  5469. {
  5470. if(!ents[i].IsHighlighted())
  5471. {
  5472. ents[i].SetHighlighted( true );
  5473. ents[i].PlayEffectSingle( 'medalion_detection_fx' );
  5474. ents[i].AddTimer( 'MedallionEffectOff', highlightTime );
  5475. }
  5476. }
  5477. }
  5478.  
  5479.  
  5480. public final function HighlightEnemies(range : float, optional highlightTime : float )
  5481. {
  5482. var ents : array<CGameplayEntity>;
  5483. var i : int;
  5484. var catComponent : CGameplayEffectsComponent;
  5485.  
  5486. FindGameplayEntitiesInSphere(ents, GetWorldPosition(), range, 100, , FLAG_ExcludePlayer + FLAG_OnlyAliveActors);
  5487.  
  5488. if(highlightTime == 0)
  5489. highlightTime = 5;
  5490.  
  5491. for(i=0; i<ents.Size(); i+=1)
  5492. {
  5493. if(IsRequiredAttitudeBetween(this, ents[i], true))
  5494. {
  5495. catComponent = GetGameplayEffectsComponent(ents[i]);
  5496. if(catComponent)
  5497. {
  5498. catComponent.SetGameplayEffectFlag(EGEF_CatViewHiglight, true);
  5499. ents[i].AddTimer( 'EnemyHighlightOff', highlightTime, , , , , true );
  5500. }
  5501. }
  5502. }
  5503. }
  5504.  
  5505. function SpawnMedallionEntity()
  5506. {
  5507. var rot : EulerAngles;
  5508. var spawnedMedallion : CEntity;
  5509.  
  5510. spawnedMedallion = theGame.GetEntityByTag( 'new_Witcher_medallion_FX' );
  5511.  
  5512. if ( !spawnedMedallion )
  5513. theGame.CreateEntity( medallionEntity, GetWorldPosition(), rot, true, false );
  5514. }
  5515.  
  5516.  
  5517.  
  5518.  
  5519.  
  5520.  
  5521.  
  5522.  
  5523.  
  5524. public final function InterruptCombatFocusMode()
  5525. {
  5526. if( this.GetCurrentStateName() == 'CombatFocusMode_SelectSpot' )
  5527. {
  5528. SetCanPlayHitAnim( true );
  5529. PopState();
  5530. }
  5531. }
  5532.  
  5533. public final function IsInDarkPlace() : bool
  5534. {
  5535. var envs : array< string >;
  5536.  
  5537. if( FactsQuerySum( "tut_in_dark_place" ) )
  5538. {
  5539. return true;
  5540. }
  5541.  
  5542. GetActiveAreaEnvironmentDefinitions( envs );
  5543.  
  5544. if( envs.Contains( 'env_novigrad_cave' ) || envs.Contains( 'cave_catacombs' ) )
  5545. {
  5546. return true;
  5547. }
  5548.  
  5549. return false;
  5550. }
  5551.  
  5552.  
  5553.  
  5554.  
  5555.  
  5556. private saved var selectedPotionSlotUpper, selectedPotionSlotLower : EEquipmentSlots;
  5557. private var potionDoubleTapTimerRunning, potionDoubleTapSlotIsUpper : bool;
  5558. default selectedPotionSlotUpper = EES_Potion1;
  5559. default selectedPotionSlotLower = EES_Potion2;
  5560. default potionDoubleTapTimerRunning = false;
  5561.  
  5562. public final function SetPotionDoubleTapRunning(b : bool, optional isUpperSlot : bool)
  5563. {
  5564. if(b)
  5565. {
  5566. AddTimer('PotionDoubleTap', 0.3);
  5567. }
  5568. else
  5569. {
  5570. RemoveTimer('PotionDoubleTap');
  5571. }
  5572.  
  5573. potionDoubleTapTimerRunning = b;
  5574. potionDoubleTapSlotIsUpper = isUpperSlot;
  5575. }
  5576.  
  5577. public final function IsPotionDoubleTapRunning() : bool
  5578. {
  5579. return potionDoubleTapTimerRunning;
  5580. }
  5581.  
  5582. timer function PotionDoubleTap(dt : float, id : int)
  5583. {
  5584. potionDoubleTapTimerRunning = false;
  5585. OnPotionDrinkInput(potionDoubleTapSlotIsUpper);
  5586. }
  5587.  
  5588. public final function OnPotionDrinkInput(fromUpperSlot : bool)
  5589. {
  5590. var slot : EEquipmentSlots;
  5591.  
  5592. if(fromUpperSlot)
  5593. slot = GetSelectedPotionSlotUpper();
  5594. else
  5595. slot = GetSelectedPotionSlotLower();
  5596.  
  5597. DrinkPotionFromSlot(slot);
  5598. }
  5599.  
  5600. public final function OnPotionDrinkKeyboardsInput(slot : EEquipmentSlots)
  5601. {
  5602. DrinkPotionFromSlot(slot);
  5603. }
  5604.  
  5605. private function DrinkPotionFromSlot(slot : EEquipmentSlots):void
  5606. {
  5607. var item : SItemUniqueId;
  5608. var hud : CR4ScriptedHud;
  5609. var module : CR4HudModuleItemInfo;
  5610.  
  5611. GetItemEquippedOnSlot(slot, item);
  5612. //modSigns: disable drinking mid action
  5613. if(IsInCombatAction() && (((int)GetBehaviorVariable('combatActionType')) == CAT_SpecialAttack || ((int)GetBehaviorVariable('combatActionType')) == CAT_CastSign && IsCurrentSignChanneled()))
  5614. {
  5615. DisplayHudMessage(GetLocStringByKeyExt( "menu_cannot_perform_action_now" ));
  5616. }
  5617. //modSigns: handle toxic food and drinks
  5618. else if(!CanUseSkill(S_Perk_15) && (inv.ItemHasTag(item, 'Alcohol') || inv.ItemHasTag(item, 'Uncooked')) && !ToxicityLowEnoughToDrinkPotion(slot))
  5619. {
  5620. SendToxicityTooHighMessage();
  5621. }
  5622. else if(inv.ItemHasTag(item, 'Edibles'))
  5623. {
  5624. ConsumeItem( item );
  5625. }
  5626. else
  5627. {
  5628. if (ToxicityLowEnoughToDrinkPotion(slot))
  5629. {
  5630. DrinkPreparedPotion(slot);
  5631. }
  5632. else
  5633. {
  5634. SendToxicityTooHighMessage();
  5635. }
  5636. }
  5637.  
  5638. hud = (CR4ScriptedHud)theGame.GetHud();
  5639. if ( hud )
  5640. {
  5641. module = (CR4HudModuleItemInfo)hud.GetHudModule("ItemInfoModule");
  5642. if( module )
  5643. {
  5644. module.ForceShowElement();
  5645. }
  5646. }
  5647. }
  5648.  
  5649. public function SendToxicityTooHighMessage(optional always : bool) // -= WMK:modQuickSlots =-
  5650. {
  5651. var messageText : string;
  5652. var language : string;
  5653. var audioLanguage : string;
  5654.  
  5655. if ((GetHudMessagesSize() < 2) || always) // -= WMK:modQuickSlots =-
  5656. {
  5657. messageText = GetLocStringByKeyExt("menu_cannot_perform_action_now") + " " + GetLocStringByKeyExt("panel_common_statistics_tooltip_current_toxicity");
  5658.  
  5659. theGame.GetGameLanguageName(audioLanguage,language);
  5660. if (language == "AR")
  5661. {
  5662. messageText += (int)(abilityManager.GetStat(BCS_Toxicity, false)) + " / " + (int)(abilityManager.GetStatMax(BCS_Toxicity)) + " :";
  5663. }
  5664. else
  5665. {
  5666. messageText += ": " + (int)(abilityManager.GetStat(BCS_Toxicity, false)) + " / " + (int)(abilityManager.GetStatMax(BCS_Toxicity));
  5667. }
  5668.  
  5669. DisplayHudMessage(messageText);
  5670. }
  5671. theSound.SoundEvent("gui_global_denied");
  5672. }
  5673.  
  5674. public final function GetSelectedPotionSlotUpper() : EEquipmentSlots
  5675. {
  5676. return selectedPotionSlotUpper;
  5677. }
  5678.  
  5679. public final function GetSelectedPotionSlotLower() : EEquipmentSlots
  5680. {
  5681. return selectedPotionSlotLower;
  5682. }
  5683.  
  5684.  
  5685. public final function FlipSelectedPotion(isUpperSlot : bool) : bool
  5686. {
  5687. if(isUpperSlot)
  5688. {
  5689. if(selectedPotionSlotUpper == EES_Potion1 && IsAnyItemEquippedOnSlot(EES_Potion3))
  5690. {
  5691. selectedPotionSlotUpper = EES_Potion3;
  5692. return true;
  5693. }
  5694. else if(selectedPotionSlotUpper == EES_Potion3 && IsAnyItemEquippedOnSlot(EES_Potion1))
  5695. {
  5696. selectedPotionSlotUpper = EES_Potion1;
  5697. return true;
  5698. }
  5699. }
  5700. else
  5701. {
  5702. if(selectedPotionSlotLower == EES_Potion2 && IsAnyItemEquippedOnSlot(EES_Potion4))
  5703. {
  5704. selectedPotionSlotLower = EES_Potion4;
  5705. return true;
  5706. }
  5707. else if(selectedPotionSlotLower == EES_Potion4 && IsAnyItemEquippedOnSlot(EES_Potion2))
  5708. {
  5709. selectedPotionSlotLower = EES_Potion2;
  5710. return true;
  5711. }
  5712. }
  5713.  
  5714. return false;
  5715. }
  5716.  
  5717. public final function AddBombThrowDelay( bombId : SItemUniqueId )
  5718. {
  5719. var slot : EEquipmentSlots;
  5720.  
  5721. slot = GetItemSlot( bombId );
  5722.  
  5723. if( slot == EES_Unused )
  5724. {
  5725. return;
  5726. }
  5727.  
  5728. if( slot == EES_Petard1 || slot == EES_Quickslot1 || slot == EES_Petard3 ) // -= WMK:modQuickSlots =-
  5729. {
  5730. remainingBombThrowDelaySlot1 = theGame.params.BOMB_THROW_DELAY;
  5731. AddTimer( 'BombDelay', 0.0f, true );
  5732. }
  5733. else if( slot == EES_Petard2 || slot == EES_Quickslot2 || slot == EES_Petard4 ) // -= WMK:modQuickSlots =-
  5734. {
  5735. remainingBombThrowDelaySlot2 = theGame.params.BOMB_THROW_DELAY;
  5736. AddTimer( 'BombDelay', 0.0f, true );
  5737. }
  5738. else
  5739. {
  5740. return;
  5741. }
  5742. }
  5743.  
  5744. public final function GetBombDelay( slot : EEquipmentSlots ) : float
  5745. {
  5746. if( slot == EES_Petard1 || slot == EES_Quickslot1 || slot == EES_Petard3 ) // -= WMK:modQuickSlots =-
  5747. {
  5748. return remainingBombThrowDelaySlot1;
  5749. }
  5750. else if( slot == EES_Petard2 || slot == EES_Quickslot2 || slot == EES_Petard4 ) // -= WMK:modQuickSlots =-
  5751. {
  5752. return remainingBombThrowDelaySlot2;
  5753. }
  5754.  
  5755. return 0;
  5756. }
  5757.  
  5758. timer function BombDelay( dt : float, id : int )
  5759. {
  5760. remainingBombThrowDelaySlot1 = MaxF( 0.f , remainingBombThrowDelaySlot1 - dt );
  5761. remainingBombThrowDelaySlot2 = MaxF( 0.f , remainingBombThrowDelaySlot2 - dt );
  5762.  
  5763. if( remainingBombThrowDelaySlot1 <= 0.0f && remainingBombThrowDelaySlot2 <= 0.0f )
  5764. {
  5765. RemoveTimer('BombDelay');
  5766. }
  5767. }
  5768.  
  5769. public function ResetCharacterDev()
  5770. {
  5771. ForceSetStat(BCS_Toxicity, 0); //modSigns: reset toxicity
  5772.  
  5773. UnequipItemFromSlot(EES_SkillMutagen1);
  5774. UnequipItemFromSlot(EES_SkillMutagen2);
  5775. UnequipItemFromSlot(EES_SkillMutagen3);
  5776. UnequipItemFromSlot(EES_SkillMutagen4);
  5777. SSS_UnequipAllMutagens(); //zur13 modSSS mutTabs
  5778. levelManager.ResetCharacterDev();
  5779. ((W3PlayerAbilityManager)abilityManager).ResetCharacterDev();
  5780. }
  5781.  
  5782. public final function ResetMutationsDev()
  5783. {
  5784. levelManager.ResetMutationsDev();
  5785. ((W3PlayerAbilityManager)abilityManager).ResetMutationsDev();
  5786. }
  5787.  
  5788. public final function GetHeldSword() : SItemUniqueId
  5789. {
  5790. var i : int;
  5791. var weapons : array< SItemUniqueId >;
  5792.  
  5793. weapons = inv.GetHeldWeapons();
  5794. for( i=0; i<weapons.Size(); i+=1 )
  5795. {
  5796. if( inv.IsItemSilverSwordUsableByPlayer( weapons[i] ) || inv.IsItemSteelSwordUsableByPlayer( weapons[i] ) )
  5797. {
  5798. return weapons[i];
  5799. }
  5800. }
  5801.  
  5802. return GetInvalidUniqueId();
  5803. }
  5804.  
  5805. public function ConsumeItem( itemId : SItemUniqueId ) : bool
  5806. {
  5807. var itemName : name;
  5808. var removedItem, willRemoveItem : bool;
  5809. var edibles : array<SItemUniqueId>;
  5810. var toSlot : EEquipmentSlots;
  5811. var i : int;
  5812. var equippedNewEdible : bool;
  5813.  
  5814. itemName = inv.GetItemName( itemId );
  5815.  
  5816. if (itemName == 'q111_imlerith_acorn' )
  5817. {
  5818. AddPoints(ESkillPoint, 2, true);
  5819. removedItem = inv.RemoveItem( itemId, 1 );
  5820. theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt("panel_character_popup_title_buy_skill") + "<br>" + GetLocStringByKeyExt("panel_character_availablepoints") + " +2");
  5821. theSound.SoundEvent("gui_character_buy_skill");
  5822. }
  5823. else if ( itemName == 'Clearing Potion' )
  5824. {
  5825. ResetCharacterDev();
  5826. removedItem = inv.RemoveItem( itemId, 1 );
  5827. theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt("panel_character_popup_character_cleared") );
  5828. theSound.SoundEvent("gui_character_synergy_effect");
  5829. }
  5830. else if ( itemName == 'Restoring Potion' )
  5831. {
  5832. ResetMutationsDev();
  5833. removedItem = inv.RemoveItem( itemId, 1 );
  5834. theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt("panel_character_popup_character_cleared") );
  5835. theSound.SoundEvent("gui_character_synergy_effect");
  5836. }
  5837. else if(itemName == 'Wolf Hour')
  5838. {
  5839. removedItem = inv.RemoveItem( itemId, 1 );
  5840. theSound.SoundEvent("gui_character_synergy_effect");
  5841. AddEffectDefault(EET_WolfHour, thePlayer, 'wolf hour');
  5842. }
  5843. else if ( itemName == 'q704_ft_golden_egg' )
  5844. {
  5845. AddPoints(ESkillPoint, 1, true);
  5846. removedItem = inv.RemoveItem( itemId, 1 );
  5847. theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt("panel_character_popup_title_buy_skill") + "<br>" + GetLocStringByKeyExt("panel_character_availablepoints") + " +1");
  5848. theSound.SoundEvent("gui_character_buy_skill");
  5849. }
  5850. else if ( itemName == 'mq7023_cake' )
  5851. {
  5852. this.AddAbility('mq7023_cake_vitality_bonus');
  5853. removedItem = inv.RemoveItem( itemId, 1 );
  5854. theSound.SoundEvent("gui_character_synergy_effect");
  5855. }
  5856. else
  5857. {
  5858. willRemoveItem = inv.GetItemQuantity(itemId) == 1 && !inv.ItemHasTag(itemId, 'InfiniteUse');
  5859.  
  5860. if(willRemoveItem)
  5861. toSlot = GetItemSlot(itemId);
  5862.  
  5863. removedItem = super.ConsumeItem(itemId);
  5864.  
  5865. if(willRemoveItem && removedItem)
  5866. {
  5867. edibles = inv.GetItemsByTag('Edibles');
  5868. equippedNewEdible = false;
  5869.  
  5870.  
  5871. for(i=0; i<edibles.Size(); i+=1)
  5872. {
  5873. if(!IsItemEquipped(edibles[i]) && !inv.ItemHasTag(edibles[i], 'Alcohol') && inv.GetItemName(edibles[i]) != 'Clearing Potion' && inv.GetItemName(edibles[i]) != 'Wolf Hour')
  5874. {
  5875. EquipItemInGivenSlot(edibles[i], toSlot, true, false);
  5876. equippedNewEdible = true;
  5877. break;
  5878. }
  5879. }
  5880.  
  5881.  
  5882. if(!equippedNewEdible)
  5883. {
  5884. for(i=0; i<edibles.Size(); i+=1)
  5885. {
  5886. if(!IsItemEquipped(edibles[i]) && inv.GetItemName(edibles[i]) != 'Clearing Potion' && inv.GetItemName(edibles[i]) != 'Wolf Hour')
  5887. {
  5888. EquipItemInGivenSlot(edibles[i], toSlot, true, false);
  5889. break;
  5890. }
  5891. }
  5892. }
  5893. }
  5894. }
  5895.  
  5896. return removedItem;
  5897. }
  5898.  
  5899.  
  5900. public final function GetAlcoholForAlchemicalItemsRefill() : SItemUniqueId
  5901. {
  5902. var alcos : array<SItemUniqueId>;
  5903. var id : SItemUniqueId;
  5904. var i, price, minPrice : int;
  5905.  
  5906. alcos = inv.GetItemsByTag(theGame.params.TAG_ALCHEMY_REFILL_ALCO);
  5907.  
  5908. if(alcos.Size() > 0)
  5909. {
  5910. if(inv.ItemHasTag(alcos[0], theGame.params.TAG_INFINITE_USE))
  5911. return alcos[0];
  5912.  
  5913. minPrice = inv.GetItemPrice(alcos[0]);
  5914. price = minPrice;
  5915. id = alcos[0];
  5916.  
  5917. for(i=1; i<alcos.Size(); i+=1)
  5918. {
  5919. if(inv.ItemHasTag(alcos[i], theGame.params.TAG_INFINITE_USE))
  5920. return alcos[i];
  5921.  
  5922. price = inv.GetItemPrice(alcos[i]);
  5923.  
  5924. if(price < minPrice)
  5925. {
  5926. minPrice = price;
  5927. id = alcos[i];
  5928. }
  5929. }
  5930.  
  5931. return id;
  5932. }
  5933.  
  5934. return GetInvalidUniqueId();
  5935. }
  5936.  
  5937. public final function ClearPreviouslyUsedBolt()
  5938. {
  5939. previouslyUsedBolt = GetInvalidUniqueId();
  5940. }
  5941.  
  5942. public function ShouldUseInfiniteWaterBolts() : bool
  5943. {
  5944. return GetCurrentStateName() == 'Swimming' || IsSwimming() || IsDiving();
  5945. }
  5946.  
  5947. public function GetCurrentInfiniteBoltName( optional forceBodkin : bool, optional forceHarpoon : bool ) : name
  5948. {
  5949. if(!forceBodkin && (forceHarpoon || ShouldUseInfiniteWaterBolts()) )
  5950. {
  5951. return 'Harpoon Bolt';
  5952. }
  5953. return 'Bodkin Bolt';
  5954. }
  5955.  
  5956.  
  5957. public final function AddAndEquipInfiniteBolt(optional forceBodkin : bool, optional forceHarpoon : bool)
  5958. {
  5959. var bolt, bodkins, harpoons : array<SItemUniqueId>;
  5960. var boltItemName : name;
  5961. var i : int;
  5962.  
  5963.  
  5964. bodkins = inv.GetItemsByName('Bodkin Bolt');
  5965. harpoons = inv.GetItemsByName('Harpoon Bolt');
  5966.  
  5967. for(i=bodkins.Size()-1; i>=0; i-=1)
  5968. inv.RemoveItem(bodkins[i], inv.GetItemQuantity(bodkins[i]) );
  5969.  
  5970. for(i=harpoons.Size()-1; i>=0; i-=1)
  5971. inv.RemoveItem(harpoons[i], inv.GetItemQuantity(harpoons[i]) );
  5972.  
  5973.  
  5974.  
  5975. boltItemName = GetCurrentInfiniteBoltName( forceBodkin, forceHarpoon );
  5976.  
  5977.  
  5978. if(boltItemName == 'Bodkin Bolt' && inv.IsIdValid(previouslyUsedBolt))
  5979. {
  5980. bolt.PushBack(previouslyUsedBolt);
  5981. }
  5982. else
  5983. {
  5984.  
  5985. bolt = inv.AddAnItem(boltItemName, 1, true, true);
  5986.  
  5987.  
  5988. if(boltItemName == 'Harpoon Bolt')
  5989. {
  5990. GetItemEquippedOnSlot(EES_Bolt, previouslyUsedBolt);
  5991. }
  5992. }
  5993.  
  5994. EquipItem(bolt[0], EES_Bolt);
  5995. }
  5996.  
  5997.  
  5998. event OnItemGiven(data : SItemChangedData)
  5999. {
  6000. var m_guiManager : CR4GuiManager;
  6001.  
  6002. super.OnItemGiven(data);
  6003.  
  6004.  
  6005. if(!inv)
  6006. inv = GetInventory();
  6007.  
  6008.  
  6009. if(inv.IsItemEncumbranceItem(data.ids[0]))
  6010. UpdateEncumbrance();
  6011.  
  6012. m_guiManager = theGame.GetGuiManager();
  6013. if(m_guiManager)
  6014. m_guiManager.RegisterNewItem(data.ids[0]);
  6015.  
  6016. // -= WMK:modQuickSlots =-
  6017. if (WmkGetQuickInventoryInstance()) {
  6018. WmkGetQuickInventoryInstance().RegisterNewItem(data.ids[0]);
  6019. }
  6020. // -= WMK:modQuickSlots =-
  6021. }
  6022.  
  6023.  
  6024. public final function CheckForFullyArmedAchievement()
  6025. {
  6026. if( HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_BEAR) || HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_GRYPHON) ||
  6027. HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_LYNX) || HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_WOLF) ||
  6028. /* modSigns */
  6029. /*HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_VIPER)*/
  6030. HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_BEAR_MINOR) || HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_GRYPHON_MINOR) ||
  6031. HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_LYNX_MINOR) || HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_WOLF_MINOR)
  6032. )
  6033. {
  6034. theGame.GetGamerProfile().AddAchievement(EA_FullyArmed);
  6035. }
  6036. }
  6037.  
  6038.  
  6039. public final function HasAllItemsFromSet(setItemTag : name) : bool
  6040. {
  6041. var item : SItemUniqueId;
  6042.  
  6043. if(!GetItemEquippedOnSlot(EES_SteelSword, item) || !inv.ItemHasTag(item, setItemTag))
  6044. return false;
  6045.  
  6046. if(!GetItemEquippedOnSlot(EES_SilverSword, item) || !inv.ItemHasTag(item, setItemTag))
  6047. return false;
  6048.  
  6049. if(!GetItemEquippedOnSlot(EES_Boots, item) || !inv.ItemHasTag(item, setItemTag))
  6050. return false;
  6051.  
  6052. if(!GetItemEquippedOnSlot(EES_Pants, item) || !inv.ItemHasTag(item, setItemTag))
  6053. return false;
  6054.  
  6055. if(!GetItemEquippedOnSlot(EES_Gloves, item) || !inv.ItemHasTag(item, setItemTag))
  6056. return false;
  6057.  
  6058. if(!GetItemEquippedOnSlot(EES_Armor, item) || !inv.ItemHasTag(item, setItemTag))
  6059. return false;
  6060.  
  6061.  
  6062. /*if(setItemTag == theGame.params.ITEM_SET_TAG_BEAR || setItemTag == theGame.params.ITEM_SET_TAG_LYNX)
  6063. {
  6064. if(!GetItemEquippedOnSlot(EES_RangedWeapon, item) || !inv.ItemHasTag(item, setItemTag))
  6065. return false;
  6066. }*/ //modSigns: removed due to set changes
  6067.  
  6068. return true;
  6069. }
  6070.  
  6071.  
  6072.  
  6073.  
  6074. public function GetTotalArmor() : SAbilityAttributeValue
  6075. {
  6076. var armor : SAbilityAttributeValue;
  6077. var armorItem : SItemUniqueId;
  6078.  
  6079. armor = super.GetTotalArmor();
  6080.  
  6081. if(GetItemEquippedOnSlot(EES_Armor, armorItem))
  6082. {
  6083.  
  6084. armor -= inv.GetItemAttributeValue(armorItem, theGame.params.ARMOR_VALUE_NAME);
  6085.  
  6086.  
  6087. armor += inv.GetItemArmorTotal(armorItem);
  6088. }
  6089.  
  6090. if(GetItemEquippedOnSlot(EES_Pants, armorItem))
  6091. {
  6092.  
  6093. armor -= inv.GetItemAttributeValue(armorItem, theGame.params.ARMOR_VALUE_NAME);
  6094.  
  6095.  
  6096. armor += inv.GetItemArmorTotal(armorItem);
  6097. }
  6098.  
  6099. if(GetItemEquippedOnSlot(EES_Boots, armorItem))
  6100. {
  6101.  
  6102. armor -= inv.GetItemAttributeValue(armorItem, theGame.params.ARMOR_VALUE_NAME);
  6103.  
  6104.  
  6105. armor += inv.GetItemArmorTotal(armorItem);
  6106. }
  6107.  
  6108. if(GetItemEquippedOnSlot(EES_Gloves, armorItem))
  6109. {
  6110.  
  6111. armor -= inv.GetItemAttributeValue(armorItem, theGame.params.ARMOR_VALUE_NAME);
  6112.  
  6113.  
  6114. armor += inv.GetItemArmorTotal(armorItem);
  6115. }
  6116.  
  6117. return armor;
  6118. }
  6119.  
  6120.  
  6121.  
  6122. public function ReduceArmorDurability() : EEquipmentSlots
  6123. {
  6124. var r, sum : int;
  6125. var slot : EEquipmentSlots;
  6126. var id : SItemUniqueId;
  6127. var prevDurMult, currDurMult, ratio : float;
  6128.  
  6129.  
  6130. sum = theGame.params.DURABILITY_ARMOR_CHEST_WEIGHT;
  6131. sum += theGame.params.DURABILITY_ARMOR_PANTS_WEIGHT;
  6132. sum += theGame.params.DURABILITY_ARMOR_GLOVES_WEIGHT;
  6133. sum += theGame.params.DURABILITY_ARMOR_BOOTS_WEIGHT;
  6134. sum += theGame.params.DURABILITY_ARMOR_MISS_WEIGHT;
  6135.  
  6136. r = RandRange(sum);
  6137.  
  6138. if(r < theGame.params.DURABILITY_ARMOR_CHEST_WEIGHT)
  6139. slot = EES_Armor;
  6140. else if (r < theGame.params.DURABILITY_ARMOR_CHEST_WEIGHT + theGame.params.DURABILITY_ARMOR_PANTS_WEIGHT)
  6141. slot = EES_Pants;
  6142. else if (r < theGame.params.DURABILITY_ARMOR_CHEST_WEIGHT + theGame.params.DURABILITY_ARMOR_PANTS_WEIGHT + theGame.params.DURABILITY_ARMOR_GLOVES_WEIGHT)
  6143. slot = EES_Gloves;
  6144. 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)
  6145. slot = EES_Boots;
  6146. else
  6147. return EES_InvalidSlot;
  6148.  
  6149. GetItemEquippedOnSlot(slot, id);
  6150. ratio = inv.GetItemDurabilityRatio(id);
  6151. if(inv.ReduceItemDurability(id))
  6152. {
  6153. prevDurMult = theGame.params.GetDurabilityMultiplier(ratio, false);
  6154.  
  6155. ratio = inv.GetItemDurabilityRatio(id);
  6156. currDurMult = theGame.params.GetDurabilityMultiplier(ratio, false);
  6157.  
  6158. if(currDurMult != prevDurMult)
  6159. {
  6160.  
  6161.  
  6162.  
  6163.  
  6164. }
  6165.  
  6166. return slot;
  6167. }
  6168.  
  6169. return EES_InvalidSlot;
  6170. }
  6171.  
  6172.  
  6173. public function DismantleItem(dismantledItem : SItemUniqueId, toolItem : SItemUniqueId) : bool
  6174. {
  6175. var parts : array<SItemParts>;
  6176. var i : int;
  6177.  
  6178. if(!inv.IsItemDismantleKit(toolItem))
  6179. return false;
  6180.  
  6181. parts = inv.GetItemRecyclingParts(dismantledItem);
  6182.  
  6183. if(parts.Size() <= 0)
  6184. return false;
  6185.  
  6186. for(i=0; i<parts.Size(); i+=1)
  6187. inv.AddAnItem(parts[i].itemName, parts[i].quantity, true, false);
  6188.  
  6189. inv.RemoveItem(toolItem);
  6190. inv.RemoveItem(dismantledItem);
  6191. return true;
  6192. }
  6193.  
  6194.  
  6195. public function GetItemEquippedOnSlot(slot : EEquipmentSlots, out item : SItemUniqueId) : bool
  6196. {
  6197. if(slot == EES_InvalidSlot || slot < 0 || slot > EnumGetMax('EEquipmentSlots'))
  6198. return false;
  6199.  
  6200. item = itemSlots[slot];
  6201.  
  6202. return inv.IsIdValid(item);
  6203. }
  6204.  
  6205.  
  6206. public function GetItemSlotByItemName(itemName : name) : EEquipmentSlots
  6207. {
  6208. var ids : array<SItemUniqueId>;
  6209. var i : int;
  6210. var slot : EEquipmentSlots;
  6211.  
  6212. ids = inv.GetItemsByName(itemName);
  6213. for(i=0; i<ids.Size(); i+=1)
  6214. {
  6215. slot = GetItemSlot(ids[i]);
  6216. if(slot != EES_InvalidSlot)
  6217. return slot;
  6218. }
  6219.  
  6220. return EES_InvalidSlot;
  6221. }
  6222.  
  6223.  
  6224. public function GetItemSlot(item : SItemUniqueId) : EEquipmentSlots
  6225. {
  6226. var i : int;
  6227.  
  6228. if(!inv.IsIdValid(item))
  6229. return EES_InvalidSlot;
  6230.  
  6231. for(i=0; i<itemSlots.Size(); i+=1)
  6232. if(itemSlots[i] == item)
  6233. return i;
  6234.  
  6235. return EES_InvalidSlot;
  6236. }
  6237.  
  6238. public function GetEquippedItems() : array<SItemUniqueId>
  6239. {
  6240. return itemSlots;
  6241. }
  6242.  
  6243. public function IsItemEquipped(item : SItemUniqueId) : bool
  6244. {
  6245. if(!inv.IsIdValid(item))
  6246. return false;
  6247.  
  6248. return itemSlots.Contains(item);
  6249. }
  6250.  
  6251. public function IsItemHeld(item : SItemUniqueId) : bool
  6252. {
  6253. if(!inv.IsIdValid(item))
  6254. return false;
  6255.  
  6256. return inv.IsItemHeld(item);
  6257. }
  6258.  
  6259.  
  6260. public function IsAnyItemEquippedOnSlot(slot : EEquipmentSlots) : bool
  6261. {
  6262. if(slot == EES_InvalidSlot || slot < 0 || slot > EnumGetMax('EEquipmentSlots'))
  6263. return false;
  6264.  
  6265. return inv.IsIdValid(itemSlots[slot]);
  6266. }
  6267.  
  6268.  
  6269. public function GetFreeQuickslot() : EEquipmentSlots
  6270. {
  6271. if(!inv.IsIdValid(itemSlots[EES_Quickslot1])) return EES_Quickslot1;
  6272. if(!inv.IsIdValid(itemSlots[EES_Quickslot2])) return EES_Quickslot2;
  6273.  
  6274.  
  6275. return EES_InvalidSlot;
  6276. }
  6277.  
  6278.  
  6279. event OnEquipItemRequested(item : SItemUniqueId, ignoreMount : bool)
  6280. {
  6281. var slot : EEquipmentSlots;
  6282.  
  6283. if(inv.IsIdValid(item))
  6284. {
  6285. slot = inv.GetSlotForItemId(item);
  6286.  
  6287. if (slot != EES_InvalidSlot)
  6288. {
  6289.  
  6290.  
  6291. EquipItemInGivenSlot(item, slot, ignoreMount);
  6292. }
  6293. }
  6294. }
  6295.  
  6296. event OnUnequipItemRequested(item : SItemUniqueId)
  6297. {
  6298. UnequipItem(item);
  6299. }
  6300.  
  6301.  
  6302. public function EquipItem(item : SItemUniqueId, optional slot : EEquipmentSlots, optional toHand : bool) : bool
  6303. {
  6304. if(!inv.IsIdValid(item))
  6305. return false;
  6306.  
  6307. if(slot == EES_InvalidSlot)
  6308. {
  6309. slot = inv.GetSlotForItemId(item);
  6310.  
  6311. if(slot == EES_InvalidSlot)
  6312. return false;
  6313. }
  6314.  
  6315. ForceSoundAppearanceUpdate();
  6316.  
  6317. return EquipItemInGivenSlot(item, slot, false, toHand);
  6318. }
  6319.  
  6320. protected function ShouldMount(slot : EEquipmentSlots, item : SItemUniqueId, category : name):bool
  6321. {
  6322.  
  6323.  
  6324. return !IsSlotPotionMutagen(slot) && category != 'usable' && category != 'potion' && category != 'petard' && !inv.ItemHasTag(item, 'PlayerUnwearable');
  6325. }
  6326.  
  6327. protected function ShouldMountItemWithName( itemName: name ): bool
  6328. {
  6329. var slot : EEquipmentSlots;
  6330. var items : array<SItemUniqueId>;
  6331. var category : name;
  6332. var i : int;
  6333.  
  6334. items = inv.GetItemsByName( itemName );
  6335.  
  6336. category = inv.GetItemCategory( items[0] );
  6337.  
  6338. slot = GetItemSlot( items[0] );
  6339.  
  6340. return ShouldMount( slot, items[0], category );
  6341. }
  6342.  
  6343. public function GetMountableItems( out items : array< SItemUniqueId > )
  6344. {
  6345. var i : int;
  6346. var mountable : bool;
  6347. var mountableItems : array< SItemUniqueId >;
  6348. var slot : EEquipmentSlots;
  6349. var category : name;
  6350. var item: SItemUniqueId;
  6351.  
  6352. for ( i = 0; i < items.Size(); i += 1 )
  6353. {
  6354. item = items[i];
  6355.  
  6356. category = inv.GetItemCategory( item );
  6357.  
  6358. slot = GetItemSlot( item );
  6359.  
  6360. mountable = ShouldMount( slot, item, category );
  6361.  
  6362. if ( mountable )
  6363. {
  6364. mountableItems.PushBack( items[ i ] );
  6365. }
  6366. }
  6367. items = mountableItems;
  6368. }
  6369.  
  6370. public final function AddAndEquipItem( item : name ) : bool
  6371. {
  6372. var ids : array< SItemUniqueId >;
  6373.  
  6374. ids = inv.AddAnItem( item );
  6375. if( inv.IsIdValid( ids[ 0 ] ) )
  6376. {
  6377. return EquipItem( ids[ 0 ] );
  6378. }
  6379.  
  6380. return false;
  6381. }
  6382.  
  6383. public final function AddQuestMarkedSelectedQuickslotItem( sel : SSelectedQuickslotItem )
  6384. {
  6385. questMarkedSelectedQuickslotItems.PushBack( sel );
  6386. }
  6387.  
  6388. public final function GetQuestMarkedSelectedQuickslotItem( sourceName : name ) : SItemUniqueId
  6389. {
  6390. var i : int;
  6391.  
  6392. for( i=0; i<questMarkedSelectedQuickslotItems.Size(); i+=1 )
  6393. {
  6394. if( questMarkedSelectedQuickslotItems[i].sourceName == sourceName )
  6395. {
  6396. return questMarkedSelectedQuickslotItems[i].itemID;
  6397. }
  6398. }
  6399.  
  6400. return GetInvalidUniqueId();
  6401. }
  6402.  
  6403. public final function SwapEquippedItems(slot1 : EEquipmentSlots, slot2 : EEquipmentSlots)
  6404. {
  6405. var temp : SItemUniqueId;
  6406. var pam : W3PlayerAbilityManager;
  6407.  
  6408. temp = itemSlots[slot1];
  6409. itemSlots[slot1] = itemSlots[slot2];
  6410. itemSlots[slot2] = temp;
  6411.  
  6412. if(IsSlotSkillMutagen(slot1))
  6413. {
  6414. pam = (W3PlayerAbilityManager)abilityManager;
  6415. if(pam)
  6416. pam.OnSwappedMutagensPost(itemSlots[slot1], itemSlots[slot2]);
  6417. }
  6418. }
  6419.  
  6420. public final function GetSlotForEquippedItem( itemID : SItemUniqueId ) : EEquipmentSlots
  6421. {
  6422. var i : int;
  6423.  
  6424. for( i=0; i<itemSlots.Size(); i+=1 )
  6425. {
  6426. if( itemSlots[i] == itemID )
  6427. {
  6428. return i;
  6429. }
  6430. }
  6431.  
  6432. return EES_InvalidSlot;
  6433. }
  6434.  
  6435. public function EquipItemInGivenSlot(item : SItemUniqueId, slot : EEquipmentSlots, ignoreMounting : bool, optional toHand : bool) : bool
  6436. {
  6437. var i, groupID, quantity : int;
  6438. var fistsID : array<SItemUniqueId>;
  6439. var pam : W3PlayerAbilityManager;
  6440. var isSkillMutagen : bool;
  6441. var armorEntity : CItemEntity;
  6442. var armorMeshComponent : CComponent;
  6443. var armorSoundIdentification : name;
  6444. var category : name;
  6445. var prevSkillColor : ESkillColor;
  6446. var containedAbilities : array<name>;
  6447. var dm : CDefinitionsManagerAccessor;
  6448. var armorType : EArmorType;
  6449. var otherMask, previousItemInSlot : SItemUniqueId;
  6450. var tutStatePot : W3TutorialManagerUIHandlerStatePotions;
  6451. var tutStateFood : W3TutorialManagerUIHandlerStateFood;
  6452. var tutStateSecondPotionEquip : W3TutorialManagerUIHandlerStateSecondPotionEquip;
  6453. var boltItem : SItemUniqueId;
  6454. var aerondight : W3Effect_Aerondight;
  6455. var phantomWeapon : W3Effect_PhantomWeapon; //modSigns
  6456.  
  6457. if(!inv.IsIdValid(item))
  6458. {
  6459. LogAssert(false, "W3PlayerWitcher.EquipItemInGivenSlot: invalid item");
  6460. return false;
  6461. }
  6462. if(slot == EES_InvalidSlot || slot == EES_HorseBlinders || slot == EES_HorseSaddle || slot == EES_HorseBag || slot == EES_HorseTrophy)
  6463. {
  6464. LogAssert(false, "W3PlayerWitcher.EquipItem: Cannot equip item <<" + inv.GetItemName(item) + ">> - provided slot <<" + slot + ">> is invalid");
  6465. return false;
  6466. }
  6467. if(itemSlots[slot] == item)
  6468. {
  6469. return true;
  6470. }
  6471.  
  6472. if(!HasRequiredLevelToEquipItem(item))
  6473. {
  6474.  
  6475. return false;
  6476. }
  6477.  
  6478. //if(inv.ItemHasTag(item, 'PhantomWeapon') && !GetPhantomWeaponMgr())
  6479. //{
  6480. // InitPhantomWeaponMgr();
  6481. //} //modSigns
  6482.  
  6483.  
  6484. if( slot == EES_SilverSword && inv.ItemHasTag( item, 'Aerondight' ) )
  6485. {
  6486. //modSigns: only in combat
  6487. if(IsInCombat())
  6488. {
  6489. AddEffectDefault( EET_Aerondight, this, "Aerondight" );
  6490. aerondight = (W3Effect_Aerondight)GetBuff( EET_Aerondight );
  6491. aerondight.Pause( 'ManageAerondightBuff' );
  6492. }
  6493. }
  6494.  
  6495. if( slot == EES_SteelSword && inv.ItemHasTag( item, 'PhantomWeapon' ) ) //modSigns
  6496. {
  6497. if(IsInCombat())
  6498. {
  6499. AddEffectDefault( EET_PhantomWeapon, this, "PhantomWeapon" );
  6500. phantomWeapon = (W3Effect_PhantomWeapon)GetBuff( EET_PhantomWeapon );
  6501. phantomWeapon.Pause( 'ManageIrisBuff' );
  6502. }
  6503. }
  6504.  
  6505.  
  6506. previousItemInSlot = itemSlots[slot];
  6507. if( IsItemEquipped(item))
  6508. {
  6509. SwapEquippedItems(slot, GetItemSlot(item));
  6510. return true;
  6511. }
  6512.  
  6513.  
  6514. isSkillMutagen = IsSlotSkillMutagen(slot);
  6515. if(isSkillMutagen)
  6516. {
  6517. pam = (W3PlayerAbilityManager)abilityManager;
  6518. if(!pam.IsSkillMutagenSlotUnlocked(slot))
  6519. {
  6520. return false;
  6521. }
  6522. }
  6523.  
  6524.  
  6525. if(inv.IsIdValid(previousItemInSlot))
  6526. {
  6527. if(!UnequipItemFromSlot(slot, true))
  6528. {
  6529. LogAssert(false, "W3PlayerWitcher.EquipItem: Cannot equip item <<" + inv.GetItemName(item) + ">> !!");
  6530. return false;
  6531. }
  6532. }
  6533.  
  6534.  
  6535. if(inv.IsItemMask(item))
  6536. {
  6537. if(slot == EES_Quickslot1)
  6538. GetItemEquippedOnSlot(EES_Quickslot2, otherMask);
  6539. else
  6540. GetItemEquippedOnSlot(EES_Quickslot1, otherMask);
  6541.  
  6542. if(inv.IsItemMask(otherMask))
  6543. UnequipItem(otherMask);
  6544. }
  6545.  
  6546. if(isSkillMutagen)
  6547. {
  6548. groupID = pam.GetSkillGroupIdOfMutagenSlot(slot);
  6549. prevSkillColor = pam.GetSkillGroupColor(groupID);
  6550. }
  6551.  
  6552. itemSlots[slot] = item;
  6553.  
  6554. category = inv.GetItemCategory( item );
  6555.  
  6556.  
  6557. if( !ignoreMounting && ShouldMount(slot, item, category) )
  6558. {
  6559.  
  6560. inv.MountItem( item, toHand, IsSlotSkillMutagen( slot ) );
  6561. }
  6562.  
  6563. theTelemetry.LogWithLabelAndValue( TE_INV_ITEM_EQUIPPED, inv.GetItemName(item), slot );
  6564.  
  6565. if(slot == EES_RangedWeapon)
  6566. {
  6567. rangedWeapon = ( Crossbow )( inv.GetItemEntityUnsafe(item) );
  6568. if(!rangedWeapon)
  6569. AddTimer('DelayedOnItemMount', 0.1, true);
  6570.  
  6571. if ( IsSwimming() || IsDiving() )
  6572. {
  6573. GetItemEquippedOnSlot(EES_Bolt, boltItem);
  6574.  
  6575. if(inv.IsIdValid(boltItem))
  6576. {
  6577. if ( !inv.ItemHasTag(boltItem, 'UnderwaterAmmo' ))
  6578. {
  6579. AddAndEquipInfiniteBolt(false, true);
  6580. }
  6581. }
  6582. else if(!IsAnyItemEquippedOnSlot(EES_Bolt))
  6583. {
  6584. AddAndEquipInfiniteBolt(false, true);
  6585. }
  6586. }
  6587.  
  6588. else if(!IsAnyItemEquippedOnSlot(EES_Bolt))
  6589. AddAndEquipInfiniteBolt();
  6590. }
  6591. else if(slot == EES_Bolt)
  6592. {
  6593. if(rangedWeapon)
  6594. { if ( !IsSwimming() || !IsDiving() )
  6595. {
  6596. rangedWeapon.OnReplaceAmmo();
  6597. rangedWeapon.OnWeaponReload();
  6598. if (FactsDoesExist('AHW') && AHW.Enabled() ) rangedWeapon.ClearDeployedEntity(true); //modAHW
  6599. }
  6600. else
  6601. {
  6602. DisplayHudMessage(GetLocStringByKeyExt( "menu_cannot_perform_action_now" ));
  6603. }
  6604. }
  6605. }
  6606.  
  6607. else if(isSkillMutagen)
  6608. {
  6609. theGame.GetGuiManager().IgnoreNewItemNotifications( true );
  6610.  
  6611.  
  6612. quantity = inv.GetItemQuantity( item );
  6613. if( quantity > 1 )
  6614. {
  6615. inv.SplitItem( item, quantity - 1 );
  6616. }
  6617.  
  6618. pam.OnSkillMutagenEquipped(item, slot, prevSkillColor);
  6619. LogSkillColors("Mutagen <<" + inv.GetItemName(item) + ">> equipped to slot <<" + slot + ">>");
  6620. LogSkillColors("Group bonus color is now <<" + pam.GetSkillGroupColor(groupID) + ">>");
  6621. LogSkillColors("");
  6622.  
  6623. theGame.GetGuiManager().IgnoreNewItemNotifications( false );
  6624. }
  6625. else if(slot == EES_Gloves && HasWeaponDrawn(false))
  6626. {
  6627. //PlayRuneword4FX(PW_Steel);
  6628. //PlayRuneword4FX(PW_Silver);
  6629. //modSigns
  6630. if(HasBuff(EET_Runeword4))
  6631. ((W3Effect_Runeword4)GetBuff(EET_Runeword4)).PlayRuneword4FX();
  6632. }
  6633.  
  6634. else if( ( slot == EES_Petard1 || slot == EES_Petard2 ) && inv.IsItemBomb( GetSelectedItemId() ) )
  6635. {
  6636. SelectQuickslotItem( slot );
  6637. }
  6638.  
  6639.  
  6640. if(inv.ItemHasAbility(item, 'MA_HtH'))
  6641. {
  6642. inv.GetItemContainedAbilities(item, containedAbilities);
  6643. fistsID = inv.GetItemsByName('fists');
  6644. dm = theGame.GetDefinitionsManager();
  6645. for(i=0; i<containedAbilities.Size(); i+=1)
  6646. {
  6647. if(dm.AbilityHasTag(containedAbilities[i], 'MA_HtH'))
  6648. {
  6649. inv.AddItemCraftedAbility(fistsID[0], containedAbilities[i], true);
  6650. }
  6651. }
  6652. }
  6653.  
  6654.  
  6655. if(inv.IsItemAnyArmor(item))
  6656. {
  6657. armorType = inv.GetArmorType(item);
  6658. pam = (W3PlayerAbilityManager)abilityManager;
  6659.  
  6660. pam.ManageSetArmorTypeBonus(); //modSigns
  6661.  
  6662. if(armorType == EAT_Light)
  6663. {
  6664. if(CanUseSkill(S_Perk_05))
  6665. pam.SetPerkArmorBonus(S_Perk_05);
  6666. }
  6667. else if(armorType == EAT_Medium)
  6668. {
  6669. if(CanUseSkill(S_Perk_06))
  6670. pam.SetPerkArmorBonus(S_Perk_06);
  6671. }
  6672. else if(armorType == EAT_Heavy)
  6673. {
  6674. if(CanUseSkill(S_Perk_07))
  6675. pam.SetPerkArmorBonus(S_Perk_07);
  6676. }
  6677. }
  6678.  
  6679.  
  6680. UpdateItemSetBonuses( item, true );
  6681.  
  6682.  
  6683. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_OnItemEquipped );
  6684.  
  6685.  
  6686. if(ShouldProcessTutorial('TutorialPotionCanEquip3'))
  6687. {
  6688. if(IsSlotPotionSlot(slot))
  6689. {
  6690. tutStatePot = (W3TutorialManagerUIHandlerStatePotions)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
  6691. if(tutStatePot)
  6692. {
  6693. tutStatePot.OnPotionEquipped(inv.GetItemName(item));
  6694. }
  6695.  
  6696. tutStateSecondPotionEquip = (W3TutorialManagerUIHandlerStateSecondPotionEquip)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
  6697. if(tutStateSecondPotionEquip)
  6698. {
  6699. tutStateSecondPotionEquip.OnPotionEquipped(inv.GetItemName(item));
  6700. }
  6701.  
  6702. }
  6703. }
  6704.  
  6705. if(ShouldProcessTutorial('TutorialFoodSelectTab'))
  6706. {
  6707. if( IsSlotPotionSlot(slot) && inv.IsItemFood(item))
  6708. {
  6709. tutStateFood = (W3TutorialManagerUIHandlerStateFood)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
  6710. if(tutStateFood)
  6711. {
  6712. tutStateFood.OnFoodEquipped();
  6713. }
  6714. }
  6715. }
  6716.  
  6717. //++modAHW
  6718. if (AHW.Enabled())
  6719. {
  6720. if (FactsDoesExist('AHW'))
  6721. {
  6722. if (inv.IsItemWeapon(item) && !toHand) AddTimer('AHWDelaySetAllInvisible', 0.1, false);
  6723. }
  6724. else if (AHW.IsCloakMod(item))
  6725. {
  6726. AHW.SetAllVisible(false);
  6727. FactsAdd('AHW');
  6728. }
  6729. //if (AHW.IsCloakMod(previousItemInSlot) && !AHW.IsCloakMod(item)) { FactsRemove('AHW'); AHW.SetAllVisible(true); }
  6730. }
  6731. //--modAHW
  6732.  
  6733. if(inv.IsItemSetItem(item))
  6734. {
  6735. CheckForFullyArmedAchievement();
  6736. }
  6737.  
  6738. return true;
  6739. }
  6740.  
  6741. private function CheckHairItem()
  6742. {
  6743. var ids : array<SItemUniqueId>;
  6744. var i : int;
  6745. var itemName : name;
  6746. var hairApplied : bool;
  6747.  
  6748. ids = inv.GetItemsByCategory('hair');
  6749.  
  6750. for(i=0; i<ids.Size(); i+= 1)
  6751. {
  6752. itemName = inv.GetItemName( ids[i] );
  6753.  
  6754. if( itemName != 'Preview Hair' )
  6755. {
  6756. if( hairApplied == false )
  6757. {
  6758. inv.MountItem( ids[i], false );
  6759. hairApplied = true;
  6760. }
  6761. else
  6762. {
  6763. inv.RemoveItem( ids[i], 1 );
  6764. }
  6765.  
  6766. }
  6767. }
  6768.  
  6769. if( hairApplied == false )
  6770. {
  6771. ids = inv.AddAnItem('Half With Tail Hairstyle', 1, true, false);
  6772. inv.MountItem( ids[0], false );
  6773. }
  6774.  
  6775. }
  6776.  
  6777.  
  6778. timer function DelayedOnItemMount( dt : float, id : int )
  6779. {
  6780. var crossbowID : SItemUniqueId;
  6781. var invent : CInventoryComponent;
  6782.  
  6783. invent = GetInventory();
  6784. if(!invent)
  6785. return;
  6786.  
  6787.  
  6788. GetItemEquippedOnSlot(EES_RangedWeapon, crossbowID);
  6789.  
  6790. if(invent.IsIdValid(crossbowID))
  6791. {
  6792.  
  6793. rangedWeapon = ( Crossbow )(invent.GetItemEntityUnsafe(crossbowID) );
  6794.  
  6795. if(rangedWeapon)
  6796. {
  6797.  
  6798. RemoveTimer('DelayedOnItemMount');
  6799. }
  6800. }
  6801. else
  6802. {
  6803.  
  6804. RemoveTimer('DelayedOnItemMount');
  6805. }
  6806. }
  6807.  
  6808. public function GetHeldItems() : array<SItemUniqueId>
  6809. {
  6810. var items : array<SItemUniqueId>;
  6811. var item : SItemUniqueId;
  6812.  
  6813. if( inv.GetItemEquippedOnSlot(EES_SilverSword, item) && inv.IsItemHeld(item))
  6814. items.PushBack(item);
  6815.  
  6816. if( inv.GetItemEquippedOnSlot(EES_SteelSword, item) && inv.IsItemHeld(item))
  6817. items.PushBack(item);
  6818.  
  6819. if( inv.GetItemEquippedOnSlot(EES_RangedWeapon, item) && inv.IsItemHeld(item))
  6820. items.PushBack(item);
  6821.  
  6822. if( inv.GetItemEquippedOnSlot(EES_Quickslot1, item) && inv.IsItemHeld(item))
  6823. items.PushBack(item);
  6824.  
  6825. if( inv.GetItemEquippedOnSlot(EES_Quickslot2, item) && inv.IsItemHeld(item))
  6826. items.PushBack(item);
  6827.  
  6828. if( inv.GetItemEquippedOnSlot(EES_Petard1, item) && inv.IsItemHeld(item))
  6829. items.PushBack(item);
  6830.  
  6831. if( inv.GetItemEquippedOnSlot(EES_Petard2, item) && inv.IsItemHeld(item))
  6832. items.PushBack(item);
  6833.  
  6834. // -= WMK:modQuickSlots =-
  6835. if (inv.GetItemEquippedOnSlot(EES_Petard3, item) && inv.IsItemHeld(item))
  6836. items.PushBack(item);
  6837. if (inv.GetItemEquippedOnSlot(EES_Petard4, item) && inv.IsItemHeld(item))
  6838. items.PushBack(item);
  6839. // -= WMK:modQuickSlots =-
  6840.  
  6841. return items;
  6842. }
  6843.  
  6844. public function MoveMutagenToSlot( item : SItemUniqueId, slotFrom : EEquipmentSlots, slotTo : EEquipmentSlots )
  6845. {
  6846. var pam : W3PlayerAbilityManager;
  6847. var prevSkillColor : ESkillColor;
  6848. var groupID : int;
  6849.  
  6850. if( IsSlotSkillMutagen( slotTo ) )
  6851. {
  6852. itemSlots[slotFrom] = GetInvalidUniqueId();
  6853.  
  6854. pam = (W3PlayerAbilityManager)abilityManager; //zur13 modSSS fixed orig script error
  6855. groupID = pam.GetSkillGroupIdOfMutagenSlot(slotFrom);
  6856. prevSkillColor = pam.GetSkillGroupColor(groupID);
  6857. pam = (W3PlayerAbilityManager)abilityManager;
  6858. pam.OnSkillMutagenUnequipped(item, slotFrom, prevSkillColor, true);
  6859.  
  6860.  
  6861.  
  6862. EquipItemInGivenSlot( item, slotTo, false );
  6863. }
  6864. }
  6865.  
  6866.  
  6867. public function UnequipItemFromSlot(slot : EEquipmentSlots, optional reequipped : bool) : bool
  6868. {
  6869. var item, bolts, id : SItemUniqueId;
  6870. var items : array<SItemUniqueId>;
  6871. var retBool : bool;
  6872. var fistsID, bolt : array<SItemUniqueId>;
  6873. var i, groupID : int;
  6874. var pam : W3PlayerAbilityManager;
  6875. var prevSkillColor : ESkillColor;
  6876. var containedAbilities : array<name>;
  6877. var dm : CDefinitionsManagerAccessor;
  6878. var armorType : EArmorType;
  6879. var isSwimming : bool;
  6880. var hud : CR4ScriptedHud;
  6881. var damagedItemModule : CR4HudModuleDamagedItems;
  6882.  
  6883. if(slot == EES_InvalidSlot || slot < 0 || slot > EnumGetMax('EEquipmentSlots') || !inv.IsIdValid(itemSlots[slot]))
  6884. return false;
  6885.  
  6886.  
  6887. if(IsSlotSkillMutagen(slot))
  6888. {
  6889.  
  6890. pam = (W3PlayerAbilityManager)abilityManager;
  6891. groupID = pam.GetSkillGroupIdOfMutagenSlot(slot);
  6892. prevSkillColor = pam.GetSkillGroupColor(groupID);
  6893. }
  6894.  
  6895.  
  6896. if(slot == EES_SilverSword || slot == EES_SteelSword)
  6897. {
  6898. PauseOilBuffs( slot == EES_SteelSword );
  6899. }
  6900.  
  6901. item = itemSlots[slot];
  6902. itemSlots[slot] = GetInvalidUniqueId();
  6903.  
  6904. //++modAHW
  6905. if (FactsDoesExist('AHW') && AHW.IsCloakMod(item) && (!AHW.menu.GetVarValue('AHW','ahwhidec') || !AHW.combatready))
  6906. {
  6907. FactsRemove('AHW');
  6908. AHW.combatready = false;
  6909. AHW.SetAllVisible(true);
  6910. }
  6911. //--modAHW
  6912.  
  6913. //if(inv.ItemHasTag( item, 'PhantomWeapon' ) && GetPhantomWeaponMgr())
  6914. //{
  6915. // DestroyPhantomWeaponMgr();
  6916. //} //modSigns
  6917.  
  6918.  
  6919.  
  6920.  
  6921. if( slot == EES_SilverSword && inv.ItemHasTag( item, 'Aerondight' ) )
  6922. {
  6923. RemoveBuff( EET_Aerondight );
  6924. }
  6925.  
  6926. if( slot == EES_SteelSword && inv.ItemHasTag( item, 'PhantomWeapon' ) ) //modSigns
  6927. {
  6928. RemoveBuff( EET_PhantomWeapon );
  6929. }
  6930.  
  6931.  
  6932. if(slot == EES_RangedWeapon)
  6933. {
  6934.  
  6935. this.OnRangedForceHolster( true, true );
  6936. rangedWeapon.ClearDeployedEntity(true);
  6937. rangedWeapon = NULL;
  6938.  
  6939.  
  6940. if(GetItemEquippedOnSlot(EES_Bolt, bolts))
  6941. {
  6942. if(inv.ItemHasTag(bolts, theGame.params.TAG_INFINITE_AMMO))
  6943. {
  6944. inv.RemoveItem(bolts, inv.GetItemQuantity(bolts) );
  6945. }
  6946. }
  6947. }
  6948. else if(IsSlotSkillMutagen(slot))
  6949. {
  6950. pam.OnSkillMutagenUnequipped(item, slot, prevSkillColor);
  6951. LogSkillColors("Mutagen <<" + inv.GetItemName(item) + ">> unequipped from slot <<" + slot + ">>");
  6952. LogSkillColors("Group bonus color is now <<" + pam.GetSkillGroupColor(groupID) + ">>");
  6953. LogSkillColors("");
  6954. }
  6955.  
  6956.  
  6957. if(currentlyEquipedItem == item)
  6958. {
  6959. currentlyEquipedItem = GetInvalidUniqueId();
  6960. RaiseEvent('ForcedUsableItemUnequip');
  6961. }
  6962. if(currentlyEquipedItemL == item)
  6963. {
  6964. if ( currentlyUsedItemL )
  6965. {
  6966. currentlyUsedItemL.OnHidden( this );
  6967. }
  6968. HideUsableItem ( true );
  6969. }
  6970.  
  6971.  
  6972. if( !IsSlotPotionMutagen(slot) )
  6973. {
  6974. GetInventory().UnmountItem(item, true);
  6975. }
  6976.  
  6977. retBool = true;
  6978.  
  6979.  
  6980. if(IsAnyItemEquippedOnSlot(EES_RangedWeapon) && slot == EES_Bolt)
  6981. {
  6982. if(inv.ItemHasTag(item, theGame.params.TAG_INFINITE_AMMO))
  6983. {
  6984.  
  6985. inv.RemoveItem(item, inv.GetItemQuantityByName( inv.GetItemName(item) ) );
  6986. }
  6987. else if (!reequipped)
  6988. {
  6989.  
  6990. AddAndEquipInfiniteBolt();
  6991. }
  6992. }
  6993.  
  6994.  
  6995. if(slot == EES_SilverSword || slot == EES_SteelSword)
  6996. {
  6997. OnEquipMeleeWeapon(PW_None, true);
  6998. }
  6999.  
  7000. if( GetSelectedItemId() == item )
  7001. {
  7002. ClearSelectedItemId();
  7003. }
  7004.  
  7005. if(inv.IsItemBody(item))
  7006. {
  7007. retBool = true;
  7008. }
  7009.  
  7010. /*if(retBool && !reequipped)
  7011. {
  7012. theTelemetry.LogWithLabelAndValue( TE_INV_ITEM_UNEQUIPPED, inv.GetItemName(item), slot );
  7013.  
  7014.  
  7015. if(slot == EES_SteelSword && !IsAnyItemEquippedOnSlot(EES_SilverSword))
  7016. {
  7017. RemoveBuff(EET_EnhancedWeapon);
  7018. }
  7019. else if(slot == EES_SilverSword && !IsAnyItemEquippedOnSlot(EES_SteelSword))
  7020. {
  7021. RemoveBuff(EET_EnhancedWeapon);
  7022. }
  7023. else if(inv.IsItemAnyArmor(item))
  7024. {
  7025. if( !IsAnyItemEquippedOnSlot(EES_Armor) && !IsAnyItemEquippedOnSlot(EES_Gloves) && !IsAnyItemEquippedOnSlot(EES_Boots) && !IsAnyItemEquippedOnSlot(EES_Pants))
  7026. RemoveBuff(EET_EnhancedArmor);
  7027. }
  7028. }*/ //modSigns: removed
  7029.  
  7030.  
  7031. if(inv.ItemHasAbility(item, 'MA_HtH'))
  7032. {
  7033. inv.GetItemContainedAbilities(item, containedAbilities);
  7034. fistsID = inv.GetItemsByName('fists');
  7035. dm = theGame.GetDefinitionsManager();
  7036. for(i=0; i<containedAbilities.Size(); i+=1)
  7037. {
  7038. if(dm.AbilityHasTag(containedAbilities[i], 'MA_HtH'))
  7039. {
  7040. inv.RemoveItemCraftedAbility(fistsID[0], containedAbilities[i]);
  7041. }
  7042. }
  7043. }
  7044.  
  7045.  
  7046. if(inv.IsItemAnyArmor(item))
  7047. {
  7048. armorType = inv.GetArmorType(item);
  7049. pam = (W3PlayerAbilityManager)abilityManager;
  7050.  
  7051. pam.ManageSetArmorTypeBonus(); //modSigns
  7052.  
  7053. if(CanUseSkill(S_Perk_05) && (armorType == EAT_Light /*|| GetCharacterStats().HasAbility('Glyphword 2 _Stats', true) || inv.ItemHasAbility(item, 'Glyphword 2 _Stats')*/))
  7054. {
  7055. pam.SetPerkArmorBonus(S_Perk_05);
  7056. }
  7057. if(CanUseSkill(S_Perk_06) && (armorType == EAT_Medium /*|| GetCharacterStats().HasAbility('Glyphword 3 _Stats', true) || inv.ItemHasAbility(item, 'Glyphword 3 _Stats')*/))
  7058. {
  7059. pam.SetPerkArmorBonus(S_Perk_06);
  7060. }
  7061. if(CanUseSkill(S_Perk_07) && (armorType == EAT_Heavy /*|| GetCharacterStats().HasAbility('Glyphword 4 _Stats', true) || inv.ItemHasAbility(item, 'Glyphword 4 _Stats')*/))
  7062. {
  7063. pam.SetPerkArmorBonus(S_Perk_07);
  7064. }
  7065. }
  7066.  
  7067.  
  7068. UpdateItemSetBonuses( item, false );
  7069.  
  7070.  
  7071. if( inv.ItemHasTag( item, theGame.params.ITEM_SET_TAG_BONUS ) && !IsSetBonusActive( EISB_RedWolf_2 ) )
  7072. {
  7073. SkillReduceBombAmmoBonus();
  7074. }
  7075.  
  7076. if( slot == EES_Gloves )
  7077. {
  7078. thePlayer.DestroyEffect('runeword_4');
  7079. }
  7080.  
  7081.  
  7082. hud = (CR4ScriptedHud)theGame.GetHud();
  7083. if ( hud )
  7084. {
  7085. damagedItemModule = hud.GetDamagedItemModule();
  7086. if ( damagedItemModule )
  7087. {
  7088. damagedItemModule.OnItemUnequippedFromSlot( slot );
  7089. }
  7090. }
  7091.  
  7092.  
  7093. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_OnItemEquipped );
  7094.  
  7095. return retBool;
  7096. }
  7097.  
  7098. public function UnequipItem(item : SItemUniqueId) : bool
  7099. {
  7100. if(!inv.IsIdValid(item))
  7101. return false;
  7102.  
  7103. return UnequipItemFromSlot( itemSlots.FindFirst(item) );
  7104. }
  7105.  
  7106. public function DropItem( item : SItemUniqueId, quantity : int ) : bool
  7107. {
  7108. if(!inv.IsIdValid(item))
  7109. return false;
  7110. if(IsItemEquipped(item))
  7111. return UnequipItem(item);
  7112.  
  7113. return true;
  7114. }
  7115.  
  7116.  
  7117. public function IsItemEquippedByName(itemName : name) : bool
  7118. {
  7119. var i : int;
  7120.  
  7121. for(i=0; i<itemSlots.Size(); i+=1)
  7122. if(inv.GetItemName(itemSlots[i]) == itemName)
  7123. return true;
  7124.  
  7125. return false;
  7126. }
  7127.  
  7128.  
  7129. public function IsItemEquippedByCategoryName(categoryName : name) : bool
  7130. {
  7131. var i : int;
  7132.  
  7133. for(i=0; i<itemSlots.Size(); i+=1)
  7134. if(inv.GetItemCategory(itemSlots[i]) == categoryName)
  7135. return true;
  7136.  
  7137. return false;
  7138. }
  7139.  
  7140. //modFriendlyStash begin
  7141. //Not actually used by Preparations (allowStash == false), but needed for modFriendlyStash compatibility
  7142. //Used by modFriendlyStash to allow using stash items for crafting and alchemy
  7143. public function GetItemQuantityByNameForCrafting(itemName : name, allowStash : bool) : int
  7144. {
  7145. if( allowStash )
  7146. {
  7147. return inv.GetItemQuantityByName(itemName) + GetHorseManager().GetInventoryComponent().GetItemQuantityByName(itemName);
  7148. }
  7149. return inv.GetItemQuantityByName(itemName);
  7150. }
  7151.  
  7152. public function GetMutagenQuantityByNameForCrafting(itemName : name, allowStash : bool) : int
  7153. {
  7154. if( allowStash )
  7155. {
  7156. return inv.GetUnusedMutagensCount(itemName) + GetHorseManager().GetInventoryComponent().GetItemQuantityByName(itemName);
  7157. }
  7158. return inv.GetUnusedMutagensCount(itemName);
  7159. }
  7160.  
  7161. public function RemoveItemByNameForCrafting(itemName : name, quantity : int, allowStash : bool) : bool
  7162. {
  7163. var playerQuantity, horseQuantity, quantityToRemove, removedQuantity : int;
  7164. if( allowStash )
  7165. {
  7166. quantityToRemove = quantity;
  7167. playerQuantity = inv.GetItemQuantityByName(itemName);
  7168. if( playerQuantity < quantityToRemove )
  7169. {
  7170. quantityToRemove = playerQuantity;
  7171. }
  7172. if( quantityToRemove > 0 && inv.RemoveItemByName(itemName, quantityToRemove) )
  7173. {
  7174. removedQuantity = quantityToRemove;
  7175. }
  7176. quantityToRemove = quantity - removedQuantity;
  7177. if( quantityToRemove > 0 )
  7178. {
  7179. horseQuantity = GetHorseManager().GetInventoryComponent().GetItemQuantityByName(itemName);
  7180. if( horseQuantity < quantityToRemove )
  7181. {
  7182. quantityToRemove = horseQuantity;
  7183. }
  7184. if( quantityToRemove > 0 && GetHorseManager().GetInventoryComponent().RemoveItemByName(itemName, quantityToRemove) )
  7185. {
  7186. removedQuantity += quantityToRemove;
  7187. }
  7188. }
  7189. if( removedQuantity == quantity )
  7190. {
  7191. return true;
  7192. }
  7193. return false;
  7194. }
  7195. return inv.RemoveItemByName(itemName, quantity);
  7196. }
  7197.  
  7198. public function RemoveMutagenByNameForCrafting(itemName : name, quantity : int, allowStash : bool) : bool
  7199. {
  7200. var playerQuantity, horseQuantity, quantityToRemove, removedQuantity : int;
  7201. if( allowStash )
  7202. {
  7203. quantityToRemove = quantity;
  7204. playerQuantity = inv.GetUnusedMutagensCount(itemName);
  7205. if( playerQuantity < quantityToRemove )
  7206. {
  7207. quantityToRemove = playerQuantity;
  7208. }
  7209. if( quantityToRemove > 0 && inv.RemoveUnusedMutagensCount(itemName, quantityToRemove) )
  7210. {
  7211. removedQuantity = quantityToRemove;
  7212. }
  7213. quantityToRemove = quantity - removedQuantity;
  7214. if( quantityToRemove > 0 )
  7215. {
  7216. horseQuantity = GetHorseManager().GetInventoryComponent().GetItemQuantityByName(itemName);
  7217. if( horseQuantity < quantityToRemove )
  7218. {
  7219. quantityToRemove = horseQuantity;
  7220. }
  7221. if( quantityToRemove > 0 && GetHorseManager().GetInventoryComponent().RemoveItemByName(itemName, quantityToRemove) )
  7222. {
  7223. removedQuantity += quantityToRemove;
  7224. }
  7225. }
  7226. if( removedQuantity == quantity )
  7227. {
  7228. return true;
  7229. }
  7230. return false;
  7231. }
  7232. return inv.RemoveUnusedMutagensCount(itemName, quantity);
  7233. }
  7234. //modFriendlyStash end
  7235.  
  7236. public function GetMaxRunEncumbrance(out usesHorseBonus : bool) : float
  7237. {
  7238. var value : float;
  7239.  
  7240. value = CalculateAttributeValue(GetHorseManager().GetHorseAttributeValue('encumbrance', false));
  7241. usesHorseBonus = (value > 0);
  7242. value += CalculateAttributeValue( GetAttributeValue('encumbrance') );
  7243.  
  7244. return value;
  7245. }
  7246.  
  7247. public function GetEncumbrance() : float
  7248. {
  7249. var i: int;
  7250. var encumbrance : float;
  7251. var items : array<SItemUniqueId>;
  7252. var inve : CInventoryComponent;
  7253.  
  7254. inve = GetInventory();
  7255. inve.GetAllItems(items);
  7256.  
  7257. for(i=0; i<items.Size(); i+=1)
  7258. {
  7259. encumbrance += inve.GetItemEncumbrance( items[i] );
  7260.  
  7261.  
  7262.  
  7263. }
  7264. return encumbrance;
  7265. }
  7266.  
  7267.  
  7268.  
  7269. public function StartInvUpdateTransaction():void
  7270. {
  7271. invUpdateTransaction = true;
  7272. }
  7273.  
  7274. public function FinishInvUpdateTransaction():void
  7275. {
  7276. invUpdateTransaction = false;
  7277.  
  7278.  
  7279.  
  7280. UpdateEncumbrance();
  7281. }
  7282.  
  7283.  
  7284. public function UpdateEncumbrance()
  7285. {
  7286. var temp : bool;
  7287.  
  7288. if (invUpdateTransaction)
  7289. {
  7290.  
  7291. return;
  7292. }
  7293.  
  7294.  
  7295.  
  7296. if ( GetEncumbrance() >= (GetMaxRunEncumbrance(temp) + 1) )
  7297. {
  7298. if( !HasBuff(EET_OverEncumbered) && FactsQuerySum( "DEBUG_EncumbranceBoy" ) == 0 )
  7299. {
  7300. AddEffectDefault(EET_OverEncumbered, NULL, "OverEncumbered");
  7301. }
  7302. }
  7303. else if(HasBuff(EET_OverEncumbered))
  7304. {
  7305. RemoveAllBuffsOfType(EET_OverEncumbered);
  7306. }
  7307. }
  7308.  
  7309. public final function GetSkillGroupIDFromIndex(idx : int) : int
  7310. {
  7311. var pam : W3PlayerAbilityManager;
  7312.  
  7313. pam = (W3PlayerAbilityManager)abilityManager;
  7314. if(pam && pam.IsInitialized())
  7315. return pam.GetSkillGroupIDFromIndex(idx);
  7316.  
  7317. return -1;
  7318. }
  7319.  
  7320. public final function GetSkillGroupColor(groupID : int) : ESkillColor
  7321. {
  7322. var pam : W3PlayerAbilityManager;
  7323.  
  7324. pam = (W3PlayerAbilityManager)abilityManager;
  7325. if(pam && pam.IsInitialized())
  7326. return pam.GetSkillGroupColor(groupID);
  7327.  
  7328. return SC_None;
  7329. }
  7330.  
  7331. public final function GetSkillGroupsCount() : int
  7332. {
  7333. var pam : W3PlayerAbilityManager;
  7334.  
  7335. pam = (W3PlayerAbilityManager)abilityManager;
  7336. if(pam && pam.IsInitialized())
  7337. return pam.GetSkillGroupsCount();
  7338.  
  7339. return 0;
  7340. }
  7341.  
  7342.  
  7343.  
  7344.  
  7345.  
  7346.  
  7347.  
  7348.  
  7349. function CycleSelectSign( bIsCyclingLeft : bool ) : ESignType
  7350. {
  7351. var signOrder : array<ESignType>;
  7352. var i : int;
  7353.  
  7354. signOrder.PushBack( ST_Yrden );
  7355. signOrder.PushBack( ST_Quen );
  7356. signOrder.PushBack( ST_Igni );
  7357. signOrder.PushBack( ST_Axii );
  7358. signOrder.PushBack( ST_Aard );
  7359.  
  7360. for( i = 0; i < signOrder.Size(); i += 1 )
  7361. if( signOrder[i] == equippedSign )
  7362. break;
  7363.  
  7364. if(bIsCyclingLeft)
  7365. return signOrder[ (4 + i) % 5 ];
  7366. else
  7367. return signOrder[ (6 + i) % 5 ];
  7368. }
  7369.  
  7370. function ToggleNextSign()
  7371. {
  7372. SetEquippedSign(CycleSelectSign( false ));
  7373. FactsAdd("SignToggled", 1, 1);
  7374. }
  7375.  
  7376. function TogglePreviousSign()
  7377. {
  7378. SetEquippedSign(CycleSelectSign( true ));
  7379. FactsAdd("SignToggled", 1, 1);
  7380. }
  7381.  
  7382. function ProcessSignEvent( eventName : name ) : bool
  7383. {
  7384. if( currentlyCastSign != ST_None && signs[currentlyCastSign].entity)
  7385. {
  7386. return signs[currentlyCastSign].entity.OnProcessSignEvent( eventName );
  7387. }
  7388.  
  7389. return false;
  7390. }
  7391.  
  7392. var findActorTargetTimeStamp : float;
  7393. var pcModeChanneledSignTimeStamp : float;
  7394. event OnProcessCastingOrientation( isContinueCasting : bool )
  7395. {
  7396. var customOrientationTarget : EOrientationTarget;
  7397. var checkHeading : float;
  7398. var rotHeading : float;
  7399. var playerToHeadingDist : float;
  7400. var slideTargetActor : CActor;
  7401. var newLockTarget : CActor;
  7402. var softlockEnabled : bool; //modCombatStance
  7403.  
  7404. var enableNoTargetOrientation : bool;
  7405.  
  7406. var currTime : float;
  7407.  
  7408. //modCombatStance begin
  7409. if(!IsInCombat() || (bool)theGame.GetInGameConfigWrapper().GetVarValue('modCombatStanceOptions', 'modCSDisableSoftlock'))
  7410. softlockEnabled = false;
  7411. else
  7412. softlockEnabled = (GetPlayerCombatStance() == PCS_AlertNear || GetPlayerCombatStance() == PCS_Guarded);
  7413. //modCombatStance end
  7414. enableNoTargetOrientation = true;
  7415. if ( softlockEnabled && GetDisplayTarget() && this.IsDisplayTargetTargetable() ) //modCombatStance
  7416. {
  7417. enableNoTargetOrientation = false;
  7418. if ( /*theInput.GetActionValue( 'CastSignHold' ) > 0*/ TestCastSignHold() /* modSigns */ || this.IsCurrentSignChanneled() )
  7419. {
  7420. if ( IsPCModeEnabled() )
  7421. {
  7422. if ( EngineTimeToFloat( theGame.GetEngineTime() ) > pcModeChanneledSignTimeStamp + 1.f )
  7423. enableNoTargetOrientation = true;
  7424. }
  7425. else
  7426. {
  7427. if ( GetCurrentlyCastSign() == ST_Igni || GetCurrentlyCastSign() == ST_Axii )
  7428. {
  7429. slideTargetActor = (CActor)GetDisplayTarget();
  7430. if ( slideTargetActor
  7431. && ( !slideTargetActor.GetGameplayVisibility() || !CanBeTargetedIfSwimming( slideTargetActor ) || !slideTargetActor.IsAlive() ) )
  7432. {
  7433. SetSlideTarget( NULL );
  7434. if ( ProcessLockTarget() )
  7435. slideTargetActor = (CActor)slideTarget;
  7436. }
  7437.  
  7438. if ( !slideTargetActor )
  7439. {
  7440. LockToTarget( false );
  7441. enableNoTargetOrientation = true;
  7442. }
  7443. else if ( IsThreat( slideTargetActor ) || GetCurrentlyCastSign() == ST_Axii )
  7444. LockToTarget( true );
  7445. else
  7446. {
  7447. LockToTarget( false );
  7448. enableNoTargetOrientation = true;
  7449. }
  7450. }
  7451. }
  7452. }
  7453.  
  7454. if ( !enableNoTargetOrientation )
  7455. {
  7456. customOrientationTarget = OT_Actor;
  7457. }
  7458. }
  7459.  
  7460. if ( enableNoTargetOrientation )
  7461. {
  7462. if ( GetPlayerCombatStance() == PCS_AlertNear && /*theInput.GetActionValue( 'CastSignHold' ) > 0*/ TestCastSignHold() /* modSigns */ )
  7463. {
  7464. if ( GetDisplayTarget() && !slideTargetActor )
  7465. {
  7466. currTime = EngineTimeToFloat( theGame.GetEngineTime() );
  7467. if ( currTime > findActorTargetTimeStamp + 1.5f )
  7468. {
  7469. findActorTargetTimeStamp = currTime;
  7470.  
  7471. newLockTarget = GetScreenSpaceLockTarget( GetDisplayTarget(), 180.f, 1.f, 0.f, true );
  7472.  
  7473. if ( newLockTarget && IsThreat( newLockTarget ) && IsCombatMusicEnabled() )
  7474. {
  7475. SetTarget( newLockTarget, true );
  7476. SetMoveTargetChangeAllowed( true );
  7477. SetMoveTarget( newLockTarget );
  7478. SetMoveTargetChangeAllowed( false );
  7479. SetSlideTarget( newLockTarget );
  7480. }
  7481. }
  7482. }
  7483. else
  7484. ProcessLockTarget();
  7485. }
  7486.  
  7487. if ( false ) //modCombatStance: compatibility trick
  7488. customOrientationTarget = OT_CameraOffset;
  7489. else
  7490. {
  7491. if ( false ) //modCombatStance: compatibility trick
  7492. customOrientationTarget = OT_CameraOffset;
  7493. else if ( /*theInput.GetActionValue( 'CastSignHold' ) > 0*/ TestCastSignHold() /* modSigns */ )
  7494. {
  7495. //modCombatStance begin
  7496. /*
  7497. if ( GetOrientationTarget() == OT_CameraOffset )
  7498. customOrientationTarget = OT_CameraOffset;
  7499. else if ( GetPlayerCombatStance() == PCS_AlertNear || GetPlayerCombatStance() == PCS_Guarded )
  7500. customOrientationTarget = OT_CameraOffset;
  7501. else
  7502. customOrientationTarget = OT_Player;
  7503. */
  7504. customOrientationTarget = OT_CameraOffset;
  7505. //modCombatStance end
  7506. }
  7507. else
  7508. //modCombatStance begin
  7509. {
  7510. if(IsUsingVehicle())
  7511. customOrientationTarget = OT_CameraOffset;
  7512. else if(lastAxisInputIsMovement)
  7513. customOrientationTarget = OT_Player;
  7514. else
  7515. customOrientationTarget = OT_CameraOffset;
  7516. }
  7517. //modCombatStance end
  7518. }
  7519. }
  7520.  
  7521. if ( GetCurrentlyCastSign() == ST_Quen )
  7522. {
  7523. if ( false ) //modCombatStance
  7524. {
  7525. customOrientationTarget = OT_Camera;
  7526. }
  7527. else if ( IsCurrentSignChanneled() )
  7528. {
  7529. //modCombatStance begin
  7530. /*
  7531. if ( bLAxisReleased )
  7532. customOrientationTarget = OT_Player;
  7533. else
  7534. customOrientationTarget = OT_Camera;
  7535. */
  7536. customOrientationTarget = OT_Camera;
  7537. //modCombatStance end
  7538. }
  7539. else
  7540. customOrientationTarget = OT_Player;
  7541. }
  7542.  
  7543. if ( GetCurrentlyCastSign() == ST_Axii && IsCurrentSignChanneled() )
  7544. {
  7545. if ( slideTarget && (CActor)slideTarget )
  7546. {
  7547. checkHeading = VecHeading( slideTarget.GetWorldPosition() - this.GetWorldPosition() );
  7548. rotHeading = checkHeading;
  7549. playerToHeadingDist = AngleDistance( GetHeading(), checkHeading );
  7550.  
  7551. if ( playerToHeadingDist > 45 )
  7552. SetCustomRotation( 'ChanneledSignAxii', rotHeading, 0.0, 0.5, false );
  7553. else if ( playerToHeadingDist < -45 )
  7554. SetCustomRotation( 'ChanneledSignAxii', rotHeading, 0.0, 0.5, false );
  7555. }
  7556. else
  7557. {
  7558. checkHeading = VecHeading( theCamera.GetCameraDirection() );
  7559. rotHeading = GetHeading();
  7560. playerToHeadingDist = AngleDistance( GetHeading(), checkHeading );
  7561.  
  7562. if ( playerToHeadingDist > 45 )
  7563. SetCustomRotation( 'ChanneledSignAxii', rotHeading - 22.5, 0.0, 0.5, false );
  7564. else if ( playerToHeadingDist < -45 )
  7565. SetCustomRotation( 'ChanneledSignAxii', rotHeading + 22.5, 0.0, 0.5, false );
  7566. }
  7567. }
  7568.  
  7569. if ( IsActorLockedToTarget() )
  7570. customOrientationTarget = OT_Actor;
  7571.  
  7572. AddCustomOrientationTarget( customOrientationTarget, 'Signs' );
  7573.  
  7574. if ( customOrientationTarget == OT_CustomHeading )
  7575. SetOrientationTargetCustomHeading( GetCombatActionHeading(), 'Signs' );
  7576. }
  7577.  
  7578. event OnRaiseSignEvent()
  7579. {
  7580. var newTarget : CActor;
  7581.  
  7582. if ( ( !IsCombatMusicEnabled() && !CanAttackWhenNotInCombat( EBAT_CastSign, false, newTarget ) ) || ( IsOnBoat() && !IsCombatMusicEnabled() ) )
  7583. {
  7584. if ( CastSignFriendly() )
  7585. return true;
  7586. }
  7587. else
  7588. {
  7589. RaiseEvent('CombatActionFriendlyEnd');
  7590. SetBehaviorVariable( 'SignNum', (int)equippedSign );
  7591. SetBehaviorVariable( 'combatActionType', (int)CAT_CastSign );
  7592.  
  7593. if ( IsPCModeEnabled() )
  7594. pcModeChanneledSignTimeStamp = EngineTimeToFloat( theGame.GetEngineTime() );
  7595.  
  7596. if( RaiseForceEvent('CombatAction') )
  7597. {
  7598. OnCombatActionStart();
  7599. findActorTargetTimeStamp = EngineTimeToFloat( theGame.GetEngineTime() );
  7600. theTelemetry.LogWithValueStr(TE_FIGHT_PLAYER_USE_SIGN, SignEnumToString( equippedSign ));
  7601. return true;
  7602. }
  7603. }
  7604.  
  7605. return false;
  7606. }
  7607.  
  7608. function CastSignFriendly() : bool
  7609. {
  7610. var actor : CActor;
  7611.  
  7612. SetBehaviorVariable( 'combatActionTypeForOverlay', (int)CAT_CastSign );
  7613. if ( RaiseCombatActionFriendlyEvent() )
  7614. {
  7615.  
  7616. return true;
  7617. }
  7618.  
  7619. return false;
  7620. }
  7621.  
  7622. function CastSign() : bool
  7623. {
  7624. var equippedSignStr : string;
  7625. var newSignEnt : W3SignEntity;
  7626. var spawnPos : Vector;
  7627. var slotMatrix : Matrix;
  7628. var target : CActor;
  7629. //var mutagen17 : W3Mutagen17_Effect; //modSigns
  7630.  
  7631. if ( IsInAir() )
  7632. {
  7633. return false;
  7634. }
  7635.  
  7636. //AddTemporarySkills(); // moved to sign entity init
  7637.  
  7638. //modSigns: check for mutagen17 activation
  7639. //if(HasBuff(EET_Mutagen17))
  7640. //{
  7641. // mutagen17 = (W3Mutagen17_Effect)GetBuff(EET_Mutagen17);
  7642. // if(mutagen17.IsBoostAvailable())
  7643. // {
  7644. // mutagen17.ActivateBoost();
  7645. // //theGame.witcherLog.AddMessage("mutagen17 boost activated: sign"); //modSigns: debug
  7646. // }
  7647. //}
  7648.  
  7649.  
  7650.  
  7651. if(equippedSign == ST_Aard)
  7652. {
  7653. CalcEntitySlotMatrix('l_weapon', slotMatrix);
  7654. spawnPos = MatrixGetTranslation(slotMatrix);
  7655. }
  7656. else
  7657. {
  7658. spawnPos = GetWorldPosition();
  7659. }
  7660.  
  7661. if( equippedSign == ST_Aard || equippedSign == ST_Igni )
  7662. {
  7663. target = GetTarget();
  7664. if(target)
  7665. target.SignalGameplayEvent( 'DodgeSign' );
  7666. }
  7667.  
  7668. newSignEnt = (W3SignEntity)theGame.CreateEntity( signs[equippedSign].template, spawnPos, GetWorldRotation() );
  7669. return newSignEnt.Init( signOwner, signs[equippedSign].entity );
  7670. }
  7671.  
  7672.  
  7673. private function HAX_SignToThrowItemRestore()
  7674. {
  7675. var action : SInputAction;
  7676.  
  7677. action.value = theInput.GetActionValue('ThrowItemHold');
  7678. action.lastFrameValue = 0;
  7679.  
  7680. if(IsPressed(action) && CanSetupCombatAction_Throw())
  7681. {
  7682. if(inv.IsItemBomb(selectedItemId))
  7683. {
  7684. BombThrowStart();
  7685. }
  7686. else
  7687. {
  7688. UsableItemStart();
  7689. }
  7690.  
  7691. SetThrowHold( true );
  7692. }
  7693. }
  7694.  
  7695. event OnCFMCameraZoomFail(){}
  7696.  
  7697.  
  7698.  
  7699. public final function GetDrunkMutagens( optional sourceName : string ) : array<CBaseGameplayEffect>
  7700. {
  7701. return effectManager.GetDrunkMutagens( sourceName );
  7702. }
  7703.  
  7704. public final function GetPotionBuffs() : array<CBaseGameplayEffect>
  7705. {
  7706. return effectManager.GetPotionBuffs();
  7707. }
  7708.  
  7709. public final function RecalcPotionsDurations()
  7710. {
  7711. var i : int;
  7712. var buffs : array<CBaseGameplayEffect>;
  7713.  
  7714. buffs = GetPotionBuffs();
  7715. for(i=0; i<buffs.Size(); i+=1)
  7716. {
  7717. buffs[i].RecalcPotionDuration();
  7718. }
  7719. }
  7720.  
  7721. public function StartFrenzy()
  7722. {
  7723. //modSigns: reworked
  7724. var dm : CDefinitionsManagerAccessor = theGame.GetDefinitionsManager();
  7725. var min, max : SAbilityAttributeValue;
  7726. var skillAbilityName : name;
  7727. var skillLevel : int;
  7728. var ratio, duration : float;
  7729.  
  7730. isInFrenzy = true;
  7731. skillLevel = GetSkillLevel(S_Alchemy_s16);
  7732. skillAbilityName = SkillEnumToName(S_Alchemy_s16);
  7733. dm.GetAbilityAttributeValue(skillAbilityName, 'slowdown_ratio', min, max);
  7734. ratio = 1.0f - skillLevel * CalculateAttributeValue(min);
  7735. dm.GetAbilityAttributeValue(skillAbilityName, 'slowdown_duration', min, max);
  7736. duration = CalculateAttributeValue(min);
  7737.  
  7738. theGame.SetTimeScale(ratio, theGame.GetTimescaleSource(ETS_SkillFrenzy), theGame.GetTimescalePriority(ETS_SkillFrenzy) );
  7739. AddTimer('SkillFrenzyFinish', duration * ratio, , , , true);
  7740. }
  7741.  
  7742. timer function SkillFrenzyFinish(dt : float, optional id : int)
  7743. {
  7744. theGame.RemoveTimeScale( theGame.GetTimescaleSource(ETS_SkillFrenzy) );
  7745. isInFrenzy = false;
  7746. }
  7747.  
  7748. public function GetToxicityDamageThreshold() : float
  7749. {
  7750. var ret : float;
  7751.  
  7752. ret = theGame.params.TOXICITY_DAMAGE_THRESHOLD;
  7753.  
  7754. //if(CanUseSkill(S_Alchemy_s01)) //modSigns -> skill changed
  7755. // ret += CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s01, 'threshold', false, true)) * GetSkillLevel(S_Alchemy_s01);
  7756.  
  7757. return ret;
  7758. }
  7759.  
  7760. //modSigns
  7761. private var cachedToxDmg : float;
  7762. public function GetToxicityDamage() : float
  7763. {
  7764. var min, max : SAbilityAttributeValue;
  7765. var dmg : float;
  7766.  
  7767. if(cachedToxDmg == 0)
  7768. {
  7769. theGame.GetDefinitionsManager().GetAbilityAttributeValue('ToxicityEffect', 'DirectDamage', min, max);
  7770. cachedToxDmg = min.valueMultiplicative;
  7771. }
  7772. dmg = cachedToxDmg * GetStatMax(BCS_Vitality);
  7773. if(HasBuff(EET_Mutation10))
  7774. dmg *= ((W3Effect_Mutation10)GetBuff(EET_Mutation10)).GetDrainMult();
  7775.  
  7776. return dmg;
  7777. }
  7778.  
  7779.  
  7780.  
  7781. public final function AddToxicityOffset( val : float)
  7782. {
  7783. ((W3PlayerAbilityManager)abilityManager).AddToxicityOffset(val);
  7784. }
  7785.  
  7786. public final function SetToxicityOffset( val : float)
  7787. {
  7788. ((W3PlayerAbilityManager)abilityManager).SetToxicityOffset(val);
  7789. }
  7790.  
  7791. public final function RemoveToxicityOffset( val : float)
  7792. {
  7793. ((W3PlayerAbilityManager)abilityManager).RemoveToxicityOffset(val);
  7794. }
  7795.  
  7796. //modSigns
  7797. public final function RecalcTransmutationAbilities()
  7798. {
  7799. var ablName : name = GetSkillAbilityName(S_Alchemy_s13);
  7800. var offset : float = GetStat(BCS_Toxicity) - GetStat(BCS_Toxicity, true);
  7801. var numAbls : int = GetAbilityCount(ablName);
  7802. var targetNumAbls : int;
  7803.  
  7804. if(!CanUseSkill(S_Alchemy_s13))
  7805. {
  7806. RemoveAbilityAll(ablName);
  7807. return;
  7808. }
  7809.  
  7810. targetNumAbls = RoundMath(offset) * GetSkillLevel(S_Alchemy_s13);
  7811. if(numAbls < targetNumAbls)
  7812. AddAbilityMultiple(ablName, targetNumAbls - numAbls);
  7813. else if(numAbls > targetNumAbls)
  7814. RemoveAbilityMultiple(ablName, numAbls - targetNumAbls);
  7815. }
  7816.  
  7817.  
  7818. public final function CalculatePotionDuration(item : SItemUniqueId, isMutagenPotion : bool, optional itemName : name) : float
  7819. {
  7820. var duration, skillPassiveMod, mutagenSkillMod : float;
  7821. var val, min, max : SAbilityAttributeValue;
  7822.  
  7823.  
  7824. if(inv.IsIdValid(item))
  7825. {
  7826. duration = CalculateAttributeValue(inv.GetItemAttributeValue(item, 'duration'));
  7827. }
  7828. else
  7829. {
  7830. theGame.GetDefinitionsManager().GetItemAttributeValueNoRandom(itemName, true, 'duration', min, max);
  7831. duration = CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  7832. }
  7833.  
  7834. skillPassiveMod = CalculateAttributeValue(GetAttributeValue('potion_duration'));
  7835.  
  7836. //if(isMutagenPotion && CanUseSkill(S_Alchemy_s14))
  7837. //{
  7838. // val = GetSkillAttributeValue(S_Alchemy_s14, 'duration', false, true);
  7839. // mutagenSkillMod = val.valueMultiplicative * GetSkillLevel(S_Alchemy_s14);
  7840. //} //modSigns: skill changed
  7841.  
  7842. //modSigns: don't add passive skill mod to mutagen potions
  7843. //duration = duration * (1 + skillPassiveMod + mutagenSkillMod);
  7844. if(isMutagenPotion)
  7845. duration = duration * (1 + mutagenSkillMod);
  7846. else
  7847. duration = duration * (1 + skillPassiveMod);
  7848.  
  7849. return duration;
  7850. }
  7851.  
  7852. public function GetAdaptationToxReduction() : float //modSigns
  7853. {
  7854. var attr : SAbilityAttributeValue;
  7855.  
  7856. if(CanUseSkill(S_Alchemy_s14))
  7857. {
  7858. attr = GetSkillAttributeValue(S_Alchemy_s14, 'tox_off_bonus', false, false);
  7859. return attr.valueMultiplicative * GetSkillLevel(S_Alchemy_s14);
  7860. }
  7861. else
  7862. return 0;
  7863. }
  7864.  
  7865. public function Mutation12FreeDecoctionAvailable() : bool //modSigns
  7866. {
  7867. var min, max : SAbilityAttributeValue;
  7868. var buffs : array< CBaseGameplayEffect >;
  7869.  
  7870. theGame.GetDefinitionsManager().GetAbilityAttributeValue('Mutation12', 'maxcap', min, max);
  7871.  
  7872. buffs = GetDrunkMutagens("Mutation12");
  7873. if(buffs.Size() < min.valueAdditive)
  7874. return true;
  7875. else
  7876. return false;
  7877. }
  7878.  
  7879. public function ToxicityLowEnoughToDrinkPotion( slotid : EEquipmentSlots, optional itemId : SItemUniqueId ) : bool
  7880. {
  7881. var item : SItemUniqueId;
  7882. var maxTox : float;
  7883. var potionToxicity : float;
  7884. var toxicityOffset : float;
  7885. var effectType : EEffectType;
  7886. var customAbilityName : name;
  7887. var adrenaline : float; //modSigns
  7888. var costReduction : SAbilityAttributeValue; //modSigns
  7889.  
  7890. if(itemId != GetInvalidUniqueId())
  7891. item = itemId;
  7892. else
  7893. item = itemSlots[slotid];
  7894.  
  7895. inv.GetPotionItemBuffData(item, effectType, customAbilityName);
  7896. maxTox = abilityManager.GetStatMax(BCS_Toxicity);
  7897. potionToxicity = CalculateAttributeValue(inv.GetItemAttributeValue(item, 'toxicity'));
  7898. //modSigns begin
  7899. if(CanUseSkill(S_Alchemy_s03))
  7900. {
  7901. potionToxicity -= CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s03, 'toxicityReduction', false, false)) * GetSkillLevel(S_Alchemy_s03);
  7902. }
  7903. //modSigns end
  7904. toxicityOffset = CalculateAttributeValue(inv.GetItemAttributeValue(item, 'toxicity_offset'));
  7905.  
  7906. //modSigns
  7907. if(CanUseSkill(S_Perk_13))
  7908. {
  7909. costReduction = GetSkillAttributeValue(S_Perk_13, 'cost_reduction', false, true);
  7910. adrenaline = FloorF(GetStat(BCS_Focus));
  7911. costReduction = costReduction * adrenaline;
  7912. potionToxicity = (potionToxicity - costReduction.valueBase) * (1 - costReduction.valueMultiplicative) - costReduction.valueAdditive;
  7913. potionToxicity = MaxF(0.f, potionToxicity);
  7914. }
  7915.  
  7916. //modSigns
  7917. if(IsMutationActive(EPMT_Mutation12) && Mutation12FreeDecoctionAvailable())
  7918. {
  7919. toxicityOffset = 0;
  7920. }
  7921. else if(CanUseSkill(S_Alchemy_s14))
  7922. {
  7923. toxicityOffset *= MaxF(0, 1 - GetAdaptationToxReduction());
  7924. }
  7925.  
  7926.  
  7927. if(effectType != EET_WhiteHoney)
  7928. {
  7929. if(abilityManager.GetStat(BCS_Toxicity, false) + potionToxicity + toxicityOffset > maxTox )
  7930. {
  7931. return false;
  7932. }
  7933. }
  7934.  
  7935. return true;
  7936. }
  7937.  
  7938. public final function HasFreeToxicityToDrinkPotion( item : SItemUniqueId, effectType : EEffectType, out finalPotionToxicity : float ) : bool
  7939. {
  7940. var i : int;
  7941. var maxTox, toxicityOffset, adrenaline : float;
  7942. var costReduction : SAbilityAttributeValue;
  7943.  
  7944.  
  7945. if( effectType == EET_WhiteHoney )
  7946. {
  7947. return true;
  7948. }
  7949.  
  7950.  
  7951. maxTox = abilityManager.GetStatMax(BCS_Toxicity);
  7952. finalPotionToxicity = CalculateAttributeValue(inv.GetItemAttributeValue(item, 'toxicity'));
  7953. //modSigns begin
  7954. if(CanUseSkill(S_Alchemy_s03))
  7955. {
  7956. finalPotionToxicity -= CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s03, 'toxicityReduction', false, false)) * GetSkillLevel(S_Alchemy_s03);
  7957. }
  7958. //modSigns end
  7959. toxicityOffset = CalculateAttributeValue(inv.GetItemAttributeValue(item, 'toxicity_offset'));
  7960.  
  7961.  
  7962. if(CanUseSkill(S_Perk_13))
  7963. {
  7964. costReduction = GetSkillAttributeValue(S_Perk_13, 'cost_reduction', false, true);
  7965. adrenaline = FloorF(GetStat(BCS_Focus));
  7966. costReduction = costReduction * adrenaline;
  7967. finalPotionToxicity = (finalPotionToxicity - costReduction.valueBase) * (1 - costReduction.valueMultiplicative) - costReduction.valueAdditive;
  7968. finalPotionToxicity = MaxF(0.f, finalPotionToxicity);
  7969. }
  7970.  
  7971.  
  7972. //modSigns
  7973. if(IsMutationActive(EPMT_Mutation12) && Mutation12FreeDecoctionAvailable())
  7974. {
  7975. toxicityOffset = 0;
  7976. }
  7977. else if(CanUseSkill(S_Alchemy_s14))
  7978. {
  7979. toxicityOffset *= MaxF(0, 1 - GetAdaptationToxReduction());
  7980. }
  7981.  
  7982.  
  7983. if(abilityManager.GetStat(BCS_Toxicity, false) + finalPotionToxicity + toxicityOffset > maxTox )
  7984. {
  7985. return false;
  7986. }
  7987.  
  7988. return true;
  7989. }
  7990.  
  7991. public function DrinkPreparedPotion( slotid : EEquipmentSlots, optional itemId : SItemUniqueId )
  7992. {
  7993. var potParams : W3PotionParams;
  7994. var potionParams : SCustomEffectParams;
  7995. var factPotionParams : W3Potion_Fact_Params;
  7996. var adrenaline, hpGainValue, staminaGainValue, duration, finalPotionToxicity : float; //modSigns
  7997. var ret : EEffectInteract;
  7998. var effectType : EEffectType;
  7999. var item : SItemUniqueId;
  8000. var customAbilityName, factId : name;
  8001. var atts : array<name>;
  8002. var i : int;
  8003. var mutagenParams : W3MutagenBuffCustomParams;
  8004.  
  8005.  
  8006. if(itemId != GetInvalidUniqueId())
  8007. item = itemId;
  8008. else
  8009. item = itemSlots[slotid];
  8010.  
  8011.  
  8012. if(!inv.IsIdValid(item))
  8013. return;
  8014.  
  8015.  
  8016. if( inv.SingletonItemGetAmmo(item) == 0 )
  8017. return;
  8018.  
  8019.  
  8020. inv.GetPotionItemBuffData(item, effectType, customAbilityName);
  8021.  
  8022.  
  8023. if( !HasFreeToxicityToDrinkPotion( item, effectType, finalPotionToxicity ) )
  8024. {
  8025. return;
  8026. }
  8027.  
  8028.  
  8029. if(effectType == EET_Fact)
  8030. {
  8031. inv.GetItemAttributes(item, atts);
  8032.  
  8033. for(i=0; i<atts.Size(); i+=1)
  8034. {
  8035. if(StrBeginsWith(NameToString(atts[i]), "fact_"))
  8036. {
  8037. factId = atts[i];
  8038. break;
  8039. }
  8040. }
  8041.  
  8042. factPotionParams = new W3Potion_Fact_Params in theGame;
  8043. factPotionParams.factName = factId;
  8044. factPotionParams.potionItemName = inv.GetItemName(item);
  8045.  
  8046. potionParams.buffSpecificParams = factPotionParams;
  8047. }
  8048.  
  8049. else if(inv.ItemHasTag( item, 'Mutagen' ))
  8050. {
  8051. mutagenParams = new W3MutagenBuffCustomParams in theGame;
  8052. //modSigns
  8053. if(IsMutationActive(EPMT_Mutation12) && Mutation12FreeDecoctionAvailable())
  8054. {
  8055. mutagenParams.toxicityOffset = 0;
  8056. potionParams.sourceName = "Mutation12";
  8057. theGame.MutationHUDFeedback(MFT_PlayOnce);
  8058. }
  8059. else
  8060. {
  8061. mutagenParams.toxicityOffset = CalculateAttributeValue(inv.GetItemAttributeValue(item, 'toxicity_offset'));
  8062. if(CanUseSkill(S_Alchemy_s14))
  8063. {
  8064. mutagenParams.toxicityOffset *= MaxF(0, 1 - GetAdaptationToxReduction());
  8065. }
  8066. }
  8067. mutagenParams.potionItemName = inv.GetItemName(item);
  8068.  
  8069. potionParams.buffSpecificParams = mutagenParams;
  8070.  
  8071. //if( IsMutationActive( EPMT_Mutation10 ) && !HasBuff( EET_Mutation10 ) && IsInCombat() ) //modSigns
  8072. //{
  8073. // AddEffectDefault( EET_Mutation10, this, "Mutation 10" );
  8074. //} //modSigns: reworked
  8075. }
  8076.  
  8077. else
  8078. {
  8079. potParams = new W3PotionParams in theGame;
  8080. potParams.potionItemName = inv.GetItemName(item);
  8081.  
  8082. potionParams.buffSpecificParams = potParams;
  8083. }
  8084.  
  8085.  
  8086. duration = CalculatePotionDuration(item, inv.ItemHasTag( item, 'Mutagen' ));
  8087.  
  8088.  
  8089. potionParams.effectType = effectType;
  8090. potionParams.creator = this;
  8091. //modSigns
  8092. if(potionParams.sourceName != "Mutation12")
  8093. potionParams.sourceName = "drank_potion";
  8094. potionParams.duration = duration;
  8095. potionParams.customAbilityName = customAbilityName;
  8096. ret = AddEffectCustom(potionParams);
  8097.  
  8098.  
  8099. if(factPotionParams)
  8100. delete factPotionParams;
  8101.  
  8102. if(mutagenParams)
  8103. delete mutagenParams;
  8104.  
  8105.  
  8106. inv.SingletonItemRemoveAmmo(item);
  8107.  
  8108.  
  8109. if(ret == EI_Pass || ret == EI_Override || ret == EI_Cumulate)
  8110. {
  8111. if( finalPotionToxicity > 0.f )
  8112. {
  8113. abilityManager.GainStat(BCS_Toxicity, finalPotionToxicity );
  8114. }
  8115.  
  8116.  
  8117. if(CanUseSkill(S_Perk_13) && !inv.ItemHasTag(item, 'Mutagen')) //modSigns
  8118. {
  8119. adrenaline = FloorF(GetStat(BCS_Focus)); //modSigns
  8120. abilityManager.DrainFocus(adrenaline);
  8121. }
  8122.  
  8123. if (!IsEffectActive('invisible'))
  8124. {
  8125. PlayEffect('use_potion');
  8126. }
  8127.  
  8128. if ( inv.ItemHasTag( item, 'Mutagen' ) )
  8129. {
  8130.  
  8131. theGame.GetGamerProfile().CheckTrialOfGrasses();
  8132.  
  8133.  
  8134. SetFailedFundamentalsFirstAchievementCondition(true);
  8135. }
  8136.  
  8137.  
  8138. if(CanUseSkill(S_Alchemy_s01)) //modSigns
  8139. {
  8140. staminaGainValue = ClampF(GetStatMax(BCS_Stamina) * CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s01, 'stamina_gain_perc', false, true)) * GetSkillLevel(S_Alchemy_s01), 0, GetStatMax(BCS_Stamina));
  8141. GainStat(BCS_Stamina, staminaGainValue);
  8142. }
  8143.  
  8144. if(CanUseSkill(S_Alchemy_s02))
  8145. {
  8146. hpGainValue = ClampF(GetStatMax(BCS_Vitality) * CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s02, 'vitality_gain_perc', false, true)) * GetSkillLevel(S_Alchemy_s02), 0, GetStatMax(BCS_Vitality));
  8147. GainStat(BCS_Vitality, hpGainValue);
  8148. }
  8149.  
  8150.  
  8151. /*if(CanUseSkill(S_Alchemy_s04) && !skillBonusPotionEffect && (RandF() < CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s04, 'apply_chance', false, true)) * GetSkillLevel(S_Alchemy_s04)))
  8152. {
  8153. AddRandomPotionEffectFromAlch4Skill( effectType );
  8154. }*/ //modSigns: removed
  8155.  
  8156. theGame.GetGamerProfile().SetStat(ES_ActivePotions, effectManager.GetPotionBuffsCount());
  8157. }
  8158.  
  8159. theTelemetry.LogWithLabel(TE_ELIXIR_USED, inv.GetItemName(item));
  8160.  
  8161. if(ShouldProcessTutorial('TutorialPotionAmmo'))
  8162. {
  8163. FactsAdd("tut_used_potion");
  8164. }
  8165.  
  8166. SetFailedFundamentalsFirstAchievementCondition(true);
  8167. }
  8168.  
  8169.  
  8170. /*private final function AddRandomPotionEffectFromAlch4Skill( currentlyDrankPotion : EEffectType )
  8171. {
  8172. var randomPotions : array<EEffectType>;
  8173. var currentPotion : CBaseGameplayEffect;
  8174. var effectsOld, effectsNew : array<CBaseGameplayEffect>;
  8175. var i, ind : int;
  8176. var duration : float;
  8177. var params : SCustomEffectParams;
  8178. var ret : EEffectInteract;
  8179.  
  8180.  
  8181. randomPotions.PushBack( EET_BlackBlood );
  8182. randomPotions.PushBack( EET_Blizzard );
  8183. randomPotions.PushBack( EET_FullMoon );
  8184. randomPotions.PushBack( EET_GoldenOriole );
  8185. //randomPotions.PushBack( EET_KillerWhale ); //modSigns
  8186. randomPotions.PushBack( EET_MariborForest );
  8187. randomPotions.PushBack( EET_PetriPhiltre );
  8188. randomPotions.PushBack( EET_Swallow );
  8189. randomPotions.PushBack( EET_TawnyOwl );
  8190. randomPotions.PushBack( EET_Thunderbolt );
  8191.  
  8192.  
  8193. randomPotions.Remove( currentlyDrankPotion );
  8194.  
  8195.  
  8196. ind = RandRange( randomPotions.Size() );
  8197.  
  8198.  
  8199. if( HasBuff( randomPotions[ ind ] ) )
  8200. {
  8201. currentPotion = GetBuff( randomPotions[ ind ] );
  8202. currentPotion.SetTimeLeft( currentPotion.GetInitialDurationAfterResists() );
  8203. }
  8204.  
  8205. else
  8206. {
  8207. duration = BonusPotionGetDurationFromXML( randomPotions[ ind ] );
  8208.  
  8209. if(duration > 0)
  8210. {
  8211. effectsOld = GetCurrentEffects();
  8212.  
  8213. params.effectType = randomPotions[ ind ];
  8214. params.creator = this;
  8215. params.sourceName = SkillEnumToName( S_Alchemy_s04 );
  8216. params.duration = duration;
  8217. ret = AddEffectCustom( params );
  8218.  
  8219.  
  8220. if( ret != EI_Undefined && ret != EI_Deny )
  8221. {
  8222. effectsNew = GetCurrentEffects();
  8223.  
  8224. ind = -1;
  8225. for( i=effectsNew.Size()-1; i>=0; i-=1)
  8226. {
  8227. if( !effectsOld.Contains( effectsNew[i] ) )
  8228. {
  8229. ind = i;
  8230. break;
  8231. }
  8232. }
  8233.  
  8234. if(ind > -1)
  8235. {
  8236. skillBonusPotionEffect = effectsNew[ind];
  8237. }
  8238. }
  8239. }
  8240. }
  8241. }*/ //modSigns: removed
  8242.  
  8243.  
  8244. private function BonusPotionGetDurationFromXML(type : EEffectType) : float
  8245. {
  8246. var dm : CDefinitionsManagerAccessor;
  8247. var main, ingredients : SCustomNode;
  8248. var tmpName, typeName, itemName : name;
  8249. var abs : array<name>;
  8250. var min, max : SAbilityAttributeValue;
  8251. var tmpInt : int;
  8252. var temp : array<float>;
  8253. var i, temp2, temp3 : int;
  8254.  
  8255. dm = theGame.GetDefinitionsManager();
  8256. main = dm.GetCustomDefinition('alchemy_recipes');
  8257. typeName = EffectTypeToName(type);
  8258.  
  8259.  
  8260. for(i=0; i<main.subNodes.Size(); i+=1)
  8261. {
  8262. if(dm.GetCustomNodeAttributeValueName(main.subNodes[i], 'type_name', tmpName))
  8263. {
  8264.  
  8265. if(tmpName == typeName)
  8266. {
  8267. if(dm.GetCustomNodeAttributeValueInt(main.subNodes[i], 'level', tmpInt))
  8268. {
  8269.  
  8270. if(tmpInt == 1)
  8271. {
  8272. if(dm.GetCustomNodeAttributeValueName(main.subNodes[i], 'cookedItem_name', itemName))
  8273. {
  8274.  
  8275. if(IsNameValid(itemName))
  8276. {
  8277. break;
  8278. }
  8279. }
  8280. }
  8281. }
  8282. }
  8283. }
  8284. }
  8285.  
  8286. if(!IsNameValid(itemName))
  8287. return 0;
  8288.  
  8289.  
  8290. dm.GetItemAbilitiesWithWeights(itemName, true, abs, temp, temp2, temp3);
  8291. dm.GetAbilitiesAttributeValue(abs, 'duration', min, max);
  8292. return CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  8293. }
  8294.  
  8295. public function ClearSkillBonusPotionEffect()
  8296. {
  8297. skillBonusPotionEffect = NULL;
  8298. }
  8299.  
  8300. public function GetSkillBonusPotionEffect() : CBaseGameplayEffect
  8301. {
  8302. return skillBonusPotionEffect;
  8303. }
  8304.  
  8305.  
  8306.  
  8307.  
  8308.  
  8309.  
  8310.  
  8311. public final function HasRunewordActive(abilityName : name) : bool
  8312. {
  8313. var item : SItemUniqueId;
  8314. var hasRuneword : bool;
  8315.  
  8316. hasRuneword = false;
  8317.  
  8318. 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)
  8319. {
  8320. hasRuneword = inv.ItemHasAbility(item, abilityName);
  8321. }
  8322.  
  8323. if(!hasRuneword)
  8324. {
  8325. 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)
  8326. {
  8327. hasRuneword = inv.ItemHasAbility(item, abilityName);
  8328. }
  8329. }
  8330.  
  8331. return hasRuneword;
  8332. }
  8333.  
  8334. public final function HasGlyphwordActive(abilityName : name) : bool //modSigns
  8335. {
  8336. var item : SItemUniqueId;
  8337. var hasGlyphword : bool;
  8338.  
  8339. hasGlyphword = false;
  8340.  
  8341. if(GetItemEquippedOnSlot(EES_Armor, item))
  8342. {
  8343. hasGlyphword = inv.ItemHasAbility(item, abilityName);
  8344. }
  8345.  
  8346. return hasGlyphword;
  8347. }
  8348.  
  8349. public final function GetShrineBuffs() : array<CBaseGameplayEffect>
  8350. {
  8351. var null : array<CBaseGameplayEffect>;
  8352.  
  8353. if(effectManager && effectManager.IsReady())
  8354. return effectManager.GetShrineBuffs();
  8355.  
  8356. return null;
  8357. }
  8358.  
  8359. public final function AddRepairObjectBuff(armor : bool, weapon : bool) : bool
  8360. {
  8361. var added : bool;
  8362.  
  8363. added = false;
  8364.  
  8365. if(weapon /*&& (IsAnyItemEquippedOnSlot(EES_SilverSword) || IsAnyItemEquippedOnSlot(EES_SteelSword))*/ ) //modSigns: restrictions removed
  8366. {
  8367. AddEffectDefault(EET_EnhancedWeapon, this, "repair_object", false);
  8368. added = true;
  8369. }
  8370.  
  8371. if(armor /*&& (IsAnyItemEquippedOnSlot(EES_Armor) || IsAnyItemEquippedOnSlot(EES_Gloves) || IsAnyItemEquippedOnSlot(EES_Boots) || IsAnyItemEquippedOnSlot(EES_Pants))*/ ) //modSigns: restrictions removed
  8372. {
  8373. AddEffectDefault(EET_EnhancedArmor, this, "repair_object", false);
  8374. added = true;
  8375. }
  8376.  
  8377. return added;
  8378. }
  8379.  
  8380.  
  8381. public function StartCSAnim(buff : CBaseGameplayEffect) : bool
  8382. {
  8383.  
  8384. if(IsAnyQuenActive() && (W3CriticalDOTEffect)buff)
  8385. return false;
  8386.  
  8387. return super.StartCSAnim(buff);
  8388. }
  8389.  
  8390. public function GetPotionBuffLevel(effectType : EEffectType) : int
  8391. {
  8392. if(effectManager && effectManager.IsReady())
  8393. return effectManager.GetPotionBuffLevel(effectType);
  8394.  
  8395. return 0;
  8396. }
  8397.  
  8398.  
  8399.  
  8400.  
  8401.  
  8402.  
  8403.  
  8404. event OnLevelGained(currentLevel : int, show : bool)
  8405. {
  8406. var hud : CR4ScriptedHud;
  8407. hud = (CR4ScriptedHud)theGame.GetHud();
  8408.  
  8409. if(abilityManager && abilityManager.IsInitialized())
  8410. {
  8411. ((W3PlayerAbilityManager)abilityManager).OnLevelGained(currentLevel);
  8412. }
  8413.  
  8414. if ( theGame.GetDifficultyMode() != EDM_Hardcore )
  8415. {
  8416. Heal(GetStatMax(BCS_Vitality));
  8417. }
  8418.  
  8419.  
  8420. if(currentLevel >= 35)
  8421. {
  8422. theGame.GetGamerProfile().AddAchievement(EA_Immortal);
  8423. }
  8424.  
  8425. if ( hud && currentLevel < levelManager.GetMaxLevel() && FactsQuerySum( "DebugNoLevelUpUpdates" ) == 0 )
  8426. {
  8427. hud.OnLevelUpUpdate(currentLevel, show);
  8428. }
  8429.  
  8430. theGame.RequestAutoSave( "level gained", false );
  8431. }
  8432.  
  8433. public function GetSignStats(skill : ESkill, out damageType : name, out damageVal : float, out spellPower : SAbilityAttributeValue)
  8434. {
  8435. var i, size : int;
  8436. var dm : CDefinitionsManagerAccessor;
  8437. var attrs : array<name>;
  8438.  
  8439. spellPower = GetPowerStatValue(CPS_SpellPower);
  8440.  
  8441. dm = theGame.GetDefinitionsManager();
  8442. dm.GetAbilityAttributes(GetSkillAbilityName(skill), attrs);
  8443. size = attrs.Size();
  8444.  
  8445. for( i = 0; i < size; i += 1 )
  8446. {
  8447. if( IsDamageTypeNameValid(attrs[i]) )
  8448. {
  8449. damageVal = CalculateAttributeValue(GetSkillAttributeValue(skill, attrs[i], false, true));
  8450. damageType = attrs[i];
  8451. break;
  8452. }
  8453. }
  8454. }
  8455.  
  8456.  
  8457. public function SetIgnorePainMaxVitality(val : float)
  8458. {
  8459. if(abilityManager && abilityManager.IsInitialized())
  8460. abilityManager.SetStatPointMax(BCS_Vitality, val);
  8461. }
  8462.  
  8463. event OnAnimEvent_ActionBlend( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  8464. {
  8465. if ( animEventType == AET_DurationStart && !disableActionBlend )
  8466. {
  8467. if ( this.IsCastingSign() )
  8468. ProcessSignEvent( 'cast_end' );
  8469.  
  8470.  
  8471. FindMoveTarget();
  8472. SetCanPlayHitAnim( true );
  8473. this.SetBIsCombatActionAllowed( true );
  8474.  
  8475. if ( this.GetFinisherVictim() && this.GetFinisherVictim().HasAbility( 'ForceFinisher' ) && !isInFinisher )
  8476. {
  8477. this.GetFinisherVictim().SignalGameplayEvent( 'Finisher' );
  8478. }
  8479. else if (this.BufferCombatAction != EBAT_EMPTY )
  8480. {
  8481.  
  8482.  
  8483.  
  8484. if ( !IsCombatMusicEnabled() )
  8485. {
  8486. SetCombatActionHeading( ProcessCombatActionHeading( this.BufferCombatAction ) );
  8487. FindTarget();
  8488. UpdateDisplayTarget( true );
  8489. }
  8490.  
  8491. if ( AllowAttack( GetTarget(), this.BufferCombatAction ) )
  8492. this.ProcessCombatActionBuffer();
  8493. }
  8494. else
  8495. {
  8496.  
  8497. ResumeStaminaRegen( 'InsideCombatAction' );
  8498.  
  8499.  
  8500.  
  8501. }
  8502. }
  8503. else if ( disableActionBlend )
  8504. {
  8505. disableActionBlend = false;
  8506. }
  8507. }
  8508.  
  8509.  
  8510. event OnAnimEvent_Sign( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  8511. {
  8512. if( animEventType == AET_Tick )
  8513. {
  8514. ProcessSignEvent( animEventName );
  8515. }
  8516. }
  8517.  
  8518. event OnAnimEvent_Throwable( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  8519. {
  8520. var thrownEntity : CThrowable;
  8521.  
  8522. thrownEntity = (CThrowable)EntityHandleGet( thrownEntityHandle );
  8523.  
  8524. if ( inv.IsItemCrossbow( inv.GetItemFromSlot('l_weapon') ) && rangedWeapon.OnProcessThrowEvent( animEventName ) )
  8525. {
  8526. return true;
  8527. }
  8528. else if( thrownEntity && IsThrowingItem() && thrownEntity.OnProcessThrowEvent( animEventName ) )
  8529. {
  8530. return true;
  8531. }
  8532. }
  8533.  
  8534. event OnTaskSyncAnim( npc : CNewNPC, animNameLeft : name )
  8535. {
  8536. var tmpBool : bool;
  8537. var tmpName : name;
  8538. var damage, points, resistance : float;
  8539. var min, max : SAbilityAttributeValue;
  8540. var mc : EMonsterCategory;
  8541.  
  8542. super.OnTaskSyncAnim( npc, animNameLeft );
  8543.  
  8544. if( animNameLeft == 'BruxaBite' && IsMutationActive( EPMT_Mutation4 ) )
  8545. {
  8546. theGame.GetMonsterParamsForActor( npc, mc, tmpName, tmpBool, tmpBool, tmpBool );
  8547.  
  8548. if( mc == MC_Vampire )
  8549. {
  8550. GetResistValue( CDS_BleedingRes, points, resistance );
  8551.  
  8552. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'BleedingEffect', 'DirectDamage', min, max );
  8553. damage = MaxF( 0.f, max.valueMultiplicative * GetMaxHealth() - points );
  8554.  
  8555. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'BleedingEffect', 'duration', min, max );
  8556. damage *= min.valueAdditive * ( 1 - MinF( 1.f, resistance ) );
  8557.  
  8558. if( damage > 0.f )
  8559. {
  8560. //npc.AddAbility( 'Mutation4BloodDebuff' ); //modSigns: moved to acid effect
  8561. ProcessActionMutation4ReturnedDamage( damage, npc, EAHA_ForceNo );
  8562. //npc.AddTimer( 'RemoveMutation4BloodDebuff', 15.f, , , , , true ); //modSigns: moved to acid effect
  8563. }
  8564. }
  8565. }
  8566. }
  8567.  
  8568.  
  8569. //modSigns: redone
  8570. public function ProcessActionMutation4ReturnedDamage( damageDealt : float, attacker : CActor, hitAnimationType : EActionHitAnim, optional action : W3DamageAction ) : bool
  8571. {
  8572. var customParams : SCustomEffectParams;
  8573. var currToxicity : float;
  8574. var min, max, customDamageValue : SAbilityAttributeValue;
  8575. var dm : CDefinitionsManagerAccessor;
  8576. var animAction : W3DamageAction;
  8577. var customDuration : float; //modSigns
  8578.  
  8579. if( damageDealt <= 0 )
  8580. {
  8581. return false;
  8582. }
  8583.  
  8584. currToxicity = GetStat( BCS_Toxicity );
  8585.  
  8586. if( currToxicity <= 0 )
  8587. {
  8588. return false;
  8589. }
  8590.  
  8591. dm = theGame.GetDefinitionsManager();
  8592. dm.GetAbilityAttributeValue( 'AcidEffect', 'DirectDamage', min, max );
  8593. customDamageValue.valueAdditive = currToxicity * min.valueAdditive;
  8594. dm.GetAbilityAttributeValue( 'AcidEffect', 'duration', min, max );
  8595. customDuration = min.valueAdditive;
  8596.  
  8597. if( customDamageValue.valueAdditive <= 0 || customDuration <= 0 )
  8598. {
  8599. return false;
  8600. }
  8601.  
  8602. if( action )
  8603. {
  8604. action.SetMutation4Triggered();
  8605. }
  8606.  
  8607. //dm.GetAbilityAttributeValue( 'AcidEffect', 'DirectDamage', min, max );
  8608. //customDamageValue.valueAdditive = damageDealt * min.valueAdditive;
  8609. //
  8610. //if( currToxicity > 0 )
  8611. //{
  8612. // customDamageValue.valueAdditive *= currToxicity;
  8613. //}
  8614. //
  8615. //dm.GetAbilityAttributeValue( 'AcidEffect', 'duration', min, max );
  8616. //customDamageValue.valueAdditive /= min.valueAdditive;
  8617.  
  8618. customParams.effectType = EET_Acid;
  8619. customParams.effectValue = customDamageValue;
  8620. customParams.duration = customDuration;
  8621. customParams.creator = this;
  8622. customParams.sourceName = 'Mutation4';
  8623.  
  8624. attacker.AddEffectCustom( customParams );
  8625.  
  8626.  
  8627. animAction = new W3DamageAction in theGame;
  8628. animAction.Initialize( this, attacker, NULL, 'Mutation4', EHRT_Reflect, CPS_Undefined, true, false, false, false );
  8629. animAction.SetCannotReturnDamage( true );
  8630. animAction.SetCanPlayHitParticle( false );
  8631. animAction.SetHitAnimationPlayType( hitAnimationType );
  8632. theGame.damageMgr.ProcessAction( animAction );
  8633. delete animAction;
  8634.  
  8635. theGame.MutationHUDFeedback( MFT_PlayOnce );
  8636.  
  8637. return true;
  8638. }
  8639.  
  8640. event OnPlayerActionEnd()
  8641. {
  8642. var l_i : int;
  8643. var l_bed : W3WitcherBed;
  8644.  
  8645. l_i = (int)GetBehaviorVariable( 'playerExplorationAction' );
  8646.  
  8647. if( l_i == PEA_GoToSleep )
  8648. {
  8649. l_bed = (W3WitcherBed)theGame.GetEntityByTag( 'witcherBed' );
  8650. BlockAllActions( 'WitcherBed', false );
  8651. l_bed.ApplyAppearance( "collision" );
  8652. l_bed.GotoState( 'WakeUp' );
  8653. theGame.ReleaseNoSaveLock( l_bed.m_bedSaveLock );
  8654.  
  8655.  
  8656. substateManager.m_MovementCorrectorO.disallowRotWhenGoingToSleep = false;
  8657. }
  8658.  
  8659. super.OnPlayerActionEnd();
  8660. }
  8661.  
  8662. event OnPlayerActionStartFinished()
  8663. {
  8664. var l_initData : W3SingleMenuInitData;
  8665. var l_i : int;
  8666.  
  8667. l_i = (int)GetBehaviorVariable( 'playerExplorationAction' );
  8668.  
  8669. if( l_i == PEA_GoToSleep )
  8670. {
  8671. //modFriendlyMeditation begin
  8672. UnblockAction( EIAB_OpenMeditation, 'WitcherBed' );
  8673. UnblockAction( EIAB_MeditationWaiting, 'WitcherBed' );
  8674. //modFriendlyMeditation end
  8675.  
  8676. l_initData = new W3SingleMenuInitData in this;
  8677. l_initData.SetBlockOtherPanels( true );
  8678. l_initData.ignoreSaveSystem = true;
  8679. l_initData.ignoreMeditationCheck = true;
  8680. l_initData.setDefaultState( '' );
  8681. l_initData.isBonusMeditationAvailable = true;
  8682. l_initData.fixedMenuName = 'MeditationClockMenu';
  8683.  
  8684. theGame.RequestMenuWithBackground( 'MeditationClockMenu', 'CommonMenu', l_initData );
  8685. }
  8686.  
  8687. super.OnPlayerActionStartFinished();
  8688. }
  8689.  
  8690. public function IsInCombatAction_SpecialAttack() : bool
  8691. {
  8692. if ( IsInCombatAction() && ( GetCombatAction() == EBAT_SpecialAttack_Light || GetCombatAction() == EBAT_SpecialAttack_Heavy ) )
  8693. return true;
  8694. else
  8695. return false;
  8696. }
  8697.  
  8698. public function IsInCombatAction_SpecialAttackHeavy() : bool
  8699. {
  8700. if ( IsInCombatAction() && GetCombatAction() == EBAT_SpecialAttack_Heavy )
  8701. return true;
  8702. else
  8703. return false;
  8704. }
  8705.  
  8706. protected function WhenCombatActionIsFinished()
  8707. {
  8708. super.WhenCombatActionIsFinished();
  8709. RemoveTimer( 'ProcessAttackTimer' );
  8710. RemoveTimer( 'AttackTimerEnd' );
  8711. CastSignAbort();
  8712. specialAttackCamera = false;
  8713. this.OnPerformSpecialAttack( true, false );
  8714. }
  8715.  
  8716. //modSigns: RemoveTemporarySkills should never happen on combat action end,
  8717. //as if sign casting interrupts any other action, temp skills are removed
  8718. //by the end of interrupted action and before the sign is actually cast!
  8719. event OnCombatActionEnd()
  8720. {
  8721. this.CleanCombatActionBuffer();
  8722. super.OnCombatActionEnd();
  8723.  
  8724. //RemoveTemporarySkills();
  8725.  
  8726. // Combat Anims - Begin
  8727. ResetCustomAnimationSpeedMult();
  8728. // Combat Anims - End
  8729. }
  8730.  
  8731. event OnCombatActionFriendlyEnd()
  8732. {
  8733. if ( IsCastingSign() )
  8734. {
  8735. SetBehaviorVariable( 'IsCastingSign', 0 );
  8736. SetCurrentlyCastSign( ST_None, NULL );
  8737. LogChannel( 'ST_None', "ST_None" );
  8738. }
  8739.  
  8740. super.OnCombatActionFriendlyEnd();
  8741. }
  8742.  
  8743. public function GetPowerStatValue( stat : ECharacterPowerStats, optional ablName : name, optional ignoreDeath : bool ) : SAbilityAttributeValue
  8744. {
  8745. var result : SAbilityAttributeValue;
  8746.  
  8747.  
  8748. result = super.GetPowerStatValue( stat, ablName, ignoreDeath );
  8749. //modSigns: W3DamageAction.GetPowerStatValue calls for actor.GetPowerStatValue twice:
  8750. //second time with attackName as ablName to obtain attack specific boosts, so Euphoria boost ends up
  8751. //being applied twice. Character stats for popup menu don't use ablName as there is no attack and no attackName,
  8752. //so bonus is displayed properly there, but gets doubled when actual damage is calculated in combat.
  8753. //To fix this we need to check for non-ability specific calls:
  8754. //if( !IsNameValid(ablName) && stat != CPS_Undefined )
  8755. // ApplyMutation10StatBoost( result ); //modSigns: reworked
  8756.  
  8757. return result;
  8758. }
  8759.  
  8760.  
  8761.  
  8762. timer function OpenRadialMenu( time: float, id : int )
  8763. {
  8764.  
  8765. if( GetBIsCombatActionAllowed() && !IsUITakeInput() )
  8766. {
  8767. bShowRadialMenu = true;
  8768. }
  8769.  
  8770. this.RemoveTimer('OpenRadialMenu');
  8771. }
  8772.  
  8773. public function OnAddRadialMenuOpenTimer( )
  8774. {
  8775.  
  8776.  
  8777.  
  8778.  
  8779.  
  8780. this.AddTimer('OpenRadialMenu', _HoldBeforeOpenRadialMenuTime * theGame.GetTimeScale() );
  8781.  
  8782. }
  8783.  
  8784. public function SetShowRadialMenuOpenFlag( bSet : bool )
  8785. {
  8786.  
  8787. bShowRadialMenu = bSet;
  8788. }
  8789.  
  8790. public function OnRemoveRadialMenuOpenTimer()
  8791. {
  8792.  
  8793. this.RemoveTimer('OpenRadialMenu');
  8794. }
  8795.  
  8796. public function ResetRadialMenuOpenTimer()
  8797. {
  8798.  
  8799. this.RemoveTimer('OpenRadialMenu');
  8800. if( GetBIsCombatActionAllowed() )
  8801. {
  8802.  
  8803.  
  8804. AddTimer('OpenRadialMenu', _HoldBeforeOpenRadialMenuTime * theGame.GetTimeScale() );
  8805. }
  8806. }
  8807.  
  8808.  
  8809.  
  8810. timer function ResendCompanionDisplayName(dt : float, id : int)
  8811. {
  8812. var hud : CR4ScriptedHud;
  8813. var companionModule : CR4HudModuleCompanion;
  8814.  
  8815. hud = (CR4ScriptedHud)theGame.GetHud();
  8816. if( hud )
  8817. {
  8818. companionModule = (CR4HudModuleCompanion)hud.GetHudModule("CompanionModule");
  8819. if( companionModule )
  8820. {
  8821. companionModule.ResendDisplayName();
  8822. }
  8823. }
  8824. }
  8825.  
  8826. timer function ResendCompanionDisplayNameSecond(dt : float, id : int)
  8827. {
  8828. var hud : CR4ScriptedHud;
  8829. var companionModule : CR4HudModuleCompanion;
  8830.  
  8831. hud = (CR4ScriptedHud)theGame.GetHud();
  8832. if( hud )
  8833. {
  8834. companionModule = (CR4HudModuleCompanion)hud.GetHudModule("CompanionModule");
  8835. if( companionModule )
  8836. {
  8837. companionModule.ResendDisplayNameSecond();
  8838. }
  8839. }
  8840. }
  8841.  
  8842. public function RemoveCompanionDisplayNameTimer()
  8843. {
  8844. this.RemoveTimer('ResendCompanionDisplayName');
  8845. }
  8846.  
  8847. public function RemoveCompanionDisplayNameTimerSecond()
  8848. {
  8849. this.RemoveTimer('ResendCompanionDisplayNameSecond');
  8850. }
  8851.  
  8852.  
  8853. public function GetCompanionNPCTag() : name
  8854. {
  8855. return companionNPCTag;
  8856. }
  8857.  
  8858. public function SetCompanionNPCTag( value : name )
  8859. {
  8860. companionNPCTag = value;
  8861. }
  8862.  
  8863. public function GetCompanionNPCTag2() : name
  8864. {
  8865. return companionNPCTag2;
  8866. }
  8867.  
  8868. public function SetCompanionNPCTag2( value : name )
  8869. {
  8870. companionNPCTag2 = value;
  8871. }
  8872.  
  8873. public function GetCompanionNPCIconPath() : string
  8874. {
  8875. return companionNPCIconPath;
  8876. }
  8877.  
  8878. public function SetCompanionNPCIconPath( value : string )
  8879. {
  8880. companionNPCIconPath = value;
  8881. }
  8882.  
  8883. public function GetCompanionNPCIconPath2() : string
  8884. {
  8885. return companionNPCIconPath2;
  8886. }
  8887.  
  8888. public function SetCompanionNPCIconPath2( value : string )
  8889. {
  8890. companionNPCIconPath2 = value;
  8891. }
  8892.  
  8893.  
  8894.  
  8895. //modSigns: chance to ignore hit anim
  8896. /*public function GetChanceToIgnoreHitAnim() : float
  8897. {
  8898. var armorPieces : array<int>;
  8899.  
  8900. inv.CountArmorPieces(armorPieces);
  8901. return armorPieces[0] * 0 + armorPieces[1] * 2.5 + armorPieces[2] * 10;
  8902. }*/
  8903.  
  8904. public function ReactToBeingHit(damageAction : W3DamageAction, optional buffNotApplied : bool) : bool
  8905. {
  8906. //var chance : float;
  8907. //var procQuen : W3SignEntity;
  8908.  
  8909. if(IsThrowingItem() || IsThrowingItemWithAim()) //modSigns: no need to abort throwing if not in fact throwing
  8910. {
  8911. if(!damageAction.IsDoTDamage() && damageAction.DealsAnyDamage() && damageAction.GetHitAnimationPlayType() != EAHA_ForceNo) //modSigns
  8912. {
  8913. if(inv.IsItemBomb(selectedItemId))
  8914. {
  8915. BombThrowAbort();
  8916. }
  8917. else
  8918. {
  8919. ThrowingAbort();
  8920. }
  8921. }
  8922. }
  8923.  
  8924.  
  8925. /*if(damageAction.IsActionRanged())
  8926. {
  8927. chance = CalculateAttributeValue(GetAttributeValue('quen_chance_on_projectile'));
  8928. if(chance > 0)
  8929. {
  8930. chance = ClampF(chance, 0, 1);
  8931.  
  8932. if(RandF() < chance)
  8933. {
  8934. procQuen = (W3SignEntity)theGame.CreateEntity(signs[ST_Quen].template, GetWorldPosition(), GetWorldRotation() );
  8935. procQuen.Init(signOwner, signs[ST_Quen].entity, true );
  8936. procQuen.OnStarted();
  8937. procQuen.OnThrowing();
  8938. procQuen.OnEnded();
  8939. }
  8940. }
  8941. }*/ //modSigns: moved to reduce damage
  8942.  
  8943.  
  8944. if( !((W3Effect_Toxicity)damageAction.causer) )
  8945. MeditationForceAbort(true);
  8946.  
  8947.  
  8948. if(IsDoingSpecialAttack(false))
  8949. damageAction.SetHitAnimationPlayType(EAHA_ForceNo);
  8950.  
  8951. return super.ReactToBeingHit(damageAction, buffNotApplied);
  8952. }
  8953.  
  8954. protected function ShouldPauseHealthRegenOnHit() : bool
  8955. {
  8956.  
  8957. if( ( HasBuff( EET_Swallow ) && GetPotionBuffLevel( EET_Swallow ) >= 3 ) || HasBuff( EET_Runeword8 ) || HasBuff( EET_Mutation11Buff ) || HasBuff( EET_UndyingSkillImmortal ) ) //modSigns
  8958. {
  8959. return false;
  8960. }
  8961.  
  8962. return true;
  8963. }
  8964.  
  8965. public function SetMappinToHighlight( mappinName : name, mappinState : bool )
  8966. {
  8967. var mappinDef : SHighlightMappin;
  8968. mappinDef.MappinName = mappinName;
  8969. mappinDef.MappinState = mappinState;
  8970. MappinToHighlight.PushBack(mappinDef);
  8971. }
  8972.  
  8973. public function ClearMappinToHighlight()
  8974. {
  8975. MappinToHighlight.Clear();
  8976. }
  8977.  
  8978. public function CastSignAbort()
  8979. {
  8980. if( currentlyCastSign != ST_None && signs[currentlyCastSign].entity)
  8981. {
  8982. signs[currentlyCastSign].entity.OnSignAborted();
  8983. }
  8984.  
  8985.  
  8986. }
  8987.  
  8988. event OnBlockingSceneStarted( scene: CStoryScene )
  8989. {
  8990. //---=== modFriendlyMeditation ===---
  8991. //var med : W3PlayerWitcherStateMeditationWaiting;
  8992. //
  8993. //
  8994. //med = (W3PlayerWitcherStateMeditationWaiting)GetCurrentState();
  8995. //if(med)
  8996. //{
  8997. // med.StopRequested(true);
  8998. //}
  8999. ModEndMeditation();
  9000. //---=== modFriendlyMeditation ===---
  9001.  
  9002.  
  9003. super.OnBlockingSceneStarted( scene );
  9004. }
  9005.  
  9006.  
  9007.  
  9008.  
  9009.  
  9010. public function GetHorseManager() : W3HorseManager
  9011. {
  9012. return (W3HorseManager)EntityHandleGet( horseManagerHandle );
  9013. }
  9014.  
  9015.  
  9016. public function HorseEquipItem(horsesItemId : SItemUniqueId) : bool
  9017. {
  9018. var man : W3HorseManager;
  9019.  
  9020. man = GetHorseManager();
  9021. if(man)
  9022. return man.EquipItem(horsesItemId) != GetInvalidUniqueId();
  9023.  
  9024. return false;
  9025. }
  9026.  
  9027.  
  9028. public function HorseUnequipItem(slot : EEquipmentSlots) : bool
  9029. {
  9030. var man : W3HorseManager;
  9031.  
  9032. man = GetHorseManager();
  9033. if(man)
  9034. return man.UnequipItem(slot) != GetInvalidUniqueId();
  9035.  
  9036. return false;
  9037. }
  9038.  
  9039.  
  9040. public final function HorseRemoveItemByName(itemName : name, quantity : int)
  9041. {
  9042. var man : W3HorseManager;
  9043.  
  9044. man = GetHorseManager();
  9045. if(man)
  9046. man.HorseRemoveItemByName(itemName, quantity);
  9047. }
  9048.  
  9049.  
  9050. public final function HorseRemoveItemByCategory(itemCategory : name, quantity : int)
  9051. {
  9052. var man : W3HorseManager;
  9053.  
  9054. man = GetHorseManager();
  9055. if(man)
  9056. man.HorseRemoveItemByCategory(itemCategory, quantity);
  9057. }
  9058.  
  9059.  
  9060. public final function HorseRemoveItemByTag(itemTag : name, quantity : int)
  9061. {
  9062. var man : W3HorseManager;
  9063.  
  9064. man = GetHorseManager();
  9065. if(man)
  9066. man.HorseRemoveItemByTag(itemTag, quantity);
  9067. }
  9068.  
  9069. public function GetAssociatedInventory() : CInventoryComponent
  9070. {
  9071. var man : W3HorseManager;
  9072.  
  9073. man = GetHorseManager();
  9074. if(man)
  9075. return man.GetInventoryComponent();
  9076.  
  9077. return NULL;
  9078. }
  9079.  
  9080.  
  9081.  
  9082.  
  9083.  
  9084. public final function TutorialMutagensUnequipPlayerSkills() : array<STutorialSavedSkill>
  9085. {
  9086. var pam : W3PlayerAbilityManager;
  9087.  
  9088. pam = (W3PlayerAbilityManager)abilityManager;
  9089. return pam.TutorialMutagensUnequipPlayerSkills();
  9090. }
  9091.  
  9092. public final function TutorialMutagensEquipOneGoodSkill()
  9093. {
  9094. var pam : W3PlayerAbilityManager;
  9095.  
  9096. pam = (W3PlayerAbilityManager)abilityManager;
  9097. pam.TutorialMutagensEquipOneGoodSkill();
  9098. }
  9099.  
  9100. public final function TutorialMutagensEquipOneGoodOneBadSkill()
  9101. {
  9102. var pam : W3PlayerAbilityManager;
  9103.  
  9104. pam = (W3PlayerAbilityManager)abilityManager;
  9105. if(pam)
  9106. pam.TutorialMutagensEquipOneGoodOneBadSkill();
  9107. }
  9108.  
  9109. public final function TutorialMutagensEquipThreeGoodSkills()
  9110. {
  9111. var pam : W3PlayerAbilityManager;
  9112.  
  9113. pam = (W3PlayerAbilityManager)abilityManager;
  9114. if(pam)
  9115. pam.TutorialMutagensEquipThreeGoodSkills();
  9116. }
  9117.  
  9118. public final function TutorialMutagensCleanupTempSkills(savedEquippedSkills : array<STutorialSavedSkill>)
  9119. {
  9120. var pam : W3PlayerAbilityManager;
  9121.  
  9122. pam = (W3PlayerAbilityManager)abilityManager;
  9123. return pam.TutorialMutagensCleanupTempSkills(savedEquippedSkills);
  9124. }
  9125.  
  9126.  
  9127.  
  9128.  
  9129.  
  9130. //modSigns: redone
  9131. //modSigns: by default, there's no armor stamina penalty as armor class already
  9132. //affects action cost, but you can enable it in options
  9133. public final function CalculatedArmorStaminaRegenBonus() : float
  9134. {
  9135. var armorEq, glovesEq, pantsEq, bootsEq : bool;
  9136. var armorId, glovesId, pantsId, bootsId : SItemUniqueId;
  9137. var staminaRegenVal : float;
  9138. var armorRegenVal : SAbilityAttributeValue;
  9139.  
  9140. if(!theGame.params.IsArmorRegenPenaltyEnabled())
  9141. return 0.0f;
  9142.  
  9143. //base armor stamina regen bonus/penalty
  9144. armorRegenVal = GetAttributeValue('staminaRegen_armor_mod');
  9145. staminaRegenVal = armorRegenVal.valueMultiplicative;
  9146.  
  9147. //equipped pieces
  9148. armorEq = inv.GetItemEquippedOnSlot( EES_Armor, armorId );
  9149. glovesEq = inv.GetItemEquippedOnSlot( EES_Gloves, glovesId );
  9150. pantsEq = inv.GetItemEquippedOnSlot( EES_Pants, pantsId );
  9151. bootsEq = inv.GetItemEquippedOnSlot( EES_Boots, bootsId );
  9152.  
  9153. //glyphwords change stamina, not replace it
  9154. //if( HasGlyphwordActive( 'Glyphword 2 _Stats' ) )
  9155. //{
  9156. // if ( armorEq && !inv.ItemHasTag(armorId, 'LightArmor') )
  9157. // staminaRegenVal += 0.07;
  9158. // if ( glovesEq && !inv.ItemHasTag(glovesId, 'LightArmor') )
  9159. // staminaRegenVal += 0.01;
  9160. // if ( pantsEq && !inv.ItemHasTag(pantsId, 'LightArmor') )
  9161. // staminaRegenVal += 0.01;
  9162. // if ( bootsEq && !inv.ItemHasTag(bootsId, 'LightArmor') )
  9163. // staminaRegenVal += 0.01;
  9164. //}
  9165. //else if( HasGlyphwordActive( 'Glyphword 3 _Stats' ) )
  9166. //{
  9167. //}
  9168. //else if( HasGlyphwordActive( 'Glyphword 4 _Stats' ) )
  9169. //{
  9170. // if ( armorEq && !inv.ItemHasTag(armorId, 'HeavyArmor') )
  9171. // staminaRegenVal -= 0.20;
  9172. // if ( glovesEq && !inv.ItemHasTag(glovesId, 'HeavyArmor') )
  9173. // staminaRegenVal -= 0.025;
  9174. // if ( pantsEq && !inv.ItemHasTag(pantsId, 'HeavyArmor') )
  9175. // staminaRegenVal -= 0.025;
  9176. // if ( bootsEq && !inv.ItemHasTag(bootsId, 'HeavyArmor') )
  9177. // staminaRegenVal -= 0.05;
  9178. //} //modSigns: reworked
  9179.  
  9180. //stamina regen bonus for missing armor pieces
  9181. if ( !armorEq )
  9182. staminaRegenVal += 0.11;
  9183. if ( !glovesEq )
  9184. staminaRegenVal += 0.02;
  9185. if ( !pantsEq )
  9186. staminaRegenVal += 0.03;
  9187. if ( !bootsEq )
  9188. staminaRegenVal += 0.04;
  9189.  
  9190. //debug
  9191. //theGame.witcherLog.AddMessage( "staminaRegenVal = " + staminaRegenVal );
  9192.  
  9193. return staminaRegenVal;
  9194. }
  9195.  
  9196. //modSigns: reworked
  9197. public function GetOffenseStatsList( optional hackMode : int ) : SPlayerOffenseStats
  9198. {
  9199. var playerOffenseStats : SPlayerOffenseStats;
  9200. var min, max, value : SAbilityAttributeValue;
  9201. var attackPower : SAbilityAttributeValue;
  9202. var fastAPBonus, strongAPBonus, steelAPBonus, silverAPBonus : SAbilityAttributeValue;
  9203. var critChance, critPowerBonus, fastCritChanceBonus, strongCritChanceBonus, fastCritPowerBonus, strongCritPowerBonus : float;
  9204. var steelCritChanceBonus, silverCritChanceBonus, steelCritPowerBonus, silverCritPowerBonus : float;
  9205. var steelDmg, silverDmg, elementalSteel, elementalSilver : float;
  9206. var attackPowerCrossbow : SAbilityAttributeValue;
  9207. var silverSword, steelSword, crossbow, bolt : SItemUniqueId;
  9208. var mutagen : CBaseGameplayEffect;
  9209. var thunder : W3Potion_Thunderbolt;
  9210. var strongDmgMult, bonusDmgMult, bonusDmgCrossbow, bonusDmgMultCrossbow, bonusDmgMultSteel, bonusDmgMultSilver : float;
  9211. var steelFastAP, silverFastAP, steelStrongAP, silverStrongAP, steelFastCritAP, silverFastCritAP, steelStrongCritAP, silverStrongCritAP : SAbilityAttributeValue;
  9212. var steelFastCritChance, silverFastCritChance, steelStrongCritChance, silverStrongCritChance : float;
  9213.  
  9214. if(!abilityManager || !abilityManager.IsInitialized())
  9215. return playerOffenseStats;
  9216.  
  9217. //base damage increase for heavy attacks
  9218. value = GetSkillAttributeValue(S_Sword_2, 'heavy_attack_dmg_boost', false, true);
  9219. strongDmgMult = 1 + value.valueMultiplicative;
  9220.  
  9221. //generic bonuses
  9222. attackPower = GetPowerStatValue(CPS_AttackPower);
  9223. //Bear tier 1 power bonus
  9224. if(IsSetBonusActive(EISB_Bear_1))
  9225. {
  9226. theGame.GetDefinitionsManager().GetAbilityAttributeValue(GetSetBonusAbility(EISB_Bear_1), 'attack_power', min, max);
  9227. attackPower.valueMultiplicative += min.valueMultiplicative * GetSetPartsEquipped(EIST_Bear) * FloorF(GetStat(BCS_Focus));
  9228. }
  9229. critChance = CalculateAttributeValue(GetAttributeValue(theGame.params.CRITICAL_HIT_CHANCE));
  9230. critPowerBonus = CalculateAttributeValue(GetAttributeValue(theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  9231.  
  9232. //attack type specific bonuses
  9233. fastAPBonus = GetSkillAttributeValue(S_Sword_1, PowerStatEnumToName(CPS_AttackPower), false, true);
  9234. strongAPBonus = GetSkillAttributeValue(S_Sword_2, PowerStatEnumToName(CPS_AttackPower), false, true);
  9235. if (CanUseSkill(S_Sword_s21))
  9236. fastAPBonus += GetSkillAttributeValue(S_Sword_s21, PowerStatEnumToName(CPS_AttackPower), false, true) * GetSkillLevel(S_Sword_s21);
  9237. if (CanUseSkill(S_Sword_s04))
  9238. strongAPBonus += GetSkillAttributeValue(S_Sword_s04, PowerStatEnumToName(CPS_AttackPower), false, true) * GetSkillLevel(S_Sword_s04);
  9239. if (HasBuff(EET_LynxSetBonus)) //lynx tier 1 attack type specific bonuses
  9240. {
  9241. fastAPBonus.valueMultiplicative += ((W3Effect_LynxSetBonus)GetBuff(EET_LynxSetBonus)).GetLynxBonus(false);
  9242. strongAPBonus.valueMultiplicative += ((W3Effect_LynxSetBonus)GetBuff(EET_LynxSetBonus)).GetLynxBonus(true);
  9243. }
  9244. if (CanUseSkill(S_Sword_s17))
  9245. {
  9246. fastCritChanceBonus = CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s17, theGame.params.CRITICAL_HIT_CHANCE, false, true)) * GetSkillLevel(S_Sword_s17);
  9247. fastCritPowerBonus = CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s17, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, true)) * GetSkillLevel(S_Sword_s17);
  9248. }
  9249. if (CanUseSkill(S_Sword_s08))
  9250. {
  9251. strongCritChanceBonus = CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s08, theGame.params.CRITICAL_HIT_CHANCE, false, true)) * GetSkillLevel(S_Sword_s08);
  9252. strongCritPowerBonus = CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s08, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, true)) * GetSkillLevel(S_Sword_s08);
  9253. }
  9254.  
  9255. //steel sword specific bonuses
  9256. if (GetItemEquippedOnSlot(EES_SteelSword, steelSword))
  9257. {
  9258. steelDmg = GetTotalWeaponDamage(steelSword, theGame.params.DAMAGE_NAME_SLASHING, GetInvalidUniqueId());
  9259. steelDmg += GetTotalWeaponDamage(steelSword, theGame.params.DAMAGE_NAME_PIERCING, GetInvalidUniqueId());
  9260. steelDmg += GetTotalWeaponDamage(steelSword, theGame.params.DAMAGE_NAME_BLUDGEONING, GetInvalidUniqueId());
  9261. elementalSteel = CalculateAttributeValue(GetInventory().GetItemAttributeValue(steelSword, theGame.params.DAMAGE_NAME_FIRE));
  9262. elementalSteel += CalculateAttributeValue(GetInventory().GetItemAttributeValue(steelSword, theGame.params.DAMAGE_NAME_FROST));
  9263. elementalSteel += CalculateAttributeValue(GetInventory().GetItemAttributeValue(steelSword, theGame.params.DAMAGE_NAME_POISON)); //modSigns
  9264. //weapon bonuses are added OnHold, so we need to retrieve them specifically if we want to show them
  9265. if (!GetInventory().IsItemHeld(steelSword))
  9266. {
  9267. steelCritChanceBonus += CalculateAttributeValue(GetInventory().GetItemAttributeValue(steelSword, theGame.params.CRITICAL_HIT_CHANCE));
  9268. steelCritPowerBonus += CalculateAttributeValue(GetInventory().GetItemAttributeValue(steelSword, theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  9269. steelAPBonus += GetInventory().GetItemAttributeValue(steelSword, 'attack_power');
  9270. }
  9271. //bonus damage
  9272. bonusDmgMultSteel += CalculateAttributeValue(GetInventory().GetItemAttributeValue(steelSword, 'sword_dmg_bonus'));
  9273. //tier 2 wolf oil bonuses
  9274. steelCritChanceBonus += CalculateAttributeValue(inv.GetOilCriticalChanceBonus(steelSword, MC_NotSet));
  9275. steelCritPowerBonus += CalculateAttributeValue(inv.GetOilCriticalDamageBonus(steelSword, MC_NotSet));
  9276. }
  9277.  
  9278. //silver sword specific bonuses
  9279. if (GetItemEquippedOnSlot(EES_SilverSword, silverSword))
  9280. {
  9281. silverDmg = GetTotalWeaponDamage(silverSword, theGame.params.DAMAGE_NAME_SILVER, GetInvalidUniqueId());
  9282. elementalSilver = CalculateAttributeValue(GetInventory().GetItemAttributeValue(silverSword, theGame.params.DAMAGE_NAME_FIRE));
  9283. elementalSilver += CalculateAttributeValue(GetInventory().GetItemAttributeValue(silverSword, theGame.params.DAMAGE_NAME_FROST));
  9284. elementalSilver += CalculateAttributeValue(GetInventory().GetItemAttributeValue(silverSword, theGame.params.DAMAGE_NAME_POISON)); //modSigns
  9285. //weapon bonuses are added OnHold, so we need to retrieve them specifically if we want to show them
  9286. if (!GetInventory().IsItemHeld(silverSword))
  9287. {
  9288. silverCritChanceBonus += CalculateAttributeValue(GetInventory().GetItemAttributeValue(silverSword, theGame.params.CRITICAL_HIT_CHANCE));
  9289. silverCritPowerBonus += CalculateAttributeValue(GetInventory().GetItemAttributeValue(silverSword, theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  9290. silverAPBonus += GetInventory().GetItemAttributeValue(silverSword, 'attack_power');
  9291. }
  9292. //bonus damage
  9293. bonusDmgMultSilver += CalculateAttributeValue(GetInventory().GetItemAttributeValue(silverSword, 'sword_dmg_bonus'));
  9294. //tier 2 wolf oil bonuses
  9295. silverCritChanceBonus += CalculateAttributeValue(inv.GetOilCriticalChanceBonus(silverSword, MC_NotSet));
  9296. silverCritPowerBonus += CalculateAttributeValue(inv.GetOilCriticalDamageBonus(silverSword, MC_NotSet));
  9297. }
  9298.  
  9299. //since drawn sword adds its stats to character stats, we now need to do this hackiest shit ever
  9300. if (GetInventory().IsItemHeld(steelSword))
  9301. {
  9302. //remove steel bonuses from silver stats
  9303. silverCritChanceBonus -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(steelSword, theGame.params.CRITICAL_HIT_CHANCE));
  9304. silverCritPowerBonus -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(steelSword, theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  9305. silverAPBonus -= GetInventory().GetItemAttributeValue(steelSword, 'attack_power');
  9306. }
  9307. if (GetInventory().IsItemHeld(silverSword))
  9308. {
  9309. //remove silver bonuses from steel stats
  9310. steelCritChanceBonus -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(silverSword, theGame.params.CRITICAL_HIT_CHANCE));
  9311. steelCritPowerBonus -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(silverSword, theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  9312. steelAPBonus -= GetInventory().GetItemAttributeValue(silverSword, 'attack_power');
  9313. }
  9314.  
  9315. //Thunderbolt lvl 3 crit chance
  9316. thunder = (W3Potion_Thunderbolt)GetBuff(EET_Thunderbolt);
  9317. if(thunder && thunder.GetBuffLevel() == 3 && GetCurWeather() == EWE_Storm)
  9318. {
  9319. critPowerBonus += 1.0f;
  9320. }
  9321.  
  9322. //heft damage increase
  9323. if(HasGlyphwordActive('Glyphword 4 _Stats'))
  9324. {
  9325. theGame.GetDefinitionsManager().GetAbilityAttributeValue('Glyphword 4 _Stats', 'glyphword4_mod', min, max);
  9326. bonusDmgMult += CalculateAttributeValue(min);
  9327. }
  9328.  
  9329. //Euphoria damage bonus
  9330. if(HasBuff(EET_Mutation10))
  9331. {
  9332. steelDmg += GetToxicityDamage();
  9333. silverDmg += GetToxicityDamage();
  9334. }
  9335.  
  9336. //final attributes
  9337. steelFastAP = attackPower + fastAPBonus + steelAPBonus;
  9338. silverFastAP = attackPower + fastAPBonus + silverAPBonus;
  9339. steelStrongAP = attackPower + strongAPBonus + steelAPBonus;
  9340. silverStrongAP = attackPower + strongAPBonus + silverAPBonus;
  9341. steelFastCritAP = steelFastAP;
  9342. steelFastCritAP.valueMultiplicative += critPowerBonus + fastCritPowerBonus + steelCritPowerBonus;
  9343. silverFastCritAP = silverFastAP;
  9344. silverFastCritAP.valueMultiplicative += critPowerBonus + fastCritPowerBonus + silverCritPowerBonus;
  9345. steelStrongCritAP = steelStrongAP;
  9346. steelStrongCritAP.valueMultiplicative += critPowerBonus + strongCritPowerBonus + steelCritPowerBonus;
  9347. silverStrongCritAP = silverStrongAP;
  9348. silverStrongCritAP.valueMultiplicative += critPowerBonus + strongCritPowerBonus + silverCritPowerBonus;
  9349. steelFastCritChance = critChance + fastCritChanceBonus + steelCritChanceBonus;
  9350. silverFastCritChance = critChance + fastCritChanceBonus + silverCritChanceBonus;
  9351. steelStrongCritChance = critChance + strongCritChanceBonus + steelCritChanceBonus;
  9352. silverStrongCritChance = critChance + strongCritChanceBonus + silverCritChanceBonus;
  9353.  
  9354. //fill offense stats
  9355. playerOffenseStats.steelFastAP = steelFastAP.valueMultiplicative;
  9356. playerOffenseStats.silverFastAP = silverFastAP.valueMultiplicative;
  9357. playerOffenseStats.steelStrongAP = steelStrongAP.valueMultiplicative;
  9358. playerOffenseStats.silverStrongAP = silverStrongAP.valueMultiplicative;
  9359. playerOffenseStats.steelFastCritAP = steelFastCritAP.valueMultiplicative;
  9360. playerOffenseStats.silverFastCritAP = silverFastCritAP.valueMultiplicative;
  9361. playerOffenseStats.steelStrongCritAP = steelStrongCritAP.valueMultiplicative;
  9362. playerOffenseStats.silverStrongCritAP = silverStrongCritAP.valueMultiplicative;
  9363. playerOffenseStats.steelFastCritChance = steelFastCritChance * 100;
  9364. playerOffenseStats.silverFastCritChance = silverFastCritChance * 100;
  9365. playerOffenseStats.steelStrongCritChance = steelStrongCritChance * 100;
  9366. playerOffenseStats.silverStrongCritChance = silverStrongCritChance * 100;
  9367. if ( steelDmg != 0 )
  9368. {
  9369. playerOffenseStats.steelFastDmg = ((steelDmg + elementalSteel) * (1 + bonusDmgMult + bonusDmgMultSteel) + steelFastAP.valueBase) * steelFastAP.valueMultiplicative + steelFastAP.valueAdditive;
  9370. playerOffenseStats.steelFastCritDmg = ((steelDmg + elementalSteel) * (1 + bonusDmgMult + bonusDmgMultSteel) + steelFastCritAP.valueBase) * steelFastCritAP.valueMultiplicative + steelFastCritAP.valueAdditive;
  9371. playerOffenseStats.steelFastDPS = playerOffenseStats.steelFastDmg * (1 - steelFastCritChance) + playerOffenseStats.steelFastCritDmg * steelFastCritChance;
  9372. playerOffenseStats.steelStrongDmg = ((steelDmg + elementalSteel) * (strongDmgMult + bonusDmgMult + bonusDmgMultSteel) + steelStrongAP.valueBase) * steelStrongAP.valueMultiplicative + steelStrongAP.valueAdditive;
  9373. playerOffenseStats.steelStrongCritDmg = ((steelDmg + elementalSteel) * (strongDmgMult + bonusDmgMult + bonusDmgMultSteel) + steelStrongCritAP.valueBase) * steelStrongCritAP.valueMultiplicative + steelStrongCritAP.valueAdditive;
  9374. playerOffenseStats.steelStrongDPS = playerOffenseStats.steelStrongDmg * (1 - steelStrongCritChance) + playerOffenseStats.steelStrongCritDmg * steelStrongCritChance;
  9375. }
  9376. if ( silverDmg != 0 )
  9377. {
  9378. playerOffenseStats.silverFastDmg = ((silverDmg + elementalSilver) * (1 + bonusDmgMult + bonusDmgMultSilver) + silverFastAP.valueBase) * silverFastAP.valueMultiplicative + silverFastAP.valueAdditive;
  9379. playerOffenseStats.silverFastCritDmg = ((silverDmg + elementalSilver) * (1 + bonusDmgMult + bonusDmgMultSilver) + silverFastCritAP.valueBase) * silverFastCritAP.valueMultiplicative + silverFastCritAP.valueAdditive;
  9380. playerOffenseStats.silverFastDPS = playerOffenseStats.silverFastDmg * (1 - silverFastCritChance) + playerOffenseStats.silverFastCritDmg * silverFastCritChance;
  9381. playerOffenseStats.silverStrongDmg = ((silverDmg + elementalSilver) * (strongDmgMult + bonusDmgMult + bonusDmgMultSilver) + silverStrongAP.valueBase) * silverStrongAP.valueMultiplicative + silverStrongAP.valueAdditive;
  9382. playerOffenseStats.silverStrongCritDmg = ((silverDmg + elementalSilver) * (strongDmgMult + bonusDmgMult + bonusDmgMultSilver) + silverStrongCritAP.valueBase) * silverStrongCritAP.valueMultiplicative + silverStrongCritAP.valueAdditive;
  9383. playerOffenseStats.silverStrongDPS = playerOffenseStats.silverStrongDmg * (1 - silverStrongCritChance) + playerOffenseStats.silverStrongCritDmg * silverStrongCritChance;
  9384. }
  9385.  
  9386. //modSigns: crossbow redone
  9387. playerOffenseStats.crossbowSteelDmgType = theGame.params.DAMAGE_NAME_PIERCING;
  9388. playerOffenseStats.crossbowElementaDmgType = '';
  9389. if (GetItemEquippedOnSlot(EES_RangedWeapon, crossbow))
  9390. {
  9391. attackPowerCrossbow = attackPower + GetInventory().GetItemAttributeValue(crossbow, PowerStatEnumToName(CPS_AttackPower));
  9392. playerOffenseStats.crossbowAttackPower = attackPowerCrossbow.valueMultiplicative;
  9393. playerOffenseStats.crossbowCritChance = GetCriticalHitChance( false, false, NULL, MC_NotSet, true );
  9394.  
  9395. value = GetCriticalHitDamageBonus( crossbow, MC_NotSet, false ) + inv.GetItemAttributeValue( crossbow, theGame.params.CRITICAL_HIT_DAMAGE_BONUS );
  9396. //Cat Eyes mutation crit damage boost
  9397. if( IsMutationActive( EPMT_Mutation9 ) )
  9398. {
  9399. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation9', 'critical_damage', min, max );
  9400. value += min;
  9401. }
  9402. if( CanUseSkill(S_Sword_s07) )
  9403. {
  9404. value += GetSkillAttributeValue(S_Sword_s07, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, true) * GetSkillLevel(S_Sword_s07);
  9405. }
  9406. playerOffenseStats.crossbowCritDmgBonus = CalculateAttributeValue(value);
  9407.  
  9408. //bolt stats
  9409. if (GetItemEquippedOnSlot(EES_Bolt, bolt))
  9410. {
  9411. playerOffenseStats.crossbowSteelDmgType = GetCrossbowSteelDmgName();
  9412. inv.GetItemStatByName(inv.GetItemName(bolt), playerOffenseStats.crossbowSteelDmgType, playerOffenseStats.crossbowSteelDmg);
  9413. inv.GetItemStatByName(inv.GetItemName(bolt), 'SilverDamage', playerOffenseStats.crossbowSilverDmg);
  9414. playerOffenseStats.crossbowElementaDmgType = GetCrossbowElementaDmgName();
  9415. if(IsNameValid(playerOffenseStats.crossbowElementaDmgType))
  9416. inv.GetItemStatByName(inv.GetItemName(bolt), playerOffenseStats.crossbowElementaDmgType, playerOffenseStats.crossbowElementaDmg);
  9417. }
  9418.  
  9419. //crossbow damage increase skill
  9420. if( CanUseSkill(S_Sword_s15) )
  9421. {
  9422. bonusDmgCrossbow += CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s15, 'xbow_dmg_bonus', false, true)) * GetSkillLevel(S_Sword_s15);
  9423. }
  9424.  
  9425. playerOffenseStats.crossbowSteelDmg += bonusDmgCrossbow;
  9426. playerOffenseStats.crossbowSilverDmg += bonusDmgCrossbow;
  9427. playerOffenseStats.crossbowElementaDmg += bonusDmgCrossbow;
  9428.  
  9429. //modSigns: mutation9 base damage boost
  9430. if( IsMutationActive( EPMT_Mutation9 ) )
  9431. {
  9432. theGame.GetDefinitionsManager().GetAbilityAttributeValue('Mutation9', 'mut9_damage', min, max);
  9433. playerOffenseStats.crossbowSteelDmg *= 1 + min.valueMultiplicative;
  9434. playerOffenseStats.crossbowSilverDmg *= 1 + min.valueMultiplicative;
  9435. playerOffenseStats.crossbowElementaDmg *= 1 + min.valueMultiplicative;
  9436. }
  9437.  
  9438. playerOffenseStats.crossbowSteelDmg = (playerOffenseStats.crossbowSteelDmg * (1 + bonusDmgMultCrossbow) + attackPowerCrossbow.valueBase) * attackPowerCrossbow.valueMultiplicative;
  9439. playerOffenseStats.crossbowSilverDmg = (playerOffenseStats.crossbowSilverDmg * (1 + bonusDmgMultCrossbow) + attackPowerCrossbow.valueBase) * attackPowerCrossbow.valueMultiplicative;
  9440. playerOffenseStats.crossbowElementaDmg = (playerOffenseStats.crossbowElementaDmg * (1 + bonusDmgMultCrossbow) + attackPowerCrossbow.valueBase) * attackPowerCrossbow.valueMultiplicative;
  9441. }
  9442.  
  9443. return playerOffenseStats;
  9444. }
  9445.  
  9446. public function GetTotalWeaponDamage(weaponId : SItemUniqueId, damageTypeName : name, crossbowId : SItemUniqueId) : float
  9447. {
  9448. var damage, durRatio, durMod, itemMod : float;
  9449. var repairObjectBonus, min, max : SAbilityAttributeValue;
  9450. var aerondight : W3Effect_Aerondight; //modSigns
  9451. var phantomWeapon : W3Effect_PhantomWeapon; //modSigns
  9452.  
  9453. //durMod = 0;
  9454. durMod = 1; //modSigns: zero value effectively removes all non-physical damages from weapon
  9455. damage = super.GetTotalWeaponDamage(weaponId, damageTypeName, crossbowId);
  9456.  
  9457.  
  9458. //modSigns: changed -> moved
  9459. //if( IsMutationActive( EPMT_Mutation9 ) && inv.IsItemBolt( weaponId ) /*&& IsDamageTypeAnyPhysicalType( damageTypeName )*/ )
  9460. //{
  9461. // theGame.GetDefinitionsManager().GetAbilityAttributeValue('Mutation9', 'mut9_damage', min, max);
  9462. // damage *= 1 + min.valueMultiplicative;
  9463. //}
  9464.  
  9465.  
  9466. if(IsPhysicalResistStat(GetResistForDamage(damageTypeName, false)))
  9467. {
  9468. repairObjectBonus = inv.GetItemAttributeValue(weaponId, theGame.params.REPAIR_OBJECT_BONUS);
  9469. durRatio = -1;
  9470.  
  9471. if(inv.IsIdValid(crossbowId) && inv.HasItemDurability(crossbowId))
  9472. {
  9473. durRatio = inv.GetItemDurabilityRatio(crossbowId);
  9474. }
  9475. else if(inv.IsIdValid(weaponId) && inv.HasItemDurability(weaponId))
  9476. {
  9477. durRatio = inv.GetItemDurabilityRatio(weaponId);
  9478. }
  9479.  
  9480.  
  9481. if(durRatio >= 0)
  9482. durMod = theGame.params.GetDurabilityMultiplier(durRatio, true);
  9483. else
  9484. durMod = 1;
  9485. }
  9486.  
  9487.  
  9488. if( damageTypeName == 'SilverDamage' && inv.ItemHasTag( weaponId, 'Aerondight' ) )
  9489. {
  9490. //itemMod = inv.GetItemModifierFloat( weaponId, 'PermDamageBoost' );
  9491. //if( itemMod > 0.f )
  9492. //{
  9493. // damage += itemMod;
  9494. //}
  9495. //modSigns: damage boost per enemy
  9496. aerondight = (W3Effect_Aerondight)GetBuff(EET_Aerondight);
  9497. if(aerondight)
  9498. damage += aerondight.GetDamageBoost();
  9499. }
  9500.  
  9501. //modSigns
  9502. if( damageTypeName == 'SlashingDamage' && inv.ItemHasTag( weaponId, 'PhantomWeapon' ) )
  9503. {
  9504. phantomWeapon = (W3Effect_PhantomWeapon)GetBuff(EET_PhantomWeapon);
  9505. if(phantomWeapon && phantomWeapon.IsFullyCharged())
  9506. {
  9507. damage += phantomWeapon.GetDamageBoost();
  9508. //theGame.witcherLog.AddMessage("Phantom dmg boost = " + phantomWeapon.GetDamageBoost());
  9509. }
  9510. }
  9511.  
  9512. //modSigns: Invigoration
  9513. if( HasBuff(EET_Runeword4) && ( damageTypeName == 'SilverDamage' || damageTypeName == 'SlashingDamage' ) )
  9514. damage *= 1 + ((W3Effect_Runeword4)GetBuff(EET_Runeword4)).GetDamageBonus();
  9515.  
  9516. return damage * (durMod + repairObjectBonus.valueMultiplicative);
  9517. }
  9518.  
  9519.  
  9520.  
  9521.  
  9522.  
  9523. public final function GetSkillPathType(skill : ESkill) : ESkillPath
  9524. {
  9525. if(abilityManager && abilityManager.IsInitialized())
  9526. return ((W3PlayerAbilityManager)abilityManager).GetSkillPathType(skill);
  9527.  
  9528. return ESP_NotSet;
  9529. }
  9530.  
  9531. public function GetSkillLevel(s : ESkill) : int
  9532. {
  9533. if(abilityManager && abilityManager.IsInitialized())
  9534. return ((W3PlayerAbilityManager)abilityManager).GetSkillLevel(s);
  9535.  
  9536. return -1;
  9537. }
  9538.  
  9539. public function GetSkillMaxLevel(s : ESkill) : int
  9540. {
  9541. if(abilityManager && abilityManager.IsInitialized())
  9542. return ((W3PlayerAbilityManager)abilityManager).GetSkillMaxLevel(s);
  9543.  
  9544. return -1;
  9545. }
  9546.  
  9547. public function GetBoughtSkillLevel(s : ESkill) : int
  9548. {
  9549. if(abilityManager && abilityManager.IsInitialized())
  9550. return ((W3PlayerAbilityManager)abilityManager).GetBoughtSkillLevel(s);
  9551.  
  9552. return -1;
  9553. }
  9554.  
  9555.  
  9556. public function GetAxiiLevel() : int
  9557. {
  9558. var level : int;
  9559.  
  9560. level = 1;
  9561.  
  9562. if(CanUseSkill(S_Magic_s17)) level += GetSkillLevel(S_Magic_s17);
  9563.  
  9564. return Clamp(level, 1, 4);
  9565. }
  9566.  
  9567. public function IsInFrenzy() : bool
  9568. {
  9569. return isInFrenzy;
  9570. }
  9571.  
  9572. //modSigns: redone to fix a bug
  9573. //public function HasRecentlyCountered() : bool
  9574. //{
  9575. // return hasRecentlyCountered;
  9576. //}
  9577. //
  9578. //public function SetRecentlyCountered(counter : bool)
  9579. //{
  9580. // hasRecentlyCountered = counter;
  9581. //}
  9582. //
  9583. ////modSigns
  9584. //timer function ResetRecentlyCountered(dt : float, id : int)
  9585. //{
  9586. // hasRecentlyCountered = false;
  9587. //}
  9588.  
  9589. timer function CheckBlockedSkills(dt : float, id : int)
  9590. {
  9591. var nextCallTime : float;
  9592.  
  9593. nextCallTime = ((W3PlayerAbilityManager)abilityManager).CheckBlockedSkills(dt);
  9594. if(nextCallTime != -1)
  9595. AddTimer('CheckBlockedSkills', nextCallTime, , , , true);
  9596. }
  9597.  
  9598. //modSigns: reworked
  9599. public function RemoveTemporarySkills()
  9600. {
  9601. var i : int;
  9602. var pam : W3PlayerAbilityManager;
  9603.  
  9604. if(tempLearnedSignSkills.Size() > 0)
  9605. {
  9606. pam = (W3PlayerAbilityManager)abilityManager;
  9607. for(i=0; i<tempLearnedSignSkills.Size(); i+=1)
  9608. {
  9609. pam.RemoveTemporarySkill(tempLearnedSignSkills[i]);
  9610. }
  9611.  
  9612. tempLearnedSignSkills.Clear();
  9613. //theGame.witcherLog.AddMessage("Temp skills removed");
  9614. }
  9615. RemoveAbilityAll(SkillEnumToName(S_Sword_s19));
  9616. }
  9617.  
  9618. public function RemoveTemporarySkill(skill : SSimpleSkill) : bool
  9619. {
  9620. var pam : W3PlayerAbilityManager;
  9621.  
  9622. pam = (W3PlayerAbilityManager)abilityManager;
  9623. if(pam && pam.IsInitialized())
  9624. return pam.RemoveTemporarySkill(skill);
  9625.  
  9626. return false;
  9627. }
  9628.  
  9629.  
  9630. //modSigns: reworked, focus is drained in sign entity
  9631. public function AddTemporarySkills() : bool
  9632. {
  9633. tempLearnedSignSkills.Clear();
  9634. if(CanUseSkill(S_Sword_s19) && GetStat(BCS_Focus) >= 3)
  9635. {
  9636. tempLearnedSignSkills = ((W3PlayerAbilityManager)abilityManager).AddTempNonAlchemySkills();
  9637. AddAbilityMultiple(SkillEnumToName(S_Sword_s19), GetSkillLevel(S_Sword_s19));
  9638. }
  9639. return tempLearnedSignSkills.Size();
  9640. }
  9641.  
  9642.  
  9643.  
  9644. public function HasAlternateQuen() : bool
  9645. {
  9646. var quenEntity : W3QuenEntity;
  9647.  
  9648. quenEntity = (W3QuenEntity)GetCurrentSignEntity();
  9649. if(quenEntity)
  9650. {
  9651. return quenEntity.IsAlternateCast();
  9652. }
  9653.  
  9654. return false;
  9655. }
  9656.  
  9657.  
  9658.  
  9659.  
  9660.  
  9661. public function AddPoints(type : ESpendablePointType, amount : int, show : bool)
  9662. {
  9663. levelManager.AddPoints(type, amount, show);
  9664. }
  9665.  
  9666. public function GetLevel() : int {return levelManager.GetLevel();}
  9667. public function GetMaxLevel() : int {return levelManager.GetMaxLevel();}
  9668. public function GetTotalExpForNextLevel() : int {return levelManager.GetTotalExpForNextLevel();}
  9669. public function GetPointsTotal(type : ESpendablePointType) : int {return levelManager.GetPointsTotal(type);}
  9670. public function IsAutoLeveling() : bool {return autoLevel;}
  9671. public function SetAutoLeveling( b : bool ) {autoLevel = b;}
  9672.  
  9673. public function GetMissingExpForNextLevel() : int
  9674. {
  9675. return Max(0, GetTotalExpForNextLevel() - GetPointsTotal(EExperiencePoint));
  9676. }
  9677.  
  9678.  
  9679.  
  9680.  
  9681. private saved var runewordInfusionType : ESignType;
  9682. default runewordInfusionType = ST_None;
  9683.  
  9684. public final function GetRunewordInfusionType() : ESignType
  9685. {
  9686. return runewordInfusionType;
  9687. }
  9688.  
  9689.  
  9690. //modSigns: reworked
  9691. public function QuenImpulse( isAlternate : bool, signEntity : W3QuenEntity, source : string, optional forceSkillLevel : int, optional forceSpellPower : SAbilityAttributeValue )
  9692. {
  9693. var level, i, j : int;
  9694. var atts, damages : array<name>;
  9695. var ents : array<CGameplayEntity>;
  9696. var action : W3DamageAction;
  9697. var dm : CDefinitionsManagerAccessor;
  9698. var skillAbilityName : name;
  9699. var dmg : float;
  9700. var min, max : SAbilityAttributeValue;
  9701. var pos : Vector;
  9702. var spellPower : SAbilityAttributeValue;
  9703. var staminaPrc : float;
  9704.  
  9705. //forced level (for Flood of Anger)
  9706. if(forceSkillLevel > 0)
  9707. level = forceSkillLevel;
  9708. else
  9709. level = GetSkillLevel(S_Magic_s13);
  9710.  
  9711. //forced spell power (for Flood of Anger)
  9712. if(forceSpellPower.valueMultiplicative > 0)
  9713. spellPower = forceSpellPower;
  9714. else
  9715. spellPower = GetTotalSignSpellPower(S_Magic_4);
  9716.  
  9717. dm = theGame.GetDefinitionsManager();
  9718. skillAbilityName = GetSkillAbilityName(S_Magic_s13);
  9719.  
  9720. //add damage
  9721. if(level >= 2)
  9722. {
  9723. dm.GetAbilityAttributes(skillAbilityName, atts);
  9724. for(i = 0; i < atts.Size(); i += 1)
  9725. {
  9726. if(IsDamageTypeNameValid(atts[i]))
  9727. damages.PushBack(atts[i]);
  9728. }
  9729. }
  9730.  
  9731. //find enemies in range
  9732. //pos = signEntity.GetWorldPosition();
  9733. //FindGameplayEntitiesInSphere(ents, pos, 3, 1000, '', FLAG_OnlyAliveActors + FLAG_ExcludeTarget + FLAG_Attitude_Hostile + FLAG_Attitude_Neutral + FLAG_TestLineOfSight, this);
  9734. //modSigns: the above variant doesn't work properly. Use box instead of a sphere.
  9735. FindGameplayEntitiesInRange(ents, this, 3, 100, , FLAG_OnlyAliveActors + FLAG_ExcludeTarget + FLAG_Attitude_Hostile, this);
  9736.  
  9737. for(i = 0; i < ents.Size(); i += 1)
  9738. {
  9739. //debug log
  9740. //theGame.witcherLog.AddMessage("Quen impulse:");
  9741. //theGame.witcherLog.AddMessage("Target # " + (i + 1) + ": " + ents[i].GetDisplayName());
  9742.  
  9743. //init damage action, use spell power and light hit reaction
  9744. action = new W3DamageAction in theGame;
  9745. action.Initialize(this, ents[i], signEntity, source, EHRT_Light, CPS_SpellPower, false, false, true, false);
  9746. action.SetSignSkill(S_Magic_s13);
  9747. action.SetCannotReturnDamage(true);
  9748. action.SetProcessBuffsIfNoDamage(true);
  9749.  
  9750. //add damages
  9751. if(level >= 2)
  9752. {
  9753. for(j = 0; j < damages.Size(); j += 1)
  9754. {
  9755. dm.GetAbilityAttributeValue(skillAbilityName, damages[j], min, max);
  9756. //damage scales with ability level
  9757. dmg = CalculateAttributeValue(GetAttributeRandomizedValue(min, max)) * (level - 1);
  9758. if( HasGlyphwordActive( 'Glyphword 5 _Stats' ) ) //modSigns
  9759. {
  9760. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Glyphword 5 _Stats', 'glyphword5_dmg_boost', min, max );
  9761. dmg *= 1 + min.valueMultiplicative;
  9762. }
  9763.  
  9764. //debug log
  9765. //theGame.witcherLog.AddMessage("Quen impulse dmg: " + dmg + " (" + damages[j] + ")");
  9766.  
  9767. if(dmg > 0)
  9768. {
  9769. action.SetHitEffectAllTypes('hit_electric_quen');
  9770. action.AddDamage(damages[j], dmg);
  9771. }
  9772. }
  9773. }
  9774.  
  9775. //add knockdown applicator (spell power will affect knockdown chances)
  9776. if(level == 3)
  9777. action.AddEffectInfo(EET_KnockdownTypeApplicator);
  9778. //add stagger
  9779. else if(level >= 1)
  9780. action.AddEffectInfo(EET_Stagger);
  9781.  
  9782. theGame.damageMgr.ProcessAction( action );
  9783. delete action;
  9784. }
  9785.  
  9786. if(isAlternate)
  9787. {
  9788. signEntity.PlayHitEffect('quen_impulse_explode', signEntity.GetWorldRotation());
  9789. signEntity.EraseFirstTimeStamp();
  9790.  
  9791. if(level >= 2)
  9792. {
  9793. //if(IsSetBonusActive( EISB_Bear_2 ))
  9794. //{
  9795. // signEntity.PlayHitEffect('quen_electric_explode_bear_abl2', signEntity.GetWorldRotation());
  9796. //}
  9797. //else //ability changed
  9798. signEntity.PlayHitEffect('quen_electric_explode', signEntity.GetWorldRotation());
  9799. }
  9800. }
  9801. else
  9802. {
  9803. signEntity.PlayEffect('lasting_shield_impulse');
  9804. }
  9805. }
  9806.  
  9807. //modSigns
  9808. public function PlayGlyphword5FX(ent : CGameplayEntity)
  9809. {
  9810. var template : CEntityTemplate;
  9811. var component : CComponent;
  9812.  
  9813. template = (CEntityTemplate)LoadResource('glyphword_5');
  9814.  
  9815. component = ent.GetComponent('torso3effect');
  9816. if(component)
  9817. thePlayer.PlayEffect('reflection_damge', component);
  9818. else
  9819. thePlayer.PlayEffect('reflection_damge', ent);
  9820. }
  9821.  
  9822. //called after both Aard casts, after normal Igni cast, for alt Igni called at the beginning of channeling,
  9823. //after normal Yrden cast, for alt Yrden - at the end of the channeling, if it wasn't aborted,
  9824. //after normal Quen cast, for alt Quen - at the beginning of the channeling,
  9825. //after normal Axii cast, for alt Axii - at the end of the channeling, if it wasn't aborted.
  9826. //modSigns: alt Igni and alt Quen calls moved to the end of channeling.
  9827. public function OnSignCastPerformed(signType : ESignType, isAlternate : bool)
  9828. {
  9829. var items : array<SItemUniqueId>;
  9830. var weaponEnt : CEntity;
  9831. var fxName : name;
  9832. var pos : Vector;
  9833. //modSigns: new vars
  9834. //var abilityName : name;
  9835. //var abilityCount, maxStack : float;
  9836. //var min, max : SAbilityAttributeValue;
  9837. //var addAbility : bool;
  9838.  
  9839. super.OnSignCastPerformed(signType, isAlternate);
  9840.  
  9841. if(HasRunewordActive('Runeword 1 _Stats') && GetStat(BCS_Focus) >= 1.0f) //modSigns
  9842. {
  9843. DrainFocus(1.0f);
  9844. runewordInfusionType = signType;
  9845. items = inv.GetHeldWeapons();
  9846. weaponEnt = inv.GetItemEntityUnsafe(items[0]);
  9847.  
  9848.  
  9849. weaponEnt.StopEffect('runeword_aard');
  9850. weaponEnt.StopEffect('runeword_axii');
  9851. weaponEnt.StopEffect('runeword_igni');
  9852. weaponEnt.StopEffect('runeword_quen');
  9853. weaponEnt.StopEffect('runeword_yrden');
  9854.  
  9855.  
  9856. if(signType == ST_Aard)
  9857. fxName = 'runeword_aard';
  9858. else if(signType == ST_Axii)
  9859. fxName = 'runeword_axii';
  9860. else if(signType == ST_Igni)
  9861. fxName = 'runeword_igni';
  9862. else if(signType == ST_Quen)
  9863. fxName = 'runeword_quen';
  9864. else if(signType == ST_Yrden)
  9865. fxName = 'runeword_yrden';
  9866.  
  9867. weaponEnt.PlayEffect(fxName);
  9868. }
  9869.  
  9870.  
  9871. if( IsMutationActive( EPMT_Mutation6 ) && signType == ST_Aard && !isAlternate )
  9872. {
  9873. pos = GetWorldPosition() + GetWorldForward() * 2;
  9874.  
  9875. theGame.GetSurfacePostFX().AddSurfacePostFXGroup( pos, 0.f, 3.f, 2.f, 5.f, 0 );
  9876. }
  9877.  
  9878. //modSigns: ancient leshed decoction fix -> decoction changed
  9879. /*if(HasBuff(EET_Mutagen22) && IsInCombat() && IsThreatened() && !isAlternate)
  9880. {
  9881. abilityName = GetBuff(EET_Mutagen22).GetAbilityName();
  9882. abilityCount = GetAbilityCount(abilityName);
  9883.  
  9884. if(abilityCount == 0)
  9885. {
  9886. addAbility = true;
  9887. }
  9888. else
  9889. {
  9890. theGame.GetDefinitionsManager().GetAbilityAttributeValue(abilityName, 'mutagen22_max_stack', min, max);
  9891. maxStack = CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  9892.  
  9893. if(maxStack >= 0)
  9894. {
  9895. addAbility = (abilityCount < maxStack);
  9896. }
  9897. else
  9898. {
  9899. addAbility = true;
  9900. }
  9901. }
  9902.  
  9903. if(addAbility)
  9904. {
  9905. AddAbility(abilityName, true);
  9906. }
  9907. }*/
  9908.  
  9909. //modSigns
  9910. if(!HasBuff(EET_GryphonSetBonus) && IsSetBonusActive( EISB_Gryphon_1 ))
  9911. {
  9912. AddEffectDefault( EET_GryphonSetBonus, NULL, signType );
  9913. }
  9914.  
  9915. //theGame.witcherLog.AddMessage("OnSignCastPerformed: " + signType + "; isAlternate: " + isAlternate); //modSigns: debug
  9916. }
  9917.  
  9918. public saved var savedQuenHealth, savedQuenDuration : float;
  9919.  
  9920. timer function HACK_QuenSaveStatus(dt : float, id : int)
  9921. {
  9922. var quenEntity : W3QuenEntity;
  9923.  
  9924. quenEntity = (W3QuenEntity)signs[ST_Quen].entity;
  9925. savedQuenHealth = quenEntity.GetShieldHealth();
  9926. savedQuenDuration = quenEntity.GetShieldRemainingDuration();
  9927. }
  9928.  
  9929. timer function DelayedRestoreQuen(dt : float, id : int)
  9930. {
  9931. RestoreQuen(savedQuenHealth, savedQuenDuration);
  9932. }
  9933.  
  9934. public final function OnBasicQuenFinishing()
  9935. {
  9936. RemoveTimer('HACK_QuenSaveStatus');
  9937. savedQuenHealth = 0.f;
  9938. savedQuenDuration = 0.f;
  9939. }
  9940.  
  9941. public final function IsAnyQuenActive() : bool
  9942. {
  9943. var quen : W3QuenEntity;
  9944.  
  9945. quen = (W3QuenEntity)GetSignEntity(ST_Quen);
  9946. if(quen)
  9947. return quen.IsAnyQuenActive();
  9948.  
  9949. return false;
  9950. }
  9951.  
  9952. public final function IsQuenActive(alternateMode : bool) : bool
  9953. {
  9954. if(IsAnyQuenActive() && GetSignEntity(ST_Quen).IsAlternateCast() == alternateMode)
  9955. return true;
  9956.  
  9957. return false;
  9958. }
  9959.  
  9960. public function FinishQuen( skipVisuals : bool, optional forceNoBearSetBonus : bool )
  9961. {
  9962. var quen : W3QuenEntity;
  9963.  
  9964. quen = (W3QuenEntity)GetSignEntity(ST_Quen);
  9965. if(quen)
  9966. quen.ForceFinishQuen( skipVisuals, forceNoBearSetBonus );
  9967. }
  9968.  
  9969.  
  9970. public function GetTotalSignSpellPower(signSkill : ESkill) : SAbilityAttributeValue
  9971. {
  9972. var sp : SAbilityAttributeValue;
  9973. var penalty : SAbilityAttributeValue;
  9974. var penaltyReduction : float;
  9975. var penaltyReductionLevel : int;
  9976. var mutagen : CBaseGameplayEffect; //modSigns
  9977. var min, max : SAbilityAttributeValue; //modSigns
  9978.  
  9979. //character SP + spell specific skills
  9980. sp = GetSkillAttributeValue(signSkill, PowerStatEnumToName(CPS_SpellPower), true, true);
  9981.  
  9982. //skill custom
  9983. if ( signSkill == S_Magic_s01 )
  9984. {
  9985. //wave leveling penalty reduction
  9986. /*penaltyReductionLevel = GetSkillLevel(S_Magic_s01) + 1;
  9987. if(penaltyReductionLevel > 0)
  9988. {
  9989. penaltyReduction = 1 - penaltyReductionLevel * CalculateAttributeValue(GetSkillAttributeValue(S_Magic_s01, 'spell_power_penalty_reduction', true, true));
  9990. penalty = GetSkillAttributeValue(S_Magic_s01, PowerStatEnumToName(CPS_SpellPower), false, false);
  9991. sp += penalty * penaltyReduction; //add amount equal to penalty reduction (since full penalty is already applied)
  9992. }*/
  9993. //modSigns: fix percentages as they are completely off from what skill description says
  9994. penaltyReductionLevel = GetSkillLevel(S_Magic_s01) - 1;
  9995. if(penaltyReductionLevel > 0)
  9996. {
  9997. penaltyReduction = penaltyReductionLevel * CalculateAttributeValue(GetSkillAttributeValue(S_Magic_s01, 'spell_power_penalty_reduction', false, false));
  9998. //penalty was already applied, so we revert it based on penalty reduction and skill level
  9999. sp.valueMultiplicative += penaltyReduction;
  10000. }
  10001. }
  10002.  
  10003.  
  10004. if(signSkill == S_Magic_1 || signSkill == S_Magic_s01)
  10005. {
  10006. sp += GetAttributeValue('spell_power_aard');
  10007. }
  10008. else if(signSkill == S_Magic_2 || signSkill == S_Magic_s02)
  10009. {
  10010. sp += GetAttributeValue('spell_power_igni');
  10011. }
  10012. else if(signSkill == S_Magic_3 || signSkill == S_Magic_s03)
  10013. {
  10014. sp += GetAttributeValue('spell_power_yrden');
  10015. }
  10016. else if(signSkill == S_Magic_4 || signSkill == S_Magic_s04)
  10017. {
  10018. sp += GetAttributeValue('spell_power_quen');
  10019. }
  10020. else if(signSkill == S_Magic_5 || signSkill == S_Magic_s05)
  10021. {
  10022. sp += GetAttributeValue('spell_power_axii');
  10023. }
  10024.  
  10025.  
  10026. //ApplyMutation10StatBoost( sp ); //modSigns: reworked
  10027.  
  10028. //modSigns: prevent negatives
  10029. sp.valueBase = MaxF(sp.valueBase, 0);
  10030. sp.valueMultiplicative = MaxF(sp.valueMultiplicative, 0);
  10031. sp.valueAdditive = MaxF(sp.valueAdditive, 0);
  10032.  
  10033. return sp;
  10034. }
  10035.  
  10036.  
  10037.  
  10038.  
  10039.  
  10040. public final function GetGwentCardIndex( cardName : name ) : int
  10041. {
  10042. var dm : CDefinitionsManagerAccessor;
  10043.  
  10044. dm = theGame.GetDefinitionsManager();
  10045.  
  10046. if(dm.ItemHasTag( cardName , 'GwintCardLeader' ))
  10047. {
  10048. return theGame.GetGwintManager().GwentLeadersNametoInt( cardName );
  10049. }
  10050. else if(dm.ItemHasTag( cardName , 'GwintCardNrkd' ))
  10051. {
  10052. return theGame.GetGwintManager().GwentNrkdNameToInt( cardName );
  10053. }
  10054. else if(dm.ItemHasTag( cardName , 'GwintCardNlfg' ))
  10055. {
  10056. return theGame.GetGwintManager().GwentNlfgNameToInt( cardName );
  10057. }
  10058. else if(dm.ItemHasTag( cardName , 'GwintCardSctl' ))
  10059. {
  10060. return theGame.GetGwintManager().GwentSctlNameToInt( cardName );
  10061. }
  10062. else if(dm.ItemHasTag( cardName , 'GwintCardMstr' ))
  10063. {
  10064. return theGame.GetGwintManager().GwentMstrNameToInt( cardName );
  10065. }
  10066. else if(dm.ItemHasTag( cardName , 'GwintCardSke' ))
  10067. {
  10068. return theGame.GetGwintManager().GwentSkeNameToInt( cardName );
  10069. }
  10070. else if(dm.ItemHasTag( cardName , 'GwintCardNeutral' ))
  10071. {
  10072. return theGame.GetGwintManager().GwentNeutralNameToInt( cardName );
  10073. }
  10074. else if(dm.ItemHasTag( cardName , 'GwintCardSpcl' ))
  10075. {
  10076. return theGame.GetGwintManager().GwentSpecialNameToInt( cardName );
  10077. }
  10078.  
  10079. return -1;
  10080. }
  10081.  
  10082. public final function AddGwentCard(cardName : name, amount : int) : bool
  10083. {
  10084. var dm : CDefinitionsManagerAccessor;
  10085. var cardIndex, i : int;
  10086. var tut : STutorialMessage;
  10087. var gwintManager : CR4GwintManager;
  10088.  
  10089.  
  10090.  
  10091. if(FactsQuerySum("q001_nightmare_ended") > 0 && ShouldProcessTutorial('TutorialGwentDeckBuilder2'))
  10092. {
  10093. tut.type = ETMT_Hint;
  10094. tut.tutorialScriptTag = 'TutorialGwentDeckBuilder2';
  10095. tut.journalEntryName = 'TutorialGwentDeckBuilder2';
  10096. tut.hintPositionType = ETHPT_DefaultGlobal;
  10097. tut.markAsSeenOnShow = true;
  10098. tut.hintDurationType = ETHDT_Long;
  10099.  
  10100. theGame.GetTutorialSystem().DisplayTutorial(tut);
  10101. }
  10102.  
  10103. dm = theGame.GetDefinitionsManager();
  10104.  
  10105. cardIndex = GetGwentCardIndex(cardName);
  10106.  
  10107. if (cardIndex != -1)
  10108. {
  10109. FactsAdd("Gwint_Card_Looted");
  10110.  
  10111. for(i = 0; i < amount; i += 1)
  10112. {
  10113. theGame.GetGwintManager().AddCardToCollection( cardIndex );
  10114. }
  10115. }
  10116.  
  10117. if( dm.ItemHasTag( cardName, 'GwentTournament' ) )
  10118. {
  10119. if ( dm.ItemHasTag( cardName, 'GT1' ) )
  10120. {
  10121. FactsAdd( "GwentTournament", 1 );
  10122. }
  10123.  
  10124. else if ( dm.ItemHasTag( cardName, 'GT2' ) )
  10125. {
  10126. FactsAdd( "GwentTournament", 2 );
  10127. }
  10128.  
  10129. else if ( dm.ItemHasTag( cardName, 'GT3' ) )
  10130. {
  10131. FactsAdd( "GwentTournament", 3 );
  10132. }
  10133.  
  10134. else if ( dm.ItemHasTag( cardName, 'GT4' ) )
  10135. {
  10136. FactsAdd( "GwentTournament", 4 );
  10137. }
  10138.  
  10139. else if ( dm.ItemHasTag( cardName, 'GT5' ) )
  10140. {
  10141. FactsAdd( "GwentTournament", 5 );
  10142. }
  10143.  
  10144. else if ( dm.ItemHasTag( cardName, 'GT6' ) )
  10145. {
  10146. FactsAdd( "GwentTournament", 6 );
  10147. }
  10148.  
  10149. else if ( dm.ItemHasTag( cardName, 'GT7' ) )
  10150. {
  10151. FactsAdd( "GwentTournament", 7 );
  10152. }
  10153.  
  10154. CheckGwentTournamentDeck();
  10155. }
  10156.  
  10157. if( dm.ItemHasTag( cardName, 'EP2Tournament' ) )
  10158. {
  10159. if ( dm.ItemHasTag( cardName, 'GT1' ) )
  10160. {
  10161. FactsAdd( "EP2Tournament", 1 );
  10162. }
  10163.  
  10164. else if ( dm.ItemHasTag( cardName, 'GT2' ) )
  10165. {
  10166. FactsAdd( "EP2Tournament", 2 );
  10167. }
  10168.  
  10169. else if ( dm.ItemHasTag( cardName, 'GT3' ) )
  10170. {
  10171. FactsAdd( "EP2Tournament", 3 );
  10172. }
  10173.  
  10174. else if ( dm.ItemHasTag( cardName, 'GT4' ) )
  10175. {
  10176. FactsAdd( "EP2Tournament", 4 );
  10177. }
  10178.  
  10179. else if ( dm.ItemHasTag( cardName, 'GT5' ) )
  10180. {
  10181. FactsAdd( "EP2Tournament", 5 );
  10182. }
  10183.  
  10184. else if ( dm.ItemHasTag( cardName, 'GT6' ) )
  10185. {
  10186. FactsAdd( "EP2Tournament", 6 );
  10187. }
  10188.  
  10189. else if ( dm.ItemHasTag( cardName, 'GT7' ) )
  10190. {
  10191. FactsAdd( "EP2Tournament", 7 );
  10192. }
  10193.  
  10194. CheckEP2TournamentDeck();
  10195. }
  10196.  
  10197. gwintManager = theGame.GetGwintManager();
  10198. if( !gwintManager.IsDeckUnlocked( GwintFaction_Skellige ) &&
  10199. gwintManager.HasCardsOfFactionInCollection( GwintFaction_Skellige, false ) )
  10200. {
  10201. gwintManager.UnlockDeck( GwintFaction_Skellige );
  10202. }
  10203.  
  10204. return true;
  10205. }
  10206.  
  10207.  
  10208. public final function RemoveGwentCard(cardName : name, amount : int) : bool
  10209. {
  10210. var dm : CDefinitionsManagerAccessor;
  10211. var cardIndex, i : int;
  10212.  
  10213. dm = theGame.GetDefinitionsManager();
  10214.  
  10215. if(dm.ItemHasTag( cardName , 'GwintCardLeader' ))
  10216. {
  10217. cardIndex = theGame.GetGwintManager().GwentLeadersNametoInt( cardName );
  10218. for(i=0; i<amount; i+=1)
  10219. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  10220. }
  10221. else if(dm.ItemHasTag( cardName , 'GwintCardNrkd' ))
  10222. {
  10223. cardIndex = theGame.GetGwintManager().GwentNrkdNameToInt( cardName );
  10224. for(i=0; i<amount; i+=1)
  10225. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  10226. }
  10227. else if(dm.ItemHasTag( cardName , 'GwintCardNlfg' ))
  10228. {
  10229. cardIndex = theGame.GetGwintManager().GwentNlfgNameToInt( cardName );
  10230. for(i=0; i<amount; i+=1)
  10231. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  10232. }
  10233. else if(dm.ItemHasTag( cardName , 'GwintCardSctl' ))
  10234. {
  10235. cardIndex = theGame.GetGwintManager().GwentSctlNameToInt( cardName );
  10236. for(i=0; i<amount; i+=1)
  10237. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  10238. }
  10239. else if(dm.ItemHasTag( cardName , 'GwintCardMstr' ))
  10240. {
  10241. cardIndex = theGame.GetGwintManager().GwentMstrNameToInt( cardName );
  10242. for(i=0; i<amount; i+=1)
  10243. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  10244. }
  10245. else if(dm.ItemHasTag( cardName , 'GwintCardNeutral' ))
  10246. {
  10247. cardIndex = theGame.GetGwintManager().GwentNeutralNameToInt( cardName );
  10248. for(i=0; i<amount; i+=1)
  10249. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  10250. }
  10251. else if(dm.ItemHasTag( cardName , 'GwintCardSpcl' ))
  10252. {
  10253. cardIndex = theGame.GetGwintManager().GwentSpecialNameToInt( cardName );
  10254. for(i=0; i<amount; i+=1)
  10255. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  10256. }
  10257.  
  10258. if( dm.ItemHasTag( cardName, 'GwentTournament' ) )
  10259. {
  10260. if ( dm.ItemHasTag( cardName, 'GT1' ) )
  10261. {
  10262. FactsSubstract( "GwentTournament", 1 );
  10263. }
  10264.  
  10265. else if ( dm.ItemHasTag( cardName, 'GT2' ) )
  10266. {
  10267. FactsSubstract( "GwentTournament", 2 );
  10268. }
  10269.  
  10270. else if ( dm.ItemHasTag( cardName, 'GT3' ) )
  10271. {
  10272. FactsSubstract( "GwentTournament", 3 );
  10273. }
  10274.  
  10275. else if ( dm.ItemHasTag( cardName, 'GT4' ) )
  10276. {
  10277. FactsSubstract( "GwentTournament", 4 );
  10278. }
  10279.  
  10280. else if ( dm.ItemHasTag( cardName, 'GT5' ) )
  10281. {
  10282. FactsSubstract( "GwentTournament", 5 );
  10283. }
  10284.  
  10285. else if ( dm.ItemHasTag( cardName, 'GT6' ) )
  10286. {
  10287. FactsSubstract( "GwentTournament", 6 );
  10288. }
  10289.  
  10290. else if ( dm.ItemHasTag( cardName, 'GT7' ) )
  10291. {
  10292. FactsSubstract( "GwentTournament", 7 );
  10293. }
  10294.  
  10295. CheckGwentTournamentDeck();
  10296. }
  10297.  
  10298.  
  10299. if( dm.ItemHasTag( cardName, 'EP2Tournament' ) )
  10300. {
  10301. if ( dm.ItemHasTag( cardName, 'GT1' ) )
  10302. {
  10303. FactsSubstract( "EP2Tournament", 1 );
  10304. }
  10305.  
  10306. else if ( dm.ItemHasTag( cardName, 'GT2' ) )
  10307. {
  10308. FactsSubstract( "EP2Tournament", 2 );
  10309. }
  10310.  
  10311. else if ( dm.ItemHasTag( cardName, 'GT3' ) )
  10312. {
  10313. FactsSubstract( "EP2Tournament", 3 );
  10314. }
  10315.  
  10316. else if ( dm.ItemHasTag( cardName, 'GT4' ) )
  10317. {
  10318. FactsSubstract( "EP2Tournament", 4 );
  10319. }
  10320.  
  10321. else if ( dm.ItemHasTag( cardName, 'GT5' ) )
  10322. {
  10323. FactsSubstract( "EP2Tournament", 5 );
  10324. }
  10325.  
  10326. else if ( dm.ItemHasTag( cardName, 'GT6' ) )
  10327. {
  10328. FactsSubstract( "EP2Tournament", 6 );
  10329. }
  10330.  
  10331. else if ( dm.ItemHasTag( cardName, 'GT7' ) )
  10332. {
  10333. FactsSubstract( "EP2Tournament", 7 );
  10334. }
  10335.  
  10336. CheckEP2TournamentDeck();
  10337. }
  10338.  
  10339. return true;
  10340. }
  10341.  
  10342. function CheckGwentTournamentDeck()
  10343. {
  10344. var gwentPower : int;
  10345. var neededGwentPower : int;
  10346. var checkBreakpoint : int;
  10347.  
  10348. neededGwentPower = 70;
  10349.  
  10350. checkBreakpoint = neededGwentPower/5;
  10351. gwentPower = FactsQuerySum( "GwentTournament" );
  10352.  
  10353. if ( gwentPower >= neededGwentPower )
  10354. {
  10355. FactsAdd( "HasGwentTournamentDeck", 1 );
  10356. }
  10357. else
  10358. {
  10359. if( FactsDoesExist( "HasGwentTournamentDeck" ) )
  10360. {
  10361. FactsRemove( "HasGwentTournamentDeck" );
  10362. }
  10363.  
  10364. if ( gwentPower >= checkBreakpoint )
  10365. {
  10366. FactsAdd( "GwentTournamentObjective1", 1 );
  10367. }
  10368. else if ( FactsDoesExist( "GwentTournamentObjective1" ) )
  10369. {
  10370. FactsRemove( "GwentTournamentObjective1" );
  10371. }
  10372.  
  10373. if ( gwentPower >= checkBreakpoint*2 )
  10374. {
  10375. FactsAdd( "GwentTournamentObjective2", 1 );
  10376. }
  10377. else if ( FactsDoesExist( "GwentTournamentObjective2" ) )
  10378. {
  10379. FactsRemove( "GwentTournamentObjective2" );
  10380. }
  10381.  
  10382. if ( gwentPower >= checkBreakpoint*3 )
  10383. {
  10384. FactsAdd( "GwentTournamentObjective3", 1 );
  10385. }
  10386. else if ( FactsDoesExist( "GwentTournamentObjective3" ) )
  10387. {
  10388. FactsRemove( "GwentTournamentObjective3" );
  10389. }
  10390.  
  10391. if ( gwentPower >= checkBreakpoint*4 )
  10392. {
  10393. FactsAdd( "GwentTournamentObjective4", 1 );
  10394. }
  10395. else if ( FactsDoesExist( "GwentTournamentObjective4" ) )
  10396. {
  10397. FactsRemove( "GwentTournamentObjective4" );
  10398. }
  10399. }
  10400. }
  10401.  
  10402. function CheckEP2TournamentDeck()
  10403. {
  10404. var gwentPower : int;
  10405. var neededGwentPower : int;
  10406. var checkBreakpoint : int;
  10407.  
  10408. neededGwentPower = 24;
  10409.  
  10410. checkBreakpoint = neededGwentPower/5;
  10411. gwentPower = FactsQuerySum( "EP2Tournament" );
  10412.  
  10413. if ( gwentPower >= neededGwentPower )
  10414. {
  10415. if( FactsQuerySum( "HasEP2TournamentDeck") == 0 )
  10416. {
  10417. FactsAdd( "HasEP2TournamentDeck", 1 );
  10418. }
  10419.  
  10420. }
  10421. else
  10422. {
  10423. if( FactsDoesExist( "HasEP2TournamentDeck" ) )
  10424. {
  10425. FactsRemove( "HasEP2TournamentDeck" );
  10426. }
  10427.  
  10428. if ( gwentPower >= checkBreakpoint )
  10429. {
  10430. FactsAdd( "EP2TournamentObjective1", 1 );
  10431. }
  10432. else if ( FactsDoesExist( "EP2TournamentObjective1" ) )
  10433. {
  10434. FactsRemove( "EP2TournamentObjective1" );
  10435. }
  10436.  
  10437. if ( gwentPower >= checkBreakpoint*2 )
  10438. {
  10439. FactsAdd( "EP2TournamentObjective2", 1 );
  10440. }
  10441. else if ( FactsDoesExist( "EP2TournamentObjective2" ) )
  10442. {
  10443. FactsRemove( "EP2TournamentObjective2" );
  10444. }
  10445.  
  10446. if ( gwentPower >= checkBreakpoint*3 )
  10447. {
  10448. FactsAdd( "EP2TournamentObjective3", 1 );
  10449. }
  10450. else if ( FactsDoesExist( "EP2TournamentObjective3" ) )
  10451. {
  10452. FactsRemove( "EP2TournamentObjective3" );
  10453. }
  10454.  
  10455. if ( gwentPower >= checkBreakpoint*4 )
  10456. {
  10457. FactsAdd( "EP2TournamentObjective4", 1 );
  10458. }
  10459. else if ( FactsDoesExist( "EP2TournamentObjective4" ) )
  10460. {
  10461. FactsRemove( "EP2TournamentObjective4" );
  10462. }
  10463. }
  10464. }
  10465.  
  10466.  
  10467.  
  10468.  
  10469.  
  10470.  
  10471. //---=== modFriendlyMeditation ===---
  10472. public function IsMeditating() : bool
  10473. {
  10474. return ( GetCurrentStateName() == 'Meditation' );
  10475. }
  10476.  
  10477. public function IsSkippingTime() : bool
  10478. {
  10479. return ( GetCurrentStateName() == 'MeditationWaiting' );
  10480. }
  10481.  
  10482. public function UpdateEffectsAccelerated( realTimeSecs, acceleration : float )
  10483. {
  10484. effectManager.PerformUpdate( realTimeSecs * acceleration );
  10485. }
  10486. //---=== modFriendlyMeditation ===---
  10487.  
  10488. public function SimulateBuffTimePassing(simulatedTime : float)
  10489. {
  10490. //---=== modPreparations ===---
  10491. /*super.SimulateBuffTimePassing(simulatedTime);
  10492.  
  10493. FinishQuen(true);*/
  10494. var t : float = 0.0f;
  10495. var dt : float = 0.1f;
  10496. if(simulatedTime > 0)
  10497. {
  10498. //the game can't handle updating effects over a long period of time
  10499. //properly, so we'll do it in small steps instead
  10500. while(t < simulatedTime)
  10501. {
  10502. effectManager.PerformUpdate(dt);
  10503. t += dt;
  10504. }
  10505. }
  10506. //---=== modPreparations ===---
  10507. }
  10508.  
  10509.  
  10510. public function CanMeditate() : bool
  10511. {
  10512. //---=== modPreparations ===---
  10513. /*var currentStateName : name;
  10514.  
  10515. currentStateName = GetCurrentStateName();
  10516.  
  10517.  
  10518. if(currentStateName == 'Exploration' && !CanPerformPlayerAction())
  10519. return false;
  10520.  
  10521.  
  10522. if(GetCurrentStateName() != 'Exploration' && GetCurrentStateName() != 'Meditation' && GetCurrentStateName() != 'MeditationWaiting')
  10523. return false;
  10524.  
  10525.  
  10526. if(GetUsedVehicle())
  10527. return false;
  10528.  
  10529.  
  10530. return CanMeditateHere();*/
  10531. if(!IsMeditationAllowed())
  10532. {
  10533. theGame.GetGuiManager().ShowNotification(GetLocStringByKeyExt(prepConfig.GetMeditationError()));
  10534. return false;
  10535. }
  10536. return true;
  10537. //---=== modPreparations ===---
  10538. }
  10539.  
  10540.  
  10541. public final function CanMeditateWait(optional skipMeditationStateCheck : bool) : bool
  10542. {
  10543. //---=== modPreparations ===---
  10544. /*var currState : name;
  10545.  
  10546. currState = GetCurrentStateName();
  10547.  
  10548.  
  10549.  
  10550. if(!skipMeditationStateCheck && currState != 'Meditation')
  10551. return false;
  10552.  
  10553.  
  10554. if(theGame.IsGameTimePaused())
  10555. return false;
  10556.  
  10557. if(!IsActionAllowed( EIAB_MeditationWaiting ))
  10558. return false;
  10559.  
  10560. return true;*/
  10561. if(!IsMeditationAllowed())
  10562. {
  10563. theGame.GetGuiManager().ShowNotification(GetLocStringByKeyExt(prepConfig.GetMeditationError()));
  10564. return false;
  10565. }
  10566. return true;
  10567. //---=== modPreparations ===---
  10568. }
  10569.  
  10570.  
  10571. public final function CanMeditateHere() : bool
  10572. {
  10573. //---=== modPreparations ===---
  10574. /*var pos : Vector;
  10575.  
  10576. pos = GetWorldPosition();
  10577. if(pos.Z <= theGame.GetWorld().GetWaterLevel(pos, true) && IsInShallowWater())
  10578. return false;
  10579.  
  10580. if(IsThreatened())
  10581. return false;
  10582.  
  10583. return true;*/
  10584. if(!IsMeditationAllowed())
  10585. {
  10586. theGame.GetGuiManager().ShowNotification(GetLocStringByKeyExt(prepConfig.GetMeditationError()));
  10587. return false;
  10588. }
  10589. return true;
  10590. //---=== modPreparations ===---
  10591. }
  10592.  
  10593.  
  10594. //---=== modPreparations ===---
  10595. public function IsMeditationAllowed() : bool
  10596. {
  10597. var curState : name = GetCurrentStateName();
  10598.  
  10599. fmedCanSpawnCampfire = false;
  10600.  
  10601. if(theGame.IsGameTimePaused())
  10602. return false;
  10603.  
  10604. if(GetUsedVehicle())
  10605. return false;
  10606.  
  10607. if(!IsActionAllowed(EIAB_MeditationWaiting))
  10608. return false;
  10609.  
  10610. if(curState != 'Exploration' && curState != 'Meditation' && curState != 'MeditationWaiting')
  10611. return false;
  10612.  
  10613. if(curState == 'Exploration' && !CanPerformPlayerAction())
  10614. return false;
  10615.  
  10616. if(IsThreatened())
  10617. return false;
  10618.  
  10619. if(((CMovingPhysicalAgentComponent)GetMovingAgentComponent()).GetSubmergeDepth() < 0)
  10620. return false;
  10621.  
  10622. if(prepConfig.disallowNPCs && HasNonAlliedActorsNearby())
  10623. return false;
  10624.  
  10625. if(prepConfig.disallowSettlement && IsInSettlement() && !IsInInterior())
  10626. return false;
  10627.  
  10628. if(prepConfig.disallowInterior && IsInInterior())
  10629. return false;
  10630.  
  10631. if(prepConfig.disallowMeditation && !HasCampfire() && !CanSpawnCampfire())
  10632. return false;
  10633.  
  10634. fmedCanSpawnCampfire = CanSpawnCampfire(); //meditation is allowed, but we need to determine if spawning a campfire is allowed (for Friendly Meditation)
  10635.  
  10636. return true;
  10637. }
  10638.  
  10639. public function HasNonAlliedActorsNearby() : bool
  10640. {
  10641. var entities : array< CGameplayEntity >;
  10642. var i : int;
  10643. var actor : CActor;
  10644.  
  10645. FindGameplayEntitiesInRange( entities, thePlayer, prepConfig.npcDistance, 1000,, FLAG_ExcludePlayer + FLAG_OnlyAliveActors,, 'CActor' );
  10646. for( i = 0; i < entities.Size(); i += 1 )
  10647. {
  10648. actor = (CActor)entities[i];
  10649. if( actor.IsAnimal() || ((CNewNPC)actor).IsHorse() || GetAttitudeBetween( thePlayer, actor ) != AIA_Hostile && ((CNewNPC)actor).IsVIP() )
  10650. continue;
  10651. else
  10652. return true;
  10653. }
  10654. return false;
  10655. }
  10656.  
  10657. public function GetFmedCanSpawnCampfire() : bool
  10658. {
  10659. return fmedCanSpawnCampfire;
  10660. }
  10661.  
  10662. public function GetOpenFireEnt() : CGameplayEntity
  10663. {
  10664. return openFireEnt;
  10665. }
  10666.  
  10667. public function HasCampfire() : bool
  10668. {
  10669. var entities : array< CGameplayEntity >;
  10670. var i : int;
  10671. var dist : float;
  10672. var glComponent : CGameplayLightComponent;
  10673.  
  10674. if( IsInInterior() )
  10675. {
  10676. dist = 1.5;
  10677. }
  10678. else
  10679. {
  10680. dist = 3.0;
  10681. }
  10682. if( openFireEnt && VecDistanceSquared2D(openFireEnt.GetWorldPosition(), GetWorldPosition()) <= dist*dist )
  10683. {
  10684. return true;
  10685. }
  10686. if( spawnedCampFire && VecDistanceSquared2D(spawnedCampFire.GetWorldPosition(), GetWorldPosition()) <= dist*dist )
  10687. {
  10688. openFireEnt = spawnedCampFire;
  10689. return true;
  10690. }
  10691. if( !prepConfig.disallowCampFire )
  10692. {
  10693. FindGameplayEntitiesInRange( entities, thePlayer, dist, 1,, FLAG_ExcludePlayer,, 'W3Campfire' );
  10694. if( entities.Size() > 0 )
  10695. {
  10696. openFireEnt = entities[0];
  10697. return true;
  10698. }
  10699. }
  10700. if( !prepConfig.disallowFireSource )
  10701. {
  10702. FindGameplayEntitiesInRange( entities, thePlayer, dist, 1,, FLAG_ExcludePlayer,, 'W3FireSource' );
  10703. if( entities.Size() > 0 )
  10704. {
  10705. openFireEnt = entities[0];
  10706. return true;
  10707. }
  10708. }
  10709. if( !prepConfig.disallowLightSource )
  10710. {
  10711. FindGameplayEntitiesInRange( entities, thePlayer, dist, 10,, FLAG_ExcludePlayer,, 'CGameplayEntity' );
  10712. for( i = 0; i < entities.Size(); i += 1 )
  10713. {
  10714. glComponent = (CGameplayLightComponent)entities[i].GetComponentByClassName( 'CGameplayLightComponent' );
  10715. if( glComponent )
  10716. {
  10717. openFireEnt = entities[i];
  10718. return true;
  10719. }
  10720. }
  10721. }
  10722. openFireEnt = NULL;
  10723. return false;
  10724. }
  10725.  
  10726. public function CanSpawnCampfire() : bool
  10727. {
  10728. fmedCanSpawnCampfire = false;
  10729.  
  10730. if( HasCampfire() )
  10731. return false;
  10732.  
  10733. if( !prepConfig.fmedSpawnCampFire() )
  10734. return false;
  10735.  
  10736. if( prepConfig.disallowCampFireInInterior && IsInInterior() )
  10737. return false;
  10738.  
  10739. if( prepConfig.disallowCampFireInSettlement && IsInSettlement() )
  10740. return false;
  10741.  
  10742. fmedCanSpawnCampfire = prepConfig.HasResourcesForCampfire();
  10743.  
  10744. return fmedCanSpawnCampfire;
  10745. }
  10746.  
  10747. timer function CampFireErrorMessageTimer(dt : float, id : int)
  10748. {
  10749. if( !HasCampfire() )
  10750. theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt( prepConfig.GetSpawnCampfireError() ) );
  10751. }
  10752.  
  10753. timer function CampFireResourcesTimer(dt : float, id : int)
  10754. {
  10755. prepConfig.RemoveResourcesForCampfire();
  10756. }
  10757.  
  10758. public function AdvanceTimeSeconds( seconds : int )
  10759. {
  10760. if( seconds > 0 )
  10761. {
  10762. theGame.SetGameTime( theGame.GetGameTime() + GameTimeCreateFromGameSeconds( seconds ), false );
  10763. UpdateEffectsAccelerated( ConvertGameSecondsToRealTimeSeconds( seconds ), 1 );
  10764. }
  10765. }
  10766. //---=== modPreparations ===---
  10767.  
  10768. public function Meditate() : bool
  10769. {
  10770. //---=== modFriendlyMeditation ===---
  10771. //var medState : W3PlayerWitcherStateMeditation;
  10772. //var stateName : name;
  10773. //
  10774. //stateName = GetCurrentStateName();
  10775. //
  10776. //
  10777. //if (!CanMeditate() || stateName == 'MeditationWaiting' )
  10778. // return false;
  10779. //
  10780. //GotoState('Meditation');
  10781. //medState = (W3PlayerWitcherStateMeditation)GetState('Meditation');
  10782. //medState.SetMeditationPointHeading(GetHeading());
  10783. //
  10784. //return true;
  10785.  
  10786. if ( !ModCanMeditate() )
  10787. return false;
  10788.  
  10789. theGame.RequestMenuWithBackground( 'MeditationClockMenu', 'CommonMenu' );
  10790.  
  10791. return true;
  10792. //---=== modFriendlyMeditation ===---
  10793. }
  10794.  
  10795.  
  10796. public final function MeditationRestoring(simulatedTime : float)
  10797. {
  10798. //---=== modPreparations ===---
  10799. if( !prepConfig.disableRegenFullHealth )
  10800. {
  10801. Heal( GetStatMax( BCS_Vitality ) );
  10802. }
  10803.  
  10804. if( simulatedTime > 0 )
  10805. {
  10806. if( prepConfig.disableCleanupCharStatus )
  10807. {
  10808. SimulateBuffTimePassing(simulatedTime);
  10809. }
  10810. else
  10811. {
  10812. abilityManager.DrainToxicity( abilityManager.GetStat( BCS_Toxicity ) );
  10813. abilityManager.DrainFocus( abilityManager.GetStat( BCS_Focus ) );
  10814. FinishQuen(true);
  10815. RemoveAllNonAutoBuffs();
  10816. }
  10817. inv.SingletonItemsRefillAmmo();
  10818. }
  10819. else if( !prepConfig.disableAutorefillQuest )
  10820. {
  10821. abilityManager.DrainToxicity( abilityManager.GetStat( BCS_Toxicity ) );
  10822. abilityManager.DrainFocus( abilityManager.GetStat( BCS_Focus ) );
  10823. FinishQuen(true);
  10824. RemoveAllNonAutoBuffs();
  10825. inv.SingletonItemsRefillAmmo(, true);
  10826. }
  10827.  
  10828. ApplyWitcherHouseBuffs();
  10829. //---=== modPreparations ===---
  10830. }
  10831.  
  10832. var clockMenu : CR4MeditationClockMenu;
  10833.  
  10834. public function MeditationClockStart(m : CR4MeditationClockMenu)
  10835. {
  10836. clockMenu = m;
  10837. AddTimer('UpdateClockTime',0.1,true);
  10838. }
  10839.  
  10840. public function MeditationClockStop()
  10841. {
  10842. clockMenu = NULL;
  10843. RemoveTimer('UpdateClockTime');
  10844. }
  10845.  
  10846. public timer function UpdateClockTime(dt : float, id : int)
  10847. {
  10848. if(clockMenu)
  10849. clockMenu.UpdateCurrentHours();
  10850. else
  10851. RemoveTimer('UpdateClockTime');
  10852. }
  10853.  
  10854. private var waitTimeHour : int;
  10855. public function SetWaitTargetHour(t : int)
  10856. {
  10857. waitTimeHour = t;
  10858. }
  10859. public function GetWaitTargetHour() : int
  10860. {
  10861. return waitTimeHour;
  10862. }
  10863.  
  10864. public function MeditationForceAbort(forceCloseUI : bool)
  10865. {
  10866. //---=== modFriendlyMeditation ===---
  10867. //var waitt : W3PlayerWitcherStateMeditationWaiting;
  10868. //var medd : W3PlayerWitcherStateMeditation;
  10869. //var currentStateName : name;
  10870. //
  10871. //currentStateName = GetCurrentStateName();
  10872. //
  10873. //if(currentStateName == 'MeditationWaiting')
  10874. //{
  10875. // waitt = (W3PlayerWitcherStateMeditationWaiting)GetCurrentState();
  10876. // if(waitt)
  10877. // {
  10878. // waitt.StopRequested(forceCloseUI);
  10879. // }
  10880. //}
  10881. //else if(currentStateName == 'Meditation')
  10882. //{
  10883. // medd = (W3PlayerWitcherStateMeditation)GetCurrentState();
  10884. // if(medd)
  10885. // {
  10886. // medd.StopRequested(forceCloseUI);
  10887. // }
  10888. //}
  10889. ModEndMeditation();
  10890. //---=== modFriendlyMeditation ===---
  10891.  
  10892.  
  10893.  
  10894. if(forceCloseUI && theGame.GetGuiManager().IsAnyMenu())
  10895. {
  10896. theGame.GetGuiManager().GetRootMenu().CloseMenu();
  10897. DisplayActionDisallowedHudMessage(EIAB_MeditationWaiting, false, false, true, false);
  10898. }
  10899. }
  10900.  
  10901. //---=== modFriendlyMeditation ===---
  10902. public function ModCanMeditate(optional isPlayerMeditatingInBed : bool) : bool
  10903. {
  10904. if( isPlayerMeditatingInBed )
  10905. return true;
  10906.  
  10907. //checking everything for Preparations compatibility
  10908. if( !CanMeditate() )
  10909. return false;
  10910.  
  10911. if( !CanMeditateWait(true) )
  10912. return false;
  10913.  
  10914. if( !CanMeditateHere() )
  10915. return false;
  10916.  
  10917. if( !ModCanMeditateHereExt() )
  10918. return false;
  10919.  
  10920. return true;
  10921. }
  10922.  
  10923. public function ModCanMeditateHereExt() : bool
  10924. {
  10925. if( IsUsingVehicle() || IsSwimming () || IsDiving() )
  10926. return false;
  10927.  
  10928. if( ((CMovingPhysicalAgentComponent)GetMovingAgentComponent()).GetSubmergeDepth() < 0 )
  10929. return false;
  10930.  
  10931. return true;
  10932. }
  10933.  
  10934. public function ModStartMeditation(optional isPlayerMeditatingInBed : bool, optional isFromClock : bool, optional endTime : float) : bool
  10935. {
  10936. if( !ModCanMeditate(isPlayerMeditatingInBed) )
  10937. return false;
  10938.  
  10939. if( theGame.GetGuiManager().IsAnyMenu() )
  10940. theGame.GetGuiManager().GetRootMenu().CloseMenu();
  10941.  
  10942. if( !IsMeditating() && !IsSkippingTime() )
  10943. {
  10944. medIsPlayerMeditatingInBed = isPlayerMeditatingInBed;
  10945. medIsFromClock = isFromClock;
  10946. medEndTime = endTime;
  10947. SetBehaviorVariable('MeditateAbort', 0);
  10948. PushState('Meditation');
  10949. return true;
  10950. }
  10951. else
  10952. {
  10953. if( IsSkippingTime() )
  10954. {
  10955. MeditationEndFastforward();
  10956. }
  10957. if( IsMeditating() )
  10958. {
  10959. medIsPlayerMeditatingInBed = isPlayerMeditatingInBed;
  10960. medIsFromClock = isFromClock;
  10961. medEndTime = endTime;
  10962. SetBehaviorVariable('MeditateAbort', 0);
  10963. if( isFromClock )
  10964. ((W3PlayerWitcherStateMeditation)GetState( 'Meditation' )).StartFastforward();
  10965. return true;
  10966. }
  10967. }
  10968.  
  10969. return false;
  10970. }
  10971.  
  10972. public function ModEndMeditation()
  10973. {
  10974. if( IsMeditating() || IsSkippingTime() )
  10975. {
  10976. SetBehaviorVariable('MeditateAbort', 1);
  10977. PopState();
  10978. medIsPlayerMeditatingInBed = false;
  10979. medIsFromClock = false;
  10980. medEndTime = -1;
  10981. if( theGame.GetGuiManager().IsAnyMenu() )
  10982. theGame.GetGuiManager().GetRootMenu().CloseMenu();
  10983. }
  10984. }
  10985.  
  10986. private var medIsPlayerMeditatingInBed : bool;
  10987. default medIsPlayerMeditatingInBed = false;
  10988. public function GetIsPlayerMeditatingInBed() : bool
  10989. {
  10990. return medIsPlayerMeditatingInBed;
  10991. }
  10992.  
  10993. private var medEndTime : float;
  10994. default medEndTime = -1;
  10995. public function GetMeditationTargetTime() : float
  10996. {
  10997. return medEndTime;
  10998. }
  10999.  
  11000. private var medIsFromClock : bool;
  11001. default medIsFromClock = false;
  11002. public function GetMeditationStartedByClock() : bool
  11003. {
  11004. return medIsFromClock;
  11005. }
  11006.  
  11007. public function MeditationRefill( gameTimeSecs : float ) : bool
  11008. {
  11009. if ( fmedAutorefillAlchemy && gameTimeSecs >= fmedRefillIntervalSeconds )
  11010. {
  11011. inv.SingletonItemsRefillAmmo();
  11012. return true;
  11013. }
  11014. return false;
  11015. }
  11016.  
  11017. public function CheckWitcherHouseBuffs( gameTimeSecs : float ) : bool
  11018. {
  11019. if ( fmedApplyWitcherHouseBuffs && GetIsPlayerMeditatingInBed() && CeilF(gameTimeSecs/3600.0) >= fmedWitcherHouseBuffsHours )
  11020. {
  11021. ApplyWitcherHouseBuffs();
  11022. return true;
  11023. }
  11024. return false;
  11025. }
  11026.  
  11027. timer function DeSpawnCampFireTimer(dt : float, id : int)
  11028. {
  11029. spawnedCampFire.ToggleFire( false );
  11030. spawnedCampFire.Destroy();
  11031. spawnedCampFire = NULL;
  11032. }
  11033.  
  11034. public function MeditationStartFastforward()
  11035. {
  11036. if( IsMeditating() )
  11037. {
  11038. medIsFromClock = false;
  11039. ((W3PlayerWitcherStateMeditation)GetState( 'Meditation' )).StartFastforward();
  11040. }
  11041. }
  11042.  
  11043. public function MeditationEndFastforward()
  11044. {
  11045. if( IsSkippingTime() )
  11046. {
  11047. ((W3PlayerWitcherStateMeditation)GetState( 'Meditation' )).EndFastforward();
  11048. medIsFromClock = false;
  11049. }
  11050. }
  11051. //---=== modFriendlyMeditation ===---
  11052.  
  11053. public function Runeword10Triggerred()
  11054. {
  11055. var min, max : SAbilityAttributeValue;
  11056.  
  11057. //modSigns
  11058. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Runeword 10 _Stats', 'health', min, max );
  11059. GainStat(BCS_Vitality, min.valueMultiplicative * GetStatMax(BCS_Vitality));
  11060. PlayEffect('runeword_10_stamina');
  11061. }
  11062.  
  11063. public function Runeword12Triggerred()
  11064. {
  11065. var min, max : SAbilityAttributeValue;
  11066.  
  11067. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Runeword 12 _Stats', 'focus', min, max );
  11068. //GainStat(BCS_Focus, RandRangeF(max.valueAdditive, min.valueAdditive));
  11069. GainStat(BCS_Focus, min.valueAdditive); //modSigns
  11070. PlayEffect('runeword_20_adrenaline');
  11071. }
  11072.  
  11073. /*var runeword10TriggerredOnFinisher, runeword12TriggerredOnFinisher : bool;
  11074.  
  11075. event OnFinisherStart()
  11076. {
  11077. super.OnFinisherStart();
  11078.  
  11079. runeword10TriggerredOnFinisher = false;
  11080. runeword12TriggerredOnFinisher = false;
  11081. }*/ //modSigns
  11082.  
  11083. public function ApplyWitcherHouseBuffs()
  11084. {
  11085. var l_bed : W3WitcherBed;
  11086.  
  11087. if( FactsQuerySum( "PlayerInsideInnerWitcherHouse" ) > 0 )
  11088. {
  11089. l_bed = (W3WitcherBed)theGame.GetEntityByTag( 'witcherBed' );
  11090.  
  11091. if( l_bed.GetWasUsed() )
  11092. {
  11093. //---=== modPreparations ===---
  11094. abilityManager.DrainToxicity( abilityManager.GetStat( BCS_Toxicity ) );
  11095. abilityManager.DrainFocus( abilityManager.GetStat( BCS_Focus ) );
  11096. //inv.SingletonItemsRefillAmmo();
  11097. SimulateBuffTimePassing(0);
  11098. //---=== modPreparations ===---
  11099. if( l_bed.GetBedLevel() != 0 )
  11100. {
  11101. AddEffectDefault( EET_WellRested, this, "Bed Buff" );
  11102. }
  11103.  
  11104. if( FactsQuerySum( "StablesExists" ) )
  11105. {
  11106. AddEffectDefault( EET_HorseStableBuff, this, "Stables" );
  11107. }
  11108.  
  11109. //---=== modPreparations ===---
  11110. if( FactsQuerySum( "AlchemyTableExists" ) )
  11111. {
  11112. ManageAlchemyTableBonus();
  11113. }
  11114.  
  11115. /*if( l_bed.GetWereItemsRefilled() )
  11116. {
  11117. theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt( "message_common_alchemy_table_buff_applied" ),, true );
  11118. l_bed.SetWereItemsRefilled( false );
  11119. }*/
  11120. //---=== modPreparations ===---
  11121.  
  11122. AddEffectDefault( EET_BookshelfBuff, this, "Bookshelf" );
  11123.  
  11124. Heal( GetStatMax( BCS_Vitality ) );
  11125. }
  11126. }
  11127. }
  11128.  
  11129. //---=== modPreparations ===---
  11130. public function ManageAlchemyTableBonus()
  11131. {
  11132. AddEffectDefault( EET_AlchemyTable, this, "Alchemy Table" );
  11133. theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt( "message_common_alchemy_table_buff_applied" ),, true );
  11134. }
  11135. //---=== modPreparations ===---
  11136.  
  11137.  
  11138.  
  11139.  
  11140. public function CheatResurrect()
  11141. {
  11142. super.CheatResurrect();
  11143. theGame.ReleaseNoSaveLock(theGame.deathSaveLockId);
  11144. theInput.RestoreContext( 'Exploration', true );
  11145. }
  11146.  
  11147.  
  11148. public function Debug_EquipTestingSkills(equip : bool, force : bool)
  11149. {
  11150. var skills : array<ESkill>;
  11151. var i, slot : int;
  11152.  
  11153.  
  11154. ((W3PlayerAbilityManager)abilityManager).OnLevelGained(36);
  11155.  
  11156. skills.PushBack(S_Magic_s01);
  11157. skills.PushBack(S_Magic_s02);
  11158. skills.PushBack(S_Magic_s03);
  11159. skills.PushBack(S_Magic_s04);
  11160. skills.PushBack(S_Magic_s05);
  11161. skills.PushBack(S_Sword_s01);
  11162. skills.PushBack(S_Sword_s02);
  11163.  
  11164.  
  11165. if(equip)
  11166. {
  11167. for(i=0; i<skills.Size(); i+=1)
  11168. {
  11169. if(!force && IsSkillEquipped(skills[i]))
  11170. continue;
  11171.  
  11172.  
  11173. if(GetSkillLevel(skills[i]) == 0)
  11174. AddSkill(skills[i]);
  11175.  
  11176.  
  11177. if(force)
  11178. slot = i+1;
  11179. else
  11180. slot = GetFreeSkillSlot();
  11181.  
  11182.  
  11183. EquipSkill(skills[i], slot);
  11184. }
  11185. }
  11186. else
  11187. {
  11188. for(i=0; i<skills.Size(); i+=1)
  11189. {
  11190. UnequipSkill(GetSkillSlotID(skills[i]));
  11191. }
  11192. }
  11193. }
  11194.  
  11195. //modSigns
  11196. public function Debug_RestoreMutagensSpent()
  11197. {
  11198. var total : array<int>;
  11199.  
  11200. total = ((W3PlayerAbilityManager)abilityManager).GetMutationsUsedMutagens();
  11201.  
  11202. if(total[0] > 0) inv.AddAnItem('Greater mutagen red', total[0]);
  11203. if(total[1] > 0) inv.AddAnItem('Greater mutagen blue', total[1]);
  11204. if(total[2] > 0) inv.AddAnItem('Greater mutagen green', total[2]);
  11205. }
  11206.  
  11207. //modSigns
  11208. public function Debug_ClearCharacterDevelopment( optional resetLevels : bool )
  11209. {
  11210. var template : CEntityTemplate;
  11211. var entity : CEntity;
  11212. var invTesting : CInventoryComponent;
  11213. var i, totalExp, currentLevel, totalSkillPoints : int;
  11214. var items : array<SItemUniqueId>;
  11215. var abs : array<name>;
  11216. var isMutationSystemEnabled : bool;
  11217. var weaponId : SItemUniqueId;
  11218.  
  11219. ForceSetStat(BCS_Toxicity, 0);
  11220.  
  11221. if(GetItemEquippedOnSlot(EES_SilverSword, weaponId)) //fix oils stuck on a sword
  11222. {
  11223. if(inv.CanItemHaveOil(weaponId))
  11224. {
  11225. inv.RemoveAllOilsFromItem(weaponId);
  11226. inv.RemoveAllOilAbilitiesFromItem(weaponId);
  11227. }
  11228. }
  11229.  
  11230. if(GetItemEquippedOnSlot(EES_SteelSword, weaponId)) //fix oils stuck on a sword
  11231. {
  11232. if(inv.CanItemHaveOil(weaponId))
  11233. {
  11234. inv.RemoveAllOilsFromItem(weaponId);
  11235. inv.RemoveAllOilAbilitiesFromItem(weaponId);
  11236. }
  11237. }
  11238.  
  11239. UnequipItemFromSlot(EES_SilverSword);
  11240. UnequipItemFromSlot(EES_SteelSword);
  11241. UnequipItemFromSlot(EES_Bolt);
  11242. UnequipItemFromSlot(EES_RangedWeapon);
  11243. UnequipItemFromSlot(EES_Armor);
  11244. UnequipItemFromSlot(EES_Boots);
  11245. UnequipItemFromSlot(EES_Pants);
  11246. UnequipItemFromSlot(EES_Gloves);
  11247. UnequipItemFromSlot(EES_Petard1);
  11248. UnequipItemFromSlot(EES_Petard2);
  11249. UnequipItemFromSlot(EES_Quickslot1);
  11250. UnequipItemFromSlot(EES_Quickslot2);
  11251. UnequipItemFromSlot(EES_Potion1);
  11252. UnequipItemFromSlot(EES_Potion2);
  11253. UnequipItemFromSlot(EES_Potion3);
  11254. UnequipItemFromSlot(EES_Potion4);
  11255. UnequipItemFromSlot(EES_Mask);
  11256. UnequipItemFromSlot(EES_SkillMutagen1);
  11257. UnequipItemFromSlot(EES_SkillMutagen2);
  11258. UnequipItemFromSlot(EES_SkillMutagen3);
  11259. UnequipItemFromSlot(EES_SkillMutagen4);
  11260. HorseUnequipItem(EES_HorseBlinders);
  11261. HorseUnequipItem(EES_HorseSaddle);
  11262. HorseUnequipItem(EES_HorseBag);
  11263. HorseUnequipItem(EES_HorseTrophy);
  11264.  
  11265. currentLevel = levelManager.GetLevel();
  11266. totalExp = levelManager.GetPointsTotal(EExperiencePoint);
  11267. totalSkillPoints = levelManager.GetPointsTotal(ESkillPoint);
  11268. isMutationSystemEnabled = ((W3PlayerAbilityManager)abilityManager).IsMutationSystemEnabled();
  11269.  
  11270. Debug_RestoreMutagensSpent();
  11271.  
  11272. GetCharacterStats().GetAbilities(abs, false);
  11273. for(i = 0; i < abs.Size(); i+=1)
  11274. RemoveAbility(abs[i]);
  11275.  
  11276. abs.Clear();
  11277. GetCharacterStatsParam(abs);
  11278. for(i = 0; i < abs.Size(); i +=1 )
  11279. AddAbility(abs[i]);
  11280.  
  11281. delete levelManager;
  11282. levelManager = new W3LevelManager in this;
  11283. levelManager.Initialize();
  11284. levelManager.PostInit(this, false, true);
  11285.  
  11286. if(!resetLevels)
  11287. {
  11288. levelManager.AddPoints(EExperiencePoint, totalExp, false, true);
  11289. levelManager.AddPoints(ESkillPoint, Max(0, totalSkillPoints - levelManager.GetPointsTotal(ESkillPoint)), false);
  11290. }
  11291.  
  11292. delete abilityManager;
  11293. SetAbilityManager();
  11294. abilityManager.Init(this, GetCharacterStats(), false, theGame.GetDifficultyMode());
  11295.  
  11296. delete effectManager;
  11297. SetEffectManager();
  11298.  
  11299. abilityManager.PostInit();
  11300. ((W3PlayerAbilityManager)abilityManager).MutationSystemEnable(isMutationSystemEnabled);
  11301. }
  11302.  
  11303. function Debug_BearSetBonusQuenSkills()
  11304. {
  11305. var skills : array<ESkill>;
  11306. var i, slot : int;
  11307.  
  11308. skills.PushBack(S_Magic_s04);
  11309. skills.PushBack(S_Magic_s14);
  11310.  
  11311. for(i=0; i<skills.Size(); i+=1)
  11312. {
  11313.  
  11314. if(GetSkillLevel(skills[i]) == 0)
  11315. {
  11316. AddSkill(skills[i]);
  11317. }
  11318.  
  11319. slot = GetFreeSkillSlot();
  11320.  
  11321.  
  11322. EquipSkill(skills[i], slot);
  11323. }
  11324. }
  11325.  
  11326. final function Debug_HAX_UnlockSkillSlot(slotIndex : int) : bool
  11327. {
  11328. if(abilityManager && abilityManager.IsInitialized())
  11329. return ((W3PlayerAbilityManager)abilityManager).Debug_HAX_UnlockSkillSlot(slotIndex);
  11330.  
  11331. return false;
  11332. }
  11333.  
  11334.  
  11335. public function GetLevelupAbility( id : int) : name
  11336. {
  11337. switch(id)
  11338. {
  11339. case 1: return 'Lvl1';
  11340. case 2: return 'Lvl2';
  11341. case 3: return 'Lvl3';
  11342. case 4: return 'Lvl4';
  11343. case 5: return 'Lvl5';
  11344. case 6: return 'Lvl6';
  11345. case 7: return 'Lvl7';
  11346. case 8: return 'Lvl8';
  11347. case 9: return 'Lvl9';
  11348. case 10: return 'Lvl10';
  11349. case 11: return 'Lvl11';
  11350. case 12: return 'Lvl12';
  11351. case 13: return 'Lvl13';
  11352. case 14: return 'Lvl14';
  11353. case 15: return 'Lvl15';
  11354. case 16: return 'Lvl16';
  11355. case 17: return 'Lvl17';
  11356. case 18: return 'Lvl18';
  11357. case 19: return 'Lvl19';
  11358. case 20: return 'Lvl20';
  11359. case 21: return 'Lvl21';
  11360. case 22: return 'Lvl22';
  11361. case 23: return 'Lvl23';
  11362. case 24: return 'Lvl24';
  11363. case 25: return 'Lvl25';
  11364. case 26: return 'Lvl26';
  11365. case 27: return 'Lvl27';
  11366. case 28: return 'Lvl28';
  11367. case 29: return 'Lvl29';
  11368. case 30: return 'Lvl30';
  11369. case 31: return 'Lvl31';
  11370. case 32: return 'Lvl32';
  11371. case 33: return 'Lvl33';
  11372. case 34: return 'Lvl34';
  11373. case 35: return 'Lvl35';
  11374. case 36: return 'Lvl36';
  11375. case 37: return 'Lvl37';
  11376. case 38: return 'Lvl38';
  11377. case 39: return 'Lvl39';
  11378. case 40: return 'Lvl40';
  11379. case 41: return 'Lvl41';
  11380. case 42: return 'Lvl42';
  11381. case 43: return 'Lvl43';
  11382. case 44: return 'Lvl44';
  11383. case 45: return 'Lvl45';
  11384. case 46: return 'Lvl46';
  11385. case 47: return 'Lvl47';
  11386. case 48: return 'Lvl48';
  11387. case 49: return 'Lvl49';
  11388. case 50: return 'Lvl50';
  11389.  
  11390. default: return '';
  11391. }
  11392.  
  11393. return '';
  11394. }
  11395.  
  11396. public function CanSprint( speed : float ) : bool
  11397. {
  11398. /*if( !super.CanSprint( speed ) )
  11399. {
  11400. return false;
  11401. } */ //modSings
  11402. if(theGame.GetEngineTimeAsSeconds() - blockSprintTimestamp < 2) //modSigns
  11403. {
  11404. return false;
  11405. }
  11406. if( rangedWeapon && rangedWeapon.GetCurrentStateName() != 'State_WeaponWait' )
  11407. {
  11408. if ( this.GetPlayerCombatStance() == PCS_AlertNear )
  11409. {
  11410. if ( IsSprintActionPressed() )
  11411. OnRangedForceHolster( true, false );
  11412. }
  11413. else
  11414. return false;
  11415. }
  11416. if( GetCurrentStateName() != 'Swimming' && GetStat(BCS_Stamina) <= 0 )
  11417. {
  11418. SetSprintActionPressed(false,true);
  11419. blockSprintTimestamp = theGame.GetEngineTimeAsSeconds(); //modSings
  11420. return false;
  11421. }
  11422.  
  11423. return super.CanSprint( speed ); //modSigns: moved here
  11424. }
  11425.  
  11426. var blockSprintTimestamp : float; //modSings
  11427.  
  11428. public function ManageSleeping()
  11429. {
  11430. thePlayer.RemoveBuffImmunity_AllCritical( 'Bed' );
  11431. thePlayer.RemoveBuffImmunity_AllNegative( 'Bed' );
  11432.  
  11433. thePlayer.PlayerStopAction( PEA_GoToSleep );
  11434. }
  11435.  
  11436.  
  11437.  
  11438. public function RestoreHorseManager() : bool
  11439. {
  11440. var horseTemplate : CEntityTemplate;
  11441. var horseManager : W3HorseManager;
  11442.  
  11443. if ( GetHorseManager() )
  11444. {
  11445. return false;
  11446. }
  11447.  
  11448. horseTemplate = (CEntityTemplate)LoadResource("horse_manager");
  11449. horseManager = (W3HorseManager)theGame.CreateEntity(horseTemplate, GetWorldPosition(),,,,,PM_Persist);
  11450. horseManager.CreateAttachment(this);
  11451. horseManager.OnCreated();
  11452. EntityHandleSet( horseManagerHandle, horseManager );
  11453.  
  11454. return true;
  11455. }
  11456.  
  11457.  
  11458.  
  11459.  
  11460.  
  11461.  
  11462. final function PerformParryCheck( parryInfo : SParryInfo ) : bool
  11463. {
  11464. if( super.PerformParryCheck( parryInfo ) )
  11465. {
  11466. //GainAdrenalineFromPerk21( 'parry' ); //modSigns
  11467. return true;
  11468. }
  11469. return false;
  11470. }
  11471.  
  11472. protected final function PerformCounterCheck( parryInfo: SParryInfo ) : bool
  11473. {
  11474. var fistFightCheck, isInFistFight : bool;
  11475.  
  11476. if( super.PerformCounterCheck( parryInfo ) )
  11477. {
  11478. //GainAdrenalineFromPerk21( 'counter' ); //modSigns
  11479.  
  11480. isInFistFight = FistFightCheck( parryInfo.target, parryInfo.attacker, fistFightCheck );
  11481.  
  11482. if( isInFistFight && fistFightCheck )
  11483. {
  11484. FactsAdd( "statistics_fist_fight_counter" );
  11485. AddTimer( 'FistFightCounterTimer', 0.5f, , , , true );
  11486. }
  11487.  
  11488. return true;
  11489. }
  11490. return false;
  11491. }
  11492.  
  11493. /*public function GainAdrenalineFromPerk21( n : name )
  11494. {
  11495. var perkStats, perkTime : SAbilityAttributeValue;
  11496. var targets : array<CActor>;
  11497.  
  11498. targets = GetHostileEnemies();
  11499.  
  11500. if( !CanUseSkill( S_Perk_21 ) || targets.Size() == 0 )
  11501. {
  11502. return;
  11503. }
  11504.  
  11505. perkTime = GetSkillAttributeValue( S_Perk_21, 'perk21Time', false, false );
  11506.  
  11507. if( theGame.GetEngineTimeAsSeconds() >= timeForPerk21 + perkTime.valueAdditive )
  11508. {
  11509. perkStats = GetSkillAttributeValue( S_Perk_21, n , false, false );
  11510. GainStat( BCS_Focus, perkStats.valueAdditive );
  11511. timeForPerk21 = theGame.GetEngineTimeAsSeconds();
  11512.  
  11513. AddEffectDefault( EET_Perk21InternalCooldown, this, "Perk21", false );
  11514. }
  11515. }*/ //modSigns
  11516.  
  11517. public function Perk21GainStamina(action : name) //modSigns
  11518. {
  11519. var min, max : SAbilityAttributeValue;
  11520.  
  11521. if(!HasBuff(EET_Perk21InternalCooldown) || action == 'kill')
  11522. {
  11523. switch(action)
  11524. {
  11525. case 'kill':
  11526. theGame.GetDefinitionsManager().GetAbilityAttributeValue('perk_21', 'stamina_kill', min, max);
  11527. GainStat(BCS_Stamina, min.valueMultiplicative * GetStatMax(BCS_Stamina));
  11528. break;
  11529. case 'crit':
  11530. case 'counter':
  11531. theGame.GetDefinitionsManager().GetAbilityAttributeValue('perk_21', 'stamina_other', min, max);
  11532. GainStat(BCS_Stamina, min.valueMultiplicative * GetStatMax(BCS_Stamina));
  11533. break;
  11534. default:
  11535. break;
  11536. }
  11537. AddEffectDefault(EET_Perk21InternalCooldown, this, "Perk21");
  11538. }
  11539. }
  11540.  
  11541. timer function FistFightCounterTimer( dt : float, id : int )
  11542. {
  11543. FactsRemove( "statistics_fist_fight_counter" );
  11544. }
  11545.  
  11546. public final function IsSignBlocked(signType : ESignType) : bool
  11547. {
  11548. switch( signType )
  11549. {
  11550. case ST_Aard :
  11551. return IsRadialSlotBlocked ( 'Aard');
  11552. break;
  11553. case ST_Axii :
  11554. return IsRadialSlotBlocked ( 'Axii');
  11555. break;
  11556. case ST_Igni :
  11557. return IsRadialSlotBlocked ( 'Igni');
  11558. break;
  11559. case ST_Quen :
  11560. return IsRadialSlotBlocked ( 'Quen');
  11561. break;
  11562. case ST_Yrden :
  11563. return IsRadialSlotBlocked ( 'Yrden');
  11564. break;
  11565. default:
  11566. break;
  11567. }
  11568. return false;
  11569.  
  11570. }
  11571.  
  11572. public final function AddAnItemWithAutogenLevelAndQuality(itemName : name, desiredLevel : int, minQuality : int, optional equipItem : bool)
  11573. {
  11574. var itemLevel, quality : int;
  11575. var ids : array<SItemUniqueId>;
  11576. var attemptCounter : int;
  11577.  
  11578. itemLevel = 0;
  11579. quality = 0;
  11580. attemptCounter = 0;
  11581. while(itemLevel != desiredLevel || quality < minQuality)
  11582. {
  11583. attemptCounter += 1;
  11584. ids.Clear();
  11585. ids = inv.AddAnItem(itemName, 1, true);
  11586. itemLevel = inv.GetItemLevel(ids[0]);
  11587. quality = RoundMath(CalculateAttributeValue(inv.GetItemAttributeValue(ids[0], 'quality')));
  11588.  
  11589.  
  11590. if(attemptCounter >= 1000)
  11591. break;
  11592.  
  11593. if(itemLevel != desiredLevel || quality < minQuality)
  11594. inv.RemoveItem(ids[0]);
  11595. }
  11596.  
  11597. if(equipItem)
  11598. EquipItem(ids[0]);
  11599. }
  11600.  
  11601. public final function AddAnItemWithAutogenLevel(itemName : name, desiredLevel : int)
  11602. {
  11603. var itemLevel : int;
  11604. var ids : array<SItemUniqueId>;
  11605. var attemptCounter : int;
  11606.  
  11607. itemLevel = 0;
  11608. while(itemLevel != desiredLevel)
  11609. {
  11610. attemptCounter += 1;
  11611. ids.Clear();
  11612. ids = inv.AddAnItem(itemName, 1, true);
  11613. itemLevel = inv.GetItemLevel(ids[0]);
  11614.  
  11615.  
  11616. if(attemptCounter >= 1000)
  11617. break;
  11618.  
  11619. if(itemLevel != desiredLevel)
  11620. inv.RemoveItem(ids[0]);
  11621. }
  11622. }
  11623.  
  11624. public final function AddAnItemWithMinQuality(itemName : name, minQuality : int, optional equip : bool)
  11625. {
  11626. var quality : int;
  11627. var ids : array<SItemUniqueId>;
  11628. var attemptCounter : int;
  11629.  
  11630. quality = 0;
  11631. while(quality < minQuality)
  11632. {
  11633. attemptCounter += 1;
  11634. ids.Clear();
  11635. ids = inv.AddAnItem(itemName, 1, true);
  11636. quality = RoundMath(CalculateAttributeValue(inv.GetItemAttributeValue(ids[0], 'quality')));
  11637.  
  11638.  
  11639. if(attemptCounter >= 1000)
  11640. break;
  11641.  
  11642. if(quality < minQuality)
  11643. inv.RemoveItem(ids[0]);
  11644. }
  11645.  
  11646. if(equip)
  11647. EquipItem(ids[0]);
  11648. }
  11649.  
  11650.  
  11651.  
  11652.  
  11653.  
  11654.  
  11655. //modSigns: fix equipped, only once
  11656. private function RecalcSetItemsEquipped()
  11657. {
  11658. var slotsToCheck : array<EEquipmentSlots>;
  11659. var setType : EItemSetType;
  11660. var item : SItemUniqueId;
  11661. var i : int;
  11662.  
  11663. for(i = 0; i < amountOfSetPiecesEquipped.Size(); i += 1)
  11664. amountOfSetPiecesEquipped[i] = 0;
  11665.  
  11666. slotsToCheck.PushBack(EES_Armor);
  11667. slotsToCheck.PushBack(EES_Boots);
  11668. slotsToCheck.PushBack(EES_Pants);
  11669. slotsToCheck.PushBack(EES_Gloves);
  11670. slotsToCheck.PushBack(EES_SilverSword);
  11671. slotsToCheck.PushBack(EES_SteelSword);
  11672.  
  11673. for(i = 0; i < slotsToCheck.Size(); i += 1)
  11674. {
  11675. if(GetItemEquippedOnSlot(slotsToCheck[i], item) && inv.ItemHasTag(item, 'SetBonusPiece'))
  11676. {
  11677. setType = CheckSetType( item );
  11678. amountOfSetPiecesEquipped[ setType ] += 1;
  11679. ManageSetBonusesSoundbanks( setType );
  11680. }
  11681. }
  11682. }
  11683.  
  11684. //modSigns: minor sets added
  11685. public function IsSetBonusActive( bonus : EItemSetBonus ) : bool
  11686. {
  11687. switch(bonus)
  11688. {
  11689. case EISB_Lynx_1:
  11690. return amountOfSetPiecesEquipped[ EIST_Lynx ] + amountOfSetPiecesEquipped[ EIST_Lynx_Minor ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  11691. case EISB_Lynx_2:
  11692. return amountOfSetPiecesEquipped[ EIST_Lynx ] >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS;
  11693. case EISB_Gryphon_1:
  11694. return amountOfSetPiecesEquipped[ EIST_Gryphon ] + amountOfSetPiecesEquipped[ EIST_Gryphon_Minor ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  11695. case EISB_Gryphon_2:
  11696. return amountOfSetPiecesEquipped[ EIST_Gryphon ] >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS;
  11697. case EISB_Bear_1:
  11698. return amountOfSetPiecesEquipped[ EIST_Bear ] + amountOfSetPiecesEquipped[ EIST_Bear_Minor ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  11699. case EISB_Bear_2:
  11700. return amountOfSetPiecesEquipped[ EIST_Bear ] >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS;
  11701. case EISB_Wolf_1:
  11702. return amountOfSetPiecesEquipped[ EIST_Wolf ] + amountOfSetPiecesEquipped[ EIST_Wolf_Minor ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  11703. case EISB_Wolf_2:
  11704. return amountOfSetPiecesEquipped[ EIST_Wolf ] >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS;
  11705. case EISB_RedWolf_1:
  11706. return amountOfSetPiecesEquipped[ EIST_RedWolf ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  11707. case EISB_RedWolf_2:
  11708. return amountOfSetPiecesEquipped[ EIST_RedWolf ] >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS;
  11709. case EISB_Vampire:
  11710. return amountOfSetPiecesEquipped[ EIST_Vampire ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  11711. //modSigns
  11712. case EISB_Viper:
  11713. return amountOfSetPiecesEquipped[ EIST_Viper ] >= GetNumItemsRequiredForSetActivation(EIST_Viper);
  11714. case EISB_KaerMorhen:
  11715. return amountOfSetPiecesEquipped[ EIST_KaerMorhen ] >= GetNumItemsRequiredForSetActivation(EIST_KaerMorhen);
  11716. default: return false;
  11717. }
  11718. }
  11719.  
  11720. //modSigns: minor sets
  11721. public function GetSetPartsEquipped( setType : EItemSetType ) : int
  11722. {
  11723. switch( setType )
  11724. {
  11725. case EIST_Lynx:
  11726. case EIST_Lynx_Minor:
  11727. return amountOfSetPiecesEquipped[ EIST_Lynx ] + amountOfSetPiecesEquipped[ EIST_Lynx_Minor ];
  11728. case EIST_Gryphon:
  11729. case EIST_Gryphon_Minor:
  11730. return amountOfSetPiecesEquipped[ EIST_Gryphon ] + amountOfSetPiecesEquipped[ EIST_Gryphon_Minor ];
  11731. case EIST_Bear:
  11732. case EIST_Bear_Minor:
  11733. return amountOfSetPiecesEquipped[ EIST_Bear ] + amountOfSetPiecesEquipped[ EIST_Bear_Minor ];
  11734. case EIST_Wolf:
  11735. case EIST_Wolf_Minor:
  11736. return amountOfSetPiecesEquipped[ EIST_Wolf ] + amountOfSetPiecesEquipped[ EIST_Wolf_Minor ];
  11737. default:
  11738. return amountOfSetPiecesEquipped[ setType ];
  11739. }
  11740. }
  11741.  
  11742. //modSigns
  11743. public function GetSetPartsEquippedRaw( setType : EItemSetType ) : int
  11744. {
  11745. return amountOfSetPiecesEquipped[ setType ];
  11746. }
  11747.  
  11748. //modSigns
  11749. public function HasMixedSetsEquipped() : bool
  11750. {
  11751. return amountOfSetPiecesEquipped[ EIST_Lynx ] > 0 && amountOfSetPiecesEquipped[ EIST_Lynx_Minor ] > 0 ||
  11752. amountOfSetPiecesEquipped[ EIST_Gryphon ] > 0 && amountOfSetPiecesEquipped[ EIST_Gryphon_Minor ] > 0 ||
  11753. amountOfSetPiecesEquipped[ EIST_Bear ] > 0 && amountOfSetPiecesEquipped[ EIST_Bear_Minor ] > 0 ||
  11754. amountOfSetPiecesEquipped[ EIST_Wolf ] > 0 && amountOfSetPiecesEquipped[ EIST_Wolf_Minor ] > 0;
  11755. }
  11756.  
  11757. protected function UpdateItemSetBonuses( item : SItemUniqueId, increment : bool )
  11758. {
  11759. var setType : EItemSetType;
  11760. var tutorialStateSets : W3TutorialManagerUIHandlerStateSetItemsUnlocked;
  11761. var id : SItemUniqueId;
  11762.  
  11763. if( !inv.IsIdValid( item ) || !inv.ItemHasTag(item, theGame.params.ITEM_SET_TAG_BONUS ) )
  11764. {
  11765.  
  11766. if( !IsSetBonusActive( EISB_Wolf_2 ) ) //modSigns
  11767. {
  11768. if( GetItemEquippedOnSlot( EES_SteelSword, id ) )
  11769. {
  11770. RemoveExtraOilsFromItem( id );
  11771. }
  11772. if( GetItemEquippedOnSlot( EES_SilverSword, id ) )
  11773. {
  11774. RemoveExtraOilsFromItem( id );
  11775. }
  11776. }
  11777.  
  11778. return;
  11779. }
  11780.  
  11781. setType = CheckSetType( item );
  11782.  
  11783. if( increment )
  11784. {
  11785. amountOfSetPiecesEquipped[ setType ] += 1;
  11786.  
  11787. //modSigns
  11788. if( GetSetPartsEquipped(setType) >= GetNumItemsRequiredForSetActivation(setType) && ShouldProcessTutorial( 'TutorialSetBonusesUnlocked' ) && theGame.GetTutorialSystem().uiHandler && theGame.GetTutorialSystem().uiHandler.GetCurrentStateName() == 'SetItemsUnlocked' )
  11789. {
  11790. tutorialStateSets = ( W3TutorialManagerUIHandlerStateSetItemsUnlocked )theGame.GetTutorialSystem().uiHandler.GetCurrentState();
  11791. tutorialStateSets.OnSetBonusCompleted();
  11792. }
  11793. }
  11794. else if( amountOfSetPiecesEquipped[ setType ] > 0 )
  11795. {
  11796. amountOfSetPiecesEquipped[ setType ] -= 1;
  11797. }
  11798.  
  11799.  
  11800. //modSigns
  11801. //if( setType < EIST_Viper && amountOfSetPiecesEquipped[ setType ] == theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS )
  11802. if( IsSetBonusActive(EISB_Lynx_2) || IsSetBonusActive(EISB_Gryphon_2) || IsSetBonusActive(EISB_Bear_2) || IsSetBonusActive(EISB_Wolf_2) || IsSetBonusActive(EISB_RedWolf_2) )
  11803. {
  11804. theGame.GetGamerProfile().AddAchievement( EA_ReadyToRoll );
  11805. }
  11806.  
  11807.  
  11808. if( !IsSetBonusActive( EISB_Wolf_2 ) ) //modSigns
  11809. {
  11810. if( GetItemEquippedOnSlot( EES_SteelSword, id ) )
  11811. {
  11812. RemoveExtraOilsFromItem( id );
  11813. }
  11814. if( GetItemEquippedOnSlot( EES_SilverSword, id ) )
  11815. {
  11816. RemoveExtraOilsFromItem( id );
  11817. }
  11818. }
  11819.  
  11820. ManageActiveSetBonuses( setType );
  11821.  
  11822.  
  11823. ManageSetBonusesSoundbanks( setType );
  11824. }
  11825.  
  11826. public function ManageActiveSetBonuses( setType : EItemSetType )
  11827. {
  11828. var l_i : int;
  11829.  
  11830.  
  11831. if( setType == EIST_Lynx || setType == EIST_Lynx_Minor ) //modSigns
  11832. {
  11833.  
  11834. if( HasBuff( EET_LynxSetBonus ) && !IsSetBonusActive( EISB_Lynx_1 ) )
  11835. {
  11836. RemoveBuff( EET_LynxSetBonus );
  11837. }
  11838. }
  11839.  
  11840. else if( setType == EIST_Gryphon )
  11841. {
  11842.  
  11843. if( !IsSetBonusActive( EISB_Gryphon_1 ) )
  11844. {
  11845. RemoveBuff( EET_GryphonSetBonus );
  11846. }
  11847.  
  11848. if( IsSetBonusActive( EISB_Gryphon_2 ) && !HasBuff( EET_GryphonSetBonusYrden ) )
  11849. {
  11850. for( l_i = 0 ; l_i < yrdenEntities.Size() ; l_i += 1 )
  11851. {
  11852. if( yrdenEntities[ l_i ].GetIsPlayerInside() && !yrdenEntities[ l_i ].IsAlternateCast() )
  11853. {
  11854. AddEffectDefault( EET_GryphonSetBonusYrden, this, "GryphonSetBonusYrden" );
  11855. break;
  11856. }
  11857. }
  11858. }
  11859. else
  11860. {
  11861. RemoveBuff( EET_GryphonSetBonusYrden );
  11862. }
  11863. }
  11864.  
  11865. //modSigns
  11866. else if( setType == EIST_KaerMorhen )
  11867. {
  11868. if( !IsSetBonusActive(EISB_KaerMorhen) && HasBuff(EET_KaerMorhenSetBonus) )
  11869. {
  11870. RemoveBuff(EET_KaerMorhenSetBonus);
  11871. }
  11872. else if( IsSetBonusActive(EISB_KaerMorhen) && !HasBuff(EET_KaerMorhenSetBonus) && IsInCombat() )
  11873. {
  11874. AddEffectDefault(EET_KaerMorhenSetBonus, this, "KaerMorhenSetBonus");
  11875. }
  11876. }
  11877. }
  11878.  
  11879. public function CheckSetTypeByName( itemName : name ) : EItemSetType
  11880. {
  11881. var dm : CDefinitionsManagerAccessor;
  11882.  
  11883. dm = theGame.GetDefinitionsManager();
  11884.  
  11885. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_LYNX ) )
  11886. {
  11887. return EIST_Lynx;
  11888. }
  11889. else
  11890. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_GRYPHON ) )
  11891. {
  11892. return EIST_Gryphon;
  11893. }
  11894. else
  11895. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_BEAR ) )
  11896. {
  11897. return EIST_Bear;
  11898. }
  11899. else
  11900. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_WOLF ) )
  11901. {
  11902. return EIST_Wolf;
  11903. }
  11904. else
  11905. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_RED_WOLF ) )
  11906. {
  11907. return EIST_RedWolf;
  11908. }
  11909. else
  11910. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_VAMPIRE ) )
  11911. {
  11912. return EIST_Vampire;
  11913. }
  11914. else
  11915. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_VIPER ) )
  11916. {
  11917. return EIST_Viper;
  11918. }
  11919. else
  11920. //modSigns
  11921. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_KAER_MORHEN ) )
  11922. {
  11923. return EIST_KaerMorhen;
  11924. }
  11925. else
  11926. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_LYNX_MINOR ) )
  11927. {
  11928. return EIST_Lynx_Minor;
  11929. }
  11930. else
  11931. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_GRYPHON_MINOR ) )
  11932. {
  11933. return EIST_Gryphon_Minor;
  11934. }
  11935. else
  11936. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_BEAR_MINOR ) )
  11937. {
  11938. return EIST_Bear_Minor;
  11939. }
  11940. else
  11941. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_WOLF_MINOR ) )
  11942. {
  11943. return EIST_Wolf_Minor;
  11944. }
  11945. else
  11946. {
  11947. return EIST_Undefined;
  11948. }
  11949. }
  11950.  
  11951. public function CheckSetType( item : SItemUniqueId ) : EItemSetType
  11952. {
  11953. var stopLoop : bool;
  11954. var tags : array<name>;
  11955. var i : int;
  11956. var setType : EItemSetType;
  11957.  
  11958. stopLoop = false;
  11959.  
  11960. inv.GetItemTags( item, tags );
  11961.  
  11962.  
  11963. for( i=0; i<tags.Size(); i+=1 )
  11964. {
  11965. switch( tags[i] )
  11966. {
  11967. case theGame.params.ITEM_SET_TAG_LYNX:
  11968. case theGame.params.ITEM_SET_TAG_GRYPHON:
  11969. case theGame.params.ITEM_SET_TAG_BEAR:
  11970. case theGame.params.ITEM_SET_TAG_WOLF:
  11971. case theGame.params.ITEM_SET_TAG_RED_WOLF:
  11972. case theGame.params.ITEM_SET_TAG_VAMPIRE:
  11973. case theGame.params.ITEM_SET_TAG_VIPER:
  11974. //modSigns
  11975. case theGame.params.ITEM_SET_TAG_KAER_MORHEN:
  11976. case theGame.params.ITEM_SET_TAG_LYNX_MINOR:
  11977. case theGame.params.ITEM_SET_TAG_GRYPHON_MINOR:
  11978. case theGame.params.ITEM_SET_TAG_BEAR_MINOR:
  11979. case theGame.params.ITEM_SET_TAG_WOLF_MINOR:
  11980. setType = SetItemNameToType( tags[i] );
  11981. stopLoop = true;
  11982. break;
  11983. }
  11984. if ( stopLoop )
  11985. {
  11986. break;
  11987. }
  11988. }
  11989.  
  11990. return setType;
  11991. }
  11992.  
  11993. public function GetSetBonusStatusByName( itemName : name, out desc1, desc2 : string, out isActive1, isActive2 : bool ) : EItemSetType
  11994. {
  11995. var setType : EItemSetType;
  11996.  
  11997. if( theGame.GetDLCManager().IsEP2Enabled() )
  11998. {
  11999. setType = CheckSetTypeByName( itemName );
  12000. SetBonusStatusByType( setType, desc1, desc2, isActive1, isActive2 );
  12001.  
  12002. return setType;
  12003. }
  12004. else
  12005. {
  12006. return EIST_Undefined;
  12007. }
  12008. }
  12009.  
  12010. public function GetSetBonusStatus( item : SItemUniqueId, out desc1, desc2 : string, out isActive1, isActive2 : bool ) : EItemSetType
  12011. {
  12012. var setType : EItemSetType;
  12013.  
  12014. if( theGame.GetDLCManager().IsEP2Enabled() )
  12015. {
  12016. setType = CheckSetType( item );
  12017. SetBonusStatusByType( setType, desc1, desc2, isActive1, isActive2 );
  12018.  
  12019. return setType;
  12020. }
  12021. else
  12022. {
  12023. return EIST_Undefined;
  12024. }
  12025. }
  12026.  
  12027. private function SetBonusStatusByType(setType : EItemSetType, out desc1, desc2 : string, out isActive1, isActive2 : bool):void
  12028. {
  12029. var setBonus : EItemSetBonus;
  12030.  
  12031. //modSigns
  12032. isActive1 = (GetSetPartsEquipped(setType) >= GetNumItemsRequiredForSetActivation(setType));
  12033. isActive2 = (amountOfSetPiecesEquipped[ setType ] >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS);
  12034.  
  12035. setBonus = ItemSetTypeToItemSetBonus( setType, 1 );
  12036. desc1 = GetSetBonusTooltipDescription( setBonus );
  12037.  
  12038. setBonus = ItemSetTypeToItemSetBonus( setType, 2 );
  12039. desc2 = GetSetBonusTooltipDescription( setBonus );
  12040. }
  12041.  
  12042. public function ItemSetTypeToItemSetBonus( setType : EItemSetType, nr : int ) : EItemSetBonus
  12043. {
  12044. var setBonus : EItemSetBonus;
  12045.  
  12046. if( nr == 1 )
  12047. {
  12048. switch( setType )
  12049. {
  12050. case EIST_Lynx: setBonus = EISB_Lynx_1; break;
  12051. case EIST_Gryphon: setBonus = EISB_Gryphon_1; break;
  12052. case EIST_Bear: setBonus = EISB_Bear_1; break;
  12053. case EIST_Wolf: setBonus = EISB_Wolf_1; break;
  12054. case EIST_RedWolf: setBonus = EISB_RedWolf_1; break;
  12055. case EIST_Vampire: setBonus = EISB_Vampire; break;
  12056. //modSigns
  12057. case EIST_Viper: setBonus = EISB_Viper; break;
  12058. case EIST_KaerMorhen: setBonus = EISB_KaerMorhen; break;
  12059. case EIST_Lynx_Minor: setBonus = EISB_Lynx_1; break;
  12060. case EIST_Gryphon_Minor: setBonus = EISB_Gryphon_1; break;
  12061. case EIST_Bear_Minor: setBonus = EISB_Bear_1; break;
  12062. case EIST_Wolf_Minor: setBonus = EISB_Wolf_1; break;
  12063. }
  12064. }
  12065. else
  12066. {
  12067. switch( setType )
  12068. {
  12069. case EIST_Lynx: setBonus = EISB_Lynx_2; break;
  12070. case EIST_Gryphon: setBonus = EISB_Gryphon_2; break;
  12071. case EIST_Bear: setBonus = EISB_Bear_2; break;
  12072. case EIST_Wolf: setBonus = EISB_Wolf_2; break;
  12073. case EIST_RedWolf: setBonus = EISB_RedWolf_2; break;
  12074. case EIST_Vampire: setBonus = EISB_Undefined; break;
  12075. //modSigns
  12076. case EIST_Viper: setBonus = EISB_Undefined; break;
  12077. case EIST_KaerMorhen: setBonus = EISB_Undefined; break;
  12078. case EIST_Lynx_Minor: setBonus = EISB_Undefined; break;
  12079. case EIST_Gryphon_Minor: setBonus = EISB_Undefined; break;
  12080. case EIST_Bear_Minor: setBonus = EISB_Undefined; break;
  12081. case EIST_Wolf_Minor: setBonus = EISB_Undefined; break;
  12082. }
  12083. }
  12084.  
  12085. return setBonus;
  12086. }
  12087.  
  12088. public function GetSetBonusTooltipDescription( bonus : EItemSetBonus ) : string
  12089. {
  12090. var finalString : string;
  12091. var arrString : array<string>;
  12092. var dm : CDefinitionsManagerAccessor;
  12093. var min, max : SAbilityAttributeValue;
  12094. var tempString : string;
  12095. var tmpVal : float; //modSigns
  12096.  
  12097. switch( bonus )
  12098. {
  12099. case EISB_Lynx_1: tempString = "skill_desc_lynx_set_ability1"; break;
  12100. case EISB_Lynx_2: tempString = "skill_desc_lynx_set_ability2"; break;
  12101. case EISB_Gryphon_1: tempString = "skill_desc_gryphon_set_ability1"; break;
  12102. case EISB_Gryphon_2: tempString = "skill_desc_gryphon_set_ability2"; break;
  12103. case EISB_Bear_1: tempString = "skill_desc_bear_set_ability1"; break;
  12104. case EISB_Bear_2: tempString = "skill_desc_bear_set_ability2"; break;
  12105. case EISB_Wolf_1: tempString = "skill_desc_wolf_set_ability1"; break;
  12106. case EISB_Wolf_2: tempString = "skill_desc_wolf_set_ability2"; break;
  12107. case EISB_RedWolf_1: tempString = "skill_desc_red_wolf_set_ability1"; break;
  12108. case EISB_RedWolf_2: tempString = "skill_desc_red_wolf_set_ability2"; break;
  12109. case EISB_Vampire: tempString = "skill_desc_vampire_set_ability1"; break;
  12110. //modSigns
  12111. case EISB_Viper: tempString = "skill_desc_viper_set_ability1"; break;
  12112. case EISB_KaerMorhen: tempString = "skill_desc_kaer_morhen_set_ability1"; break;
  12113. default: tempString = ""; break;
  12114. }
  12115.  
  12116. dm = theGame.GetDefinitionsManager();
  12117.  
  12118. switch( bonus )
  12119. {
  12120. case EISB_Lynx_1:
  12121. dm.GetAbilityAttributeValue( 'LynxSetBonusEffect', 'lynx_ap_boost', min, max );
  12122. arrString.PushBack( FloatToString( min.valueAdditive * 100 ) );
  12123. arrString.PushBack( FloatToString( min.valueAdditive * 100 * GetSetPartsEquipped( EIST_Lynx ) ) );
  12124. dm.GetAbilityAttributeValue( 'LynxSetBonusEffect', 'lynx_boost_max', min, max );
  12125. arrString.PushBack( FloatToString( min.valueAdditive * 100 ) );
  12126. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  12127. break;
  12128. case EISB_Lynx_2:
  12129. //modSigns: changed
  12130. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  12131. break;
  12132. case EISB_Gryphon_1:
  12133. //modSigns: new mechanic
  12134. dm.GetAbilityAttributeValue( 'GryphonSetBonusEffect', 'gryphon_tier1_bonus', min, max );
  12135. arrString.PushBack( FloatToString( min.valueAdditive * 100 ) );
  12136. arrString.PushBack( FloatToString( min.valueAdditive * 100 * GetSetPartsEquipped( EIST_Gryphon ) ) );
  12137. dm.GetAbilityAttributeValue( 'GryphonSetBonusEffect', 'duration', min, max );
  12138. arrString.PushBack( FloatToString( min.valueAdditive ) );
  12139. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  12140. break;
  12141. case EISB_Gryphon_2:
  12142. dm.GetAbilityAttributeValue( 'GryphonSetBonusYrdenEffect', 'trigger_scale', min, max );
  12143. arrString.PushBack( FloatToString( ( min.valueAdditive - 1 )* 100) );
  12144. //dm.GetAbilityAttributeValue( 'GryphonSetBonusYrdenEffect', 'staminaRegen', min, max ); //modSigns: removed
  12145. //arrString.PushBack( FloatToString( min.valueMultiplicative * 100) );
  12146. dm.GetAbilityAttributeValue( 'GryphonSetBonusYrdenEffect', 'spell_power', min, max );
  12147. arrString.PushBack( FloatToString( min.valueMultiplicative * 100) );
  12148. dm.GetAbilityAttributeValue( 'GryphonSetBonusYrdenEffect', 'slashing_resistance_perc', min, max );
  12149. arrString.PushBack( FloatToString( min.valueAdditive * 100) );
  12150. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  12151. break;
  12152. case EISB_Bear_1: //modSigns: full set redesign
  12153. dm.GetAbilityAttributeValue( 'setBonusAbilityBear_1', 'bonus_focus_gain', min, max );
  12154. arrString.PushBack( NoTrailZeros( CalculateAttributeValue(min) ) );
  12155. arrString.PushBack( NoTrailZeros( CalculateAttributeValue(min) * GetSetPartsEquipped( EIST_Bear ) ) );
  12156. dm.GetAbilityAttributeValue( 'setBonusAbilityBear_1', 'attack_power', min, max );
  12157. arrString.PushBack( NoTrailZeros( min.valueMultiplicative * 100 ) );
  12158. arrString.PushBack( NoTrailZeros( min.valueMultiplicative * 100 * GetSetPartsEquipped( EIST_Bear ) ) );
  12159. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  12160. break;
  12161. case EISB_Bear_2: //modSigns: full set redesign
  12162. dm.GetAbilityAttributeValue( 'setBonusAbilityBear_2', 'stamina_attack', min, max );
  12163. arrString.PushBack( NoTrailZeros( CalculateAttributeValue(min) * 100 ) );
  12164. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  12165. break;
  12166. //modSigns
  12167. case EISB_Wolf_1:
  12168. dm.GetAbilityAttributeValue( 'SetBonusAbilityWolf_1', 'per_piece_oil_bonus', min, max );
  12169. arrString.PushBack( RoundMath( CalculateAttributeValue(min) * 100 ) );
  12170. arrString.PushBack( RoundMath( CalculateAttributeValue(min) * 100 * GetSetPartsEquipped( EIST_Wolf ) ) );
  12171. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  12172. break;
  12173. case EISB_Wolf_2:
  12174. dm.GetAbilityAttributeValue( 'SetBonusAbilityWolf_2', 'per_oil_crit_chance_bonus', min, max );
  12175. arrString.PushBack( FloatToString( CalculateAttributeValue(min) * 100 ) );
  12176. dm.GetAbilityAttributeValue( 'SetBonusAbilityWolf_2', 'per_oil_crit_power_bonus', min, max );
  12177. arrString.PushBack( FloatToString( CalculateAttributeValue(min) * 100 ) );
  12178. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  12179. break;
  12180. case EISB_RedWolf_1:
  12181. dm.GetAbilityAttributeValue( 'setBonusAbilityRedWolf_1', 'per_redwolf_piece_crit_chance_bonus', min, max );
  12182. arrString.PushBack( FloatToString( CalculateAttributeValue(min) * 100 ) );
  12183. arrString.PushBack( FloatToString( CalculateAttributeValue(min) * 100 * GetSetPartsEquipped( EIST_RedWolf ) ) );
  12184. dm.GetAbilityAttributeValue( 'setBonusAbilityRedWolf_1', 'per_redwolf_piece_crit_power_bonus', min, max );
  12185. arrString.PushBack( FloatToString( CalculateAttributeValue(min) * 100 ) );
  12186. arrString.PushBack( FloatToString( CalculateAttributeValue(min) * 100 * GetSetPartsEquipped( EIST_RedWolf ) ) );
  12187. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  12188. break;
  12189. case EISB_RedWolf_2:
  12190. dm.GetAbilityAttributeValue( 'setBonusAbilityRedWolf_2', 'amount', min, max );
  12191. arrString.PushBack( FloatToString( min.valueAdditive ) );
  12192. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  12193. break;
  12194. case EISB_Vampire:
  12195. dm.GetAbilityAttributeValue( 'setBonusAbilityVampire', 'life_percent', min, max );
  12196. arrString.PushBack( FloatToString( min.valueAdditive ) );
  12197. arrString.PushBack( FloatToString( min.valueAdditive * GetSetPartsEquipped( EIST_Vampire ) ) );
  12198. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  12199. break;
  12200. //modSigns
  12201. case EISB_Viper:
  12202. dm.GetAbilityAttributeValue( 'setBonusAbilityViper_1', 'per_viper_piece_poison_healing_rate', min, max );
  12203. arrString.PushBack( FloatToString( CalculateAttributeValue(min) * 100 ) );
  12204. arrString.PushBack( FloatToString( CalculateAttributeValue(min) * 100 * GetSetPartsEquipped( EIST_Viper ) ) );
  12205. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  12206. break;
  12207. case EISB_KaerMorhen:
  12208. dm.GetAbilityAttributeValue( 'KaerMorhenSetBonusEffect', 'staminaRegen', min, max );
  12209. tmpVal = CalculateAttributeValue(min);
  12210. arrString.PushBack( FloatToString( tmpVal ) );
  12211. dm.GetAbilityAttributeValue( 'KaerMorhenSetBonusEffect', 'maxStacks', min, max );
  12212. arrString.PushBack( FloatToString( tmpVal * CalculateAttributeValue(min) ) );
  12213. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  12214. break;
  12215. default:
  12216. finalString = GetLocStringByKeyExtWithParams( tempString );
  12217. }
  12218.  
  12219. return finalString;
  12220. }
  12221.  
  12222. //modSigns
  12223. public function LoadCurrentSetBonusSoundbank()
  12224. {
  12225. if(IsSetBonusActive(EISB_Lynx_1) || IsSetBonusActive(EISB_Lynx_2))
  12226. {
  12227. LoadSetBonusSoundBank( "ep2_setbonus_lynx.bnk" );
  12228. }
  12229. if(IsSetBonusActive(EISB_Gryphon_1) || IsSetBonusActive(EISB_Gryphon_2))
  12230. {
  12231. LoadSetBonusSoundBank( "ep2_setbonus_gryphon.bnk" );
  12232. }
  12233. //if(IsSetBonusActive(EISB_Bear_1) || IsSetBonusActive(EISB_Bear_2))
  12234. //{
  12235. LoadSetBonusSoundBank( "ep2_setbonus_bear.bnk" );
  12236. //} //should always be loaded as it's used by regular Quen now!
  12237. }
  12238.  
  12239. public function ManageSetBonusesSoundbanks( setType : EItemSetType )
  12240. {
  12241. //modSigns
  12242. if( GetSetPartsEquipped(setType) >= GetNumItemsRequiredForSetActivation(setType) )
  12243. {
  12244. switch( setType )
  12245. {
  12246. case EIST_Lynx:
  12247. LoadSetBonusSoundBank( "ep2_setbonus_lynx.bnk" );
  12248. break;
  12249. case EIST_Gryphon:
  12250. LoadSetBonusSoundBank( "ep2_setbonus_gryphon.bnk" );
  12251. break;
  12252. case EIST_Bear:
  12253. LoadSetBonusSoundBank( "ep2_setbonus_bear.bnk" );
  12254. break;
  12255. }
  12256. }
  12257. else
  12258. {
  12259. switch( setType )
  12260. {
  12261. case EIST_Lynx:
  12262. UnloadSetBonusSoundBank( "ep2_setbonus_lynx.bnk" );
  12263. break;
  12264. case EIST_Gryphon:
  12265. UnloadSetBonusSoundBank( "ep2_setbonus_gryphon.bnk" );
  12266. break;
  12267. case EIST_Bear:
  12268. UnloadSetBonusSoundBank( "ep2_setbonus_bear.bnk" );
  12269. break;
  12270. }
  12271. }
  12272. }
  12273.  
  12274. public function VampiricSetAbilityRegeneration()
  12275. {
  12276. var healthMax : float;
  12277. var healthToReg : float;
  12278. var healthPrc : float; //modSigns
  12279. var min, max : SAbilityAttributeValue; //modSigns
  12280.  
  12281. healthMax = GetStatMax( BCS_Vitality );
  12282.  
  12283. //modSigns: whoever decided that assuming no one will ever change xml values
  12284. //should be thrown to harpies
  12285. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'setBonusAbilityVampire', 'life_percent', min, max );
  12286. healthPrc = min.valueAdditive;
  12287.  
  12288. healthToReg = ( healthPrc * GetSetPartsEquipped(EIST_Vampire) * healthMax ) / 100;
  12289.  
  12290. //PlayEffect('drain_energy_caretaker_shovel');
  12291. GainStat( BCS_Vitality, healthToReg );
  12292. }
  12293.  
  12294. private function LoadSetBonusSoundBank( bankName : string )
  12295. {
  12296. if( !theSound.SoundIsBankLoaded( bankName ) )
  12297. {
  12298. theSound.SoundLoadBank( bankName, true );
  12299. }
  12300. }
  12301.  
  12302. private function UnloadSetBonusSoundBank( bankName : string )
  12303. {
  12304. if( theSound.SoundIsBankLoaded( bankName ) )
  12305. {
  12306. theSound.SoundUnloadBank( bankName );
  12307. }
  12308. }
  12309.  
  12310. timer function BearSetBonusQuenReapply( dt : float, id : int )
  12311. {
  12312. var newQuen : W3QuenEntity;
  12313.  
  12314. newQuen = (W3QuenEntity)theGame.CreateEntity( GetSignTemplate( ST_Quen ), GetWorldPosition(), GetWorldRotation() );
  12315. newQuen.Init( signOwner, GetSignEntity( ST_Quen ), true );
  12316. newQuen.freeCast = true; //modSigns
  12317. newQuen.OnStarted();
  12318. newQuen.OnThrowing();
  12319. newQuen.OnEnded();
  12320.  
  12321. m_quenReappliedCount += 1;
  12322.  
  12323. RemoveTimer( 'BearSetBonusQuenReapply');
  12324. }
  12325.  
  12326. //modSigns: gryphon set tier 1 bonus
  12327. public function GetGryphonSetTier1Bonus() : float
  12328. {
  12329. var abl : SAbilityAttributeValue;
  12330.  
  12331. abl = GetAttributeValue( 'gryphon_tier1_bonus' );
  12332. return abl.valueAdditive * GetSetPartsEquipped( EIST_Gryphon );
  12333. }
  12334.  
  12335. //modSigns: griffin school perk bonus
  12336. public function GetPerk6StaminaCostReduction() : float
  12337. {
  12338. var abl : SAbilityAttributeValue;
  12339. var bonus : float;
  12340.  
  12341. abl = GetAttributeValue('perk_6_stamina_cost_reduction');
  12342. bonus = abl.valueMultiplicative;
  12343. bonus = ClampF(bonus, 0, 1);
  12344.  
  12345. //theGame.witcherLog.AddMessage("stamina reduction bonus: " + bonus);
  12346.  
  12347. return bonus;
  12348. }
  12349.  
  12350. //modSigns
  12351. timer function GiveStandAloneEP1Items(dt : float, timerId : int)
  12352. {
  12353. var items : array<SItemUniqueId>;
  12354.  
  12355. if( inv )
  12356. {
  12357. inv.GetAllItems(items);
  12358. if( items.Size() <= 0 )
  12359. return;
  12360. }
  12361. else
  12362. return;
  12363.  
  12364. StandaloneEp1_1();
  12365.  
  12366. FactsAdd("standalone_ep1_inv", 1);
  12367.  
  12368. RemoveTimer('GiveStandAloneEP1Items');
  12369. }
  12370.  
  12371. //modSigns
  12372. timer function GiveStandAloneEP2Items(dt : float, timerId : int)
  12373. {
  12374. var items : array<SItemUniqueId>;
  12375.  
  12376. if( inv )
  12377. {
  12378. inv.GetAllItems(items);
  12379. if( items.Size() <= 0 )
  12380. return;
  12381. }
  12382. else
  12383. return;
  12384.  
  12385. StandaloneEp2_1();
  12386.  
  12387. FactsAdd("standalone_ep2_inv", 1);
  12388.  
  12389. RemoveTimer('GiveStandAloneEP2Items');
  12390. }
  12391.  
  12392. public final function StandaloneEp1_1()
  12393. {
  12394. var i, inc, quantityLow, randLow, quantityMedium, randMedium, quantityHigh, randHigh, startingMoney : int;
  12395. var pam : W3PlayerAbilityManager;
  12396. var ids : array<SItemUniqueId>;
  12397. var STARTING_LEVEL : int;
  12398.  
  12399. FactsAdd("StandAloneEP1", 1);
  12400.  
  12401.  
  12402. inv.RemoveAllItems();
  12403.  
  12404.  
  12405. inv.AddAnItem('Illusion Medallion', 1, true, true, false);
  12406. inv.AddAnItem('q103_safe_conduct', 1, true, true, false);
  12407.  
  12408.  
  12409. theGame.GetGamerProfile().ClearAllAchievementsForEP1();
  12410.  
  12411.  
  12412. STARTING_LEVEL = 32;
  12413. inc = STARTING_LEVEL - GetLevel();
  12414. for(i=0; i<inc; i+=1)
  12415. {
  12416. levelManager.AddPoints(EExperiencePoint, levelManager.GetTotalExpForNextLevel() - levelManager.GetPointsTotal(EExperiencePoint), false);
  12417. }
  12418.  
  12419.  
  12420. levelManager.ResetCharacterDev();
  12421. pam = (W3PlayerAbilityManager)abilityManager;
  12422. if(pam)
  12423. {
  12424. pam.ResetCharacterDev();
  12425. }
  12426. levelManager.SetFreeSkillPoints(levelManager.GetLevel() - 1 + 11);
  12427.  
  12428.  
  12429. //modSigns
  12430. inv.AddAnItem('Greater mutagen red', 1);
  12431. inv.AddAnItem('Greater mutagen green', 1);
  12432. inv.AddAnItem('Greater mutagen blue', 1);
  12433. inv.AddAnItem('Mutagen red', 2);
  12434. inv.AddAnItem('Mutagen green', 2);
  12435. inv.AddAnItem('Mutagen blue', 2);
  12436. inv.AddAnItem('Lesser mutagen red', 2);
  12437. inv.AddAnItem('Lesser mutagen green', 2);
  12438. inv.AddAnItem('Lesser mutagen blue', 2);
  12439.  
  12440.  
  12441. startingMoney = 4000;
  12442. if(GetMoney() > startingMoney)
  12443. {
  12444. RemoveMoney(GetMoney() - startingMoney);
  12445. }
  12446. else
  12447. {
  12448. AddMoney( 4000 - GetMoney() );
  12449. }
  12450.  
  12451.  
  12452.  
  12453.  
  12454.  
  12455. ids.Clear();
  12456. ids = inv.AddAnItem('EP1 Standalone Starting Armor');
  12457. EquipItem(ids[0]);
  12458. ids.Clear();
  12459. ids = inv.AddAnItem('EP1 Standalone Starting Boots');
  12460. EquipItem(ids[0]);
  12461. ids.Clear();
  12462. ids = inv.AddAnItem('EP1 Standalone Starting Gloves');
  12463. EquipItem(ids[0]);
  12464. ids.Clear();
  12465. ids = inv.AddAnItem('EP1 Standalone Starting Pants');
  12466. EquipItem(ids[0]);
  12467.  
  12468.  
  12469. ids.Clear();
  12470. ids = inv.AddAnItem('EP1 Standalone Starting Steel Sword');
  12471. EquipItem(ids[0]);
  12472. ids.Clear();
  12473. ids = inv.AddAnItem('EP1 Standalone Starting Silver Sword');
  12474. EquipItem(ids[0]);
  12475.  
  12476.  
  12477. inv.AddAnItem('Torch', 1, true, true, false);
  12478.  
  12479.  
  12480. //modSigns
  12481. quantityLow = 1;
  12482. randLow = 2;
  12483. quantityMedium = 2;
  12484. randMedium = 2;
  12485. quantityHigh = 3;
  12486. randHigh = 2;
  12487.  
  12488. inv.AddAnItem('Alghoul bone marrow',quantityMedium+RandRange(randMedium));
  12489. inv.AddAnItem('Amethyst dust',quantityLow+RandRange(randLow));
  12490. inv.AddAnItem('Arachas eyes',quantityLow+RandRange(randLow));
  12491. inv.AddAnItem('Arachas venom',quantityLow+RandRange(randLow));
  12492. inv.AddAnItem('Basilisk hide',quantityLow+RandRange(randLow));
  12493. inv.AddAnItem('Basilisk venom',quantityLow+RandRange(randLow));
  12494. inv.AddAnItem('Berserker pelt',quantityLow+RandRange(randLow));
  12495. inv.AddAnItem('Coal',quantityHigh+RandRange(randHigh));
  12496. inv.AddAnItem('Cotton',quantityHigh+RandRange(randHigh));
  12497. inv.AddAnItem('Dark iron ingot',quantityLow+RandRange(randLow));
  12498. inv.AddAnItem('Dark iron ore',quantityLow+RandRange(randLow));
  12499. inv.AddAnItem('Diamond dust',quantityLow+RandRange(randLow));
  12500. inv.AddAnItem('Draconide leather',quantityLow+RandRange(randLow));
  12501. inv.AddAnItem('Drowned dead tongue',quantityLow+RandRange(randLow));
  12502. inv.AddAnItem('Drowner brain',quantityMedium+RandRange(randMedium));
  12503. inv.AddAnItem('Dwimeryte ingot',quantityLow+RandRange(randLow));
  12504. inv.AddAnItem('Dwimeryte ore',quantityLow+RandRange(randLow));
  12505. inv.AddAnItem('Emerald dust',quantityLow+RandRange(randLow));
  12506. inv.AddAnItem('Endriag chitin plates',quantityMedium+RandRange(randMedium));
  12507. inv.AddAnItem('Endriag embryo',quantityLow+RandRange(randLow));
  12508. inv.AddAnItem('Ghoul blood',quantityMedium+RandRange(randMedium));
  12509. inv.AddAnItem('Hag teeth',quantityMedium+RandRange(randMedium));
  12510. inv.AddAnItem('Hardened leather',quantityMedium+RandRange(randMedium));
  12511. inv.AddAnItem('Hardened timber',quantityMedium+RandRange(randMedium));
  12512. inv.AddAnItem('Harpy feathers',quantityMedium+RandRange(randMedium));
  12513. inv.AddAnItem('Iron ore',quantityHigh+RandRange(randHigh));
  12514. inv.AddAnItem('Leather straps',quantityHigh+RandRange(randHigh));
  12515. inv.AddAnItem('Leather',quantityHigh+RandRange(randHigh));
  12516. inv.AddAnItem('Linen',quantityMedium+RandRange(randMedium));
  12517. inv.AddAnItem('Meteorite ingot',quantityLow+RandRange(randLow));
  12518. inv.AddAnItem('Meteorite ore',quantityMedium+RandRange(randMedium));
  12519. inv.AddAnItem('Necrophage skin',quantityLow+RandRange(randLow));
  12520. inv.AddAnItem('Nekker blood',quantityHigh+RandRange(randHigh));
  12521. inv.AddAnItem('Nekker heart',quantityMedium+RandRange(randMedium));
  12522. inv.AddAnItem('Oil',quantityHigh+RandRange(randHigh));
  12523. inv.AddAnItem('Phosphorescent crystal',quantityLow+RandRange(randLow));
  12524. inv.AddAnItem('Pure silver',quantityMedium+RandRange(randMedium));
  12525. inv.AddAnItem('Rotfiend blood',quantityMedium+RandRange(randMedium));
  12526. inv.AddAnItem('Sapphire dust',quantityLow+RandRange(randLow));
  12527. inv.AddAnItem('Silk',quantityHigh+RandRange(randHigh));
  12528. inv.AddAnItem('Silver ingot',quantityMedium+RandRange(randMedium));
  12529. inv.AddAnItem('Silver ore',quantityHigh+RandRange(randHigh));
  12530. inv.AddAnItem('Specter dust',quantityMedium+RandRange(randMedium));
  12531. inv.AddAnItem('Steel ingot',quantityHigh+RandRange(randHigh));
  12532. inv.AddAnItem('String',quantityHigh+RandRange(randHigh));
  12533. inv.AddAnItem('Thread',quantityHigh+RandRange(randHigh));
  12534. inv.AddAnItem('Timber',quantityHigh+RandRange(randHigh));
  12535. inv.AddAnItem('Twine',quantityMedium+RandRange(randMedium));
  12536. inv.AddAnItem('Venom extract',quantityMedium+RandRange(randMedium));
  12537. inv.AddAnItem('Water essence',quantityMedium+RandRange(randMedium));
  12538. inv.AddAnItem('Wolf liver',quantityHigh+RandRange(randHigh));
  12539. inv.AddAnItem('Alcohest', 3);
  12540. inv.AddAnItem('Dwarven spirit', 4);
  12541.  
  12542.  
  12543. ids.Clear();
  12544. ids = inv.AddAnItem('Crossbow 5');
  12545. EquipItem(ids[0]);
  12546. ids.Clear();
  12547. ids = inv.AddAnItem('Blunt Bolt', 20);
  12548. EquipItem(ids[0]);
  12549. inv.AddAnItem('Broadhead Bolt', 20);
  12550. inv.AddAnItem('Split Bolt', 20);
  12551.  
  12552.  
  12553. RemoveAllAlchemyRecipes();
  12554. RemoveAllCraftingSchematics();
  12555.  
  12556.  
  12557.  
  12558.  
  12559. AddAlchemyRecipe('Recipe for Cat 1');
  12560.  
  12561.  
  12562.  
  12563. AddAlchemyRecipe('Recipe for Maribor Forest 1');
  12564. AddAlchemyRecipe('Recipe for Petris Philtre 1');
  12565. AddAlchemyRecipe('Recipe for Swallow 1');
  12566. AddAlchemyRecipe('Recipe for Tawny Owl 1');
  12567.  
  12568. AddAlchemyRecipe('Recipe for White Gull 1');
  12569. AddAlchemyRecipe('Recipe for White Honey 1');
  12570. AddAlchemyRecipe('Recipe for White Raffards Decoction 1');
  12571.  
  12572.  
  12573.  
  12574. AddAlchemyRecipe('Recipe for Beast Oil 1');
  12575. AddAlchemyRecipe('Recipe for Cursed Oil 1');
  12576. AddAlchemyRecipe('Recipe for Hanged Man Venom 1');
  12577. AddAlchemyRecipe('Recipe for Hybrid Oil 1');
  12578. AddAlchemyRecipe('Recipe for Insectoid Oil 1');
  12579. AddAlchemyRecipe('Recipe for Magicals Oil 1');
  12580. AddAlchemyRecipe('Recipe for Necrophage Oil 1');
  12581. AddAlchemyRecipe('Recipe for Specter Oil 1');
  12582. AddAlchemyRecipe('Recipe for Vampire Oil 1');
  12583. AddAlchemyRecipe('Recipe for Draconide Oil 1');
  12584. AddAlchemyRecipe('Recipe for Ogre Oil 1');
  12585. AddAlchemyRecipe('Recipe for Relic Oil 1');
  12586. AddAlchemyRecipe('Recipe for Beast Oil 2');
  12587. AddAlchemyRecipe('Recipe for Cursed Oil 2');
  12588. AddAlchemyRecipe('Recipe for Hanged Man Venom 2');
  12589. AddAlchemyRecipe('Recipe for Hybrid Oil 2');
  12590. AddAlchemyRecipe('Recipe for Insectoid Oil 2');
  12591. AddAlchemyRecipe('Recipe for Magicals Oil 2');
  12592. AddAlchemyRecipe('Recipe for Necrophage Oil 2');
  12593. AddAlchemyRecipe('Recipe for Specter Oil 2');
  12594. AddAlchemyRecipe('Recipe for Vampire Oil 2');
  12595. AddAlchemyRecipe('Recipe for Draconide Oil 2');
  12596. AddAlchemyRecipe('Recipe for Ogre Oil 2');
  12597. AddAlchemyRecipe('Recipe for Relic Oil 2');
  12598.  
  12599.  
  12600. AddAlchemyRecipe('Recipe for Dancing Star 1');
  12601.  
  12602. AddAlchemyRecipe('Recipe for Dwimeritum Bomb 1');
  12603.  
  12604. AddAlchemyRecipe('Recipe for Grapeshot 1');
  12605. AddAlchemyRecipe('Recipe for Samum 1');
  12606.  
  12607. AddAlchemyRecipe('Recipe for White Frost 1');
  12608.  
  12609.  
  12610.  
  12611. AddAlchemyRecipe('Recipe for Dwarven spirit 1');
  12612. AddAlchemyRecipe('Recipe for Alcohest 1');
  12613. AddAlchemyRecipe('Recipe for White Gull 1');
  12614.  
  12615.  
  12616. AddStartingSchematics();
  12617.  
  12618.  
  12619. ids.Clear();
  12620. ids = inv.AddAnItem('Swallow 2');
  12621. EquipItem(ids[0]);
  12622. ids.Clear();
  12623. ids = inv.AddAnItem('Thunderbolt 2');
  12624. EquipItem(ids[0]);
  12625. ids.Clear();
  12626. ids = inv.AddAnItem('Tawny Owl 2');
  12627. EquipItem(ids[0]);
  12628. ids.Clear();
  12629.  
  12630. ids = inv.AddAnItem('Grapeshot 2');
  12631. EquipItem(ids[0]);
  12632. ids.Clear();
  12633. ids = inv.AddAnItem('Samum 2');
  12634. EquipItem(ids[0]);
  12635.  
  12636. inv.AddAnItem('Dwimeritum Bomb 1');
  12637. inv.AddAnItem('Dragons Dream 1');
  12638. inv.AddAnItem('Silver Dust Bomb 1');
  12639. inv.AddAnItem('White Frost 2');
  12640. inv.AddAnItem('Devils Puffball 2');
  12641. inv.AddAnItem('Dancing Star 2');
  12642. inv.AddAnItem('Beast Oil 1');
  12643. inv.AddAnItem('Cursed Oil 1');
  12644. inv.AddAnItem('Hanged Man Venom 2');
  12645. inv.AddAnItem('Hybrid Oil 1');
  12646. inv.AddAnItem('Insectoid Oil 1');
  12647. inv.AddAnItem('Magicals Oil 1');
  12648. inv.AddAnItem('Necrophage Oil 2');
  12649. inv.AddAnItem('Specter Oil 1');
  12650. inv.AddAnItem('Vampire Oil 1');
  12651. inv.AddAnItem('Draconide Oil 1');
  12652. inv.AddAnItem('Relic Oil 1');
  12653. inv.AddAnItem('Black Blood 1');
  12654. inv.AddAnItem('Blizzard 1');
  12655. inv.AddAnItem('Cat 2');
  12656. inv.AddAnItem('Full Moon 1');
  12657. inv.AddAnItem('Maribor Forest 1');
  12658. inv.AddAnItem('Petris Philtre 1');
  12659. inv.AddAnItem('White Gull 1', 2);
  12660. inv.AddAnItem('White Honey 2');
  12661. inv.AddAnItem('White Raffards Decoction 1');
  12662.  
  12663.  
  12664. inv.AddAnItem('Mutagen 17');
  12665. inv.AddAnItem('Mutagen 19');
  12666. inv.AddAnItem('Mutagen 27');
  12667. inv.AddAnItem('Mutagen 26');
  12668.  
  12669.  
  12670. inv.AddAnItem('weapon_repair_kit_1', 3);
  12671. inv.AddAnItem('weapon_repair_kit_2', 2);
  12672. inv.AddAnItem('armor_repair_kit_1', 3);
  12673. inv.AddAnItem('armor_repair_kit_2', 2);
  12674.  
  12675.  
  12676. quantityMedium = 1;
  12677. quantityLow = 1;
  12678. inv.AddAnItem('Rune stribog lesser', quantityMedium);
  12679. inv.AddAnItem('Rune stribog', quantityLow);
  12680. inv.AddAnItem('Rune dazhbog lesser', quantityMedium);
  12681. inv.AddAnItem('Rune dazhbog', quantityLow);
  12682. inv.AddAnItem('Rune devana lesser', quantityMedium);
  12683. inv.AddAnItem('Rune devana', quantityLow);
  12684. inv.AddAnItem('Rune zoria lesser', quantityMedium);
  12685. inv.AddAnItem('Rune zoria', quantityLow);
  12686. inv.AddAnItem('Rune morana lesser', quantityMedium);
  12687. inv.AddAnItem('Rune morana', quantityLow);
  12688. inv.AddAnItem('Rune triglav lesser', quantityMedium);
  12689. inv.AddAnItem('Rune triglav', quantityLow);
  12690. inv.AddAnItem('Rune svarog lesser', quantityMedium);
  12691. inv.AddAnItem('Rune svarog', quantityLow);
  12692. inv.AddAnItem('Rune veles lesser', quantityMedium);
  12693. inv.AddAnItem('Rune veles', quantityLow);
  12694. inv.AddAnItem('Rune perun lesser', quantityMedium);
  12695. inv.AddAnItem('Rune perun', quantityLow);
  12696. inv.AddAnItem('Rune elemental lesser', quantityMedium);
  12697. inv.AddAnItem('Rune elemental', quantityLow);
  12698.  
  12699. inv.AddAnItem('Glyph aard lesser', quantityMedium);
  12700. inv.AddAnItem('Glyph aard', quantityLow);
  12701. inv.AddAnItem('Glyph axii lesser', quantityMedium);
  12702. inv.AddAnItem('Glyph axii', quantityLow);
  12703. inv.AddAnItem('Glyph igni lesser', quantityMedium);
  12704. inv.AddAnItem('Glyph igni', quantityLow);
  12705. inv.AddAnItem('Glyph quen lesser', quantityMedium);
  12706. inv.AddAnItem('Glyph quen', quantityLow);
  12707. inv.AddAnItem('Glyph yrden lesser', quantityMedium);
  12708. inv.AddAnItem('Glyph yrden', quantityLow);
  12709.  
  12710.  
  12711. StandaloneEp1_2();
  12712. }
  12713.  
  12714. public final function StandaloneEp1_2()
  12715. {
  12716. var horseId : SItemUniqueId;
  12717. var ids : array<SItemUniqueId>;
  12718. var ents : array< CJournalBase >;
  12719. var i : int;
  12720. var manager : CWitcherJournalManager;
  12721.  
  12722.  
  12723. inv.AddAnItem( 'Cows milk', 5 );
  12724. ids.Clear();
  12725. ids = inv.AddAnItem( 'Dumpling', 5 );
  12726. EquipItem(ids[0]);
  12727.  
  12728.  
  12729. inv.AddAnItem('Clearing Potion', 2, true, false, false);
  12730.  
  12731.  
  12732. GetHorseManager().RemoveAllItems();
  12733.  
  12734. ids.Clear();
  12735. ids = inv.AddAnItem('Horse Bag 2');
  12736. horseId = GetHorseManager().MoveItemToHorse(ids[0]);
  12737. GetHorseManager().EquipItem(horseId);
  12738.  
  12739. ids.Clear();
  12740. ids = inv.AddAnItem('Horse Blinder 2');
  12741. horseId = GetHorseManager().MoveItemToHorse(ids[0]);
  12742. GetHorseManager().EquipItem(horseId);
  12743.  
  12744. ids.Clear();
  12745. ids = inv.AddAnItem('Horse Saddle 2');
  12746. horseId = GetHorseManager().MoveItemToHorse(ids[0]);
  12747. GetHorseManager().EquipItem(horseId);
  12748.  
  12749. manager = theGame.GetJournalManager();
  12750.  
  12751.  
  12752. manager.GetActivatedOfType( 'CJournalCreature', ents );
  12753. for(i=0; i<ents.Size(); i+=1)
  12754. {
  12755. manager.ActivateEntry(ents[i], JS_Inactive, false, true);
  12756. }
  12757.  
  12758.  
  12759. ents.Clear();
  12760. manager.GetActivatedOfType( 'CJournalCharacter', ents );
  12761. for(i=0; i<ents.Size(); i+=1)
  12762. {
  12763. manager.ActivateEntry(ents[i], JS_Inactive, false, true);
  12764. }
  12765.  
  12766.  
  12767. ents.Clear();
  12768. manager.GetActivatedOfType( 'CJournalQuest', ents );
  12769. for(i=0; i<ents.Size(); i+=1)
  12770. {
  12771.  
  12772. if( StrStartsWith(ents[i].baseName, "q60"))
  12773. continue;
  12774.  
  12775. manager.ActivateEntry(ents[i], JS_Inactive, false, true);
  12776. }
  12777.  
  12778.  
  12779. manager.ActivateEntryByScriptTag('TutorialAard', JS_Active);
  12780. manager.ActivateEntryByScriptTag('TutorialAdrenaline', JS_Active);
  12781. manager.ActivateEntryByScriptTag('TutorialAxii', JS_Active);
  12782. manager.ActivateEntryByScriptTag('TutorialAxiiDialog', JS_Active);
  12783. manager.ActivateEntryByScriptTag('TutorialCamera', JS_Active);
  12784. manager.ActivateEntryByScriptTag('TutorialCamera_pad', JS_Active);
  12785. manager.ActivateEntryByScriptTag('TutorialCiriBlink', JS_Active);
  12786. manager.ActivateEntryByScriptTag('TutorialCiriCharge', JS_Active);
  12787. manager.ActivateEntryByScriptTag('TutorialCiriStamina', JS_Active);
  12788. manager.ActivateEntryByScriptTag('TutorialCounter', JS_Active);
  12789. manager.ActivateEntryByScriptTag('TutorialDialogClose', JS_Active);
  12790. manager.ActivateEntryByScriptTag('TutorialFallingRoll', JS_Active);
  12791. manager.ActivateEntryByScriptTag('TutorialFocus', JS_Active);
  12792. manager.ActivateEntryByScriptTag('TutorialFocusClues', JS_Active);
  12793. manager.ActivateEntryByScriptTag('TutorialFocusClues', JS_Active);
  12794. manager.ActivateEntryByScriptTag('TutorialHorseRoad', JS_Active);
  12795. manager.ActivateEntryByScriptTag('TutorialHorseSpeed0', JS_Active);
  12796. manager.ActivateEntryByScriptTag('TutorialHorseSpeed0_pad', JS_Active);
  12797. manager.ActivateEntryByScriptTag('TutorialHorseSpeed1', JS_Active);
  12798. manager.ActivateEntryByScriptTag('TutorialHorseSpeed2', JS_Active);
  12799. manager.ActivateEntryByScriptTag('TutorialHorseSummon', JS_Active);
  12800. manager.ActivateEntryByScriptTag('TutorialHorseSummon_pad', JS_Active);
  12801. manager.ActivateEntryByScriptTag('TutorialIgni', JS_Active);
  12802. manager.ActivateEntryByScriptTag('TutorialJournalAlternateSings', JS_Active);
  12803. manager.ActivateEntryByScriptTag('TutorialJournalBoatDamage', JS_Active);
  12804. manager.ActivateEntryByScriptTag('TutorialJournalBoatMount', JS_Active);
  12805. manager.ActivateEntryByScriptTag('TutorialJournalBuffs', JS_Active);
  12806. manager.ActivateEntryByScriptTag('TutorialJournalCharDevLeveling', JS_Active);
  12807. manager.ActivateEntryByScriptTag('TutorialJournalCharDevSkills', JS_Active);
  12808. manager.ActivateEntryByScriptTag('TutorialJournalCrafting', JS_Active);
  12809. manager.ActivateEntryByScriptTag('TutorialJournalCrossbow', JS_Active);
  12810. manager.ActivateEntryByScriptTag('TutorialJournalDialogGwint', JS_Active);
  12811. manager.ActivateEntryByScriptTag('TutorialJournalDialogShop', JS_Active);
  12812. manager.ActivateEntryByScriptTag('TutorialJournalDive', JS_Active);
  12813. manager.ActivateEntryByScriptTag('TutorialJournalDodge', JS_Active);
  12814. manager.ActivateEntryByScriptTag('TutorialJournalDodge_pad', JS_Active);
  12815. manager.ActivateEntryByScriptTag('TutorialJournalDrawWeapon', JS_Active);
  12816. manager.ActivateEntryByScriptTag('TutorialJournalDrawWeapon_pad', JS_Active);
  12817. manager.ActivateEntryByScriptTag('TutorialJournalDurability', JS_Active);
  12818. manager.ActivateEntryByScriptTag('TutorialJournalExplorations', JS_Active);
  12819. manager.ActivateEntryByScriptTag('TutorialJournalExplorations_pad', JS_Active);
  12820. manager.ActivateEntryByScriptTag('TutorialJournalFastTravel', JS_Active);
  12821. manager.ActivateEntryByScriptTag('TutorialJournalFocusRedObjects', JS_Active);
  12822. manager.ActivateEntryByScriptTag('TutorialJournalGasClouds', JS_Active);
  12823. manager.ActivateEntryByScriptTag('TutorialJournalHeavyAttacks', JS_Active);
  12824. manager.ActivateEntryByScriptTag('TutorialJournalHorse', JS_Active);
  12825. manager.ActivateEntryByScriptTag('TutorialJournalHorseStamina', JS_Active);
  12826. manager.ActivateEntryByScriptTag('TutorialJournalJump', JS_Active);
  12827. manager.ActivateEntryByScriptTag('TutorialJournalLightAttacks', JS_Active);
  12828. manager.ActivateEntryByScriptTag('TutorialJournalLightAttacks_pad', JS_Active);
  12829. manager.ActivateEntryByScriptTag('TutorialJournalMeditation', JS_Active);
  12830. manager.ActivateEntryByScriptTag('TutorialJournalMeditation_pad', JS_Active);
  12831. manager.ActivateEntryByScriptTag('TutorialJournalMonsterThreatLevels', JS_Active);
  12832. manager.ActivateEntryByScriptTag('TutorialJournalMovement', JS_Active);
  12833. manager.ActivateEntryByScriptTag('TutorialJournalMovement_pad', JS_Active);
  12834. manager.ActivateEntryByScriptTag('TutorialJournalMutagenIngredient', JS_Active);
  12835. manager.ActivateEntryByScriptTag('TutorialJournalMutagenPotion', JS_Active);
  12836. manager.ActivateEntryByScriptTag('TutorialJournalOils', JS_Active);
  12837. manager.ActivateEntryByScriptTag('TutorialJournalPetards', JS_Active);
  12838. manager.ActivateEntryByScriptTag('TutorialJournalPotions', JS_Active);
  12839. manager.ActivateEntryByScriptTag('TutorialJournalPotions_pad', JS_Active);
  12840. manager.ActivateEntryByScriptTag('TutorialJournalQuestArea', JS_Active);
  12841. manager.ActivateEntryByScriptTag('TutorialJournalRadial', JS_Active);
  12842. manager.ActivateEntryByScriptTag('TutorialJournalRifts', JS_Active);
  12843. manager.ActivateEntryByScriptTag('TutorialJournalRun', JS_Active);
  12844. manager.ActivateEntryByScriptTag('TutorialJournalShopDescription', JS_Active);
  12845. manager.ActivateEntryByScriptTag('TutorialJournalSignCast', JS_Active);
  12846. manager.ActivateEntryByScriptTag('TutorialJournalSignCast_pad', JS_Active);
  12847. manager.ActivateEntryByScriptTag('TutorialJournalSpecialAttacks', JS_Active);
  12848. manager.ActivateEntryByScriptTag('TutorialJournalStaminaExploration', JS_Active);
  12849. manager.ActivateEntryByScriptTag('TutorialJumpHang', JS_Active);
  12850. manager.ActivateEntryByScriptTag('TutorialLadder', JS_Active);
  12851. manager.ActivateEntryByScriptTag('TutorialLadderMove', JS_Active);
  12852. manager.ActivateEntryByScriptTag('TutorialLadderMove_pad', JS_Active);
  12853. manager.ActivateEntryByScriptTag('TutorialObjectiveSwitching', JS_Active);
  12854. manager.ActivateEntryByScriptTag('TutorialOxygen', JS_Active);
  12855. manager.ActivateEntryByScriptTag('TutorialParry', JS_Active);
  12856. manager.ActivateEntryByScriptTag('TutorialPOIUncovered', JS_Active);
  12857. manager.ActivateEntryByScriptTag('TutorialQuen', JS_Active);
  12858. manager.ActivateEntryByScriptTag('TutorialRoll', JS_Active);
  12859. manager.ActivateEntryByScriptTag('TutorialRoll_pad', JS_Active);
  12860. manager.ActivateEntryByScriptTag('TutorialSpeedPairing', JS_Active);
  12861. manager.ActivateEntryByScriptTag('TutorialSprint', JS_Active);
  12862. manager.ActivateEntryByScriptTag('TutorialStaminaSigns', JS_Active);
  12863. manager.ActivateEntryByScriptTag('TutorialStealing', JS_Active);
  12864. manager.ActivateEntryByScriptTag('TutorialSwimmingSpeed', JS_Active);
  12865. manager.ActivateEntryByScriptTag('TutorialTimedChoiceDialog', JS_Active);
  12866. manager.ActivateEntryByScriptTag('TutorialYrden', JS_Active);
  12867.  
  12868.  
  12869. FactsAdd('kill_base_tutorials');
  12870.  
  12871.  
  12872. theGame.GetTutorialSystem().RemoveAllQueuedTutorials();
  12873.  
  12874. if( FactsQuerySum("standalone_ep1") < 1 ) //modSigns
  12875. FactsAdd("standalone_ep1");
  12876. FactsRemove("StandAloneEP1");
  12877.  
  12878. theGame.GetJournalManager().ForceUntrackingQuestForEP1Savegame();
  12879. }
  12880.  
  12881. final function Debug_FocusBoyFocusGain()
  12882. {
  12883. var focusGain : float;
  12884.  
  12885. focusGain = FactsQuerySum( "debug_fact_focus_boy" ) ;
  12886. GainStat( BCS_Focus, focusGain );
  12887. }
  12888.  
  12889. public final function StandaloneEp2_1()
  12890. {
  12891. var i, inc, quantityLow, randLow, quantityMedium, randMedium, quantityHigh, randHigh, startingMoney : int;
  12892. var pam : W3PlayerAbilityManager;
  12893. var ids : array<SItemUniqueId>;
  12894. var STARTING_LEVEL : int;
  12895.  
  12896. FactsAdd( "StandAloneEP2", 1 );
  12897.  
  12898.  
  12899. inv.RemoveAllItems();
  12900.  
  12901.  
  12902. inv.AddAnItem( 'Illusion Medallion', 1, true, true, false );
  12903. inv.AddAnItem( 'q103_safe_conduct', 1, true, true, false );
  12904.  
  12905.  
  12906. theGame.GetGamerProfile().ClearAllAchievementsForEP2();
  12907.  
  12908.  
  12909. levelManager.Hack_EP2StandaloneLevelShrink( 35 );
  12910.  
  12911.  
  12912. levelManager.ResetCharacterDev();
  12913. pam = ( W3PlayerAbilityManager )abilityManager;
  12914. if( pam )
  12915. {
  12916. pam.ResetCharacterDev();
  12917. }
  12918. levelManager.SetFreeSkillPoints( levelManager.GetLevel() - 1 + 11 );
  12919.  
  12920.  
  12921. //modSigns
  12922. inv.AddAnItem('Greater mutagen red', 1);
  12923. inv.AddAnItem('Greater mutagen green', 1);
  12924. inv.AddAnItem('Greater mutagen blue', 1);
  12925. inv.AddAnItem('Mutagen red', 2);
  12926. inv.AddAnItem('Mutagen green', 2);
  12927. inv.AddAnItem('Mutagen blue', 2);
  12928. inv.AddAnItem('Lesser mutagen red', 2);
  12929. inv.AddAnItem('Lesser mutagen green', 2);
  12930. inv.AddAnItem('Lesser mutagen blue', 2);
  12931.  
  12932.  
  12933. startingMoney = 5000;
  12934. if( GetMoney() > startingMoney )
  12935. {
  12936. RemoveMoney( GetMoney() - startingMoney );
  12937. }
  12938. else
  12939. {
  12940. AddMoney( 5000 - GetMoney() );
  12941. }
  12942.  
  12943.  
  12944. ids.Clear();
  12945. ids = inv.AddAnItem( 'EP2 Standalone Starting Armor' );
  12946. EquipItem( ids[0] );
  12947. ids.Clear();
  12948. ids = inv.AddAnItem( 'EP2 Standalone Starting Boots' );
  12949. EquipItem( ids[0] );
  12950. ids.Clear();
  12951. ids = inv.AddAnItem( 'EP2 Standalone Starting Gloves' );
  12952. EquipItem( ids[0] );
  12953. ids.Clear();
  12954. ids = inv.AddAnItem( 'EP2 Standalone Starting Pants' );
  12955. EquipItem( ids[0] );
  12956.  
  12957.  
  12958. ids.Clear();
  12959. ids = inv.AddAnItem( 'EP2 Standalone Starting Steel Sword' );
  12960. EquipItem( ids[0] );
  12961. ids.Clear();
  12962. ids = inv.AddAnItem( 'EP2 Standalone Starting Silver Sword' );
  12963. EquipItem( ids[0] );
  12964.  
  12965.  
  12966. inv.AddAnItem( 'Torch', 1, true, true, false );
  12967.  
  12968.  
  12969. //modSigns
  12970. quantityLow = 1;
  12971. randLow = 2;
  12972. quantityMedium = 2;
  12973. randMedium = 2;
  12974. quantityHigh = 3;
  12975. randHigh = 2;
  12976.  
  12977. inv.AddAnItem( 'Alghoul bone marrow',quantityMedium+RandRange( randMedium ) );
  12978. inv.AddAnItem( 'Amethyst dust',quantityLow+RandRange( randLow ) );
  12979. inv.AddAnItem( 'Arachas eyes',quantityLow+RandRange( randLow ) );
  12980. inv.AddAnItem( 'Arachas venom',quantityLow+RandRange( randLow ) );
  12981. inv.AddAnItem( 'Basilisk hide',quantityLow+RandRange( randLow ) );
  12982. inv.AddAnItem( 'Basilisk venom',quantityLow+RandRange( randLow ) );
  12983. inv.AddAnItem( 'Berserker pelt',quantityLow+RandRange( randLow ) );
  12984. inv.AddAnItem( 'Coal',quantityHigh+RandRange( randHigh ) );
  12985. inv.AddAnItem( 'Cotton',quantityHigh+RandRange( randHigh ) );
  12986. inv.AddAnItem( 'Diamond dust',quantityLow+RandRange( randLow ) );
  12987. inv.AddAnItem( 'Drowned dead tongue',quantityLow+RandRange( randLow ) );
  12988. inv.AddAnItem( 'Drowner brain',quantityMedium+RandRange( randMedium ) );
  12989. inv.AddAnItem( 'Endriag chitin plates',quantityMedium+RandRange( randMedium ) );
  12990. inv.AddAnItem( 'Endriag embryo',quantityLow+RandRange( randLow ) );
  12991. inv.AddAnItem( 'Ghoul blood',quantityMedium+RandRange( randMedium ) );
  12992. inv.AddAnItem( 'Hag teeth',quantityMedium+RandRange( randMedium ) );
  12993. inv.AddAnItem( 'Hardened leather',quantityMedium+RandRange( randMedium ) );
  12994. inv.AddAnItem( 'Hardened timber',quantityMedium+RandRange( randMedium ) );
  12995. inv.AddAnItem( 'Harpy feathers',quantityMedium+RandRange( randMedium ) );
  12996. inv.AddAnItem( 'Necrophage skin',quantityLow+RandRange( randLow ) );
  12997. inv.AddAnItem( 'Nekker blood',quantityHigh+RandRange( randHigh ) );
  12998. inv.AddAnItem( 'Nekker heart',quantityMedium+RandRange( randMedium ) );
  12999. inv.AddAnItem( 'Phosphorescent crystal',quantityLow+RandRange( randLow ) );
  13000. inv.AddAnItem( 'Rotfiend blood',quantityMedium+RandRange( randMedium ) );
  13001. inv.AddAnItem( 'Sapphire dust',quantityLow+RandRange( randLow ) );
  13002. inv.AddAnItem( 'Specter dust',quantityMedium+RandRange( randMedium ) );
  13003. inv.AddAnItem( 'Water essence',quantityMedium+RandRange( randMedium ) );
  13004. inv.AddAnItem( 'Wolf liver',quantityHigh+RandRange( randHigh ) );
  13005. inv.AddAnItem( 'Alcohest', 3 );
  13006. inv.AddAnItem( 'Dwarven spirit', 4 );
  13007.  
  13008.  
  13009. ids.Clear();
  13010. ids = inv.AddAnItem( 'Crossbow 5' );
  13011. EquipItem( ids[0] );
  13012. ids.Clear();
  13013. ids = inv.AddAnItem( 'Blunt Bolt', 20 );
  13014. EquipItem( ids[0] );
  13015. inv.AddAnItem( 'Broadhead Bolt', 20 );
  13016. inv.AddAnItem( 'Split Bolt', 20 );
  13017.  
  13018.  
  13019. RemoveAllAlchemyRecipes();
  13020. RemoveAllCraftingSchematics();
  13021.  
  13022.  
  13023.  
  13024.  
  13025.  
  13026.  
  13027.  
  13028.  
  13029.  
  13030. AddAlchemyRecipe( 'Recipe for Petris Philtre 2' );
  13031. AddAlchemyRecipe( 'Recipe for Swallow 1' );
  13032. AddAlchemyRecipe( 'Recipe for Tawny Owl 1' );
  13033.  
  13034. AddAlchemyRecipe( 'Recipe for White Gull 1' );
  13035.  
  13036.  
  13037.  
  13038.  
  13039.  
  13040. AddAlchemyRecipe( 'Recipe for Beast Oil 1' );
  13041. AddAlchemyRecipe( 'Recipe for Cursed Oil 1' );
  13042. AddAlchemyRecipe( 'Recipe for Hanged Man Venom 1' );
  13043. AddAlchemyRecipe( 'Recipe for Hybrid Oil 1' );
  13044. AddAlchemyRecipe( 'Recipe for Insectoid Oil 2' );
  13045. AddAlchemyRecipe( 'Recipe for Magicals Oil 1' );
  13046. AddAlchemyRecipe( 'Recipe for Necrophage Oil 1' );
  13047. AddAlchemyRecipe( 'Recipe for Specter Oil 1' );
  13048. AddAlchemyRecipe( 'Recipe for Vampire Oil 2' );
  13049. AddAlchemyRecipe( 'Recipe for Draconide Oil 2' );
  13050. AddAlchemyRecipe( 'Recipe for Ogre Oil 1' );
  13051. AddAlchemyRecipe( 'Recipe for Relic Oil 1' );
  13052. AddAlchemyRecipe( 'Recipe for Beast Oil 2' );
  13053. AddAlchemyRecipe( 'Recipe for Cursed Oil 2' );
  13054. AddAlchemyRecipe( 'Recipe for Hanged Man Venom 2' );
  13055. AddAlchemyRecipe( 'Recipe for Hybrid Oil 2' );
  13056. AddAlchemyRecipe( 'Recipe for Insectoid Oil 2' );
  13057. AddAlchemyRecipe( 'Recipe for Magicals Oil 2' );
  13058. AddAlchemyRecipe( 'Recipe for Necrophage Oil 2' );
  13059. AddAlchemyRecipe( 'Recipe for Specter Oil 2' );
  13060. AddAlchemyRecipe( 'Recipe for Vampire Oil 2' );
  13061. AddAlchemyRecipe( 'Recipe for Draconide Oil 2' );
  13062. AddAlchemyRecipe( 'Recipe for Ogre Oil 2' );
  13063. AddAlchemyRecipe( 'Recipe for Relic Oil 2' );
  13064.  
  13065.  
  13066. AddAlchemyRecipe( 'Recipe for Dancing Star 1' );
  13067.  
  13068. AddAlchemyRecipe( 'Recipe for Dwimeritum Bomb 1' );
  13069.  
  13070. AddAlchemyRecipe( 'Recipe for Grapeshot 1' );
  13071. AddAlchemyRecipe( 'Recipe for Samum 1' );
  13072.  
  13073. AddAlchemyRecipe( 'Recipe for White Frost 1' );
  13074.  
  13075.  
  13076.  
  13077. AddAlchemyRecipe( 'Recipe for Dwarven spirit 1' );
  13078. AddAlchemyRecipe( 'Recipe for Alcohest 1' );
  13079. AddAlchemyRecipe( 'Recipe for White Gull 1' );
  13080.  
  13081.  
  13082. AddStartingSchematics();
  13083.  
  13084.  
  13085. ids.Clear();
  13086. ids = inv.AddAnItem( 'Swallow 2' );
  13087. EquipItem( ids[0] );
  13088. ids.Clear();
  13089. ids = inv.AddAnItem( 'Thunderbolt 2' );
  13090. EquipItem( ids[0] );
  13091. ids.Clear();
  13092. ids = inv.AddAnItem( 'Tawny Owl 2' );
  13093. EquipItem( ids[0] );
  13094. ids.Clear();
  13095.  
  13096. ids = inv.AddAnItem( 'Grapeshot 2' );
  13097. EquipItem( ids[0] );
  13098. ids.Clear();
  13099. ids = inv.AddAnItem( 'Samum 2' );
  13100. EquipItem( ids[0] );
  13101.  
  13102. inv.AddAnItem( 'Dwimeritum Bomb 1' );
  13103. inv.AddAnItem( 'Dragons Dream 1' );
  13104. inv.AddAnItem( 'Silver Dust Bomb 1' );
  13105. inv.AddAnItem( 'White Frost 2' );
  13106. inv.AddAnItem( 'Devils Puffball 2' );
  13107. inv.AddAnItem( 'Dancing Star 2' );
  13108. inv.AddAnItem( 'Beast Oil 1' );
  13109. inv.AddAnItem( 'Cursed Oil 1' );
  13110. inv.AddAnItem( 'Hanged Man Venom 2' );
  13111. inv.AddAnItem( 'Hybrid Oil 2' );
  13112. inv.AddAnItem( 'Insectoid Oil 2' );
  13113. inv.AddAnItem( 'Magicals Oil 1' );
  13114. inv.AddAnItem( 'Necrophage Oil 2' );
  13115. inv.AddAnItem( 'Ogre Oil 1' );
  13116. inv.AddAnItem( 'Specter Oil 1' );
  13117. inv.AddAnItem( 'Vampire Oil 2' );
  13118. inv.AddAnItem( 'Draconide Oil 2' );
  13119. inv.AddAnItem( 'Relic Oil 1' );
  13120. inv.AddAnItem( 'Black Blood 1' );
  13121. inv.AddAnItem( 'Blizzard 1' );
  13122. inv.AddAnItem( 'Cat 2' );
  13123. inv.AddAnItem( 'Full Moon 1' );
  13124. inv.AddAnItem( 'Golden Oriole 1' );
  13125. inv.AddAnItem( 'Killer Whale 1' );
  13126. inv.AddAnItem( 'Maribor Forest 1' );
  13127. inv.AddAnItem( 'Petris Philtre 2' );
  13128. inv.AddAnItem( 'White Gull 1', 2 );
  13129. inv.AddAnItem( 'White Honey 2' );
  13130. inv.AddAnItem( 'White Raffards Decoction 1' );
  13131.  
  13132.  
  13133. inv.AddAnItem( 'Mutagen 17' );
  13134. inv.AddAnItem( 'Mutagen 19' );
  13135. inv.AddAnItem( 'Mutagen 27' );
  13136. inv.AddAnItem( 'Mutagen 26' );
  13137.  
  13138.  
  13139. inv.AddAnItem( 'weapon_repair_kit_1', 3 );
  13140. inv.AddAnItem( 'weapon_repair_kit_2', 2 );
  13141. inv.AddAnItem( 'armor_repair_kit_1', 3 );
  13142. inv.AddAnItem( 'armor_repair_kit_2', 2 );
  13143.  
  13144.  
  13145. quantityMedium = 1;
  13146. quantityLow = 1;
  13147. inv.AddAnItem( 'Rune stribog lesser', quantityMedium );
  13148. inv.AddAnItem( 'Rune stribog', quantityLow );
  13149. inv.AddAnItem( 'Rune dazhbog lesser', quantityMedium );
  13150. inv.AddAnItem( 'Rune dazhbog', quantityLow );
  13151. inv.AddAnItem( 'Rune devana lesser', quantityMedium );
  13152. inv.AddAnItem( 'Rune devana', quantityLow );
  13153. inv.AddAnItem( 'Rune zoria lesser', quantityMedium );
  13154. inv.AddAnItem( 'Rune zoria', quantityLow );
  13155. inv.AddAnItem( 'Rune morana lesser', quantityMedium );
  13156. inv.AddAnItem( 'Rune morana', quantityLow );
  13157. inv.AddAnItem( 'Rune triglav lesser', quantityMedium );
  13158. inv.AddAnItem( 'Rune triglav', quantityLow );
  13159. inv.AddAnItem( 'Rune svarog lesser', quantityMedium );
  13160. inv.AddAnItem( 'Rune svarog', quantityLow );
  13161. inv.AddAnItem( 'Rune veles lesser', quantityMedium );
  13162. inv.AddAnItem( 'Rune veles', quantityLow );
  13163. inv.AddAnItem( 'Rune perun lesser', quantityMedium );
  13164. inv.AddAnItem( 'Rune perun', quantityLow );
  13165. inv.AddAnItem( 'Rune elemental lesser', quantityMedium );
  13166. inv.AddAnItem( 'Rune elemental', quantityLow );
  13167.  
  13168. inv.AddAnItem( 'Glyph aard lesser', quantityMedium );
  13169. inv.AddAnItem( 'Glyph aard', quantityLow );
  13170. inv.AddAnItem( 'Glyph axii lesser', quantityMedium );
  13171. inv.AddAnItem( 'Glyph axii', quantityLow );
  13172. inv.AddAnItem( 'Glyph igni lesser', quantityMedium );
  13173. inv.AddAnItem( 'Glyph igni', quantityLow );
  13174. inv.AddAnItem( 'Glyph quen lesser', quantityMedium );
  13175. inv.AddAnItem( 'Glyph quen', quantityLow );
  13176. inv.AddAnItem( 'Glyph yrden lesser', quantityMedium );
  13177. inv.AddAnItem( 'Glyph yrden', quantityLow );
  13178.  
  13179.  
  13180. StandaloneEp2_2();
  13181. }
  13182.  
  13183. public final function StandaloneEp2_2()
  13184. {
  13185. var horseId : SItemUniqueId;
  13186. var ids : array<SItemUniqueId>;
  13187. var ents : array< CJournalBase >;
  13188. var i : int;
  13189. var manager : CWitcherJournalManager;
  13190.  
  13191.  
  13192. inv.AddAnItem( 'Cows milk', 5 );
  13193. ids.Clear();
  13194. ids = inv.AddAnItem( 'Dumpling', 5 );
  13195. EquipItem( ids[0] );
  13196.  
  13197.  
  13198. inv.AddAnItem( 'Clearing Potion', 2, true, false, false );
  13199.  
  13200.  
  13201. GetHorseManager().RemoveAllItems();
  13202.  
  13203. ids.Clear();
  13204. ids = inv.AddAnItem( 'Horse Bag 2' );
  13205. horseId = GetHorseManager( ).MoveItemToHorse( ids[0] );
  13206. GetHorseManager().EquipItem( horseId );
  13207.  
  13208. ids.Clear();
  13209. ids = inv.AddAnItem( 'Horse Blinder 2' );
  13210. horseId = GetHorseManager().MoveItemToHorse( ids[0] );
  13211. GetHorseManager().EquipItem( horseId );
  13212.  
  13213. ids.Clear();
  13214. ids = inv.AddAnItem( 'Horse Saddle 2' );
  13215. horseId = GetHorseManager().MoveItemToHorse( ids[0] );
  13216. GetHorseManager().EquipItem( horseId );
  13217.  
  13218. manager = theGame.GetJournalManager();
  13219.  
  13220.  
  13221. manager.GetActivatedOfType( 'CJournalCreature', ents );
  13222. for(i=0; i<ents.Size(); i+=1)
  13223. {
  13224. manager.ActivateEntry( ents[i], JS_Inactive, false, true );
  13225. }
  13226.  
  13227.  
  13228. ents.Clear();
  13229. manager.GetActivatedOfType( 'CJournalCharacter', ents );
  13230. for(i=0; i<ents.Size(); i+=1)
  13231. {
  13232. manager.ActivateEntry( ents[i], JS_Inactive, false, true );
  13233. }
  13234.  
  13235.  
  13236. ents.Clear();
  13237. manager.GetActivatedOfType( 'CJournalQuest', ents );
  13238. for(i=0; i<ents.Size(); i+=1)
  13239. {
  13240.  
  13241. if( StrStartsWith( ents[i].baseName, "q60" ) )
  13242. continue;
  13243.  
  13244. manager.ActivateEntry( ents[i], JS_Inactive, false, true );
  13245. }
  13246.  
  13247.  
  13248. manager.ActivateEntryByScriptTag( 'TutorialAard', JS_Active );
  13249. manager.ActivateEntryByScriptTag( 'TutorialAdrenaline', JS_Active );
  13250. manager.ActivateEntryByScriptTag( 'TutorialAxii', JS_Active );
  13251. manager.ActivateEntryByScriptTag( 'TutorialAxiiDialog', JS_Active );
  13252. manager.ActivateEntryByScriptTag( 'TutorialCamera', JS_Active );
  13253. manager.ActivateEntryByScriptTag( 'TutorialCamera_pad', JS_Active );
  13254. manager.ActivateEntryByScriptTag( 'TutorialCiriBlink', JS_Active );
  13255. manager.ActivateEntryByScriptTag( 'TutorialCiriCharge', JS_Active );
  13256. manager.ActivateEntryByScriptTag( 'TutorialCiriStamina', JS_Active );
  13257. manager.ActivateEntryByScriptTag( 'TutorialCounter', JS_Active );
  13258. manager.ActivateEntryByScriptTag( 'TutorialDialogClose', JS_Active );
  13259. manager.ActivateEntryByScriptTag( 'TutorialFallingRoll', JS_Active );
  13260. manager.ActivateEntryByScriptTag( 'TutorialFocus', JS_Active );
  13261. manager.ActivateEntryByScriptTag( 'TutorialFocusClues', JS_Active );
  13262. manager.ActivateEntryByScriptTag( 'TutorialFocusClues', JS_Active );
  13263. manager.ActivateEntryByScriptTag( 'TutorialHorseRoad', JS_Active );
  13264. manager.ActivateEntryByScriptTag( 'TutorialHorseSpeed0', JS_Active );
  13265. manager.ActivateEntryByScriptTag( 'TutorialHorseSpeed0_pad', JS_Active );
  13266. manager.ActivateEntryByScriptTag( 'TutorialHorseSpeed1', JS_Active );
  13267. manager.ActivateEntryByScriptTag( 'TutorialHorseSpeed2', JS_Active );
  13268. manager.ActivateEntryByScriptTag( 'TutorialHorseSummon', JS_Active );
  13269. manager.ActivateEntryByScriptTag( 'TutorialHorseSummon_pad', JS_Active );
  13270. manager.ActivateEntryByScriptTag( 'TutorialIgni', JS_Active );
  13271. manager.ActivateEntryByScriptTag( 'TutorialJournalAlternateSings', JS_Active );
  13272. manager.ActivateEntryByScriptTag( 'TutorialJournalBoatDamage', JS_Active );
  13273. manager.ActivateEntryByScriptTag( 'TutorialJournalBoatMount', JS_Active );
  13274. manager.ActivateEntryByScriptTag( 'TutorialJournalBuffs', JS_Active );
  13275. manager.ActivateEntryByScriptTag( 'TutorialJournalCharDevLeveling', JS_Active );
  13276. manager.ActivateEntryByScriptTag( 'TutorialJournalCharDevSkills', JS_Active );
  13277. manager.ActivateEntryByScriptTag( 'TutorialJournalCrafting', JS_Active );
  13278. manager.ActivateEntryByScriptTag( 'TutorialJournalCrossbow', JS_Active );
  13279. manager.ActivateEntryByScriptTag( 'TutorialJournalDialogGwint', JS_Active );
  13280. manager.ActivateEntryByScriptTag( 'TutorialJournalDialogShop', JS_Active );
  13281. manager.ActivateEntryByScriptTag( 'TutorialJournalDive', JS_Active );
  13282. manager.ActivateEntryByScriptTag( 'TutorialJournalDodge', JS_Active );
  13283. manager.ActivateEntryByScriptTag( 'TutorialJournalDodge_pad', JS_Active );
  13284. manager.ActivateEntryByScriptTag( 'TutorialJournalDrawWeapon', JS_Active );
  13285. manager.ActivateEntryByScriptTag( 'TutorialJournalDrawWeapon_pad', JS_Active );
  13286. manager.ActivateEntryByScriptTag( 'TutorialJournalDurability', JS_Active );
  13287. manager.ActivateEntryByScriptTag( 'TutorialJournalExplorations', JS_Active );
  13288. manager.ActivateEntryByScriptTag( 'TutorialJournalExplorations_pad', JS_Active );
  13289. manager.ActivateEntryByScriptTag( 'TutorialJournalFastTravel', JS_Active );
  13290. manager.ActivateEntryByScriptTag( 'TutorialJournalFocusRedObjects', JS_Active );
  13291. manager.ActivateEntryByScriptTag( 'TutorialJournalGasClouds', JS_Active );
  13292. manager.ActivateEntryByScriptTag( 'TutorialJournalHeavyAttacks', JS_Active );
  13293. manager.ActivateEntryByScriptTag( 'TutorialJournalHorse', JS_Active );
  13294. manager.ActivateEntryByScriptTag( 'TutorialJournalHorseStamina', JS_Active );
  13295. manager.ActivateEntryByScriptTag( 'TutorialJournalJump', JS_Active );
  13296. manager.ActivateEntryByScriptTag( 'TutorialJournalLightAttacks', JS_Active );
  13297. manager.ActivateEntryByScriptTag( 'TutorialJournalLightAttacks_pad', JS_Active );
  13298. manager.ActivateEntryByScriptTag( 'TutorialJournalMeditation', JS_Active );
  13299. manager.ActivateEntryByScriptTag( 'TutorialJournalMeditation_pad', JS_Active );
  13300. manager.ActivateEntryByScriptTag( 'TutorialJournalMonsterThreatLevels', JS_Active );
  13301. manager.ActivateEntryByScriptTag( 'TutorialJournalMovement', JS_Active );
  13302. manager.ActivateEntryByScriptTag( 'TutorialJournalMovement_pad', JS_Active );
  13303. manager.ActivateEntryByScriptTag( 'TutorialJournalMutagenIngredient', JS_Active );
  13304. manager.ActivateEntryByScriptTag( 'TutorialJournalMutagenPotion', JS_Active );
  13305. manager.ActivateEntryByScriptTag( 'TutorialJournalOils', JS_Active );
  13306. manager.ActivateEntryByScriptTag( 'TutorialJournalPetards', JS_Active );
  13307. manager.ActivateEntryByScriptTag( 'TutorialJournalPotions', JS_Active );
  13308. manager.ActivateEntryByScriptTag( 'TutorialJournalPotions_pad', JS_Active );
  13309. manager.ActivateEntryByScriptTag( 'TutorialJournalQuestArea', JS_Active );
  13310. manager.ActivateEntryByScriptTag( 'TutorialJournalRadial', JS_Active );
  13311. manager.ActivateEntryByScriptTag( 'TutorialJournalRifts', JS_Active );
  13312. manager.ActivateEntryByScriptTag( 'TutorialJournalRun', JS_Active );
  13313. manager.ActivateEntryByScriptTag( 'TutorialJournalShopDescription', JS_Active );
  13314. manager.ActivateEntryByScriptTag( 'TutorialJournalSignCast', JS_Active );
  13315. manager.ActivateEntryByScriptTag( 'TutorialJournalSignCast_pad', JS_Active );
  13316. manager.ActivateEntryByScriptTag( 'TutorialJournalSpecialAttacks', JS_Active );
  13317. manager.ActivateEntryByScriptTag( 'TutorialJournalStaminaExploration', JS_Active );
  13318. manager.ActivateEntryByScriptTag( 'TutorialJumpHang', JS_Active );
  13319. manager.ActivateEntryByScriptTag( 'TutorialLadder', JS_Active );
  13320. manager.ActivateEntryByScriptTag( 'TutorialLadderMove', JS_Active );
  13321. manager.ActivateEntryByScriptTag( 'TutorialLadderMove_pad', JS_Active );
  13322. manager.ActivateEntryByScriptTag( 'TutorialObjectiveSwitching', JS_Active );
  13323. manager.ActivateEntryByScriptTag( 'TutorialOxygen', JS_Active );
  13324. manager.ActivateEntryByScriptTag( 'TutorialParry', JS_Active );
  13325. manager.ActivateEntryByScriptTag( 'TutorialPOIUncovered', JS_Active );
  13326. manager.ActivateEntryByScriptTag( 'TutorialQuen', JS_Active );
  13327. manager.ActivateEntryByScriptTag( 'TutorialRoll', JS_Active );
  13328. manager.ActivateEntryByScriptTag( 'TutorialRoll_pad', JS_Active );
  13329. manager.ActivateEntryByScriptTag( 'TutorialSpeedPairing', JS_Active );
  13330. manager.ActivateEntryByScriptTag( 'TutorialSprint', JS_Active );
  13331. manager.ActivateEntryByScriptTag( 'TutorialStaminaSigns', JS_Active );
  13332. manager.ActivateEntryByScriptTag( 'TutorialStealing', JS_Active );
  13333. manager.ActivateEntryByScriptTag( 'TutorialSwimmingSpeed', JS_Active );
  13334. manager.ActivateEntryByScriptTag( 'TutorialTimedChoiceDialog', JS_Active );
  13335. manager.ActivateEntryByScriptTag( 'TutorialYrden', JS_Active );
  13336.  
  13337. //modSigns
  13338. inv.AddAnItem( 'Geralt Shirt', 1 );
  13339. inv.AddAnItem( 'Thread', 3 );
  13340. inv.AddAnItem( 'String', 3 );
  13341. inv.AddAnItem( 'Linen', 2 );
  13342. inv.AddAnItem( 'Silk', 1 );
  13343. inv.AddAnItem( 'Nigredo', 1 );
  13344. inv.AddAnItem( 'Albedo', 1 );
  13345. inv.AddAnItem( 'Rubedo', 1 );
  13346. inv.AddAnItem( 'Rebis', 1 );
  13347. inv.AddAnItem( 'Dog tallow', 3 );
  13348. inv.AddAnItem( 'Lunar shards', 1 );
  13349. inv.AddAnItem( 'Quicksilver solution', 1 );
  13350. inv.AddAnItem( 'Aether', 1 );
  13351. inv.AddAnItem( 'Optima mater', 1 );
  13352. inv.AddAnItem( 'Fifth essence', 1 );
  13353. inv.AddAnItem( 'Hardened timber', 2 );
  13354. inv.AddAnItem( 'Fur square', 1 );
  13355. inv.AddAnItem( 'Leather straps', 4 );
  13356. inv.AddAnItem( 'Leather squares', 1 );
  13357. inv.AddAnItem( 'Leather', 2 );
  13358. inv.AddAnItem( 'Hardened leather', 2 );
  13359. inv.AddAnItem( 'Chitin scale', 2 );
  13360. inv.AddAnItem( 'Draconide leather', 1 );
  13361. inv.AddAnItem( 'Infused draconide leather', 0 );
  13362. inv.AddAnItem( 'Steel ingot', 2 );
  13363. inv.AddAnItem( 'Dark iron ore', 2 );
  13364. inv.AddAnItem( 'Dark iron ingot', 1 );
  13365. inv.AddAnItem( 'Dark steel ingot', 1 );
  13366. inv.AddAnItem( 'Silver ore', 2 );
  13367. inv.AddAnItem( 'Silver ingot', 2 );
  13368. inv.AddAnItem( 'Meteorite ore', 2 );
  13369. inv.AddAnItem( 'Meteorite ingot', 1 );
  13370. inv.AddAnItem( 'Meteorite silver ingot', 1 );
  13371. inv.AddAnItem( 'Dwimeryte ingot', 2 );
  13372. inv.AddAnItem( 'Emerald dust', 2 );
  13373. inv.AddAnItem( 'Ruby dust', 2 );
  13374. inv.AddAnItem( 'Ruby', 1 );
  13375. inv.AddAnItem( 'Sapphire dust', 2 );
  13376. inv.AddAnItem( 'Sapphire', 1 );
  13377. inv.AddAnItem( 'Monstrous brain', 4 );
  13378. inv.AddAnItem( 'Monstrous blood', 3 );
  13379. inv.AddAnItem( 'Monstrous bone', 4 );
  13380. inv.AddAnItem( 'Monstrous claw', 3 );
  13381. inv.AddAnItem( 'Monstrous dust', 3 );
  13382. inv.AddAnItem( 'Monstrous ear', 4 );
  13383. inv.AddAnItem( 'Monstrous egg', 2 );
  13384. inv.AddAnItem( 'Monstrous eye', 2 );
  13385. inv.AddAnItem( 'Monstrous essence', 3 );
  13386. inv.AddAnItem( 'Monstrous feather', 4 );
  13387. inv.AddAnItem( 'Monstrous hair', 3 );
  13388. inv.AddAnItem( 'Monstrous heart', 2 );
  13389. inv.AddAnItem( 'Monstrous hide', 3 );
  13390. inv.AddAnItem( 'Monstrous liver', 2 );
  13391. inv.AddAnItem( 'Monstrous plate', 1 );
  13392. inv.AddAnItem( 'Monstrous saliva', 4 );
  13393. inv.AddAnItem( 'Monstrous stomach', 2 );
  13394. inv.AddAnItem( 'Monstrous tongue', 2 );
  13395. inv.AddAnItem( 'Monstrous tooth', 3 );
  13396. inv.AddAnItem( 'Venom extract', 1 );
  13397. inv.AddAnItem( 'Siren vocal cords', 1 );
  13398.  
  13399.  
  13400. SelectQuickslotItem( EES_RangedWeapon );
  13401.  
  13402.  
  13403. FactsAdd( 'kill_base_tutorials' );
  13404.  
  13405.  
  13406. theGame.GetTutorialSystem().RemoveAllQueuedTutorials();
  13407.  
  13408.  
  13409. if( FactsQuerySum("standalone_ep2") < 1 ) //modSigns
  13410. FactsAdd("standalone_ep2");
  13411. FactsRemove( "StandAloneEP2" );
  13412.  
  13413. theGame.GetJournalManager().ForceUntrackingQuestForEP1Savegame();
  13414. }
  13415.  
  13416. //zur13 modSSS
  13417. public function SSS_GetEquippedMutationType() : array< EPlayerMutationType >
  13418. {
  13419. return ( ( W3PlayerAbilityManager ) abilityManager ).SSS_GetEquippedMutationType();
  13420. }
  13421.  
  13422. //zur13 modSSS mutTabs
  13423. public function SSS_FixEquippedMutagens()
  13424. {
  13425. var item : SItemUniqueId;
  13426. var i : int;
  13427. for( i = EES_SkillMutagen5 ; i < EES_SkillMutagen48; i=i+1 )
  13428. {
  13429. if( GetItemEquippedOnSlot( i, item ) )
  13430. {
  13431. inv.SetItemStackable( item, false );
  13432. }
  13433. }
  13434. }
  13435.  
  13436. //zur13 modSSS mutTabs
  13437. public function SSS_Patch_MutagenStacking(muts : array< SItemUniqueId >) : array< SItemUniqueId >
  13438. {
  13439. var i, j, quantity : int;
  13440. var item : SItemUniqueId;
  13441.  
  13442. for( i = EES_SkillMutagen5 ; i < EES_SkillMutagen48; i=i+1 )
  13443. {
  13444. if( GetItemEquippedOnSlot( i, item ) )
  13445. {
  13446. muts.Remove( item );
  13447. inv.SetItemStackable( item, false );
  13448. }
  13449. }
  13450. return muts;
  13451. }
  13452.  
  13453. // Combat Anims - Begin
  13454. event OnAnimEvent_GeraltFastAttackAnimStart( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  13455. {
  13456. var animName : name;
  13457. var speed : float;
  13458.  
  13459. animName = GetAnimNameFromEventAnimInfo(animInfo);
  13460. switch(animName)
  13461. {
  13462. case 'geralt_attack_fast_2_rp': speed = 1.35f; break;
  13463. case 'geralt_attack_fast_4_rp': speed = 1.65f; break;
  13464. case 'geralt_attack_fast_5_rp': speed = 1.35f; break;
  13465. case 'geralt_attack_fast_6_rp': speed = 1.3f; break;
  13466.  
  13467. case 'geralt_attack_fast_long_1_rp': speed = 1.3f; break;
  13468. case 'geralt_attack_fast_long_1_lp': speed = 1.3f; break;
  13469.  
  13470. case 'geralt_attack_fast_2_lp': speed = 1.65f; break;
  13471. case 'geralt_attack_fast_3_lp': speed = 1.45f; break;
  13472. case 'geralt_attack_fast_4_lp': speed = 1.45f; break;
  13473. case 'geralt_attack_fast_5_lp': speed = 1.25f; break;
  13474. case 'geralt_attack_fast_6_lp': speed = 1.75f; break;
  13475. default: speed = 1.f; break;
  13476. }
  13477.  
  13478. SetAnimSpeed(speed);
  13479. }
  13480.  
  13481. event OnAnimEvent_GeraltStrongAttackAnimStart( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  13482. {
  13483. var animName : name;
  13484. var speed : float;
  13485.  
  13486. animName = GetAnimNameFromEventAnimInfo(animInfo);
  13487. switch(animName)
  13488. {
  13489. case 'geralt_attack_strong_4_rp': speed = 0.85f; break;
  13490. case 'geralt_attack_strong_5_rp': speed = 0.85f; break;
  13491.  
  13492. case 'geralt_attack_strong_3_lp': speed = 0.85f; break;
  13493. case 'geralt_attack_strong_2_lp': speed = 1.05f; break;
  13494. default: speed = 1.f; break;
  13495. }
  13496.  
  13497. SetAnimSpeed(speed);
  13498. }
  13499.  
  13500. event OnAnimEvent_GeraltFastAttackFarAnimStart( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  13501. {
  13502. SetAnimSpeed(0.9f);
  13503. }
  13504.  
  13505. event OnAnimEvent_GeraltStrongAttackFarAnimStart( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  13506. {
  13507. SetAnimSpeed(0.85f);
  13508. }
  13509.  
  13510. event OnAnimEvent_SecondaryAttackAnimStart( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  13511. {
  13512. var animName : name;
  13513. var speed : float;
  13514.  
  13515. animName = GetAnimNameFromEventAnimInfo(animInfo);
  13516. switch(animName)
  13517. {
  13518. case 'geralt_sec_fast_1_rp': speed = 1.2f; break;
  13519. case 'geralt_sec_fast_2_rp': speed = 1.1f; break;
  13520. case 'geralt_sec_fast_3_rp': speed = 1.25f; break;
  13521.  
  13522. case 'geralt_sec_fast_1_lp': speed = 1.1f; break;
  13523. case 'geralt_sec_fast_2_lp': speed = 1.3f; break;
  13524. case 'geralt_sec_fast_3_lp': speed = 1.2f; break;
  13525. default: speed = 1.f; break;
  13526. }
  13527.  
  13528. SetAnimSpeed(speed);
  13529. }
  13530.  
  13531. private var animationID : int; default animationID = -1;
  13532. public function ResetCustomAnimationSpeedMult()
  13533. {
  13534. ResetAnimationSpeedMultiplier(animationID);
  13535. }
  13536.  
  13537. public function SetAnimSpeed( speed : float )
  13538. {
  13539. animationID = SetAnimationSpeedMultiplier(speed, animationID, true);
  13540. }
  13541. // Combat Anims - End
  13542. }
  13543.  
  13544. exec function fuqfep1()
  13545. {
  13546. theGame.GetJournalManager().ForceUntrackingQuestForEP1Savegame();
  13547. }
  13548.  
  13549.  
  13550.  
  13551.  
  13552.  
  13553. function GetWitcherPlayer() : W3PlayerWitcher
  13554. {
  13555. return (W3PlayerWitcher)thePlayer;
  13556. }
  13557.  
Add Comment
Please, Sign In to add comment