Skip to content

Instantly share code, notes, and snippets.

@AleksLitynski
Created July 25, 2013 21:58
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 AleksLitynski/6084163 to your computer and use it in GitHub Desktop.
Save AleksLitynski/6084163 to your computer and use it in GitHub Desktop.
ability system
abstract class ability
{
string name;
string description;
ability(n, d)
{
name = n; description = d;
}
absrtact void doAbility(*caster, *target);
}
class fireySplash : ability
{
override void doAbility(*caster, *target)
{
target.hp -= caster.mp / 10;
}
}
class fireBall : ability
{
override void doAbility(*caster, *target)
{
target.hp -= 3 * caster.magicShiz / target.magicResist;
fireySplash(caster, target.characterToTheLeft);
fireySplash(caster, target.characterToTheRight);
}
}
static void main()
{
while 1 {
player[0].chooseAnAbility
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment