Skip to content

Instantly share code, notes, and snippets.

@GarethOates
Created January 27, 2020 23:30
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 GarethOates/40a1549309952538420e6919b16c0076 to your computer and use it in GitHub Desktop.
Save GarethOates/40a1549309952538420e6919b16c0076 to your computer and use it in GitHub Desktop.
A more generic equipment class
using System;
namespace MagicTheProgramming
{
public class Weapon : CreatureDecorator, ICreature
{
protected int _powermodifier;
protected int _toughnessmodifier;
public Weapon(ICreature creature, int powermod, int toughnessmod)
: base(creature) {
this._powermodifier = powermod;
this._toughnessmodifier = toughnessmod;
}
public override int Toughness => base.Toughness + _toughnessmodifier;
public override int Power => base.Power + _powermodifier;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment