Orb of the Morph implemented

This commit is contained in:
Zeno Rogue 2017-10-10 14:18:11 +02:00
parent f8b47115ae
commit 4a60fa52c8
1 changed files with 33 additions and 0 deletions

View File

@ -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);