Ejemplo n.º 1
0
        public override bool TakeDamage(Living source, ref int damageAmount, ref int criticalAmount, int type, int delay)
        {
            bool result = false;
            bool result2;

            if (this.Blood > 0)
            {
                if (type == 0)
                {
                    this.OnBeforeTakedDamage(source, ref damageAmount, ref criticalAmount, delay);
                    this.StartAttacked();
                }
                WorldBossMgr.TakeDamage(damageAmount + criticalAmount, Game.FindRandomPlayer().PlayerDetail.GamePlayerId);
                if (this.m_syncAtTime)
                {
                    {
                        this.m_game.SendGameUpdateHealth(this, 1, damageAmount + criticalAmount);
                    }
                }
                this.OnAfterTakedDamage(source, damageAmount, criticalAmount, delay);
                if (this.Blood <= 0)
                {
                    this.Die();
                }
                source.OnAfterKillingLiving(this, damageAmount, criticalAmount, delay);
                result = true;
            }
            else
            {
                this.Die();
            }
            result2 = result;
            return(result2);
        }
Ejemplo n.º 2
0
        public virtual bool TakeDamage(Living source, ref int damageAmount, ref int criticalAmount, int type, int delay)
        {
            bool result = false;
            bool result2;

            if (!this.IsFrost && this.m_blood > 0)
            {
                if (this.m_game is PVEGame)
                {
                    if (!((PVEGame)this.m_game).CanCampAttack(source, this))
                    {
                        result2 = false;
                        return(result2);
                    }
                }
                if (type == 0)
                {
                    this.OnBeforeTakedDamage(source, ref damageAmount, ref criticalAmount, delay);
                    this.StartAttacked();
                }
                this.m_blood -= damageAmount + criticalAmount;
                if (source.WillIceForonze && source.IsLiving)
                {
                    this.BeginNextTurn = (LivingEventHandle)Delegate.Combine(this.BeginNextTurn, new LivingEventHandle(this.SetIceFronze));
                }
                if (this.m_syncAtTime)
                {
                    if (this is SimpleBoss && (((SimpleBoss)this).NpcInfo.ID == 1207 || ((SimpleBoss)this).NpcInfo.ID == 1307))
                    {
                        this.m_game.SendGameUpdateHealth(this, 6, damageAmount + criticalAmount);
                    }
                    else
                    {
                        this.m_game.SendGameUpdateHealth(this, 1, damageAmount + criticalAmount);
                    }
                }
                this.OnAfterTakedDamage(source, damageAmount, criticalAmount, delay);
                if (this.m_blood <= 0)
                {
                    this.Die();
                }
                source.OnAfterKillingLiving(this, damageAmount, criticalAmount, delay);
                result = true;
            }
            this.EffectList.StopEffect(typeof(IceFronzeEffect));
            this.EffectList.StopEffect(typeof(HideEffect));
            this.EffectList.StopEffect(typeof(NoHoleEffect));
            result2 = result;
            return(result2);
        }
