示例#1
0
        public ICard CreateCard(string type, string name)
        {
            //Type cardType = Assembly.GetExecutingAssembly()
            //    .GetTypes()
            //    .FirstOrDefault(t => t.Name.StartsWith(type));

            //var card = Activator.CreateInstance(cardType, name) as ICard;

            //return card;

            ICard card = null;

            switch (type)
            {
            case "Trap":
                card = new TrapCard(name);
                break;

            case "Magic":
                card = new MagicCard(name);
                break;
            }

            return(card);
        }
示例#2
0
        public void MakeAPlayerDrawATrapCard_AndAssertThatTheirLifeTotalHasChanged()
        {
            TrapCard trap         = new TrapCard();
            int      healthBefore = rogan.Health;

            trap.Draw(rogan);
            Assert.That(healthBefore, Is.Not.EqualTo(rogan.Health));
        }
示例#3
0
 /*	If the assigned trap is a throwable trap, this method replaces the trap associated with it with the special gameobject
  *  used to use it.
  *
  *  Positions of each one:
  *  Throwable = 0
  */
 void AssignThrowableTrap(TrapCard currTrapCard)
 {
     switch (currTrapCard.associatedTrap.name)
     {
     case "Grenade":
         currTrapCard.associatedTrap = ThrowableTraps[0];
         break;
     }
 }
示例#4
0
 private void CreateTrapCards()
 {
     for (int i = -11; i <= 12; i++)
     {
         TrapCard trCard = CreateInstance <TrapCard>().Init(i);
         AssetDatabase.CreateAsset(trCard, "Assets/Resources/CardAssets/TrapCards/TrapCard" + i + ".asset");
     }
     AssetDatabase.SaveAssets();
 }
    // This sets the given trap from the parameter into this spot.
    public void SetTrap(TrapCard selectedTrapCard)
    {
        // This is done so that we know which TrapCard is associated to this spot.
        associatedTrapCard = selectedTrapCard;

        // This sets the trap that's in the TrapCard to the player.
        player.currEquippedTraps[representWhichSpot] = selectedTrapCard.associatedTrap;
        DeselectSpot();
        print("Set " + player.currEquippedTraps[representWhichSpot].name + " into slot " + representWhichSpot);
    }
    // This removes the current trap that's in the currTrap variable.
    public void RemoveTrap()
    {
        // We tell the TrapCard associated here that it is no longer associated with anything.
        associatedTrapCard.GetComponent <TrapCard>().equipped = false;
        print("Removed " + player.currEquippedTraps[representWhichSpot].name + " from slot " + representWhichSpot);

        // And then we null out the refrences.
        associatedTrapCard = null;
        player.currEquippedTraps[representWhichSpot] = null;
    }
示例#7
0
        public ICard CreateCard(string type, string name)
        {
            ICard card = new MagicCard(name);

            if (type == "Trap")
            {
                card = new TrapCard(name);
            }

            return(card);
        }
示例#8
0
 public void OnTrapCardPlayed(TrapCard _playedCard, TrapCard _pickedCard)
 {
     for (int i = 0; i < m_PawnInfo.m_TrapCards.Length; i++)
     {
         if (_playedCard == m_PawnInfo.m_TrapCards[i])
         {
             m_PawnInfo.m_TrapCards[i] = _pickedCard;
         }
     }
     CardManager.m_Instance.RemoveTrapCard(_playedCard, _pickedCard);
     OnCardPlayed();
 }
示例#9
0
        public async Task <ISingleResult <Card> > Incluir(TrapCard entity)
        {
            try
            {
                await _cards.InsertOneAsync(entity);
            }
            catch (Exception)
            {
                return(new SingleResult <Card>(MensagensNegocio.MSG07));
            }

            return(new InclusaoResult <Card>(entity));
        }
示例#10
0
 public ICard CreateCard(string type, string name)
 {
     if (type == "Magic")
     {
         MagicCard magicCard = new MagicCard(name);
         return(magicCard);
     }
     else if (type == "Trap")
     {
         TrapCard trapCard = new TrapCard(name);
         return(trapCard);
     }
     return(null);
 }
示例#11
0
 public string AddCard(string type, string name)
 {
     if (type == "Magic")
     {
         Card card = new MagicCard(name);
         cardRepository.Add(card);
     }
     else if (type == "Trap")
     {
         Card card = new TrapCard(name);
         cardRepository.Add(card);
     }
     return(string.Format(ConstantMessages.SuccessfullyAddedCard, type, name));
 }
