Пример #1
0
 public void UpdateCurrentValues(int rank, int rankcap)
 {
     if (this.param == null || this.param.buffs == null || this.param.buffs.Length == 0)
     {
         this.Clear();
     }
     else
     {
         int length = this.param.buffs.Length;
         if (this.targets == null)
         {
             this.targets = new List <BuffEffect.BuffTarget>(length);
         }
         if (this.targets.Count > length)
         {
             this.targets.RemoveRange(length, this.targets.Count - length);
         }
         while (this.targets.Count < length)
         {
             this.targets.Add(new BuffEffect.BuffTarget());
         }
         for (int index = 0; index < length; ++index)
         {
             int valueIni  = (int)this.param.buffs[index].value_ini;
             int valueMax  = (int)this.param.buffs[index].value_max;
             int rankValue = this.GetRankValue(rank, rankcap, valueIni, valueMax);
             this.targets[index].value     = (OInt)rankValue;
             this.targets[index].value_one = this.param.buffs[index].value_one;
             this.targets[index].calcType  = this.param.buffs[index].calc;
             this.targets[index].paramType = this.param.buffs[index].type;
             this.targets[index].buffType  = !BuffEffectParam.IsNegativeValueIsBuff(this.param.buffs[index].type) ? (rankValue >= 0 ? BuffTypes.Buff : BuffTypes.Debuff) : (rankValue <= 0 ? BuffTypes.Buff : BuffTypes.Debuff);
         }
     }
 }
Пример #2
0
 public bool CheckBuffCalcType(BuffTypes buff, SkillParamCalcTypes calc, bool is_negative_value_is_buff)
 {
     for (int index = 0; index < this.targets.Count; ++index)
     {
         BuffEffect.BuffTarget target = this.targets[index];
         if (buff == target.buffType && calc == target.calcType && BuffEffectParam.IsNegativeValueIsBuff(target.paramType) == is_negative_value_is_buff)
         {
             return(true);
         }
     }
     return(false);
 }
Пример #3
0
        public void CalcBuffStatus(ref BaseStatus status, EElement element, BuffTypes buffType, bool is_check_negative_value, bool is_negative_value_is_buff, SkillParamCalcTypes calcType, int up_count = 0)
        {
            for (int index = 0; index < this.targets.Count; ++index)
            {
                BuffEffect.BuffTarget target = this.targets[index];
                if (target.buffType == buffType && (!is_check_negative_value || BuffEffectParam.IsNegativeValueIsBuff(target.paramType) == is_negative_value_is_buff) && target.calcType == calcType)
                {
                    if (element != EElement.None)
                    {
                        bool flag = false;
                        switch (target.paramType)
                        {
                        case ParamTypes.Assist_Fire:
                        case ParamTypes.UnitDefenseFire:
                            flag = element != EElement.Fire;
                            break;

                        case ParamTypes.Assist_Water:
                        case ParamTypes.UnitDefenseWater:
                            flag = element != EElement.Water;
                            break;

                        case ParamTypes.Assist_Wind:
                        case ParamTypes.UnitDefenseWind:
                            flag = element != EElement.Wind;
                            break;

                        case ParamTypes.Assist_Thunder:
                        case ParamTypes.UnitDefenseThunder:
                            flag = element != EElement.Thunder;
                            break;

                        case ParamTypes.Assist_Shine:
                        case ParamTypes.UnitDefenseShine:
                            flag = element != EElement.Shine;
                            break;

                        case ParamTypes.Assist_Dark:
                        case ParamTypes.UnitDefenseDark:
                            flag = element != EElement.Dark;
                            break;
                        }
                        if (flag)
                        {
                            continue;
                        }
                    }
                    BuffMethodTypes buffMethodType = this.GetBuffMethodType(target.buffType, calcType);
                    ParamTypes      paramType      = target.paramType;
                    int             val1           = (int)target.value;
                    if ((bool)this.param.mIsUpBuff)
                    {
                        val1 = (int)target.value_one * up_count;
                        if (val1 > 0)
                        {
                            val1 = Math.Min(val1, (int)target.value);
                        }
                        else if (val1 < 0)
                        {
                            val1 = Math.Max(val1, (int)target.value);
                        }
                    }
                    BuffEffect.SetBuffValues(paramType, buffMethodType, ref status, val1);
                }
            }
        }
Пример #4
0
        private void InternalBuffSkill(BuffEffect effect, EElement element, BuffTypes buffType, bool is_check_negative_value, bool is_negative_value_is_buff, SkillParamCalcTypes calcType, BaseStatus status, List <BuffEffect.BuffValues> list = null)
        {
            for (int index1 = 0; index1 < effect.targets.Count; ++index1)
            {
                BuffEffect.BuffTarget target = effect.targets[index1];
                if (target != null && target.buffType == buffType && (!is_check_negative_value || BuffEffectParam.IsNegativeValueIsBuff(target.paramType) == is_negative_value_is_buff) && target.calcType == calcType)
                {
                    if (element != EElement.None)
                    {
                        bool flag = false;
                        switch (target.paramType)
                        {
                        case ParamTypes.Assist_Fire:
                        case ParamTypes.UnitDefenseFire:
                            flag = element != EElement.Fire;
                            break;

                        case ParamTypes.Assist_Water:
                        case ParamTypes.UnitDefenseWater:
                            flag = element != EElement.Water;
                            break;

                        case ParamTypes.Assist_Wind:
                        case ParamTypes.UnitDefenseWind:
                            flag = element != EElement.Wind;
                            break;

                        case ParamTypes.Assist_Thunder:
                        case ParamTypes.UnitDefenseThunder:
                            flag = element != EElement.Thunder;
                            break;

                        case ParamTypes.Assist_Shine:
                        case ParamTypes.UnitDefenseShine:
                            flag = element != EElement.Shine;
                            break;

                        case ParamTypes.Assist_Dark:
                        case ParamTypes.UnitDefenseDark:
                            flag = element != EElement.Dark;
                            break;
                        }
                        if (flag)
                        {
                            continue;
                        }
                    }
                    BuffMethodTypes buffMethodType = this.GetBuffMethodType(target.buffType, calcType);
                    ParamTypes      paramType      = target.paramType;
                    int             num            = (int)target.value;
                    if ((bool)effect.param.mIsUpBuff)
                    {
                        num = 0;
                    }
                    if (list == null)
                    {
                        BuffEffect.SetBuffValues(paramType, buffMethodType, ref status, num);
                    }
                    else
                    {
                        bool flag = true;
                        for (int index2 = 0; index2 < list.Count; ++index2)
                        {
                            BuffEffect.BuffValues buffValues = list[index2];
                            if (buffValues.param_type == paramType && buffValues.method_type == buffMethodType)
                            {
                                buffValues.value += num;
                                list[index2]      = buffValues;
                                flag              = false;
                                break;
                            }
                        }
                        if (flag)
                        {
                            list.Add(new BuffEffect.BuffValues()
                            {
                                param_type  = paramType,
                                method_type = buffMethodType,
                                value       = num
                            });
                        }
                    }
                }
            }
        }