예제 #1
0
파일: Living.cs 프로젝트: uvbs/DDTank-3.0
        public virtual bool TakeDamage(Living source, ref int damageAmount, ref int criticalAmount, string msg)
        {
            bool result = false;

            if (IsFrost == false && m_blood > 0)
            {
                if (source != this || source.Team == this.Team)
                {
                    OnBeforeTakedDamage(source, ref damageAmount, ref criticalAmount);
                }

                m_blood -= (damageAmount + criticalAmount);

                if (EffectTrigger && this is Player)
                {
                    Game.SendMessage((this as Player).PlayerDetail, LanguageMgr.GetTranslation("PlayerEquipEffect.Success2"), LanguageMgr.GetTranslation("PlayerEquipEffect.Success3", (this as Player).PlayerDetail.PlayerCharacter.NickName), 3);
                }
                if (m_syncAtTime)
                {
                    if (this is SimpleBoss && (((SimpleBoss)this).NpcInfo.ID == 22 || ((SimpleBoss)this).NpcInfo.ID == 29))
                    {
                        m_game.SendGameUpdateHealth(this, 6, damageAmount + criticalAmount);
                    }
                    else
                    {
                        m_game.SendGameUpdateHealth(this, 1, damageAmount + criticalAmount);
                    }
                }
                OnAfterTakedDamage(source, damageAmount, criticalAmount);

                if (m_blood <= 0)
                {
                    Die();
                }
                //log.Error(string.Format("调用函数" + msg + string.Format("----玩家名称:{0},ID{1}", this.Name, Id) + string.Format("----当前血量{0}", Blood)));
                if (this is Player)
                {
                    //Console.WriteLine("伤血{0}", damageAmount + criticalAmount);
                    // Console.WriteLine("玩家{0}, 血量{1}", this.Name, Blood);
                }
                result = true;
            }

            EffectList.StopEffect(typeof(IceFronzeEffect));
            EffectList.StopEffect(typeof(HideEffect));
            EffectList.StopEffect(typeof(NoHoleEffect));

            return(result);
        }