or poisonous chunks.
Throw out all those special cases in food_colouring.txt and replace them with logic. I sure hope I got all special cases, but if not they should be easy enough to add. The functions are currently all in food.cc but they could easily be moved over to clua.cc and adapted accordingly if needed.
New prefix shortcuts:
(I also added one-liners to the descriptions of chunks of those types.)
The changes apply to all menu types, but they don't handle messages. This is problematic in that you'd have to check the pickup menu to see which corpses are worth butchering, but I'm still against keeping all those manual checks for (currently) poisonous/mutagenic/… corpses, esp. as information like this can date quickly. Instead the butchering interface should be improved to somehow handle that, possibly by overriding the prompt colour with the specified colour if necessary. I don't think there are any other cases where this is important.
Also add a prefix for equipped items and artefacts, so they can be easily checked for as well. I really think the identified/unidentified prefix should become default (and the option removed) - this allows for easy differentiation between identified and non-identified artefacts. The "known" prefix (for known wand charges or enchantments) is a bit less interesting but wouldn't hurt any (I think).
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5373 c06c8d41-db1a-0410-9941-cceddc491573
NGW2XPEX2XRK3CYC37DNUZSSB5IQLECMKRB6NX257I2X3G35LMPAC XOQFNR5MS23SVNJNSFJWH7LGL5JWI6MZK3SYETKW6CPRHJVB4FRQC 4SAYTYAEYZY4Q4JMCHC6Q3KRO65C6O3M26QI5SLNZN2SD3AQPQQAC JI33MPZAQQV55WDCZE4IHGMZYRYWIYU5MSYKYZB7RX2AWWY2SMCQC WN3ZHNL4T7QMQC6JF5DJR6NHLZVOGQVO4OJNEKEM5FZKQ7AVOP4AC RQR4PTMGQLTRWLYRU3KXIIDGND7FBORESJWMWFVD3WYU5SISZXAAC TDAVD56MGLFSMJLPLSYLEVW7MBRMT7V5BNII4TRWVDIHH47CD2OAC GTG5BFLJ5GBLJEEWK6AVZSCL5SQ4VSUW6IWEMZM7PAAT7KTSJQ5QC BRNMISYGZGT3XGXA2VCDTPDDROEWX6O23VNEPWMHYVEQEKUVVWOQC KFULGQQOHWUTXOM3BXCCYPGGVGGY4Z6265XUFRCBPNLTZAEHJZSQC K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC SDLKLUNFGVKDS55DDJZCBAVIB7NL3RRYPTACAY65SCUQKV6APFSAC LFBNFE3PZBXTR2ROPKYPARUWLJAYWAKGTS7VBWADZWVVSJ5CLX6AC ID2OZJTHFXL74RVUCS3JCMDQEUHAXCQFZU7235VU6IEVAAUWD2FAC 2B4AQJIATJ4E7RFN6OTQITZNDBAPQ2VWWXLBCVYSORAFG2GIIDNQC 77H4BWWPPGLM3PLZH4QTAJRXIZTSDVNCOKZE223I437FN2UJ34RQC O6ZMFKDI3XO2SWPNEYHIPYFDWJR4TVDP5BAATK6LVCVETQID6E7AC RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC U6OTXM3JN7SGPVIGQ5F6NR2I7J5V7KOWFQ7AVNNRQQDNLBEDMYFQC 3D6NWJ44UYHLZMD3BOQIWXJUEGITAVCHK6Z2WWDQONVQC4HSBRXQC VCG3BRIYRTNNWYC3LOXD6KFGXOX37HAFW2HNV7WXVG2V7EUHLDZQC L3DRKFURVDCV3EJKGG6GVVQX3D5MZPICTVOKNOD3LGM2PECBA7PQC 5RK245FAGZFCDDYG4AZAXSC7JPVIJG4DSAVAKHWWVBUNGICHYNJQC 2PAHDAPDO6PN4FNGB5N7CQNEGHSE3NOGPXYZMIAOJC4VW34FRVOAC CWTKS62IFZYYR3HGPDP5LW5C53CRWVAD6AAEOV4BSWNW52BCQH3QC JCWJWGMQIKQGSSFJUQRKNIWW3HBOJSHYDTOPPE5BWOJTIJTDYUTAC 7BBEAPSUBQMBK4XC2Q6YJ2JPSVSPCSBJUYXM6EWXHNTQG4AEJX3QC XRZPPYWPWUOM4SFNI6BHKH2UKJQNLKOV6Y7XIEPEZXE5QYRT26PAC str += item_class_name(item.base_type, true) + " ";
case OBJ_FOOD:if (!can_ingest(item.base_type, item.sub_type, true, true, false)|| food_is_rotten(item)&& !player_mutation_level(MUT_SAPROVOROUS)){prefixes.push_back("inedible");}else if (is_preferred_food(item))prefixes.push_back("preferred");// intentional fall-throughcase OBJ_CORPSES:if (is_poisonous(item) && !player_res_poison())prefixes.push_back("poisonous");else if (is_mutagenic(item))prefixes.push_back("mutagenic");else if (is_contaminated(item))prefixes.push_back("contaminated");else if (causes_rot(item))prefixes.push_back("rot-inducing");break;case OBJ_WEAPONS:case OBJ_ARMOUR:case OBJ_JEWELLERY:if (item_is_equipped(item))prefixes.push_back("equipped");if (is_artefact(item))prefixes.push_back("artefact");default:break;
/*static std::string _get_item_prefix(const item_def &item){std::vector<std::string> prefixes;switch (item.base_type){case OBJ_FOOD:if (!can_ingest(item.base_type, item.sub_type, true, true, false))prefixes.push_back("inedible");// intentional fall-throughcase OBJ_CORPSES:if (is_poisonous(item) && !player_res_poison())prefixes.push_back("poisonous");if (is_mutagenic(item))prefixes.push_back("mutagenic");
if (is_snack(item))prefixes.push_back("snack");break;case OBJ_WEAPONS:case OBJ_ARMOUR:case OBJ_JEWELLERY:if (item_is_equipped(item))prefixes.push_back("equipped");if (is_artefact(item))prefixes.push_back("artefact");default:break;}return comma_separated_line(prefixes.begin(), prefixes.end(),",", ",");}*/
}bool is_poisonous(const item_def &food){if (food.base_type != OBJ_FOOD && food.base_type != OBJ_CORPSES)return (false);return (mons_corpse_effect(food.plus) == CE_POISONOUS);}bool is_mutagenic(const item_def &food){if (food.base_type != OBJ_FOOD || food.base_type != OBJ_CORPSES)return (false);return (mons_corpse_effect(food.plus) == CE_MUTAGEN_RANDOM);}bool is_contaminated(const item_def &food){if (food.base_type != OBJ_FOOD || food.base_type != OBJ_CORPSES)return (false);return (mons_corpse_effect(food.plus) == CE_CONTAMINATED);
bool causes_rot(const item_def &food){if (food.base_type != OBJ_FOOD || food.sub_type != FOOD_CHUNK)return (false);return (mons_corpse_effect(food.plus) == CE_HCL);}// Returns 1 for herbivores, -1 for carnivores and 0 for either.static int _player_likes_food_type(int food_type){switch (food_type){case FOOD_BREAD_RATION:case FOOD_PEAR:case FOOD_APPLE:case FOOD_CHOKO:case FOOD_SNOZZCUMBER:case FOOD_PIZZA:case FOOD_APRICOT:case FOOD_ORANGE:case FOOD_BANANA:case FOOD_STRAWBERRY:case FOOD_RAMBUTAN:case FOOD_LEMON:case FOOD_GRAPE:case FOOD_SULTANA:case FOOD_LYCHEE:case FOOD_CHEESE:return 1;case FOOD_CHUNK:case FOOD_MEAT_RATION:case FOOD_SAUSAGE:return -1;}// Anything missing?return 0;}// As we want to avoid autocolouring the entire food selection, this should// be restricted to the absolute highlights, even though other stuff may// still be edible or even delicious.bool is_preferred_food(const item_def &food){if (food.base_type != OBJ_FOOD)return (false);// Honeycombs are tasty for everyone.if (food.sub_type == FOOD_HONEYCOMB || food.sub_type == FOOD_ROYAL_JELLY)return (true);// Ghouls specifically like rotten food.if (you.species == SP_GHOUL)return (food_is_rotten(food));if (player_mutation_level(MUT_CARNIVOROUS) == 3)return (_player_likes_food_type(food.sub_type) < 0);if (player_mutation_level(MUT_HERBIVOROUS) == 3)return (_player_likes_food_type(food.sub_type) > 0);// No food preference.return (false);}
case FOOD_BREAD_RATION:case FOOD_PEAR:case FOOD_APPLE:case FOOD_CHOKO:case FOOD_SNOZZCUMBER:case FOOD_PIZZA:case FOOD_APRICOT:case FOOD_ORANGE:case FOOD_BANANA:case FOOD_STRAWBERRY:case FOOD_RAMBUTAN:case FOOD_LEMON:case FOOD_GRAPE:case FOOD_SULTANA:case FOOD_LYCHEE:case FOOD_CHEESE:
switch (mons_corpse_effect(item.plus)){case CE_POISONOUS:description << "$$This meat is poisonous.";break;case CE_MUTAGEN_RANDOM:if (you.species != SP_GHOUL){description << "$$Eating this meat will cause random ""mutations.";}break;case CE_HCL:if (you.species != SP_GHOUL)description << "$$Eating this meat will cause rotting.";break;case CE_CONTAMINATED:if (player_mutation_level(MUT_SAPROVOROUS) < 3){description << "$$Chunks like this may occasionally cause ""sickness.";}break;default:break;}
# Unidentified weapon artefacts#menu = magenta:.*weapon.* ((brightly|faintly) glowing|smoking|twisted)menu = magenta:.*weapon.* (bloodstained|shimmering|warped|crystal)menu = magenta:.*weapon.* (jewelled|transparent|encrusted|pitted|slimy)menu = magenta:.*weapon.* (polished|fine|crude|ancient|ichor-stained)menu = magenta:.*weapon.* (steaming|shiny|polka-dotted)menu = magenta:.*weapon.* (golden|purple|bone|serpentine|ruby|chunky)menu = magenta:.*weapon.* (thin|green|ivory|ephemeral|blackened)menu = magenta:.*weapon.* (sapphire|rusty|blue|brutal|adamantine|ebony)menu = magenta:.*weapon.* (mangy|mithril|black|very long|steel|tiny)menu = magenta:.*weapon.* flaming crossbow
# If Options.menu_colour_prefix_id is set to true, you can# differentiate further.#menu = white:.*identified.*artefact.*#menu = magenta:.*unidentified.*artefact.*
# Unidentified armour artefacts#menu = lightgrey:.*armour.* jewelled helm(et)?menu = magenta:.*armour.* ((brightly|faintly) glowing|smoking|twisted)menu = magenta:.*armour.* (bloodstained|shimmering|warped|heavily runed)menu = magenta:.*armour.* (jewelled|transparent|encrusted|pitted|slimy)menu = magenta:.*armour.* (polished|fine|crude|ancient|ichor-stained)menu = magenta:.*armour.* (steaming|distressingly furry|plaid|tie-dyed)menu = magenta:.*armour.* (dull|golden|silk|tattered|round|bronze)menu = magenta:.*armour.* (fabulously|vibrating|soft|smelly|red|thick)menu = magenta:.*armour.* (weird-looking|blue|black|dirty|paisley)menu = magenta:.*armour.* (chartreuse)# Unidentified jewellery artefacts#menu = magenta:.*jewellery.* ((brightly|faintly) glowing|smoking)menu = magenta:.*jewellery.* (shimmering|warped|crystal|diamond)menu = magenta:.*jewellery.* (transparent|pitted|slimy|polished|fine)menu = magenta:.*jewellery.* (crude|ancient|steaming|scintillating)menu = magenta:.*jewellery.* (sparkling|flickering|glittering)menu = magenta:.*jewellery.* (black |blood-stained|cast-iron)menu = magenta:.*jewellery.* (phosphorescent)menu = magenta:.*jewellery.* an (encrusted|emerald) (ring|amulet)menu = magenta:.*jewellery.* a (runed|twisted|shiny|ruby) (ring|amulet)menu = magenta:.*jewellery.* a (sapphire) ringmenu = magenta:.*jewellery.* a (jade) amulet
: if you.race() == "Spriggan" thenmsg = darkgrey:.*corpsemsg = darkgrey:.*chunkinv = darkgrey:.*chunks? ofinv = darkgrey:.*corpseinv = yellow:.*food.*(bread ration|snozzcumber|slice of pizza)inv = yellow:.*food.*(orange|banana|lemon|pear|apple|apricot|choko)inv = yellow:.*food.*(rambutan|lychee|strawberry|grape|sultana): end
# Mummies don't care for food at all.#: if you.race() == "Mummy" thenmsg = darkgrey:.*corpsemsg = darkgrey:.*chunkinv = darkgrey:.*food.*: end# Rotten chunks eaters: Ghouls, Ogres, Kobolds, Trolls, Hill Orcs#: if you.race() == "Ghoul" thenmsg = yellow:rot.*chunks? ofmsg = yellow:rot.*corpseinv = yellow:.*rot.*chunks? of< elseif you.race() == "Ogre" oryou.race() == "Kobold" oryou.race() == "Troll" oryou.race() == "Hill Orc" then ># color rotten chunks as normal chunks: elsemsg = lightred:rot.*chunks? ofmsg = lightred:rot.*corpseinv = lightred:.*rot.*chunks? ofinv = lightred:.*rot.*corpseautopickup_exceptions = >rot.*chunks? of: end
msg = darkgrey:.*inedible.*inv = darkgrey:.*inedible.*
# Kobolds don't want fruits but meat.#: if you.race() == "Kobold" theninv = darkgrey:.*food.*(bread ration|snozzcumber|slice of pizza)inv = darkgrey:.*food.*(orange|banana|lemon|pear|apple|apricot)inv = darkgrey:.*food.*(rambutan|lychee|strawberry|grape|sultana)inv = yellow:.*chunks? of: end
msg = yellow:.*preferred.*inv = yellow:.*preferred.*
# Undead corpses/chunks#msg = lightred:chunks? of.*(ghoul|necrophage|death drake)msg = lightred:(ghoul | necrophage|death drake).*corpseinv = lightred:.*chunks? of.*(ghoul|necrophage|death drake)
# Corpses of undead (necrophages etc.)msg = lightred:.*rot-inducing.*inv = lightred:.*rot-inducing.*
#msg = magenta:chunks? of.*(draining|orange brain|great orb)msg = magenta:chunks? of.*(guardian naga|shapeshifter|very ugly)msg = magenta:(draining|orange brain|great orb).*corpsemsg = magenta:(guardian naga|shapeshifter|very ugly).*corpseinv = magenta:.*chunks? of.*(draining|orange brain|great orb)inv = magenta:.*chunks? of.*(guardian naga|shapeshifter|very ugly)
msg = magenta:.*mutagenic.*inv = magenta:.*mutagenic.*
#msg = lightgreen:chunks? of.*(ant larva|kobold|beetle)msg = lightgreen:chunks? of.*(brain worm|green draconian)msg = lightgreen:chunks? of.*((black|brown|yellow) snake)msg = lightgreen:chunks? of.*(bee|death yak|slug|amoeba)msg = lightgreen:chunks? of.*(centipede|mite|snail|gila|hydra)msg = lightgreen:chunks? of.*(iron troll|naga|queen|wasp)msg = lightgreen:chunks? of.*(redback|(golden|mottled) dragon)msg = lightgreen:chunks? of.*((orange|green) rat)msg = lightgreen:chunks? of.*(scorpion|soldier ant|spiny|spider)msg = lightgreen:(ant larva|kobold|beetle).*corpsemsg = lightgreen:(brain worm|green draconian).*corpsemsg = lightgreen:((black|brown|yellow) snake).*corpsemsg = lightgreen:(bee|death yak|slug|amoeba).*corpsemsg = lightgreen:(centipede|mite|snail|gila|hydra).*corpsemsg = lightgreen:(iron troll|naga|queen|wasp).*corpsemsg = lightgreen:(redback|(golden|mottled) dragon).*corpsemsg = lightgreen:((orange|green) rat).*corpsemsg = lightgreen:(scorpion|soldier ant|spiny|spider).*corpseinv = lightgreen:.*chunks? of.*(ant larva|kobold|beetle)inv = lightgreen:.*chunks? of.*(brain worm|green draconian)inv = lightgreen:.*chunks? of.*((black|brown|yellow) snake)inv = lightgreen:.*chunks? of.*(bee|death yak|slug|amoeba)inv = lightgreen:.*chunks? of.*(centipede|mite|snail|gila|hydra)inv = lightgreen:.*chunks? of.*(iron troll|naga|queen|wasp)inv = lightgreen:.*chunks? of.*(redback|(golden|mottled) dragon)inv = lightgreen:.*chunks? of.*((orange|green) rat)inv = lightgreen:.*chunks? of.*(scorpion|soldier ant|spiny|spider)
msg = lightgreen:.*poisonous.*inv = lightgreen:.*poisonous.*
#msg = brown:chunks? of.*(elf|human|drake|blowfly|cockroach)msg = brown:chunks? of.*((fire|hill|frost|stone) giant)msg = brown:chunks? of.*(mosquito|gnoll|goblin|jackal)msg = brown:chunks? of.*(manticore|minotaur|ogre|orc)msg = brown:chunks? of.*(war dog|warg|((rock|deep) )?troll)msg = brown:chunks? of.*(grey rat|ugly thing|draconian)msg = brown:chunks? of.*((quicksilver|iron|swamp|komodo) dragon)msg = brown:chunks? of.*(mer(folk|maid))msg = brown:(elf|human|drake|blowfly|cockroach).*corpsemsg = brown:((fire|hill|frost|stone) giant).*corpsemsg = brown:(mosquito|gnoll|goblin|jackal).*corpsemsg = brown:(manticore|minotaur|ogre|orc).*corpsemsg = brown:(war dog|warg|((rock|deep) )?troll).*corpsemsg = brown:(grey rat|ugly thing|draconian).*corpsemsg = brown:((quicksilver|iron|swamp|komodo) dragon).*corpsemsg = brown:(mer(folk|maid)).*corpseinv = brown:.*chunks? of.*(elf|human|drake|blowfly|cockroach)inv = brown:.*chunks? of.*((fire|hill|frost|stone) giant)inv = brown:.*chunks? of.*(mosquito|gnoll|goblin|jackal)inv = brown:.*chunks? of.*(manticore|minotaur|ogre|orc)inv = brown:.*chunks? of.*(war dog|warg|((rock|deep) )?troll)inv = brown:.*chunks? of.*(grey rat|ugly thing|draconian)inv = brown:.*chunks? of.*((quicksilver|iron|swamp|komodo) dragon)inv = brown:.*chunks? of.*(mer(folk|maid))
msg = brown:.*contaminated.*inv = brown:.*contaminated.*