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); }
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); }