mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2026-03-15 09:39:44 +00:00
26 lines
612 B
C++
26 lines
612 B
C++
namespace rogue_unlike {
|
|
|
|
void prepare_hallucination() {
|
|
set<string> names_seen;
|
|
vector<entity*> visions;
|
|
for(auto& [c, r]: rooms) for(auto& e: r.entities) {
|
|
if(!e->can_be_hallucinated()) continue;
|
|
string s = e->get_name();
|
|
if(names_seen.count(s)) continue;
|
|
names_seen.insert(s);
|
|
visions.push_back(&*e);
|
|
}
|
|
|
|
for(auto& e: rogue_unlike::visions) visions.push_back(&*e);
|
|
|
|
for(auto& [c, r]: rooms) for(auto& e: r.entities) {
|
|
e->hallucinated = hrand_elt(visions);
|
|
}
|
|
}
|
|
|
|
entity *entity::hal() {
|
|
return (m.current.hallucinating && hallucinated) ? hallucinated : this;
|
|
}
|
|
|
|
}
|