public override float OnTakeDamage(AbstractPerson takeDamageFrom, BasicDamage damage)
        {
            var realDamage = base.OnTakeDamage(takeDamageFrom, damage);

            if (realDamage > 0)
            {
                headBloodBar.Value -= realDamage;
            }
            return(realDamage);
        }
Example #2
0
        public override float OnTakeDamage(AbstractPerson takeDamageFrom, BasicDamage damage)
        {
            var realDamage = base.OnTakeDamage(takeDamageFrom, damage);

            if (realDamage > 0)
            {
                CEventCenter.BroadMessage(Message.M_PlayerBloodChange, -Mathf.RoundToInt(realDamage));
                this.IsInvincible = true;
                MainLoop.Instance.ExecuteLater(() => IsInvincible = false, this.DefaultConstTime);
            }
            return(realDamage);
        }
Example #3
0
        public override float OnCauseDamage(AbstractPerson causeDamageTo, BasicDamage damage)
        {
            var realDamage = base.OnCauseDamage(causeDamageTo, damage);

            if (realDamage > 0 && System.Math.Abs(realDamage) > 0.01f)
            {
                var change = Mathf.RoundToInt(realDamage * GameSettings.Instance.damageToDragScale);
                CEventCenter.BroadMessage(Message.M_PlayerDragChange, change);
            }

//			Debug.Log($"FinalDamage:[{realDamage}]");
            return(realDamage);
        }
Example #4
0
        public void AddDamageInstance(PSO2DamageInstance instance)
        {
            if (instance.TargetId == ID)
            {
                //we took damage from instance.SourceId
                _receivedDamageInstances.Add(instance);
                DamageTaken.AddDamage(instance);

                if (!_attackInfoList.ContainsKey("Damage Taken"))
                {
                    _attackInfoList.Add("Damage Taken", new AttackInfo("Damage Taken", 0));
                }
                _attackInfoList["Damage Taken"].AddDamageInstance(instance);
            }
            else if (instance.SourceId == ID)
            {
                //we dealt damage to instance.TargetId
                if (instance.IsAISDamage)
                {
                    AISDamage.AddDamage(instance);

                    if (trackersToSum.HasFlag(PSO2DamageTrackers.AIS))
                    {
                        AddAttackInfo(instance);
                    }
                }
                else if (instance.IsDarkBlastDamage)
                {
                    DarkBlastDamage.AddDamage(instance);

                    if (trackersToSum.HasFlag(PSO2DamageTrackers.DarkBlast))
                    {
                        AddAttackInfo(instance);
                    }
                }
                else if (instance.IsZanverseDamage)
                {
                    ZanverseDamage.AddDamage(instance);

                    if (trackersToSum.HasFlag(PSO2DamageTrackers.Zanverse))
                    {
                        AddAttackInfo(instance);
                    }
                }
                else if (instance.IsHeroFinishDamage)
                {
                    HeroTimeFinishDamage.AddDamage(instance);

                    if (trackersToSum.HasFlag(PSO2DamageTrackers.HTF))
                    {
                        AddAttackInfo(instance);
                    }
                }
                else if (instance.IsPhotonDamage)
                {
                    PhotonDamage.AddDamage(instance);

                    if (trackersToSum.HasFlag(PSO2DamageTrackers.PWP))
                    {
                        AddAttackInfo(instance);
                    }
                }
                else if (instance.IsRideroidDamage)
                {
                    RideroidDamage.AddDamage(instance);

                    if (trackersToSum.HasFlag(PSO2DamageTrackers.Ride))
                    {
                        AddAttackInfo(instance);
                    }
                }
                else if (instance.IsLaconiumDamage)
                {
                    LaconiumDamage.AddDamage(instance);

                    if (trackersToSum.HasFlag(PSO2DamageTrackers.LSW))
                    {
                        AddAttackInfo(instance);
                    }
                }
                else if (instance.IsElementalDamage)
                {
                    ElementDamage.AddDamage(instance);

                    if (trackersToSum.HasFlag(PSO2DamageTrackers.Elem))
                    {
                        AddAttackInfo(instance);
                    }
                }
                else
                {
                    BasicDamage.AddDamage(instance);

                    if (trackersToSum.HasFlag(PSO2DamageTrackers.Basic))
                    {
                        AddAttackInfo(instance);
                    }
                }

                _damageInstances.Add(instance);

                if (instance.IsZanverseDamage) //only update ZV max hit if ZV is not separated
                {
                    if (trackersToSum.HasFlag(PSO2DamageTrackers.Zanverse))
                    {
                        UpdateMaxHit(instance);
                    }
                }
                else
                {
                    UpdateMaxHit(instance);
                }
            }
        }