Exemplo n.º 1
0
    public void WeaponAttack(GameObject creature, CreatureData creatureData, WeaponCard weaponCard)
    {
        if ((equippedCreaturesObj.IndexOf(creature) + 1) > tempRange) //checks if clicked creature is in range
        {
            WarningPopup("Target out of range");
        }
        else
        {
            ammo -= tempWeaponData.ap;                                         //updates AP remaining
            AmmoUpdate();                                                      //updates UI text
            creatureData.hp -= tempWeaponData.dmg;                             //weapon deals dmg to creature
            weaponCard.PlaySound1();                                           //plays sound
            CreatureCard defCreature = creature.GetComponent <CreatureCard>(); //creatures a reference to the creature
            defCreature.hpText.text = defCreature.creatureData.hp.ToString();  //updates UI text

            if (creatureData.hp <= 0)                                          //checks if creature is dead
            {
                CreatureCard deadCreature = creature.GetComponent <CreatureCard>();
                Destroy(deadCreature.gameObject);                     //destroys the creature
                equippedCreaturesObj.Remove(deadCreature.gameObject); //removes destroyed creature from attackers list
                MonstersUpdate();                                     //updates UI text
            }

            for (int i = 0; i < equippedCreaturesObj.Count; i++) //loop repeats for each creature on the board
            {
                CreatureCard attacker = equippedCreaturesObj[i].GetComponent <CreatureCard>();
                attacker.buttonObject.SetActive(false); //disables buttons on all creature cards
            }
            tempRangeIndicator.SetActive(false);        //disables range indicator
        }
    }
Exemplo n.º 2
0
    public int AIStagePower(List <Card> currStage)
    {
        Card currCard = null;
        int  power    = 0;

        for (int i = 0; i < currStage.Count; i++)
        {
            currCard = currStage[i];
            if (currCard.GetType() == typeof(WeaponCard))
            {
                WeaponCard currWeapon = (WeaponCard)currCard;
                power += currWeapon.power;
            }
            else if (currCard.GetType() == typeof(FoeCard))
            {
                FoeCard currFoe = (FoeCard)currCard;
                if (_questCard.featuredFoe == currFoe.type)
                {
                    power += currFoe.hiPower;
                }
                else if (_questCard.featuredFoe == "*")
                {
                    power += currFoe.hiPower;
                }
                else
                {
                    power += currFoe.loPower;
                }
            }
        }
        return(power);
    }
Exemplo n.º 3
0
    void TurnStart()
    {
        if (turnState == turn.Player2)                        //checks if it is the AI's turn
        {
            for (int i = 0; i < equippedWeaponObj.Count; i++) //loop repeats for each weapon on the board
            {
                WeaponCard weapon = equippedWeaponObj[i].GetComponent <WeaponCard>();
                weapon.useButton.SetActive(false); //disables buttons on all weapon cards during AI turn
            }

            currentUltimate.useButton.SetActive(false); //disables button

            if (equippedCreaturesObj.Count == 0)        //checks if AI has creatures on the board
            {
                DealCreatureHand();                     //Deals new row of creatures
                EndTurn();                              //Ends turn
            }
            else
            {
                StartCoroutine(HeroAttackPhase()); //starts attack phase
            }
        }

        if (turnState == turn.Player1)                        //checks if it is the Players's turn
        {
            for (int i = 0; i < equippedWeaponObj.Count; i++) //loop repeats for each weapon on the board
            {
                WeaponCard weapon = equippedWeaponObj[i].GetComponent <WeaponCard>();
                weapon.useButton.SetActive(true); //enables buttons on all weapon cards during player turn
            }
        }
    }
Exemplo n.º 4
0
    public void Test_WeaponCard()
    {
        WeaponCard weaponCard = new WeaponCard("Sword", 100, "test.png");

        Assert.AreEqual(weaponCard.name, "Sword");
        Assert.AreEqual(weaponCard.power, 100);
        Assert.AreEqual(weaponCard.asset, "test.png");
    }
Exemplo n.º 5
0
    public override void SetCard(Card card)
    {
        base.SetCard(card);
        WeaponCard weaponCard = card as WeaponCard;

        attackText.text     = weaponCard.Attack.ToString();
        durabilityText.text = weaponCard.Durability.ToString();
    }
