コード例 #1
0
ファイル: CharacterBaseModel.cs プロジェクト: tcape/stc_game
 public CharacterBaseModel()
 {
     HeroClass = HeroClass.Warrior;
     Name      = HeroClass.ToString();
     GameState = new GameState();
     IsActive  = true;
 }
コード例 #2
0
    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);
    }
コード例 #3
0
    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);
            }
        }
    }
コード例 #4
0
ファイル: ItemDrop.cs プロジェクト: tcape/stc_game
 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;
     }
 }
コード例 #5
0
    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);
    }
コード例 #6
0
 public MatchupStats GetMatchupStats(HeroClass opponent)
 => new MatchupStats(opponent.ToString(), _games.Where(x => x.OpponentHero == opponent.ToString()).Select(x => x));
コード例 #7
0
ファイル: HeroButton.cs プロジェクト: jwvg0425/Hmmo
 void SetBox(HeroClass heroClass, int level)
 {
     sprite.sprite2D = uiManager.GetClassSprite(heroClass);
     label.text = "Lv " + level + "  " + heroClass.ToString();
 }
コード例 #8
0
 public ConstructedMatchup(HeroClass player, IEnumerable <GameStats> games)
 {
     _player = player;
     _games  = games.Where(x => x.PlayerHero == player.ToString());
 }
コード例 #9
0
 public IActionResult ClassStats(HeroClass heroClass) => new JsonResult(HeroFactory.Create(heroClass, heroClass.ToString()));
コード例 #10
0
		public MatchupStats GetMatchupStats(HeroClass opponent)
			=> new MatchupStats(opponent.ToString(), _games.Where(x => x.OpponentHero == opponent.ToString()).Select(x => x));
コード例 #11
0
		public ConstructedMatchup(HeroClass player, IEnumerable<GameStats> games)
		{
			_player = player;
			_games = games.Where(x => x.PlayerHero == player.ToString());
		}
コード例 #12
0
        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);
        }
コード例 #13
0
ファイル: ClassContainer.cs プロジェクト: jwvg0425/Hmmo
	public void SetClass(HeroClass type, int level)
    {
        sprite.sprite2D = uiManager.GetClassSprite(type);
        label.text = "Lv " + level.ToString() + "    " + type.ToString();
    }
コード例 #14
0
        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();
        }
コード例 #15
0
ファイル: PickHeroBox.cs プロジェクト: jwvg0425/Hmmo
 public void SetBox(HeroClass heroType)
 {
     var uiManager = GameObject.FindGameObjectWithTag("UI").GetComponent<LobbyUI>();
     sprite.sprite2D = uiManager.GetClassSprite(heroType);
     label.text =heroType.ToString();
 }
コード例 #16
0
			public HeroClassWrapper(HeroClass heroClass)
			{
				Class = heroClass.ToString();
			}
 public HeroClassWrapper(HeroClass heroClass)
 {
     Class = heroClass.ToString();
 }
コード例 #18
0
        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);
            }
        }
コード例 #19
0
        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();
        }
コード例 #20
0
        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);
        }