Esempio n. 1
0
        static internal BlueprintSpellsTable CreateArcanistPerDay()
        {
            if (library.BlueprintsByAssetId.ContainsKey("7de5c1dbbbc57d9dea0f7280a229d6db"))
            {
                return(library.Get <BlueprintSpellsTable>("7de5c1dbbbc57d9dea0f7280a229d6db"));
            }
            //UnityModManagerNet.UnityModManager.Logger.Log("RUA RUA RUA 000");
            BlueprintSpellsTable perday = Helpers.Create <BlueprintSpellsTable>();

            perday.Levels = new SpellsLevelEntry[21];
            //UnityModManagerNet.UnityModManager.Logger.Log("RUA RUA RUA 001");
            perday.Levels[0] = new SpellsLevelEntry {
                Count = new int[] { 0, 0 }
            };
            //UnityModManagerNet.UnityModManager.Logger.Log("RUA RUA RUA 002");
            for (int i = 1; i <= 20; i++)
            {
                int maxTier = (i < 4) ? 1 : Math.Min(9, i / 2); // max spell tier on level i
                perday.Levels[i] = new SpellsLevelEntry {
                    Count = new int[maxTier + 1]
                };
                perday.Levels[i].Count[0] = 0;
                for (int j = 1; j <= maxTier; j++)
                {
                    UnityModManagerNet.UnityModManager.Logger.Log($"{i}, {j}");
                    perday.Levels[i].Count[j] = (j == 1) ? Math.Min(4, i + 1) : Math.Min(4, i - j * 2 + 2);
                }
            }
            library.AddAsset(perday, "7de5c1dbbbc57d9dea0f7280a229d6db");//MD5-32[ArcanistClass.SpellsPerDayTable]
            return(perday);
        }
Esempio n. 2
0
 static public void SetSpellTableLevel(this BlueprintSpellsTable spellPerDay, int level, int[] Count)
 {
     try {
         spellPerDay.Levels[level]       = new SpellsLevelEntry();
         spellPerDay.Levels[level].Count = Count;
     }
     catch (Exception e) {
         spellPerDay.Levels = new SpellsLevelEntry[21];
     }
 }
Esempio n. 3
0
        static internal BlueprintSpellsTable CreateArcanistMemorize()
        {
            if (library.BlueprintsByAssetId.ContainsKey("70a540f04461bcd29da08e9a25b5c566"))
            {
                return(library.Get <BlueprintSpellsTable>("70a540f04461bcd29da08e9a25b5c566"));
            }
            BlueprintSpellsTable memorize  = Helpers.Create <BlueprintSpellsTable>();
            const int            MAX_KNOWN = 255;

            memorize.Levels    = new SpellsLevelEntry[41];
            memorize.Levels[0] = new SpellsLevelEntry {
                Count = new int[] { 0, 0 }
            };
            for (int i = 1; i <= 20; i++)
            {
                int maxTier = (i < 4) ? 1 : Math.Min(9, i / 2);
                memorize.Levels[i] = new SpellsLevelEntry {
                    Count = new int[maxTier + 1]
                };
                memorize.Levels[i].Count[0] = 0;
                for (int j = 1; j <= maxTier; j++)
                {
                    //Arcanist is a spontaneous caster but also get two new spells every time she levels up, just like a wizard.
                    //On choosing new spells of each level up(say level i -> level i+1), the game will check whether \
                    //number of chosen spells of each spell tier j is greater than known(i+1,j)-known(i,j)
                    //if j<known(i+1,j)-known(i,j) then the spell choosing part is not finished.
                    //So an easy way to fix this is to set an arcanist's known spell of level 1-20 to 1.
                    //(On level 1 you can only choose tier 1 spell so set it to 1 won't cause a bug on character creation(level 0->1).
                    //And data of level 21-40 of known spell table contains number of arcanist's every day memorized spells.
                    memorize.Levels[i].Count[j] = 1;
                }

                memorize.Levels[i + 20] = sorcerer.Spellbook.SpellsKnown.Levels[i];
            }
            library.AddAsset(memorize, "70a540f04461bcd29da08e9a25b5c566");//MD5-32[ArcanistClass.SpellMemorizeTable]
            return(memorize);
        }
