-
-
Save oinant/84a375d4840d4c6c3046 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace Blog.RolePlayingGame.Core | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var myHero = new HeroBuilder() | |
.OfWarriorClass() | |
.WithName("Mighty Hall-Dard") | |
.WithLevel(2) | |
.BoostStrength() | |
.BoostSpirit() | |
.Create(); | |
var enemy = new Monster(); | |
myHero.Hit(enemy); | |
} | |
} | |
class Monster : ITarget | |
{ | |
private int health = 15; | |
private int _strength = 3; | |
private int _spirit = 3; | |
public void ReceivePhysicalAttack(int incomingStrength) | |
{ | |
health -= Math.Max(0, (incomingStrength - _strength)); | |
} | |
public void ReceiveMagicalAttack(int strength) | |
{ | |
throw new NotImplementedException(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment