예제 #1
0
파일: Living.cs 프로젝트: uvbs/DDTank-3.0
        public bool Beat(Living target, string action, int demageAmount, int criticalAmount, int delay)
        {
            if (target == null || target.IsLiving == false)
            {
                return(false);
            }

            demageAmount = MakeDamage(target);
            //Console.WriteLine("Living.Beat() : {0}", demageAmount);
            int dis = (int)target.Distance(X, Y);

            if (dis <= MaxBeatDis)   //加了等号
            {
                if (this.X - target.X > 0)
                {
                    this.Direction = -1;
                }
                else
                {
                    this.Direction = 1;
                }
                m_game.AddAction(new LivingBeatAction(this, target, demageAmount, criticalAmount, action, delay));
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #2
0
        protected int MakePetDamage(Living target)
        {
            double baseDamage        = this.m_owner.BaseDamage;
            double arg_12_0          = target.BaseGuard;
            double arg_19_0          = target.Defence;
            double attack            = this.m_owner.Attack;
            bool   arg_31_0          = this.m_owner.IgnoreArmor;
            float  currentDamagePlus = this.m_owner.CurrentDamagePlus;
            float  currentShootMinus = this.m_owner.CurrentShootMinus;
            double num = 0.95 * (target.BaseGuard - (double)(3 * this.m_owner.Grade)) / (500.0 + target.BaseGuard - (double)(3 * this.m_owner.Grade));
            double num2;

            if (target.Defence - this.m_owner.Lucky < 0.0)
            {
                num2 = 0.0;
            }
            else
            {
                num2 = 0.95 * (target.Defence - this.m_owner.Lucky) / (600.0 + target.Defence - this.m_owner.Lucky);
            }
            double num3 = baseDamage * (1.0 + attack * 0.001) * (1.0 - (num + num2 - num * num2)) * (double)currentDamagePlus * (double)currentShootMinus;
            Point  p    = new Point(this.X, this.Y);
            double num4 = target.Distance(p);

            if (num4 >= (double)this.m_petRadius)
            {
                return(0);
            }
            num3 *= 1.0 - num4 / (double)this.m_petRadius / 4.0;
            if (num3 < 0.0)
            {
                return(1);
            }
            return((int)num3);
        }
예제 #3
0
        protected int MakeDamage(Living target)
        {
            int result;

            if (target is SimpleNpc && (target as SimpleNpc).NpcInfo.Type == 3)
            {
                result = 1;
            }
            else
            {
                double baseDamage = this.m_owner.BaseDamage;
                double baseGuard  = target.BaseGuard;
                double defence    = target.Defence;
                double attack     = this.m_owner.Attack;
                if (this.m_owner.IgnoreArmor)
                {
                    baseGuard = 0.0;
                    defence   = 0.0;
                }
                float  damagePlus = this.m_owner.CurrentDamagePlus;
                float  shootMinus = this.m_owner.CurrentShootMinus;
                double DR         = 0.95 * (baseGuard - (double)(3 * this.m_owner.Grade)) / (500.0 + baseGuard - (double)(3 * this.m_owner.Grade));
                double DR2;
                if (defence - this.m_owner.Lucky < 0.0)
                {
                    DR2 = 0.0;
                }
                else
                {
                    DR2 = 0.95 * (defence - this.m_owner.Lucky) / (600.0 + defence - this.m_owner.Lucky);
                }
                double damage   = baseDamage * (1.0 + attack * 0.001) * (1.0 - (DR + DR2 - DR * DR2)) * (double)damagePlus * (double)shootMinus;
                Point  p        = new Point(this.X, this.Y);
                double distance = target.Distance(p);
                if (distance <= (double)this.m_radius)
                {
                    damage *= 1.0 - distance / (double)this.m_radius / 4.0;
                    if (damage < 0.0)
                    {
                        result = 1;
                    }
                    else
                    {
                        result = (int)damage;
                    }
                }
                else
                {
                    result = 0;
                }
            }
            return(result);
        }
예제 #4
0
        protected int MakeDamage(Living target)
        {
            double baseDamage = m_owner.BaseDamage;
            double baseGuard  = target.BaseGuard;

            double defence = target.Defence;
            double attack  = m_owner.Attack;

            if (m_owner.IgnoreArmor)
            {
                baseGuard = 0;
                defence   = 0;
            }

            float damagePlus = m_owner.CurrentDamagePlus;
            float shootMinus = m_owner.CurrentShootMinus;

            //伤害={ 基础伤害*(1+攻击*0.1%)*[1-(基础护甲/200+防御*0.03%)] }*(1+道具攻击加成)*炸弹威力*连击系数
            // double damage = (baseDamage * ( 1 + attack * 0.001) * (1 - (baseGuard / 200 + defence * 0.003))) * (1 + damagePlus) * shootMinus ;

            double DR1 = 0.95 * (target.BaseGuard - 3 * m_owner.Grade) / (500 + target.BaseGuard - 3 * m_owner.Grade);//护甲提供伤害减免
            double DR2 = 0;

            if ((target.Defence - m_owner.Lucky) < 0)
            {
                DR2 = 0;
            }
            else
            {
                DR2 = 0.95 * (target.Defence - m_owner.Lucky) / (600 + target.Defence - m_owner.Lucky); //防御提供的伤害减免
            }
            //DR2 = DR2 < 0 ? 0 : DR2;

            double damage = (baseDamage * (1 + attack * 0.001) * (1 - (DR1 + DR2 - DR1 * DR2))) * damagePlus * shootMinus;

            Point  p        = new Point(X, Y);
            double distance = target.Distance(p);

            if (distance < m_radius)
            {
                damage = damage * (1 - distance / m_radius / 4);
                if (damage < 0)
                {
                    return(1);
                }
            }
            else
            {
                return(0);
            }
            return((int)damage);
        }
예제 #5
0
        public bool Beat(Living target, string action, int demageAmount, int criticalAmount, int delay, int livingCount, int attackEffect)
        {
            if (target == null || !target.IsLiving)
            {
                return(false);
            }
            demageAmount = this.MakeDamage(target);
            int num = (int)target.Distance(this.X, this.Y);

            if (num <= this.MaxBeatDis)
            {
                if (this.X - target.X > 0)
                {
                    this.Direction = -1;
                }
                else
                {
                    this.Direction = 1;
                }
                this.m_game.AddAction(new LivingBeatAction(this, target, demageAmount, criticalAmount, action, delay, livingCount, attackEffect));
                return(true);
            }
            return(false);
        }
예제 #6
0
        private bool BeatImpl(Living target, string action, int delay, int demageAmount, bool isdemage)
        {
            int  dis = (int)target.Distance(this.X, this.Y);
            bool result;

            if (dis <= this.MaxBeatDis)
            {
                if (this.X - target.X > 0)
                {
                    this.Direction = -1;
                }
                else
                {
                    this.Direction = 1;
                }
                this.m_game.AddAction(new LivingBeatAction(this, target, demageAmount, 0, action, delay, isdemage));
                result = true;
            }
            else
            {
                result = false;
            }
            return(result);
        }
예제 #7
0
        public bool Beat(Living target, string action, int demageAmount, int criticalAmount, int delay, int livingCount, int attackEffect)
        {
            if (target == null || target.IsLiving == false)
                return false;

            demageAmount = MakeDamage(target);
            //Console.WriteLine("Living.Beat() : {0}", demageAmount);
            int dis = (int)target.Distance(X, Y);
            if (dis <= MaxBeatDis)   //加了等号
            {
                if (X - target.X > 0)
                {
                    Direction = -1;
                }
                else
                {
                    Direction = 1;
                }
                m_game.AddAction(new LivingBeatAction(this, target, demageAmount, criticalAmount, action, delay, livingCount, attackEffect));
                return true;
            }
            else
            {
                return false;
            }
        }
예제 #8
0
        protected int MakeDamage(Living target)
        {
            double baseDamage = m_owner.BaseDamage;
            double baseGuard = target.BaseGuard;

            double defence = target.Defence;
            double attack = m_owner.Attack;
            if (m_owner.IgnoreArmor)
            {
                baseGuard = 0;
                defence = 0;
            }

            float damagePlus = m_owner.CurrentDamagePlus;
            float shootMinus = m_owner.CurrentShootMinus;

            //伤害={ 基础伤害*(1+攻击*0.1%)*[1-(基础护甲/200+防御*0.03%)] }*(1+道具攻击加成)*炸弹威力*连击系数
            // double damage = (baseDamage * ( 1 + attack * 0.001) * (1 - (baseGuard / 200 + defence * 0.003))) * (1 + damagePlus) * shootMinus ;

            double DR1 = 0.95 * (target.BaseGuard - 3 * m_owner.Grade) / (500 + target.BaseGuard - 3 * m_owner.Grade);//护甲提供伤害减免
            double DR2 = 0;
            if ((target.Defence - m_owner.Lucky) < 0)
            {
                DR2 = 0;
            }
            else
            {

                DR2 = 0.95 * (target.Defence - m_owner.Lucky) / (600 + target.Defence - m_owner.Lucky); //防御提供的伤害减免
            }
            //DR2 = DR2 < 0 ? 0 : DR2;

            double damage = (baseDamage * (1 + attack * 0.001) * (1 - (DR1 + DR2 - DR1 * DR2))) * damagePlus * shootMinus;

            Point p = new Point(X, Y);
            double distance = target.Distance(p);
            if (distance < m_radius)
            {
                damage = damage * (1 - distance / m_radius / 4);
                if (damage < 0)
                {
                    return 1;
                }
            }
            else
            {
                return 0;
            }
            return (int)damage;
        }