Ejemplo n.º 1
0
 public void RemoveCalculateCurTargetProp(CharacterState cs, SkillBuff sBuff)
 {
     if (cs != null && CharBuffs.ContainsKey(cs) && CharBuffs[cs].Contains(sBuff))
     {
         float resultValue = 0;
         //查找和当前buff同类型的
         List <SkillBuff> mCurSkillBuff = CharBuffs[cs].FindAll(a => a != sBuff && a.node.type == sBuff.node.type && a.node.buffActionType == sBuff.node.buffActionType);
         //增益减益的不存在取当前值,存在取差值,其它的只有最后一个buff存在的值才为0
         if ((sBuff.node.type == BuffType.increase || sBuff.node.type == BuffType.decrease) && (SkillBuffType)sBuff.id != SkillBuffType.AbsorbDamage)
         {
             if (mCurSkillBuff.Count > 0)
             {
                 mCurSkillBuff.Sort((a, b) => Mathf.FloorToInt(b.baseValue - a.baseValue));
                 if (sBuff.baseValue > mCurSkillBuff[0].baseValue)
                 {
                     resultValue = sBuff.baseValue - mCurSkillBuff[0].baseValue;
                 }
             }
             else
             {
                 resultValue = sBuff.baseValue;
             }
         }
         else
         {
             resultValue = mCurSkillBuff.Count;
         }
         sBuff.Reverse(cs, resultValue);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 通过目标和buff类型判断添加buff之后造成的效果
 /// </summary>
 /// <param name="cs"></param>
 /// <param name="sBuff"></param>
 public void AddCalculateCurTargetProp(CharacterState cs, SkillBuff sBuff)
 {
     if (CharBuffs.ContainsKey(cs))
     {
         float            resultValue   = 0;
         List <SkillBuff> mCurSkillBuff = new List <SkillBuff>();
         //持续减益/增益类buff相互抵消
         if (sBuff.node.type == BuffType.continuousDecrease || sBuff.node.type == BuffType.continuousIncrease)
         {
             SkillBuff tempBuff = CharBuffs[cs].Find(a => a != sBuff && a.node.type == sBuff.node.type && a.skillNode.skill_id == sBuff.skillNode.skill_id);
             if (tempBuff != null)
             {
                 tempBuff.Reverse(cs, tempBuff.baseValue);
                 RemoveContinousSkillBuff(tempBuff);
             }
         }
         else
         {
             //查找和当前buff同类型的
             mCurSkillBuff = CharBuffs[cs].FindAll(a => a != sBuff && a.node.type == sBuff.node.type && a.node.buffActionType == sBuff.node.buffActionType);
         }
         //不存在取当前值,存在取差值
         if (mCurSkillBuff.Count > 0)
         {
             mCurSkillBuff.Sort((a, b) => Mathf.FloorToInt(b.baseValue - a.baseValue));
             if (sBuff.baseValue > mCurSkillBuff[0].baseValue)
             {
                 resultValue = sBuff.baseValue - mCurSkillBuff[0].baseValue;
             }
         }
         else
         {
             resultValue = sBuff.baseValue;
         }
         sBuff.Excute(cs, resultValue);
     }
 }