示例#1
0
        /// <summary>
        /// BUFF改变角色身上颜色的接口
        /// </summary>
        public void UpdateVO_ColorByBuff()
        {
            if (m_buffList == null || m_vCreature == null)
            {
                return;
            }

            bool  hasColor = false;
            Color color    = Color.white;

            // 获取有颜色的BUFF,取最新的
            for (int i = 0; i < m_buffList.Count; i++)
            {
                BuffBase buff = m_buffList[i];
                if (buff.m_buffData.hasColor)
                {
                    hasColor = true;
                    color    = buff.m_buffData.hitColor;
                }
            }

            if (hasColor)
            {
                m_vCreature.GetEnt().SetShader(eShaderType.eRim, color / 255);
                //m_vCreature.GetEnt().SetColor(color / 255);
            }
            else
            {
                m_vCreature.GetEnt().RemoveShader();
                //m_vCreature.GetEnt().RestoreColor();
            }
        }
示例#2
0
文件: BuffBase.cs 项目: mengtest/fs
        private void UpdateBuff(CCreature rec)
        {
            BuffBase buff = rec.GetStateBuff(eBuffState.sleep);

            if (buff != null)
            {
                CBuffMgr.Destroy(buff.m_uid);
            }
        }
示例#3
0
文件: CBuffMgr.cs 项目: mengtest/fs
        /// <summary>
        /// 同步移除
        /// 需要外部调用清除的BUFF,比如BUFF消失时间未到,但是人物已经死亡时
        /// </summary>
        /// <param name="uid"></param>
        public static void Destroy(long uid)
        {
            BuffBase buff = Get(uid);

            if (buff != null)
            {
                buff.Destroy();
                Remove(uid);
            }
        }
示例#4
0
 public void Destoty()
 {
     for (int i = 0; i < m_buffList.Count; i++)
     {
         BuffBase buff = m_buffList[i];
         if (buff != null)
         {
             buff.Destroy();
         }
     }
 }
示例#5
0
 public void OnCreateHitBuff(CCreature foeCc)
 {
     for (int i = 0; i < m_buffList.Count; i++)
     {
         BuffBase buff = m_buffList[i];
         if (buff.GetBuffType() == eBuffType.hitCreate)
         {
             ((Buff12)buff).CreateBuff(foeCc);
         }
     }
 }
示例#6
0
 /// <summary>
 /// 通过状态BUFF的类型获取当前BUFF对象
 /// </summary>
 public BuffBase GetStateBuff(eBuffState type)
 {
     for (int i = 0; i < m_buffList.Count; i++)
     {
         BuffBase buff = m_buffList[i];
         if (buff.IsStateBuff() && buff.GetVal1() == (int)type)
         {
             return(buff);
         }
     }
     return(null);
 }
示例#7
0
        public void RemoveBuff(BuffBase buffUid)
        {
            if (m_buffList == null || !m_buffList.Contains(buffUid))
            {
                return;
            }
            m_buffList.Remove(buffUid);

            UpdateUI_Buff();
            if (buffUid.m_buffData.hasColor)
            {
                UpdateVO_ColorByBuff();
            }
        }
示例#8
0
        public void AddBuff(BuffBase buffUid)
        {
            if (m_buffList.Contains(buffUid))
            {
                return;
            }
            m_buffList.Add(buffUid);

            UpdateUI_Buff();
            if (buffUid.m_buffData.hasColor)
            {
                UpdateVO_ColorByBuff();
            }
        }
示例#9
0
 /// <summary>
 /// 死亡时移除的BUFF
 /// </summary>
 public void ClearBuff()
 {
     if (m_buffList != null)
     {
         // 倒序,可以避免在遍历中玩家移除了BUFF导致的元素丢失问题
         for (int i = m_buffList.Count - 1; i >= 0; i--)
         {
             BuffBase buff = m_buffList[i];
             if (buff.m_dieDestroy)
             {
                 buff.Destroy();
             }
         }
     }
 }
