Пример #1
0
        public BuffData(int id)
        {
            var    dtBuff = GameEntry.DataTable.GetDataTable <DRBuff>();
            DRBuff drBuff = dtBuff.GetDataRow(id);

            if (drBuff == null)
            {
                Log.Error("Can no get DRBuff by id:{0}", id);
                return;
            }

            Name             = drBuff.Name;
            Icon             = drBuff.Icon;
            BuffType         = (BuffType)drBuff.BuffType;
            LifeTime         = drBuff.LifeTime;
            OverlayType      = (BuffOverlayType)drBuff.OverlayType;
            MaxOverlayNum    = drBuff.MaxOverlayNum;
            DestroyType      = (BuffDestroyType)drBuff.DestroyType;
            Result           = drBuff.Result;
            ResultAttrID     = drBuff.ResultAttrID;
            ResultInterval   = drBuff.ResultInterval;
            EffectID         = drBuff.EffectID;
            EffectBind       = drBuff.EffectBind;
            ChangeModelID    = drBuff.ChangeModelID;
            ChangeModelScale = drBuff.ChangeModelScale;
            Desc             = drBuff.Desc;
        }
Пример #2
0
        public void AddBuff(int id, ActorBase caster)
        {
            if (m_Owner.IsDead)
            {
                return;
            }

            DRBuff db = GameEntry.DataTable.GetDataTable <DRBuff>()?.GetDataRow(id);

            if (db == null)
            {
                return;
            }

            BuffBase commonBuff = FindBuff(id);

            if (commonBuff != null)
            {
                switch ((BuffOverlayType)commonBuff.Data.OverlayType)
                {
                case BuffOverlayType.Overlay:
                    commonBuff.Overlay();
                    break;

                case BuffOverlayType.Reset:
                    commonBuff.Refresh();
                    break;

                case BuffOverlayType.Cancle:
                    m_DelBuffList.Add(commonBuff.Id);
                    break;
                }
                return;
            }
            CommandReplyType reply = CommandReplyType.NO;

            switch ((BattleActType)db.Result)
            {
            case BattleActType.Addattr:
            case BattleActType.Subattr:
            case BattleActType.Lddattr:
            case BattleActType.Lubattr:
            {
                reply = CommandReplyType.YES;
            }
            break;

            case BattleActType.Super:
            {
                reply = CommandReplyType.YES;
            }
            break;

            case BattleActType.Variation:
            {
                reply = m_Owner.ExecuteCommand(new VariationCommand(db.LifeTime, db.ChangeModelID));
            }
            break;

            case BattleActType.Hitfly:
            {
                reply = m_Owner.ExecuteCommand(new BeatFlyCommand());
            }
            break;

            case BattleActType.Hitdown:
            {
                reply = m_Owner.ExecuteCommand(new BeatDownCommand());
            }
            break;

            case BattleActType.Hitback:
            {
                reply = m_Owner.ExecuteCommand(new BeatBackCommand());
            }
            break;

            case BattleActType.Stun:
            {
                reply = m_Owner.ExecuteCommand(new StunCommand(db.LifeTime));
            }
            break;

            case BattleActType.Fixbody:
            {
                reply = m_Owner.ExecuteCommand(new FixBodyCommand(db.LifeTime));
            }
            break;

            case BattleActType.Stealth:
            {
                reply = m_Owner.ExecuteCommand(new StealthCommand(db.LifeTime));
            }
            break;

            case BattleActType.Frozen:
            {
                reply = m_Owner.ExecuteCommand(new FrostCommand(db.LifeTime));
            }
            break;

            case BattleActType.Blind:
            {
                reply = m_Owner.ExecuteCommand(new BlindCommand(db.LifeTime));
            }
            break;

            case BattleActType.Silent:
            {
                reply = m_Owner.ExecuteCommand(new SilentCommand(db.LifeTime));
            }
            break;

            case BattleActType.Sleep:
            {
                reply = m_Owner.ExecuteCommand(new SleepCommand(db.LifeTime));
            }
            break;

            case BattleActType.Absorb:
            {
                reply = CommandReplyType.YES;
            }
            break;

            case BattleActType.Wild:
            {
                reply = CommandReplyType.YES;
            }
            break;

            case BattleActType.Divive:
            {
                RemoveAllDebuff();
                reply = CommandReplyType.YES;
            }
            break;

            case BattleActType.Paraly:
            {
                reply = CommandReplyType.YES;
            }
            break;

            case BattleActType.Fear:
            {
                reply = CommandReplyType.YES;
            }
            break;

            case BattleActType.Reflex:
            {
                reply = CommandReplyType.YES;
            }
            break;

            case BattleActType.Dead:
            {
                reply = CommandReplyType.YES;
            }
            break;
            }

            if (reply == CommandReplyType.YES)
            {
                BuffBase buff = new BuffBase(id, m_Owner, caster);
                m_BuffMap.Add(id, buff);
            }

            m_Owner.UpdateCurAttribute();
        }