コード例 #1
0
        public bool ShouldActivateNow(List <string> args, Character player)
        {
            if (string.IsNullOrWhiteSpace(ActivateWhen))
            {
                return(true);
            }

            return(Expressions.GetBool(DndUtils.InjectParameters(ActivateWhen, Parameters, args), player));
        }
コード例 #2
0
        public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Creature creature, Target target, CastedSpell spell, RollResults dice = null)
        {
            ExpectingArguments(args, 1);

            bool isVisible = Expressions.GetBool(args[0]);

            if (creature != null)
            {
                creature.Visible = isVisible;
            }
            return(null);
        }
コード例 #3
0
        // TODO: Add customData parameter?
        public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Creature player, Target target, CastedSpell spell, RollResults dice = null)
        {
            ExpectingArguments(args, 1, 2);

            string shortcutName    = evaluator.Evaluate <string>(args[0]);
            bool   rollImmediately = false;

            if (args.Count > 1)
            {
                rollImmediately = Expressions.GetBool(args[1], player, target, spell, dice);
            }

            player.AddShortcutToQueue(shortcutName, rollImmediately);

            return(null);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Character player, Target target, CastedSpell spell, DiceStoppedRollingData dice = null)
        {
            ExpectingArguments(args, 0, 1);
            bool showXamlUI = true;

            if (args.Count > 0)
            {
                showXamlUI = Expressions.GetBool(args[0], player, target, spell, dice);
            }
            TargetEventArgs ea = new TargetEventArgs();

            ea.Player     = player;
            ea.Target     = target;
            ea.ShowXamlUI = showXamlUI;
            OnRequestSelectTarget(ea);

            return(ea.Target);
        }
コード例 #6
0
        public List <WindupDto> GetAvailableWindups(Character player)
        {
            List <WindupDto> result = new List <WindupDto>();
            int index = 0;

            foreach (WindupDto windup in Windups)
            {
                if (windup != null)
                {
                    if (string.IsNullOrWhiteSpace(windup.EffectAvailableWhen) || Expressions.GetBool(windup.EffectAvailableWhen, player))
                    {
                        WindupDto item = windup.Clone();
                        if (CarriedWeapon != null)
                        {
                            switch (index)
                            {
                            case 0:
                                SetHueFromStr(item, player, CarriedWeapon.WeaponHue);
                                break;

                            case 1:
                                SetHueFromStr(item, player, CarriedWeapon.Hue1);
                                break;

                            case 2:
                                SetHueFromStr(item, player, CarriedWeapon.Hue2);
                                break;

                            case 3:
                                SetHueFromStr(item, player, CarriedWeapon.Hue3);
                                break;
                            }
                        }
                        result.Add(item);
                    }
                }
                index++;
            }
            return(result);
        }
コード例 #7
0
        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);
        }
コード例 #8
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);
            }
        }