Exemple #1
0
        public int GetLevel(int id)
        {
            int            i    = 0;
            StageClassInfo info = Singleton <StageClassInfoList> .Instance.GetData(id);

            if (PassiveList.Count > 0)
            {
                foreach (Contract contract in PassiveList)
                {
                    if (CheckActivate(contract, info))
                    {
                        i += contract.level;
                    }
                    continue;
                }
            }
            if (StageList.Count > 0)
            {
                foreach (Contract contract in StageList)
                {
                    if (CheckActivate(contract, info))
                    {
                        i += contract.level;
                    }
                    continue;
                }
            }
            return(i);
        }
        public override void Modify(ref StageClassInfo info)
        {
            int           index     = UnityEngine.Random.Range(0, info.waveList.Count);
            StageWaveInfo reinforce = info.waveList[index];

            info.waveList.Insert(index, Harmony_Patch.CopyXml(reinforce));
        }
 public static void StageController_InitCommon(ref StageClassInfo stage)
 {
     if (stage.stageType == StageType.Creature || Duel)
     {
         return;
     }
     stage = CopyXml(stage);
     ContractModification.Init(stage);
 }
 public override void Modify(ref StageClassInfo info)
 {
     foreach (StageWaveInfo wave in info.waveList)
     {
         if (wave.availableNumber > 1)
         {
             wave.availableNumber -= 1;
         }
     }
 }
 public override bool IsValid(StageClassInfo info)
 {
     if (Level == 1)
     {
         return(info.exceptFloorList.Count < 5 && info.floorOnlyList.Count == 0);
     }
     else
     {
         return(info.floorOnlyList.Count == 0);
     }
 }
 public override bool IsValid(StageClassInfo info)
 {
     foreach (StageWaveInfo wave in info.waveList)
     {
         if (wave.availableNumber > 1)
         {
             return(true);
         }
     }
     return(false);
 }
 public static void StageController_InitStageByEndContentsStage(StageClassInfo stage)
 {
     Duel = false;
     if (CheckDuel(stage.id))
     {
         Duel = true;
     }
     if (!PassiveAbility_1890003_init)
     {
         PassiveAbility_1890003_InitList();
     }
 }
Exemple #8
0
 public void CheckSpecialCondition(StageClassInfo info)
 {
     if (GetContractCondition(OrangeCrossCondition, info))
     {
         Harmony_Patch.Progess.Orange_Path = 1;
         UIs.Add(TextDataModel.GetText("ui_RewardSpecial", TextDataModel.GetText("Condition_OrangeCross")));
     }
     if (EnsembleComplete)
     {
         if (Harmony_Patch.Progess.Ensemble_Complete == 0)
         {
             UIs.Add(TextDataModel.GetText("ui_RewardSpecial", TextDataModel.GetText("Condition_Ensemble")));
         }
         Harmony_Patch.Progess.Ensemble_Complete = 1;
     }
 }
Exemple #9
0
 public static void Init(StageClassInfo info)
 {
     foreach (Contract contract in Singleton <ContractLoader> .Instance.GetStageList())
     {
         if (contract.modifier == null)
         {
             Debug.Log("{0} doesn't load modifier", contract.Type);
             continue;
         }
         if (!contract.modifier.IsValid(info))
         {
             Debug.Log("{0} doesn't match {1}'s requirement", Singleton <StageNameXmlList> .Instance.GetName(info.id), contract.Type);
             continue;
         }
         contract.modifier.Modify(ref info);
         Debug.Log("{0} finish modifier", contract.Type);
     }
     current = info;
 }
 public override void Modify(ref StageClassInfo info)
 {
     if (Level == 1)
     {
         while (info.exceptFloorList.Count < 5)
         {
             SephirahType sephirah = RandomUtil.SelectOne <SephirahType>(SephirahType.Malkuth, SephirahType.Yesod, SephirahType.Hod, SephirahType.Netzach, SephirahType.Tiphereth, SephirahType.Gebura, SephirahType.Chesed, SephirahType.Binah, SephirahType.Hokma, SephirahType.Keter);
             if (!info.exceptFloorList.Contains(sephirah))
             {
                 info.exceptFloorList.Add(sephirah);
             }
         }
         return;
     }
     else
     {
         info.floorOnlyList.Add(RandomUtil.SelectOne <SephirahType>(SephirahType.Malkuth, SephirahType.Yesod, SephirahType.Hod, SephirahType.Netzach, SephirahType.Tiphereth, SephirahType.Gebura, SephirahType.Chesed, SephirahType.Binah, SephirahType.Hokma, SephirahType.Keter));
     }
 }
