Rider.cpp 547 B

123456789101112131415161718192021222324
  1. #pragma once
  2. #include <iostream>
  3. #include <random>
  4. #include <ctime>
  5. #include "unit.h"
  6. #include "Rider.h"
  7. Rider::Rider(std::string id) {
  8. }
  9. Rider::~Rider(){}
  10. bool Rider::canAttackForDistance(int distance) {
  11. return (canMoveForDistance(attack_cost_ * getMovementSpeed() + distance - attack_range_));
  12. }
  13. bool Rider::canAttackToCell(Cell * destination) {
  14. return lenOfActualPath(destination) != 0 &&
  15. canAttackForDistance(lenOfActualPath(destination));
  16. }
  17. bool Rider::canAttackUnit(Unit * target) {
  18. return canAttackToCell(target->getLocation());
  19. }