示例#10
0
 /// <summary>
 /// 包含状态类BUFF
 /// </summary>
 public bool bStateBuff(eBuffState type)
 {
     if (m_buffList == null)
     {
         return(false);
     }
     for (int i = 0; i < m_buffList.Count; i++)
     {
         BuffBase buff = m_buffList[i];
         if (buff.IsStateBuff() && buff.GetVal1() == (int)type)
         {
             return(true);
         }
     }
     return(false);
 }
示例#11
0
 private void GetBuff()
 {
     if (m_curBuff != null)
     {
         return;
     }
     m_curBuff = new List <BuffBase>();
     int[] selfBuffList = GetSkillData().casterSelfBuffList;
     for (int i = 0; i < selfBuffList.Length; i++)
     {
         BuffBase buff = GetCaster().GetBuffByCsvId(selfBuffList[i]);
         if (buff != null /*&& buff.GetBuffType() == eBuffType.createTrigger*/)
         {
             // 如果是触发器BUFF,则传递技能指令信息
             m_curBuff.Add(buff);
         }
     }
 }
示例#12
0
        /// <summary>
        /// 通过BUFF的攻击增减
        /// </summary>
        public FixedPoint GetBuffSpeed(FixedPoint cur)
        {
            if (m_buffList == null)
            {
                return(FixedPoint.N_0);
            }
            FixedPoint newVal = FixedPoint.N_0;

            for (int i = 0; i < m_buffList.Count; i++)
            {
                BuffBase buff = m_buffList[i];
                if (buff.GetBuffType() == eBuffType.speed)
                {
                    FixedPoint pct = buff.GetVal1() * new FixedPoint(0.01f);
                    newVal += cur * pct;
                }
            }
            return(newVal);
        }
示例#13
0
        /// <summary>
        /// 通过BUFF的攻击增减
        /// </summary>
        public int GetBuffAp(int cur)
        {
            if (m_buffList == null)
            {
                return(0);
            }
            int newVal = 0;

            for (int i = 0; i < m_buffList.Count; i++)
            {
                BuffBase buff = m_buffList[i];
                if (buff.GetBuffType() == eBuffType.atk)
                {
                    FixedPoint pct = buff.GetVal1() * new FixedPoint(0.01f);
                    newVal += (int)(cur * pct).value;
                }
            }
            return(newVal);
        }
示例#14
0
        /// <summary>
        /// 命中目标时,释放的技能包含击中BUFF,则触发
        /// </summary>
        public void OnCreateAtkBuff(int skillIndex, CCreature foeCc)
        {
            if (m_buffList == null || skillIndex == -1)
            {
                return;
            }

            for (int i = 0; i < m_buffList.Count; i++)
            {
                BuffBase buff = m_buffList[i];
                // 施法者身上包含命中BUFF,并且刚好是当前技能所包含的BUFF,则触发
                if (buff.GetBuffType() == eBuffType.atkCreate)
                {
                    if (m_dicSkill[skillIndex].m_skillDataInfo.ContainAtkBuff(buff.m_buffData.id))
                    {
                        ((Buff11)buff).CreateBuff(foeCc);
                    }
                }
            }
        }
示例#15
0
文件: CBuffMgr.cs 项目: mengtest/fs
 public static void Add(long uid, BuffBase creature)
 {
     m_dicSkill[uid] = creature;
 }
