예제 #1
0
        public XmlElement ToXml(XmlDocument xmldoc)
        {
            XmlElement xmlelUnit = xmldoc.CreateElement("DefenseUnit");

            xmlelUnit.AppendChild(Cost.ToXml(xmldoc, "Cost"));

            xmlelUnit.AppendChild(RemainingCost.ToXml(xmldoc, "RemainingCost"));

            return(xmlelUnit);
        }
예제 #2
0
        public override bool TryToAddTarget(object target)
        {
            if (!WaitForTarget)
            {
                if (RemainingCost != null)
                {
                    if (RemainingCost.RequiredTargetCount > 0 && target is CardInstance)
                    {
                        CardInstance cat = target as CardInstance;
                        RemainingCost = RemainingCost.Pay(ref cat, CardSource);
                        if (cat == null)
                        {
                            return(true);
                        }
                    }
                }
                return(false);
            }

            if (target is CardInstance)
            {
                CardInstance ci = target as CardInstance;
                if (ci.BindedAction != null)
                {
                    target = ci.BindedAction;
                }
            }

            //other target group are possible, should change
            foreach (Target ct in ValidTargets)
            {
                if (ct.Accept(target, CardSource))
                {
                    if (Source.Effects.AcceptTarget(target))
                    {
                        SelectedTargets.Add(target);
                        return(true);
                    }
                }
            }

            Magic.AddLog("Invalid target: " + target.ToString());
            return(false);
        }
예제 #3
0
 public virtual void PayCost(ref Cost _amount)
 {
     RemainingCost = RemainingCost.Pay(ref _amount);
 }