コード例 #1
0
    public List <Card> setUpEarlyFoeEncounter(List <Card> hand, string questFoe, int prev)
    {
        strategyUtil strat        = new strategyUtil();
        List <Card>  foeEncounter = new List <Card>();
        List <Card>  foes         = new List <Card>();

        for (int i = 0; i < hand.Count; i++)
        {
            if (hand[i].type == "Foe Card" && strat.getValidCardBP(hand[i], new List <Player>(), questFoe) < prev)
            {
                foes.Add(hand[i]);
            }
        }

        foes = strat.sortFoesByDescendingOrder(foes, questFoe);
        foeEncounter.Add(foes[0]);
        hand.Remove(foes[0]);

        for (int i = 0; i < hand.Count; i++)
        {
            if (hand[i].type == "Weapon Card" && strat.hasMultiple(hand, hand[i].name) && strat.checkDuplicate(hand[i], foeEncounter, "Weapon Card") && ((strat.sumFoeEncounterCards(foeEncounter, questFoe) + strat.getValidCardBP(hand[i], new List <Player>(), questFoe) < prev)))
            {
                foeEncounter.Add(hand[i]);
                hand.Remove(hand[i]);
            }
        }
        return(foeEncounter);
    }
コード例 #2
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);
    }
コード例 #3
0
    public List <Card> setUpFinalFoe(List <Card> hand, string questFoe)
    {
        strategyUtil strat = new strategyUtil();
        // get a list of our foes and weapons
        List <Card> foes    = new List <Card>();
        List <Card> weapons = new List <Card>();

        for (var i = 0; i < hand.Count; i++)
        {
            if (hand[i].type == "Foe Card")
            {
                foes.Add(hand[i]);
            }
            // for our weapons, we also filter out duplicates
            if (hand[i].type == "Weapon Card" && strat.checkDuplicate(hand[i], weapons, "Weapon Card"))
            {
                weapons.Add(hand[i]);
            }
        }

        // sort the foes in descending order so our strongest foe is first
        foes = strat.sortFoesByDescendingOrder(foes, questFoe);

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

        // add the strongest foe to the encounter
        foeEncounter.Add(foes[0]);
        hand.Remove(foes[0]);

        // loop twice, once to add all of our non duplicate weapons to the encounter
        for (int i = 0; i < weapons.Count; i++)
        {
            foeEncounter.Add(weapons[i]);
        }

        // and once to remove from our hands
        for (int i = 1; i < foeEncounter.Count; i++)
        {
            hand.Remove(foeEncounter[i]);
        }

        return(foeEncounter);
    }
コード例 #4
0
    public List <Card> setUpEarlyFoeEncounter(List <Card> hand, string questFoe, int prev)
    {
        strategyUtil strat = new strategyUtil();
        // instantiate a list of foes we have and the foe encounter
        List <Card> foeEncounter = new List <Card>();
        List <Card> foes         = new List <Card>();

        // put all valid foe cards in the foes list
        for (int i = 0; i < hand.Count; i++)
        {
            if (hand[i].type == "Foe Card" && strat.getValidCardBP(hand[i], new List <Player>(), questFoe) < prev)
            {
                foes.Add(hand[i]);
            }
        }
        // sort by descending order, take teh strongest and return
        foes = strat.sortFoesByDescendingOrder(foes, questFoe);
        foeEncounter.Add(foes[0]);
        hand.Remove(foes[0]);

        return(foeEncounter);
    }