From c6369ac832d4634121294021f6b9555b1f8041bf Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Fri, 17 Jun 2022 10:40:26 +0200 Subject: [PATCH] Orb of the Sword can now kill yourself through mirror or topology --- attack.cpp | 6 +++++- checkmove.cpp | 4 ++++ pcmove.cpp | 3 +++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/attack.cpp b/attack.cpp index dc016a39..c768afe9 100644 --- a/attack.cpp +++ b/attack.cpp @@ -1202,6 +1202,8 @@ EX void killHardcorePlayer(int id, flagtype flags) { } } +EX bool suicidal; + EX void killThePlayer(eMonster m, int id, flagtype flags) { if(markOrb(itOrbShield)) return; if(shmup::on) { @@ -1231,6 +1233,7 @@ EX void killThePlayer(eMonster m, int id, flagtype flags) { else { // printf("confused!\n"); addMessage(XLAT("%The1 is confused!", m)); + changes.value_set(suicidal, true); } } @@ -1283,7 +1286,8 @@ EX void stabbingAttack(movei mi, eMonster who, int bonuskill IS(0)) { bool stabthere = false, away = true; if(logical_adjacent(mt, who, c)) stabthere = true, away = false; - + if(inmirror(c)) c = mirror::reflect(c).at; + if(stabthere && c->wall == waExplosiveBarrel && markOrb(itOrbThorns)) explodeBarrel(c); diff --git a/checkmove.cpp b/checkmove.cpp index 949bcddc..6843b619 100644 --- a/checkmove.cpp +++ b/checkmove.cpp @@ -241,6 +241,10 @@ EX bool monstersnear_aux() { /** like monstersnear but add the potential moves of other players into account */ EX bool monstersnear_add_pmi(player_move_info pmi0) { + if(suicidal) { + who_kills_me = moPlayer; + return true; + } pmi.push_back(pmi0); bool b = monstersnear_aux(); pmi.pop_back(); diff --git a/pcmove.cpp b/pcmove.cpp index e715bbd5..cda590a3 100644 --- a/pcmove.cpp +++ b/pcmove.cpp @@ -248,6 +248,7 @@ bool pcmove::movepcto() { mip.t = NULL; switchplaces = false; warning_shown = false; + suicidal = false; if(d == MD_USE_ORB) return targetRangedOrb(multi::whereto[multi::cpid].tgt, roMultiGo); @@ -1495,6 +1496,8 @@ EX bool swordAttack(cell *mt, eMonster who, cell *c, int bb) { } if(c->wall == waExplosiveBarrel) explodeBarrel(c); + if(!peace::on && isPlayerOn(c) && whichPlayerOn(c) != multi::cpid && !markOrb(itOrbEmpathy)) killThePlayer(moPlayer, whichPlayerOn(mt), 0); + if(!peace::on && mt == c && !markOrb(itOrbEmpathy)) killThePlayer(moPlayer, multi::cpid, 0); if(!peace::on && canAttack(mt, who, c, m, AF_SWORD)) { changes.ccell(c); markOrb(bb ? itOrbSword2: itOrbSword);