Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jonylu7 committed Mar 25, 2024
1 parent 0795893 commit b8a1991
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 20 deletions.
21 changes: 2 additions & 19 deletions include/Unit/AttackAndDamageUnit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,11 @@

#ifndef PRACTICALTOOLSFORSIMPLEDESIGN_ATTACKANDDAMAGEUNIT_HPP
#define PRACTICALTOOLSFORSIMPLEDESIGN_ATTACKANDDAMAGEUNIT_HPP
<<<<<<< HEAD

class AttackAndDamageUnit {
public:
AttackAndDamageUnit() {}
virtual ~AttackAndDamageUnit() {}
=======
#include "Avatar.hpp"
class AttackAndDameageUnit {
public:
AttackAndDameageUnit() {}
~AttackAndDameageUnit() {}
>>>>>>> ae90c3b (attack and damage)

int getHP() { return m_HP; }
int getArmorRate() { return m_ArmorRate; }
Expand All @@ -29,19 +21,13 @@ class AttackAndDameageUnit {
void setHardAttack(int hardattack) { m_SoftAttack = hardattack; }

void takeDamage(int softattack, int hardattack) {
<<<<<<< HEAD
=======

>>>>>>> ae90c3b (attack and damage)
m_HP -= (100 - m_ArmorRate) * (1 / 100) * softattack +
m_ArmorRate * (1 / 100) * hardattack;
}

<<<<<<< HEAD
void ForceAttackUnit(std::shared_ptr<AttackAndDamageUnit> target) {
=======
void ForceAttackUnit(std::shared_ptr<AttackAndDameageUnit> target) {
>>>>>>> ae90c3b (attack and damage)

// check withinrange
// cd time
target->takeDamage(m_SoftAttack, m_HardAttack);
Expand All @@ -54,11 +40,8 @@ class AttackAndDameageUnit {
int m_SoftAttack;
int m_HardAttack;
float m_AttackRange;
<<<<<<< HEAD

float cd; // count as seconds
=======
int cd;
>>>>>>> ae90c3b (attack and damage)
};

#endif // PRACTICALTOOLSFORSIMPLEDESIGN_ATTACKANDDAMAGEUNIT_HPP
4 changes: 3 additions & 1 deletion include/Unit/PathfindingUnit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ class PathfindingUnit : public Util::GameObject {
void setCurrentCell(glm::vec2 cell) {
this->m_currentCell = glm::vec2(cell);
// MapClass::CellCoordToGlobal(m_currentCell);
glm::vec2 temp = MapUtil::CellCoordToGlobal(this->m_currentCell);
glm::vec2 temp(
int(this->m_currentCell.x * CELL_SIZE.x) + 0.5 * CELL_SIZE.x,
int(this->m_currentCell.y * CELL_SIZE.y) + 0.5 * CELL_SIZE.y);
// m_currentLocation={temp.x+CELL_SIZE.x/2,temp.y+CELL_SIZE.y/2};
m_currentLocation = {temp.x, temp.y};
}
Expand Down

0 comments on commit b8a1991

Please sign in to comment.