Example #1
0
        public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Character player, Creature target, CastedSpell spell)
        {
            ExpectingArguments(args, 1);

            Ability ability = (Ability)Expressions.GetInt(args[0], player, target, spell);

            return(player.GetAbilityModifier(ability));
        }
        public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Creature player, Target target, CastedSpell spell, DiceStoppedRollingData dice = null)
        {
            ExpectingArguments(args, 1);

            Ability ability = (Ability)Expressions.GetInt(args[0], player, target, spell);

            return(player.GetAbilityModifier(ability));
        }
Example #3
0
        public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Creature player, Target target, CastedSpell spell, RollResults dice = null)
        {
            ExpectingArguments(args, 3);

            string userName    = Expressions.GetStr(args[0], player, target, spell);
            string chargeName  = Expressions.GetStr(args[1], player, target, spell);
            int    chargeCount = Expressions.GetInt(args[2], player, target, spell);

            OnRequestAddViewerCharge(new RequestAddViewerChargeEventArgs(userName, chargeName, chargeCount));
            return(null);
        }
        public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Creature player, Target target = null, CastedSpell spell = null, RollResults dice = null)
        {
            ExpectingArguments(args, 1);
            TargetEventArgs ea = new TargetEventArgs();

            ea.WhatSide   = WhatSide.Friendly;
            ea.MaxTargets = Expressions.GetInt(args[0], player, target, spell);

            OnRequestTarget(ea);
            SystemVariables.FriendlyTargets = ea.Target;
            return(ea.Target);
        }
        public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Character player, Target target, CastedSpell spell, DiceStoppedRollingData dice = null)
        {
            ExpectingArguments(args, 4);

            string rechargeableName = Expressions.GetStr(args[0], player, target, spell);
            string variableName     = Expressions.GetStr(args[1], player, target, spell);
            int    maxValue         = Expressions.GetInt(args[2], player, target, spell);
            string cycle            = Expressions.GetStr(args[3], player, target, spell);

            player.AddRechargeable(rechargeableName, variableName, maxValue, cycle);

            return(null);
        }
        public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Character player, Target target, CastedSpell spell, DiceStoppedRollingData dice = null)
        {
            ExpectingArguments(args, 3);

            int value = Expressions.GetInt(args[0], player, target, spell);

            if (value == 1)
            {
                return(Expressions.GetStr(args[1], player, target, spell));                     // singular.
            }
            else
            {
                return(Expressions.GetStr(args[2], player, target, spell));                 // plural
            }
        }
        public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Creature player, Target target, CastedSpell spell, RollResults dice = null)
        {
            ExpectingArguments(args, 3, 4);

            string sourceName    = Expressions.GetStr(args[0], player);
            string filterName    = Expressions.GetStr(args[1]);
            bool   filterEnabled = Expressions.GetBool(args[2]);
            int    delayMs       = 0;

            if (args.Count > 3)
            {
                delayMs = Expressions.GetInt(args[3]);
            }

            OnRequestSetObsSceneFilterVisibility(null, new ObsSceneFilterEventArgs(sourceName, filterName, filterEnabled, delayMs));
            return(null);
        }
Example #8
0
        public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Character player, Creature target = null, CastedSpell spell = null)
        {
            ExpectingArguments(args, 1, 2);
            if (player != null)
            {
                int hue        = Expressions.GetInt(args[0], player, target, spell);
                int brightness = 100;
                if (args.Count == 2)
                {
                    brightness = Expressions.GetInt(args[1], player, target, spell);
                }

                player.AddSpellEffect(hue, brightness);
            }

            return(null);
        }
        public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Character player, Target target = null, CastedSpell spell = null, DiceStoppedRollingData dice = null)
        {
            ExpectingArguments(args, 1, 2);
            if (player != null)
            {
                string fileName = Expressions.GetStr(args[0], player, target, spell);

                int timeOffsetMs = 0;
                if (args.Count > 1)
                {
                    timeOffsetMs = Expressions.GetInt(args[1], player, target, spell);
                }

                player.AddSpellCastSoundEffect(fileName, timeOffsetMs);
            }

            return(null);
        }
Example #10
0
        public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Creature creature, Target target, CastedSpell spell, RollResults dice = null)
        {
            ExpectingArguments(args, 3);
            string timerName       = Expressions.GetStr(args[0], creature, target, spell);
            int    durationSeconds = Expressions.GetInt(args[1], creature, target, spell);
            string functionToCall  = Expressions.GetStr(args[2], creature, target, spell);

            if (creature == null)
            {
                return(null);
            }
            if (creature.Game == null)
            {
                return(null);
            }
            DndAlarm dndAlarm = creature.Game.Clock.CreateAlarm(TimeSpan.FromSeconds(durationSeconds), timerName, creature, functionToCall);

            dndAlarm.AlarmFired += DndAlarm_AlarmFired;
            return(null);
        }
        public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Character player, Target target, CastedSpell spell, DiceStoppedRollingData dice = null)
        {
            ExpectingArguments(args, 3);
            string timerName       = Expressions.GetStr(args[0], player, target, spell);
            int    durationSeconds = Expressions.GetInt(args[1], player, target, spell);
            string functionToCall  = Expressions.GetStr(args[2], player, target, spell);

            if (player == null)
            {
                return(null);
            }
            if (player.Game == null)
            {
                return(null);
            }
            DndAlarm dndAlarm = player.Game.Clock.CreateAlarm(TimeSpan.FromSeconds(durationSeconds), timerName, player, functionToCall);

            dndAlarm.AlarmFired += DndAlarm_AlarmFired;
            return(null);
        }
Example #12
0
        public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Creature player, Target target = null, CastedSpell spell = null, DiceStoppedRollingData dice = null)
        {
            ExpectingArguments(args, 1, 4);
            string fillColor    = "player";
            string outlineColor = "player";
            int    delayMs      = 0;

            if (args.Count > 1)
            {
                fillColor = args[1].Trim();
                if (args.Count > 2)
                {
                    outlineColor = args[2].Trim();
                    if (args.Count > 3)
                    {
                        delayMs = Expressions.GetInt(args[3], player, target, spell, dice);
                    }
                }
            }

            CreaturePlusModId recipient = Expressions.GetCustomData <CreaturePlusModId>(evaluator.Variables);

            if (recipient != null && recipient.Creature is Character recipientPlayer)
            {
                recipientPlayer.ShowState(Expressions.GetStr(args[0], player, target, spell), fillColor, outlineColor, delayMs);
            }
            else if (player != null)
            {
                player.ShowState(Expressions.GetStr(args[0], player, target, spell), fillColor, outlineColor, delayMs);
            }
            else if (recipient.Creature != null)
            {
                recipient.Creature.ShowState(Expressions.GetStr(args[0], player, target, spell), fillColor, outlineColor, delayMs);
                // TODO: Implement FloatCreatureText
                //FloatCreatureText(recipient.Creature, args[0]);
            }
            return(null);
        }
Example #13
0
        public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Character player, Target target, CastedSpell spell, DiceStoppedRollingData dice = null)
        {
            CreaturePlusModId recipient = Expressions.GetCustomData <CreaturePlusModId>(evaluator.Variables);

            if (recipient == null)
            {
                throw new Exception($"CreaturePlusModId recipient must be specified before evaluating expressions containing AddPropertyMod.");
            }

            ExpectingArguments(args, 4);
            DiceRollType rollType = Expressions.Get <DiceRollType>(args[0], player, target, spell);
            Skills       skills   = Expressions.Get <Skills>(args[1].Trim(), player, target, spell);
            string       dieLabel = args[2].Trim();

            if (dieLabel.StartsWith("\""))
            {
                dieLabel = Expressions.GetStr(dieLabel, player, target, spell);
            }
            int vantageOffset = Expressions.GetInt(args[3], player, target, spell);

            recipient.Creature.AddVantageMod(recipient.ID, rollType, skills, dieLabel, vantageOffset);
            return(null);
        }
        public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Creature creature, Target target, CastedSpell spell, DiceStoppedRollingData dice = null)
        {
            ExpectingArguments(args, 1, 3);
            TargetStatus targetStatus = Expressions.Get <TargetStatus>(args[0], creature, target, spell, dice);

            ea = new TargetEventArgs();
            if (args.Count > 1)
            {
                ea.MinTargets = Expressions.GetInt(args[1], creature, target, spell, dice);
                if (args.Count > 2)
                {
                    ea.MaxTargets = Expressions.GetInt(args[2], creature, target, spell, dice);
                }
            }

            ea.Player = creature as Character;
            ea.Target = target;

            ea.ShowUI       = true;
            ea.TargetStatus = targetStatus;
            OnRequestSelectTarget(ea);
            return(ea.Target);
        }
