Example #1
0
        // given node is <action.../>
        internal SingleAction(XmlNode node)
        {
            ArrayedTarget a_target = new ArrayedTarget(node);

            if (a_target.Count == 1)
            {
                target = a_target[0];
            }
            else
            {
                target = a_target;
            }

            ArrayedEffect a_effect = new ArrayedEffect(node);

            if (a_effect.Count == 1)
            {
                effect = a_effect[0];
            }
            else
            {
                effect = a_effect;
            }
            XmlNode dsc = node.SelectSingleNode("description");

            if (dsc != null)
            {
                msgTempl = dsc.InnerText;
            }
        }
Example #2
0
        private object Parse(XmlNode node)
        {
            ArrayedTarget array = new ArrayedTarget(node);

            // if single action, regists non-arrayed action object.
            if (array.Count == 1)
            {
                return(array[0]);
            }
            else
            {
                return(array);
            }
        }
Example #3
0
        private object Parse(XmlNode node, RandTableType rtType)
        {
            switch (rtType)
            {
            case RandTableType.ACTION:
                ArrayedAction aArray = new ArrayedAction(node);
                // if single action, regists non-arrayed action object.
                if (aArray.Count == 1)
                {
                    return(aArray[0]);
                }
                else
                {
                    return(aArray);
                }

            case RandTableType.EFFECT:
                ArrayedEffect eArray = new ArrayedEffect(node);
                // if single action, regists non-arrayed action object.
                if (eArray.Count == 1)
                {
                    return(eArray[0]);
                }
                else
                {
                    return(eArray);
                }

            case RandTableType.TARGET:
                ArrayedTarget tArray = new ArrayedTarget(node);
                // if single action, regists non-arrayed action object.
                if (tArray.Count == 1)
                {
                    return(tArray[0]);
                }
                else
                {
                    return(tArray);
                }

            default:
                throw new FormatException("Invalid type attribute in the randomized tag");
                break;
            }
            return(null);
        }