Beispiel #1
0
 public override void OnNpcDamage(ObjNPC npc, int damage, ObjBase enemy)
 {
     base.OnNpcDamage(npc, damage, enemy);
     if (npc.GetObjType() == ObjType.NPC)
     {
         DamageAddChicken(npc);
     }
 }
        public override void OnNpcDie(ObjNPC npc, ulong characterId = 0)
        {
            if (npc == null)
            {
                return;
            }
            base.OnNpcDie(npc, characterId);
            try
            {
                if (npc.GetObjType() != ObjType.NPC)
                {
                    return;
                }

                var killer = FindCharacter(characterId);
                if (killer == null)
                {
                    return;
                }

                var player = killer.GetRewardOwner() as ObjPlayer;
                if (null == player)
                {
                    return;
                }

                DeadNpcNum++;

                if (DeadNpcNum == startNum)
                {
                    DanageNpcNum = 0;
                    startTime    = DateTime.Now;
                    DoAction(player);
                }
            }
            catch (Exception)
            {
                Logger.Error("MaYaWeaponDungeon err on OnNpcDie");
            }
        }
Beispiel #3
0
        //public override void OnNpcDamage(ObjNPC obj, int damage, ObjBase enemy)
        //{
        //    base.OnNpcDamage(obj, damage, enemy);
        //    var hpNow = mBoss.Attr.GetDataValue(eAttributeType.HpNow);
        //    if (hpNow < BossMaxHp * 0.3)
        //        return;
        //    mBoss.Attr.SetDataValue(eAttributeType.HpNow, (int)(hpNow + BossMaxHp / 100 * MyRandom.Random(10, 30)));
        //}
        public override void OnNpcDie(ObjNPC npc, ulong characterId = 0)
        {
            base.OnNpcDie(npc, characterId);

            if (State != eDungeonState.Start)
            {
                return;
            }

            if (npc.GetObjType() == ObjType.NPC)
            {
                Running = false;
                SendLastDamageList();
                //结束公告
                PushActionToAllPlayer(
                    player => { player.Proxy.NotifyBattleReminder(14, Utils.WrapDictionaryId(220445), 0); });

                var result = new FubenResult();
                result.CompleteType = (int)eDungeonCompleteType.Success;
                CompleteToAll(result);
            }
        }
Beispiel #4
0
        public override void OnNpcDie(ObjNPC npc, ulong characterId = 0)
        {
            if (npc == null)
            {
                return;
            }
            base.OnNpcDie(npc, characterId);
            try
            {
                if (npc.GetObjType() != ObjType.NPC)
                {
                    return;
                }

                if (npc.mTypeId != 3014)
                {
                    return;
                }

                DeadNpcNum++;

                if (startNum + 1 == DeadNpcNum || DelBuffFailed)
                {
                    if ((DateTime.Now - startTime).TotalSeconds < timeDelta)
                    {
                        DelBuffFailed = true;
                        return;
                    }
                    DelBuffFailed = false;
                    // 解除buff
                    PushActionToAllObj(npc2 =>
                    {
                        var tempNpc = npc2 as ObjNPC;
                        if (tempNpc == null)
                        {
                            return;
                        }
                        if (!tempNpc.IsMonster())
                        {
                            return;
                        }


                        tempNpc.DeleteBuff(buffId, eCleanBuffType.EffectOver);
                    });
                    return;
                }

                var killer = FindCharacter(characterId);
                if (killer == null)
                {
                    return;
                }

                var player = killer.GetRewardOwner() as ObjPlayer;
                if (null == player)
                {
                    return;
                }

                if (DeadNpcNum == startNum)
                {
                    startTime = DateTime.Now;
                    LearnSkill(player);
                }
            }
            catch (Exception)
            {
                Logger.Error("XpSkillDungeon err on OnNpcDie");
            }
        }
        public override void OnNpcDamage(ObjNPC npc, int damage, ObjBase enemy)
        {
            if (npc == null)
            {
                return;
            }
            base.OnNpcDamage(npc, damage, enemy);
            try
            {
                if (npc.GetObjType() != ObjType.NPC)
                {
                    return;
                }

                var killer = FindCharacter(enemy.ObjId);
                if (killer == null)
                {
                    return;
                }

                var tmpNpc = killer as ObjNPC;
                if (tmpNpc != null)
                {
                    return;
                }


                var player = killer.GetRewardOwner() as ObjPlayer;
                if (null == player)
                {
                    return;
                }

                DanageNpcNum++;

                if ((DanageNpcNum > 0 && startNum <= DeadNpcNum) || DelBuffFailed)
                {
                    if (HasDeletedBuff)
                    {
                        return;
                    }
                    if ((DateTime.Now - startTime).TotalSeconds < timeDelta)
                    {
                        DelBuffFailed = true;
                        return;
                    }
                    DelBuffFailed = false;

                    player.Proxy.NotifyBattleReminder(26, Utils.WrapDictionaryId(589), 1);
                    // 给主角加buff
//                     var buff1 = -1;
//                     var buff2 = -1;
//                     if (player.GetRole()== 0) //战士
//                     {
//                         buff1 = 513;
//                         buff2 = 510;
//                     }
//                  else if (player.GetRole() == 1) //法师
//                     {
//                         buff1 = 514;
//                         buff2 = 511;
//                     }
//                  else if (player.GetRole() == 2) // 弓手
//                     {
//                         buff1 = 515;
//                         buff2 = 512;
//                     }
//
//                     if (buff1 == -1 || buff2 == -1)
//                     {
//                         return;
//                     }
//
//                     player.AddBuff(buff1, 1, player);
//                     player.AddBuff(buff2, 1, player);
                    // 解除buff
                    PushActionToAllObj(npc2 =>
                    {
                        var tempNpc = npc2 as ObjNPC;
                        if (tempNpc == null)
                        {
                            return;
                        }
                        if (!tempNpc.IsMonster())
                        {
                            return;
                        }

                        tempNpc.DeleteBuff(XuanYunBuffId, eCleanBuffType.EffectOver);
                    });

                    HasDeletedBuff = true;
                    return;
                }
            }
            catch (Exception)
            {
                Logger.Error("MaYaWeaponDungeon err on OnNpcDamage");
            }
        }