Skip to content
Snippets Groups Projects
Commit abb13726 authored by Max Cherris's avatar Max Cherris
Browse files

Add actual fighting

parent 70b3c323
No related branches found
No related tags found
1 merge request!15Merge units into main
......@@ -82,13 +82,18 @@ namespace advanced_wars
}
// Start Attack: choose the appropriate weapon:
/*
int offDamage = damageMatrix[static_cast<u_int8_t>(ally->id)][static_cast<u_int8_t>(enemy->id)] * ((ally->health) / (ally->max_health));
int defDamage = damageMatrix[static_cast<u_int8_t>(ally->id)][static_cast<u_int8_t>(enemy->id)] * ((enemy->health) / (enemy->max_health));
int defDamage = damageMatrix[static_cast<u_int8_t>(enemy->id)][static_cast<u_int8_t>(ally->id)] * ((enemy->health) / (enemy->max_health));
*/
int offDamage = 10;
int defDamage = 1000;
enemy->health = enemy->health - offDamage;
if (enemy->health > 0)
{
ally->health = ally->health - defDamage;
std::cout << "Health ally:" << ally->health << std::endl;
if (ally->health <= 0)
{
ally->~Unit();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment