bow:: rusalka curses now work

This commit is contained in:
Zeno Rogue 2024-02-22 18:11:12 +01:00
parent bcc026173e
commit 60980bcb8b
2 changed files with 14 additions and 5 deletions

View File

@ -369,6 +369,8 @@ EX bool fire_on_mouse(cell *c) {
return b;
}
EX int rusalka_curses = 0;
EX void shoot() {
flagtype attackflags = AF_BOW;
if(items[itOrbSpeed]&1) attackflags |= AF_FAST;
@ -382,6 +384,7 @@ EX void shoot() {
vector<pair<cell*, int>> healthy_dragons;
map<cell*, pair<int, int>> kraken_hits;
int dragon_hits = 0;
rusalka_curses++;
// for achievements
for(auto& mov: bowpath) {
@ -458,6 +461,8 @@ EX void shoot() {
if(m && attackMonster(c, attackflags | AF_MSG, who)) hit_anything = true;
if(m == moRusalka) rusalka_curses++;
if(!c->monst || isAnyIvy(m)) {
spread_plague(cf, c, movei(mov.prev).rev().d, moPlayer);
produceGhost(c, m, moPlayer);

View File

@ -309,6 +309,8 @@ bool pcmove::try_shooting(bool auto_target) {
nextmovetype = hit_anything ? lmAttack : lmSkip;
lastmovetype = hit_anything ? lmAttack : lmSkip; lastmove = NULL;
while(bow::rusalka_curses--) rusalka_curse();
mi = movei(cwt.at, STAY);
if(last_gravity_state && !gravity_state)
playerMoveEffects(mi);
@ -1101,6 +1103,12 @@ void pcmove::tell_why_impassable() {
}
}
EX void rusalka_curse() {
changes.ccell(cwt.at);
if(cwt.at->wall == waNone) cwt.at->wall = waShallow;
else if(cwt.at->wall == waShallow || isAlch(cwt.at->wall)) cwt.at->wall = waDeepWater;
}
bool pcmove::attack() {
auto& c2 = mi.t;
if(!fmsAttack) return false;
@ -1177,11 +1185,7 @@ bool pcmove::attack() {
changes.value_add(wandering_jiangshi, 1);
}
attackMonster(c2, attackflags | AF_MSG, moPlayer);
if(m == moRusalka) {
changes.ccell(cwt.at);
if(cwt.at->wall == waNone) cwt.at->wall = waShallow;
else if(cwt.at->wall == waShallow || isAlch(cwt.at->wall)) cwt.at->wall = waDeepWater;
}
if(m == moRusalka) rusalka_curse();
changes.ccell(c2);
// salamanders are stunned for longer time when pushed into a wall
if(c2->monst == moSalamander && (mip.t == c2 || !mip.t)) c2->stuntime = 10;