Skip to content

Commit

Permalink
Fix DinoForceChase EnergyPerUnstoppableEnemyHit
Browse files Browse the repository at this point in the history
  • Loading branch information
Zheneq committed Jul 14, 2024
1 parent efb8133 commit c49f48b
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 10 deletions.
21 changes: 11 additions & 10 deletions Assembly-CSharp/DinoForceChase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,18 @@ public class DinoForceChase : GenericAbility_Container

private AbilityMod_DinoForceChase m_abilityMod;
private AbilityData.ActionType m_knockbackActionType = AbilityData.ActionType.INVALID_ACTION;

#if SERVER
// custom
private Passive_Dino m_passive;
#endif

protected override void SetupTargetersAndCachedVars()
{
#if SERVER
// custom
m_passive = GetPassiveOfType(typeof(Passive_Dino)) as Passive_Dino;
#endif
AbilityData abilityData = GetComponent<AbilityData>();
DinoTargetedKnockback knockbackAbility = GetAbilityOfType<DinoTargetedKnockback>();
if (abilityData != null && knockbackAbility != null)
Expand Down Expand Up @@ -78,17 +87,9 @@ protected override void ProcessGatheredHits(

actorHitResult.AddMiscHitEvent(new MiscHitEventData(MiscHitEventType.TargetForceChaseCaster));

if (hitActor.GetActorStatus().IsMovementDebuffImmune())
{
actorHitResult.AddTechPointGainOnCaster(GetEnergyPerUnstoppableEnemyHit());
}
else
if (ServerAbilityUtils.CurrentlyGatheringRealResults())
{
actorHitResult.AddMiscHitEvent(
new MiscHitEventData_UpdateFreelancerStat(
(int)FreelancerStats.DinoStats.ForceChaseNumChases,
1,
caster));
m_passive.AddActorInForceChase(hitActor);
}
}

Expand Down
38 changes: 38 additions & 0 deletions Assembly-CSharp/Passive_Dino.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ public class Passive_Dino : Passive
private Dino_SyncComponent m_syncComp;
private DinoLayerCones m_primaryAbility;
private DinoTargetedKnockback m_knockbackAbility;
private DinoForceChase m_forceChaseAbility;
private AbilityData.ActionType m_dashActionType;

private int m_pendingPowerLevel = -1;
private List<ActorData> m_actorsPendingKnockback;
private readonly List<ActorData> m_actorsInForceChase = new List<ActorData>();
public int m_dashCooldownAdjust;

protected override void OnStartup()
Expand All @@ -23,6 +25,7 @@ protected override void OnStartup()
m_primaryAbility = Owner.GetAbilityData().GetAbilityOfType(typeof(DinoLayerCones)) as DinoLayerCones;
m_knockbackAbility =
Owner.GetAbilityData().GetAbilityOfType(typeof(DinoTargetedKnockback)) as DinoTargetedKnockback;
m_forceChaseAbility = Owner.GetAbilityData().GetAbilityOfType(typeof(DinoForceChase)) as DinoForceChase;
m_dashActionType = Owner.GetAbilityData().GetActionTypeOfAbilityOfType(typeof(DinoDashOrShield));
Owner.OnKnockbackHitExecutedDelegate += OnKnockbackMovementHitExecuted;
}
Expand All @@ -32,6 +35,41 @@ private void OnDestroy()
Owner.OnKnockbackHitExecutedDelegate -= OnKnockbackMovementHitExecuted;
}

public override void OnAbilitiesDone()
{
base.OnAbilitiesDone();

int energyCompensation = 0;
foreach (ActorData hitActor in m_actorsInForceChase)
{
if (hitActor.GetActorStatus().IsMovementDebuffImmune())
{
energyCompensation += m_forceChaseAbility.GetEnergyPerUnstoppableEnemyHit();
}
else
{
Owner.GetFreelancerStats().IncrementValueOfStat(FreelancerStats.DinoStats.ForceChaseNumChases);
}
}
m_actorsInForceChase.Clear();

if (energyCompensation > 0)
{
ActorHitResults actorHitResults = new ActorHitResults(new ActorHitParameters(Owner, Owner.GetFreePos()));
actorHitResults.AddTechPointGainOnCaster(energyCompensation);
MovementResults.SetupAndExecuteAbilityResultsOutsideResolution(
Owner,
Owner,
actorHitResults,
m_forceChaseAbility);
}
}

public void AddActorInForceChase(ActorData actor)
{
m_actorsInForceChase.Add(actor);
}

public List<ActorData> GetActorsPendingKnockback()
{
return m_actorsPendingKnockback;
Expand Down

0 comments on commit c49f48b

Please sign in to comment.