Exemplo n.º 6
0
        public WhenFindingCardById(ServiceFixture fixture)
        {
            Fixture = fixture;

            ICard card = new WeaponCard("1");

            Fixture.Repository.Setup(x => x.GetById <ICard>("1")).Returns(card).Verifiable();
        }
Exemplo n.º 7
0
 private void Start()
 {
     audioSource         = GetComponent <AudioSource>();
     weaponCard          = GetComponent <WeaponCard>();
     gameController      = (GameController)FindObjectOfType(typeof(GameController));           //finds the gamecontroller
     inventoryController = (InventoryController)FindObjectOfType(typeof(InventoryController)); //finds the inventorycontroller
     UIWeaponCard(dmgText, ammoText, rangeText);
 }
    // Get power from card.
    public int getPowerFromCard(Card c)
    {
        if (c.GetType() == typeof(WeaponCard))
        {
            WeaponCard currWeapon = (WeaponCard)c;
            return(currWeapon.power);
        }

        if (c.GetType() == typeof(AmourCard))
        {
            AmourCard currAmour = (AmourCard)c;
            return(currAmour.power);
        }

        if (c.GetType() == typeof(AllyCard))
        {
            AllyCard currAlly = (AllyCard)c;

            int currAllyPower = currAlly.power;

            //Quest Condition
            if (_storyCard.GetType() == typeof(QuestCard))
            {
                QuestCard currQuest = (QuestCard)_storyCard;
                //Same Quest
                if (currAlly.questCondition == currQuest.name)
                {
                    currAllyPower += currAlly.bonusPower;
                }
            }

            //Ally Condition
            if (currAlly.allyCondition != null)
            {
                //Go Through The Players
                for (int x = 0; x < _players.Count; x++)
                {
                    List <Card> currInPlay = _players[x].inPlay;
                    for (int i = 0; i < currInPlay.Count; i++)
                    {
                        //If ally card
                        if (currInPlay[i].GetType() == typeof(AllyCard))
                        {
                            AllyCard compareAlly = (AllyCard)currInPlay[i];
                            if (currAlly.allyCondition == compareAlly.name)
                            {
                                currAllyPower += currAlly.bonusPower;
                                return(currAllyPower);
                            }
                        }
                    }
                }
            }
            return(currAllyPower);
        }

        return(0);
    }
    // Determine if the cards in the play area are valid.
    public bool playAreaValid(List <Card> cards = null)
    {
        bool doPrompt = true;

        if (cards == null)
        {
            cards = playArea.GetComponent <CardArea> ().cards;
        }
        else
        {
            doPrompt = false;
        }

        int amourCardCounter      = 0;
        List <WeaponCard> weapons = new List <WeaponCard>();

        for (int i = 0; i < cards.Count; i++)
        {
            // Return false if there are any foe cards.
            if (cards[i].GetType() == typeof(FoeCard))
            {
                logger.warn("Play area invalid: you can't submit foes to the play area!");
                if (doPrompt)
                {
                    PromptManager.statusPrompt("You can't submit foes to the play area!");
                }
                return(false);
            }

            if (cards[i].GetType() == typeof(WeaponCard))
            {
                WeaponCard currWeapon = (WeaponCard)cards[i];
                for (int x = 0; x < weapons.Count; x++)
                {
                    if (currWeapon.name == weapons[x].name)
                    {
                        logger.warn("Play area invalid: you can't submit duplicate weapons to the play area!");
                        if (doPrompt)
                        {
                            PromptManager.statusPrompt("You can't submit duplicate weapons.");
                        }
                        return(false);
                    }
                }
                weapons.Add(currWeapon);
            }
            if (cards[i].GetType() == typeof(AmourCard))
            {
                logger.warn("Play area invalid: too many amour cards in the play area!");
                amourCardCounter++;
            }
        }
        if (amourCardCounter > 1)
        {
            return(false);
        }
        return(true);
    }
Exemplo n.º 10
0
    public void DealWeapon(Transform spawnTransform, WeaponData data, List <GameObject> objectList) //Deals one weapon card
    {
        WeaponData card     = Instantiate(data);                                                    //instantiates instance of scriptable object
        WeaponCard tempCard = Instantiate(weaponCardTemplate);                                      //instantiates an instance of the card prefab

        tempCard.transform.SetParent(spawnTransform, false);                                        //moves card onto board
        tempCard.weaponData = card;                                                                 //assigns the instance of the scriptable object to the instance of the prefab
        objectList.Add(tempCard.gameObject);                                                        //adds card to list
    }
