added typecheck to attack constructor