示例#1
0
        public bool UseItem(RandomGenerator random, Character src, List <Character> targets)
        {
            if (targets.Count == 1)
            {
                return(UseItem(random, src, targets.First()));
            }
            if (action == null)
            {
                return(false);
            }
            if (targetType != TargetType.All)
            {
                return(false);
            }

            if (src.items.Contains(this.code) &&
                src.ReduceForAction(0, 0, spNeed) &&
                src.ReduceItem(this.code))
            {
                foreach (Character target in targets)
                {
                    action(random, src, target);
                }
                return(true);
            }

            return(false);
        }
示例#2
0
        public bool UseItem(RandomGenerator random, Character src)
        {
            if (action == null)
            {
                return(false);
            }
            if (targetType != TargetType.None)
            {
                return(false);
            }

            if (src.items.Contains(this.code) &&
                src.ReduceForAction(0, 0, spNeed) &&
                src.ReduceItem(this.code))
            {
                return(action(random, src, null));
            }

            return(false);
        }