From 4a60fa52c8675667eaf499c78702c3876673e6b3 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Tue, 10 Oct 2017 14:18:11 +0200 Subject: [PATCH] Orb of the Morph implemented --- orbs.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/orbs.cpp b/orbs.cpp index edcbdeb5..96208784 100644 --- a/orbs.cpp +++ b/orbs.cpp @@ -855,6 +855,33 @@ void stun_attack(cell *dest) { checkmoveO(); } +void poly_attack(cell *dest) { + playSound(dest, "orb-ranged"); + auto polymonsters = { + moYeti, moRunDog, moHunterDog, moRanger, + moDesertman, moMonkey, moZombie, moCultist, + moWitch, moEvilGolem, moFamiliar, moOrangeDog, + moRedFox, moFalsePrincess, moResearcher, + moNarciss, moJiangshi + }; + int ssf = 0; + eMonster target = *(polymonsters.begin() + hrand(size(polymonsters))); + for(eMonster m: polymonsters) + if(kills[m] && m != dest->monst) { + ssf += kills[m]; + if(hrand(ssf) < kills[m]) + target = m; + } + addMessage(XLAT("You polymorph %the1 into %the2!", dest->monst, target)); + dest->monst = target; + if(!dest->stuntime) dest->stuntime = 1; + checkStunKill(dest); + useupOrb(itOrbMorph, 2); + createNoise(3); + bfs(); + checkmoveO(); + } + void placeIllusion(cell *c) { c->monst = moIllusion; useupOrb(itOrbIllusion, 5); @@ -1116,6 +1143,12 @@ eItem targetRangedOrb(cell *c, orbAction a) { return itOrbStunning; } + // (5d) poly + if(items[itOrbMorph] && c->monst && !isMultitile(c->monst) && !shmup::on) { + if(!isCheck(a)) poly_attack(c); + return itOrbMorph; + } + // (6) place fire (non-shmup variant) if(!shmup::on && items[itOrbDragon] && makeflame(c, 20, true)) { if(!isCheck(a)) useOrbOfDragon(c);