Exemplo n.º 11
0
    // sets up the final stage of a quest for this CPU player, in this strategy:
    // we need to get 40BP in as few cards as possible
    public List <Card> setUpFinalFoe(List <Card> hand, string questFoe)
    {
        strategyUtil strat = new strategyUtil();

        // instantiate a List of foes and weapons from the user's hand
        List <Card> foes    = new List <Card>();
        List <Card> weapons = new List <Card>();

        // seperate the foes and weapons into their own lists from the hand
        for (var i = 0; i < hand.Count; i++)
        {
            if (hand[i].type == "Foe Card")
            {
                foes.Add(hand[i]);
            }
            // make sure that we sort out weapons that are already in the weapons
            if (hand[i].type == "Weapon Card" && strat.checkDuplicate(hand[i], weapons, "Weapon Card"))
            {
                weapons.Add(hand[i]);
            }
        }
        foes    = strat.sortFoesByDescendingOrder(foes, questFoe);
        weapons = strat.sortWeaponsByDescendingOrder(weapons);

        // instantiate the foeEncounter list
        List <Card> foeEncounter = new List <Card>();

        // subtract the foe with the MOST BP in the user's hand from 40, the AI threshold
        FoeCard strongFoe = (FoeCard)foes[0];
        int     bpNeeded  = (40 - strongFoe.minBP);

        // Add this foe to the foeEncounter as the foe to be played
        foeEncounter.Add(foes[0]);
        hand.Remove(foes[0]);

        // initialize index as 0 to loop through the weapons
        int index = 0;

        // while we still need BP toreach our 40 threshold
        while (bpNeeded > 0 && index < weapons.Count)
        {
            // if we still have weapons to loop through
            // subtract the BP of the next most powerful weapon from the threshold
            WeaponCard nextWeapon = (WeaponCard)weapons[index];
            bpNeeded -= nextWeapon.battlePoints;
            // add this weapon to the encounter
            foeEncounter.Add(weapons[index]);
            hand.Remove(weapons[index]);
            // increment index
            index++;
        }

        // return the most powerful foe we have with the set of weapons that most quickly gets us to 40 BP.
        return(foeEncounter);
    }
Exemplo n.º 12
0
    public void DealWeapon(Transform weaponTransform, List <GameObject> weaponObjectList, WeaponData weapon) //Deals one card
    {
        WeaponData card     = Instantiate(weapon);                                                           //instantiates instance of scriptable object
        WeaponCard tempCard = Instantiate(weaponCardTemplate);                                               //instantiates an instance of the card prefab

        tempCard.transform.SetParent(weaponTransform.transform, false);                                      //moves card onto board
        tempCard.weaponData = card;                                                                          //assigns the instance of the scriptable object to the instance of the prefab
        weaponObjectList.Add(tempCard.gameObject);                                                           //adds to list
        tempCard.equipButton.SetActive(true);                                                                //enables the button
        tempCard.name = tempCard.weaponData.name.Replace("(Clone)", "").ToString();
    }
Exemplo n.º 13
0
    public void WeaponCard_CreatedWithGiven_WillHaveTheVariables()
    {
        var weapon = new WeaponCard("Weapon Card", "Horse", " ", 10);

        weapon.display();
        Assert.AreEqual("Weapon Card", weapon.type);
        Assert.AreEqual("Horse", weapon.name);
        Assert.AreEqual(" ", weapon.texturePath);
        Assert.AreEqual(10, weapon.battlePoints);

        // Use the Assert class to test conditions.
    }
