Exemple #1
0
        static void LoadFly(BlueprintBuff airWalkBuff)
        {
            var wings = wingBuffs.Value;
            // Wings all have the generic wing icon, which is fine, but bloodline icons are nicer.
            var wingToIcon = new Dictionary <BlueprintBuff, Sprite>();

            foreach (var bloodline in Helpers.bloodlineSelection.AllFeatures.OfType <BlueprintProgression>())
            {
                foreach (var feat in bloodline.GetLevelEntry(15).Features)
                {
                    var addFacts = feat.GetComponent <AddFacts>();
                    if (addFacts == null)
                    {
                        continue;
                    }
                    var ability = addFacts.Facts.OfType <BlueprintActivatableAbility>()
                                  .FirstOrDefault(a => wings.Contains(a.Buff));
                    if (ability != null)
                    {
                        wingToIcon.Add(ability.Buff, bloodline.Icon);
                        break;
                    }
                }
            }

            var variants = new List <(BlueprintAbility, BlueprintAbility, BlueprintBuff)>();

            foreach (var wing in wings)
            {
                var name = wing.name.Replace("BuffWings", "");
                if (name.StartsWith("Draconic"))
                {
                    name = $"{name.Replace("Draconic", "")} Dragon";
                }
                variants.Add(CreateFly(wing, name, wingToIcon[wing], airWalkBuff));
            }

            var flyBuffs = variants.Select(v => v.Item3).ToArray();

            foreach (var variant in variants)
            {
                // Overland flight needs to suppress all Fly buffs.
                variant.Item2.AddComponent(Helpers.CreateSuppressBuffs(flyBuffs));
            }

            var fly = library.CopyAndAdd(variants[0].Item1, "FlySpell", "20ab2cd848c04d46882625e696c921bf");

            fly.SetName(lc.GetTranslate("spFlyName"));
            fly.SetComponents(
                SpellSchool.Transmutation.CreateSpellComponent(),
                Helpers.CreateSpellDescriptor(),
                fly.CreateAbilityVariants(variants.Select(v => v.Item1)));
            fly.AvailableMetamagic = Metamagic.Quicken | Metamagic.Extend | Metamagic.Heighten;
            fly.AddToSpellList(Helpers.wizardSpellList, 3);
            fly.AddToSpellList(Helpers.magusSpellList, 3);
            fly.AddToSpellList(Helpers.alchemistSpellList, 3);
            Helpers.AddSpellAndScroll(fly, "8f1956fa46b122b4f86c1ce383ad8af7", 0); // scroll righteous might
            FlySpells.flySpell = fly;

            // Fix Draconic bloodline to use Fly as the 3rd level choice.
            WishSpells.FixBloodlineSpell(fly, "7bd143ead2d6c3a409aad6ee22effe34", "606cdd9198fb270429ab6dce1a6b14f1");
            // Fix Travel domain to use Fly for the 3rd level spell.
            fly.FixDomainSpell(3, "ab90308db82342f47bf0d636fe941434");

            var overlandFlight = library.CopyAndAdd(variants[0].Item2, "OverlandFlight", "8b5ea075097e4c7e999266b7569ee39d");

            overlandFlight.SetName(lc.GetTranslate("spOverlandFlightName"));
            overlandFlight.SetComponents(
                SpellSchool.Transmutation.CreateSpellComponent(),
                Helpers.CreateSpellDescriptor(),
                overlandFlight.CreateAbilityVariants(variants.Select(v => v.Item2)));
            overlandFlight.AvailableMetamagic = Metamagic.Extend | Metamagic.Quicken | Metamagic.Heighten;
            overlandFlight.AddToSpellList(Helpers.wizardSpellList, 5);
            overlandFlight.AddToSpellList(Helpers.magusSpellList, 5);
            overlandFlight.AddToSpellList(Helpers.alchemistSpellList, 5);
            Helpers.AddSpellAndScroll(overlandFlight, "8f1956fa46b122b4f86c1ce383ad8af7", 0); // scroll righteous might
            FlySpells.overlandFlight = overlandFlight;
        }
        static void LoadFly(BlueprintBuff airWalkBuff)
        {
            var wings = wingBuffs.Value;
            // Wings all have the generic wing icon, which is fine, but bloodline icons are nicer.
            var wingToIcon = new Dictionary <BlueprintBuff, Sprite>();

            foreach (var bloodline in Helpers.bloodlineSelection.AllFeatures.OfType <BlueprintProgression>())
            {
                foreach (var feat in bloodline.GetLevelEntry(15).Features)
                {
                    var addFacts = feat.GetComponent <AddFacts>();
                    if (addFacts == null)
                    {
                        continue;
                    }
                    var ability = addFacts.Facts.OfType <BlueprintActivatableAbility>()
                                  .FirstOrDefault(a => wings.Contains(a.Buff));
                    if (ability != null)
                    {
                        wingToIcon.Add(ability.Buff, bloodline.Icon);
                        break;
                    }
                }
            }

            // Wings' name for localization
            var dictLocalWingName = new Dictionary <string, string> {
                { "BuffWingsAngel", RES.FlyWingAngelName_info },                      // angel
                { "BuffWingsDemon", RES.FlyWingDemonName_info },                      // demon
                { "BuffWingsDevil", RES.FlyWingDevilName_info },                      // devil
                { "BuffWingsDraconicBlack", RES.FlyWingDraconicBlackName_info },      // black dragon
                { "BuffWingsDraconicBlue", RES.FlyWingDraconicBlueName_info },        // blue dragon
                { "BuffWingsDraconicBrass", RES.FlyWingDraconicBrassName_info },      // brass
                { "BuffWingsDraconicBronze", RES.FlyWingDraconicBronzeName_info },    // bronze
                { "BuffWingsDraconicCopper", RES.FlyWingDraconicCopperName_info },    // copper
                { "BuffWingsDraconicGold", RES.FlyWingDraconicGoldName_info },        // gold
                { "BuffWingsDraconicGreen", RES.FlyWingDraconicGreenName_info },      // green
                { "BuffWingsDraconicRed", RES.FlyWingDraconicRedName_info },          // red
                { "BuffWingsDraconicSilver", RES.FlyWingDraconicSilverName_info },    // silver
                { "BuffWingsDraconicWhite", RES.FlyWingDraconicWhiteName_info }       // white
            };

            var variants = new List <FlySpellInfo>();

            foreach (var wing in wings)
            {
                // var name = wing.name.Replace("BuffWings", "");
                // if (name.StartsWith("Draconic")) name = $"{name.Replace("Draconic", "")} Dragon";
                variants.Add(CreateFly(wing, dictLocalWingName[wing.name], wingToIcon[wing]));
            }

            // Each Fly variant needs to suppress wing buffs, air walk, and previous fly buffs
            var suppressBuffs = wingBuffs.Value.ToList();

            suppressBuffs.Add(airWalkBuff);
            foreach (var variant in variants)
            {
                variant.FlyBuff.AddComponent(Helpers.CreateSuppressBuffs(suppressBuffs));
                suppressBuffs.Add(variant.FlyBuff);
            }
            // Each Overland flight variant needs to suppress all the buffs Fly suppresses,
            // all fly buffs, and previous overland flight buffs.
            foreach (var variant in variants)
            {
                variant.OverlandFlightBuff.AddComponent(Helpers.CreateSuppressBuffs(suppressBuffs));
                suppressBuffs.Add(variant.OverlandFlightBuff);
            }

            var fly = library.CopyAndAdd(variants[0].Fly, "FlySpell", "20ab2cd848c04d46882625e696c921bf");

            fly.SetName(RES.FlySpellName_info);
            fly.SetComponents(
                SpellSchool.Transmutation.CreateSpellComponent(),
                Helpers.CreateSpellDescriptor(),
                fly.CreateAbilityVariants(variants.Select(v => v.Fly)));
            fly.EffectOnAlly       = AbilityEffectOnUnit.Helpful;
            fly.AvailableMetamagic = Metamagic.Quicken | Metamagic.Extend | Metamagic.Heighten;
            fly.AddToSpellList(Helpers.wizardSpellList, 3);
            fly.AddToSpellList(Helpers.magusSpellList, 3);
            fly.AddToSpellList(Helpers.alchemistSpellList, 3);
            Helpers.AddSpellAndScroll(fly, "8f1956fa46b122b4f86c1ce383ad8af7", 0); // scroll righteous might
            FlySpells.flySpell = fly;

            // Fix Draconic bloodline to use Fly as the 3rd level choice.
            WishSpells.FixBloodlineSpell(fly, "7bd143ead2d6c3a409aad6ee22effe34", "606cdd9198fb270429ab6dce1a6b14f1");
            // Fix Travel domain to use Fly for the 3rd level spell.
            fly.FixDomainSpell(3, "ab90308db82342f47bf0d636fe941434");

            var overlandFlight = library.CopyAndAdd(variants[0].OverlandFlight, "OverlandFlight", "8b5ea075097e4c7e999266b7569ee39d");

            overlandFlight.SetName(RES.OverlandFlightSpellName_info);
            overlandFlight.SetComponents(
                SpellSchool.Transmutation.CreateSpellComponent(),
                Helpers.CreateSpellDescriptor(),
                overlandFlight.CreateAbilityVariants(variants.Select(v => v.OverlandFlight)));
            overlandFlight.EffectOnAlly       = AbilityEffectOnUnit.Helpful;
            overlandFlight.AvailableMetamagic = Metamagic.Extend | Metamagic.Quicken | Metamagic.Heighten;
            overlandFlight.AddToSpellList(Helpers.wizardSpellList, 5);
            overlandFlight.AddToSpellList(Helpers.magusSpellList, 5);
            overlandFlight.AddToSpellList(Helpers.alchemistSpellList, 5);
            Helpers.AddSpellAndScroll(overlandFlight, "8f1956fa46b122b4f86c1ce383ad8af7", 0); // scroll righteous might
            FlySpells.overlandFlight = overlandFlight;
        }