#!/usr/bin/perl 
#use Mooix::Thing;
run sub {
	my $this=shift;
	%_=@_;
	my $avatar=$_{avatar} || $this->croak("bad avatar");

	my ($rolls, $dice, $modifier) = 
		$this->damage_amount =~ /^(\d{1,2})d(\d{1,3})([+-]\d{1,3})?/;
	
	my $dice_roll = 0;
	for ($count = 0; $count < $rolls; $count++) {
		$dice_roll += int(rand($dice-1)+1);
	}
	return $dice_roll + $modifier;
}
