Ejemplo n.º 1
0
        public string GetChangeWeather(RandXorshift rand = null)
        {
            if (this.mChangeWeatherIdLists.Count == 0)
            {
                return((string)null);
            }
            int index1 = 0;

            if (rand != null)
            {
                int num1 = (int)(rand.Get() % 100U);
                int num2 = 0;
                for (int index2 = 0; index2 < this.mChangeWeatherRateLists.Count; ++index2)
                {
                    num2 += this.mChangeWeatherRateLists[index2];
                    if (num1 < num2)
                    {
                        index1 = index2;
                        break;
                    }
                }
            }
            if (index1 >= this.mChangeWeatherIdLists.Count)
            {
                index1 = 0;
            }
            return(this.mChangeWeatherIdLists[index1]);
        }
Ejemplo n.º 2
0
        private bool actionBuff(Unit target, EffectCheckTimings chk_timing, RandXorshift rand = null)
        {
            if (this.mBuffEffect == null || target == null || !this.mBuffEffect.CheckEnableBuffTarget(target))
            {
                return(false);
            }
            if (rand != null)
            {
                int rate = (int)this.mBuffEffect.param.rate;
                if (0 < rate && rate < 100 && (int)(rand.Get() % 100U) > rate)
                {
                    return(true);
                }
            }
            BaseStatus status1 = new BaseStatus();
            BaseStatus status2 = new BaseStatus();
            BaseStatus status3 = new BaseStatus();
            BaseStatus status4 = new BaseStatus();
            BaseStatus status5 = new BaseStatus();
            BaseStatus status6 = new BaseStatus();

            this.mBuffEffect.CalcBuffStatus(ref status1, target.Element, BuffTypes.Buff, true, false, SkillParamCalcTypes.Add, 0);
            this.mBuffEffect.CalcBuffStatus(ref status2, target.Element, BuffTypes.Buff, true, true, SkillParamCalcTypes.Add, 0);
            this.mBuffEffect.CalcBuffStatus(ref status3, target.Element, BuffTypes.Buff, false, false, SkillParamCalcTypes.Scale, 0);
            this.mBuffEffect.CalcBuffStatus(ref status4, target.Element, BuffTypes.Debuff, true, false, SkillParamCalcTypes.Add, 0);
            this.mBuffEffect.CalcBuffStatus(ref status5, target.Element, BuffTypes.Debuff, true, true, SkillParamCalcTypes.Add, 0);
            this.mBuffEffect.CalcBuffStatus(ref status6, target.Element, BuffTypes.Debuff, false, false, SkillParamCalcTypes.Scale, 0);
            if (this.mBuffEffect.CheckBuffCalcType(BuffTypes.Buff, SkillParamCalcTypes.Add, false))
            {
                BuffAttachment buffAttachment = this.createBuffAttachment(target, BuffTypes.Buff, false, SkillParamCalcTypes.Add, status1, chk_timing);
                target.SetBuffAttachment(buffAttachment, false);
            }
            if (this.mBuffEffect.CheckBuffCalcType(BuffTypes.Buff, SkillParamCalcTypes.Add, true))
            {
                BuffAttachment buffAttachment = this.createBuffAttachment(target, BuffTypes.Buff, true, SkillParamCalcTypes.Add, status2, chk_timing);
                target.SetBuffAttachment(buffAttachment, false);
            }
            if (this.mBuffEffect.CheckBuffCalcType(BuffTypes.Buff, SkillParamCalcTypes.Scale))
            {
                BuffAttachment buffAttachment = this.createBuffAttachment(target, BuffTypes.Buff, false, SkillParamCalcTypes.Scale, status3, chk_timing);
                target.SetBuffAttachment(buffAttachment, false);
            }
            if (this.mBuffEffect.CheckBuffCalcType(BuffTypes.Debuff, SkillParamCalcTypes.Add, false))
            {
                BuffAttachment buffAttachment = this.createBuffAttachment(target, BuffTypes.Debuff, false, SkillParamCalcTypes.Add, status4, chk_timing);
                target.SetBuffAttachment(buffAttachment, false);
            }
            if (this.mBuffEffect.CheckBuffCalcType(BuffTypes.Debuff, SkillParamCalcTypes.Add, true))
            {
                BuffAttachment buffAttachment = this.createBuffAttachment(target, BuffTypes.Debuff, true, SkillParamCalcTypes.Add, status5, chk_timing);
                target.SetBuffAttachment(buffAttachment, false);
            }
            if (this.mBuffEffect.CheckBuffCalcType(BuffTypes.Debuff, SkillParamCalcTypes.Scale))
            {
                BuffAttachment buffAttachment = this.createBuffAttachment(target, BuffTypes.Debuff, false, SkillParamCalcTypes.Scale, status6, chk_timing);
                target.SetBuffAttachment(buffAttachment, false);
            }
            return(true);
        }
