// Return a list of list the count of stages, where at each index is the card(s) that sets up each stage public List <List <Card> > setupQuest(int stages, List <Card> hand, string questFoe) { strategyUtil strat = new strategyUtil(); // instantiate the quest line List <List <Card> > questLine = new List <List <Card> >(); // create the final stage first List <Card> finalStage = setupFoeStage(stages, stages, hand, questFoe, 0); // if we have a test, create a test stage and then work from the first stage to fill in the foe stages if (strat.haveTest(hand)) { List <Card> testStage = setupTestStage(hand); for (int i = 0; i < (stages - 2); i++) { List <Card> foeStage = setupFoeStage(i, stages, hand, questFoe, 0); questLine.Add(foeStage); } questLine.Add(testStage); // else we don't have a test, we fill in foe stages the same way but 1 more for the missing test } else { for (int i = 0; i < (stages - 1); i++) { List <Card> foeStage = setupFoeStage(i, stages, hand, questFoe, 0); questLine.Add(foeStage); } } // add our final Stage that we created first so its on the end and return questLine.Add(finalStage); return(questLine); }
public List <List <Card> > setupQuest(int stages, List <Card> hand, string questFoe) { // instantiate the quest line strategyUtil strat = new strategyUtil(); List <List <Card> > questLine = new List <List <Card> >(); // create the final stage first List <Card> finalStage = setupFoeStage(stages, stages, hand, questFoe, 0); int prevBP = strat.sumFoeEncounterCards(finalStage, questFoe); questLine.Add(finalStage); // if we have a test, create a test stage and then work from the first stage to fill in the foe stages if (strat.haveTest(hand)) { List <Card> testStage = setupTestStage(hand); questLine.Add(testStage); for (int i = 0; i < (stages - 2); i++) { List <Card> foeStage = setupFoeStage(i, stages, hand, questFoe, prevBP); questLine.Add(foeStage); prevBP = strat.sumFoeEncounterCards(foeStage, questFoe); } // else we don't have a test, we fill in foe stages the same way but 1 more for the missing test } else { for (int i = 0; i < (stages - 1); i++) { List <Card> foeStage = setupFoeStage(i, stages, hand, questFoe, prevBP); questLine.Add(foeStage); prevBP = strat.sumFoeEncounterCards(foeStage, questFoe); } } questLine.Reverse(); /* * for (int i = 0; i < questLine.Count; i++) * { * for (int j = 0; j < questLine[i].Count; j++) * { * questLine[i][j].display(); * } * } */ return(questLine); }
public List <List <Card> > setupQuest(int stages, List <Card> hand, string questFoe) { strategyUtil strat = new strategyUtil(); // initalize the quest line List <List <Card> > questLine = new List <List <Card> >(); // call setupFoeStage with stage == stages so it'll know to set up the FINAL encounter. List <Card> finalStage = setupFoeStage(stages, stages, hand, questFoe, 0); // get the BP of the foe encounter and add it to the questLine int prevBP = strat.sumFoeEncounterCards(finalStage, questFoe); questLine.Add(finalStage); // we either build the rest of the Quest taking into account a test encounter. if (strat.haveTest(hand)) { List <Card> testStage = setupTestStage(hand); questLine.Add(testStage); for (int i = 0; i < (stages - 2); i++) { List <Card> foeStage = setupFoeStage(i, stages, hand, questFoe, prevBP); prevBP = strat.sumFoeEncounterCards(foeStage, questFoe); questLine.Add(foeStage); } } // or a quest being filled by purely foe encounters else { for (int i = 0; i < (stages - 1); i++) { List <Card> foeStage = setupFoeStage(i, stages, hand, questFoe, prevBP); prevBP = strat.sumFoeEncounterCards(foeStage, questFoe); questLine.Add(foeStage); } } // reverse the quest because weve set up the stages backward then return questLine.Reverse(); return(questLine); }
// checks whether or not a CPU has the requisite cards to sponsor the quest public bool canISponsor(List <Card> hand, int stages) { // see if we have enough cards to sponsor the quest // Count through our hand and subtract strategyUtil strat = new strategyUtil(); int stageCount = stages; List <Card> foes = new List <Card>(); for (var i = 0; i < hand.Count; i++) { // count up our foes to compare to the # of stages if (hand[i].type == "Foe Card" && checkDuplicate(hand[i], foes, "Foe Card")) { stageCount -= 1; foes.Add(hand[i]); } } // decreate stageCount by one more if we had a Test if (strat.haveTest(hand)) { stageCount -= 1; } return(stageCount <= 0); }