Esempio n. 1
0
 public PlayerState()
 {
     _playerBaseStats = new PlayerStatAddends()
                        .With(PlayerStatType.CardDraws, 6)
                        .With(PlayerStatType.CardPlays, 3)
                        .With(PlayerStatType.CardCycles, 2);
 }
Esempio n. 2
0
        /// <summary>
        /// Initialises the weapon controller.
        /// </summary>
        public void InitialiseWeaponController()
        {
            pauseChecker    = this.GetComponent <ICheckPaused>();
            loadoutPosition = LoadoutConfiguration.Forward;

            IPlayerStats shipWeaponStats = this.GetComponent <IPlayerStats>();
            ShipData     shipData        = shipWeaponStats.GetShipData();

            SetupWeapons(shipData);
        }
Esempio n. 3
0
 public static void PrintPlayer(IPlayerStats PlayerToPrint)
 {
     Console.WriteLine($"\nStats of {PlayerToPrint.Name}");
     Console.WriteLine($"Health:\t\t{PlayerToPrint.Health, 2}\t\tAgility:\t{PlayerToPrint.Agility, 2}");
     Console.WriteLine($"Stamina:\t{PlayerToPrint.Stamina, 2}\t\tStrength:\t{PlayerToPrint.Strength, 2}");
     Console.Write($"Educability:\t{PlayerToPrint.Educability, 2}");
     if (PlayerToPrint.Element != null)
     {
         Console.Write($"\t\tElement:\t{PlayerToPrint.Element}");
     }
 }
 public AdjustedPlayerStats(IPlayerStats stats, int duration, bool isDebuff, bool indefinite)
 {
     PlayerStats = stats;
     IsDebuff    = isDebuff;
     // This makes it so that for 1 Turns in the UI will last until the End of the Subsequent Turn.
     // 0 Turn Duration would last until the end of the current turn
     // Perhaps we need a design that would select whether something should last until the start of turn, or end of turn, or perhaps the character's next action
     // For now, this solves the current use case.
     _remainingTurnDuration = duration + 1;
     _indefinite            = indefinite;
 }
Esempio n. 5
0
        public static void CreateRadnomPlayer(int[] Player, out IPlayerStats Player2)
        {
            Random rnd = new Random();
            bool   fu;

            string[] ElChooseList = { "Water", "Fire", "Earth", "Air" };
            int      rndEl        = rnd.Next(0, 4);

            int[] maxSkillPoints;
            do
            {
                fu                 = false;
                maxSkillPoints     = new int[] { 333, 333, 0 };
                Player[0]          = rnd.Next(50, 91);
                maxSkillPoints[1] -= Player[0];
                Player[1]          = rnd.Next(10, 81);
                maxSkillPoints[1] -= Player[1];
                Player[2]          = rnd.Next(40, 91);
                maxSkillPoints[1] -= Player[2];
                if (maxSkillPoints[1] > 180)
                {
                    fu = true;
                }
                else if (maxSkillPoints[1] <= 180 && maxSkillPoints[1] >= 95 && maxSkillPoints[1] >= 5)
                {
                    do
                    {
                        Player[3]          = rnd.Next(40, 91);
                        maxSkillPoints[1] -= Player[3];
                    } while (maxSkillPoints[1] > 90);
                    Player[4] = maxSkillPoints[1];
                }
                else if (maxSkillPoints[1] <= 180 && maxSkillPoints[1] < 95 && maxSkillPoints[1] % 2 == 0 && maxSkillPoints[1] >= 10)
                {
                    Player[3] = rnd.Next(5, maxSkillPoints[1] / 2);
                    Player[4] = rnd.Next(5, maxSkillPoints[1] / 2);
                }
                else if (maxSkillPoints[1] <= 180 && maxSkillPoints[1] < 95 && maxSkillPoints[1] % 2 != 0 && maxSkillPoints[1] >= 5)
                {
                    int ber = (maxSkillPoints[1] - 1) / 2;
                    Player[3] = rnd.Next(5, ber + 1);
                    Player[4] = rnd.Next(5, ber);
                }
                else
                {
                    fu = true;
                }
                maxSkillPoints[2] = Player.Sum();
            } while (maxSkillPoints[2] != maxSkillPoints[0] || fu);
            Console.Write("\nType in your character's name:\t");
            string name2 = Console.ReadLine();

            Player2 = new PlayerStats(Player, name2, PlayersElement: ElChooseList[rndEl]);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="T:TextualRealityExperienceEngine.GameEngine.Player"/> class.
        /// </summary>
        public Player(string name, GenderIdentityEnum genderIdentity)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException(nameof(name));
            }

            Inventory      = new Inventory();
            Name           = name;
            GenderIdentity = genderIdentity;
            PlayerStats    = new PlayerStats();
        }
Esempio n. 7
0
 public Player(string name, IPoint loc, IPoint respawn, IPlayerStats playerStats, ICharacterMovement movement, ICombatActions combatActions, Dictionary <string, int> monsters = null)
 {
     _name          = name;
     _location      = loc ?? throw new ArgumentNullException(nameof(loc));
     _respawn       = respawn ?? throw new ArgumentNullException(nameof(respawn));
     _playerStats   = playerStats ?? throw new ArgumentNullException(nameof(playerStats));
     _movement      = movement ?? throw new ArgumentNullException(nameof(movement));
     _combatActions = combatActions ?? throw new ArgumentNullException(nameof(combatActions));
     if (monsters != null)
     {
         MonsterCollection = monsters;
     }
 }
Esempio n. 8
0
        internal async Task <IPlayerStats> GetPlayerStatsById(uint id)
        {
            IPlayerStats playerStats = null;

            await CreateTransaction(async transaction =>
            {
                await Select(transaction, async reader =>
                {
                    if (await reader.ReadAsync())
                    {
                        playerStats = new PlayerStats(reader);
                    }
                }, "SELECT respect, daily_respect, daily_pet_points FROM player_stats WHERE player_id = @0 LIMIT 1;", id);
            });

            return(playerStats);
        }
Esempio n. 9
0
 public UserObjectComposer(IPlayer player, IPlayerStats playerStats)
     : base(Headers.UserObjectMessageComposer)
 {
     WriteInt(player.Id);
     WriteString(player.Username);
     WriteString(player.Figure);
     WriteString(player.Gender);
     WriteString(player.Motto);
     WriteString("");     //TODO: Find out what this is.
     WriteBoolean(false); //TODO:
     WriteInt(playerStats.Respect);
     WriteInt(playerStats.DailyRespect);
     WriteInt(playerStats.DailyPetPoints);
     WriteBoolean(false); //Friends stream?
     WriteString("Last online...");
     WriteBoolean(true);  //Can change name.
     WriteBoolean(false);
 }
Esempio n. 10
0
        public async Task HandleAsync(
            ISession session,
            IClientPacket clientPacket)
        {
            IPlayerStats playerStats =
                await _playerController.GetPlayerStatsByIdAsync(session.Player.Id);

            if (playerStats == null)
            {
                await _playerController.AddPlayerStatsAsync(session.Player.Id);

                playerStats = await _playerController.GetPlayerStatsByIdAsync(session.Player.Id);
            }

            session.PlayerStats = playerStats;

            await session.WriteAndFlushAsync(new UserObjectComposer(session.Player, session.PlayerStats));

            await session.WriteAndFlushAsync(new UserPerksComposer());
        }
Esempio n. 11
0
        private void Calculate(IQueryable <PlayerPosition> games, IPlayerStats playerStats)
        {
            var blueWins = games.Where(x => x.Game.BlueScore > x.Game.RedScore).ToList();
            var redWins  = games.Where(x => x.Game.BlueScore < x.Game.RedScore).ToList();

            playerStats.WinsCount   = blueWins.Count(x => x.Team == Team.Blue) + redWins.Count(x => x.Team == Team.Red);
            playerStats.LossesCount = blueWins.Count(x => x.Team == Team.Red) + redWins.Count(x => x.Team == Team.Blue);

            var blueCount = games.Count(x => x.Team == Team.Blue);
            var redCount  = games.Count(x => x.Team == Team.Red);

            if (redCount == blueCount)
            {
                playerStats.FavoriteTeam = "No favorite team";
            }
            else if (redCount < blueCount)
            {
                playerStats.FavoriteTeam = "Blue";
            }
            else
            {
                playerStats.FavoriteTeam = "Red";
            }
        }
Esempio n. 12
0
 public StatsController(IPlayerStats stats, IUser user, IMeaningfulCalculation calculations)
 {
     playerStats = stats;
     usersBLL    = user;
     calculator  = calculations;
 }
 public PlayerStatsViewModel(IPlayerStats stats)
 {
     playerStats = stats;
 }
Esempio n. 14
0
 public static IPlayerStats Plus(this IPlayerStats first, params IPlayerStats[] others) => Plus(first, (IEnumerable <IPlayerStats>)others);
 public PlayerStatsProcessor(IPlayerStats stats)
 {
     playerStats = stats;
 }
Esempio n. 16
0
 public Player(int playerId, IPlayerStats stats)
 {
     PlayerId = playerId;
     Stats    = stats;
 }
Esempio n. 17
0
 public static int CardDraw(this IPlayerStats stats) => stats[PlayerStatType.CardDraws].RoundUp();
Esempio n. 18
0
 public PlayerFactory(IBoardFactory boardFactory, IPlayerStats stats)
 {
     _boardFactory = boardFactory;
     _stats        = stats;
 }
 public PlayerStatsViewModel(IPlayerStats stats)
 {
     playerStats = stats;
 }
Esempio n. 20
0
 public PlayerStatsProcessor(IPlayerStats stats)
 {
     playerStats = stats;
 }
Esempio n. 21
0
 public AddedPlayerStats(IPlayerStats first, IPlayerStats second)
 {
     _first  = first;
     _second = second;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="T:TextualRealityExperienceEngine.GameEngine.Player"/> class.
 /// </summary>
 public Player()
 {
     Inventory      = new Inventory();
     GenderIdentity = GenderIdentityEnum.Other;
     PlayerStats    = new PlayerStats();
 }
Esempio n. 23
0
 public static IPlayerStats Plus(this IPlayerStats first, IEnumerable <IPlayerStats> others) => others.Aggregate(first, (current, other) => new AddedPlayerStats(current, other));
Esempio n. 24
0
 public static int CardCycles(this IPlayerStats stats) => stats[PlayerStatType.CardCycles].RoundUp();