-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnormalunit.cpp
More file actions
executable file
·42 lines (31 loc) · 1.09 KB
/
normalunit.cpp
File metadata and controls
executable file
·42 lines (31 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "normalunit.h"
#include "player.h"
#include "iostream"
using namespace std;
NormalUnit::NormalUnit(Map* _map, Player* player) :Unit(_map){
gameObjectType=4;
this->name=player->information.normal_name;
this->cost=player->information.normal_cost;
this->training_time=player->information.normal_time_constructoin;
this->max_health=player->information.normal_max_health;
this->attack_damage=player->information.normal_attack_damage;
this->attack_range=player->information.normal_attack_range;
this->attack_delay=player->information.normal_attack_delay;
this->speed=player->information.normal_speed;
health=max_health;
}
bool NormalUnit::upgrade(){
level++;
max_health+= max_health /4;
health+= health/4;
attack_damage+= attack_damage/4;
return true;
}
string NormalUnit::getStatus(){
char status[100];
if(myRoad.size()==0)
sprintf(status,"this unit don't go any where");
else
sprintf(status,"this unit go to block (%d,%d)",myRoad[0].y,myRoad[0].x);
return status;
}