Example #1
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);
        }