* type == 0 to 9 : you zapping a wand * type == 10 to 19 : you casting a spell * type == 20 to 29 : you breathing as a monster * type == -10 to -19 : monster casting spell * type == -20 to -29 : monster breathing at you * type == -30 to -39 : monster zapping a wand * called with dx = dy = 0 for vertical bolts */
| 4777 | * called with dx = dy = 0 for vertical bolts |
| 4778 | */ |
| 4779 | void |
| 4780 | dobuzz( |
| 4781 | int type, /* 0..29 (by hero) or -39..-10 (by monster) */ |
| 4782 | int nd, /* damage strength ('number of dice') */ |
| 4783 | coordxy sx, coordxy sy, /* starting point */ |
| 4784 | int dx, int dy, /* direction delta */ |
| 4785 | boolean sayhit, boolean saymiss, /* report out of sight hit/miss events */ |
| 4786 | boolean forcemiss) |
| 4787 | { |
| 4788 | int range, fltyp = zaptype(type), damgtype = fltyp % 10; |
| 4789 | coordxy lsx, lsy; |
| 4790 | struct monst *mon; |
| 4791 | coord save_bhitpos; |
| 4792 | boolean shopdamage = FALSE, |
| 4793 | fireball = (type == ZT_SPELL(ZT_FIRE)), /* set once */ |
| 4794 | gas_hit = FALSE; /* will be set during each iteration */ |
| 4795 | struct obj *otmp; |
| 4796 | int spell_type; |
| 4797 | int hdmgtype = Hallucination ? rn2(6) : damgtype; |
| 4798 | |
| 4799 | /* if it's a hero spell then get its SPE_TYPE */ |
| 4800 | spell_type = is_hero_spell(type) ? SPE_MAGIC_MISSILE + damgtype : 0; |
| 4801 | |
| 4802 | if (u.uswallow) { |
| 4803 | int tmp; |
| 4804 | |
| 4805 | if (type < 0) |
| 4806 | return; |
| 4807 | tmp = zhitm(u.ustuck, type, nd, &otmp); |
| 4808 | if (!u.ustuck) { |
| 4809 | u.uswallow = 0; |
| 4810 | } else { |
| 4811 | pline("%s rips into %s%s", The(flash_str(fltyp, FALSE)), |
| 4812 | mon_nam(u.ustuck), exclam(tmp)); |
| 4813 | /* Using disintegration from the inside only makes a hole... */ |
| 4814 | if (tmp == MAGIC_COOKIE) |
| 4815 | u.ustuck->mhp = 0; |
| 4816 | if (DEADMONSTER(u.ustuck)) |
| 4817 | killed(u.ustuck); |
| 4818 | } |
| 4819 | return; |
| 4820 | } |
| 4821 | if (type < 0) |
| 4822 | newsym(u.ux, u.uy); |
| 4823 | range = rn1(7, 7); |
| 4824 | if (dx == 0 && dy == 0) |
| 4825 | range = 1; |
| 4826 | save_bhitpos = gb.bhitpos; |
| 4827 | |
| 4828 | tmp_at(DISP_BEAM, zapdir_to_glyph(dx, dy, hdmgtype)); |
| 4829 | while (range-- > 0) { |
| 4830 | lsx = sx; |
| 4831 | sx += dx; |
| 4832 | lsy = sy; |
| 4833 | sy += dy; |
| 4834 | if (!isok(sx, sy) || levl[sx][sy].typ == STONE) |
| 4835 | goto make_bounce; |
| 4836 |
no test coverage detected