Ejemplo n.º 3
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.º 4
0
        public static bool UpdateWeather(List <Unit> units, int now_clock, RandXorshift rand = null)
        {
            if (!WeatherData.mIsExecuteUpdate)
            {
                return(false);
            }
            bool            flag = false;
            WeatherSetParam currentWeatherSet = WeatherData.mCurrentWeatherSet;

            if (currentWeatherSet != null)
            {
                string iname = (string)null;
                if (WeatherData.mCurrentWeatherData == null)
                {
                    iname = currentWeatherSet.GetStartWeather(rand);
                    if (string.IsNullOrEmpty(iname))
                    {
                        return(false);
                    }
                }
                else
                {
                    int mChangeClock = (int)WeatherData.mCurrentWeatherData.mChangeClock;
                    if (mChangeClock != 0 && now_clock >= mChangeClock)
                    {
                        WeatherData.mCurrentWeatherData.mChangeClock = (OInt)currentWeatherSet.GetNextChangeClock(now_clock, rand);
                        iname = currentWeatherSet.GetChangeWeather(rand);
                    }
                }
                if (!string.IsNullOrEmpty(iname) && WeatherData.ChangeWeather(iname, units, now_clock, rand, (Unit)null, 1, 1) != null)
                {
                    flag = true;
                }
            }
            if (units != null && WeatherData.mCurrentWeatherData != null)
            {
                WeatherData currentWeatherData = WeatherData.mCurrentWeatherData;
                using (List <Unit> .Enumerator enumerator = units.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        Unit current = enumerator.Current;
                        if (!current.IsGimmick && current.IsEntry && !current.IsSub)
                        {
                            currentWeatherData.attachCond(WeatherData.eCondAttachType.TURN, current, rand);
                        }
                    }
                }
            }
            return(flag);
        }
Ejemplo n.º 5
0
        public int GetNextChangeClock(int now_clock, RandXorshift rand = null)
        {
            if (this.mChangeClockMin == 0 || this.mChangeClockMax == 0)
            {
                return(0);
            }
            int mChangeClockMin = this.mChangeClockMin;
            int num             = this.mChangeClockMax - this.mChangeClockMin + 1;

            if (num > 1 && rand != null)
            {
                mChangeClockMin += (int)((long)rand.Get() % (long)num);
            }
            return(now_clock + mChangeClockMin);
        }
Ejemplo n.º 6
0
        private bool actionEffectTurnStart(List <Unit> target_lists, RandXorshift rand)
        {
            if (target_lists == null)
            {
                return(false);
            }
            bool flag = false;

            using (List <Unit> .Enumerator enumerator = target_lists.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    Unit current = enumerator.Current;
                    flag |= this.actionBuff(current, EffectCheckTimings.MomentStart, rand);
                }
            }
            return(flag);
        }
Ejemplo n.º 7
0
    public override void OnActivate(int pinID)
    {
        switch (pinID)
        {
        case 100:
            if (this.mRand == null)
            {
                this.mRand = new RandXorshift("fnr");
                this.mRand.Seed((uint)DateTime.Now.Ticks);
            }
            FlowNode_Random.sLastResult = this.mRand.Get() % Math.Max(1U, (uint)this.DivValue);
            this.CheckResult(FlowNode_Random.sLastResult);
            break;

        case 101:
            this.CheckResult(FlowNode_Random.sLastResult);
            break;
        }
    }
