Archer.cpp 522 B

12345678910111213141516171819202122232425
  1. #pragma once
  2. #include <iostream>
  3. #include <random>
  4. #include <ctime>
  5. #include "unit.h"
  6. #include "Archer.h"
  7. Archer::Archer(std::string id) {
  8. }
  9. Archer::~Archer() {}
  10. bool Archer::canAttackForDistance(int distance) {
  11. //this is a dummy
  12. srand(time(0));
  13. return rand() % 2;
  14. }
  15. bool Archer::canAttackToCell(Cell * destination) {
  16. return canAttackForDistance(lenOfActualPath(destination) + getAttackCost() * getMovementSpeed());
  17. }
  18. bool Archer::canAttackUnit(Unit * target) {
  19. return canAttackToCell(target->getLocation());
  20. }