Beispiel #1
0
        //returns the damage the player will give opponnent
        public double Attack(UserPlayer player)
        {
            double hp         = HitProbability(player);
            double damageDone = GetDamage() * GetRandomProbability(Convert.ToInt32((hp - (hp * .25))), Convert.ToInt32(hp)) / 100;

            return(damageDone / 100);
        }
Beispiel #2
0
        private static Player SetPlayerAttributes(Player player, UserPlayer userPlayer)
        {
            player.Aggression = userPlayer.Aggression;
            player.Agility    = userPlayer.Agility;
            player.Endurance  = userPlayer.Endurance;
            player.Humor      = userPlayer.Humor;
            player.TeamWork   = userPlayer.TeamWork;
            player.Strength   = userPlayer.Strength;

            return(player);
        }
Beispiel #3
0
        public double HitProbability(UserPlayer player)
        {
            int remainingHealth = 100 - Health;

            double hp = (Agility * Rating * Strength * Math.Log(TeamWork) + Math.Sqrt(Humor)) / Agility * (Math.Log10(Aggression));

            //Using the remaing health as the players energy
            //Enerrgy is used to determine if the player will produce maximum damage
            if (this.Injured)
            {
                //If player is injured the chances of getting maximum damage is reduced by 50%
                hp /= (GetRandomProbability(remainingHealth, 120));
                hp *= player.GetPlayerAgility();
            }
            else
            {
                hp /= (GetRandomProbability((remainingHealth < 50 ? remainingHealth  : 50), 50));
                hp *= player.GetPlayerAgility();
                hp  = hp < 75 ? (double)GetRandomProbability(Convert.ToInt32(hp), 100) : hp;
            }
            return(hp);
        }