Ejemplo n.º 8
0
        private bool actionEffectTurnEnd(List <Unit> target_lists, RandXorshift rand, LogMapTrick log_mt)
        {
            if (target_lists == null)
            {
                return(false);
            }
            bool flag = false;

            using (List <Unit> .Enumerator enumerator = target_lists.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    Unit current = enumerator.Current;
                    LogMapTrick.TargetInfo log_mt_ti = (LogMapTrick.TargetInfo)null;
                    if (log_mt != null)
                    {
                        log_mt_ti        = new LogMapTrick.TargetInfo();
                        log_mt_ti.Target = current;
                    }
                    switch (this.mTrickParam.DamageType)
                    {
                    case eTrickDamageType.DAMAGE:
                        flag |= this.actionDamage(current, log_mt_ti);
                        break;

                    case eTrickDamageType.HEAL:
                        flag |= this.actionHeal(current, log_mt_ti);
                        break;
                    }
                    flag |= this.actionCond(current, rand, log_mt_ti);
                    flag |= this.actionKnockBack(current, rand, log_mt_ti);
                    if (log_mt != null)
                    {
                        log_mt.TargetInfoLists.Add(log_mt_ti);
                    }
                }
            }
            return(flag);
        }
Ejemplo n.º 9
0
        private bool actionKnockBack(Unit target, RandXorshift rand, LogMapTrick.TargetInfo log_mt_ti)
        {
            if (rand == null || (int)this.mTrickParam.KnockBackRate == 0 || (int)this.mTrickParam.KnockBackVal == 0)
            {
                return(false);
            }
            SceneBattle instance = SceneBattle.Instance;

            if (!UnityEngine.Object.op_Implicit((UnityEngine.Object)instance))
            {
                return(false);
            }
            BattleCore battle = instance.Battle;

            if (battle == null)
            {
                return(false);
            }
            if (!this.checkKnockBack(target, rand))
            {
                return(true);
            }
            EUnitDirection dir           = this.reverseDirection[(int)target.Direction];
            Grid           gridKnockBack = battle.GetGridKnockBack(target, dir, (int)this.mTrickParam.KnockBackVal, (SkillData)null, 0, 0);

            if (gridKnockBack == null)
            {
                return(true);
            }
            if (log_mt_ti != null)
            {
                log_mt_ti.IsEffective   = true;
                log_mt_ti.KnockBackGrid = gridKnockBack;
            }
            target.x = gridKnockBack.x;
            target.y = gridKnockBack.y;
            return(true);
        }
Ejemplo n.º 10
0
        public bool BuffSkill(ESkillTiming timing, EElement element, BaseStatus buff, BaseStatus buff_negative, BaseStatus buff_scale, BaseStatus debuff, BaseStatus debuff_negative, BaseStatus debuff_scale, RandXorshift rand = null, SkillEffectTargets buff_target = SkillEffectTargets.Target, bool is_resume = false, List <BuffEffect.BuffValues> list = null)
        {
            if (this.Timing != timing)
            {
                return(false);
            }
            BuffEffect buffEffect = this.GetBuffEffect(buff_target);

            if (buffEffect == null)
            {
                return(false);
            }
            if (!is_resume)
            {
                int rate = (int)buffEffect.param.rate;
                if (rate > 0 && rate < 100)
                {
                    DebugUtility.Assert(rand != null, "発動確率が設定されているスキルを正規タイミングで発動させたにも関わらず乱数生成器の設定がされていない");
                    if ((int)(rand.Get() % 100U) > rate)
                    {
                        return(false);
                    }
                }
            }
            if (list == null)
            {
                if (buff != null)
                {
                    this.InternalBuffSkill(buffEffect, element, BuffTypes.Buff, true, false, SkillParamCalcTypes.Add, buff, (List <BuffEffect.BuffValues>)null);
                }
                if (buff_negative != null)
                {
                    this.InternalBuffSkill(buffEffect, element, BuffTypes.Buff, true, true, SkillParamCalcTypes.Add, buff_negative, (List <BuffEffect.BuffValues>)null);
                }
                if (buff_scale != null)
                {
                    this.InternalBuffSkill(buffEffect, element, BuffTypes.Buff, false, false, SkillParamCalcTypes.Scale, buff_scale, (List <BuffEffect.BuffValues>)null);
                }
                if (debuff != null)
                {
                    this.InternalBuffSkill(buffEffect, element, BuffTypes.Debuff, true, false, SkillParamCalcTypes.Add, debuff, (List <BuffEffect.BuffValues>)null);
                }
                if (debuff_negative != null)
                {
                    this.InternalBuffSkill(buffEffect, element, BuffTypes.Debuff, true, true, SkillParamCalcTypes.Add, debuff_negative, (List <BuffEffect.BuffValues>)null);
                }
                if (debuff_scale != null)
                {
                    this.InternalBuffSkill(buffEffect, element, BuffTypes.Debuff, false, false, SkillParamCalcTypes.Scale, debuff_scale, (List <BuffEffect.BuffValues>)null);
                }
            }
            else
            {
                this.InternalBuffSkill(buffEffect, element, BuffTypes.Buff, false, false, SkillParamCalcTypes.Add, (BaseStatus)null, list);
                this.InternalBuffSkill(buffEffect, element, BuffTypes.Buff, false, false, SkillParamCalcTypes.Scale, (BaseStatus)null, list);
                this.InternalBuffSkill(buffEffect, element, BuffTypes.Debuff, false, false, SkillParamCalcTypes.Add, (BaseStatus)null, list);
                this.InternalBuffSkill(buffEffect, element, BuffTypes.Debuff, false, false, SkillParamCalcTypes.Scale, (BaseStatus)null, list);
            }
            return(true);
        }
