meleedamage.cpp 701 B

123456789101112131415161718192021222324252627
  1. //
  2. // Created by IgorBat on 23.04.2018.
  3. //
  4. #include <cassert>
  5. #include "effects\meleedamage.h"
  6. #include "units\unit.h"
  7. #include <string>
  8. void MeleeDamage::OperateOnCell(Cell* cell){
  9. throw std :: string("CAN'T TOUCH THIS");
  10. }
  11. void MeleeDamage::OperateOnUnitToCell(Unit* who, Cell* where){
  12. throw std :: string("CAN'T TOUCH THIS");
  13. }
  14. void MeleeDamage::OperateOnUnit(Unit* unit){
  15. unit->setHealthPoints( unit->getHealthPoints() -
  16. (count_ - 2.5 * double(count_) * double(unit->getPhysicDefence()) / 100.0));
  17. }
  18. void MeleeDamage::Execute(Cell* from, Cell* where, Unit* who, Unit* whom, TypeOfTrigger Type){
  19. if(Type == 1){
  20. OperateOnUnit(whom);
  21. }
  22. }