示例#12
0
        public ICard CreateCard(string type, string name)
        {
            ICard cardToCreate = null;

            if (type.ToLower() == "magic".ToLower())
            {
                cardToCreate = new MagicCard(name);
            }
            else if (type.ToLower() == "trap".ToLower())
            {
                cardToCreate = new TrapCard(name);
            }

            return(cardToCreate);
        }
示例#13
0
 public string AddCard(string type, string name)
 {
     if (type == "Magic")
     {
         var card = new MagicCard(name);
         cardRepository.Add(card);
         return($"Successfully added card of type {type}Card with name: {name}");
     }
     else
     {
         var card = new TrapCard(name);
         cardRepository.Add(card);
         return($"Successfully added card of type {type}Card with name: {name}");
     }
 }
示例#14
0
文件: Game1.cs 项目: mwoyden/Yugioh
 /// <summary>
 /// Checks if P1 is able to use trap cards based off hooks.
 /// </summary>
 /// <param name="gameTime">for timing</param>
 /// <param name="p1">player 1</param>
 /// <param name="p2">player 2</param>
 /// <param name="p1Field">player 1's field</param>
 /// <param name="p2Field">player 2's field</param>
 /// <returns>Trap card that was hooked and the card that hooked it.</returns>
 private KeyValuePair <TrapCard, int> CheckHooksP1(GameTime gameTime, Player p1, Player p2, Field p1Field, Field p2Field)
 {
     foreach (Card card in p1Field.magicAndTrapZone)
     {
         if (card is TrapCard)
         {
             TrapCard trap            = (TrapCard)card;
             int      hookedCardIndex = trap.HookTriggered(p1);
             if (hookedCardIndex > -1) // Card was hooked
             {
                 return(new KeyValuePair <TrapCard, int>(trap, hookedCardIndex));
             }
         }
     }
     return(new KeyValuePair <TrapCard, int>(null, -1));
 }
示例#15
0
        public string AddCard(string type, string name)
        {
            ICard card = null;

            if (type == "Magic")
            {
                card = new MagicCard(name);
            }
            else if (type == "Trap")
            {
                card = new TrapCard(name);
            }
            this.cardRepository.Add(card);

            return($"Successfully added card of type {type}Card with name: {name}");
        }
示例#16
0
        public string AddCard(string type, string name)
        {
            ICard card;

            if (type == "Magic")
            {
                card = new MagicCard(name);
            }
            else
            {
                card = new TrapCard(name);
            }
            this.cards.Add(card);

            return($"Successfully added card of type {card.GetType().Name} with name: {card.Name}");
        }
示例#17
0
        public ICard CreateCard(string type, string name)
        {
            ICard card = null;

            switch (type.ToLower())
            {
            case "trap":
                card = new TrapCard(name);
                break;

            case "magic":
                card = new MagicCard(name);
                break;
            }
            return(card);
        }
示例#18
0
 public string AddCard(string type, string name)
 {
     if (type == "Trap")
     {
         TrapCard trapCard = new TrapCard(name);
         cardRepository.Add(trapCard);
         return($"Successfully added card of type TrapCard with name: {trapCard.Name}");
     }
     else if (type == "Magic")
     {
         MagicCard magicCard = new MagicCard(name);
         cardRepository.Add(magicCard);
         return($"Successfully added card of type MagicCard with name: {magicCard.Name}");
     }
     return(null);
 }
        public string AddCard(string type, string name)
        {
            ICard card = null;

            if (type == "Trap")
            {
                card = new TrapCard(name);
            }
            else if (type == "Magic")
            {
                card = new MagicCard(name);
            }

            this.cardRepository.Add(card);

            return(string.Format(OutputMessages.SuccessfullyAddedCard, type, name));
        }
示例#20
0
        public string AddCard(string type, string name)
        {
            ICard card = null;

            switch (type)
            {
            case "Magic":
                card = new MagicCard(name);
                break;

            case "Trap":
                card = new TrapCard(name);
                break;
            }
            this.cardRepository.Add(card);
            return($"Successfully added card of type {type}Card with name: {name}");
        }
示例#21
0
        public string AddCard(string type, string name)
        {
            string result = $"Successfully added card of type {type}Card with name: {name}";

            // Creates a card$ with the provided type and name.The method should return the following message:
            if (type == "Magic")
            {
                var newCard = new MagicCard(name);
                this.cardRepo.Add(newCard);
            }
            else
            {
                var newCard = new TrapCard(name);
                this.cardRepo.Add(newCard);
            }
            return(result);
        }
