private void btnUsTapCard_Click(object sender, EventArgs e)
        {
            Card temp = (Card)lbxUsField.SelectedItem;

            if (temp != null)
            {
                temp.Field.Remove(temp);

                if (temp is Land)
                {
                    Land l = temp as Land;
                    l.Tap();
                }
                else if (temp is Creature)
                {
                    Creature c = temp as Creature;
                    c.Tap();
                }
                else if (temp is ArtifactEnchant)
                {
                    ArtifactEnchant ae = temp as ArtifactEnchant;
                    ae.Tap();
                }
                temp.Tapped = true;
                temp.Field.Add(temp);
            }
        }
예제 #2
0
        private static GameState Cast(Card C, GameState state)
        {
            GameState newState = new GameState(state, C);

            ActiveState = newState;
            Card            targ = null;
            Creature        cr   = null;
            Spell           sp   = null;
            ArtifactEnchant ae   = null;

            foreach (Card ca in newState.PlayerHand)
            {
                if (ca.GetType() == C.GetType())
                {
                    targ = ca;
                }
            }
            if (targ != null)
            {
                targ.Hand.Remove(targ);
                targ.Field.Add(targ);
                if (targ is Creature)
                {
                    cr = targ as Creature;
                    cr.Cast();

                    cr.EnterBattlefield();
                    foreach (Card ca in ActiveState.PlayerField)
                    {
                        if (ca is Creature)
                        {
                            Creature cre = ca as Creature;
                            cre.OtherEnterBattlefield(cr);
                        }
                    }
                }
                else if (targ is Spell)
                {
                    sp = targ as Spell;
                    sp.Field.Remove(sp);
                    sp.Graveyard.Add(sp);
                    sp.Cast();
                }
                else if (targ is ArtifactEnchant)
                {
                    ae = targ as ArtifactEnchant;
                    ae.Cast();
                    ae.EnterBattlefield();
                }
            }

            return(newState);
        }
        private void btnUsCast_Click(object sender, EventArgs e)
        {
            Card temp = (Card)lbxUsHand.SelectedItem;

            if (temp != null)
            {
                lbxUsHand.Items.Remove(temp);
                if (temp is Land)
                {
                    Land l = temp as Land;
                    l.Cast();
                    manaForTurn = true;
                    lbxUsField.Items.Add(temp);
                }
                else if (temp is Creature)
                {
                    Creature c = temp as Creature;
                    c.Cast();
                    lbxUsField.Items.Add(temp);
                    c.EnterBattlefield();
                    foreach (Card ca in lbxUsField.Items)
                    {
                        if (ca is Creature)
                        {
                            Creature cr = ca as Creature;
                            cr.OtherEnterBattlefield(c);
                        }
                    }
                }
                else if (temp is ArtifactEnchant)
                {
                    ArtifactEnchant ae = temp as ArtifactEnchant;
                    ae.Cast();
                    lbxUsField.Items.Add(temp);
                }
                else
                {
                    Spell sp = temp as Spell;
                    sp.Cast();
                    lbxUsGraveyard.Items.Add(temp);
                }
            }
        }
        private void btnUsExileToField_Click(object sender, EventArgs e)
        {
            Card temp = (Card)lbxUsExile.SelectedItem;

            if (temp != null)
            {
                lbxUsExile.Items.Remove(temp);
                if (temp is Creature)
                {
                    Creature c = temp as Creature;
                    c.EnterBattlefield();
                }
                if (temp is ArtifactEnchant)
                {
                    ArtifactEnchant ae = temp as ArtifactEnchant;
                    ae.EnterBattlefield();
                }
                lbxUsField.Items.Add(temp);
            }
        }
예제 #5
0
        private static string checkCastables(GameState state, bool secMain)
        {
            GameState m_state = state;

            ActiveState = m_state;
            string            toDo      = null;
            LinkedList <Card> castables = new LinkedList <Card>();

            foreach (Card c in m_state.PlayerHand)
            {
                if (!(c is Land) && !(c is ArtifactEnchant))
                {
                    if (castable(c, m_state))
                    {
                        castables.AddLast(c);
                    }
                }
                if (c is ArtifactEnchant)
                {
                    ArtifactEnchant ae = c as ArtifactEnchant;
                    if (ae.type == ArtifactEnchant.SpellType.Enchantment)
                    {
                        if (castable(c, m_state))
                        {
                            castables.AddLast(c);
                        }
                    }
                }
            }
            foreach (Card c in castables)
            {
                if (!secMain)
                {
                    if (!(c is Spell))
                    {
                        m_state.StateBranches.AddLast(Cast(c, m_state));
                    }
                }
                else
                {
                    m_state.StateBranches.AddLast(Cast(c, m_state));
                }
            }
            if (m_state.StateBranches.Count > 0)
            {
                GameState best = bestStateFinder(m_state);
                if (best == m_state)
                {
                    toDo = "Advance Phase";
                }
                else
                {
                    ManaPayment(best.target, m_state);
                    toDo = String.Format("Play {0}", best.target.CName);
                }
            }
            else
            {
                toDo = "Advance Phase";
            }

            return(toDo);
        }
예제 #6
0
 public void DisenchantCreature()
 {
     enchantment = null;
 }
예제 #7
0
 public void EnchantCreature(ArtifactEnchant enchant)
 {
     enchantment = enchant;
 }