Ejemplo n.º 3
0
        private void BombImp()
        {
            List <Living> playersAround = m_map.FindHitByHitPiont(GetCollidePoint(), m_radius);

            foreach (Living p in playersAround)
            {
                if (p.IsNoHole || p.NoHoleTurn)
                {
                    p.NoHoleTurn = true;
                    digMap       = false;
                }
                p.SyncAtTime = false;
            }
            m_owner.SyncAtTime = false;
            try
            {
                //TrieuLSL DIG DIG DIG
                if (digMap)
                {
                    m_map.Dig(m_x, m_y, m_shape, null);
                }
                m_actions.Add(new BombAction(m_lifeTime, ActionType.BOMB, m_x, m_y, digMap ? 1 : 0, 0));

                switch (m_type)
                {
                case BombType.FORZEN:
                    foreach (Living p in playersAround)
                    {
                        if (m_owner is SimpleBoss && new IceFronzeEffect(100).Start(p))
                        {
                            m_actions.Add(new BombAction(m_lifeTime, ActionType.FORZEN, p.Id, 0, 0, 0));
                        }
                        else
                        {
                            if (new IceFronzeEffect(2).Start(p))
                            {
                                m_actions.Add(new BombAction(m_lifeTime, ActionType.FORZEN, p.Id, 0, 0, 0));
                            }
                            else
                            {
                                m_actions.Add(new BombAction(m_lifeTime, ActionType.FORZEN, -1, 0, 0, 0));
                                m_actions.Add(new BombAction(m_lifeTime, ActionType.UNANGLE, p.Id, 0, 0, 0));
                            }
                        }
                    }
                    break;

                case BombType.TRANFORM:
                    //炸弹的飞行时间必须超过1
                    if (m_y > 10 && m_lifeTime > 0.04f)
                    {
                        //炸弹最后的落脚地点必须为空,否则向后退5像素
                        if (m_map.IsEmpty(m_x, m_y) == false)
                        {
                            PointF v = new PointF(-vX, -vY);
                            v    = v.Normalize(5);
                            m_x -= (int)v.X;
                            m_y -= (int)v.Y;
                        }
                        m_owner.SetXY(m_x, m_y);
                        m_owner.StartMoving();
                        m_actions.Add(new BombAction(m_lifeTime, ActionType.TRANSLATE, m_x, m_y, 0, 0));
                        m_actions.Add(new BombAction(m_lifeTime, ActionType.START_MOVE, m_owner.Id, m_owner.X, m_owner.Y, m_owner.IsLiving ? 1 : 0));
                    }
                    break;

                case BombType.CURE:
                    foreach (Living p in playersAround)
                    {
                        double plus = 0;
                        if (playersAround.Count > 1)
                        {
                            plus = 0.4;
                        }
                        else
                        {
                            plus = 1;
                        }
                        int blood = (int)(((Player)m_owner).PlayerDetail.SecondWeapon.Template.Property7 * Math.Pow(1.1, ((Player)m_owner).PlayerDetail.SecondWeapon.StrengthenLevel) * plus);
                        p.AddBlood(blood);
                        if (p is Player)
                        {
                            ((Player)p).TotalCure += blood;
                        }
                        m_actions.Add(new BombAction(m_lifeTime, ActionType.CURE, p.Id, p.Blood, blood, 0));
                        //Console.WriteLine("治疗{0},血量{1}", blood, p.Blood);
                    }
                    break;

                default:
                    foreach (Living p in playersAround)
                    {
                        //Console.WriteLine("炸弹ID{0}", m_info.Name);
                        //判断npc之间的阵营
                        if (m_owner.IsFriendly(p) == true)
                        {
                            continue;
                        }

                        int damage   = MakeDamage(p);
                        int critical = 0;
                        if (damage != 0)
                        {
                            critical = MakeCriticalDamage(p, damage);    //暴击
                            m_owner.OnTakedDamage(m_owner, ref damage, ref damage);
                            if (p.TakeDamage(m_owner, ref damage, ref critical, "爆炸"))
                            {
                                m_actions.Add(new BombAction(m_lifeTime, ActionType.KILL_PLAYER, p.Id, damage + critical, critical != 0 ? 2 : 1, p.Blood));
                            }
                            else
                            {
                                m_actions.Add(new BombAction(m_lifeTime, ActionType.UNFORZEN, p.Id, 0, 0, 0));
                            }

                            if (p is Player)
                            {
                                m_actions.Add(new BombAction(m_lifeTime, ActionType.DANDER, p.Id, ((Player)p).Dander, 0, 0));
                                //(p as Player).StartMoving();//((int)((m_lifeTime + 1) * 1000), 12);
                            }
                            if (p is SimpleBoss)
                            {
                                ((PVEGame)m_game).OnShooted();
                            }
                        }
                        else if (p is SimpleBoss)
                        {
                            m_actions.Add(new BombAction(m_lifeTime, ActionType.PLAYMOVIE, p.Id, 0, 0, 2));
                        }
                        m_owner.OnAfterKillingLiving(p, damage, critical);

                        if (p.IsLiving)
                        {
                            // Console.WriteLine("爆炸之前Y:{0}", p.Y);

                            p.StartMoving((int)((m_lifeTime + 1) * 1000), 12);
                            //  Console.WriteLine("爆炸之后Y:{0}", p.Y);
                            Console.WriteLine("爆炸还活着?" + p.IsLiving.ToString());
                            m_actions.Add(new BombAction(m_lifeTime, ActionType.START_MOVE, p.Id, p.X, p.Y, p.IsLiving ? 1 : 0));
                        }
                    }
                    break;
                }
                this.Die();
            }
            finally
            {
                m_owner.SyncAtTime = true;
                foreach (Living p in playersAround)
                {
                    p.SyncAtTime = true;
                }
            }
        }
