예제 #1
0
        public void OnEventAboutToTrigger(RuleCalculateAbilityParams evt)
        {
            UnitDescriptor unit = evt.AbilityData != null ? evt.AbilityData.Caster : null;

            if (unit != null && evt.Spell != null && evt.Spellbook != null && evt.Spell.Type == AbilityType.Spell)
            {
                if (metamagic == Metamagic.Heighten && HeightenTarget > evt.SpellLevel)
                {
                    int metamagicCost = MetamagicHelper.DefaultCost(metamagic);
                    if (metamagic == Metamagic.Heighten)
                    {
                        metamagicCost += (HeightenTarget - evt.SpellLevel);
                    }
                    if (unit.Resources.GetResourceAmount(ArcaneReservoir.resource) < metamagicCost)
                    {
                        if (this.ShallRemove)
                        {
                            base.Buff.Remove();
                        }
                    }
                    unit.Resources.Spend(ArcaneReservoir.resource, metamagicCost);

                    evt.AddMetamagic(this.metamagic);
                    if (this.metamagic == Metamagic.Heighten)
                    {
                        MetamagicData md = metamagicData_Getter(evt) as MetamagicData;
                        md.HeightenLevel = (HeightenTarget - evt.SpellLevel >= md.HeightenLevel ? HeightenTarget - evt.SpellLevel : md.HeightenLevel);
                    }
                    if (this.ShallRemove)
                    {
                        base.Buff.Remove();
                    }
                }
            }
        }
예제 #2
0
        static public bool Prefix(AbilityData __instance, ref bool __result)
        {
            bool result;

            if (__instance.ActionType == UnitCommand.CommandType.Standard)
            {
                Spellbook spellbook            = __instance.Spellbook;
                bool?     isSpontaneous        = (spellbook != null) ? new bool?(spellbook.Blueprint.Spontaneous) : null;
                bool?     isArcanist           = (spellbook != null) ? new bool?(spellbook.Blueprint.CharacterClass == ArcanistClass.arcanist) : null;
                bool?     isUsingSponMetamagic = (spellbook != null) ? new bool?(spellbook.Owner.HasFact(SponMetamagic.flagBuff)) : null;
                //UnityModManager.Logger.Log($"spontaneous  = {(isSpontaneous!=null ? (isSpontaneous.Value?"T":"F") : "null")}");
                //UnityModManager.Logger.Log($"arcanist  = {(isArcanist != null ? (isArcanist.Value ? "T" : "F") : "null")}");
                //UnityModManager.Logger.Log($"sponmeta  = {(isUsingSponMetamagic != null ? (isUsingSponMetamagic.Value ? "T" : "F") : "null")}");
                if (isSpontaneous != null && isSpontaneous.Value)
                {
                    MetamagicData metamagicData = __instance.MetamagicData;
                    bool?         flag2         = (metamagicData != null) ? new bool?(metamagicData.NotEmpty) : null;
                    if (flag2 != null && flag2.Value)
                    {
                        __result = !(isArcanist.Value && !(isUsingSponMetamagic.Value));
                        if (isUsingSponMetamagic.Value)
                        {
                            spellbook.Owner.RemoveFact(SponMetamagic.flagBuff);
                        }
                        return(false);
                    }
                }
                __result = __instance.Blueprint.IsFullRoundAction;
                return(false);
            }
            else
            {
                __result = false;
                return(false);
            }
        }