-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathButter.cpp
More file actions
16 lines (14 loc) · 816 Bytes
/
Butter.cpp
File metadata and controls
16 lines (14 loc) · 816 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include "Butter.h"
// Butter is a child class of ShopItem
// Default constructor
Butter::Butter() : ShopItem("Butter", 35, "Requirements to unlock this item: Purchase Speed Boosting Kit.\nEffects: -0.01 of the Enemy's Speed when activated.\n\n\033[3mSlather this slippery treat on your enemy’s feet, and watch them struggle to catch up as they slide around in confusion.\033[0m", "butter.png") {
hasButterEffectApplied = false;
}
// Method that applies the butter effect to the enemy, reducing their speed by 0.01
void Butter::applyEffect(Player* player, Enemy* enemy) {
if (enemy && !hasButterEffectApplied) {
enemy->setEnemySpeed(enemy->getEnemySpeed() - 0.01f);
hasButterEffectApplied = true;
std::cout << "Enemy Speed decreased to: " << enemy->getEnemySpeed() << "\n";
}
}