code as weapons of returning, but such ammunition has the same chance of being randomly destroyed when thrown as non-returning ammunition. Note that the brand is not actually generated anywhere yet.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3024 c06c8d41-db1a-0410-9941-cceddc491573
W74555HMPXUQ72AGKBXC5P3STMMX5DZAW6ZESUDLNVJBCAG43PLAC 5FECCMAC5QKG3SJ4ATZFE2QF7I3A4YKWKCU4XQEW2P2SWZ2J33YQC WFOFNKQC3EP2FX4YHYAB54B2JPN2KW6LCMFSX4KI6EK6YXNF4DXQC FN737JAMGSLK4L72SCIXBDS43OWI5H35Z226SS3OWQDNFQJVKIBQC IZ5YT2GANAFYBACERZYTFQE2H66NM4Y3K5ADYNYF2IUADY23HJ4QC WCNEIYQ3FFHSAY7SX6JHQWS47GZH4PW4T4MTA6QMODZLFLUBSO3QC K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC FA2V3G4NYTWJWUT7EWH75L3YOUX6YVOZ5LNRSFLO2XF273JKSUTAC SVY2PTCLXR3KNPQAWXVXTTGCC5DR334HOAKHYO3VDDRWM2BWMALAC RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC VNHFP63ZLLZU3A3PLXP4BITX57DUIYDHFOHQYK3BOBHV3S64G26QC HSRRNAU5UAYC6B6IQWGJPFROMZBTJICPCH6DJVZDHDTAGOQ6IOYAC SJP5BHX6MFWF3OSQPEF4WUWZWPUGMOVURTT2CUVT6H3A66LETXUAC EIHGPFT3BQM7I76T3MITHSNFMDNNBWLUGEVQHTXID6UJQHVRNSDAC VVEULZ7FMS53F6WZUJLNJ23URJMCCWHBUEDVGKI6R72JO2DLL5HQC GQL5SIGBHLU3FMCE54XVGLRY5AZHRM6DUEB722REA2DPLGJSN6EQC EFWEYIB2R3DPD3JWIPU6LS6SFLPMYN7J7X4GBZR7DJWKHJ3UELSAC 4UXFU3FZOCBSLDQ4S7MJKAE2H7VUHCNRDQMIY6NJ3PHYXWNGISDQC HQXDLVLTDTWKB5OY5DKOLMY6PFXL7HHWVRM5FIW4FOX3RBRQP44AC BRGAZR5AXWC2IALBVXO5SB354IRQEIRHSK55RZPGFI4AGIOD4LUQC EA42PHBFQFBGTUU6BV3H3AEUEOHFDHXNZQPDFZ555MEKNN5GHP7QC RI4M3GZHNE7IY2R7OBY2E56B2ULEMAEJTEHJBQ6A3WTELSV523RAC 5V47S4NNTHWTSAHV3YLO2VGH7JTUIYJ3GBPDN5ZM4UQALT2ZEXDQC 74LQ7JXVLAFSHLI7LCBKFX47CNTYSKGUQSXNX5FCIUIGCC2JTR3QC bool mons_thrown_object_destroyed( item_def *item, int x, int y,bool returning, int midx ){ASSERT( item != NULL );bool destroyed = ((item->base_type != OBJ_MISSILES ||item->sub_type != MI_THROWING_NET) && coinflip());bool hostile_grid = grid_destroys_items(grd[x][y]);// Non-returning items thrown into item-destroying grids are always// destroyed. Returning items are only destroyed if they would have// been randomly destroyed anyway.if (returning && !destroyed)hostile_grid = false;if (hostile_grid){// No destruction sound here. Too much message spam otherwise.item_was_destroyed(*item, midx);destroyed = true;}return destroyed;}
returning = (get_weapon_brand(item) == SPWPN_RETURNING && !teleport &&!one_chance_in(1 + skill_bump(SK_THROWING)));
returning = ((get_weapon_brand(item) == SPWPN_RETURNING ||get_ammo_brand(item) == SPMSL_RETURNING) &&!teleport &&!one_chance_in(1 + skill_bump(SK_THROWING)));
bool thrown_object_destroyed( item_def *item, int x, int y, bool returning ){ASSERT( item != NULL );int chance = 0;bool destroyed = false;bool hostile_grid = false;if (item->base_type == OBJ_MISSILES){// [dshaligram] Removed influence of Throwing on ammo preservation.// The effect is nigh impossible to perceive.switch (item->sub_type){case MI_NEEDLE:chance = (get_ammo_brand(*item) == SPMSL_CURARE ? 3 : 6);break;case MI_SLING_BULLET:case MI_STONE: chance = 4; break;case MI_DART: chance = 3; break;case MI_ARROW: chance = 4; break;case MI_BOLT: chance = 4; break;case MI_JAVELIN: chance = 10; break;case MI_THROWING_NET: break; // doesn't get destroyed by throwing
case MI_LARGE_ROCK:default:chance = 25;break;}}destroyed = (chance == 0) ? false : one_chance_in(chance);hostile_grid = grid_destroys_items(grd[x][y]);// Non-returning items thrown into item-destroying grids are always// destroyed. Returning items are only destroyed if they would have// been randomly destroyed anyway.if (returning && !destroyed)hostile_grid = false;if (hostile_grid){if (player_can_hear(x, y))mprf(MSGCH_SOUND, grid_item_destruction_message(grd[x][y]));item_was_destroyed(*item, NON_MONSTER);destroyed = true;}return destroyed;}
return;if ( grid_destroys_items(grd[x][y]) ){// Too much message spam otherwiseif ( YOU_KILL(beam.thrower) && player_can_hear(x, y) )mprf(MSGCH_SOUND, grid_item_destruction_message(grd[x][y]));item_was_destroyed(*item, beam.beam_source);return;}// doesn't get destroyed by throwingif (item->sub_type == MI_THROWING_NET){// player or monster on position is caught in netif (you.x_pos == x && you.y_pos == y && you.attribute[ATTR_HELD]|| mgrd[x][y] != NON_MONSTER && mons_is_caught(&menv[mgrd[x][y]])){// if no trapping net found mark this oneif (get_trapping_net(x,y, true) == NON_ITEM)set_item_stationary(*item);}copy_item_to_grid( *item, x, y, 1 );
int chance;// [dshaligram] Removed influence of Throwing on ammo preservation.// The effect is nigh impossible to perceive.switch (item->sub_type)
if (item->sub_type == MI_THROWING_NET)
case MI_NEEDLE:chance = (get_ammo_brand(*item) == SPMSL_CURARE? 3 : 6);break;case MI_SLING_BULLET:case MI_STONE: chance = 4; break;case MI_DART: chance = 3; break;case MI_ARROW: chance = 4; break;case MI_BOLT: chance = 4; break;case MI_JAVELIN: chance = 10; break;case MI_LARGE_ROCK:default:chance = 25;break;
// player or monster on position is caught in netif (you.x_pos == x && you.y_pos == y && you.attribute[ATTR_HELD]|| mgrd[x][y] != NON_MONSTER &&mons_is_caught(&menv[mgrd[x][y]])){// if no trapping net found mark this oneif (get_trapping_net(x,y, true) == NON_ITEM)set_item_stationary(*item);}
if (item->base_type != OBJ_MISSILES || !one_chance_in(chance))copy_item_to_grid( *item, x, y, 1 );}else if (MON_KILL(beam.thrower)&& (item->base_type != OBJ_MISSILES || coinflip())){