@@ -39,6 +39,7 @@ public:
int getStartingActivityPoints();
int getHealthPoints();
+ void setHealthPoints(int);
int getMagicDefence();
int getPhysicDefence();
@@ -16,11 +16,12 @@ void MeleeDamage::OperateOnUnitToCell(Unit* who, Cell* where){
}
void MeleeDamage::OperateOnUnit(Unit* unit){
-// unit->setHealthPoints( unit->getHealthPoints() -
-// (count_ - 2.5 * double(count_) * double(unit->getPhysicDefence()) / 100.0));
+ unit->setHealthPoints( unit->getHealthPoints() -
+ (count_ - 2.5 * double(count_) * double(unit->getPhysicDefence()) / 100.0));
void MeleeDamage::Execute(Cell* from, Cell* where, Unit* who, Unit* whom, TypeOfTrigger Type){
- if(Type == 1)
+ if(Type == 1){
OperateOnUnit(whom);
+ }
@@ -12,7 +12,7 @@ void SelfHeal::OperateOnCell(Cell* cell){
void SelfHeal::OperateOnUnit(Unit* unit){
- //unit.setHealthPoints(std :: min(unit.getHealthPoints() + count_ > unit->getMaxHealthPoints());
+ unit->setHealthPoints(std :: min(unit->getHealthPoints() + count_, unit->getMaxHealthPoints()));
//check_on_is_it_max
@@ -129,6 +129,10 @@ int Unit::getActivityPoints(){
return activity_points_;
+void Unit::setHealthPoints(int health){
+ health_points_ = std::min(40, health);
+}
+
int Unit::getStartingActivityPoints() {
return starting_activity_points_;