Ejemplo n.º 11
0
        public static void ActionEffect(eTrickActionTiming action_timing, Unit target, int grid_x, int grid_y, RandXorshift rand, LogMapTrick log_mt = null)
        {
            if (target == null)
            {
                return;
            }
            TrickData trick_data = TrickData.SearchEffect(grid_x, grid_y);

            if (trick_data == null || !trick_data.checkTarget(target, false) || target.IsJump)
            {
                return;
            }
            if (log_mt != null)
            {
                log_mt.TrickData = trick_data;
                log_mt.TargetInfoLists.Clear();
            }
            List <Unit> target_lists = new List <Unit>();

            if (trick_data.checkTarget(target, true))
            {
                target_lists.Add(target);
            }
            TrickData.addTargetAreaEff(grid_x, grid_y, trick_data, target_lists);
            switch (action_timing)
            {
            case eTrickActionTiming.TURN_START:
                trick_data.actionEffectTurnStart(target_lists, rand);
                break;

            case eTrickActionTiming.TURN_END:
                trick_data.actionEffectTurnEnd(target_lists, rand, log_mt);
                trick_data.decActionCount();
                break;
            }
        }
Ejemplo n.º 12
0
        private bool checkFailCond(Unit target, int val, int resist, EUnitCondition condition, RandXorshift rand)
        {
            if (rand == null || val <= 0)
            {
                return(false);
            }
            int num1 = val - resist;

            if (num1 <= 0)
            {
                return(false);
            }
            int num2 = (int)(rand.Get() % 100U);

            return(num1 > num2);
        }
Ejemplo n.º 13
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.º 14
0
        public static WeatherData ChangeWeather(string iname, List <Unit> units, int now_clock, RandXorshift rand, Unit modify_unit = null, int rank = 1, int rankcap = 1)
        {
            if (string.IsNullOrEmpty(iname))
            {
                return((WeatherData)null);
            }
            if (WeatherData.mCurrentWeatherData != null && WeatherData.mCurrentWeatherData.WeatherParam.Iname == iname)
            {
                return((WeatherData)null);
            }
            WeatherData weatherData = new WeatherData();

            weatherData.setup(iname, modify_unit, rank, rankcap);
            if (weatherData.mWeatherParam == null)
            {
                return((WeatherData)null);
            }
            if (WeatherData.mCurrentWeatherSet != null)
            {
                weatherData.mChangeClock = (OInt)WeatherData.mCurrentWeatherSet.GetNextChangeClock(now_clock, rand);
            }
            WeatherData.mCurrentWeatherData = weatherData;
            SceneBattle instance = SceneBattle.Instance;

            if (UnityEngine.Object.op_Implicit((UnityEngine.Object)instance))
            {
                BattleCore battle = instance.Battle;
                if (battle != null)
                {
                    LogWeather logWeather = battle.Log <LogWeather>();
                    if (logWeather != null)
                    {
                        logWeather.WeatherData = weatherData;
                    }
                }
            }
            if (units != null)
            {
                using (List <Unit> .Enumerator enumerator = units.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        Unit current = enumerator.Current;
                        if (!current.IsGimmick)
                        {
                            weatherData.updatePassive(current);
                        }
                    }
                }
            }
            return(weatherData);
        }
Ejemplo n.º 15
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);
        }