示例#1
0
文件: Enemy.cs 项目: dmacy5/RPG
 public override void turn(Character enemy)
 {
     Random generator = new Random();
     double choice = generator.NextDouble();
     if (choice > .4)
         basicAttack(enemy);
 }
示例#2
0
文件: Slash.cs 项目: 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 + ".");
 }
示例#3
0
文件: Inventory.cs 项目: dmacy5/RPG
        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);
            }
        }
示例#4
0
文件: Player.cs 项目: 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);
            }
        }
示例#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;
        }
示例#6
0
 public abstract void useAbility(Character player, Character enemy);
示例#7
0
文件: Event.cs 项目: dmacy5/RPG
 public Event(Character thisPlayer, Character thisEnemy)
 {
     player = thisPlayer;
     enemy = thisEnemy;
 }
示例#8
0
文件: Event.cs 项目: dmacy5/RPG
 public Event(Character thisPlayer)
 {
     player = thisPlayer;
     enemy = null;
 }
示例#9
0
文件: Character.cs 项目: dmacy5/RPG
 public abstract void turn( Character enemy );
示例#10
0
文件: Character.cs 项目: dmacy5/RPG
 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 + ".");
 }
示例#11
0
文件: Inventory.cs 项目: dmacy5/RPG
        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;
        }
示例#12
0
文件: Area.cs 项目: dmacy5/RPG
 //chest?
 //enemy?
 //hidden treasure?
 public Area(Character thisPlayer)
 {
     player = thisPlayer;
 }
示例#13
0
文件: World.cs 项目: dmacy5/RPG
 public World(Character thisPlayer)
 {
     player = thisPlayer;
     currentLocation = new Area(player);
     previousLocation = null;
 }
示例#14
0
文件: Battle.cs 项目: dmacy5/RPG
 public Battle(Character thisPlayer, Character thisEnemy)
 {
     player = thisPlayer;
     enemy = thisEnemy;
 }
示例#15
0
文件: Item.cs 项目: dmacy5/RPG
 public abstract bool effect(Character target);