mirror of
https://github.com/Nimac0/SDL_Minigame
synced 2026-01-12 10:13:42 +00:00
fixed uint->int conversion issues and buff duration
This commit is contained in:
parent
6c0fccbb9f
commit
037a7f7611
@ -24,7 +24,7 @@ constexpr int MAP_SIZE_Y = 20;
|
||||
|
||||
constexpr int SPAWN_ATTEMPTS = 20;
|
||||
|
||||
constexpr int BUFF_DURATION = 6000;
|
||||
constexpr int BUFF_DURATION = 240;
|
||||
|
||||
constexpr int BUFF_VALUE = 1;
|
||||
|
||||
|
||||
@ -18,10 +18,10 @@ public:
|
||||
void init() override;
|
||||
void update() override;
|
||||
|
||||
void modifyStatDur(Stats stat, uint8_t duration);
|
||||
void modifyStatDur(Stats stat, int duration);
|
||||
|
||||
void modifyStatValue(Stats stat, int modifier);
|
||||
|
||||
private:
|
||||
std::array<int8_t, MAX_STATS> buffs = { 0 };
|
||||
std::array<int, MAX_STATS> buffs = { 0 };
|
||||
};
|
||||
@ -48,10 +48,10 @@ void PowerupComponent::heartEffect(Entity* player)
|
||||
|
||||
void PowerupComponent::movementSpeedEffect(Entity* player)
|
||||
{
|
||||
player->getComponent<StatEffectsComponent>().modifyStatDur(Stats::MOVEMENT_SPEED, (uint8_t) BUFF_DURATION);
|
||||
player->getComponent<StatEffectsComponent>().modifyStatDur(Stats::MOVEMENT_SPEED, BUFF_DURATION);
|
||||
}
|
||||
|
||||
void PowerupComponent::atkSpeedEffect(Entity* player)
|
||||
{
|
||||
player->getComponent<StatEffectsComponent>().modifyStatDur(Stats::ATTACK_SPEED, (uint8_t) BUFF_DURATION);
|
||||
player->getComponent<StatEffectsComponent>().modifyStatDur(Stats::ATTACK_SPEED, BUFF_DURATION);
|
||||
}
|
||||
@ -21,7 +21,7 @@ void StatEffectsComponent::update()
|
||||
}
|
||||
}
|
||||
|
||||
void StatEffectsComponent::modifyStatDur(Stats stat, uint8_t duration)
|
||||
void StatEffectsComponent::modifyStatDur(Stats stat, int duration)
|
||||
{
|
||||
if(this->buffs.at((uint8_t)stat) == 0) this->modifyStatValue(stat, BUFF_VALUE);
|
||||
this->buffs.at((uint8_t)stat) += duration;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user