Advertisement
ralf425

Untitled

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