Beispiel #1
0
    public void collect(Unit collector)
    {
        //give them a loot card
        Card_Loot card = (Card_Loot)CardManager.instance.getCardFromIdName("loot");

        card.lootSetup(level);
        card.setup(collector, collector.deck);
        collector.deck.addCardToHand(card);

        //mark that we're done
        isDone = true;
    }
    void createDummyLoot()
    {
        lootList = new List <Card_Loot> ();
        for (int i = 1; i < 6; i++)
        {
            int       level = (i % 2) + 1;
            Card_Loot card  = (Card_Loot)CardManager.instance.getCardFromIdName("loot");
            card.lootSetup(level);
            card.setup(null, null);
            lootList.Add(card);
        }

        Debug.Log("did it");
    }
Beispiel #3
0
    //finishing the game
    public List <Card_Loot> syphonLootFromDrawPile()
    {
        List <Card_Loot> loot = new List <Card_Loot> ();

        for (int i = drawPile.Count - 1; i >= 0; i--)
        {
            if (drawPile [i].type == Card.CardType.Loot)
            {
                Card_Loot lootCard = (Card_Loot)drawPile [i];
                drawPile.RemoveAt(i);
                loot.Add(lootCard);
            }
        }
        return(loot);
    }
Beispiel #4
0
    private LootReward getRewardFromLootCard(Card_Loot lootCard)
    {
        LootReward reward = new LootReward();
        int        level  = (int)Mathf.Max(lootCard.level, 1);

        reward.baseMoney = level + 1;

        int numCardsAtLevel          = 2;
        int numCardPairsAtLowerLevel = 2;

        //every reward needs to include at least one movement card
        bool hasMovementCard = false;

        List <string> cardsThisLevel  = CardManager.instance.getIDListAtLevel(level);
        List <string> cardsLowerLevel = CardManager.instance.getIDListAtLevel((int)Mathf.Max(1, level - 1));

        int numLowerLevelCardsPerGroup = 2;

        if (level <= 1)
        {
            numLowerLevelCardsPerGroup = 1;
        }
        for (int i = 0; i < numCardPairsAtLowerLevel; i++)
        {
            Card[] cards = new Card[numLowerLevelCardsPerGroup];
            for (int j = 0; j < numLowerLevelCardsPerGroup; j++)
            {
                int    idNum  = (int)Random.Range(0, cardsLowerLevel.Count);
                string idName = cardsLowerLevel [idNum];
                //cardsLowerLevel.RemoveAt (idNum);	//no duplicate cards in the same pack
                //maybe this is OK for lower level packs
                Card card = CardManager.instance.getCardFromIdName(idName);
                card.setup(null, null);
                cards [j] = card;
                if (card.type == Card.CardType.Movement)
                {
                    hasMovementCard = true;
                }
            }
            reward.addMultipleCards(cards);
        }

        for (int i = 0; i < numCardsAtLevel; i++)
        {
            int    idNum  = (int)Random.Range(0, cardsThisLevel.Count);
            string idName = cardsThisLevel [idNum];
            cardsThisLevel.RemoveAt(idNum);                     //no duplicate cards in the same pack
            Card card = CardManager.instance.getCardFromIdName(idName);
            card.setup(null, null);
            if (card.type == Card.CardType.Movement)
            {
                hasMovementCard = true;
            }
            reward.addSingleCard(card);
        }

        //and a money option
        reward.addMoneyOption(getRewardMoney(level));

        //if there is a movement card, return it, otheriwse try again
        if (hasMovementCard)
        {
            return(reward);
        }
        else
        {
            return(getRewardFromLootCard(lootCard));
        }
    }
