Ejemplo n.º 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);
         }
     }
 }
Ejemplo n.º 2
0
        private static void SetBuffValue(BuffMethodTypes type, ref OShort param, int value)
        {
            switch (type)
            {
            case BuffMethodTypes.Add:
                param = (OShort)((int)param + value);
                break;

            case BuffMethodTypes.Highest:
                if ((int)param >= value)
                {
                    break;
                }
                param = (OShort)value;
                break;

            case BuffMethodTypes.Lowest:
                if ((int)param <= value)
                {
                    break;
                }
                param = (OShort)value;
                break;
            }
        }
Ejemplo n.º 3
0
        public void Setup(ConceptCardEffectsParam param, int lv, int lvcap, int awake_count, int awake_count_cap)
        {
            this.mEffectParam     = param;
            this.mConditionsIname = param.cnds_iname;
            this.is_levelmax      = lv >= lvcap;
            if (!string.IsNullOrEmpty(param.card_skill))
            {
                this.mCardSkill = new SkillData();
                this.mCardSkill.Setup(param.card_skill, lv, lvcap, (MasterParam)null);
            }
            if (!string.IsNullOrEmpty(param.add_card_skill_buff_awake) && awake_count > 0)
            {
                BuffEffectParam buffEffectParam = MonoSingleton <GameManager> .Instance.MasterParam.GetBuffEffectParam(param.add_card_skill_buff_awake);

                if (buffEffectParam != null)
                {
                    this.mAddCardSkillBuffEffectAwake = BuffEffect.CreateBuffEffect(buffEffectParam, awake_count, awake_count_cap);
                }
            }
            if (!string.IsNullOrEmpty(param.add_card_skill_buff_lvmax) && lv >= lvcap && awake_count > 0)
            {
                BuffEffectParam buffEffectParam = MonoSingleton <GameManager> .Instance.MasterParam.GetBuffEffectParam(param.add_card_skill_buff_lvmax);

                if (buffEffectParam != null)
                {
                    this.mAddCardSkillBuffEffectLvMax = BuffEffect.CreateBuffEffect(buffEffectParam, 1, 1);
                }
            }
            if (!string.IsNullOrEmpty(param.statusup_skill))
            {
                this.mEquipSkill = new SkillData();
                this.mEquipSkill.Setup(param.statusup_skill, lv, lvcap, (MasterParam)null);
            }
            if (!string.IsNullOrEmpty(param.skin))
            {
                this.mSkin = param.skin;
            }
            if (!string.IsNullOrEmpty(param.abil_iname) && MonoSingleton <GameManager> .Instance.GetAbilityParam(param.abil_iname) != null)
            {
                this.mAbilityDefault = new AbilityData();
                this.mAbilityDefault.Setup((UnitData)null, 0L, param.abil_iname, lv - 1, lvcap);
                this.mAbilityDefault.IsNoneCategory = true;
                this.mAbilityDefault.IsHideList     = false;
            }
            if (string.IsNullOrEmpty(param.abil_iname) || string.IsNullOrEmpty(param.abil_iname_lvmax) || MonoSingleton <GameManager> .Instance.GetAbilityParam(param.abil_iname_lvmax) == null)
            {
                return;
            }
            this.mAbilityLvMax = new AbilityData();
            this.mAbilityLvMax.Setup((UnitData)null, 0L, param.abil_iname_lvmax, lv - 1, lvcap);
            this.mAbilityLvMax.IsNoneCategory = true;
            this.mAbilityLvMax.IsHideList     = false;
        }
Ejemplo n.º 4
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);
 }
Ejemplo n.º 5
0
        public static BuffEffect CreateBuffEffect(BuffEffectParam param, int rank, int rankcap)
        {
            if (param == null || param.buffs == null || param.buffs.Length == 0)
            {
                return((BuffEffect)null);
            }
            BuffEffect buffEffect = new BuffEffect();

            buffEffect.param   = param;
            buffEffect.targets = new List <BuffEffect.BuffTarget>(param.buffs.Length);
            buffEffect.UpdateCurrentValues(rank, rankcap);
            return(buffEffect);
        }
Ejemplo n.º 6
0
        public static bool IsEnableCardSkillForUnit(Unit target, SkillData card_skill)
        {
            if (target == null || card_skill == null || card_skill.SkillParam.condition != ESkillCondition.CardSkill)
            {
                return(false);
            }
            BuffEffectParam buffEffectParam = MonoSingleton <GameManager> .GetInstanceDirect().MasterParam.GetBuffEffectParam(card_skill.SkillParam.target_buff_iname);

            if (buffEffectParam == null)
            {
                return(false);
            }
            return(BuffEffect.CreateBuffEffect(buffEffectParam, card_skill.Rank, card_skill.GetRankCap()).CheckEnableBuffTarget(target));
        }
Ejemplo n.º 7
0
        public BuffEffect CreateAddCardSkillBuffEffectAwake(int awake, int awake_cap)
        {
            if (string.IsNullOrEmpty(this.add_card_skill_buff_awake) || awake <= 0)
            {
                return((BuffEffect)null);
            }
            BuffEffectParam buffEffectParam = MonoSingleton <GameManager> .Instance.MasterParam.GetBuffEffectParam(this.add_card_skill_buff_awake);

            if (buffEffectParam == null)
            {
                return((BuffEffect)null);
            }
            return(BuffEffect.CreateBuffEffect(buffEffectParam, awake, awake_cap));
        }
Ejemplo n.º 8
0
        public BuffEffect CreateAddCardSkillBuffEffectLvMax(int lv, int lv_cap, int awake)
        {
            if (lv < lv_cap)
            {
                return((BuffEffect)null);
            }
            if (string.IsNullOrEmpty(this.add_card_skill_buff_lvmax) || awake <= 0)
            {
                return((BuffEffect)null);
            }
            BuffEffectParam buffEffectParam = MonoSingleton <GameManager> .Instance.MasterParam.GetBuffEffectParam(this.add_card_skill_buff_lvmax);

            if (buffEffectParam == null)
            {
                return((BuffEffect)null);
            }
            return(BuffEffect.CreateBuffEffect(buffEffectParam, 1, 1));
        }
Ejemplo n.º 9
0
        private void SetBuffValue(BuffTypes type, ref OShort param, int value)
        {
            switch (type)
            {
            case BuffTypes.Buff:
                if ((int)param >= value)
                {
                    break;
                }
                param = (OShort)value;
                break;

            case BuffTypes.Debuff:
                if ((int)param <= value)
                {
                    break;
                }
                param = (OShort)value;
                break;
            }
        }
Ejemplo n.º 10
0
 private void Clear()
 {
     this.param   = (BuffEffectParam)null;
     this.targets = (List <BuffEffect.BuffTarget>)null;
 }
Ejemplo n.º 11
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);
                }
            }
        }
Ejemplo n.º 12
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
                            });
                        }
                    }
                }
            }
        }
Ejemplo n.º 13
0
 public BuffAttachment(BuffEffectParam param)
 {
     this.mParam = param;
 }