mirror of
https://github.com/zoriya/Bomberman.git
synced 2025-12-21 22:05:10 +00:00
removed ignore walls bonus (sorry clément :( )
This commit is contained in:
@@ -20,7 +20,7 @@ namespace BBM {
|
|||||||
double rnd = static_cast<double>(std::rand()) / RAND_MAX;
|
double rnd = static_cast<double>(std::rand()) / RAND_MAX;
|
||||||
|
|
||||||
if (rnd < 0.4)
|
if (rnd < 0.4)
|
||||||
return (static_cast<BonusType>(std::rand() % (IGNOREWALLS - 1) + 1));
|
return (static_cast<BonusType>(std::rand() % (DAMAGEINC - 1) + 1));
|
||||||
return (NOTHING);
|
return (NOTHING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -21,8 +21,7 @@ namespace BBM
|
|||||||
BOMBSTOCK,
|
BOMBSTOCK,
|
||||||
SPEEDUP,
|
SPEEDUP,
|
||||||
EXPLOSIONINC,
|
EXPLOSIONINC,
|
||||||
DAMAGEINC,
|
DAMAGEINC
|
||||||
IGNOREWALLS
|
|
||||||
};
|
};
|
||||||
|
|
||||||
std::chrono::nanoseconds disappearTimer = 5s;
|
std::chrono::nanoseconds disappearTimer = 5s;
|
||||||
|
|||||||
@@ -28,10 +28,6 @@ namespace BBM
|
|||||||
std::chrono::nanoseconds rangeBonusRate = 10s;
|
std::chrono::nanoseconds rangeBonusRate = 10s;
|
||||||
//! @brief The number of nanosecond before the expiration of a range bonus.
|
//! @brief The number of nanosecond before the expiration of a range bonus.
|
||||||
std::chrono::nanoseconds nextRangeBonusRate = rangeBonusRate;
|
std::chrono::nanoseconds nextRangeBonusRate = rangeBonusRate;
|
||||||
//! @brief The number of seconds before a ignoreWalls expire. This variable is used to reset the nextSpeedBonusRate value.
|
|
||||||
std::chrono::nanoseconds ignoreWallsBonusRate = 15s;
|
|
||||||
//! @brief The number of nanosecond before the expiration of a ignoreWalls bonus.
|
|
||||||
std::chrono::nanoseconds nextIgnoreWallsBonusRate = ignoreWallsBonusRate;
|
|
||||||
|
|
||||||
//! @inherit
|
//! @inherit
|
||||||
WAL::Component *clone(WAL::Entity &entity) const override;
|
WAL::Component *clone(WAL::Entity &entity) const override;
|
||||||
|
|||||||
@@ -56,17 +56,4 @@ namespace BBM {
|
|||||||
controllable.speed = 0.35f;
|
controllable.speed = 0.35f;
|
||||||
playerBonus.nextSpeedBonusRate = playerBonus.speedBonusRate;
|
playerBonus.nextSpeedBonusRate = playerBonus.speedBonusRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bonus::IgnoreWallsBonus(WAL::Entity &player, const WAL::Entity &bonus, CollisionComponent::CollidedAxis axis)
|
|
||||||
{
|
|
||||||
if (bonus.shouldDelete())
|
|
||||||
return;
|
|
||||||
if (player.hasComponent<BombHolderComponent>()) {
|
|
||||||
auto &playerBonus = player.getComponent<PlayerBonusComponent>();
|
|
||||||
auto &bombHolder = player.getComponent<BombHolderComponent>();
|
|
||||||
playerBonus.nextIgnoreWallsBonusRate = playerBonus.ignoreWallsBonusRate;
|
|
||||||
std::cout << "Explosion is supposed to pass through walls here" << std::endl;
|
|
||||||
//bombHolder.ignoreWalls = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -29,10 +29,5 @@ namespace BBM {
|
|||||||
//! @param player the entity on which the effect will be applied
|
//! @param player the entity on which the effect will be applied
|
||||||
//! @brief Apply bonus effect that allows to run faster
|
//! @brief Apply bonus effect that allows to run faster
|
||||||
static void SpeedUpBonus(WAL::Entity &player, const WAL::Entity &bonus, CollisionComponent::CollidedAxis axis);
|
static void SpeedUpBonus(WAL::Entity &player, const WAL::Entity &bonus, CollisionComponent::CollidedAxis axis);
|
||||||
|
|
||||||
//! @param bonus bonus
|
|
||||||
//! @param player the entity on which the effect will be applied
|
|
||||||
//! @brief Apply bonus effect that allows bomb explosion to pass through walls
|
|
||||||
static void IgnoreWallsBonus(WAL::Entity &player, const WAL::Entity &bonus, CollisionComponent::CollidedAxis axis);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -23,11 +23,6 @@ namespace BBM
|
|||||||
playerBonus.nextSpeedBonusRate = playerBonus.speedBonusRate;
|
playerBonus.nextSpeedBonusRate = playerBonus.speedBonusRate;
|
||||||
controllable.speed = 0.25f;
|
controllable.speed = 0.25f;
|
||||||
}
|
}
|
||||||
playerBonus.nextIgnoreWallsBonusRate -= dtime;
|
|
||||||
if (playerBonus.nextIgnoreWallsBonusRate <= 0ns) {
|
|
||||||
playerBonus.nextIgnoreWallsBonusRate = playerBonus.ignoreWallsBonusRate;
|
|
||||||
//holder.ignoreWalls = false;
|
|
||||||
}
|
|
||||||
playerBonus.nextDamageBonusRate -= dtime;
|
playerBonus.nextDamageBonusRate -= dtime;
|
||||||
if (playerBonus.nextDamageBonusRate <= 0ns) {
|
if (playerBonus.nextDamageBonusRate <= 0ns) {
|
||||||
playerBonus.nextDamageBonusRate = playerBonus.damageBonusRate;
|
playerBonus.nextDamageBonusRate = playerBonus.damageBonusRate;
|
||||||
|
|||||||
@@ -30,12 +30,11 @@ namespace BBM
|
|||||||
{BonusComponent::BonusType::BOMBSTOCK, "assets/items/bombup"},
|
{BonusComponent::BonusType::BOMBSTOCK, "assets/items/bombup"},
|
||||||
{BonusComponent::BonusType::SPEEDUP, "assets/items/speedup"},
|
{BonusComponent::BonusType::SPEEDUP, "assets/items/speedup"},
|
||||||
//{BonusComponent::BonusType::EXPLOSIONINC, "assets/items/explosion"},
|
//{BonusComponent::BonusType::EXPLOSIONINC, "assets/items/explosion"},
|
||||||
{BonusComponent::BonusType::DAMAGEINC, "assets/items/fireup"},
|
{BonusComponent::BonusType::DAMAGEINC, "assets/items/fireup"}
|
||||||
{BonusComponent::BonusType::IGNOREWALLS, "assets/items/wallpass"}
|
|
||||||
};
|
};
|
||||||
static std::vector<std::function<void (WAL::Entity &, const WAL::Entity &, CollisionComponent::CollidedAxis)>> func = {
|
static std::vector<std::function<void (WAL::Entity &, const WAL::Entity &, CollisionComponent::CollidedAxis)>> func = {
|
||||||
&Bonus::BombUpBonus, &Bonus::SpeedUpBonus, //&Bonus::ExplosionRangeBonus,
|
&Bonus::BombUpBonus, &Bonus::SpeedUpBonus, //&Bonus::ExplosionRangeBonus,
|
||||||
&Bonus::DamageIncreasedBonus, &Bonus::IgnoreWallsBonus
|
&Bonus::DamageIncreasedBonus
|
||||||
};
|
};
|
||||||
|
|
||||||
if (bonusType == BonusComponent::BonusType::NOTHING)
|
if (bonusType == BonusComponent::BonusType::NOTHING)
|
||||||
|
|||||||
Reference in New Issue
Block a user