static void Main(string[] args)
        {
            Stats s = new Stats();

            Player p = new Player("Tuukka Hellman");
            Potion po = new Potion();
            object obj = new object();

            Hero h = new Hero();

            p.

            // Sama kuin IncrementWins

            for (int i = 0; i < 2; i++)
            {
               s.increase(Stats.Kind.Wins);
            }

            for (int i = 0; i < 4; i++)
            {
              s.increase(Stats.Kind.Ties);
            }

            for (int i = 0; i < 8; i++)
            {
               s.increase(Stats.Kind.Losses);
            }

            /*
            Console.WriteLine(s.GetWinPercentage());
            Console.WriteLine(s.GetLossPercentage());
            Console.WriteLine(s.GetTiePercentage());
            */
        }
Exemple #2
0
 /// <summary>
 /// Copy constructor
 /// </summary>
 /// <param name="parent">Parent debuggable</param>
 /// <param name="stats">The stats to copy</param>
 public Stats(Debuggable parent, Stats stats)
     : base(parent)
 {
     Hp.Value = stats.Hp;
     Mp.Value = stats.Mp;
     Attack.Value = stats.Attack;
     Defense.Value = stats.Defense;
     MagicAttack.Value = stats.MagicAttack;
     MagicDefense.Value = stats.MagicDefense;
     Speed.Value = stats.Speed;
 }
Exemple #3
0
 /// <summary>
 /// Modifies these stats using the passed in stats and operations
 /// </summary>
 /// <param name="stats">The stats to modify with</param>
 /// <param name="operations">How to modify the stats</param>
 public void Modify(Stats stats, StatOperations operations)
 {
     Modify(Hp, stats.Hp, operations.Hp, v => Hp.Value = v);
     Modify(Mp, stats.Mp, operations.Mp, v => Mp.Value = v);
     Modify(Attack, stats.Attack, operations.Attack, v => Attack.Value = v);
     Modify(Defense, stats.Defense, operations.Defense, v => Defense.Value = v);
     Modify(MagicAttack, stats.MagicAttack, operations.MagicAttack, v => MagicAttack.Value = v);
     Modify(MagicDefense, stats.MagicDefense, operations.MagicDefense, v => MagicDefense.Value = v);
     Modify(Speed, stats.Speed, operations.Speed, v => Speed.Value = v);
 }
Exemple #4
0
 // Luokan konstruktoria kutsutaan aina! Jollei sitä ole määritelty sinne erikseen; kutsutaan default-konstruktoria
 public Player(string pName)
 {
     name = pName;
     st = new Stats();
 }