Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /***********************************************************************/
- /** © 2015 CD PROJEKT S.A. All rights reserved.
- /** THE WITCHER® is a trademark of CD PROJEKT S. A.
- /** The Witcher game is based on the prose of Andrzej Sapkowski.
- /***********************************************************************/
- statemachine abstract import class CR4Player extends CPlayer
- {
- protected var pcGamePlayInitialized : bool;
- private var pcMode : bool;
- default pcMode = true;
- protected saved var weaponHolster : WeaponHolster;
- public var rangedWeapon : Crossbow;
- public var crossbowDontPopStateHack : bool; default crossbowDontPopStateHack = false;
- private var hitReactTransScale : float;
- private var bIsCombatActionAllowed : bool;
- private var currentCombatAction : EBufferActionType;
- private var uninterruptedHitsCount : int;
- private var uninterruptedHitsCameraStarted : bool;
- private var uninterruptedHitsCurrentCameraEffect : name;
- private var counterTimestamps : array<EngineTime>;
- private var hitReactionEffect : bool;
- private var lookAtPosition : Vector;
- private var orientationTarget : EOrientationTarget;
- private var customOrientationTarget : EOrientationTarget;
- protected var customOrientationStack : array<SCustomOrientationParams>;
- public var delayOrientationChange : bool;
- protected var delayCameraOrientationChange : bool;
- private var actionType : int;
- private var customOrientationStackIndex : int;
- private var emptyMoveTargetTimer : float;
- private var onlyOneEnemyLeft : bool;
- public var isInFinisher : bool;
- private var finisherTarget : CGameplayEntity;
- private var combatStance : EPlayerCombatStance;
- public var approachAttack : int;
- default approachAttack = 1;
- protected var specialAttackCamera : bool;
- private var specialAttackTimeRatio : float;
- public saved var itemsPerLevel : array<name>;
- public var itemsPerLevelGiven : array<bool>;
- private var playerTickTimerPhase : int;
- default playerTickTimerPhase = 0;
- protected var evadeHeading : float;
- public var vehicleCbtMgrAiming : bool;
- public var specialHeavyChargeDuration : float;
- public var specialHeavyStartEngineTime : EngineTime;
- public var playedSpecialAttackMissingResourceSound : bool;
- public function SetPlayedSpecialAttackMissingResourceSound(b : bool) {playedSpecialAttackMissingResourceSound = b;}
- public var counterCollisionGroupNames : array<name>;
- public saved var lastInstantKillTime : GameTime;
- private var noSaveLockCombatActionName : string; default noSaveLockCombatActionName = 'combat_action';
- private var noSaveLockCombatAction : int;
- private var deathNoSaveLock : int;
- private var noSaveLock : int;
- protected saved var newGamePlusInitialized : bool;
- default newGamePlusInitialized = false;
- protected var BufferAllSteps : bool;
- protected var BufferCombatAction : EBufferActionType;
- protected var BufferButtonStage : EButtonStage;
- default BufferAllSteps = false;
- default customOrientationTarget = OT_None;
- default hitReactionEffect = true;
- default uninterruptedHitsCount = 0;
- default uninterruptedHitsCameraStarted = false;
- default customOrientationStackIndex = -1;
- private var keepRequestingCriticalAnimStart : bool;
- default keepRequestingCriticalAnimStart = false;
- private var currentCustomAction : EPlayerExplorationAction;
- public var substateManager : CExplorationStateManager;
- protected var isOnBoat : bool;
- protected var isInShallowWater : bool;
- public var medallion : W3MedallionFX;
- protected var lastMedallionEffect : float;
- private var isInRunAnimation : bool;
- public var interiorTracker :CPlayerInteriorTracker;
- public var m_SettlementBlockCanter : int;
- private var fistFightMinigameEnabled : bool;
- private var isFFMinigameToTheDeath : bool;
- private var FFMinigameEndsithBS : bool;
- public var fistFightTeleportNode : CNode;
- public var isStartingFistFightMinigame : bool;
- public var GeraltMaxHealth : float;
- public var fistsItems : array< SItemUniqueId >;
- default FFMinigameEndsithBS = false;
- default fistFightMinigameEnabled = false;
- default isFFMinigameToTheDeath = false;
- private var gwintAiDifficulty : EGwintDifficultyMode; default gwintAiDifficulty = EGDM_Easy;
- private var gwintAiAggression : EGwintAggressionMode; default gwintAiAggression = EGAM_Defensive;
- private var gwintMinigameState : EMinigameState; default gwintMinigameState = EMS_None;
- import private var horseWithInventory : EntityHandle;
- private var currentlyMountedHorse : CNewNPC;
- private var horseSummonTimeStamp : float;
- private saved var isHorseRacing : bool;
- private var horseCombatSlowMo : bool;
- default isHorseRacing = false;
- default horseCombatSlowMo = true;
- private var HudMessages : array <string>;
- protected var fShowToLowStaminaIndication : float;
- public var showTooLowAdrenaline : bool;
- private var HAXE3Container : W3Container;
- private var HAXE3bAutoLoot: bool;
- private var bShowHud : bool;
- private var dodgeFeedbackTarget : CActor;
- default HAXE3bAutoLoot = false;
- default fShowToLowStaminaIndication = 0.0f;
- default bShowHud = true;
- saved var displayedQuestsGUID : array< CGUID >;
- saved var rewardsMultiplier : array< SRewardMultiplier >;
- saved var glossaryImageOverride : array< SGlossaryImageOverride >;
- private var prevRawLeftJoyRot : float;
- protected var explorationInputContext : name;
- protected var combatInputContext : name;
- protected var combatFistsInputContext : name;
- private var isInsideInteraction : bool;
- private var isInsideHorseInteraction : bool;
- public var horseInteractionSource : CEntity;
- public var nearbyLockedContainersNoKey : array<W3LockableEntity>;
- private var bMoveTargetChangeAllowed : bool; default bMoveTargetChangeAllowed = true;
- private var moveAdj : CMovementAdjustor;
- private var defaultLocomotionController : CR4LocomotionPlayerControllerScript;
- private var canFollowNpc : bool;
- private var actorToFollow : CActor;
- public var terrainPitch : float;
- public var steepSlopeNormalPitch : float; default steepSlopeNormalPitch = 65.f;
- public var disableSprintTerrainPitch : float; default disableSprintTerrainPitch = 54.f;
- private var submergeDepth : float;
- private var m_useSelectedItemIfSpawned : bool; default m_useSelectedItemIfSpawned = false;
- var navQuery : CNavigationReachabilityQueryInterface;
- public saved var rememberedCustomHead : name;
- public saved var disableWeatherDisplay : bool;
- public saved var proudWalk : bool;
- private var etherealCount : int;
- default etherealCount = 0;
- public saved var injuredWalk : bool;
- public saved var tiedWalk : bool;
- private var insideDiveAttackArea : bool;
- default insideDiveAttackArea = false;
- private var diveAreaNumber : int;
- default diveAreaNumber = -1;
- private var flyingBossCamera : bool;
- default flyingBossCamera = false;
- public function SetFlyingBossCamera( val : bool ) { flyingBossCamera = val; }
- public function GetFlyingBossCamera() : bool { return flyingBossCamera; }
- public saved var upscaledTooltipState : bool;
- default upscaledTooltipState = false;
- private var phantomWeaponMgr : CPhantomWeaponManager;
- function EnablePCMode( flag : bool )
- {
- pcMode = flag;
- }
- public function IsPCModeEnabled() : bool
- {
- return pcMode && theInput.LastUsedPCInput();
- }
- public function ShouldUsePCModeTargeting() : bool
- {
- return IsPCModeEnabled() && !lastAxisInputIsMovement;
- }
- public function SetDodgeFeedbackTarget( target : CActor )
- {
- dodgeFeedbackTarget = target;
- }
- public function GetDodgeFeedbackTarget() : CActor
- {
- return dodgeFeedbackTarget;
- }
- public function SetSubmergeDepth( depth : float )
- {
- submergeDepth = depth;
- }
- public function GetSubmergeDepth() : float
- {
- return submergeDepth;
- }
- editable var delayBetweenIllusionOneliners : float;
- hint delayBetweenIllusionOneliners = "delay in secs between oneliners about illusionary objects";
- default delayBetweenIllusionOneliners = 5;
- private var battlecry_timeForNext : float;
- private var battlecry_delayMin : float; default battlecry_delayMin = 15;
- private var battlecry_delayMax : float; default battlecry_delayMax = 60;
- private var battlecry_lastTry : name;
- private var previousWeather : name;
- private var previousRainStrength : float;
- protected var receivedDamageInCombat : bool;
- protected var prevDayNightIsNight : bool;
- public var failedFundamentalsFirstAchievementCondition : bool;
- private var spawnedTime : float;
- public var currentMonsterHuntInvestigationArea : W3MonsterHuntInvestigationArea;
- private var isPerformingPhaseChangeAnimation : bool;
- default isPerformingPhaseChangeAnimation = false;
- default receivedDamageInCombat = false;
- public var playerMode : W3PlayerMode;
- protected saved var selectedItemId : SItemUniqueId;
- protected saved var blockedRadialSlots : array < SRadialSlotDef >;
- public var enemyCollectionDist : float;
- public var findMoveTargetDistMin : float;
- public var findMoveTargetDistMax : float;
- private var findMoveTargetScaledFrame : float;
- public var interactDist : float;
- protected var bCanFindTarget : bool;
- private var bIsConfirmingEmptyTarget : bool;
- private var displayTarget : CGameplayEntity;
- private var isShootingFriendly : bool;
- default findMoveTargetDistMax = 18.f;
- default findMoveTargetScaledFrame = 0.5f;
- default interactDist = 3.5f;
- private var currentSelectedTarget : CActor;
- private var selectedTargetToConfirm : CActor;
- private var bConfirmTargetTimerIsEnabled : bool;
- public saved var thrownEntityHandle : EntityHandle;
- private var isThrowingItemWithAim : bool;
- private saved var isThrowingItem : bool;
- private var isThrowHoldPressed : bool;
- private var isAimingCrossbow : bool;
- default isThrowingItemWithAim = false;
- public var playerAiming : PlayerAiming;
- public var forceDismember : bool;
- public var forceDismemberName : name;
- public var forceDismemberChance : int;
- public var forceDismemberExplosion : bool;
- private var finisherVictim : CActor;
- public var forceFinisher : bool;
- public var forceFinisherAnimName : name;
- public var forceFinisherChance : int;
- public var forcedStance : bool;
- private var m_WeaponFXCollisionGroupNames : array <name>;
- private var m_CollisionEffect : CEntity;
- private var m_LastWeaponTipPos : Vector;
- private var m_CollisionFxTemplate : CEntityTemplate;
- private var m_RefreshWeaponFXType : bool;
- private var m_PlayWoodenFX : bool;
- private var m_activePoster : W3Poster;
- public function SetActivePoster ( poster : W3Poster )
- {
- m_activePoster = poster;
- }
- public function RemoveActivePoster ()
- {
- m_activePoster = NULL;
- }
- public function GetActivePoster () : W3Poster
- {
- return m_activePoster;
- }
- public var horseOnNavMesh : bool;
- default horseOnNavMesh = true;
- public function SetHorseNav( val : bool ) { horseOnNavMesh = val; }
- public var testAdjustRequestedMovementDirection : bool;
- default testAdjustRequestedMovementDirection = false;
- default autoState = 'Exploration';
- import final function GetEnemiesInRange( out enemies : array< CActor > );
- import final function GetVisibleEnemies( out enemies : array< CActor > );
- import final function IsEnemyVisible( enemy : CActor ) : bool;
- import final function SetupEnemiesCollection( range, heightTolerance : float,
- maxEnemies : int,
- optional tag : name,
- optional flags : int );
- import final function IsInInterior() : bool;
- import final function IsInSettlement() : bool;
- import final function EnterSettlement( isEntering : bool );
- import final function ActionDirectControl( controller : CR4LocomotionDirectController ) : bool;
- import final function SetPlayerTarget( target : CActor );
- import final function SetPlayerCombatTarget( target : CActor );
- import final function ObtainTicketFromCombatTarget( ticketName : CName, ticketsCount : int );
- import final function FreeTicketAtCombatTarget();
- import final function SetScriptMoveTarget( target : CActor );
- import final function GetRiderData() : CAIStorageRiderData;
- import final function SetIsInCombat( inCombat : bool );
- import final function SaveLastMountedHorse( mountedHorse : CActor );
- import final function SetBacklightFromHealth( healthPercentage : float );
- import private final function SetBacklightColor( color : Vector );
- import final function GetCombatDataComponent() : CCombatDataComponent;
- import final function GetTemplatePathAndAppearance( out templatePath : string, out appearance : name );
- import final function HACK_BoatDismountPositionCorrection( slotPos : Vector );
- import final function HACK_ForceGetBonePosition( boneIndex : int ) : Vector;
- public function GetLevel() : int
- {
- return 0;
- }
- var targeting : CR4PlayerTargeting;
- var targetingPrecalcs : SR4PlayerTargetingPrecalcs;
- var targetingIn : SR4PlayerTargetingIn;
- var targetingOut : SR4PlayerTargetingOut;
- var useNativeTargeting : bool;
- default useNativeTargeting = true;
- var visibleActors : array< CActor >;
- var visibleActorsTime : array< float >;
- event OnSpawned( spawnData : SEntitySpawnData )
- {
- var atts : array<name>;
- var skill : ESkill;
- var i : int;
- var item : SItemUniqueId;
- AddAnimEventCallback('ThrowHoldTest', 'OnAnimEvent_ThrowHoldTest');
- AddAnimEventCallback('OnWeaponDrawReady', 'OnAnimEvent_OnWeaponDrawReady');
- AddAnimEventCallback('OnWeaponHolsterReady', 'OnAnimEvent_OnWeaponHolsterReady');
- AddAnimEventCallback('AllowTempLookAt', 'OnAnimEvent_AllowTempLookAt');
- AddAnimEventCallback('SlideToTarget', 'OnAnimEvent_SlideToTarget');
- AddAnimEventCallback('PlayFinisherBlood', 'OnAnimEvent_PlayFinisherBlood');
- AddAnimEventCallback('SlowMo', 'OnAnimEvent_SlowMo');
- AddAnimEventCallback('BloodTrailForced', 'OnAnimEvent_BloodTrailForced');
- AddAnimEventCallback('FadeOut', 'OnAnimEvent_FadeOut');
- AddAnimEventCallback('FadeIn', 'OnAnimEvent_FadeIn');
- AddAnimEventCallback('DisallowHitAnim', 'OnAnimEvent_DisallowHitAnim');
- AddAnimEventCallback('AllowFall', 'OnAnimEvent_AllowFall');
- AddAnimEventCallback('AllowFall2', 'OnAnimEvent_AllowFall2');
- AddAnimEventCallback('DettachGround', 'OnAnimEvent_DettachGround');
- AddAnimEventCallback('KillWithRagdoll', 'OnAnimEvent_KillWithRagdoll');
- AddAnimEventCallback('pad_vibration', 'OnAnimEvent_pad_vibration');
- AddAnimEventCallback('pad_vibration_light', 'OnAnimEvent_pad_vibration_light');
- AddAnimEventCallback('RemoveBurning', 'OnAnimEvent_RemoveBurning');
- AddAnimEventCallback('RemoveTangled', 'OnAnimEvent_RemoveTangled');
- AddAnimEventCallback('MoveNoise', 'OnAnimEvent_MoveNoise');
- AddItemPerLevelList();
- enemyCollectionDist = findMoveTargetDistMax;
- theGame.RemoveTimeScale('horse_melee');
- if(!spawnData.restored && !((W3ReplacerCiri)this) )
- {
- AddTimer('GiveStartingItems', 0.00001, true, , , true);
- if(!theGame.IsFinalBuild())
- {
- AddAbility('GeraltSkills_Testing');
- AddTimer('Debug_GiveTestingItems',0.0001,true);
- }
- FactsAdd("tut_stash_fresh_playthrough");
- }
- InitTargeting();
- if( spawnData.restored )
- {
- theGame.GameplayFactsRemove( "in_combat" );
- }
- if ( !weaponHolster )
- {
- weaponHolster = new WeaponHolster in this;
- }
- weaponHolster.Initialize( this, spawnData.restored );
- if ( !interiorTracker )
- {
- interiorTracker = new CPlayerInteriorTracker in this;
- }
- interiorTracker.Init( spawnData.restored );
- super.OnSpawned( spawnData );
- medallion = new W3MedallionFX in this;
- playerMode = new W3PlayerMode in this;
- playerMode.Initialize( this );
- playerAiming = new PlayerAiming in this;
- playerAiming.Initialize( this );
- navQuery = new CNavigationReachabilityQueryInterface in this;
- EnableFindTarget( true );
- AddTimer( 'CombatCheck', 0.2f, true );
- substateManager = ( CExplorationStateManager ) GetComponentByClassName( 'CExplorationStateManager' );
- findMoveTargetDist = findMoveTargetDistMax;
- SetupEnemiesCollection( enemyCollectionDist, findMoveTargetDist, 10, 'None', FLAG_Attitude_Neutral + FLAG_Attitude_Hostile + FLAG_Attitude_Friendly + FLAG_OnlyAliveActors );
- inputHandler.RemoveLocksOnSpawn();
- ((CActor) this ).SetInteractionPriority( IP_Prio_0 );
- prevDayNightIsNight = theGame.envMgr.IsNight();
- CheckDayNightCycle();
- EnableVisualDebug( SHOW_AI, true );
- FactsRemove("blocked_illusion_oneliner");
- SetFailedFundamentalsFirstAchievementCondition(false);
- m_CollisionFxTemplate = (CEntityTemplate) LoadResource( 'sword_colision_fx' );
- if( m_WeaponFXCollisionGroupNames.Size() == 0 )
- {
- m_WeaponFXCollisionGroupNames.PushBack('Static');
- m_WeaponFXCollisionGroupNames.PushBack('Foliage');
- m_WeaponFXCollisionGroupNames.PushBack('Fence');
- m_WeaponFXCollisionGroupNames.PushBack('BoatSide');
- m_WeaponFXCollisionGroupNames.PushBack('Door');
- m_WeaponFXCollisionGroupNames.PushBack('RigidBody');
- m_WeaponFXCollisionGroupNames.PushBack('Dynamic');
- m_WeaponFXCollisionGroupNames.PushBack('Destructible');
- }
- if ( counterCollisionGroupNames.Size() == 0 )
- {
- counterCollisionGroupNames.PushBack('Static');
- counterCollisionGroupNames.PushBack('Foliage');
- counterCollisionGroupNames.PushBack('Fence');
- counterCollisionGroupNames.PushBack('Terrain');
- counterCollisionGroupNames.PushBack('Door');
- counterCollisionGroupNames.PushBack('RigidBody');
- counterCollisionGroupNames.PushBack('Dynamic');
- counterCollisionGroupNames.PushBack('Destructible');
- }
- ResetPadBacklightColor();
- if( spawnData.restored )
- {
- if (IsCurrentlyUsingItemL())
- {
- if (inv.HasItemById( currentlyEquipedItemL ))
- {
- OnUseSelectedItem();
- }
- else
- {
- HideUsableItem(true);
- }
- }
- if ( GetCurrentMeleeWeaponType() == PW_Steel || GetCurrentMeleeWeaponType() == PW_Silver )
- {
- OnEquipMeleeWeapon(GetCurrentMeleeWeaponType(), true, true);
- }
- AddTimer( 'UnmountCrossbowTimer', 0.01, true );
- ClearBlockedSlots();
- }
- ((CR4PlayerStateSwimming)this.GetState('Swimming')).OnParentSpawned();
- SetImmortalityMode( AIM_None, AIC_SyncedAnim );
- theGame.GetDefinitionsManager().GetContainedAbilities('DwimeritiumBomb_3', atts);
- for(i=0; i<atts.Size(); i+=1)
- {
- skill = SkillNameToEnum(atts[i]);
- if(skill != S_SUndefined)
- BlockSkill(skill, false);
- }
- this.GetInventory().GetItemEquippedOnSlot( EES_SteelSword, item );
- if( this.GetInventory().ItemHasTag( item, 'PhantomWeapon' ) )
- {
- this.InitPhantomWeaponMgr();
- }
- if(FactsQuerySum("mq3036_fact_done") > 0)
- BlockAllActions('mq3036', false);
- spawnedTime = theGame.GetEngineTimeAsSeconds();
- if ( theGame.GetInGameConfigWrapper().GetVarValue('Gameplay', 'EnableUberMovement' ) == "1" )
- theGame.EnableUberMovement( true );
- else
- theGame.EnableUberMovement( false );
- if ( !FactsDoesExist("gwent_difficulty") )
- FactsAdd("gwent_difficulty", 2);
- if(!newGamePlusInitialized && FactsQuerySum("NewGamePlus") > 0)
- {
- NewGamePlusInitialize();
- }
- if( lastInstantKillTime > theGame.GetGameTime() )
- {
- SetLastInstantKillTime( GameTimeCreate(0) );
- }
- }
- public function NewGamePlusInitialize()
- {
- SetLastInstantKillTime( GameTimeCreate(0) );
- }
- public function GetTimeSinceSpawned() : float
- {
- return theGame.GetEngineTimeAsSeconds() - spawnedTime;
- }
- timer function UnmountCrossbowTimer( dt : float, id : int )
- {
- var itemId : SItemUniqueId;
- itemId = this.inv.GetItemFromSlot( 'l_weapon' );
- if ( inv.IsIdValid( itemId ) && inv.IsItemCrossbow( itemId ) )
- {
- rangedWeapon = (Crossbow)( inv.GetItemEntityUnsafe( itemId ) );
- if (rangedWeapon)
- {
- rangedWeapon.Initialize( (CActor)( rangedWeapon.GetParentEntity() ) );
- OnRangedForceHolster( true, true );
- RemoveTimer( 'UnmountCrossbowTimer' );
- }
- }
- else
- RemoveTimer( 'UnmountCrossbowTimer' );
- }
- event OnDestroyed()
- {
- playerAiming.RemoveAimingSloMo();
- if(rangedWeapon)
- rangedWeapon.ClearDeployedEntity(true);
- ResetPadBacklightColor();
- theGame.ReleaseNoSaveLock( noSaveLock );
- }
- public function GetBlockedSlots () : array < SRadialSlotDef >
- {
- return blockedRadialSlots;
- }
- public function ClearBlockedSlots()
- {
- var i : int;
- for ( i = 0; i < blockedRadialSlots.Size(); i+=1 )
- {
- if( !IsSwimming() )
- {
- if ( EnableRadialSlot(blockedRadialSlots[i].slotName, 'swimming'))
- {
- i-=1;
- continue;
- }
- }
- if (!IsUsingVehicle())
- {
- if ( EnableRadialSlot(blockedRadialSlots[i].slotName, 'useVehicle'))
- {
- i-=1;
- continue;
- }
- }
- if ( !IsCurrentlyUsingItemL() || !IsUsableItemLBlocked() )
- {
- if ( EnableRadialSlot(blockedRadialSlots[i].slotName, 'usableItemL'))
- {
- i-=1;
- continue;
- }
- }
- if ( !IsThrowingItem() )
- {
- if ( EnableRadialSlot(blockedRadialSlots[i].slotName, 'throwBomb'))
- {
- i-=1;
- continue;
- }
- }
- }
- }
- public function RestoreBlockedSlots ()
- {
- var i : int;
- var slotsToBlock : array<name>;
- for ( i = 0; i < blockedRadialSlots.Size(); i+=1 )
- {
- slotsToBlock.PushBack ( blockedRadialSlots[i].slotName );
- }
- if ( slotsToBlock.Size() > 0 )
- {
- EnableRadialSlots ( false, slotsToBlock );
- }
- }
- private function DisableRadialSlot ( slotName : name, sourceName : name ) : bool
- {
- var i : int;
- var k : int;
- var slotsToBlock : array<name>;
- var blockedRadialSlotEntry : SRadialSlotDef;
- slotsToBlock.PushBack ( slotName );
- for ( i = 0; i < blockedRadialSlots.Size(); i+=1 )
- {
- if ( blockedRadialSlots[i].slotName == slotName )
- {
- if ( sourceName != '' )
- {
- for ( k = 0; k < blockedRadialSlots[i].disabledBySources.Size(); k += 1 )
- {
- if ( blockedRadialSlots[i].disabledBySources[k] == sourceName )
- {
- return false;
- }
- }
- blockedRadialSlots[i].disabledBySources.PushBack ( sourceName );
- return false;
- }
- return false;
- }
- }
- blockedRadialSlotEntry = InitBlockedRadialSlotEntry ( slotName );
- if ( sourceName != '' )
- {
- blockedRadialSlotEntry.disabledBySources.PushBack ( sourceName );
- }
- blockedRadialSlots.PushBack ( blockedRadialSlotEntry );
- EnableRadialSlots ( false, slotsToBlock );
- return true;
- }
- public function EnableRadialSlot ( slotName : name, sourceName : name ) : bool
- {
- var i : int;
- var k : int;
- var slotsToBlock : array<name>;
- slotsToBlock.PushBack ( slotName );
- for ( i = 0; i < blockedRadialSlots.Size(); i+=1 )
- {
- if ( blockedRadialSlots[i].slotName == slotName )
- {
- if ( sourceName != '' )
- {
- for ( k = 0; k < blockedRadialSlots[i].disabledBySources.Size(); k += 1 )
- {
- if ( blockedRadialSlots[i].disabledBySources[k] == sourceName )
- {
- blockedRadialSlots[i].disabledBySources.Remove ( blockedRadialSlots[i].disabledBySources[k] );
- }
- }
- }
- if ( blockedRadialSlots[i].disabledBySources.Size() <= 0 )
- {
- blockedRadialSlots.Remove( blockedRadialSlots[i] );
- EnableRadialSlots ( true, slotsToBlock );
- return true;
- }
- return false;
- }
- }
- return false;
- }
- private function InitBlockedRadialSlotEntry ( slotName : name ) : SRadialSlotDef
- {
- var blockedRadialSlotEntry : SRadialSlotDef;
- blockedRadialSlotEntry.slotName = slotName;
- return blockedRadialSlotEntry;
- }
- public function EnableRadialSlotsWithSource ( enable : bool, slotsToBlock : array < name >, sourceName : name )
- {
- var i : int;
- for ( i = 0; i < slotsToBlock.Size(); i+=1 )
- {
- if ( enable )
- {
- EnableRadialSlot ( slotsToBlock[i], sourceName );
- }
- else
- {
- DisableRadialSlot ( slotsToBlock[i], sourceName );
- }
- }
- if ( blockedRadialSlots.Size() <= 0 )
- {
- blockedRadialSlots.Clear();
- }
- }
- public function IsRadialSlotBlocked ( slotName : name ) : bool
- {
- var i : int;
- for ( i = 0; i < blockedRadialSlots.Size(); i+=1 )
- {
- if ( blockedRadialSlots[i].slotName == slotName )
- {
- return true;
- }
- }
- return false;
- }
- public function RepairItem ( rapairKitId : SItemUniqueId, usedOnItem : SItemUniqueId );
- public function HasRepairAbleGearEquiped () : bool;
- public function HasRepairAbleWaponEquiped () : bool;
- public function IsItemRepairAble ( item : SItemUniqueId ) : bool;
- public final function ReduceAllOilsAmmo( id : SItemUniqueId )
- {
- var i : int;
- var oils : array< W3Effect_Oil >;
- oils = inv.GetOilsAppliedOnItem( id );
- for( i=0; i<oils.Size(); i+=1 )
- {
- oils[ i ].ReduceAmmo();
- }
- }
- public final function ResumeOilBuffs( steel : bool )
- {
- var item : SItemUniqueId;
- var oils : array< CBaseGameplayEffect >;
- var buff, recentOil : W3Effect_Oil;
- var i : int;
- item = GetEquippedSword( steel );
- oils = GetBuffs( EET_Oil );
- if( oils.Size() > 1 )
- {
- recentOil = inv.GetNewestOilAppliedOnItem( item, false );
- }
- for( i=0; i<oils.Size(); i+=1 )
- {
- buff = ( W3Effect_Oil ) oils[ i ];
- if( recentOil && recentOil == buff )
- {
- continue;
- }
- if(buff && buff.GetSwordItemId() == item )
- {
- buff.Resume( '' );
- }
- }
- if( recentOil )
- {
- recentOil.Resume( '' );
- }
- }
- protected final function PauseOilBuffs( isSteel : bool )
- {
- var item : SItemUniqueId;
- var oils : array< CBaseGameplayEffect >;
- var buff : W3Effect_Oil;
- var i : int;
- item = GetEquippedSword( isSteel );
- oils = GetBuffs( EET_Oil );
- for( i=0; i<oils.Size(); i+=1 )
- {
- buff = ( W3Effect_Oil ) oils[ i ];
- if(buff && buff.GetSwordItemId() == item )
- {
- buff.Pause( '', true );
- }
- }
- }
- public final function ManageAerondightBuff( apply : bool )
- {
- var aerondight : W3Effect_Aerondight;
- var item : SItemUniqueId;
- item = inv.GetCurrentlyHeldSword();
- if( inv.ItemHasTag( item, 'Aerondight' ) )
- {
- aerondight = (W3Effect_Aerondight)GetBuff( EET_Aerondight );
- if( apply )
- {
- if( !aerondight )
- {
- AddEffectDefault( EET_Aerondight, this, "Aerondight" );
- }
- else
- {
- aerondight.Resume( 'ManageAerondightBuff' );
- }
- }
- else
- {
- aerondight.Pause( 'ManageAerondightBuff' );
- }
- }
- }
- public function ApplyOil( oilId : SItemUniqueId, usedOnItem : SItemUniqueId ) : bool
- {
- var oilAbilities : array< name >;
- var ammo, ammoBonus : float;
- var dm : CDefinitionsManagerAccessor;
- var buffParams : SCustomEffectParams;
- var oilParams : W3OilBuffParams;
- var oilName : name;
- var min, max : SAbilityAttributeValue;
- var i : int;
- var oils : array< W3Effect_Oil >;
- var existingOil : W3Effect_Oil;
- if( !CanApplyOilOnItem( oilId, usedOnItem ) )
- {
- return false;
- }
- dm = theGame.GetDefinitionsManager();
- inv.GetItemAbilitiesWithTag( oilId, theGame.params.OIL_ABILITY_TAG, oilAbilities );
- oilName = inv.GetItemName( oilId );
- oils = inv.GetOilsAppliedOnItem( usedOnItem );
- for( i=0; i<oils.Size(); i+=1 )
- {
- if( oils[ i ].GetOilItemName() == oilName )
- {
- existingOil = oils[ i ];
- break;
- }
- }
- if( !existingOil )
- {
- // FCR3 --
- //if( !GetWitcherPlayer() || !GetWitcherPlayer().IsSetBonusActive( EISB_Wolf_1 ) )
- if( !GetWitcherPlayer() || !CanUseSkill(S_Alchemy_s06) )
- // -- FCR3
- {
- inv.RemoveAllOilsFromItem( usedOnItem );
- }
- else
- {
- // FCR3 --
- //dm.GetAbilityAttributeValue( GetSetBonusAbility( EISB_Wolf_1 ), 'max_oils_count', min, max );
- //if( inv.GetActiveOilsAppliedOnItemCount( usedOnItem ) >= CalculateAttributeValue( max ) )
- if( inv.GetActiveOilsAppliedOnItemCount( usedOnItem ) >= GetSkillLevel( S_Alchemy_s06 ) )
- // -- FCR3
- {
- inv.RemoveOldestOilFromItem( usedOnItem );
- }
- }
- }
- ammo = CalculateAttributeValue(inv.GetItemAttributeValue(oilId, 'ammo'));
- if(CanUseSkill(S_Alchemy_s06))
- {
- ammoBonus = CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s06, 'ammo_bonus', false, false));
- ammo *= 1 + ammoBonus * GetSkillLevel(S_Alchemy_s06);
- }
- if( existingOil )
- {
- existingOil.Reapply( RoundMath( ammo ) );
- }
- else
- {
- buffParams.effectType = EET_Oil;
- buffParams.creator = this;
- oilParams = new W3OilBuffParams in this;
- oilParams.iconPath = dm.GetItemIconPath( oilName );
- oilParams.localizedName = dm.GetItemLocalisationKeyName( oilName );
- oilParams.localizedDescription = dm.GetItemLocalisationKeyName( oilName );
- oilParams.sword = usedOnItem;
- oilParams.maxCount = RoundMath( ammo );
- oilParams.currCount = RoundMath( ammo );
- oilParams.oilAbilityName = oilAbilities[ 0 ];
- oilParams.oilItemName = oilName;
- buffParams.buffSpecificParams = oilParams;
- AddEffectCustom( buffParams );
- delete oilParams;
- }
- LogOils("Added oil <<" + oilName + ">> to <<" + inv.GetItemName( usedOnItem ) + ">>");
- SetFailedFundamentalsFirstAchievementCondition( true );
- theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_OnOilApplied );
- if( !inv.IsItemHeld( usedOnItem ) )
- {
- PauseOilBuffs( inv.IsItemSteelSwordUsableByPlayer( usedOnItem ) );
- }
- return true;
- }
- public final function IsEquippedSwordUpgradedWithOil(steel : bool, optional oilName : name) : bool
- {
- var sword : SItemUniqueId;
- var i : int;
- var oils : array< W3Effect_Oil >;
- sword = GetEquippedSword( steel );
- if( !inv.IsIdValid( sword ) )
- {
- return false;
- }
- if( oilName == '' )
- {
- return inv.ItemHasAnyActiveOilApplied( sword );
- }
- oils = inv.GetOilsAppliedOnItem( sword );
- for( i=0; i<oils.Size(); i+=1 )
- {
- if( oils[ i ].GetOilItemName() == oilName )
- {
- return true;
- }
- }
- return false;
- }
- public function CanApplyOilOnItem(oilId : SItemUniqueId, usedOnItem : SItemUniqueId) : bool
- {
- if(inv.ItemHasTag(oilId, theGame.params.TAG_STEEL_OIL) && inv.IsItemSteelSwordUsableByPlayer(usedOnItem))
- return true;
- if(inv.ItemHasTag(oilId, theGame.params.TAG_SILVER_OIL) && inv.IsItemSilverSwordUsableByPlayer(usedOnItem))
- return true;
- return false;
- }
- public final function DidFailFundamentalsFirstAchievementCondition() : bool
- {
- return failedFundamentalsFirstAchievementCondition;
- }
- public final function SetFailedFundamentalsFirstAchievementCondition(b : bool)
- {
- var i : int;
- var npc : CNewNPC;
- failedFundamentalsFirstAchievementCondition = b;
- if(failedFundamentalsFirstAchievementCondition)
- {
- for(i=0; i<hostileEnemies.Size(); i+=1)
- {
- if(hostileEnemies[i].HasTag(theGame.params.MONSTER_HUNT_ACTOR_TAG))
- {
- npc = (CNewNPC)hostileEnemies[i];
- npc.AddTag('failedFundamentalsAchievement');
- npc.AddTimer('FundamentalsAchFailTimer', 30*60, , , , true, true);
- }
- }
- }
- }
- public function IsInCombatFist() : bool
- {
- return this.GetCurrentStateName() == 'CombatFists';
- }
- public function IsInitialized() : bool;
- public function IsCiri() : bool
- {
- return ((W3ReplacerCiri)this);
- }
- protected function WouldLikeToMove() : bool
- {
- var speedVec : Vector;
- var speed, speedMult : float;
- speedVec.X = theInput.GetActionValue( 'GI_AxisLeftX' );
- speedVec.Y = theInput.GetActionValue( 'GI_AxisLeftY' );
- speed = VecLength2D( speedVec );
- return speed > 0.1f;
- }
- function HandleMovement( deltaTime : float )
- {
- if (WouldLikeToMove())
- SetBehaviorVariable( 'playerWouldLikeToMove', 1.0f);
- else
- SetBehaviorVariable( 'playerWouldLikeToMove', 0.0f);
- super.HandleMovement( deltaTime );
- }
- function BattleCryIsReady( ) : bool
- {
- var l_currentTime : float;
- l_currentTime = theGame.GetEngineTimeAsSeconds();
- if( l_currentTime >= battlecry_timeForNext )
- {
- return true;
- }
- return false;
- }
- function PlayBattleCry( _BattleCry : name , _Chance : float, optional _IgnoreDelay, ignoreRepeatCheck : bool )
- {
- var l_randValue : float;
- var fact : int;
- fact = FactsQuerySum("force_stance_normal");
- if( IsSwimming()
- || theGame.IsDialogOrCutscenePlaying()
- || IsInNonGameplayCutscene()
- || IsInGameplayScene()
- || theGame.IsCurrentlyPlayingNonGameplayScene()
- || theGame.IsFading()
- || theGame.IsBlackscreen()
- || FactsQuerySum("force_stance_normal") > 0 )
- {
- return;
- }
- if ( !ignoreRepeatCheck )
- {
- if( battlecry_lastTry == _BattleCry )
- return;
- }
- battlecry_lastTry = _BattleCry;
- l_randValue = RandF();
- if( l_randValue < _Chance && ( _IgnoreDelay || BattleCryIsReady() ) )
- {
- thePlayer.PlayVoiceset( 90, _BattleCry );
- battlecry_timeForNext = theGame.GetEngineTimeAsSeconds() + RandRangeF( battlecry_delayMax, battlecry_delayMin );
- }
- }
- public final function OnWeatherChanged()
- {
- if( IsInInterior()
- || GetCurrentStateName() != 'Exploration'
- || theGame.IsDialogOrCutscenePlaying()
- || IsInNonGameplayCutscene()
- || IsInGameplayScene()
- || theGame.IsCurrentlyPlayingNonGameplayScene()
- || theGame.IsFading()
- || theGame.IsBlackscreen()
- || GetTimeSinceSpawned() < 60 )
- {
- return;
- }
- AddTimer( 'CommentOnWeather', 1 );
- }
- public final timer function CommentOnWeather( _Delta : float, _Id : int )
- {
- var l_weather : name;
- var l_currentArea : EAreaName;
- var l_rand : float;
- l_weather = GetWeatherConditionName();
- l_currentArea = theGame.GetCommonMapManager().GetCurrentArea();
- switch ( l_weather )
- {
- case 'WT_Clear':
- l_rand = RandF();
- if( l_rand > 0.66f && !AreaIsCold() && theGame.envMgr.IsDay() )
- {
- thePlayer.PlayVoiceset( 90, 'WeatherHot' );
- }
- else if ( l_rand > 0.33f )
- {
- thePlayer.PlayVoiceset( 90, 'WeatherClearingUp' );
- }
- break;
- case 'WT_Rain_Storm':
- thePlayer.PlayVoiceset( 90, 'WeatherStormy' );
- break;
- case 'WT_Light_Clouds':
- if( previousRainStrength < GetRainStrength() )
- {
- thePlayer.PlayVoiceset( 90, 'WeatherLooksLikeRain' );
- }
- else if( AreaIsCold() && previousWeather == 'WT_Clear' )
- {
- thePlayer.PlayVoiceset( 90, 'WeatherCold' );
- }
- break;
- case 'WT_Mid_Clouds':
- if( previousRainStrength < GetRainStrength() )
- {
- thePlayer.PlayVoiceset( 90, 'WeatherRaining' );
- }
- else if( AreaIsCold() && previousWeather == 'WT_Clear' )
- {
- thePlayer.PlayVoiceset( 90, 'WeatherCold' );
- }
- break;
- case 'WT_Mid_Clouds_Dark':
- if( previousWeather != 'WT_Heavy_Clouds' && previousWeather != 'WT_Heavy_Clouds_Dark' )
- thePlayer.PlayVoiceset( 90, 'WeatherWindy' );
- break;
- case 'WT_Heavy_Clouds':
- if( previousWeather != 'WT_Mid_Clouds_Dark' && previousWeather != 'WT_Heavy_Clouds_Dark' )
- thePlayer.PlayVoiceset( 90, 'WeatherWindy' );
- break;
- case 'WT_Heavy_Clouds_Dark':
- if( thePlayer.IsOnBoat() )
- {
- thePlayer.PlayVoiceset( 90, 'WeatherSeaWillStorm' );
- }
- else if( previousRainStrength < GetRainStrength() )
- {
- thePlayer.PlayVoiceset( 90, 'WeatherLooksLikeRain' );
- }
- else
- {
- thePlayer.PlayVoiceset( 90, 'WeatherWindy' );
- }
- break;
- case 'WT_Snow':
- if( RandF() > 0.5f )
- thePlayer.PlayVoiceset( 90, 'WeatherSnowy' );
- else
- thePlayer.PlayVoiceset( 90, 'WeatherCold' );
- break;
- }
- previousRainStrength = GetRainStrength();
- previousWeather = l_weather;
- }
- function CanUpdateMovement() : bool
- {
- if ( rangedWeapon
- && GetBehaviorVariable( 'fullBodyAnimWeight' ) >= 1.f
- && rangedWeapon.GetCurrentStateName() != 'State_WeaponWait' )
- return false;
- return true;
- }
- public function SetDefaultLocomotionController()
- {
- if( !defaultLocomotionController )
- {
- defaultLocomotionController = new CR4LocomotionPlayerControllerScript in this;
- }
- ActionDirectControl( defaultLocomotionController );
- }
- event OnPlayerTickTimer( deltaTime : float )
- {
- var focusModeController : CFocusModeController;
- var cnt : int;
- super.OnPlayerTickTimer( deltaTime );
- HandleMovement( deltaTime );
- if ( playerAiming.GetCurrentStateName() == 'Aiming' )
- {
- FindTarget();
- FindNonActorTarget( false );
- UpdateDisplayTarget();
- UpdateLookAtTarget();
- }
- else
- {
- if( playerTickTimerPhase == 0 )
- {
- FindTarget();
- }
- else if( playerTickTimerPhase == 1 )
- {
- FindNonActorTarget( false );
- }
- else if ( playerTickTimerPhase == 2 )
- {
- UpdateDisplayTarget();
- UpdateLookAtTarget();
- }
- }
- playerTickTimerPhase = ( playerTickTimerPhase + 1 ) % 3;
- focusModeController = theGame.GetFocusModeController();
- focusModeController.UpdateFocusInteractions( deltaTime );
- cnt = (int)( effectManager.GetCriticalBuffsCount() > 0 );
- SetBehaviorVariable('hasCriticalBuff', cnt);
- }
- event OnDeath( damageAction : W3DamageAction )
- {
- super.OnDeath( damageAction );
- RemoveTimer('RequestCriticalAnimStart');
- EnableFindTarget( false );
- BlockAllActions('Death', true);
- EnableHardLock( false );
- theGame.CreateNoSaveLock( 'player_death', deathNoSaveLock, false, false );
- theGame.SetDeathSaveLockId( deathNoSaveLock );
- ClearHostileEnemiesList();
- RemoveReactions();
- SetPlayerCombatTarget(NULL);
- OnEnableAimingMode( false );
- theGame.EnableFreeCamera( false );
- }
- function OnRevived()
- {
- super.OnRevived();
- BlockAllActions('Death', false);
- theGame.ReleaseNoSaveLock(deathNoSaveLock);
- this.RestartReactionsIfNeeded();
- }
- public function CanStartTalk() : bool
- {
- if ( beingWarnedBy.Size() > 0 )
- return false;
- return super.CanStartTalk();
- }
- public function AddCounterTimeStamp(time : EngineTime) {counterTimestamps.PushBack(time);}
- public function CheckCounterSpamming(attacker : CActor) : bool
- {
- var counterWindowStartTime : EngineTime;
- var i, spamCounter : int;
- var reflexAction : bool;
- var testEngineTime : EngineTime;
- if(!attacker)
- return false;
- counterWindowStartTime = ((CNewNPC)attacker).GetCounterWindowStartTime();
- spamCounter = 0;
- reflexAction = false;
- if ( counterWindowStartTime == testEngineTime )
- {
- return false;
- }
- for(i = counterTimestamps.Size() - 1; i>=0; i-=1)
- {
- if(counterTimestamps[i] >= (counterWindowStartTime - EngineTimeFromFloat(0.4)) )
- {
- spamCounter += 1;
- }
- else
- {
- counterTimestamps.Remove(counterTimestamps[i]);
- continue;
- }
- if(!reflexAction && (counterTimestamps[i] >= counterWindowStartTime))
- reflexAction = true;
- }
- if(spamCounter == 1 && reflexAction)
- return true;
- return false;
- }
- protected function PerformCounterCheck(parryInfo: SParryInfo) : bool
- {
- var mult : float;
- var parryType : EParryType;
- var validCounter, useKnockdown : bool;
- var slideDistance, duration : float;
- var playerToTargetRot : EulerAngles;
- var zDifference, mutation8TriggerHP : float;
- var effectType : EEffectType;
- var repelType : EPlayerRepelType = PRT_Random;
- var params : SCustomEffectParams;
- var thisPos, attackerPos : Vector;
- var fistFightCheck, isMutation8 : bool;
- var fistFightCounter : bool;
- var attackerInventory : CInventoryComponent;
- var weaponId : SItemUniqueId;
- var weaponTags : array<name>;
- var playerToAttackerVector : Vector;
- var tracePosStart : Vector;
- var tracePosEnd : Vector;
- var hitPos : Vector;
- var hitNormal : Vector;
- var min, max : SAbilityAttributeValue;
- var npc : CNewNPC;
- if(ShouldProcessTutorial('TutorialDodge') || ShouldProcessTutorial('TutorialCounter'))
- {
- theGame.RemoveTimeScale( theGame.GetTimescaleSource(ETS_TutorialFight) );
- FactsRemove("tut_fight_slomo_ON");
- }
- if ( !parryInfo.canBeParried || parryInfo.attacker.HasAbility( 'CannotBeCountered' ) )
- return false;
- fistFightCheck = FistFightCheck( parryInfo.target, parryInfo.attacker, fistFightCounter );
- if( ParryCounterCheck() && parryInfo.targetToAttackerAngleAbs < theGame.params.PARRY_HALF_ANGLE && fistFightCheck )
- {
- validCounter = CheckCounterSpamming(parryInfo.attacker);
- if(validCounter)
- {
- if ( IsInCombatActionFriendly() )
- RaiseEvent('CombatActionFriendlyEnd');
- SetBehaviorVariable( 'parryType', ChooseParryTypeIndex( parryInfo ) );
- SetBehaviorVariable( 'counter', (float)validCounter);
- SetBehaviorVariable( 'parryType', ChooseParryTypeIndex( parryInfo ) );
- SetBehaviorVariable( 'counter', (float)validCounter);
- this.SetBehaviorVariable( 'combatActionType', (int)CAT_Parry );
- if ( !fistFightCounter )
- {
- attackerInventory = parryInfo.attacker.GetInventory();
- weaponId = attackerInventory.GetItemFromSlot('r_weapon');
- attackerInventory.GetItemTags( weaponId , weaponTags );
- if( GetWitcherPlayer().IsMutationActive( EPMT_Mutation8 ) )
- {
- isMutation8 = true;
- theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation8', 'hp_perc_trigger', min, max );
- mutation8TriggerHP = min.valueMultiplicative;
- }
- npc = (CNewNPC)parryInfo.attacker;
- if ( parryInfo.attacker.HasAbility('mon_gravehag') )
- {
- repelType = PRT_Slash;
- parryInfo.attacker.AddEffectDefault(EET_CounterStrikeHit, this, 'ReflexParryPerformed');
- }
- else if ( npc && !npc.IsHuman() && !npc.HasTag( 'dettlaff_vampire' ) )
- {
- repelType = PRT_SideStepSlash;
- }
- else if ( weaponTags.Contains('spear2h') )
- {
- repelType = PRT_SideStepSlash;
- parryInfo.attacker.AddEffectDefault(EET_CounterStrikeHit, this, "ReflexParryPerformed");
- parryInfo.attacker.SignalGameplayEvent( 'SpearDestruction');
- }
- // FCR3 --
- //else if( isMutation8 && npc && !npc.IsImmuneToMutation8Finisher() )
- else if( isMutation8 && npc && !npc.IsImmuneToMutation8Finisher() && RandRangeF(3,0) < GetWitcherPlayer().GetStat(BCS_Focus) )
- // -- FCR3
- {
- repelType = PRT_RepelToFinisher;
- npc.AddEffectDefault( EET_CounterStrikeHit, this, "ReflexParryPerformed" );
- SetTarget( npc, true );
- PerformFinisher( 0.f, 0 );
- }
- else
- {
- thisPos = this.GetWorldPosition();
- attackerPos = parryInfo.attacker.GetWorldPosition();
- playerToTargetRot = VecToRotation( thisPos - attackerPos );
- zDifference = thisPos.Z - attackerPos.Z;
- if ( playerToTargetRot.Pitch < -5.f && zDifference > 0.35 )
- {
- repelType = PRT_Kick;
- ragdollTarget = parryInfo.attacker;
- AddTimer( 'ApplyCounterRagdollTimer', 0.3 );
- }
- else
- {
- useKnockdown = false;
- if ( CanUseSkill(S_Sword_s11) )
- {
- if( GetSkillLevel(S_Sword_s11) > 1 && RandRangeF(3,0) < GetWitcherPlayer().GetStat(BCS_Focus) )
- {
- duration = CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s11, 'duration', false, true));
- useKnockdown = true;
- }
- }
- else if ( parryInfo.attacker.IsHuman() )
- {
- tracePosStart = parryInfo.attacker.GetWorldPosition();
- tracePosStart.Z += 1.f;
- playerToAttackerVector = VecNormalize( parryInfo.attacker.GetWorldPosition() - parryInfo.target.GetWorldPosition() );
- tracePosEnd = ( playerToAttackerVector * 0.75f ) + ( playerToAttackerVector * parryInfo.attacker.GetRadius() ) + parryInfo.attacker.GetWorldPosition();
- tracePosEnd.Z += 1.f;
- if ( !theGame.GetWorld().StaticTrace( tracePosStart, tracePosEnd, hitPos, hitNormal, counterCollisionGroupNames ) )
- {
- tracePosStart = tracePosEnd;
- tracePosEnd -= 3.f;
- if ( !theGame.GetWorld().StaticTrace( tracePosStart, tracePosEnd, hitPos, hitNormal, counterCollisionGroupNames ) )
- useKnockdown = true;
- }
- }
- if(useKnockdown && (!parryInfo.attacker.IsImmuneToBuff(EET_HeavyKnockdown) || !parryInfo.attacker.IsImmuneToBuff(EET_Knockdown)))
- {
- if(!parryInfo.attacker.IsImmuneToBuff(EET_HeavyKnockdown))
- {
- params.effectType = EET_HeavyKnockdown;
- }
- else
- {
- params.effectType = EET_Knockdown;
- }
- repelType = PRT_Kick;
- params.creator = this;
- params.sourceName = "ReflexParryPerformed";
- params.duration = duration;
- parryInfo.attacker.AddEffectCustom(params);
- }
- else
- {
- parryInfo.attacker.AddEffectDefault(EET_CounterStrikeHit, this, "ReflexParryPerformed");
- }
- }
- }
- parryInfo.attacker.GetInventory().PlayItemEffect(parryInfo.attackerWeaponId, 'counterattack');
- if ( repelType == PRT_Random )
- if ( RandRange(100) > 50 )
- repelType = PRT_Bash;
- else
- repelType = PRT_Kick;
- this.SetBehaviorVariable( 'repelType', (int)repelType );
- parryInfo.attacker.SetBehaviorVariable( 'repelType', (int)repelType );
- }
- else
- {
- parryInfo.attacker.AddEffectDefault(EET_CounterStrikeHit, this, "ReflexParryPerformed");
- }
- SetParryTarget ( parryInfo.attacker );
- SetSlideTarget( parryInfo.attacker );
- if ( !IsActorLockedToTarget() )
- SetMoveTarget( parryInfo.attacker );
- if ( RaiseForceEvent( 'PerformCounter' ) )
- OnCombatActionStart();
- SetCustomRotation( 'Counter', VecHeading( parryInfo.attacker.GetWorldPosition() - this.GetWorldPosition() ), 0.0f, 0.2f, false );
- AddTimer( 'UpdateCounterRotation', 0.4f, true );
- AddTimer( 'SetCounterRotation', 0.2f );
- IncreaseUninterruptedHitsCount();
- if(IsHeavyAttack(parryInfo.attackActionName))
- mult = theGame.params.HEAVY_STRIKE_COST_MULTIPLIER;
- DrainStamina(ESAT_Counterattack, 0, 0, '', 0, mult);
- theGame.GetGamerProfile().IncStat(ES_CounterattackChain);
- }
- else
- {
- ResetUninterruptedHitsCount();
- }
- return validCounter;
- }
- return false;
- }
- timer function UpdateCounterRotation( dt : float, id : int )
- {
- UpdateCustomRotationHeading( 'Counter', VecHeading( parryTarget.GetWorldPosition() - this.GetWorldPosition() ) );
- }
- timer function SetCounterRotation( dt : float, id : int )
- {
- SetCustomRotation( 'Counter', VecHeading( parryTarget.GetWorldPosition() - this.GetWorldPosition() ), 360.f, 0.2f, false );
- }
- private var parryTarget : CActor;
- private function SetParryTarget( t : CActor )
- {
- parryTarget = t;
- }
- private var ragdollTarget : CActor;
- timer function ApplyCounterRagdollTimer( time : float , id : int)
- {
- var actor : CActor;
- actor = (CActor)ragdollTarget;
- if(actor)
- {
- actor.AddEffectDefault(EET_HeavyKnockdown, this, 'ReflexParryPerformed');
- }
- }
- public function EnableMode( mode : EPlayerMode, enable : bool )
- {
- playerMode.EnableMode( mode, enable );
- }
- public function GetPlayerMode() : W3PlayerMode
- {
- return playerMode;
- }
- private function GetClosestIncomingAttacker() : CActor
- {
- var i, size : int;
- var attackerToPlayerDistances : array< float >;
- var closestAttackerIndex : int;
- var incomingAttackers : array<CActor>;
- // FCR3 --
- /*
- }*/
- private var drainFocusAmount : float;
- private var drainFocusTimerActive : bool;
- public function DrainFocus(amount : float )
- {
- if(abilityManager && abilityManager.IsInitialized() && IsAlive())
- {
- //if( GetWitcherPlayer().IsMutationActive( EPMT_Mutation7 ) && !drainFocusTimerActive && thePlayer.GetHealthPercents() >= 1 && thePlayer.IsInCombat() )
- if( GetWitcherPlayer().IsMutationActive( EPMT_Mutation7 ) )
- {
- drainFocusAmount += amount;
- if ( !drainFocusTimerActive )
- inv.SetItemDurabilityScript(item, inv.GetItemMaxDurability(item));
- return true;
- {
- AddTimer('Mutation7DelayedDrainFocus', 4.0f, , , , true);
- drainFocusTimerActive = true;
- }
- }
- else
- {
- abilityManager.DrainFocus(amount);
- }
- }
- }
- timer function Mutation7DelayedDrainFocus( dt : float, id : int )
- {
- abilityManager.DrainFocus(drainFocusAmount);
- drainFocusTimerActive = false;
- drainFocusAmount = 0;
- }
- // -- FCR3
Add Comment
Please, Sign In to add comment