예제 #1
0
        static void AddSpellShortcutsFor(Character player, KnownSpell knownSpell)
        {
            List <PlayerActionShortcut> lastShortcuts = null;
            List <ItemEffect>           spellEffects  = AllSpellEffects.GetAll(knownSpell.SpellName).OrderBy(x => x.index).ToList();

            if (spellEffects.Count == 0)
            {
                lastShortcuts = PlayerActionShortcut.FromItemSpellEffect(knownSpell.SpellName, null, player);
            }
            else
            {
                for (int i = 0; i < spellEffects.Count; i++)
                {
                    ItemEffect itemEffect = spellEffects[i];
                    if (i == 0)
                    {
                        lastShortcuts = PlayerActionShortcut.FromItemSpellEffect(knownSpell.SpellName, itemEffect, player);
                    }
                    else
                    {
                        foreach (PlayerActionShortcut playerActionShortcut in lastShortcuts)
                        {
                            playerActionShortcut.Windups.Add(WindupDto.FromItemEffect(itemEffect, playerActionShortcut.Name));
                        }
                    }
                }
            }
            if (lastShortcuts != null)
            {
                AllShortcuts.AddRange(lastShortcuts);
            }
        }
예제 #2
0
        public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Creature player, Target target, CastedSpell spell, DiceStoppedRollingData dice = null)
        {
            if (target == null)
            {
                return(null);
            }
            ExpectingArguments(args, 1, 8);              // up to seven optional parameters of any data type.

            string spellName = Expressions.GetStr(args[0], player, target, spell);
            object data1     = null;
            object data2     = null;
            object data3     = null;
            object data4     = null;
            object data5     = null;
            object data6     = null;
            object data7     = null;

            if (args.Count > 1)
            {
                data1 = Expressions.Get(args[1], player, target, spell);
            }
            if (args.Count > 2)
            {
                data2 = Expressions.Get(args[2], player, target, spell);
            }
            if (args.Count > 3)
            {
                data3 = Expressions.Get(args[3], player, target, spell);
            }
            if (args.Count > 4)
            {
                data4 = Expressions.Get(args[4], player, target, spell);
            }
            if (args.Count > 5)
            {
                data5 = Expressions.Get(args[5], player, target, spell);
            }
            if (args.Count > 6)
            {
                data6 = Expressions.Get(args[6], player, target, spell);
            }
            if (args.Count > 7)
            {
                data7 = Expressions.Get(args[7], player, target, spell);
            }

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

            foreach (int playerId in target.PlayerIds)
            {
                Character recipient = player.Game.GetPlayerFromId(playerId);
                if (recipient == null)
                {
                    break;
                }
                KnownSpell knownSpell = new KnownSpell();
                knownSpell.SpellName = spellName;
                knownSpell.Player    = recipient;
                recipient.GiveSpell(knownSpell, data1, data2, data3, data4, data5, data6, data7);
            }

            return(null);
        }