Example #1
0
File: Enemy.cs Project: dmacy5/RPG
 public override void turn(Character enemy)
 {
     Random generator = new Random();
     double choice = generator.NextDouble();
     if (choice > .4)
         basicAttack(enemy);
 }
Example #2
0
File: Slash.cs Project: dmacy5/RPG
 public override void useAbility(Character player, Character enemy)
 {
     Console.WriteLine(Name + " slashes " + enemy.Name + "!");
     int attack = 2 * player.Strength * player.attackModifier();
     enemy.Health -= attack;
     Console.WriteLine(enemy.Name + " took " + attack + " damage and now has " + enemy.Health + ".");
 }
Example #3
0
        public void useItem(Character player, Character enemy)
        {
            Console.WriteLine("Pick item to use: ");
            displayInventory();
            int itemIndex = GameManager.getInputBetween(1, itemCount) - 1;
            Character target = pickTarget(player, enemy);

            bool removeItem = inventory[itemIndex].effect(target);

            if (removeItem)
            {
                totalWeight -= inventory[itemIndex].Weight;
                inventory.RemoveAt(itemIndex);
            }
        }
Example #4
0
File: Player.cs Project: dmacy5/RPG
        public override void turn(Character enemy)
        {
            Console.WriteLine(Name + "'s turn: ");
            Console.WriteLine("1. Basic attack");
            Console.WriteLine("2. Special abilities");
            Console.WriteLine("3. Inventory");
            Console.WriteLine("4. Run");

            int option = GameManager.getInputBetween(1, 4);

            if (option == 1)
                basicAttack(enemy);
            else if(option == 2)
            {
                SpecialAbility picked = abilities.getAbility();
                picked.useAbility(this, enemy);
            }
            else if(option == 3)
            {
                inventory.useItem(this, enemy);
            }
        }
Example #5
0
        public override bool effect(Character target)
        {
            int healthDifference = target.MaxHealth - target.Health;

            if (healthDifference == 0)
            {
                Console.WriteLine("Nothing to heal. Not using health potion. Lose a turn.");
                return false;
            }
            else if (healthDifference >= 20)
            {
                target.Health += 20;
                Console.WriteLine(target.Name + " healed by 20 and now has " + target.Health + " health.");
            }
            else
            {
                target.Health += target.MaxHealth;
                Console.WriteLine(target.Name + " healed by " + healthDifference
                    + " and now has " + target.Health + " health.");
            }

            return true;
        }
Example #6
0
 public abstract void useAbility(Character player, Character enemy);
Example #7
0
File: Event.cs Project: dmacy5/RPG
 public Event(Character thisPlayer, Character thisEnemy)
 {
     player = thisPlayer;
     enemy = thisEnemy;
 }
Example #8
0
File: Event.cs Project: dmacy5/RPG
 public Event(Character thisPlayer)
 {
     player = thisPlayer;
     enemy = null;
 }
Example #9
0
 public abstract void turn( Character enemy );
Example #10
0
 public void basicAttack( Character enemy )
 {
     Console.WriteLine(Name + " is attacking " + enemy.Name + ".");
     int attack = strength * attackModifier();
     enemy.health -= attack;
     Console.WriteLine(enemy.Name + " took " + attack + " damage and now has " + enemy.Health + ".");
 }
Example #11
0
        private Character pickTarget(Character him, Character her)
        {
            Console.WriteLine("Pick target for item: ");
            Console.WriteLine("1. " + him.Name);
            Console.WriteLine("2. " + her.Name);
            int option = GameManager.getInputBetween(1, 2);

            if (option == 1)
                return him;
            else return her;
        }
Example #12
0
File: Area.cs Project: dmacy5/RPG
 //chest?
 //enemy?
 //hidden treasure?
 public Area(Character thisPlayer)
 {
     player = thisPlayer;
 }
Example #13
0
File: World.cs Project: dmacy5/RPG
 public World(Character thisPlayer)
 {
     player = thisPlayer;
     currentLocation = new Area(player);
     previousLocation = null;
 }
Example #14
0
File: Battle.cs Project: dmacy5/RPG
 public Battle(Character thisPlayer, Character thisEnemy)
 {
     player = thisPlayer;
     enemy = thisEnemy;
 }
Example #15
0
File: Item.cs Project: dmacy5/RPG
 public abstract bool effect(Character target);