| 158 | } |
| 159 | |
| 160 | staticfn void |
| 161 | m_initweap(struct monst *mtmp) |
| 162 | { |
| 163 | struct permonst *ptr = mtmp->data; |
| 164 | int mm = monsndx(ptr); |
| 165 | struct obj *otmp; |
| 166 | int bias, w1, w2; |
| 167 | |
| 168 | if (Is_rogue_level(&u.uz)) |
| 169 | return; |
| 170 | /* |
| 171 | * First a few special cases: |
| 172 | * giants get a boulder to throw sometimes |
| 173 | * ettins get clubs |
| 174 | * kobolds get darts to throw |
| 175 | * centaurs get some sort of bow & arrows or bolts |
| 176 | * soldiers get all sorts of things |
| 177 | * kops get clubs & cream pies. |
| 178 | */ |
| 179 | switch (ptr->mlet) { |
| 180 | case S_GIANT: |
| 181 | if (rn2(2)) |
| 182 | (void) mongets(mtmp, (mm != PM_ETTIN) ? BOULDER : CLUB); |
| 183 | if ((mm != PM_ETTIN) && !rn2(5)) |
| 184 | (void) mongets(mtmp, rn2(2) ? TWO_HANDED_SWORD : BATTLE_AXE); |
| 185 | break; |
| 186 | case S_HUMAN: |
| 187 | if (is_mercenary(ptr)) { |
| 188 | w1 = w2 = 0; |
| 189 | switch (mm) { |
| 190 | case PM_WATCHMAN: |
| 191 | case PM_SOLDIER: |
| 192 | if (!rn2(3)) { |
| 193 | /* lance and dwarvish mattock used to be in midst of |
| 194 | the polearms but use different skills from polearms |
| 195 | and aren't appropriates choices for human soldiers */ |
| 196 | do { |
| 197 | w1 = rn1(BEC_DE_CORBIN - PARTISAN + 1, PARTISAN); |
| 198 | } while (objects[w1].oc_skill != P_POLEARMS); |
| 199 | w2 = rn2(2) ? DAGGER : KNIFE; |
| 200 | } else |
| 201 | w1 = rn2(2) ? SPEAR : SHORT_SWORD; |
| 202 | break; |
| 203 | case PM_SERGEANT: |
| 204 | w1 = rn2(2) ? FLAIL : MACE; |
| 205 | break; |
| 206 | case PM_LIEUTENANT: |
| 207 | w1 = rn2(2) ? BROADSWORD : LONG_SWORD; |
| 208 | break; |
| 209 | case PM_CAPTAIN: |
| 210 | case PM_WATCH_CAPTAIN: |
| 211 | w1 = rn2(2) ? LONG_SWORD : SILVER_SABER; |
| 212 | break; |
| 213 | default: |
| 214 | if (!rn2(4)) |
| 215 | w1 = DAGGER; |
| 216 | if (!rn2(7)) |
| 217 | w2 = SPEAR; |
no test coverage detected