Exemplo n.º 14
0
    public void WeaponTarget(WeaponData weaponData, WeaponCard weaponCard) //function for selecting weapon target
    {
        if (ammo - weaponData.ap < 0)
        {
            WarningPopup("Not enough Ammo");
        }
        else
        {
            weaponCard.PlaySound2();                             //plays sound
            tempWeaponData = weaponData;                         //assigns the data of clicked weapon as the tempWeaponData
            tempWeaponCard = weaponCard;                         //assigns the weaponCard of clicked as the tempWeaponCard
            tempRange      = weaponData.range;                   //sets range of current weapon

            for (int i = 0; i < equippedCreaturesObj.Count; i++) //loop repeats for each creature in range
            {
                CreatureCard attacker = equippedCreaturesObj[i].GetComponent <CreatureCard>();
                attacker.buttonObject.SetActive(true); //enables buttons on all creature cards
            }

            foreach (GameObject item in rangeIndicators)
            {
                item.SetActive(false); //disables range indicators (this is so if a player changes weapons, they don't get multiple icons active)
            }

            //actives the range indicator appropriate to the weapons range

            if (tempRange == 1)
            {
                tempRangeIndicator = rangeIndicators[0];
                tempRangeIndicator.SetActive(true);
            }
            else if (tempRange == 2)
            {
                tempRangeIndicator = rangeIndicators[1];
                tempRangeIndicator.SetActive(true);
            }
            else if (tempRange == 3)
            {
                tempRangeIndicator = rangeIndicators[2];
                tempRangeIndicator.SetActive(true);
            }
            else if (tempRange == 4)
            {
                tempRangeIndicator = rangeIndicators[3];
                tempRangeIndicator.SetActive(true);
            }
            else
            {
                print("Range Error");
            }
        }
    }
Exemplo n.º 15
0
    public Weapon(WeaponCard card)
    {
        Card   = card;
        Player = card.Player;

        CurrentAttack = card.CurrentAttack;
        BaseAttack    = card.BaseAttack;

        CurrentDurability = card.CurrentDurability;
        BaseDurability    = card.BaseDurability;

        HasWindfury = Card.HasWindfury;
    }
Exemplo n.º 16
0
 public WeaponCardRecord(int cardRecordID, int cardID) : base(cardRecordID, cardID)
 {
     if (Card is WeaponCard)
     {
         WeaponCard weaponCard = Card as WeaponCard;
         Attack     = weaponCard.Attack;
         Durability = weaponCard.Durability;
     }
     else
     {
         CardRecordID = -1;
     }
 }
Exemplo n.º 17
0
        public void WeaponCardConstructorTestMethod1()
        {
            WeaponCard card = new WeaponCard(1, 2, "WeaponCard", new List <Effect>(), 3, 2, RarityCode.Free);

            Assert.IsNotNull(card);
            Assert.AreEqual(card.CardID, 1);
            Assert.AreEqual(card.ManaCost, 2);
            Assert.AreEqual(card.CardName, "WeaponCard");
            Assert.AreEqual(card.Description(null, 0), "");
            Assert.AreEqual(card.CardType, CardTypeCode.Weapon);
            Assert.AreEqual(card.Attack, 3);
            Assert.AreEqual(card.Durability, 2);
            Assert.AreEqual(card.Rarity, RarityCode.Free);
        }
Exemplo n.º 18
0
    protected List <WeaponCard> extractWeapons(List <Card> hand)
    {
        List <WeaponCard> weaponCards = new List <WeaponCard>();

        for (int i = 0; i < hand.Count; i++)
        {
            if (hand [i] is WeaponCard)
            {
                WeaponCard currWeapon = (WeaponCard)hand [i];
                weaponCards.Add(currWeapon);
            }
        }
        return(weaponCards);
    }
Exemplo n.º 19
0
    public void SaveBackpack() //saves backpack lists and remaining lootdrop lists
    {
        //saves backpack items to list of strings

        textBackpackWeapons.Clear(); //clears list before saving
        foreach (GameObject weapon in backPackWeapons)
        {
            WeaponCard tempWeapon = weapon.GetComponent <WeaponCard>();
            weaponLoot1.Remove(tempWeapon.weaponData);       //removes from loot drop list
            textBackpackWeapons.Add(weapon.name.ToString()); //Converts data to string
        }

        textBackpackUltimate.Clear(); //clears list before saving
        foreach (GameObject ultimate in backPackUltimates)
        {
            UltimateCard tempUltimate = ultimate.GetComponent <UltimateCard>();
            ultimateLoot1.Remove(tempUltimate.ultimateData);    //removes from loot drop list
            textBackpackUltimate.Add(ultimate.name.ToString()); //Converts data to string
        }

        textBackpackArmour.Clear(); //clears list before saving
        foreach (GameObject armour in backPackArmour)
        {
            ArmourCard tempArmour = armour.GetComponent <ArmourCard>();
            armourLoot1.Remove(tempArmour.armourData);      //removes from loot drop list
            textBackpackArmour.Add(armour.name.ToString()); //Converts data to string
        }

        //serializes list of strings to .dat files

        FileStream weaponFile = new FileStream("BackpackWeapons.dat", FileMode.Create);
        var        bf         = new BinaryFormatter();

        bf.Serialize(weaponFile, textBackpackWeapons);
        weaponFile.Close();

        FileStream ultimateFile = new FileStream("BackpackUltimates.dat", FileMode.Create);

        bf.Serialize(ultimateFile, textBackpackUltimate);
        ultimateFile.Close();

        FileStream armourFile = new FileStream("BackpackArmour.dat", FileMode.Create);

        bf.Serialize(armourFile, textBackpackArmour);
        armourFile.Close();

        //print("saved backpack");
        SaveLootTable();
        SceneManager.LoadScene("MenuScene");
    }
Exemplo n.º 20
0
    public void OnHeroEquippedWeapon(Player player, WeaponCard weapon)
    {
        HeroEquippedWeaponEvent heroEquippedWeaponEvent = new HeroEquippedWeaponEvent()
        {
            Player = player,
            Weapon = weapon
        };

        HeroEquippedWeaponHandler.OnNext(heroEquippedWeaponEvent);

        foreach (Minion battlefieldMinion in GameManager.Instance.GetAllMinions())
        {
            battlefieldMinion.Buffs.OnHeroEquippedWeapon.OnNext(heroEquippedWeaponEvent);
        }
    }
Exemplo n.º 21
0
 public void playerClickWeapon(WeaponCard card)
 {
     currentWeapon = card;
     foreach (WeaponCard c in allWeapons)
     {
         if (c != card)
         {
             c.GetComponent <Button>().interactable = false;
         }
     }
     foreach (CountryCard c in allCountries)
     {
         c.GetComponent <Button>().interactable = true;
     }
 }
Exemplo n.º 22
0
    public void UpdateCardHand()
    {
        if (_hand.Count > 0)
        {
            _hand.Clear();
        }

        if (_copyInv.Count > 0)
        {
            _copyInv.Clear();
        }

        foreach (Transform child in transform)
        {
            Destroy(child.gameObject);
        }

        for (int i = 0; i < pc._inventory.Count; i++)
        {
            if (pc._inventory[i] != null)
            {
                GameObject refr = Instantiate(_cardRefr, this.transform);

                if (pc._inventory[i].card != null)
                {
                    refr.transform.GetChild(0).GetChild(0).GetComponent <Image>().sprite = pc._inventory[i].card.EquipmentSprite;
                }

                CardUI cardInfo = refr.GetComponent <CardUI>();

                WeaponCard wTemp = (WeaponCard)pc._inventory[i].card;

                cardInfo.itemName.text   = pc._inventory[i].card.name;
                cardInfo.ammoCount.text  = pc._inventory[i].ammoCount.ToString() + "/" + wTemp.AmmoCap;
                cardInfo.firingType.text = wTemp.FireMode.ToString();

                _hand.Add(refr);
            }
        }

        foreach (EquipmentItem card in pc._inventory)
        {
            _copyInv.Add(card);
        }

        pc._handChanged = false;
    }
Exemplo n.º 23
0
        /// <summary>
        /// 武器的导入
        /// </summary>
        /// <param name="target"></param>
        /// <param name="workbook"></param>
        private void Weapon(dynamic workbook)
        {
            if (Directory.Exists(ExportFolderPicker.SelectedPathOrFileName + "\\Weapon\\"))
            {
                Directory.Delete(ExportFolderPicker.SelectedPathOrFileName + "\\Weapon\\", true);
            }
            Directory.CreateDirectory(ExportFolderPicker.SelectedPathOrFileName + "\\Weapon\\");
            //武器的导入
            dynamic worksheet = workbook.Sheets(3);
            int     rowCount  = 4;

            while (!string.IsNullOrEmpty(worksheet.Cells(rowCount, 2).Text))
            {
                WeaponCard Weapon = new WeaponCard();
                Weapon.序列号  = worksheet.Cells(rowCount, 2).Text;
                Weapon.称    = worksheet.Cells(rowCount, 3).Text;
                Weapon.描述   = worksheet.Cells(rowCount, 4).Text;
                Weapon.职业   = CSharpUtility.GetEnum <CardUtility.职业枚举>(worksheet.Cells(rowCount, 5).Text, CardUtility.职业枚举.中立);
                Weapon.使用成本 = CSharpUtility.GetInt(worksheet.Cells(rowCount, 7).Text);

                Weapon.攻击力  = CSharpUtility.GetInt(worksheet.Cells(rowCount, 8).Text);
                Weapon.耐久度  = CSharpUtility.GetInt(worksheet.Cells(rowCount, 9).Text);
                Weapon.稀有程度 = CSharpUtility.GetEnum <CardBasicInfo.稀有程度枚举>(worksheet.Cells(rowCount, 12).Text, CardBasicInfo.稀有程度枚举.白色);
                Weapon.是否启用 = !string.IsNullOrEmpty(worksheet.Cells(rowCount, 13).Text);

                switch (exportType)
                {
                case SystemManager.ExportType.XML:
                    XmlSerializer xml         = new XmlSerializer(typeof(WeaponCard));
                    string        XmlFilename = ExportFolderPicker.SelectedPathOrFileName + "\\Weapon\\" + Weapon.序列号 + ".xml";
                    xml.Serialize(new StreamWriter(XmlFilename), Weapon);
                    break;

                case SystemManager.ExportType.JSON:
                    string       JSonFilename = ExportFolderPicker.SelectedPathOrFileName + "\\Weapon\\" + Weapon.序列号 + ".json";
                    StreamWriter json         = new StreamWriter(JSonFilename);
                    json.Write(Weapon.ToJson());
                    json.Close();
                    break;

                default:
                    break;
                }
                rowCount++;
            }
        }
