Exemplo n.º 1
0
        private void failCond(Unit target, CondEffect effect, ConditionEffectTypes effect_type, EUnitCondition condition, LogMapTrick.TargetInfo log_mt_ti)
        {
            SceneBattle instance = SceneBattle.Instance;

            if (UnityEngine.Object.op_Implicit((UnityEngine.Object)instance))
            {
                BattleCore battle = instance.Battle;
                if (battle != null)
                {
                    LogFailCondition logFailCondition = battle.Log <LogFailCondition>();
                    logFailCondition.self      = target;
                    logFailCondition.source    = (Unit)null;
                    logFailCondition.condition = condition;
                    TacticsUnitController unitController = instance.FindUnitController(target);
                    if (UnityEngine.Object.op_Implicit((UnityEngine.Object)unitController))
                    {
                        unitController.LockUpdateBadStatus(condition, false);
                    }
                }
            }
            CondAttachment condAttachment = this.createCondAttachment(target, effect, effect_type, condition);

            target.SetCondAttachment(condAttachment);
            if (log_mt_ti == null || !target.IsUnitCondition(condition))
            {
                return;
            }
            log_mt_ti.IsEffective    = true;
            log_mt_ti.FailCondition |= condition;
        }
Exemplo n.º 2
0
        private void failCond(Unit target, CondEffect effect, ConditionEffectTypes effect_type, EUnitCondition condition)
        {
            CondAttachment condAttachment     = this.createCondAttachment(target, effect, effect_type, condition);
            CondAttachment sameCondAttachment = this.getSameCondAttachment(target, condAttachment);

            if (sameCondAttachment != null)
            {
                sameCondAttachment.turn = condAttachment.turn;
            }
            else
            {
                target.SetCondAttachment(condAttachment);
                if (!WeatherData.mIsEntryConditionLog)
                {
                    return;
                }
                SceneBattle instance = SceneBattle.Instance;
                if (!UnityEngine.Object.op_Implicit((UnityEngine.Object)instance))
                {
                    return;
                }
                BattleCore battle = instance.Battle;
                if (battle == null)
                {
                    return;
                }
                LogFailCondition logFailCondition = battle.Log <LogFailCondition>();
                logFailCondition.self      = target;
                logFailCondition.source    = (Unit)null;
                logFailCondition.condition = condition;
                TacticsUnitController unitController = instance.FindUnitController(target);
                if (!UnityEngine.Object.op_Implicit((UnityEngine.Object)unitController))
                {
                    return;
                }
                unitController.LockUpdateBadStatus(condition, false);
            }
        }
Exemplo 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);
        }
Exemplo 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);
        }