Skip to content

Instantly share code, notes, and snippets.

@oinant
Created September 16, 2015 09:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oinant/84a375d4840d4c6c3046 to your computer and use it in GitHub Desktop.
Save oinant/84a375d4840d4c6c3046 to your computer and use it in GitHub Desktop.
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