Exemplo n.º 24
0
    void BeginGame() //function for starting the game.
    {
        GameObject controller = GameObject.FindGameObjectWithTag("MenuMusic");

        if (controller != null)
        {
            controller.GetComponent <MenuMusicController>().StopMusic();
        }
        ultimateUsed = false;
        if (LevelController.levelCounter == 0)
        {
            currentAiDeck = aiDeck1;
        }
        else if (LevelController.levelCounter == 1)
        {
            currentAiDeck = aiDeck2;
        }
        else if (LevelController.levelCounter == 2)
        {
            currentAiDeck = aiDeck3;
        }
        else
        {
            print("Level counter error");
        }
        CreatureShuffle(currentAiDeck);
        CreateDictionaries();
        LoadEquipment();
        DealHero();
        DealCreatureHand();
        lootCounter = lootDrop;
        turnState   = turn.Player1;
        if (turnState == turn.Player1)                        //checks if it is the Players's turn
        {
            for (int i = 0; i < equippedWeaponObj.Count; i++) //loop repeats for each weapon on the board
            {
                WeaponCard weapon = equippedWeaponObj[i].GetComponent <WeaponCard>();
                weapon.useButton.SetActive(true);           //enables buttons on all weapon cards during player turn
            }
            if (currentUltimate.ultimateData.cooldown == 0) //Checks if Ultimte is ready
            {
                currentUltimate.useButton.SetActive(true);  //enables button
            }
        }
        APReset();
    }
Exemplo n.º 25
0
        //fonction de simplification de parcour de type de card
        private Card searchRightTypeClass(JToken item)
        {
            //je recup mon token et je veux verifier de quel type il est pour utiliser la bonne class
            string   jsonType      = item["type"].Value <string>();
            string   idCard        = item["id"].Value <string>();
            CardType jsonTypeClass = (CardType)Enum.Parse(typeof(CardType), jsonType);

            if (jsonTypeClass == CardType.HERO)
            {
                HeroCard Card = item.ToObject <HeroCard>();
                Card.LinkPicture = "https://art.hearthstonejson.com/v1/render/latest/frFR/512x/" + idCard + ".png";
                Console.WriteLine(Card.Name + " " + Card.Type + " " + Card.CardClass + " " + Card.Rarity + " : " + idCard);
                return(Card);
            }
            else if (jsonTypeClass == CardType.HERO_POWER)
            {
                HeroPowerCard Card = item.ToObject <HeroPowerCard>();
                Card.LinkPicture = "https://art.hearthstonejson.com/v1/render/latest/frFR/512x/" + idCard + ".png";
                Console.WriteLine(Card.Name + " " + Card.Type + " " + Card.CardClass + " " + Card.Rarity + " : " + idCard);
                return(Card);
            }
            else if (jsonTypeClass == CardType.MINION)
            {
                MinionCard Card = item.ToObject <MinionCard>();
                Card.LinkPicture = "https://art.hearthstonejson.com/v1/render/latest/frFR/512x/" + idCard + ".png";
                Console.WriteLine(Card.Name + " " + Card.Type + " " + Card.CardClass + " " + Card.Rarity + " : " + idCard);
                return(Card);
            }
            else if (jsonTypeClass == CardType.SPELL)
            {
                SpellCard Card = item.ToObject <SpellCard>();
                Card.LinkPicture = "https://art.hearthstonejson.com/v1/render/latest/frFR/512x/" + idCard + ".png";
                Console.WriteLine(Card.Name + " " + Card.Type + " " + Card.CardClass + " " + Card.Rarity + " : " + idCard);
                return(Card);
            }
            else if (jsonTypeClass == CardType.WEAPON)
            {
                WeaponCard Card = item.ToObject <WeaponCard>();
                Card.LinkPicture = "https://art.hearthstonejson.com/v1/render/latest/frFR/512x/" + idCard + ".png";
                Console.WriteLine(Card.Name + " " + Card.Type + " " + Card.CardClass + " " + Card.Rarity + " : " + idCard);
                return(Card);
            }

            return(null);
        }