示例#16
0
        public CSkillInfo(CCreature creature, int index, int skillId, int lv, bool subSkill = false, CSkillInfo mainSkill = null)
        {
            m_creature   = creature;
            m_skillId    = skillId;
            m_skillIndex = index;
            SkillCsv skill = CsvManager.Inst.GetCsv <SkillCsv>((int)eAllCSV.eAC_Skill);

            m_skillInfo = skill.GetData(skillId);
            m_skillLv   = lv;

            int skillDataId = skill.GetSkillDataIdByLv(skillId, lv);

            SkillDataCsv dataCsv = CsvManager.Inst.GetCsv <SkillDataCsv>((int)eAllCSV.eAC_SkillData);

            m_skillDataInfo = dataCsv.GetData(skillDataId);
            if (m_skillDataInfo == null)
            {
                return;
            }
            if (GetCDType() == (int)eSkillCdType.Time)
            {
                m_curCdTime = m_skillDataInfo.cd;
            }
            // 技能附加击中BUFF
            for (int i = 0; i < m_skillDataInfo.atkBuffList.Length; i++)
            {
                if (m_skillDataInfo.atkBuffList[i] == 0)
                {
                    continue;
                }
                BuffBase buff = SkillBase.AddBuff(m_creature, m_creature, m_skillDataInfo.atkBuffList[i], Vector2d.zero, Vector2d.zero, Vector2d.zero, index);
                if (buff != null)
                {
                    buff.m_dieDestroy = false;
                    m_buffList.Add(buff);
                }
            }
            // 技能附加受击BUFF
            for (int i = 0; i < m_skillDataInfo.hitBuffList.Length; i++)
            {
                if (m_skillDataInfo.hitBuffList[i] == 0)
                {
                    continue;
                }
                BuffBase buff = SkillBase.AddBuff(m_creature, m_creature, m_skillDataInfo.hitBuffList[i], Vector2d.zero, Vector2d.zero, Vector2d.zero, index);
                if (buff != null)
                {
                    buff.m_dieDestroy = false;
                    m_buffList.Add(buff);
                }
            }

            #region 包含子技能的部分
            m_mainSkill = mainSkill;
            if (subSkill)
            {
                return;
            }
            if (m_skillInfo.subSkill != null &&
                m_skillInfo.subSkill.Length > 0 &&
                m_skillInfo.subSkill[0] != 0)
            {
                m_bCondiSubSkill = true;
                m_nearCommon     = new CSkillInfo[m_skillInfo.subSkill.Length];
                for (int i = 0; i < m_skillInfo.subSkill.Length; i++)
                {
                    int        sSkillId = m_skillInfo.subSkill[i];
                    CSkillInfo info     = new CSkillInfo(m_creature, index, sSkillId, 1, true, this);
                    m_nearCommon[i] = info;
                }
            }
            #endregion
        }
示例#17
0
文件: SkillBase.cs 项目: mengtest/fs
        public static BuffBase AddBuff(CCreature caster, CCreature receiver, int buffId, Vector2d startPos, Vector2d skillPos, Vector2d dir, int skillIndex = 0, object obj = null)
        {
            // 接受者无敌时
            if (receiver != null)
            {
                if (receiver.IsDie() || receiver.CheckState(eBuffState.WindBlowsUp))
                {
                    return(null);
                }
                if (caster != receiver && receiver.CheckState(eBuffState.God))
                {
                    return(null);
                }
            }

            // 非瞬间伤害的其他所有BUFF,如果是持续的,并且buffid相同时,重置生命时间
            SkillBuffCsvData buffData = CsvManager.Inst.GetCsv <SkillBuffCsv>((int)eAllCSV.eAC_SkillBuff).GetData(buffId);

            if (buffData == null)
            {
                Debug.LogError("无buffid,策划检测检查配置表:" + buffId);
                return(null);
            }

            // 状态BUFF的处理
            // 接受者霸体时,不再添加其他状态BUFF
            if (receiver != null && receiver.CheckState(eBuffState.SuperArmor))
            {
                if (buffData.logicId == (int)eBuffType.state ||
                    buffData.logicId == (int)eBuffType.repel ||
                    buffData.logicId == (int)eBuffType.pullPos
                    )
                {
                    return(null);
                }
            }

            // 相同BUFF的叠加处理
            if (buffData.IsCont &&
                receiver != null &&
                buffData.logicId != (int)eBuffType.damage)
            {
                BuffBase stateBuff = receiver.GetBuffByCsvId(buffId);
                // 1.相同BUFFID
                // 2.相同施法者
                // 3.相同施法者,相同触发器(暂无)
                if (stateBuff != null && stateBuff.m_caster == caster)
                {
                    //Debug.Log("有相同buff。。。" + buffId);
                    // 相同施法者的持续性BUFF,内部可以计算叠加次数和伤害
                    stateBuff.ResetTime();
                    return(stateBuff);
                }
            }

            BuffBase buff = CBuffMgr.Create(buffId);

            //Debug.Log("技能流程:创建BUFF:" + buffId + " " + buff.m_buffData.name + " 类型:" + (eBuffType)buff.m_buffData.logicId);
            if (buff == null)
            {
                Debug.LogError("添加BUFF为空:" + buffId);
                return(null);
            }

            // 最终的接收者,由配表决定
            if (buff.m_buffData.targetType == 0)
            {
            }
            else if (buff.m_buffData.targetType == 1)
            {
                receiver = caster;
            }

            buff.m_caster = caster;
            buff.m_rec    = receiver;

            buff.m_startPos    = startPos;
            buff.m_skillIndex  = skillIndex;
            buff.m_skillPos    = skillPos;
            buff.m_skillDir    = dir;
            buff.m_extendParam = obj;
            // 持续性的才加到人物身上,当角色挂掉时,要清除身上的BUFF
            if (buff.IsCont() && receiver != null)
            {
                // 因为BUFF改变的速度,攻击力等都是在初始化时,遍历BUFF增减数值,所以要先add
                receiver.AddBuff(buff);
                buff.Init();
            }
            else
            {
                buff.Init();
                buff.Destroy();
            }
            return(buff);
        }
示例#18
0
文件: CBuffMgr.cs 项目: mengtest/fs
        /// <summary>
        ///
        /// </summary>
        /// <param name="buffId"></param>
        /// <returns></returns>
        public static BuffBase Create(int buffId)
        {
            SkillBuffCsvData buffData = CsvManager.Inst.GetCsv <SkillBuffCsv>((int)eAllCSV.eAC_SkillBuff).GetData(buffId);

            if (buffData == null)
            {
                Debug.LogError("BUFF为空 id:" + buffId);
                return(null);
            }
            if (buffData.logicId == 0)
            {
                Debug.LogError("BUFF配置错误 id:" + buffId + "  类型:" + buffData.logicId);
                return(null);
            }
            BuffBase obj = null;

            switch (buffData.logicId)
            {
            case (int)eBuffType.damage:
                obj = new Buff01(m_uid, buffData);
                break;

            case (int)eBuffType.contDamage:
                obj = new Buff02(m_uid, buffData);
                break;

            case (int)eBuffType.pullPos:
                obj = new Buff03(m_uid, buffData);
                break;

            case (int)eBuffType.atk:
                obj = new Buff04(m_uid, buffData);
                break;

            case (int)eBuffType.speed:
                obj = new Buff05(m_uid, buffData);
                break;

            case (int)eBuffType.repel:
                obj = new Buff06(m_uid, buffData);
                break;

            case (int)eBuffType.addHp:
                obj = new Buff07(m_uid, buffData);
                break;

            case (int)eBuffType.dp:
                obj = new Buff08(m_uid, buffData);
                break;

            case (int)eBuffType.modelScale:
                obj = new Buff09(m_uid, buffData);
                break;

            case (int)eBuffType.state:
                obj = new Buff10(m_uid, buffData);
                break;

            case (int)eBuffType.atkCreate:
                obj = new Buff11(m_uid, buffData);
                break;

            case (int)eBuffType.hitCreate:
                obj = new Buff12(m_uid, buffData);
                break;

            case (int)eBuffType.createTrigger:
                obj = new Buff20(m_uid, buffData);
                break;

            case (int)eBuffType.createSkill:
                obj = new Buff21(m_uid, buffData);
                break;

            case (int)eBuffType.createCreature:
                obj = new Buff22(m_uid, buffData);
                break;

            case (int)eBuffType.flash:
                obj = new Buff101(m_uid, buffData);
                break;
            }
            m_uid++;
            //Add(m_uid++, obj);
            m_listAdd.Add(obj);
            return(obj);
        }