Exemple #11
0
        public void CheckReward(StageClassInfo info)
        {
            if (Harmony_Patch.CheckDuel(info.id))
            {
                return;
            }
            if (Singleton <ContractLoader> .Instance.GetLevel(info.id) < 12)
            {
                return;
            }
            UIs = new List <string>();
            switch (info.id)
            {
            case (70001):
                Harmony_Patch.Progess.Philiph_Risk = 1;
                break;

            case (70002):
                Harmony_Patch.Progess.Eileen_Risk = 1;
                break;

            case (70007):
                Harmony_Patch.Progess.Jaeheon_Risk = 1;
                break;

            case (70008):
                Harmony_Patch.Progess.Elena_Risk = 1;
                break;

            case (70009):
                Harmony_Patch.Progess.Pluto_Risk = 1;
                break;
            }
            UIs.Add(TextDataModel.GetText("ui_RewardStage", Singleton <StageNameXmlList> .Instance.GetName(info.id)));
            CheckSpecialCondition(info);
            CheckRewardAchieved();
            Debug.SaveDebug();
            if (UIs.Count > 0)
            {
                UIAlarmPopup.instance.SetAlarmText(string.Join("\n", UIs));
            }
        }
Exemple #12
0
 public bool CheckActivate(Contract contract, StageClassInfo info)
 {
     if (PassiveList.Contains(contract))
     {
         if (contract.Enemy.Count > 0)
         {
             List <int> enemy = new List <int>();
             enemy.AddRange(contract.Enemy);
             foreach (StageWaveInfo wave in info.waveList)
             {
                 if (wave.enemyUnitIdList.Exists((Predicate <int>)(x => enemy.Contains(x))))
                 {
                     enemy.RemoveAll(x => wave.enemyUnitIdList.Contains(x));
                 }
             }
             if (enemy.Count == 0)
             {
                 return(true);
             }
             return(false);
         }
         return(true);
     }
     if (StageList.Contains(contract))
     {
         if (contract.modifier == null)
         {
             Debug.Log("{0} does load modifier", contract.Type);
             return(false);
         }
         if (contract.modifier.IsValid(info))
         {
             return(true);
         }
         return(false);
     }
     return(false);
 }
        public static StageClassInfo CopyXml(StageClassInfo info)
        {
            StageClassInfo output = new StageClassInfo
            {
                id                 = info.id,
                waveList           = new List <StageWaveInfo>(),
                stageType          = info.stageType,
                mapInfo            = new List <string>(),
                floorNum           = info.floorNum,
                chapter            = info.chapter,
                invitationInfo     = CopyXml(info.invitationInfo),
                extraCondition     = CopyXml(info.extraCondition),
                storyList          = new List <StageStoryInfo>(),
                isChapterLast      = info.isChapterLast,
                _storyType         = info._storyType,
                isStageFixedNormal = info.isStageFixedNormal,
                floorOnlyList      = new List <SephirahType>(),
                exceptFloorList    = new List <SephirahType>(),
                rewardList         = new List <BookDropItemInfo>()
            };

            foreach (StageWaveInfo wave in info.waveList)
            {
                output.waveList.Add(CopyXml(wave));
            }
            output.mapInfo.AddRange(info.mapInfo);
            foreach (StageStoryInfo story in info.storyList)
            {
                output.storyList.Add(CopyXml(story));
            }
            output.floorOnlyList.AddRange(info.floorOnlyList);
            output.exceptFloorList.AddRange(info.exceptFloorList);
            foreach (BookDropItemInfo reward in info.rewardList)
            {
                output.rewardList.Add(CopyXml(reward));
            }
            return(output);
        }
 public override bool IsValid(StageClassInfo info)
 {
     return(info.floorNum != 1);
 }
        public static void Init(BattleUnitModel Model)
        {
            Inition.Add(Model);
            List <ContingecyContract> Contracts      = new List <ContingecyContract>();
            List <ContingecyContract> BuffContracts  = new List <ContingecyContract>();
            List <ContingecyContract> StageContracts = new List <ContingecyContract>();

            foreach (Contract contract in Singleton <ContractLoader> .Instance.GetPassiveList())
            {
                if (contract.Faction != Model.faction)
                {
                    Debug.Log("{0}'s faction doesn't match {1}'s", contract.Type, Model.UnitData.unitData.name);
                    continue;
                }
                if (contract.Enemy.Count > 0 && !contract.Enemy.Contains(Model.UnitData.unitData.EnemyUnitId))
                {
                    Debug.Log("{0} isn't for {1}", contract.Type, Model.UnitData.unitData.EnemyUnitId.ToString());
                    continue;
                }
                System.Type type = System.Type.GetType("Contingecy_Contract.ContingecyContract_" + contract.Type);
                if (type == (System.Type)null)
                {
                    Debug.Log("Instance of {0} is not found for {1}", type.Name, Model.UnitData.unitData.name);
                    continue;
                }
                Debug.Log("Instance of {0} is found for {1}", type.Name, Model.UnitData.unitData.name);
                if (Activator.CreateInstance(type, new object[] { contract.level }) is ContingecyContract instance)
                {
                    Debug.Log("Instance of {0}  is created for {1}", type.Name, Model.UnitData.unitData.name);
                    instance.Init(Model);
                    string level = string.Empty;
                    if (contract.Variation > 0)
                    {
                        level = (contract.level - contract.BaseLevel).ToString();
                    }
                    instance.name = Singleton <PassiveDescXmlList> .Instance.GetName(20210302) + contract.GetDesc(TextDataModel.CurrentLanguage).name + " " + level;

                    instance.desc = string.Format(contract.GetDesc(TextDataModel.CurrentLanguage).desc, instance.GetFormatParam);
                    if (contract.level <= 2)
                    {
                        instance.rare = Rarity.Uncommon;
                    }
                    if (contract.level == 3)
                    {
                        instance.rare = Rarity.Rare;
                    }
                    if (contract.level >= 4)
                    {
                        instance.rare = Rarity.Unique;
                    }
                    if (instance.Type == ContractType.Buff || instance.Type == ContractType.Special)
                    {
                        BuffContracts.Add(instance);
                        Debug.Log("Instance of {0} is added to Buff List for {1}", type.Name, Model.UnitData.unitData.name);
                    }
                    else
                    {
                        Contracts.Add(instance);
                        Debug.Log("Instance of {0} is added to Passive List for {1}", type.Name, Model.UnitData.unitData.name);
                    }
                }
            }
            foreach (Contract contract in Singleton <ContractLoader> .Instance.GetStageList())
            {
                if (contract.Faction != Model.faction)
                {
                    Debug.Log("{0}'s faction doesn't match {1}'s", contract.Type, Model.UnitData.unitData.name);
                    continue;
                }
                if (contract.Enemy.Count > 0 && !contract.Enemy.Contains(Model.UnitData.unitData.EnemyUnitId))
                {
                    Debug.Log("{0} isn't for {1}", contract.Type, Model.UnitData.unitData.EnemyUnitId.ToString());
                    continue;
                }
                StageClassInfo original = Singleton <StageClassInfoList> .Instance.GetData(Singleton <StageController> .Instance.GetStageModel().ClassInfo.id);

                if (!contract.modifier.IsValid(original))
                {
                    Debug.Log("{0} doesn't match {1}'s requirement", Singleton <StageNameXmlList> .Instance.GetName(original.id), contract.Type);
                    continue;
                }
                System.Type type = System.Type.GetType("Contingecy_Contract.ContingecyContract_" + contract.Type);
                if (type == (System.Type)null)
                {
                    Debug.Log("Instance of {0} is not found for {1}", type.Name, Model.UnitData.unitData.name);
                    continue;
                }
                Debug.Log("Instance of {0} is found for {1}", type.Name, Model.UnitData.unitData.name);
                if (Activator.CreateInstance(type, new object[] { contract.level }) is ContingecyContract stage)
                {
                    string level = string.Empty;
                    if (contract.Variation > 0)
                    {
                        level = (contract.level - contract.BaseLevel).ToString();
                    }
                    stage.name = Singleton <PassiveDescXmlList> .Instance.GetName(20210302) + contract.GetDesc(TextDataModel.CurrentLanguage).name + " " + level;

                    stage.desc = string.Format(contract.GetDesc(TextDataModel.CurrentLanguage).desc, stage.GetFormatParam);
                    if (contract.level <= 2)
                    {
                        stage.rare = Rarity.Uncommon;
                    }
                    if (contract.level == 3)
                    {
                        stage.rare = Rarity.Rare;
                    }
                    if (contract.level >= 4)
                    {
                        stage.rare = Rarity.Unique;
                    }
                    StageContracts.Add(stage);
                }
            }
            List <PassiveAbilityBase> passiveList = Model.passiveDetail.PassiveList;

            passiveList.AddRange(Contracts);
            passiveList.AddRange(BuffContracts);
            passiveList.AddRange(StageContracts);
            typeof(BattleUnitPassiveDetail).GetField("_passiveList", AccessTools.all).SetValue((object)Model.passiveDetail, (object)passiveList);
            foreach (PassiveAbilityBase contract in Contracts)
            {
                try
                {
                    contract.OnWaveStart();
                }
                catch
                {
                }
            }
            if (BuffContracts.Count > 0)
            {
                Model.bufListDetail.AddBuf(new ContractStatBonus(BuffContracts));
                if (Harmony_Patch.CombaltData.ContainsKey(Model.UnitData))
                {
                    Model.SetHp(Harmony_Patch.CombaltData[Model.UnitData]);
                    Model.breakDetail.breakGauge = Model.breakDetail.GetDefaultBreakGauge();
                    CheckPhaseCondition(Model);
                }
                else
                {
                    Model.SetHp((int)Model.passiveDetail.GetStartHp((float)Model.MaxHp));
                    Model.breakDetail.breakGauge = Model.breakDetail.GetDefaultBreakGauge();
                    CheckPhaseCondition(Model);
                }
            }
        }
 public override void Modify(ref StageClassInfo info)
 {
     info.floorNum = 1;
 }
Exemple #17
0
 public virtual bool IsValid(StageClassInfo info) => true;
Exemple #18
0
 public virtual void Modify(ref StageClassInfo info)
 {
 }
        public static void LibraryModel_OnClearStage(int stageId)
        {
            StageClassInfo info = Singleton <StageClassInfoList> .Instance.GetData(stageId);

            Singleton <ContractRewardSystem> .Instance.CheckReward(info);
        }