Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Uppgift_Hero {
- class Program {
- static void Main(string[] args) {
- }
- }
- public class Humanoid {
- public Humanoid() {
- }
- void Attack(Humanoid target) {
- int finalDamage = sword.damage;
- int damageReduction = armorPoints / 3;
- finalDamage -= damageReduction;
- armor.durability -= 1;
- shield.durability -= 1;
- helmet.durability -= 1;
- hp -= finalDamage > 0 ? finalDamage : 0;
- }
- public int hp { get; set; }
- public int armorPoints {
- get {
- return shield.shieldPoints * 2 + armor.armorPoints + helmet.armorPoints;
- }
- set {
- armorPoints = value;
- }
- }
- Sword sword;
- Armor armor;
- Shield shield;
- Helmet helmet;
- }
- public class Hero : Humanoid {
- Hero() {
- }
- public Castle castle;
- List<Equipment> inventory;
- }
- public class Enemy : Humanoid {
- public Enemy() {
- }
- Hero hero;
- }
- public class Equipment {
- public Equipment(int durability) {
- }
- public int durability { get; set; }
- }
- public class Shield : Equipment {
- public Shield(int durability) : base(durability) {
- }
- public int shieldPoints { get; private set; }
- }
- public class Armor : Equipment {
- public Armor(int durability) : base(durability) {
- }
- public int armorPoints { get; private set; }
- }
- public class Helmet : Equipment {
- public Helmet(int durability) : base(durability) {
- }
- public int armorPoints { get; private set; }
- }
- public class Sword : Equipment {
- public Sword(int durability) : base(durability) {
- Castle.Tower t = new Castle.Tower();
- }
- public int damage { get; private set; }
- }
- public class Castle {
- Castle(int towers) {
- this.towers = new List<Tower>();
- for(int i = 0; i < towers; i++) {
- this.towers.Add(new Tower());
- }
- }
- public void AddEnemy(Enemy enemy) {
- enemies.Add(enemy);
- }
- public List<Tower> towers { get; }
- List<Enemy> enemies;
- public class Tower {
- public Tower() {
- }
- public void AddEnemy(Enemy enemy) {
- enemies.Add(enemy);
- }
- List<Enemy> enemies;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement