1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-25 01:20:37 +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) { EX string measure(int bits) {
return "(" + its(progress(bits)) + "/" + its(tortoise::numbits) + ")"; 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 }
EX namespace dragon { EX namespace dragon {

View File

@ -347,9 +347,8 @@ EX void moveItem1(cell *from, cell *to, bool activateYendor) {
yendor::yi[i].actualKey = to; yendor::yi[i].actualKey = to;
} }
if(from->item == itBabyTortoise) { if(from->item == itBabyTortoise || to->item == itBabyTortoise) {
tortoise::babymap[to] = tortoise::babymap[from]; tortoise::move_baby(from, to);
tortoise::babymap.erase(from);
} }
eItem i = to->item; 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 == moKnight) camelot::move_knight(cf, ct);
if(cf && m == moTortoise) { if(cf && m == moTortoise) {
changes.map_value(tortoise::emap, ct); tortoise::move_adult(cf, ct);
changes.map_value(tortoise::emap, cf);
tortoise::emap[ct] = tortoise::getb(cf);
tortoise::emap.erase(cf);
} }
if(cf && ct->item == itBabyTortoise && !cf->item) { if(cf && ct->item == itBabyTortoise && !cf->item) {
changes.map_value(tortoise::babymap, ct);
changes.map_value(tortoise::babymap, cf);
cf->item = itBabyTortoise; cf->item = itBabyTortoise;
ct->item = itNone; ct->item = itNone;
animateMovement(mi.rev(), LAYER_BOAT); animateMovement(mi.rev(), LAYER_BOAT);
tortoise::babymap[cf] = tortoise::babymap[ct]; tortoise::move_baby(cf, ct);
tortoise::babymap.erase(ct);
} }
} }

View File

@ -517,6 +517,12 @@ void apply_chaos() {
princess::move(movei{cb, ca, JUMP}); princess::move(movei{cb, ca, JUMP});
if(isPrincess(cb) && !isPrincess(ca)) if(isPrincess(cb) && !isPrincess(ca))
princess::move(movei{ca, cb, JUMP}); 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() { bool pcmove::actual_move() {