Ejemplo n.º 1
0
        public int GetTotalFailConditionCount()
        {
            CondEffect condEffect = this.skill.GetCondEffect(SkillEffectTargets.Target);

            if (condEffect == null || condEffect.param == null || condEffect.param.conditions == null || condEffect.param.type != ConditionEffectTypes.FailCondition && condEffect.param.type != ConditionEffectTypes.ForcedFailCondition && condEffect.param.type != ConditionEffectTypes.RandomFailCondition)
            {
                return(0);
            }
            int num1 = 0;
            int num2 = 0;

            if (this.self.AI != null)
            {
                num2 = (int)this.self.AI.cond_border;
            }
            if (num2 > 0 && (int)condEffect.rate > 0 && (int)condEffect.rate < num2)
            {
                return(0);
            }
            for (int index1 = 0; index1 < this.targets.Count; ++index1)
            {
                for (int index2 = 0; index2 < condEffect.param.conditions.Length; ++index2)
                {
                    Unit           target    = this.targets[index1].target;
                    EUnitCondition condition = condEffect.param.conditions[index2];
                    if (!target.IsUnitCondition(condition) && !target.IsDisableUnitCondition(condition) && (num2 <= 0 || Math.Max((int)condEffect.value - (int)target.CurrentStatus.enchant_resist[condition], 0) >= num2))
                    {
                        ++num1;
                    }
                }
            }
            return(num1);
        }
Ejemplo n.º 2
0
        private bool checkKnockBack(Unit target, RandXorshift rand)
        {
            if (target == null || rand == null || target.IsDisableUnitCondition(EUnitCondition.DisableKnockback))
            {
                return(false);
            }
            int num = (int)this.mTrickParam.KnockBackRate - (int)target.CurrentStatus.enchant_resist[EnchantTypes.Knockback];

            return(num > 0 && (num >= 100 || (int)(rand.Get() % 100U) < num));
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
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);
        }