Ejemplo n.º 1
0
 private void HeroPowerPortret_MouseUp(object sender, MouseEventArgs e)
 {
     if (parent.MyMoveQ)
     {
         if (parent.hero.Parent.TryHeroPower(out var act))
         {
             act();
             center.ReBuild();
         }
     }
     else
     {
         VisualExceptions.NotMyMoveSelection("HeroPower");
     }
 }
Ejemplo n.º 2
0
 void InvokeSelection()
 {
     if (S1 == null || S2 == null)
     {
         ReBuild();
     }
     else
     {
         if (S2.GetTarget is Creature tc)
         {
             if (S1.GetTarget is Creature c)
             {
                 if (c.CanAttack(tc))
                 {
                     c.Hit(tc);
                 }
                 else
                 {
                     VisualExceptions.CannotAttackThatOne(c.Name, tc.Name);
                 }
             }
             else if (S1.GetTarget is ITargetPlayCard tpc)
             {
                 if (tpc.CanPlay(tc, out var play))
                 {
                     play();
                 }
                 else
                 {
                     VisualExceptions.CannotTargetThatThing(tpc.ToString(), tc.Name);
                 }
             }
             else
             {
                 throw new NotImplementedException();
             }
         }
         else
         {
             VisualExceptions.CannotTargetThatThing("Anything", S2.ToString());
         }
         ReBuild();
         S1 = null; S2 = null;
     }
 }
Ejemplo n.º 3
0
        public void SelectMe(ISelectable s)
        {
            if (S1 == null)
            {
                S1 = s;
            }
            else if (S2 == null)
            {
                S2 = s;
            }
            else
            {
                S1 = null; S2 = null;
            }

            if (S1 != null)
            {
                if (S1.MyMoveQ)
                {
                    if (S1 == S2)
                    {
                        S1 = null; S2 = null;
                    }

                    if (S2 != null)
                    {
                        if ((!(S1.GetTarget is ITargetPlayCard)) && S1.MyMoveQ == S2.MyMoveQ)
                        {
                            S1 = s; S2 = null;
                        }
                    }
                }
                else
                {
                    VisualExceptions.NotMyMoveSelection(s.GetTarget.GetType().Name);
                    S1 = null;
                    S2 = null;
                }
            }

            InvokeSelection();
        }