secondary slots. (Okawaru still uses the old 50% armour, rest secondary chances.)
If mundane items are created, preferably replace subtype with an unfilled equipment slot. When trying this in wizard mode, this never came up, though: ~50 acquirements while naked and all were egos, with a few artefacts strewn in. I then ran some tests when enforcing non-egos, and this worked fine. (And yes, I did take the hack out again.)
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10496 c06c8d41-db1a-0410-9941-cceddc491573
HHHZGZT7QAERYSE26QGJPFAV6TQQXXECP6RTCLF6SZQ5L6GTXPWAC 5TQYGO7IXRZVWFDFLFKMZ4M3WJKR6GAPAZ4ZMGDZK32S3YL3DM2QC IVUKW5AV2TWRBSLWPRKCL256H3VQENHV3QXRV3NYSWMCRQSVJOMAC QNSFZBLVAN7BPYYRXUELHBZCLIQTYDATDIXF3YVH7LBBST66VUCQC OE3TD4J5FSIFAM37J2UPEV7QQNXLSZM6GDUMPI66LC5LW2OM2J4AC K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC 75M6AVUSS3G5EJECJJRB67V5UYDOIV26FZNB2FFCMBZ33EK7FVIQC KQNIGKATHT4YSPJFPJGIGPD6VNR5B753SE2JN2LCXZZJNHCGY3DQC 74LQ7JXVLAFSHLI7LCBKFX47CNTYSKGUQSXNX5FCIUIGCC2JTR3QC 2YLX45THVAG2ICWFAOANL3BQQBYMPQV36EY73TYCWA336RVW7KGQC SWT4O2TCOAQOVFA6WRA7MCU3KMTMJWFEMIHO64N4PWL5FNHDPADAC 2DORUQ4B574MDOOMRYWGU5I72AKHMCSTZ6B3VSHQBUQOZYHRC7FAC YBXZWBUWXXLLYKP5IHXU46AHJ4YO55NM5QE34I3DFB25NLPQXZPAC // Increasing the representation of the non-body armour// slots here to make up for the fact that there's only// one type of item for most of them. -- bwr//// NUM_ARMOURS is body armour and handled belowarmour_type result = (coinflip()) ? NUM_ARMOURS: _random_nonbody_armour_type();
armour_type result = arm;
static armour_type _acquirement_armour_subtype(bool okawaru){// Increasing the representation of the non-body armour// slots here to make up for the fact that there's only// one type of item for most of them. -- bwr//// NUM_ARMOURS is body armour and handled belowarmour_type result = NUM_ARMOURS;if (okawaru){if (coinflip())result = _random_nonbody_armour_type();}else{static const equipment_type armour_slots[] ={ EQ_SHIELD, EQ_CLOAK, EQ_HELMET, EQ_GLOVES, EQ_BOOTS };equipment_type picked = EQ_BODY_ARMOUR;const int num_slots = ARRAYSZ(armour_slots);// Start count at 1, for body armour (already picked).for (int i = 0, count = 1; i < num_slots; ++i)if (you_can_wear(armour_slots[i], true) && one_chance_in(++count))picked = armour_slots[i];switch (picked){case EQ_SHIELD:result = ARM_SHIELD; break;case EQ_CLOAK:result = ARM_CLOAK; break;case EQ_HELMET:result = ARM_HELMET; break;case EQ_GLOVES:result = ARM_GLOVES; break;case EQ_BOOTS:result = ARM_BOOTS; break;default:case EQ_BODY_ARMOUR:result = NUM_ARMOURS; break;}}result = _pick_wearable_armour(result);
// If armour acquirement turned up a non-ego non-artefact armour item,// see whether the player has any unfilled equipment slots. If so,// hand out a mundane (and possibly negatively enchanted) item of that// type. Otherwise, keep the original armour.static void _try_give_mundane_armour(item_def &arm){static const equipment_type armour_slots[] ={ EQ_SHIELD, EQ_CLOAK, EQ_HELMET, EQ_GLOVES, EQ_BOOTS };equipment_type picked = EQ_BODY_ARMOUR;const int num_slots = ARRAYSZ(armour_slots);for (int i = 0, count = 0; i < num_slots; ++i){if (!you_can_wear(armour_slots[i]))continue;if (you.equip[armour_slots[i]] != -1)continue;if (one_chance_in(++count))picked = armour_slots[i];}
// All available secondary slots already filled.if (picked == EQ_BODY_ARMOUR)return;armour_type result = NUM_ARMOURS;switch (picked){case EQ_SHIELD:result = ARM_SHIELD; break;case EQ_CLOAK:result = ARM_CLOAK; break;case EQ_HELMET:result = ARM_HELMET; break;case EQ_GLOVES:result = ARM_GLOVES; break;case EQ_BOOTS:result = ARM_BOOTS; break;default:return;}// Clear the description flag.set_equip_desc(arm, ISFLAG_NO_DESC);arm.sub_type = _pick_wearable_armour(result);arm.plus = random2(5) - 2;int max_ench = armour_max_enchant(arm);if (arm.plus > max_ench)arm.plus = max_ench;else if (arm.plus < -max_ench)arm.plus = -max_ench;}
// For mundane armour, try to change the subtype to something// matching a currently unfilled equipment slot.if (doodad.base_type == OBJ_ARMOUR && !is_artefact(doodad)&& get_armour_ego_type(doodad) == SPARM_NORMAL){_try_give_mundane_armour(doodad);if (agent == GOD_OKAWARU && doodad.plus < 0)doodad.plus = 0;}