Exemplo n.º 1
0
        internal static BlueprintBuff CreateBuffForAbility(BlueprintBuff realBuff, String assetId,
                                                           BlueprintAbilityResource resource, DurationRate duration,
                                                           bool dispellable = true, bool removeWhenTurnedOff = false)
        {
            // Clone the real buff, but remove its functionality and UI.
            var clonedBuff = UnityEngine.Object.Instantiate(realBuff);

            clonedBuff.name = $"{realBuff.name}ResourceBuff";
            Main.library.AddAsset(clonedBuff, Helpers.MergeIds(realBuff.AssetGuid, assetId));
            var flags = realBuff.GetBuffFlags();

            clonedBuff.SetBuffFlags(flags | BuffFlags.HiddenInUi);
            clonedBuff.FxOnStart  = new PrefabLink();
            clonedBuff.FxOnRemove = new PrefabLink();

            var logic = Helpers.Create <LingeringBuffLogic>();

            logic.RequiredResource    = resource;
            logic.BuffDuration        = duration;
            logic.RealBuff            = realBuff;
            logic.Dispellable         = dispellable;
            logic.RemoveWhenTurnedOff = removeWhenTurnedOff;

            clonedBuff.SetComponents(logic);
            return(clonedBuff);
        }
Exemplo n.º 2
0
        static public BlueprintFeature Create()
        {
            if (library.BlueprintsByAssetId.ContainsKey("b04d23c4d4f14d431d316063db884fe5"))
            {
                return(library.Get <BlueprintFeature>("b04d23c4d4f14d431d316063db884fe5"));
            }
            var variants = new List <BlueprintAbility>();

            buffDict = new Dictionary <Pair <int, int>, BlueprintBuff>();
            flagBuff = Helpers.CreateBuff("ArcanistClassSponMetamagicFlagBuff", "", "",
                                          OtherUtils.GetMd5("ArcanistClassSponMetamagicFlagBuff"), null, null);
            flagBuff.SetBuffFlags(flagBuff.GetBuffFlags() | BuffFlags.HiddenInUi);

            //make metamagics other than heighten
            foreach (var kv in MetaFeats.dict)
            {
                Metamagic        metaId   = (Metamagic)(kv.Key);
                BlueprintFeature metaFeat = library.Get <BlueprintFeature>(kv.Value);
                if (metaId == Metamagic.Heighten)
                {
                    continue;
                }
                RealMetamagicOnNextSpell comp = Helpers.Create <RealMetamagicOnNextSpell>();
                comp.metamagic = metaId;
                var buff_i = Helpers.CreateBuff($"ArcanistClassSponMetamagic{metaId}SubBuff", "", "",
                                                OtherUtils.GetMd5($"ArcanistClassSponMetamagic{metaId}SubBuff"),
                                                metaFeat.Icon, null, comp);
                buff_i.SetName(metaFeat.GetName());
                buff_i.SetDescription(metaFeat.GetDescription());

                var ablEffectComp       = Helpers.Create <AbilityEffectRunAction>();
                var ablEffectCompAction = Helpers.Create <ContextActionApplyBuff>();
                ablEffectCompAction.Buff            = buff_i;
                ablEffectCompAction.Permanent       = false;
                ablEffectCompAction.DurationValue   = PresetDurations.oneRound;
                ablEffectCompAction.IsFromSpell     = false;
                ablEffectCompAction.IsNotDispelable = false;
                ablEffectCompAction.ToCaster        = false;
                ablEffectCompAction.AsChild         = true;
                ablEffectComp.Actions = new ActionList {
                    Actions = new GameAction[] { null, ablEffectCompAction }
                };

                var ablRequirementComp = Helpers.Create <AbilityRequirementFeature>();
                ablRequirementComp.Feat = metaFeat;
                ablRequirementComp.Not  = false;

                var abl_i = Helpers.CreateAbility($"ArcanistClassSponMetamagic{metaId}SubAbl", "", "",
                                                  OtherUtils.GetMd5($"ArcanistClassSponMetamagic{metaId}SubAbl"),
                                                  metaFeat.Icon,
                                                  AbilityType.Special,
                                                  UnitCommand.CommandType.Free,
                                                  AbilityRange.Personal,
                                                  "", "",
                                                  ablEffectComp, ablRequirementComp);
                abl_i.SetName(metaFeat.GetName());
                abl_i.SetDescription(metaFeat.GetDescription());
                abl_i.LocalizedDuration    = Helpers.CreateString("ArcaneTide.OneRound");
                abl_i.LocalizedSavingThrow = Helpers.CreateString("ArcaneTide.WillSave.NoHarm");

                variants.Add(abl_i);
                buffDict[OtherUtils.make_pair <int, int>((int)metaId, 0)] = buff_i;
            }


            var abl = Helpers.CreateAbility("ArcanistClassSponMetamagicAbl", "", "",
                                            "d4abbfad4a4cd0eadde062132945f7bf",//MD5-32[ArcanistClass.SponMetamagic.Abl]
                                            IconSet.metamagic,
                                            AbilityType.Special,
                                            UnitCommand.CommandType.Free,
                                            AbilityRange.Personal,
                                            "", "");

            abl.SetName(Helpers.CreateString("ArcanistClass.SponMetamagic.Abl.Name"));
            abl.SetDescription(Helpers.CreateString("ArcanistClass.SponMetamagic.Abl.Desc"));
            abl.LocalizedDuration    = Helpers.CreateString("ArcaneTide.OneRound");
            abl.LocalizedSavingThrow = Helpers.CreateString("ArcaneTide.WillSave.NoHarm");
            abl.AddComponent(Helpers.CreateAbilityVariants(abl, variants));

            var ablHeighten = CreateHeighten();

            feat = Helpers.CreateFeature("ArcanistClassSponMetamagicFeat", "", "",
                                         "b04d23c4d4f14d431d316063db884fe5",//MD5-32[ArcanistClass.SponMetamagic.Feat]
                                         null,
                                         FeatureGroup.None,
                                         Helpers.Create <AddFacts>(a => a.Facts = new BlueprintUnitFact[] { abl, ablHeighten }));
            feat.HideInUI = true;
            return(feat);
        }