public void Init()
        {
            Console.Title         = "HearthstoneCORE";
            Console.CursorVisible = false;

            //Console.SetWindowSize(Console.LargestWindowWidth, Console.LargestWindowHeight);
            //Console.SetBufferSize(Console.LargestWindowWidth, Console.LargestWindowHeight);

            RenderComponents = new List <RenderComponent>();


            List <HSCard> cards = HSCard.GetAllCards();

            HSDeck deck = new HSDeck();

            deck.AddCards(cards);

            player1 = new HSPlayer(deck);

            Logo = new ASCIIComponent("logo", new RenderLocation(Console.WindowWidth - 5, 10));

            GameBoard = new GameBoardComponent(new RenderLocation(1, 1));

            RenderComponents.Add(GameBoard);

            //int i = 1;
            //foreach(var card in deck.Cards)
            //{
            //    card.RenderComponent = new CardComponent(card, new RenderLocation(i * 5, 6));
            //    RenderComponents.Add(card.RenderComponent);
            //    i++;
            //}

            RenderComponents.Add(Logo);
        }
Exemple #2
0
        public override void OnPlayerExited(HSPlayer player)
        {
            base.OnPlayerExited(player);
            (player.Controller as HSController).SprintSpeed = 320f;

            //if ( !Host.IsServer ) return;
            player.GlowActive = false;
        }
 public override void OnPlayerTeamChange(HSPlayer ply, BaseTeam team)
 {
     if (team.Players.Count != 0)
     {
         return;
     }
     HSGame.Instance.SetRound(new WaitingRound());
 }
        public override void OnPlayerTeamChange(HSPlayer ply, BaseTeam team)
        {
            if (team.Players.Count != 0)
            {
                return;
            }
            BaseTeam winningTeam = (ply.Team is HiderTeam ? HSGame.Instance.Seekers : HSGame.Instance.Hiders);

            teamWon(winningTeam);
        }
Exemple #5
0
        private bool shouldSee()
        {
            HSPlayer hsPlayer = Local.Pawn as HSPlayer;

            if (hsPlayer.Team is not BaseTeam plyTeam)
            {
                return(false);
            }

            return(!plyTeam.ShouldMove);
        }
Exemple #6
0
        public override void OnPlayerEntered(HSPlayer player)
        {
            base.OnPlayerEntered(player);
            (player.Controller as HSController).SprintSpeed = 365f;

            //if ( !Host.IsServer ) return;

            player.GlowActive        = true;
            player.GlowState         = GlowStates.GlowStateOn;
            player.GlowColor         = new Color(.05f, 0, 0);
            player.GlowDistanceStart = 100;
            player.GlowDistanceEnd   = 5000;
        }
 public WaitingRound()
 {
     if (!Host.IsServer)
     {
         return;
     }
     foreach (Client client in Client.All)
     {
         HSPlayer ply = client.Pawn as HSPlayer;
         HSGame.Instance.MoveToSpawnpoint(ply);
         ply.Team  = null;
         ply.Scale = 1;
     }
 }
        public override void OnPlayerTouch(HSPlayer ply, HSPlayer other)
        {
            List <HSPlayer> plyColliding = new() { ply, other };
            HSPlayer        plySeeker    = plyColliding.Where(x => x.Team is SeekerTeam).FirstOrDefault();
            HSPlayer        plyHider     = plyColliding.Where(x => x.Team is HiderTeam).FirstOrDefault();

            if (plySeeker is null || plyHider is null)
            {
                return;
            }

            ChatBox.AddChatEntry(To.Everyone, "", $"Seeker {plySeeker.GetClientOwner().Name} has caught {plyHider.GetClientOwner().Name}");
            plyHider.Team = plySeeker.Team;

            if (HSGame.Instance.Hiders.Players.Count == 0)
            {
                teamWon(HSGame.Instance.Seekers);
            }
        }
Exemple #9
0
    public void StoreNewHighScore(string initials)
    {
        HSPlayer newScore = new HSPlayer {
            initials      = initials,
            playerScore   = playerScore,
            computerScore = computerScore,
            timeScore     = timeScore
        };

        playersRanking.Add(newScore);
        playersRanking.Sort();

        while (playersRanking.Count > rankLength)
        {
            playersRanking.Remove(playersRanking.Last());
        }

        ResetScores();
        Storage.Instance.SavePlayerData(this);
    }
Exemple #10
0
        private void UpdatingEntity(LogLine line)
        {
            Match match       = PowerTaskList.UpdatingEntityRegex.Match(line.Log);
            Match matchEntity = LogRegex.EntityRegex.Match(match.Groups["entity"].Value);

            if (!Game.PlayersOrdered)
            {
                if (matchEntity.Groups["player"].Value.Equals("2"))
                {
                    HSPlayer tmp = Game.User;
                    Game.User           = Game.Opponent;
                    Game.Opponent       = tmp;
                    Game.User.Enemy     = false;
                    Game.Opponent.Enemy = true;
                }
                Game.PlayersOrdered = true;
            }
            HSCard card = Game.GetCard(int.Parse(matchEntity.Groups["player"].Value), int.Parse(matchEntity.Groups["id"].Value));

            if (card.CardDB == null)
            {
                card.CardDB = Cards.All[match.Groups["cardId"].Value];
            }
            while (PowerTaskList.TagRegex.IsMatch(PeekLine(PowerReader).Log))
            {
                var a = GetLine(PowerReader).Log;
                match = PowerTaskList.TagRegex.Match(a);
                if (HsConstants.StringToTag(match.Groups["tag"].Value).Equals(GameTag.ZONE))
                {
                    Zone oldzone = card.Zone;
                    card.AddTag(match.Groups["tag"].Value, match.Groups["value"].Value);
                    MoveCard(card, oldzone);
                }
                else
                {
                    card.AddTag(match.Groups["tag"].Value, match.Groups["value"].Value);
                }
            }
            IO.LogDebug("Updated card " + card, IO.DebugFile.Hs, false);
        }
Exemple #11
0
    public bool CheckHighScore()
    {
        // If rank is not full return infinite to allow any score
        if (playersRanking.Count < rankLength)
        {
            return(true);
        }

        // Compare current score with worst high score
        HSPlayer newScore = new HSPlayer {
            playerScore   = playerScore,
            computerScore = computerScore,
            timeScore     = timeScore
        };

        List <HSPlayer> hs = new List <HSPlayer> {
            playersRanking.Last(), newScore
        };

        hs.Sort();
        return(hs.First() == newScore);
    }
 public virtual void OnPlayerTouch(HSPlayer ply, HSPlayer other)
 {
 }
 public override void OnPlayerJoined(HSPlayer ply)
 {
     ply.Team  = HSGame.Instance.Seekers;
     ply.Scale = HSConfig.CurrentPlayerScale;
 }
 public virtual void OnPlayerLeft(HSPlayer ply)
 {
 }
 public virtual void OnPlayerReset(HSPlayer ply)
 {
 }
 public override void OnPlayerReset(HSPlayer ply)
 {
     ply.Team = HSGame.Instance.Seekers;
 }
 public virtual void OnPlayerTeamChange(HSPlayer ply, BaseTeam team)
 {
 }
Exemple #18
0
 public void UpdateScore(HSPlayer player)
 {
     initials.text = player.initials;
     score.text    = player.playerScore.ToString() + "-" + player.computerScore.ToString();
     time.text     = player.timeScore.ToString("F1");
 }
 public virtual void OnPlayerJoined(HSPlayer ply)
 {
 }