/// <summary> /// Changes characteristics about the character based on what they're /// evolving into. /// </summary> /// <param name="evolutionType"></param> public void Evolve(EvolutionType evolutionType) { Evolution evolution = ReferenceManager.Instance.evolutionLibrary .GetComponent <EvolutionLibrary>().GetEvolution(evolutionType); SetCameraPosition(evolution.cameraZ); col.radius = evolution.colliderRadius; rend.sprite = evolution.sprite; rb.mass = evolution.mass; character.healthProperties.health = Mathf.RoundToInt( evolution.CalculateMaximumHealth() * Difficulty.Instance.GetHealthMult(gameObject) ); character.movementProperties.speed = Mathf.RoundToInt( evolution.CalculateMaximumSpeed() * Difficulty.Instance.GetSpeedMult(gameObject) ); foreach (Transform child in transform) { child.localScale = transform.localScale * evolution.CalculateStatMul(); } character.evolutionProperties.CurrentEvolution = evolution; }
public Evolution(XmlNode node) { Name = node.Attributes["name"].Value; Type = (EvolutionType)Enum.Parse(typeof(EvolutionType), node.Attributes["type"].Value, true); if (node.Attributes.Contains("condition")) { Condition = node.Attributes["condition"].Value; } }
// Update is called once per frame void Update() { var evolution = EvolutionManager.VerifyEvolution(); if (evolutionType != evolution) { evolutionType = evolution; switch (evolutionType) { case EvolutionType.Crianca: SetEvolution(Crianca); break; case EvolutionType.AdultoEmpresario: SetEvolution(AdultoEmpresario); break; case EvolutionType.AdultoHippie: SetEvolution(AdultoHippie); break; case EvolutionType.AdultoPunk: SetEvolution(AdultoPunk); break; case EvolutionType.AdultoNormal: SetEvolution(AdultoNormal); break; case EvolutionType.VelhoAtleta: SetEvolution(VelhoAtleta); break; case EvolutionType.VelhoCadeirante: SetEvolution(VelhoCadeirante); break; case EvolutionType.VelhoZen: SetEvolution(VelhoZen); break; case EvolutionType.VelhoNormal: SetEvolution(VelhoNormal); break; default: print("ERRO BIZARRO"); break; } } }
//UPDATE HUD VALUES OF COLORS public void ModifyColorHUD(EvolutionType color) { if (color == EvolutionType.ORANGE_COLOR) { temp_object = orange_hud.transform.Find("charges").gameObject; temp_object.GetComponent <Text>().text = curr_orange.ToString(); temp_object = orange_hud.transform.Find("Image").gameObject; if (curr_orange > 0) { temp_object.SetActive(true); } else { temp_object.SetActive(false); } } else if (color == EvolutionType.GREEN_COLOR) { temp_object = green_hud.transform.Find("charges").gameObject; temp_object.GetComponent <Text>().text = curr_green.ToString(); temp_object = green_hud.transform.Find("Image").gameObject; if (curr_green > 0) { temp_object.SetActive(true); } else { temp_object.SetActive(false); } } else if (color == EvolutionType.PINK_COLOR) { temp_object = pink_hud.transform.Find("charges").gameObject; temp_object.GetComponent <Text>().text = curr_pink.ToString(); temp_object = pink_hud.transform.Find("Image").gameObject; if (curr_pink > 0) { temp_object.SetActive(true); } else { temp_object.SetActive(false); } } }
private static void AddPokemonInfoToDic(Dictionary <string, List <EvolutionType> > pokemons, string name, string evolutionType, string level) { EvolutionType newEvolutionType = new EvolutionType(); newEvolutionType.EvoName = evolutionType; newEvolutionType.Level = long.Parse(level); if (!pokemons.ContainsKey(name)) { List <EvolutionType> newEvoList = new List <EvolutionType>(); newEvoList.Add(newEvolutionType); pokemons.Add(name, newEvoList); } else { pokemons[name].Add(newEvolutionType); } }
/// <summary> /// Attempts to consume and evolve from another character object. /// </summary> /// <param name="character"></param> void AttemptEvolve(Character target) { bool targetStillAlive = target.healthProperties.alive; if (targetStillAlive) { return; } bool currentlyDead = !character.healthProperties.alive; if (currentlyDead) { return; } EvolutionType targetEvolution = target .evolutionProperties .CurrentEvolution .type; EvolutionType nextEvolution = character .evolutionProperties .CurrentEvolution .nextEvolution; bool invalidEvolution = targetEvolution != nextEvolution; if (invalidEvolution) { return; } var type = character.evolutionProperties.CurrentEvolution.nextEvolution; if (library.GetEvolution(type).nextEvolution == EvolutionType.None) { Debug.Log("YOU WON"); ProgressionManager.Instance.Win(); return; } Destroy(target.gameObject); GetComponent <CharacterCombat>().ChooseNewWeapon(); Evolve(character.evolutionProperties.CurrentEvolution.nextEvolution); }
public static EvolutionTypeArgumentType GetArgType(this EvolutionType t) => ArgType[t];
public static bool IsLevelUpRequired(this EvolutionType t) => t.ToString().StartsWith("LevelUp", StringComparison.Ordinal); // don't use this
// params // -f -s 5 -t 4 static void Main(string[] args) { // params EvolutionType et = EvolutionType.Tens; int startIndex = 0, count = 1, parallelDegreeExt = -1, parallelDegreeInt = -1; var rnd = new ThreadSafeRandom(); //char sep = Path.DirectorySeparatorChar; //string directoryPath = $"..{sep}..{sep}..{sep}AI{sep}Provincial{sep}data{sep}kingdoms{sep}"; //string directoryPath = $"..{sep}..{sep}..{sep}AI{sep}"; string directoryPath = BuyAgenda.DirectoryPath; string subsetFile = null; BuyAgendaManager manager = new SimpleManager(directoryPath, "Tens_"); IEnumerator <string> kingdoms = null; // params handling for (int i = 0; i < args.Length; i++) { if (args[i][0] != '-') { continue; } for (int j = 1; j < args[i].Length; j++) { try { switch (args[i][j]) { case 'c': count = int.Parse(args[++i]); break; case 'd': et = EvolutionType.Tens; manager = new SimpleManager(directoryPath, "Tens_"); break; case 'f': et = EvolutionType.Subsets; //manager = new CachedManager(directoryPath, 5, "Fives_"); manager = new SimpleManager(directoryPath, "Fives_"); subsetFile = "fives"; break; case 'h': et = EvolutionType.Subsets; //manager = new CachedManager(directoryPath, 3, "Threes_"); manager = new SimpleManager(directoryPath, "Threes43_"); // TODO 43 subsetFile = "threes"; break; case 'n': et = EvolutionType.NamedGames; break; case 's': startIndex = int.Parse(args[++i]); break; case 't': parallelDegreeExt = 1; parallelDegreeInt = int.Parse(args[++i]); break; default: break; } } catch { WriteLine($"Parameter {i} failed."); } } } WriteLine($"evolution: {et.ToString()}"); if (et == EvolutionType.Subsets) { kingdoms = File.ReadAllLines($"{directoryPath}{BuyAgenda.sep}{subsetFile}.txt").Skip(startIndex).Take(count).GetEnumerator(); WriteLine($"count: {count}"); WriteLine($"start index: {startIndex}"); } else { WriteLine($"kingdom: random"); } for (int i = 0; i < count; i++) { // try { switch (et) { case EvolutionType.Tens: { //cards = PresetGames.Get(Games.FirstGame).AddRequiredCards(); List <Card> cards = null; // get random 10 cards cards = Enumerable.Range((int)CardType.Adventurer, 25) .Select(t => ((t, r: rnd.NextDouble()))) .OrderBy(a => a.r) .Take(10) .Select(((int type, double)a) => Card.Get((CardType)a.type)) .ToList(); var kingdomName = cards.OrderBy(p => p.Type).Select(p => (int)p.Type).Aggregate("kingdom", (a, b) => a + " " + b); WriteLine($"kingdom {i}: {kingdomName}"); if (manager.Load(cards) != null) { WriteLine($"Skipping kingdom."); continue; } var evolution = new Evolution(new Params { Kingdom = cards, Evaluator = new ProvincialEvaluator(), ParallelDegreeExt = parallelDegreeExt, ParallelDegreeInt = parallelDegreeInt, LeaderCount = 10, PoolCount = 50, Generations = 50, }, new Logger()); var agenda = evolution.Run(); manager.Save(cards, agenda); } break; case EvolutionType.Subsets: { List <Card> cards = null; kingdoms.MoveNext(); cards = kingdoms.Current.Split(new char[] { }, StringSplitOptions.RemoveEmptyEntries) .Select(a => Card.Get((CardType)int.Parse(a))).ToList(); var kingdomName = cards.OrderBy(p => p.Type).Select(p => (int)p.Type).Aggregate("kingdom", (a, b) => a + " " + b); WriteLine($"kingdom {i}: {kingdomName}"); if (manager.Load(cards) != null) { WriteLine("skipping"); continue; } var evolution = new Evolution(new Params { Kingdom = cards, Evaluator = new ProvincialEvaluator(), ParallelDegreeExt = parallelDegreeExt, ParallelDegreeInt = parallelDegreeInt, LeaderCount = 10, PoolCount = 50, Generations = 50, }, new Logger()); var agenda = evolution.Run(); manager.Save(cards, agenda); } break; case EvolutionType.NamedGames: { //cards = PresetGames.Get(Games.FirstGame).AddRequiredCards(); List <(List <Card> Cards, string Name)> games = new List <(List <Card>, string)> { (PresetGames.Get(Games.BigMoney), "bigMoneyGame"), (PresetGames.Get(Games.Interaction), "interaction"), (PresetGames.Get(Games.FirstGame), "firstGame"), (PresetGames.Get(Games.SizeDistortion), "sizeDistortion"), (PresetGames.Get(Games.ThrashHeap), "trasheap"), (PresetGames.Get(Games.VillageSquare), "village"), //((new int[]{ 9, 12, 15, 18, 22, 24, 27, 28, 31, 32}.Select(c => Card.Get((CardType)c)).ToList()), "badCards") //(new List<Card>{Card.Get(CardType.Curse)}, "bigMoney") }; games.ForEach(item => { var kingdomName = item.Cards.OrderBy(p => p.Type).Select(p => (int)p.Type).Aggregate("kingdom", (a, b) => a + " " + b); WriteLine($"kingdom {i}: {item.Name} {kingdomName}"); var evolution = new Evolution(new Params { Kingdom = item.Cards, Evaluator = new ProvincialEvaluator(), LeaderCount = 10, PoolCount = 50, Generations = 50, }, new Logger()); //manager.First(a => a.Id == item.Name)); var agenda = evolution.Run(); manager.Save(item.Cards, agenda); }); } break; default: break; } } //catch (Exception e) //{ // WriteLine(e.Message); //} } ReadLine(); }
public static bool IsTrade(this EvolutionType t) => t is Trade or TradeHeldItem or TradeShelmetKarrablast;
public EvolutionType VerifyEvolution() { int entrepreneurInfluence = 0; int hippieInfluence = 0; int punkInfluence = 0; int atleteInfluence = 0; int wheelchairInfluence = 0; int zenInfluence = 0; Dictionary <EvolutionType, Vector2> evolutionVector = new Dictionary <EvolutionType, Vector2>(); evolutionVector.Add(EvolutionType.AdultoEmpresario, Vector2.right); evolutionVector.Add(EvolutionType.AdultoHippie, Vector2.right.Rotate(120f)); evolutionVector.Add(EvolutionType.AdultoPunk, Vector2.right.Rotate(240f)); evolutionVector.Add(EvolutionType.VelhoAtleta, Vector2.right); evolutionVector.Add(EvolutionType.VelhoCadeirante, Vector2.right.Rotate(120f)); evolutionVector.Add(EvolutionType.VelhoZen, Vector2.right.Rotate(240f)); evolutionVector.Add(EvolutionType.Crianca, Vector2.right.Rotate(240f)); foreach (var item in charInfo.ItemCount) { entrepreneurInfluence += item.Key.entrepreneurInfluence * item.Value; hippieInfluence += item.Key.hippieInfluence * item.Value; punkInfluence += item.Key.punkInfluence * item.Value; atleteInfluence += item.Key.atleteInfluence * item.Value; wheelchairInfluence += item.Key.wheelchairInfluence * item.Value; zenInfluence += item.Key.zenInfluence * item.Value; } evolutionVector[EvolutionType.AdultoEmpresario] *= entrepreneurInfluence; evolutionVector[EvolutionType.AdultoHippie] *= hippieInfluence; evolutionVector[EvolutionType.AdultoPunk] *= punkInfluence; evolutionVector[EvolutionType.VelhoAtleta] *= atleteInfluence; evolutionVector[EvolutionType.VelhoCadeirante] *= wheelchairInfluence; evolutionVector[EvolutionType.VelhoZen] *= zenInfluence; Vector2 resultVector = Vector2.zero; Dictionary <EvolutionType, float> EvolutionDots = new Dictionary <EvolutionType, float>(); if (charInfo.Age < adultAge) { return(EvolutionType.Crianca); } else if (charInfo.Age >= adultAge && charInfo.Age <= seniorAge) { resultVector = evolutionVector[EvolutionType.AdultoEmpresario] + evolutionVector[EvolutionType.AdultoHippie] + evolutionVector[EvolutionType.AdultoPunk]; EvolutionDots.Add(EvolutionType.AdultoEmpresario, Vector2.Dot(resultVector, evolutionVector[EvolutionType.AdultoEmpresario])); EvolutionDots.Add(EvolutionType.AdultoHippie, Vector2.Dot(resultVector, evolutionVector[EvolutionType.AdultoHippie])); EvolutionDots.Add(EvolutionType.AdultoPunk, Vector2.Dot(resultVector, evolutionVector[EvolutionType.AdultoPunk])); if (resultVector.magnitude <= evolutionThreshold) { return(EvolutionType.AdultoNormal); } } else if (charInfo.Age >= seniorAge) { resultVector = evolutionVector[EvolutionType.VelhoAtleta] + evolutionVector[EvolutionType.VelhoCadeirante] + evolutionVector[EvolutionType.VelhoZen]; EvolutionDots.Add(EvolutionType.VelhoAtleta, Vector2.Dot(resultVector, evolutionVector[EvolutionType.VelhoAtleta])); EvolutionDots.Add(EvolutionType.VelhoCadeirante, Vector2.Dot(resultVector, evolutionVector[EvolutionType.VelhoCadeirante])); EvolutionDots.Add(EvolutionType.VelhoZen, Vector2.Dot(resultVector, evolutionVector[EvolutionType.VelhoZen])); if (resultVector.magnitude <= evolutionThreshold) { return(EvolutionType.VelhoNormal); } } EvolutionType selectedType = EvolutionType.Crianca; float biggestDotValue = -1; foreach (var kvp in EvolutionDots) { if (kvp.Value >= biggestDotValue) { selectedType = kvp.Key; biggestDotValue = kvp.Value; } } //print(EvolutionDots[biggestDotValue]); return(selectedType); }
// Use this for initialization void Start() { evolutionType = EvolutionType.Crianca; SetEvolution(Crianca); }
public static bool IsTrade(this EvolutionType t) => t is Trade or TradeHeldItem or TradeSpecies;
public Evolution GetEvolution(EvolutionType type) => evolutionMap[type];
public Evolution(PokemonData _resultant, ItemData _itemToEvolve) { resultant = _resultant; itemToEvolve = _itemToEvolve; evolutionType = EvolutionType.ITEM; }
public Evolution(PokemonData _resultant, int _levelToEvolve) { resultant = _resultant; levelToEvolve = _levelToEvolve; evolutionType = EvolutionType.LEVEL; }
public EvolutionConfig(List <GeneratedTexture> source, EvolutionType evolutionType, InheritedSymmetryConfig inheritedSymmetryConfig) { evolutionSource = source; this.evolutionType = evolutionType; this.inheritedSymmetryConfig = inheritedSymmetryConfig; }
public static bool IsTrade(this EvolutionType t) => t == Trade || t == TradeHeldItem || t == TradeSpecies;
public static bool IsLevelUpRequired(this EvolutionType t) => t.ToString().StartsWith("LevelUp"); // don't use this