Beispiel #5
0
    //used when loading in the cards on start
    public Card getCardFromXMLNode(XmlNode node)
    {
        Card thisCard = null;

        string scriptName = node ["script"].InnerText;

        if (scriptName == "Card_Loot")
        {
            thisCard = new Card_Loot(node);
        }
        else if (scriptName == "Card_Movement")
        {
            thisCard = new Card_Movement(node);
        }
        else if (scriptName == "Card_Attack")
        {
            thisCard = new Card_Attack(node);
        }
        else if (scriptName == "Card_AttackTypeCount")
        {
            thisCard = new  Card_AttackTypeCount(node);
        }
        else if (scriptName == "Card_BasicAOEAttack")
        {
            thisCard = new Card_BasicAOEAttack(node);
        }
        else if (scriptName == "Card_BasicTargetBonus")
        {
            thisCard = new Card_BasicTargetBonus(node);
        }
        else if (scriptName == "Card_CardsPlayedBonus")
        {
            thisCard = new Card_CardsPlayedBonus(node);
        }
        else if (scriptName == "Card_CoverAttack")
        {
            thisCard = new Card_CoverAttack(node);
        }
        else if (scriptName == "Card_GiveCharm")
        {
            thisCard = new Card_GiveCharm(node);
        }
        else if (scriptName == "Card_Heal")
        {
            thisCard = new Card_Heal(node);
        }
        else if (scriptName == "Card_MoveAndAttack")
        {
            thisCard = new Card_MoveAndAttack(node);
        }
        else if (scriptName == "Card_MoveAttackAOE")
        {
            thisCard = new Card_MoveAttackAOE(node);
        }
        else if (scriptName == "Card_TeamDash")
        {
            thisCard = new Card_TeamDash(node);
        }
        else if (scriptName == "Card_Teleport")
        {
            thisCard = new Card_Teleport(node);
        }
        else if (scriptName == "Card_Trade_Places")
        {
            thisCard = new Card_Trade_Places(node);
        }
        else if (scriptName == "Card_DirectDamage")
        {
            thisCard = new Card_DirectDamage(node);
        }
        else if (scriptName == "Card_Equipment")
        {
            thisCard = new Card_Equipment(node);
        }
        else if (scriptName == "Card_RemoveCharm")
        {
            thisCard = new Card_RemoveCharm(node);
        }
        else if (scriptName == "Card_SpawnUnit")
        {
            thisCard = new Card_SpawnUnit(node);
        }
        else if (scriptName == "Card_DiscardAndDraw")
        {
            thisCard = new Card_DiscardAndDraw(node);
        }
        else if (scriptName == "Card_ChangeCover")
        {
            thisCard = new Card_ChangeCover(node);
        }
        else if (scriptName == "Card_LatchOn")
        {
            thisCard = new Card_LatchOn(node);
        }
        else if (scriptName == "Card_LeechBite")
        {
            thisCard = new Card_LeechBite(node);
        }
        else
        {
            Debug.Log("SCRIPT NAME FOR CARD NOT FOUND: " + scriptName);
        }

        return(thisCard);
    }
Beispiel #6
0
    //used to actually get new cards during the game
    public Card getCardFromBlueprint(Card blueprint)
    {
        Card thisCard = null;

        string scriptName = blueprint.scriptName;

        if (scriptName == "Card_Loot")
        {
            thisCard = new Card_Loot();
        }
        else if (scriptName == "Card_Movement")
        {
            thisCard = new Card_Movement();
        }
        else if (scriptName == "Card_Attack")
        {
            thisCard = new Card_Attack();
        }
        else if (scriptName == "Card_AttackTypeCount")
        {
            thisCard = new  Card_AttackTypeCount();
        }
        else if (scriptName == "Card_BasicAOEAttack")
        {
            thisCard = new Card_BasicAOEAttack();
        }
        else if (scriptName == "Card_BasicTargetBonus")
        {
            thisCard = new Card_BasicTargetBonus();
        }
        else if (scriptName == "Card_CardsPlayedBonus")
        {
            thisCard = new Card_CardsPlayedBonus();
        }
        else if (scriptName == "Card_CoverAttack")
        {
            thisCard = new Card_CoverAttack();
        }
        else if (scriptName == "Card_GiveCharm")
        {
            thisCard = new Card_GiveCharm();
        }
        else if (scriptName == "Card_Heal")
        {
            thisCard = new Card_Heal();
        }
        else if (scriptName == "Card_MoveAndAttack")
        {
            thisCard = new Card_MoveAndAttack();
        }
        else if (scriptName == "Card_MoveAttackAOE")
        {
            thisCard = new Card_MoveAttackAOE();
        }
        else if (scriptName == "Card_TeamDash")
        {
            thisCard = new Card_TeamDash();
        }
        else if (scriptName == "Card_Teleport")
        {
            thisCard = new Card_Teleport();
        }
        else if (scriptName == "Card_Trade_Places")
        {
            thisCard = new Card_Trade_Places();
        }
        else if (scriptName == "Card_DirectDamage")
        {
            thisCard = new Card_DirectDamage();
        }
        else if (scriptName == "Card_Equipment")
        {
            thisCard = new Card_Equipment();
        }
        else if (scriptName == "Card_RemoveCharm")
        {
            thisCard = new Card_RemoveCharm();
        }
        else if (scriptName == "Card_SpawnUnit")
        {
            thisCard = new Card_SpawnUnit();
        }
        else if (scriptName == "Card_DiscardAndDraw")
        {
            thisCard = new Card_DiscardAndDraw();
        }
        else if (scriptName == "Card_ChangeCover")
        {
            thisCard = new Card_ChangeCover();
        }
        else if (scriptName == "Card_LatchOn")
        {
            thisCard = new Card_LatchOn();
        }
        else if (scriptName == "Card_LeechBite")
        {
            thisCard = new Card_LeechBite();
        }
        else
        {
            Debug.Log("SCRIPT NAME FOR BLUEPRINT NOT FOUND: " + scriptName);
        }

        if (thisCard != null)
        {
            thisCard.blueprint = blueprint;
        }
        return(thisCard);
    }