#include "Creature.hpp"
#include "../app/Assets.hpp"
+#include "../ui/string.hpp"
#include "../world/Planet.hpp"
#include "../world/Resource.hpp"
#include "../world/Simulation.hpp"
// TODO: check if in compatible atmosphere
double amount = GetCreature().GetStats().Breath().gain * -(1.5 + 0.5 * GetCreature().ExhaustionFactor());
GetCreature().GetStats().Breath().Add(amount * dt);
- // maintain ~2.5% gas composition
+ // maintain ~1% gas composition
double gas_amount = GetCreature().GetComposition().Get(gas);
- if (gas_amount < GetCreature().GetComposition().TotalMass() * 0.025) {
+ if (gas_amount < GetCreature().GetComposition().TotalMass() * 0.01) {
double add = std::min(GetCreature().GetComposition().TotalMass() * 0.025 - gas_amount, -amount * dt);
GetCreature().Ingest(gas, add);
}
void BlobBackgroundTask::CheckSplit() {
if (GetCreature().Mass() > GetCreature().OffspringMass() * 2.0
&& GetCreature().OffspringChance() > Assets().random.UNorm()) {
- std::cout << "[" << int(GetCreature().GetSimulation().Time())
- << "s] " << GetCreature().Name() << " split" << std::endl;
+ std::cout << "[" << ui::TimeString(GetCreature().GetSimulation().Time())
+ << "] " << GetCreature().Name() << " split" << std::endl;
Split(GetCreature());
return;
}
// check for random property mutation
if (GetCreature().MutateChance() > Assets().random.UNorm()) {
double amount = 1.0 + (Assets().random.SNorm() * 0.05);
- math::Distribution &d = GetCreature().GetGenome().properties.props[(int(Assets().random.UNorm() * 8.0) % 8)];
+ math::Distribution &d = GetCreature().GetGenome().properties.props[Assets().random.UInt(9)];
if (Assets().random.UNorm() < 0.5) {
d.Mean(d.Mean() * amount);
} else {