Grimoires

Untitled

Oct 25th, 2022
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 386.72 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. statemachine class W3PlayerWitcher extends CR4Player
  8. {
  9. private saved var craftingSchematics : array<name>;
  10. private saved var expandedCraftingCategories : array<name>;
  11. private saved var craftingFilters : SCraftingFilters;
  12.  
  13.  
  14. private saved var alchemyRecipes : array<name>;
  15. private saved var expandedAlchemyCategories : array<name>;
  16. private saved var alchemyFilters : SCraftingFilters;
  17.  
  18. // -= WMK:modAQOOM =-
  19. public saved var wmkMapMenuData : WmkMapMenuData;
  20. public var wmkMapMenu : WmkMapMenuEx;
  21. // -= WMK:modAQOOM =-
  22.  
  23. private saved var expandedBestiaryCategories : array<name>;
  24.  
  25.  
  26. private saved var booksRead : array<name>;
  27.  
  28.  
  29. private var fastAttackCounter, heavyAttackCounter : int;
  30. private var isInFrenzy : bool;
  31. private var hasRecentlyCountered : bool;
  32. private saved var cannotUseUndyingSkill : bool;
  33.  
  34.  
  35. protected saved var amountOfSetPiecesEquipped : array<int>;
  36.  
  37.  
  38. public var canSwitchFocusModeTarget : bool;
  39. protected var switchFocusModeTargetAllowed : bool;
  40. default canSwitchFocusModeTarget = true;
  41. default switchFocusModeTargetAllowed = true;
  42.  
  43.  
  44. private editable var signs : array< SWitcherSign >;
  45. private saved var equippedSign : ESignType;
  46. private var currentlyCastSign : ESignType; default currentlyCastSign = ST_None;
  47. private var signOwner : W3SignOwnerPlayer;
  48. private var usedQuenInCombat : bool;
  49. public var yrdenEntities : array<W3YrdenEntity>;
  50. public saved var m_quenReappliedCount : int;
  51. public saved var m_quickInventorySaveData : WmkQuickInventorySaveData; // -= WMK:modQuickSlots =-
  52.  
  53. default equippedSign = ST_Aard;
  54. default m_quenReappliedCount = 1;
  55.  
  56.  
  57.  
  58. private var bDispalyHeavyAttackIndicator : bool;
  59. private var bDisplayHeavyAttackFirstLevelTimer : bool;
  60. public var specialAttackHeavyAllowed : bool;
  61. private var mutations : bool;
  62.  
  63. default mutations = false;
  64. default bIsCombatActionAllowed = true;
  65. default bDispalyHeavyAttackIndicator = false;
  66. default bDisplayHeavyAttackFirstLevelTimer = true;
  67.  
  68.  
  69.  
  70. default explorationInputContext = 'Exploration';
  71. default combatInputContext = 'Combat';
  72. default combatFistsInputContext = 'Combat';
  73.  
  74.  
  75. private saved var companionNPCTag : name;
  76. private saved var companionNPCTag2 : name;
  77.  
  78. private saved var companionNPCIconPath : string;
  79. private saved var companionNPCIconPath2 : string;
  80.  
  81.  
  82. private saved var itemSlots : array<SItemUniqueId>;
  83. private var remainingBombThrowDelaySlot1 : float;
  84. private var remainingBombThrowDelaySlot2 : float;
  85. private var previouslyUsedBolt : SItemUniqueId;
  86. private saved var questMarkedSelectedQuickslotItems : array< SSelectedQuickslotItem >;
  87.  
  88. default isThrowingItem = false;
  89. default remainingBombThrowDelaySlot1 = 0.f;
  90. default remainingBombThrowDelaySlot2 = 0.f;
  91.  
  92.  
  93.  
  94.  
  95.  
  96. private saved var tempLearnedSignSkills : array<SSimpleSkill>;
  97. public saved var autoLevel : bool;
  98.  
  99.  
  100.  
  101.  
  102. protected saved var skillBonusPotionEffect : CBaseGameplayEffect;
  103.  
  104.  
  105. public saved var levelManager : W3LevelManager;
  106.  
  107. //---=== modFriendlyHUD ===---
  108. public var prepDisallowOilsInCombat : bool; default prepDisallowOilsInCombat = false;
  109. public var prepOilsHaveAmmo : bool; default prepOilsHaveAmmo = false;
  110. //---=== modFriendlyHUD ===---
  111.  
  112.  
  113. saved var reputationManager : W3Reputation;
  114.  
  115.  
  116. private editable var medallionEntity : CEntityTemplate;
  117. private var medallionController : W3MedallionController;
  118.  
  119.  
  120.  
  121.  
  122. public var bShowRadialMenu : bool;
  123.  
  124. private var _HoldBeforeOpenRadialMenuTime : float;
  125.  
  126. default _HoldBeforeOpenRadialMenuTime = 0.5f;
  127.  
  128. public var MappinToHighlight : array<SHighlightMappin>;
  129.  
  130.  
  131. protected saved var horseManagerHandle : EntityHandle;
  132.  
  133.  
  134. private var isInitialized : bool;
  135. private var timeForPerk21 : float;
  136.  
  137. default isInitialized = false;
  138.  
  139.  
  140. private var invUpdateTransaction : bool;
  141. default invUpdateTransaction = false;
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152. // W3EE - Begin
  153. private saved var hasFollowerWolf : bool;
  154. private saved var isWolfFollowing : bool;
  155. private var followerWolf : CWolfNPC;
  156. public function GetFollower() : CWolfNPC
  157. {
  158. return followerWolf;
  159. }
  160.  
  161. public function RemoveFollower()
  162. {
  163. hasFollowerWolf = false;
  164. isWolfFollowing = false;
  165. }
  166.  
  167. public function SetIsWolfFollowing( b : bool )
  168. {
  169. isWolfFollowing = b;
  170. }
  171.  
  172. public function DestroyFollower()
  173. {
  174. if( followerWolf )
  175. {
  176. followerWolf.Destroy();
  177. delete followerWolf;
  178. hasFollowerWolf = false;
  179. isWolfFollowing = false;
  180. }
  181. }
  182.  
  183. public function ManageFollower( optional silentSpawn : bool )
  184. {
  185. var Z : float;
  186. var spawnPos : Vector;
  187. var spawnRot : EulerAngles;
  188. var wolfTemplate : CEntityTemplate;
  189.  
  190. if( !followerWolf || !followerWolf.IsAlive() || (!WasVisibleInScaledFrame(followerWolf, 1.5f, 1.5f) && VecDistanceSquared(GetWorldPosition(), followerWolf.GetWorldPosition()) > 900) || VecDistanceSquared(GetWorldPosition(), followerWolf.GetWorldPosition()) > 1600 )
  191. {
  192. if( followerWolf )
  193. {
  194. followerWolf.Destroy();
  195. delete followerWolf;
  196. hasFollowerWolf = false;
  197. isWolfFollowing = false;
  198. }
  199.  
  200. spawnRot = GetWorldRotation();
  201. spawnPos = GetWorldPosition(); Z = spawnPos.Z;
  202. spawnPos += theCamera.GetCameraDirection() * -6;
  203.  
  204. if( theGame.GetWorld().NavigationLineTest(GetWorldPosition(), spawnPos, 0.2f) )
  205. theGame.GetWorld().PhysicsCorrectZ(spawnPos, Z);
  206.  
  207. spawnPos.Z = Z;
  208. switch( StringToInt(theGame.GetInGameConfigWrapper().GetVarValue('wolfCompanion' ,'wolfType')) )
  209. {
  210. case 0: wolfTemplate = (CEntityTemplate)LoadResource("dlc\wolfie\data\ents\wolfie_grey.w2ent", true); break;
  211. case 1: wolfTemplate = (CEntityTemplate)LoadResource("dlc\wolfie\data\ents\wolfie_timber.w2ent", true); break;
  212. case 2: wolfTemplate = (CEntityTemplate)LoadResource("dlc\wolfie\data\ents\wolfie_white.w2ent", true); break;
  213. }
  214. followerWolf = (CWolfNPC)theGame.CreateEntity(wolfTemplate, spawnPos, spawnRot);
  215.  
  216. if( followerWolf )
  217. {
  218. hasFollowerWolf = true;
  219. isWolfFollowing = true;
  220. }
  221. }
  222. else followerWolf.OnCompanionInteraction();
  223. }
  224.  
  225. timer function CompanionOnSpawn( dt : float, id : int )
  226. {
  227. if( hasFollowerWolf && isWolfFollowing )
  228. ManageFollower(true);
  229. }
  230.  
  231. private var horseFollowTask : CBTTaskHorseSummon;
  232. public function SetFollowTask( task : CBTTaskHorseSummon )
  233. {
  234. horseFollowTask = task;
  235. }
  236.  
  237. public function ClearFollowTask()
  238. {
  239. horseFollowTask = NULL;
  240. }
  241.  
  242. timer function SummonDistanceCheck( dt: float, id : int )
  243. {
  244. if( VecDistanceSquared( GetWorldPosition(), GetHorseWithInventory().GetWorldPosition() ) < 25.0 )
  245. {
  246. horseFollowTask.OnDeactivate();
  247. RemoveTimer('SummonDistanceCheck');
  248. }
  249. }
  250.  
  251. timer function ResetPerk10( dt : float, id : int )
  252. {
  253. Damage().SetPerk10State(false);
  254. }
  255.  
  256. timer function ReactivatePerk21( dt : float, id : int )
  257. {
  258. Combat().SetPerk21State(true);
  259. Combat().SetPerk21TimerState(false);
  260. }
  261.  
  262. timer function RefreshVigor( dt : float, id : int )
  263. {
  264. Options().ReadOptionValues();
  265. Combat().SetMaximumAdrenaline();
  266.  
  267. CountPiecesOnSpawn();
  268.  
  269. RemoveBuff(EET_AdrenalineDrain, true);
  270. RemoveBuff(EET_DimeritiumCharge, true);
  271. AddEffectDefault(EET_AdrenalineDrain, this, "VigorRegen");
  272. if( !FactsDoesExist("StoredVigor") )
  273. FactsAdd("StoredVigor", (int)(GetStatMax(BCS_Focus) * 1000), -1);
  274.  
  275. /*if( !FactsDoesExist("WasCharacterReset") )
  276. {
  277. Options().ResetCharacter();
  278. FactsAdd("WasCharacterReset");
  279. }*/
  280.  
  281. DrainFocus(GetStat(BCS_Focus, true));
  282. GainStat(BCS_Focus, FactsQueryLatestValue("StoredVigor") / 1000);
  283.  
  284. if( !HasBuff(EET_Poise) )
  285. AddEffectDefault(EET_Poise, this, "Poise");
  286.  
  287. GetPoiseEffect().UpdateMaxPoise();
  288. }
  289.  
  290. timer function W3EEBestiaryInitialize( dt : float, id : int )
  291. {
  292. var manager : CWitcherJournalManager;
  293.  
  294. if( !FactsDoesExist("BestiaryUpdatedFinal") )
  295. {
  296. FactsAdd("BestiaryUpdatedFinal");
  297. manager = theGame.GetJournalManager();
  298.  
  299. activateJournalBestiaryEntryWithAlias("BestiaryGolding", manager);
  300. activateJournalBestiaryEntryWithAlias("BestiarySilvan", manager);
  301. activateJournalBestiaryEntryWithAlias("BestiarySuccubus", manager);
  302. activateJournalBestiaryEntryWithAlias("BestiaryHigherVampire", manager);
  303. activateJournalBestiaryEntryWithAlias("BestiaryBear", manager);
  304. activateJournalBestiaryEntryWithAlias("BestiaryHim", manager);
  305. activateJournalBestiaryEntryWithAlias("BestiaryPesta", manager);
  306. activateJournalBestiaryEntryWithAlias("BestiaryAlghoul", manager);
  307. activateJournalBestiaryEntryWithAlias("BestiaryMiscreant", manager);
  308. activateJournalBestiaryEntryWithAlias("BestiaryWerebear", manager);
  309. activateJournalBestiaryEntryWithAlias("BestiaryDzinn", manager);
  310. activateJournalBestiaryEntryWithAlias("BestiaryBasilisk", manager);
  311. activateJournalBestiaryEntryWithAlias("BestiaryCockatrice", manager);
  312. activateJournalBestiaryEntryWithAlias("BestiaryCrabSpider", manager);
  313. activateJournalBestiaryEntryWithAlias("BestiaryArmoredArachas", manager);
  314. activateJournalBestiaryEntryWithAlias("BestiaryPoisonousArachas", manager);
  315. activateJournalBestiaryEntryWithAlias("BestiaryEkkima", manager);
  316. activateJournalBestiaryEntryWithAlias("BestiaryElemental", manager);
  317. activateJournalBestiaryEntryWithAlias("BestiaryEndriaga", manager);
  318. activateJournalBestiaryEntryWithAlias("BestiaryEndriagaWorker", manager);
  319. activateJournalBestiaryEntryWithAlias("BestiaryEndriagaTruten", manager);
  320. activateJournalBestiaryEntryWithAlias("BestiaryForktail", manager);
  321. activateJournalBestiaryEntryWithAlias("BestiaryGhoul", manager);
  322. activateJournalBestiaryEntryWithAlias("BestiaryGolem", manager);
  323. activateJournalBestiaryEntryWithAlias("BestiaryKatakan", manager);
  324. activateJournalBestiaryEntryWithAlias("BestiaryMoonwright", manager);
  325. activateJournalBestiaryEntryWithAlias("BestiaryNoonwright", manager);
  326. activateJournalBestiaryEntryWithAlias("BestiaryLycanthrope", manager);
  327. activateJournalBestiaryEntryWithAlias("BestiaryWerewolf", manager);
  328. activateJournalBestiaryEntryWithAlias("BestiaryWyvern", manager);
  329. activateJournalBestiaryEntryWithAlias("BestiaryCzart", manager);
  330. activateJournalBestiaryEntryWithAlias("BestiaryBies", manager);
  331. activateJournalBestiaryEntryWithAlias("BestiaryDog", manager);
  332. activateJournalBestiaryEntryWithAlias("BestiaryDrowner", manager);
  333. activateJournalBestiaryEntryWithAlias("BestiaryFireElemental", manager);
  334. activateJournalBestiaryEntryWithAlias("BestiaryFogling", manager);
  335. activateJournalBestiaryEntryWithAlias("BestiaryGraveHag", manager);
  336. activateJournalBestiaryEntryWithAlias("BestiaryGriffin", manager);
  337. activateJournalBestiaryEntryWithAlias("BestiaryErynia", manager);
  338. activateJournalBestiaryEntryWithAlias("BestiaryHarpy", manager);
  339. activateJournalBestiaryEntryWithAlias("BestiaryIceGiant", manager);
  340. activateJournalBestiaryEntryWithAlias("BestiaryLeshy", manager);
  341. activateJournalBestiaryEntryWithAlias("BestiaryNekker", manager);
  342. activateJournalBestiaryEntryWithAlias("BestiarySiren", manager);
  343. activateJournalBestiaryEntryWithAlias("BestiaryIceTroll", manager);
  344. activateJournalBestiaryEntryWithAlias("BestiaryCaveTroll", manager);
  345. activateJournalBestiaryEntryWithAlias("BestiaryWaterHag", manager);
  346. activateJournalBestiaryEntryWithAlias("BestiaryWhMinion", manager);
  347. activateJournalBestiaryEntryWithAlias("BestiaryWolf", manager);
  348. activateJournalBestiaryEntryWithAlias("BestiaryWraith", manager);
  349. activateJournalBestiaryEntryWithAlias("BestiaryCyclop", manager);
  350. activateJournalBestiaryEntryWithAlias("BestiaryIceGolem", manager);
  351. activateJournalBestiaryEntryWithAlias("BestiaryGargoyle", manager);
  352. activateJournalBestiaryEntryWithAlias("BestiaryGreaterRotFiend", manager);
  353. activateJournalBestiaryEntryWithAlias("BestiaryDracolizardMatriarch", manager);
  354. activateJournalBestiaryEntryWithAlias("BestiaryDracolizard", manager);
  355. activateJournalBestiaryEntryWithAlias("BestiarySpriggan", manager);
  356. activateJournalBestiaryEntryWithAlias("BestiaryGarkain", manager);
  357. activateJournalBestiaryEntryWithAlias("BestiaryPanther", manager);
  358. activateJournalBestiaryEntryWithAlias("BestiarySharley", manager);
  359. activateJournalBestiaryEntryWithAlias("BestiaryBarghest", manager);
  360. activateJournalBestiaryEntryWithAlias("BestiaryBruxa", manager);
  361. activateJournalBestiaryEntryWithAlias("BestiaryFleder", manager);
  362. activateJournalBestiaryEntryWithAlias("BestiaryProtofleder", manager);
  363. activateJournalBestiaryEntryWithAlias("BestiaryAlp", manager);
  364. activateJournalBestiaryEntryWithAlias("BestiaryPaleWidow", manager);
  365. activateJournalBestiaryEntryWithAlias("BestiaryScolopendromorph", manager);
  366. activateJournalBestiaryEntryWithAlias("BestiaryKikimoraWarrior", manager);
  367. activateJournalBestiaryEntryWithAlias("BestiaryKikimoraWorker", manager);
  368. activateJournalBestiaryEntryWithAlias("BestiaryArchespore", manager);
  369. activateJournalBestiaryEntryWithAlias("BestiaryWicht", manager);
  370. activateJournalBestiaryEntryWithAlias("BestiaryBeanshie", manager);
  371. activateJournalBestiaryEntryWithAlias("BestiarySpiderEP2", manager);
  372. activateJournalBestiaryEntryWithAlias("BestiaryBoarEP2", manager);
  373. activateJournalBestiaryEntryWithAlias("BestiaryGraveir", manager);
  374. }
  375. }
  376.  
  377. timer function InitSkills( dt : float, id : int )
  378. {
  379. Combat().SetPerkArmorBonuses();
  380. Experience().InitializeSkills(this);
  381. Alchemy().Initialize(this);
  382. ManageActiveSetBonuses(EIST_MediumArmor);
  383. InitAnimManager();
  384. Combat().ForceEndGlyphsSkill();
  385. BlockAllActions('tutorial_chardev', false);
  386. BlockAllActions('tutorial_alchemy', false);
  387. BlockAllActions('tutorial_crafting', false);
  388. BlockAllActions('tutorial_inventory', false);
  389.  
  390. UpdateWoundedState();
  391. if( !FactsDoesExist("was_repair_buff_fixed") )
  392. {
  393. FactsAdd("was_repair_buff_fixed");
  394. RemoveAllRepairBuffs();
  395. }
  396.  
  397. // theGame.GetGuiManager().ShowUserDialogAdv(0, "pauseonload", "Game Paused", false, UDB_Ok);
  398. }
  399.  
  400. private var nightSight : bool;
  401. event OnToggleNightsight( action : SInputAction )
  402. {
  403. if( theInput.IsActionPressed('ControllerCastModifier') )
  404. return false;
  405.  
  406. if( IsPressed(action) && !nightSight )
  407. {
  408. nightSight = true;
  409. EnableCatViewFx( 1.0f );
  410. SetTintColorsCatViewFx(Vector(0.1f,0.12f,0.13f,0.6f),Vector(0.075f,0.1f,0.11f,0.6f),0.2f);
  411. SetBrightnessCatViewFx(StringToFloat(theGame.GetInGameConfigWrapper().GetVarValue('NightSightMenu', 'NightSightBrightness')));
  412. SetViewRangeCatViewFx(StringToFloat(theGame.GetInGameConfigWrapper().GetVarValue('NightSightMenu', 'NightSightRange')));
  413. SetPositionCatViewFx( Vector(0,0,0,0) , true );
  414. SetHightlightCatViewFx( Vector(0.5f,0.2f,0.2f,1.f),0.05f,1.5f);
  415. SetFogDensityCatViewFx( 0.5 );
  416. }
  417. else
  418. if( IsPressed(action) && nightSight )
  419. {
  420. nightSight = false;
  421. DisableCatViewFx( 1.0f );
  422. }
  423. }
  424.  
  425. public function ManageModShieldHoods( item : SItemUniqueId, isOnEquip : bool )
  426. {
  427. if( inv.ItemHasTag( item, 'Hood' ) && !isOnEquip )
  428. DisplayHair( false );
  429. }
  430.  
  431. public function DisplayHair( display : bool )
  432. {
  433. var l_comp : CComponent;
  434. var hair : CEntityTemplate;
  435.  
  436. l_comp = thePlayer.GetComponentByClassName( 'CAppearanceComponent' );
  437. hair = (CEntityTemplate)LoadResource("dlc\kontusz\data\items\hoods\hood_hair\hair_hood.w2ent", true);
  438.  
  439. if( display )
  440. ((CAppearanceComponent)l_comp).IncludeAppearanceTemplate(hair);
  441. else
  442. ((CAppearanceComponent)l_comp).ExcludeAppearanceTemplate(hair);
  443. }
  444. // W3EE - End
  445.  
  446. event OnSpawned( spawnData : SEntitySpawnData )
  447. {
  448. var i : int;
  449. var items : array<SItemUniqueId>;
  450. var items2 : array<SItemUniqueId>;
  451. var horseTemplate : CEntityTemplate;
  452. var horseManager : W3HorseManager;
  453. // W3EE - Begin
  454. var hud : CR4ScriptedHud;
  455. var hudWolfHeadModule : CR4HudModuleWolfHead;
  456. var effectType : name;
  457. var infType : ESignType;
  458. // W3EE - End
  459.  
  460. AddAnimEventCallback( 'ActionBlend', 'OnAnimEvent_ActionBlend' );
  461. AddAnimEventCallback('cast_begin', 'OnAnimEvent_Sign');
  462. AddAnimEventCallback('cast_throw', 'OnAnimEvent_Sign');
  463. AddAnimEventCallback('cast_end', 'OnAnimEvent_Sign');
  464. AddAnimEventCallback('cast_friendly_begin', 'OnAnimEvent_Sign');
  465. AddAnimEventCallback('cast_friendly_throw', 'OnAnimEvent_Sign');
  466. AddAnimEventCallback('axii_ready', 'OnAnimEvent_Sign');
  467. AddAnimEventCallback('axii_alternate_ready', 'OnAnimEvent_Sign');
  468. AddAnimEventCallback('yrden_draw_ready', 'OnAnimEvent_Sign');
  469.  
  470. AddAnimEventCallback( 'ProjectileThrow', 'OnAnimEvent_Throwable' );
  471. AddAnimEventCallback( 'OnWeaponReload', 'OnAnimEvent_Throwable' );
  472. AddAnimEventCallback( 'ProjectileAttach', 'OnAnimEvent_Throwable' );
  473. AddAnimEventCallback( 'Mutation11AnimEnd', 'OnAnimEvent_Mutation11AnimEnd' );
  474. AddAnimEventCallback( 'Mutation11ShockWave', 'OnAnimEvent_Mutation11ShockWave' );
  475.  
  476. // W3EE - Begin
  477. AddAnimEventCallback( 'GeraltFastAttackAnimStart', 'OnAnimEvent_GeraltFastAttackAnimStart' );
  478. AddAnimEventCallback( 'GeraltStrongAttackAnimStart', 'OnAnimEvent_GeraltStrongAttackAnimStart' );
  479. AddAnimEventCallback( 'GeraltFastAttackFarAnimStart', 'OnAnimEvent_GeraltFastAttackFarAnimStart' );
  480. AddAnimEventCallback( 'GeraltStrongAttackFarAnimStart', 'OnAnimEvent_GeraltStrongAttackFarAnimStart' );
  481. AddAnimEventCallback( 'SecondaryAttackAnimStart', 'OnAnimEvent_SecondaryAttackAnimStart' );
  482. AddAnimEventCallback( 'FastAxeAttackAnimStart', 'OnAnimEvent_FastAxeAttackAnimStart' );
  483. AddAnimEventCallback( 'StrongAxeAttackAnimStart', 'OnAnimEvent_StrongAxeAttackAnimStart' );
  484. AddAnimEventCallback( 'ShieldBlockAnimStart', 'OnAnimEvent_ShieldBlockAnimStart' );
  485. AddAnimEventCallback( 'ShieldBlockAnimEnd', 'OnAnimEvent_ShieldBlockAnimEnd' );
  486. AddAnimEventCallback( 'SpecialKickAnimStart', 'OnAnimEvent_SpecialKickAnimStart' );
  487. AddAnimEventCallback( 'SpecialKickAnimEnd', 'OnAnimEvent_SpecialKickAnimEnd' );
  488. AddAnimEventCallback( 'GeraltSpecialStrongAnimEnd', 'OnAnimEvent_GeraltSpecialStrongAnimEnd' );
  489. AddAnimEventCallback( 'DodgeInvulnerableStart', 'OnAnimEvent_DodgeInvulnerableStart' );
  490. AddAnimEventCallback( 'DodgeGrazeStart', 'OnAnimEvent_DodgeGrazeStart' );
  491. AddAnimEventCallback( 'TriggerFinisherFromAnimEvent', 'OnAnimEvent_TriggerFinisherFromAnimEvent' );
  492. // W3EE - End
  493.  
  494. amountOfSetPiecesEquipped.Resize( EnumGetMax( 'EItemSetType' ) + 1 );
  495.  
  496. runewordInfusionType = ST_None;
  497.  
  498.  
  499. inv = GetInventory();
  500.  
  501.  
  502. signOwner = new W3SignOwnerPlayer in this;
  503. signOwner.Init( this );
  504.  
  505. itemSlots.Resize( EnumGetMax('EEquipmentSlots')+1 );
  506.  
  507. if(!spawnData.restored)
  508. {
  509. levelManager = new W3LevelManager in this;
  510. levelManager.Initialize();
  511.  
  512.  
  513. inv.GetAllItems(items);
  514. for(i=0; i<items.Size(); i+=1)
  515. {
  516. if(inv.IsItemMounted(items[i]) && ( !inv.IsItemBody(items[i]) || inv.GetItemCategory(items[i]) == 'hair' ) )
  517. EquipItem(items[i]);
  518. }
  519.  
  520.  
  521.  
  522.  
  523.  
  524. AddAlchemyRecipe('Recipe for Swallow 1',true,true);
  525. AddAlchemyRecipe('Recipe for Cat 1',true,true);
  526. AddAlchemyRecipe('Recipe for White Honey 1',true,true);
  527.  
  528. AddAlchemyRecipe('Recipe for Samum 1',true,true);
  529. AddAlchemyRecipe('Recipe for Grapeshot 1',true,true);
  530.  
  531. AddAlchemyRecipe('Recipe for Specter Oil 1',true,true);
  532. AddAlchemyRecipe('Recipe for Necrophage Oil 1',true,true);
  533. AddAlchemyRecipe('Recipe for Alcohest 1',true,true);
  534. }
  535. else
  536. {
  537. AddTimer('DelayedOnItemMount', 0.1, true);
  538.  
  539.  
  540. CheckHairItem();
  541. }
  542.  
  543.  
  544. AddStartingSchematics();
  545.  
  546. super.OnSpawned( spawnData );
  547.  
  548.  
  549. AddAlchemyRecipe('Recipe for Mutagen red',true,true);
  550. AddAlchemyRecipe('Recipe for Mutagen green',true,true);
  551. AddAlchemyRecipe('Recipe for Mutagen blue',true,true);
  552. AddAlchemyRecipe('Recipe for Greater mutagen red',true,true);
  553. AddAlchemyRecipe('Recipe for Greater mutagen green',true,true);
  554. AddAlchemyRecipe('Recipe for Greater mutagen blue',true,true);
  555.  
  556. AddCraftingSchematic('Starting Armor Upgrade schematic 1',true,true);
  557.  
  558.  
  559. if( inputHandler )
  560. {
  561. inputHandler.BlockAllActions( 'being_ciri', false );
  562. }
  563. SetBehaviorVariable( 'test_ciri_replacer', 0.0f);
  564.  
  565. if(!spawnData.restored)
  566. {
  567.  
  568. abilityManager.GainStat(BCS_Toxicity, 0);
  569. }
  570.  
  571. levelManager.PostInit(this, spawnData.restored, true);
  572.  
  573. SetBIsCombatActionAllowed( true );
  574. SetBIsInputAllowed( true, 'OnSpawned' );
  575.  
  576.  
  577. if ( !reputationManager )
  578. {
  579. reputationManager = new W3Reputation in this;
  580. reputationManager.Initialize();
  581. }
  582.  
  583. theSound.SoundParameter( "focus_aim", 1.0f, 1.0f );
  584. theSound.SoundParameter( "focus_distance", 0.0f, 1.0f );
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591. currentlyCastSign = ST_None;
  592.  
  593.  
  594. if(!spawnData.restored)
  595. {
  596. horseTemplate = (CEntityTemplate)LoadResource("horse_manager");
  597. horseManager = (W3HorseManager)theGame.CreateEntity(horseTemplate, GetWorldPosition(),,,,,PM_Persist);
  598. horseManager.CreateAttachment(this);
  599. horseManager.OnCreated();
  600. EntityHandleSet( horseManagerHandle, horseManager );
  601. }
  602. else
  603. {
  604. AddTimer('DelayedHorseUpdate', 0.01, true);
  605. }
  606.  
  607.  
  608. RemoveAbility('Ciri_CombatRegen');
  609. RemoveAbility('Ciri_Rage');
  610. RemoveAbility('CiriBlink');
  611. RemoveAbility('CiriCharge');
  612. RemoveAbility('Ciri_Q205');
  613. RemoveAbility('Ciri_Q305');
  614. RemoveAbility('Ciri_Q403');
  615. RemoveAbility('Ciri_Q111');
  616. RemoveAbility('Ciri_Q501');
  617. RemoveAbility('SkillCiri');
  618.  
  619. if(spawnData.restored)
  620. {
  621. RestoreQuen(savedQuenHealth, savedQuenDuration);
  622. }
  623. else
  624. {
  625. savedQuenHealth = 0.f;
  626. savedQuenDuration = 0.f;
  627. }
  628.  
  629. if(spawnData.restored)
  630. {
  631. ApplyPatchFixes();
  632. }
  633. else
  634. {
  635.  
  636. FactsAdd( "new_game_started_in_1_20" );
  637. }
  638.  
  639. if ( spawnData.restored )
  640. {
  641. FixEquippedMutagens();
  642. }
  643.  
  644. if ( FactsQuerySum("NewGamePlus") > 0 )
  645. {
  646. NewGamePlusAdjustDLC1TemerianSet(inv);
  647. NewGamePlusAdjustDLC5NilfgardianSet(inv);
  648. NewGamePlusAdjustDLC10WolfSet(inv);
  649. NewGamePlusAdjustDLC14SkelligeSet(inv);
  650. if(horseManager)
  651. {
  652. NewGamePlusAdjustDLC1TemerianSet(horseManager.GetInventoryComponent());
  653. NewGamePlusAdjustDLC5NilfgardianSet(horseManager.GetInventoryComponent());
  654. NewGamePlusAdjustDLC10WolfSet(horseManager.GetInventoryComponent());
  655. NewGamePlusAdjustDLC14SkelligeSet(horseManager.GetInventoryComponent());
  656. }
  657. }
  658.  
  659.  
  660. // W3EE - Begin
  661. ResumeStaminaRegen('WhirlSkill');
  662. ResumeStaminaRegen('RendSkill');
  663.  
  664. armorPieces.Resize(4);
  665. armorPiecesOriginal.Resize(4);
  666.  
  667. abilityManager.GainStat(BCS_Toxicity, 0);
  668.  
  669. AddTimer('CompanionOnSpawn', 0.5f, false);
  670.  
  671. AddTimer('RefreshVigor', 0.5f, false);
  672.  
  673. AddTimer('InitSkills', 0.5f, false);
  674.  
  675. AddTimer('W3EEBestiaryInitialize', 2.5f, false);
  676.  
  677. AddTimer('ResetAdrenalineCombat', 5.f, false);
  678.  
  679. RemoveAbilityAll('magic_staminaregen');
  680.  
  681. RemoveAbilityAll('sword_adrenalinegain');
  682.  
  683. ResumeStaminaRegen('RendSkill');
  684.  
  685. if( FactsQuerySum("MissingRecipesAdded") < 1 )
  686. {
  687. AddAlchemyRecipe('Recipe for Tawny Owl 1', true, true);
  688. AddCraftingSchematic('Meteorite plate schematic', true, true);
  689. FactsAdd("MissingRecipesAdded");
  690. }
  691.  
  692. //AddTimer('RelevelItem', 4, false);
  693.  
  694. Equipment().ScaleItems(inv);
  695.  
  696. for(i=1; i<=50; i+=1)
  697. {
  698. RemoveAbilityAll( GetLevelupAbility(i) );
  699. AddAbility( GetLevelupAbility(i) );
  700. }
  701.  
  702. theInput.UnregisterListener(this, 'Nightsight');
  703. theInput.RegisterListener(this, 'OnToggleNightsight', 'Nightsight');
  704. // W3EE - End
  705.  
  706. if(HasAbility('Runeword 4 _Stats', true))
  707. StartVitalityRegen();
  708.  
  709.  
  710. if(HasAbility('sword_s19'))
  711. {
  712. RemoveTemporarySkills();
  713. }
  714.  
  715. HACK_UnequipWolfLiver();
  716.  
  717.  
  718. if( HasBuff( EET_GryphonSetBonusYrden ) )
  719. {
  720. RemoveBuff( EET_GryphonSetBonusYrden, false, "GryphonSetBonusYrden" );
  721. }
  722.  
  723. // -= WMK:modQuickSlots =-
  724. if (WmkGetQuickInventoryInstance()) {
  725. WmkGetQuickInventoryInstance().OnPlayerWitcherSpawned();
  726. }
  727. // -= WMK:modQuickSlots =-
  728.  
  729. if( spawnData.restored )
  730. {
  731.  
  732. UpdateEncumbrance();
  733.  
  734.  
  735. RemoveBuff( EET_Mutation11Immortal );
  736. RemoveBuff( EET_Mutation11Buff );
  737. }
  738.  
  739.  
  740. theGame.GameplayFactsAdd( "PlayerIsGeralt" );
  741.  
  742. isInitialized = true;
  743.  
  744. //modNoDuplicates - Begin
  745. if(!newGamePlusInitialized && FactsQuerySum("NewGamePlus")<=0)
  746. {
  747. ModNoDuplicatesAddInventoryComponentFacts(inv);
  748. ModNoDuplicatesAddInventoryComponentFacts(GetHorseManager().GetInventoryComponent());
  749. }
  750. //modNoDuplicates - End
  751. }
  752.  
  753. private function HACK_UnequipWolfLiver()
  754. {
  755. var itemName1, itemName2, itemName3, itemName4 : name;
  756. var item1, item2, item3, item4 : SItemUniqueId;
  757.  
  758. GetItemEquippedOnSlot( EES_Potion1, item1 );
  759. GetItemEquippedOnSlot( EES_Potion2, item2 );
  760. GetItemEquippedOnSlot( EES_Potion3, item3 );
  761. GetItemEquippedOnSlot( EES_Potion4, item4 );
  762.  
  763. if ( inv.IsIdValid( item1 ) )
  764. itemName1 = inv.GetItemName( item1 );
  765. if ( inv.IsIdValid( item2 ) )
  766. itemName2 = inv.GetItemName( item2 );
  767. if ( inv.IsIdValid( item3 ) )
  768. itemName3 = inv.GetItemName( item3 );
  769. if ( inv.IsIdValid( item4 ) )
  770. itemName4 = inv.GetItemName( item4 );
  771.  
  772. if ( itemName1 == 'Wolf liver' || itemName3 == 'Wolf liver' )
  773. {
  774. if ( inv.IsIdValid( item1 ) )
  775. UnequipItem( item1 );
  776. if ( inv.IsIdValid( item3 ) )
  777. UnequipItem( item3 );
  778. }
  779. else if ( itemName2 == 'Wolf liver' || itemName4 == 'Wolf liver' )
  780. {
  781. if ( inv.IsIdValid( item2 ) )
  782. UnequipItem( item2 );
  783. if ( inv.IsIdValid( item4 ) )
  784. UnequipItem( item4 );
  785. }
  786. }
  787.  
  788.  
  789.  
  790.  
  791.  
  792. timer function DelayedHorseUpdate( dt : float, id : int )
  793. {
  794. var man : W3HorseManager;
  795.  
  796. man = GetHorseManager();
  797. if(man)
  798. {
  799. if ( man.ApplyHorseUpdateOnSpawn() )
  800. {
  801.  
  802. UpdateEncumbrance();
  803.  
  804. RemoveTimer( 'DelayedHorseUpdate' );
  805. }
  806. }
  807. }
  808.  
  809. event OnAbilityAdded( abilityName : name)
  810. {
  811. super.OnAbilityAdded(abilityName);
  812.  
  813. if( HasAbility('Runeword 4 _Stats', true) )
  814. {
  815. StartVitalityRegen();
  816. }
  817.  
  818. // W3EE - Begin
  819. /*if ( abilityName == 'Runeword 8 _Stats' && GetStat(BCS_Focus, true) >= GetStatMax(BCS_Focus) && !HasBuff(EET_Runeword8) )
  820. {
  821. AddEffectDefault(EET_Runeword8, this, "equipped item");
  822. }*/
  823. // W3EE - End
  824. }
  825.  
  826. private final function AddStartingSchematics()
  827. {
  828. AddCraftingSchematic('Starting Armor Upgrade schematic 1', true,true);
  829. AddCraftingSchematic('Thread schematic', true, true);
  830. AddCraftingSchematic('String schematic', true, true);
  831. AddCraftingSchematic('Linen schematic', true, true);
  832. AddCraftingSchematic('Cloth schematic', true, true);
  833. AddCraftingSchematic('Silk schematic', true, true);
  834. AddCraftingSchematic('Resin schematic', true, true);
  835. AddCraftingSchematic('Blasting powder schematic', true, true);
  836. AddCraftingSchematic('Haft schematic', true, true);
  837. AddCraftingSchematic('Hardened timber schematic', true, true);
  838. AddCraftingSchematic('Leather squares schematic', true, true);
  839. AddCraftingSchematic('Leather schematic', true, true);
  840. AddCraftingSchematic('Hardened leather schematic', true, true);
  841. AddCraftingSchematic('Draconide leather schematic', true, true);
  842. AddCraftingSchematic('Iron ingot schematic', true, true);
  843. AddCraftingSchematic('Steel ingot schematic', true, true);
  844. AddCraftingSchematic('Steel ingot schematic 1', true, true);
  845. AddCraftingSchematic('Steel plate schematic', true, true);
  846. AddCraftingSchematic('Dark iron ingot schematic', true, true);
  847. AddCraftingSchematic('Dark iron plate schematic', true, true);
  848. AddCraftingSchematic('Dark steel ingot schematic', true, true);
  849. AddCraftingSchematic('Dark steel ingot schematic 1', true, true);
  850. AddCraftingSchematic('Dark steel plate schematic', true, true);
  851. AddCraftingSchematic('Silver ore schematic', true, true);
  852. AddCraftingSchematic('Silver ingot schematic', true, true);
  853. AddCraftingSchematic('Silver ingot schematic 1', true, true);
  854. AddCraftingSchematic('Silver plate schematic', true, true);
  855. AddCraftingSchematic('Meteorite ingot schematic', true, true);
  856. AddCraftingSchematic('Meteorite silver ingot schematic', true, true);
  857. AddCraftingSchematic('Meteorite silver plate schematic', true, true);
  858. AddCraftingSchematic('Glowing ingot schematic', true, true);
  859. AddCraftingSchematic('Dwimeryte ore schematic', true, true);
  860. AddCraftingSchematic('Dwimeryte ingot schematic', true, true);
  861. AddCraftingSchematic('Dwimeryte ingot schematic 1', true, true);
  862. AddCraftingSchematic('Dwimeryte plate schematic', true, true);
  863. AddCraftingSchematic('Infused dust schematic', true, true);
  864. AddCraftingSchematic('Infused shard schematic', true, true);
  865. AddCraftingSchematic('Infused crystal schematic', true, true);
  866.  
  867. if ( theGame.GetDLCManager().IsEP2Available() )
  868. {
  869. AddCraftingSchematic('Draconide infused leather schematic', true, true);
  870. AddCraftingSchematic('Nickel ore schematic', true, true);
  871. AddCraftingSchematic('Cupronickel ore schematic', true, true);
  872. AddCraftingSchematic('Copper ore schematic', true, true);
  873. AddCraftingSchematic('Copper ingot schematic', true, true);
  874. AddCraftingSchematic('Copper plate schematic', true, true);
  875. AddCraftingSchematic('Green gold ore schematic', true, true);
  876. AddCraftingSchematic('Green gold ore schematic 1', true, true);
  877. AddCraftingSchematic('Green gold ingot schematic', true, true);
  878. AddCraftingSchematic('Green gold plate schematic', true, true);
  879. AddCraftingSchematic('Orichalcum ore schematic', true, true);
  880. AddCraftingSchematic('Orichalcum ore schematic 1', true, true);
  881. AddCraftingSchematic('Orichalcum ingot schematic', true, true);
  882. AddCraftingSchematic('Orichalcum plate schematic', true, true);
  883. AddCraftingSchematic('Dwimeryte enriched ore schematic', true, true);
  884. AddCraftingSchematic('Dwimeryte enriched ingot schematic', true, true);
  885. AddCraftingSchematic('Dwimeryte enriched plate schematic', true, true);
  886. }
  887. }
  888.  
  889. private final function ApplyPatchFixes()
  890. {
  891. var cnt, transmutationCount, mutagenCount, i, slot : int;
  892. var transmutationAbility, itemName : name;
  893. var pam : W3PlayerAbilityManager;
  894. var slotId : int;
  895. var offset : float;
  896. var buffs : array<CBaseGameplayEffect>;
  897. var skill : SSimpleSkill;
  898. var spentSkillPoints, swordSkillPointsSpent, alchemySkillPointsSpent, perkSkillPointsSpent, pointsToAdd : int;
  899.  
  900. if(FactsQuerySum("ClearingPotionPassiveBonusFix") < 1)
  901. {
  902. pam = (W3PlayerAbilityManager)abilityManager;
  903.  
  904. // W3EE - Begin
  905. /*cnt = GetAbilityCount('sword_adrenalinegain') - pam.GetPathPointsSpent(ESP_Sword);
  906. if(cnt > 0)
  907. RemoveAbilityMultiple('sword_adrenalinegain', cnt);
  908.  
  909. cnt = GetAbilityCount('magic_staminaregen') - pam.GetPathPointsSpent(ESP_Signs);
  910. if(cnt > 0)
  911. RemoveAbilityMultiple('magic_staminaregen', cnt);*/
  912. // W3EE - End
  913.  
  914. cnt = GetAbilityCount('alchemy_potionduration') - pam.GetPathPointsSpent(ESP_Alchemy);
  915. if(cnt > 0)
  916. RemoveAbilityMultiple('alchemy_potionduration', cnt);
  917.  
  918. FactsAdd("ClearingPotionPassiveBonusFix");
  919. }
  920.  
  921.  
  922. if(FactsQuerySum("DimeritiumSynergyFix") < 1)
  923. {
  924. slotId = GetSkillSlotID(S_Alchemy_s19);
  925. if(slotId != -1)
  926. UnequipSkill(S_Alchemy_s19);
  927.  
  928. RemoveAbilityAll('greater_mutagen_color_green_synergy_bonus');
  929. RemoveAbilityAll('mutagen_color_green_synergy_bonus');
  930. RemoveAbilityAll('mutagen_color_lesser_green_synergy_bonus');
  931.  
  932. RemoveAbilityAll('greater_mutagen_color_blue_synergy_bonus');
  933. RemoveAbilityAll('mutagen_color_blue_synergy_bonus');
  934. RemoveAbilityAll('mutagen_color_lesser_blue_synergy_bonus');
  935.  
  936. RemoveAbilityAll('greater_mutagen_color_red_synergy_bonus');
  937. RemoveAbilityAll('mutagen_color_red_synergy_bonus');
  938. RemoveAbilityAll('mutagen_color_lesser_red_synergy_bonus');
  939.  
  940. if(slotId != -1)
  941. EquipSkill(S_Alchemy_s19, slotId);
  942.  
  943. FactsAdd("DimeritiumSynergyFix");
  944. }
  945.  
  946.  
  947. if(FactsQuerySum("DontShowRecipePinTut") < 1)
  948. {
  949. FactsAdd( "DontShowRecipePinTut" );
  950. TutorialScript('alchemyRecipePin', '');
  951. TutorialScript('craftingRecipePin', '');
  952. }
  953.  
  954.  
  955. /*if(FactsQuerySum("LevelReqPotGiven") < 1)
  956. {
  957. FactsAdd("LevelReqPotGiven");
  958. inv.AddAnItem('Wolf Hour', 1, false, false, true);
  959. }*/
  960.  
  961.  
  962. if(!HasBuff(EET_AutoStaminaRegen))
  963. {
  964. AddEffectDefault(EET_AutoStaminaRegen, this, 'autobuff', false);
  965. }
  966.  
  967.  
  968.  
  969. buffs = GetBuffs();
  970. offset = 0;
  971. //mutagenCount = 0;
  972.  
  973. if(offset != (GetStat(BCS_Toxicity) - GetStat(BCS_Toxicity, true)))
  974. SetToxicityOffset(offset);
  975.  
  976.  
  977. /*mutagenCount *= GetSkillLevel(S_Alchemy_s13);
  978. transmutationAbility = GetSkillAbilityName(S_Alchemy_s13);
  979. transmutationCount = GetAbilityCount(transmutationAbility);
  980. if(mutagenCount < transmutationCount)
  981. {
  982. RemoveAbilityMultiple(transmutationAbility, transmutationCount - mutagenCount);
  983. }
  984. else if(mutagenCount > transmutationCount)
  985. {
  986. AddAbilityMultiple(transmutationAbility, mutagenCount - transmutationCount);
  987. }*/
  988.  
  989.  
  990. if(theGame.GetDLCManager().IsEP1Available())
  991. {
  992. theGame.GetJournalManager().ActivateEntryByScriptTag('TutorialJournalEnchanting', JS_Active);
  993. }
  994.  
  995.  
  996. if(HasAbility('sword_s19') && FactsQuerySum("Patch_Sword_s19") < 1)
  997. {
  998. pam = (W3PlayerAbilityManager)abilityManager;
  999.  
  1000.  
  1001. skill.level = 0;
  1002. for(i = S_Magic_s01; i <= S_Magic_s20; i+=1)
  1003. {
  1004. skill.skillType = i;
  1005. pam.RemoveTemporarySkill(skill);
  1006. }
  1007.  
  1008.  
  1009. spentSkillPoints = levelManager.GetPointsUsed(ESkillPoint);
  1010. swordSkillPointsSpent = pam.GetPathPointsSpent(ESP_Sword);
  1011. alchemySkillPointsSpent = pam.GetPathPointsSpent(ESP_Alchemy);
  1012. perkSkillPointsSpent = pam.GetPathPointsSpent(ESP_Perks);
  1013.  
  1014. pointsToAdd = spentSkillPoints - swordSkillPointsSpent - alchemySkillPointsSpent - perkSkillPointsSpent;
  1015. if(pointsToAdd > 0)
  1016. levelManager.UnspendPoints(ESkillPoint, pointsToAdd);
  1017.  
  1018.  
  1019. RemoveAbilityAll('sword_s19');
  1020.  
  1021.  
  1022. FactsAdd("Patch_Sword_s19");
  1023. }
  1024.  
  1025.  
  1026. if( HasAbility( 'sword_s19' ) )
  1027. {
  1028. RemoveAbilityAll( 'sword_s19' );
  1029. }
  1030.  
  1031.  
  1032. if(FactsQuerySum("Patch_Armor_Type_Glyphwords") < 1)
  1033. {
  1034. pam = (W3PlayerAbilityManager)abilityManager;
  1035.  
  1036. pam.SetPerkArmorBonus( S_Perk_05, this );
  1037. pam.SetPerkArmorBonus( S_Perk_06, this );
  1038. pam.SetPerkArmorBonus( S_Perk_07, this );
  1039.  
  1040. FactsAdd("Patch_Armor_Type_Glyphwords");
  1041. }
  1042. else if( FactsQuerySum("154999") < 1 )
  1043. {
  1044.  
  1045. pam = (W3PlayerAbilityManager)abilityManager;
  1046.  
  1047. pam.SetPerkArmorBonus( S_Perk_05, this );
  1048. pam.SetPerkArmorBonus( S_Perk_06, this );
  1049. pam.SetPerkArmorBonus( S_Perk_07, this );
  1050.  
  1051. FactsAdd("154999");
  1052. }
  1053.  
  1054. if( FactsQuerySum( "154997" ) < 1 )
  1055. {
  1056. if( IsSkillEquipped( S_Alchemy_s18 ) )
  1057. {
  1058. slot = GetSkillSlotID( S_Alchemy_s18 );
  1059. UnequipSkill( slot );
  1060. EquipSkill( S_Alchemy_s18, slot );
  1061. }
  1062. FactsAdd( "154997" );
  1063. }
  1064. if( FactsQuerySum( "Patch_Mutagen_Ing_Stacking" ) < 1 )
  1065. {
  1066. Patch_MutagenStacking();
  1067. FactsAdd( "Patch_Mutagen_Ing_Stacking" );
  1068. }
  1069. }
  1070.  
  1071. private final function Patch_MutagenStacking()
  1072. {
  1073. var i, j, quantity : int;
  1074. var muts : array< SItemUniqueId >;
  1075. var item : SItemUniqueId;
  1076. var mutName : name;
  1077. var wasInArray : bool;
  1078. var mutsToAdd : array< SItemParts >;
  1079. var mutToAdd : SItemParts;
  1080.  
  1081. muts = inv.GetItemsByTag( 'MutagenIngredient' );
  1082. if( GetItemEquippedOnSlot( EES_SkillMutagen1, item ) )
  1083. {
  1084. muts.Remove( item );
  1085. inv.SetItemStackable( item, false );
  1086. }
  1087. if( GetItemEquippedOnSlot( EES_SkillMutagen2, item ) )
  1088. {
  1089. muts.Remove( item );
  1090. inv.SetItemStackable( item, false );
  1091. }
  1092. if( GetItemEquippedOnSlot( EES_SkillMutagen3, item ) )
  1093. {
  1094. muts.Remove( item );
  1095. inv.SetItemStackable( item, false );
  1096. }
  1097. if( GetItemEquippedOnSlot( EES_SkillMutagen4, item ) )
  1098. {
  1099. muts.Remove( item );
  1100. inv.SetItemStackable( item, false );
  1101. }
  1102.  
  1103. for( i=0; i<muts.Size(); i+=1 )
  1104. {
  1105. mutName = inv.GetItemName( muts[i] );
  1106. quantity = inv.GetItemQuantity( muts[i] );
  1107.  
  1108. wasInArray = false;
  1109. for( j=0; j<mutsToAdd.Size(); j+=1 )
  1110. {
  1111. if( mutsToAdd[j].itemName == mutName )
  1112. {
  1113. mutsToAdd[j].quantity += quantity;
  1114. wasInArray = true;
  1115. break;
  1116. }
  1117. }
  1118.  
  1119. if( !wasInArray )
  1120. {
  1121. mutToAdd.itemName = mutName;
  1122. mutToAdd.quantity = quantity;
  1123. mutsToAdd.PushBack( mutToAdd );
  1124. }
  1125.  
  1126. inv.RemoveItem( muts[i], quantity );
  1127. }
  1128.  
  1129. for( i=0; i<mutsToAdd.Size(); i+=1 )
  1130. {
  1131. inv.AddAnItem( mutsToAdd[i].itemName, mutsToAdd[i].quantity, true, true );
  1132. }
  1133. }
  1134.  
  1135. private function FixEquippedMutagens()
  1136. {
  1137. var item : SItemUniqueId;
  1138. if( GetItemEquippedOnSlot( EES_SkillMutagen1, item ) )
  1139. {
  1140. inv.SetItemStackable( item, false );
  1141. }
  1142. if( GetItemEquippedOnSlot( EES_SkillMutagen2, item ) )
  1143. {
  1144. inv.SetItemStackable( item, false );
  1145. }
  1146. if( GetItemEquippedOnSlot( EES_SkillMutagen3, item ) )
  1147. {
  1148. inv.SetItemStackable( item, false );
  1149. }
  1150. if( GetItemEquippedOnSlot( EES_SkillMutagen4, item ) )
  1151. {
  1152. inv.SetItemStackable( item, false );
  1153. }
  1154. }
  1155.  
  1156. public final function RestoreQuen( quenHealth : float, quenDuration : float, optional alternate : bool ) : bool
  1157. {
  1158. var restoredQuen : W3QuenEntity;
  1159.  
  1160. if(quenHealth > 0.f && quenDuration >= 3.f)
  1161. {
  1162. restoredQuen = (W3QuenEntity)theGame.CreateEntity( signs[ST_Quen].template, GetWorldPosition(), GetWorldRotation() );
  1163. restoredQuen.Init( signOwner, signs[ST_Quen].entity, true );
  1164.  
  1165. if( alternate )
  1166. {
  1167. restoredQuen.SetAlternateCast( S_Magic_s04 );
  1168. }
  1169.  
  1170. restoredQuen.OnStarted();
  1171. restoredQuen.OnThrowing();
  1172.  
  1173. if( !alternate )
  1174. {
  1175. restoredQuen.OnEnded();
  1176. }
  1177.  
  1178. restoredQuen.SetDataFromRestore(quenHealth, quenDuration);
  1179.  
  1180. return true;
  1181. }
  1182.  
  1183. return false;
  1184. }
  1185.  
  1186. public function IsInitialized() : bool
  1187. {
  1188. return isInitialized;
  1189. }
  1190.  
  1191. private function NewGamePlusInitialize()
  1192. {
  1193. var questItems : array<name>;
  1194. var horseManager : W3HorseManager;
  1195. var horseInventory : CInventoryComponent;
  1196. var i, missingLevels, expDiff : int;
  1197.  
  1198. super.NewGamePlusInitialize();
  1199.  
  1200.  
  1201. horseManager = (W3HorseManager)EntityHandleGet(horseManagerHandle);
  1202. if(horseManager)
  1203. horseInventory = horseManager.GetInventoryComponent();
  1204.  
  1205.  
  1206. theGame.params.SetNewGamePlusLevel(GetLevel());
  1207.  
  1208.  
  1209. if (theGame.GetDLCManager().IsDLCAvailable('ep1'))
  1210. missingLevels = theGame.params.NEW_GAME_PLUS_EP1_MIN_LEVEL - GetLevel();
  1211. else
  1212. missingLevels = theGame.params.NEW_GAME_PLUS_MIN_LEVEL - GetLevel();
  1213.  
  1214. for(i=0; i<missingLevels; i+=1)
  1215. {
  1216.  
  1217. expDiff = levelManager.GetTotalExpForNextLevel() - levelManager.GetPointsTotal(EExperiencePoint);
  1218. expDiff = CeilF( ((float)expDiff) / 2 );
  1219. AddPoints(EExperiencePoint, expDiff, false);
  1220. }
  1221.  
  1222.  
  1223.  
  1224.  
  1225.  
  1226. inv.RemoveItemByTag('Quest', -1);
  1227. horseInventory.RemoveItemByTag('Quest', -1);
  1228.  
  1229.  
  1230.  
  1231. questItems = theGame.GetDefinitionsManager().GetItemsWithTag('Quest');
  1232. for(i=0; i<questItems.Size(); i+=1)
  1233. {
  1234. inv.RemoveItemByName(questItems[i], -1);
  1235. horseInventory.RemoveItemByName(questItems[i], -1);
  1236. }
  1237.  
  1238.  
  1239. inv.RemoveItemByName('mq1002_artifact_3', -1);
  1240. horseInventory.RemoveItemByName('mq1002_artifact_3', -1);
  1241.  
  1242.  
  1243. inv.RemoveItemByTag('NotTransferableToNGP', -1);
  1244. horseInventory.RemoveItemByTag('NotTransferableToNGP', -1);
  1245.  
  1246.  
  1247. inv.RemoveItemByTag('NoticeBoardNote', -1);
  1248. horseInventory.RemoveItemByTag('NoticeBoardNote', -1);
  1249.  
  1250.  
  1251. RemoveAllNonAutoBuffs();
  1252.  
  1253.  
  1254. RemoveAlchemyRecipe('Recipe for Trial Potion Kit');
  1255. RemoveAlchemyRecipe('Recipe for Pops Antidote');
  1256. RemoveAlchemyRecipe('Recipe for Czart Lure');
  1257. RemoveAlchemyRecipe('q603_diarrhea_potion_recipe');
  1258.  
  1259.  
  1260. inv.RemoveItemByTag('Trophy', -1);
  1261. horseInventory.RemoveItemByTag('Trophy', -1);
  1262.  
  1263.  
  1264. inv.RemoveItemByCategory('usable', -1);
  1265. horseInventory.RemoveItemByCategory('usable', -1);
  1266.  
  1267.  
  1268. RemoveAbility('StaminaTutorialProlog');
  1269. RemoveAbility('TutorialStaminaRegenHack');
  1270. RemoveAbility('area_novigrad');
  1271. RemoveAbility('NoRegenEffect');
  1272. RemoveAbility('HeavySwimmingStaminaDrain');
  1273. RemoveAbility('AirBoost');
  1274. RemoveAbility('area_nml');
  1275. RemoveAbility('area_skellige');
  1276.  
  1277.  
  1278. inv.RemoveItemByTag('GwintCard', -1);
  1279. horseInventory.RemoveItemByTag('GwintCard', -1);
  1280.  
  1281.  
  1282.  
  1283. inv.RemoveItemByTag('ReadableItem', -1);
  1284. horseInventory.RemoveItemByTag('ReadableItem', -1);
  1285.  
  1286.  
  1287. abilityManager.RestoreStats();
  1288.  
  1289.  
  1290. ((W3PlayerAbilityManager)abilityManager).RemoveToxicityOffset(10000);
  1291.  
  1292. // W3EE - Begin
  1293. //GetInventory().SingletonItemsRefillAmmo();
  1294. GetInventory().SingletonItemsRefillAmmoNoAlco(true);
  1295. // W3EE - End
  1296.  
  1297. craftingSchematics.Clear();
  1298. AddStartingSchematics();
  1299.  
  1300.  
  1301. for( i=0; i<amountOfSetPiecesEquipped.Size(); i+=1 )
  1302. {
  1303. amountOfSetPiecesEquipped[i] = 0;
  1304. }
  1305.  
  1306.  
  1307. inv.AddAnItem('Clearing Potion', 1, true, false, false);
  1308.  
  1309.  
  1310. inv.RemoveItemByName('q203_broken_eyeofloki', -1);
  1311. horseInventory.RemoveItemByName('q203_broken_eyeofloki', -1);
  1312.  
  1313.  
  1314. NewGamePlusReplaceViperSet(inv);
  1315. NewGamePlusReplaceViperSet(horseInventory);
  1316. NewGamePlusReplaceLynxSet(inv);
  1317. NewGamePlusReplaceLynxSet(horseInventory);
  1318. NewGamePlusReplaceGryphonSet(inv);
  1319. NewGamePlusReplaceGryphonSet(horseInventory);
  1320. NewGamePlusReplaceBearSet(inv);
  1321. NewGamePlusReplaceBearSet(horseInventory);
  1322. NewGamePlusReplaceEP1(inv);
  1323. NewGamePlusReplaceEP1(horseInventory);
  1324. NewGamePlusReplaceEP2WitcherSets(inv);
  1325. NewGamePlusReplaceEP2WitcherSets(horseInventory);
  1326. NewGamePlusReplaceEP2Items(inv);
  1327. NewGamePlusReplaceEP2Items(horseInventory);
  1328. NewGamePlusMarkItemsToNotAdjust(inv);
  1329. NewGamePlusMarkItemsToNotAdjust(horseInventory);
  1330.  
  1331.  
  1332. inputHandler.ClearLocksForNGP();
  1333.  
  1334.  
  1335. buffImmunities.Clear();
  1336. buffRemovedImmunities.Clear();
  1337.  
  1338. newGamePlusInitialized = true;
  1339.  
  1340. //modNoDuplicates - Begin
  1341. ModNoDuplicatesAddInventoryItemsModifiers(inv);
  1342. ModNoDuplicatesAddInventoryItemsModifiers(horseInventory);
  1343. //modNoDuplicates - End
  1344.  
  1345. m_quenReappliedCount = 1;
  1346. }
  1347.  
  1348. private final function NewGamePlusMarkItemsToNotAdjust(out inv : CInventoryComponent)
  1349. {
  1350. var ids : array<SItemUniqueId>;
  1351. var i : int;
  1352. var n : name;
  1353.  
  1354. inv.GetAllItems(ids);
  1355. for( i=0; i<ids.Size(); i+=1 )
  1356. {
  1357. inv.SetItemModifierInt(ids[i], 'NGPItemAdjusted', 1);
  1358. }
  1359. }
  1360.  
  1361. private final function NewGamePlusReplaceItem( item : name, new_item : name, out inv : CInventoryComponent)
  1362. {
  1363. var i, j : int;
  1364. var ids, new_ids, enh_ids : array<SItemUniqueId>;
  1365. var dye_ids : array<SItemUniqueId>;
  1366. var enh : array<name>;
  1367. var wasEquipped : bool;
  1368. var wasEnchanted : bool;
  1369. var wasDyed : bool;
  1370. var enchantName, colorName : name;
  1371.  
  1372. if ( inv.HasItem( item ) )
  1373. {
  1374. ids = inv.GetItemsIds(item);
  1375. for (i = 0; i < ids.Size(); i += 1)
  1376. {
  1377. inv.GetItemEnhancementItems( ids[i], enh );
  1378. wasEnchanted = inv.IsItemEnchanted( ids[i] );
  1379. if ( wasEnchanted )
  1380. enchantName = inv.GetEnchantment( ids[i] );
  1381. wasEquipped = IsItemEquipped( ids[i] );
  1382. wasDyed = inv.IsItemColored( ids[i] );
  1383. if ( wasDyed )
  1384. {
  1385. colorName = inv.GetItemColor( ids[i] );
  1386. }
  1387.  
  1388. inv.RemoveItem( ids[i], 1 );
  1389. new_ids = inv.AddAnItem( new_item, 1, true, true, false );
  1390. if ( wasEquipped )
  1391. {
  1392. EquipItem( new_ids[0] );
  1393. }
  1394. if ( wasEnchanted )
  1395. {
  1396. inv.EnchantItem( new_ids[0], enchantName, getEnchamtmentStatName(enchantName) );
  1397. }
  1398. for (j = 0; j < enh.Size(); j += 1)
  1399. {
  1400. enh_ids = inv.AddAnItem( enh[j], 1, true, true, false );
  1401. inv.EnhanceItemScript( new_ids[0], enh_ids[0] );
  1402. }
  1403. if ( wasDyed )
  1404. {
  1405. dye_ids = inv.AddAnItem( colorName, 1, true, true, false );
  1406. inv.ColorItem( new_ids[0], dye_ids[0] );
  1407. inv.RemoveItem( dye_ids[0], 1 );
  1408. }
  1409.  
  1410. inv.SetItemModifierInt( new_ids[0], 'NGPItemAdjusted', 1 );
  1411. }
  1412. }
  1413. }
  1414.  
  1415. private final function NewGamePlusAdjustDLCItem(item : name, mod : name, inv : CInventoryComponent)
  1416. {
  1417. var ids : array<SItemUniqueId>;
  1418. var i : int;
  1419.  
  1420. if( inv.HasItem(item) )
  1421. {
  1422. ids = inv.GetItemsIds(item);
  1423. for (i = 0; i < ids.Size(); i += 1)
  1424. {
  1425. if ( inv.GetItemModifierInt(ids[i], 'DoNotAdjustNGPDLC') <= 0 )
  1426. {
  1427. inv.AddItemBaseAbility(ids[i], mod);
  1428. inv.SetItemModifierInt(ids[i], 'DoNotAdjustNGPDLC', 1);
  1429. }
  1430. }
  1431. }
  1432.  
  1433. }
  1434.  
  1435. private final function NewGamePlusAdjustDLC1TemerianSet(inv : CInventoryComponent)
  1436. {
  1437. NewGamePlusAdjustDLCItem('NGP DLC1 Temerian Armor', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1438. NewGamePlusAdjustDLCItem('NGP DLC1 Temerian Gloves', 'NGP DLC Compatibility Armor Mod', inv);
  1439. NewGamePlusAdjustDLCItem('NGP DLC1 Temerian Pants', 'NGP DLC Compatibility Armor Mod', inv);
  1440. NewGamePlusAdjustDLCItem('NGP DLC1 Temerian Boots', 'NGP DLC Compatibility Armor Mod', inv);
  1441. }
  1442.  
  1443. private final function NewGamePlusAdjustDLC5NilfgardianSet(inv : CInventoryComponent)
  1444. {
  1445. NewGamePlusAdjustDLCItem('NGP DLC5 Nilfgaardian Armor', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1446. NewGamePlusAdjustDLCItem('NGP DLC5 Nilfgaardian Gloves', 'NGP DLC Compatibility Armor Mod', inv);
  1447. NewGamePlusAdjustDLCItem('NGP DLC5 Nilfgaardian Pants', 'NGP DLC Compatibility Armor Mod', inv);
  1448. NewGamePlusAdjustDLCItem('NGP DLC5 Nilfgaardian Boots', 'NGP DLC Compatibility Armor Mod', inv);
  1449. }
  1450.  
  1451. private final function NewGamePlusAdjustDLC10WolfSet(inv : CInventoryComponent)
  1452. {
  1453. NewGamePlusAdjustDLCItem('NGP Wolf Armor', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1454. NewGamePlusAdjustDLCItem('NGP Wolf Armor 1', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1455. NewGamePlusAdjustDLCItem('NGP Wolf Armor 2', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1456. NewGamePlusAdjustDLCItem('NGP Wolf Armor 3', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1457.  
  1458. NewGamePlusAdjustDLCItem('NGP Wolf Boots 1', 'NGP DLC Compatibility Armor Mod', inv);
  1459. NewGamePlusAdjustDLCItem('NGP Wolf Boots 2', 'NGP DLC Compatibility Armor Mod', inv);
  1460. NewGamePlusAdjustDLCItem('NGP Wolf Boots 3', 'NGP DLC Compatibility Armor Mod', inv);
  1461. NewGamePlusAdjustDLCItem('NGP Wolf Boots 4', 'NGP DLC Compatibility Armor Mod', inv);
  1462.  
  1463. NewGamePlusAdjustDLCItem('NGP Wolf Gloves 1', 'NGP DLC Compatibility Armor Mod', inv);
  1464. NewGamePlusAdjustDLCItem('NGP Wolf Gloves 2', 'NGP DLC Compatibility Armor Mod', inv);
  1465. NewGamePlusAdjustDLCItem('NGP Wolf Gloves 3', 'NGP DLC Compatibility Armor Mod', inv);
  1466. NewGamePlusAdjustDLCItem('NGP Wolf Gloves 4', 'NGP DLC Compatibility Armor Mod', inv);
  1467.  
  1468. NewGamePlusAdjustDLCItem('NGP Wolf Pants 1', 'NGP DLC Compatibility Armor Mod', inv);
  1469. NewGamePlusAdjustDLCItem('NGP Wolf Pants 2', 'NGP DLC Compatibility Armor Mod', inv);
  1470. NewGamePlusAdjustDLCItem('NGP Wolf Pants 3', 'NGP DLC Compatibility Armor Mod', inv);
  1471. NewGamePlusAdjustDLCItem('NGP Wolf Pants 4', 'NGP DLC Compatibility Armor Mod', inv);
  1472.  
  1473. NewGamePlusAdjustDLCItem('NGP Wolf School steel sword', 'NGP Wolf Steel Sword Mod', inv);
  1474. NewGamePlusAdjustDLCItem('NGP Wolf School steel sword 1', 'NGP Wolf Steel Sword Mod', inv);
  1475. NewGamePlusAdjustDLCItem('NGP Wolf School steel sword 2', 'NGP Wolf Steel Sword Mod', inv);
  1476. NewGamePlusAdjustDLCItem('NGP Wolf School steel sword 3', 'NGP Wolf Steel Sword Mod', inv);
  1477.  
  1478. NewGamePlusAdjustDLCItem('NGP Wolf School silver sword', 'NGP Wolf Silver Sword Mod', inv);
  1479. NewGamePlusAdjustDLCItem('NGP Wolf School silver sword 1', 'NGP Wolf Silver Sword Mod', inv);
  1480. NewGamePlusAdjustDLCItem('NGP Wolf School silver sword 2', 'NGP Wolf Silver Sword Mod', inv);
  1481. NewGamePlusAdjustDLCItem('NGP Wolf School silver sword 3', 'NGP Wolf Silver Sword Mod', inv);
  1482. }
  1483.  
  1484. private final function NewGamePlusAdjustDLC14SkelligeSet(inv : CInventoryComponent)
  1485. {
  1486. NewGamePlusAdjustDLCItem('NGP DLC14 Skellige Armor', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1487. NewGamePlusAdjustDLCItem('NGP DLC14 Skellige Gloves', 'NGP DLC Compatibility Armor Mod', inv);
  1488. NewGamePlusAdjustDLCItem('NGP DLC14 Skellige Pants', 'NGP DLC Compatibility Armor Mod', inv);
  1489. NewGamePlusAdjustDLCItem('NGP DLC14 Skellige Boots', 'NGP DLC Compatibility Armor Mod', inv);
  1490. }
  1491.  
  1492. private final function NewGamePlusReplaceViperSet(out inv : CInventoryComponent)
  1493. {
  1494. NewGamePlusReplaceItem('Viper School steel sword', 'NGP Viper School steel sword', inv);
  1495.  
  1496. NewGamePlusReplaceItem('Viper School silver sword', 'NGP Viper School silver sword', inv);
  1497. }
  1498.  
  1499. private final function NewGamePlusReplaceLynxSet(out inv : CInventoryComponent)
  1500. {
  1501. NewGamePlusReplaceItem('Lynx Armor', 'NGP Lynx Armor', inv);
  1502. NewGamePlusReplaceItem('Lynx Armor 1', 'NGP Lynx Armor 1', inv);
  1503. NewGamePlusReplaceItem('Lynx Armor 2', 'NGP Lynx Armor 2', inv);
  1504. NewGamePlusReplaceItem('Lynx Armor 3', 'NGP Lynx Armor 3', inv);
  1505.  
  1506. NewGamePlusReplaceItem('Lynx Gloves 1', 'NGP Lynx Gloves 1', inv);
  1507. NewGamePlusReplaceItem('Lynx Gloves 2', 'NGP Lynx Gloves 2', inv);
  1508. NewGamePlusReplaceItem('Lynx Gloves 3', 'NGP Lynx Gloves 3', inv);
  1509. NewGamePlusReplaceItem('Lynx Gloves 4', 'NGP Lynx Gloves 4', inv);
  1510.  
  1511. NewGamePlusReplaceItem('Lynx Pants 1', 'NGP Lynx Pants 1', inv);
  1512. NewGamePlusReplaceItem('Lynx Pants 2', 'NGP Lynx Pants 2', inv);
  1513. NewGamePlusReplaceItem('Lynx Pants 3', 'NGP Lynx Pants 3', inv);
  1514. NewGamePlusReplaceItem('Lynx Pants 4', 'NGP Lynx Pants 4', inv);
  1515.  
  1516. NewGamePlusReplaceItem('Lynx Boots 1', 'NGP Lynx Boots 1', inv);
  1517. NewGamePlusReplaceItem('Lynx Boots 2', 'NGP Lynx Boots 2', inv);
  1518. NewGamePlusReplaceItem('Lynx Boots 3', 'NGP Lynx Boots 3', inv);
  1519. NewGamePlusReplaceItem('Lynx Boots 4', 'NGP Lynx Boots 4', inv);
  1520.  
  1521. NewGamePlusReplaceItem('Lynx School steel sword', 'NGP Lynx School steel sword', inv);
  1522. NewGamePlusReplaceItem('Lynx School steel sword 1', 'NGP Lynx School steel sword 1', inv);
  1523. NewGamePlusReplaceItem('Lynx School steel sword 2', 'NGP Lynx School steel sword 2', inv);
  1524. NewGamePlusReplaceItem('Lynx School steel sword 3', 'NGP Lynx School steel sword 3', inv);
  1525.  
  1526. NewGamePlusReplaceItem('Lynx School silver sword', 'NGP Lynx School silver sword', inv);
  1527. NewGamePlusReplaceItem('Lynx School silver sword 1', 'NGP Lynx School silver sword 1', inv);
  1528. NewGamePlusReplaceItem('Lynx School silver sword 2', 'NGP Lynx School silver sword 2', inv);
  1529. NewGamePlusReplaceItem('Lynx School silver sword 3', 'NGP Lynx School silver sword 3', inv);
  1530. }
  1531.  
  1532. private final function NewGamePlusReplaceGryphonSet(out inv : CInventoryComponent)
  1533. {
  1534. NewGamePlusReplaceItem('Gryphon Armor', 'NGP Gryphon Armor', inv);
  1535. NewGamePlusReplaceItem('Gryphon Armor 1', 'NGP Gryphon Armor 1', inv);
  1536. NewGamePlusReplaceItem('Gryphon Armor 2', 'NGP Gryphon Armor 2', inv);
  1537. NewGamePlusReplaceItem('Gryphon Armor 3', 'NGP Gryphon Armor 3', inv);
  1538.  
  1539. NewGamePlusReplaceItem('Gryphon Gloves 1', 'NGP Gryphon Gloves 1', inv);
  1540. NewGamePlusReplaceItem('Gryphon Gloves 2', 'NGP Gryphon Gloves 2', inv);
  1541. NewGamePlusReplaceItem('Gryphon Gloves 3', 'NGP Gryphon Gloves 3', inv);
  1542. NewGamePlusReplaceItem('Gryphon Gloves 4', 'NGP Gryphon Gloves 4', inv);
  1543.  
  1544. NewGamePlusReplaceItem('Gryphon Pants 1', 'NGP Gryphon Pants 1', inv);
  1545. NewGamePlusReplaceItem('Gryphon Pants 2', 'NGP Gryphon Pants 2', inv);
  1546. NewGamePlusReplaceItem('Gryphon Pants 3', 'NGP Gryphon Pants 3', inv);
  1547. NewGamePlusReplaceItem('Gryphon Pants 4', 'NGP Gryphon Pants 4', inv);
  1548.  
  1549. NewGamePlusReplaceItem('Gryphon Boots 1', 'NGP Gryphon Boots 1', inv);
  1550. NewGamePlusReplaceItem('Gryphon Boots 2', 'NGP Gryphon Boots 2', inv);
  1551. NewGamePlusReplaceItem('Gryphon Boots 3', 'NGP Gryphon Boots 3', inv);
  1552. NewGamePlusReplaceItem('Gryphon Boots 4', 'NGP Gryphon Boots 4', inv);
  1553.  
  1554. NewGamePlusReplaceItem('Gryphon School steel sword', 'NGP Gryphon School steel sword', inv);
  1555. NewGamePlusReplaceItem('Gryphon School steel sword 1', 'NGP Gryphon School steel sword 1', inv);
  1556. NewGamePlusReplaceItem('Gryphon School steel sword 2', 'NGP Gryphon School steel sword 2', inv);
  1557. NewGamePlusReplaceItem('Gryphon School steel sword 3', 'NGP Gryphon School steel sword 3', inv);
  1558.  
  1559. NewGamePlusReplaceItem('Gryphon School silver sword', 'NGP Gryphon School silver sword', inv);
  1560. NewGamePlusReplaceItem('Gryphon School silver sword 1', 'NGP Gryphon School silver sword 1', inv);
  1561. NewGamePlusReplaceItem('Gryphon School silver sword 2', 'NGP Gryphon School silver sword 2', inv);
  1562. NewGamePlusReplaceItem('Gryphon School silver sword 3', 'NGP Gryphon School silver sword 3', inv);
  1563. }
  1564.  
  1565. private final function NewGamePlusReplaceBearSet(out inv : CInventoryComponent)
  1566. {
  1567. NewGamePlusReplaceItem('Bear Armor', 'NGP Bear Armor', inv);
  1568. NewGamePlusReplaceItem('Bear Armor 1', 'NGP Bear Armor 1', inv);
  1569. NewGamePlusReplaceItem('Bear Armor 2', 'NGP Bear Armor 2', inv);
  1570. NewGamePlusReplaceItem('Bear Armor 3', 'NGP Bear Armor 3', inv);
  1571.  
  1572. NewGamePlusReplaceItem('Bear Gloves 1', 'NGP Bear Gloves 1', inv);
  1573. NewGamePlusReplaceItem('Bear Gloves 2', 'NGP Bear Gloves 2', inv);
  1574. NewGamePlusReplaceItem('Bear Gloves 3', 'NGP Bear Gloves 3', inv);
  1575. NewGamePlusReplaceItem('Bear Gloves 4', 'NGP Bear Gloves 4', inv);
  1576.  
  1577. NewGamePlusReplaceItem('Bear Pants 1', 'NGP Bear Pants 1', inv);
  1578. NewGamePlusReplaceItem('Bear Pants 2', 'NGP Bear Pants 2', inv);
  1579. NewGamePlusReplaceItem('Bear Pants 3', 'NGP Bear Pants 3', inv);
  1580. NewGamePlusReplaceItem('Bear Pants 4', 'NGP Bear Pants 4', inv);
  1581.  
  1582. NewGamePlusReplaceItem('Bear Boots 1', 'NGP Bear Boots 1', inv);
  1583. NewGamePlusReplaceItem('Bear Boots 2', 'NGP Bear Boots 2', inv);
  1584. NewGamePlusReplaceItem('Bear Boots 3', 'NGP Bear Boots 3', inv);
  1585. NewGamePlusReplaceItem('Bear Boots 4', 'NGP Bear Boots 4', inv);
  1586.  
  1587. NewGamePlusReplaceItem('Bear School steel sword', 'NGP Bear School steel sword', inv);
  1588. NewGamePlusReplaceItem('Bear School steel sword 1', 'NGP Bear School steel sword 1', inv);
  1589. NewGamePlusReplaceItem('Bear School steel sword 2', 'NGP Bear School steel sword 2', inv);
  1590. NewGamePlusReplaceItem('Bear School steel sword 3', 'NGP Bear School steel sword 3', inv);
  1591.  
  1592. NewGamePlusReplaceItem('Bear School silver sword', 'NGP Bear School silver sword', inv);
  1593. NewGamePlusReplaceItem('Bear School silver sword 1', 'NGP Bear School silver sword 1', inv);
  1594. NewGamePlusReplaceItem('Bear School silver sword 2', 'NGP Bear School silver sword 2', inv);
  1595. NewGamePlusReplaceItem('Bear School silver sword 3', 'NGP Bear School silver sword 3', inv);
  1596. }
  1597.  
  1598. private final function NewGamePlusReplaceEP1(out inv : CInventoryComponent)
  1599. {
  1600. NewGamePlusReplaceItem('Ofir Armor', 'NGP Ofir Armor', inv);
  1601. NewGamePlusReplaceItem('Ofir Sabre 2', 'NGP Ofir Sabre 2', inv);
  1602.  
  1603. NewGamePlusReplaceItem('Crafted Burning Rose Armor', 'NGP Crafted Burning Rose Armor', inv);
  1604. NewGamePlusReplaceItem('Crafted Burning Rose Gloves', 'NGP Crafted Burning Rose Gloves', inv);
  1605. NewGamePlusReplaceItem('Crafted Burning Rose Sword', 'NGP Crafted Burning Rose Sword', inv);
  1606.  
  1607. NewGamePlusReplaceItem('Crafted Ofir Armor', 'NGP Crafted Ofir Armor', inv);
  1608. NewGamePlusReplaceItem('Crafted Ofir Boots', 'NGP Crafted Ofir Boots', inv);
  1609. NewGamePlusReplaceItem('Crafted Ofir Gloves', 'NGP Crafted Ofir Gloves', inv);
  1610. NewGamePlusReplaceItem('Crafted Ofir Pants', 'NGP Crafted Ofir Pants', inv);
  1611. NewGamePlusReplaceItem('Crafted Ofir Steel Sword', 'NGP Crafted Ofir Steel Sword', inv);
  1612.  
  1613. NewGamePlusReplaceItem('EP1 Crafted Witcher Silver Sword', 'NGP EP1 Crafted Witcher Silver Sword', inv);
  1614. NewGamePlusReplaceItem('Olgierd Sabre', 'NGP Olgierd Sabre', inv);
  1615.  
  1616. NewGamePlusReplaceItem('EP1 Witcher Armor', 'NGP EP1 Witcher Armor', inv);
  1617. NewGamePlusReplaceItem('EP1 Witcher Boots', 'NGP EP1 Witcher Boots', inv);
  1618. NewGamePlusReplaceItem('EP1 Witcher Gloves', 'NGP EP1 Witcher Gloves', inv);
  1619. NewGamePlusReplaceItem('EP1 Witcher Pants', 'NGP EP1 Witcher Pants', inv);
  1620. NewGamePlusReplaceItem('EP1 Viper School steel sword', 'NGP EP1 Viper School steel sword', inv);
  1621. NewGamePlusReplaceItem('EP1 Viper School silver sword', 'NGP EP1 Viper School silver sword', inv);
  1622. }
  1623.  
  1624. private final function NewGamePlusReplaceEP2WitcherSets(out inv : CInventoryComponent)
  1625. {
  1626. NewGamePlusReplaceItem('Lynx Armor 4', 'NGP Lynx Armor 4', inv);
  1627. NewGamePlusReplaceItem('Gryphon Armor 4', 'NGP Gryphon Armor 4', inv);
  1628. NewGamePlusReplaceItem('Bear Armor 4', 'NGP Bear Armor 4', inv);
  1629. NewGamePlusReplaceItem('Wolf Armor 4', 'NGP Wolf Armor 4', inv);
  1630. NewGamePlusReplaceItem('Red Wolf Armor 1', 'NGP Red Wolf Armor 1', inv);
  1631.  
  1632. NewGamePlusReplaceItem('Lynx Gloves 5', 'NGP Lynx Gloves 5', inv);
  1633. NewGamePlusReplaceItem('Gryphon Gloves 5', 'NGP Gryphon Gloves 5', inv);
  1634. NewGamePlusReplaceItem('Bear Gloves 5', 'NGP Bear Gloves 5', inv);
  1635. NewGamePlusReplaceItem('Wolf Gloves 5', 'NGP Wolf Gloves 5', inv);
  1636. NewGamePlusReplaceItem('Red Wolf Gloves 1', 'NGP Red Wolf Gloves 1', inv);
  1637.  
  1638. NewGamePlusReplaceItem('Lynx Pants 5', 'NGP Lynx Pants 5', inv);
  1639. NewGamePlusReplaceItem('Gryphon Pants 5', 'NGP Gryphon Pants 5', inv);
  1640. NewGamePlusReplaceItem('Bear Pants 5', 'NGP Bear Pants 5', inv);
  1641. NewGamePlusReplaceItem('Wolf Pants 5', 'NGP Wolf Pants 5', inv);
  1642. NewGamePlusReplaceItem('Red Wolf Pants 1', 'NGP Red Wolf Pants 1', inv);
  1643.  
  1644. NewGamePlusReplaceItem('Lynx Boots 5', 'NGP Lynx Boots 5', inv);
  1645. NewGamePlusReplaceItem('Gryphon Boots 5', 'NGP Gryphon Boots 5', inv);
  1646. NewGamePlusReplaceItem('Bear Boots 5', 'NGP Bear Boots 5', inv);
  1647. NewGamePlusReplaceItem('Wolf Boots 5', 'NGP Wolf Boots 5', inv);
  1648. NewGamePlusReplaceItem('Red Wolf Boots 1', 'NGP Red Wolf Boots 1', inv);
  1649.  
  1650.  
  1651. NewGamePlusReplaceItem('Lynx School steel sword 4', 'NGP Lynx School steel sword 4', inv);
  1652. NewGamePlusReplaceItem('Gryphon School steel sword 4', 'NGP Gryphon School steel sword 4', inv);
  1653. NewGamePlusReplaceItem('Bear School steel sword 4', 'NGP Bear School steel sword 4', inv);
  1654. NewGamePlusReplaceItem('Wolf School steel sword 4', 'NGP Wolf School steel sword 4', inv);
  1655. NewGamePlusReplaceItem('Red Wolf School steel sword 1', 'NGP Red Wolf School steel sword 1', inv);
  1656.  
  1657. NewGamePlusReplaceItem('Lynx School silver sword 4', 'NGP Lynx School silver sword 4', inv);
  1658. NewGamePlusReplaceItem('Gryphon School silver sword 4', 'NGP Gryphon School silver sword 4', inv);
  1659. NewGamePlusReplaceItem('Bear School silver sword 4', 'NGP Bear School silver sword 4', inv);
  1660. NewGamePlusReplaceItem('Wolf School silver sword 4', 'NGP Wolf School silver sword 4', inv);
  1661. NewGamePlusReplaceItem('Red Wolf School silver sword 1', 'NGP Red Wolf School silver sword 1', inv);
  1662. }
  1663.  
  1664. private final function NewGamePlusReplaceEP2Items(out inv : CInventoryComponent)
  1665. {
  1666. NewGamePlusReplaceItem('Guard Lvl1 Armor 3', 'NGP Guard Lvl1 Armor 3', inv);
  1667. NewGamePlusReplaceItem('Guard Lvl1 A Armor 3', 'NGP Guard Lvl1 A Armor 3', inv);
  1668. NewGamePlusReplaceItem('Guard Lvl2 Armor 3', 'NGP Guard Lvl2 Armor 3', inv);
  1669. NewGamePlusReplaceItem('Guard Lvl2 A Armor 3', 'NGP Guard Lvl2 A Armor 3', inv);
  1670. NewGamePlusReplaceItem('Knight Geralt Armor 3', 'NGP Knight Geralt Armor 3', inv);
  1671. NewGamePlusReplaceItem('Knight Geralt A Armor 3', 'NGP Knight Geralt A Armor 3', inv);
  1672. NewGamePlusReplaceItem('q702_vampire_armor', 'NGP q702_vampire_armor', inv);
  1673.  
  1674. NewGamePlusReplaceItem('Guard Lvl1 Gloves 3', 'NGP Guard Lvl1 Gloves 3', inv);
  1675. NewGamePlusReplaceItem('Guard Lvl1 A Gloves 3', 'NGP Guard Lvl1 A Gloves 3', inv);
  1676. NewGamePlusReplaceItem('Guard Lvl2 Gloves 3', 'NGP Guard Lvl2 Gloves 3', inv);
  1677. NewGamePlusReplaceItem('Guard Lvl2 A Gloves 3', 'NGP Guard Lvl2 A Gloves 3', inv);
  1678. NewGamePlusReplaceItem('Knight Geralt Gloves 3', 'NGP Knight Geralt Gloves 3', inv);
  1679. NewGamePlusReplaceItem('Knight Geralt A Gloves 3', 'NGP Knight Geralt A Gloves 3', inv);
  1680. NewGamePlusReplaceItem('q702_vampire_gloves', 'NGP q702_vampire_gloves', inv);
  1681.  
  1682. NewGamePlusReplaceItem('Guard Lvl1 Pants 3', 'NGP Guard Lvl1 Pants 3', inv);
  1683. NewGamePlusReplaceItem('Guard Lvl1 A Pants 3', 'NGP Guard Lvl1 A Pants 3', inv);
  1684. NewGamePlusReplaceItem('Guard Lvl2 Pants 3', 'NGP Guard Lvl2 Pants 3', inv);
  1685. NewGamePlusReplaceItem('Guard Lvl2 A Pants 3', 'NGP Guard Lvl2 A Pants 3', inv);
  1686. NewGamePlusReplaceItem('Knight Geralt Pants 3', 'NGP Knight Geralt Pants 3', inv);
  1687. NewGamePlusReplaceItem('Knight Geralt A Pants 3', 'NGP Knight Geralt A Pants 3', inv);
  1688. NewGamePlusReplaceItem('q702_vampire_pants', 'NGP q702_vampire_pants', inv);
  1689.  
  1690. NewGamePlusReplaceItem('Guard Lvl1 Boots 3', 'NGP Guard Lvl1 Boots 3', inv);
  1691. NewGamePlusReplaceItem('Guard Lvl1 A Boots 3', 'NGP Guard Lvl1 A Boots 3', inv);
  1692. NewGamePlusReplaceItem('Guard Lvl2 Boots 3', 'NGP Guard Lvl2 Boots 3', inv);
  1693. NewGamePlusReplaceItem('Guard Lvl2 A Boots 3', 'NGP Guard Lvl2 A Boots 3', inv);
  1694. NewGamePlusReplaceItem('Knight Geralt Boots 3', 'NGP Knight Geralt Boots 3', inv);
  1695. NewGamePlusReplaceItem('Knight Geralt A Boots 3', 'NGP Knight Geralt A Boots 3', inv);
  1696. NewGamePlusReplaceItem('q702_vampire_boots', 'NGP q702_vampire_boots', inv);
  1697.  
  1698. NewGamePlusReplaceItem('Serpent Steel Sword 1', 'NGP Serpent Steel Sword 1', inv);
  1699. NewGamePlusReplaceItem('Serpent Steel Sword 2', 'NGP Serpent Steel Sword 2', inv);
  1700. NewGamePlusReplaceItem('Serpent Steel Sword 3', 'NGP Serpent Steel Sword 3', inv);
  1701. NewGamePlusReplaceItem('Guard lvl1 steel sword 3', 'NGP Guard lvl1 steel sword 3', inv);
  1702. NewGamePlusReplaceItem('Guard lvl2 steel sword 3', 'NGP Guard lvl2 steel sword 3', inv);
  1703. NewGamePlusReplaceItem('Knights steel sword 3', 'NGP Knights steel sword 3', inv);
  1704. NewGamePlusReplaceItem('Hanza steel sword 3', 'NGP Hanza steel sword 3', inv);
  1705. NewGamePlusReplaceItem('Toussaint steel sword 3', 'NGP Toussaint steel sword 3', inv);
  1706. NewGamePlusReplaceItem('q702 vampire steel sword', 'NGP q702 vampire steel sword', inv);
  1707.  
  1708. NewGamePlusReplaceItem('Serpent Silver Sword 1', 'NGP Serpent Silver Sword 1', inv);
  1709. NewGamePlusReplaceItem('Serpent Silver Sword 2', 'NGP Serpent Silver Sword 2', inv);
  1710. NewGamePlusReplaceItem('Serpent Silver Sword 3', 'NGP Serpent Silver Sword 3', inv);
  1711. }
  1712.  
  1713. public function GetEquippedSword(steel : bool) : SItemUniqueId
  1714. {
  1715. var item : SItemUniqueId;
  1716.  
  1717. if(steel)
  1718. GetItemEquippedOnSlot(EES_SteelSword, item);
  1719. else
  1720. GetItemEquippedOnSlot(EES_SilverSword, item);
  1721.  
  1722. return item;
  1723. }
  1724.  
  1725. timer function BroadcastRain( deltaTime : float, id : int )
  1726. {
  1727. var rainStrength : float = 0;
  1728. rainStrength = GetRainStrength();
  1729. if( rainStrength > 0.5 )
  1730. {
  1731. theGame.GetBehTreeReactionManager().CreateReactionEventIfPossible( thePlayer, 'RainAction', 2.0f , 50.0f, -1.f, -1, true);
  1732. LogReactionSystem( "'RainAction' was sent by Player - single broadcast - distance: 50.0" );
  1733. }
  1734. }
  1735.  
  1736. function InitializeParryType()
  1737. {
  1738. var i, j : int;
  1739.  
  1740. parryTypeTable.Resize( EnumGetMax('EAttackSwingType')+1 );
  1741. for( i = 0; i < EnumGetMax('EAttackSwingType')+1; i += 1 )
  1742. {
  1743. parryTypeTable[i].Resize( EnumGetMax('EAttackSwingDirection')+1 );
  1744. }
  1745. parryTypeTable[AST_Horizontal][ASD_UpDown] = PT_None;
  1746. parryTypeTable[AST_Horizontal][ASD_DownUp] = PT_None;
  1747. parryTypeTable[AST_Horizontal][ASD_LeftRight] = PT_Left;
  1748. parryTypeTable[AST_Horizontal][ASD_RightLeft] = PT_Right;
  1749. parryTypeTable[AST_Vertical][ASD_UpDown] = PT_Up;
  1750. parryTypeTable[AST_Vertical][ASD_DownUp] = PT_Down;
  1751. parryTypeTable[AST_Vertical][ASD_LeftRight] = PT_None;
  1752. parryTypeTable[AST_Vertical][ASD_RightLeft] = PT_None;
  1753. parryTypeTable[AST_DiagonalUp][ASD_UpDown] = PT_None;
  1754. parryTypeTable[AST_DiagonalUp][ASD_DownUp] = PT_None;
  1755. parryTypeTable[AST_DiagonalUp][ASD_LeftRight] = PT_UpLeft;
  1756. parryTypeTable[AST_DiagonalUp][ASD_RightLeft] = PT_RightUp;
  1757. parryTypeTable[AST_DiagonalDown][ASD_UpDown] = PT_None;
  1758. parryTypeTable[AST_DiagonalDown][ASD_DownUp] = PT_None;
  1759. parryTypeTable[AST_DiagonalDown][ASD_LeftRight] = PT_LeftDown;
  1760. parryTypeTable[AST_DiagonalDown][ASD_RightLeft] = PT_DownRight;
  1761. parryTypeTable[AST_Jab][ASD_UpDown] = PT_Jab;
  1762. parryTypeTable[AST_Jab][ASD_DownUp] = PT_Jab;
  1763. parryTypeTable[AST_Jab][ASD_LeftRight] = PT_Jab;
  1764. parryTypeTable[AST_Jab][ASD_RightLeft] = PT_Jab;
  1765. }
  1766.  
  1767.  
  1768.  
  1769.  
  1770.  
  1771.  
  1772. event OnDeath( damageAction : W3DamageAction )
  1773. {
  1774. var items : array< SItemUniqueId >;
  1775. var i, size : int;
  1776. var slot : EEquipmentSlots;
  1777. var holdSlot : name;
  1778.  
  1779. super.OnDeath( damageAction );
  1780.  
  1781. items = GetHeldItems();
  1782.  
  1783. if( rangedWeapon && rangedWeapon.GetCurrentStateName() != 'State_WeaponWait')
  1784. {
  1785. OnRangedForceHolster( true, true, true );
  1786. rangedWeapon.ClearDeployedEntity(true);
  1787. }
  1788.  
  1789. size = items.Size();
  1790.  
  1791. if ( size > 0 )
  1792. {
  1793. for ( i = 0; i < size; i += 1 )
  1794. {
  1795. if ( this.inv.IsIdValid( items[i] ) && !( this.inv.IsItemCrossbow( items[i] ) ) )
  1796. {
  1797. holdSlot = this.inv.GetItemHoldSlot( items[i] );
  1798.  
  1799. if ( holdSlot == 'l_weapon' && this.IsHoldingItemInLHand() )
  1800. {
  1801. this.OnUseSelectedItem( true );
  1802. }
  1803.  
  1804. DropItemFromSlot( holdSlot, false );
  1805.  
  1806. if ( holdSlot == 'r_weapon' )
  1807. {
  1808. slot = this.GetItemSlot( items[i] );
  1809. if ( UnequipItemFromSlot( slot ) )
  1810. Log( "Unequip" );
  1811. }
  1812. }
  1813. }
  1814. }
  1815. }
  1816.  
  1817.  
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823. function HandleMovement( deltaTime : float )
  1824. {
  1825. super.HandleMovement( deltaTime );
  1826.  
  1827. rawCameraHeading = theCamera.GetCameraHeading();
  1828. }
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836. function ToggleSpecialAttackHeavyAllowed( toggle : bool)
  1837. {
  1838. specialAttackHeavyAllowed = toggle;
  1839. }
  1840.  
  1841. function GetReputationManager() : W3Reputation
  1842. {
  1843. return reputationManager;
  1844. }
  1845.  
  1846. function OnRadialMenuItemChoose( selectedItem : string )
  1847. {
  1848. var iSlotId : int;
  1849. var item : SItemUniqueId;
  1850.  
  1851. if ( selectedItem != "Crossbow" )
  1852. {
  1853. if ( rangedWeapon && rangedWeapon.GetCurrentStateName() != 'State_WeaponWait' )
  1854. OnRangedForceHolster( true, false );
  1855. }
  1856.  
  1857.  
  1858. switch(selectedItem)
  1859. {
  1860.  
  1861. case "Meditation":
  1862. theGame.RequestMenuWithBackground( 'MeditationClockMenu', 'CommonMenu' );
  1863. break;
  1864. // -= WMK:modQuickSlots =-
  1865. /*
  1866. case "Slot1":
  1867. GetItemEquippedOnSlot( EES_Petard1, item );
  1868. if( thePlayer.inv.IsIdValid( item ) )
  1869. {
  1870. SelectQuickslotItem( EES_Petard1 );
  1871. }
  1872. else
  1873. {
  1874. SelectQuickslotItem( EES_Petard2 );
  1875. }
  1876. break;
  1877.  
  1878. case "Slot2":
  1879. GetItemEquippedOnSlot( EES_Petard2, item );
  1880. if( thePlayer.inv.IsIdValid( item ) )
  1881. {
  1882. SelectQuickslotItem( EES_Petard2 );
  1883. }
  1884. else
  1885. {
  1886. SelectQuickslotItem( EES_Petard1 );
  1887. }
  1888. break;
  1889. */
  1890. case "Slot1":
  1891. SelectQuickslotItem(EES_Petard1);
  1892. break;
  1893. case "Slot2":
  1894. SelectQuickslotItem(EES_Petard2);
  1895. break;
  1896. case "Slot5":
  1897. SelectQuickslotItem(EES_Petard3);
  1898. break;
  1899. case "Slot6":
  1900. SelectQuickslotItem(EES_Petard4);
  1901. break;
  1902. // -= WMK:modQuickSlots =-
  1903.  
  1904. case "Crossbow":
  1905. SelectQuickslotItem(EES_RangedWeapon);
  1906. break;
  1907.  
  1908. case "Slot3":
  1909. GetItemEquippedOnSlot( EES_Quickslot1, item );
  1910. if( thePlayer.inv.IsIdValid( item ) )
  1911. {
  1912. SelectQuickslotItem( EES_Quickslot1 );
  1913. }
  1914. else
  1915. {
  1916. SelectQuickslotItem( EES_Quickslot2 );
  1917. }
  1918. break;
  1919.  
  1920. case "Slot4":
  1921. GetItemEquippedOnSlot( EES_Quickslot2, item );
  1922. if( thePlayer.inv.IsIdValid( item ) )
  1923. {
  1924. SelectQuickslotItem( EES_Quickslot2 );
  1925. }
  1926. else
  1927. {
  1928. SelectQuickslotItem( EES_Quickslot1 );
  1929. }
  1930. break;
  1931.  
  1932. default:
  1933. SetEquippedSign(SignStringToEnum( selectedItem ));
  1934. FactsRemove("SignToggled");
  1935. break;
  1936. }
  1937. }
  1938.  
  1939. function ToggleNextItem()
  1940. {
  1941. var quickSlotItems : array< EEquipmentSlots >;
  1942. var currentSelectedItem : SItemUniqueId;
  1943. var item : SItemUniqueId;
  1944. var i : int;
  1945.  
  1946. for( i = EES_Quickslot2; i > EES_Petard1 - 1; i -= 1 )
  1947. {
  1948. GetItemEquippedOnSlot( i, item );
  1949. if( inv.IsIdValid( item ) )
  1950. {
  1951. quickSlotItems.PushBack( i );
  1952. }
  1953. }
  1954. if( !quickSlotItems.Size() )
  1955. {
  1956. return;
  1957. }
  1958.  
  1959. currentSelectedItem = GetSelectedItemId();
  1960.  
  1961. if( inv.IsIdValid( currentSelectedItem ) )
  1962. {
  1963. for( i = 0; i < quickSlotItems.Size(); i += 1 )
  1964. {
  1965. GetItemEquippedOnSlot( quickSlotItems[i], item );
  1966. if( currentSelectedItem == item )
  1967. {
  1968. if( i == quickSlotItems.Size() - 1 )
  1969. {
  1970. SelectQuickslotItem( quickSlotItems[ 0 ] );
  1971. }
  1972. else
  1973. {
  1974. SelectQuickslotItem( quickSlotItems[ i + 1 ] );
  1975. }
  1976. return;
  1977. }
  1978. }
  1979. }
  1980. else
  1981. {
  1982. SelectQuickslotItem( quickSlotItems[ 0 ] );
  1983. }
  1984. }
  1985.  
  1986.  
  1987. function SetEquippedSign( signType : ESignType )
  1988. {
  1989. // W3EE - Begin
  1990. if(!IsSignBlocked(signType) || IsSwimming())
  1991. // W3EE - End
  1992. {
  1993. equippedSign = signType;
  1994. FactsSet("CurrentlySelectedSign", equippedSign);
  1995. }
  1996. }
  1997.  
  1998. function GetEquippedSign() : ESignType
  1999. {
  2000. return equippedSign;
  2001. }
  2002.  
  2003. function GetCurrentlyCastSign() : ESignType
  2004. {
  2005. return currentlyCastSign;
  2006. }
  2007.  
  2008. function SetCurrentlyCastSign( type : ESignType, entity : W3SignEntity )
  2009. {
  2010. currentlyCastSign = type;
  2011.  
  2012. if( type != ST_None )
  2013. {
  2014. signs[currentlyCastSign].entity = entity;
  2015. }
  2016. }
  2017.  
  2018. function GetCurrentSignEntity() : W3SignEntity
  2019. {
  2020. if(currentlyCastSign == ST_None)
  2021. return NULL;
  2022.  
  2023. return signs[currentlyCastSign].entity;
  2024. }
  2025.  
  2026. public function GetSignEntity(type : ESignType) : W3SignEntity
  2027. {
  2028. if(type == ST_None)
  2029. return NULL;
  2030.  
  2031. return signs[type].entity;
  2032. }
  2033.  
  2034. public function GetSignTemplate(type : ESignType) : CEntityTemplate
  2035. {
  2036. if(type == ST_None)
  2037. return NULL;
  2038.  
  2039. return signs[type].template;
  2040. }
  2041.  
  2042. public function IsCurrentSignChanneled() : bool
  2043. {
  2044. if( currentlyCastSign != ST_None && signs[currentlyCastSign].entity)
  2045. return signs[currentlyCastSign].entity.OnCheckChanneling();
  2046.  
  2047. return false;
  2048. }
  2049.  
  2050. function IsCastingSign() : bool
  2051. {
  2052. return currentlyCastSign != ST_None;
  2053. }
  2054.  
  2055.  
  2056. protected function IsInCombatActionCameraRotationEnabled() : bool
  2057. {
  2058. if( IsInCombatAction() && ( GetCombatAction() == EBAT_EMPTY || GetCombatAction() == EBAT_Parry ) )
  2059. {
  2060. return true;
  2061. }
  2062.  
  2063. return !bIsInCombatAction;
  2064. }
  2065.  
  2066. function SetHoldBeforeOpenRadialMenuTime ( time : float )
  2067. {
  2068. _HoldBeforeOpenRadialMenuTime = time;
  2069. }
  2070.  
  2071.  
  2072.  
  2073.  
  2074.  
  2075.  
  2076.  
  2077. public function RepairItem ( rapairKitId : SItemUniqueId, usedOnItem : SItemUniqueId )
  2078. {
  2079. var itemMaxDurablity : float;
  2080. var itemCurrDurablity : float;
  2081. var baseRepairValue : float;
  2082. var reapirValue : float;
  2083. var itemAttribute : SAbilityAttributeValue;
  2084.  
  2085. itemMaxDurablity = inv.GetItemMaxDurability(usedOnItem);
  2086. itemCurrDurablity = inv.GetItemDurability(usedOnItem);
  2087. itemAttribute = inv.GetItemAttributeValue ( rapairKitId, 'repairValue' );
  2088.  
  2089. if( itemCurrDurablity >= itemMaxDurablity )
  2090. {
  2091. return;
  2092. }
  2093.  
  2094. if ( inv.IsItemAnyArmor ( usedOnItem )|| inv.IsItemWeapon( usedOnItem ) )
  2095. {
  2096.  
  2097. baseRepairValue = (itemMaxDurablity - itemCurrDurablity) * itemAttribute.valueMultiplicative;
  2098. reapirValue = MinF( itemCurrDurablity + baseRepairValue, itemMaxDurablity );
  2099.  
  2100. inv.SetItemDurabilityScript ( usedOnItem, MinF ( reapirValue, itemMaxDurablity ));
  2101. }
  2102.  
  2103. inv.RemoveItem ( rapairKitId, 1 );
  2104.  
  2105. }
  2106. public function HasRepairAbleGearEquiped ( ) : bool
  2107. {
  2108. var curEquipedItem : SItemUniqueId;
  2109.  
  2110. return ( GetItemEquippedOnSlot(EES_Armor, curEquipedItem) || GetItemEquippedOnSlot(EES_Boots, curEquipedItem) || GetItemEquippedOnSlot(EES_Pants, curEquipedItem) || GetItemEquippedOnSlot(EES_Gloves, curEquipedItem)) == true;
  2111. }
  2112. public function HasRepairAbleWaponEquiped () : bool
  2113. {
  2114. var curEquipedItem : SItemUniqueId;
  2115.  
  2116. return ( GetItemEquippedOnSlot(EES_SilverSword, curEquipedItem) || GetItemEquippedOnSlot(EES_SteelSword, curEquipedItem) ) == true;
  2117. }
  2118. public function IsItemRepairAble ( item : SItemUniqueId ) : bool
  2119. {
  2120. return inv.GetItemDurabilityRatio(item) <= 0.99999f;
  2121. }
  2122.  
  2123.  
  2124.  
  2125.  
  2126.  
  2127.  
  2128.  
  2129. // W3EE - Begin
  2130. public function ApplyOilHack( oilId : SItemUniqueId, usedOnItem : SItemUniqueId )
  2131. {
  2132. super.ApplyOil(oilId, usedOnItem);
  2133. }
  2134. // W3EE - End
  2135.  
  2136. public function ApplyOil( oilId : SItemUniqueId, usedOnItem : SItemUniqueId ) : bool
  2137. {
  2138. var tutStateOil : W3TutorialManagerUIHandlerStateOils;
  2139.  
  2140. // W3EE - Begin
  2141. /*if( !super.ApplyOil( oilId, usedOnItem ))
  2142. return false;*/
  2143.  
  2144. if( IsMeditating() || !Options().GetUseOilAnimation() )
  2145. return super.ApplyOil(oilId, usedOnItem);
  2146. else
  2147. GetAnimManager().PerformAnimation(EES_InvalidSlot, oilId, usedOnItem);
  2148. // W3EE - End
  2149.  
  2150. return true;
  2151. }
  2152.  
  2153. private final function RemoveExtraOilsFromItem( item : SItemUniqueId, hasWolfSet : bool, hasEmulation : bool )
  2154. {
  2155. var oils : array< CBaseGameplayEffect >;
  2156. var i, cnt, maxOils : int;
  2157. var buff : W3Effect_Oil;
  2158.  
  2159. maxOils = 1;
  2160. if(hasWolfSet) maxOils += 1;
  2161. if(hasEmulation) maxOils += 1;
  2162.  
  2163. oils = GetBuffs( EET_Oil );
  2164. for( i=0; i<oils.Size(); i+=1 )
  2165. {
  2166. buff = (W3Effect_Oil) oils[ i ];
  2167. if( buff && buff.GetSwordItemId() == item )
  2168. {
  2169. cnt += 1;
  2170. }
  2171. }
  2172. while( cnt > maxOils )
  2173. {
  2174. inv.RemoveOldestOilFromItem( item );
  2175. cnt -= 1;
  2176. }
  2177. }
  2178.  
  2179.  
  2180.  
  2181.  
  2182.  
  2183.  
  2184. timer function Mutation5Disable( dt : float, id : int )
  2185. {
  2186. RemoveBuff(EET_Mutation5);
  2187. }
  2188.  
  2189. function ReduceDamage(out damageData : W3DamageAction)
  2190. {
  2191. var actorAttacker : CActor;
  2192. var quen : W3QuenEntity;
  2193. var attackRange : CAIAttackRange;
  2194. var angleDist, distToAttacker, currAdrenaline, adrenReducedDmg, focus : float;
  2195. var attackName : name;
  2196. var safeDodgeAngle : int;
  2197. var min, max : SAbilityAttributeValue;
  2198.  
  2199. super.ReduceDamage(damageData);
  2200.  
  2201. ((W3Decoction7_Effect)GetBuff(EET_Decoction7)).ActivateQuen(damageData, this);
  2202. quen = (W3QuenEntity)signs[ST_Quen].entity;
  2203. if( !damageData.DealsAnyDamage() )
  2204. return;
  2205.  
  2206. actorAttacker = (CActor)damageData.attacker;
  2207. if(actorAttacker && ( IsCurrentlyDodging() || IsInCombatAction() && ((int)GetBehaviorVariable( 'combatActionType' ) == CAT_Dodge || (int)GetBehaviorVariable( 'combatActionType' ) == CAT_Roll) ) )
  2208. {
  2209. Combat().SetDodgeCount(0);
  2210. angleDist = AbsF(AngleDistance(evadeHeading, actorAttacker.GetHeading()));
  2211. distToAttacker = VecDistance(this.GetWorldPosition(),damageData.attacker.GetWorldPosition());
  2212. attackName = actorAttacker.GetLastAttackRangeName();
  2213. attackRange = theGame.GetAttackRangeForEntity( actorAttacker, attackName );
  2214.  
  2215. if( CanUseSkill(S_Sword_s09) )
  2216. damageData.SetHitAnimationPlayType(EAHA_ForceNo);
  2217.  
  2218. safeDodgeAngle = Combat().GetSafeDodgeAngle() / 2;
  2219. if( /*damageData.CanBeDodged()*/ ((angleDist <= safeDodgeAngle && attackName != 'stomp' && attackName != 'anchor_special_far' && attackName != 'anchor_far') || ((attackName == 'stomp' || attackName == 'anchor_special_far' || attackName == 'anchor_far') && distToAttacker > attackRange.rangeMax * 0.75)) )
  2220. {
  2221. if( isInvulnerableDodge )
  2222. {
  2223. damageData.SetWasDodged();
  2224. damageData.ClearEffects();
  2225. damageData.SetAllProcessedDamageAs(0);
  2226. damageData.SetHitAnimationPlayType(EAHA_ForceNo);
  2227. damageData.SetSuppressHitSounds(true);
  2228. damageData.SetCanPlayHitParticle(false);
  2229. }
  2230. else
  2231. if( isGrazeDodge )
  2232. {
  2233. damageData.SetWasPartiallyDodged();
  2234. damageData.RemoveBuffsByType(EET_Bleeding);
  2235. /*damageData.processedDmg.vitalityDamage *= 0.50;
  2236. damageData.processedDmg.essenceDamage *= 0.50;*/
  2237.  
  2238. min = GetAttributeValue('graze_damage_reduction');
  2239. damageData.processedDmg.vitalityDamage *= 1 - CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s09, 'damage_reduction', false, true)) * GetSkillLevel(S_Sword_s09);
  2240. damageData.processedDmg.vitalityDamage *= 1 - min.valueMultiplicative;
  2241. }
  2242. }
  2243. }
  2244.  
  2245. if(quen && damageData.GetBuffSourceName() != "FallingDamage")
  2246. {
  2247. quen.OnTargetHit( damageData );
  2248. }
  2249.  
  2250. if( HasBuff( EET_GryphonSetBonusYrden ) )
  2251. {
  2252. min = GetAttributeValue( 'gryphon_set_bns_dmg_reduction' );
  2253. damageData.processedDmg.vitalityDamage *= 1 - min.valueAdditive;
  2254. }
  2255.  
  2256. if( IsMutationActive(EPMT_Mutation5) && !damageData.IsDoTDamage() )
  2257. {
  2258. if( HasBuff(EET_Mutation5) )
  2259. {
  2260. theGame.GetDefinitionsManager().GetAbilityAttributeValue('Mutation5', 'mut5_dmg_red_perc', min, max);
  2261. damageData.processedDmg.vitalityDamage *= 1 - min.valueAdditive;
  2262.  
  2263. theGame.MutationHUDFeedback(MFT_PlayOnce);
  2264. PlayEffect('mutation_5_stage_03');
  2265. }
  2266. theGame.GetDefinitionsManager().GetAbilityAttributeValue('Mutation5Effect', 'duration', min, max);
  2267. AddEffectDefault(EET_Mutation5, this, "", false);
  2268. AddTimer('Mutation5Disable', min.valueAdditive, false);
  2269. }
  2270.  
  2271. if(!damageData.GetIgnoreImmortalityMode())
  2272. {
  2273. if(!((W3PlayerWitcher)this))
  2274. Log("");
  2275.  
  2276.  
  2277. if( IsInvulnerable() )
  2278. {
  2279. if ( theGame.CanLog() )
  2280. {
  2281. LogDMHits("CActor.ReduceDamage: victim Invulnerable - no damage will be dealt", damageData );
  2282. }
  2283. damageData.SetAllProcessedDamageAs(0);
  2284. return;
  2285. }
  2286.  
  2287. if(actorAttacker && damageData.DealsAnyDamage() )
  2288. actorAttacker.SignalGameplayEventParamObject( 'DamageInstigated', damageData );
  2289.  
  2290.  
  2291. if( IsImmortal() )
  2292. {
  2293. if ( theGame.CanLog() )
  2294. {
  2295. LogDMHits("CActor.ReduceDamage: victim is Immortal, clamping damage", damageData );
  2296. }
  2297. damageData.processedDmg.vitalityDamage = ClampF(damageData.processedDmg.vitalityDamage, 0, GetStat(BCS_Vitality)-1 );
  2298. damageData.processedDmg.essenceDamage = ClampF(damageData.processedDmg.essenceDamage, 0, GetStat(BCS_Essence)-1 );
  2299. return;
  2300. }
  2301. }
  2302. else
  2303. {
  2304.  
  2305. if(actorAttacker && damageData.DealsAnyDamage() )
  2306. actorAttacker.SignalGameplayEventParamObject( 'DamageInstigated', damageData );
  2307. }
  2308. }
  2309.  
  2310. timer function UndyingSkillCooldown(dt : float, id : int)
  2311. {
  2312. cannotUseUndyingSkill = false;
  2313. }
  2314.  
  2315. event OnTakeDamage( action : W3DamageAction)
  2316. {
  2317. var currVitality, rgnVitality, hpTriggerTreshold : float;
  2318. var healingFactor : float;
  2319. var abilityName : name;
  2320. var abilityCount, maxStack, itemDurability : float;
  2321. var addAbility : bool;
  2322. var min, max : SAbilityAttributeValue;
  2323. var mutagenQuen : W3SignEntity;
  2324. var equipped : array<SItemUniqueId>;
  2325. var i : int;
  2326. var killSourceName : string;
  2327. var aerondight : W3Effect_Aerondight;
  2328.  
  2329. // W3EE - Begin
  2330. if( action.GetHitReactionType() != EHRT_None && !action.IsDoTDamage() )
  2331. {
  2332. ResetCustomAnimationSpeedMult();
  2333. Combat().RemovePlayerSpeedMult();
  2334. }
  2335.  
  2336. GetAnimatedState().OnTakeDamage(action);
  2337. ((W3Effect_WolfSetParry)GetBuff(EET_WolfSetParry, "BearSetBonus2")).OnTakeDamage(action);
  2338. // W3EE - End
  2339.  
  2340. currVitality = GetStat(BCS_Vitality);
  2341.  
  2342.  
  2343. if(action.processedDmg.vitalityDamage >= currVitality)
  2344. {
  2345. killSourceName = action.GetBuffSourceName();
  2346.  
  2347.  
  2348. if( killSourceName != "Quest" && killSourceName != "Kill Trigger" && killSourceName != "Trap" && killSourceName != "FallingDamage" )
  2349. {
  2350.  
  2351. /*if(!cannotUseUndyingSkill && CanUseSkill(S_Sword_s18) )
  2352. {
  2353. // W3EE - Begin
  2354. healingFactor = GetStatMax(BCS_Vitality) / 30.f;
  2355. healingFactor *= GetStat(BCS_Focus) * GetSkillLevel(S_Sword_s18);
  2356. healingFactor += GetSkillLevel(S_Sword_s18) * GetStatMax(BCS_Vitality) / 20.f;
  2357. GainStat(BCS_Vitality, MinF(healingFactor, GetStatMax(BCS_Vitality)) + action.processedDmg.vitalityDamage);
  2358. DrainFocus(GetStat(BCS_Focus),,true);
  2359. RemoveBuff(EET_BattleTrance);
  2360. cannotUseUndyingSkill = true;
  2361. AddTimer('UndyingSkillCooldown', 300 - (GetSkillLevel(S_Sword_s18) - 1) * 30, false, , , true);
  2362. // W3EE - End
  2363. }
  2364.  
  2365. else*/ if( IsMutationActive( EPMT_Mutation11 ) && !HasBuff( EET_Mutation11Debuff ) && !IsInAir() )
  2366. {
  2367. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation11', 'health_prc', min, max );
  2368.  
  2369. action.SetAllProcessedDamageAs( 0 );
  2370.  
  2371. OnMutation11Triggered();
  2372. }
  2373. else
  2374. {
  2375.  
  2376. equipped = GetEquippedItems();
  2377.  
  2378. for(i=0; i<equipped.Size(); i+=1)
  2379. {
  2380. if ( !inv.IsIdValid( equipped[i] ) )
  2381. {
  2382. continue;
  2383. }
  2384. itemDurability = inv.GetItemDurability(equipped[i]);
  2385. if(inv.ItemHasAbility(equipped[i], 'MA_Reinforced') && itemDurability > 0)
  2386. {
  2387.  
  2388. inv.SetItemDurabilityScript(equipped[i], MaxF(0, itemDurability - action.processedDmg.vitalityDamage) );
  2389.  
  2390.  
  2391. action.processedDmg.vitalityDamage = 0;
  2392. ForceSetStat(BCS_Vitality, 1);
  2393.  
  2394. break;
  2395. }
  2396. }
  2397. }
  2398. }
  2399. }
  2400.  
  2401. if(HasBuff(EET_Trap) && !action.IsDoTDamage() && action.attacker.HasAbility( 'mon_dettlaff_monster_base' ))
  2402. {
  2403. action.AddEffectInfo(EET_Knockdown);
  2404. RemoveBuff(EET_Trap, true);
  2405. }
  2406.  
  2407. super.OnTakeDamage(action);
  2408.  
  2409.  
  2410. if( !action.WasDodged() && action.DealtDamage() && inv.ItemHasTag( inv.GetCurrentlyHeldSword(), 'Aerondight' ) && !action.IsDoTDamage() && !( (W3Effect_Toxicity) action.causer ) )
  2411. {
  2412. aerondight = (W3Effect_Aerondight)GetBuff( EET_Aerondight );
  2413. if( aerondight && aerondight.GetCurrentCount() != 0 )
  2414. {
  2415. aerondight.ReduceAerondightStacks();
  2416. }
  2417. }
  2418.  
  2419.  
  2420. if( !action.WasDodged() && action.DealtDamage() && !action.IsDoTDamage() )
  2421. {
  2422. RemoveBuff( EET_Mutation3 );
  2423. }
  2424.  
  2425. // W3EE - Begin
  2426. if( action.attacker.HasTag('Vesemir') )
  2427. ForceSetStat(BCS_Vitality, GetStatMax(BCS_Vitality));
  2428. // W3EE - End
  2429. }
  2430.  
  2431.  
  2432.  
  2433.  
  2434.  
  2435.  
  2436. // W3EE - Begin
  2437. private var equippedHood : SItemUniqueId;
  2438. private var hoodSlot : EEquipmentSlots;
  2439. private function UnequipHoodFistfight()
  2440. {
  2441. if( inv.GetItemEquippedOnSlot(EES_Quickslot1, equippedHood) && inv.ItemHasTag(equippedHood, 'Hood') )
  2442. {
  2443. UnequipItem(equippedHood);
  2444. hoodSlot = EES_Quickslot1;
  2445. }
  2446. if( inv.GetItemEquippedOnSlot(EES_Quickslot2, equippedHood) && inv.ItemHasTag(equippedHood, 'Hood') )
  2447. {
  2448. UnequipItem(equippedHood);
  2449. hoodSlot = EES_Quickslot1;
  2450. }
  2451. }
  2452.  
  2453. private function EquipHoodFistfight()
  2454. {
  2455. EquipItem(equippedHood, hoodSlot, false);
  2456. }
  2457.  
  2458. event OnStartFistfightMinigame()
  2459. {
  2460. var i : int;
  2461. var buffs : array< CBaseGameplayEffect >;
  2462.  
  2463. /*
  2464. effectManager.RemoveAllPotionEffects();
  2465.  
  2466. abilityManager.DrainToxicity(GetStatMax( BCS_Toxicity ));
  2467.  
  2468. buffs = GetBuffs( EET_WellFed );
  2469. for( i=buffs.Size()-1; i>=0; i-=1 )
  2470. {
  2471. RemoveEffect( buffs[i] );
  2472. }
  2473.  
  2474.  
  2475. buffs.Clear();
  2476. buffs = GetBuffs( EET_WellHydrated );
  2477. for( i=buffs.Size()-1; i>=0; i-=1 )
  2478. {
  2479. RemoveEffect( buffs[i] );
  2480. }
  2481. */
  2482.  
  2483. UnequipHoodFistfight();
  2484.  
  2485. super.OnStartFistfightMinigame();
  2486. }
  2487.  
  2488. event OnEndFistfightMinigame()
  2489. {
  2490. EquipHoodFistfight();
  2491. super.OnEndFistfightMinigame();
  2492. }
  2493. // W3EE - End
  2494.  
  2495.  
  2496. public function GetCriticalHitChance( isLightAttack : bool, isHeavyAttack : bool, target : CActor, victimMonsterCategory : EMonsterCategory, isBolt : bool ) : float
  2497. {
  2498. var ret : float;
  2499. // var thunder : W3Potion_Thunderbolt;
  2500. var min, max : SAbilityAttributeValue;
  2501.  
  2502. ret = super.GetCriticalHitChance( isLightAttack, isHeavyAttack, target, victimMonsterCategory, isBolt );
  2503.  
  2504.  
  2505.  
  2506.  
  2507.  
  2508.  
  2509.  
  2510. // W3EE - Begin
  2511. /*
  2512. thunder = ( W3Potion_Thunderbolt )GetBuff( EET_Thunderbolt );
  2513. if( thunder && thunder.GetBuffLevel() == 3 && GetCurWeather() == EWE_Storm )
  2514. {
  2515. ret += 0.25f;
  2516. }
  2517. */
  2518. // W3EE - End
  2519.  
  2520.  
  2521. if( isBolt && IsMutationActive( EPMT_Mutation9 ) )
  2522. {
  2523. theGame.GetDefinitionsManager().GetAbilityAttributeValue('Mutation9', 'critical_hit_chance', min, max);
  2524. ret += min.valueMultiplicative;
  2525. }
  2526.  
  2527.  
  2528. if( isBolt && CanUseSkill( S_Sword_s07 ) )
  2529. {
  2530. ret += CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s07, theGame.params.CRITICAL_HIT_CHANCE, false, true)) * GetSkillLevel(S_Sword_s07);
  2531. }
  2532.  
  2533. return ret;
  2534. }
  2535.  
  2536.  
  2537. public function GetCriticalHitDamageBonus(weaponId : SItemUniqueId, victimMonsterCategory : EMonsterCategory, isStrikeAtBack : bool) : SAbilityAttributeValue
  2538. {
  2539. // W3EE - Begin
  2540. var min, max, bonus, null, oilBonus : SAbilityAttributeValue;
  2541. var monsterBonusType : name;
  2542. var aerondightBuff : W3Effect_Aerondight;
  2543.  
  2544. bonus = super.GetCriticalHitDamageBonus(weaponId, victimMonsterCategory, isStrikeAtBack);
  2545.  
  2546. /*
  2547. if( inv.ItemHasActiveOilApplied( weaponId, victimMonsterCategory ) && GetStat( BCS_Focus ) >= Options().MaxFocus() && CanUseSkill( S_Alchemy_s07 ) )
  2548. {
  2549. monsterBonusType = MonsterCategoryToAttackPowerBonus( victimMonsterCategory );
  2550. oilBonus = inv.GetItemAttributeValue( weaponId, monsterBonusType );
  2551. if(oilBonus != null)
  2552. {
  2553. bonus += GetSkillAttributeValue(S_Alchemy_s07, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, true) * GetSkillLevel(S_Alchemy_s07);
  2554. }
  2555. }
  2556. */
  2557.  
  2558. aerondightBuff = (W3Effect_Aerondight)GetBuff(EET_Aerondight);
  2559. if( aerondightBuff )
  2560. {
  2561. theGame.GetDefinitionsManager().GetAbilityAttributeValue('AerondightEffect', 'crit_dam_bonus_stack', min, max);
  2562. bonus += min * aerondightBuff.GetCurrentCount();
  2563. }
  2564. // W3EE - End
  2565.  
  2566. return bonus;
  2567. }
  2568.  
  2569. public function ProcessLockTarget( optional newLockTarget : CActor, optional checkLeftStickHeading : bool ) : bool
  2570. {
  2571. var newLockTargetFound : bool;
  2572.  
  2573. newLockTargetFound = super.ProcessLockTarget(newLockTarget, checkLeftStickHeading);
  2574.  
  2575. if(GetCurrentlyCastSign() == ST_Axii)
  2576. {
  2577. ((W3AxiiEntity)GetCurrentSignEntity()).OnDisplayTargetChange(newLockTarget);
  2578. }
  2579.  
  2580. return newLockTargetFound;
  2581. }
  2582.  
  2583.  
  2584.  
  2585.  
  2586.  
  2587. event OnProcessActionPost(action : W3DamageAction)
  2588. {
  2589. var attackAction : W3Action_Attack;
  2590. var rendLoad : float;
  2591. var value : SAbilityAttributeValue;
  2592. var actorVictim : CActor;
  2593. var weaponId : SItemUniqueId;
  2594. var usesSteel, usesSilver, usesVitality, usesEssence : bool;
  2595. var abs : array<name>;
  2596. var i : int;
  2597. var dm : CDefinitionsManagerAccessor;
  2598. var items : array<SItemUniqueId>;
  2599. var weaponEnt : CEntity;
  2600. var lynxSetBuff : W3Effect_LynxSetBonus;
  2601.  
  2602. super.OnProcessActionPost(action);
  2603.  
  2604. attackAction = (W3Action_Attack)action;
  2605. actorVictim = (CActor)action.victim;
  2606.  
  2607. if(attackAction)
  2608. {
  2609. if(attackAction.IsActionMelee())
  2610. {
  2611.  
  2612. if(SkillNameToEnum(attackAction.GetAttackTypeName()) == S_Sword_s02)
  2613. {
  2614. // W3EE - Begin
  2615. /*rendLoad = GetSpecialAttackTimeRatio();
  2616.  
  2617.  
  2618. rendLoad = MinF(rendLoad * GetStatMax(BCS_Focus), GetStat(BCS_Focus));
  2619.  
  2620.  
  2621. rendLoad = FloorF(rendLoad);
  2622. DrainFocus(rendLoad);*/
  2623. // W3EE - End
  2624.  
  2625. OnSpecialAttackHeavyActionProcess();
  2626. }
  2627. else if(actorVictim && IsRequiredAttitudeBetween(this, actorVictim, true))
  2628. {
  2629.  
  2630.  
  2631. value = GetAttributeValue('focus_gain');
  2632.  
  2633. if( FactsQuerySum("debug_fact_focus_boy") > 0 )
  2634. {
  2635. Debug_FocusBoyFocusGain();
  2636. }
  2637.  
  2638.  
  2639. /*if ( CanUseSkill(S_Sword_s20) )
  2640. {
  2641. value += GetSkillAttributeValue(S_Sword_s20, 'focus_gain', false, true) * GetSkillLevel(S_Sword_s20);
  2642. }*/
  2643.  
  2644.  
  2645. 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() )
  2646. {
  2647. AddEffectDefault( EET_Mutation3, this, "", false );
  2648. }
  2649.  
  2650. // W3EE - Begin
  2651. // GainStat(BCS_Focus, 0.1f * (1 + CalculateAttributeValue(value)) );
  2652. // W3EE - End
  2653. }
  2654.  
  2655.  
  2656. weaponId = attackAction.GetWeaponId();
  2657. if(actorVictim && (ShouldProcessTutorial('TutorialWrongSwordSteel') || ShouldProcessTutorial('TutorialWrongSwordSilver')) && GetAttitudeBetween(actorVictim, this) == AIA_Hostile)
  2658. {
  2659. usesSteel = inv.IsItemSteelSwordUsableByPlayer(weaponId);
  2660. usesSilver = inv.IsItemSilverSwordUsableByPlayer(weaponId);
  2661. usesVitality = actorVictim.UsesVitality();
  2662. usesEssence = actorVictim.UsesEssence();
  2663.  
  2664. if(usesSilver && usesVitality)
  2665. {
  2666. FactsAdd('tut_wrong_sword_silver',1);
  2667. }
  2668. else if(usesSteel && usesEssence)
  2669. {
  2670. FactsAdd('tut_wrong_sword_steel',1);
  2671. }
  2672. else if(FactsQuerySum('tut_wrong_sword_steel') && usesSilver && usesEssence)
  2673. {
  2674. FactsAdd('tut_proper_sword_silver',1);
  2675. FactsRemove('tut_wrong_sword_steel');
  2676. }
  2677. else if(FactsQuerySum('tut_wrong_sword_silver') && usesSteel && usesVitality)
  2678. {
  2679. FactsAdd('tut_proper_sword_steel',1);
  2680. FactsRemove('tut_wrong_sword_silver');
  2681. }
  2682. }
  2683.  
  2684. // W3EE - Begin
  2685. /*
  2686. if(!action.WasDodged() && HasAbility('Runeword 1 _Stats', true))
  2687. {
  2688. if(runewordInfusionType == ST_Axii)
  2689. {
  2690. actorVictim.SoundEvent('sign_axii_release');
  2691. }
  2692. else if(runewordInfusionType == ST_Igni)
  2693. {
  2694. actorVictim.SoundEvent('sign_igni_charge_begin');
  2695. }
  2696. else if(runewordInfusionType == ST_Quen)
  2697. {
  2698. value = GetAttributeValue('runeword1_quen_heal');
  2699. Heal( action.GetDamageDealt() * value.valueMultiplicative );
  2700. PlayEffectSingle('drain_energy_caretaker_shovel');
  2701. }
  2702. else if(runewordInfusionType == ST_Yrden)
  2703. {
  2704. actorVictim.SoundEvent('sign_yrden_shock_activate');
  2705. }
  2706. runewordInfusionType = ST_None;
  2707.  
  2708.  
  2709. items = inv.GetHeldWeapons();
  2710. weaponEnt = inv.GetItemEntityUnsafe(items[0]);
  2711. weaponEnt.StopEffect('runeword_aard');
  2712. weaponEnt.StopEffect('runeword_axii');
  2713. weaponEnt.StopEffect('runeword_igni');
  2714. weaponEnt.StopEffect('runeword_quen');
  2715. weaponEnt.StopEffect('runeword_yrden');
  2716. }
  2717. */
  2718. // W3EE - End
  2719.  
  2720. if(ShouldProcessTutorial('TutorialLightAttacks') || ShouldProcessTutorial('TutorialHeavyAttacks'))
  2721. {
  2722. if(IsLightAttack(attackAction.GetAttackName()))
  2723. {
  2724. theGame.GetTutorialSystem().IncreaseGeraltsLightAttacksCount(action.victim.GetTags());
  2725. }
  2726. else if(IsHeavyAttack(attackAction.GetAttackName()))
  2727. {
  2728. theGame.GetTutorialSystem().IncreaseGeraltsHeavyAttacksCount(action.victim.GetTags());
  2729. }
  2730. }
  2731. }
  2732. // W3EE - Begin
  2733. /*
  2734. else if(action.IsActionRanged())
  2735. {
  2736. if(CanUseSkill(S_Sword_s15))
  2737. {
  2738. value = GetSkillAttributeValue(S_Sword_s15, 'focus_gain', false, true) * GetSkillLevel(S_Sword_s15) ;
  2739. GainStat(BCS_Focus, CalculateAttributeValue(value) );
  2740. }
  2741.  
  2742. if(CanUseSkill(S_Sword_s12) && action.IsCriticalHit() && actorVictim && !actorVictim.HasAbility('mon_dettlaff_monster_base'))
  2743. {
  2744.  
  2745. actorVictim.GetCharacterStats().GetAbilities(abs, false);
  2746. dm = theGame.GetDefinitionsManager();
  2747. for(i=abs.Size()-1; i>=0; i-=1)
  2748. {
  2749. if(!dm.AbilityHasTag(abs[i], theGame.params.TAG_MONSTER_SKILL) || actorVictim.IsAbilityBlocked(abs[i]))
  2750. {
  2751. abs.EraseFast(i);
  2752. }
  2753. }
  2754.  
  2755.  
  2756. if(abs.Size() > 0)
  2757. {
  2758. value = GetSkillAttributeValue(S_Sword_s12, 'duration', true, true) * GetSkillLevel(S_Sword_s12);
  2759. actorVictim.BlockAbility(abs[ RandRange(abs.Size()) ], true, CalculateAttributeValue(value));
  2760. }
  2761. }
  2762. }
  2763. */
  2764. // W3EE - End
  2765. }
  2766.  
  2767.  
  2768. if( IsMutationActive( EPMT_Mutation10 ) && ( action.IsActionMelee() || action.IsActionWitcherSign() ) )
  2769. {
  2770. PlayEffect( 'mutation_10_energy' );
  2771. }
  2772.  
  2773. // W3EE - Begin
  2774. /*if(CanUseSkill(S_Perk_18) && ((W3Petard)action.causer) && action.DealsAnyDamage() && !action.IsDoTDamage())
  2775. {
  2776. value = GetSkillAttributeValue(S_Perk_18, 'focus_gain', false, true);
  2777. GainStat(BCS_Focus, CalculateAttributeValue(value));
  2778. }*/
  2779.  
  2780. if( attackAction && attackAction.IsActionMelee() && !IsUsingHorse() && attackAction.DealtDamage() && IsSetBonusActive( EISB_Lynx_1 ) && !attackAction.IsCountered() && ( inv.IsItemSteelSwordUsableByPlayer( attackAction.GetWeaponId() ) || inv.IsItemSilverSwordUsableByPlayer( attackAction.GetWeaponId() ) ) )
  2781. {
  2782. lynxSetBuff = (W3Effect_LynxSetBonus)GetBuff(EET_LynxSetBonus);
  2783. if( IsHeavyAttack(attackAction.GetAttackName()) )
  2784. {
  2785. if( lynxSetBuff && lynxSetBuff.GetSourceName() == "LightAttack" )
  2786. {
  2787. RemoveEffect(lynxSetBuff);
  2788. }
  2789. AddEffectDefault(EET_LynxSetBonus, NULL, "HeavyAttack");
  2790. }
  2791. else
  2792. {
  2793. if( lynxSetBuff && lynxSetBuff.GetSourceName() == "HeavyAttack" )
  2794. {
  2795. RemoveEffect(lynxSetBuff);
  2796. }
  2797. AddEffectDefault(EET_LynxSetBonus, NULL, "LightAttack");
  2798. }
  2799. SoundEvent("ep2_setskill_lynx_activate");
  2800. }
  2801. // W3EE - End
  2802. }
  2803.  
  2804. public final function FailFundamentalsFirstAchievementCondition()
  2805. {
  2806. SetFailedFundamentalsFirstAchievementCondition(true);
  2807. }
  2808.  
  2809. public final function SetUsedQuenInCombat()
  2810. {
  2811. usedQuenInCombat = true;
  2812. }
  2813.  
  2814. public final function UsedQuenInCombat() : bool
  2815. {
  2816. return usedQuenInCombat;
  2817. }
  2818.  
  2819. // W3EE - Begin
  2820. private var adrenalineEffect : W3Effect_CombatAdrenaline;
  2821. public function GetAdrenalineEffect() : W3Effect_CombatAdrenaline
  2822. {
  2823. return adrenalineEffect;
  2824. }
  2825.  
  2826. public function GetAdrenalinePercMult() : float
  2827. {
  2828. return (1.f - adrenalineEffect.GetValue());
  2829. }
  2830.  
  2831. private var isWounded : bool; default isWounded = false;
  2832. public function UpdateWoundedState( optional forceNo : bool )
  2833. {
  2834. isWounded = false;
  2835. if( GetStatPercents(BCS_Vitality) <= 0.3f )
  2836. isWounded = true;
  2837.  
  2838. if( GetInjuryManager().GetInjuryCount() >= 2 )
  2839. isWounded = true;
  2840.  
  2841. if( ((W3Effect_ToxicityFever)GetBuff(EET_ToxicityFever)).IsFeverActive() && !(CanUseSkill(S_Alchemy_s13) && HasDecoctionEffect()) )
  2842. isWounded = true;
  2843.  
  2844. if( IsInCombat() )
  2845. isWounded = false;
  2846.  
  2847. if( forceNo )
  2848. isWounded = false;
  2849.  
  2850. if( GetBehaviorVariable('alternateWalk') != 2 )
  2851. {
  2852. if( isWounded )
  2853. {
  2854. BlockAction(EIAB_RunAndSprint, 'woundedState', true);
  2855. SetBehaviorVariable('alternateWalk', 1);
  2856. theGame.GetTutorialSystem().uiHandler.GotoState('InjuredState');
  2857. }
  2858. else
  2859. {
  2860. UnblockAction(EIAB_RunAndSprint, 'woundedState');
  2861. SetBehaviorVariable('alternateWalk', 0);
  2862. }
  2863. }
  2864. }
  2865.  
  2866. public function IsWounded() : bool
  2867. {
  2868. return isWounded;
  2869. }
  2870.  
  2871. public var enemiesKilled : int;
  2872. public var startingHealthPerc : float;
  2873. event OnCombatStart()
  2874. {
  2875. var quenEntity, glyphQuen : W3QuenEntity;
  2876. var focus, stamina : float;
  2877. var glowTargets, moTargets, actors : array< CActor >;
  2878. var delays : array< float >;
  2879. var rand, i : int;
  2880. var isHostile, isAlive, isUnconscious : bool;
  2881.  
  2882. super.OnCombatStart();
  2883.  
  2884. if ( IsInCombatActionFriendly() )
  2885. {
  2886. SetBIsCombatActionAllowed(true);
  2887. SetBIsInputAllowed(true, 'OnCombatActionStart' );
  2888. }
  2889.  
  2890. UpdateWoundedState();
  2891. enemiesKilled = 0;
  2892. startingHealthPerc = GetStatPercents(BCS_Vitality);
  2893. if( !Options().CombatInv() )
  2894. BlockAction(EIAB_OpenInventory, 'CombatInventoryBlock');
  2895.  
  2896. if( IsSetBonusActive(EISB_Bear_2) && !HasBuff(EET_WolfSetParry) )
  2897. AddEffectDefault(EET_WolfSetParry, this, "BearSetBonus2", false);
  2898.  
  2899. if( IsSetBonusActive(EISB_Dimeritium1) && !HasBuff(EET_DimeritiumCharge) )
  2900. AddEffectDefault(EET_DimeritiumCharge, this, "DimeritiumSetBonus", false);
  2901.  
  2902. if( !HasBuff(EET_CombatAdr) )
  2903. AddEffectDefault(EET_CombatAdr, this, "CombatAdrenaline", false);
  2904. adrenalineEffect = (W3Effect_CombatAdrenaline)GetBuff(EET_CombatAdr);
  2905.  
  2906.  
  2907. mutation12IsOnCooldown = false;
  2908.  
  2909.  
  2910. quenEntity = (W3QuenEntity)signs[ST_Quen].entity;
  2911.  
  2912.  
  2913. if(quenEntity)
  2914. {
  2915. usedQuenInCombat = quenEntity.IsAnyQuenActive();
  2916. }
  2917. else
  2918. {
  2919. usedQuenInCombat = false;
  2920. }
  2921.  
  2922. if(usedQuenInCombat || HasPotionBuff() || IsEquippedSwordUpgradedWithOil(true) || IsEquippedSwordUpgradedWithOil(false))
  2923. {
  2924. SetFailedFundamentalsFirstAchievementCondition(true);
  2925. }
  2926. else
  2927. {
  2928. if(IsAnyItemEquippedOnSlot(EES_PotionMutagen1) || IsAnyItemEquippedOnSlot(EES_PotionMutagen2) || IsAnyItemEquippedOnSlot(EES_PotionMutagen3) || IsAnyItemEquippedOnSlot(EES_PotionMutagen4))
  2929. SetFailedFundamentalsFirstAchievementCondition(true);
  2930. else
  2931. SetFailedFundamentalsFirstAchievementCondition(false);
  2932. }
  2933.  
  2934. if ( HasAbility('Glyphword 17 _Stats', true) && RandF() < CalculateAttributeValue(GetAttributeValue('quen_apply_chance')) )
  2935. {
  2936. glyphQuen = (W3QuenEntity)theGame.CreateEntity( signs[ST_Quen].template, GetWorldPosition(), GetWorldRotation() );
  2937. glyphQuen.Init( signOwner, signs[ST_Quen].entity, true, false, true );
  2938. glyphQuen.OnStarted();
  2939. glyphQuen.OnThrowing();
  2940. glyphQuen.OnEnded();
  2941. }
  2942.  
  2943. MeditationForceAbort(true);
  2944.  
  2945. if( IsSetBonusActive(EISB_Wolf_1) )
  2946. {
  2947. RemoveTimer( 'Mutation7CombatStartHackFixGo' );
  2948. AddTimer( 'Mutation7CombatStartHackFix', 1.f, true, , , , true );
  2949. }
  2950.  
  2951. if( IsMutationActive( EPMT_Mutation4 ) )
  2952. {
  2953. AddEffectDefault( EET_Mutation4, this, "combat start", false );
  2954. }
  2955. else if( IsMutationActive( EPMT_Mutation8 ) )
  2956. {
  2957. theGame.MutationHUDFeedback( MFT_PlayRepeat );
  2958. }
  2959. else if( IsMutationActive( EPMT_Mutation10 ) )
  2960. {
  2961. if( !HasBuff( EET_Mutation10 ) && GetStat( BCS_Toxicity ) > 0.f )
  2962. {
  2963. AddEffectDefault( EET_Mutation10, this, "Mutation 10" );
  2964. }
  2965.  
  2966. PlayEffect( 'mutation_10' );
  2967. PlayEffect( 'critical_toxicity' );
  2968. AddTimer( 'Mutation10StopEffect', 5.f );
  2969. }
  2970. }
  2971. // W3EE - End
  2972.  
  2973. timer function Mutation7CombatStartHackFix( dt : float, id : int )
  2974. {
  2975. var actors : array< CActor >;
  2976.  
  2977. actors = GetEnemies();
  2978.  
  2979. if( actors.Size() > 0 )
  2980. {
  2981.  
  2982. AddTimer( 'Mutation7CombatStartHackFixGo', 0.5f );
  2983. RemoveTimer( 'Mutation7CombatStartHackFix' );
  2984. }
  2985. }
  2986.  
  2987. timer function Mutation7CombatStartHackFixGo( dt : float, id : int )
  2988. {
  2989. var actors : array< CActor >;
  2990.  
  2991. if( IsSetBonusActive(EISB_Wolf_1) )
  2992. {
  2993. actors = GetEnemies();
  2994.  
  2995. if( actors.Size() > 1 )
  2996. {
  2997. AddEffectDefault( EET_Mutation7Buff, this, "Mutation 7, combat start" );
  2998. }
  2999. }
  3000. }
  3001.  
  3002. public final function IsInFistFight() : bool
  3003. {
  3004. var enemies : array< CActor >;
  3005. var i, j : int;
  3006. var invent : CInventoryComponent;
  3007. var weapons : array< SItemUniqueId >;
  3008.  
  3009. if( IsInFistFightMiniGame() )
  3010. {
  3011. return true;
  3012. }
  3013.  
  3014. enemies = GetEnemies();
  3015. for( i=0; i<enemies.Size(); i+=1 )
  3016. {
  3017. weapons.Clear();
  3018. invent = enemies[i].GetInventory();
  3019. weapons = invent.GetHeldWeapons();
  3020.  
  3021. for( j=0; j<weapons.Size(); j+=1 )
  3022. {
  3023. if( invent.IsItemFists( weapons[j] ) )
  3024. {
  3025. return true;
  3026. }
  3027. }
  3028. }
  3029.  
  3030. return false;
  3031. }
  3032.  
  3033. timer function Mutation10StopEffect( dt : float, id : int )
  3034. {
  3035. StopEffect( 'critical_toxicity' );
  3036. }
  3037.  
  3038. // W3EE - Begin
  3039. timer function ResetAdrenalineCombat( dt : float, id : int )
  3040. {
  3041. if( !IsInCombat() )
  3042. {
  3043. RemoveBuff(EET_CombatAdr, true, "CombatAdrenaline");
  3044. ((W3Effect_DimeritiumCharge)GetBuff(EET_DimeritiumCharge, "DimeritiumSetBonus")).SetDimeritiumCharge(0);
  3045. RemoveBuff(EET_DimeritiumCharge);
  3046. RemoveBuff(EET_WolfSetParry);
  3047. }
  3048. }
  3049. // W3EE - End
  3050.  
  3051. event OnCombatFinished()
  3052. {
  3053. var inGameConfigWrapper : CInGameConfigWrapper;
  3054. var disableAutoSheathe : bool;
  3055.  
  3056. super.OnCombatFinished();
  3057.  
  3058. Experience().AwardCombatAdrenalineXP(this, enemiesKilled, startingHealthPerc == GetStatPercents(BCS_Vitality));
  3059. UnblockAction(EIAB_OpenInventory, 'CombatInventoryBlock');
  3060. AddTimer('ResetAdrenalineCombat', 8.f, false,,,,true);
  3061. adrenalineEffect = NULL;
  3062. enemiesKilled = 0;
  3063.  
  3064. if( HasBuff(EET_Decoction9) )
  3065. ((W3Decoction9_Effect)GetBuff(EET_Decoction9)).ClearBoost();
  3066. // W3EE - End
  3067.  
  3068.  
  3069. RemoveBuff( EET_Mutation3 );
  3070.  
  3071.  
  3072. RemoveBuff( EET_Mutation4 );
  3073.  
  3074.  
  3075. RemoveBuff( EET_Mutation5 );
  3076.  
  3077.  
  3078. RemoveBuff( EET_Mutation7Buff );
  3079. RemoveBuff( EET_Mutation7Debuff );
  3080.  
  3081. if( IsMutationActive( EPMT_Mutation8 ) )
  3082. {
  3083. theGame.MutationHUDFeedback( MFT_PlayHide );
  3084. }
  3085.  
  3086. RemoveBuff( EET_LynxSetBonus );
  3087.  
  3088. // W3EE - Begin
  3089.  
  3090. UpdateWoundedState();
  3091. // RemoveBuff( EET_Mutation10 );
  3092.  
  3093. /*if(GetStat(BCS_Focus) > 0)
  3094. {
  3095. AddTimer('DelayedAdrenalineDrain', theGame.params.ADRENALINE_DRAIN_AFTER_COMBAT_DELAY, , , , true);
  3096. }*/
  3097. // W3EE - End
  3098.  
  3099. thePlayer.abilityManager.ResetOverhealBonus();
  3100.  
  3101. usedQuenInCombat = false;
  3102.  
  3103. theGame.GetGamerProfile().ResetStat(ES_FinesseKills);
  3104.  
  3105. LogChannel( 'OnCombatFinished', "OnCombatFinished: DelayedSheathSword timer added" );
  3106.  
  3107.  
  3108. inGameConfigWrapper = (CInGameConfigWrapper)theGame.GetInGameConfigWrapper();
  3109. disableAutoSheathe = inGameConfigWrapper.GetVarValue( 'Gameplay', 'DisableAutomaticSwordSheathe' );
  3110. if( !disableAutoSheathe )
  3111. {
  3112. if ( ShouldAutoSheathSwordInstantly() )
  3113. AddTimer( 'DelayedSheathSword', 0.5f );
  3114. else
  3115. AddTimer( 'DelayedSheathSword', 2.f );
  3116. }
  3117.  
  3118. OnBlockAllCombatTickets( false );
  3119.  
  3120.  
  3121. runewordInfusionType = ST_None;
  3122.  
  3123.  
  3124.  
  3125.  
  3126.  
  3127. }
  3128.  
  3129. public function PlayHitEffect( damageAction : W3DamageAction )
  3130. {
  3131. var hitReactionType : EHitReactionType;
  3132. var isAtBack : bool;
  3133.  
  3134.  
  3135. if( damageAction.GetMutation4Triggered() )
  3136. {
  3137. hitReactionType = damageAction.GetHitReactionType();
  3138. isAtBack = IsAttackerAtBack( damageAction.attacker );
  3139.  
  3140. if( hitReactionType != EHRT_Heavy )
  3141. {
  3142. if( isAtBack )
  3143. {
  3144. damageAction.SetHitEffect( 'light_hit_back_toxic', true );
  3145. }
  3146. else
  3147. {
  3148. damageAction.SetHitEffect( 'light_hit_toxic' );
  3149. }
  3150. }
  3151. else
  3152. {
  3153. if( isAtBack )
  3154. {
  3155. damageAction.SetHitEffect( 'heavy_hit_back_toxic' ,true );
  3156. }
  3157. else
  3158. {
  3159. damageAction.SetHitEffect( 'heavy_hit_toxic' );
  3160. }
  3161. }
  3162. }
  3163.  
  3164. super.PlayHitEffect( damageAction );
  3165. }
  3166.  
  3167.  
  3168. // W3EE - Begin
  3169. public function StartRegenTimer( regenDelay : float )
  3170. {
  3171. ((W3Effect_AdrenalineDrain)GetBuff(EET_AdrenalineDrain)).StopRegen();
  3172. if( IsMutationActive(EPMT_Mutation1) )
  3173. ResumeVigorRegen(0, 0);
  3174. else
  3175. AddTimer('ResumeVigorRegen', regenDelay, false,,,,true);
  3176. }
  3177.  
  3178. timer function ResumeVigorRegen( dt : float, id : int )
  3179. {
  3180. if( !HasBuff(EET_AdrenalineDrain) )
  3181. AddEffectDefault(EET_AdrenalineDrain, this, "VigorRegen");
  3182. ((W3Effect_AdrenalineDrain)GetBuff(EET_AdrenalineDrain)).ResumeRegen();
  3183. }
  3184.  
  3185. public function StartCustomVigorTimer( time : float )
  3186. {
  3187. ((W3Effect_AdrenalineDrain)GetBuff(EET_AdrenalineDrain)).StopRegen();
  3188. ((W3Effect_AdrenalineDrain)GetBuff(EET_AdrenalineDrain)).SetCustomTimerActive(true);
  3189. AddTimer('CustomVigorTimerEnd', time, false,,,,true);
  3190. }
  3191.  
  3192. timer function CustomVigorTimerEnd( dt : float, id : int )
  3193. {
  3194. ((W3Effect_AdrenalineDrain)GetBuff(EET_AdrenalineDrain)).SetCustomTimerActive(false);
  3195. ((W3Effect_AdrenalineDrain)GetBuff(EET_AdrenalineDrain)).ResumeRegen();
  3196. }
  3197.  
  3198. timer function StunPlayer( dt : float, id : int )
  3199. {
  3200. AddEffectDefault(EET_Knockdown, NULL, "Stun", false);
  3201. }
  3202. // W3EE - End
  3203.  
  3204. protected function Attack( hitTarget : CGameplayEntity, animData : CPreAttackEventData, weaponId : SItemUniqueId, parried : bool, countered : bool, parriedBy : array<CActor>, attackAnimationName : name, hitTime : float, weaponEntity : CItemEntity)
  3205. {
  3206. // W3EE - Begin
  3207. var isNotCounterAttack, isBuffConsumed : bool;
  3208.  
  3209. super.Attack(hitTarget, animData, weaponId, parried, countered, parriedBy, attackAnimationName, hitTime, weaponEntity);
  3210.  
  3211. isNotCounterAttack = IsLightAttack(animData.attackName) || IsHeavyAttack(animData.attackName);
  3212.  
  3213. if( HasBuff(EET_Decoction9) )
  3214. {
  3215.  
  3216. if ( IsLightAttack(animData.attackName) )
  3217. {
  3218. if( ((W3Decoction9_Effect)GetBuff(EET_Decoction9)).HasBoost("light") )
  3219. ((W3Decoction9_Effect)GetBuff(EET_Decoction9)).ClearBoost();
  3220.  
  3221. FactsAdd("decoction_9_attack_light", 1);
  3222. }
  3223. else if( IsHeavyAttack(animData.attackName) )
  3224. {
  3225. if( ((W3Decoction9_Effect)GetBuff(EET_Decoction9)).HasBoost("heavy") )
  3226. ((W3Decoction9_Effect)GetBuff(EET_Decoction9)).ClearBoost();
  3227.  
  3228. FactsAdd("decoction_9_attack_heavy", 1);
  3229. }
  3230. }
  3231. // W3EE - End
  3232. }
  3233.  
  3234. public final timer function SpecialAttackLightSustainCost(dt : float, id : int)
  3235. {
  3236. var focusPerSec, cost, delay : float;
  3237. var reduction : SAbilityAttributeValue;
  3238. var skillLevel : int;
  3239.  
  3240. if(abilityManager && abilityManager.IsInitialized() && IsAlive())
  3241. {
  3242. PauseStaminaRegen('WhirlSkill');
  3243.  
  3244. if(GetStat(BCS_Stamina) > 0)
  3245. {
  3246. cost = GetStaminaActionCost(ESAT_Ability, GetSkillAbilityName(S_Sword_s01), dt);
  3247. delay = GetStaminaActionDelay(ESAT_Ability, GetSkillAbilityName(S_Sword_s01), dt);
  3248. skillLevel = GetSkillLevel(S_Sword_s01);
  3249.  
  3250. if(skillLevel >= 1)
  3251. {
  3252. reduction = GetSkillAttributeValue(S_Sword_s01, 'cost_reduction', false, true) * skillLevel;
  3253. cost = MaxF(0, cost * (1 - reduction.valueMultiplicative) - reduction.valueAdditive);
  3254. }
  3255.  
  3256. //W3EE - Begin
  3257. DrainStamina(ESAT_FixedValue, cost * 0.4f, delay, GetSkillAbilityName(S_Sword_s01));
  3258. //W3EE - End
  3259. }
  3260. // W3EE - Begin
  3261. /*else
  3262. {
  3263. GetSkillAttributeValue(S_Sword_s01, 'focus_cost_per_sec', false, true);
  3264. focusPerSec = GetWhirlFocusCostPerSec();
  3265. DrainFocus(focusPerSec * dt);
  3266. }*/
  3267. // W3EE - End
  3268. }
  3269.  
  3270. // W3EE - Begin
  3271. if(GetStat(BCS_Stamina) <= 0 /*&& GetStat(BCS_Focus) <= 0*/)
  3272. // W3EE - End
  3273. {
  3274. OnPerformSpecialAttack(true, false);
  3275. }
  3276. }
  3277.  
  3278. public final function GetWhirlFocusCostPerSec() : float
  3279. {
  3280. var ability : SAbilityAttributeValue;
  3281. var val : float;
  3282. var skillLevel : int;
  3283.  
  3284. ability = GetSkillAttributeValue(S_Sword_s01, 'focus_cost_per_sec_initial', false, false);
  3285. skillLevel = GetSkillLevel(S_Sword_s01);
  3286.  
  3287. if(skillLevel >= 1)
  3288. ability -= GetSkillAttributeValue(S_Sword_s01, 'cost_reduction', false, false) * skillLevel;
  3289.  
  3290. val = CalculateAttributeValue(ability);
  3291.  
  3292. return val;
  3293. }
  3294.  
  3295. public final timer function SpecialAttackHeavySustainCost(dt : float, id : int)
  3296. {
  3297. var focusHighlight, ratio : float;
  3298. var hud : CR4ScriptedHud;
  3299. var hudWolfHeadModule : CR4HudModuleWolfHead;
  3300.  
  3301. //W3EE - Begin
  3302. PauseStaminaRegen('RendSkill');
  3303.  
  3304. DrainStamina(ESAT_Ability, 0, 0, GetSkillAbilityName(S_Sword_s02), dt, 1.f);
  3305. // W3EE - End
  3306.  
  3307. if(GetStat(BCS_Stamina) <= 0)
  3308. OnPerformSpecialAttack(false, false);
  3309.  
  3310.  
  3311. ratio = EngineTimeToFloat(theGame.GetEngineTime() - specialHeavyStartEngineTime) / specialHeavyChargeDuration;
  3312.  
  3313.  
  3314. if(ratio > 0.95)
  3315. ratio = 1;
  3316.  
  3317. SetSpecialAttackTimeRatio(ratio);
  3318.  
  3319. // W3EE - Begin
  3320. /*focusHighlight = ratio * GetStatMax(BCS_Focus);
  3321. focusHighlight = MinF(focusHighlight, GetStat(BCS_Focus));
  3322. focusHighlight = FloorF(focusHighlight);
  3323.  
  3324. hud = (CR4ScriptedHud)theGame.GetHud();
  3325. if ( hud )
  3326. {
  3327. hudWolfHeadModule = (CR4HudModuleWolfHead)hud.GetHudModule( "WolfHeadModule" );
  3328. if ( hudWolfHeadModule )
  3329. {
  3330. hudWolfHeadModule.LockFocusPoints((int)focusHighlight);
  3331. }
  3332. }*/
  3333. // W3EE - End
  3334. }
  3335.  
  3336. public function OnSpecialAttackHeavyActionProcess()
  3337. {
  3338. var hud : CR4ScriptedHud;
  3339. var hudWolfHeadModule : CR4HudModuleWolfHead;
  3340.  
  3341. super.OnSpecialAttackHeavyActionProcess();
  3342.  
  3343. // W3EE - Begin
  3344. /*hud = (CR4ScriptedHud)theGame.GetHud();
  3345. if ( hud )
  3346. {
  3347. hudWolfHeadModule = (CR4HudModuleWolfHead)hud.GetHudModule( "WolfHeadModule" );
  3348. if ( hudWolfHeadModule )
  3349. {
  3350. hudWolfHeadModule.ResetFocusPoints();
  3351. }
  3352. }*/
  3353. // W3EE - End
  3354. }
  3355.  
  3356. timer function IsSpecialLightAttackInputHeld ( time : float, id : int )
  3357. {
  3358. var hasResource : bool;
  3359.  
  3360. if ( GetCurrentStateName() == 'CombatSteel' || GetCurrentStateName() == 'CombatSilver' )
  3361. {
  3362. if ( GetBIsCombatActionAllowed() && inputHandler.IsActionAllowed(EIAB_SwordAttack))
  3363. {
  3364. // W3EE - Begin
  3365. if(GetStat(BCS_Stamina) > 0)
  3366. {
  3367. hasResource = true;
  3368. }
  3369. /*else
  3370. {
  3371. hasResource = (GetStat(BCS_Focus) >= GetWhirlFocusCostPerSec() * time);
  3372. }*/
  3373.  
  3374. if(hasResource)
  3375. {
  3376. SetupCombatAction( EBAT_SpecialAttack_Light, BS_Pressed );
  3377. RemoveTimer('IsSpecialLightAttackInputHeld');
  3378. }
  3379. else if(!playedSpecialAttackMissingResourceSound)
  3380. {
  3381.  
  3382. SetShowToLowStaminaIndication(1.f);
  3383. playedSpecialAttackMissingResourceSound = true;
  3384. }
  3385. // W3EE - End
  3386. }
  3387. }
  3388. else
  3389. {
  3390. RemoveTimer('IsSpecialLightAttackInputHeld');
  3391. }
  3392. }
  3393.  
  3394. timer function IsSpecialHeavyAttackInputHeld ( time : float, id : int )
  3395. {
  3396. var cost : float;
  3397.  
  3398. // W3EE - Begin
  3399. if( (theInput.LastUsedGamepad() && !theInput.IsActionPressed('AttackHeavy')) || (!theInput.LastUsedGamepad() && !theInput.IsActionPressed('AttackWithAlternateHeavy')) )
  3400. {
  3401. CancelHoldAttacks();
  3402. RemoveTimer('IsSpecialHeavyAttackInputHeld');
  3403. return;
  3404. }
  3405.  
  3406. if ( (GetCurrentStateName() == 'CombatSteel' || GetCurrentStateName() == 'CombatSilver') && !inputHandler.IsRendCanceled() )
  3407. {
  3408. if( GetBIsCombatActionAllowed() && inputHandler.IsActionAllowed(EIAB_SwordAttack) )
  3409. {
  3410. cost = CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s02, 'stamina_cost_per_sec', false, false));
  3411.  
  3412. if(GetStat(BCS_Stamina) >= cost)
  3413. {
  3414. SetupCombatAction( EBAT_SpecialAttack_Heavy, BS_Pressed );
  3415. RemoveTimer('IsSpecialHeavyAttackInputHeld');
  3416. }
  3417. else if(!playedSpecialAttackMissingResourceSound)
  3418. {
  3419. SetShowToLowStaminaIndication(1.f);
  3420. playedSpecialAttackMissingResourceSound = true;
  3421. }
  3422. }
  3423. }
  3424. else
  3425. {
  3426. CancelHoldAttacks();
  3427. RemoveTimer('IsSpecialHeavyAttackInputHeld');
  3428. }
  3429. // W3EE - End
  3430. }
  3431.  
  3432. public function EvadePressed( bufferAction : EBufferActionType )
  3433. {
  3434. var cat : float;
  3435.  
  3436. if( (bufferAction == EBAT_Dodge && IsActionAllowed(EIAB_Dodge)) || (bufferAction == EBAT_Roll && IsActionAllowed(EIAB_Roll)) )
  3437. {
  3438.  
  3439. if(bufferAction != EBAT_Roll && ShouldProcessTutorial('TutorialDodge'))
  3440. {
  3441. FactsAdd("tut_in_dodge", 1, 2);
  3442.  
  3443. if(FactsQuerySum("tut_fight_use_slomo") > 0)
  3444. {
  3445. theGame.RemoveTimeScale( theGame.GetTimescaleSource(ETS_TutorialFight) );
  3446. FactsRemove("tut_fight_slomo_ON");
  3447. }
  3448. }
  3449. else if(bufferAction == EBAT_Roll && ShouldProcessTutorial('TutorialRoll'))
  3450. {
  3451. FactsAdd("tut_in_roll", 1, 2);
  3452.  
  3453. if(FactsQuerySum("tut_fight_use_slomo") > 0)
  3454. {
  3455. theGame.RemoveTimeScale( theGame.GetTimescaleSource(ETS_TutorialFight) );
  3456. FactsRemove("tut_fight_slomo_ON");
  3457. }
  3458. }
  3459.  
  3460. if ( GetBIsInputAllowed() )
  3461. {
  3462. if ( GetBIsCombatActionAllowed() )
  3463. {
  3464. CriticalEffectAnimationInterrupted("Dodge 2");
  3465. PushCombatActionOnBuffer( bufferAction, BS_Released );
  3466. ProcessCombatActionBuffer();
  3467. }
  3468. else if ( IsInCombatAction() && GetBehaviorVariable( 'combatActionType' ) == (int)CAT_Attack )
  3469. {
  3470. if ( CanPlayHitAnim() && IsThreatened() )
  3471. {
  3472. CriticalEffectAnimationInterrupted("Dodge 1");
  3473. PushCombatActionOnBuffer( bufferAction, BS_Released );
  3474. ProcessCombatActionBuffer();
  3475. }
  3476. else
  3477. PushCombatActionOnBuffer( bufferAction, BS_Released );
  3478. }
  3479.  
  3480. else if ( !( IsCurrentSignChanneled() ) )
  3481. {
  3482.  
  3483. PushCombatActionOnBuffer( bufferAction, BS_Released );
  3484. }
  3485. }
  3486. else
  3487. {
  3488. if ( IsInCombatAction() && GetBehaviorVariable( 'combatActionType' ) == (int)CAT_Attack )
  3489. {
  3490. if ( CanPlayHitAnim() && IsThreatened() )
  3491. {
  3492. CriticalEffectAnimationInterrupted("Dodge 3");
  3493. PushCombatActionOnBuffer( bufferAction, BS_Released );
  3494. ProcessCombatActionBuffer();
  3495. }
  3496. else
  3497. PushCombatActionOnBuffer( bufferAction, BS_Released );
  3498. }
  3499. LogChannel( 'InputNotAllowed', "InputNotAllowed" );
  3500. }
  3501. }
  3502. else
  3503. {
  3504. DisplayActionDisallowedHudMessage(EIAB_Dodge);
  3505. }
  3506. }
  3507.  
  3508.  
  3509. public function ProcessCombatActionBuffer() : bool
  3510. {
  3511. var action : EBufferActionType = this.BufferCombatAction;
  3512. var stage : EButtonStage = this.BufferButtonStage;
  3513. var throwStage : EThrowStage;
  3514. var actionResult : bool = true;
  3515.  
  3516.  
  3517. if( isInFinisher )
  3518. {
  3519. return false;
  3520. }
  3521.  
  3522. if ( action != EBAT_SpecialAttack_Heavy )
  3523. specialAttackCamera = false;
  3524.  
  3525.  
  3526. if(super.ProcessCombatActionBuffer())
  3527. return true;
  3528.  
  3529. switch ( action )
  3530. {
  3531. case EBAT_CastSign :
  3532. {
  3533. switch ( stage )
  3534. {
  3535. case BS_Pressed :
  3536. {
  3537.  
  3538.  
  3539.  
  3540.  
  3541.  
  3542.  
  3543. actionResult = this.CastSign();
  3544. LogChannel('SignDebug', "CastSign()");
  3545.  
  3546.  
  3547. } break;
  3548.  
  3549. default :
  3550. {
  3551. actionResult = false;
  3552. } break;
  3553. }
  3554. } break;
  3555.  
  3556. case EBAT_SpecialAttack_Light :
  3557. {
  3558. switch ( stage )
  3559. {
  3560. case BS_Pressed :
  3561. {
  3562. actionResult = this.OnPerformSpecialAttack( true, true );
  3563. } break;
  3564.  
  3565. case BS_Released :
  3566. {
  3567. actionResult = this.OnPerformSpecialAttack( true, false );
  3568. } break;
  3569.  
  3570. default :
  3571. {
  3572. actionResult = false;
  3573. } break;
  3574. }
  3575. } break;
  3576.  
  3577. case EBAT_SpecialAttack_Heavy :
  3578. {
  3579. switch ( stage )
  3580. {
  3581. case BS_Pressed :
  3582. {
  3583. actionResult = this.OnPerformSpecialAttack( false, true );
  3584. } break;
  3585.  
  3586. case BS_Released :
  3587. {
  3588. actionResult = this.OnPerformSpecialAttack( false, false );
  3589. } break;
  3590.  
  3591. default :
  3592. {
  3593. actionResult = false;
  3594. } break;
  3595. }
  3596. } break;
  3597.  
  3598. default:
  3599. return false;
  3600. }
  3601.  
  3602.  
  3603. this.CleanCombatActionBuffer();
  3604.  
  3605. if (actionResult)
  3606. {
  3607. SetCombatAction( action ) ;
  3608. }
  3609.  
  3610. return true;
  3611. }
  3612.  
  3613.  
  3614. event OnPerformSpecialAttack( isLightAttack : bool, enableAttack : bool ){}
  3615.  
  3616. public final function GetEnemies() : array< CActor >
  3617. {
  3618. var actors, actors2 : array<CActor>;
  3619. var i : int;
  3620.  
  3621.  
  3622. actors = GetWitcherPlayer().GetHostileEnemies();
  3623. ArrayOfActorsAppendUnique( actors, GetWitcherPlayer().GetMoveTargets() );
  3624.  
  3625.  
  3626. thePlayer.GetVisibleEnemies( actors2 );
  3627. ArrayOfActorsAppendUnique( actors, actors2 );
  3628.  
  3629. for( i=actors.Size()-1; i>=0; i-=1 )
  3630. {
  3631. if( !IsRequiredAttitudeBetween( actors[i], this, true ) )
  3632. {
  3633. actors.EraseFast( i );
  3634. }
  3635. }
  3636.  
  3637. return actors;
  3638. }
  3639.  
  3640. // W3EE - Begin
  3641. private var tickTimer : float; default tickTimer = 0;
  3642. event OnPlayerTickTimer( deltaTime : float )
  3643. {
  3644. super.OnPlayerTickTimer( deltaTime );
  3645.  
  3646. if ( !IsInCombat() )
  3647. {
  3648. fastAttackCounter = 0;
  3649. heavyAttackCounter = 0;
  3650. }
  3651.  
  3652. tickTimer += deltaTime;
  3653. if(tickTimer > 5)
  3654. {
  3655. FactsSet("StoredVigor", (int)(GetStat(BCS_Focus) * 1000), -1);
  3656. }
  3657. WmkGetMapMenuInstance().OnTick(deltaTime); // -= WMK:modAQOOM =-
  3658. }
  3659. // W3EE - End
  3660.  
  3661.  
  3662.  
  3663.  
  3664. 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
  3665. {
  3666. var ret : bool;
  3667. var skill : ESkill;
  3668.  
  3669. ret = super.PrepareAttackAction(hitTarget, animData, weaponId, parried, countered, parriedBy, attackAnimationName, hitTime, weaponEntity, attackAction);
  3670.  
  3671. if(!ret)
  3672. return false;
  3673.  
  3674.  
  3675. if(attackAction.IsActionMelee())
  3676. {
  3677. skill = SkillNameToEnum( attackAction.GetAttackTypeName() );
  3678. if( skill != S_SUndefined && CanUseSkill(skill))
  3679. {
  3680. if(IsLightAttack(animData.attackName))
  3681. fastAttackCounter += 1;
  3682. else
  3683. fastAttackCounter = 0;
  3684.  
  3685. if(IsHeavyAttack(animData.attackName))
  3686. heavyAttackCounter += 1;
  3687. else
  3688. heavyAttackCounter = 0;
  3689. }
  3690. }
  3691.  
  3692. AddTimer('FastAttackCounterDecay',5.0);
  3693. AddTimer('HeavyAttackCounterDecay',5.0);
  3694.  
  3695. return true;
  3696. }
  3697.  
  3698. protected function TestParryAndCounter(data : CPreAttackEventData, weaponId : SItemUniqueId, out parried : bool, out countered : bool) : array<CActor>
  3699. {
  3700.  
  3701. if(SkillNameToEnum(attackActionName) == S_Sword_s02)
  3702. data.Can_Parry_Attack = false;
  3703.  
  3704. return super.TestParryAndCounter(data, weaponId, parried, countered);
  3705. }
  3706.  
  3707. private timer function FastAttackCounterDecay(delta : float, id : int)
  3708. {
  3709. fastAttackCounter = 0;
  3710. }
  3711.  
  3712. private timer function HeavyAttackCounterDecay(delta : float, id : int)
  3713. {
  3714. heavyAttackCounter = 0;
  3715. }
  3716.  
  3717.  
  3718. public function GetCraftingSchematicsNames() : array<name> {return craftingSchematics;}
  3719.  
  3720. public function RemoveAllCraftingSchematics()
  3721. {
  3722. craftingSchematics.Clear();
  3723. }
  3724.  
  3725.  
  3726. function AddCraftingSchematic( nam : name, optional isSilent : bool, optional skipTutorialUpdate : bool ) : bool
  3727. {
  3728. var i : int;
  3729.  
  3730. if(!skipTutorialUpdate && ShouldProcessTutorial('TutorialCraftingGotRecipe'))
  3731. {
  3732. FactsAdd("tut_received_schematic");
  3733. }
  3734.  
  3735. for(i=0; i<craftingSchematics.Size(); i+=1)
  3736. {
  3737. if(craftingSchematics[i] == nam)
  3738. return false;
  3739.  
  3740.  
  3741. if(StrCmp(craftingSchematics[i],nam) > 0)
  3742. {
  3743. craftingSchematics.Insert(i,nam);
  3744. AddCraftingHudNotification( nam, isSilent );
  3745. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_CraftingSchematics );
  3746. return true;
  3747. }
  3748. }
  3749.  
  3750.  
  3751. craftingSchematics.PushBack(nam);
  3752. AddCraftingHudNotification( nam, isSilent );
  3753. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_CraftingSchematics );
  3754. return true;
  3755. }
  3756.  
  3757. function AddCraftingHudNotification( nam : name, isSilent : bool )
  3758. {
  3759. var hud : CR4ScriptedHud;
  3760. if( !isSilent )
  3761. {
  3762. hud = (CR4ScriptedHud)theGame.GetHud();
  3763. if( hud )
  3764. {
  3765. hud.OnCraftingSchematicUpdate( nam );
  3766. }
  3767. }
  3768. }
  3769.  
  3770. function AddAlchemyHudNotification( nam : name, isSilent : bool )
  3771. {
  3772. var hud : CR4ScriptedHud;
  3773. if( !isSilent )
  3774. {
  3775. hud = (CR4ScriptedHud)theGame.GetHud();
  3776. if( hud )
  3777. {
  3778. hud.OnAlchemySchematicUpdate( nam );
  3779. }
  3780. }
  3781. }
  3782.  
  3783. public function GetExpandedCraftingCategories() : array< name >
  3784. {
  3785. return expandedCraftingCategories;
  3786. }
  3787.  
  3788. public function AddExpandedCraftingCategory( category : name )
  3789. {
  3790. if ( IsNameValid( category ) )
  3791. {
  3792. ArrayOfNamesPushBackUnique( expandedCraftingCategories, category );
  3793. }
  3794. }
  3795.  
  3796. public function RemoveExpandedCraftingCategory( category : name )
  3797. {
  3798. if ( IsNameValid( category ) )
  3799. {
  3800. expandedCraftingCategories.Remove( category );
  3801. }
  3802. }
  3803.  
  3804. public function SetCraftingFilters(showHasIngre : bool, showMissingIngre : bool, showAlreadyCrafted : bool )
  3805. {
  3806. craftingFilters.showCraftable = showHasIngre;
  3807. craftingFilters.showMissingIngre = showMissingIngre;
  3808. craftingFilters.showAlreadyCrafted = showAlreadyCrafted;
  3809. }
  3810.  
  3811. public function GetCraftingFilters() : SCraftingFilters
  3812. {
  3813.  
  3814. if ( craftingFilters.showCraftable == false && craftingFilters.showMissingIngre == false && craftingFilters.showAlreadyCrafted == false )
  3815. {
  3816. craftingFilters.showCraftable = true;
  3817. craftingFilters.showMissingIngre = true;
  3818. craftingFilters.showAlreadyCrafted = false;
  3819. }
  3820.  
  3821. return craftingFilters;
  3822. }
  3823.  
  3824.  
  3825.  
  3826.  
  3827.  
  3828. event OnMutation11Triggered()
  3829. {
  3830. var min, max : SAbilityAttributeValue;
  3831. var healValue : float;
  3832. var quenEntity : W3QuenEntity;
  3833.  
  3834.  
  3835. if( IsSwimming() || IsDiving() || IsSailing() || IsUsingHorse() || IsUsingBoat() || IsUsingVehicle() || IsUsingExploration() )
  3836. {
  3837.  
  3838. ForceSetStat( BCS_Vitality, GetStatMax( BCS_Vitality ) );
  3839.  
  3840.  
  3841. theGame.MutationHUDFeedback( MFT_PlayOnce );
  3842.  
  3843.  
  3844. GCameraShake( 1.0f, , , , true, 'camera_shake_loop_lvl1_1' );
  3845. AddTimer( 'StopMutation11CamShake', 2.f );
  3846.  
  3847.  
  3848. theGame.VibrateControllerVeryHard( 2.f );
  3849.  
  3850.  
  3851. Mutation11ShockWave( true );
  3852.  
  3853.  
  3854. AddEffectDefault( EET_Mutation11Debuff, NULL, "Mutation 11 Debuff", false );
  3855. }
  3856. else
  3857. {
  3858. AddEffectDefault( EET_Mutation11Buff, this, "Mutation 11", false );
  3859. }
  3860. }
  3861.  
  3862. timer function StopMutation11CamShake( dt : float, id : int )
  3863. {
  3864. theGame.GetGameCamera().StopAnimation( 'camera_shake_loop_lvl1_1' );
  3865. }
  3866.  
  3867. public final function GetDrunkDecoctions( optional sourceName : string ) : array<CBaseGameplayEffect>
  3868. {
  3869. return effectManager.GetDrunkDecoctions(sourceName);
  3870. }
  3871.  
  3872. private var mutation12IsOnCooldown : bool;
  3873. public final function AddMutation12Decoction()
  3874. {
  3875. var params : SCustomEffectParams;
  3876. var buffs : array< EEffectType >;
  3877. var existingDecoctionBuffs : array<CBaseGameplayEffect>;
  3878. var i : int;
  3879. var effectType : EEffectType;
  3880. var decoctions : array< SItemUniqueId >;
  3881. var tmpName : name;
  3882. var min, max : SAbilityAttributeValue;
  3883.  
  3884. if( mutation12IsOnCooldown )
  3885. {
  3886. return;
  3887. }
  3888.  
  3889. existingDecoctionBuffs = GetDrunkDecoctions("Mutation12");
  3890. theGame.GetDefinitionsManager().GetAbilityAttributeValue('Mutation12', 'maxcap', min, max);
  3891. if( existingDecoctionBuffs.Size() >= min.valueAdditive )
  3892. {
  3893. return;
  3894. }
  3895.  
  3896. mutation12IsOnCooldown = true;
  3897. theGame.GetDefinitionsManager().GetAbilityAttributeValue('Mutation12', 'cooldown', min, max);
  3898. AddTimer('Mutation12Cooldown', CalculateAttributeValue(min));
  3899. for(i=EET_Decoction1; i<=EET_Decoction10; i+=1)
  3900. {
  3901. if( !HasBuff(i) )
  3902. buffs.PushBack(i);
  3903. }
  3904.  
  3905. if( buffs.Size() == 0 )
  3906. {
  3907. return;
  3908. }
  3909.  
  3910. theGame.GetDefinitionsManager().GetAbilityAttributeValue('Mutation12', 'duration', min, max);
  3911. params.effectType = buffs[RandRange(buffs.Size())];
  3912. params.creator = this;
  3913. params.sourceName = "Mutation12";
  3914. params.duration = min.valueAdditive;
  3915. AddEffectCustom(params);
  3916. if( !IsEffectActive('invisible') )
  3917. PlayEffect( 'use_potion' );
  3918.  
  3919. theGame.MutationHUDFeedback( MFT_PlayOnce );
  3920. }
  3921.  
  3922. timer function Mutation12Cooldown( dt : float, id : int )
  3923. {
  3924. mutation12IsOnCooldown = false;
  3925. }
  3926.  
  3927.  
  3928. public final function HasResourcesToStartAnyMutationResearch() : bool
  3929. {
  3930. var greenPoints, redPoints, bluePoints, count : int;
  3931. var itemIDs : array< SItemUniqueId >;
  3932.  
  3933. if( levelManager.GetPointsFree( ESkillPoint ) > 0 )
  3934. {
  3935. return true;
  3936. }
  3937.  
  3938.  
  3939. count = inv.GetItemQuantityByName( 'Greater mutagen green' );
  3940. if( count > 0 )
  3941. {
  3942. itemIDs = inv.GetItemsByName( 'Greater mutagen green' );
  3943. greenPoints = inv.GetMutationResearchPoints( SC_Green, itemIDs[0] );
  3944. if( greenPoints > 0 )
  3945. {
  3946. return true;
  3947. }
  3948. }
  3949. count = inv.GetItemQuantityByName( 'Greater mutagen red' );
  3950. if( count > 0 )
  3951. {
  3952. itemIDs.Clear();
  3953. itemIDs = inv.GetItemsByName( 'Greater mutagen red' );
  3954. redPoints = inv.GetMutationResearchPoints( SC_Red, itemIDs[0] );
  3955. if( redPoints > 0 )
  3956. {
  3957. return true;
  3958. }
  3959. }
  3960. count = inv.GetItemQuantityByName( 'Greater mutagen blue' );
  3961. if( count > 0 )
  3962. {
  3963. itemIDs.Clear();
  3964. itemIDs = inv.GetItemsByName( 'Greater mutagen blue' );
  3965. bluePoints = inv.GetMutationResearchPoints( SC_Blue, itemIDs[0] );
  3966. if( bluePoints > 0 )
  3967. {
  3968. return true;
  3969. }
  3970. }
  3971.  
  3972. return false;
  3973. }
  3974.  
  3975.  
  3976. public final function Mutation11StartAnimation()
  3977. {
  3978.  
  3979. thePlayer.ActionPlaySlotAnimationAsync( 'PLAYER_SLOT', 'geralt_mutation_11', 0.2, 0.2 );
  3980.  
  3981.  
  3982. BlockAllActions( 'Mutation11', true );
  3983.  
  3984.  
  3985. loopingCameraShakeAnimName = 'camera_shake_loop_lvl1_1';
  3986. GCameraShake( 1.0f, , , , true, loopingCameraShakeAnimName );
  3987.  
  3988.  
  3989. theGame.VibrateControllerVeryHard( 15.f );
  3990.  
  3991.  
  3992. storedInteractionPriority = GetInteractionPriority();
  3993. SetInteractionPriority( IP_Max_Unpushable );
  3994. }
  3995.  
  3996. event OnAnimEvent_Mutation11ShockWave( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  3997. {
  3998. Mutation11ShockWave( false );
  3999. }
  4000.  
  4001. private final function Mutation11ShockWave( skipQuenSign : bool )
  4002. {
  4003. var action : W3DamageAction;
  4004. var ents : array< CGameplayEntity >;
  4005. var i, j : int;
  4006. var damages : array< SRawDamage >;
  4007.  
  4008.  
  4009. FindGameplayEntitiesInSphere(ents, GetWorldPosition(), 5.f, 1000, '', FLAG_OnlyAliveActors + FLAG_ExcludeTarget + FLAG_Attitude_Hostile + FLAG_Attitude_Neutral, this);
  4010.  
  4011. if( ents.Size() > 0 )
  4012. {
  4013. damages = theGame.GetDefinitionsManager().GetDamagesFromAbility( 'Mutation11' );
  4014. }
  4015.  
  4016.  
  4017. for(i=0; i<ents.Size(); i+=1)
  4018. {
  4019. action = new W3DamageAction in theGame;
  4020. action.Initialize( this, ents[i], NULL, "Mutation11", EHRT_Heavy, CPS_SpellPower, false, false, true, false );
  4021.  
  4022. for( j=0; j<damages.Size(); j+=1 )
  4023. {
  4024. action.AddDamage( damages[j].dmgType, damages[j].dmgVal );
  4025. }
  4026.  
  4027. action.SetCannotReturnDamage( true );
  4028. action.SetProcessBuffsIfNoDamage( true );
  4029. action.AddEffectInfo( EET_KnockdownTypeApplicator );
  4030. action.SetHitAnimationPlayType( EAHA_ForceYes );
  4031. action.SetCanPlayHitParticle( false );
  4032.  
  4033. theGame.damageMgr.ProcessAction( action );
  4034. delete action;
  4035. }
  4036.  
  4037.  
  4038.  
  4039.  
  4040.  
  4041. mutation11QuenEntity = ( W3QuenEntity )GetSignEntity( ST_Quen );
  4042. if( !mutation11QuenEntity )
  4043. {
  4044. mutation11QuenEntity = (W3QuenEntity)theGame.CreateEntity( GetSignTemplate( ST_Quen ), GetWorldPosition(), GetWorldRotation() );
  4045. mutation11QuenEntity.CreateAttachment( this, 'quen_sphere' );
  4046. AddTimer( 'DestroyMutation11QuenEntity', 2.f );
  4047. }
  4048. mutation11QuenEntity.PlayHitEffect( 'quen_impulse_explode', mutation11QuenEntity.GetWorldRotation() );
  4049.  
  4050. if( !skipQuenSign )
  4051. {
  4052.  
  4053. PlayEffect( 'mutation_11_second_life' );
  4054.  
  4055.  
  4056. RestoreQuen( 1000000.f, 10.f, true );
  4057. }
  4058. }
  4059.  
  4060. private var mutation11QuenEntity : W3QuenEntity;
  4061. private var storedInteractionPriority : EInteractionPriority;
  4062.  
  4063. timer function DestroyMutation11QuenEntity( dt : float, id : int )
  4064. {
  4065. if( mutation11QuenEntity )
  4066. {
  4067. mutation11QuenEntity.Destroy();
  4068. }
  4069. }
  4070.  
  4071. event OnAnimEvent_Mutation11AnimEnd( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4072. {
  4073. if( animEventType == AET_DurationEnd )
  4074. {
  4075.  
  4076. BlockAllActions( 'Mutation11', false );
  4077.  
  4078.  
  4079. theGame.GetGameCamera().StopAnimation( 'camera_shake_loop_lvl1_1' );
  4080.  
  4081.  
  4082. theGame.StopVibrateController();
  4083.  
  4084.  
  4085. SetInteractionPriority( storedInteractionPriority );
  4086.  
  4087.  
  4088. RemoveBuff( EET_Mutation11Buff, true );
  4089. }
  4090. else if ( animEventType == AET_DurationStart || animEventType == AET_DurationStartInTheMiddle )
  4091. {
  4092.  
  4093. SetBehaviorVariable( 'AIControlled', 0.f );
  4094. }
  4095. }
  4096.  
  4097. public final function MutationSystemEnable( enable : bool )
  4098. {
  4099. ( ( W3PlayerAbilityManager ) abilityManager ).MutationSystemEnable( enable );
  4100. }
  4101.  
  4102. public final function IsMutationSystemEnabled() : bool
  4103. {
  4104. return ( ( W3PlayerAbilityManager ) abilityManager ).IsMutationSystemEnabled();
  4105. }
  4106.  
  4107. public final function GetMutation( mutationType : EPlayerMutationType ) : SMutation
  4108. {
  4109. return ( ( W3PlayerAbilityManager ) abilityManager ).GetMutation( mutationType );
  4110. }
  4111.  
  4112. public final function IsMutationActive( mutationType : EPlayerMutationType) : bool
  4113. {
  4114. var swordQuality : int;
  4115. var sword : SItemUniqueId;
  4116.  
  4117. if( GetEquippedMutationType() != mutationType )
  4118. {
  4119. return false;
  4120. }
  4121.  
  4122. switch( mutationType )
  4123. {
  4124. case EPMT_Mutation4 :
  4125. case EPMT_Mutation8 :
  4126. case EPMT_Mutation11 :
  4127. case EPMT_Mutation12 :
  4128. if( IsInFistFight() )
  4129. {
  4130. return false;
  4131. }
  4132. }
  4133.  
  4134. return true;
  4135. }
  4136.  
  4137. public final function SetEquippedMutation( mutationType : EPlayerMutationType ) : bool
  4138. {
  4139. return ( ( W3PlayerAbilityManager ) abilityManager ).SetEquippedMutation( mutationType );
  4140. }
  4141.  
  4142. public final function GetEquippedMutationType() : EPlayerMutationType
  4143. {
  4144. return ( ( W3PlayerAbilityManager ) abilityManager ).GetEquippedMutationType();
  4145. }
  4146.  
  4147. public final function CanEquipMutation(mutationType : EPlayerMutationType) : bool
  4148. {
  4149. return ( ( W3PlayerAbilityManager ) abilityManager ).CanEquipMutation( mutationType );
  4150. }
  4151.  
  4152. public final function CanResearchMutation( mutationType : EPlayerMutationType ) : bool
  4153. {
  4154. return ( ( W3PlayerAbilityManager ) abilityManager ).CanResearchMutation( mutationType );
  4155. }
  4156.  
  4157. public final function IsMutationResearched(mutationType : EPlayerMutationType) : bool
  4158. {
  4159. return ( ( W3PlayerAbilityManager ) abilityManager ).IsMutationResearched( mutationType );
  4160. }
  4161.  
  4162. public final function GetMutationResearchProgress(mutationType : EPlayerMutationType) : int
  4163. {
  4164. return ( ( W3PlayerAbilityManager ) abilityManager ).GetMutationResearchProgress( mutationType );
  4165. }
  4166.  
  4167. public final function GetMasterMutationStage() : int
  4168. {
  4169. return ( ( W3PlayerAbilityManager ) abilityManager ).GetMasterMutationStage();
  4170. }
  4171.  
  4172. public final function MutationResearchWithSkillPoints(mutation : EPlayerMutationType, skillPoints : int) : bool
  4173. {
  4174. return ( ( W3PlayerAbilityManager ) abilityManager ).MutationResearchWithSkillPoints( mutation, skillPoints );
  4175. }
  4176.  
  4177. public final function MutationResearchWithItem(mutation : EPlayerMutationType, item : SItemUniqueId, optional count: int) : bool
  4178. {
  4179. return ( ( W3PlayerAbilityManager ) abilityManager ).MutationResearchWithItem( mutation, item, count );
  4180. }
  4181.  
  4182. public final function GetMutationLocalizedName( mutationType : EPlayerMutationType ) : string
  4183. {
  4184. var pam : W3PlayerAbilityManager;
  4185. var locKey : name;
  4186.  
  4187. pam = (W3PlayerAbilityManager)GetWitcherPlayer().abilityManager;
  4188. locKey = pam.GetMutationNameLocalizationKey( mutationType );
  4189.  
  4190. return GetLocStringByKeyExt( locKey );
  4191. }
  4192.  
  4193. public final function GetMutationLocalizedDescription( mutationType : EPlayerMutationType ) : string
  4194. {
  4195. var pam : W3PlayerAbilityManager;
  4196. var locKey : name;
  4197. var arrStr : array< string >;
  4198. var dm : CDefinitionsManagerAccessor;
  4199. var min, max, sp : SAbilityAttributeValue;
  4200. var tmp, tmp2, tox, critBonusDamage, val : float;
  4201. var stats, stats2 : SPlayerOffenseStats;
  4202. var buffPerc, exampleEnemyCount, debuffPerc : int;
  4203.  
  4204. pam = (W3PlayerAbilityManager)GetWitcherPlayer().abilityManager;
  4205. locKey = pam.GetMutationDescriptionLocalizationKey( mutationType );
  4206. dm = theGame.GetDefinitionsManager();
  4207.  
  4208. switch( mutationType )
  4209. {
  4210. case EPMT_Mutation2 :
  4211. sp = GetTotalSpellPower();
  4212.  
  4213.  
  4214. dm.GetAbilityAttributeValue( 'Mutation2', 'crit_chance_factor', min, max );
  4215. arrStr.PushBack( NoTrailZeros( RoundMath( 100 * ( min.valueAdditive + sp.valueMultiplicative * min.valueMultiplicative ) ) ) );
  4216.  
  4217.  
  4218. dm.GetAbilityAttributeValue( 'Mutation2', 'crit_damage_factor', min, max );
  4219. critBonusDamage = sp.valueMultiplicative * min.valueMultiplicative;
  4220.  
  4221. arrStr.PushBack( NoTrailZeros( RoundMath( 100 * critBonusDamage ) ) );
  4222. break;
  4223.  
  4224. case EPMT_Mutation3 :
  4225.  
  4226. dm.GetAbilityAttributeValue( 'Mutation3', 'attack_power', min, max );
  4227. tmp = min.valueMultiplicative;
  4228. arrStr.PushBack( NoTrailZeros( RoundMath( 100 * tmp ) ) );
  4229.  
  4230.  
  4231. dm.GetAbilityAttributeValue( 'Mutation3', 'maxcap', min, max );
  4232. arrStr.PushBack( NoTrailZeros( RoundMath( 100 * tmp * min.valueAdditive ) ) );
  4233. break;
  4234.  
  4235. case EPMT_Mutation4 :
  4236. // W3EE - Begin
  4237. /*
  4238. dm.GetAbilityAttributeValue( 'AcidEffect', 'DirectDamage', min, max );
  4239. tmp2 = 100 * min.valueAdditive;
  4240. dm.GetAbilityAttributeValue( 'AcidEffect', 'duration', min, max );
  4241. tmp2 *= min.valueAdditive;
  4242. arrStr.PushBack( NoTrailZeros( tmp2 ) );
  4243. */
  4244.  
  4245. tox = GetStatPercents( BCS_Toxicity );
  4246. if( tox > 0 )
  4247. {
  4248. tmp = RoundMath( GetStat(BCS_Vitality) * tox * 0.5f );
  4249. }
  4250. else
  4251. {
  4252. tmp = 5;
  4253. }
  4254. arrStr.PushBack( NoTrailZeros( tmp ) );
  4255.  
  4256.  
  4257. //tox = GetStatMax( BCS_Toxicity );
  4258. tmp = RoundMath( GetStatMax(BCS_Vitality) * 0.5f );
  4259. arrStr.PushBack( NoTrailZeros( tmp ) );
  4260. // W3EE - End
  4261. break;
  4262.  
  4263. case EPMT_Mutation5 :
  4264.  
  4265. dm.GetAbilityAttributeValue('Mutation5', 'mut5_dmg_red_perc', min, max);
  4266. tmp = min.valueAdditive;
  4267. arrStr.PushBack(NoTrailZeros(100 * tmp));
  4268.  
  4269. dm.GetAbilityAttributeValue('Mutation5Effect', 'duration', min, max);
  4270. tmp = min.valueAdditive;
  4271. arrStr.PushBack(NoTrailZeros(tmp));
  4272.  
  4273. break;
  4274.  
  4275. case EPMT_Mutation6 :
  4276.  
  4277. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation6', 'full_freeze_chance', min, max );
  4278. arrStr.PushBack( NoTrailZeros( 100 * min.valueMultiplicative ) );
  4279.  
  4280. // W3EE - Begin
  4281. // theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation6', 'ForceDamage', min, max );
  4282. sp = GetTotalSignSpellPower( S_Magic_1 );
  4283. val = 350.f * sp.valueMultiplicative; // sp.valueAdditive + sp.valueMultiplicative * ( sp.valueBase + min.valueAdditive );
  4284. arrStr.PushBack( NoTrailZeros( RoundMath( val ) ) );
  4285. // W3EE - End
  4286.  
  4287. break;
  4288.  
  4289. case EPMT_Mutation7 :
  4290.  
  4291. break;
  4292.  
  4293. case EPMT_Mutation8 :
  4294.  
  4295. dm.GetAbilityAttributeValue( 'Mutation8', 'dmg_bonus', min, max );
  4296. arrStr.PushBack( NoTrailZeros( 100 * min.valueMultiplicative ) );
  4297.  
  4298.  
  4299. dm.GetAbilityAttributeValue( 'Mutation8', 'hp_perc_trigger', min, max );
  4300. arrStr.PushBack( NoTrailZeros( 100 * min.valueMultiplicative ) );
  4301.  
  4302. break;
  4303.  
  4304. case EPMT_Mutation9 :
  4305.  
  4306.  
  4307.  
  4308.  
  4309. stats = GetOffenseStatsList( 1 );
  4310. arrStr.PushBack( NoTrailZeros( RoundMath( stats.crossbowSteelDmg ) ) );
  4311.  
  4312.  
  4313. stats2 = GetOffenseStatsList( 2 );
  4314. arrStr.PushBack( NoTrailZeros( RoundMath( stats2.crossbowSteelDmg ) ) );
  4315.  
  4316.  
  4317. dm.GetAbilityAttributeValue( 'Mutation9', 'critical_hit_chance', min, max );
  4318. arrStr.PushBack( NoTrailZeros( 100 * min.valueMultiplicative ) );
  4319.  
  4320. break;
  4321.  
  4322. case EPMT_Mutation10 :
  4323. // W3EE - Begin
  4324. dm.GetAbilityAttributeValue( 'Mutation10Effect', 'mutation10_stat_boost', min, max );
  4325. //arrStr.PushBack( NoTrailZeros( min.valueMultiplicative ) );
  4326.  
  4327.  
  4328. arrStr.PushBack( NoTrailZeros( 100 * min.valueMultiplicative ) );
  4329. // W3EE - End
  4330. break;
  4331.  
  4332. case EPMT_Mutation11 :
  4333.  
  4334. arrStr.PushBack( 100 );
  4335.  
  4336.  
  4337. dm.GetAbilityAttributeValue( 'Mutation11DebuffEffect', 'duration', min, max);
  4338. arrStr.PushBack( NoTrailZeros( min.valueAdditive ) );
  4339. break;
  4340.  
  4341. case EPMT_Mutation12 :
  4342.  
  4343. dm.GetAbilityAttributeValue( 'Mutation12', 'duration', min, max );
  4344. arrStr.PushBack( NoTrailZeros( min.valueAdditive ) );
  4345.  
  4346. dm.GetAbilityAttributeValue( 'Mutation12', 'maxcap', min, max );
  4347. arrStr.PushBack( NoTrailZeros( min.valueAdditive ) );
  4348.  
  4349. dm.GetAbilityAttributeValue( 'Mutation12', 'cooldown', min, max );
  4350. arrStr.PushBack( NoTrailZeros( min.valueAdditive ) );
  4351. break;
  4352.  
  4353. case EPMT_MutationMaster :
  4354.  
  4355. arrStr.PushBack( "15" );
  4356. arrStr.PushBack( "10" );
  4357.  
  4358. break;
  4359. }
  4360.  
  4361. return GetLocStringByKeyExtWithParams( locKey, , , arrStr );
  4362. }
  4363.  
  4364. public final function ApplyMutation10StatBoost( out statValue : SAbilityAttributeValue )
  4365. {
  4366. var attValue : SAbilityAttributeValue;
  4367. var currToxicity : float;
  4368.  
  4369. if( IsMutationActive( EPMT_Mutation10 ) )
  4370. {
  4371. // W3EE - Begin
  4372. currToxicity = GetStat(BCS_Toxicity) / GetStatMax(BCS_Toxicity);
  4373. if( currToxicity > 0.f )
  4374. {
  4375. attValue = GetAttributeValue( 'mutation10_stat_boost' );
  4376. attValue.valueMultiplicative *= PowF(currToxicity, 2);
  4377. statValue.valueMultiplicative += attValue.valueMultiplicative;
  4378. }
  4379. // W3EE - End
  4380. }
  4381. }
  4382.  
  4383.  
  4384.  
  4385.  
  4386.  
  4387.  
  4388.  
  4389. public final function IsBookRead( bookName : name ):bool
  4390. {
  4391. return booksRead.Contains( bookName );
  4392. }
  4393.  
  4394. public final function AddReadBook( bookName : name ):void
  4395. {
  4396. if( !booksRead.Contains( bookName ) )
  4397. {
  4398. booksRead.PushBack( bookName );
  4399. }
  4400. }
  4401.  
  4402. public final function RemoveReadBook( bookName : name ):void
  4403. {
  4404. var idx : int = booksRead.FindFirst( bookName );
  4405.  
  4406. if( idx > -1 )
  4407. {
  4408. booksRead.Erase( idx );
  4409. }
  4410. }
  4411.  
  4412.  
  4413.  
  4414.  
  4415.  
  4416.  
  4417.  
  4418. public function GetAlchemyRecipes() : array<name>
  4419. {
  4420. return alchemyRecipes;
  4421. }
  4422.  
  4423. public function CanLearnAlchemyRecipe(recipeName : name) : bool
  4424. {
  4425. var dm : CDefinitionsManagerAccessor;
  4426. var recipeNode : SCustomNode;
  4427. var i, tmpInt : int;
  4428. var tmpName : name;
  4429.  
  4430. dm = theGame.GetDefinitionsManager();
  4431. if ( dm.GetSubNodeByAttributeValueAsCName( recipeNode, 'alchemy_recipes', 'name_name', recipeName ) )
  4432. {
  4433. return true;
  4434.  
  4435. }
  4436.  
  4437. return false;
  4438. }
  4439.  
  4440. private final function RemoveAlchemyRecipe(recipeName : name)
  4441. {
  4442. alchemyRecipes.Remove(recipeName);
  4443. }
  4444.  
  4445. private final function RemoveAllAlchemyRecipes()
  4446. {
  4447. alchemyRecipes.Clear();
  4448. }
  4449.  
  4450.  
  4451. function AddAlchemyRecipe(nam : name, optional isSilent : bool, optional skipTutorialUpdate : bool) : bool
  4452. {
  4453. var i, potions, bombs : int;
  4454. var found : bool;
  4455. var m_alchemyManager : W3AlchemyManager;
  4456. var recipe : SAlchemyRecipe;
  4457. var knownBombTypes : array<string>;
  4458. var strRecipeName, recipeNameWithoutLevel : string;
  4459.  
  4460. if(!IsAlchemyRecipe(nam))
  4461. return false;
  4462.  
  4463. found = false;
  4464. for(i=0; i<alchemyRecipes.Size(); i+=1)
  4465. {
  4466. if(alchemyRecipes[i] == nam)
  4467. return false;
  4468.  
  4469.  
  4470. if(StrCmp(alchemyRecipes[i],nam) > 0)
  4471. {
  4472. alchemyRecipes.Insert(i,nam);
  4473. found = true;
  4474. AddAlchemyHudNotification(nam,isSilent);
  4475. break;
  4476. }
  4477. }
  4478.  
  4479. if(!found)
  4480. {
  4481. alchemyRecipes.PushBack(nam);
  4482. AddAlchemyHudNotification(nam,isSilent);
  4483. }
  4484.  
  4485. m_alchemyManager = new W3AlchemyManager in this;
  4486. m_alchemyManager.Init(alchemyRecipes);
  4487. m_alchemyManager.GetRecipe(nam, recipe);
  4488.  
  4489.  
  4490. // W3EE - Begin
  4491. /*
  4492. if(CanUseSkill(S_Alchemy_s18))
  4493. {
  4494. if ((recipe.cookedItemType != EACIT_Bolt) && (recipe.cookedItemType != EACIT_Undefined) && (recipe.cookedItemType != EACIT_Dye) && (recipe.level <= GetSkillLevel(S_Alchemy_s18)))
  4495. AddAbility(SkillEnumToName(S_Alchemy_s18), true);
  4496.  
  4497. }
  4498. */
  4499. // W3EE - End
  4500.  
  4501. if(recipe.cookedItemType == EACIT_Bomb)
  4502. {
  4503. bombs = 0;
  4504. for(i=0; i<alchemyRecipes.Size(); i+=1)
  4505. {
  4506. m_alchemyManager.GetRecipe(alchemyRecipes[i], recipe);
  4507.  
  4508.  
  4509. if(recipe.cookedItemType == EACIT_Bomb)
  4510. {
  4511. strRecipeName = NameToString(alchemyRecipes[i]);
  4512. recipeNameWithoutLevel = StrLeft(strRecipeName, StrLen(strRecipeName)-2);
  4513. if(!knownBombTypes.Contains(recipeNameWithoutLevel))
  4514. {
  4515. bombs += 1;
  4516. knownBombTypes.PushBack(recipeNameWithoutLevel);
  4517. }
  4518. }
  4519. }
  4520.  
  4521. theGame.GetGamerProfile().SetStat(ES_KnownBombRecipes, bombs);
  4522. }
  4523.  
  4524. else if(recipe.cookedItemType == EACIT_Potion || recipe.cookedItemType == EACIT_MutagenPotion || recipe.cookedItemType == EACIT_Alcohol || recipe.cookedItemType == EACIT_Quest)
  4525. {
  4526. potions = 0;
  4527. for(i=0; i<alchemyRecipes.Size(); i+=1)
  4528. {
  4529. m_alchemyManager.GetRecipe(alchemyRecipes[i], recipe);
  4530.  
  4531.  
  4532. if(recipe.cookedItemType == EACIT_Potion || recipe.cookedItemType == EACIT_MutagenPotion || recipe.cookedItemType == EACIT_Alcohol || recipe.cookedItemType == EACIT_Quest)
  4533. {
  4534. potions += 1;
  4535. }
  4536. }
  4537. theGame.GetGamerProfile().SetStat(ES_KnownPotionRecipes, potions);
  4538. }
  4539.  
  4540. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_AlchemyRecipe );
  4541.  
  4542. return true;
  4543. }
  4544. public function GetExpandedAlchemyCategories() : array< name >
  4545. {
  4546. return expandedAlchemyCategories;
  4547. }
  4548.  
  4549. public function AddExpandedAlchemyCategory( category : name )
  4550. {
  4551. if ( IsNameValid( category ) )
  4552. {
  4553. ArrayOfNamesPushBackUnique( expandedAlchemyCategories, category );
  4554. }
  4555. }
  4556.  
  4557. public function RemoveExpandedAlchemyCategory( category : name )
  4558. {
  4559. if ( IsNameValid( category ) )
  4560. {
  4561. expandedAlchemyCategories.Remove( category );
  4562. }
  4563. }
  4564.  
  4565. public function SetAlchemyFilters(showHasIngre : bool, showMissingIngre : bool, showAlreadyCrafted : bool )
  4566. {
  4567. alchemyFilters.showCraftable = showHasIngre;
  4568. alchemyFilters.showMissingIngre = showMissingIngre;
  4569. alchemyFilters.showAlreadyCrafted = showAlreadyCrafted;
  4570. }
  4571.  
  4572. public function GetAlchemyFilters() : SCraftingFilters
  4573. {
  4574.  
  4575. if ( alchemyFilters.showCraftable == false && alchemyFilters.showMissingIngre == false && alchemyFilters.showAlreadyCrafted == false )
  4576. {
  4577. alchemyFilters.showCraftable = true;
  4578. alchemyFilters.showMissingIngre = true;
  4579. alchemyFilters.showAlreadyCrafted = false;
  4580. }
  4581.  
  4582. return alchemyFilters;
  4583. }
  4584.  
  4585.  
  4586.  
  4587.  
  4588.  
  4589.  
  4590.  
  4591. public function GetExpandedBestiaryCategories() : array< name >
  4592. {
  4593. return expandedBestiaryCategories;
  4594. }
  4595.  
  4596. public function AddExpandedBestiaryCategory( category : name )
  4597. {
  4598. if ( IsNameValid( category ) )
  4599. {
  4600. ArrayOfNamesPushBackUnique( expandedBestiaryCategories, category );
  4601. }
  4602. }
  4603.  
  4604. public function RemoveExpandedBestiaryCategory( category : name )
  4605. {
  4606. if ( IsNameValid( category ) )
  4607. {
  4608. expandedBestiaryCategories.Remove( category );
  4609. }
  4610. }
  4611.  
  4612.  
  4613.  
  4614.  
  4615.  
  4616.  
  4617.  
  4618. public function GetDisplayHeavyAttackIndicator() : bool
  4619. {
  4620. return bDispalyHeavyAttackIndicator;
  4621. }
  4622.  
  4623. public function SetDisplayHeavyAttackIndicator( val : bool )
  4624. {
  4625. bDispalyHeavyAttackIndicator = val;
  4626. }
  4627.  
  4628. public function GetDisplayHeavyAttackFirstLevelTimer() : bool
  4629. {
  4630. return bDisplayHeavyAttackFirstLevelTimer;
  4631. }
  4632.  
  4633. public function SetDisplayHeavyAttackFirstLevelTimer( val : bool )
  4634. {
  4635. bDisplayHeavyAttackFirstLevelTimer = val;
  4636. }
  4637.  
  4638.  
  4639.  
  4640.  
  4641.  
  4642.  
  4643.  
  4644. public function SelectQuickslotItem( slot : EEquipmentSlots )
  4645. {
  4646. var item : SItemUniqueId;
  4647.  
  4648. GetItemEquippedOnSlot(slot, item);
  4649. selectedItemId = item;
  4650. }
  4651.  
  4652.  
  4653.  
  4654.  
  4655.  
  4656.  
  4657.  
  4658. public function GetMedallion() : W3MedallionController
  4659. {
  4660. if ( !medallionController )
  4661. {
  4662. medallionController = new W3MedallionController in this;
  4663. }
  4664. return medallionController;
  4665. }
  4666.  
  4667.  
  4668. public final function HighlightObjects(range : float, optional highlightTime : float )
  4669. {
  4670. var ents : array<CGameplayEntity>;
  4671. var i : int;
  4672.  
  4673. FindGameplayEntitiesInSphere(ents, GetWorldPosition(), range, 100, 'HighlightedByMedalionFX', FLAG_ExcludePlayer);
  4674.  
  4675. if(highlightTime == 0)
  4676. highlightTime = 30;
  4677.  
  4678. for(i=0; i<ents.Size(); i+=1)
  4679. {
  4680. if(!ents[i].IsHighlighted())
  4681. {
  4682. ents[i].SetHighlighted( true );
  4683. ents[i].PlayEffectSingle( 'medalion_detection_fx' );
  4684. ents[i].AddTimer( 'MedallionEffectOff', highlightTime );
  4685. }
  4686. }
  4687. }
  4688.  
  4689.  
  4690. public final function HighlightEnemies(range : float, optional highlightTime : float )
  4691. {
  4692. var ents : array<CGameplayEntity>;
  4693. var i : int;
  4694. var catComponent : CGameplayEffectsComponent;
  4695.  
  4696. FindGameplayEntitiesInSphere(ents, GetWorldPosition(), range, 100, , FLAG_ExcludePlayer + FLAG_OnlyAliveActors);
  4697.  
  4698. if(highlightTime == 0)
  4699. highlightTime = 5;
  4700.  
  4701. for(i=0; i<ents.Size(); i+=1)
  4702. {
  4703. if(IsRequiredAttitudeBetween(this, ents[i], true))
  4704. {
  4705. catComponent = GetGameplayEffectsComponent(ents[i]);
  4706. if(catComponent)
  4707. {
  4708. catComponent.SetGameplayEffectFlag(EGEF_CatViewHiglight, true);
  4709. ents[i].AddTimer( 'EnemyHighlightOff', highlightTime, , , , , true );
  4710. }
  4711. }
  4712. }
  4713. }
  4714.  
  4715. function SpawnMedallionEntity()
  4716. {
  4717. var rot : EulerAngles;
  4718. var spawnedMedallion : CEntity;
  4719.  
  4720. spawnedMedallion = theGame.GetEntityByTag( 'new_Witcher_medallion_FX' );
  4721.  
  4722. if ( !spawnedMedallion )
  4723. theGame.CreateEntity( medallionEntity, GetWorldPosition(), rot, true, false );
  4724. }
  4725.  
  4726.  
  4727.  
  4728.  
  4729.  
  4730.  
  4731.  
  4732.  
  4733.  
  4734. public final function InterruptCombatFocusMode()
  4735. {
  4736. if( this.GetCurrentStateName() == 'CombatFocusMode_SelectSpot' )
  4737. {
  4738. SetCanPlayHitAnim( true );
  4739. PopState();
  4740. }
  4741. }
  4742.  
  4743. public final function IsInDarkPlace() : bool
  4744. {
  4745. var envs : array< string >;
  4746.  
  4747. if( FactsQuerySum( "tut_in_dark_place" ) )
  4748. {
  4749. return true;
  4750. }
  4751.  
  4752. GetActiveAreaEnvironmentDefinitions( envs );
  4753.  
  4754. if( envs.Contains( 'env_novigrad_cave' ) || envs.Contains( 'cave_catacombs' ) )
  4755. {
  4756. return true;
  4757. }
  4758.  
  4759. return false;
  4760. }
  4761.  
  4762.  
  4763.  
  4764.  
  4765.  
  4766. private saved var selectedPotionSlotUpper, selectedPotionSlotLower : EEquipmentSlots;
  4767. private var potionDoubleTapTimerRunning, potionDoubleTapSlotIsUpper : bool;
  4768. default selectedPotionSlotUpper = EES_Potion1;
  4769. default selectedPotionSlotLower = EES_Potion2;
  4770. default potionDoubleTapTimerRunning = false;
  4771.  
  4772. public final function SetPotionDoubleTapRunning(b : bool, optional isUpperSlot : bool)
  4773. {
  4774. if(b)
  4775. {
  4776. AddTimer('PotionDoubleTap', 0.3);
  4777. }
  4778. else
  4779. {
  4780. RemoveTimer('PotionDoubleTap');
  4781. }
  4782.  
  4783. potionDoubleTapTimerRunning = b;
  4784. potionDoubleTapSlotIsUpper = isUpperSlot;
  4785. }
  4786.  
  4787. public final function IsPotionDoubleTapRunning() : bool
  4788. {
  4789. return potionDoubleTapTimerRunning;
  4790. }
  4791.  
  4792. timer function PotionDoubleTap(dt : float, id : int)
  4793. {
  4794. potionDoubleTapTimerRunning = false;
  4795. OnPotionDrinkInput(potionDoubleTapSlotIsUpper);
  4796. }
  4797.  
  4798. public final function OnPotionDrinkInput(fromUpperSlot : bool)
  4799. {
  4800. var slot : EEquipmentSlots;
  4801.  
  4802. if(fromUpperSlot)
  4803. slot = GetSelectedPotionSlotUpper();
  4804. else
  4805. slot = GetSelectedPotionSlotLower();
  4806.  
  4807. DrinkPotionFromSlot(slot);
  4808. }
  4809.  
  4810. public final function OnPotionDrinkKeyboardsInput(slot : EEquipmentSlots)
  4811. {
  4812. DrinkPotionFromSlot(slot);
  4813. }
  4814.  
  4815. private function DrinkPotionFromSlot(slot : EEquipmentSlots):void
  4816. {
  4817. var item : SItemUniqueId;
  4818. var hud : CR4ScriptedHud;
  4819. var module : CR4HudModuleItemInfo;
  4820.  
  4821. GetItemEquippedOnSlot(slot, item);
  4822. // W3EE - Begin
  4823. if(inv.ItemHasTag(item, 'Edibles'))
  4824. {
  4825. if( inv.ItemHasTag(item, 'Drinks') )
  4826. {
  4827. if( !Options().GetUseDrinkAnimation() )
  4828. ConsumeItem( item );
  4829. else
  4830. GetAnimManager().PerformAnimation(slot, item);
  4831. }
  4832. else
  4833. {
  4834. if( !Options().GetUseEatAnimation() )
  4835. ConsumeItem( item );
  4836. else
  4837. GetAnimManager().PerformAnimation(slot, item);
  4838. }
  4839. }
  4840. else
  4841. {
  4842. if (ToxicityLowEnoughToDrinkPotion(slot))
  4843. {
  4844. if( !Options().GetUseDrinkAnimation() )
  4845. DrinkPreparedPotion(slot);
  4846. else
  4847. GetAnimManager().PerformAnimation(slot, item);
  4848. }
  4849. else
  4850. {
  4851. SendToxicityTooHighMessage();
  4852. }
  4853. }
  4854.  
  4855. /*
  4856. if(inv.ItemHasTag(item, 'Edibles'))
  4857. {
  4858. ConsumeItem( item );
  4859. }
  4860. else
  4861. {
  4862. if (ToxicityLowEnoughToDrinkPotion(slot))
  4863. {
  4864. DrinkPreparedPotion(slot);
  4865. }
  4866. else
  4867. {
  4868. SendToxicityTooHighMessage();
  4869. }
  4870. }
  4871. */
  4872. // W3EE - End
  4873.  
  4874. hud = (CR4ScriptedHud)theGame.GetHud();
  4875. if ( hud )
  4876. {
  4877. module = (CR4HudModuleItemInfo)hud.GetHudModule("ItemInfoModule");
  4878. if( module )
  4879. {
  4880. module.ForceShowElement();
  4881. }
  4882. }
  4883. }
  4884.  
  4885. private function SendToxicityTooHighMessage()
  4886. {
  4887. var messageText : string;
  4888. var language : string;
  4889. var audioLanguage : string;
  4890.  
  4891. if (GetHudMessagesSize() < 2)
  4892. {
  4893. messageText = GetLocStringByKeyExt("menu_cannot_perform_action_now") + " " + GetLocStringByKeyExt("panel_common_statistics_tooltip_current_toxicity");
  4894.  
  4895. theGame.GetGameLanguageName(audioLanguage,language);
  4896. if (language == "AR")
  4897. {
  4898. messageText += (int)(abilityManager.GetStat(BCS_Toxicity, false)) + " / " + (int)(abilityManager.GetStatMax(BCS_Toxicity)) + " :";
  4899. }
  4900. else
  4901. {
  4902. messageText += ": " + (int)(abilityManager.GetStat(BCS_Toxicity, false)) + " / " + (int)(abilityManager.GetStatMax(BCS_Toxicity));
  4903. }
  4904.  
  4905. DisplayHudMessage(messageText);
  4906. }
  4907. theSound.SoundEvent("gui_global_denied");
  4908. }
  4909.  
  4910. public final function GetSelectedPotionSlotUpper() : EEquipmentSlots
  4911. {
  4912. return selectedPotionSlotUpper;
  4913. }
  4914.  
  4915. public final function GetSelectedPotionSlotLower() : EEquipmentSlots
  4916. {
  4917. return selectedPotionSlotLower;
  4918. }
  4919.  
  4920.  
  4921. public final function FlipSelectedPotion(isUpperSlot : bool) : bool
  4922. {
  4923. if(isUpperSlot)
  4924. {
  4925. if(selectedPotionSlotUpper == EES_Potion1 && IsAnyItemEquippedOnSlot(EES_Potion3))
  4926. {
  4927. selectedPotionSlotUpper = EES_Potion3;
  4928. return true;
  4929. }
  4930. else if(selectedPotionSlotUpper == EES_Potion3 && IsAnyItemEquippedOnSlot(EES_Potion1))
  4931. {
  4932. selectedPotionSlotUpper = EES_Potion1;
  4933. return true;
  4934. }
  4935. }
  4936. else
  4937. {
  4938. if(selectedPotionSlotLower == EES_Potion2 && IsAnyItemEquippedOnSlot(EES_Potion4))
  4939. {
  4940. selectedPotionSlotLower = EES_Potion4;
  4941. return true;
  4942. }
  4943. else if(selectedPotionSlotLower == EES_Potion4 && IsAnyItemEquippedOnSlot(EES_Potion2))
  4944. {
  4945. selectedPotionSlotLower = EES_Potion2;
  4946. return true;
  4947. }
  4948. }
  4949.  
  4950. return false;
  4951. }
  4952.  
  4953. public final function AddBombThrowDelay( bombId : SItemUniqueId )
  4954. {
  4955. var slot : EEquipmentSlots;
  4956.  
  4957. slot = GetItemSlot( bombId );
  4958.  
  4959. if( slot == EES_Unused )
  4960. {
  4961. return;
  4962. }
  4963.  
  4964. if( slot == EES_Petard1 || slot == EES_Quickslot1 )
  4965. {
  4966. remainingBombThrowDelaySlot1 = theGame.params.BOMB_THROW_DELAY;
  4967. AddTimer( 'BombDelay', 0.0f, true );
  4968. }
  4969. else if( slot == EES_Petard2 || slot == EES_Quickslot2 )
  4970. {
  4971. remainingBombThrowDelaySlot2 = theGame.params.BOMB_THROW_DELAY;
  4972. AddTimer( 'BombDelay', 0.0f, true );
  4973. }
  4974. else
  4975. {
  4976. return;
  4977. }
  4978. }
  4979.  
  4980. public final function GetBombDelay( slot : EEquipmentSlots ) : float
  4981. {
  4982. if( slot == EES_Petard1 || slot == EES_Quickslot1 )
  4983. {
  4984. return remainingBombThrowDelaySlot1;
  4985. }
  4986. else if( slot == EES_Petard2 || slot == EES_Quickslot2 )
  4987. {
  4988. return remainingBombThrowDelaySlot2;
  4989. }
  4990.  
  4991. return 0;
  4992. }
  4993.  
  4994. timer function BombDelay( dt : float, id : int )
  4995. {
  4996. remainingBombThrowDelaySlot1 = MaxF( 0.f , remainingBombThrowDelaySlot1 - dt );
  4997. remainingBombThrowDelaySlot2 = MaxF( 0.f , remainingBombThrowDelaySlot2 - dt );
  4998.  
  4999. if( remainingBombThrowDelaySlot1 <= 0.0f && remainingBombThrowDelaySlot2 <= 0.0f )
  5000. {
  5001. RemoveTimer('BombDelay');
  5002. }
  5003. }
  5004.  
  5005. public function ResetCharacterDev()
  5006. {
  5007.  
  5008. UnequipItemFromSlot(EES_SkillMutagen1);
  5009. UnequipItemFromSlot(EES_SkillMutagen2);
  5010. UnequipItemFromSlot(EES_SkillMutagen3);
  5011. UnequipItemFromSlot(EES_SkillMutagen4);
  5012.  
  5013. levelManager.ResetCharacterDev();
  5014. ((W3PlayerAbilityManager)abilityManager).ResetCharacterDev();
  5015. }
  5016.  
  5017. public final function ResetMutationsDev()
  5018. {
  5019. levelManager.ResetMutationsDev();
  5020. ((W3PlayerAbilityManager)abilityManager).ResetMutationsDev();
  5021. }
  5022.  
  5023. public final function GetHeldSword() : SItemUniqueId
  5024. {
  5025. var i : int;
  5026. var weapons : array< SItemUniqueId >;
  5027.  
  5028. weapons = inv.GetHeldWeapons();
  5029. for( i=0; i<weapons.Size(); i+=1 )
  5030. {
  5031. if( inv.IsItemSilverSwordUsableByPlayer( weapons[i] ) || inv.IsItemSteelSwordUsableByPlayer( weapons[i] ) )
  5032. {
  5033. return weapons[i];
  5034. }
  5035. }
  5036.  
  5037. return GetInvalidUniqueId();
  5038. }
  5039.  
  5040. public function ConsumeItem( itemId : SItemUniqueId ) : bool
  5041. {
  5042. var itemName : name;
  5043. var removedItem, willRemoveItem : bool;
  5044. var edibles : array<SItemUniqueId>;
  5045. var toSlot : EEquipmentSlots;
  5046. var i : int;
  5047. var equippedNewEdible : bool;
  5048.  
  5049. itemName = inv.GetItemName( itemId );
  5050.  
  5051. // W3EE - Begin
  5052. if (itemName == 'q111_imlerith_acorn' )
  5053. {
  5054. // AddPoints(ESkillPoint, 2, true);
  5055. Experience().ModTotalPathPoints(ESSP_Sword_Utility, 2);
  5056. removedItem = inv.RemoveItem( itemId, 1 );
  5057. // theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt("panel_character_popup_title_buy_skill") + "<br>" + GetLocStringByKeyExt("panel_character_availablepoints") + " +2");
  5058. theSound.SoundEvent("gui_character_buy_skill");
  5059. }
  5060. else if ( itemName == 'Clearing Potion' )
  5061. {
  5062. ResetMutationsDev();
  5063. ResetCharacterDev();
  5064. Debug_ClearCharacterDevelopment(true);
  5065. removedItem = inv.RemoveItem( itemId, 1 );
  5066. if( !HasBuff(EET_Poise) )
  5067. AddEffectDefault(EET_Poise, this, "Poise");
  5068. theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt("panel_character_popup_character_cleared") );
  5069. theSound.SoundEvent("gui_character_synergy_effect");
  5070. }
  5071. else if ( itemName == 'Restoring Potion' )
  5072. {
  5073. /*ResetMutationsDev();*/
  5074. removedItem = inv.RemoveItem( itemId, 1 );
  5075. /*theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt("panel_character_popup_character_cleared") );*/
  5076. theSound.SoundEvent("gui_character_synergy_effect");
  5077. }
  5078. // W3EE - End
  5079. else if(itemName == 'Wolf Hour')
  5080. {
  5081. removedItem = inv.RemoveItem( itemId, 1 );
  5082. theSound.SoundEvent("gui_character_synergy_effect");
  5083. //AddEffectDefault(EET_WolfHour, thePlayer, 'wolf hour');
  5084. }
  5085. else if ( itemName == 'q704_ft_golden_egg' )
  5086. {
  5087. Experience().ModTotalPathPoints(ESSP_Perks, 2);
  5088. removedItem = inv.RemoveItem( itemId, 1 );
  5089. //theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt("panel_character_popup_title_buy_skill") + "<br>" + GetLocStringByKeyExt("panel_character_availablepoints") + " +1");
  5090. theSound.SoundEvent("gui_character_buy_skill");
  5091. }
  5092. else if ( itemName == 'mq7023_cake' )
  5093. {
  5094. this.AddAbility('mq7023_cake_vitality_bonus');
  5095. removedItem = inv.RemoveItem( itemId, 1 );
  5096. theSound.SoundEvent("gui_character_synergy_effect");
  5097. }
  5098. else
  5099. {
  5100. willRemoveItem = inv.GetItemQuantity(itemId) == 1 && !inv.ItemHasTag(itemId, 'InfiniteUse');
  5101.  
  5102. if(willRemoveItem)
  5103. toSlot = GetItemSlot(itemId);
  5104.  
  5105. removedItem = super.ConsumeItem(itemId);
  5106.  
  5107. if(willRemoveItem && removedItem)
  5108. {
  5109. edibles = inv.GetItemsByTag('Edibles');
  5110. equippedNewEdible = false;
  5111.  
  5112.  
  5113. for(i=0; i<edibles.Size(); i+=1)
  5114. {
  5115. if(!IsItemEquipped(edibles[i]) && !inv.ItemHasTag(edibles[i], 'Alcohol') && inv.GetItemName(edibles[i]) != 'Clearing Potion' && inv.GetItemName(edibles[i]) != 'Wolf Hour')
  5116. {
  5117. EquipItemInGivenSlot(edibles[i], toSlot, true, false);
  5118. equippedNewEdible = true;
  5119. break;
  5120. }
  5121. }
  5122.  
  5123.  
  5124. if(!equippedNewEdible)
  5125. {
  5126. for(i=0; i<edibles.Size(); i+=1)
  5127. {
  5128. if(!IsItemEquipped(edibles[i]) && inv.GetItemName(edibles[i]) != 'Clearing Potion' && inv.GetItemName(edibles[i]) != 'Wolf Hour')
  5129. {
  5130. EquipItemInGivenSlot(edibles[i], toSlot, true, false);
  5131. break;
  5132. }
  5133. }
  5134. }
  5135. }
  5136. }
  5137.  
  5138. return removedItem;
  5139. }
  5140.  
  5141.  
  5142. public final function GetAlcoholForAlchemicalItemsRefill() : SItemUniqueId
  5143. {
  5144. var alcos : array<SItemUniqueId>;
  5145. var id : SItemUniqueId;
  5146. var i, price, minPrice : int;
  5147.  
  5148. alcos = inv.GetItemsByTag(theGame.params.TAG_ALCHEMY_REFILL_ALCO);
  5149.  
  5150. if(alcos.Size() > 0)
  5151. {
  5152. if(inv.ItemHasTag(alcos[0], theGame.params.TAG_INFINITE_USE))
  5153. return alcos[0];
  5154.  
  5155. minPrice = inv.GetItemPrice(alcos[0]);
  5156. price = minPrice;
  5157. id = alcos[0];
  5158.  
  5159. for(i=1; i<alcos.Size(); i+=1)
  5160. {
  5161. if(inv.ItemHasTag(alcos[i], theGame.params.TAG_INFINITE_USE))
  5162. return alcos[i];
  5163.  
  5164. price = inv.GetItemPrice(alcos[i]);
  5165.  
  5166. if(price < minPrice)
  5167. {
  5168. minPrice = price;
  5169. id = alcos[i];
  5170. }
  5171. }
  5172.  
  5173. return id;
  5174. }
  5175.  
  5176. return GetInvalidUniqueId();
  5177. }
  5178.  
  5179. public final function ClearPreviouslyUsedBolt()
  5180. {
  5181. previouslyUsedBolt = GetInvalidUniqueId();
  5182. }
  5183.  
  5184. public function ShouldUseInfiniteWaterBolts() : bool
  5185. {
  5186. // W3EE - Begin
  5187. return false; //GetCurrentStateName() == 'Swimming' || IsSwimming() || IsDiving();
  5188. // W3EE - End
  5189. }
  5190.  
  5191. public function GetCurrentInfiniteBoltName( optional forceBodkin : bool, optional forceHarpoon : bool ) : name
  5192. {
  5193. if(!forceBodkin && (forceHarpoon || ShouldUseInfiniteWaterBolts()) )
  5194. {
  5195. return 'Harpoon Bolt';
  5196. }
  5197. return 'Bodkin Bolt';
  5198. }
  5199.  
  5200.  
  5201. public final function AddAndEquipInfiniteBolt(optional forceBodkin : bool, optional forceHarpoon : bool)
  5202. {
  5203. // W3EE - Begin
  5204. /*
  5205. var bolt, bodkins, harpoons : array<SItemUniqueId>;
  5206. var boltItemName : name;
  5207. var i : int;
  5208.  
  5209.  
  5210. bodkins = inv.GetItemsByName('Bodkin Bolt');
  5211. harpoons = inv.GetItemsByName('Harpoon Bolt');
  5212.  
  5213. for(i=bodkins.Size()-1; i>=0; i-=1)
  5214. inv.RemoveItem(bodkins[i], inv.GetItemQuantity(bodkins[i]) );
  5215.  
  5216. for(i=harpoons.Size()-1; i>=0; i-=1)
  5217. inv.RemoveItem(harpoons[i], inv.GetItemQuantity(harpoons[i]) );
  5218.  
  5219.  
  5220.  
  5221. boltItemName = GetCurrentInfiniteBoltName( forceBodkin, forceHarpoon );
  5222.  
  5223.  
  5224. if(boltItemName == 'Bodkin Bolt' && inv.IsIdValid(previouslyUsedBolt))
  5225. {
  5226. bolt.PushBack(previouslyUsedBolt);
  5227. }
  5228. else
  5229. {
  5230.  
  5231. bolt = inv.AddAnItem(boltItemName, 1, true, true);
  5232.  
  5233.  
  5234. if(boltItemName == 'Harpoon Bolt')
  5235. {
  5236. GetItemEquippedOnSlot(EES_Bolt, previouslyUsedBolt);
  5237. }
  5238. }
  5239.  
  5240. EquipItem(bolt[0], EES_Bolt);
  5241. */
  5242. // W3EE - End
  5243. }
  5244.  
  5245.  
  5246. event OnItemGiven(data : SItemChangedData)
  5247. {
  5248. var m_guiManager : CR4GuiManager;
  5249.  
  5250. super.OnItemGiven(data);
  5251.  
  5252.  
  5253. if(!inv)
  5254. inv = GetInventory();
  5255.  
  5256. ModNoDuplicatesAddDuplicateItemFact(inv,data);//modNoDuplicates
  5257.  
  5258.  
  5259. if(inv.IsItemEncumbranceItem(data.ids[0]))
  5260. UpdateEncumbrance();
  5261.  
  5262. m_guiManager = theGame.GetGuiManager();
  5263. if(m_guiManager)
  5264. m_guiManager.RegisterNewItem(data.ids[0]);
  5265.  
  5266. // -= WMK:modQuickSlots =-
  5267. if (WmkGetQuickInventoryInstance()) {
  5268. WmkGetQuickInventoryInstance().RegisterNewItem(data.ids[0]);
  5269. }
  5270. // -= WMK:modQuickSlots =-
  5271. }
  5272.  
  5273.  
  5274. public final function CheckForFullyArmedAchievement()
  5275. {
  5276. if( HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_BEAR) || HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_GRYPHON) ||
  5277. HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_LYNX) || HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_WOLF) ||
  5278. HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_VIPER)
  5279. )
  5280. {
  5281. theGame.GetGamerProfile().AddAchievement(EA_FullyArmed);
  5282. }
  5283. }
  5284.  
  5285.  
  5286. public final function HasAllItemsFromSet(setItemTag : name) : bool
  5287. {
  5288. var item : SItemUniqueId;
  5289.  
  5290. if(!GetItemEquippedOnSlot(EES_SteelSword, item) || !inv.ItemHasTag(item, setItemTag))
  5291. return false;
  5292.  
  5293. if(!GetItemEquippedOnSlot(EES_SilverSword, item) || !inv.ItemHasTag(item, setItemTag))
  5294. return false;
  5295.  
  5296. if(!GetItemEquippedOnSlot(EES_Boots, item) || !inv.ItemHasTag(item, setItemTag))
  5297. return false;
  5298.  
  5299. if(!GetItemEquippedOnSlot(EES_Pants, item) || !inv.ItemHasTag(item, setItemTag))
  5300. return false;
  5301.  
  5302. if(!GetItemEquippedOnSlot(EES_Gloves, item) || !inv.ItemHasTag(item, setItemTag))
  5303. return false;
  5304.  
  5305. if(!GetItemEquippedOnSlot(EES_Armor, item) || !inv.ItemHasTag(item, setItemTag))
  5306. return false;
  5307.  
  5308.  
  5309. if(setItemTag == theGame.params.ITEM_SET_TAG_BEAR || setItemTag == theGame.params.ITEM_SET_TAG_LYNX)
  5310. {
  5311. if(!GetItemEquippedOnSlot(EES_RangedWeapon, item) || !inv.ItemHasTag(item, setItemTag))
  5312. return false;
  5313. }
  5314.  
  5315. return true;
  5316. }
  5317.  
  5318.  
  5319.  
  5320.  
  5321. public function GetTotalArmor() : SAbilityAttributeValue
  5322. {
  5323. // W3EE - Begin
  5324. var armor, tempArmor : SAbilityAttributeValue;
  5325. var armorItem : SItemUniqueId;
  5326. var tempArmorGlyph : SAbilityAttributeValue;
  5327.  
  5328. armor = super.GetTotalArmor();
  5329.  
  5330. if(GetItemEquippedOnSlot(EES_Armor, armorItem))
  5331. {
  5332.  
  5333. armor -= inv.GetItemAttributeValue(armorItem, theGame.params.ARMOR_VALUE_NAME);
  5334.  
  5335. tempArmor = inv.GetItemArmorTotal(armorItem);
  5336. tempArmor.valueBase *= MaxF(0, 1.f + ((tempArmor.valueBase - 131) / 660));
  5337. armor += tempArmor;
  5338. }
  5339.  
  5340. if(GetItemEquippedOnSlot(EES_Pants, armorItem))
  5341. {
  5342.  
  5343. armor -= inv.GetItemAttributeValue(armorItem, theGame.params.ARMOR_VALUE_NAME);
  5344.  
  5345.  
  5346. tempArmor = inv.GetItemArmorTotal(armorItem);
  5347. tempArmor.valueBase *= MaxF(0, 1.f + ((tempArmor.valueBase - 40) / 171));
  5348. armor += tempArmor;
  5349. }
  5350.  
  5351. if(GetItemEquippedOnSlot(EES_Boots, armorItem))
  5352. {
  5353.  
  5354. armor -= inv.GetItemAttributeValue(armorItem, theGame.params.ARMOR_VALUE_NAME);
  5355.  
  5356.  
  5357. tempArmor = inv.GetItemArmorTotal(armorItem);
  5358. tempArmor.valueBase *= MaxF(0, 1.f + ((tempArmor.valueBase - 40) / 171));
  5359. armor += tempArmor;
  5360. }
  5361.  
  5362. if(GetItemEquippedOnSlot(EES_Gloves, armorItem))
  5363. {
  5364.  
  5365. armor -= inv.GetItemAttributeValue(armorItem, theGame.params.ARMOR_VALUE_NAME);
  5366.  
  5367.  
  5368. tempArmor = inv.GetItemArmorTotal(armorItem);
  5369. tempArmor.valueBase *= MaxF(0, 1.f + ((tempArmor.valueBase - 38) / 166));
  5370. armor += tempArmor;
  5371. }
  5372.  
  5373. if( HasAbility('Glyphword 11 _Stats', true) )
  5374. {
  5375. if (GetItemEquippedOnSlot(EES_Armor, armorItem))
  5376. {
  5377. if (inv.GetArmorType(armorItem) == EAT_Light) { tempArmorGlyph.valueBase += 150; armor += tempArmorGlyph; }
  5378. else if (inv.GetArmorType(armorItem) == EAT_Medium) { tempArmorGlyph.valueBase += 300; armor += tempArmorGlyph; }
  5379. }
  5380. if (GetItemEquippedOnSlot(EES_Pants, armorItem))
  5381. {
  5382. tempArmorGlyph.valueBase = 0;
  5383. if (inv.GetArmorType(armorItem) == EAT_Light) { tempArmorGlyph.valueBase += 75; armor += tempArmorGlyph; }
  5384. else if (inv.GetArmorType(armorItem) == EAT_Medium) { tempArmorGlyph.valueBase += 150; armor += tempArmorGlyph; }
  5385. }
  5386. if (GetItemEquippedOnSlot(EES_Gloves, armorItem))
  5387. {
  5388. tempArmorGlyph.valueBase = 0;
  5389. if (inv.GetArmorType(armorItem) == EAT_Light) { tempArmorGlyph.valueBase += 75; armor += tempArmorGlyph; }
  5390. else if (inv.GetArmorType(armorItem) == EAT_Medium) { tempArmorGlyph.valueBase += 150; armor += tempArmorGlyph; }
  5391. }
  5392. if (GetItemEquippedOnSlot(EES_Boots, armorItem))
  5393. {
  5394. tempArmorGlyph.valueBase = 0;
  5395. if (inv.GetArmorType(armorItem) == EAT_Light) { tempArmorGlyph.valueBase += 75; armor += tempArmorGlyph; }
  5396. else if (inv.GetArmorType(armorItem) == EAT_Medium) { tempArmorGlyph.valueBase += 150; armor += tempArmorGlyph; }
  5397. }
  5398. }
  5399.  
  5400. return armor;
  5401. // W3EE - End
  5402. }
  5403.  
  5404.  
  5405.  
  5406. public function ReduceArmorDurability() : EEquipmentSlots
  5407. {
  5408. var r, sum : int;
  5409. var slot : EEquipmentSlots;
  5410. var id : SItemUniqueId;
  5411. var prevDurMult, currDurMult, ratio : float;
  5412.  
  5413.  
  5414. sum = theGame.params.DURABILITY_ARMOR_CHEST_WEIGHT;
  5415. sum += theGame.params.DURABILITY_ARMOR_PANTS_WEIGHT;
  5416. sum += theGame.params.DURABILITY_ARMOR_GLOVES_WEIGHT;
  5417. sum += theGame.params.DURABILITY_ARMOR_BOOTS_WEIGHT;
  5418. sum += theGame.params.DURABILITY_ARMOR_MISS_WEIGHT;
  5419.  
  5420. r = RandRange(sum);
  5421.  
  5422. if(r < theGame.params.DURABILITY_ARMOR_CHEST_WEIGHT)
  5423. slot = EES_Armor;
  5424. else if (r < theGame.params.DURABILITY_ARMOR_CHEST_WEIGHT + theGame.params.DURABILITY_ARMOR_PANTS_WEIGHT)
  5425. slot = EES_Pants;
  5426. else if (r < theGame.params.DURABILITY_ARMOR_CHEST_WEIGHT + theGame.params.DURABILITY_ARMOR_PANTS_WEIGHT + theGame.params.DURABILITY_ARMOR_GLOVES_WEIGHT)
  5427. slot = EES_Gloves;
  5428. 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)
  5429. slot = EES_Boots;
  5430. else
  5431. return EES_InvalidSlot;
  5432.  
  5433. GetItemEquippedOnSlot(slot, id);
  5434. ratio = inv.GetItemDurabilityRatio(id);
  5435. if(inv.ReduceItemDurability(id))
  5436. {
  5437. prevDurMult = theGame.params.GetDurabilityMultiplier(ratio, false);
  5438.  
  5439. ratio = inv.GetItemDurabilityRatio(id);
  5440. currDurMult = theGame.params.GetDurabilityMultiplier(ratio, false);
  5441.  
  5442. if(currDurMult != prevDurMult)
  5443. {
  5444.  
  5445.  
  5446.  
  5447.  
  5448. }
  5449.  
  5450. return slot;
  5451. }
  5452.  
  5453. return EES_InvalidSlot;
  5454. }
  5455.  
  5456.  
  5457. public function DismantleItem(dismantledItem : SItemUniqueId, toolItem : SItemUniqueId) : bool
  5458. {
  5459. var parts : array<SItemParts>;
  5460. var i : int;
  5461.  
  5462. if(!inv.IsItemDismantleKit(toolItem))
  5463. return false;
  5464.  
  5465. parts = inv.GetItemRecyclingParts(dismantledItem);
  5466.  
  5467. if(parts.Size() <= 0)
  5468. return false;
  5469.  
  5470. for(i=0; i<parts.Size(); i+=1)
  5471. inv.AddAnItem(parts[i].itemName, parts[i].quantity, true, false);
  5472.  
  5473. inv.RemoveItem(toolItem);
  5474. inv.RemoveItem(dismantledItem);
  5475. return true;
  5476. }
  5477.  
  5478.  
  5479. public function GetItemEquippedOnSlot(slot : EEquipmentSlots, out item : SItemUniqueId) : bool
  5480. {
  5481. if(slot == EES_InvalidSlot || slot < 0 || slot > EnumGetMax('EEquipmentSlots'))
  5482. return false;
  5483.  
  5484. item = itemSlots[slot];
  5485.  
  5486. return inv.IsIdValid(item);
  5487. }
  5488.  
  5489.  
  5490. public function GetItemSlotByItemName(itemName : name) : EEquipmentSlots
  5491. {
  5492. var ids : array<SItemUniqueId>;
  5493. var i : int;
  5494. var slot : EEquipmentSlots;
  5495.  
  5496. ids = inv.GetItemsByName(itemName);
  5497. for(i=0; i<ids.Size(); i+=1)
  5498. {
  5499. slot = GetItemSlot(ids[i]);
  5500. if(slot != EES_InvalidSlot)
  5501. return slot;
  5502. }
  5503.  
  5504. return EES_InvalidSlot;
  5505. }
  5506.  
  5507.  
  5508. public function GetItemSlot(item : SItemUniqueId) : EEquipmentSlots
  5509. {
  5510. var i : int;
  5511.  
  5512. if(!inv.IsIdValid(item))
  5513. return EES_InvalidSlot;
  5514.  
  5515. for(i=0; i<itemSlots.Size(); i+=1)
  5516. if(itemSlots[i] == item)
  5517. return i;
  5518.  
  5519. return EES_InvalidSlot;
  5520. }
  5521.  
  5522. public function GetEquippedItems() : array<SItemUniqueId>
  5523. {
  5524. return itemSlots;
  5525. }
  5526.  
  5527. public function IsItemEquipped(item : SItemUniqueId) : bool
  5528. {
  5529. if(!inv.IsIdValid(item))
  5530. return false;
  5531.  
  5532. return itemSlots.Contains(item);
  5533. }
  5534.  
  5535. public function IsItemHeld(item : SItemUniqueId) : bool
  5536. {
  5537. if(!inv.IsIdValid(item))
  5538. return false;
  5539.  
  5540. return inv.IsItemHeld(item);
  5541. }
  5542.  
  5543.  
  5544. public function IsAnyItemEquippedOnSlot(slot : EEquipmentSlots) : bool
  5545. {
  5546. if(slot == EES_InvalidSlot || slot < 0 || slot > EnumGetMax('EEquipmentSlots'))
  5547. return false;
  5548.  
  5549. return inv.IsIdValid(itemSlots[slot]);
  5550. }
  5551.  
  5552.  
  5553. public function GetFreeQuickslot() : EEquipmentSlots
  5554. {
  5555. if(!inv.IsIdValid(itemSlots[EES_Quickslot1])) return EES_Quickslot1;
  5556. if(!inv.IsIdValid(itemSlots[EES_Quickslot2])) return EES_Quickslot2;
  5557.  
  5558.  
  5559. return EES_InvalidSlot;
  5560. }
  5561.  
  5562.  
  5563. event OnEquipItemRequested(item : SItemUniqueId, ignoreMount : bool)
  5564. {
  5565. var slot : EEquipmentSlots;
  5566.  
  5567. if(inv.IsIdValid(item))
  5568. {
  5569. slot = inv.GetSlotForItemId(item);
  5570.  
  5571. if (slot != EES_InvalidSlot)
  5572. {
  5573.  
  5574.  
  5575. EquipItemInGivenSlot(item, slot, ignoreMount);
  5576. }
  5577. }
  5578. }
  5579.  
  5580. event OnUnequipItemRequested(item : SItemUniqueId)
  5581. {
  5582. UnequipItem(item);
  5583. }
  5584.  
  5585.  
  5586. public function EquipItem(item : SItemUniqueId, optional slot : EEquipmentSlots, optional toHand : bool) : bool
  5587. {
  5588. if(!inv.IsIdValid(item))
  5589. return false;
  5590.  
  5591. if(slot == EES_InvalidSlot)
  5592. {
  5593. slot = inv.GetSlotForItemId(item);
  5594.  
  5595. if(slot == EES_InvalidSlot)
  5596. return false;
  5597. }
  5598.  
  5599. ForceSoundAppearanceUpdate();
  5600.  
  5601. return EquipItemInGivenSlot(item, slot, false, toHand);
  5602. }
  5603.  
  5604. protected function ShouldMount(slot : EEquipmentSlots, item : SItemUniqueId, category : name):bool
  5605. {
  5606.  
  5607.  
  5608. return !IsSlotPotionMutagen(slot) && category != 'usable' && category != 'potion' && category != 'petard' && !inv.ItemHasTag(item, 'PlayerUnwearable');
  5609. }
  5610.  
  5611. protected function ShouldMountItemWithName( itemName: name ): bool
  5612. {
  5613. var slot : EEquipmentSlots;
  5614. var items : array<SItemUniqueId>;
  5615. var category : name;
  5616. var i : int;
  5617.  
  5618. items = inv.GetItemsByName( itemName );
  5619.  
  5620. category = inv.GetItemCategory( items[0] );
  5621.  
  5622. slot = GetItemSlot( items[0] );
  5623.  
  5624. return ShouldMount( slot, items[0], category );
  5625. }
  5626.  
  5627. public function GetMountableItems( out items : array< SItemUniqueId > )
  5628. {
  5629. var i : int;
  5630. var mountable : bool;
  5631. var mountableItems : array< SItemUniqueId >;
  5632. var slot : EEquipmentSlots;
  5633. var category : name;
  5634. var item: SItemUniqueId;
  5635.  
  5636. for ( i = 0; i < items.Size(); i += 1 )
  5637. {
  5638. item = items[i];
  5639.  
  5640. category = inv.GetItemCategory( item );
  5641.  
  5642. slot = GetItemSlot( item );
  5643.  
  5644. mountable = ShouldMount( slot, item, category );
  5645.  
  5646. if ( mountable )
  5647. {
  5648. mountableItems.PushBack( items[ i ] );
  5649. }
  5650. }
  5651. items = mountableItems;
  5652. }
  5653.  
  5654. public final function AddAndEquipItem( item : name ) : bool
  5655. {
  5656. var ids : array< SItemUniqueId >;
  5657.  
  5658. ids = inv.AddAnItem( item );
  5659. if( inv.IsIdValid( ids[ 0 ] ) )
  5660. {
  5661. return EquipItem( ids[ 0 ] );
  5662. }
  5663.  
  5664. return false;
  5665. }
  5666.  
  5667. public final function AddQuestMarkedSelectedQuickslotItem( sel : SSelectedQuickslotItem )
  5668. {
  5669. questMarkedSelectedQuickslotItems.PushBack( sel );
  5670. }
  5671.  
  5672. public final function GetQuestMarkedSelectedQuickslotItem( sourceName : name ) : SItemUniqueId
  5673. {
  5674. var i : int;
  5675.  
  5676. for( i=0; i<questMarkedSelectedQuickslotItems.Size(); i+=1 )
  5677. {
  5678. if( questMarkedSelectedQuickslotItems[i].sourceName == sourceName )
  5679. {
  5680. return questMarkedSelectedQuickslotItems[i].itemID;
  5681. }
  5682. }
  5683.  
  5684. return GetInvalidUniqueId();
  5685. }
  5686.  
  5687. public final function SwapEquippedItems(slot1 : EEquipmentSlots, slot2 : EEquipmentSlots)
  5688. {
  5689. var temp : SItemUniqueId;
  5690. var pam : W3PlayerAbilityManager;
  5691.  
  5692. temp = itemSlots[slot1];
  5693. itemSlots[slot1] = itemSlots[slot2];
  5694. itemSlots[slot2] = temp;
  5695.  
  5696. if(IsSlotSkillMutagen(slot1))
  5697. {
  5698. pam = (W3PlayerAbilityManager)abilityManager;
  5699. if(pam)
  5700. pam.OnSwappedMutagensPost(itemSlots[slot1], itemSlots[slot2]);
  5701. }
  5702. }
  5703.  
  5704. public final function GetSlotForEquippedItem( itemID : SItemUniqueId ) : EEquipmentSlots
  5705. {
  5706. var i : int;
  5707.  
  5708. for( i=0; i<itemSlots.Size(); i+=1 )
  5709. {
  5710. if( itemSlots[i] == itemID )
  5711. {
  5712. return i;
  5713. }
  5714. }
  5715.  
  5716. return EES_InvalidSlot;
  5717. }
  5718.  
  5719. public function GetPoiseEffect() : W3Effect_Poise
  5720. {
  5721. return (W3Effect_Poise)GetBuff(EET_Poise);
  5722. }
  5723.  
  5724. public function EquipItemInGivenSlot(item : SItemUniqueId, slot : EEquipmentSlots, ignoreMounting : bool, optional toHand : bool) : bool
  5725. {
  5726. var i, groupID, quantity : int;
  5727. var fistsID : array<SItemUniqueId>;
  5728. var pam : W3PlayerAbilityManager;
  5729. var isSkillMutagen : bool;
  5730. var armorEntity : CItemEntity;
  5731. var armorMeshComponent : CComponent;
  5732. var armorSoundIdentification : name;
  5733. var category : name;
  5734. var prevSkillColor : ESkillColor;
  5735. var containedAbilities : array<name>;
  5736. var dm : CDefinitionsManagerAccessor;
  5737. var armorType : EArmorType;
  5738. var otherMask, previousItemInSlot : SItemUniqueId;
  5739. var tutStatePot : W3TutorialManagerUIHandlerStateInventory;
  5740. var tutStateFood : W3TutorialManagerUIHandlerStateFood;
  5741. var boltItem : SItemUniqueId;
  5742. var aerondight : W3Effect_Aerondight;
  5743.  
  5744. if(!inv.IsIdValid(item))
  5745. {
  5746. LogAssert(false, "W3PlayerWitcher.EquipItemInGivenSlot: invalid item");
  5747. return false;
  5748. }
  5749. if(slot == EES_InvalidSlot || slot == EES_HorseBlinders || slot == EES_HorseSaddle || slot == EES_HorseBag || slot == EES_HorseTrophy)
  5750. {
  5751. LogAssert(false, "W3PlayerWitcher.EquipItem: Cannot equip item <<" + inv.GetItemName(item) + ">> - provided slot <<" + slot + ">> is invalid");
  5752. return false;
  5753. }
  5754. if(itemSlots[slot] == item)
  5755. {
  5756. return true;
  5757. }
  5758.  
  5759. if(!HasRequiredLevelToEquipItem(item))
  5760. {
  5761.  
  5762. return false;
  5763. }
  5764.  
  5765. if(inv.ItemHasTag(item, 'PhantomWeapon') && !GetPhantomWeaponMgr())
  5766. {
  5767. InitPhantomWeaponMgr();
  5768. }
  5769.  
  5770. // W3EE - Begin
  5771. UpdateArmorCount(slot, item, 1);
  5772. if( /*slot == EES_SilverSword &&*/ inv.ItemHasTag( item, 'Aerondight' ) )
  5773. {
  5774. AddEffectDefault( EET_Aerondight, this, "Aerondight" );
  5775.  
  5776.  
  5777. aerondight = (W3Effect_Aerondight)GetBuff( EET_Aerondight );
  5778. aerondight.Pause( 'ManageAerondightBuff' );
  5779. UpdateAllSetBonuses(true);
  5780. }
  5781.  
  5782. GetPoiseEffect().UpdateMaxPoise();
  5783. // W3EE - End
  5784.  
  5785. previousItemInSlot = itemSlots[slot];
  5786. if( IsItemEquipped(item))
  5787. {
  5788. SwapEquippedItems(slot, GetItemSlot(item));
  5789. return true;
  5790. }
  5791.  
  5792.  
  5793. isSkillMutagen = IsSlotSkillMutagen(slot);
  5794. if(isSkillMutagen)
  5795. {
  5796. pam = (W3PlayerAbilityManager)abilityManager;
  5797. if(!pam.IsSkillMutagenSlotUnlocked(slot))
  5798. {
  5799. return false;
  5800. }
  5801. }
  5802.  
  5803.  
  5804. if(inv.IsIdValid(previousItemInSlot))
  5805. {
  5806. if(!UnequipItemFromSlot(slot, true))
  5807. {
  5808. LogAssert(false, "W3PlayerWitcher.EquipItem: Cannot equip item <<" + inv.GetItemName(item) + ">> !!");
  5809. return false;
  5810. }
  5811. }
  5812.  
  5813.  
  5814. if(inv.IsItemMask(item))
  5815. {
  5816. if(slot == EES_Quickslot1)
  5817. GetItemEquippedOnSlot(EES_Quickslot2, otherMask);
  5818. else
  5819. GetItemEquippedOnSlot(EES_Quickslot1, otherMask);
  5820.  
  5821. if(inv.IsItemMask(otherMask))
  5822. UnequipItem(otherMask);
  5823. }
  5824.  
  5825. if(isSkillMutagen)
  5826. {
  5827. groupID = pam.GetSkillGroupIdOfMutagenSlot(slot);
  5828. prevSkillColor = pam.GetSkillGroupColor(groupID);
  5829. }
  5830.  
  5831. itemSlots[slot] = item;
  5832.  
  5833. category = inv.GetItemCategory( item );
  5834.  
  5835.  
  5836. if( !ignoreMounting && ShouldMount(slot, item, category) )
  5837. {
  5838.  
  5839. inv.MountItem( item, toHand, IsSlotSkillMutagen( slot ) );
  5840. }
  5841.  
  5842. theTelemetry.LogWithLabelAndValue( TE_INV_ITEM_EQUIPPED, inv.GetItemName(item), slot );
  5843.  
  5844. if(slot == EES_RangedWeapon)
  5845. {
  5846. rangedWeapon = ( Crossbow )( inv.GetItemEntityUnsafe(item) );
  5847. if(!rangedWeapon)
  5848. AddTimer('DelayedOnItemMount', 0.1, true);
  5849.  
  5850. if ( IsSwimming() || IsDiving() )
  5851. {
  5852. GetItemEquippedOnSlot(EES_Bolt, boltItem);
  5853.  
  5854. if(inv.IsIdValid(boltItem))
  5855. {
  5856. if ( !inv.ItemHasTag(boltItem, 'UnderwaterAmmo' ))
  5857. {
  5858. AddAndEquipInfiniteBolt(false, true);
  5859. }
  5860. }
  5861. else if(!IsAnyItemEquippedOnSlot(EES_Bolt))
  5862. {
  5863. AddAndEquipInfiniteBolt(false, true);
  5864. }
  5865. }
  5866.  
  5867. else if(!IsAnyItemEquippedOnSlot(EES_Bolt))
  5868. AddAndEquipInfiniteBolt();
  5869. }
  5870. else if(slot == EES_Bolt)
  5871. {
  5872. if(rangedWeapon)
  5873. { if ( !IsSwimming() || !IsDiving() )
  5874. {
  5875. rangedWeapon.OnReplaceAmmo();
  5876. rangedWeapon.OnWeaponReload();
  5877. }
  5878. else
  5879. {
  5880. DisplayHudMessage(GetLocStringByKeyExt( "menu_cannot_perform_action_now" ));
  5881. }
  5882. }
  5883. }
  5884.  
  5885. else if(isSkillMutagen)
  5886. {
  5887. theGame.GetGuiManager().IgnoreNewItemNotifications( true );
  5888.  
  5889.  
  5890. quantity = inv.GetItemQuantity( item );
  5891. if( quantity > 1 )
  5892. {
  5893. inv.SplitItem( item, quantity - 1 );
  5894. }
  5895.  
  5896. pam.OnSkillMutagenEquipped(item, slot, prevSkillColor);
  5897. LogSkillColors("Mutagen <<" + inv.GetItemName(item) + ">> equipped to slot <<" + slot + ">>");
  5898. LogSkillColors("Group bonus color is now <<" + pam.GetSkillGroupColor(groupID) + ">>");
  5899. LogSkillColors("");
  5900.  
  5901. theGame.GetGuiManager().IgnoreNewItemNotifications( false );
  5902. }
  5903. else if(slot == EES_Gloves && HasWeaponDrawn(false))
  5904. {
  5905. // W3EE - Begin
  5906. /*
  5907. PlayRuneword4FX(PW_Steel);
  5908. PlayRuneword4FX(PW_Silver);
  5909. */
  5910. // W3EE - End
  5911. }
  5912.  
  5913. else if( ( slot == EES_Petard1 || slot == EES_Petard2 ) && inv.IsItemBomb( GetSelectedItemId() ) )
  5914. {
  5915. SelectQuickslotItem( slot );
  5916. }
  5917.  
  5918.  
  5919. if(inv.ItemHasAbility(item, 'MA_HtH'))
  5920. {
  5921. inv.GetItemContainedAbilities(item, containedAbilities);
  5922. fistsID = inv.GetItemsByName('fists');
  5923. dm = theGame.GetDefinitionsManager();
  5924. for(i=0; i<containedAbilities.Size(); i+=1)
  5925. {
  5926. if(dm.AbilityHasTag(containedAbilities[i], 'MA_HtH'))
  5927. {
  5928. inv.AddItemCraftedAbility(fistsID[0], containedAbilities[i], true);
  5929. }
  5930. }
  5931. }
  5932.  
  5933.  
  5934. if(inv.IsItemAnyArmor(item))
  5935. {
  5936. // W3EE - Begin
  5937. armorType = inv.GetArmorTypeOriginal(item);
  5938. // W3EE - End
  5939. pam = (W3PlayerAbilityManager)abilityManager;
  5940.  
  5941. if(armorType == EAT_Light)
  5942. {
  5943. if(CanUseSkill(S_Perk_05))
  5944. pam.SetPerkArmorBonus(S_Perk_05);
  5945. }
  5946. else if(armorType == EAT_Medium)
  5947. {
  5948. if(CanUseSkill(S_Perk_06))
  5949. pam.SetPerkArmorBonus(S_Perk_06);
  5950. }
  5951. else if(armorType == EAT_Heavy)
  5952. {
  5953. if(CanUseSkill(S_Perk_07))
  5954. pam.SetPerkArmorBonus(S_Perk_07);
  5955. }
  5956. }
  5957.  
  5958.  
  5959. UpdateItemSetBonuses( item, true );
  5960.  
  5961.  
  5962. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_OnItemEquipped );
  5963.  
  5964.  
  5965. if(ShouldProcessTutorial('TutorialPotionCanEquip3'))
  5966. {
  5967. if(IsSlotPotionSlot(slot))
  5968. {
  5969. tutStatePot = (W3TutorialManagerUIHandlerStateInventory)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
  5970. if(tutStatePot)
  5971. {
  5972. tutStatePot.OnPotionEquipped(inv.GetItemName(item));
  5973. }
  5974. }
  5975. }
  5976.  
  5977. // W3EE - Begin
  5978. ManageModShieldHoods(item, true);
  5979. if( inv.IsItemAnyArmor(item) )
  5980. ResumeRepairBuffs(item);
  5981. // W3EE - End
  5982.  
  5983. if(ShouldProcessTutorial('TutorialFoodSelectTab'))
  5984. {
  5985. if( IsSlotPotionSlot(slot) && inv.IsItemFood(item))
  5986. {
  5987. tutStateFood = (W3TutorialManagerUIHandlerStateFood)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
  5988. if(tutStateFood)
  5989. {
  5990. tutStateFood.OnFoodEquipped();
  5991. }
  5992. }
  5993. }
  5994.  
  5995.  
  5996. if(inv.IsItemSetItem(item))
  5997. {
  5998. CheckForFullyArmedAchievement();
  5999. }
  6000.  
  6001. return true;
  6002. }
  6003.  
  6004. private function CheckHairItem()
  6005. {
  6006. var ids : array<SItemUniqueId>;
  6007. var i : int;
  6008. var itemName : name;
  6009. var hairApplied : bool;
  6010.  
  6011. ids = inv.GetItemsByCategory('hair');
  6012.  
  6013. for(i=0; i<ids.Size(); i+= 1)
  6014. {
  6015. itemName = inv.GetItemName( ids[i] );
  6016.  
  6017. if( itemName != 'Preview Hair' )
  6018. {
  6019. if( hairApplied == false )
  6020. {
  6021. inv.MountItem( ids[i], false );
  6022. hairApplied = true;
  6023. }
  6024. else
  6025. {
  6026. inv.RemoveItem( ids[i], 1 );
  6027. }
  6028.  
  6029. }
  6030. }
  6031.  
  6032. if( hairApplied == false )
  6033. {
  6034. ids = inv.AddAnItem('Half With Tail Hairstyle', 1, true, false);
  6035. inv.MountItem( ids[0], false );
  6036. }
  6037.  
  6038. }
  6039.  
  6040.  
  6041. timer function DelayedOnItemMount( dt : float, id : int )
  6042. {
  6043. var crossbowID : SItemUniqueId;
  6044. var invent : CInventoryComponent;
  6045.  
  6046. invent = GetInventory();
  6047. if(!invent)
  6048. return;
  6049.  
  6050.  
  6051. GetItemEquippedOnSlot(EES_RangedWeapon, crossbowID);
  6052.  
  6053. if(invent.IsIdValid(crossbowID))
  6054. {
  6055.  
  6056. rangedWeapon = ( Crossbow )(invent.GetItemEntityUnsafe(crossbowID) );
  6057.  
  6058. if(rangedWeapon)
  6059. {
  6060.  
  6061. RemoveTimer('DelayedOnItemMount');
  6062. }
  6063. }
  6064. else
  6065. {
  6066.  
  6067. RemoveTimer('DelayedOnItemMount');
  6068. }
  6069. }
  6070.  
  6071. public function GetHeldItems() : array<SItemUniqueId>
  6072. {
  6073. var items : array<SItemUniqueId>;
  6074. var item : SItemUniqueId;
  6075.  
  6076. if( inv.GetItemEquippedOnSlot(EES_SilverSword, item) && inv.IsItemHeld(item))
  6077. items.PushBack(item);
  6078.  
  6079. if( inv.GetItemEquippedOnSlot(EES_SteelSword, item) && inv.IsItemHeld(item))
  6080. items.PushBack(item);
  6081.  
  6082. if( inv.GetItemEquippedOnSlot(EES_RangedWeapon, item) && inv.IsItemHeld(item))
  6083. items.PushBack(item);
  6084.  
  6085. if( inv.GetItemEquippedOnSlot(EES_Quickslot1, item) && inv.IsItemHeld(item))
  6086. items.PushBack(item);
  6087.  
  6088. if( inv.GetItemEquippedOnSlot(EES_Quickslot2, item) && inv.IsItemHeld(item))
  6089. items.PushBack(item);
  6090.  
  6091. if( inv.GetItemEquippedOnSlot(EES_Petard1, item) && inv.IsItemHeld(item))
  6092. items.PushBack(item);
  6093.  
  6094. if( inv.GetItemEquippedOnSlot(EES_Petard2, item) && inv.IsItemHeld(item))
  6095. items.PushBack(item);
  6096.  
  6097. // -= WMK:modQuickSlots =-
  6098. if (inv.GetItemEquippedOnSlot(EES_Petard3, item) && inv.IsItemHeld(item))
  6099. items.PushBack(item);
  6100. if (inv.GetItemEquippedOnSlot(EES_Petard4, item) && inv.IsItemHeld(item))
  6101. items.PushBack(item);
  6102. // -= WMK:modQuickSlots =-
  6103.  
  6104. return items;
  6105. }
  6106.  
  6107. public function MoveMutagenToSlot( item : SItemUniqueId, slotFrom : EEquipmentSlots, slotTo : EEquipmentSlots )
  6108. {
  6109. var pam : W3PlayerAbilityManager;
  6110. var prevSkillColor : ESkillColor;
  6111. var groupID : int;
  6112.  
  6113. if( IsSlotSkillMutagen( slotTo ) )
  6114. {
  6115. itemSlots[slotFrom] = GetInvalidUniqueId();
  6116.  
  6117.  
  6118. groupID = pam.GetSkillGroupIdOfMutagenSlot(slotFrom);
  6119. prevSkillColor = pam.GetSkillGroupColor(groupID);
  6120. pam = (W3PlayerAbilityManager)abilityManager;
  6121. pam.OnSkillMutagenUnequipped(item, slotFrom, prevSkillColor, true);
  6122.  
  6123.  
  6124.  
  6125. EquipItemInGivenSlot( item, slotTo, false );
  6126. }
  6127. }
  6128.  
  6129.  
  6130. public function UnequipItemFromSlot(slot : EEquipmentSlots, optional reequipped : bool) : bool
  6131. {
  6132. var item, bolts, id : SItemUniqueId;
  6133. var items : array<SItemUniqueId>;
  6134. var retBool : bool;
  6135. var fistsID, bolt : array<SItemUniqueId>;
  6136. var i, groupID : int;
  6137. var pam : W3PlayerAbilityManager;
  6138. var prevSkillColor : ESkillColor;
  6139. var containedAbilities : array<name>;
  6140. var dm : CDefinitionsManagerAccessor;
  6141. var armorType : EArmorType;
  6142. var isSwimming : bool;
  6143. var hud : CR4ScriptedHud;
  6144. var damagedItemModule : CR4HudModuleDamagedItems;
  6145.  
  6146. if(slot == EES_InvalidSlot || slot < 0 || slot > EnumGetMax('EEquipmentSlots') || !inv.IsIdValid(itemSlots[slot]))
  6147. return false;
  6148.  
  6149. // W3EE - Begin
  6150. item = itemSlots[slot];
  6151. if( Equipment().DisallowUnequip(slot, item, inv) )
  6152. return false;
  6153.  
  6154. PauseRepairBuffs(item);
  6155. Equipment().HandleRelicAbilities(this, item, false);
  6156. // W3EE - End
  6157.  
  6158. if(IsSlotSkillMutagen(slot))
  6159. {
  6160.  
  6161. pam = (W3PlayerAbilityManager)abilityManager;
  6162. groupID = pam.GetSkillGroupIdOfMutagenSlot(slot);
  6163. prevSkillColor = pam.GetSkillGroupColor(groupID);
  6164. }
  6165.  
  6166.  
  6167. if(slot == EES_SilverSword || slot == EES_SteelSword)
  6168. {
  6169. PauseOilBuffs( slot == EES_SteelSword );
  6170. }
  6171.  
  6172. // item = itemSlots[slot];
  6173. itemSlots[slot] = GetInvalidUniqueId();
  6174.  
  6175.  
  6176. if(inv.ItemHasTag( item, 'PhantomWeapon' ) && GetPhantomWeaponMgr())
  6177. {
  6178. DestroyPhantomWeaponMgr();
  6179. }
  6180.  
  6181. // W3EE - Begin
  6182. UpdateArmorCount(slot, item, -1);
  6183.  
  6184. if( /*slot == EES_SilverSword &&*/ inv.ItemHasTag( item, 'Aerondight' ) )
  6185. {
  6186. RemoveBuff( EET_Aerondight );
  6187. UpdateAllSetBonuses(false);
  6188. }
  6189.  
  6190. GetPoiseEffect().UpdateMaxPoise();
  6191. // W3EE - End
  6192.  
  6193. if(slot == EES_RangedWeapon)
  6194. {
  6195.  
  6196. this.OnRangedForceHolster( true, true );
  6197. rangedWeapon.ClearDeployedEntity(true);
  6198. rangedWeapon = NULL;
  6199.  
  6200.  
  6201. if(GetItemEquippedOnSlot(EES_Bolt, bolts))
  6202. {
  6203. if(inv.ItemHasTag(bolts, theGame.params.TAG_INFINITE_AMMO))
  6204. {
  6205. inv.RemoveItem(bolts, inv.GetItemQuantity(bolts) );
  6206. }
  6207. }
  6208. }
  6209. else if(IsSlotSkillMutagen(slot))
  6210. {
  6211. pam.OnSkillMutagenUnequipped(item, slot, prevSkillColor, true);
  6212. LogSkillColors("Mutagen <<" + inv.GetItemName(item) + ">> unequipped from slot <<" + slot + ">>");
  6213. LogSkillColors("Group bonus color is now <<" + pam.GetSkillGroupColor(groupID) + ">>");
  6214. LogSkillColors("");
  6215. }
  6216.  
  6217.  
  6218. if(currentlyEquipedItem == item)
  6219. {
  6220. currentlyEquipedItem = GetInvalidUniqueId();
  6221. RaiseEvent('ForcedUsableItemUnequip');
  6222. }
  6223. if(currentlyEquipedItemL == item)
  6224. {
  6225. if ( currentlyUsedItemL )
  6226. {
  6227. currentlyUsedItemL.OnHidden( this );
  6228. }
  6229. HideUsableItem ( true );
  6230. }
  6231.  
  6232.  
  6233. if( !IsSlotPotionMutagen(slot) )
  6234. {
  6235. GetInventory().UnmountItem(item, true);
  6236. }
  6237.  
  6238. retBool = true;
  6239.  
  6240.  
  6241. if(IsAnyItemEquippedOnSlot(EES_RangedWeapon) && slot == EES_Bolt)
  6242. {
  6243. if(inv.ItemHasTag(item, theGame.params.TAG_INFINITE_AMMO))
  6244. {
  6245.  
  6246. inv.RemoveItem(item, inv.GetItemQuantityByName( inv.GetItemName(item) ) );
  6247. }
  6248. else if (!reequipped)
  6249. {
  6250.  
  6251. AddAndEquipInfiniteBolt();
  6252. }
  6253. }
  6254.  
  6255.  
  6256. if(slot == EES_SilverSword || slot == EES_SteelSword)
  6257. {
  6258. OnEquipMeleeWeapon(PW_None, true);
  6259. }
  6260.  
  6261. if( GetSelectedItemId() == item )
  6262. {
  6263. ClearSelectedItemId();
  6264. }
  6265.  
  6266. if(inv.IsItemBody(item))
  6267. {
  6268. retBool = true;
  6269. }
  6270.  
  6271. /*if(retBool && !reequipped)
  6272. {
  6273. theTelemetry.LogWithLabelAndValue( TE_INV_ITEM_UNEQUIPPED, inv.GetItemName(item), slot );
  6274.  
  6275.  
  6276. if(slot == EES_SteelSword && !IsAnyItemEquippedOnSlot(EES_SilverSword))
  6277. {
  6278. RemoveBuff(EET_EnhancedWeapon);
  6279. }
  6280. else if(slot == EES_SilverSword && !IsAnyItemEquippedOnSlot(EES_SteelSword))
  6281. {
  6282. RemoveBuff(EET_EnhancedWeapon);
  6283. }
  6284. else if(inv.IsItemAnyArmor(item))
  6285. {
  6286. if( !IsAnyItemEquippedOnSlot(EES_Armor) && !IsAnyItemEquippedOnSlot(EES_Gloves) && !IsAnyItemEquippedOnSlot(EES_Boots) && !IsAnyItemEquippedOnSlot(EES_Pants))
  6287. RemoveBuff(EET_EnhancedArmor);
  6288. }
  6289. }*/
  6290.  
  6291.  
  6292. if(inv.ItemHasAbility(item, 'MA_HtH'))
  6293. {
  6294. inv.GetItemContainedAbilities(item, containedAbilities);
  6295. fistsID = inv.GetItemsByName('fists');
  6296. dm = theGame.GetDefinitionsManager();
  6297. for(i=0; i<containedAbilities.Size(); i+=1)
  6298. {
  6299. if(dm.AbilityHasTag(containedAbilities[i], 'MA_HtH'))
  6300. {
  6301. inv.RemoveItemCraftedAbility(fistsID[0], containedAbilities[i]);
  6302. }
  6303. }
  6304. }
  6305.  
  6306.  
  6307. if(inv.IsItemAnyArmor(item))
  6308. {
  6309. // W3EE - Begin
  6310. armorType = inv.GetArmorTypeOriginal(item);
  6311. // W3EE - End
  6312. pam = (W3PlayerAbilityManager)abilityManager;
  6313.  
  6314. if(CanUseSkill(S_Perk_05) && (armorType == EAT_Light || GetCharacterStats().HasAbility('Glyphword 2 _Stats', true) || inv.ItemHasAbility(item, 'Glyphword 2 _Stats')))
  6315. {
  6316. pam.SetPerkArmorBonus(S_Perk_05);
  6317. }
  6318. if(CanUseSkill(S_Perk_06) && (armorType == EAT_Medium || GetCharacterStats().HasAbility('Glyphword 3 _Stats', true) || inv.ItemHasAbility(item, 'Glyphword 3 _Stats')) )
  6319. {
  6320. pam.SetPerkArmorBonus(S_Perk_06);
  6321. }
  6322. if(CanUseSkill(S_Perk_07) && (armorType == EAT_Heavy || GetCharacterStats().HasAbility('Glyphword 4 _Stats', true) || inv.ItemHasAbility(item, 'Glyphword 4 _Stats')) )
  6323. {
  6324. pam.SetPerkArmorBonus(S_Perk_07);
  6325. }
  6326. }
  6327.  
  6328.  
  6329. UpdateItemSetBonuses( item, false );
  6330.  
  6331.  
  6332. if( inv.ItemHasTag( item, theGame.params.ITEM_SET_TAG_BONUS ) && !IsSetBonusActive( EISB_RedWolf_2 ) )
  6333. {
  6334. SkillReduceBombAmmoBonus();
  6335. }
  6336.  
  6337. // W3EE - Begin
  6338. ManageModShieldHoods(item, false);
  6339. // W3EE - End
  6340.  
  6341. if( slot == EES_Gloves )
  6342. {
  6343. thePlayer.DestroyEffect('runeword_4');
  6344. }
  6345.  
  6346.  
  6347. hud = (CR4ScriptedHud)theGame.GetHud();
  6348. if ( hud )
  6349. {
  6350. damagedItemModule = hud.GetDamagedItemModule();
  6351. if ( damagedItemModule )
  6352. {
  6353. damagedItemModule.OnItemUnequippedFromSlot( slot );
  6354. }
  6355. }
  6356.  
  6357.  
  6358. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_OnItemEquipped );
  6359.  
  6360. return retBool;
  6361. }
  6362.  
  6363. public function UnequipItem(item : SItemUniqueId) : bool
  6364. {
  6365. // W3EE - Begin
  6366. if(!inv.IsIdValid(item) || Equipment().DisallowUnequip(itemSlots.FindFirst(item), item, inv))
  6367. return false;
  6368. // W3EE - End
  6369.  
  6370. return UnequipItemFromSlot( itemSlots.FindFirst(item) );
  6371. }
  6372.  
  6373. public function DropItem( item : SItemUniqueId, quantity : int ) : bool
  6374. {
  6375. if(!inv.IsIdValid(item))
  6376. return false;
  6377. if(IsItemEquipped(item))
  6378. return UnequipItem(item);
  6379.  
  6380. return true;
  6381. }
  6382.  
  6383.  
  6384. public function IsItemEquippedByName(itemName : name) : bool
  6385. {
  6386. var i : int;
  6387.  
  6388. for(i=0; i<itemSlots.Size(); i+=1)
  6389. if(inv.GetItemName(itemSlots[i]) == itemName)
  6390. return true;
  6391.  
  6392. return false;
  6393. }
  6394.  
  6395.  
  6396. public function IsItemEquippedByCategoryName(categoryName : name) : bool
  6397. {
  6398. var i : int;
  6399.  
  6400. for(i=0; i<itemSlots.Size(); i+=1)
  6401. if(inv.GetItemCategory(itemSlots[i]) == categoryName)
  6402. return true;
  6403.  
  6404. return false;
  6405. }
  6406.  
  6407. public function GetMaxRunEncumbrance(out usesHorseBonus : bool) : float
  6408. {
  6409. var attValue : SAbilityAttributeValue;
  6410. var value : float;
  6411.  
  6412. // W3EE - Begin
  6413. //value = CalculateAttributeValue(GetHorseManager().GetHorseAttributeValue('encumbrance', false));
  6414. value = 0;
  6415. usesHorseBonus = (value > 0);
  6416. attValue = GetAttributeValue('carryweight_bonus');
  6417. value += Options().BaseCWGeralt() + CalculateAttributeValue( GetAttributeValue('encumbrance') ) - 60 + attValue.valueAdditive;
  6418. // W3EE - End
  6419.  
  6420. return value;
  6421. }
  6422.  
  6423. public function GetEncumbrance() : float
  6424. {
  6425. var i: int;
  6426. var encumbrance : float;
  6427. var items : array<SItemUniqueId>;
  6428. var inve : CInventoryComponent;
  6429.  
  6430. inve = GetInventory();
  6431. inve.GetAllItems(items);
  6432.  
  6433. for(i=0; i<items.Size(); i+=1)
  6434. {
  6435. encumbrance += inve.GetItemEncumbrance( items[i] );
  6436.  
  6437.  
  6438.  
  6439. }
  6440. return encumbrance;
  6441. }
  6442.  
  6443.  
  6444.  
  6445. public function StartInvUpdateTransaction():void
  6446. {
  6447. invUpdateTransaction = true;
  6448. }
  6449.  
  6450. public function FinishInvUpdateTransaction():void
  6451. {
  6452. invUpdateTransaction = false;
  6453.  
  6454.  
  6455.  
  6456. UpdateEncumbrance();
  6457. }
  6458.  
  6459.  
  6460. public function UpdateEncumbrance()
  6461. {
  6462. var temp : bool;
  6463.  
  6464. if (invUpdateTransaction)
  6465. {
  6466.  
  6467. return;
  6468. }
  6469.  
  6470.  
  6471.  
  6472. if ( GetEncumbrance() >= (GetMaxRunEncumbrance(temp) + 1) )
  6473. {
  6474. if( !HasBuff(EET_OverEncumbered) && FactsQuerySum( "DEBUG_EncumbranceBoy" ) == 0 )
  6475. {
  6476. AddEffectDefault(EET_OverEncumbered, NULL, "OverEncumbered");
  6477. }
  6478. }
  6479. else if(HasBuff(EET_OverEncumbered))
  6480. {
  6481. RemoveAllBuffsOfType(EET_OverEncumbered);
  6482. }
  6483. }
  6484.  
  6485. public final function GetSkillGroupIDFromIndex(idx : int) : int
  6486. {
  6487. var pam : W3PlayerAbilityManager;
  6488.  
  6489. pam = (W3PlayerAbilityManager)abilityManager;
  6490. if(pam && pam.IsInitialized())
  6491. return pam.GetSkillGroupIDFromIndex(idx);
  6492.  
  6493. return -1;
  6494. }
  6495.  
  6496. public final function GetSkillGroupColor(groupID : int) : ESkillColor
  6497. {
  6498. var pam : W3PlayerAbilityManager;
  6499.  
  6500. pam = (W3PlayerAbilityManager)abilityManager;
  6501. if(pam && pam.IsInitialized())
  6502. return pam.GetSkillGroupColor(groupID);
  6503.  
  6504. return SC_None;
  6505. }
  6506.  
  6507. public final function GetSkillGroupsCount() : int
  6508. {
  6509. var pam : W3PlayerAbilityManager;
  6510.  
  6511. pam = (W3PlayerAbilityManager)abilityManager;
  6512. if(pam && pam.IsInitialized())
  6513. return pam.GetSkillGroupsCount();
  6514.  
  6515. return 0;
  6516. }
  6517.  
  6518.  
  6519.  
  6520.  
  6521.  
  6522.  
  6523.  
  6524.  
  6525. function CycleSelectSign( bIsCyclingLeft : bool ) : ESignType
  6526. {
  6527. var signOrder : array<ESignType>;
  6528. var i : int;
  6529.  
  6530. signOrder.PushBack( ST_Yrden );
  6531. signOrder.PushBack( ST_Quen );
  6532. signOrder.PushBack( ST_Igni );
  6533. signOrder.PushBack( ST_Axii );
  6534. signOrder.PushBack( ST_Aard );
  6535.  
  6536. for( i = 0; i < signOrder.Size(); i += 1 )
  6537. if( signOrder[i] == equippedSign )
  6538. break;
  6539.  
  6540. if(bIsCyclingLeft)
  6541. return signOrder[ (4 + i) % 5 ];
  6542. else
  6543. return signOrder[ (6 + i) % 5 ];
  6544. }
  6545.  
  6546. function ToggleNextSign()
  6547. {
  6548. SetEquippedSign(CycleSelectSign( false ));
  6549. FactsAdd("SignToggled", 1, 1);
  6550. }
  6551.  
  6552. function TogglePreviousSign()
  6553. {
  6554. SetEquippedSign(CycleSelectSign( true ));
  6555. FactsAdd("SignToggled", 1, 1);
  6556. }
  6557.  
  6558. function ProcessSignEvent( eventName : name ) : bool
  6559. {
  6560. if( currentlyCastSign != ST_None && signs[currentlyCastSign].entity)
  6561. {
  6562. return signs[currentlyCastSign].entity.OnProcessSignEvent( eventName );
  6563. }
  6564.  
  6565. return false;
  6566. }
  6567.  
  6568. var findActorTargetTimeStamp : float;
  6569. var pcModeChanneledSignTimeStamp : float;
  6570. event OnProcessCastingOrientation( isContinueCasting : bool )
  6571. {
  6572. var customOrientationTarget : EOrientationTarget;
  6573. var checkHeading : float;
  6574. var rotHeading : float;
  6575. var playerToHeadingDist : float;
  6576. var slideTargetActor : CActor;
  6577. var newLockTarget : CActor;
  6578.  
  6579. var enableNoTargetOrientation : bool;
  6580.  
  6581. var currTime : float;
  6582.  
  6583. enableNoTargetOrientation = true;
  6584. if ( GetDisplayTarget() && this.IsDisplayTargetTargetable() )
  6585. {
  6586. enableNoTargetOrientation = false;
  6587. // W3EE - Begin
  6588. if ( /*theInput.GetActionValue( 'CastSignHold' ) > 0*/ GetWitcherPlayer().GetIsAlternateCast() || this.IsCurrentSignChanneled() )
  6589. // W3EE - End
  6590. {
  6591. if ( IsPCModeEnabled() )
  6592. {
  6593. if ( EngineTimeToFloat( theGame.GetEngineTime() ) > pcModeChanneledSignTimeStamp + 1.f )
  6594. enableNoTargetOrientation = true;
  6595. }
  6596. else
  6597. {
  6598. if ( GetCurrentlyCastSign() == ST_Igni || GetCurrentlyCastSign() == ST_Axii )
  6599. {
  6600. slideTargetActor = (CActor)GetDisplayTarget();
  6601. if ( slideTargetActor
  6602. && ( !slideTargetActor.GetGameplayVisibility() || !CanBeTargetedIfSwimming( slideTargetActor ) || !slideTargetActor.IsAlive() ) )
  6603. {
  6604. SetSlideTarget( NULL );
  6605. if ( ProcessLockTarget() )
  6606. slideTargetActor = (CActor)slideTarget;
  6607. }
  6608.  
  6609. if ( !slideTargetActor )
  6610. {
  6611. LockToTarget( false );
  6612. enableNoTargetOrientation = true;
  6613. }
  6614. else if ( IsThreat( slideTargetActor ) || GetCurrentlyCastSign() == ST_Axii )
  6615. LockToTarget( true );
  6616. else
  6617. {
  6618. LockToTarget( false );
  6619. enableNoTargetOrientation = true;
  6620. }
  6621. }
  6622. }
  6623. }
  6624.  
  6625. if ( !enableNoTargetOrientation )
  6626. {
  6627. customOrientationTarget = OT_Actor;
  6628. }
  6629. }
  6630.  
  6631. if ( enableNoTargetOrientation )
  6632. {
  6633. // W3EE - Begin
  6634. if ( GetPlayerCombatStance() == PCS_AlertNear && GetWitcherPlayer().GetIsAlternateCast() /*theInput.GetActionValue( 'CastSignHold' ) > 0*/ )
  6635. // W3EE - End
  6636. {
  6637. if ( GetDisplayTarget() && !slideTargetActor )
  6638. {
  6639. currTime = EngineTimeToFloat( theGame.GetEngineTime() );
  6640. if ( currTime > findActorTargetTimeStamp + 1.5f )
  6641. {
  6642. findActorTargetTimeStamp = currTime;
  6643.  
  6644. newLockTarget = GetScreenSpaceLockTarget( GetDisplayTarget(), 180.f, 1.f, 0.f, true );
  6645.  
  6646. if ( newLockTarget && IsThreat( newLockTarget ) && IsCombatMusicEnabled() )
  6647. {
  6648. SetTarget( newLockTarget, true );
  6649. SetMoveTargetChangeAllowed( true );
  6650. SetMoveTarget( newLockTarget );
  6651. SetMoveTargetChangeAllowed( false );
  6652. SetSlideTarget( newLockTarget );
  6653. }
  6654. }
  6655. }
  6656. else
  6657. ProcessLockTarget();
  6658. }
  6659.  
  6660. if ( wasBRAxisPushed )
  6661. customOrientationTarget = OT_CameraOffset;
  6662. else
  6663. {
  6664. if ( !lastAxisInputIsMovement || theInput.LastUsedPCInput() )
  6665. customOrientationTarget = OT_CameraOffset;
  6666. // W3EE - Begin
  6667. //else if ( theInput.GetActionValue( 'CastSignHold' ) > 0 )
  6668. else if( GetWitcherPlayer().GetIsAlternateCast() )
  6669. // W3EE - End
  6670. {
  6671. if ( GetOrientationTarget() == OT_CameraOffset )
  6672. customOrientationTarget = OT_CameraOffset;
  6673. else if ( GetPlayerCombatStance() == PCS_AlertNear || GetPlayerCombatStance() == PCS_Guarded )
  6674. customOrientationTarget = OT_CameraOffset;
  6675. else
  6676. customOrientationTarget = OT_Player;
  6677. }
  6678. else
  6679. customOrientationTarget = OT_CustomHeading;
  6680. }
  6681. }
  6682.  
  6683. if ( GetCurrentlyCastSign() == ST_Quen )
  6684. {
  6685. if ( IsCurrentSignChanneled() )
  6686. {
  6687. if ( bLAxisReleased )
  6688. customOrientationTarget = OT_Player;
  6689. else
  6690. customOrientationTarget = OT_Camera;
  6691. }
  6692. else
  6693. customOrientationTarget = OT_Player;
  6694. }
  6695.  
  6696. if ( GetCurrentlyCastSign() == ST_Axii && IsCurrentSignChanneled() )
  6697. {
  6698. if ( slideTarget && (CActor)slideTarget )
  6699. {
  6700. checkHeading = VecHeading( slideTarget.GetWorldPosition() - this.GetWorldPosition() );
  6701. rotHeading = checkHeading;
  6702. playerToHeadingDist = AngleDistance( GetHeading(), checkHeading );
  6703.  
  6704. if ( playerToHeadingDist > 45 )
  6705. SetCustomRotation( 'ChanneledSignAxii', rotHeading, 0.0, 0.5, false );
  6706. else if ( playerToHeadingDist < -45 )
  6707. SetCustomRotation( 'ChanneledSignAxii', rotHeading, 0.0, 0.5, false );
  6708. }
  6709. else
  6710. {
  6711. checkHeading = VecHeading( theCamera.GetCameraDirection() );
  6712. rotHeading = GetHeading();
  6713. playerToHeadingDist = AngleDistance( GetHeading(), checkHeading );
  6714.  
  6715. if ( playerToHeadingDist > 45 )
  6716. SetCustomRotation( 'ChanneledSignAxii', rotHeading - 22.5, 0.0, 0.5, false );
  6717. else if ( playerToHeadingDist < -45 )
  6718. SetCustomRotation( 'ChanneledSignAxii', rotHeading + 22.5, 0.0, 0.5, false );
  6719. }
  6720. }
  6721.  
  6722. if( !Options().LockOn() && !Options().LockOnMode() || Options().LockOn() && !Options().LockOnModeSF() && theGame.GetInGameConfigWrapper().GetVarValue('EnhancedTargeting', 'ETSignsTowardsCamera') )
  6723. customOrientationTarget = OT_CameraOffset;
  6724. else
  6725. if( GetCurrentlyCastSign() != ST_Quen && theGame.GetInGameConfigWrapper().GetVarValue('EnhancedTargeting', 'ETSignsTowardsCamera') )
  6726. customOrientationTarget = OT_CustomHeading;
  6727.  
  6728. if ( IsActorLockedToTarget() )
  6729. customOrientationTarget = OT_Actor;
  6730.  
  6731. AddCustomOrientationTarget( customOrientationTarget, 'Signs' );
  6732. if ( customOrientationTarget == OT_CustomHeading )
  6733. SetOrientationTargetCustomHeading( GetCombatActionHeading(), 'Signs' );
  6734. }
  6735.  
  6736. event OnRaiseSignEvent()
  6737. {
  6738. var newTarget : CActor;
  6739.  
  6740. if ( ( !IsCombatMusicEnabled() && !CanAttackWhenNotInCombat( EBAT_CastSign, false, newTarget ) ) || ( IsOnBoat() && !IsCombatMusicEnabled() ) )
  6741. {
  6742. if ( CastSignFriendly() )
  6743. return true;
  6744. }
  6745. else
  6746. {
  6747. RaiseEvent('CombatActionFriendlyEnd');
  6748. SetBehaviorVariable( 'SignNum', (int)equippedSign );
  6749. SetBehaviorVariable( 'combatActionType', (int)CAT_CastSign );
  6750.  
  6751. if ( IsPCModeEnabled() )
  6752. pcModeChanneledSignTimeStamp = EngineTimeToFloat( theGame.GetEngineTime() );
  6753.  
  6754. if( RaiseForceEvent('CombatAction') )
  6755. {
  6756. OnCombatActionStart();
  6757. findActorTargetTimeStamp = EngineTimeToFloat( theGame.GetEngineTime() );
  6758. theTelemetry.LogWithValueStr(TE_FIGHT_PLAYER_USE_SIGN, SignEnumToString( equippedSign ));
  6759. return true;
  6760. }
  6761. }
  6762.  
  6763. return false;
  6764. }
  6765.  
  6766. function CastSignFriendly() : bool
  6767. {
  6768. var actor : CActor;
  6769.  
  6770. SetBehaviorVariable( 'combatActionTypeForOverlay', (int)CAT_CastSign );
  6771. if ( RaiseCombatActionFriendlyEvent() )
  6772. {
  6773.  
  6774. return true;
  6775. }
  6776.  
  6777. return false;
  6778. }
  6779.  
  6780. function CastSign() : bool
  6781. {
  6782. var equippedSignStr : string;
  6783. var newSignEnt : W3SignEntity;
  6784. var spawnPos : Vector;
  6785. var slotMatrix : Matrix;
  6786. var target : CActor;
  6787.  
  6788. // W3EE - Begin
  6789. if ( IsInAir() || IsSwimming() || IsMeditating() )
  6790. {
  6791. return false;
  6792. }
  6793. // W3EE - End
  6794.  
  6795. AddTemporarySkills();
  6796.  
  6797.  
  6798.  
  6799. if(equippedSign == ST_Aard)
  6800. {
  6801. CalcEntitySlotMatrix('l_weapon', slotMatrix);
  6802. spawnPos = MatrixGetTranslation(slotMatrix);
  6803. }
  6804. else
  6805. {
  6806. spawnPos = GetWorldPosition();
  6807. }
  6808.  
  6809. if( equippedSign == ST_Aard || equippedSign == ST_Igni )
  6810. {
  6811. target = GetTarget();
  6812. if(target)
  6813. target.SignalGameplayEvent( 'DodgeSign' );
  6814. }
  6815.  
  6816. newSignEnt = (W3SignEntity)theGame.CreateEntity( signs[equippedSign].template, spawnPos, GetWorldRotation() );
  6817. return newSignEnt.Init( signOwner, signs[equippedSign].entity );
  6818. }
  6819.  
  6820. // W3EE - Begin
  6821. public function CastSignUnderwater()
  6822. {
  6823. if( equippedSign == ST_Aard || equippedSign == ST_Quen )
  6824. {
  6825. SetBehaviorVariable('SelectedItemL', (int)UI_OilLamp, true);
  6826. RaiseEvent('ItemUseL');
  6827. AddTimer('CastSignUnderwaterTimer', 1.1f, false);
  6828. AddTimer('EndUsableAnim', 1.6f, false);
  6829. }
  6830. }
  6831.  
  6832. timer function EndUsableAnim( dt : float, id : int )
  6833. {
  6834. RaiseEvent('ItemEndL');
  6835. }
  6836.  
  6837. timer function CastSignUnderwaterTimer( dt : float, id : int )
  6838. {
  6839. CastDesiredSignUnderwater(equippedSign, false);
  6840. }
  6841.  
  6842. public function CastDesiredSignUnderwater( signType : ESignType, alternateCast : bool )
  6843. {
  6844. var slotMatrix : Matrix;
  6845. var spawnPos : Vector;
  6846. var signEntity : W3SignEntity;
  6847.  
  6848. if( signType == ST_Aard )
  6849. {
  6850. CalcEntitySlotMatrix('l_weapon', slotMatrix);
  6851. spawnPos = MatrixGetTranslation(slotMatrix);
  6852. }
  6853. else
  6854. if( signType == ST_Quen )
  6855. {
  6856. spawnPos = GetWorldPosition();
  6857. }
  6858. else return;
  6859.  
  6860. AddTemporarySkills();
  6861.  
  6862. signEntity = (W3SignEntity)theGame.CreateEntity(signs[signType].template, spawnPos, GetWorldRotation());
  6863. signEntity.Init(signOwner, signs[signType].entity, true, false, false);
  6864. if( alternateCast )
  6865. signEntity.SetAlternateCast(SignEnumToSkillEnum(signType));
  6866. signEntity.OnStarted();
  6867. signEntity.OnThrowing();
  6868. signEntity.OnEnded();
  6869. }
  6870.  
  6871. public function CastDesiredSign( signType : ESignType, freeCast : bool, alternateCast : bool, baseCast : bool, spawnPos : Vector, rotation : EulerAngles )
  6872. {
  6873. var signEntity : W3SignEntity;
  6874.  
  6875. signEntity = (W3SignEntity)theGame.CreateEntity(signs[signType].template, spawnPos, rotation);
  6876. signEntity.Init(signOwner, signs[signType].entity, true, false, freeCast);
  6877. if( baseCast )
  6878. signEntity.SetBaseCast();
  6879. if( alternateCast )
  6880. signEntity.SetAlternateCast(SignEnumToSkillEnum(signType));
  6881. signEntity.OnStarted();
  6882. signEntity.OnThrowing();
  6883. signEntity.OnEnded();
  6884. }
  6885. // W3EE - End
  6886.  
  6887. private function HAX_SignToThrowItemRestore()
  6888. {
  6889. var action : SInputAction;
  6890.  
  6891. action.value = theInput.GetActionValue('ThrowItemHold');
  6892. action.lastFrameValue = 0;
  6893.  
  6894. if(IsPressed(action) && CanSetupCombatAction_Throw())
  6895. {
  6896. if(inv.IsItemBomb(selectedItemId))
  6897. {
  6898. BombThrowStart();
  6899. }
  6900. else
  6901. {
  6902. UsableItemStart();
  6903. }
  6904.  
  6905. SetThrowHold( true );
  6906. }
  6907. }
  6908.  
  6909. event OnCFMCameraZoomFail(){}
  6910.  
  6911.  
  6912.  
  6913. public final function GetPotionBuffs() : array<CBaseGameplayEffect>
  6914. {
  6915. return effectManager.GetPotionBuffs();
  6916. }
  6917.  
  6918. public final function RecalcPotionsDurations()
  6919. {
  6920. var i : int;
  6921. var buffs : array<CBaseGameplayEffect>;
  6922.  
  6923. buffs = GetPotionBuffs();
  6924. for(i=0; i<buffs.Size(); i+=1)
  6925. {
  6926. buffs[i].RecalcPotionDuration();
  6927. }
  6928. }
  6929.  
  6930. // W3EE - Begin
  6931. private var frenzySpeedBuff : int; default frenzySpeedBuff = -1;
  6932. public function StartFrenzy()
  6933. {
  6934. var min, max : SAbilityAttributeValue;
  6935. var slowdown, duration, chance : float;
  6936. var thunderbolt : W3Potion_Thunderbolt;
  6937.  
  6938. thunderbolt = (W3Potion_Thunderbolt)GetBuff(EET_Thunderbolt);
  6939. if( !isInFrenzy && thunderbolt && thunderbolt.GetBuffLevel() == 3 )
  6940. {
  6941. theGame.GetDefinitionsManager().GetAbilityAttributeValue('ThunderboltEffect_Level3', 'critical_frenzy_chance', min, max);
  6942. chance = min.valueAdditive;
  6943.  
  6944. if( RandRange(100, 0) <= chance )
  6945. {
  6946. isInFrenzy = true;
  6947. theGame.GetDefinitionsManager().GetAbilityAttributeValue('ThunderboltEffect_Level3', 'critical_frenzy_duration', min, max);
  6948. duration = min.valueAdditive;
  6949. theGame.GetDefinitionsManager().GetAbilityAttributeValue('ThunderboltEffect_Level3', 'critical_frenzy_slowdown', min, max);
  6950. slowdown = min.valueAdditive;
  6951. frenzySpeedBuff = SetAnimationSpeedMultiplier(1 / slowdown, frenzySpeedBuff, true);
  6952. theGame.SetTimeScale(slowdown, theGame.GetTimescaleSource(ETS_SkillFrenzy), theGame.GetTimescalePriority(ETS_SkillFrenzy), true);
  6953. AddTimer('SkillFrenzyFinish', duration * slowdown, , , , true);
  6954. }
  6955. }
  6956. }
  6957.  
  6958. timer function SkillFrenzyFinish(dt : float, optional id : int)
  6959. {
  6960. ResetAnimationSpeedMultiplier(frenzySpeedBuff);
  6961. theGame.RemoveTimeScale(theGame.GetTimescaleSource(ETS_SkillFrenzy));
  6962. isInFrenzy = false;
  6963. }
  6964. // W3EE - End
  6965.  
  6966. public function GetToxicityDamageThreshold() : float
  6967. {
  6968. var ret : float;
  6969.  
  6970. ret = theGame.params.TOXICITY_DAMAGE_THRESHOLD;
  6971.  
  6972. // W3EE - Begin
  6973. if( GetCurrentStateName() == 'W3EEMeditation' )
  6974. ret += GetStatMax(BCS_Toxicity) * 0.2f;
  6975.  
  6976. /*
  6977. if(CanUseSkill(S_Alchemy_s01))
  6978. ret += CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s01, 'threshold', false, true)) * GetSkillLevel(S_Alchemy_s01);
  6979. */
  6980. // W3EE - End
  6981.  
  6982. return ret;
  6983. }
  6984.  
  6985.  
  6986.  
  6987. public final function AddToxicityOffset( val : float )
  6988. {
  6989. ((W3PlayerAbilityManager)abilityManager).AddToxicityOffset(val);
  6990. }
  6991.  
  6992. public final function SetToxicityOffset( val : float )
  6993. {
  6994. ((W3PlayerAbilityManager)abilityManager).SetToxicityOffset(val);
  6995. }
  6996.  
  6997. public final function RemoveToxicityOffset( val : float )
  6998. {
  6999. ((W3PlayerAbilityManager)abilityManager).RemoveToxicityOffset(val);
  7000. }
  7001.  
  7002. public final function GetToxicityOffset() : float
  7003. {
  7004. return ((W3PlayerAbilityManager)abilityManager).GetToxicityOffset();
  7005. }
  7006.  
  7007.  
  7008. public final function CalculatePotionDuration(item : SItemUniqueId, isDecoction : bool, optional itemName : name) : float
  7009. {
  7010. var duration, skillPassiveMod, mutagenSkillMod : float;
  7011. var val, min, max : SAbilityAttributeValue;
  7012.  
  7013.  
  7014. if(inv.IsIdValid(item))
  7015. {
  7016. duration = CalculateAttributeValue(inv.GetItemAttributeValue(item, 'duration'));
  7017. }
  7018. else
  7019. {
  7020. theGame.GetDefinitionsManager().GetItemAttributeValueNoRandom(itemName, true, 'duration', min, max);
  7021. duration = CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  7022. }
  7023.  
  7024. // W3EE - Begin
  7025. if( isDecoction )
  7026. {
  7027. if( Options().GetGlobalDecoctionDuration()() )
  7028. duration = Options().GetGlobalDecoctionDuration();
  7029. else
  7030. if( Options().GetMinimumDecoctionDuration() )
  7031. duration += Options().GetMinimumDecoctionDuration();
  7032.  
  7033. if( Options().GetDecoctionDurationMult() )
  7034. duration *= Options().GetDecoctionDurationMult();
  7035.  
  7036. if( IsMeditating() )
  7037. duration *= 1.1f;
  7038. }
  7039. else
  7040. {
  7041. if( Options().GetGlobalPotionDuration() )
  7042. duration = Options().GetGlobalPotionDuration();
  7043. else
  7044. if( Options().GetMinimumPotionDuration() )
  7045. duration += Options().GetMinimumPotionDuration();
  7046.  
  7047. if( Options().GetPotionDurationMult() && !isDecoction )
  7048. duration *= Options().GetPotionDurationMult();
  7049.  
  7050. if( IsMeditating() )
  7051. duration *= 1.2f;
  7052.  
  7053. duration *= 1.f + 0.1f * GetSkillLevel(S_Alchemy_s02);
  7054. }
  7055.  
  7056. skillPassiveMod = CalculateAttributeValue(GetAttributeValue('potion_duration'));
  7057. if( isDecoction )
  7058. {
  7059. if (CanUseSkill(S_Alchemy_s14) )
  7060. {
  7061. val = GetSkillAttributeValue(S_Alchemy_s14, 'duration', false, true);
  7062. mutagenSkillMod = val.valueMultiplicative * GetSkillLevel(S_Alchemy_s14);
  7063. duration *= (1 + mutagenSkillMod);
  7064. }
  7065. }
  7066. else
  7067. duration = duration * (1 + skillPassiveMod);
  7068. // W3EE - End
  7069.  
  7070. return duration;
  7071. }
  7072.  
  7073. // W3EE - Begin
  7074. public function ToxicityLowEnoughToDrinkPotion( slotid : EEquipmentSlots, optional itemId : SItemUniqueId ) : bool
  7075. {
  7076. var item : SItemUniqueId;
  7077. // var maxTox : float;
  7078. // var potionToxicity : float;
  7079. var toxicityOffset : float;
  7080. var effectType : EEffectType;
  7081. var customAbilityName : name;
  7082.  
  7083. if(itemId != GetInvalidUniqueId())
  7084. item = itemId;
  7085. else
  7086. item = itemSlots[slotid];
  7087.  
  7088. inv.GetPotionItemBuffData(item, effectType, customAbilityName);
  7089.  
  7090. return HasFreeToxicityToDrinkPotion(item, effectType, toxicityOffset);
  7091. }
  7092.  
  7093. public function GetFinalPotionToxicity( finalPotionToxicity : float ) : float
  7094. {
  7095. var i : int;
  7096. var buffs : array<CBaseGameplayEffect>;
  7097.  
  7098. buffs = GetPotionBuffs();
  7099.  
  7100. if( finalPotionToxicity > 0.f )
  7101. {
  7102. for(i=0; i<buffs.Size(); i+=1)
  7103. {
  7104. if( (W3Potion_GoldenOriole)buffs[i] )
  7105. continue;
  7106.  
  7107. if( GetCurrentStateName() == 'W3EEMeditation' && GetSkillLevel(S_Perk_12) > 0 )
  7108. finalPotionToxicity *= 1.1f;
  7109. else
  7110. finalPotionToxicity *= 1.25f;
  7111. }
  7112. }
  7113.  
  7114. return finalPotionToxicity;
  7115.  
  7116. }
  7117.  
  7118. public final function HasFreeToxicityToDrinkPotion( item : SItemUniqueId, effectType : EEffectType, out finalPotionToxicity : float ) : bool
  7119. {
  7120. var i : int;
  7121. var maxTox, toxicityOffset, adrenaline : float;
  7122. var costReduction, toxicity : SAbilityAttributeValue;
  7123.  
  7124. if( effectType == EET_WhiteHoney )
  7125. {
  7126. return true;
  7127. }
  7128.  
  7129. maxTox = abilityManager.GetStatMax(BCS_Toxicity);
  7130. toxicity = inv.GetItemAttributeValue(item, 'toxicity');
  7131. if( effectType == EET_GoldenOriole )
  7132. finalPotionToxicity = toxicity.valueAdditive;
  7133. else
  7134. finalPotionToxicity = GetFinalPotionToxicity(toxicity.valueAdditive);
  7135.  
  7136. toxicityOffset = CalculateAttributeValue(inv.GetItemAttributeValue(item, 'toxicity_offset'));
  7137. if( inv.ItemHasTag(item, 'Decoction') )
  7138. {
  7139. if( CanUseSkill(S_Alchemy_s14) )
  7140. finalPotionToxicity -= 5 * GetSkillLevel(S_Alchemy_s14);
  7141. }
  7142.  
  7143. if(abilityManager.GetStat(BCS_Toxicity, false) + finalPotionToxicity + toxicityOffset > maxTox )
  7144. {
  7145. return false;
  7146. }
  7147.  
  7148. return true;
  7149. }
  7150. // W3EE - End
  7151.  
  7152. public function DrinkPreparedPotion( slotid : EEquipmentSlots, optional itemId : SItemUniqueId )
  7153. {
  7154. var potParams : W3PotionParams;
  7155. var potionParams : SCustomEffectParams;
  7156. var factPotionParams : W3Potion_Fact_Params;
  7157. var adrenaline, hpGainValue, duration, finalPotionToxicity : float;
  7158. var ret : EEffectInteract;
  7159. var effectType : EEffectType;
  7160. var item : SItemUniqueId;
  7161. var customAbilityName, factId : name;
  7162. var atts : array<name>;
  7163. var i : int;
  7164. // W3EE - Begin
  7165. var toxicity : W3Effect_Toxicity;
  7166. // W3EE - End
  7167.  
  7168.  
  7169. if(itemId != GetInvalidUniqueId())
  7170. item = itemId;
  7171. else
  7172. item = itemSlots[slotid];
  7173.  
  7174. if(!inv.IsIdValid(item))
  7175. return;
  7176.  
  7177. if( inv.SingletonItemGetAmmo(item) <= 0 )
  7178. return;
  7179.  
  7180. inv.GetPotionItemBuffData(item, effectType, customAbilityName);
  7181. if( inv.ItemHasTag(item, 'Decoction') && HasDecoctionEffect() )
  7182. {
  7183. theSound.SoundEvent("gui_global_denied");
  7184. theGame.GetGuiManager().ShowNotification(GetLocStringByKeyExt("W3EE_DecoctionActive"), 2000.f, true);
  7185. return;
  7186. }
  7187.  
  7188. if( !HasFreeToxicityToDrinkPotion( item, effectType, finalPotionToxicity ) )
  7189. {
  7190. return;
  7191. }
  7192.  
  7193. if(effectType == EET_Fact)
  7194. {
  7195. inv.GetItemAttributes(item, atts);
  7196.  
  7197. for(i=0; i<atts.Size(); i+=1)
  7198. {
  7199. if(StrBeginsWith(NameToString(atts[i]), "fact_"))
  7200. {
  7201. factId = atts[i];
  7202. break;
  7203. }
  7204. }
  7205.  
  7206. factPotionParams = new W3Potion_Fact_Params in theGame;
  7207. factPotionParams.factName = factId;
  7208. factPotionParams.potionItemName = inv.GetItemName(item);
  7209.  
  7210. potionParams.buffSpecificParams = factPotionParams;
  7211. }
  7212. else
  7213. {
  7214. potParams = new W3PotionParams in theGame;
  7215. potParams.potionItemName = inv.GetItemName(item);
  7216.  
  7217. potionParams.buffSpecificParams = potParams;
  7218. }
  7219.  
  7220.  
  7221. duration = CalculatePotionDuration(item, inv.ItemHasTag( item, 'Decoction' ));
  7222.  
  7223.  
  7224. potionParams.effectType = effectType;
  7225. potionParams.creator = this;
  7226. potionParams.sourceName = "drank_potion";
  7227. potionParams.duration = duration;
  7228. potionParams.customAbilityName = customAbilityName;
  7229. ret = AddEffectCustom(potionParams);
  7230.  
  7231.  
  7232. if(factPotionParams)
  7233. delete factPotionParams;
  7234.  
  7235. Experience().AwardAlchemyUsageXP(inv.IsItemMutagenPotion(item), inv.IsItemPotion(item), inv.IsItemOil(item), inv.IsItemBomb(item));
  7236.  
  7237. // W3EE - Begin
  7238. Alchemy().AddSecondarySubstanceEffects(item);
  7239. inv.SingletonItemRemoveAmmo(item);
  7240. inv.AddAnItem('Empty vial', 1);
  7241. // W3EE - End
  7242.  
  7243. if(ret == EI_Pass || ret == EI_Override || ret == EI_Cumulate)
  7244. {
  7245. // W3EE - Begin
  7246. if( finalPotionToxicity > 0.f )
  7247. {
  7248. abilityManager.GainStat(BCS_Toxicity, finalPotionToxicity);
  7249. }
  7250. else
  7251. if( effectType == EET_WhiteHoney )
  7252. {
  7253. abilityManager.DrainToxicity(finalPotionToxicity * -1.f);
  7254. }
  7255.  
  7256. toxicity = (W3Effect_Toxicity)GetBuff(EET_Toxicity);
  7257. if( toxicity )
  7258. toxicity.AddToxicityEntry(effectType, finalPotionToxicity, duration);
  7259.  
  7260. /*if(CanUseSkill(S_Perk_13))
  7261. {
  7262. abilityManager.DrainFocus(adrenaline);
  7263. }*/
  7264. // W3EE - End
  7265.  
  7266. if (!IsEffectActive('invisible'))
  7267. {
  7268. PlayEffect('use_potion');
  7269. }
  7270.  
  7271. if ( inv.ItemHasTag( item, 'Decoction' ) )
  7272. {
  7273.  
  7274. theGame.GetGamerProfile().CheckTrialOfGrasses();
  7275.  
  7276.  
  7277. SetFailedFundamentalsFirstAchievementCondition(true);
  7278. }
  7279.  
  7280. // W3EE - Begin
  7281. /*
  7282. if(CanUseSkill(S_Alchemy_s02))
  7283. {
  7284. hpGainValue = ClampF(GetStatMax(BCS_Vitality) * CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s02, 'vitality_gain_perc', false, true)) * GetSkillLevel(S_Alchemy_s02), 0, GetStatMax(BCS_Vitality));
  7285. GainStat(BCS_Vitality, hpGainValue);
  7286. }
  7287.  
  7288.  
  7289. if(CanUseSkill(S_Alchemy_s04) && !skillBonusPotionEffect && (RandF() < CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s04, 'apply_chance', false, true)) * GetSkillLevel(S_Alchemy_s04)))
  7290. {
  7291. AddRandomPotionEffectFromAlch4Skill( effectType );
  7292. }
  7293. */
  7294. // W3EE - End
  7295.  
  7296. theGame.GetGamerProfile().SetStat(ES_ActivePotions, effectManager.GetPotionBuffsCount());
  7297. }
  7298.  
  7299. theTelemetry.LogWithLabel(TE_ELIXIR_USED, inv.GetItemName(item));
  7300.  
  7301. GetPoiseEffect().UpdateMaxPoise();
  7302.  
  7303. if(ShouldProcessTutorial('TutorialPotionAmmo'))
  7304. {
  7305. FactsAdd("tut_used_potion");
  7306. }
  7307.  
  7308. SetFailedFundamentalsFirstAchievementCondition(true);
  7309. }
  7310.  
  7311.  
  7312. private final function AddRandomPotionEffectFromAlch4Skill( currentlyDrankPotion : EEffectType )
  7313. {
  7314. var randomPotions : array<EEffectType>;
  7315. var currentPotion : CBaseGameplayEffect;
  7316. var effectsOld, effectsNew : array<CBaseGameplayEffect>;
  7317. var i, ind : int;
  7318. var duration : float;
  7319. var params : SCustomEffectParams;
  7320. var ret : EEffectInteract;
  7321.  
  7322.  
  7323. randomPotions.PushBack( EET_BlackBlood );
  7324. randomPotions.PushBack( EET_Blizzard );
  7325. randomPotions.PushBack( EET_FullMoon );
  7326. randomPotions.PushBack( EET_GoldenOriole );
  7327. // W3EE - Begin
  7328. //randomPotions.PushBack( EET_KillerWhale );
  7329. // W3EE - End
  7330. randomPotions.PushBack( EET_MariborForest );
  7331. randomPotions.PushBack( EET_PetriPhiltre );
  7332. randomPotions.PushBack( EET_Swallow );
  7333. randomPotions.PushBack( EET_TawnyOwl );
  7334. randomPotions.PushBack( EET_Thunderbolt );
  7335.  
  7336.  
  7337. randomPotions.Remove( currentlyDrankPotion );
  7338.  
  7339.  
  7340. ind = RandRange( randomPotions.Size() );
  7341.  
  7342.  
  7343. if( HasBuff( randomPotions[ ind ] ) )
  7344. {
  7345. currentPotion = GetBuff( randomPotions[ ind ] );
  7346. currentPotion.SetTimeLeft( currentPotion.GetInitialDurationAfterResists() );
  7347. }
  7348.  
  7349. else
  7350. {
  7351. duration = BonusPotionGetDurationFromXML( randomPotions[ ind ] );
  7352.  
  7353. if(duration > 0)
  7354. {
  7355. effectsOld = GetCurrentEffects();
  7356.  
  7357. params.effectType = randomPotions[ ind ];
  7358. params.creator = this;
  7359. params.sourceName = SkillEnumToName( S_Alchemy_s04 );
  7360. params.duration = duration;
  7361. ret = AddEffectCustom( params );
  7362.  
  7363.  
  7364. if( ret != EI_Undefined && ret != EI_Deny )
  7365. {
  7366. effectsNew = GetCurrentEffects();
  7367.  
  7368. ind = -1;
  7369. for( i=effectsNew.Size()-1; i>=0; i-=1)
  7370. {
  7371. if( !effectsOld.Contains( effectsNew[i] ) )
  7372. {
  7373. ind = i;
  7374. break;
  7375. }
  7376. }
  7377.  
  7378. if(ind > -1)
  7379. {
  7380. skillBonusPotionEffect = effectsNew[ind];
  7381. }
  7382. }
  7383. }
  7384. }
  7385. }
  7386.  
  7387.  
  7388. private function BonusPotionGetDurationFromXML(type : EEffectType) : float
  7389. {
  7390. var dm : CDefinitionsManagerAccessor;
  7391. var main, ingredients : SCustomNode;
  7392. var tmpName, typeName, itemName : name;
  7393. var abs : array<name>;
  7394. var min, max : SAbilityAttributeValue;
  7395. var tmpInt : int;
  7396. var temp : array<float>;
  7397. var i, temp2, temp3 : int;
  7398.  
  7399. dm = theGame.GetDefinitionsManager();
  7400. main = dm.GetCustomDefinition('alchemy_recipes');
  7401. typeName = EffectTypeToName(type);
  7402.  
  7403.  
  7404. for(i=0; i<main.subNodes.Size(); i+=1)
  7405. {
  7406. if(dm.GetCustomNodeAttributeValueName(main.subNodes[i], 'type_name', tmpName))
  7407. {
  7408.  
  7409. if(tmpName == typeName)
  7410. {
  7411. if(dm.GetCustomNodeAttributeValueInt(main.subNodes[i], 'level', tmpInt))
  7412. {
  7413.  
  7414. if(tmpInt == 1)
  7415. {
  7416. if(dm.GetCustomNodeAttributeValueName(main.subNodes[i], 'cookedItem_name', itemName))
  7417. {
  7418.  
  7419. if(IsNameValid(itemName))
  7420. {
  7421. break;
  7422. }
  7423. }
  7424. }
  7425. }
  7426. }
  7427. }
  7428. }
  7429.  
  7430. if(!IsNameValid(itemName))
  7431. return 0;
  7432.  
  7433.  
  7434. dm.GetItemAbilitiesWithWeights(itemName, true, abs, temp, temp2, temp3);
  7435. dm.GetAbilitiesAttributeValue(abs, 'duration', min, max);
  7436. return CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  7437. }
  7438.  
  7439. public function ClearSkillBonusPotionEffect()
  7440. {
  7441. skillBonusPotionEffect = NULL;
  7442. }
  7443.  
  7444. public function GetSkillBonusPotionEffect() : CBaseGameplayEffect
  7445. {
  7446. return skillBonusPotionEffect;
  7447. }
  7448.  
  7449.  
  7450.  
  7451.  
  7452.  
  7453.  
  7454.  
  7455. public final function HasRunewordActive(abilityName : name) : bool
  7456. {
  7457. var item : SItemUniqueId;
  7458. var hasRuneword : bool;
  7459.  
  7460. if(GetItemEquippedOnSlot(EES_SteelSword, item))
  7461. {
  7462. hasRuneword = inv.ItemHasAbility(item, abilityName);
  7463. }
  7464.  
  7465. if(!hasRuneword)
  7466. {
  7467. if(GetItemEquippedOnSlot(EES_SilverSword, item))
  7468. {
  7469. hasRuneword = inv.ItemHasAbility(item, abilityName);
  7470. }
  7471. }
  7472.  
  7473. return hasRuneword;
  7474. }
  7475.  
  7476. public final function GetShrineBuffs() : array<CBaseGameplayEffect>
  7477. {
  7478. var null : array<CBaseGameplayEffect>;
  7479.  
  7480. if(effectManager && effectManager.IsReady())
  7481. return effectManager.GetShrineBuffs();
  7482.  
  7483. return null;
  7484. }
  7485.  
  7486. // W3EE - Begin
  7487. event OnHolsteredItem( category : name, slotName : name )
  7488. {
  7489. if( slotName == 'r_weapon' )
  7490. {
  7491. if( category == 'steelsword' )
  7492. PauseRepairBuffs(GetEquippedSword(true));
  7493. else
  7494. PauseRepairBuffs(GetEquippedSword(false));
  7495. }
  7496.  
  7497. super.OnHolsteredItem(category, slotName);
  7498. }
  7499.  
  7500. private function GetEnhancementsOnItem( item : SItemUniqueId ) : array<W3RepairObjectEnhancement>
  7501. {
  7502. var buffs : array<CBaseGameplayEffect>;
  7503. var buff : W3RepairObjectEnhancement;
  7504. var ret : array<W3RepairObjectEnhancement>;
  7505. var i : int;
  7506.  
  7507. if( inv.IsItemAnyArmor(item) )
  7508. {
  7509. buffs = GetBuffs(EET_EnhancedArmor, inv.GetItemName(item));
  7510. for(i=0; i<buffs.Size(); i+=1)
  7511. {
  7512. buff = (W3RepairObjectEnhancement)buffs[i];
  7513. if( buff.GetItemID() == item )
  7514. ret.PushBack(buff);
  7515. }
  7516. }
  7517. else
  7518. if( inv.IsItemWeapon(item) )
  7519. {
  7520. buffs = GetBuffs(EET_EnhancedWeapon, inv.GetItemName(item));
  7521. for(i=0; i<buffs.Size(); i+=1)
  7522. {
  7523. buff = (W3RepairObjectEnhancement)buffs[i];
  7524. if( buff.GetItemID() == item )
  7525. ret.PushBack(buff);
  7526. }
  7527. }
  7528.  
  7529. return ret;
  7530. }
  7531.  
  7532. public final function ManageRepairBuffs( action : W3Action_Attack, weaponId : SItemUniqueId, isHeavyAttack : bool )
  7533. {
  7534. var buffs : array<W3RepairObjectEnhancement>;
  7535. var weapons : array<SItemUniqueId>;
  7536. var armorId : SItemUniqueId;
  7537. var i, j : int;
  7538.  
  7539. if( action.IsDoTDamage() || !action.DealsAnyDamage() )
  7540. return;
  7541.  
  7542. if( action.victim == this )
  7543. {
  7544. if( action.IsActionMelee() || action.IsActionRanged() )
  7545. {
  7546. if( action.IsParried() || action.IsCountered() )
  7547. {
  7548. weapons = inv.GetHeldWeapons();
  7549. for(i=0; i<weapons.Size(); i+=1)
  7550. {
  7551. if( inv.IsIdValid(weapons[i]) && (inv.IsItemSteelSwordUsableByPlayer(weapons[i]) || inv.IsItemSilverSwordUsableByPlayer(weapons[i])) )
  7552. {
  7553. buffs = GetEnhancementsOnItem(weapons[i]);
  7554. for(j=0; j<buffs.Size(); j+=1)
  7555. buffs[j].ReduceAmmo(isHeavyAttack);
  7556.  
  7557. break;
  7558. }
  7559. }
  7560. }
  7561. else
  7562. {
  7563. if( GetItemEquippedOnSlot(EES_Armor, armorId) )
  7564. {
  7565. buffs = GetEnhancementsOnItem(armorId);
  7566. for(i=0; i<buffs.Size(); i+=1)
  7567. buffs[i].ReduceAmmo(isHeavyAttack);
  7568. }
  7569. }
  7570. }
  7571. }
  7572. else
  7573. {
  7574. if( action.IsActionMelee() )
  7575. {
  7576. buffs = GetEnhancementsOnItem(weaponId);
  7577. for(i=0; i<buffs.Size(); i+=1)
  7578. buffs[i].ReduceAmmo(isHeavyAttack);
  7579. }
  7580. }
  7581. }
  7582.  
  7583. public final function ResumeRepairBuffs( item : SItemUniqueId )
  7584. {
  7585. var buffs : array<W3RepairObjectEnhancement>;
  7586. var i : int;
  7587.  
  7588. buffs = GetEnhancementsOnItem(item);
  7589. for(i=0; i<buffs.Size(); i+=1)
  7590. buffs[i].Resume('');
  7591. }
  7592.  
  7593. public final function PauseRepairBuffs( item : SItemUniqueId )
  7594. {
  7595. var buffs : array<W3RepairObjectEnhancement>;
  7596. var i : int;
  7597.  
  7598. buffs = GetEnhancementsOnItem(item);
  7599. for(i=0; i<buffs.Size(); i+=1)
  7600. buffs[i].Pause('', true);
  7601. }
  7602.  
  7603. public final function RemoveRepairBuffs( item : SItemUniqueId )
  7604. {
  7605. var buffs : array<W3RepairObjectEnhancement>;
  7606. var i : int;
  7607.  
  7608. buffs = GetEnhancementsOnItem(item);
  7609. for(i=0; i<buffs.Size(); i+=1)
  7610. RemoveEffect(buffs[i]);
  7611. }
  7612.  
  7613. public final function RemoveAllRepairBuffs()
  7614. {
  7615. var buffs : array<CBaseGameplayEffect>;
  7616. var i : int;
  7617.  
  7618. buffs = GetBuffs(EET_EnhancedWeapon);
  7619. for(i=0; i<buffs.Size(); i+=1)
  7620. RemoveEffect(buffs[i]);
  7621.  
  7622. buffs = GetBuffs(EET_EnhancedArmor);
  7623. for(i=0; i<buffs.Size(); i+=1)
  7624. RemoveEffect(buffs[i]);
  7625. }
  7626.  
  7627. public final function AddRepairObjectBuff( armor : bool, weapon : bool ) : bool
  7628. {
  7629. var effect : SCustomEffectParams;
  7630. var effectParams : W3EnhanceBuffParams;
  7631. var steel, silver : SItemUniqueId;
  7632. var added : bool = false;
  7633.  
  7634. if( weapon )
  7635. {
  7636. effect.effectType = EET_EnhancedWeapon;
  7637. effect.creator = this;
  7638. if( GetItemEquippedOnSlot(EES_SilverSword, silver) )
  7639. {
  7640. effectParams = new W3EnhanceBuffParams in this;
  7641. effectParams.item = silver;
  7642. effect.sourceName = inv.GetItemName(silver);
  7643. effect.buffSpecificParams = effectParams;
  7644. AddEffectCustom(effect);
  7645. delete effectParams;
  7646. added = true;
  7647. if( !inv.IsItemHeld(silver) )
  7648. PauseRepairBuffs(silver);
  7649. }
  7650.  
  7651. if( GetItemEquippedOnSlot(EES_SteelSword, steel) )
  7652. {
  7653. effectParams = new W3EnhanceBuffParams in this;
  7654. effectParams.item = steel;
  7655. effect.sourceName = inv.GetItemName(steel);
  7656. effect.buffSpecificParams = effectParams;
  7657. AddEffectCustom(effect);
  7658. delete effectParams;
  7659. added = true;
  7660. if( !inv.IsItemHeld(steel) )
  7661. PauseRepairBuffs(steel);
  7662. }
  7663. }
  7664. else
  7665. if( armor )
  7666. {
  7667. effect.effectType = EET_EnhancedArmor;
  7668. effect.creator = this;
  7669. if( GetItemEquippedOnSlot(EES_Armor, steel) )
  7670. {
  7671. effectParams = new W3EnhanceBuffParams in this;
  7672. effectParams.item = steel;
  7673. effect.sourceName = inv.GetItemName(steel);
  7674. effect.buffSpecificParams = effectParams;
  7675. AddEffectCustom(effect);
  7676. delete effectParams;
  7677. added = true;
  7678. }
  7679. }
  7680.  
  7681. return added;
  7682. }
  7683. // W3EE - End
  7684.  
  7685. public function StartCSAnim(buff : CBaseGameplayEffect) : bool
  7686. {
  7687.  
  7688. if(IsAnyQuenActive() && (W3CriticalDOTEffect)buff)
  7689. return false;
  7690.  
  7691. return super.StartCSAnim(buff);
  7692. }
  7693.  
  7694. public function GetPotionBuffLevel(effectType : EEffectType) : int
  7695. {
  7696. if(effectManager && effectManager.IsReady())
  7697. return effectManager.GetPotionBuffLevel(effectType);
  7698.  
  7699. return 0;
  7700. }
  7701.  
  7702.  
  7703.  
  7704.  
  7705.  
  7706.  
  7707.  
  7708. event OnLevelGained(currentLevel : int, show : bool)
  7709. {
  7710. var hud : CR4ScriptedHud;
  7711. hud = (CR4ScriptedHud)theGame.GetHud();
  7712.  
  7713. if(abilityManager && abilityManager.IsInitialized())
  7714. {
  7715. ((W3PlayerAbilityManager)abilityManager).OnLevelGained(currentLevel);
  7716. }
  7717.  
  7718. // W3EE - Begin
  7719. /*
  7720. if ( theGame.GetDifficultyMode() != EDM_Hardcore )
  7721. {
  7722. Heal(GetStatMax(BCS_Vitality));
  7723. }
  7724. */
  7725. // W3EE - End
  7726.  
  7727. if(currentLevel >= 35)
  7728. {
  7729. theGame.GetGamerProfile().AddAchievement(EA_Immortal);
  7730. }
  7731.  
  7732. if ( hud && currentLevel < levelManager.GetMaxLevel() && FactsQuerySum( "DebugNoLevelUpUpdates" ) == 0 )
  7733. {
  7734. hud.OnLevelUpUpdate(currentLevel, show);
  7735. }
  7736.  
  7737. theGame.RequestAutoSave( "level gained", false );
  7738. }
  7739.  
  7740. public function GetSignStats(skill : ESkill, out damageType : name, out damageVal : float, out spellPower : SAbilityAttributeValue)
  7741. {
  7742. var i, size : int;
  7743. var dm : CDefinitionsManagerAccessor;
  7744. var attrs : array<name>;
  7745.  
  7746. spellPower = GetPowerStatValue(CPS_SpellPower);
  7747.  
  7748. dm = theGame.GetDefinitionsManager();
  7749. dm.GetAbilityAttributes(GetSkillAbilityName(skill), attrs);
  7750. size = attrs.Size();
  7751.  
  7752. for( i = 0; i < size; i += 1 )
  7753. {
  7754. if( IsDamageTypeNameValid(attrs[i]) )
  7755. {
  7756. damageVal = CalculateAttributeValue(GetSkillAttributeValue(skill, attrs[i], false, true));
  7757. damageType = attrs[i];
  7758. break;
  7759. }
  7760. }
  7761. }
  7762.  
  7763.  
  7764. public function SetIgnorePainMaxVitality(val : float)
  7765. {
  7766. if(abilityManager && abilityManager.IsInitialized())
  7767. abilityManager.SetStatPointMax(BCS_Vitality, val);
  7768. }
  7769.  
  7770. event OnAnimEvent_ActionBlend( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  7771. {
  7772. if ( animEventType == AET_DurationStart && !disableActionBlend )
  7773. {
  7774. if ( this.IsCastingSign() )
  7775. ProcessSignEvent( 'cast_end' );
  7776.  
  7777.  
  7778. FindMoveTarget();
  7779. SetCanPlayHitAnim( true );
  7780. this.SetBIsCombatActionAllowed( true );
  7781.  
  7782. if ( this.GetFinisherVictim() && this.GetFinisherVictim().HasAbility( 'ForceFinisher' ) && !isInFinisher )
  7783. {
  7784. this.GetFinisherVictim().SignalGameplayEvent( 'Finisher' );
  7785. }
  7786. else if (this.BufferCombatAction != EBAT_EMPTY )
  7787. {
  7788.  
  7789.  
  7790.  
  7791. if ( !IsCombatMusicEnabled() )
  7792. {
  7793. SetCombatActionHeading( ProcessCombatActionHeading( this.BufferCombatAction ) );
  7794. FindTarget();
  7795. UpdateDisplayTarget( true );
  7796. }
  7797.  
  7798. if ( AllowAttack( GetTarget(), this.BufferCombatAction ) )
  7799. this.ProcessCombatActionBuffer();
  7800. }
  7801. else
  7802. {
  7803.  
  7804. ResumeStaminaRegen( 'InsideCombatAction' );
  7805.  
  7806.  
  7807.  
  7808. }
  7809. }
  7810. else if ( disableActionBlend )
  7811. {
  7812. disableActionBlend = false;
  7813. }
  7814. }
  7815.  
  7816.  
  7817. event OnAnimEvent_Sign( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  7818. {
  7819. if( animEventType == AET_Tick )
  7820. {
  7821. ProcessSignEvent( animEventName );
  7822. }
  7823. }
  7824.  
  7825. event OnAnimEvent_Throwable( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  7826. {
  7827. var thrownEntity : CThrowable;
  7828.  
  7829. thrownEntity = (CThrowable)EntityHandleGet( thrownEntityHandle );
  7830.  
  7831. if ( inv.IsItemCrossbow( inv.GetItemFromSlot('l_weapon') ) && rangedWeapon.OnProcessThrowEvent( animEventName ) )
  7832. {
  7833. return true;
  7834. }
  7835. else if( thrownEntity && IsThrowingItem() && thrownEntity.OnProcessThrowEvent( animEventName ) )
  7836. {
  7837. return true;
  7838. }
  7839. }
  7840.  
  7841. event OnTaskSyncAnim( npc : CNewNPC, animNameLeft : name )
  7842. {
  7843. var tmpBool : bool;
  7844. var tmpName : name;
  7845. var damage, points, resistance : float;
  7846. var min, max : SAbilityAttributeValue;
  7847. var mc : EMonsterCategory;
  7848.  
  7849. super.OnTaskSyncAnim( npc, animNameLeft );
  7850.  
  7851. if( animNameLeft == 'BruxaBite' && IsMutationActive( EPMT_Mutation4 ) )
  7852. {
  7853. theGame.GetMonsterParamsForActor( npc, mc, tmpName, tmpBool, tmpBool, tmpBool );
  7854.  
  7855. if( mc == MC_Vampire )
  7856. {
  7857. GetResistValue( CDS_BleedingRes, points, resistance );
  7858.  
  7859. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'BleedingEffect', 'DirectDamage', min, max );
  7860. damage = MaxF( 0.f, max.valueMultiplicative * GetMaxHealth() - points );
  7861.  
  7862. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'BleedingEffect', 'duration', min, max );
  7863. damage *= min.valueAdditive * ( 1 - MinF( 1.f, resistance ) );
  7864.  
  7865. if( damage > 0.f )
  7866. {
  7867. npc.AddAbility( 'Mutation4BloodDebuff' );
  7868. ProcessActionMutation4ReturnedDamage( damage, npc, EAHA_ForceNo );
  7869. npc.AddTimer( 'RemoveMutation4BloodDebuff', 15.f, , , , , true );
  7870. }
  7871. }
  7872. }
  7873. }
  7874.  
  7875.  
  7876. public function ProcessActionMutation4ReturnedDamage( damageDealt : float, attacker : CActor, hitAnimationType : EActionHitAnim, optional action : W3DamageAction ) : bool
  7877. {
  7878. var customParams : SCustomEffectParams;
  7879. var currToxicity : float;
  7880. var min, max, customDamageValue : SAbilityAttributeValue;
  7881. var dm : CDefinitionsManagerAccessor;
  7882. var animAction : W3DamageAction;
  7883.  
  7884. if( damageDealt <= 0 )
  7885. {
  7886. return false;
  7887. }
  7888.  
  7889. if( action )
  7890. {
  7891. action.SetMutation4Triggered();
  7892. }
  7893.  
  7894. // W3EE - Begin
  7895. dm = theGame.GetDefinitionsManager();
  7896. currToxicity = GetStatPercents( BCS_Toxicity );
  7897.  
  7898. dm.GetAbilityAttributeValue( 'AcidEffect', 'DirectDamage', min, max );
  7899. //customDamageValue.valueAdditive = damageDealt * min.valueAdditive;
  7900.  
  7901. /*if( currToxicity > 0 )
  7902. {*/
  7903. customDamageValue.valueAdditive = MaxF(5.f, currToxicity * GetStat(BCS_Vitality) * 0.5f);
  7904. //}
  7905. // W3EE - End
  7906.  
  7907. dm.GetAbilityAttributeValue( 'AcidEffect', 'duration', min, max );
  7908. customDamageValue.valueAdditive /= min.valueAdditive;
  7909.  
  7910. customParams.effectType = EET_Acid;
  7911. customParams.effectValue = customDamageValue;
  7912. customParams.duration = min.valueAdditive;
  7913. customParams.creator = this;
  7914. customParams.sourceName = 'Mutation4';
  7915.  
  7916. attacker.AddEffectCustom( customParams );
  7917. attacker.ApplyPoisoning(2, this, "Mutation4", true);
  7918.  
  7919. animAction = new W3DamageAction in theGame;
  7920. animAction.Initialize( this, attacker, NULL, 'Mutation4', EHRT_Reflect, CPS_Undefined, true, false, false, false );
  7921. animAction.SetCannotReturnDamage( true );
  7922. animAction.SetCanPlayHitParticle( false );
  7923. animAction.SetHitAnimationPlayType( hitAnimationType );
  7924. theGame.damageMgr.ProcessAction( animAction );
  7925. delete animAction;
  7926.  
  7927. theGame.MutationHUDFeedback( MFT_PlayOnce );
  7928.  
  7929. return true;
  7930. }
  7931.  
  7932. event OnPlayerActionEnd()
  7933. {
  7934. var l_i : int;
  7935. var l_bed : W3WitcherBed;
  7936.  
  7937. l_i = (int)GetBehaviorVariable( 'playerExplorationAction' );
  7938.  
  7939. if( l_i == PEA_GoToSleep )
  7940. {
  7941. l_bed = (W3WitcherBed)theGame.GetEntityByTag( 'witcherBed' );
  7942. BlockAllActions( 'WitcherBed', false );
  7943. l_bed.ApplyAppearance( "collision" );
  7944. l_bed.GotoState( 'WakeUp' );
  7945. theGame.ReleaseNoSaveLock( l_bed.m_bedSaveLock );
  7946.  
  7947.  
  7948. substateManager.m_MovementCorrectorO.disallowRotWhenGoingToSleep = false;
  7949. }
  7950.  
  7951. super.OnPlayerActionEnd();
  7952. }
  7953.  
  7954. event OnPlayerActionStartFinished()
  7955. {
  7956. var l_initData : W3SingleMenuInitData;
  7957. var l_i : int;
  7958.  
  7959. l_i = (int)GetBehaviorVariable( 'playerExplorationAction' );
  7960.  
  7961. if( l_i == PEA_GoToSleep )
  7962. {
  7963. l_initData = new W3SingleMenuInitData in this;
  7964. l_initData.SetBlockOtherPanels( true );
  7965. l_initData.ignoreSaveSystem = true;
  7966. l_initData.ignoreMeditationCheck = true;
  7967. l_initData.setDefaultState( '' );
  7968. l_initData.isBonusMeditationAvailable = true;
  7969. l_initData.fixedMenuName = 'MeditationClockMenu';
  7970.  
  7971. theGame.RequestMenuWithBackground( 'MeditationClockMenu', 'CommonMenu', l_initData );
  7972. }
  7973.  
  7974. super.OnPlayerActionStartFinished();
  7975. }
  7976.  
  7977. public function IsInCombatAction_SpecialAttack() : bool
  7978. {
  7979. if ( IsInCombatAction() && ( GetCombatAction() == EBAT_SpecialAttack_Light || GetCombatAction() == EBAT_SpecialAttack_Heavy ) )
  7980. return true;
  7981. else
  7982. return false;
  7983. }
  7984.  
  7985. public function IsInCombatAction_SpecialAttackLight() : bool
  7986. {
  7987. if ( IsInCombatAction() && GetCombatAction() == EBAT_SpecialAttack_Light )
  7988. return true;
  7989. else
  7990. return false;
  7991. }
  7992.  
  7993. public function IsInCombatAction_SpecialAttackHeavy() : bool
  7994. {
  7995. if ( IsInCombatAction() && GetCombatAction() == EBAT_SpecialAttack_Heavy )
  7996. return true;
  7997. else
  7998. return false;
  7999. }
  8000.  
  8001. protected function WhenCombatActionIsFinished()
  8002. {
  8003. super.WhenCombatActionIsFinished();
  8004. RemoveTimer( 'ProcessAttackTimer' );
  8005. RemoveTimer( 'AttackTimerEnd' );
  8006. CastSignAbort();
  8007. specialAttackCamera = false;
  8008. this.OnPerformSpecialAttack( true, false );
  8009. }
  8010.  
  8011. // W3EE - Begin
  8012. private var isCurrentlyRolling : bool;
  8013. public function SetIsCurrentlyDodging( enable : bool, optional isRolling : bool )
  8014. {
  8015. isCurrentlyRolling = isRolling;
  8016. super.SetIsCurrentlyDodging(enable, isRolling);
  8017. }
  8018.  
  8019. event OnCombatActionStart()
  8020. {
  8021. var combatActionType : float = GetBehaviorVariable('combatActionType', -1);
  8022.  
  8023. if( (combatActionType >= 0 && combatActionType <= 3) || combatActionType == 9 )
  8024. {
  8025. Combat().GetActionType();
  8026. Combat().CombatSpeedModule();
  8027. }
  8028.  
  8029. super.OnCombatActionStart();
  8030. }
  8031.  
  8032. event OnCombatActionEnd()
  8033. {
  8034. ResetDodgeState();
  8035. isCurrentlyRolling = false;
  8036. Combat().RemovePlayerSpeedMult();
  8037. ResetCustomAnimationSpeedMult();
  8038. //RemoveCustomOrientationTarget('Signs');
  8039.  
  8040. CleanCombatActionBuffer();
  8041. super.OnCombatActionEnd();
  8042.  
  8043. RemoveTemporarySkills();
  8044. }
  8045. // W3EE - End
  8046.  
  8047. event OnCombatActionFriendlyEnd()
  8048. {
  8049. if ( IsCastingSign() )
  8050. {
  8051. SetBehaviorVariable( 'IsCastingSign', 0 );
  8052. SetCurrentlyCastSign( ST_None, NULL );
  8053. LogChannel( 'ST_None', "ST_None" );
  8054. }
  8055.  
  8056. super.OnCombatActionFriendlyEnd();
  8057. }
  8058.  
  8059. public function GetPowerStatValue( stat : ECharacterPowerStats, optional ablName : name, optional ignoreDeath : bool ) : SAbilityAttributeValue
  8060. {
  8061. var result : SAbilityAttributeValue;
  8062.  
  8063.  
  8064. result = super.GetPowerStatValue( stat, ablName, ignoreDeath );
  8065. ApplyMutation10StatBoost( result );
  8066.  
  8067. return result;
  8068. }
  8069.  
  8070.  
  8071.  
  8072. timer function OpenRadialMenu( time: float, id : int )
  8073. {
  8074.  
  8075. if( GetBIsCombatActionAllowed() && !IsUITakeInput() )
  8076. {
  8077. bShowRadialMenu = true;
  8078. }
  8079.  
  8080. this.RemoveTimer('OpenRadialMenu');
  8081. }
  8082.  
  8083. public function OnAddRadialMenuOpenTimer( )
  8084. {
  8085.  
  8086.  
  8087.  
  8088.  
  8089.  
  8090. this.AddTimer('OpenRadialMenu', _HoldBeforeOpenRadialMenuTime * theGame.GetTimeScale() );
  8091.  
  8092. }
  8093.  
  8094. public function SetShowRadialMenuOpenFlag( bSet : bool )
  8095. {
  8096.  
  8097. bShowRadialMenu = bSet;
  8098. }
  8099.  
  8100. public function OnRemoveRadialMenuOpenTimer()
  8101. {
  8102.  
  8103. this.RemoveTimer('OpenRadialMenu');
  8104. }
  8105.  
  8106. public function ResetRadialMenuOpenTimer()
  8107. {
  8108.  
  8109. this.RemoveTimer('OpenRadialMenu');
  8110. if( GetBIsCombatActionAllowed() )
  8111. {
  8112.  
  8113.  
  8114. AddTimer('OpenRadialMenu', _HoldBeforeOpenRadialMenuTime * theGame.GetTimeScale() );
  8115. }
  8116. }
  8117.  
  8118.  
  8119.  
  8120. timer function ResendCompanionDisplayName(dt : float, id : int)
  8121. {
  8122. var hud : CR4ScriptedHud;
  8123. var companionModule : CR4HudModuleCompanion;
  8124.  
  8125. hud = (CR4ScriptedHud)theGame.GetHud();
  8126. if( hud )
  8127. {
  8128. companionModule = (CR4HudModuleCompanion)hud.GetHudModule("CompanionModule");
  8129. if( companionModule )
  8130. {
  8131. companionModule.ResendDisplayName();
  8132. }
  8133. }
  8134. }
  8135.  
  8136. timer function ResendCompanionDisplayNameSecond(dt : float, id : int)
  8137. {
  8138. var hud : CR4ScriptedHud;
  8139. var companionModule : CR4HudModuleCompanion;
  8140.  
  8141. hud = (CR4ScriptedHud)theGame.GetHud();
  8142. if( hud )
  8143. {
  8144. companionModule = (CR4HudModuleCompanion)hud.GetHudModule("CompanionModule");
  8145. if( companionModule )
  8146. {
  8147. companionModule.ResendDisplayNameSecond();
  8148. }
  8149. }
  8150. }
  8151.  
  8152. public function RemoveCompanionDisplayNameTimer()
  8153. {
  8154. this.RemoveTimer('ResendCompanionDisplayName');
  8155. }
  8156.  
  8157. public function RemoveCompanionDisplayNameTimerSecond()
  8158. {
  8159. this.RemoveTimer('ResendCompanionDisplayNameSecond');
  8160. }
  8161.  
  8162.  
  8163. public function GetCompanionNPCTag() : name
  8164. {
  8165. return companionNPCTag;
  8166. }
  8167.  
  8168. public function SetCompanionNPCTag( value : name )
  8169. {
  8170. companionNPCTag = value;
  8171. }
  8172.  
  8173. public function GetCompanionNPCTag2() : name
  8174. {
  8175. return companionNPCTag2;
  8176. }
  8177.  
  8178. public function SetCompanionNPCTag2( value : name )
  8179. {
  8180. companionNPCTag2 = value;
  8181. }
  8182.  
  8183. public function GetCompanionNPCIconPath() : string
  8184. {
  8185. return companionNPCIconPath;
  8186. }
  8187.  
  8188. public function SetCompanionNPCIconPath( value : string )
  8189. {
  8190. companionNPCIconPath = value;
  8191. }
  8192.  
  8193. public function GetCompanionNPCIconPath2() : string
  8194. {
  8195. return companionNPCIconPath2;
  8196. }
  8197.  
  8198. public function SetCompanionNPCIconPath2( value : string )
  8199. {
  8200. companionNPCIconPath2 = value;
  8201. }
  8202.  
  8203.  
  8204.  
  8205. public function ReactToBeingHit(damageAction : W3DamageAction, optional buffNotApplied : bool) : bool
  8206. {
  8207. var chance : float;
  8208. var procQuen : W3SignEntity;
  8209.  
  8210. if(!damageAction.IsDoTDamage() && damageAction.DealsAnyDamage())
  8211. {
  8212. if(inv.IsItemBomb(selectedItemId))
  8213. {
  8214. BombThrowAbort();
  8215. }
  8216. else
  8217. {
  8218.  
  8219. ThrowingAbort();
  8220. }
  8221. }
  8222.  
  8223. // W3EE - Begin
  8224. if(damageAction.IsActionRanged())
  8225. {
  8226. chance = CalculateAttributeValue(GetAttributeValue('quen_chance_on_projectile'));
  8227. if(chance > 0)
  8228. {
  8229. chance = ClampF(chance, 0, 1);
  8230.  
  8231. if(RandF() < chance)
  8232. {
  8233. procQuen = (W3QuenEntity)theGame.CreateEntity(signs[ST_Quen].template, GetWorldPosition(), GetWorldRotation() );
  8234. procQuen.Init(signOwner, signs[ST_Quen].entity, true );
  8235. procQuen.OnStarted();
  8236. procQuen.OnThrowing();
  8237. procQuen.OnEnded();
  8238. }
  8239. }
  8240. }
  8241.  
  8242.  
  8243. if( !damageAction.IsDoTDamage() )
  8244. MeditationForceAbort(true);
  8245. // W3EE - End
  8246.  
  8247.  
  8248. if(IsDoingSpecialAttack(false))
  8249. damageAction.SetHitAnimationPlayType(EAHA_ForceNo);
  8250.  
  8251. return super.ReactToBeingHit(damageAction, buffNotApplied);
  8252. }
  8253.  
  8254. protected function ShouldPauseHealthRegenOnHit() : bool
  8255. {
  8256. // W3EE - Begin
  8257. if( ( HasBuff( EET_Swallow ) && GetPotionBuffLevel( EET_Swallow ) >= 3 ) /*|| HasBuff( EET_Runeword8 )*/ || HasBuff( EET_Mutation11Buff ) )
  8258. // W3EE - End
  8259. {
  8260. return false;
  8261. }
  8262.  
  8263. return true;
  8264. }
  8265.  
  8266. public function SetMappinToHighlight( mappinName : name, mappinState : bool )
  8267. {
  8268. var mappinDef : SHighlightMappin;
  8269. mappinDef.MappinName = mappinName;
  8270. mappinDef.MappinState = mappinState;
  8271. MappinToHighlight.PushBack(mappinDef);
  8272. }
  8273.  
  8274. public function ClearMappinToHighlight()
  8275. {
  8276. MappinToHighlight.Clear();
  8277. }
  8278.  
  8279. public function CastSignAbort()
  8280. {
  8281. if( currentlyCastSign != ST_None && signs[currentlyCastSign].entity)
  8282. {
  8283. signs[currentlyCastSign].entity.OnSignAborted();
  8284. }
  8285.  
  8286.  
  8287. }
  8288.  
  8289. event OnBlockingSceneStarted( scene: CStoryScene )
  8290. {
  8291. var med : W3PlayerWitcherStateMeditationWaiting;
  8292.  
  8293.  
  8294. med = (W3PlayerWitcherStateMeditationWaiting)GetCurrentState();
  8295. if(med)
  8296. {
  8297. med.StopRequested(true);
  8298. }
  8299.  
  8300. super.OnBlockingSceneStarted( scene );
  8301. }
  8302.  
  8303.  
  8304.  
  8305.  
  8306.  
  8307. public function GetHorseManager() : W3HorseManager
  8308. {
  8309. return (W3HorseManager)EntityHandleGet( horseManagerHandle );
  8310. }
  8311.  
  8312.  
  8313. public function HorseEquipItem(horsesItemId : SItemUniqueId) : bool
  8314. {
  8315. var man : W3HorseManager;
  8316.  
  8317. man = GetHorseManager();
  8318. if(man)
  8319. return man.EquipItem(horsesItemId) != GetInvalidUniqueId();
  8320.  
  8321. return false;
  8322. }
  8323.  
  8324.  
  8325. public function HorseUnequipItem(slot : EEquipmentSlots) : bool
  8326. {
  8327. var man : W3HorseManager;
  8328.  
  8329. man = GetHorseManager();
  8330. if(man)
  8331. return man.UnequipItem(slot) != GetInvalidUniqueId();
  8332.  
  8333. return false;
  8334. }
  8335.  
  8336.  
  8337. public final function HorseRemoveItemByName(itemName : name, quantity : int)
  8338. {
  8339. var man : W3HorseManager;
  8340.  
  8341. man = GetHorseManager();
  8342. if(man)
  8343. man.HorseRemoveItemByName(itemName, quantity);
  8344. }
  8345.  
  8346.  
  8347. public final function HorseRemoveItemByCategory(itemCategory : name, quantity : int)
  8348. {
  8349. var man : W3HorseManager;
  8350.  
  8351. man = GetHorseManager();
  8352. if(man)
  8353. man.HorseRemoveItemByCategory(itemCategory, quantity);
  8354. }
  8355.  
  8356.  
  8357. public final function HorseRemoveItemByTag(itemTag : name, quantity : int)
  8358. {
  8359. var man : W3HorseManager;
  8360.  
  8361. man = GetHorseManager();
  8362. if(man)
  8363. man.HorseRemoveItemByTag(itemTag, quantity);
  8364. }
  8365.  
  8366. public function GetAssociatedInventory() : CInventoryComponent
  8367. {
  8368. var man : W3HorseManager;
  8369.  
  8370. man = GetHorseManager();
  8371. if(man)
  8372. return man.GetInventoryComponent();
  8373.  
  8374. return NULL;
  8375. }
  8376.  
  8377.  
  8378.  
  8379.  
  8380.  
  8381. public final function TutorialMutagensUnequipPlayerSkills() : array<STutorialSavedSkill>
  8382. {
  8383. var pam : W3PlayerAbilityManager;
  8384.  
  8385. pam = (W3PlayerAbilityManager)abilityManager;
  8386. return pam.TutorialMutagensUnequipPlayerSkills();
  8387. }
  8388.  
  8389. public final function TutorialMutagensEquipOneGoodSkill()
  8390. {
  8391. var pam : W3PlayerAbilityManager;
  8392.  
  8393. pam = (W3PlayerAbilityManager)abilityManager;
  8394. pam.TutorialMutagensEquipOneGoodSkill();
  8395. }
  8396.  
  8397. public final function TutorialMutagensEquipOneGoodOneBadSkill()
  8398. {
  8399. var pam : W3PlayerAbilityManager;
  8400.  
  8401. pam = (W3PlayerAbilityManager)abilityManager;
  8402. if(pam)
  8403. pam.TutorialMutagensEquipOneGoodOneBadSkill();
  8404. }
  8405.  
  8406. public final function TutorialMutagensEquipThreeGoodSkills()
  8407. {
  8408. var pam : W3PlayerAbilityManager;
  8409.  
  8410. pam = (W3PlayerAbilityManager)abilityManager;
  8411. if(pam)
  8412. pam.TutorialMutagensEquipThreeGoodSkills();
  8413. }
  8414.  
  8415. public final function TutorialMutagensCleanupTempSkills(savedEquippedSkills : array<STutorialSavedSkill>)
  8416. {
  8417. var pam : W3PlayerAbilityManager;
  8418.  
  8419. pam = (W3PlayerAbilityManager)abilityManager;
  8420. return pam.TutorialMutagensCleanupTempSkills(savedEquippedSkills);
  8421. }
  8422.  
  8423.  
  8424.  
  8425.  
  8426.  
  8427. public final function CalculatedArmorStaminaRegenBonus() : float
  8428. {
  8429. // W3EE - Begin
  8430. /*
  8431. var armorEq, glovesEq, pantsEq, bootsEq : bool;
  8432. var tempItem : SItemUniqueId;
  8433. var staminaRegenVal : float;
  8434. var armorRegenVal : SAbilityAttributeValue;
  8435.  
  8436. if( HasAbility( 'Glyphword 2 _Stats', true ) )
  8437. {
  8438. armorEq = inv.GetItemEquippedOnSlot( EES_Armor, tempItem );
  8439. glovesEq = inv.GetItemEquippedOnSlot( EES_Gloves, tempItem );
  8440. pantsEq = inv.GetItemEquippedOnSlot( EES_Pants, tempItem );
  8441. bootsEq = inv.GetItemEquippedOnSlot( EES_Boots, tempItem );
  8442.  
  8443. if ( armorEq )
  8444. staminaRegenVal += 0.1;
  8445. if ( glovesEq )
  8446. staminaRegenVal += 0.02;
  8447. if ( pantsEq )
  8448. staminaRegenVal += 0.1;
  8449. if ( bootsEq )
  8450. staminaRegenVal += 0.03;
  8451.  
  8452. }
  8453. else if( HasAbility( 'Glyphword 3 _Stats', true ) )
  8454. {
  8455. staminaRegenVal = 0;
  8456. }
  8457. else if( HasAbility( 'Glyphword 4 _Stats', true ) )
  8458. {
  8459. armorEq = inv.GetItemEquippedOnSlot( EES_Armor, tempItem );
  8460. glovesEq = inv.GetItemEquippedOnSlot( EES_Gloves, tempItem );
  8461. pantsEq = inv.GetItemEquippedOnSlot( EES_Pants, tempItem );
  8462. bootsEq = inv.GetItemEquippedOnSlot( EES_Boots, tempItem );
  8463.  
  8464. if ( armorEq )
  8465. staminaRegenVal -= 0.1;
  8466. if ( glovesEq )
  8467. staminaRegenVal -= 0.02;
  8468. if ( pantsEq )
  8469. staminaRegenVal -= 0.1;
  8470. if ( bootsEq )
  8471. staminaRegenVal -= 0.03;
  8472. }
  8473. */
  8474.  
  8475. //W3EE old armor system
  8476. /*
  8477. if( HasAbility('Glyphword 9 _Stats', true) )
  8478. {
  8479. staminaRegenVal = 0;
  8480. if( inv.GetItemEquippedOnSlot( EES_Armor, tempItem ) && inv.GetArmorType(tempItem) == EAT_Heavy ) staminaRegenVal -= 0.05;
  8481. if( inv.GetItemEquippedOnSlot( EES_Gloves, tempItem ) && inv.GetArmorType(tempItem) == EAT_Heavy ) staminaRegenVal -= 0.01;
  8482. if( inv.GetItemEquippedOnSlot( EES_Pants, tempItem ) && inv.GetArmorType(tempItem) == EAT_Heavy ) staminaRegenVal -= 0.05;
  8483. if( inv.GetItemEquippedOnSlot( EES_Boots, tempItem ) && inv.GetArmorType(tempItem) == EAT_Heavy ) staminaRegenVal -= 0.015;
  8484. }
  8485. else
  8486. {
  8487. staminaRegenVal = 0;
  8488. if( inv.GetItemEquippedOnSlot( EES_Armor, tempItem ) && inv.GetArmorType(tempItem) == EAT_Medium ) staminaRegenVal -= 0.05;
  8489. else
  8490. if( inv.GetArmorType(tempItem) == EAT_Heavy ) staminaRegenVal -= 0.1;
  8491.  
  8492. if( inv.GetItemEquippedOnSlot( EES_Gloves, tempItem ) && inv.GetArmorType(tempItem) == EAT_Medium ) staminaRegenVal -= 0.01;
  8493. else
  8494. if( inv.GetArmorType(tempItem) == EAT_Heavy ) staminaRegenVal -= 0.02;
  8495.  
  8496. if( inv.GetItemEquippedOnSlot( EES_Pants, tempItem ) && inv.GetArmorType(tempItem) == EAT_Medium ) staminaRegenVal -= 0.05;
  8497. else
  8498. if( inv.GetArmorType(tempItem) == EAT_Heavy ) staminaRegenVal -= 0.1;
  8499.  
  8500. if( inv.GetItemEquippedOnSlot( EES_Boots, tempItem ) && inv.GetArmorType(tempItem) == EAT_Medium ) staminaRegenVal -= 0.015;
  8501. else
  8502. if( inv.GetArmorType(tempItem) == EAT_Heavy ) staminaRegenVal -= 0.03;
  8503. }
  8504. */
  8505. var attributeRegenPenalty : SAbilityAttributeValue;
  8506. var staminaRegenVal : float;
  8507.  
  8508. attributeRegenPenalty = GetAttributeValue('armor_regen_penalty');
  8509. staminaRegenVal = attributeRegenPenalty.valueMultiplicative;
  8510.  
  8511. if( HasAbility('Glyphword 9 _Stats', true) )
  8512. staminaRegenVal += 0.05;
  8513.  
  8514. return staminaRegenVal;
  8515.  
  8516. // W3EE - End
  8517.  
  8518. }
  8519.  
  8520. // W3EE - Begin
  8521. public function GetOffenseStatsList( optional hackMode : int ) : SPlayerOffenseStats
  8522. {
  8523. var playerOffenseStats:SPlayerOffenseStats;
  8524. var steelDmg, silverDmg, elementalSteel, elementalSilver : float;
  8525. var steelCritChance, steelCritDmg : float;
  8526. var silverCritChance, silverCritDmg : float;
  8527. var attackPower : SAbilityAttributeValue;
  8528. var fastCritChance, fastCritDmg : float;
  8529. var strongCritChance, strongCritDmg : float;
  8530. var fastAP, strongAP, min, max : SAbilityAttributeValue;
  8531. var item, crossbow : SItemUniqueId;
  8532. var value : SAbilityAttributeValue;
  8533. var mutagen : CBaseGameplayEffect;
  8534. // var thunder : W3Potion_Thunderbolt;
  8535.  
  8536. if(!abilityManager || !abilityManager.IsInitialized())
  8537. return playerOffenseStats;
  8538.  
  8539. /*if (CanUseSkill(S_Sword_s21))
  8540. fastAP += GetSkillAttributeValue(S_Sword_s21, PowerStatEnumToName(CPS_AttackPower), false, true) * GetSkillLevel(S_Sword_s21); */
  8541. if (CanUseSkill(S_Perk_05))
  8542. {
  8543. fastAP += GetAttributeValue('attack_power_fast_style');
  8544. fastCritDmg += CalculateAttributeValue(GetAttributeValue('critical_hit_chance_fast_style'));
  8545. // W3EE - Begin
  8546. // strongCritDmg += CalculateAttributeValue(GetAttributeValue('critical_hit_chance_fast_style'));
  8547. // W3EE - End
  8548. }
  8549. /*if (CanUseSkill(S_Sword_s04))
  8550. strongAP += GetSkillAttributeValue(S_Sword_s04, PowerStatEnumToName(CPS_AttackPower), false, true) * GetSkillLevel(S_Sword_s04);*/
  8551. if (CanUseSkill(S_Perk_07))
  8552. strongAP += GetAttributeValue('attack_power_heavy_style');
  8553.  
  8554. if (CanUseSkill(S_Sword_s17))
  8555. {
  8556. // W3EE - Begin
  8557. fastCritChance += CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s17, theGame.params.CRITICAL_HIT_CHANCE, false, true)) * GetSkillLevel(S_Sword_s17);
  8558. //fastCritDmg += CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s17, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, true)) * GetSkillLevel(S_Sword_s17);
  8559. // W3EE - End
  8560. }
  8561.  
  8562. if (CanUseSkill(S_Sword_s08))
  8563. {
  8564. // W3EE - Begin
  8565. //strongCritChance += CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s08, theGame.params.CRITICAL_HIT_CHANCE, false, true)) * GetSkillLevel(S_Sword_s08);
  8566. // W3EE - End
  8567. strongCritDmg += CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s08, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, true)) * GetSkillLevel(S_Sword_s08);
  8568. }
  8569.  
  8570. steelCritChance += CalculateAttributeValue(GetAttributeValue(theGame.params.CRITICAL_HIT_CHANCE));
  8571. silverCritChance += CalculateAttributeValue(GetAttributeValue(theGame.params.CRITICAL_HIT_CHANCE));
  8572. steelCritDmg += CalculateAttributeValue(GetAttributeValue(theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  8573. silverCritDmg += CalculateAttributeValue(GetAttributeValue(theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  8574. attackPower += GetPowerStatValue(CPS_AttackPower);
  8575.  
  8576. if (GetItemEquippedOnSlot(EES_SteelSword, item))
  8577. {
  8578. steelDmg = GetTotalWeaponDamage(item, theGame.params.DAMAGE_NAME_SLASHING, GetInvalidUniqueId());
  8579. steelDmg += GetTotalWeaponDamage(item, theGame.params.DAMAGE_NAME_PIERCING, GetInvalidUniqueId());
  8580. steelDmg += GetTotalWeaponDamage(item, theGame.params.DAMAGE_NAME_BLUDGEONING, GetInvalidUniqueId());
  8581. elementalSteel = CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_FIRE));
  8582. elementalSteel += CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_FROST));
  8583. elementalSteel += CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_ELEMENTAL));
  8584. if ( GetInventory().IsItemHeld(item) )
  8585. {
  8586. steelCritChance -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_CHANCE));
  8587. silverCritChance -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_CHANCE));
  8588. steelCritDmg -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  8589. silverCritDmg -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  8590. }
  8591. steelCritChance += CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_CHANCE));
  8592. steelCritDmg += CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  8593.  
  8594. // W3EE - Begin
  8595. /*
  8596. thunder = (W3Potion_Thunderbolt)GetBuff(EET_Thunderbolt);
  8597. if(thunder && thunder.GetBuffLevel() == 3 && GetCurWeather() == EWE_Storm)
  8598. {
  8599. steelCritChance += 1.0f;
  8600. }
  8601. */
  8602. // W3EE - End
  8603. }
  8604. else
  8605. {
  8606. steelDmg += 0;
  8607. steelCritChance += 0;
  8608. steelCritDmg +=0;
  8609. }
  8610.  
  8611. if (GetItemEquippedOnSlot(EES_SilverSword, item))
  8612. {
  8613. silverDmg = GetTotalWeaponDamage(item, theGame.params.DAMAGE_NAME_SILVER, GetInvalidUniqueId());
  8614. elementalSilver = CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_FIRE));
  8615. elementalSilver += CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_FROST));
  8616. elementalSilver += CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_ELEMENTAL));
  8617. if ( GetInventory().IsItemHeld(item) )
  8618. {
  8619. steelCritChance -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_CHANCE));
  8620. silverCritChance -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_CHANCE));
  8621. steelCritDmg -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  8622. silverCritDmg -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  8623. }
  8624. silverCritChance += CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_CHANCE));
  8625. silverCritDmg += CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  8626.  
  8627. // W3EE - Begin
  8628. /*
  8629. thunder = (W3Potion_Thunderbolt)GetBuff(EET_Thunderbolt);
  8630. if(thunder && thunder.GetBuffLevel() == 3 && GetCurWeather() == EWE_Storm)
  8631. {
  8632. silverCritChance += 1.0f;
  8633. }
  8634. */
  8635. // W3EE - End
  8636. }
  8637. else
  8638. {
  8639. silverDmg += 0;
  8640. silverCritChance += 0;
  8641. silverCritDmg +=0;
  8642. }
  8643.  
  8644. if ( HasAbility('Runeword 4 _Stats', true) )
  8645. {
  8646. steelDmg += steelDmg * (abilityManager.GetOverhealBonus() / GetStatMax(BCS_Vitality));
  8647. silverDmg += silverDmg * (abilityManager.GetOverhealBonus() / GetStatMax(BCS_Vitality));
  8648. }
  8649.  
  8650. fastAP += attackPower;
  8651. strongAP += attackPower;
  8652.  
  8653. // W3EE - Begin
  8654. theGame.GetDefinitionsManager().GetAbilityAttributeValue(theGame.params.ATTACK_NAME_HEAVY, 'attack_power', min, max);
  8655. strongAP += GetAttributeRandomizedValue(min, max);
  8656. playerOffenseStats.fastAP = fastAP.valueMultiplicative;
  8657. playerOffenseStats.strongAP = strongAP.valueMultiplicative;
  8658. // W3EE - End
  8659.  
  8660. playerOffenseStats.steelFastCritChance = (steelCritChance + fastCritChance) * 100;
  8661. playerOffenseStats.steelFastCritDmg = steelCritDmg + fastCritDmg;
  8662. if ( steelDmg != 0 )
  8663. {
  8664. // W3EE - Begin
  8665. playerOffenseStats.steelFastDmg = (steelDmg + fastAP.valueBase + elementalSteel) * fastAP.valueMultiplicative + fastAP.valueAdditive;
  8666. playerOffenseStats.steelFastCritDmg = (steelDmg + fastAP.valueBase + elementalSteel) * (fastAP.valueMultiplicative + playerOffenseStats.steelFastCritDmg) + fastAP.valueAdditive;
  8667. // W3EE - End
  8668. }
  8669. else
  8670. {
  8671. playerOffenseStats.steelFastDmg = 0;
  8672. playerOffenseStats.steelFastCritDmg = 0;
  8673. }
  8674. playerOffenseStats.steelFastDPS = (playerOffenseStats.steelFastDmg * (100 - playerOffenseStats.steelFastCritChance) + playerOffenseStats.steelFastCritDmg * playerOffenseStats.steelFastCritChance) / 100;
  8675. // W3EE - Begin
  8676. //playerOffenseStats.steelFastDPS = playerOffenseStats.steelFastDPS / 0.6;
  8677. // W3EE - End
  8678.  
  8679. playerOffenseStats.steelStrongCritChance = (steelCritChance + strongCritChance) * 100;
  8680. playerOffenseStats.steelStrongCritDmg = steelCritDmg + strongCritDmg;
  8681. if ( steelDmg != 0 )
  8682. {
  8683. // W3EE - Begin
  8684. playerOffenseStats.steelStrongDmg = (steelDmg + strongAP.valueBase + elementalSteel) * strongAP.valueMultiplicative + strongAP.valueAdditive; //modSigns
  8685. //playerOffenseStats.steelStrongDmg *= 1.833f;
  8686. playerOffenseStats.steelStrongCritDmg = (steelDmg + strongAP.valueBase + elementalSteel) * (strongAP.valueMultiplicative + playerOffenseStats.steelStrongCritDmg) + strongAP.valueAdditive; //modSigns
  8687. //playerOffenseStats.steelStrongCritDmg *= 1.833f;
  8688. // W3EE - End
  8689. }
  8690. else
  8691. {
  8692. playerOffenseStats.steelStrongDmg = 0;
  8693. playerOffenseStats.steelStrongCritDmg = 0;
  8694. }
  8695. playerOffenseStats.steelStrongDPS = (playerOffenseStats.steelStrongDmg * (100 - playerOffenseStats.steelStrongCritChance) + playerOffenseStats.steelStrongCritDmg * playerOffenseStats.steelStrongCritChance) / 100;
  8696. // W3EE - Begin
  8697. // playerOffenseStats.steelStrongDPS = playerOffenseStats.steelStrongDPS / 1.1;
  8698. // W3EE - End
  8699.  
  8700. playerOffenseStats.silverFastCritChance = (silverCritChance + fastCritChance) * 100;
  8701. playerOffenseStats.silverFastCritDmg = silverCritDmg + fastCritDmg;
  8702. if ( silverDmg != 0 )
  8703. {
  8704. // W3EE - Begin
  8705. playerOffenseStats.silverFastDmg = (silverDmg + fastAP.valueBase + elementalSilver) * fastAP.valueMultiplicative + fastAP.valueAdditive;
  8706. playerOffenseStats.silverFastCritDmg = (silverDmg + fastAP.valueBase + elementalSilver) * (fastAP.valueMultiplicative + playerOffenseStats.silverFastCritDmg) + fastAP.valueAdditive;
  8707. // W3EE - End
  8708. }
  8709. else
  8710. {
  8711. playerOffenseStats.silverFastDmg = 0;
  8712. playerOffenseStats.silverFastCritDmg = 0;
  8713. }
  8714. playerOffenseStats.silverFastDPS = (playerOffenseStats.silverFastDmg * (100 - playerOffenseStats.silverFastCritChance) + playerOffenseStats.silverFastCritDmg * playerOffenseStats.silverFastCritChance) / 100;
  8715. // W3EE - Begin
  8716. // playerOffenseStats.silverFastDPS = playerOffenseStats.silverFastDPS / 0.6;
  8717. // W3EE - End
  8718.  
  8719. playerOffenseStats.silverStrongCritChance = (silverCritChance + strongCritChance) * 100;
  8720. playerOffenseStats.silverStrongCritDmg = silverCritDmg + strongCritDmg;
  8721. if ( silverDmg != 0 )
  8722. {
  8723. // W3EE - Begin
  8724. playerOffenseStats.silverStrongDmg = (silverDmg + strongAP.valueBase + elementalSilver) * strongAP.valueMultiplicative + strongAP.valueAdditive;
  8725. //playerOffenseStats.silverStrongDmg *= 1.833f;
  8726. playerOffenseStats.silverStrongCritDmg = (silverDmg + strongAP.valueBase + elementalSilver) * (strongAP.valueMultiplicative + playerOffenseStats.silverStrongCritDmg) + strongAP.valueAdditive;
  8727. //playerOffenseStats.silverStrongCritDmg *= 1.833f;
  8728. // W3EE - End
  8729. }
  8730. else
  8731. {
  8732. playerOffenseStats.silverStrongDmg = 0;
  8733. playerOffenseStats.silverStrongCritDmg = 0;
  8734. }
  8735. playerOffenseStats.silverStrongDPS = (playerOffenseStats.silverStrongDmg * (100 - playerOffenseStats.silverStrongCritChance) + playerOffenseStats.silverStrongCritDmg * playerOffenseStats.silverStrongCritChance) / 100;
  8736. // W3EE - Begin
  8737. // playerOffenseStats.silverStrongDPS = playerOffenseStats.silverStrongDPS / 1.1;
  8738. // W3EE - End
  8739.  
  8740. playerOffenseStats.crossbowCritChance = GetCriticalHitChance( false, false, NULL, MC_NotSet, true );
  8741.  
  8742. playerOffenseStats.crossbowSteelDmgType = theGame.params.DAMAGE_NAME_PIERCING;
  8743. if (GetItemEquippedOnSlot(EES_Bolt, item))
  8744. {
  8745.  
  8746.  
  8747. steelDmg = CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_FIRE));
  8748. if(steelDmg > 0)
  8749. {
  8750. playerOffenseStats.crossbowSteelDmg = steelDmg;
  8751.  
  8752. playerOffenseStats.crossbowSteelDmgType = theGame.params.DAMAGE_NAME_FIRE;
  8753. playerOffenseStats.crossbowSilverDmg = steelDmg;
  8754. }
  8755. else
  8756. {
  8757. playerOffenseStats.crossbowSilverDmg = CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_SILVER));
  8758.  
  8759. steelDmg = CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_PIERCING));
  8760. if(steelDmg > 0)
  8761. {
  8762. playerOffenseStats.crossbowSteelDmg = steelDmg;
  8763. playerOffenseStats.crossbowSteelDmgType = theGame.params.DAMAGE_NAME_PIERCING;
  8764. }
  8765. else
  8766. {
  8767. playerOffenseStats.crossbowSteelDmg = CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_BLUDGEONING));
  8768. playerOffenseStats.crossbowSteelDmgType = theGame.params.DAMAGE_NAME_BLUDGEONING;
  8769. }
  8770. }
  8771. }
  8772.  
  8773. if (GetItemEquippedOnSlot(EES_RangedWeapon, item))
  8774. {
  8775. attackPower += GetInventory().GetItemAttributeValue(item, PowerStatEnumToName(CPS_AttackPower));
  8776. if(CanUseSkill(S_Perk_02))
  8777. {
  8778. attackPower += GetSkillAttributeValue(S_Perk_02, PowerStatEnumToName(CPS_AttackPower), false, true);
  8779. }
  8780.  
  8781. if( hackMode != 1 && ( IsMutationActive( EPMT_Mutation9 ) || hackMode == 2 ) )
  8782. {
  8783. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation9', 'damage', min, max );
  8784. playerOffenseStats.crossbowSteelDmg += min.valueAdditive;
  8785. playerOffenseStats.crossbowSilverDmg += min.valueAdditive;
  8786. }
  8787.  
  8788. playerOffenseStats.crossbowSteelDmg = (playerOffenseStats.crossbowSteelDmg + attackPower.valueBase) * attackPower.valueMultiplicative + attackPower.valueAdditive;
  8789. playerOffenseStats.crossbowSilverDmg = (playerOffenseStats.crossbowSilverDmg + attackPower.valueBase) * attackPower.valueMultiplicative + attackPower.valueAdditive;
  8790. }
  8791. else
  8792. {
  8793. playerOffenseStats.crossbowSteelDmg = 0;
  8794. playerOffenseStats.crossbowSilverDmg = 0;
  8795. playerOffenseStats.crossbowSteelDmgType = theGame.params.DAMAGE_NAME_PIERCING;
  8796. }
  8797.  
  8798. return playerOffenseStats;
  8799. }
  8800. // W3EE - End
  8801.  
  8802. public function GetTotalWeaponDamage(weaponId : SItemUniqueId, damageTypeName : name, crossbowId : SItemUniqueId, optional bolt : W3BoltProjectile) : float
  8803. {
  8804. var damage, durRatio, durMod, itemMod : float;
  8805. var repairObjectBonus, min, max : SAbilityAttributeValue;
  8806.  
  8807. // W3EE - Begin
  8808. durMod = 1;
  8809. // W3EE - End
  8810. damage = super.GetTotalWeaponDamage(weaponId, damageTypeName, crossbowId, bolt);
  8811.  
  8812.  
  8813. if( IsMutationActive( EPMT_Mutation9 ) && inv.IsItemBolt( weaponId ) && IsDamageTypeAnyPhysicalType( damageTypeName ) )
  8814. {
  8815. theGame.GetDefinitionsManager().GetAbilityAttributeValue('Mutation9', 'damage', min, max);
  8816. damage += min.valueAdditive;
  8817. }
  8818.  
  8819.  
  8820. if(IsPhysicalResistStat(GetResistForDamage(damageTypeName, false)))
  8821. {
  8822. repairObjectBonus = inv.GetItemAttributeValue(weaponId, theGame.params.REPAIR_OBJECT_BONUS);
  8823. durRatio = -1;
  8824.  
  8825. if(inv.IsIdValid(crossbowId) && inv.HasItemDurability(crossbowId))
  8826. {
  8827. durRatio = inv.GetItemDurabilityRatio(crossbowId);
  8828. }
  8829. else if(inv.IsIdValid(weaponId) && inv.HasItemDurability(weaponId))
  8830. {
  8831. durRatio = inv.GetItemDurabilityRatio(weaponId);
  8832. }
  8833.  
  8834.  
  8835. if(durRatio >= 0)
  8836. durMod = theGame.params.GetDurabilityMultiplier(durRatio, true);
  8837. else
  8838. durMod = 1;
  8839. }
  8840.  
  8841.  
  8842. if( damageTypeName == 'SilverDamage' && inv.ItemHasTag( weaponId, 'Aerondight' ) )
  8843. {
  8844. itemMod = inv.GetItemModifierFloat( weaponId, 'PermDamageBoost' );
  8845. if( itemMod > 0.f )
  8846. {
  8847. damage += itemMod;
  8848. }
  8849. }
  8850.  
  8851. return damage * (durMod + repairObjectBonus.valueMultiplicative);
  8852. }
  8853.  
  8854.  
  8855.  
  8856.  
  8857.  
  8858. public final function GetSkillPathType(skill : ESkill) : ESkillPath
  8859. {
  8860. if(abilityManager && abilityManager.IsInitialized())
  8861. return ((W3PlayerAbilityManager)abilityManager).GetSkillPathType(skill);
  8862.  
  8863. return ESP_NotSet;
  8864. }
  8865.  
  8866. public function GetSkillLevel(s : ESkill) : int
  8867. {
  8868. if(abilityManager && abilityManager.IsInitialized())
  8869. return ((W3PlayerAbilityManager)abilityManager).GetSkillLevel(s);
  8870. return -1;
  8871. }
  8872.  
  8873. public function GetSkillMaxLevel(s : ESkill) : int
  8874. {
  8875. if(abilityManager && abilityManager.IsInitialized())
  8876. return ((W3PlayerAbilityManager)abilityManager).GetSkillMaxLevel(s);
  8877.  
  8878. return -1;
  8879. }
  8880.  
  8881. public function GetBoughtSkillLevel(s : ESkill) : int
  8882. {
  8883. if(abilityManager && abilityManager.IsInitialized())
  8884. return ((W3PlayerAbilityManager)abilityManager).GetBoughtSkillLevel(s);
  8885.  
  8886. return -1;
  8887. }
  8888.  
  8889.  
  8890. public function GetAxiiLevel() : int
  8891. {
  8892. var level : int;
  8893.  
  8894. level = 1;
  8895.  
  8896. if(CanUseSkill(S_Magic_s17)) level = 4;
  8897.  
  8898. return Clamp(level, 1, 4);
  8899. }
  8900.  
  8901. public function IsInFrenzy() : bool
  8902. {
  8903. return isInFrenzy;
  8904. }
  8905.  
  8906. public function HasRecentlyCountered() : bool
  8907. {
  8908. return hasRecentlyCountered;
  8909. }
  8910.  
  8911. public function SetRecentlyCountered(counter : bool)
  8912. {
  8913. hasRecentlyCountered = counter;
  8914. }
  8915.  
  8916. timer function CheckBlockedSkills(dt : float, id : int)
  8917. {
  8918. var nextCallTime : float;
  8919.  
  8920. nextCallTime = ((W3PlayerAbilityManager)abilityManager).CheckBlockedSkills(dt);
  8921. if(nextCallTime != -1)
  8922. AddTimer('CheckBlockedSkills', nextCallTime, , , , true);
  8923. }
  8924.  
  8925.  
  8926. public function RemoveTemporarySkills()
  8927. {
  8928. var i : int;
  8929. var pam : W3PlayerAbilityManager;
  8930.  
  8931. if(tempLearnedSignSkills.Size() > 0)
  8932. {
  8933. pam = (W3PlayerAbilityManager)abilityManager;
  8934. for(i=0; i<tempLearnedSignSkills.Size(); i+=1)
  8935. {
  8936. pam.RemoveTemporarySkill(tempLearnedSignSkills[i]);
  8937. }
  8938.  
  8939. tempLearnedSignSkills.Clear();
  8940. }
  8941. RemoveAbilityAll(SkillEnumToName(S_Sword_s19));
  8942. }
  8943.  
  8944. public function RemoveTemporarySkill(skill : SSimpleSkill) : bool
  8945. {
  8946. var pam : W3PlayerAbilityManager;
  8947.  
  8948. pam = (W3PlayerAbilityManager)abilityManager;
  8949. if(pam && pam.IsInitialized())
  8950. return pam.RemoveTemporarySkill(skill);
  8951.  
  8952. return false;
  8953. }
  8954.  
  8955. // W3EE - Begin
  8956. private function AddTemporarySkills()
  8957. {
  8958. /*if(CanUseSkill(S_Sword_s19) && GetStat(BCS_Focus) >= 3)
  8959. {
  8960. // tempLearnedSignSkills = ((W3PlayerAbilityManager)abilityManager).AddTempNonAlchemySkills();
  8961. AddAbilityMultiple(SkillEnumToName(S_Sword_s19), GetSkillLevel(S_Sword_s19));
  8962. }*/
  8963. }
  8964. // W3EE - End
  8965.  
  8966.  
  8967. public function HasAlternateQuen() : bool
  8968. {
  8969. var quenEntity : W3QuenEntity;
  8970.  
  8971. quenEntity = (W3QuenEntity)GetCurrentSignEntity();
  8972. if(quenEntity)
  8973. {
  8974. return quenEntity.IsAlternateCast();
  8975. }
  8976.  
  8977. return false;
  8978. }
  8979.  
  8980.  
  8981.  
  8982.  
  8983.  
  8984. public function AddPoints(type : ESpendablePointType, amount : int, show : bool)
  8985. {
  8986. levelManager.AddPoints(type, amount, show);
  8987. }
  8988.  
  8989. public function GetLevel() : int {return levelManager.GetLevel();}
  8990. public function GetMaxLevel() : int {return levelManager.GetMaxLevel();}
  8991. public function GetTotalExpForNextLevel() : int {return levelManager.GetTotalExpForNextLevel();}
  8992. public function GetPointsTotal(type : ESpendablePointType) : int {return levelManager.GetPointsTotal(type);}
  8993. public function IsAutoLeveling() : bool {return autoLevel;}
  8994. public function SetAutoLeveling( b : bool ) {autoLevel = b;}
  8995.  
  8996. public function GetMissingExpForNextLevel() : int
  8997. {
  8998. return Max(0, GetTotalExpForNextLevel() - GetPointsTotal(EExperiencePoint));
  8999. }
  9000.  
  9001.  
  9002.  
  9003.  
  9004. private saved var runewordInfusionType : ESignType;
  9005. default runewordInfusionType = ST_None;
  9006.  
  9007. public final function GetRunewordInfusionType() : ESignType
  9008. {
  9009. return runewordInfusionType;
  9010. }
  9011.  
  9012. // W3EE - Begin
  9013. public var infusionCooldown : bool;
  9014. timer function InfusionCooldown( dt : float, id : int )
  9015. {
  9016. infusionCooldown = false;
  9017. }
  9018.  
  9019. public final function SetRunewordInfusionType( i : ESignType )
  9020. {
  9021. runewordInfusionType = i;
  9022. }
  9023. // W3EE - End
  9024.  
  9025. public function QuenImpulse( isAlternate : bool, signEntity : W3QuenEntity, source : string )
  9026. {
  9027. var level, range, i, j : int;
  9028. var atts, damages : array<name>;
  9029. // W3EE - Begin
  9030. var ents : array<CActor>;
  9031. var action : W3DamageAction;
  9032. var dm : CDefinitionsManagerAccessor;
  9033. var skillAbilityName : name;
  9034. var dmg : float;
  9035. var min, max, sp : SAbilityAttributeValue;
  9036. var pos : Vector;
  9037. var impulsePower, damageMult : float;
  9038. var fx : CEntity;
  9039.  
  9040. damageMult = 1.f;
  9041. if( !isAlternate )
  9042. damageMult = signEntity.GetShieldHealth() / signEntity.GetInitialShieldHealth();
  9043.  
  9044. dm = theGame.GetDefinitionsManager();
  9045. skillAbilityName = GetSkillAbilityName(S_Magic_s13);
  9046.  
  9047. dm.GetAbilityAttributes(skillAbilityName, atts);
  9048. for(i=0; i<atts.Size(); i+=1)
  9049. {
  9050. if(IsDamageTypeNameValid(atts[i]))
  9051. {
  9052. damages.PushBack(atts[i]);
  9053. }
  9054. }
  9055.  
  9056. sp = signEntity.GetTotalSignIntensity();
  9057. pos = signEntity.GetWorldPosition();
  9058. level = signEntity.GetActualOwner().GetSkillLevel(S_Magic_s13, signEntity);
  9059. range = CeilF(2.f + level / 2.f);
  9060. ents = GetActorsInRange(this, range, 1000, , true);
  9061. for(i=0; i<ents.Size(); i+=1)
  9062. {
  9063. if( (W3PlayerWitcher)ents[i] || ents[i].GetAttitude(this) == AIA_Friendly || ents[i].GetAttitude(this) == AIA_Neutral )
  9064. continue;
  9065.  
  9066. action = new W3DamageAction in theGame;
  9067. action.Initialize(this, ents[i], signEntity, source, EHRT_Heavy, CPS_SpellPower, false, false, true, false);
  9068. action.SetSignSkill(S_Magic_s13);
  9069. action.SetCannotReturnDamage(true);
  9070. action.SetProcessBuffsIfNoDamage(true);
  9071.  
  9072. action.SetHitEffect('hit_electric_quen');
  9073. action.SetHitEffect('hit_electric_quen', true);
  9074. action.SetHitEffect('hit_electric_quen', false, true);
  9075. action.SetHitEffect('hit_electric_quen', true, true);
  9076.  
  9077. fx = ((CActor)ents[i]).CreateFXEntityAtPelvis('mutation1_hit', true);
  9078. fx.PlayEffect('mutation_1_hit_quen');
  9079.  
  9080. if( ((CActor)ents[i]).IsHelpless() )
  9081. action.SetHitAnimationPlayType(EAHA_ForceNo);
  9082. else
  9083. {
  9084. if( isAlternate )
  9085. action.SetHitAnimationPlayType(EAHA_ForceYes);
  9086. else
  9087. action.AddEffectInfo(EET_Stagger);
  9088. }
  9089.  
  9090. for(j=0; j<damages.Size(); j+=1)
  9091. {
  9092. dm.GetAbilityAttributeValue(skillAbilityName, damages[j], min, max);
  9093. // dmg = CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  9094. if(isAlternate)
  9095. dmg = 15 * level;
  9096. else
  9097. dmg = MaxF(90 * level, 150 * level * sp.valueMultiplicative * damageMult);
  9098. if( IsSetBonusActive( EISB_Wolf_2 ) )
  9099. {
  9100. dm.GetAbilityAttributeValue( GetSetBonusAbility( EISB_Bear_2 ), 'quen_dmg_boost', min, max );
  9101. dmg *= 1 + min.valueMultiplicative;
  9102. }
  9103. action.AddDamage(damages[j], dmg);
  9104. }
  9105. if(isAlternate)
  9106. {
  9107. impulsePower = 0.02f * level * sp.valueMultiplicative;
  9108. if( RandF() <= impulsePower )
  9109. {
  9110. if( IsSetBonusActive( EISB_Wolf_2 ) )
  9111. action.AddEffectInfo(EET_Knockdown);
  9112. else
  9113. action.AddEffectInfo(EET_LongStagger);
  9114. }
  9115. else
  9116. if( RandF() <= impulsePower )
  9117. action.AddEffectInfo(EET_Stagger);
  9118. else
  9119. action.SetHitAnimationPlayType(EAHA_ForceYes);
  9120. }
  9121. else
  9122. {
  9123. impulsePower = 0.1f * level * sp.valueMultiplicative;
  9124. if( RandF() <= impulsePower )
  9125. {
  9126. if( IsSetBonusActive( EISB_Wolf_2 ) )
  9127. action.AddEffectInfo(EET_HeavyKnockdown);
  9128. else
  9129. action.AddEffectInfo(EET_Knockdown);
  9130. }
  9131. else
  9132. if( RandF() <= impulsePower )
  9133. action.AddEffectInfo(EET_LongStagger);
  9134. else
  9135. action.AddEffectInfo(EET_Stagger);
  9136. }
  9137. // action.AddEffectInfo(EET_KnockdownTypeApplicator);
  9138.  
  9139. theGame.damageMgr.ProcessAction( action );
  9140. delete action;
  9141. }
  9142.  
  9143. GCameraShake(0.05f * level * sp.valueMultiplicative);
  9144. // W3EE - End
  9145.  
  9146. if(isAlternate)
  9147. {
  9148. signEntity.PlayHitEffect('quen_impulse_explode', signEntity.GetWorldRotation());
  9149. signEntity.EraseFirstTimeStamp();
  9150.  
  9151. if( !IsSetBonusActive( EISB_Wolf_2 ) )
  9152. {
  9153. signEntity.PlayHitEffect('quen_electric_explode', signEntity.GetWorldRotation());
  9154. }
  9155. else
  9156. {
  9157. signEntity.PlayHitEffect('quen_electric_explode_bear_abl2', signEntity.GetWorldRotation());
  9158. }
  9159. }
  9160. else
  9161. {
  9162. signEntity.PlayEffect('lasting_shield_impulse');
  9163. }
  9164. }
  9165.  
  9166. public function OnSignCastPerformed(signType : ESignType, isAlternate : bool)
  9167. {
  9168. var items : array<SItemUniqueId>;
  9169. var weaponEnt : CEntity;
  9170. var fxName : name;
  9171. var pos : Vector;
  9172. var harmonyAbility : SCustomEffectParams;
  9173.  
  9174. super.OnSignCastPerformed(signType, isAlternate);
  9175. // W3EE - Begin
  9176. Combat().SetInfusionVariables(this, signType);
  9177.  
  9178. if( (HasAbility('Runeword 2 _Stats', true) || HasAbility('Runeword 1 _Stats', true)) && !infusionCooldown /*&& GetStat(BCS_Focus) >= 1.0f*/)
  9179. {
  9180. // DrainFocus(1.0f);
  9181. // W3EE - End
  9182. runewordInfusionType = signType;
  9183. items = inv.GetHeldWeapons();
  9184. weaponEnt = inv.GetItemEntityUnsafe(items[0]);
  9185.  
  9186.  
  9187. weaponEnt.StopEffect('runeword_aard');
  9188. weaponEnt.StopEffect('runeword_axii');
  9189. weaponEnt.StopEffect('runeword_igni');
  9190. weaponEnt.StopEffect('runeword_quen');
  9191. weaponEnt.StopEffect('runeword_yrden');
  9192.  
  9193.  
  9194. if(signType == ST_Aard)
  9195. fxName = 'runeword_aard';
  9196. else if(signType == ST_Axii)
  9197. fxName = 'runeword_axii';
  9198. else if(signType == ST_Igni)
  9199. fxName = 'runeword_igni';
  9200. else if(signType == ST_Quen)
  9201. fxName = 'runeword_quen';
  9202. else if(signType == ST_Yrden)
  9203. fxName = 'runeword_yrden';
  9204.  
  9205. weaponEnt.PlayEffect(fxName);
  9206.  
  9207. infusionCooldown = true;
  9208. AddTimer('InfusionCooldown', 1.5f, false);
  9209. }
  9210.  
  9211.  
  9212. if( CanUseSkill(S_Magic_s12) && signType == ST_Aard )
  9213. {
  9214. if( !isAlternate )
  9215. pos = GetWorldPosition() + GetWorldForward() * 2;
  9216. else
  9217. pos = GetWorldPosition();
  9218.  
  9219. theGame.GetSurfacePostFX().AddSurfacePostFXGroup( pos, 0.15f, 7.f, 2.f, 5.f, 0 );
  9220. }
  9221.  
  9222. if( IsMutationActive( EPMT_Mutation6 ) )
  9223. {
  9224. if( signType == ST_Aard && HasBuff( EET_HarmonyAard ) )
  9225. {
  9226. harmonyAbility.effectType = EET_HarmonyAxii;
  9227. harmonyAbility.creator = this;
  9228. harmonyAbility.sourceName = "Mutation 6";
  9229. harmonyAbility.isSignEffect = false;
  9230. harmonyAbility.duration = -1;
  9231. this.AddEffectCustom(harmonyAbility);
  9232. RemoveBuff(EET_HarmonyAard);
  9233. }
  9234. else
  9235. if( signType == ST_Axii && HasBuff( EET_HarmonyAxii ) )
  9236. {
  9237. harmonyAbility.effectType = EET_HarmonyQuen;
  9238. harmonyAbility.creator = this;
  9239. harmonyAbility.sourceName = "Mutation 6";
  9240. harmonyAbility.isSignEffect = false;
  9241. harmonyAbility.duration = -1;
  9242. this.AddEffectCustom(harmonyAbility);
  9243. RemoveBuff(EET_HarmonyAxii);
  9244. }
  9245. else
  9246. if( signType == ST_Quen && HasBuff( EET_HarmonyQuen ) )
  9247. {
  9248. harmonyAbility.effectType = EET_HarmonyIgni;
  9249. harmonyAbility.creator = this;
  9250. harmonyAbility.sourceName = "Mutation 6";
  9251. harmonyAbility.isSignEffect = false;
  9252. harmonyAbility.duration = -1;
  9253. this.AddEffectCustom(harmonyAbility);
  9254. RemoveBuff(EET_HarmonyQuen);
  9255. }
  9256. else
  9257. if( signType == ST_Igni && HasBuff( EET_HarmonyIgni ) )
  9258. {
  9259. harmonyAbility.effectType = EET_HarmonyYrden;
  9260. harmonyAbility.creator = this;
  9261. harmonyAbility.sourceName = "Mutation 6";
  9262. harmonyAbility.isSignEffect = false;
  9263. harmonyAbility.duration = -1;
  9264. this.AddEffectCustom(harmonyAbility);
  9265. RemoveBuff(EET_HarmonyIgni);
  9266. }
  9267. else
  9268. if( signType == ST_Yrden && HasBuff( EET_HarmonyYrden ) )
  9269. {
  9270. harmonyAbility.effectType = EET_HarmonyAard;
  9271. harmonyAbility.creator = this;
  9272. harmonyAbility.sourceName = "Mutation 6";
  9273. harmonyAbility.isSignEffect = false;
  9274. harmonyAbility.duration = -1;
  9275. this.AddEffectCustom(harmonyAbility);
  9276. RemoveBuff(EET_HarmonyYrden);
  9277. }
  9278. else
  9279. if( !(HasBuff( EET_HarmonyAard ) || HasBuff( EET_HarmonyAxii ) || HasBuff( EET_HarmonyQuen ) || HasBuff( EET_HarmonyIgni ) || HasBuff( EET_HarmonyYrden )) )
  9280. {
  9281. harmonyAbility.effectType = EET_HarmonyYrden;
  9282. harmonyAbility.creator = this;
  9283. harmonyAbility.sourceName = "Mutation 6";
  9284. harmonyAbility.isSignEffect = false;
  9285. harmonyAbility.duration = -1;
  9286. this.AddEffectCustom(harmonyAbility);
  9287. }
  9288. }
  9289. }
  9290.  
  9291. public saved var savedQuenHealth, savedQuenDuration : float;
  9292.  
  9293. timer function HACK_QuenSaveStatus(dt : float, id : int)
  9294. {
  9295. var quenEntity : W3QuenEntity;
  9296.  
  9297. quenEntity = (W3QuenEntity)signs[ST_Quen].entity;
  9298. savedQuenHealth = quenEntity.GetShieldHealth();
  9299. savedQuenDuration = quenEntity.GetShieldRemainingDuration();
  9300. }
  9301.  
  9302. timer function DelayedRestoreQuen(dt : float, id : int)
  9303. {
  9304. RestoreQuen(savedQuenHealth, savedQuenDuration);
  9305. }
  9306.  
  9307. private var refreshFace : bool; default refreshFace = false;
  9308. public final function OnBasicQuenFinishing()
  9309. {
  9310. RemoveTimer('HACK_QuenSaveStatus');
  9311. savedQuenHealth = 0.f;
  9312. savedQuenDuration = 0.f;
  9313. refreshFace = true;
  9314. }
  9315.  
  9316. public function ShouldRefreshFace() : bool
  9317. {
  9318. return refreshFace;
  9319. }
  9320.  
  9321. public function ResetRefreshFace()
  9322. {
  9323. refreshFace = false;
  9324. }
  9325.  
  9326. public final function IsAnyQuenActive() : bool
  9327. {
  9328. var quen : W3QuenEntity;
  9329.  
  9330. quen = (W3QuenEntity)GetSignEntity(ST_Quen);
  9331. if(quen)
  9332. return quen.IsAnyQuenActive();
  9333.  
  9334. return false;
  9335. }
  9336.  
  9337. public final function IsQuenActive(alternateMode : bool) : bool
  9338. {
  9339. if(IsAnyQuenActive() && GetSignEntity(ST_Quen).IsAlternateCast() == alternateMode)
  9340. return true;
  9341.  
  9342. return false;
  9343. }
  9344.  
  9345. public function FinishQuen( skipVisuals : bool, optional forceNoBearSetBonus : bool )
  9346. {
  9347. var quen : W3QuenEntity;
  9348.  
  9349. quen = (W3QuenEntity)GetSignEntity(ST_Quen);
  9350. if(quen)
  9351. quen.ForceFinishQuen( skipVisuals, forceNoBearSetBonus );
  9352. }
  9353.  
  9354. // W3EE - Begin
  9355. public function GetTotalSpellPower() : SAbilityAttributeValue
  9356. {
  9357. var sp : SAbilityAttributeValue;
  9358. var maxFocus, currFocus, penaltyPerc, vigorPenalty : float;
  9359.  
  9360. sp = GetAttributeValue(PowerStatEnumToName(CPS_SpellPower));
  9361.  
  9362. if( CanUseSkill(S_Sword_s19) && GetAdrenalineEffect().GetValue() > 0 )
  9363. {
  9364. sp.valueMultiplicative += (GetAdrenalineEffect().GetValue() * GetSkillLevel(S_Sword_s19) * 0.15f);
  9365. }
  9366.  
  9367. maxFocus = GetStatMax(BCS_Focus);
  9368. currFocus = GetStat(BCS_Focus);
  9369.  
  9370. if( CanUseSkill(S_Perk_11) )
  9371. penaltyPerc = Options().VigIntLost() / 150.f;
  9372. else
  9373. penaltyPerc = Options().VigIntLost() / 100.f;
  9374.  
  9375. if( currFocus < 1 && CanUseSkill(S_Perk_09) )
  9376. vigorPenalty = 3.15f * penaltyPerc;
  9377. else
  9378. {
  9379. if( IsMutationActive(EPMT_Mutation1) && currFocus >= 1 )
  9380. vigorPenalty = 0.f;
  9381. else
  9382. vigorPenalty = (maxFocus / Options().MaxFocus()) * (maxFocus - currFocus) * penaltyPerc;
  9383. }
  9384.  
  9385. sp.valueMultiplicative -= sp.valueMultiplicative * vigorPenalty;
  9386. sp.valueMultiplicative = MaxF(0, sp.valueMultiplicative);
  9387.  
  9388. ApplyMutation10StatBoost(sp);
  9389.  
  9390. return sp;
  9391. }
  9392.  
  9393. public function GetSingleSignSpellPower( signSkill : ESkill ) : SAbilityAttributeValue
  9394. {
  9395. var sp : SAbilityAttributeValue;
  9396. var penaltyReduction : float;
  9397. var penaltyReductionLevel : int;
  9398. var quenEntity : W3QuenEntity;
  9399. var maxFocus, currFocus, penaltyPerc, vigorPenalty : float;
  9400.  
  9401. if(signSkill == S_Magic_1 || signSkill == S_Magic_s01)
  9402. {
  9403. sp = GetAttributeValue('spell_power_aard');
  9404. sp.valueMultiplicative += Experience().GetSpentPathPoints(ESSP_Signs_Aard) * 0.01f;
  9405. if( signSkill == S_Magic_s01 )
  9406. {
  9407. penaltyReductionLevel = GetSkillLevel(S_Magic_s01) - 1;
  9408. if(penaltyReductionLevel > 0)
  9409. {
  9410. penaltyReduction = penaltyReductionLevel * CalculateAttributeValue(GetSkillAttributeValue(S_Magic_s01, 'spell_power_penalty_reduction', false, false));
  9411. sp.valueMultiplicative += penaltyReduction;
  9412. }
  9413. }
  9414. }
  9415. else if(signSkill == S_Magic_2 || signSkill == S_Magic_s02)
  9416. {
  9417. sp = GetAttributeValue('spell_power_igni');
  9418. sp.valueMultiplicative += Experience().GetSpentPathPoints(ESSP_Signs_Igni) * 0.01f;
  9419. }
  9420. else if(signSkill == S_Magic_3 || signSkill == S_Magic_s03)
  9421. {
  9422. sp = GetAttributeValue('spell_power_yrden');
  9423. sp.valueMultiplicative += Experience().GetSpentPathPoints(ESSP_Signs_Yrden) * 0.01f;
  9424. }
  9425. else if(signSkill == S_Magic_4 || signSkill == S_Magic_s04)
  9426. {
  9427. sp = GetAttributeValue('spell_power_quen');
  9428. sp.valueMultiplicative += Experience().GetSpentPathPoints(ESSP_Signs_Quen) * 0.01f;
  9429. quenEntity = (W3QuenEntity)GetWitcherPlayer().GetSignEntity(ST_Quen);
  9430. }
  9431. else if(signSkill == S_Magic_5 || signSkill == S_Magic_s05)
  9432. {
  9433. sp = GetAttributeValue('spell_power_axii');
  9434. sp.valueMultiplicative += Experience().GetSpentPathPoints(ESSP_Signs_Axi) * 0.01f;
  9435. }
  9436.  
  9437. maxFocus = GetStatMax(BCS_Focus);
  9438. currFocus = GetStat(BCS_Focus);
  9439. if( CanUseSkill(S_Perk_11) )
  9440. penaltyPerc = Options().VigIntLost() / 150.f;
  9441. else
  9442. penaltyPerc = Options().VigIntLost() / 100.f;
  9443.  
  9444. if( currFocus < 1 && CanUseSkill(S_Perk_09) )
  9445. vigorPenalty = 3.15f * penaltyPerc;
  9446. else
  9447. {
  9448. if( IsMutationActive(EPMT_Mutation1) && currFocus >= 1 )
  9449. vigorPenalty = 0.f;
  9450. else
  9451. vigorPenalty = (3.f - GetStatPercents(BCS_Focus) * 3.f) * penaltyPerc;
  9452. }
  9453.  
  9454. sp.valueMultiplicative -= sp.valueMultiplicative * vigorPenalty;
  9455. sp.valueMultiplicative = MaxF(0, sp.valueMultiplicative);
  9456.  
  9457. ApplyMutation10StatBoost(sp);
  9458.  
  9459. return sp;
  9460. }
  9461.  
  9462. public function GetTotalSignSpellPower(signSkill : ESkill) : SAbilityAttributeValue
  9463. {
  9464. var sp: SAbilityAttributeValue;
  9465. var penaltyReduction : float;
  9466. var penaltyReductionLevel : int;
  9467. var quenEntity : W3QuenEntity;
  9468. var maxFocus, currFocus, penaltyPerc, vigorPenalty : float;
  9469.  
  9470. sp = GetAttributeValue(PowerStatEnumToName(CPS_SpellPower));
  9471. if( CanUseSkill(S_Sword_s19) && GetAdrenalineEffect().GetValue() > 0 )
  9472. {
  9473. sp.valueMultiplicative += (GetAdrenalineEffect().GetValue() * GetSkillLevel(S_Sword_s19) * 0.15f);
  9474. }
  9475.  
  9476. if(signSkill == S_Magic_1 || signSkill == S_Magic_s01)
  9477. {
  9478. if( signSkill == S_Magic_s01 )
  9479. {
  9480. penaltyReductionLevel = GetSkillLevel(S_Magic_s01) - 1;
  9481. if(penaltyReductionLevel > 0)
  9482. {
  9483. penaltyReduction = penaltyReductionLevel * CalculateAttributeValue(GetSkillAttributeValue(S_Magic_s01, 'spell_power_penalty_reduction', false, false));
  9484. sp.valueMultiplicative += penaltyReduction;
  9485. }
  9486. }
  9487. sp += GetAttributeValue('spell_power_aard');
  9488. sp.valueMultiplicative += Experience().GetSpentPathPoints(ESSP_Signs_Aard) * 0.01f;
  9489. }
  9490. else if(signSkill == S_Magic_2 || signSkill == S_Magic_s02)
  9491. {
  9492. sp += GetAttributeValue('spell_power_igni');
  9493. sp.valueMultiplicative += Experience().GetSpentPathPoints(ESSP_Signs_Igni) * 0.01f;
  9494. }
  9495. else if(signSkill == S_Magic_3 || signSkill == S_Magic_s03)
  9496. {
  9497. sp += GetAttributeValue('spell_power_yrden');
  9498. sp.valueMultiplicative += Experience().GetSpentPathPoints(ESSP_Signs_Yrden) * 0.01f;
  9499. }
  9500. else if(signSkill == S_Magic_4 || signSkill == S_Magic_s04)
  9501. {
  9502. sp += GetAttributeValue('spell_power_quen');
  9503. sp.valueMultiplicative += Experience().GetSpentPathPoints(ESSP_Signs_Quen) * 0.01f;
  9504. quenEntity = (W3QuenEntity)GetWitcherPlayer().GetSignEntity(ST_Quen);
  9505. }
  9506. else if(signSkill == S_Magic_5 || signSkill == S_Magic_s05)
  9507. {
  9508. sp += GetAttributeValue('spell_power_axii');
  9509. sp.valueMultiplicative += Experience().GetSpentPathPoints(ESSP_Signs_Axi) * 0.01f;
  9510. }
  9511.  
  9512. maxFocus = GetStatMax(BCS_Focus);
  9513. currFocus = GetStat(BCS_Focus);
  9514. if( CanUseSkill(S_Perk_11) )
  9515. penaltyPerc = Options().VigIntLost() / 150.f;
  9516. else
  9517. penaltyPerc = Options().VigIntLost() / 100.f;
  9518.  
  9519. if( currFocus < 1 && CanUseSkill(S_Perk_09) )
  9520. vigorPenalty = 3.15f * penaltyPerc;
  9521. else
  9522. {
  9523. if( IsMutationActive(EPMT_Mutation1) && currFocus >= 1 )
  9524. vigorPenalty = 0.f;
  9525. else
  9526. vigorPenalty = (maxFocus / Options().MaxFocus()) * (maxFocus - currFocus) * penaltyPerc;
  9527. }
  9528.  
  9529. sp.valueMultiplicative -= sp.valueMultiplicative * vigorPenalty;
  9530. sp.valueMultiplicative = MaxF(0, sp.valueMultiplicative);
  9531.  
  9532. ApplyMutation10StatBoost(sp);
  9533.  
  9534. return sp;
  9535. }
  9536. // W3EE - End
  9537.  
  9538.  
  9539.  
  9540.  
  9541.  
  9542. public final function GetGwentCardIndex( cardName : name ) : int
  9543. {
  9544. var dm : CDefinitionsManagerAccessor;
  9545.  
  9546. dm = theGame.GetDefinitionsManager();
  9547.  
  9548. if(dm.ItemHasTag( cardName , 'GwintCardLeader' ))
  9549. {
  9550. return theGame.GetGwintManager().GwentLeadersNametoInt( cardName );
  9551. }
  9552. else if(dm.ItemHasTag( cardName , 'GwintCardNrkd' ))
  9553. {
  9554. return theGame.GetGwintManager().GwentNrkdNameToInt( cardName );
  9555. }
  9556. else if(dm.ItemHasTag( cardName , 'GwintCardNlfg' ))
  9557. {
  9558. return theGame.GetGwintManager().GwentNlfgNameToInt( cardName );
  9559. }
  9560. else if(dm.ItemHasTag( cardName , 'GwintCardSctl' ))
  9561. {
  9562. return theGame.GetGwintManager().GwentSctlNameToInt( cardName );
  9563. }
  9564. else if(dm.ItemHasTag( cardName , 'GwintCardMstr' ))
  9565. {
  9566. return theGame.GetGwintManager().GwentMstrNameToInt( cardName );
  9567. }
  9568. else if(dm.ItemHasTag( cardName , 'GwintCardSke' ))
  9569. {
  9570. return theGame.GetGwintManager().GwentSkeNameToInt( cardName );
  9571. }
  9572. else if(dm.ItemHasTag( cardName , 'GwintCardNeutral' ))
  9573. {
  9574. return theGame.GetGwintManager().GwentNeutralNameToInt( cardName );
  9575. }
  9576. else if(dm.ItemHasTag( cardName , 'GwintCardSpcl' ))
  9577. {
  9578. return theGame.GetGwintManager().GwentSpecialNameToInt( cardName );
  9579. }
  9580.  
  9581. return -1;
  9582. }
  9583.  
  9584. public final function AddGwentCard(cardName : name, amount : int) : bool
  9585. {
  9586. var dm : CDefinitionsManagerAccessor;
  9587. var cardIndex, i : int;
  9588. var tut : STutorialMessage;
  9589. var gwintManager : CR4GwintManager;
  9590.  
  9591.  
  9592.  
  9593. if(FactsQuerySum("q001_nightmare_ended") > 0 && ShouldProcessTutorial('TutorialGwentDeckBuilder2'))
  9594. {
  9595. tut.type = ETMT_Hint;
  9596. tut.tutorialScriptTag = 'TutorialGwentDeckBuilder2';
  9597. tut.journalEntryName = 'TutorialGwentDeckBuilder2';
  9598. tut.hintPositionType = ETHPT_DefaultGlobal;
  9599. tut.markAsSeenOnShow = true;
  9600. tut.hintDurationType = ETHDT_Long;
  9601.  
  9602. theGame.GetTutorialSystem().DisplayTutorial(tut);
  9603. }
  9604.  
  9605. dm = theGame.GetDefinitionsManager();
  9606.  
  9607. cardIndex = GetGwentCardIndex(cardName);
  9608.  
  9609. if (cardIndex != -1)
  9610. {
  9611. FactsAdd("Gwint_Card_Looted");
  9612.  
  9613. for(i = 0; i < amount; i += 1)
  9614. {
  9615. theGame.GetGwintManager().AddCardToCollection( cardIndex );
  9616. }
  9617. }
  9618.  
  9619. if( dm.ItemHasTag( cardName, 'GwentTournament' ) )
  9620. {
  9621. if ( dm.ItemHasTag( cardName, 'GT1' ) )
  9622. {
  9623. FactsAdd( "GwentTournament", 1 );
  9624. }
  9625.  
  9626. else if ( dm.ItemHasTag( cardName, 'GT2' ) )
  9627. {
  9628. FactsAdd( "GwentTournament", 2 );
  9629. }
  9630.  
  9631. else if ( dm.ItemHasTag( cardName, 'GT3' ) )
  9632. {
  9633. FactsAdd( "GwentTournament", 3 );
  9634. }
  9635.  
  9636. else if ( dm.ItemHasTag( cardName, 'GT4' ) )
  9637. {
  9638. FactsAdd( "GwentTournament", 4 );
  9639. }
  9640.  
  9641. else if ( dm.ItemHasTag( cardName, 'GT5' ) )
  9642. {
  9643. FactsAdd( "GwentTournament", 5 );
  9644. }
  9645.  
  9646. else if ( dm.ItemHasTag( cardName, 'GT6' ) )
  9647. {
  9648. FactsAdd( "GwentTournament", 6 );
  9649. }
  9650.  
  9651. else if ( dm.ItemHasTag( cardName, 'GT7' ) )
  9652. {
  9653. FactsAdd( "GwentTournament", 7 );
  9654. }
  9655.  
  9656. CheckGwentTournamentDeck();
  9657. }
  9658.  
  9659. if( dm.ItemHasTag( cardName, 'EP2Tournament' ) )
  9660. {
  9661. if ( dm.ItemHasTag( cardName, 'GT1' ) )
  9662. {
  9663. FactsAdd( "EP2Tournament", 1 );
  9664. }
  9665.  
  9666. else if ( dm.ItemHasTag( cardName, 'GT2' ) )
  9667. {
  9668. FactsAdd( "EP2Tournament", 2 );
  9669. }
  9670.  
  9671. else if ( dm.ItemHasTag( cardName, 'GT3' ) )
  9672. {
  9673. FactsAdd( "EP2Tournament", 3 );
  9674. }
  9675.  
  9676. else if ( dm.ItemHasTag( cardName, 'GT4' ) )
  9677. {
  9678. FactsAdd( "EP2Tournament", 4 );
  9679. }
  9680.  
  9681. else if ( dm.ItemHasTag( cardName, 'GT5' ) )
  9682. {
  9683. FactsAdd( "EP2Tournament", 5 );
  9684. }
  9685.  
  9686. else if ( dm.ItemHasTag( cardName, 'GT6' ) )
  9687. {
  9688. FactsAdd( "EP2Tournament", 6 );
  9689. }
  9690.  
  9691. else if ( dm.ItemHasTag( cardName, 'GT7' ) )
  9692. {
  9693. FactsAdd( "EP2Tournament", 7 );
  9694. }
  9695.  
  9696. CheckEP2TournamentDeck();
  9697. }
  9698.  
  9699. gwintManager = theGame.GetGwintManager();
  9700. if( !gwintManager.IsDeckUnlocked( GwintFaction_Skellige ) &&
  9701. gwintManager.HasCardsOfFactionInCollection( GwintFaction_Skellige, false ) )
  9702. {
  9703. gwintManager.UnlockDeck( GwintFaction_Skellige );
  9704. }
  9705.  
  9706. return true;
  9707. }
  9708.  
  9709.  
  9710. public final function RemoveGwentCard(cardName : name, amount : int) : bool
  9711. {
  9712. var dm : CDefinitionsManagerAccessor;
  9713. var cardIndex, i : int;
  9714.  
  9715. dm = theGame.GetDefinitionsManager();
  9716.  
  9717. if(dm.ItemHasTag( cardName , 'GwintCardLeader' ))
  9718. {
  9719. cardIndex = theGame.GetGwintManager().GwentLeadersNametoInt( cardName );
  9720. for(i=0; i<amount; i+=1)
  9721. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  9722. }
  9723. else if(dm.ItemHasTag( cardName , 'GwintCardNrkd' ))
  9724. {
  9725. cardIndex = theGame.GetGwintManager().GwentNrkdNameToInt( cardName );
  9726. for(i=0; i<amount; i+=1)
  9727. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  9728. }
  9729. else if(dm.ItemHasTag( cardName , 'GwintCardNlfg' ))
  9730. {
  9731. cardIndex = theGame.GetGwintManager().GwentNlfgNameToInt( cardName );
  9732. for(i=0; i<amount; i+=1)
  9733. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  9734. }
  9735. else if(dm.ItemHasTag( cardName , 'GwintCardSctl' ))
  9736. {
  9737. cardIndex = theGame.GetGwintManager().GwentSctlNameToInt( cardName );
  9738. for(i=0; i<amount; i+=1)
  9739. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  9740. }
  9741. else if(dm.ItemHasTag( cardName , 'GwintCardMstr' ))
  9742. {
  9743. cardIndex = theGame.GetGwintManager().GwentMstrNameToInt( cardName );
  9744. for(i=0; i<amount; i+=1)
  9745. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  9746. }
  9747. else if(dm.ItemHasTag( cardName , 'GwintCardNeutral' ))
  9748. {
  9749. cardIndex = theGame.GetGwintManager().GwentNeutralNameToInt( cardName );
  9750. for(i=0; i<amount; i+=1)
  9751. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  9752. }
  9753. else if(dm.ItemHasTag( cardName , 'GwintCardSpcl' ))
  9754. {
  9755. cardIndex = theGame.GetGwintManager().GwentSpecialNameToInt( cardName );
  9756. for(i=0; i<amount; i+=1)
  9757. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  9758. }
  9759.  
  9760. if( dm.ItemHasTag( cardName, 'GwentTournament' ) )
  9761. {
  9762. if ( dm.ItemHasTag( cardName, 'GT1' ) )
  9763. {
  9764. FactsSubstract( "GwentTournament", 1 );
  9765. }
  9766.  
  9767. else if ( dm.ItemHasTag( cardName, 'GT2' ) )
  9768. {
  9769. FactsSubstract( "GwentTournament", 2 );
  9770. }
  9771.  
  9772. else if ( dm.ItemHasTag( cardName, 'GT3' ) )
  9773. {
  9774. FactsSubstract( "GwentTournament", 3 );
  9775. }
  9776.  
  9777. else if ( dm.ItemHasTag( cardName, 'GT4' ) )
  9778. {
  9779. FactsSubstract( "GwentTournament", 4 );
  9780. }
  9781.  
  9782. else if ( dm.ItemHasTag( cardName, 'GT5' ) )
  9783. {
  9784. FactsSubstract( "GwentTournament", 5 );
  9785. }
  9786.  
  9787. else if ( dm.ItemHasTag( cardName, 'GT6' ) )
  9788. {
  9789. FactsSubstract( "GwentTournament", 6 );
  9790. }
  9791.  
  9792. else if ( dm.ItemHasTag( cardName, 'GT7' ) )
  9793. {
  9794. FactsSubstract( "GwentTournament", 7 );
  9795. }
  9796.  
  9797. CheckGwentTournamentDeck();
  9798. }
  9799.  
  9800.  
  9801. if( dm.ItemHasTag( cardName, 'EP2Tournament' ) )
  9802. {
  9803. if ( dm.ItemHasTag( cardName, 'GT1' ) )
  9804. {
  9805. FactsSubstract( "EP2Tournament", 1 );
  9806. }
  9807.  
  9808. else if ( dm.ItemHasTag( cardName, 'GT2' ) )
  9809. {
  9810. FactsSubstract( "EP2Tournament", 2 );
  9811. }
  9812.  
  9813. else if ( dm.ItemHasTag( cardName, 'GT3' ) )
  9814. {
  9815. FactsSubstract( "EP2Tournament", 3 );
  9816. }
  9817.  
  9818. else if ( dm.ItemHasTag( cardName, 'GT4' ) )
  9819. {
  9820. FactsSubstract( "EP2Tournament", 4 );
  9821. }
  9822.  
  9823. else if ( dm.ItemHasTag( cardName, 'GT5' ) )
  9824. {
  9825. FactsSubstract( "EP2Tournament", 5 );
  9826. }
  9827.  
  9828. else if ( dm.ItemHasTag( cardName, 'GT6' ) )
  9829. {
  9830. FactsSubstract( "EP2Tournament", 6 );
  9831. }
  9832.  
  9833. else if ( dm.ItemHasTag( cardName, 'GT7' ) )
  9834. {
  9835. FactsSubstract( "EP2Tournament", 7 );
  9836. }
  9837.  
  9838. CheckEP2TournamentDeck();
  9839. }
  9840.  
  9841. return true;
  9842. }
  9843.  
  9844. function CheckGwentTournamentDeck()
  9845. {
  9846. var gwentPower : int;
  9847. var neededGwentPower : int;
  9848. var checkBreakpoint : int;
  9849.  
  9850. neededGwentPower = 70;
  9851.  
  9852. checkBreakpoint = neededGwentPower/5;
  9853. gwentPower = FactsQuerySum( "GwentTournament" );
  9854.  
  9855. if ( gwentPower >= neededGwentPower )
  9856. {
  9857. FactsAdd( "HasGwentTournamentDeck", 1 );
  9858. }
  9859. else
  9860. {
  9861. if( FactsDoesExist( "HasGwentTournamentDeck" ) )
  9862. {
  9863. FactsRemove( "HasGwentTournamentDeck" );
  9864. }
  9865.  
  9866. if ( gwentPower >= checkBreakpoint )
  9867. {
  9868. FactsAdd( "GwentTournamentObjective1", 1 );
  9869. }
  9870. else if ( FactsDoesExist( "GwentTournamentObjective1" ) )
  9871. {
  9872. FactsRemove( "GwentTournamentObjective1" );
  9873. }
  9874.  
  9875. if ( gwentPower >= checkBreakpoint*2 )
  9876. {
  9877. FactsAdd( "GwentTournamentObjective2", 1 );
  9878. }
  9879. else if ( FactsDoesExist( "GwentTournamentObjective2" ) )
  9880. {
  9881. FactsRemove( "GwentTournamentObjective2" );
  9882. }
  9883.  
  9884. if ( gwentPower >= checkBreakpoint*3 )
  9885. {
  9886. FactsAdd( "GwentTournamentObjective3", 1 );
  9887. }
  9888. else if ( FactsDoesExist( "GwentTournamentObjective3" ) )
  9889. {
  9890. FactsRemove( "GwentTournamentObjective3" );
  9891. }
  9892.  
  9893. if ( gwentPower >= checkBreakpoint*4 )
  9894. {
  9895. FactsAdd( "GwentTournamentObjective4", 1 );
  9896. }
  9897. else if ( FactsDoesExist( "GwentTournamentObjective4" ) )
  9898. {
  9899. FactsRemove( "GwentTournamentObjective4" );
  9900. }
  9901. }
  9902. }
  9903.  
  9904. function CheckEP2TournamentDeck()
  9905. {
  9906. var gwentPower : int;
  9907. var neededGwentPower : int;
  9908. var checkBreakpoint : int;
  9909.  
  9910. neededGwentPower = 24;
  9911.  
  9912. checkBreakpoint = neededGwentPower/5;
  9913. gwentPower = FactsQuerySum( "EP2Tournament" );
  9914.  
  9915. if ( gwentPower >= neededGwentPower )
  9916. {
  9917. if( FactsQuerySum( "HasEP2TournamentDeck") == 0 )
  9918. {
  9919. FactsAdd( "HasEP2TournamentDeck", 1 );
  9920. }
  9921.  
  9922. }
  9923. else
  9924. {
  9925. if( FactsDoesExist( "HasEP2TournamentDeck" ) )
  9926. {
  9927. FactsRemove( "HasEP2TournamentDeck" );
  9928. }
  9929.  
  9930. if ( gwentPower >= checkBreakpoint )
  9931. {
  9932. FactsAdd( "EP2TournamentObjective1", 1 );
  9933. }
  9934. else if ( FactsDoesExist( "EP2TournamentObjective1" ) )
  9935. {
  9936. FactsRemove( "EP2TournamentObjective1" );
  9937. }
  9938.  
  9939. if ( gwentPower >= checkBreakpoint*2 )
  9940. {
  9941. FactsAdd( "EP2TournamentObjective2", 1 );
  9942. }
  9943. else if ( FactsDoesExist( "EP2TournamentObjective2" ) )
  9944. {
  9945. FactsRemove( "EP2TournamentObjective2" );
  9946. }
  9947.  
  9948. if ( gwentPower >= checkBreakpoint*3 )
  9949. {
  9950. FactsAdd( "EP2TournamentObjective3", 1 );
  9951. }
  9952. else if ( FactsDoesExist( "EP2TournamentObjective3" ) )
  9953. {
  9954. FactsRemove( "EP2TournamentObjective3" );
  9955. }
  9956.  
  9957. if ( gwentPower >= checkBreakpoint*4 )
  9958. {
  9959. FactsAdd( "EP2TournamentObjective4", 1 );
  9960. }
  9961. else if ( FactsDoesExist( "EP2TournamentObjective4" ) )
  9962. {
  9963. FactsRemove( "EP2TournamentObjective4" );
  9964. }
  9965. }
  9966. }
  9967.  
  9968.  
  9969.  
  9970.  
  9971.  
  9972.  
  9973. public function SimulateBuffTimePassing(simulatedTime : float)
  9974. {
  9975. super.SimulateBuffTimePassing(simulatedTime);
  9976.  
  9977. FinishQuen(true);
  9978. }
  9979.  
  9980. public function CanMeditate() : bool
  9981. {
  9982. var currentStateName : name;
  9983.  
  9984. currentStateName = GetCurrentStateName();
  9985.  
  9986.  
  9987. if(currentStateName == 'Exploration' && !CanPerformPlayerAction())
  9988. return false;
  9989.  
  9990.  
  9991. if(GetCurrentStateName() != 'Exploration' && GetCurrentStateName() != 'Meditation' && GetCurrentStateName() != 'MeditationWaiting')
  9992. return false;
  9993.  
  9994.  
  9995. if(GetUsedVehicle())
  9996. return false;
  9997.  
  9998.  
  9999. return CanMeditateHere();
  10000. }
  10001.  
  10002.  
  10003. public final function CanMeditateWait(optional skipMeditationStateCheck : bool) : bool
  10004. {
  10005. var currState : name;
  10006.  
  10007. currState = GetCurrentStateName();
  10008.  
  10009.  
  10010.  
  10011. if(!skipMeditationStateCheck && currState != 'Meditation')
  10012. return false;
  10013.  
  10014. // W3EE - Begin
  10015.  
  10016. if(theGame.IsGameTimePaused())
  10017. {
  10018. return false;
  10019. }
  10020.  
  10021. if(!IsActionAllowed( EIAB_MeditationWaiting ))
  10022. {
  10023. return false;
  10024. }
  10025.  
  10026. if( IsThreatened() )
  10027. {
  10028. return false;
  10029. }
  10030.  
  10031. if( IsOnBoat() || IsInAir() || IsSwimming() )
  10032. {
  10033. return false;
  10034. }
  10035.  
  10036. return true;
  10037.  
  10038. // W3EE - End
  10039. }
  10040.  
  10041.  
  10042. public final function CanMeditateHere() : bool
  10043. {
  10044. var pos : Vector;
  10045.  
  10046. pos = GetWorldPosition();
  10047.  
  10048. // W3EE - Begin
  10049. if(pos.Z <= theGame.GetWorld().GetWaterLevel(pos, true) && IsInShallowWater())
  10050. {
  10051. return false;
  10052. }
  10053.  
  10054. if(IsThreatened())
  10055. {
  10056. return false;
  10057. }
  10058.  
  10059. if( !clockMenu )
  10060. {
  10061. if( ((CMovingPhysicalAgentComponent)GetMovingAgentComponent()).GetSubmergeDepth() < 0 )
  10062. {
  10063. return false;
  10064. }
  10065.  
  10066. return CanMeditateWait(true);
  10067. }
  10068. // W3EE - End
  10069.  
  10070. return true;
  10071. }
  10072.  
  10073. // W3EE - Begin
  10074. private var animManager : W3EEAnimationManager;
  10075. private function InitAnimManager()
  10076. {
  10077. if( !animManager )
  10078. {
  10079. animManager = new W3EEAnimationManager in this;
  10080. animManager.Init(this);
  10081. }
  10082. }
  10083.  
  10084. public function GetAnimManager() : W3EEAnimationManager
  10085. {
  10086. return animManager;
  10087. }
  10088.  
  10089. public function IsAnimated() : bool
  10090. {
  10091. return animManager.IsAnimated();
  10092. }
  10093.  
  10094. public timer function StartAnimatedState( dt : float, id : int )
  10095. {
  10096. animManager.GotoState('Animation');
  10097. }
  10098.  
  10099. public function GetAnimatedState() : W3EEAnimationManagerStateAnimation
  10100. {
  10101. return animManager.GetAnimatedState();
  10102. }
  10103.  
  10104. public function AdvanceTimeSeconds( seconds : int )
  10105. {
  10106. theGame.SetGameTime(theGame.GetGameTime() + GameTimeCreateFromGameSeconds(seconds), false);
  10107. UpdateEffectsAccelerated(ConvertGameSecondsToRealTimeSeconds(seconds));
  10108. }
  10109.  
  10110. public function IsMeditating() : bool
  10111. {
  10112. return GetCurrentStateName() == 'W3EEMeditation';
  10113. }
  10114.  
  10115. public function GetMeditationState() : W3PlayerWitcherStateW3EEMeditation
  10116. {
  10117. if( IsMeditating() )
  10118. {
  10119. return (W3PlayerWitcherStateW3EEMeditation)GetState('W3EEMeditation');
  10120. }
  10121.  
  10122. return NULL;
  10123. }
  10124.  
  10125. public function MeditationStartFastforwardMenu()
  10126. {
  10127. GetMeditationState().SetShouldMeditateMenu(true);
  10128. }
  10129.  
  10130. public function MeditationStartFastforward()
  10131. {
  10132. GetMeditationState().SetShouldMeditate(true);
  10133. }
  10134.  
  10135. public function MeditationEndFastforward()
  10136. {
  10137. GetMeditationState().SetShouldMeditate(false);
  10138. }
  10139.  
  10140. private var brewingInterrupted : bool;
  10141. timer function MeditationStartBrewing( dt : float, id : int )
  10142. {
  10143. GetMeditationState().SetShouldBrew();
  10144. }
  10145.  
  10146. public function HasNonAlliedActorsNearby() : bool
  10147. {
  10148. var entities : array< CGameplayEntity >;
  10149. var i : int;
  10150.  
  10151. FindGameplayEntitiesInRange( entities, thePlayer, 15, 10,, FLAG_ExcludePlayer + FLAG_OnlyAliveActors,, 'CActor' );
  10152. for( i = 0; i < entities.Size(); i += 1 )
  10153. {
  10154. if( ((CActor)entities[i]).GetAttitude( thePlayer ) != AIA_Friendly || ((CActor)entities[i]).GetAttitude( thePlayer ) != AIA_Neutral )
  10155. {
  10156. return true;
  10157. }
  10158. }
  10159. return false;
  10160. }
  10161.  
  10162. public function UpdateEffectsAccelerated( dt : float )
  10163. {
  10164. effectManager.PerformUpdate(dt);
  10165. }
  10166.  
  10167. private var noFireCall : bool;
  10168. public function GetNoFireCall() : bool
  10169. {
  10170. return noFireCall;
  10171. }
  10172.  
  10173. public function SetNoFireCall( b: bool )
  10174. {
  10175. noFireCall = b;
  10176. }
  10177.  
  10178. protected var inMeditationMenu : bool;
  10179. public function SetInMeditationMenu( b : bool )
  10180. {
  10181. inMeditationMenu = b;
  10182. }
  10183.  
  10184. timer function StartW3EEMeditationTimer( dt : float, id : int )
  10185. {
  10186. if( IsMeditating() )
  10187. {
  10188. if( !inMeditationMenu )
  10189. {
  10190. theGame.RequestMenuWithBackground( 'MeditationClockMenu', 'MeditationClockMenu' );
  10191. }
  10192. else
  10193. {
  10194. theGame.CloseMenu('MeditationClockMenu');
  10195. }
  10196. }
  10197. else
  10198. {
  10199. noFireCall = true;
  10200. StartW3EEMeditation();
  10201. }
  10202. }
  10203.  
  10204. timer function W3EEMeditationTimer( dt : float, id : int )
  10205. {
  10206. if( GetCurrentStateName() != 'W3EEMeditation' )
  10207. {
  10208. StartW3EEMeditation();
  10209. }
  10210. else
  10211. {
  10212. EndW3EEMeditation();
  10213. }
  10214. }
  10215.  
  10216. public function StartW3EEMeditation()
  10217. {
  10218. if( GetCurrentStateName() != 'W3EEMeditation' && CanMeditateHere() )
  10219. {
  10220. PushState( 'W3EEMeditation' );
  10221. }
  10222. else DisplayHudMessage(GetLocStringByKeyExt("menu_cannot_perform_action_here"));
  10223. }
  10224.  
  10225. public function EndW3EEMeditation()
  10226. {
  10227. if( GetCurrentStateName() == 'W3EEMeditation' && !inMeditationMenu && !GetMeditationState().IsActivelyMeditating() )
  10228. {
  10229. PopState();
  10230. }
  10231. }
  10232. // W3EE - End
  10233.  
  10234. public function Meditate() : bool
  10235. {
  10236. var medState : W3PlayerWitcherStateMeditation;
  10237. var stateName : name;
  10238.  
  10239. stateName = GetCurrentStateName();
  10240.  
  10241.  
  10242. if (!CanMeditate() || stateName == 'MeditationWaiting' )
  10243. return false;
  10244.  
  10245. GotoState('Meditation');
  10246. medState = (W3PlayerWitcherStateMeditation)GetState('Meditation');
  10247. medState.SetMeditationPointHeading(GetHeading());
  10248.  
  10249. return true;
  10250. }
  10251.  
  10252.  
  10253. public final function MeditationRestoring(simulatedTime : float)
  10254. {
  10255. // W3EE - Begin
  10256. /*if ( theGame.GetDifficultyMode() != EDM_Hard && theGame.GetDifficultyMode() != EDM_Hardcore )
  10257. {
  10258. Heal(GetStatMax(BCS_Vitality));
  10259. }
  10260.  
  10261.  
  10262. abilityManager.DrainToxicity( abilityManager.GetStat( BCS_Toxicity ) );
  10263.  
  10264. abilityManager.DrainFocus( abilityManager.GetStat( BCS_Focus ) );
  10265.  
  10266. inv.SingletonItemsRefillAmmo();
  10267.  
  10268.  
  10269. SimulateBuffTimePassing(simulatedTime);*/
  10270. // W3EE - End
  10271.  
  10272. ApplyWitcherHouseBuffs();
  10273. }
  10274.  
  10275. var clockMenu : CR4MeditationClockMenu;
  10276.  
  10277. public function MeditationClockStart(m : CR4MeditationClockMenu)
  10278. {
  10279. clockMenu = m;
  10280. AddTimer('UpdateClockTime',0.1,true);
  10281. }
  10282.  
  10283. public function MeditationClockStop()
  10284. {
  10285. clockMenu = NULL;
  10286. RemoveTimer('UpdateClockTime');
  10287. }
  10288.  
  10289. public timer function UpdateClockTime(dt : float, id : int)
  10290. {
  10291. if(clockMenu)
  10292. clockMenu.UpdateCurrentHours();
  10293. else
  10294. RemoveTimer('UpdateClockTime');
  10295. }
  10296.  
  10297. private var waitTimeHour : int;
  10298. public function SetWaitTargetHour(t : int)
  10299. {
  10300. waitTimeHour = t;
  10301. }
  10302. public function GetWaitTargetHour() : int
  10303. {
  10304. return waitTimeHour;
  10305. }
  10306.  
  10307. public function MeditationForceAbort(forceCloseUI : bool)
  10308. {
  10309. var waitt : W3PlayerWitcherStateMeditationWaiting;
  10310. var medd : W3PlayerWitcherStateMeditation;
  10311. var currentStateName : name;
  10312.  
  10313. currentStateName = GetCurrentStateName();
  10314.  
  10315. if(currentStateName == 'MeditationWaiting')
  10316. {
  10317. waitt = (W3PlayerWitcherStateMeditationWaiting)GetCurrentState();
  10318. if(waitt)
  10319. {
  10320. waitt.StopRequested(forceCloseUI);
  10321. }
  10322. }
  10323. else if(currentStateName == 'Meditation')
  10324. {
  10325. medd = (W3PlayerWitcherStateMeditation)GetCurrentState();
  10326. if(medd)
  10327. {
  10328. medd.StopRequested(forceCloseUI);
  10329. }
  10330. }
  10331.  
  10332.  
  10333.  
  10334. if(forceCloseUI && theGame.GetGuiManager().IsAnyMenu())
  10335. {
  10336. theGame.GetGuiManager().GetRootMenu().CloseMenu();
  10337. DisplayActionDisallowedHudMessage(EIAB_MeditationWaiting, false, false, true, false);
  10338. }
  10339.  
  10340. // W3EE - Begin
  10341. EndW3EEMeditation();
  10342. // W3EE - End
  10343. }
  10344.  
  10345. public function Runeword10Triggerred()
  10346. {
  10347. var min, max : SAbilityAttributeValue;
  10348.  
  10349. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Runeword 10 _Stats', 'stamina', min, max );
  10350. GainStat(BCS_Stamina, min.valueMultiplicative * GetStatMax(BCS_Stamina));
  10351. PlayEffect('runeword_10_stamina');
  10352. }
  10353.  
  10354. public function Runeword12Triggerred()
  10355. {
  10356. var min, max : SAbilityAttributeValue;
  10357.  
  10358. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Runeword 12 _Stats', 'focus', min, max );
  10359. GainStat(BCS_Focus, RandRangeF(max.valueAdditive, min.valueAdditive));
  10360. PlayEffect('runeword_20_adrenaline');
  10361. }
  10362.  
  10363. var runeword10TriggerredOnFinisher, runeword12TriggerredOnFinisher : bool;
  10364.  
  10365. event OnFinisherStart()
  10366. {
  10367. super.OnFinisherStart();
  10368.  
  10369. runeword10TriggerredOnFinisher = false;
  10370. runeword12TriggerredOnFinisher = false;
  10371. }
  10372.  
  10373. public function ApplyWitcherHouseBuffs()
  10374. {
  10375. var l_bed : W3WitcherBed;
  10376.  
  10377. if( FactsQuerySum( "PlayerInsideInnerWitcherHouse" ) > 0 )
  10378. {
  10379. l_bed = (W3WitcherBed)theGame.GetEntityByTag( 'witcherBed' );
  10380.  
  10381. if( l_bed.GetWasUsed() )
  10382. {
  10383. // W3EE - Begin
  10384. abilityManager.DrainToxicity( abilityManager.GetStat( BCS_Toxicity ) );
  10385. SimulateBuffTimePassing(0);
  10386. // W3EE - End
  10387.  
  10388. if( l_bed.GetBedLevel() != 0 )
  10389. {
  10390. AddEffectDefault( EET_WellRested, this, "Bed Buff" );
  10391. }
  10392.  
  10393. if( FactsQuerySum( "StablesExists" ) )
  10394. {
  10395. AddEffectDefault( EET_HorseStableBuff, this, "Stables" );
  10396. }
  10397.  
  10398. // W3EE - Begin
  10399. if( FactsQuerySum( "AlchemyTableExists" ) )
  10400. {
  10401. ManageAlchemyTableBonus();
  10402. }
  10403.  
  10404. /*if( l_bed.GetWereItemsRefilled() )
  10405. {
  10406. theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt( "message_common_alchemy_table_buff_applied" ),, true );
  10407. l_bed.SetWereItemsRefilled( false );
  10408. }*/
  10409. // W3EE - End
  10410.  
  10411. AddEffectDefault( EET_BookshelfBuff, this, "Bookshelf" );
  10412.  
  10413. Heal( GetStatMax( BCS_Vitality ) );
  10414. }
  10415. }
  10416. }
  10417.  
  10418. // W3EE - Begin
  10419. public function ManageAlchemyTableBonus()
  10420. {
  10421. AddEffectDefault( EET_AlchemyTable, this, "Alchemy Table" );
  10422. theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt( "message_common_alchemy_table_buff_applied" ),, true );
  10423. }
  10424. // W3EE - End
  10425.  
  10426. public function CheatResurrect()
  10427. {
  10428. super.CheatResurrect();
  10429. theGame.ReleaseNoSaveLock(theGame.deathSaveLockId);
  10430. theInput.RestoreContext( 'Exploration', true );
  10431. }
  10432.  
  10433.  
  10434. public function Debug_EquipTestingSkills(equip : bool, force : bool)
  10435. {
  10436. var skills : array<ESkill>;
  10437. var i, slot : int;
  10438.  
  10439.  
  10440. ((W3PlayerAbilityManager)abilityManager).OnLevelGained(36);
  10441.  
  10442. skills.PushBack(S_Magic_s01);
  10443. skills.PushBack(S_Magic_s02);
  10444. skills.PushBack(S_Magic_s03);
  10445. skills.PushBack(S_Magic_s04);
  10446. skills.PushBack(S_Magic_s05);
  10447. skills.PushBack(S_Sword_s01);
  10448. skills.PushBack(S_Sword_s02);
  10449.  
  10450.  
  10451. if(equip)
  10452. {
  10453. for(i=0; i<skills.Size(); i+=1)
  10454. {
  10455. if(!force && IsSkillEquipped(skills[i]))
  10456. continue;
  10457.  
  10458.  
  10459. if(GetSkillLevel(skills[i]) == 0)
  10460. AddSkill(skills[i]);
  10461.  
  10462.  
  10463. if(force)
  10464. slot = i+1;
  10465. else
  10466. slot = GetFreeSkillSlot();
  10467.  
  10468.  
  10469. EquipSkill(skills[i], slot);
  10470. }
  10471. }
  10472. else
  10473. {
  10474. for(i=0; i<skills.Size(); i+=1)
  10475. {
  10476. UnequipSkill(GetSkillSlotID(skills[i]));
  10477. }
  10478. }
  10479. }
  10480.  
  10481. public function Debug_ClearCharacterDevelopment(optional keepInv : bool)
  10482. {
  10483. var template : CEntityTemplate;
  10484. var entity : CEntity;
  10485. var invTesting : CInventoryComponent;
  10486. var i : int;
  10487. var items : array<SItemUniqueId>;
  10488. var abs : array<name>;
  10489.  
  10490. RemoveAllRepairBuffs();
  10491. items = inv.GetItemsByCategory('steelsword');
  10492. for(i=0; i<items.Size(); i+=1)
  10493. inv.RemoveAllOilsFromItem(items[i]);
  10494. items = inv.GetItemsByCategory('silversword');
  10495. for(i=0; i<items.Size(); i+=1)
  10496. inv.RemoveAllOilsFromItem(items[i]);
  10497.  
  10498. if( IsMutationSystemEnabled() )
  10499. mutations = true;
  10500.  
  10501. delete abilityManager;
  10502. delete levelManager;
  10503. delete effectManager;
  10504.  
  10505.  
  10506. GetCharacterStats().GetAbilities(abs, false);
  10507. for(i=0; i<abs.Size(); i+=1)
  10508. RemoveAbility(abs[i]);
  10509.  
  10510.  
  10511. abs.Clear();
  10512. GetCharacterStatsParam(abs);
  10513. for(i=0; i<abs.Size(); i+=1)
  10514. AddAbility(abs[i]);
  10515.  
  10516.  
  10517. levelManager = new W3LevelManager in this;
  10518. levelManager.Initialize();
  10519. levelManager.PostInit(this, false, true);
  10520.  
  10521.  
  10522. //AddAbility('GeraltSkills_Testing');
  10523. SetAbilityManager();
  10524. abilityManager.Init(this, GetCharacterStats(), false, theGame.GetDifficultyMode());
  10525.  
  10526. SetEffectManager();
  10527.  
  10528. abilityManager.PostInit();
  10529.  
  10530.  
  10531. for(i=1; i<=50; i+=1)
  10532. {
  10533. RemoveAbilityAll( GetLevelupAbility(i) );
  10534. AddAbility( GetLevelupAbility(i) );
  10535. }
  10536.  
  10537. // Lazarus - Clearing Potion
  10538. if(mutations)
  10539. MutationSystemEnable( true );
  10540.  
  10541. if(keepInv)
  10542. {
  10543. //inv.RemoveAllItems();
  10544. return;
  10545. }
  10546.  
  10547.  
  10548. template = (CEntityTemplate)LoadResource("geralt_inventory_release");
  10549. entity = theGame.CreateEntity(template, Vector(0,0,0));
  10550. invTesting = (CInventoryComponent)entity.GetComponentByClassName('CInventoryComponent');
  10551. invTesting.GiveAllItemsTo(inv, true);
  10552. entity.Destroy();
  10553.  
  10554.  
  10555. inv.GetAllItems(items);
  10556. for(i=0; i<items.Size(); i+=1)
  10557. {
  10558. if(!inv.ItemHasTag(items[i], 'NoDrop'))
  10559. EquipItem(items[i]);
  10560. }
  10561.  
  10562. if( !HasBuff(EET_Poise) )
  10563. AddEffectDefault(EET_Poise, this, "Poise");
  10564. //Debug_GiveTestingItems(0);
  10565. }
  10566.  
  10567. function Debug_BearSetBonusQuenSkills()
  10568. {
  10569. var skills : array<ESkill>;
  10570. var i, slot : int;
  10571.  
  10572. skills.PushBack(S_Magic_s04);
  10573. skills.PushBack(S_Magic_s14);
  10574.  
  10575. for(i=0; i<skills.Size(); i+=1)
  10576. {
  10577.  
  10578. if(GetSkillLevel(skills[i]) == 0)
  10579. {
  10580. AddSkill(skills[i]);
  10581. }
  10582.  
  10583. slot = GetFreeSkillSlot();
  10584.  
  10585.  
  10586. EquipSkill(skills[i], slot);
  10587. }
  10588. }
  10589.  
  10590. final function Debug_HAX_UnlockSkillSlot(slotIndex : int) : bool
  10591. {
  10592. if(abilityManager && abilityManager.IsInitialized())
  10593. return ((W3PlayerAbilityManager)abilityManager).Debug_HAX_UnlockSkillSlot(slotIndex);
  10594.  
  10595. return false;
  10596. }
  10597.  
  10598.  
  10599. public function GetLevelupAbility( id : int) : name
  10600. {
  10601. switch(id)
  10602. {
  10603. case 1: return 'Lvl1';
  10604. case 2: return 'Lvl2';
  10605. case 3: return 'Lvl3';
  10606. case 4: return 'Lvl4';
  10607. case 5: return 'Lvl5';
  10608. case 6: return 'Lvl6';
  10609. case 7: return 'Lvl7';
  10610. case 8: return 'Lvl8';
  10611. case 9: return 'Lvl9';
  10612. case 10: return 'Lvl10';
  10613. case 11: return 'Lvl11';
  10614. case 12: return 'Lvl12';
  10615. case 13: return 'Lvl13';
  10616. case 14: return 'Lvl14';
  10617. case 15: return 'Lvl15';
  10618. case 16: return 'Lvl16';
  10619. case 17: return 'Lvl17';
  10620. case 18: return 'Lvl18';
  10621. case 19: return 'Lvl19';
  10622. case 20: return 'Lvl20';
  10623. case 21: return 'Lvl21';
  10624. case 22: return 'Lvl22';
  10625. case 23: return 'Lvl23';
  10626. case 24: return 'Lvl24';
  10627. case 25: return 'Lvl25';
  10628. case 26: return 'Lvl26';
  10629. case 27: return 'Lvl27';
  10630. case 28: return 'Lvl28';
  10631. case 29: return 'Lvl29';
  10632. case 30: return 'Lvl30';
  10633. case 31: return 'Lvl31';
  10634. case 32: return 'Lvl32';
  10635. case 33: return 'Lvl33';
  10636. case 34: return 'Lvl34';
  10637. case 35: return 'Lvl35';
  10638. case 36: return 'Lvl36';
  10639. case 37: return 'Lvl37';
  10640. case 38: return 'Lvl38';
  10641. case 39: return 'Lvl39';
  10642. case 40: return 'Lvl40';
  10643. case 41: return 'Lvl41';
  10644. case 42: return 'Lvl42';
  10645. case 43: return 'Lvl43';
  10646. case 44: return 'Lvl44';
  10647. case 45: return 'Lvl45';
  10648. case 46: return 'Lvl46';
  10649. case 47: return 'Lvl47';
  10650. case 48: return 'Lvl48';
  10651. case 49: return 'Lvl49';
  10652. case 50: return 'Lvl50';
  10653.  
  10654. default: return '';
  10655. }
  10656.  
  10657. return '';
  10658. }
  10659.  
  10660. public function CanSprint( speed : float ) : bool
  10661. {
  10662. if( !super.CanSprint( speed ) )
  10663. {
  10664. return false;
  10665. }
  10666. if( rangedWeapon && rangedWeapon.GetCurrentStateName() != 'State_WeaponWait' )
  10667. {
  10668. if ( this.GetPlayerCombatStance() == PCS_AlertNear )
  10669. {
  10670. if ( IsSprintActionPressed() )
  10671. OnRangedForceHolster( true, false );
  10672. }
  10673. else
  10674. return false;
  10675. }
  10676. if( GetCurrentStateName() != 'Swimming' && GetStat(BCS_Stamina) <= 0 )
  10677. {
  10678. SetSprintActionPressed(false,true);
  10679. return false;
  10680. }
  10681.  
  10682. return true;
  10683. }
  10684.  
  10685. public function ManageSleeping()
  10686. {
  10687. thePlayer.RemoveBuffImmunity_AllCritical( 'Bed' );
  10688. thePlayer.RemoveBuffImmunity_AllNegative( 'Bed' );
  10689.  
  10690. thePlayer.PlayerStopAction( PEA_GoToSleep );
  10691. }
  10692.  
  10693.  
  10694.  
  10695. public function RestoreHorseManager() : bool
  10696. {
  10697. var horseTemplate : CEntityTemplate;
  10698. var horseManager : W3HorseManager;
  10699.  
  10700. if ( GetHorseManager() )
  10701. {
  10702. return false;
  10703. }
  10704.  
  10705. horseTemplate = (CEntityTemplate)LoadResource("horse_manager");
  10706. horseManager = (W3HorseManager)theGame.CreateEntity(horseTemplate, GetWorldPosition(),,,,,PM_Persist);
  10707. horseManager.CreateAttachment(this);
  10708. horseManager.OnCreated();
  10709. EntityHandleSet( horseManagerHandle, horseManager );
  10710.  
  10711. return true;
  10712. }
  10713.  
  10714.  
  10715.  
  10716.  
  10717.  
  10718.  
  10719. final function PerformParryCheck( parryInfo : SParryInfo ) : bool
  10720. {
  10721. if( super.PerformParryCheck( parryInfo ) )
  10722. {
  10723. // W3EE - Begin
  10724. // GainAdrenalineFromPerk21( 'parry' );
  10725. // W3EE - End
  10726. return true;
  10727. }
  10728. return false;
  10729. }
  10730.  
  10731. protected final function PerformCounterCheck( parryInfo: SParryInfo ) : bool
  10732. {
  10733. var fistFightCheck, isInFistFight : bool;
  10734.  
  10735. if( super.PerformCounterCheck( parryInfo ) )
  10736. {
  10737. // W3EE - Begin
  10738. // GainAdrenalineFromPerk21( 'counter' );
  10739. // W3EE - End
  10740.  
  10741. isInFistFight = FistFightCheck( parryInfo.target, parryInfo.attacker, fistFightCheck );
  10742.  
  10743. if( isInFistFight && fistFightCheck )
  10744. {
  10745. FactsAdd( "statistics_fist_fight_counter" );
  10746. AddTimer( 'FistFightCounterTimer', 0.5f, , , , true );
  10747. }
  10748.  
  10749. return true;
  10750. }
  10751. return false;
  10752. }
  10753.  
  10754. public function GainAdrenalineFromPerk21( n : name )
  10755. {
  10756. var perkStats, perkTime : SAbilityAttributeValue;
  10757. var targets : array<CActor>;
  10758.  
  10759. targets = GetHostileEnemies();
  10760.  
  10761. if( !CanUseSkill( S_Perk_21 ) || targets.Size() == 0 )
  10762. {
  10763. return;
  10764. }
  10765.  
  10766. perkTime = GetSkillAttributeValue( S_Perk_21, 'perk21Time', false, false );
  10767.  
  10768. if( theGame.GetEngineTimeAsSeconds() >= timeForPerk21 + perkTime.valueAdditive )
  10769. {
  10770. perkStats = GetSkillAttributeValue( S_Perk_21, n , false, false );
  10771. GainStat( BCS_Focus, perkStats.valueAdditive );
  10772. timeForPerk21 = theGame.GetEngineTimeAsSeconds();
  10773.  
  10774. AddEffectDefault( EET_Perk21InternalCooldown, this, "Perk21", false );
  10775. }
  10776. }
  10777.  
  10778. timer function FistFightCounterTimer( dt : float, id : int )
  10779. {
  10780. FactsRemove( "statistics_fist_fight_counter" );
  10781. }
  10782.  
  10783. public final function IsSignBlocked(signType : ESignType) : bool
  10784. {
  10785. switch( signType )
  10786. {
  10787. case ST_Aard :
  10788. return IsRadialSlotBlocked ( 'Aard');
  10789. break;
  10790. case ST_Axii :
  10791. return IsRadialSlotBlocked ( 'Axii');
  10792. break;
  10793. case ST_Igni :
  10794. return IsRadialSlotBlocked ( 'Igni');
  10795. break;
  10796. case ST_Quen :
  10797. return IsRadialSlotBlocked ( 'Quen');
  10798. break;
  10799. case ST_Yrden :
  10800. return IsRadialSlotBlocked ( 'Yrden');
  10801. break;
  10802. default:
  10803. break;
  10804. }
  10805. return false;
  10806.  
  10807. }
  10808.  
  10809. public final function AddAnItemWithAutogenLevelAndQuality(itemName : name, desiredLevel : int, minQuality : int, optional equipItem : bool)
  10810. {
  10811. var itemLevel, quality : int;
  10812. var ids : array<SItemUniqueId>;
  10813. var attemptCounter : int;
  10814.  
  10815. itemLevel = 0;
  10816. quality = 0;
  10817. attemptCounter = 0;
  10818. while(itemLevel != desiredLevel || quality < minQuality)
  10819. {
  10820. attemptCounter += 1;
  10821. ids.Clear();
  10822. ids = inv.AddAnItem(itemName, 1, true);
  10823. itemLevel = inv.GetItemLevel(ids[0]);
  10824. quality = RoundMath(CalculateAttributeValue(inv.GetItemAttributeValue(ids[0], 'quality')));
  10825.  
  10826.  
  10827. if(attemptCounter >= 1000)
  10828. break;
  10829.  
  10830. if(itemLevel != desiredLevel || quality < minQuality)
  10831. inv.RemoveItem(ids[0]);
  10832. }
  10833.  
  10834. if(equipItem)
  10835. EquipItem(ids[0]);
  10836. }
  10837.  
  10838. public final function AddAnItemWithAutogenLevel(itemName : name, desiredLevel : int)
  10839. {
  10840. var itemLevel : int;
  10841. var ids : array<SItemUniqueId>;
  10842. var attemptCounter : int;
  10843.  
  10844. itemLevel = 0;
  10845. while(itemLevel != desiredLevel)
  10846. {
  10847. attemptCounter += 1;
  10848. ids.Clear();
  10849. ids = inv.AddAnItem(itemName, 1, true);
  10850. itemLevel = inv.GetItemLevel(ids[0]);
  10851.  
  10852.  
  10853. if(attemptCounter >= 1000)
  10854. break;
  10855.  
  10856. if(itemLevel != desiredLevel)
  10857. inv.RemoveItem(ids[0]);
  10858. }
  10859. }
  10860.  
  10861. public final function AddAnItemWithMinQuality(itemName : name, minQuality : int, optional equip : bool)
  10862. {
  10863. var quality : int;
  10864. var ids : array<SItemUniqueId>;
  10865. var attemptCounter : int;
  10866.  
  10867. quality = 0;
  10868. while(quality < minQuality)
  10869. {
  10870. attemptCounter += 1;
  10871. ids.Clear();
  10872. ids = inv.AddAnItem(itemName, 1, true);
  10873. quality = RoundMath(CalculateAttributeValue(inv.GetItemAttributeValue(ids[0], 'quality')));
  10874.  
  10875.  
  10876. if(attemptCounter >= 1000)
  10877. break;
  10878.  
  10879. if(quality < minQuality)
  10880. inv.RemoveItem(ids[0]);
  10881. }
  10882.  
  10883. if(equip)
  10884. EquipItem(ids[0]);
  10885. }
  10886.  
  10887.  
  10888.  
  10889.  
  10890.  
  10891.  
  10892. public function IsSetBonusActive( bonus : EItemSetBonus ) : bool
  10893. {
  10894. switch(bonus)
  10895. {
  10896. case EISB_Lynx_1: return amountOfSetPiecesEquipped[ EIST_Lynx ] + Max(0, amountOfSetPiecesEquipped[ EIST_MinorLynx ] - (theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS - theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS)) >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  10897. case EISB_Lynx_2: return amountOfSetPiecesEquipped[ EIST_Lynx ] >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS;
  10898. case EISB_Gryphon_2: return amountOfSetPiecesEquipped[ EIST_Gryphon ] + Max(0, amountOfSetPiecesEquipped[ EIST_MinorGryphon ] - (theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS - theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS)) >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  10899. case EISB_Gryphon_1: return amountOfSetPiecesEquipped[ EIST_Gryphon ] >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS;
  10900. case EISB_Bear_1: return amountOfSetPiecesEquipped[ EIST_Bear ] + Max(0, amountOfSetPiecesEquipped[ EIST_MinorBear ] - (theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS - theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS)) >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  10901. case EISB_Bear_2: return amountOfSetPiecesEquipped[ EIST_Bear ] >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS;
  10902. case EISB_Wolf_1: return amountOfSetPiecesEquipped[ EIST_Wolf ] + Max(0, amountOfSetPiecesEquipped[ EIST_MinorWolf ] - (theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS - theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS)) >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  10903. case EISB_Wolf_2: return amountOfSetPiecesEquipped[ EIST_Wolf ] >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS;
  10904. case EISB_RedWolf_1: return amountOfSetPiecesEquipped[ EIST_RedWolf ] + Max(0, amountOfSetPiecesEquipped[ EIST_MinorRedWolf ] - (theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS - theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS)) >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  10905. case EISB_RedWolf_2: return amountOfSetPiecesEquipped[ EIST_RedWolf ] >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS;
  10906. //case EISB_Vampire: return amountOfSetPiecesEquipped[ EIST_Vampire ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  10907. // W3EE - Begin
  10908. case EISB_Viper1: return amountOfSetPiecesEquipped[ EIST_Viper ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  10909. case EISB_Viper2: return amountOfSetPiecesEquipped[ EIST_Viper ] >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS;
  10910. case EISB_Gothic1: return amountOfSetPiecesEquipped[ EIST_Gothic ] + IsHelmetEquipped(EIST_Gothic) >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  10911. case EISB_Gothic2: return amountOfSetPiecesEquipped[ EIST_Gothic ] + IsHelmetEquipped(EIST_Gothic) >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS;
  10912. case EISB_Dimeritium1: return amountOfSetPiecesEquipped[ EIST_Dimeritium ] + IsHelmetEquipped(EIST_Dimeritium) >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  10913. case EISB_Dimeritium2: return amountOfSetPiecesEquipped[ EIST_Dimeritium ] + IsHelmetEquipped(EIST_Dimeritium) >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS;
  10914. case EISB_Meteorite: return amountOfSetPiecesEquipped[ EIST_Meteorite ] + IsHelmetEquipped(EIST_Meteorite) >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS;
  10915.  
  10916. case EISB_LightArmor: return GetSetPartsEquipped(EIST_LightArmor) >= 4;
  10917. case EISB_MediumArmor: return GetSetPartsEquipped(EIST_MediumArmor) >= 4;
  10918. case EISB_HeavyArmor: return GetSetPartsEquipped(EIST_HeavyArmor) >= 4;
  10919. // W3EE - End
  10920. default: return false;
  10921. }
  10922. }
  10923.  
  10924. // W3EE - Begin
  10925. public function GetSetPartsEquipped( setType : EItemSetType ) : int
  10926. {
  10927. if( setType == EIST_LightArmor )
  10928. return armorPiecesOriginal[0].all + armorPiecesOriginal[1].all;
  10929. else
  10930. if( setType == EIST_MediumArmor )
  10931. return armorPiecesOriginal[2].all;
  10932. else
  10933. if( setType == EIST_HeavyArmor )
  10934. return armorPiecesOriginal[3].all;
  10935. else
  10936. if( IsMinorSetType(setType) )
  10937. return amountOfSetPiecesEquipped[ setType ] + amountOfSetPiecesEquipped[ GetSetTypeMajor(setType) ] + IsHelmetEquipped(setType);
  10938. else
  10939. return amountOfSetPiecesEquipped[ setType ] + amountOfSetPiecesEquipped[ GetSetTypeMinor(setType) ] + IsHelmetEquipped(setType);
  10940. }
  10941.  
  10942. public function IsMinorSetType( setType : EItemSetType ) : bool
  10943. {
  10944. switch(setType)
  10945. {
  10946. case EIST_MinorLynx:
  10947. case EIST_MinorGryphon:
  10948. case EIST_MinorBear:
  10949. case EIST_MinorWolf:
  10950. case EIST_MinorRedWolf:
  10951. return true;
  10952. default:
  10953. return false;
  10954. }
  10955. }
  10956.  
  10957. public function GetSetTypeMinor( setType : EItemSetType ) : EItemSetType
  10958. {
  10959. switch(setType)
  10960. {
  10961. case EIST_Lynx: return EIST_MinorLynx;
  10962. case EIST_Gryphon: return EIST_MinorGryphon;
  10963. case EIST_Bear: return EIST_MinorBear;
  10964. case EIST_Wolf: return EIST_MinorWolf;
  10965. case EIST_RedWolf: return EIST_MinorRedWolf;
  10966. default: return EIST_Undefined;
  10967. }
  10968. }
  10969.  
  10970. public function GetSetTypeMajor( setType : EItemSetType ) : EItemSetType
  10971. {
  10972. switch(setType)
  10973. {
  10974. case EIST_MinorLynx: return EIST_Lynx;
  10975. case EIST_MinorGryphon: return EIST_Gryphon;
  10976. case EIST_MinorBear: return EIST_Bear;
  10977. case EIST_MinorWolf: return EIST_Wolf;
  10978. case EIST_MinorRedWolf: return EIST_RedWolf;
  10979. default: return EIST_Undefined;
  10980. }
  10981. }
  10982.  
  10983. private saved var currentHelmet : EItemSetType;
  10984. public function SetCurrentHelmet( type : EItemSetType )
  10985. {
  10986. currentHelmet = type;
  10987. }
  10988.  
  10989. public function IsHelmetEquipped( type : EItemSetType ) : int
  10990. {
  10991. if( currentHelmet == type && FactsDoesExist("isWearingHelmet") )
  10992. return 1;
  10993.  
  10994. return 0;
  10995. }
  10996.  
  10997. public function UpdateAllSetBonuses( increment : bool )
  10998. {
  10999. var setType : EItemSetType;
  11000. var tutorialStateSets : W3TutorialManagerUIHandlerStateSetItemsUnlocked;
  11001. var id : SItemUniqueId;
  11002. var i : int;
  11003.  
  11004. for(i=1; i<=EnumGetMax('EItemSetType')-8; i+=1)
  11005. {
  11006. setType = (EItemSetType)i;
  11007.  
  11008. if( increment )
  11009. {
  11010. amountOfSetPiecesEquipped[ setType ] += 1;
  11011.  
  11012. if( amountOfSetPiecesEquipped[ setType ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS && ShouldProcessTutorial( 'TutorialSetBonusesUnlocked' ) && theGame.GetTutorialSystem().uiHandler && theGame.GetTutorialSystem().uiHandler.GetCurrentStateName() == 'SetItemsUnlocked' )
  11013. {
  11014. tutorialStateSets = ( W3TutorialManagerUIHandlerStateSetItemsUnlocked )theGame.GetTutorialSystem().uiHandler.GetCurrentState();
  11015. tutorialStateSets.OnSetBonusCompleted();
  11016. }
  11017. }
  11018. else if( amountOfSetPiecesEquipped[ setType ] > 0 )
  11019. {
  11020. amountOfSetPiecesEquipped[ setType ] -= 1;
  11021. }
  11022.  
  11023. if( setType != EIST_Vampire && amountOfSetPiecesEquipped[ setType ] == theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS )
  11024. {
  11025. theGame.GetGamerProfile().AddAchievement( EA_ReadyToRoll );
  11026. }
  11027.  
  11028. if( GetItemEquippedOnSlot( EES_SteelSword, id ) )
  11029. {
  11030. RemoveExtraOilsFromItem( id, ( increment && IsSetBonusActive( EISB_Viper1 ) ), CanUseSkill(S_Alchemy_s07) );
  11031. }
  11032. if( GetItemEquippedOnSlot( EES_SilverSword, id ) )
  11033. {
  11034. RemoveExtraOilsFromItem( id, ( increment && IsSetBonusActive( EISB_Viper1 ) ), CanUseSkill(S_Alchemy_s07) );
  11035. }
  11036.  
  11037. ManageActiveSetBonuses( setType );
  11038.  
  11039. ManageSetBonusesSoundbanks( setType );
  11040. }
  11041. }
  11042.  
  11043. public function UpdateItemSetBonuses( item : SItemUniqueId, increment : bool )
  11044. {
  11045. var setType : EItemSetType;
  11046. var tutorialStateSets : W3TutorialManagerUIHandlerStateSetItemsUnlocked;
  11047. var id : SItemUniqueId;
  11048.  
  11049. if( !inv.IsIdValid( item ) || !inv.IsItemSetItem(item) )
  11050. {
  11051.  
  11052. if( GetItemEquippedOnSlot( EES_SteelSword, id ) )
  11053. {
  11054. RemoveExtraOilsFromItem( id, IsSetBonusActive( EISB_Viper1 ) , CanUseSkill(S_Alchemy_s07) );
  11055. }
  11056. if( GetItemEquippedOnSlot( EES_SilverSword, id ) )
  11057. {
  11058. RemoveExtraOilsFromItem( id, IsSetBonusActive( EISB_Viper1 ) , CanUseSkill(S_Alchemy_s07) );
  11059. }
  11060.  
  11061. return;
  11062. }
  11063.  
  11064. setType = CheckSetType( item );
  11065.  
  11066. if( increment )
  11067. {
  11068. amountOfSetPiecesEquipped[ setType ] += 1;
  11069.  
  11070. if( amountOfSetPiecesEquipped[ setType ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS && ShouldProcessTutorial( 'TutorialSetBonusesUnlocked' ) && theGame.GetTutorialSystem().uiHandler && theGame.GetTutorialSystem().uiHandler.GetCurrentStateName() == 'SetItemsUnlocked' )
  11071. {
  11072. tutorialStateSets = ( W3TutorialManagerUIHandlerStateSetItemsUnlocked )theGame.GetTutorialSystem().uiHandler.GetCurrentState();
  11073. tutorialStateSets.OnSetBonusCompleted();
  11074. }
  11075. }
  11076. else if( amountOfSetPiecesEquipped[ setType ] > 0 )
  11077. {
  11078. amountOfSetPiecesEquipped[ setType ] -= 1;
  11079. }
  11080.  
  11081.  
  11082. if( setType != EIST_Vampire && amountOfSetPiecesEquipped[ setType ] == theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS )
  11083. {
  11084. theGame.GetGamerProfile().AddAchievement( EA_ReadyToRoll );
  11085. }
  11086.  
  11087.  
  11088. if( GetItemEquippedOnSlot( EES_SteelSword, id ) )
  11089. {
  11090. RemoveExtraOilsFromItem( id, IsSetBonusActive( EISB_Viper1 ) , CanUseSkill(S_Alchemy_s07) );
  11091. }
  11092. if( GetItemEquippedOnSlot( EES_SilverSword, id ) )
  11093. {
  11094. RemoveExtraOilsFromItem( id, IsSetBonusActive( EISB_Viper1 ) , CanUseSkill(S_Alchemy_s07) );
  11095. }
  11096.  
  11097. ManageActiveSetBonuses( setType );
  11098.  
  11099.  
  11100. ManageSetBonusesSoundbanks( setType );
  11101. }
  11102. // W3EE - End
  11103.  
  11104. public function ManageActiveSetBonuses( setType : EItemSetType )
  11105. {
  11106. var l_i : int;
  11107.  
  11108.  
  11109. if( setType == EIST_Lynx )
  11110. {
  11111.  
  11112. if( HasBuff( EET_LynxSetBonus ) && !IsSetBonusActive( EISB_Lynx_1 ) )
  11113. {
  11114. RemoveBuff( EET_LynxSetBonus );
  11115. }
  11116. }
  11117. // W3EE - Begin
  11118. else
  11119. if( setType == EIST_MediumArmor )
  11120. {
  11121. if( IsSetBonusActive(EISB_MediumArmor) )
  11122. AddAbility('MediumSetBonusAbility', false);
  11123. else
  11124. RemoveAbility('MediumSetBonusAbility');
  11125. }
  11126. else
  11127. if( setType == EIST_Dimeritium )
  11128. {
  11129. if( !IsSetBonusActive(EISB_Dimeritium1) )
  11130. {
  11131. ((W3Effect_DimeritiumCharge)GetBuff(EET_DimeritiumCharge, "DimeritiumSetBonus")).SetDimeritiumCharge(0);
  11132. RemoveBuff(EET_DimeritiumCharge);
  11133. }
  11134. }
  11135. else
  11136. if( setType == EIST_Bear )
  11137. {
  11138. if( !IsSetBonusActive(EISB_Bear_2) )
  11139. RemoveBuff(EET_WolfSetParry);
  11140. }
  11141. // W3EE - End
  11142. else if( setType == EIST_Gryphon )
  11143. {
  11144.  
  11145. if( !IsSetBonusActive( EISB_Gryphon_1 ) )
  11146. {
  11147. RemoveBuff( EET_GryphonSetBonus );
  11148. }
  11149.  
  11150. /*if( IsSetBonusActive( EISB_Gryphon_2 ) && !HasBuff( EET_GryphonSetBonusYrden ) )
  11151. {
  11152. for( l_i = 0 ; l_i < yrdenEntities.Size() ; l_i += 1 )
  11153. {
  11154. if( yrdenEntities[ l_i ].GetIsPlayerInside() && !yrdenEntities[ l_i ].IsAlternateCast() )
  11155. {
  11156. AddEffectDefault( EET_GryphonSetBonusYrden, this, "GryphonSetBonusYrden" );
  11157. break;
  11158. }
  11159. }
  11160. }
  11161. else
  11162. {
  11163. RemoveBuff( EET_GryphonSetBonusYrden );
  11164. }*/
  11165. }
  11166. }
  11167.  
  11168. public function CheckSetTypeByName( itemName : name ) : EItemSetType
  11169. {
  11170. var dm : CDefinitionsManagerAccessor;
  11171.  
  11172. dm = theGame.GetDefinitionsManager();
  11173.  
  11174. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_LYNX ) )
  11175. {
  11176. if( dm.ItemHasTag(itemName, theGame.params.ITEM_SET_TAG_BONUS) )
  11177. return EIST_Lynx;
  11178. else
  11179. return EIST_MinorLynx;
  11180. }
  11181. else
  11182. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_GRYPHON ) )
  11183. {
  11184. if( dm.ItemHasTag(itemName, theGame.params.ITEM_SET_TAG_BONUS) )
  11185. return EIST_Gryphon;
  11186. else
  11187. return EIST_MinorGryphon;
  11188. }
  11189. else
  11190. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_BEAR ) )
  11191. {
  11192. if( dm.ItemHasTag(itemName, theGame.params.ITEM_SET_TAG_BONUS) )
  11193. return EIST_Bear;
  11194. else
  11195. return EIST_MinorBear;
  11196. }
  11197. else
  11198. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_WOLF ) )
  11199. {
  11200. if( dm.ItemHasTag(itemName, theGame.params.ITEM_SET_TAG_BONUS) )
  11201. return EIST_Wolf;
  11202. else
  11203. return EIST_MinorWolf;
  11204. }
  11205. else
  11206. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_RED_WOLF ) )
  11207. {
  11208. if( dm.ItemHasTag(itemName, theGame.params.ITEM_SET_TAG_BONUS) )
  11209. return EIST_RedWolf;
  11210. else
  11211. return EIST_MinorRedWolf;
  11212. }
  11213. else
  11214. /*if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_VAMPIRE ) )
  11215. {
  11216. return EIST_Vampire;
  11217. }
  11218. else*/
  11219. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_VIPER ) )
  11220. {
  11221. return EIST_Viper;
  11222. }
  11223. // W3EE - Begin
  11224. else
  11225. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_GOTHIC ) )
  11226. {
  11227. return EIST_Gothic;
  11228. }
  11229. else
  11230. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_DIMERITIUM ) )
  11231. {
  11232. return EIST_Dimeritium;
  11233. }
  11234. else
  11235. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_METEORITE ) )
  11236. {
  11237. return EIST_Meteorite;
  11238. }
  11239. else
  11240. if( inv.GetArmorTypeOriginal(inv.GetItemId(itemName)) == EAT_Light )
  11241. {
  11242. return EIST_LightArmor;
  11243. }
  11244. else
  11245. if( inv.GetArmorTypeOriginal(inv.GetItemId(itemName)) == EAT_Medium )
  11246. {
  11247. return EIST_MediumArmor;
  11248. }
  11249. else
  11250. if( inv.GetArmorTypeOriginal(inv.GetItemId(itemName)) == EAT_Heavy )
  11251. {
  11252. return EIST_HeavyArmor;
  11253. }
  11254. // W3EE - End
  11255. else
  11256. {
  11257. return EIST_Undefined;
  11258. }
  11259. }
  11260.  
  11261. public function CheckSetType( item : SItemUniqueId ) : EItemSetType
  11262. {
  11263. var stopLoop : bool;
  11264. var tags : array<name>;
  11265. var i : int;
  11266. var setType : EItemSetType;
  11267.  
  11268. stopLoop = false;
  11269.  
  11270. inv.GetItemTags( item, tags );
  11271.  
  11272.  
  11273. for( i=0; i<tags.Size(); i+=1 )
  11274. {
  11275. switch( tags[i] )
  11276. {
  11277. case theGame.params.ITEM_SET_TAG_LYNX:
  11278. case theGame.params.ITEM_SET_TAG_GRYPHON:
  11279. case theGame.params.ITEM_SET_TAG_BEAR:
  11280. case theGame.params.ITEM_SET_TAG_WOLF:
  11281. case theGame.params.ITEM_SET_TAG_RED_WOLF:
  11282. case theGame.params.ITEM_SET_TAG_VAMPIRE:
  11283. case theGame.params.ITEM_SET_TAG_VIPER:
  11284. // W3EE - Begin
  11285. case theGame.params.ITEM_SET_TAG_GOTHIC:
  11286. case theGame.params.ITEM_SET_TAG_DIMERITIUM:
  11287. case theGame.params.ITEM_SET_TAG_METEORITE:
  11288. // W3EE - End
  11289. setType = SetItemNameToType( tags[i] );
  11290. stopLoop = true;
  11291. break;
  11292. }
  11293. if ( stopLoop )
  11294. {
  11295. break;
  11296. }
  11297. }
  11298.  
  11299. // W3EE - Begin
  11300. if( !inv.IsItemGrandmasterItem(item) )
  11301. {
  11302. switch(setType)
  11303. {
  11304. case EIST_Lynx:
  11305. return EIST_MinorLynx;
  11306. case EIST_Gryphon:
  11307. return EIST_MinorGryphon;
  11308. case EIST_Bear:
  11309. return EIST_MinorBear;
  11310. case EIST_Wolf:
  11311. return EIST_MinorWolf;
  11312. case EIST_RedWolf:
  11313. return EIST_MinorRedWolf;
  11314. default: break;
  11315. }
  11316. }
  11317.  
  11318. if( !stopLoop )
  11319. {
  11320. if( inv.GetArmorTypeOriginal(item) == EAT_Light )
  11321. return EIST_LightArmor;
  11322. else
  11323. if( inv.GetArmorTypeOriginal(item) == EAT_Medium )
  11324. return EIST_MediumArmor;
  11325. else
  11326. if( inv.GetArmorTypeOriginal(item) == EAT_Heavy )
  11327. return EIST_HeavyArmor;
  11328. }
  11329. // W3EE - End
  11330.  
  11331. return setType;
  11332. }
  11333.  
  11334. public function GetSetBonusStatusByName( itemName : name, out desc1, desc2 : string, out isActive1, isActive2 : bool ) : EItemSetType
  11335. {
  11336. var setType : EItemSetType;
  11337.  
  11338. if( theGame.GetDLCManager().IsEP2Enabled() )
  11339. {
  11340. setType = CheckSetTypeByName( itemName );
  11341. SetBonusStatusByType( setType, desc1, desc2, isActive1, isActive2 );
  11342.  
  11343. return setType;
  11344. }
  11345. else
  11346. {
  11347. return EIST_Undefined;
  11348. }
  11349. }
  11350.  
  11351. public function GetSetBonusStatus( item : SItemUniqueId, out desc1, desc2 : string, out isActive1, isActive2 : bool ) : EItemSetType
  11352. {
  11353. var setType : EItemSetType;
  11354.  
  11355. if( theGame.GetDLCManager().IsEP2Enabled() )
  11356. {
  11357. setType = CheckSetType( item );
  11358. SetBonusStatusByType( setType, desc1, desc2, isActive1, isActive2 );
  11359.  
  11360. return setType;
  11361. }
  11362. else
  11363. {
  11364. return EIST_Undefined;
  11365. }
  11366. }
  11367.  
  11368. private function SetBonusStatusByType(setType : EItemSetType, out desc1, desc2 : string, out isActive1, isActive2 : bool):void
  11369. {
  11370. var setBonus : EItemSetBonus;
  11371.  
  11372. // W3EE - Begin
  11373. isActive1 = IsSetBonusActive(ItemSetTypeToItemSetBonus(setType, 1));
  11374. isActive2 = IsSetBonusActive(ItemSetTypeToItemSetBonus(setType, 2));
  11375.  
  11376. setBonus = ItemSetTypeToItemSetBonus(setType, 1);
  11377. desc1 = GetSetBonusTooltipDescription(setBonus);
  11378.  
  11379. setBonus = ItemSetTypeToItemSetBonus(setType, 2);
  11380. desc2 = GetSetBonusTooltipDescription(setBonus);
  11381. // W3EE - End
  11382. }
  11383.  
  11384. public function ItemSetTypeToItemSetBonus( setType : EItemSetType, nr : int ) : EItemSetBonus
  11385. {
  11386. var setBonus : EItemSetBonus;
  11387.  
  11388. if( nr == 1 )
  11389. {
  11390. switch( setType )
  11391. {
  11392. case EIST_Lynx:
  11393. case EIST_MinorLynx: setBonus = EISB_Lynx_1; break;
  11394. case EIST_Gryphon:
  11395. case EIST_MinorGryphon: setBonus = EISB_Gryphon_2; break;
  11396. case EIST_Bear:
  11397. case EIST_MinorBear: setBonus = EISB_Bear_1; break;
  11398. case EIST_Wolf:
  11399. case EIST_MinorWolf: setBonus = EISB_Wolf_1; break;
  11400. case EIST_RedWolf:
  11401. case EIST_MinorRedWolf: setBonus = EISB_RedWolf_1; break;
  11402. //case EIST_Vampire: setBonus = EISB_Vampire; break;
  11403. // W3EE - Begin
  11404. case EIST_Viper: setBonus = EISB_Viper1; break;
  11405. case EIST_Gothic: setBonus = EISB_Gothic1; break;
  11406. case EIST_Dimeritium: setBonus = EISB_Dimeritium1; break;
  11407. case EIST_Meteorite: setBonus = EISB_Undefined; break;
  11408.  
  11409. case EIST_LightArmor: setBonus = EISB_LightArmor; break;
  11410. case EIST_MediumArmor: setBonus = EISB_MediumArmor; break;
  11411. case EIST_HeavyArmor: setBonus = EISB_HeavyArmor; break;
  11412. default: setBonus = EISB_Undefined; break;
  11413. // W3EE - End
  11414. }
  11415. }
  11416. else
  11417. {
  11418. switch( setType )
  11419. {
  11420. case EIST_Lynx: setBonus = EISB_Lynx_2; break;
  11421. case EIST_Gryphon: setBonus = EISB_Gryphon_1; break;
  11422. case EIST_Bear: setBonus = EISB_Bear_2; break;
  11423. case EIST_Wolf: setBonus = EISB_Wolf_2; break;
  11424. case EIST_RedWolf: setBonus = EISB_RedWolf_2; break;
  11425. case EIST_Viper: setBonus = EISB_Viper2; break;
  11426. //case EIST_Vampire: setBonus = EISB_Undefined; break;
  11427. // W3EE - Begin
  11428. case EIST_Gothic: setBonus = EISB_Gothic2; break;
  11429. case EIST_Dimeritium: setBonus = EISB_Dimeritium2; break;
  11430. case EIST_Meteorite: setBonus = EISB_Meteorite; break;
  11431. default: setBonus = EISB_Undefined; break;
  11432. // W3EE - End
  11433. }
  11434. }
  11435.  
  11436. return setBonus;
  11437. }
  11438.  
  11439. public function GetSetBonusTooltipDescription( bonus : EItemSetBonus ) : string
  11440. {
  11441. var finalString : string;
  11442. var arrString : array<string>;
  11443. var dm : CDefinitionsManagerAccessor;
  11444. var min, max : SAbilityAttributeValue;
  11445. var tempString : string;
  11446.  
  11447. switch( bonus )
  11448. {
  11449. case EISB_Lynx_1: tempString = "W3EE_Cat_1"; break;
  11450. case EISB_Lynx_2: tempString = "skill_desc_lynx_set_ability2"; break;
  11451. case EISB_Gryphon_1: tempString = "skill_desc_gryphon_set_ability1"; break;
  11452. case EISB_Gryphon_2: tempString = "W3EE_Griffin_1"; break;
  11453. case EISB_Bear_1: tempString = "W3EE_Bear_1"; break;
  11454. case EISB_Bear_2: tempString = "W3EE_Wolf_2_Ability"; break;
  11455. case EISB_Wolf_1: tempString = "w3ee_wolf_set_bonus_1"; break;
  11456. case EISB_Wolf_2: tempString = "skill_desc_bear_set_ability2"; break;
  11457. case EISB_RedWolf_1: tempString = "w3ee_skill_desc_red_wolf_set_ability1"; break;
  11458. case EISB_RedWolf_2: tempString = "skill_desc_red_wolf_set_ability2"; break;
  11459. //case EISB_Vampire: tempString = "skill_desc_vampire_set_ability1"; break;
  11460. // W3EE - Begin
  11461. case EISB_Viper1: tempString = "skill_desc_wolf_set_ability2"; break;
  11462. case EISB_Viper2: tempString = "set_bonus_viper"; break;
  11463. case EISB_Gothic1: tempString = "GothicDescription"; break;
  11464. case EISB_Gothic2: tempString = "GothicDescription2"; break;
  11465. case EISB_Dimeritium1: tempString = "DimeritiumDescription"; break;
  11466. case EISB_Dimeritium2: tempString = "DimeritiumDescription2"; break;
  11467. case EISB_Meteorite: tempString = "MeteoriteDescription"; break;
  11468. case EISB_LightArmor: tempString = "GenericLightArmorBonus"; break;
  11469. case EISB_MediumArmor: tempString = "GenericMediumArmorBonus"; break;
  11470. case EISB_HeavyArmor: tempString = "GenericHeavyArmorBonus"; break;
  11471. // W3EE - End
  11472. default: tempString = ""; break;
  11473. }
  11474.  
  11475. dm = theGame.GetDefinitionsManager();
  11476.  
  11477. switch( bonus )
  11478. {
  11479. case EISB_Lynx_1:
  11480. dm.GetAbilityAttributeValue( 'LynxSetBonusEffect', 'duration', min, max );
  11481. arrString.PushBack( FloatToString( min.valueAdditive ) );
  11482. dm.GetAbilityAttributeValue( 'LynxSetBonusEffect', 'lynx_dmg_boost', min, max );
  11483. arrString.PushBack( FloatToString( min.valueAdditive * 100 ) );
  11484. // arrString.PushBack( FloatToString( min.valueAdditive * 100 * GetSetPartsEquipped( EIST_Lynx ) ) );
  11485. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  11486. break;
  11487. case EISB_Lynx_2:
  11488. dm.GetAbilityAttributeValue( GetSetBonusAbility( EISB_Lynx_2 ), 'lynx_2_dmg_boost', min, max );
  11489. arrString.PushBack( FloatToString( min.valueAdditive * 100 ) );
  11490.  
  11491. dm.GetAbilityAttributeValue( GetSetBonusAbility( EISB_Lynx_2 ), 'lynx_2_adrenaline_cost', min, max );
  11492. arrString.PushBack( FloatToString( min.valueAdditive * 100 ) );
  11493.  
  11494. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  11495. break;
  11496. case EISB_Gryphon_1:
  11497. dm.GetAbilityAttributeValue( 'GryphonSetBonusEffect', 'duration', min, max );
  11498. arrString.PushBack( FloatToString( min.valueAdditive ) );
  11499. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  11500. break;
  11501. case EISB_Gryphon_2:
  11502. /*dm.GetAbilityAttributeValue( 'GryphonSetBonusYrdenEffect', 'staminaRegen', min, max );
  11503. arrString.PushBack( FloatToString( min.valueMultiplicative * 100) );
  11504. dm.GetAbilityAttributeValue( 'GryphonSetBonusYrdenEffect', 'spell_power', min, max );
  11505. arrString.PushBack( FloatToString( min.valueMultiplicative * 100) );
  11506. dm.GetAbilityAttributeValue( 'GryphonSetBonusYrdenEffect', 'gryphon_set_bns_dmg_reduction', min, max );
  11507. arrString.PushBack( FloatToString( min.valueAdditive * 100) );*/
  11508. dm.GetAbilityAttributeValue( 'GryphonSetBonusYrdenEffect', 'trigger_scale', min, max );
  11509. arrString.PushBack( FloatToString( ( min.valueAdditive - 1 )* 100) );
  11510. arrString.PushBack( FloatToString( 0.2f * 100) );
  11511. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  11512. break;
  11513. case EISB_Bear_1:
  11514. dm.GetAbilityAttributeValue( 'setBonusAbilityBear_1', 'quen_reapply_chance', min, max );
  11515. arrString.PushBack( FloatToString( min.valueMultiplicative * 100 ) );
  11516.  
  11517. arrString.PushBack( FloatToString( min.valueMultiplicative * 100 * amountOfSetPiecesEquipped[ EIST_Bear ] ) );
  11518. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  11519. break;
  11520. case EISB_Wolf_1:
  11521. dm.GetAbilityAttributeValue('Mutation7Buff', 'attack_power', min, max);
  11522. arrString.PushBack(NoTrailZeros(100 * min.valueMultiplicative));
  11523.  
  11524. dm.GetAbilityAttributeValue('Mutation7BuffEffect', 'duration', min, max);
  11525. arrString.PushBack(NoTrailZeros(min.valueAdditive));
  11526.  
  11527. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  11528. break;
  11529. case EISB_Wolf_2:
  11530. dm.GetAbilityAttributeValue( 'setBonusAbilityBear_2', 'quen_dmg_boost', min, max );
  11531. arrString.PushBack( FloatToString( min.valueMultiplicative * 100 ) );
  11532. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  11533. break;
  11534. case EISB_RedWolf_2:
  11535. dm.GetAbilityAttributeValue( 'setBonusAbilityRedWolf_2', 'amount', min, max );
  11536. arrString.PushBack( FloatToString( min.valueAdditive ) );
  11537. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  11538. break;
  11539. case EISB_Viper2:
  11540. arrString.PushBack( FloatToString(5) );
  11541. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  11542. break;
  11543. /*case EISB_Vampire:
  11544. dm.GetAbilityAttributeValue( 'setBonusAbilityVampire', 'life_percent', min, max );
  11545. arrString.PushBack( FloatToString( min.valueAdditive ) );
  11546. arrString.PushBack( FloatToString( min.valueAdditive * amountOfSetPiecesEquipped[ EIST_Vampire ] ) );
  11547. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  11548. break;*/
  11549. default:
  11550. finalString = GetLocStringByKeyExtWithParams( tempString );
  11551. }
  11552.  
  11553. return finalString;
  11554. }
  11555.  
  11556. public function ManageSetBonusesSoundbanks( setType : EItemSetType )
  11557. {
  11558. if( amountOfSetPiecesEquipped[ setType ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS )
  11559. {
  11560. switch( setType )
  11561. {
  11562. case EIST_Lynx:
  11563. case EIST_MinorLynx:
  11564. LoadSetBonusSoundBank( "ep2_setbonus_lynx.bnk" );
  11565. break;
  11566. case EIST_Gryphon:
  11567. case EIST_MinorGryphon:
  11568. LoadSetBonusSoundBank( "ep2_setbonus_gryphon.bnk" );
  11569. break;
  11570. case EIST_Bear:
  11571. case EIST_MinorBear:
  11572. LoadSetBonusSoundBank( "ep2_setbonus_bear.bnk" );
  11573. break;
  11574. }
  11575. }
  11576. else
  11577. {
  11578. switch( setType )
  11579. {
  11580. case EIST_Lynx:
  11581. case EIST_MinorLynx:
  11582. UnloadSetBonusSoundBank( "ep2_setbonus_lynx.bnk" );
  11583. break;
  11584. case EIST_Gryphon:
  11585. case EIST_MinorGryphon:
  11586. UnloadSetBonusSoundBank( "ep2_setbonus_gryphon.bnk" );
  11587. break;
  11588. case EIST_Bear:
  11589. case EIST_MinorBear:
  11590. UnloadSetBonusSoundBank( "ep2_setbonus_bear.bnk" );
  11591. break;
  11592. }
  11593. }
  11594. }
  11595.  
  11596. public function VampiricSetAbilityRegeneration()
  11597. {
  11598. /*var healthMax : float;
  11599. var healthToReg : float;
  11600.  
  11601. healthMax = GetStatMax( BCS_Vitality );
  11602.  
  11603. healthToReg = ( amountOfSetPiecesEquipped[ EIST_Vampire ] * healthMax ) / 100;
  11604.  
  11605. PlayEffect('drain_energy_caretaker_shovel');
  11606. GainStat( BCS_Vitality, healthToReg );*/
  11607. }
  11608.  
  11609. private function LoadSetBonusSoundBank( bankName : string )
  11610. {
  11611. if( !theSound.SoundIsBankLoaded( bankName ) )
  11612. {
  11613. theSound.SoundLoadBank( bankName, true );
  11614. }
  11615. }
  11616.  
  11617. private function UnloadSetBonusSoundBank( bankName : string )
  11618. {
  11619. if( theSound.SoundIsBankLoaded( bankName ) )
  11620. {
  11621. theSound.SoundUnloadBank( bankName );
  11622. }
  11623. }
  11624.  
  11625. timer function BearSetBonusQuenReapply( dt : float, id : int )
  11626. {
  11627. var newQuen : W3QuenEntity;
  11628.  
  11629. newQuen = (W3QuenEntity)theGame.CreateEntity( GetSignTemplate( ST_Quen ), GetWorldPosition(), GetWorldRotation() );
  11630. newQuen.Init( signOwner, GetSignEntity( ST_Quen ), true );
  11631. newQuen.freeFromBearSetBonus = true;
  11632. newQuen.OnStarted();
  11633. newQuen.OnThrowing();
  11634. newQuen.OnEnded();
  11635.  
  11636. m_quenReappliedCount += 1;
  11637.  
  11638. RemoveTimer( 'BearSetBonusQuenReapply');
  11639. }
  11640.  
  11641. public final function StandaloneEp1_1()
  11642. {
  11643. var i, inc, quantityLow, randLow, quantityMedium, randMedium, quantityHigh, randHigh, startingMoney : int;
  11644. var pam : W3PlayerAbilityManager;
  11645. var ids : array<SItemUniqueId>;
  11646. var STARTING_LEVEL : int;
  11647.  
  11648. FactsAdd("StandAloneEP1", 1);
  11649.  
  11650.  
  11651. inv.RemoveAllItems();
  11652.  
  11653.  
  11654. inv.AddAnItem('Illusion Medallion', 1, true, true, false);
  11655. inv.AddAnItem('q103_safe_conduct', 1, true, true, false);
  11656.  
  11657.  
  11658. theGame.GetGamerProfile().ClearAllAchievementsForEP1();
  11659.  
  11660.  
  11661. STARTING_LEVEL = 32;
  11662. inc = STARTING_LEVEL - GetLevel();
  11663. for(i=0; i<inc; i+=1)
  11664. {
  11665. levelManager.AddPoints(EExperiencePoint, levelManager.GetTotalExpForNextLevel() - levelManager.GetPointsTotal(EExperiencePoint), false);
  11666. }
  11667.  
  11668. for(i=1; i<EnumGetMax('ESkillSubPath') - 5; i+=1)
  11669. Experience().ModTotalPathPoints((ESkillSubPath)i, 15, true);
  11670.  
  11671.  
  11672. levelManager.ResetCharacterDev();
  11673. pam = (W3PlayerAbilityManager)abilityManager;
  11674. if(pam)
  11675. {
  11676. pam.ResetCharacterDev();
  11677. }
  11678. levelManager.SetFreeSkillPoints(levelManager.GetLevel() - 1 + 11);
  11679.  
  11680.  
  11681. inv.AddAnItem('Greater mutagen green', 6);
  11682. inv.AddAnItem('Greater mutagen blue', 6);
  11683. inv.AddAnItem('Greater mutagen red', 6);
  11684.  
  11685.  
  11686. startingMoney = 10000;
  11687. if(GetMoney() > startingMoney)
  11688. {
  11689. RemoveMoney(GetMoney() - startingMoney);
  11690. }
  11691. else
  11692. {
  11693. AddMoney( 10000 - GetMoney() );
  11694. }
  11695.  
  11696.  
  11697.  
  11698.  
  11699.  
  11700. ids.Clear();
  11701. ids = inv.AddAnItem('Oathbreaker Armor');
  11702. EquipItem(ids[0]);
  11703. ids.Clear();
  11704. ids = inv.AddAnItem('Oathbreaker Boots');
  11705. EquipItem(ids[0]);
  11706. ids.Clear();
  11707. ids = inv.AddAnItem('Oathbreaker Gloves');
  11708. EquipItem(ids[0]);
  11709. ids.Clear();
  11710. ids = inv.AddAnItem('Oathbreaker Pants');
  11711. EquipItem(ids[0]);
  11712. ids.Clear();
  11713. ids = inv.AddAnItem('Hood Grey');
  11714. EquipItem(ids[0]);
  11715.  
  11716.  
  11717. ids.Clear();
  11718. ids = inv.AddAnItem('Wild Hunt sword 2');
  11719. EquipItem(ids[0]);
  11720. ids.Clear();
  11721. ids = inv.AddAnItem('Silver sword 7');
  11722. EquipItem(ids[0]);
  11723.  
  11724.  
  11725. inv.AddAnItem('Torch', 1, true, true, false);
  11726.  
  11727.  
  11728. quantityLow = 1;
  11729. randLow = 3;
  11730. quantityMedium = 4;
  11731. randMedium = 4;
  11732. quantityHigh = 8;
  11733. randHigh = 6;
  11734.  
  11735. inv.AddAnItem('Alghoul bone marrow',quantityMedium+RandRange(randMedium));
  11736. inv.AddAnItem('Amethyst dust',quantityLow+RandRange(randLow));
  11737. inv.AddAnItem('Arachas eyes',quantityLow+RandRange(randLow));
  11738. inv.AddAnItem('Arachas venom',quantityLow+RandRange(randLow));
  11739. inv.AddAnItem('Basilisk venom',quantityLow+RandRange(randLow));
  11740. inv.AddAnItem('Coal',quantityHigh+RandRange(randHigh));
  11741. inv.AddAnItem('Cotton',quantityHigh+RandRange(randHigh));
  11742. inv.AddAnItem('Dark iron ingot',quantityLow+RandRange(randLow));
  11743. inv.AddAnItem('Dark iron ore',quantityLow+RandRange(randLow));
  11744. inv.AddAnItem('Deer hide',quantityHigh+RandRange(randHigh));
  11745. inv.AddAnItem('Diamond dust',quantityLow+RandRange(randLow));
  11746. inv.AddAnItem('Drowned dead tongue',quantityLow+RandRange(randLow));
  11747. inv.AddAnItem('Drowner brain',quantityMedium+RandRange(randMedium));
  11748. inv.AddAnItem('Dwimeryte ingot',quantityLow+RandRange(randLow));
  11749. inv.AddAnItem('Dwimeryte ore',quantityLow+RandRange(randLow));
  11750. inv.AddAnItem('Emerald dust',quantityLow+RandRange(randLow));
  11751. inv.AddAnItem('Endriag chitin plates',quantityMedium+RandRange(randMedium));
  11752. inv.AddAnItem('Endriag embryo',quantityLow+RandRange(randLow));
  11753. inv.AddAnItem('Ghoul blood',quantityMedium+RandRange(randMedium));
  11754. inv.AddAnItem('Hag teeth',quantityMedium+RandRange(randMedium));
  11755. inv.AddAnItem('Hardened leather',quantityMedium+RandRange(randMedium));
  11756. inv.AddAnItem('Hardened timber',quantityMedium+RandRange(randMedium));
  11757. inv.AddAnItem('Harpy feathers',quantityMedium+RandRange(randMedium));
  11758. inv.AddAnItem('Leather straps',quantityHigh+RandRange(randHigh));
  11759. inv.AddAnItem('Linen',quantityMedium+RandRange(randMedium));
  11760. inv.AddAnItem('Meteorite ingot',quantityLow+RandRange(randLow));
  11761. inv.AddAnItem('Meteorite ore',quantityMedium+RandRange(randMedium));
  11762. inv.AddAnItem('Necrophage skin',quantityLow+RandRange(randLow));
  11763. inv.AddAnItem('Nekker blood',quantityHigh+RandRange(randHigh));
  11764. inv.AddAnItem('Nekker heart',quantityMedium+RandRange(randMedium));
  11765. inv.AddAnItem('Oil',quantityHigh+RandRange(randHigh));
  11766. inv.AddAnItem('Phosphorescent crystal',quantityLow+RandRange(randLow));
  11767. inv.AddAnItem('Pig hide',quantityMedium+RandRange(randMedium));
  11768. inv.AddAnItem('Pure silver',quantityMedium+RandRange(randMedium));
  11769. inv.AddAnItem('Rabbit pelt',quantityMedium+RandRange(randMedium));
  11770. inv.AddAnItem('Rotfiend blood',quantityMedium+RandRange(randMedium));
  11771. inv.AddAnItem('Sapphire dust',quantityLow+RandRange(randLow));
  11772. inv.AddAnItem('Silk',quantityHigh+RandRange(randHigh));
  11773. inv.AddAnItem('Silver ingot',quantityMedium+RandRange(randMedium));
  11774. inv.AddAnItem('Silver ore',quantityHigh+RandRange(randHigh));
  11775. inv.AddAnItem('Specter dust',quantityMedium+RandRange(randMedium));
  11776. inv.AddAnItem('Steel ingot',quantityHigh+RandRange(randHigh));
  11777. inv.AddAnItem('Steel plate',quantityHigh+RandRange(randHigh));
  11778. inv.AddAnItem('String',quantityHigh+RandRange(randHigh));
  11779. inv.AddAnItem('Thread',quantityHigh+RandRange(randHigh));
  11780. inv.AddAnItem('Timber',quantityHigh+RandRange(randHigh));
  11781. inv.AddAnItem('Twine',quantityMedium+RandRange(randMedium));
  11782. inv.AddAnItem('Venom extract',quantityMedium+RandRange(randMedium));
  11783. inv.AddAnItem('Water essence',quantityMedium+RandRange(randMedium));
  11784.  
  11785. inv.AddAnItem('Alcohest', 5);
  11786. inv.AddAnItem('Dwarven spirit', 5);
  11787.  
  11788.  
  11789. ids.Clear();
  11790. ids = inv.AddAnItem('Crossbow 5');
  11791. EquipItem(ids[0]);
  11792. ids.Clear();
  11793. inv.AddAnItem('Broadhead Bolt', 40);
  11794. EquipItem(ids[0]);
  11795.  
  11796.  
  11797. RemoveAllAlchemyRecipes();
  11798. RemoveAllCraftingSchematics();
  11799.  
  11800.  
  11801.  
  11802.  
  11803. AddAlchemyRecipe('Recipe for Cat 1');
  11804.  
  11805.  
  11806.  
  11807. AddAlchemyRecipe('Recipe for Maribor Forest 1');
  11808. AddAlchemyRecipe('Recipe for Petris Philtre 1');
  11809. AddAlchemyRecipe('Recipe for Swallow 1');
  11810. AddAlchemyRecipe('Recipe for Tawny Owl 1');
  11811.  
  11812. AddAlchemyRecipe('Recipe for White Gull 1');
  11813. AddAlchemyRecipe('Recipe for White Honey 1');
  11814. AddAlchemyRecipe('Recipe for White Raffards Decoction 1');
  11815.  
  11816.  
  11817.  
  11818. AddAlchemyRecipe('Recipe for Beast Oil 1');
  11819. AddAlchemyRecipe('Recipe for Cursed Oil 1');
  11820. AddAlchemyRecipe('Recipe for Hanged Man Venom 1');
  11821. AddAlchemyRecipe('Recipe for Hybrid Oil 1');
  11822. AddAlchemyRecipe('Recipe for Insectoid Oil 1');
  11823. AddAlchemyRecipe('Recipe for Magicals Oil 1');
  11824. AddAlchemyRecipe('Recipe for Necrophage Oil 1');
  11825. AddAlchemyRecipe('Recipe for Specter Oil 1');
  11826. AddAlchemyRecipe('Recipe for Vampire Oil 1');
  11827. AddAlchemyRecipe('Recipe for Draconide Oil 1');
  11828. AddAlchemyRecipe('Recipe for Ogre Oil 1');
  11829. AddAlchemyRecipe('Recipe for Relic Oil 1');
  11830. AddAlchemyRecipe('Recipe for Beast Oil 2');
  11831. AddAlchemyRecipe('Recipe for Cursed Oil 2');
  11832. AddAlchemyRecipe('Recipe for Hanged Man Venom 2');
  11833. AddAlchemyRecipe('Recipe for Hybrid Oil 2');
  11834. AddAlchemyRecipe('Recipe for Insectoid Oil 2');
  11835. AddAlchemyRecipe('Recipe for Magicals Oil 2');
  11836. AddAlchemyRecipe('Recipe for Necrophage Oil 2');
  11837. AddAlchemyRecipe('Recipe for Specter Oil 2');
  11838. AddAlchemyRecipe('Recipe for Vampire Oil 2');
  11839. AddAlchemyRecipe('Recipe for Draconide Oil 2');
  11840. AddAlchemyRecipe('Recipe for Ogre Oil 2');
  11841. AddAlchemyRecipe('Recipe for Relic Oil 2');
  11842.  
  11843.  
  11844. AddAlchemyRecipe('Recipe for Dancing Star 1');
  11845.  
  11846. AddAlchemyRecipe('Recipe for Dwimeritum Bomb 1');
  11847.  
  11848. AddAlchemyRecipe('Recipe for Grapeshot 1');
  11849. AddAlchemyRecipe('Recipe for Samum 1');
  11850.  
  11851. AddAlchemyRecipe('Recipe for White Frost 1');
  11852.  
  11853.  
  11854.  
  11855. AddAlchemyRecipe('Recipe for Dwarven spirit 1');
  11856. AddAlchemyRecipe('Recipe for Alcohest 1');
  11857. AddAlchemyRecipe('Recipe for White Gull 1');
  11858.  
  11859.  
  11860. AddStartingSchematics();
  11861.  
  11862.  
  11863. ids.Clear();
  11864. ids = inv.AddAnItem('Swallow 2 Rubedo');
  11865. EquipItem(ids[0]);
  11866. ids.Clear();
  11867. ids = inv.AddAnItem('Thunderbolt 2 Nigredo');
  11868. EquipItem(ids[0]);
  11869. ids.Clear();
  11870. ids = inv.AddAnItem('Tawny Owl 2');
  11871. EquipItem(ids[0]);
  11872. ids.Clear();
  11873.  
  11874. ids = inv.AddAnItem('Grapeshot 2');
  11875. EquipItem(ids[0]);
  11876. ids.Clear();
  11877. ids = inv.AddAnItem('Samum 2');
  11878. EquipItem(ids[0]);
  11879.  
  11880. inv.AddAnItem('Dwimeritum Bomb 1');
  11881. inv.AddAnItem('Silver Dust Bomb 1');
  11882. inv.AddAnItem('White Frost 2');
  11883. inv.AddAnItem('Dancing Star 2');
  11884. inv.AddAnItem('Brown Oil 3');
  11885. inv.AddAnItem('Ethereal Oil 3');
  11886. inv.AddAnItem('Poisonous Oil 2');
  11887. inv.AddAnItem('Flammable Oil 2');
  11888. inv.AddAnItem('Cat 2 Albedo');
  11889. inv.AddAnItem('Maribor Forest 1');
  11890. inv.AddAnItem('Petris Philtre 1');
  11891. inv.AddAnItem('White Gull 1', 3);
  11892. inv.AddAnItem('White Honey 1');
  11893.  
  11894.  
  11895. inv.AddAnItem('weapon_repair_kit_1', 2);
  11896. inv.AddAnItem('weapon_repair_kit_2', 1);
  11897. inv.AddAnItem('armor_repair_kit_1', 2);
  11898. inv.AddAnItem('armor_repair_kit_2', 1);
  11899.  
  11900.  
  11901. StandaloneEp1_2();
  11902. }
  11903.  
  11904. public final function StandaloneEp1_2()
  11905. {
  11906. var horseId : SItemUniqueId;
  11907. var ids : array<SItemUniqueId>;
  11908. var ents : array< CJournalBase >;
  11909. var i : int;
  11910. var manager : CWitcherJournalManager;
  11911.  
  11912.  
  11913. ids.Clear();
  11914. ids = inv.AddAnItem( 'Dumpling', 12 );
  11915. EquipItem(ids[0]);
  11916.  
  11917.  
  11918. inv.AddAnItem('Clearing Potion', 2, true, false, false);
  11919.  
  11920.  
  11921. GetHorseManager().RemoveAllItems();
  11922.  
  11923. ids.Clear();
  11924. ids = inv.AddAnItem('Horse Bag 2');
  11925. horseId = GetHorseManager().MoveItemToHorse(ids[0]);
  11926. GetHorseManager().EquipItem(horseId);
  11927.  
  11928. ids.Clear();
  11929. ids = inv.AddAnItem('Horse Blinder 2');
  11930. horseId = GetHorseManager().MoveItemToHorse(ids[0]);
  11931. GetHorseManager().EquipItem(horseId);
  11932.  
  11933. ids.Clear();
  11934. ids = inv.AddAnItem('Horse Saddle 2');
  11935. horseId = GetHorseManager().MoveItemToHorse(ids[0]);
  11936. GetHorseManager().EquipItem(horseId);
  11937.  
  11938. manager = theGame.GetJournalManager();
  11939.  
  11940.  
  11941. manager.GetActivatedOfType( 'CJournalCreature', ents );
  11942. for(i=0; i<ents.Size(); i+=1)
  11943. {
  11944. manager.ActivateEntry(ents[i], JS_Inactive, false, true);
  11945. }
  11946.  
  11947.  
  11948. ents.Clear();
  11949. manager.GetActivatedOfType( 'CJournalCharacter', ents );
  11950. for(i=0; i<ents.Size(); i+=1)
  11951. {
  11952. manager.ActivateEntry(ents[i], JS_Inactive, false, true);
  11953. }
  11954.  
  11955.  
  11956. ents.Clear();
  11957. manager.GetActivatedOfType( 'CJournalQuest', ents );
  11958. for(i=0; i<ents.Size(); i+=1)
  11959. {
  11960.  
  11961. if( StrStartsWith(ents[i].baseName, "q60"))
  11962. continue;
  11963.  
  11964. manager.ActivateEntry(ents[i], JS_Inactive, false, true);
  11965. }
  11966.  
  11967.  
  11968. manager.ActivateEntryByScriptTag('TutorialAard', JS_Active);
  11969. manager.ActivateEntryByScriptTag('TutorialAdrenaline', JS_Active);
  11970. manager.ActivateEntryByScriptTag('TutorialAxii', JS_Active);
  11971. manager.ActivateEntryByScriptTag('TutorialAxiiDialog', JS_Active);
  11972. manager.ActivateEntryByScriptTag('TutorialCamera', JS_Active);
  11973. manager.ActivateEntryByScriptTag('TutorialCamera_pad', JS_Active);
  11974. manager.ActivateEntryByScriptTag('TutorialCiriBlink', JS_Active);
  11975. manager.ActivateEntryByScriptTag('TutorialCiriCharge', JS_Active);
  11976. manager.ActivateEntryByScriptTag('TutorialCiriStamina', JS_Active);
  11977. manager.ActivateEntryByScriptTag('TutorialCounter', JS_Active);
  11978. manager.ActivateEntryByScriptTag('TutorialDialogClose', JS_Active);
  11979. manager.ActivateEntryByScriptTag('TutorialFallingRoll', JS_Active);
  11980. manager.ActivateEntryByScriptTag('TutorialFocus', JS_Active);
  11981. manager.ActivateEntryByScriptTag('TutorialFocusClues', JS_Active);
  11982. manager.ActivateEntryByScriptTag('TutorialFocusClues', JS_Active);
  11983. manager.ActivateEntryByScriptTag('TutorialHorseRoad', JS_Active);
  11984. manager.ActivateEntryByScriptTag('TutorialHorseSpeed0', JS_Active);
  11985. manager.ActivateEntryByScriptTag('TutorialHorseSpeed0_pad', JS_Active);
  11986. manager.ActivateEntryByScriptTag('TutorialHorseSpeed1', JS_Active);
  11987. manager.ActivateEntryByScriptTag('TutorialHorseSpeed2', JS_Active);
  11988. manager.ActivateEntryByScriptTag('TutorialHorseSummon', JS_Active);
  11989. manager.ActivateEntryByScriptTag('TutorialHorseSummon_pad', JS_Active);
  11990. manager.ActivateEntryByScriptTag('TutorialIgni', JS_Active);
  11991. manager.ActivateEntryByScriptTag('TutorialJournalAlternateSings', JS_Active);
  11992. manager.ActivateEntryByScriptTag('TutorialJournalBoatDamage', JS_Active);
  11993. manager.ActivateEntryByScriptTag('TutorialJournalBoatMount', JS_Active);
  11994. manager.ActivateEntryByScriptTag('TutorialJournalBuffs', JS_Active);
  11995. manager.ActivateEntryByScriptTag('TutorialJournalCharDevLeveling', JS_Active);
  11996. manager.ActivateEntryByScriptTag('TutorialJournalCharDevSkills', JS_Active);
  11997. manager.ActivateEntryByScriptTag('TutorialJournalCrafting', JS_Active);
  11998. manager.ActivateEntryByScriptTag('TutorialJournalCrossbow', JS_Active);
  11999. manager.ActivateEntryByScriptTag('TutorialJournalDialogGwint', JS_Active);
  12000. manager.ActivateEntryByScriptTag('TutorialJournalDialogShop', JS_Active);
  12001. manager.ActivateEntryByScriptTag('TutorialJournalDive', JS_Active);
  12002. manager.ActivateEntryByScriptTag('TutorialJournalDodge', JS_Active);
  12003. manager.ActivateEntryByScriptTag('TutorialJournalDodge_pad', JS_Active);
  12004. manager.ActivateEntryByScriptTag('TutorialJournalDrawWeapon', JS_Active);
  12005. manager.ActivateEntryByScriptTag('TutorialJournalDrawWeapon_pad', JS_Active);
  12006. manager.ActivateEntryByScriptTag('TutorialJournalDurability', JS_Active);
  12007. manager.ActivateEntryByScriptTag('TutorialJournalExplorations', JS_Active);
  12008. manager.ActivateEntryByScriptTag('TutorialJournalExplorations_pad', JS_Active);
  12009. manager.ActivateEntryByScriptTag('TutorialJournalFastTravel', JS_Active);
  12010. manager.ActivateEntryByScriptTag('TutorialJournalFocusRedObjects', JS_Active);
  12011. manager.ActivateEntryByScriptTag('TutorialJournalGasClouds', JS_Active);
  12012. manager.ActivateEntryByScriptTag('TutorialJournalHeavyAttacks', JS_Active);
  12013. manager.ActivateEntryByScriptTag('TutorialJournalHorse', JS_Active);
  12014. manager.ActivateEntryByScriptTag('TutorialJournalHorseStamina', JS_Active);
  12015. manager.ActivateEntryByScriptTag('TutorialJournalJump', JS_Active);
  12016. manager.ActivateEntryByScriptTag('TutorialJournalLightAttacks', JS_Active);
  12017. manager.ActivateEntryByScriptTag('TutorialJournalLightAttacks_pad', JS_Active);
  12018. manager.ActivateEntryByScriptTag('TutorialJournalMeditation', JS_Active);
  12019. manager.ActivateEntryByScriptTag('TutorialJournalMeditation_pad', JS_Active);
  12020. manager.ActivateEntryByScriptTag('TutorialJournalMonsterThreatLevels', JS_Active);
  12021. manager.ActivateEntryByScriptTag('TutorialJournalMovement', JS_Active);
  12022. manager.ActivateEntryByScriptTag('TutorialJournalMovement_pad', JS_Active);
  12023. manager.ActivateEntryByScriptTag('TutorialJournalMutagenIngredient', JS_Active);
  12024. manager.ActivateEntryByScriptTag('TutorialJournalMutagenPotion', JS_Active);
  12025. manager.ActivateEntryByScriptTag('TutorialJournalOils', JS_Active);
  12026. manager.ActivateEntryByScriptTag('TutorialJournalPetards', JS_Active);
  12027. manager.ActivateEntryByScriptTag('TutorialJournalPotions', JS_Active);
  12028. manager.ActivateEntryByScriptTag('TutorialJournalPotions_pad', JS_Active);
  12029. manager.ActivateEntryByScriptTag('TutorialJournalQuestArea', JS_Active);
  12030. manager.ActivateEntryByScriptTag('TutorialJournalRadial', JS_Active);
  12031. manager.ActivateEntryByScriptTag('TutorialJournalRifts', JS_Active);
  12032. manager.ActivateEntryByScriptTag('TutorialJournalRun', JS_Active);
  12033. manager.ActivateEntryByScriptTag('TutorialJournalShopDescription', JS_Active);
  12034. manager.ActivateEntryByScriptTag('TutorialJournalSignCast', JS_Active);
  12035. manager.ActivateEntryByScriptTag('TutorialJournalSignCast_pad', JS_Active);
  12036. manager.ActivateEntryByScriptTag('TutorialJournalSpecialAttacks', JS_Active);
  12037. manager.ActivateEntryByScriptTag('TutorialJournalStaminaExploration', JS_Active);
  12038. manager.ActivateEntryByScriptTag('TutorialJumpHang', JS_Active);
  12039. manager.ActivateEntryByScriptTag('TutorialLadder', JS_Active);
  12040. manager.ActivateEntryByScriptTag('TutorialLadderMove', JS_Active);
  12041. manager.ActivateEntryByScriptTag('TutorialLadderMove_pad', JS_Active);
  12042. manager.ActivateEntryByScriptTag('TutorialObjectiveSwitching', JS_Active);
  12043. manager.ActivateEntryByScriptTag('TutorialOxygen', JS_Active);
  12044. manager.ActivateEntryByScriptTag('TutorialParry', JS_Active);
  12045. manager.ActivateEntryByScriptTag('TutorialPOIUncovered', JS_Active);
  12046. manager.ActivateEntryByScriptTag('TutorialQuen', JS_Active);
  12047. manager.ActivateEntryByScriptTag('TutorialRoll', JS_Active);
  12048. manager.ActivateEntryByScriptTag('TutorialRoll_pad', JS_Active);
  12049. manager.ActivateEntryByScriptTag('TutorialSpeedPairing', JS_Active);
  12050. manager.ActivateEntryByScriptTag('TutorialSprint', JS_Active);
  12051. manager.ActivateEntryByScriptTag('TutorialStaminaSigns', JS_Active);
  12052. manager.ActivateEntryByScriptTag('TutorialStealing', JS_Active);
  12053. manager.ActivateEntryByScriptTag('TutorialSwimmingSpeed', JS_Active);
  12054. manager.ActivateEntryByScriptTag('TutorialTimedChoiceDialog', JS_Active);
  12055. manager.ActivateEntryByScriptTag('TutorialYrden', JS_Active);
  12056.  
  12057.  
  12058. FactsAdd('kill_base_tutorials');
  12059.  
  12060.  
  12061. theGame.GetTutorialSystem().RemoveAllQueuedTutorials();
  12062.  
  12063.  
  12064. FactsAdd('standalone_ep1');
  12065. FactsRemove("StandAloneEP1");
  12066.  
  12067. theGame.GetJournalManager().ForceUntrackingQuestForEP1Savegame();
  12068. }
  12069.  
  12070. final function Debug_FocusBoyFocusGain()
  12071. {
  12072. var focusGain : float;
  12073.  
  12074. focusGain = FactsQuerySum( "debug_fact_focus_boy" ) ;
  12075. GainStat( BCS_Focus, focusGain );
  12076. }
  12077.  
  12078. public final function StandaloneEp2_1()
  12079. {
  12080. var i, inc, quantityLow, randLow, quantityMedium, randMedium, quantityHigh, randHigh, startingMoney : int;
  12081. var pam : W3PlayerAbilityManager;
  12082. var ids : array<SItemUniqueId>;
  12083. var STARTING_LEVEL : int;
  12084.  
  12085. FactsAdd( "StandAloneEP2", 1 );
  12086.  
  12087.  
  12088. inv.RemoveAllItems();
  12089.  
  12090.  
  12091. inv.AddAnItem( 'Illusion Medallion', 1, true, true, false );
  12092. inv.AddAnItem( 'q103_safe_conduct', 1, true, true, false );
  12093.  
  12094.  
  12095. theGame.GetGamerProfile().ClearAllAchievementsForEP2();
  12096.  
  12097.  
  12098. levelManager.Hack_EP2StandaloneLevelShrink( 35 );
  12099.  
  12100.  
  12101. levelManager.ResetCharacterDev();
  12102. pam = ( W3PlayerAbilityManager )abilityManager;
  12103. if( pam )
  12104. {
  12105. pam.ResetCharacterDev();
  12106. }
  12107. levelManager.SetFreeSkillPoints( levelManager.GetLevel() - 1 + 11 );
  12108.  
  12109. for(i=1; i<EnumGetMax('ESkillSubPath') - 5; i+=1)
  12110. Experience().ModTotalPathPoints((ESkillSubPath)i, 20, true);
  12111.  
  12112. inv.AddAnItem( 'Mutagen red', 4 );
  12113. inv.AddAnItem( 'Mutagen green', 4 );
  12114. inv.AddAnItem( 'Mutagen blue', 4 );
  12115. inv.AddAnItem( 'Lesser mutagen red', 2 );
  12116. inv.AddAnItem( 'Lesser mutagen green', 2 );
  12117. inv.AddAnItem( 'Lesser mutagen blue', 2 );
  12118. inv.AddAnItem( 'Greater mutagen red', 6 );
  12119. inv.AddAnItem( 'Greater mutagen green', 6 );
  12120. inv.AddAnItem( 'Greater mutagen blue', 6 );
  12121.  
  12122.  
  12123. startingMoney = 10000;
  12124. if( GetMoney() > startingMoney )
  12125. {
  12126. RemoveMoney( GetMoney() - startingMoney );
  12127. }
  12128. else
  12129. {
  12130. AddMoney( 10000 - GetMoney() );
  12131. }
  12132.  
  12133.  
  12134. ids.Clear();
  12135. ids = inv.AddAnItem('Kinslayer Armor');
  12136. EquipItem(ids[0]);
  12137. ids.Clear();
  12138. ids = inv.AddAnItem('Kinslayer Boots');
  12139. EquipItem(ids[0]);
  12140. ids.Clear();
  12141. ids = inv.AddAnItem('Kinslayer Gloves');
  12142. EquipItem(ids[0]);
  12143. ids.Clear();
  12144. ids = inv.AddAnItem('Kinslayer Pants');
  12145. EquipItem(ids[0]);
  12146.  
  12147.  
  12148. ids.Clear();
  12149. ids = inv.AddAnItem('Sezon Burz Steel Sword');
  12150. EquipItem(ids[0]);
  12151. ids.Clear();
  12152. ids = inv.AddAnItem('Sezon Burz Silver Sword');
  12153. EquipItem(ids[0]);
  12154.  
  12155.  
  12156. inv.AddAnItem('Torch', 1, true, true, false);
  12157.  
  12158.  
  12159. quantityLow = 1;
  12160. randLow = 3;
  12161. quantityMedium = 4;
  12162. randMedium = 4;
  12163. quantityHigh = 8;
  12164. randHigh = 6;
  12165.  
  12166. inv.AddAnItem('Alghoul bone marrow',quantityMedium+RandRange(randMedium));
  12167. inv.AddAnItem('Amethyst dust',quantityLow+RandRange(randLow));
  12168. inv.AddAnItem('Arachas eyes',quantityLow+RandRange(randLow));
  12169. inv.AddAnItem('Arachas venom',quantityLow+RandRange(randLow));
  12170. inv.AddAnItem('Basilisk venom',quantityLow+RandRange(randLow));
  12171. inv.AddAnItem('Coal',quantityHigh+RandRange(randHigh));
  12172. inv.AddAnItem('Cotton',quantityHigh+RandRange(randHigh));
  12173. inv.AddAnItem('Dark iron ingot',quantityLow+RandRange(randLow));
  12174. inv.AddAnItem('Dark iron ore',quantityLow+RandRange(randLow));
  12175. inv.AddAnItem('Deer hide',quantityHigh+RandRange(randHigh));
  12176. inv.AddAnItem('Diamond dust',quantityLow+RandRange(randLow));
  12177. inv.AddAnItem('Drowned dead tongue',quantityLow+RandRange(randLow));
  12178. inv.AddAnItem('Drowner brain',quantityMedium+RandRange(randMedium));
  12179. inv.AddAnItem('Dwimeryte ingot',quantityLow+RandRange(randLow));
  12180. inv.AddAnItem('Dwimeryte ore',quantityLow+RandRange(randLow));
  12181. inv.AddAnItem('Emerald dust',quantityLow+RandRange(randLow));
  12182. inv.AddAnItem('Endriag chitin plates',quantityMedium+RandRange(randMedium));
  12183. inv.AddAnItem('Endriag embryo',quantityLow+RandRange(randLow));
  12184. inv.AddAnItem('Ghoul blood',quantityMedium+RandRange(randMedium));
  12185. inv.AddAnItem('Hag teeth',quantityMedium+RandRange(randMedium));
  12186. inv.AddAnItem('Hardened leather',quantityMedium+RandRange(randMedium));
  12187. inv.AddAnItem('Hardened timber',quantityMedium+RandRange(randMedium));
  12188. inv.AddAnItem('Harpy feathers',quantityMedium+RandRange(randMedium));
  12189. inv.AddAnItem('Leather straps',quantityHigh+RandRange(randHigh));
  12190. inv.AddAnItem('Linen',quantityMedium+RandRange(randMedium));
  12191. inv.AddAnItem('Meteorite ingot',quantityLow+RandRange(randLow));
  12192. inv.AddAnItem('Meteorite ore',quantityMedium+RandRange(randMedium));
  12193. inv.AddAnItem('Necrophage skin',quantityLow+RandRange(randLow));
  12194. inv.AddAnItem('Nekker blood',quantityHigh+RandRange(randHigh));
  12195. inv.AddAnItem('Nekker heart',quantityMedium+RandRange(randMedium));
  12196. inv.AddAnItem('Oil',quantityHigh+RandRange(randHigh));
  12197. inv.AddAnItem('Phosphorescent crystal',quantityLow+RandRange(randLow));
  12198. inv.AddAnItem('Pig hide',quantityMedium+RandRange(randMedium));
  12199. inv.AddAnItem('Pure silver',quantityMedium+RandRange(randMedium));
  12200. inv.AddAnItem('Rabbit pelt',quantityMedium+RandRange(randMedium));
  12201. inv.AddAnItem('Rotfiend blood',quantityMedium+RandRange(randMedium));
  12202. inv.AddAnItem('Sapphire dust',quantityLow+RandRange(randLow));
  12203. inv.AddAnItem('Silk',quantityHigh+RandRange(randHigh));
  12204. inv.AddAnItem('Silver ingot',quantityMedium+RandRange(randMedium));
  12205. inv.AddAnItem('Silver ore',quantityHigh+RandRange(randHigh));
  12206. inv.AddAnItem('Specter dust',quantityMedium+RandRange(randMedium));
  12207. inv.AddAnItem('Steel ingot',quantityHigh+RandRange(randHigh));
  12208. inv.AddAnItem('Steel plate',quantityHigh+RandRange(randHigh));
  12209. inv.AddAnItem('String',quantityHigh+RandRange(randHigh));
  12210. inv.AddAnItem('Thread',quantityHigh+RandRange(randHigh));
  12211. inv.AddAnItem('Timber',quantityHigh+RandRange(randHigh));
  12212. inv.AddAnItem('Twine',quantityMedium+RandRange(randMedium));
  12213. inv.AddAnItem('Venom extract',quantityMedium+RandRange(randMedium));
  12214. inv.AddAnItem('Water essence',quantityMedium+RandRange(randMedium));
  12215.  
  12216. inv.AddAnItem('Alcohest', 5);
  12217. inv.AddAnItem('Dwarven spirit', 5);
  12218.  
  12219.  
  12220. ids.Clear();
  12221. ids = inv.AddAnItem('Crossbow 5');
  12222. EquipItem(ids[0]);
  12223. ids.Clear();
  12224. inv.AddAnItem('Broadhead Bolt', 40);
  12225. EquipItem(ids[0]);
  12226.  
  12227.  
  12228. RemoveAllAlchemyRecipes();
  12229. RemoveAllCraftingSchematics();
  12230.  
  12231.  
  12232.  
  12233.  
  12234. AddAlchemyRecipe('Recipe for Cat 1');
  12235.  
  12236.  
  12237.  
  12238. AddAlchemyRecipe('Recipe for Maribor Forest 1');
  12239. AddAlchemyRecipe('Recipe for Petris Philtre 1');
  12240. AddAlchemyRecipe('Recipe for Swallow 1');
  12241. AddAlchemyRecipe('Recipe for Tawny Owl 1');
  12242.  
  12243. AddAlchemyRecipe('Recipe for White Gull 1');
  12244. AddAlchemyRecipe('Recipe for White Honey 1');
  12245. AddAlchemyRecipe('Recipe for White Raffards Decoction 1');
  12246.  
  12247.  
  12248.  
  12249. AddAlchemyRecipe('Recipe for Beast Oil 1');
  12250. AddAlchemyRecipe('Recipe for Cursed Oil 1');
  12251. AddAlchemyRecipe('Recipe for Hanged Man Venom 1');
  12252. AddAlchemyRecipe('Recipe for Hybrid Oil 1');
  12253. AddAlchemyRecipe('Recipe for Insectoid Oil 1');
  12254. AddAlchemyRecipe('Recipe for Magicals Oil 1');
  12255. AddAlchemyRecipe('Recipe for Necrophage Oil 1');
  12256. AddAlchemyRecipe('Recipe for Specter Oil 1');
  12257. AddAlchemyRecipe('Recipe for Vampire Oil 1');
  12258. AddAlchemyRecipe('Recipe for Draconide Oil 1');
  12259. AddAlchemyRecipe('Recipe for Ogre Oil 1');
  12260. AddAlchemyRecipe('Recipe for Relic Oil 1');
  12261. AddAlchemyRecipe('Recipe for Beast Oil 2');
  12262. AddAlchemyRecipe('Recipe for Cursed Oil 2');
  12263. AddAlchemyRecipe('Recipe for Hanged Man Venom 2');
  12264. AddAlchemyRecipe('Recipe for Hybrid Oil 2');
  12265. AddAlchemyRecipe('Recipe for Insectoid Oil 2');
  12266. AddAlchemyRecipe('Recipe for Magicals Oil 2');
  12267. AddAlchemyRecipe('Recipe for Necrophage Oil 2');
  12268. AddAlchemyRecipe('Recipe for Specter Oil 2');
  12269. AddAlchemyRecipe('Recipe for Vampire Oil 2');
  12270. AddAlchemyRecipe('Recipe for Draconide Oil 2');
  12271. AddAlchemyRecipe('Recipe for Ogre Oil 2');
  12272. AddAlchemyRecipe('Recipe for Relic Oil 2');
  12273.  
  12274.  
  12275. AddAlchemyRecipe('Recipe for Dancing Star 1');
  12276.  
  12277. AddAlchemyRecipe('Recipe for Dwimeritum Bomb 1');
  12278.  
  12279. AddAlchemyRecipe('Recipe for Grapeshot 1');
  12280. AddAlchemyRecipe('Recipe for Samum 1');
  12281.  
  12282. AddAlchemyRecipe('Recipe for White Frost 1');
  12283.  
  12284.  
  12285.  
  12286. AddAlchemyRecipe('Recipe for Dwarven spirit 1');
  12287. AddAlchemyRecipe('Recipe for Alcohest 1');
  12288. AddAlchemyRecipe('Recipe for White Gull 1');
  12289.  
  12290.  
  12291. AddStartingSchematics();
  12292.  
  12293.  
  12294. ids.Clear();
  12295. ids = inv.AddAnItem('Swallow 2 Rubedo');
  12296. EquipItem(ids[0]);
  12297. ids.Clear();
  12298. ids = inv.AddAnItem('Thunderbolt 2 Nigredo');
  12299. EquipItem(ids[0]);
  12300. ids.Clear();
  12301. ids = inv.AddAnItem('Tawny Owl 2');
  12302. EquipItem(ids[0]);
  12303. ids.Clear();
  12304.  
  12305. ids = inv.AddAnItem('Grapeshot 2');
  12306. EquipItem(ids[0]);
  12307. ids.Clear();
  12308. ids = inv.AddAnItem('Samum 2');
  12309. EquipItem(ids[0]);
  12310.  
  12311. inv.AddAnItem('Dwimeritum Bomb 1');
  12312. inv.AddAnItem('Silver Dust Bomb 1');
  12313. inv.AddAnItem('White Frost 2');
  12314. inv.AddAnItem('Dancing Star 2');
  12315. inv.AddAnItem('Brown Oil 3');
  12316. inv.AddAnItem('Ethereal Oil 3');
  12317. inv.AddAnItem('Poisonous Oil 2');
  12318. inv.AddAnItem('Flammable Oil 2');
  12319. inv.AddAnItem('Cat 2 Albedo');
  12320. inv.AddAnItem('Maribor Forest 1');
  12321. inv.AddAnItem('Petris Philtre 1');
  12322. inv.AddAnItem('White Gull 1', 3);
  12323. inv.AddAnItem('White Honey 1');
  12324.  
  12325.  
  12326. inv.AddAnItem('weapon_repair_kit_1', 2);
  12327. inv.AddAnItem('weapon_repair_kit_2', 1);
  12328. inv.AddAnItem('armor_repair_kit_1', 2);
  12329. inv.AddAnItem('armor_repair_kit_2', 1);
  12330.  
  12331.  
  12332. StandaloneEp2_2();
  12333. }
  12334.  
  12335. public final function StandaloneEp2_2()
  12336. {
  12337. var horseId : SItemUniqueId;
  12338. var ids : array<SItemUniqueId>;
  12339. var ents : array< CJournalBase >;
  12340. var i : int;
  12341. var manager : CWitcherJournalManager;
  12342.  
  12343.  
  12344. inv.AddAnItem( 'Cows milk', 20 );
  12345. ids.Clear();
  12346. ids = inv.AddAnItem( 'Dumpling', 44 );
  12347. EquipItem( ids[0] );
  12348.  
  12349.  
  12350. inv.AddAnItem( 'Clearing Potion', 2, true, false, false );
  12351.  
  12352.  
  12353. GetHorseManager().RemoveAllItems();
  12354.  
  12355. ids.Clear();
  12356. ids = inv.AddAnItem( 'Horse Bag 2' );
  12357. horseId = GetHorseManager( ).MoveItemToHorse( ids[0] );
  12358. GetHorseManager().EquipItem( horseId );
  12359.  
  12360. ids.Clear();
  12361. ids = inv.AddAnItem( 'Horse Blinder 2' );
  12362. horseId = GetHorseManager().MoveItemToHorse( ids[0] );
  12363. GetHorseManager().EquipItem( horseId );
  12364.  
  12365. ids.Clear();
  12366. ids = inv.AddAnItem( 'Horse Saddle 2' );
  12367. horseId = GetHorseManager().MoveItemToHorse( ids[0] );
  12368. GetHorseManager().EquipItem( horseId );
  12369.  
  12370. manager = theGame.GetJournalManager();
  12371.  
  12372.  
  12373. manager.GetActivatedOfType( 'CJournalCreature', ents );
  12374. for(i=0; i<ents.Size(); i+=1)
  12375. {
  12376. manager.ActivateEntry( ents[i], JS_Inactive, false, true );
  12377. }
  12378.  
  12379.  
  12380. ents.Clear();
  12381. manager.GetActivatedOfType( 'CJournalCharacter', ents );
  12382. for(i=0; i<ents.Size(); i+=1)
  12383. {
  12384. manager.ActivateEntry( ents[i], JS_Inactive, false, true );
  12385. }
  12386.  
  12387.  
  12388. ents.Clear();
  12389. manager.GetActivatedOfType( 'CJournalQuest', ents );
  12390. for(i=0; i<ents.Size(); i+=1)
  12391. {
  12392.  
  12393. if( StrStartsWith( ents[i].baseName, "q60" ) )
  12394. continue;
  12395.  
  12396. manager.ActivateEntry( ents[i], JS_Inactive, false, true );
  12397. }
  12398.  
  12399.  
  12400. manager.ActivateEntryByScriptTag( 'TutorialAard', JS_Active );
  12401. manager.ActivateEntryByScriptTag( 'TutorialAdrenaline', JS_Active );
  12402. manager.ActivateEntryByScriptTag( 'TutorialAxii', JS_Active );
  12403. manager.ActivateEntryByScriptTag( 'TutorialAxiiDialog', JS_Active );
  12404. manager.ActivateEntryByScriptTag( 'TutorialCamera', JS_Active );
  12405. manager.ActivateEntryByScriptTag( 'TutorialCamera_pad', JS_Active );
  12406. manager.ActivateEntryByScriptTag( 'TutorialCiriBlink', JS_Active );
  12407. manager.ActivateEntryByScriptTag( 'TutorialCiriCharge', JS_Active );
  12408. manager.ActivateEntryByScriptTag( 'TutorialCiriStamina', JS_Active );
  12409. manager.ActivateEntryByScriptTag( 'TutorialCounter', JS_Active );
  12410. manager.ActivateEntryByScriptTag( 'TutorialDialogClose', JS_Active );
  12411. manager.ActivateEntryByScriptTag( 'TutorialFallingRoll', JS_Active );
  12412. manager.ActivateEntryByScriptTag( 'TutorialFocus', JS_Active );
  12413. manager.ActivateEntryByScriptTag( 'TutorialFocusClues', JS_Active );
  12414. manager.ActivateEntryByScriptTag( 'TutorialFocusClues', JS_Active );
  12415. manager.ActivateEntryByScriptTag( 'TutorialHorseRoad', JS_Active );
  12416. manager.ActivateEntryByScriptTag( 'TutorialHorseSpeed0', JS_Active );
  12417. manager.ActivateEntryByScriptTag( 'TutorialHorseSpeed0_pad', JS_Active );
  12418. manager.ActivateEntryByScriptTag( 'TutorialHorseSpeed1', JS_Active );
  12419. manager.ActivateEntryByScriptTag( 'TutorialHorseSpeed2', JS_Active );
  12420. manager.ActivateEntryByScriptTag( 'TutorialHorseSummon', JS_Active );
  12421. manager.ActivateEntryByScriptTag( 'TutorialHorseSummon_pad', JS_Active );
  12422. manager.ActivateEntryByScriptTag( 'TutorialIgni', JS_Active );
  12423. manager.ActivateEntryByScriptTag( 'TutorialJournalAlternateSings', JS_Active );
  12424. manager.ActivateEntryByScriptTag( 'TutorialJournalBoatDamage', JS_Active );
  12425. manager.ActivateEntryByScriptTag( 'TutorialJournalBoatMount', JS_Active );
  12426. manager.ActivateEntryByScriptTag( 'TutorialJournalBuffs', JS_Active );
  12427. manager.ActivateEntryByScriptTag( 'TutorialJournalCharDevLeveling', JS_Active );
  12428. manager.ActivateEntryByScriptTag( 'TutorialJournalCharDevSkills', JS_Active );
  12429. manager.ActivateEntryByScriptTag( 'TutorialJournalCrafting', JS_Active );
  12430. manager.ActivateEntryByScriptTag( 'TutorialJournalCrossbow', JS_Active );
  12431. manager.ActivateEntryByScriptTag( 'TutorialJournalDialogGwint', JS_Active );
  12432. manager.ActivateEntryByScriptTag( 'TutorialJournalDialogShop', JS_Active );
  12433. manager.ActivateEntryByScriptTag( 'TutorialJournalDive', JS_Active );
  12434. manager.ActivateEntryByScriptTag( 'TutorialJournalDodge', JS_Active );
  12435. manager.ActivateEntryByScriptTag( 'TutorialJournalDodge_pad', JS_Active );
  12436. manager.ActivateEntryByScriptTag( 'TutorialJournalDrawWeapon', JS_Active );
  12437. manager.ActivateEntryByScriptTag( 'TutorialJournalDrawWeapon_pad', JS_Active );
  12438. manager.ActivateEntryByScriptTag( 'TutorialJournalDurability', JS_Active );
  12439. manager.ActivateEntryByScriptTag( 'TutorialJournalExplorations', JS_Active );
  12440. manager.ActivateEntryByScriptTag( 'TutorialJournalExplorations_pad', JS_Active );
  12441. manager.ActivateEntryByScriptTag( 'TutorialJournalFastTravel', JS_Active );
  12442. manager.ActivateEntryByScriptTag( 'TutorialJournalFocusRedObjects', JS_Active );
  12443. manager.ActivateEntryByScriptTag( 'TutorialJournalGasClouds', JS_Active );
  12444. manager.ActivateEntryByScriptTag( 'TutorialJournalHeavyAttacks', JS_Active );
  12445. manager.ActivateEntryByScriptTag( 'TutorialJournalHorse', JS_Active );
  12446. manager.ActivateEntryByScriptTag( 'TutorialJournalHorseStamina', JS_Active );
  12447. manager.ActivateEntryByScriptTag( 'TutorialJournalJump', JS_Active );
  12448. manager.ActivateEntryByScriptTag( 'TutorialJournalLightAttacks', JS_Active );
  12449. manager.ActivateEntryByScriptTag( 'TutorialJournalLightAttacks_pad', JS_Active );
  12450. manager.ActivateEntryByScriptTag( 'TutorialJournalMeditation', JS_Active );
  12451. manager.ActivateEntryByScriptTag( 'TutorialJournalMeditation_pad', JS_Active );
  12452. manager.ActivateEntryByScriptTag( 'TutorialJournalMonsterThreatLevels', JS_Active );
  12453. manager.ActivateEntryByScriptTag( 'TutorialJournalMovement', JS_Active );
  12454. manager.ActivateEntryByScriptTag( 'TutorialJournalMovement_pad', JS_Active );
  12455. manager.ActivateEntryByScriptTag( 'TutorialJournalMutagenIngredient', JS_Active );
  12456. manager.ActivateEntryByScriptTag( 'TutorialJournalMutagenPotion', JS_Active );
  12457. manager.ActivateEntryByScriptTag( 'TutorialJournalOils', JS_Active );
  12458. manager.ActivateEntryByScriptTag( 'TutorialJournalPetards', JS_Active );
  12459. manager.ActivateEntryByScriptTag( 'TutorialJournalPotions', JS_Active );
  12460. manager.ActivateEntryByScriptTag( 'TutorialJournalPotions_pad', JS_Active );
  12461. manager.ActivateEntryByScriptTag( 'TutorialJournalQuestArea', JS_Active );
  12462. manager.ActivateEntryByScriptTag( 'TutorialJournalRadial', JS_Active );
  12463. manager.ActivateEntryByScriptTag( 'TutorialJournalRifts', JS_Active );
  12464. manager.ActivateEntryByScriptTag( 'TutorialJournalRun', JS_Active );
  12465. manager.ActivateEntryByScriptTag( 'TutorialJournalShopDescription', JS_Active );
  12466. manager.ActivateEntryByScriptTag( 'TutorialJournalSignCast', JS_Active );
  12467. manager.ActivateEntryByScriptTag( 'TutorialJournalSignCast_pad', JS_Active );
  12468. manager.ActivateEntryByScriptTag( 'TutorialJournalSpecialAttacks', JS_Active );
  12469. manager.ActivateEntryByScriptTag( 'TutorialJournalStaminaExploration', JS_Active );
  12470. manager.ActivateEntryByScriptTag( 'TutorialJumpHang', JS_Active );
  12471. manager.ActivateEntryByScriptTag( 'TutorialLadder', JS_Active );
  12472. manager.ActivateEntryByScriptTag( 'TutorialLadderMove', JS_Active );
  12473. manager.ActivateEntryByScriptTag( 'TutorialLadderMove_pad', JS_Active );
  12474. manager.ActivateEntryByScriptTag( 'TutorialObjectiveSwitching', JS_Active );
  12475. manager.ActivateEntryByScriptTag( 'TutorialOxygen', JS_Active );
  12476. manager.ActivateEntryByScriptTag( 'TutorialParry', JS_Active );
  12477. manager.ActivateEntryByScriptTag( 'TutorialPOIUncovered', JS_Active );
  12478. manager.ActivateEntryByScriptTag( 'TutorialQuen', JS_Active );
  12479. manager.ActivateEntryByScriptTag( 'TutorialRoll', JS_Active );
  12480. manager.ActivateEntryByScriptTag( 'TutorialRoll_pad', JS_Active );
  12481. manager.ActivateEntryByScriptTag( 'TutorialSpeedPairing', JS_Active );
  12482. manager.ActivateEntryByScriptTag( 'TutorialSprint', JS_Active );
  12483. manager.ActivateEntryByScriptTag( 'TutorialStaminaSigns', JS_Active );
  12484. manager.ActivateEntryByScriptTag( 'TutorialStealing', JS_Active );
  12485. manager.ActivateEntryByScriptTag( 'TutorialSwimmingSpeed', JS_Active );
  12486. manager.ActivateEntryByScriptTag( 'TutorialTimedChoiceDialog', JS_Active );
  12487. manager.ActivateEntryByScriptTag( 'TutorialYrden', JS_Active );
  12488.  
  12489. SelectQuickslotItem( EES_RangedWeapon );
  12490.  
  12491.  
  12492. FactsAdd( 'kill_base_tutorials' );
  12493.  
  12494.  
  12495. theGame.GetTutorialSystem().RemoveAllQueuedTutorials();
  12496.  
  12497.  
  12498. FactsAdd( 'standalone_ep2' );
  12499. FactsRemove( "StandAloneEP2" );
  12500.  
  12501. theGame.GetJournalManager().ForceUntrackingQuestForEP1Savegame();
  12502. }
  12503.  
  12504. // W3EE - Begin
  12505. private var armorPiecesOriginal, armorPieces : array<SArmorCount>;
  12506. private function UpdateArmorCount( slot : EEquipmentSlots, item : SItemUniqueId, increment : int )
  12507. {
  12508. if( !inv.IsItemAnyArmor(item) )
  12509. return;
  12510.  
  12511. switch(inv.GetArmorType(item))
  12512. {
  12513. case EAT_Light: armorPieces[1].all += increment; if( slot != EES_Boots && slot != EES_Pants ) armorPieces[1].upper += increment; break;
  12514. case EAT_Medium: armorPieces[2].all += increment; if( slot != EES_Boots && slot != EES_Pants ) armorPieces[2].upper += increment; break;
  12515. case EAT_Heavy: armorPieces[3].all += increment; if( slot != EES_Boots && slot != EES_Pants ) armorPieces[3].upper += increment; break;
  12516. default : break;
  12517. }
  12518.  
  12519. switch(inv.GetArmorTypeOriginal(item))
  12520. {
  12521. case EAT_Light: armorPiecesOriginal[1].all += increment; if( slot != EES_Boots && slot != EES_Pants ) armorPiecesOriginal[1].upper += increment; break;
  12522. case EAT_Medium: armorPiecesOriginal[2].all += increment; if( slot != EES_Boots && slot != EES_Pants ) armorPiecesOriginal[2].upper += increment; break;
  12523. case EAT_Heavy: armorPiecesOriginal[3].all += increment; if( slot != EES_Boots && slot != EES_Pants ) armorPiecesOriginal[3].upper += increment; break;
  12524. default : break;
  12525. }
  12526.  
  12527. armorPieces[0].all = 4 - armorPieces[1].all - armorPieces[2].all - armorPieces[3].all;
  12528. armorPieces[0].upper = 2 - armorPieces[1].upper - armorPieces[2].upper - armorPieces[3].upper;
  12529. armorPiecesOriginal[0].all = 4 - armorPiecesOriginal[1].all - armorPiecesOriginal[2].all - armorPiecesOriginal[3].all;
  12530. armorPiecesOriginal[0].upper = 2 - armorPiecesOriginal[1].upper - armorPiecesOriginal[2].upper - armorPiecesOriginal[3].upper;
  12531. }
  12532.  
  12533. private function CountPiecesOnSpawn()
  12534. {
  12535. var item : SItemUniqueId;
  12536.  
  12537. armorPieces[0].all = 0; armorPieces[0].upper = 0;
  12538. armorPieces[1].all = 0; armorPieces[1].upper = 0;
  12539. armorPieces[2].all = 0; armorPieces[2].upper = 0;
  12540. armorPieces[3].all = 0; armorPieces[3].upper = 0;
  12541. armorPiecesOriginal[0].all = 0; armorPiecesOriginal[0].upper = 0;
  12542. armorPiecesOriginal[1].all = 0; armorPiecesOriginal[1].upper = 0;
  12543. armorPiecesOriginal[2].all = 0; armorPiecesOriginal[2].upper = 0;
  12544. armorPiecesOriginal[3].all = 0; armorPiecesOriginal[3].upper = 0;
  12545.  
  12546. if( inv.GetItemEquippedOnSlot(EES_Armor, item) )
  12547. {
  12548. switch(inv.GetArmorType(item))
  12549. {
  12550. case EAT_Light: armorPieces[1].all += 1; armorPieces[1].upper += 1; break;
  12551. case EAT_Medium: armorPieces[2].all += 1; armorPieces[2].upper += 1; break;
  12552. case EAT_Heavy: armorPieces[3].all += 1; armorPieces[3].upper += 1; break;
  12553. default : break;
  12554. }
  12555.  
  12556. switch(inv.GetArmorTypeOriginal(item))
  12557. {
  12558. case EAT_Light: armorPiecesOriginal[1].all += 1; armorPiecesOriginal[1].upper += 1; break;
  12559. case EAT_Medium: armorPiecesOriginal[2].all += 1; armorPiecesOriginal[2].upper += 1; break;
  12560. case EAT_Heavy: armorPiecesOriginal[3].all += 1; armorPiecesOriginal[3].upper += 1; break;
  12561. default : break;
  12562. }
  12563. }
  12564.  
  12565. if( inv.GetItemEquippedOnSlot(EES_Boots, item) )
  12566. {
  12567. switch(inv.GetArmorType(item))
  12568. {
  12569. case EAT_Light: armorPieces[1].all += 1; break;
  12570. case EAT_Medium: armorPieces[2].all += 1; break;
  12571. case EAT_Heavy: armorPieces[3].all += 1; break;
  12572. default : break;
  12573. }
  12574.  
  12575. switch(inv.GetArmorTypeOriginal(item))
  12576. {
  12577. case EAT_Light: armorPiecesOriginal[1].all += 1; break;
  12578. case EAT_Medium: armorPiecesOriginal[2].all += 1; break;
  12579. case EAT_Heavy: armorPiecesOriginal[3].all += 1; break;
  12580. default : break;
  12581. }
  12582. }
  12583.  
  12584. if( inv.GetItemEquippedOnSlot(EES_Pants, item) )
  12585. {
  12586. switch(inv.GetArmorType(item))
  12587. {
  12588. case EAT_Light: armorPieces[1].all += 1; break;
  12589. case EAT_Medium: armorPieces[2].all += 1; break;
  12590. case EAT_Heavy: armorPieces[3].all += 1; break;
  12591. default : break;
  12592. }
  12593.  
  12594. switch(inv.GetArmorTypeOriginal(item))
  12595. {
  12596. case EAT_Light: armorPiecesOriginal[1].all += 1; break;
  12597. case EAT_Medium: armorPiecesOriginal[2].all += 1; break;
  12598. case EAT_Heavy: armorPiecesOriginal[3].all += 1; break;
  12599. default : break;
  12600. }
  12601. }
  12602.  
  12603. if( inv.GetItemEquippedOnSlot(EES_Gloves, item) )
  12604. {
  12605. switch(inv.GetArmorType(item))
  12606. {
  12607. case EAT_Light: armorPieces[1].all += 1; armorPieces[1].upper += 1; break;
  12608. case EAT_Medium: armorPieces[2].all += 1; armorPieces[2].upper += 1; break;
  12609. case EAT_Heavy: armorPieces[3].all += 1; armorPieces[3].upper += 1; break;
  12610. default : break;
  12611. }
  12612.  
  12613. switch(inv.GetArmorTypeOriginal(item))
  12614. {
  12615. case EAT_Light: armorPiecesOriginal[1].all += 1; armorPiecesOriginal[1].upper += 1; break;
  12616. case EAT_Medium: armorPiecesOriginal[2].all += 1; armorPiecesOriginal[2].upper += 1; break;
  12617. case EAT_Heavy: armorPiecesOriginal[3].all += 1; armorPiecesOriginal[3].upper += 1; break;
  12618. default : break;
  12619. }
  12620. }
  12621.  
  12622. armorPieces[0].all = 4 - armorPieces[1].all - armorPieces[2].all - armorPieces[3].all;
  12623. armorPieces[0].upper = 2 - armorPieces[1].upper - armorPieces[2].upper - armorPieces[3].upper;
  12624. armorPiecesOriginal[0].all = 4 - armorPiecesOriginal[1].all - armorPiecesOriginal[2].all - armorPiecesOriginal[3].all;
  12625. armorPiecesOriginal[0].upper = 2 - armorPiecesOriginal[1].upper - armorPiecesOriginal[2].upper - armorPiecesOriginal[3].upper;
  12626. }
  12627.  
  12628. public function GetArmorCount() : array<SArmorCount>
  12629. {
  12630. return armorPieces;
  12631. }
  12632.  
  12633. public function GetArmorCountOrig() : array<SArmorCount>
  12634. {
  12635. return armorPiecesOriginal;
  12636. }
  12637.  
  12638. event OnAnimEvent_GeraltFastAttackAnimStart( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  12639. {
  12640. var animName : name;
  12641. var speed : float;
  12642.  
  12643. animName = GetAnimNameFromEventAnimInfo(animInfo);
  12644. switch(animName)
  12645. {
  12646. case 'geralt_attack_fast_2_rp': speed = 1.35f; break;
  12647. case 'geralt_attack_fast_4_rp': speed = 1.65f; break;
  12648. case 'geralt_attack_fast_5_rp': speed = 1.35f; break;
  12649. case 'geralt_attack_fast_6_rp': speed = 1.3f; break;
  12650.  
  12651. case 'geralt_attack_fast_long_1_rp': speed = 1.3f; break;
  12652. case 'geralt_attack_fast_long_1_lp': speed = 1.3f; break;
  12653.  
  12654. case 'geralt_attack_fast_2_lp': speed = 1.65f; break;
  12655. case 'geralt_attack_fast_3_lp': speed = 1.45f; break;
  12656. case 'geralt_attack_fast_4_lp': speed = 1.45f; break;
  12657. case 'geralt_attack_fast_5_lp': speed = 1.25f; break;
  12658. case 'geralt_attack_fast_6_lp': speed = 1.75f; break;
  12659. default: speed = 1.f; break;
  12660. }
  12661.  
  12662. SetAnimSpeed(speed);
  12663. }
  12664.  
  12665. event OnAnimEvent_GeraltStrongAttackAnimStart( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  12666. {
  12667. var animName : name;
  12668. var speed : float;
  12669.  
  12670. animName = GetAnimNameFromEventAnimInfo(animInfo);
  12671. switch(animName)
  12672. {
  12673. case 'geralt_attack_strong_4_rp': speed = 0.85f; break;
  12674. case 'geralt_attack_strong_5_rp': speed = 0.85f; break;
  12675.  
  12676. case 'geralt_attack_strong_3_lp': speed = 0.85f; break;
  12677. case 'geralt_attack_strong_2_lp': speed = 1.05f; break;
  12678. default: speed = 1.f; break;
  12679. }
  12680.  
  12681. SetAnimSpeed(speed);
  12682. }
  12683.  
  12684. event OnAnimEvent_GeraltFastAttackFarAnimStart( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  12685. {
  12686. SetAnimSpeed(0.9f);
  12687. }
  12688.  
  12689. event OnAnimEvent_GeraltStrongAttackFarAnimStart( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  12690. {
  12691. SetAnimSpeed(0.85f);
  12692. }
  12693.  
  12694. event OnAnimEvent_SecondaryAttackAnimStart( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  12695. {
  12696. var animName : name;
  12697. var speed : float;
  12698.  
  12699. animName = GetAnimNameFromEventAnimInfo(animInfo);
  12700. switch(animName)
  12701. {
  12702. case 'geralt_sec_fast_1_rp': speed = 1.2f; break;
  12703. case 'geralt_sec_fast_2_rp': speed = 1.1f; break;
  12704. case 'geralt_sec_fast_3_rp': speed = 1.25f; break;
  12705.  
  12706. case 'geralt_sec_fast_1_lp': speed = 1.1f; break;
  12707. case 'geralt_sec_fast_2_lp': speed = 1.3f; break;
  12708. case 'geralt_sec_fast_3_lp': speed = 1.2f; break;
  12709. default: speed = 1.f; break;
  12710. }
  12711.  
  12712. SetAnimSpeed(speed);
  12713. }
  12714.  
  12715. event OnAnimEvent_FastAxeAttackAnimStart( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  12716. {
  12717. var animName : name;
  12718. var speed : float;
  12719.  
  12720. animName = GetAnimNameFromEventAnimInfo(animInfo);
  12721. switch(animName)
  12722. {
  12723. case 'geralt_axe_fast_1_rp': speed = 1.25f; break;
  12724. case 'geralt_axe_fast_2_rp': speed = 1.25f; break;
  12725. case 'geralt_axe_fast_3_rp': speed = 1.25f; break;
  12726. case 'geralt_axe_fast_4_rp': speed = 1.25f; break;
  12727.  
  12728. case 'geralt_axe_fast_1_lp': speed = 1.25f; break;
  12729. case 'geralt_axe_fast_2_lp': speed = 1.25f; break;
  12730. case 'geralt_axe_fast_3_lp': speed = 1.25f; break;
  12731. case 'geralt_axe_fast_4_lp': speed = 1.25f; break;
  12732. case 'geralt_axe_fast_5_lp': speed = 1.25f; break;
  12733. default: speed = 1.f; break;
  12734. }
  12735.  
  12736. SetAnimSpeed(speed);
  12737. }
  12738.  
  12739. event OnAnimEvent_StrongAxeAttackAnimStart( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  12740. {
  12741. var animName : name;
  12742. var speed : float;
  12743.  
  12744. animName = GetAnimNameFromEventAnimInfo(animInfo);
  12745. switch(animName)
  12746. {
  12747. case 'geralt_axe_strong_1_rp': speed = 1.1f; break;
  12748. case 'geralt_axe_strong_2_rp': speed = 1.1f; break;
  12749. case 'geralt_axe_strong_3_rp': speed = 1.1f; break;
  12750. case 'geralt_axe_strong_4_rp': speed = 1.1f; break;
  12751.  
  12752. case 'geralt_axe_strong_1_lp': speed = 1.1f; break;
  12753. case 'geralt_axe_strong_2_lp': speed = 1.1f; break;
  12754. case 'geralt_axe_strong_3_lp': speed = 1.1f; break;
  12755. case 'geralt_axe_strong_4_lp': speed = 1.1f; break;
  12756. case 'geralt_axe_strong_5_lp': speed = 1.1f; break;
  12757. default: speed = 1.f; break;
  12758. }
  12759.  
  12760. SetAnimSpeed(speed);
  12761. }
  12762.  
  12763. event OnAnimEvent_ShieldBlockAnimStart( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  12764. {
  12765. var animName : name;
  12766. var speed : float;
  12767.  
  12768. animName = GetAnimNameFromEventAnimInfo(animInfo);
  12769. if( animName == 'geralt_shield_block_3' )
  12770. speed = 1.5f;
  12771. else
  12772. speed = 1.2f;
  12773.  
  12774. SetAnimSpeed(speed);
  12775. }
  12776.  
  12777. event OnAnimEvent_ShieldBlockAnimEnd( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  12778. {
  12779. ResetCustomAnimationSpeedMult();
  12780. Combat().RemovePlayerSpeedMult();
  12781. }
  12782.  
  12783. event OnAnimEvent_SpecialKickAnimStart( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  12784. {
  12785. SetAnimSpeed(0.9f);
  12786. }
  12787.  
  12788. event OnAnimEvent_SpecialKickAnimEnd( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  12789. {
  12790. ResetCustomAnimationSpeedMult();
  12791. Combat().RemovePlayerSpeedMult();
  12792. }
  12793.  
  12794. event OnAnimEvent_GeraltSpecialStrongAnimEnd( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  12795. {
  12796. ResetCustomAnimationSpeedMult();
  12797. Combat().RemovePlayerSpeedMult();
  12798. }
  12799.  
  12800. private var isInvulnerableDodge, isGrazeDodge : bool;
  12801. event OnAnimEvent_DodgeInvulnerableStart( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  12802. {
  12803. isInvulnerableDodge = true;
  12804. isGrazeDodge = false;
  12805. }
  12806.  
  12807. event OnAnimEvent_DodgeGrazeStart( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  12808. {
  12809. isInvulnerableDodge = false;
  12810. isGrazeDodge = true;
  12811. }
  12812.  
  12813. event OnAnimEvent_TriggerFinisherFromAnimEvent( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  12814. {
  12815. if( cachedAct && cachedAct.IsAlive() )
  12816. {
  12817. FinishTarget(0, 0);
  12818. }
  12819. }
  12820.  
  12821. private function ResetDodgeState()
  12822. {
  12823. isInvulnerableDodge = false;
  12824. isGrazeDodge = false;
  12825. }
  12826.  
  12827. private var animationID : int; default animationID = -1;
  12828. public function ResetCustomAnimationSpeedMult()
  12829. {
  12830. ResetAnimationSpeedMultiplier(animationID);
  12831. }
  12832.  
  12833. private timer function PlayLightAttackSound( dt : float, id : int )
  12834. {
  12835. SoundEvent("cmb_weapon_swoosh_light_slow", 'r_hand');
  12836. }
  12837.  
  12838. private timer function PlayHeavyAttackSound( dt : float, id : int )
  12839. {
  12840. SoundEvent("cmb_weapon_swoosh_heavy_slow", 'r_hand');
  12841. }
  12842.  
  12843. public function SetAnimSpeed( speed : float )
  12844. {
  12845. animationID = SetAnimationSpeedMultiplier(speed, animationID, true);
  12846. }
  12847.  
  12848. private var cachedAct : CActor;
  12849. private var isBashing : bool;
  12850. private var counteredAct : CActor;
  12851.  
  12852. public function SetCountAct( a : CActor )
  12853. {
  12854. counteredAct = a;
  12855. }
  12856.  
  12857. public function GetCountAct() : CActor
  12858. {
  12859. return counteredAct;
  12860. }
  12861.  
  12862. public timer function DestroyProj( dt : float, id : int )
  12863. {
  12864. Combat().IsUsingShield().DestroyProjectiles();
  12865. }
  12866.  
  12867. timer function SetNormalStagger( dt : float, id : int )
  12868. {
  12869. if( VecDistance(GetWorldPosition(), counteredAct.GetWorldPosition()) < 2.3f )
  12870. counteredAct.AddEffectDefault(EET_Stagger, this, "ReflexParryPerformed", false);
  12871. }
  12872.  
  12873. timer function SetLongStagger( dt : float, id : int )
  12874. {
  12875. if( VecDistance(GetWorldPosition(), counteredAct.GetWorldPosition()) < 2.3f )
  12876. counteredAct.AddEffectDefault(EET_LongStagger, this, "ReflexParryPerformed", false);
  12877. }
  12878.  
  12879. timer function SetKnockdownStagger( dt : float, id : int )
  12880. {
  12881. if( VecDistance(GetWorldPosition(), counteredAct.GetWorldPosition()) < 2.3f )
  12882. counteredAct.AddEffectDefault(EET_Knockdown, this, "ReflexParryPerformed", false);
  12883. }
  12884.  
  12885. public function GetIsBashing() : bool
  12886. {
  12887. return isBashing;
  12888. }
  12889.  
  12890. public function SetIsBashing( b : bool )
  12891. {
  12892. isBashing = b;
  12893. }
  12894.  
  12895. timer function RemoveBashing( dt : float, id : int )
  12896. {
  12897. SetIsBashing(false);
  12898. }
  12899.  
  12900. public function SetCachedAct( act : CActor )
  12901. {
  12902. cachedAct = act;
  12903. }
  12904.  
  12905. public function GetCachedAct() : CActor
  12906. {
  12907. return cachedAct;
  12908. }
  12909.  
  12910. public timer function FinishTarget( dt : float, id : int )
  12911. {
  12912. if( cachedAct && cachedAct.IsAlive() )
  12913. {
  12914. SetTarget(cachedAct, true);
  12915. cachedAct.AddAbility('ForceFinisher', false);
  12916. cachedAct.Kill('ForceFinisher', false, this, true);
  12917. SetFinisherVictim(cachedAct);
  12918. CleanCombatActionBuffer();
  12919. OnBlockAllCombatTickets(true);
  12920.  
  12921. // cachedAct.SignalGameplayEvent('ForceFinisher');
  12922. FindMoveTarget();
  12923. AddTimer('FinishVictim', 0.2, false);
  12924. }
  12925. }
  12926.  
  12927. timer function FinishVictim( dt : float, id : int )
  12928. {
  12929. cachedAct.SignalGameplayEvent('Finisher');
  12930. cachedAct = NULL;
  12931. }
  12932.  
  12933. public timer function RemoveWeaponCharge( dt : float, id : int )
  12934. {
  12935. Combat().RemoveInfusionEffects();
  12936. }
  12937.  
  12938. private var isAlternateCastInput : bool;
  12939. private var timeStamp : float;
  12940.  
  12941. public function GetTimeStampSign()
  12942. {
  12943. isAlternateCastInput = true;
  12944. timeStamp = theGame.GetEngineTimeAsSeconds();
  12945. }
  12946.  
  12947. public function ResetCastInput()
  12948. {
  12949. isAlternateCastInput = false;
  12950. }
  12951.  
  12952. public function GetIsAlternateCast() : bool
  12953. {
  12954. return (theGame.GetEngineTimeAsSeconds() - timeStamp > 0.1f && isAlternateCastInput) || theInput.GetActionValue('CastSignHold') > 0.f;
  12955. }
  12956.  
  12957. public function GetSignOwner() : W3SignOwnerPlayer
  12958. {
  12959. return signOwner;
  12960. }
  12961.  
  12962. public function GetBoltArmorPiercingValue() : SAbilityAttributeValue
  12963. {
  12964. var bolt : SItemUniqueId;
  12965.  
  12966. GetItemEquippedOnSlot(EES_Bolt, bolt);
  12967. return inv.GetItemAttributeValue(bolt, 'armor_reduction');
  12968. }
  12969.  
  12970. public function GetOilCritChanceBonus( victimMonsterCategory : EMonsterCategory ) : SAbilityAttributeValue
  12971. {
  12972. var i : int;
  12973. var weaponId : SItemUniqueId;
  12974. var oils : array<W3Effect_Oil>;
  12975. var critChance : SAbilityAttributeValue;
  12976. var attributeName, appliedOilName : name;
  12977.  
  12978. weaponId = inv.GetCurrentlyHeldSword();
  12979. oils = inv.GetOilsAppliedOnItem(weaponId);
  12980. if( oils.Size() > 0 )
  12981. {
  12982. attributeName = MonsterCategoryToCriticalChanceBonus(victimMonsterCategory);
  12983. for(i=0; i<oils.Size(); i+=1)
  12984. {
  12985. appliedOilName = oils[i].GetOilItemName();
  12986. if( oils[i].GetAmmoCurrentCount() > 0 && theGame.GetDefinitionsManager().ItemHasAttribute(appliedOilName, true, attributeName) )
  12987. {
  12988. critChance = inv.GetItemAttributeValue(weaponId, attributeName) * (1.f - PowF(1.f - oils[i].GetAmmoPercentage(), 2) * (1.f - 0.2f * GetSkillLevel(S_Alchemy_s05)));
  12989. }
  12990. }
  12991. }
  12992.  
  12993. return critChance;
  12994. }
  12995.  
  12996. public function GetOilCritDamageBonus( victimMonsterCategory : EMonsterCategory ) : SAbilityAttributeValue
  12997. {
  12998. var i : int;
  12999. var weaponId : SItemUniqueId;
  13000. var oils : array<W3Effect_Oil>;
  13001. var critDamage : SAbilityAttributeValue;
  13002. var attributeName, appliedOilName : name;
  13003.  
  13004. weaponId = inv.GetCurrentlyHeldSword();
  13005. oils = inv.GetOilsAppliedOnItem(weaponId);
  13006. if( oils.Size() > 0 )
  13007. {
  13008. attributeName = MonsterCategoryToCriticalDamageBonus(victimMonsterCategory);
  13009. for(i=0; i<oils.Size(); i+=1)
  13010. {
  13011. appliedOilName = oils[i].GetOilItemName();
  13012. if( oils[i].GetAmmoCurrentCount() > 0 && theGame.GetDefinitionsManager().ItemHasAttribute(appliedOilName, true, attributeName) )
  13013. {
  13014. critDamage = inv.GetItemAttributeValue(weaponId, attributeName) * (1.f - PowF(1.f - oils[i].GetAmmoPercentage(), 2) * (1.f - 0.2f * GetSkillLevel(S_Alchemy_s05)));
  13015. }
  13016. }
  13017. }
  13018.  
  13019. return critDamage;
  13020. }
  13021.  
  13022. public function GetOilResistIgnore( victimMonsterCategory : EMonsterCategory ) : float
  13023. {
  13024. var i : int;
  13025. var weaponId : SItemUniqueId;
  13026. var oils : array<W3Effect_Oil>;
  13027. var attributeName, appliedOilName : name;
  13028. var resistIgnore : SAbilityAttributeValue;
  13029.  
  13030. weaponId = inv.GetCurrentlyHeldSword();
  13031. oils = inv.GetOilsAppliedOnItem(weaponId);
  13032. if( oils.Size() > 0 )
  13033. {
  13034. attributeName = MonsterCategoryToResistReduction(victimMonsterCategory);
  13035. for(i=0; i<oils.Size(); i+=1)
  13036. {
  13037. appliedOilName = oils[i].GetOilItemName();
  13038. if( oils[i].GetAmmoCurrentCount() > 0 && theGame.GetDefinitionsManager().ItemHasAttribute(appliedOilName, true, attributeName) )
  13039. {
  13040. resistIgnore = inv.GetItemAttributeValue(weaponId, attributeName) * (1.f - PowF(1.f - oils[i].GetAmmoPercentage(), 2) * (1.f - 0.2f * GetSkillLevel(S_Alchemy_s05)));
  13041. }
  13042. }
  13043. }
  13044.  
  13045. return resistIgnore.valueMultiplicative;
  13046. }
  13047.  
  13048. public function GetPlayerArmorPiercingValue( isMelee : bool, isRanged : bool, throwable : CThrowable, attackName : name ) : float
  13049. {
  13050. var armorPiercing : SAbilityAttributeValue;
  13051. var finalArmorPiercing : float;
  13052. var attrs : array<name>;
  13053.  
  13054. if( isMelee )
  13055. {
  13056. armorPiercing = GetAttributeValue('armor_reduction');
  13057. finalArmorPiercing = armorPiercing.valueMultiplicative - 1.f;
  13058.  
  13059. if( IsHeavyAttack(attackName) )
  13060. {
  13061. armorPiercing = GetAttributeValue('armor_reduction_heavy_style');
  13062.  
  13063. finalArmorPiercing += 0.25f;
  13064. if( IsInCombatAction_SpecialAttackHeavy() )
  13065. finalArmorPiercing += 0.01f * GetSkillLevel(S_Sword_s02) * (GetSpecialAttackTimeRatio() * 1.4f + 0.9f);
  13066.  
  13067. finalArmorPiercing += GetSkillLevel(S_Sword_s08) * 0.03f + armorPiercing.valueMultiplicative;
  13068. }
  13069. else
  13070. if( IsLightAttack(attackName) )
  13071. {
  13072. armorPiercing = GetAttributeValue('armor_reduction_fast_style');
  13073. finalArmorPiercing += armorPiercing.valueMultiplicative;
  13074. }
  13075. }
  13076. else
  13077. {
  13078. if( (W3Petard)throwable )
  13079. finalArmorPiercing = ((W3Petard)throwable).GetBombArmorPierce(false);
  13080. else
  13081. if( (W3ThrowingKnife)throwable )
  13082. finalArmorPiercing = ((W3ThrowingKnife)throwable).GetKnifeArmorPierce(false) + (GetSkillLevel(S_Sword_s07) * 0.04f + armorPiercing.valueMultiplicative);
  13083. else
  13084. {
  13085. armorPiercing = GetBoltArmorPiercingValue();
  13086. finalArmorPiercing = GetSkillLevel(S_Sword_s07) * 0.04f + armorPiercing.valueMultiplicative;
  13087. }
  13088. }
  13089.  
  13090. return MinF(finalArmorPiercing * Damage().pap, 1.f);
  13091. }
  13092.  
  13093. public function HasQuen() : bool
  13094. {
  13095. return IsQuenActive(false) || IsQuenActive(true);
  13096. }
  13097.  
  13098. timer function DestroyQuen( dt : float, id : int )
  13099. {
  13100. var quen : W3QuenEntity;
  13101.  
  13102. quen = (W3QuenEntity)signs[ST_Quen].entity;
  13103. quen.Destroy();
  13104. }
  13105.  
  13106. timer function RemoveWolvenParry( dt : float, id : int )
  13107. {
  13108. Combat().GetWolvenEffect().ResetCounter();
  13109. }
  13110.  
  13111. private var isSelectionActive : bool; default isSelectionActive = false;
  13112. public function IsSelectionActive() : bool
  13113. {
  13114. return isSelectionActive;
  13115. }
  13116.  
  13117. public function SetSelectionActive( b : bool )
  13118. {
  13119. isSelectionActive = b;
  13120. }
  13121.  
  13122. public function GetNumMutagenSlotsUnlocked() : int
  13123. {
  13124. var pam : W3PlayerAbilityManager;
  13125. var count : int;
  13126.  
  13127. pam = (W3PlayerAbilityManager)abilityManager;
  13128. if( pam && pam.IsInitialized() )
  13129. {
  13130. if( pam.IsSkillMutagenSlotUnlocked(EES_SkillMutagen1) ) count += 1;
  13131. if( pam.IsSkillMutagenSlotUnlocked(EES_SkillMutagen2) ) count += 1;
  13132. if( pam.IsSkillMutagenSlotUnlocked(EES_SkillMutagen3) ) count += 1;
  13133. if( pam.IsSkillMutagenSlotUnlocked(EES_SkillMutagen4) ) count += 1;
  13134.  
  13135. return count;
  13136. }
  13137.  
  13138. return 0;
  13139. }
  13140.  
  13141. private var isFreeBomb : bool; default isFreeBomb = true;
  13142. public function IsFreeBomb() : bool
  13143. {
  13144. return isFreeBomb;
  13145. }
  13146.  
  13147. public function SetIsFreeBomb( b : bool )
  13148. {
  13149. isFreeBomb = b;
  13150. }
  13151.  
  13152. timer function ManticoreBombCooldown( dt : float, id : int )
  13153. {
  13154. SetIsFreeBomb(true);
  13155. }
  13156.  
  13157. public function GetFeverEffectReductionMult() : float
  13158. {
  13159. if( CanUseSkill(S_Alchemy_s13) && HasDecoctionEffect() )
  13160. return 1.f - (0.2f + 0.1f * (GetSkillLevel(S_Alchemy_s13) - 1));
  13161.  
  13162. return 1.f;
  13163. }
  13164. // W3EE - End
  13165.  
  13166. }
  13167.  
  13168. exec function fuqfep1()
  13169. {
  13170. theGame.GetJournalManager().ForceUntrackingQuestForEP1Savegame();
  13171. }
  13172.  
  13173.  
  13174. function GetWitcherPlayer() : W3PlayerWitcher
  13175. {
  13176. return (W3PlayerWitcher)thePlayer;
  13177. }
  13178.  
Add Comment
Please, Sign In to add comment