incrementing player stats

This commit is contained in:
devZoGok
2023-12-30 11:23:55 +02:00
parent 31eba177cb
commit 86a0c7d24d
8 changed files with 38 additions and 18 deletions
+16 -2
View File
@@ -145,9 +145,23 @@ namespace battleship{
Unit *targetUnit = orders[0].targets[0].unit;
if(targetUnit)
if(targetUnit){
targetUnit->takeDamage(damage);
if(targetUnit->getHealth() <= DEATH_HP){
Player *targUnitPlayer = targetUnit->getPlayer();
if(targetUnit->isVehicle()){
player->incVehiclesDestroyed();
targUnitPlayer->incVehiclesLost();
}
else{
player->incStructuresDestroyed();
targUnitPlayer->incStructuresLost();
}
}
}
lastFireTime = getTime();
}
@@ -187,7 +201,7 @@ namespace battleship{
for(GarrisonSlot &slot : garrisonSlots)
displayUnitStats(slot.foreground, slot.background, (int)((bool)slot.vehicle), (int)true, mainPlayerSelecting, slot.offset);
if (health <= 0)
if (health <= DEATH_HP)
blowUp();
}