git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5578 c06c8d41-db1a-0410-9941-cceddc491573
BH2RBXQLAMSL2UYMSB7XGDEDO3WZRTJXKMFKDMYCPKEXNBX3YDXAC 7KBQYZSNXBMQGEEOAZI6YU34XZ5ECFGTJA32QIJDZP2NYS3SF3IQC K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC 4HHCHQD26LSGYC5TSQV25D2KIWLRJDB4BJQHJPSIB3MWNSSE4TGAC RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC NFJKJYTT6CBLOKLGT6HIVIDEPWXMGXJV5AAL37SBZTG2HSFMJMKQC 3XL4DKV7PSWAU3ZBJSKZFJ2VUYABC47I7KKWGIRCJYXULQD453MQC SJXOZ6J66G3S5VYGIZ3YHEUCKUF5554YEFUYLVBH7X4ALYSXKTGQC OGQWGPC24OQCKTCZAXGLRF4TLX3AV63Z4QODPPY5MHKX3ICMUHLQC BSAKBTGIAD3JFZPNLMEI6SOJ2XPT4EJNETZYBW2555ASJTZ2GEGQC HX6674PUYEPMQYI5X22KBCXKS3R4QLW6CM4ATX4WI2C32W722JXAC BTQKRO24R3D6REBOCQYCWQHWXILNTH4WD4RFWTXWXMCC3H7PHDZAC GPEJOT73KMACP33IPAKFR5ROGHCOIP22VXZMQNYTGLEA2OSZUM2AC C7EEMEI6FU6L2VWZBTDCZO5ZTB2N5TCNGSMIBZTN6NZRE7BUBFPQC IE3INS4WUXZOBVXB5VWRBYPVPXADD2U2W5H3TBTOYNWJ3EGRSGQQC N3NXT75G2JYKVON7ZTE3TG34BBWITCL2HHVQ6H7QREYCDTVQFSGAC //jmf: beefed up higher-level casting of this (formerly lame) spellvoid summon_small_mammals(int pow){monster_type mon = MONS_PROGRAM_BUG; // error trapping{dlb}int pow_spent = 0;int pow_left = pow + 1;int summoned = 0;int summoned_max = pow / 16;if (summoned_max > 5)summoned_max = 5;if (summoned_max < 1)summoned_max = 1;while (pow_left > 0 && summoned < summoned_max){summoned++;pow_spent = 1 + random2(pow_left);pow_left -= pow_spent;
switch (pow_spent){case 75: case 74: case 38:// If you worship a good god, don't summon an evil small// mammal.// XXX: There should be a better way to do this, using// player_angers_monster().if (!is_good_god(you.religion)){mon = MONS_ORANGE_RAT;break;}case 65: case 64: case 63: case 27: case 26: case 25:mon = MONS_GREEN_RAT;break;case 57: case 56: case 55: case 54: case 53: case 52:case 20: case 18: case 16: case 14: case 12: case 10:mon = coinflip() ? MONS_QUOKKA : MONS_GREY_RAT;break;default:mon = coinflip() ? MONS_GIANT_BAT : MONS_RAT;break;}create_monster(mgen_data(mon, BEH_FRIENDLY, 3,you.pos(), you.pet_target));}}
//jmf: beefed up higher-level casting of this (formerly lame) spellbool cast_summon_small_mammals(int pow, bool god_gift){bool success = false;monster_type mon = MONS_PROGRAM_BUG;int pow_spent = 0;int pow_left = pow + 1;int count = 0;int count_max = std::max(1, std::min(5, pow / 16));while (pow_left > 0 && count < count_max){count++;pow_spent = random2(pow_left) + 1;pow_left -= pow_spent;switch (pow_spent){case 75: case 74: case 38:// If you worship a good god, don't summon an evil small// mammal.// XXX: There should be a better way to do this, using// player_angers_monster().if (!is_good_god(you.religion)){mon = MONS_ORANGE_RAT;break;}case 65: case 64: case 63: case 27: case 26: case 25:mon = MONS_GREEN_RAT;break;case 57: case 56: case 55: case 54: case 53: case 52:case 20: case 18: case 16: case 14: case 12: case 10:mon = coinflip() ? MONS_QUOKKA : MONS_GREY_RAT;break;default:mon = coinflip() ? MONS_GIANT_BAT : MONS_RAT;break;}if (create_monster(mgen_data(mon, BEH_FRIENDLY, 3,you.pos(), you.pet_target,god_gift ? MF_GOD_GIFT : 0)) != -1){success = true;if (success)mpr("A small mammal appears!");}}return (success);}