Example #1
0
 public void SetEnchentParamMax(JSON_UnitParam json)
 {
     if (!this.IsExistEnchentParamMax(json))
     {
         return;
     }
     this.enchant_resist               = new EnchantParam();
     this.enchant_resist.poison        = (OShort)json.mrpo;
     this.enchant_resist.paralyse      = (OShort)json.mrpa;
     this.enchant_resist.stun          = (OShort)json.mrst;
     this.enchant_resist.sleep         = (OShort)json.mrsl;
     this.enchant_resist.charm         = (OShort)json.mrch;
     this.enchant_resist.stone         = (OShort)json.mrsn;
     this.enchant_resist.blind         = (OShort)json.mrbl;
     this.enchant_resist.notskl        = (OShort)json.mrns;
     this.enchant_resist.notmov        = (OShort)json.mrnm;
     this.enchant_resist.notatk        = (OShort)json.mrna;
     this.enchant_resist.zombie        = (OShort)json.mrzo;
     this.enchant_resist.death         = (OShort)json.mrde;
     this.enchant_resist.knockback     = (OShort)json.mrkn;
     this.enchant_resist.resist_debuff = (OShort)json.mrdf;
     this.enchant_resist.berserk       = (OShort)json.mrbe;
     this.enchant_resist.stop          = (OShort)json.mrcs;
     this.enchant_resist.fast          = (OShort)json.mrcu;
     this.enchant_resist.slow          = (OShort)json.mrcd;
     this.enchant_resist.donsoku       = (OShort)json.mrdo;
     this.enchant_resist.rage          = (OShort)json.mrra;
     this.enchant_resist.single_attack = (OShort)json.mrsa;
     this.enchant_resist.area_attack   = (OShort)json.mraa;
     this.enchant_resist.dec_ct        = (OShort)json.mrdc;
     this.enchant_resist.inc_ct        = (OShort)json.mric;
 }
