mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-24 01:00:25 +00:00
dice:: Orb of Chaos works correctly now
This commit is contained in:
parent
e6dd27f5bf
commit
b9ba311a63
19
complex2.cpp
19
complex2.cpp
@ -1402,6 +1402,25 @@ EX namespace dice {
|
||||
}
|
||||
}
|
||||
|
||||
EX bool swap_forbidden(cell *ca, cell *cb) {
|
||||
if(!on(ca)) return false;
|
||||
return cb->type % data[ca].which->facesides;
|
||||
}
|
||||
|
||||
EX void chaos_swap(cellwalker wa, cellwalker wb) {
|
||||
swap_data(data, wa.at, wb.at);
|
||||
if(on(wa.at)) {
|
||||
auto& d = data[wa.at];
|
||||
d.dir = chaos_mirror_dir(d.dir, wb, wa);
|
||||
d.mirrored = !d.mirrored;
|
||||
}
|
||||
if(on(wb.at)) {
|
||||
auto& d = data[wb.at];
|
||||
d.dir = chaos_mirror_dir(d.dir, wa, wb);
|
||||
d.mirrored = !d.mirrored;
|
||||
}
|
||||
}
|
||||
|
||||
int hook = addHook(hooks_clearmemory, 0, [] () { data.clear(); });
|
||||
EX }
|
||||
|
||||
|
@ -564,6 +564,8 @@ void apply_chaos() {
|
||||
auto wb = cwt-1+wstep;
|
||||
cell *ca = wa.at;
|
||||
cell *cb = wb.at;
|
||||
if(dice::swap_forbidden(ca, cb)) return;
|
||||
if(dice::swap_forbidden(cb, ca)) return;
|
||||
if(!items[itOrbChaos] || chaos_forbidden(ca) || chaos_forbidden(cb)) return;
|
||||
if(ca && is_paired(ca->monst)) killMonster(ca, moPlayer);
|
||||
if(cb && is_paired(cb->monst)) killMonster(cb, moPlayer);
|
||||
@ -596,6 +598,9 @@ void apply_chaos() {
|
||||
if(ca->monst == moTortoise || cb->monst == moTortoise) {
|
||||
tortoise::move_adult(ca, cb);
|
||||
}
|
||||
if(dice::on(ca) || dice::on(cb)) {
|
||||
dice::chaos_swap(wa, wb);
|
||||
}
|
||||
if(ca->item == itBabyTortoise || cb->item == itBabyTortoise) {
|
||||
tortoise::move_baby(ca, cb);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user