| 1 | sub new { | ||
| 2 | ### an Action is based around 2 entities and has several | ||
| 3 | ### hitting functors, one one which entity1 is hit and another | ||
| 4 | ### on which it is hit | ||
| 5 | ### entity2 is on which you hit with entity1 | ||
| 6 | |||
| 7 | ### NOTE that both actions can be at the same time to care | ||
| 8 | ### for defense, god mode etc. Actions' functors can e.g. use | ||
| 9 | ### the Metropolis algorithm in this codebase wrapped in the functor. | ||
| 10 | |||
| 11 | my ($class, $entity1, $entity2, $hitf, $tohitf) = @_; | ||
| 12 | |||
| 13 | $self = { playerentity => $entity1, adversaryentity => $entity2, | ||
| 14 | hitmethod => $hitf, tohitmethod => $tohitf, }; | ||
| 15 | |||
| 16 | bless $self, $class; | ||
| 17 | }; | ||
| 18 | |||
| 19 | 1; |