예제 #1
0
 /// <summary>
 /// Causes a pokemon to take damage
 /// </summary>
 /// <param name="damageFrom"></param>
 public void TakeDamage(Move damageFrom)
 {
     Console.WriteLine(damageFrom.Attacker);
     if(damageFrom.WasCritical) Console.WriteLine("It's a critical hit!");
     if(damageFrom.WasEffective == true) Console.WriteLine("It's super effective!");
     else if(damageFrom.WasEffective == false) Console.WriteLine("It's not very effective...");
     this.HP -= damageFrom.Damage;
     if(damageFrom.Damage >= 0) Console.WriteLine(this.GetType().Name + " took " + damageFrom.Damage + " damage!");
     else Console.WriteLine(this.GetType().Name + " gained " + (damageFrom.Damage*-1) + " HP!");
 }
예제 #2
0
        /// <summary>
        /// Sets the moves a pokemon can use randomly
        /// </summary>
        public void SetMoves()
        {
            Move[] toSet;

            if(this.MoveList.Length <= 4)
            {
                toSet = new Move[this.MoveList.Length];
                for(int i = 0; i < this.MoveList.Length; i++) toSet[i] = (Move)Activator.CreateInstance(this.MoveList[i]);
            }
            else
            {
                toSet = new Move[4];
                int[] indexes = Utilities.Utilities.getRandomUniqueIndexArray(this.MoveList.Length, toSet.Length);
                for(int i = 0; i < toSet.Length; i++) toSet[i] = (Move)Activator.CreateInstance(this.MoveList[indexes[i]]);
            }

            this.Moves = toSet;
        }