Example #2
0
 public void Add(EnchantParam src)
 {
     if (src == null)
     {
         return;
     }
     for (int index = 0; index < this.values.Length; ++index)
     {
         // ISSUE: explicit reference operation
         // ISSUE: variable of a reference type
         OInt& local = @this.values[index];
Example #3
0
 public void CopyTo(EnchantParam dsc)
 {
     if (dsc == null)
     {
         return;
     }
     for (int index = 0; index < this.values.Length; ++index)
     {
         dsc.values[index] = this.values[index];
     }
 }
Example #4
0
        private bool actionCond(Unit target, RandXorshift rand, LogMapTrick.TargetInfo log_mt_ti)
        {
            CondEffect mCondEffect = this.mCondEffect;

            if (rand == null || mCondEffect == null || (mCondEffect.param == null || mCondEffect.param.conditions == null))
            {
                return(false);
            }
            ConditionEffectTypes conditionEffectTypes = ConditionEffectTypes.None;

            if (!mCondEffect.CheckEnableCondTarget(target))
            {
                return(true);
            }
            if (mCondEffect.param.type != ConditionEffectTypes.None && mCondEffect.param.conditions != null)
            {
                int rate = (int)mCondEffect.rate;
                if (0 < rate && rate < 100 && (int)(rand.Get() % 100U) > rate)
                {
                    return(true);
                }
                conditionEffectTypes = mCondEffect.param.type;
            }
            switch (conditionEffectTypes)
            {
            case ConditionEffectTypes.CureCondition:
                for (int index = 0; index < mCondEffect.param.conditions.Length; ++index)
                {
                    EUnitCondition condition = mCondEffect.param.conditions[index];
                    this.cureCond(target, condition, log_mt_ti);
                }
                break;

            case ConditionEffectTypes.FailCondition:
                if ((int)mCondEffect.value != 0)
                {
                    EnchantParam enchantResist = target.CurrentStatus.enchant_resist;
                    for (int index = 0; index < mCondEffect.param.conditions.Length; ++index)
                    {
                        EUnitCondition condition = mCondEffect.param.conditions[index];
                        if (!target.IsDisableUnitCondition(condition) && this.checkFailCond(target, (int)mCondEffect.value, (int)enchantResist[condition], condition, rand))
                        {
                            this.failCond(target, mCondEffect, conditionEffectTypes, condition, log_mt_ti);
                        }
                    }
                    break;
                }
                break;

            case ConditionEffectTypes.ForcedFailCondition:
                for (int index = 0; index < mCondEffect.param.conditions.Length; ++index)
                {
                    EUnitCondition condition = mCondEffect.param.conditions[index];
                    this.failCond(target, mCondEffect, conditionEffectTypes, condition, log_mt_ti);
                }
                break;

            case ConditionEffectTypes.RandomFailCondition:
                if ((int)mCondEffect.value != 0)
                {
                    EnchantParam   enchantResist = target.CurrentStatus.enchant_resist;
                    int            index         = (int)((long)rand.Get() % (long)mCondEffect.param.conditions.Length);
                    EUnitCondition condition     = mCondEffect.param.conditions[index];
                    if (!target.IsDisableUnitCondition(condition) && this.checkFailCond(target, (int)mCondEffect.value, (int)enchantResist[condition], condition, rand))
                    {
                        this.failCond(target, mCondEffect, conditionEffectTypes, condition, log_mt_ti);
                        break;
                    }
                    break;
                }
                break;

            case ConditionEffectTypes.DisableCondition:
                for (int index = 0; index < mCondEffect.param.conditions.Length; ++index)
                {
                    CondAttachment condAttachment = this.createCondAttachment(target, mCondEffect, conditionEffectTypes, mCondEffect.param.conditions[index]);
                    target.SetCondAttachment(condAttachment);
                }
                break;
            }
            return(true);
        }
Example #5
0
        public void CalcLevelCurveStatus(int rank, ref BaseStatus result, UnitParam.Status ini_status, UnitParam.Status max_status)
        {
            int num1 = this.GetLevelCap() - 1;
            int num2 = rank - 1;

            result.bonus.Clear();
            result.enchant_assist.Clear();
            result.enchant_resist.Clear();
            result.element_assist.Clear();
            result.element_resist.Clear();
            ini_status.param.CopyTo(result.param);
            if (ini_status.enchant_resist != null)
            {
                ini_status.enchant_resist.CopyTo(result.enchant_resist);
            }
            if (num2 < 1 || num1 < 1)
            {
                return;
            }
            if (num2 >= num1)
            {
                max_status.param.CopyTo(result.param);
                if (max_status.enchant_resist == null)
                {
                    return;
                }
                max_status.enchant_resist.CopyTo(result.enchant_resist);
            }
            else
            {
                BaseStatus baseStatus1 = new BaseStatus();
                BaseStatus baseStatus2 = new BaseStatus();
                for (int index1 = 0; index1 < this.curve.Count; ++index1)
                {
                    long num3 = (long)((int)this.curve[index1].lv - 1);
                    for (int index2 = index1; index2 > 0; --index2)
                    {
                        num3 -= (long)(int)this.curve[index2 - 1].lv;
                    }
                    long        num4         = (long)num2 >= num3 ? num3 : (long)num2;
                    StatusParam statusParam1 = ini_status.param;
                    StatusParam statusParam2 = max_status.param;
                    StatusParam src          = this.curve[index1].status.param;
                    src.CopyTo(baseStatus1.param);
                    baseStatus1.param.Sub(baseStatus2.param);
                    baseStatus2.param.Add(src);
                    for (int index2 = 0; index2 < baseStatus1.param.Length; ++index2)
                    {
                        long num5 = (long)(((int)statusParam2[(StatusTypes)index2] - (int)statusParam1[(StatusTypes)index2]) * (int)baseStatus1.param[(StatusTypes)index2] / 100);
                        if (num5 != 0L)
                        {
                            StatusParam statusParam3;
                            StatusTypes index3;
                            (statusParam3 = result.param)[index3 = (StatusTypes)index2] = (OInt)((int)statusParam3[index3] + (int)(100000L * num5 / num3 * num4 / 100000L));
                        }
                    }
                    if (ini_status.enchant_resist != null && max_status.enchant_resist != null)
                    {
                        EnchantParam enchantResist1 = ini_status.enchant_resist;
                        EnchantParam enchantResist2 = max_status.enchant_resist;
                        EnchantParam enchantResist3 = this.curve[index1].status.enchant_resist;
                        enchantResist3.CopyTo(baseStatus1.enchant_resist);
                        baseStatus1.enchant_resist.Sub(baseStatus2.enchant_resist);
                        baseStatus2.enchant_resist.Add(enchantResist3);
                        for (int index2 = 0; index2 < baseStatus1.enchant_resist.values.Length; ++index2)
                        {
                            long num5 = (long)(((int)enchantResist2.values[index2] - (int)enchantResist1.values[index2]) * (int)baseStatus1.enchant_resist.values[index2] / 100);
                            if (num5 != 0L)
                            {
                                // ISSUE: explicit reference operation
                                // ISSUE: variable of a reference type
                                OShort& local = @result.enchant_resist.values[index2];
Example #6
0
        private bool attachCond(WeatherData.eCondAttachType cond_at_type, Unit target, RandXorshift rand = null)
        {
            bool flag = false;

            using (List <CondEffect> .Enumerator enumerator = this.mCondEffectLists.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    CondEffect current = enumerator.Current;
                    if (current != null && current.param != null && current.param.conditions != null)
                    {
                        switch (cond_at_type)
                        {
                        case WeatherData.eCondAttachType.PASSIVE:
                            if (current.param.chk_timing == EffectCheckTimings.Eternal)
                            {
                                break;
                            }
                            continue;

                        case WeatherData.eCondAttachType.TURN:
                            if (current.param.chk_timing != EffectCheckTimings.Eternal)
                            {
                                break;
                            }
                            continue;
                        }
                        if (current.CheckEnableCondTarget(target))
                        {
                            ConditionEffectTypes type = current.param.type;
                            switch (type)
                            {
                            case ConditionEffectTypes.CureCondition:
                                for (int index = 0; index < current.param.conditions.Length; ++index)
                                {
                                    EUnitCondition condition = current.param.conditions[index];
                                    this.cureCond(target, condition);
                                }
                                break;

                            case ConditionEffectTypes.FailCondition:
                                if ((int)current.value != 0)
                                {
                                    EnchantParam enchantResist = target.CurrentStatus.enchant_resist;
                                    for (int index = 0; index < current.param.conditions.Length; ++index)
                                    {
                                        EUnitCondition condition = current.param.conditions[index];
                                        if (!target.IsDisableUnitCondition(condition) && this.checkFailCond(target, (int)current.value, (int)enchantResist[condition], condition, rand))
                                        {
                                            this.failCond(target, current, type, condition);
                                        }
                                    }
                                    break;
                                }
                                break;

                            case ConditionEffectTypes.ForcedFailCondition:
                                for (int index = 0; index < current.param.conditions.Length; ++index)
                                {
                                    EUnitCondition condition = current.param.conditions[index];
                                    this.failCond(target, current, type, condition);
                                }
                                break;

                            case ConditionEffectTypes.RandomFailCondition:
                                if ((int)current.value != 0)
                                {
                                    EnchantParam   enchantResist = target.CurrentStatus.enchant_resist;
                                    int            index         = rand == null ? 0 : (int)((long)rand.Get() % (long)current.param.conditions.Length);
                                    EUnitCondition condition     = current.param.conditions[index];
                                    if (!target.IsDisableUnitCondition(condition) && this.checkFailCond(target, (int)current.value, (int)enchantResist[condition], condition, rand))
                                    {
                                        this.failCond(target, current, type, condition);
                                        break;
                                    }
                                    break;
                                }
                                break;

                            case ConditionEffectTypes.DisableCondition:
                                for (int index = 0; index < current.param.conditions.Length; ++index)
                                {
                                    CondAttachment condAttachment     = this.createCondAttachment(target, current, type, current.param.conditions[index]);
                                    CondAttachment sameCondAttachment = this.getSameCondAttachment(target, condAttachment);
                                    if (sameCondAttachment != null)
                                    {
                                        sameCondAttachment.turn = condAttachment.turn;
                                    }
                                    else
                                    {
                                        target.SetCondAttachment(condAttachment);
                                    }
                                }
                                break;
                            }
                            flag = true;
                        }
                    }
                }
            }
            return(flag);
        }