/// <summary> /// Makes the Resource print itself out. /// </summary> /// <param name="forest"></param> /// <param name="amount"></param> public virtual void Print(Forest forest, int amount) { Console.WriteLine(Text(forest, amount)); }
/// <summary> /// Returns what the price of a given purchase will be modified by. /// The modification is equal to Inc^(lift+base) /// /// Lift indicates how many more purchases this modifier counts for than the current base. /// This is used for getting the price of paying this Resources several times at the same time. /// </summary> /// <param name="lift"></param> /// <param name="forest"></param> /// <returns></returns> public double Modifier(int lift, Forest forest) { return(Math.Pow(forest.GetValue(Inc), forest.GetValue(XValue) + lift)); }
static void Main(string[] args) { var culture = new CultureInfo("en-US"); Thread.CurrentThread.CurrentCulture = culture; Forest forest = new Forest(); Initializer.Init(forest); while (true) { Console.Write("\nWhat do you do? "); string l = Console.ReadLine(); if (l.StartsWith("do")) { if (l.Split(' ').Length == 1) { forest.ListDoables(); } else if (forest.Doables.ContainsKey(l.Substring(3).Trim())) { forest.PerformDoable(l.Substring(3)); } else { Console.WriteLine("No doable by name " + l.Substring(3).Trim()); } } else if (l.StartsWith("count")) { forest.ListGrowths(); } else if (l.ToLower().StartsWith("growth")) { if (l.Split(' ').Length == 1) { forest.ListGrowths(); } else { string growth = l.Substring(6).Trim(); if (!forest.Entities.ContainsKey(growth)) { Console.WriteLine("No Growth by name " + growth); } else { forest.Entities[growth].Echo(true); } } } else if (l.StartsWith("create")) { if (l.Split(' ').Length == 1) { forest.ListPrices(); } else if (forest.Entities.ContainsKey(l.Substring(7).Trim())) { string thing = l.Substring(7).Trim(); if (!forest.Entities.ContainsKey(thing) || !forest.Entities[thing].HasExtension(E.EEXT_BUYABLE)) { Console.WriteLine("This cannot be created."); } else { Console.Write("How many? "); l = Console.ReadLine(); int res = 0; if (l.EndsWith("%")) { if (int.TryParse(l.Substring(0, l.Length - 1), out res)) { forest.BuyObject(thing, res, true); } } else { res = 0; if (int.TryParse(l, out res)) { if (res > 0) { forest.BuyObject(thing, res); } } } } } } else if (l.StartsWith("items")) { forest.ListGrowths(E.GRP_ITEMS); } else if (l.StartsWith("skills")) { forest.ListSkills(); } else if (l.StartsWith("hp")) { Console.WriteLine(Math.Round(forest.Hp, 2) + " / " + Math.Round(forest.Stats[E.HEALTH], 2)); } else if (l.StartsWith("mana")) { Console.WriteLine(Math.Round(forest.Mana, 2) + " / " + Math.Round(forest.Stats[E.MAXMANA], 2)); } else if (l.StartsWith("fight")) { forest.StartFighting(); } else if (l.StartsWith("boss")) { forest.EchoBoss(); } else if (l.StartsWith("stats")) { foreach (KeyValuePair <string, double> entry in forest.GetStats()) { if (entry.Value != 0) { Console.WriteLine(entry.Key + ": " + entry.Value); } } if (debug && forest.Boss != null) { Console.WriteLine("DEBUG VALUE (hp*(attack-b.def)): " + Statics.GetDisplayNumber(forest.Hp * (forest.Stats[E.ATTACK] - forest.Boss.Stats[E.DEFENSE]))); Console.WriteLine("DEBUG VALUE 2 ((b.attack-(def+hpReg))/soothing * 30) - seconds to survive: " + ((forest.Boss.Stats[E.ATTACK] - (forest.Stats[E.DEFENSE] + forest.Stats[E.HEALTHREGEN])) / forest.Stats[E.SOOTHING]) * 30 + "s"); } } else if (l.StartsWith("upgrades")) { forest.ListAvailableUpgrades(); } else if (l.StartsWith("upgrade")) // Get data on a specific Upgrade and maybe buy it { if (l.Split(' ').Length == 1) { forest.ListAvailableUpgrades(); } else { string upgrade = l.Substring(8); if (upgrade == "all") { foreach (Upgrade u in forest.GetEntities(E.GRP_UPGRADES)) { if (u.Unlocked && !u.Owned) { u.Create(1); } } } else if (!forest.Entities.ContainsKey(upgrade) || !forest.Entities[upgrade].Unlocked || forest.Entities[upgrade].Group != E.GRP_UPGRADES) { Console.WriteLine("No upgrade by name " + upgrade); } else { forest.Entities[upgrade].Echo(); if (!((Upgrade)forest.Entities[upgrade]).Owned) //Let you buy the upgrade { Console.WriteLine("Do you want to buy it? [Y/N]"); string answer = Console.ReadLine(); if (answer.Trim().ToLower().Equals("y")) { forest.Entities[upgrade].Create(1); } else { Console.WriteLine("Okay :)"); } } } } } else if (l.StartsWith("talents")) { if (l.Split(' ').Length == 1) { foreach (KeyValuePair <string, int> talentPoints in forest.TalentPoints) { if (forest.Xp[talentPoints.Key] > 101) { Console.WriteLine(talentPoints.Key + ": " + talentPoints.Value + " point" + (talentPoints.Value != 1 ? "s" : "") + "."); } } forest.ListAvailableTalents(null); } else { string skill = l.Substring(8); if (!Statics.skills.Contains(skill)) { Console.WriteLine("That skill does not exist!"); } else { Console.WriteLine(skill + ": " + forest.TalentPoints[skill] + " point" + (forest.TalentPoints[skill] != 1 ? "s" : "") + "."); forest.ListAvailableTalents(skill); } } } else if (l.StartsWith("talent")) // Get data on a specific Talent and maybe buy it { if (l.Split(' ').Length == 1) { PrintHelp(); } else { string talent = l.Substring(7); if (!forest.Entities.ContainsKey(talent) || !forest.Entities[talent].Unlocked) { Console.WriteLine("No talent by name " + talent); } else { forest.Entities[talent].Echo(); if (!((Talent)forest.Entities[talent]).Owned) //Let you buy the talent { Console.WriteLine("Do you want to buy it? [Y/N]"); string answer = Console.ReadLine(); if (answer.Trim().ToLower().Equals("y")) { forest.Entities[talent].Create(1); } else { Console.WriteLine("Okay :)"); } } } } } else if (l.StartsWith("modifiers")) { forest.ListModifiers(); } else if (l.StartsWith("branch")) { forest.PickPath(); } else if (l.StartsWith("path")) { forest.EchoPath(); } else if (l.StartsWith("path")) { forest.EchoPath(); } else if (l.StartsWith("style")) { if (forest.GetValue(E.CHANGED_STYLE) > 0) { Console.WriteLine("You have already picked your style. You need time and contemplation if you want to repick."); } else if (l.Length == 5) { Console.WriteLine(E.STYLE_FIGHT + ": Lock in to the path of fighting for your right."); if (forest.Stats[E.SOOTHING] > 0) { Console.WriteLine(E.STYLE_SOOTHE + ": Soothe your enemies, but don't deal them damage"); } } else { string style = l.Substring(6); if (style == E.STYLE_FIGHT) { Console.WriteLine("You are now locked in as a fighter."); forest.FightingStyle = E.STYLE_FIGHT; forest.Values[E.CHANGED_STYLE] = 1; } else if (style == E.STYLE_SOOTHE && forest.Stats[E.SOOTHING] > 0) { Console.WriteLine("You are now a Soother!"); forest.FightingStyle = E.STYLE_SOOTHE; forest.Values[E.CHANGED_STYLE] = 1; } else { Console.WriteLine("Invalid style!"); } } } else if (l.StartsWith("debug")) { debug = !debug; if (l.Split(' ').Length > 1) { if (int.TryParse(l.Split(' ')[1], out int res)) { if (res > 0) { debugCountTime = res; } debug = true; } } if (debug) { Console.WriteLine("Now debugging..."); } else { Console.WriteLine("Not debugging anymore."); } } else if (l.StartsWith("time")) { Console.WriteLine(forest.Count / 5 + "s, offline " + forest.OfflineTicks / 5 + "s"); Console.WriteLine(forest.LifeCount / 5 + "s alive"); } else if (l.StartsWith("save")) { if (l.Split(' ').Length > 1) { forest.Save(l.Substring(5)); } else { forest.Save(); } } else if (l.StartsWith("load")) { forest.Running = false; forest = new Forest(); Initializer.firstInit = true; Initializer.Init(forest); if (l.Split(' ').Length > 1) { forest.Load(l.Substring(5)); } else { forest.Load(); } } else if (l.StartsWith("think")) { forest.Think();; } else { PrintHelp(); } } }
public override double Calculate(double number, Forest forest) { return(forest.GetValue(BaseValue) + forest.GetValue(Proportionality) * number); }
public virtual double Calculate(double number, Forest forest) => 0;
public static void InitValues(Forest forest) { forest.Entities[E.ORGANIC_MATERIAL].Unlocked = true; forest.FightingStyle = E.STYLE_FIGHT; forest.Values[E.DEFEATED_BOSSES] = 0; forest.Values["wandlevel"] = 0; forest.Values[E.BOUGHT_THINGS] = 0; forest.Values["allowedGrowths"] = 2; forest.AddModifier(new Modifier("Base Stats", modifiersA: new Dictionary <string, double>() { { "HealthRegen", 1 }, { E.MAXMANA, 120 }, { E.MANAREGEN, 1 } })); forest.AddModifier(new Modifier(E.XP + E.GAIN, modifiersF: new Dictionary <string, double>() { { E.XP + E.GAIN, 1 } })); foreach (string skill in Statics.skills) { forest.Values[skill + E.XP + E.GAIN] = 1; forest.Modifiers[E.XP + E.GAIN].ModifiersF[skill + E.XP + E.GAIN] = 1; } //Modifier som GrowthDruids can increase når de increaser xp gain af noget //Druidcraft XP: Income //Animal Handling XP: Damage givet //Soothing XP: Soothing udført // BUSHES forest.Values[E.ENTITY_BUSHES + E.GAIN] = 0.6; forest.Values[E.ENTITY_BUSHES + E.ATTACK] = 0.2; forest.Values[E.ENTITY_BUSHES + E.HEALTH] = 0.2; forest.Values[E.ENTITY_BUSHES + E.INC] = 1.1; forest.Entities[E.ENTITY_BUSHES].Amount = 1; forest.Entities[E.ENTITY_BUSHES].Unlocked = true; forest.Entities[E.ENTITY_BUSHES].Description = "Adds 0.2 attack and 0.2 health each."; // OAKS forest.Values[E.ENTITY_OAKS + E.GAIN] = 2; forest.Values[E.ENTITY_OAKS + E.HEALTH] = 1; forest.Values[E.ENTITY_OAKS + E.INC] = 1.1; forest.Entities[E.ENTITY_OAKS].Unlocked = true; forest.Entities[E.ENTITY_OAKS].Description = "Adds 1 health each."; // ANTS forest.Values[E.ENTITY_ANTS + E.GAIN] = 3.6; forest.Values[E.ENTITY_ANTS + E.ATTACK] = 0.8; forest.Values[E.ENTITY_ANTS + E.INC] = 1.1; forest.Entities[E.ENTITY_ANTS].Description = "Adds 0.8 attack each. Gives 3% xp mod in Animal handling."; // BIRCHES forest.Values[E.ENTITY_BIRCHES + E.GAIN] = 7; forest.Values[E.ENTITY_BIRCHES + E.DEFENSE] = 0.25; forest.Values[E.ENTITY_BIRCHES + E.INC] = 3; forest.Entities[E.ENTITY_BIRCHES].Description = "Adds 0.25 defense each. Is a limited growth. Each birch costs 3x the last."; // YEWS forest.Values[E.ENTITY_YEWS + E.GAIN] = 23; forest.Values[E.ENTITY_YEWS + E.HEALTH] = 4; forest.Values[E.ENTITY_YEWS + E.INC] = 1.1; forest.Entities[E.ENTITY_YEWS].Description = "Adds 4 health each."; // FLOWERS forest.Values[E.ENTITY_FLOWERS + E.HEALTHREGEN] = 0.2; forest.Values[E.ENTITY_FLOWERS + E.SOOTHING] = 2; forest.Values[E.ENTITY_FLOWERS + E.INC] = 1.1; // SPIDERS forest.Values[E.ENTITY_SPIDERS + E.GAIN] = 85; forest.Values[E.ENTITY_SPIDERS + E.ATTACK] = 1; forest.AddModifier(new Modifier(E.ENTITY_SPIDERS + E.ATTACK + E.MOD, new Dictionary <string, double>() { { E.ENTITY_SPIDERS + E.ATTACK, 1 } })); forest.Values[E.ENTITY_SPIDERS + E.INC] = 1.1; // DOABLES forest.Values[E.ABIL_REJUVENATE + E.MOD] = 5; forest.Values[E.ABIL_REJUVENATE + E.COOLDOWN + E.MOD] = 1; //Is a speed, making it higher will make it faster. forest.Values[E.ABIL_REJUVENATE + E.MANA] = 15; forest.Doables[E.ABIL_REJUVENATE].Unlocked = true; // Harmony forest.Values[E.ABIL_HARMONY + E.TIME] = 15 * 5; // Ticks harmony lasts forest.Values[E.ABIL_HARMONY + E.COOLDOWN + E.TIME] = 60 * 5; // Ticks harmony cooldowns forest.Doables[E.ABIL_HARMONY].Unlocked = false; forest.Doables[E.ABIL_HARMONY].Requirements += E.ABIL_HARMONY + E.COOLDOWN + "_<=_0"; forest.Values[E.ABIL_HARMONY + E.MANA] = 100; // Rageuvenate forest.Values[E.ABIL_RAGEUVENATE + E.COOLDOWN + E.TIME] = 30 * 5; forest.Doables[E.ABIL_RAGEUVENATE].Requirements += E.ABIL_RAGEUVENATE + E.COOLDOWN + "_<=_0"; forest.Values[E.ABIL_RAGEUVENATE + E.DAMAGE + E.TIME] = 2; // How many rounds of damage Rageuvenate deals forest.Values[E.ABIL_RAGEUVENATE + E.INCOME + E.TIME] = 12 * 5; // How many ticks of income Rageuvenate gives forest.Values[E.ABIL_RAGEUVENATE + E.MANA] = 45; // Surf the Web forest.Values[E.ABIL_SURF_THE_WEB + E.TIME] = 20 * 5; // Ticks Surf the Web lasts forest.Doables[E.ABIL_SURF_THE_WEB].Unlocked = false; forest.Doables[E.ABIL_SURF_THE_WEB].Requirements += E.ABIL_SURF_THE_WEB + E.COOLDOWN + "_<=_0"; forest.Values[E.ABIL_SURF_THE_WEB + E.MANA] = 100; forest.Values[E.ABIL_SURF_THE_WEB + E.TREES + E.MOD] = 0.05; forest.Values[E.ABIL_SURF_THE_WEB + E.ANIMALS + E.MOD] = 0.05; // Web Site forest.Values[E.UPG_WEB_SITE + E.MOD] = 0.2; // How much each magnitude of income increases the floating point modifier on spider attack. // Web Development & Webs forest.Values[E.ENTITY_WEBS + E.GAIN] = 1E+4; forest.Values[E.ENTITY_WEBS + E.DEFENSE] = 50; forest.Values[E.ENTITY_WEBS + E.ATTACK] = 5; forest.Values[E.ENTITY_WEBS + E.INC] = 10; forest.AddModifier(new Modifier(E.ENTITY_WEBS, modifiersA: new Dictionary <string, double>() { { E.STALL, 0 }, { E.ENTITY_SPIDERS + E.ATTACK, 0 } })); // Testing doable that gives half an hour of passive generation. forest.Doables["Halfhour Offline"].Unlocked = true; // Think upgrades forest.Values[E.UPG_DRUIDCRAFT_CONSIDERED + E.MOD] = 0.03; //How much production boost in % each level of druidcraft gives. forest.Values[E.UPG_HANDLED_YOU_BEFORE + E.MOD] = 0.03; //How much attack boost in % each level of Animal Handling gives. forest.Values[E.UPG_SOOTHING_THOUGHTS + E.MOD] = 0.03; //How much attack boost in % each level of Soothing gives. }
/// <summary> /// Tests whether the requirements are met for this doable. /// </summary> /// <returns></returns> public bool TestRequirements() { return(Forest.TestRequirements(Requirements)); }