mirror of
https://github.com/zoriya/Bomberman.git
synced 2025-12-21 13:55:10 +00:00
26 lines
554 B
C++
26 lines
554 B
C++
//
|
|
// Created by Benjamin Henry on 2021-06-01.
|
|
//
|
|
|
|
#include "BonusComponent.hpp"
|
|
#include <map>
|
|
|
|
namespace BBM {
|
|
BonusComponent::BonusComponent(WAL::Entity &entity)
|
|
: WAL::Component(entity)
|
|
{}
|
|
|
|
WAL::Component *BonusComponent::clone(WAL::Entity &entity) const
|
|
{
|
|
return new BonusComponent(entity);
|
|
}
|
|
|
|
BonusComponent::BonusType BonusComponent::getRandomBonusType() const
|
|
{
|
|
double rnd = static_cast<double>(std::rand()) / RAND_MAX;
|
|
|
|
if (rnd < 0.4)
|
|
return (static_cast<BonusType>(std::rand() % (DAMAGEINC - 1) + 1));
|
|
return (NOTHING);
|
|
}
|
|
} |