示例#22
0
        public Selector(SpriteBatch spriteBatch, Card card)
        {
            // Make card selector outline
            line = new Texture2D(spriteBatch.GraphicsDevice, 1, 1);
            line.SetData <Color>(new Color[] { Color.White });
            lineWidth = 4;

            // Other selector variables
            color        = Color.Black;
            selected     = card;
            attacking    = null; //idk
            summoning    = null; //idk
            settingMagic = null; //idk
            settingTrap  = null; //idk
            state        = SelectedState.P1_HAND;
            action       = SelectedAction.NONE;
            index        = 0;
        }
        public string AddCard(string type, string name)
        {
            if (type == "Magic")
            {
                ICard card = new MagicCard(name);
                this.cardRepository.Add(card);

                return(string.Format(ConstantMessages.SuccessfullyAddedCard, "Magic", name));
            }
            if (type == "Trap")
            {
                ICard card = new TrapCard(name);
                this.cardRepository.Add(card);

                return(string.Format(ConstantMessages.SuccessfullyAddedCard, "Trap", name));
            }
            return("");
        }
        public string AddCard(string type, string name)
        {
            ICard card = null;

            if (type == "MagicCard")
            {
                card = new MagicCard(name);
            }

            else if (type == "TrapCard")
            {
                card = new TrapCard(name);
            }

            cardRepository.Add(card);

            return($"{string.Format(ConstantMessages.SuccessfullyAddedCard, type, name)}");
        }
示例#25
0
    // Loads the specified trap into a TrapCard.
    void SpawnTrapCard(Vector3 pos, GameObject trap)
    {
        TrapCard _trapCard = Instantiate(TrapCard, pos, transform.rotation, transform).GetComponent <TrapCard>();

        _trapCard.LoadTrapInSlot(trap);
        AssignThrowableTrap(_trapCard);

        // Checks if the player has equipped this trap already. If so, it sets this card to the respective trapRadial spot.
        for (int i = 0; i < trapSlots.Length; i++)
        {
            int trapIndex = trapSlots[i].representWhichSpot;
            if (player.currEquippedTraps[trapIndex] != null && player.currEquippedTraps[trapIndex].name == _trapCard.associatedTrap.name)
            {
                _trapCard.equipped = true;
                trapSlots[i].associatedTrapCard = _trapCard;
                break;
            }
        }
    }
示例#26
0
        public ICard CreateCard(string type, string name)
        {
            ICard card = null;

            switch (type)
            {
            case "Trap":
                card = new TrapCard(name);
                break;

            case "Magic":
                card = new MagicCard(name);
                break;

            default:
                throw new ArgumentException("Card of this type does not exists!");
            }

            return(card);
        }
示例#27
0
        public ICard CreateCard(string type, string name)
        {
            ICard card = null;

            switch (type)
            {
            case "Magic":
                card = new MagicCard(name);
                break;

            case "Trap":
                card = new TrapCard(name);
                break;

            default:
                break;
            }

            return(card);
        }
示例#28
0
        public string AddCard(string type, string name)
        {
            ICard card = null;

            switch (type)
            {
            case "Trap":
                card = new TrapCard(name);
                break;

            case "Magic":
                card = new MagicCard(name);
                break;

            default:
                break;
            }

            this.cardRepository.Add(card);

            return(string.Format(ConstantMessages.SuccessfullyAddedCard, type, name));
        }
        public string AddCard(string type, string name)
        {
            if (this.cardRepository.Find(name) == null)
            {
                ICard card = null;

                if (type == "MagicCard" || type == "Magic")
                {
                    card = new MagicCard(name);
                }
                else if (type == "TrapCard" || type == "Trap")
                {
                    card = new TrapCard(name);
                }

                this.cardRepository.Add(card);
                return($"Successfully added card of type {type}Card with name: {name}");
            }
            else
            {
                throw new ArgumentException($"Card {name} already exists!");
            }
        }
