public CharacterBaseModel() { HeroClass = HeroClass.Warrior; Name = HeroClass.ToString(); GameState = new GameState(); IsActive = true; }
private static List <Spell> ParseSpellList(HeroClass heroClass) { //Parsing Stats string csv = "/Assets/Data/Heroes.csv"; string path = Path.GetFullPath(dir + csv); StreamReader strReader = new StreamReader(path); List <Spell> baseSpells = new List <Spell>(); string fileString = strReader.ReadToEnd(); string[] lines = fileString.Split('\n'); int heroClassId = (int)heroClass; string[] fields = lines[heroClassId + 1].Split(';'); if (fields[1].Equals(heroClass.ToString())) { baseSpells.Add(ParseSpell(Int32.Parse(fields[4]))); baseSpells.Add(ParseSpell(Int32.Parse(fields[5]))); } else { throw new Exception(" Invalid Hero class Id given in builder, table might be wrong"); } return(baseSpells); }
private IEnumerator SpawnItems() { float rotation = (float)(Math.PI * gameObject.transform.rotation.eulerAngles.y / 180.0f) - (float)Math.PI / 4f; foreach (var item in items) { if (item.GetComponent <GameItem>().item.itemClass == ItemClass.Any || item.GetComponent <GameItem>().item.itemClass.ToString() == playerClass.ToString()) { yield return(new WaitForSeconds(0.2f)); float x = (float)Math.Sin(rotation) * 2f; float z = (float)Math.Cos(rotation) * 2f; var droppedItem = Instantiate(item, gameObject.transform); droppedItem.transform.position = transform.position + new Vector3(x, 0.7f, z); droppedItem.transform.rotation = Quaternion.Euler(0, UnityEngine.Random.Range(0f, 360f), 90); rotation += (float)(Math.PI / 4f); } } }
public void DropItems() { if (!dropped) { float rotation = 0; foreach (var item in items) { if (item.GetComponent<GameItem>().item.itemClass == ItemClass.Any || item.GetComponent<GameItem>().item.itemClass.ToString() == playerClass.ToString()) { float x = (float)Math.Sin(rotation) * 2f; float z = (float)Math.Cos(rotation) * 2f; var droppedItem = Instantiate(item); droppedItem.transform.position = transform.position + new Vector3(x, 1.5f, z); droppedItem.transform.rotation = Quaternion.Euler(0, UnityEngine.Random.Range(0f, 360f), 90); rotation += (float)(Math.PI / 4f); } } dropped = true; } }
private static Dictionary <Stat, int> ParseStats(HeroClass heroClass) { Dictionary <Stat, int> baseStats = new Dictionary <Stat, int> { { Stat.Healing, 0 }, { Stat.Damage, 0 }, { Stat.Alive, 1 }, { Stat.Threat, 0 }, { Stat.isBoss, 0 }, { Stat.isHero, 1 } }; //Parsing Stats string csv = "/Assets/Data/Heroes.csv"; string path = Path.GetFullPath(dir + csv); StreamReader strReader = new StreamReader(path); string fileString = strReader.ReadToEnd(); string[] lines = fileString.Split('\n'); int heroClassId = (int)heroClass; string[] fields = lines[heroClassId + 1].Split(';'); if (fields[1].Equals(heroClass.ToString())) { baseStats.Add(Stat.Hp, Int32.Parse(fields[2])); baseStats.Add(Stat.Armor, Int32.Parse(fields[3])); } else { throw new Exception(" Invalid Hero class Id given in builder, table might be wrong"); } return(baseStats); }
public MatchupStats GetMatchupStats(HeroClass opponent) => new MatchupStats(opponent.ToString(), _games.Where(x => x.OpponentHero == opponent.ToString()).Select(x => x));
void SetBox(HeroClass heroClass, int level) { sprite.sprite2D = uiManager.GetClassSprite(heroClass); label.text = "Lv " + level + " " + heroClass.ToString(); }
public ConstructedMatchup(HeroClass player, IEnumerable <GameStats> games) { _player = player; _games = games.Where(x => x.PlayerHero == player.ToString()); }
public IActionResult ClassStats(HeroClass heroClass) => new JsonResult(HeroFactory.Create(heroClass, heroClass.ToString()));
public ConstructedMatchup(HeroClass player, IEnumerable<GameStats> games) { _player = player; _games = games.Where(x => x.PlayerHero == player.ToString()); }
public D3CalculatorForm(Follower follower, HeroClass heroClass) : this() { Item offHand; Item mainHand; Text += " [ " + follower.Slug + " ]"; guiHeroClass.SelectedItem = heroClass.ToString(); guiHeroLevel.Text = follower.Level.ToString(); guiHeroParagonLevel.Text = "0"; if (follower.Items.Special != null) { special = follower.Items.Special.GetFullItem(); } if (follower.Items.LeftFinger != null) { leftFinger = follower.Items.LeftFinger.GetFullItem(); } if (follower.Items.Neck != null) { neck = follower.Items.Neck.GetFullItem(); } if (follower.Items.RightFinger != null) { rightFinger = follower.Items.RightFinger.GetFullItem(); } // If no weapon is set in mainHand, use "naked hand" weapon if (follower.Items.MainHand != null) { mainHand = follower.Items.MainHand.GetFullItem(); } else { mainHand = Constants.NakedHandWeapon; } // If no item is set in offHand, use a blank item if (follower.Items.OffHand != null) { offHand = follower.Items.OffHand.GetFullItem(); } else { offHand = Constants.BlankWeapon; } var allRawItems = new List <Item> { special, leftFinger, neck, rightFinger, mainHand, offHand }; guiItemChoiceSpecial.Tag = special; guiItemChoiceMainHand.Tag = mainHand; guiItemChoiceOffHand.Tag = offHand; guiItemChoiceLeftFinger.Tag = leftFinger; guiItemChoiceNeck.Tag = neck; guiItemChoiceRightFinger.Tag = rightFinger; guiSetBonusEditor.SetEditedItem(new Item(allRawItems.Where(i => i != null).ToList().GetActivatedSetBonus())); // Main hand item selected by default guiItemChoices_Click(guiItemChoiceMainHand, null); // Run initial calculations DoCalculations(); DoActionOnCalculatedControls(UpdateResultControlColor); }
public void SetClass(HeroClass type, int level) { sprite.sprite2D = uiManager.GetClassSprite(type); label.text = "Lv " + level.ToString() + " " + type.ToString(); }
public D3CalculatorForm(Follower follower, HeroClass heroClass) : this() { Item offHand; Item mainHand; Text += " [ " + follower.slug + " ]"; guiHeroClass.SelectedItem = heroClass.ToString(); guiHeroLevel.Text = follower.level.ToString(); guiHeroParagonLevel.Text = "0"; if (follower.items.special != null) { special = follower.items.special.GetFullItem(); } if (follower.items.leftFinger != null) { leftFinger = follower.items.leftFinger.GetFullItem(); } if (follower.items.neck != null) { neck = follower.items.neck.GetFullItem(); } if (follower.items.rightFinger != null) { rightFinger = follower.items.rightFinger.GetFullItem(); } // If no weapon is set in mainHand, use "naked hand" weapon if (follower.items.mainHand != null) { mainHand = follower.items.mainHand.GetFullItem(); } else { mainHand = D3Calculator.NakedHandWeapon; } // If no item is set in offHand, use a blank item if (follower.items.offHand != null) { offHand = follower.items.offHand.GetFullItem(); } else { offHand = D3Calculator.BlankWeapon; } var allRawItems = new List <Item> { special, leftFinger, neck, rightFinger, mainHand, offHand }; guiSpecialEditor.SetEditedItem(special); guiMainHandEditor.SetEditedItem(mainHand); guiOffHandEditor.SetEditedItem(offHand); guiLeftFingerEditor.SetEditedItem(leftFinger); guiNeckEditor.SetEditedItem(neck); guiRightFingerEditor.SetEditedItem(rightFinger); guiSetBonusEditor.SetEditedItem(new Item(allRawItems.Where(i => i != null).ToList().GetActivatedSetBonus())); //populatePassiveSkills(); //populateActiveSkills(); }
public void SetBox(HeroClass heroType) { var uiManager = GameObject.FindGameObjectWithTag("UI").GetComponent<LobbyUI>(); sprite.sprite2D = uiManager.GetClassSprite(heroType); label.text =heroType.ToString(); }
public HeroClassWrapper(HeroClass heroClass) { Class = heroClass.ToString(); }
private static void SaveHero(HeroClass hero, List <CardPair> classPairs, bool isFull) { classPairs.Sort(); //int minCount = classPairs[0].Count(); //classPairs.RemoveAll(x => x.Count() < minCount); RankedCard.rankedCards.Clear(); foreach (CardPair pair in classPairs) { RankedCard.AddCard(pair.Card2, pair.DeckWinPercentage()); RankedCard.AddCard(pair.Card1, pair.DeckWinPercentage()); } RankedCard.rankedCards.Sort(); bool allowNDR = true; bool allowNMR = true; bool allowNNR = true; bool oneMoreDeck = true; while (oneMoreDeck) { Deck deck = new Deck(hero, allowNDR, allowNMR, allowNNR); int i = 0; while (deck.cards.Count == 0) { deck.AddCard(RankedCard.rankedCards[i++].name); } bool noMoreCards = false; while (deck.cards.Count < 40 && !noMoreCards) { List <Candidate> candidates = new List <Candidate>(); foreach (RankedCard card in RankedCard.rankedCards) { candidates.Add(new Candidate(card.name, Calculate(card.name, classPairs, deck.cards))); } candidates.Sort(); int j = 0; bool added; do { added = deck.AddCard(candidates[j++].card); } while (!added && j < candidates.Count); if (j == candidates.Count) { noMoreCards = true; } } oneMoreDeck = false; string restrictions = ""; if (deck.ndr.IsDeckRestricted(deck.cards)) { allowNDR = false; oneMoreDeck = true; restrictions += "_NDR"; } if (deck.nmr.IsDeckRestricted(deck.cards)) { allowNMR = false; oneMoreDeck = true; restrictions += "_NMR"; } if (deck.nnr.IsDeckRestricted(deck.cards)) { allowNNR = false; oneMoreDeck = true; restrictions += "_NNR"; } string full = ""; if (isFull) { full = "_FULL"; } SaveDeck(deck.cards, hero.ToString() + full + "_" + deck.cards[0] + restrictions, classPairs); } }
public D3CalculatorForm(Follower follower, HeroClass heroClass) : this() { Item offHand; Item mainHand; Text += " [ " + follower.slug + " ]"; guiHeroClass.SelectedItem = heroClass.ToString(); guiHeroLevel.Text = follower.level.ToString(); guiHeroParagonLevel.Text = "0"; if (follower.items.special != null) { special = follower.items.special.GetFullItem(); } if (follower.items.leftFinger != null) { leftFinger = follower.items.leftFinger.GetFullItem(); } if (follower.items.neck != null) { neck = follower.items.neck.GetFullItem(); } if (follower.items.rightFinger != null) { rightFinger = follower.items.rightFinger.GetFullItem(); } // If no weapon is set in mainHand, use "naked hand" weapon if (follower.items.mainHand != null) { mainHand = follower.items.mainHand.GetFullItem(); } else { mainHand = D3Calculator.NakedHandWeapon; } // If no item is set in offHand, use a blank item if (follower.items.offHand != null) { offHand = follower.items.offHand.GetFullItem(); } else { offHand = D3Calculator.BlankWeapon; } var allRawItems = new List<Item> { special, leftFinger, neck, rightFinger, mainHand, offHand }; guiSpecialEditor.SetEditedItem(special); guiMainHandEditor.SetEditedItem(mainHand); guiOffHandEditor.SetEditedItem(offHand); guiLeftFingerEditor.SetEditedItem(leftFinger); guiNeckEditor.SetEditedItem(neck); guiRightFingerEditor.SetEditedItem(rightFinger); guiSetBonusEditor.SetEditedItem(new Item(allRawItems.Where(i => i != null).ToList().GetActivatedSetBonus())); //populatePassiveSkills(); //populateActiveSkills(); }
public D3CalculatorForm(Follower follower, HeroClass heroClass) : this() { Item offHand; Item mainHand; Text += " [ " + follower.Slug + " ]"; guiHeroClass.SelectedItem = heroClass.ToString(); guiHeroLevel.Text = follower.Level.ToString(); guiHeroParagonLevel.Text = "0"; if (follower.Items.Special != null) { special = follower.Items.Special.GetFullItem(); } if (follower.Items.LeftFinger != null) { leftFinger = follower.Items.LeftFinger.GetFullItem(); } if (follower.Items.Neck != null) { neck = follower.Items.Neck.GetFullItem(); } if (follower.Items.RightFinger != null) { rightFinger = follower.Items.RightFinger.GetFullItem(); } // If no weapon is set in mainHand, use "naked hand" weapon if (follower.Items.MainHand != null) { mainHand = follower.Items.MainHand.GetFullItem(); } else { mainHand = Constants.NakedHandWeapon; } // If no item is set in offHand, use a blank item if (follower.Items.OffHand != null) { offHand = follower.Items.OffHand.GetFullItem(); } else { offHand = Constants.BlankWeapon; } var allRawItems = new List<Item> { special, leftFinger, neck, rightFinger, mainHand, offHand }; guiItemChoiceSpecial.Tag = special; guiItemChoiceMainHand.Tag = mainHand; guiItemChoiceOffHand.Tag = offHand; guiItemChoiceLeftFinger.Tag = leftFinger; guiItemChoiceNeck.Tag = neck; guiItemChoiceRightFinger.Tag = rightFinger; guiSetBonusEditor.SetEditedItem(new Item(allRawItems.Where(i => i != null).ToList().GetActivatedSetBonus())); // Main hand item selected by default guiItemChoices_Click(guiItemChoiceMainHand, null); // Run initial calculations DoCalculations(); DoActionOnCalculatedControls(UpdateResultControlColor); }