Ejemplo n.º 1
0
        private void Start()
        {
            SceneBattle instance = SceneBattle.Instance;

            if (this.mButtonObj != null)
            {
                this.mButtonObj.Clear();
            }
            else
            {
                this.mButtonObj = new List <GameObject>();
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.ExitButton, (UnityEngine.Object)null))
            {
                this.ExitButton.SetActive(true);
            }
            if (!UnityEngine.Object.op_Inequality((UnityEngine.Object)instance, (UnityEngine.Object)null))
            {
                return;
            }
            List <JSON_MyPhotonPlayerParam> audiencePlayer = instance.AudiencePlayer;
            List <Unit> allUnits = instance.Battle.AllUnits;

            for (int i = 0; i < audiencePlayer.Count; ++i)
            {
                JSON_MyPhotonPlayerParam.UnitDataElem[] units = audiencePlayer[i].units;
                GenericSlot[] genericSlotArray = i != 0 ? this.Units_2P : this.Units_1P;
                if (genericSlotArray != null)
                {
                    for (int j = 0; j < genericSlotArray.Length; ++j)
                    {
                        if (j < units.Length)
                        {
                            genericSlotArray[j].SetSlotData <UnitData>(units[j].unit);
                            Button component = (Button)((Component)genericSlotArray[j]).GetComponent <Button>();
                            if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component, (UnityEngine.Object)null))
                            {
                                Unit data = allUnits.Find((Predicate <Unit>)(un =>
                                {
                                    if (un.OwnerPlayerIndex == i + 1)
                                    {
                                        return(un.UnitData.UnitParam.iname == units[j].unit.UnitParam.iname);
                                    }
                                    return(false);
                                }));
                                if (data != null)
                                {
                                    DataSource.Bind <Unit>(((Component)component).get_gameObject(), data);
                                    this.mButtonObj.Add(((Component)component).get_gameObject());
                                    ((Selectable)component).set_interactable(!data.IsDeadCondition());
                                }
                            }
                        }
                        else
                        {
                            genericSlotArray[j].SetSlotData <UnitData>((UnitData)null);
                        }
                    }
                }
                Text text1 = i != 0 ? this.Name2P : this.Name1P;
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object)text1, (UnityEngine.Object)null))
                {
                    text1.set_text(audiencePlayer[i].playerName);
                }
                Text text2 = i != 0 ? this.TotalAtk2P : this.TotalAtk1P;
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object)text2, (UnityEngine.Object)null))
                {
                    text2.set_text(audiencePlayer[i].totalAtk.ToString());
                }
                Text text3 = i != 0 ? this.Lv2P : this.Lv1P;
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object)text2, (UnityEngine.Object)null))
                {
                    text3.set_text(audiencePlayer[i].playerLevel.ToString());
                }
            }
        }
Ejemplo n.º 2
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.º 3
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);
        }
Ejemplo n.º 4
0
 private void cureCond(Unit target, EUnitCondition condition)
 {
     target.CureCondEffects(condition, true, false);
 }
Ejemplo n.º 5
0
        private bool attachBuffPassive(Unit target)
        {
            if (target == null)
            {
                return(false);
            }
            bool flag = false;

            using (List <BuffEffect> .Enumerator enumerator = this.mBuffEffectLists.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    BuffEffect current = enumerator.Current;
                    if (current != null && current.param.chk_timing == EffectCheckTimings.Eternal && current.CheckEnableBuffTarget(target))
                    {
                        BaseStatus status1 = new BaseStatus();
                        BaseStatus status2 = new BaseStatus();
                        BaseStatus status3 = new BaseStatus();
                        BaseStatus status4 = new BaseStatus();
                        BaseStatus status5 = new BaseStatus();
                        BaseStatus status6 = new BaseStatus();
                        current.CalcBuffStatus(ref status1, target.Element, BuffTypes.Buff, true, false, SkillParamCalcTypes.Add, 0);
                        current.CalcBuffStatus(ref status2, target.Element, BuffTypes.Buff, true, true, SkillParamCalcTypes.Add, 0);
                        current.CalcBuffStatus(ref status3, target.Element, BuffTypes.Buff, false, false, SkillParamCalcTypes.Scale, 0);
                        current.CalcBuffStatus(ref status4, target.Element, BuffTypes.Debuff, true, false, SkillParamCalcTypes.Add, 0);
                        current.CalcBuffStatus(ref status5, target.Element, BuffTypes.Debuff, true, true, SkillParamCalcTypes.Add, 0);
                        current.CalcBuffStatus(ref status6, target.Element, BuffTypes.Debuff, false, false, SkillParamCalcTypes.Scale, 0);
                        if (current.CheckBuffCalcType(BuffTypes.Buff, SkillParamCalcTypes.Add, false))
                        {
                            BuffAttachment buffAttachment = this.createBuffAttachment(target, current, BuffTypes.Buff, false, SkillParamCalcTypes.Add, status1);
                            target.SetBuffAttachment(buffAttachment, false);
                        }
                        if (current.CheckBuffCalcType(BuffTypes.Buff, SkillParamCalcTypes.Add, true))
                        {
                            BuffAttachment buffAttachment = this.createBuffAttachment(target, current, BuffTypes.Buff, true, SkillParamCalcTypes.Add, status2);
                            target.SetBuffAttachment(buffAttachment, false);
                        }
                        if (current.CheckBuffCalcType(BuffTypes.Buff, SkillParamCalcTypes.Scale))
                        {
                            BuffAttachment buffAttachment = this.createBuffAttachment(target, current, BuffTypes.Buff, false, SkillParamCalcTypes.Scale, status3);
                            target.SetBuffAttachment(buffAttachment, false);
                        }
                        if (current.CheckBuffCalcType(BuffTypes.Debuff, SkillParamCalcTypes.Add, false))
                        {
                            BuffAttachment buffAttachment = this.createBuffAttachment(target, current, BuffTypes.Debuff, false, SkillParamCalcTypes.Add, status4);
                            target.SetBuffAttachment(buffAttachment, false);
                        }
                        if (current.CheckBuffCalcType(BuffTypes.Debuff, SkillParamCalcTypes.Add, true))
                        {
                            BuffAttachment buffAttachment = this.createBuffAttachment(target, current, BuffTypes.Debuff, true, SkillParamCalcTypes.Add, status5);
                            target.SetBuffAttachment(buffAttachment, false);
                        }
                        if (current.CheckBuffCalcType(BuffTypes.Debuff, SkillParamCalcTypes.Scale))
                        {
                            BuffAttachment buffAttachment = this.createBuffAttachment(target, current, BuffTypes.Debuff, false, SkillParamCalcTypes.Scale, status6);
                            target.SetBuffAttachment(buffAttachment, false);
                        }
                        flag = true;
                    }
                }
            }
            return(flag);
        }