Ejemplo n.º 4
0
        private void BombImp()
        {
            List <Living> list = this.m_map.FindHitByHitPiont(this.GetCollidePoint(), this.m_radius);

            foreach (Living current in list)
            {
                if (current.IsNoHole || current.NoHoleTurn)
                {
                    current.NoHoleTurn = true;
                    this.digMap        = false;
                }
                current.SyncAtTime = false;
            }
            this.m_owner.SyncAtTime = false;
            try
            {
                if (this.digMap)
                {
                    this.m_map.Dig(this.m_x, this.m_y, this.m_shape, null);
                }
                this.m_actions.Add(new BombAction(this.m_lifeTime, ActionType.BOMB, this.m_x, this.m_y, this.digMap ? 1 : 0, 0));
                switch (this.m_type)
                {
                case BombType.FORZEN:
                    using (List <Living> .Enumerator enumerator2 = list.GetEnumerator())
                    {
                        while (enumerator2.MoveNext())
                        {
                            Living current2 = enumerator2.Current;
                            if (this.m_owner is SimpleBoss && new IceFronzeEffect(100).Start(current2))
                            {
                                this.m_actions.Add(new BombAction(this.m_lifeTime, ActionType.FORZEN, current2.Id, 0, 0, 0));
                            }

                            if (current2 is NormalBoss && new IceFronzeEffect(2).Start(current2))
                            {
                                current2.PlayMovie("cryB", 1000, 0);
                            }
                            if (current2 is NormalNpc && m_map.Info.ID == 1154)
                            {
                                if (IsEixt == 0 && current2.IsFrost == true)
                                {
                                    current2.PlayMovie("standC", 1500, 0);
                                    IsEixt = 2;
                                }

                                if (IsEixt == 0)
                                {
                                    current2.PlayMovie("standB", 1500, 0);
                                    current2.IsFrost = true;
                                }
                            }
                            if (current2 is SimpleNpc && m_map.Info.ID == 1153)
                            {
                                current2.PlayMovie("cry", 2000, 1000);
                                current2.Die(3500);
                            }
                            else
                            {
                                if (new IceFronzeEffect(2).Start(current2))
                                {
                                    this.m_actions.Add(new BombAction(this.m_lifeTime, ActionType.FORZEN, current2.Id, 0, 0, 0));
                                }
                                else
                                {
                                    this.m_actions.Add(new BombAction(this.m_lifeTime, ActionType.FORZEN, -1, 0, 0, 0));
                                    this.m_actions.Add(new BombAction(this.m_lifeTime, ActionType.UNANGLE, current2.Id, 0, 0, 0));
                                }
                            }
                        }
                        goto IL_752;
                    }
                    break;

                case BombType.TRANFORM:
                    break;

                case BombType.CURE:
                    using (List <Living> .Enumerator enumerator3 = list.GetEnumerator())
                    {
                        while (enumerator3.MoveNext())
                        {
                            Living current3 = enumerator3.Current;
                            double num;
                            if (this.m_map.FindPlayers(this.GetCollidePoint(), this.m_radius))
                            {
                                num = 0.4;
                            }
                            else
                            {
                                num = 1.0;
                            }
                            int num2 = (int)((double)((Player)this.m_owner).PlayerDetail.SecondWeapon.Template.Property7 * Math.Pow(1.1, (double)((Player)this.m_owner).PlayerDetail.SecondWeapon.StrengthenLevel) * num);
                            if (current3 is Player)
                            {
                                current3.AddBlood(num2);
                                ((Player)current3).TotalCure += num2;
                                this.m_actions.Add(new BombAction(this.m_lifeTime, ActionType.CURE, current3.Id, current3.Blood, num2, 0));
                            }
                            if (current3 is SimpleNpc && !current3.NoTakeDamage)
                            {
                                current3.AddBlood(num2);
                                ((SimpleNpc)current3).TotalCure += num2;
                                this.m_actions.Add(new BombAction(this.m_lifeTime, ActionType.CURE, current3.Id, current3.Blood, num2, 0));
                            }

                            if (current3 is NormalNpc)    //MrPhuong
                            {
                                current3.AddBlood(num2);
                                ((NormalNpc)current3).TotalCure += num2;
                                m_actions.Add(new BombAction(m_lifeTime, ActionType.CURE, current3.Id, current3.Blood, num2, 0));
                            }
                            if (current3 is NormalBoss)    //MrPhuong
                            {
                                current3.AddBlood(num2);
                                ((NormalBoss)current3).TotalCure += num2;
                                m_actions.Add(new BombAction(m_lifeTime, ActionType.CURE, current3.Id, current3.Blood, num2, 0));
                            }
                        }
                        goto IL_752;
                    }
                    goto IL_44C;

                default:
                    goto IL_44C;
                }
                if (this.m_y > 10 && this.m_lifeTime > 0.04f)
                {
                    if (!this.m_map.IsEmpty(this.m_x, this.m_y))
                    {
                        PointF point = new PointF(-base.vX, -base.vY);
                        point     = point.Normalize(5f);
                        this.m_x -= (int)point.X;
                        this.m_y -= (int)point.Y;
                    }
                    this.m_owner.SetXY(this.m_x, this.m_y);
                    this.m_owner.StartMoving();
                    this.m_actions.Add(new BombAction(this.m_lifeTime, ActionType.TRANSLATE, this.m_x, this.m_y, 0, 0));
                    this.m_actions.Add(new BombAction(this.m_lifeTime, ActionType.START_MOVE, this.m_owner.Id, this.m_owner.X, this.m_owner.Y, this.m_owner.IsLiving ? 1 : 0));
                    goto IL_752;
                }
                goto IL_752;
IL_44C:
                foreach (Living current4 in list)
                {
                    if (!this.m_owner.IsFriendly(current4))
                    {
                        int num3 = this.MakeDamage(current4);
                        int num4 = 0;
                        if (num3 != 0)
                        {
                            num4 = this.MakeCriticalDamage(current4, num3);
                            this.m_owner.OnTakedDamage(this.m_owner, ref num3, ref num3);
                            if (current4.TakeDamage(this.m_owner, ref num3, ref num4, "Fire") && m_map.Info.ID != 1151)
                            {
                                this.m_actions.Add(new BombAction(this.m_lifeTime, ActionType.KILL_PLAYER, current4.Id, num3 + num4, (num4 != 0) ? 2 : 1, current4.Blood));
                            }
                            if (m_map.Info.ID == 1151)
                            {
                                m_actions.Add(new BombAction(m_lifeTime, ActionType.PETSHOOT, current4.Id, num3 + num4, (num4 != 0) ? 2 : 1, current4.Blood));
                                current4.PlayMovie("cryA", (int)((m_lifeTime + 1f) * 1000f), 0);
                            }
                            else
                            {
                                this.m_actions.Add(new BombAction(this.m_lifeTime, ActionType.UNFORZEN, current4.Id, 0, 0, 0));
                            }
                            if (current4 is Player)
                            {
                                this.m_actions.Add(new BombAction(this.m_lifeTime, ActionType.DANDER, current4.Id, ((Player)current4).Dander, 0, 0));
                            }
                            if (current4 is SimpleBoss)
                            {
                                ((PVEGame)this.m_game).OnShooted();
                            }
                        }
                        else
                        {
                            if (current4 is SimpleBoss)
                            {
                                this.m_actions.Add(new BombAction(this.m_lifeTime, ActionType.PLAYMOVIE, current4.Id, 0, 0, 2));
                            }
                        }
                        m_owner.OnAfterKillingLiving(current4, num3, num4);
                        if (current4.IsLiving)
                        {
                            current4.StartMoving((int)((m_lifeTime + 1f) * 1000f), 12);
                            m_actions.Add(new BombAction(m_lifeTime, ActionType.START_MOVE, current4.Id, current4.X, current4.Y, current4.IsLiving ? 1 : 0));
                        }
                    }
                }
                if (this.m_owner.isPet && this.m_owner.activePetHit)
                {
                    list = this.m_map.FindHitByHitPiont(this.GetCollidePoint(), this.m_petRadius);
                    foreach (Living current5 in list)
                    {
                        int num5 = 0;
                        int num6 = 0;
                        if (current5 != this.m_owner)
                        {
                            num5 = this.MakePetDamage(current5) * this.m_owner.PetBaseAtt / 100;
                            num6 = this.MakeCriticalDamage(current5, num5);
                            if (current5.PetTakeDamage(this.m_owner, ref num5, ref num6, "PetFire"))
                            {
                                if (current5 is Player)
                                {
                                    this.m_petActions.Add(new BombAction(this.m_lifeTime, ActionType.PETSHOOT, current5.Id, num5 + num6, ((Player)current5).Dander, current5.Blood));
                                }
                                else
                                {
                                    this.m_petActions.Add(new BombAction(this.m_lifeTime, ActionType.PETSHOOT, current5.Id, num5 + num6, 1, current5.Blood));
                                }
                            }
                        }
                    }
                    this.m_owner.activePetHit = false;
                }
IL_752:
                this.Die();
            }
            finally
            {
                this.m_owner.SyncAtTime = true;
                foreach (Living current6 in list)
                {
                    current6.SyncAtTime = true;
                }
            }
        }