Example #15
0
        public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Creature player, Target target = null, CastedSpell spell = null, RollResults dice = null)
        {
            ExpectingArguments(args, 1, 3);
            if (player != null)
            {
                int hue = Expressions.GetInt(args[0], player, target, spell);

                int saturation = 100;
                if (args.Count == 2)
                {
                    saturation = Expressions.GetInt(args[1], player, target, spell);
                }

                int brightness = 100;
                if (args.Count == 3)
                {
                    brightness = Expressions.GetInt(args[2], player, target, spell);
                }

                player.AddSpellHitEffect(hue: hue, saturation: saturation, brightness: brightness);
            }

            return(null);
        }
        public static void GetVisualEffectParameters(List <string> args, Character player, Target target, CastedSpell spell, out string effectName, out int hue, out int saturation, out int brightness, out double scale, out double rotation, out double autoRotation, out int timeOffset, out int secondaryHue, out int secondarySaturation, out int secondaryBrightness, out int xOffset, out int yOffset, out double velocityX, out double velocityY)
        {
            effectName = Expressions.GetStr(args[0], player, target, spell);
            hue        = 0;
            if (args.Count > 1)
            {
                if (args[1].Trim() == "player" && player != null)
                {
                    hue = player.hueShift;
                }
                else
                {
                    hue = Expressions.GetInt(args[1], player, target, spell);
                }
            }

            saturation = 100;
            if (args.Count > 2)
            {
                saturation = Expressions.GetInt(args[2], player, target, spell);
            }

            brightness = 100;
            if (args.Count > 3)
            {
                brightness = Expressions.GetInt(args[3], player, target, spell);
            }

            scale = 1;
            if (args.Count > 4)
            {
                scale = Expressions.GetDouble(args[4], player, target, spell);
            }

            rotation = 0;
            if (args.Count > 5)
            {
                rotation = Expressions.GetDouble(args[5], player, target, spell);
            }


            autoRotation = 0;
            if (args.Count > 6)
            {
                autoRotation = Expressions.GetDouble(args[6], player, target, spell);
            }

            timeOffset = int.MinValue;
            if (args.Count > 7)
            {
                timeOffset = Expressions.GetInt(args[7], player, target, spell);
            }

            secondaryHue = 0;
            if (args.Count > 8)
            {
                if (args[8].Trim() == "player" && player != null)
                {
                    secondaryHue = player.hueShift;
                }
                else
                {
                    secondaryHue = Expressions.GetInt(args[8], player, target, spell);
                }
            }

            secondarySaturation = 100;
            if (args.Count > 9)
            {
                secondarySaturation = Expressions.GetInt(args[9], player, target, spell);
            }

            secondaryBrightness = 100;
            if (args.Count > 10)
            {
                secondaryBrightness = Expressions.GetInt(args[10], player, target, spell);
            }

            xOffset = 0;
            if (args.Count > 11)
            {
                xOffset = Expressions.GetInt(args[11], player, target, spell);
            }

            yOffset = 0;
            if (args.Count > 12)
            {
                yOffset = Expressions.GetInt(args[12], player, target, spell);
            }

            velocityX = 0;
            if (args.Count > 13)
            {
                velocityX = Expressions.GetDouble(args[13], player, target, spell);
            }

            velocityY = 0;
            if (args.Count > 14)
            {
                velocityY = Expressions.GetDouble(args[14], player, target, spell);
            }
        }
Example #17
0
        public static void GetWindupParameters(List <string> args, Creature player, Target target, CastedSpell spell,
                                               out string effectName, out int hue, out int saturation, out int brightness, out double scale,
                                               out double rotation, out double autoRotation, out double degreesOffset, out bool flipHorizontal,
                                               out int xOffset, out int yOffset, out double velocityX, out double velocityY, out double forceX, out double forceY,
                                               out int fadeIn, out int lifespan, out int fadeOut)
        {
            effectName = Expressions.GetStr(args[0], player, target, spell);
            hue        = 0;
            if (args.Count > 1)
            {
                if (args[1].Trim() == "player")
                {
                    hue = player.hueShift;
                }
                else
                {
                    hue = Expressions.GetInt(args[1], player, target, spell);
                }
            }

            saturation = 100;
            if (args.Count > 2)
            {
                saturation = Expressions.GetInt(args[2], player, target, spell);
            }

            brightness = 100;
            if (args.Count > 3)
            {
                brightness = Expressions.GetInt(args[3], player, target, spell);
            }

            scale = 1;
            if (args.Count > 4)
            {
                scale = Expressions.GetDouble(args[4], player, target, spell);
            }

            rotation = 0;
            if (args.Count > 5)
            {
                rotation = Expressions.GetDouble(args[5], player, target, spell);
            }

            autoRotation = 0;
            if (args.Count > 6)
            {
                autoRotation = Expressions.GetDouble(args[6], player, target, spell);
            }

            degreesOffset = 0;
            if (args.Count > 7)
            {
                degreesOffset = Expressions.GetDouble(args[7], player, target, spell);
            }

            flipHorizontal = false;
            if (args.Count > 8)
            {
                flipHorizontal = Expressions.GetBool(args[8], player, target, spell);
            }

            xOffset = 0;
            if (args.Count > 9)
            {
                xOffset = Expressions.GetInt(args[9], player, target, spell);
            }

            yOffset = 0;
            if (args.Count > 10)
            {
                yOffset = Expressions.GetInt(args[10], player, target, spell);
            }

            velocityX = 0;
            if (args.Count > 11)
            {
                velocityX = Expressions.GetDouble(args[11], player, target, spell);
            }

            velocityY = 0;
            if (args.Count > 12)
            {
                velocityY = Expressions.GetDouble(args[12], player, target, spell);
            }

            forceX = 0;
            if (args.Count > 13)
            {
                forceX = Expressions.GetDouble(args[13], player, target, spell);
            }

            forceY = 0;
            if (args.Count > 14)
            {
                forceY = Expressions.GetDouble(args[14], player, target, spell);
            }

            fadeIn = 0;
            if (args.Count > 15)
            {
                fadeIn = Expressions.GetInt(args[15], player, target, spell);
            }

            lifespan = 0;
            if (args.Count > 16)
            {
                lifespan = Expressions.GetInt(args[16], player, target, spell);
            }

            fadeOut = 0;
            if (args.Count > 17)
            {
                fadeOut = Expressions.GetInt(args[17], player, target, spell);
            }
        }