Esempio n. 4
0
            public static bool Prefix(LevelUpState state, UnitDescriptor unit)
            {
                if (!settings.toggleMulticlass)
                {
                    return(false);
                }
                if ((UnityEngine.Object)state.SelectedClass == (UnityEngine.Object)null)
                {
                    return(true);
                }
                SkipLevelsForSpellProgression component1 = state.SelectedClass.GetComponent <SkipLevelsForSpellProgression>();

                if ((UnityEngine.Object)component1 != (UnityEngine.Object)null && ((IEnumerable <int>)component1.Levels).Contains <int>(state.NextClassLevel))
                {
                    return(true);
                }
                ClassData classData = unit.Progression.GetClassData(state.SelectedClass);

                if (classData == null || !((UnityEngine.Object)classData.Spellbook != (UnityEngine.Object)null))
                {
                    return(true);
                }
                Spellbook spellbook1 = unit.DemandSpellbook(classData.Spellbook);

                if ((bool)(UnityEngine.Object)state.SelectedClass.Spellbook && (UnityEngine.Object)state.SelectedClass.Spellbook != (UnityEngine.Object)classData.Spellbook)
                {
                    Spellbook spellbook2 = unit.Spellbooks.FirstOrDefault <Spellbook>((Func <Spellbook, bool>)(s => (UnityEngine.Object)s.Blueprint == (UnityEngine.Object)state.SelectedClass.Spellbook));
                    if (spellbook2 != null)
                    {
                        foreach (AbilityData allKnownSpell in spellbook2.GetAllKnownSpells())
                        {
                            spellbook1.AddKnown(allKnownSpell.SpellLevel, allKnownSpell.Blueprint);
                        }
                        unit.DeleteSpellbook(state.SelectedClass.Spellbook);
                    }
                }
                int casterLevelBefore = spellbook1.CasterLevel;

                spellbook1.AddLevelFromClass(classData.CharacterClass);
                int casterLevelAfter = spellbook1.CasterLevel;

                if (casterLevelBefore == casterLevelAfter)
                {
                    return(true);                                       // Mod line
                }
                SpellSelectionData spellSelectionData = state.DemandSpellSelection(spellbook1.Blueprint, spellbook1.Blueprint.SpellList);

                if ((UnityEngine.Object)spellbook1.Blueprint.SpellsKnown != (UnityEngine.Object)null)
                {
                    for (int index = 0; index <= 10; ++index)
                    {
                        BlueprintSpellsTable spellsKnown = spellbook1.Blueprint.SpellsKnown;
                        int?count = spellsKnown.GetCount(casterLevelBefore, index);
                        int num1  = count ?? 0;
                        count = spellsKnown.GetCount(casterLevelAfter, index);
                        int num2 = count ?? 0;
                        spellSelectionData.SetLevelSpells(index, Math.Max(0, num2 - num1));
                    }
                }
                int maxSpellLevel = spellbook1.MaxSpellLevel;

                if (spellbook1.Blueprint.SpellsPerLevel > 0)
                {
                    if (casterLevelBefore == 0)
                    {
                        spellSelectionData.SetExtraSpells(0, maxSpellLevel);
                        spellSelectionData.ExtraByStat = true;
                        spellSelectionData.UpdateMaxLevelSpells(unit);
                    }
                    else
                    {
                        spellSelectionData.SetExtraSpells(spellbook1.Blueprint.SpellsPerLevel, maxSpellLevel);
                    }
                }
                foreach (AddCustomSpells component2 in spellbook1.Blueprint.GetComponents <AddCustomSpells>())
                {
                    ApplySpellbook.TryApplyCustomSpells(spellbook1, component2, state, unit);
                }
                return(true);
            }