示例#30
0
    // Loads the specified trap into a TrapCard.
    void SpawnTrapCard(Vector3 pos, GameObject trap)
    {
        GameObject _trapCard    = (GameObject)Instantiate(TrapCard, pos, transform.rotation, Slider);
        TrapCard   thisTrapCard = _trapCard.GetComponent <TrapCard>();

        thisTrapCard.LoadTrapInSlot(trap);
        TrapCards.Add(thisTrapCard);
        thisTrapCard.trapCardSpawner   = this;
        thisTrapCard.CenterPoint       = Center;
        thisTrapCard.trapCanvas        = trapCanvasScript;
        thisTrapCard.confirmationGroup = confirmationGroup;

        // Checks if the player has equipped this trap already. If so, it sets this card to the respective trapRadial spot.
        for (int i = 0; i < trapSlots.Length; i++)
        {
            int trapIndex = trapSlots[i].representWhichSpot;
            if (player.currEquippedTraps[trapIndex] != null && player.currEquippedTraps[trapIndex].name == thisTrapCard.associatedTrap.name)
            {
                thisTrapCard.equipped           = true;
                trapSlots[i].associatedTrapCard = thisTrapCard;
                break;
            }
        }
    }
示例#31
0
 public static TrapCard NewCard(string name)
 {
     Uri baseUri = new Uri("ms-appx:///");
     TrapCard card = new TrapCard();
     card.Name = name;
     switch (name)
     {
         case "Castle Walls":
             card.Description = "Increase the DEF of 1 face-up monster on the field by 500 points until the end of this turn.";
             card.SetImage(baseUri, "Assets/Trap/CastleWalls.jpg");
             card.ShortDescription = "";
             card.Category = "Normal";
             break;
         case "Enchanted Javelin":
             card.Description = "Increase your Life Points by the ATK of 1 attacking monster.";
             card.SetImage(baseUri, "Assets/Trap/EnchantedJavelin.jpg");
             card.ShortDescription = "";
             card.Category = "Normal";
             break;
         case "Reinforcements":
             card.Description = "Increase 1 selected monster's ATK by 500 points during the turn this card is activated.";
             card.SetImage(baseUri, "Assets/Trap/Reinforcements.jpg");
             card.ShortDescription = "";
             card.Category = "Normal";
             break;
         case "Ring of Destruction":
             card.Description = "Destroy 1 face-up monster and inflict damage to both players equal to its ATK.";
             card.SetImage(baseUri, "Assets/Trap/RingOfDestruction.jpg");
             card.ShortDescription = "";
             card.Category = "Normal";
             break;
         case "Solemn Wishes":
             card.Description = "You gain 500 Life Points when you draw a card (or cards).";
             card.SetImage(baseUri, "Assets/Trap/SolemnWishes.jpg");
             card.ShortDescription = "Continuous";
             card.Category = "Continuous";
             break;
         case "Ultimate Offering":
             card.Description = "At the cost of 500 Life Points per monster, a player is allowed an extra Normal Summon or Set.";
             card.SetImage(baseUri, "Assets/Trap/UltimateOffering.jpg");
             card.ShortDescription = "Continuous";
             card.Category = "Continuous";
             break;
     }
     return card;
 }
示例#32
0
        private static void LoadOverlordCards(Game game)
        {
            StreamReader reader = new StreamReader(TitleContainer.OpenStream("overlordcards.txt"));
            overlordCards = new List<OverlordCard>();

            int n = int.Parse(reader.ReadLine());
            for (int i = 0; i < n; i++)
            {
                string line = reader.ReadLine();
                if (line.StartsWith("//")) continue;
                OverlordCard card = null;

                string[] data = line.Split(new char[] { ',' }, 9);

                int id = int.Parse(data[0]);
                string type = data[1];
                string name = data[2];
                int amount = int.Parse(data[3]);
                int cost = int.Parse(data[4]);
                int sell = int.Parse(data[5]);
                string description = data[7];

                switch (type)
                {
                    case "Spawn":
                        List<Monster> monsters = new List<Monster>();
                        string[] creaturesToSpawn = data[6].Split('/');
                        for (int j = 0; j < creaturesToSpawn.Length; j++)
                        {
                            for (int k = 0; k < int.Parse(creaturesToSpawn[j].Split(' ')[1]); k++)
                            {
                                monsters.Add(GetMonster(int.Parse(creaturesToSpawn[j].Split(' ')[0])));
                            }
                        }
                        card = new SpawnCard(id, name, description, cost, sell, monsters.ToArray());
                        break;
                    case "Power":
                        card = new PowerCard(id, name, description, cost, sell);
                        break;
                    case "Trap":
                        card = new TrapCard(id, name, description, cost, sell);
                        break;
                    case "Event":
                        card = new EventCard(id, name, description, cost, sell);
                        break;
                }
                if (card != null)
                    overlordCards.Add(card);
            }
        }