public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Creature player, Target target, CastedSpell spell, RollResults dice = null)
        {
            ExpectingArguments(args, 2);

            string propertyName = Expressions.GetStr(args[0], player, target, spell, dice);
            double deltaValue   = Expressions.GetDouble(args[1], player, target, spell, dice);

            if (target == null)
            {
                // Make sure this Spell has values in the MinTargetsToCast and MaxTargetsToCast columns.
                System.Diagnostics.Debugger.Break();
                return(null);
            }

            foreach (Creature creature in target.Creatures)
            {
                OnRequestPropertyChange(creature, propertyName, deltaValue);
            }

            if (player != null)
            {
                foreach (int playerId in target.PlayerIds)
                {
                    Character playerFromId = player.Game.GetPlayerFromId(playerId);
                    if (playerFromId != null)
                    {
                        OnRequestPropertyChange(playerFromId, propertyName, deltaValue);
                    }
                }
            }


            return(null);
        }
Esempio n. 2
0
        public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Creature player, Target target, CastedSpell spell, DiceStoppedRollingData dice = null)
        {
            ExpectingArguments(args, 1);
            double value = Expressions.GetDouble(args[0], player, target, spell);

            return(Math.Floor(value / 2.0));
        }
        public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Creature player, Target target, CastedSpell spell, RollResults 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, 2, 3);
            string propertyName = string.Empty;

            if (args[0] is string)
            {
                propertyName = args[0];
            }
            double offset     = Expressions.GetDouble(args[1], player, target, spell);
            double multiplier = 1;

            if (args.Count == 3)
            {
                multiplier = Expressions.GetDouble(args[2], player, target, spell);
            }

            recipient.Creature.AddPropertyMod(propertyName, recipient.ID, offset, multiplier);
            return(null);
        }
        public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Creature player, Target target = null, CastedSpell spell = null, RollResults dice = null)
        {
            ExpectingArguments(args, 2);
            if (player != null)
            {
                double targetScale = Expressions.GetDouble(args[0], player, target, spell) / 100.0;
                double timeMs      = Expressions.GetDouble(args[1], player, target, spell);
                OnRequestLiveFeedResize(null, new LiveFeedEventArgs(player, targetScale, timeMs));
            }

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

            string sceneName = evaluator.Evaluate <string>(args[0]);
            double delaySec  = 0;
            double returnSec = 0;

            if (args.Count > 1)
            {
                delaySec = Expressions.GetDouble(args[1]);
                if (args.Count > 2)
                {
                    returnSec = Expressions.GetDouble(args[2]);
                }
            }

            OnRequestPlayScene(sceneName, delaySec, returnSec);

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

            SelectMonsterEventArgs ea = new SelectMonsterEventArgs(player);

            if (args.Count > 0)
            {
                ea.CreatureKindFilter = DndUtils.ToCreatureKind(args[0]);
                if (args.Count > 1)
                {
                    ea.MaxChallengeRating = Expressions.GetDouble(args[1], player, target, spell);
                    if (args.Count > 2)
                    {
                        string speedLimitations = Expressions.GetStr(args[2], player, target, spell);
                        if (speedLimitations != null)
                        {
                            string[] limitations = speedLimitations.Split(',');
                            foreach (string limitation in limitations)
                            {
                                switch (limitation.Trim())
                                {
                                case "flying":
                                    ea.MaxFlyingSpeed = 0;
                                    break;

                                case "swimming":
                                    ea.MaxSwimmingSpeed = 0;
                                    break;
                                }
                            }
                        }
                    }
                }
            }

            OnRequestSelectMonster(ea);

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

            string sourceName = evaluator.Evaluate <string>(args[0]);
            string sceneName  = null;
            double delaySec   = 0;
            bool   visible;

            visible = Expressions.GetBool(args[1]);
            if (args.Count > 2)
            {
                delaySec = Expressions.GetDouble(args[2].Trim());
                if (args.Count > 3)
                {
                    sceneName = evaluator.Evaluate <string>(args[3]);
                }
            }

            OnRequestSetObsSourceVisibility(sceneName, sourceName, visible, delaySec);

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

            string sceneName = evaluator.Evaluate <string>(args[0]);

            sceneName = DndUtils.GetRandomSceneIfNecessary(sceneName);

            double delaySec  = 0;
            double returnSec = 0;

            if (args.Count > 1)
            {
                delaySec = Expressions.GetDouble(args[1]);
                if (args.Count > 2)
                {
                    returnSec = Expressions.GetDouble(args[2]);
                }
            }

            OnRequestPlayScene(sceneName, delaySec, returnSec);

            return(null);
        }
Esempio n. 9
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);
            }
        }
        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);
            }
        }
        public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Creature player, Target target, CastedSpell spell, RollResults dice = null)
        {
            ExpectingArguments(args, 1, 9);
            if (player == null)
            {
                return(null);
            }

            string spellId;

            if (spell == null)
            {
                spellId = Guid.NewGuid().ToString();
            }
            else
            {
                spellId = spell.ID;
            }

            string         effectName        = Expressions.GetStr(args[0]);
            float          lifeTime          = 0;
            float          secondsDelayStart = 0;
            float          enlargeTime       = 0;
            float          shrinkTime        = 0;
            float          rotation          = 0;
            float          wallLength        = 0;
            float          distanceBetweenWallEffectsFeet = 2.5f;
            EffectLocation effectLocation = EffectLocation.CreatureBase;

            if (args.Count > 1)
            {
                lifeTime = (float)Expressions.GetDouble(args[1]);
                if (args.Count > 2)
                {
                    effectLocation = Expressions.Get <EffectLocation>(args[2]);
                    if (args.Count > 3)
                    {
                        secondsDelayStart = Expressions.GetFloat(args[3]);
                        if (args.Count > 4)
                        {
                            enlargeTime = Expressions.GetFloat(args[4]);
                            if (args.Count > 5)
                            {
                                shrinkTime = Expressions.GetFloat(args[5]);
                                if (args.Count > 6)
                                {
                                    rotation = Expressions.GetFloat(args[6]);
                                    if (args.Count > 7)
                                    {
                                        wallLength = Expressions.GetFloat(args[7]);
                                        if (args.Count > 8)
                                        {
                                            distanceBetweenWallEffectsFeet = Expressions.GetFloat(args[8]);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            OnPlayKnownEffect(effectName, spellId, player.taleSpireId, lifeTime, effectLocation, secondsDelayStart, enlargeTime, shrinkTime, rotation, wallLength, distanceBetweenWallEffectsFeet);

            return(null);
        }