* Polymorph some of the stuff in this pile into a monster, preferably * a golem of the kind okind. */
| 1543 | * a golem of the kind okind. |
| 1544 | */ |
| 1545 | staticfn void |
| 1546 | create_polymon(struct obj *obj, int okind) |
| 1547 | { |
| 1548 | struct permonst *mdat = (struct permonst *) 0; |
| 1549 | struct monst *mtmp; |
| 1550 | const char *material; |
| 1551 | int pm_index; |
| 1552 | |
| 1553 | if (svc.context.bypasses) { |
| 1554 | /* this is approximate because the "no golems" !obj->nexthere |
| 1555 | check below doesn't understand bypassed objects; but it |
| 1556 | should suffice since bypassed objects always end up as a |
| 1557 | consecutive group at the top of their pile */ |
| 1558 | while (obj && obj->bypass) |
| 1559 | obj = obj->nexthere; |
| 1560 | } |
| 1561 | |
| 1562 | /* no golems if you zap only one object -- not enough stuff */ |
| 1563 | if (!obj || (!obj->nexthere && obj->quan == 1L)) |
| 1564 | return; |
| 1565 | |
| 1566 | /* some of these choices are arbitrary */ |
| 1567 | switch (okind) { |
| 1568 | case IRON: |
| 1569 | case METAL: |
| 1570 | case MITHRIL: |
| 1571 | pm_index = PM_IRON_GOLEM; |
| 1572 | material = "metal "; |
| 1573 | break; |
| 1574 | case COPPER: |
| 1575 | case SILVER: |
| 1576 | case PLATINUM: |
| 1577 | case GEMSTONE: |
| 1578 | case MINERAL: |
| 1579 | pm_index = rn2(2) ? PM_STONE_GOLEM : PM_CLAY_GOLEM; |
| 1580 | material = "lithic "; |
| 1581 | break; |
| 1582 | case 0: |
| 1583 | case FLESH: |
| 1584 | /* there is no flesh type, but all food is type 0, so we use it */ |
| 1585 | pm_index = PM_FLESH_GOLEM; |
| 1586 | material = "organic "; |
| 1587 | break; |
| 1588 | case WOOD: |
| 1589 | pm_index = PM_WOOD_GOLEM; |
| 1590 | material = "wood "; |
| 1591 | break; |
| 1592 | case LEATHER: |
| 1593 | pm_index = PM_LEATHER_GOLEM; |
| 1594 | material = "leather "; |
| 1595 | break; |
| 1596 | case CLOTH: |
| 1597 | pm_index = PM_ROPE_GOLEM; |
| 1598 | material = "cloth "; |
| 1599 | break; |
| 1600 | case BONE: |
| 1601 | pm_index = PM_SKELETON; /* nearest thing to "bone golem" */ |
| 1602 | material = "bony "; |