public virtual void HealSP(float amount) { if (this.isAlive != 0) { DelegateUtils.UpdateField(ref this.SP, Mathf.Clamp(this.SP + amount, 0f, (float)this.maxSP), amount, this.onSPChanged); } }
public override void Core() { this._betweenAttackResumeTimer.Core(1f); this._forceResumeTimer.Core(this._shieldResumeRatio); this._minForceResumeTimer.Core(1f); this._shieldResumeTimer.Core(1f); if (this._state == State.Idle) { if (this.shield <= 0f) { this._state = State.ShieldBroken; this._forceResumeTimer.SetActive(true); this._minForceResumeTimer.SetActive(true); base.actor.abilityPlugin.TryRemoveModifier(base.instancedAbility, this.config.ShieldOnModifierName); base.actor.abilityPlugin.ApplyModifier(base.instancedAbility, this.config.ShieldOffModifierName); } else if (this._betweenAttackResumeTimer.isTimeUp) { this._state = State.Resuming; this._displayFloor = this.config.ShieldDisplayRatioFloor; this._shieldResumeStart = this.shield; this._shieldResumeTarget = Mathf.Min(this.shield + (this.maxShield * this.config.BetweenAttackResumeCD), this.maxShield); this._shieldResumeTimer.Reset(true); this._betweenAttackResumeTimer.Reset(true); } } else if (this._state == State.ShieldBroken) { this._shieldResumeRatio = this.GetShieldResumeRatio(); if (this._forceResumeTimer.isTimeUp && this._minForceResumeTimer.isTimeUp) { this._state = State.Resuming; this._displayFloor = this.config.ShieldDisplayRatioFloor; this._shieldResumeStart = this.shield; this._shieldResumeTarget = Mathf.Min(this.shield + (this.maxShield * this.config.ForceResumeRatio), this.maxShield); this._shieldResumeTimer.Reset(true); this._forceResumeTimer.Reset(false); base.actor.abilityPlugin.TryRemoveModifier(base.instancedAbility, this.config.ShieldOffModifierName); base.actor.abilityPlugin.ApplyModifier(base.instancedAbility, this.config.ShieldOnModifierName); } } else if (this._state == State.Resuming) { float newValue = Mathf.Lerp(this._shieldResumeStart, this._shieldResumeTarget, this._shieldResumeTimer.GetTimingRatio()); DelegateUtils.UpdateField <float>(ref this.shield, newValue, new Action <float, float>(this.OnShieldChanged)); if (this._shieldResumeTimer.isTimeUp) { this._state = State.Idle; this._shieldResumeTimer.timespan = this.config.ShieldResumeTimeSpan; this._displayFloor = this.config.ShieldDisplayRatioFloor; if (this._monsterActor.isElite) { this._monsterEntity.SwitchEliteShader(true); } } } }
private void SkillIDChangedCallback(string from, string to) { if (this.config.SkillID == to) { DelegateUtils.UpdateField <float>(ref this._stamina, this._stamina - this.config.SkillHeatCost, new Action <float, float>(this.UpdateStaminaDisplayValue)); this._isSkilling = true; } if (this.config.SkillID == from) { this._isSkilling = false; } }
public void AddRemainTime(float timeDelta) { float newValue = this.countDownTimer + timeDelta; if (newValue <= 0f) { newValue = 0f; this.isTiming = false; this.IsLevelTimeUp = true; this.OnTimingChange = (Action <float, float>)Delegate.Remove(this.OnTimingChange, new Action <float, float>(this.SetTimingText)); Singleton <EventManager> .Instance.FireEvent(new EvtLevelTimesUp(0x21800001), MPEventDispatchMode.Normal); } DelegateUtils.UpdateField(ref this.countDownTimer, newValue, this.OnTimingChange); }
private bool OnSkillStart(EvtAttackStart evt) { if (this.config.SkillIDs != null) { for (int i = 0; i < this.config.SkillIDs.Length; i++) { if ((this.config.SkillIDs[i] == evt.skillID) && !this._animatorEntity.ContainAnimEventPredicate(this.config.IgnorePredicate)) { DelegateUtils.UpdateField <float>(ref this._heat, this._heat + this.config.SkillHeatAdds[i], new Action <float, float>(this.UpdateOverheatDisplayValue)); this._coolSpeed = 0f; break; } } } return(true); }
private bool ListenAttackLanded(EvtAttackLanded evt) { KeyValuePair <int, string> item = new KeyValuePair <int, string>(this._frameIndex, evt.animEventID); if ((!this._countAnimEventComboOnceInOneFrame || !this._frameHitSet.Contains(item)) && (((evt.attackResult.isAnimEventAttack && evt.attackResult.isInComboCount) && (!evt.attackResult.rejected && (Singleton <RuntimeIDManager> .Instance.ParseCategory(evt.targetID) == 3))) && Singleton <AvatarManager> .Instance.IsLocalAvatar(evt.targetID))) { this._frameHitSet.Add(item); this.ResetComboTimer(); DelegateUtils.UpdateField(ref this.levelCombo, ((int)this.levelCombo) + 1, this.onLevelComboChanged); if (Singleton <LevelScoreManager> .Instance.maxComboNum < this.levelCombo) { Singleton <LevelScoreManager> .Instance.maxComboNum = this.levelCombo; } } return(true); }
public override void Core() { base.Core(); if (this._currentHeatAddSpeed != 0f) { DelegateUtils.UpdateField <float>(ref this._heat, this._heat + (((this._currentHeatAddSpeed * base.entity.TimeScale) * Time.deltaTime) * base.instancedAbility.Evaluate(this.config.ContinuousHeatSpeedRatio)), new Action <float, float>(this.UpdateOverheatDisplayValue)); this._coolSpeed = 0f; } if ((this._heat > 0f) && this._animatorEntity.ContainAnimEventPredicate(this.config.IgnorePredicate)) { DelegateUtils.UpdateField <float>(ref this._heat, 0f, new Action <float, float>(this.UpdateOverheatDisplayValue)); } if ((this._heat > this.config.OverHeatMax) && !this._isOverHeat) { this._isOverHeat = true; this._isOverheatDisplay.Pub(1f); base.actor.abilityPlugin.HandleActionTargetDispatch(this.config.OverHeatActions, base.instancedAbility, base.instancedModifier, base.actor, null); this._avatarActor.SetMuteSkill(this.config.OverHeatButtonSkillID, true); Singleton <AvatarManager> .Instance.GetAvatarByRuntimeID(base.actor.runtimeID).IsLockDirection = false; } if (this._isOverHeat) { if (this._heat > 0f) { if (this._coolSpeed < this.config.OverHeatCoolSpeed) { this._coolSpeed += (Time.deltaTime * this.config.OverHeatCoolSpeed) / this.config.ToMaxCoolSpeedTime; } DelegateUtils.UpdateField <float>(ref this._heat, this._heat - ((base.entity.TimeScale * Time.deltaTime) * this._coolSpeed), new Action <float, float>(this.UpdateOverheatDisplayValue)); } else { this._isOverHeat = false; this._isOverheatDisplay.Pub(0f); base.actor.abilityPlugin.HandleActionTargetDispatch(this.config.CoolDownActions, base.instancedAbility, base.instancedModifier, base.actor, null); this._avatarActor.SetMuteSkill(this.config.OverHeatButtonSkillID, false); } } else if ((this._heat > 0f) && !this._isAttacking) { if (this._coolSpeed < this.config.CoolSpeed) { this._coolSpeed += (Time.deltaTime * this.config.CoolSpeed) / this.config.ToMaxCoolSpeedTime; } DelegateUtils.UpdateField <float>(ref this._heat, this._heat - ((base.entity.TimeScale * Time.deltaTime) * this._coolSpeed), new Action <float, float>(this.UpdateOverheatDisplayValue)); } }
public override void Core() { if (this.isTiming && (this.countDownTimer > 0f)) { float newValue = this.countDownTimer - (((Time.deltaTime * this._levelActor.levelEntity.TimeScale) * this._levelActor.levelEntity.AuxTimeScale) * this.countDownSpeedRatio); if (newValue <= 0f) { newValue = 0f; this.isTiming = false; this.IsLevelTimeUp = true; this.OnTimingChange = (Action <float, float>)Delegate.Remove(this.OnTimingChange, new Action <float, float>(this.SetTimingText)); Singleton <EventManager> .Instance.FireEvent(new EvtLevelTimesUp(0x21800001), MPEventDispatchMode.Normal); } DelegateUtils.UpdateField(ref this.countDownTimer, newValue, this.OnTimingChange); } base.Core(); }
protected void HPPropertyChangedCallback() { float num = (float)(this.HP / this.maxHP); float newValue = (this.baseMaxHP + this.GetProperty("Actor_MaxHPDelta")) * (1f + this.GetProperty("Actor_MaxHPRatio")); bool flag = newValue > this.maxHP; DelegateUtils.UpdateField(ref this.maxHP, newValue, this.onMaxHPChanged); if (flag) { float num3 = num * this.maxHP; DelegateUtils.UpdateField(ref this.HP, num3, num3 - this.HP, this.onHPChanged); } else { float num4 = Mathf.Min((float)this.maxHP, (float)this.HP); DelegateUtils.UpdateField(ref this.HP, num4, num4 - this.HP, this.onHPChanged); } }
public override void Core() { base.Core(); if ((this._stamina < this.config.StaminaMax) && !this._isSkilling) { DelegateUtils.UpdateField <float>(ref this._stamina, Mathf.Min(this._stamina + ((base.entity.TimeScale * Time.deltaTime) * this.config.ResumeSpeed), this.config.StaminaMax), new Action <float, float>(this.UpdateStaminaDisplayValue)); } if ((this._stamina < this.config.SkillHeatCost) && !this._maskSkill) { this._avatarActor.entity.MaskTrigger(this.config.MaskTriggerID); this._maskSkill = true; } if ((this._stamina >= this.config.SkillHeatCost) && this._maskSkill) { this._avatarActor.entity.UnmaskTrigger(this.config.MaskTriggerID); this._maskSkill = false; } }
public override void Core() { base.Core(); bool flag = Singleton <AvatarManager> .Instance.IsLocalAvatar(base.entity.GetRuntimeID()); if (!this._isUltraMode && (((base.actor.SP / base.actor.maxSP) >= this.config.AutoUltraSPRatio) & flag)) { base.actor.abilityPlugin.HandleActionTargetDispatch(this.config.BeginActions, base.instancedAbility, base.instancedModifier, base.actor, null); this._isUltraMode = true; } if (this._isUltraMode & flag) { float num = this.config.CostSPSpeed * Time.deltaTime; DelegateUtils.UpdateField(ref base.actor.SP, base.actor.SP - num, -num, base.actor.onSPChanged); if ((base.actor.SP / base.actor.maxSP) < this.config.EndUltarSPRatio) { base.actor.abilityPlugin.HandleActionTargetDispatch(this.config.EndActions, base.instancedAbility, base.instancedModifier, base.actor, null); this._isUltraMode = false; } } }
private bool OnRemoteBeingHit(EvtBeingHit evt) { if (evt.attackData.rejected) { return(false); } if (evt.attackData.hitCollision == null) { this._actor.AmendHitCollision(evt.attackData); } evt.attackData.resolveStep = AttackData.AttackDataStep.FinalResolved; float newValue = this._actor.HP - evt.resolvedDamage; if (newValue <= 0f) { newValue = 0f; } DelegateUtils.UpdateField(ref this._actor.HP, newValue, newValue - this._actor.HP, this._actor.onHPChanged); this._actor.FireAttackDataEffects(evt.attackData); this._actor.AbilityBeingHit(evt); this._actor.BeingHit(evt.attackData, evt.beHitEffect); return(true); }
protected virtual bool OnBeingHitResolve(EvtBeingHit evt) { evt.Resolve(); if (evt.attackData.rejected) { if (evt.attackData.rejectState == AttackResult.RejectType.RejectButShowAttackEffect) { this.AmendHitCollision(evt.attackData); this.FireAttackDataEffects(evt.attackData); } return(false); } if ((base.isAlive == 0) || (evt.attackData.GetTotalDamage() > base.HP)) { evt.attackData.attackeeAniDefenceRatio = 0f; } AttackResult attackResult = DamageModelLogic.ResolveAttackDataFinal(this, evt.attackData); this.AmendHitCollision(attackResult); if (base.isAlive != 0) { if (base.abilityState.ContainsState(AbilityState.Invincible)) { attackResult.damage = 0f; attackResult.plainDamage = 0f; attackResult.fireDamage = 0f; attackResult.thunderDamage = 0f; attackResult.iceDamage = 0f; attackResult.alienDamage = 0f; attackResult.hitLevel = AttackResult.ActorHitLevel.Mute; attackResult.hitEffect = AttackResult.AnimatorHitEffect.Mute; attackResult.frameHalt += 5; } else if (base.abilityState.ContainsState(AbilityState.Endure)) { attackResult.hitEffect = AttackResult.AnimatorHitEffect.Mute; attackResult.frameHalt += 5; } if (!attackResult.isAnimEventAttack) { attackResult.hitEffect = AttackResult.AnimatorHitEffect.Mute; attackResult.hitLevel = AttackResult.ActorHitLevel.Normal; attackResult.hitEffectPattern = AttackResult.HitEffectPattern.OnlyBeHit; attackResult.attackCameraShake = null; attackResult.killEffect = KillEffect.KillNow; } float totalDamage = attackResult.GetTotalDamage(); float newValue = base.HP - totalDamage; if (newValue <= 0f) { newValue = 0f; } if (base.abilityState.ContainsState(AbilityState.Undamagable)) { DelegateUtils.UpdateField(ref this.HP, (float)base.HP, newValue - base.HP, base.onHPChanged); } else { DelegateUtils.UpdateField(ref this.HP, newValue, newValue - base.HP, base.onHPChanged); evt.resolvedDamage = totalDamage; } if (base.HP == 0f) { if ((base.abilityState & AbilityState.Limbo) != AbilityState.None) { evt.beHitEffect = BeHitEffect.NormalBeHit; this.BeingHit(attackResult, BeHitEffect.NormalBeHit); } else { if (attackResult.killEffect != KillEffect.KillTillHitAnimationEnd) { if ((this.monster.IsAnimatorInTag(MonsterData.MonsterTagGroup.Throw) || (evt.attackData.hitEffect == AttackResult.AnimatorHitEffect.ThrowUp)) || (evt.attackData.hitEffect == AttackResult.AnimatorHitEffect.ThrowUpBlow)) { attackResult.killEffect = KillEffect.KillFastWithNormalAnim; } else if (((base.abilityState & AbilityState.WitchTimeSlowed) != AbilityState.None) || (attackResult.aniDamageRatio >= 0.9f)) { attackResult.killEffect = KillEffect.KillFastWithDieAnim; } } this.Kill(evt.sourceID, evt.animEventID, attackResult.killEffect); evt.beHitEffect = BeHitEffect.KillingBeHit; this.BeingHit(attackResult, BeHitEffect.KillingBeHit); } } else { evt.beHitEffect = BeHitEffect.NormalBeHit; this.BeingHit(attackResult, BeHitEffect.NormalBeHit); } } else { evt.beHitEffect = BeHitEffect.OverkillBeHit; this.BeingHit(attackResult, BeHitEffect.OverkillBeHit); } this.FireAttackDataEffects(attackResult); if (evt.attackData.isAnimEventAttack) { EvtAttackLanded landed = new EvtAttackLanded(evt.sourceID, base.runtimeID, evt.animEventID, attackResult); Singleton <EventManager> .Instance.FireEvent(landed, MPEventDispatchMode.Normal); Singleton <NotifyManager> .Instance.FireNotify(new Notify(NotifyTypes.AttackLanded, landed)); } else { Singleton <EventManager> .Instance.FireEvent(new EvtDamageLanded(evt.sourceID, base.runtimeID, attackResult), MPEventDispatchMode.Normal); } base.MarkImportantEventIsHandled(evt); return(true); }
public override void Core() { this._frameIndex++; if (this._frameIndex > 20) { this._frameHitSet.Clear(); this._frameIndex = 0; } base.Core(); if (this._timeSlowTimer > 0f) { this._timeSlowTimer -= Time.unscaledDeltaTime; if (this._timeSlowTimer <= 0f) { Time.timeScale = 1f; Time.fixedDeltaTime = 0.02f * Time.timeScale; Singleton <WwiseAudioManager> .Instance.Post("Avatar_TimeSlow_End", null, null, null); if (this._timeSlowDoneCallback != null) { this._timeSlowDoneCallback(); this._timeSlowDoneCallback = null; } } } if (this._swapTimerState == LevelMinSwapTimerState.Running) { this._levelMinSwapTimer -= this.levelEntity.TimeScale * Time.deltaTime; if (this._levelMinSwapTimer < 0f) { this._swapTimerState = LevelMinSwapTimerState.Idle; this._levelMinSwapTimer = 0f; } } if (this._avatarSwapState == AvatarSwapState.Started) { this._avatarSwapState = AvatarSwapState.Idle; } if (this._levelComboTimer > 0f) { BaseMonoAvatar localAvatar = Singleton <AvatarManager> .Instance.GetLocalAvatar(); if (localAvatar != null) { string currentSkillID = localAvatar.CurrentSkillID; if (!string.IsNullOrEmpty(currentSkillID) && localAvatar.config.Skills.ContainsKey(currentSkillID)) { float comboTimerPauseNormalizedTimeStart = localAvatar.config.Skills[currentSkillID].ComboTimerPauseNormalizedTimeStart; float comboTimerPauseNormalizedTimeStop = localAvatar.config.Skills[currentSkillID].ComboTimerPauseNormalizedTimeStop; float currentNormalizedTime = localAvatar.GetCurrentNormalizedTime(); if (comboTimerPauseNormalizedTimeStart < comboTimerPauseNormalizedTimeStop) { if ((currentNormalizedTime > comboTimerPauseNormalizedTimeStart) && (currentNormalizedTime < comboTimerPauseNormalizedTimeStop)) { this._comboTimerState = ComboTimerState.Pause; } else if (currentNormalizedTime > comboTimerPauseNormalizedTimeStop) { this._comboTimerState = ComboTimerState.Running; } } } } if (this._comboTimerState == ComboTimerState.Running) { this._levelComboTimer -= this.levelEntity.TimeScale * Time.deltaTime; } if (this._levelComboTimer < 0f) { if (this.comboTimeUPCallback != null) { this.comboTimeUPCallback(); } else { DelegateUtils.UpdateField(ref this.levelCombo, 0, this.onLevelComboChanged); } } } }
private bool OnBeingHitResolve(EvtBeingHit evt) { evt.Resolve(); AttackResult attackResult = DamageModelLogic.ResolveAttackDataFinal(this, evt.attackData); if (attackResult.hitCollision == null) { AttackResult.HitCollsion collsion = new AttackResult.HitCollsion { hitPoint = this.prop.RootNode.position, hitDir = -this.prop.transform.forward }; attackResult.hitCollision = collsion; } if (!evt.attackData.isAnimEventAttack) { return(false); } if (base.isAlive != 0) { float totalDamage = attackResult.GetTotalDamage(); float newValue = base.HP - totalDamage; if (newValue <= 0f) { newValue = 0f; } DelegateUtils.UpdateField(ref this.HP, newValue, newValue - base.HP, base.onHPChanged); if (base.HP == 0f) { if (base.abilityState.ContainsState(AbilityState.Limbo)) { this.BeingHit(attackResult, BeHitEffect.NormalBeHit, evt.sourceID); } else { this.BeingHit(attackResult, BeHitEffect.KillingBeHit, evt.sourceID); this.Kill(evt.sourceID, evt.animEventID); } } else { this.BeingHit(attackResult, BeHitEffect.NormalBeHit, evt.sourceID); } } if ((attackResult.attackEffectPattern != null) && ((attackResult.hitEffectPattern == AttackResult.HitEffectPattern.Normal) || (attackResult.hitEffectPattern == AttackResult.HitEffectPattern.OnlyAttack))) { AttackPattern.ActAttackEffects(attackResult.attackEffectPattern, this.prop, attackResult.hitCollision.hitPoint, attackResult.hitCollision.hitDir); } if ((attackResult.beHitEffectPattern != null) && ((attackResult.hitEffectPattern == AttackResult.HitEffectPattern.Normal) || (attackResult.hitEffectPattern == AttackResult.HitEffectPattern.OnlyBeHit))) { AttackPattern.ActAttackEffects(attackResult.beHitEffectPattern, this.prop, attackResult.hitCollision.hitPoint, attackResult.hitCollision.hitDir); } if (evt.attackData.isAnimEventAttack) { EvtAttackLanded landed = new EvtAttackLanded(evt.sourceID, base.runtimeID, evt.animEventID, attackResult); Singleton <EventManager> .Instance.FireEvent(landed, MPEventDispatchMode.Normal); Singleton <NotifyManager> .Instance.FireNotify(new Notify(NotifyTypes.AttackLanded, landed)); } else { Singleton <EventManager> .Instance.FireEvent(new EvtDamageLanded(evt.sourceID, base.runtimeID, attackResult), MPEventDispatchMode.Normal); } return(true); }
private bool OnKilled(EvtKilled evt) { DelegateUtils.UpdateField <float>(ref this.shield, 0f, new Action <float, float>(this.OnShieldChanged)); return(true); }
private bool OnPostBeingHit(EvtBeingHit evt) { if (!evt.attackData.isAnimEventAttack) { return(false); } if (evt.attackData.rejected) { return(false); } if (base.actor.abilityState.ContainsState(AbilityState.Invincible) || base.actor.abilityState.ContainsState(AbilityState.Undamagable)) { return(false); } this._betweenAttackResumeTimer.Reset(); float attackerAniDamageRatio = evt.attackData.attackerAniDamageRatio; if (attackerAniDamageRatio < 0f) { attackerAniDamageRatio = 0f; } float num3 = Mathf.Pow(evt.attackData.damage, this.config.DamagePower) * Mathf.Pow(evt.attackData.attackerShieldDamageRatio, this.config.ShieldDamagePower); num3 *= Mathf.Pow(attackerAniDamageRatio, this.config.AniDamagePower); num3 += evt.attackData.attackerShieldDamageDelta; float newValue = this.shield - num3; if (newValue <= 0f) { newValue = 0f; } if ((newValue > 0f) && (this.config.ShieldSuccessEffect != null)) { evt.attackData.beHitEffectPattern = this.config.ShieldSuccessEffect; } if (((this.shield > 0f) && (newValue == 0f)) && (this._state != State.Resuming)) { if (this.config.ShieldBrokenTimeSlow > 0f) { Singleton <LevelManager> .Instance.levelActor.TimeSlow(this.config.ShieldBrokenTimeSlow); } base.FireMixinEffect(this.config.ShieldBrokenEffect, base.entity, false); base.actor.abilityPlugin.HandleActionTargetDispatch(this.config.ShiedlBrokenActions, base.instancedAbility, base.instancedModifier, Singleton <EventManager> .Instance.GetActor <BaseAbilityActor>(evt.sourceID), evt); evt.attackData.frameHalt = 0; evt.attackData.attackerAniDamageRatio = 10f; Singleton <EventManager> .Instance.FireEvent(new EvtShieldBroken(base.actor.runtimeID), MPEventDispatchMode.Normal); evt.attackData.AddHitFlag(AttackResult.ActorHitFlag.Count); this._forceResumeDamage = 0f; if (this._monsterActor.isElite) { this._monsterEntity.SwitchEliteShader(false); } } if (this._state != State.Resuming) { DelegateUtils.UpdateField <float>(ref this.shield, newValue, new Action <float, float>(this.OnShieldChanged)); } if ((this.shield > 0f) && (evt.attackData.attackeeAniDefenceRatio > evt.attackData.attackerAniDamageRatio)) { evt.attackData.frameHalt += this.config.ShieldSuccessAddFrameHalt; if (this.config.MuteHitEffect) { evt.attackData.hitEffect = AttackResult.AnimatorHitEffect.Mute; } else { evt.attackData.hitEffect = AttackResult.AnimatorHitEffect.Light; } base.actor.abilityPlugin.HandleActionTargetDispatch(this.config.ShieldSuccessActions, base.instancedAbility, base.instancedModifier, Singleton <EventManager> .Instance.GetActor <BaseAbilityActor>(evt.sourceID), evt); } if (((this._state == State.ShieldBroken) && (this.shield == 0f)) && (base.instancedAbility.Evaluate(this.config.ForceResumeByDamageHPRatio) > 0f)) { this._forceResumeDamage += evt.attackData.GetTotalDamage() * this._shieldResumeRatio; if ((this._forceResumeDamage / base.actor.baseMaxHP) >= base.instancedAbility.Evaluate(this.config.ForceResumeByDamageHPRatio)) { this._forceResumeTimer.isTimeUp = true; } } return(true); }