| 1 | sub new { | ||
| 2 | ### This Action uses 2 other Actions such as HitAction, HittedAction | ||
| 3 | ### instead of functors as in Action.pm | ||
| 4 | |||
| 5 | ### NOTE that both actions can be at the same time to care | ||
| 6 | ### for defense, god mode etc. Actions' functors can e.g. use | ||
| 7 | ### the Metropolis algorithm in this codebase. | ||
| 8 | |||
| 9 | ### hitaction is what you hit with and hittedaction is the action | ||
| 10 | ### on which you get hit | ||
| 11 | |||
| 12 | my ($class, $entity1, $entity2, $hitaction, $hittedaction) = @_; | ||
| 13 | |||
| 14 | $self = { playerentity => $entity1, adversaryentity => $entity2, | ||
| 15 | hitaction => $hitaction, hittedaction => $hittedaction, }; | ||
| 16 | |||
| 17 | bless $self, $class; | ||
| 18 | }; | ||
| 19 | |||
| 20 | 1; |