Beispiel #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;
        }
Beispiel #2
0
        private CondAttachment createCondAttachment(Unit target, CondEffect effect, ConditionEffectTypes type, EUnitCondition condition)
        {
            if (type == ConditionEffectTypes.None)
            {
                return((CondAttachment)null);
            }
            if (effect == null)
            {
                return((CondAttachment)null);
            }
            CondAttachment condAttachment = new CondAttachment(effect.param);

            condAttachment.user         = (Unit)null;
            condAttachment.skill        = (SkillData)null;
            condAttachment.skilltarget  = SkillEffectTargets.Self;
            condAttachment.CondId       = effect.param.iname;
            condAttachment.IsPassive    = (OBool)false;
            condAttachment.UseCondition = ESkillCondition.None;
            condAttachment.CondType     = type;
            condAttachment.Condition    = condition;
            condAttachment.turn         = effect.turn;
            condAttachment.CheckTiming  = effect.param.chk_timing;
            condAttachment.CheckTarget  = target;
            if (condAttachment.IsFailCondition())
            {
                condAttachment.IsCurse = effect.IsCurse;
            }
            condAttachment.SetupLinkageBuff();
            return(condAttachment);
        }
Beispiel #3
0
        private CondAttachment createCondAttachment(Unit target, CondEffect effect, ConditionEffectTypes type, EUnitCondition condition)
        {
            if (type == ConditionEffectTypes.None)
            {
                return((CondAttachment)null);
            }
            CondAttachment condAttachment = new CondAttachment();

            condAttachment.user         = (Unit)null;
            condAttachment.skill        = (SkillData)null;
            condAttachment.IsPassive    = (OBool)(effect.param.chk_timing == EffectCheckTimings.Eternal);
            condAttachment.UseCondition = ESkillCondition.Weather;
            condAttachment.CondType     = type;
            condAttachment.Condition    = condition;
            int num = (int)effect.turn;

            if (num < 2)
            {
                num = 2;
            }
            condAttachment.turn        = (OInt)num;
            condAttachment.CheckTiming = effect.param.chk_timing;
            condAttachment.CheckTarget = target;
            if (condAttachment.IsFailCondition())
            {
                condAttachment.IsCurse = effect.IsCurse;
            }
            return(condAttachment);
        }
Beispiel #4
0
 public bool Deserialize(JSON_CondEffectParam json)
 {
     if (json == null)
     {
         return(false);
     }
     this.iname      = json.iname;
     this.job        = json.job;
     this.buki       = json.buki;
     this.birth      = json.birth;
     this.sex        = (ESex)json.sex;
     this.elem       = (EElement)json.elem;
     this.cond       = (ESkillCondition)json.cond;
     this.type       = (ConditionEffectTypes)json.type;
     this.chk_target = (EffectCheckTargets)json.chktgt;
     this.chk_timing = (EffectCheckTimings)json.timing;
     this.value_ini  = (OInt)json.vini;
     this.value_max  = (OInt)json.vmax;
     this.rate_ini   = (OInt)json.rini;
     this.rate_max   = (OInt)json.rmax;
     this.turn_ini   = (OInt)json.tini;
     this.turn_max   = (OInt)json.tmax;
     this.curse      = (OInt)json.curse;
     this.conditions = (EUnitCondition[])null;
     if (json.conds != null)
     {
         this.conditions = new EUnitCondition[json.conds.Length];
         for (int index = 0; index < json.conds.Length; ++index)
         {
             if (json.conds[index] >= 0)
             {
                 this.conditions[index] = (EUnitCondition)(1 << json.conds[index]);
             }
         }
     }
     this.v_poison_rate      = (OInt)json.v_poi;
     this.v_poison_fix       = (OInt)json.v_poifix;
     this.v_paralyse_rate    = (OInt)json.v_par;
     this.v_blink_hit        = (OInt)json.v_blihit;
     this.v_blink_avo        = (OInt)json.v_bliavo;
     this.v_death_count      = (OInt)json.v_dea;
     this.v_berserk_atk      = (OInt)json.v_beratk;
     this.v_berserk_def      = (OInt)json.v_berdef;
     this.v_fast             = (OInt)json.v_fast;
     this.v_slow             = (OInt)json.v_slow;
     this.v_donmov           = (OInt)json.v_don;
     this.v_auto_hp_heal     = (OInt)json.v_ahp;
     this.v_auto_mp_heal     = (OInt)json.v_amp;
     this.v_auto_hp_heal_fix = (OInt)json.v_ahpfix;
     this.v_auto_mp_heal_fix = (OInt)json.v_ampfix;
     return(true);
 }
Beispiel #5
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);
            }
        }
Beispiel #6
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);
        }
Beispiel #7
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);
        }