Large diffs are not rendered by default.

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RPG_ConsoleGame.Interfaces
{
public interface IAbilitiesProcessor
{

void ProcessCommand(string command, ICharacter player, ICharacter enemy);
}
}
@@ -11,7 +11,8 @@ namespace RPG_ConsoleGame.Interfaces
public interface ICharacter : IAttack, IDestroyable
{
string Name { get; set; }

int Defense { get; set; }
IList<string> Abilities { get; set; }
Position Position { get; set; }

}
@@ -10,5 +10,6 @@ namespace RPG_ConsoleGame.Interfaces
public interface IPlayer : ICharacter, IMoveable, ICollect
{
//PlayerClass Class { get; }
IList<string> Abilities { get; set; }
}
}
@@ -10,6 +10,8 @@ public interface IRender
{
void WriteLine(string message, params object[] paramaters);

void PrintScreen(StringBuilder screen);

void Clear();
}
}
@@ -0,0 +1,128 @@
using RPG_ConsoleGame.Interfaces;

namespace RPG_ConsoleGame.Models.Characters.Abilities.Mage
{
public class AbilitiesProcessor : IAbilitiesProcessor
{
public void ProcessCommand(string command, ICharacter player, ICharacter enemy)
{
switch (command)
{
//Mage abilities
case "Fireball":
this.Fireball(player, enemy);
break;
case "Hellfire":
this.Hellfire(player, enemy);
break;
case "Reflect":
this.Reflect(player, enemy);
break;

//Warrior abilities
case "Slash":
this.Slash(player, enemy);
break;
case "Enrage":
this.Enrage(player);
break;
case "ShieldWall":
this.ShieldWall(player);
break;

//Archer abilities
case "Firearrows":
this.MarkTarget(enemy);
break;
case "Heavyshot":
this.Heavyshot(player, enemy);
break;
case "Venomousarrow":
this.Venomousarrow(player, enemy);
break;

//Rogue abilities
case "Backstab":
this.Backstab(player, enemy);
break;
case "SharpenBlades":
this.SharpenBlades(player);
break;
case "Execute":
this.Execute(player, enemy);
break;

default:
break;
}
}
//Mage
private void Fireball(ICharacter player, ICharacter enemy)
{
enemy.Health -= (player.Damage + 40);
}

private void Hellfire(ICharacter player, ICharacter enemy)
{
enemy.Health -= (player.Damage + 15);
// TO ADD BURN EFFECT
}

private void Reflect(ICharacter player, ICharacter enemy)
{
enemy.Health -= enemy.Damage;
player.Health += enemy.Damage;
}
//TO ADD MAGE PASSIVE(MANA SHIELD)

//Warrior
private void Slash(ICharacter player, ICharacter enemy)
{
enemy.Health -= player.Damage + 10 - enemy.Defense;
}

private void Enrage(ICharacter player)
{
player.Damage *= 2;
}

private void ShieldWall(ICharacter player)
{
player.Defense += 10;
}
//TO ADD WARRIOR PASSIVE(LAST STAND)
//Archer
private void MarkTarget(ICharacter enemy)
{
enemy.Defense -= 15;
}

private void Heavyshot(ICharacter player, ICharacter enemy)
{
enemy.Health -= (player.Damage + 10);
}

private void Venomousarrow(ICharacter player, ICharacter enemy)
{
enemy.Health -= player.Damage;
//TO DO POISON EFFECT
}
//TO ADD ARCHER PASSIVE(HEADSHOT)
// Rogue
private void Backstab(ICharacter player, ICharacter enemy)
{
enemy.Health -= (player.Damage * 2);
}

private void SharpenBlades(ICharacter player)
{
player.Damage += 15;
}

private void Execute(ICharacter player, ICharacter enemy)
{
//enemy.Health -= player.Damage*Round;
}
//TO ADD ROGUE PASSIVE (POISON)
}
}
@@ -11,16 +11,16 @@ namespace RPG_ConsoleGame.Characters
{
public class Bot: Character, IBot
{
private readonly List<Item> inventory;
//private readonly List<Item> inventory;

public int currentRow = 1;
public int currentCol = 1;

public Bot(Position position, char objectSymbol, string name, PlayerRace race)
: base(position, objectSymbol, name, 0, 0)
: base(position, objectSymbol, name, 0, 0, 0)
{
this.Race = race;
this.inventory = new List<Item>();
//this.inventory = new List<Item>();
this.SetPlayerStats();
//this.CurrentCol = currentCol;
//this.CurrentRow = currentRow;
@@ -31,18 +31,10 @@ public Bot(Position position, char objectSymbol, string name, PlayerRace race)
//public int CurrentRow { get; set; }

public PlayerRace Race { get; private set; }

public IEnumerable<Item> Inventory
{
get
{
return this.inventory;
}
}

public void AddItemToInventory(Item item)
{
this.inventory.Add(item);
Inventory.Add(item);
}

//public void Heal()
@@ -61,7 +53,7 @@ public void AddItemToInventory(Item item)
public override string ToString()
{
return string.Format(
"Player {0} ({1}): Damage ({2}), Health ({3}), Number of beers: {4}",
"Bot {0} ({1}): Damage ({2}), Health ({3}), Number of beers: {4}",
this.Name,
this.Race,
this.Damage,
@@ -74,24 +66,49 @@ private void SetPlayerStats()
switch (this.Race)
{
case PlayerRace.Mage:
this.Damage = 50;
//abilities
Abilities.Add("Fireball");
Abilities.Add("Hellfire");
Abilities.Add("Reflect");
//passives
this.Damage = 10;
this.Health = 100;
this.Defense = 10;
break;
case PlayerRace.Warrior:
this.Damage = 20;
this.Health = 300;
//abilities
Abilities.Add("Slash");
Abilities.Add("Enrage");
Abilities.Add("ShieldWall");
//passeives
this.Damage = 15;
this.Health = 200;
this.Defense = 20;
break;
case PlayerRace.Archer:
//abilities
Abilities.Add("MarkTarget");
Abilities.Add("Heavyshot");
Abilities.Add("Venomousarrow");
//passives
this.Damage = 40;
this.Health = 150;
this.Health = 130;
this.Defense = 15;
break;
case PlayerRace.Rogue:
//abilities
Abilities.Add("Backstab");
Abilities.Add("Ambush");
Abilities.Add("Kick");
//passive
this.Damage = 30;
this.Health = 200;
this.Health = 150;
this.Defense = 10;
break;
default:
throw new ArgumentException("Unknown player race.");
}
}

}
}
@@ -11,49 +11,80 @@ namespace RPG_ConsoleGame.Characters
using Items;
public abstract class Character : GameObject, ICharacter
{

private string name;
private int health;
private int defence;

private int defense;
private IList<string> abilities;
private IList<Item> inventory;

protected Character(Position position, char objectSymbol, string name, int damage, int health, int defence)
: base(position, objectSymbol)
{
this.Damage = damage;
this.Health = health;
this.Name = name;
this.Defense = defense;
this.Abilities = new List<string>();
this.Inventory = new List<Item>();
}

public int Damage { get; set; }

public int Health { get; set; }
public int Defence

public IList<string> Abilities
{
get
{
return this.defence;
return abilities;
}
set
{
abilities = value;
}
}

public IList<Item> Inventory
{
get
{
return inventory;
}
set
{
inventory = value;
}
}

public int Defense
{
get
{
return this.defense;

}
set
{
if (value+this.defence>=85)
if (value+this.defense>=85)
{
this.defence = 85;
this.defense = 85;
}
else
{
if (this.defence+value<=0)
if (this.defense+value<=0)
{
this.defence = 0;
this.defense = 0;
}
else
{
this.defence = value;
this.defense = value;
}
}
}

}

public string Name
{
get
@@ -1,4 +1,6 @@
namespace RPG_ConsoleGame.Characters
using RPG_ConsoleGame.Models.Characters.Abilities.Mage;

namespace RPG_ConsoleGame.Characters
{
using System;
using System.Collections.Generic;
@@ -9,7 +11,6 @@

public class Player : Character, IPlayer
{
private List<Item> inventory;
private Item[] bodyItems = new Item[5];

private int currentRow = 1;
@@ -19,26 +20,18 @@ public Player(Position position, char objectSymbol, string name, PlayerRace race
: base(position, objectSymbol, name, 0, 0, 0)
{
this.Race = race;
this.inventory = new List<Item>();

this.SetPlayerStats();
this.CurrentCol = currentCol;
this.CurrentRow = currentRow;

}

public int CurrentCol { get; set; }
public int CurrentRow { get; set; }

public PlayerRace Race { get; private set; }

public IEnumerable<Item> Inventory
{
get
{
return this.inventory;
}
}

public void Move(char[,] map)
{
if (Console.KeyAvailable)
@@ -67,41 +60,39 @@ public void Move(char[,] map)
}
}

public void ItemCollect(Item item)
public void SetBodyItems(Item item)
{

switch (item.itemposition)
{
case Itempossition.helmet:
case ItemBodyPossition.helmet:
///Adding the item to helmet possition
this.bodyItems[0] = item;
break;
case Itempossition.chest:
case ItemBodyPossition.chest:
///Adding the item to chest possition
this.bodyItems[1] = item;
break;
case Itempossition.hands:
case ItemBodyPossition.hands:
///Adding the item to hand possition
this.bodyItems[2] = item;
break;
case Itempossition.weapon:
case ItemBodyPossition.weapon:
///Adding the item to WEAPON possition
this.bodyItems[3] = item;
break;
case Itempossition.boots:
case ItemBodyPossition.boots:
///Adding the item to boots
this.bodyItems[4] = item;
break;
case Itempossition.inventory:
this.inventory.Add(item);
case ItemBodyPossition.inventory:
this.Inventory.Add(item);
break;
default:
throw new ArgumentException("ItemCollect Method error!");

}
}


//public void Heal()
//{
// var beer = this.inventory.FirstOrDefault() as Beer;
@@ -118,7 +109,7 @@ public void ItemCollect(Item item)
public override string ToString()
{
return string.Format(
"Player {0} ({1}): Damage ({2}), Health ({3}), Number of beers: {4}",
"Player {0} ({1}): Damage ({2}), Health ({3}), Inventory count: {4}",
this.Name,
this.Race,
this.Damage,
@@ -132,29 +123,50 @@ private void SetPlayerStats()
switch (this.Race)
{
case PlayerRace.Mage:
this.Damage = 50;
//abilities
Abilities.Add("Fireball");
Abilities.Add("Hellfire");
Abilities.Add("Reflect");
//passives
this.Damage = 10;
this.Health = 100;
this.Defence = 10;
this.Defense = 10;
break;
case PlayerRace.Warrior:
this.Damage = 20;
this.Health = 300;
this.Defence = 30;
//abilities
Abilities.Add("Slash");
Abilities.Add("Enrage");
Abilities.Add("ShieldWall");
//passeives
this.Damage = 15;
this.Health = 200;
this.Defense = 20;
break;
case PlayerRace.Archer:
//abilities
Abilities.Add("MarkTarget");
Abilities.Add("Heavyshot");
Abilities.Add("Venomousarrow");
//passives
this.Damage = 40;
this.Health = 150;
this.Defence = 20;
this.Health = 130;
this.Defense = 15;
break;
case PlayerRace.Rogue:
//abilities
Abilities.Add("Backstab");
Abilities.Add("Ambush");
Abilities.Add("Kick");
//passive
this.Damage = 30;
this.Health = 200;
this.Defence = 10;
this.Health = 150;
this.Defense = 10;
break;
default:
throw new ArgumentException("Unknown player race.");
}
}

private void MoveLeft(char[,] map)
{
if ((map[currentRow, currentCol - 1] != '.') &&
@@ -171,6 +183,7 @@ private void MoveLeft(char[,] map)
position.Y = currentCol;
}
}

private void MoveRight(char[,] map)
{
if ((map[currentRow, currentCol + 1] != '.') &&
@@ -187,6 +200,7 @@ private void MoveRight(char[,] map)
position.Y = currentCol;
}
}

private void MoveUp(char[,] map)
{
if ((map[currentRow - 1, currentCol] != 'w') &&
@@ -204,6 +218,7 @@ private void MoveUp(char[,] map)
//Position = new Position(CurrentRow, currentCol);
}
}

private void MoveDown(char[,] map)
{
if ((map[currentRow + 1, currentCol] != 'w') &&
@@ -220,6 +235,7 @@ private void MoveDown(char[,] map)
position.Y = currentCol;
}
}

private void ItemsStatsToPlayerStat()
{
///write a logic for thransforming item to play stats
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,74 @@
namespace RPG_ConsoleGame.Items
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RPG_ConsoleGame.Characters;
using RPG_ConsoleGame.Map;

public class Item
{
private double hp;
private double power;
private double defence;
private ItemPossition itemposition;

public Item(double hp, double defence, double power, ItemPossition possition)
{
this.Hp = hp;
this.Defence = defence;
this.Power = power;
this.itemposition = possition;
}

public double Hp { get; private set; }

public double Power { get; private set; }

public double Defence { get; private set; }
public ItemPossition ItemPossiton { get; set; }

public Item GetItem()
{
Random rnd = new Random();
double tempPower = rnd.Next(10 - 100);
double powercoef = 0.7;
Array values = Enum.GetValues(typeof(ItemPossition));
ItemPossition rndPos = (ItemPossition)values.GetValue(rnd.Next(values.Length));
double coef = 0;
double tempHp = tempPower * coef;
double tempDeff = tempHp / 10;
if (tempPower >= 50)
{
coef += tempPower * powercoef;
}
else
{
coef += tempPower * (powercoef + 0.5);
}

switch (rndPos)
{
case ItemPossition.helmet:
case ItemPossition.chest:
case ItemPossition.hands:
case ItemPossition.boots:
//nothing here some other logic some other time
break;
case ItemPossition.inventory:
tempPower = 0;
break;
case ItemPossition.weapon:
tempPower = tempPower * 1.1;
tempDeff = 0;
break;
default:
break;
}

return new Item(tempHp, tempDeff, tempPower, rndPos);
}
}
}
@@ -1,6 +1,6 @@
namespace RPG_ConsoleGame.Items
{
public enum Itempossition
public enum ItemBodyPossition
{
helmet,
chest,
@@ -45,10 +45,12 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Characters\Character.cs" />
<Compile Include="Characters\Bot.cs" />
<Compile Include="Characters\Player.cs" />
<Compile Include="Characters\PlayerRace.cs" />
<Compile Include="Interfaces\IAbilitiesProcessor.cs" />
<Compile Include="Map\Models\Characters\Abilities\AbilitiesProcessor.cs" />
<Compile Include="Map\Models\Characters\Character.cs" />
<Compile Include="Map\Models\Characters\Bot.cs" />
<Compile Include="Map\Models\Characters\Player.cs" />
<Compile Include="Map\Models\Characters\PlayerRace.cs" />
<Compile Include="Core\Factories\BotFactory.cs" />
<Compile Include="Core\Factories\ItemFactory.cs" />
<Compile Include="Core\Factories\PlayerFactory.cs" />
@@ -66,9 +68,9 @@
<Compile Include="Interfaces\IMoveable.cs" />
<Compile Include="Interfaces\IPlayer.cs" />
<Compile Include="Interfaces\IRender.cs" />
<Compile Include="Items\GameObject.cs" />
<Compile Include="Items\Item.cs" />
<Compile Include="Items\Itempossition.cs" />
<Compile Include="Map\Models\GameObject.cs" />
<Compile Include="Map\Models\Items\Item.cs" />
<Compile Include="Map\Models\Items\ItemBodyPosition.cs" />
<Compile Include="Launcher.cs" />
<Compile Include="Map\Map.cs" />
<Compile Include="Map\Position.cs" />
@@ -1,19 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text;

namespace RPG_ConsoleGame.UserInterface
{
using System;
using Interfaces;

public class ConsoleRender : IRender
{
public void WriteLine(string message, params object[] paramaters)
{
Console.WriteLine(message, paramaters);
}

public void PrintScreen(StringBuilder screen)
{
Console.WriteLine(screen);
}

public void Clear()
{
Console.Clear();