1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-24 17:10:36 +00:00

Orb of Chaos no longer despecializes Tortoises

This commit is contained in:
Zeno Rogue 2020-03-12 10:22:46 +01:00
parent b3c105de0c
commit 0381999842
4 changed files with 29 additions and 11 deletions

View File

@ -2569,6 +2569,25 @@ EX namespace tortoise {
EX string measure(int bits) {
return "(" + its(progress(bits)) + "/" + its(tortoise::numbits) + ")";
}
template<class T> void swap_data(T& data, cell *c1, cell *c2) {
changes.map_value(data, c1);
changes.map_value(data, c2);
if(data.count(c1) && data.count(c2))
swap(data[c1], data[c2]);
else if(data.count(c1))
data[c2] = data[c1], data.erase(c1);
else if(data.count(c2))
data[c1] = data[c2], data.erase(c2);
}
EX void move_baby(cell *c1, cell *c2) {
swap_data(babymap, c1, c2);
}
EX void move_adult(cell *c1, cell *c2) {
swap_data(emap, c1, c2);
}
EX }
EX namespace dragon {

View File

@ -347,9 +347,8 @@ EX void moveItem1(cell *from, cell *to, bool activateYendor) {
yendor::yi[i].actualKey = to;
}
if(from->item == itBabyTortoise) {
tortoise::babymap[to] = tortoise::babymap[from];
tortoise::babymap.erase(from);
if(from->item == itBabyTortoise || to->item == itBabyTortoise) {
tortoise::move_baby(from, to);
}
eItem i = to->item;

View File

@ -87,20 +87,14 @@ EX void moveEffect(const movei& mi, eMonster m) {
if(cf && m == moKnight) camelot::move_knight(cf, ct);
if(cf && m == moTortoise) {
changes.map_value(tortoise::emap, ct);
changes.map_value(tortoise::emap, cf);
tortoise::emap[ct] = tortoise::getb(cf);
tortoise::emap.erase(cf);
tortoise::move_adult(cf, ct);
}
if(cf && ct->item == itBabyTortoise && !cf->item) {
changes.map_value(tortoise::babymap, ct);
changes.map_value(tortoise::babymap, cf);
cf->item = itBabyTortoise;
ct->item = itNone;
animateMovement(mi.rev(), LAYER_BOAT);
tortoise::babymap[cf] = tortoise::babymap[ct];
tortoise::babymap.erase(ct);
tortoise::move_baby(cf, ct);
}
}

View File

@ -517,6 +517,12 @@ void apply_chaos() {
princess::move(movei{cb, ca, JUMP});
if(isPrincess(cb) && !isPrincess(ca))
princess::move(movei{ca, cb, JUMP});
if(ca->monst == moTortoise || cb->monst == moTortoise) {
tortoise::move_adult(ca, cb);
}
if(ca->item == itBabyTortoise || cb->item == itBabyTortoise) {
tortoise::move_baby(ca, cb);
}
}
bool pcmove::actual_move() {