public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Creature 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 RemovePropertyMod.");
            }

            ExpectingArguments(args, 0);

            recipient.Creature.RemoveVantageMod(recipient.ID);
            return(null);
        }
        public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Character player, Creature target, CastedSpell spell)
        {
            ExpectingArguments(args, 4);

            string tableName   = evaluator.Evaluate <string>(args[0]);
            string fieldLookup = evaluator.Evaluate <string>(args[1]);
            string matchColumn = evaluator.Evaluate <string>(args[2]);
            object matchValue  = evaluator.Evaluate(Expressions.Clean(args[3]));

            return(AllTables.GetData(tableName, fieldLookup, matchColumn, matchValue));
        }
Exemplo n.º 3
0
        public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Character player, Creature target, CastedSpell spell)
        {
            ExpectingArguments(args, 1);

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

            return(player.GetLevel(characterClassName));
        }
        public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Creature player, Target target, CastedSpell spell, RollResults dice = null)
        {
            if (target == null)
            {
                return(null);
            }
            ExpectingArguments(args, 1);
            string spellName = args[0];

            if (target == null || player.Game == null)
            {
                return(null);
            }

            foreach (int playerId in target.PlayerIds)
            {
                Character recipient = player.Game.GetPlayerFromId(playerId);
                if (recipient != null)
                {
                    recipient.TakeSpell(spellName);
                }
            }

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

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

            player.AddDieRollEffects(dieRollEffects);

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

            if (spell != null)
            {
                spellId = spell.ID;
            }
            else
            {
                CreaturePlusModId creaturePlusModId = Expressions.GetCustomData <CreaturePlusModId>(evaluator.Variables);
                if (creaturePlusModId != null)
                {
                    spellId = creaturePlusModId.Guid;
                }
            }
            float lifeTime        = 0;
            float shrinkTime      = 0;
            float rotationDegrees = 0;

            if (player != null && spellId != null)
            {
                string effectName        = Expressions.GetStr(args[0]);
                float  secondsDelayStart = 0;
                float  enlargeTime       = 0;
                if (args.Count > 1)
                {
                    float.TryParse(args[1], out secondsDelayStart);
                    if (args.Count > 2)
                    {
                        float.TryParse(args[2], out enlargeTime);
                        if (args.Count > 3)
                        {
                            float.TryParse(args[3], out lifeTime);
                            if (args.Count > 4)
                            {
                                float.TryParse(args[4], out shrinkTime);
                                if (args.Count > 5)
                                {
                                    float.TryParse(args[5], out rotationDegrees);
                                }
                            }
                        }
                    }
                }

                OnAttachChargingEffect(effectName, spellId, player.taleSpireId, secondsDelayStart, enlargeTime, lifeTime, shrinkTime, rotationDegrees);
            }

            return(null);
        }
        public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Creature player, Target target, CastedSpell spell, RollResults dice = null)
        {
            ExpectingArguments(args, 2);
            char[] trimChars    = { '"', ' ' };
            string shortcutName = args[1].Trim(trimChars);

            if (player == null)
            {
                return(null);
            }

            PlayerActionShortcut shortcut = AllActionShortcuts.Get(player.IntId, shortcutName).FirstOrDefault();

            if (shortcut == null)
            {
                return(null);
            }

            int delayMs = MathUtils.GetInt(args[0].Trim());

            OnActivateShortcutRequest(player, new ShortcutEventArgs(shortcut, delayMs));
            return(null);
        }
        public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Creature player, Target target, CastedSpell spell, RollResults dice = null)
        {
            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);

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

            player.AddDieRollEffects(dieRollEffects);

            return(null);
        }
Exemplo n.º 10
0
        public static void GetVisualEffectParameters(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 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);
            }
        }
Exemplo n.º 11
0
        public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Creature player, Target target = null, CastedSpell spell = null, RollResults dice = null)
        {
            ExpectingArguments(args, 1, 15);
            if (player != null)
            {
                string effectName;
                int    hue, saturation, brightness, timeOffset, secondaryHue, secondarySaturation, secondaryBrightness, xOffset, yOffset;
                double scale, rotation, autoRotation, velocityX, velocityY;
                GetVisualEffectParameters(args, player, target, spell, out effectName, out hue, out saturation, out brightness, out scale, out rotation, out autoRotation, out timeOffset, out secondaryHue, out secondarySaturation, out secondaryBrightness, out xOffset, out yOffset, out velocityX, out velocityY);

                player.AddSpellCastEffect(effectName, hue, saturation, brightness,
                                          scale, rotation, autoRotation, timeOffset,
                                          secondaryHue, secondarySaturation, secondaryBrightness, xOffset, yOffset, velocityX, velocityY);
            }

            return(null);
        }
Exemplo n.º 12
0
        public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Creature 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, 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);
        }