public Quest(long prior, int seed, params QuestChallenge[] challenges) { _obstacles = challenges; if (challenges.Length > 0) { originalGoal = challenges[challenges.Length - 1].type; } numQuestsBefore = prior; heroMaxHealth = 100 + ((UpgradeIntValue)Main.instance.player.upgrades[UpgradeType.HERO_HEALTH]).value; heroCurHealth = heroMaxHealth; inventory = new List <ItemStack>(); questStep = 0; questTimer = 60; questTotalTime = GetQuestMaxTime(); questRand = new System.Random(seed); HarrowDeck deck = new HarrowDeck(); STR = deck.STR.tokens; AGL = deck.AGL.tokens; INT = deck.INT.tokens; CHA = deck.CHA.tokens; if (challenges.Length > 0) { List <long> reqList = new List <long>(); //Debug.Log(Upgrades.AllRenownUps.Find(x => x.saveName == "QUEST_REQS")); if (Upgrades.AllRenownUps.Find(x => x.saveName == "QUEST_REQS").getIsPurchased()) { getBetterRequirements(ref reqList, challenges); } else { getBasicRequirements(ref reqList, challenges); } knownRequirements = new long[6]; for (int ki = 0; ki < 6 && ki < reqList.Count; ki++) { knownRequirements[ki] = reqList[ki]; } /*knownRequirements[0] = (long)challenges[0].getReq(0); * knownRequirements[1] = (long)challenges[0].getReq(1); * knownRequirements[2] = (long)challenges[0].getReq(2); * knownRequirements[3] = (long)challenges[challenges.Length - 1].getReq(0); * knownRequirements[4] = (long)challenges[challenges.Length - 1].getReq(1); * knownRequirements[5] = (long)challenges[challenges.Length - 1].getReq(2); * Array.Sort(knownRequirements); * Array.Reverse(knownRequirements);*/ } rewards = new ItemStack[2]; //Debug.Log(challenges[challenges.Length - 1].type.name); }
public override EnumResult MakeAttempt(Quest theQuest, int fails, int partials, int questBonus) { EnumResult result = EnumResult.MIXED; if (theQuest.inventory.Count == 0) { return(EnumResult.CONTINUE); } HarrowDeck opponent = new HarrowDeck(); int opScore = 0; int heroScore = 0; if (theQuest.testStrength(questBonus)) { heroScore += 1; } if (theQuest.testAgility(questBonus)) { heroScore += 1; } if (testAttribute(opponent.STR.tokens)) { opScore += 1; } if (testAttribute(opponent.AGL.tokens)) { opScore += 1; } if ((result + heroScore - opScore) == EnumResult.MIXED && theQuest.heroCurHealth < 30) { return(EnumResult.CRIT_FAIL); } return(result + heroScore - opScore); }