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

	my $amass = $avatar->_basemass;
	my $mass = $this->_mass;

	# If avatar is a little bit overloaded, then don't allow the
	# attack.
	if ($amass + $mass * 2 > $avatar->maxweight) {
		return 0;
	}
	
	# Only add the part of the avatar's mass if the object has a
	# reasonable amount of mass to begin with. Adding avatar's mass
	# when attacking with a needle or a balloon would be silly.
	if ($mass > 0.25) {
		$mass += $amass / 10;
	}

	return $mass / 5;
}