Exemplo n.º 26
0
 // gets the BP of a single 'valid' card
 public int getValidCardBP(Card card, List <Player> players, string questName)
 {
     if (card.type == "Ally Card")
     {
         AllyCard ally = (AllyCard)card;
         return(ally.getBattlePoints(questName, players));
     }
     if (card.type == "Weapon Card")
     {
         WeaponCard weapon = (WeaponCard)card;
         return(weapon.battlePoints);
     }
     else
     {
         // amour
         return(10);
     }
 }
Exemplo n.º 27
0
 // sorts the weapons in DESCENDING order of BP
 public List <Card> sortWeaponsByDescendingOrder(List <Card> weapons)
 {
     for (int x = 0; x < weapons.Count; x++)
     {
         for (int i = 0; i < (weapons.Count - 1); i++)
         {
             WeaponCard weapon1 = (WeaponCard)weapons[i];
             WeaponCard weapon2 = (WeaponCard)weapons[i + 1];
             if (weapon1.battlePoints < weapon2.battlePoints)
             {
                 var temp = weapons[i + 1];
                 weapons[i + 1] = weapons[i];
                 weapons[i]     = temp;
             }
         }
     }
     return(weapons);
 }
Exemplo n.º 28
0
    public void GiveNewCard(EquipmentCard newCard)
    {
        if (newCard.type == EquipmentType.item)
        {
            ItemCard iCard = (ItemCard)newCard;
            iCard.UseItem(this);
        }
        else if (newCard.type == EquipmentType.weapon)
        {
            EquipmentItem newItem = new EquipmentItem();
            newItem.card = newCard;
            WeaponCard temp = (WeaponCard)newCard;
            newItem.ammoCount = temp.AmmoCap;

            _inventory.Add(newItem);
        }

        _handChanged = true;
    }
Exemplo n.º 29
0
    public override void UpdateNumbers()
    {
        CostController.UpdateNumber(Card.CurrentCost, Util.GetColor(Card.CurrentCost, Card.BaseCost));

        switch (Card.GetCardType())
        {
        case CardType.Minion:
            MinionCard minionCard = Card.As <MinionCard>();
            AttackController.UpdateNumber(minionCard.CurrentAttack, Util.GetColor(minionCard.CurrentAttack, minionCard.BaseAttack));
            AttributeController.UpdateNumber(minionCard.CurrentHealth, Util.GetColor(minionCard.CurrentHealth, minionCard.BaseHealth));
            break;

        case CardType.Weapon:
            WeaponCard weaponCard = Card.As <WeaponCard>();
            AttackController.UpdateNumber(weaponCard.CurrentAttack, Util.GetColor(weaponCard.CurrentAttack, weaponCard.BaseAttack));
            AttributeController.UpdateNumber(weaponCard.CurrentDurability, Util.GetColor(weaponCard.CurrentDurability, weaponCard.BaseDurability));
            break;
        }
    }
Exemplo n.º 30
0
    public void UseItem(PlayerController pc)
    {
        // Debug.Log("Using item");
        if (itemType == ItemType.consumable)
        {
            Debug.Log("Using Consumable...");
        }
        else if (itemType == ItemType.equipment)
        {
            // Debug.Log("Giving Equipment...");

            WeaponCard newWeapon = weapons[Random.Range(0, weapons.Count)];

            EquipmentItem newItem = new EquipmentItem();
            newItem.card      = newWeapon;
            newItem.ammoCount = newWeapon.AmmoCap;

            pc._inventory.Add(newItem);
        }
    }