{"action":"created","issue":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/13121","labels_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/13121/labels{/name}","comments_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/13121/comments","events_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/13121/events","html_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/13121","id":98003003,"number":13121,"title":"Rewrite throwing to use same rules as shooting","user":{"login":"Coolthulhu","id":1878860,"avatar_url":"https://avatars.githubusercontent.com/u/1878860?v=3","gravatar_id":"","url":"https://api.github.com/users/Coolthulhu","html_url":"https://github.com/Coolthulhu","followers_url":"https://api.github.com/users/Coolthulhu/followers","following_url":"https://api.github.com/users/Coolthulhu/following{/other_user}","gists_url":"https://api.github.com/users/Coolthulhu/gists{/gist_id}","starred_url":"https://api.github.com/users/Coolthulhu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Coolthulhu/subscriptions","organizations_url":"https://api.github.com/users/Coolthulhu/orgs","repos_url":"https://api.github.com/users/Coolthulhu/repos","events_url":"https://api.github.com/users/Coolthulhu/events{/privacy}","received_events_url":"https://api.github.com/users/Coolthulhu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-07-29T18:43:57Z","updated_at":"2015-07-31T13:24:28Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/13121","html_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/13121","diff_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/13121.diff","patch_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/13121.patch"},"body":"Throwing used weird system, totally split from other ranged attacks, a bit like an inlined subset of shooting ranged attacks. For example, directly applying damage, skipping monster dodge and size and skipping monsters' abilities such as damage resistance or on-hit effects.\r\n\r\nI rewrote throwing to use the same rules as shot projectiles. This should greatly improve maintainability, should someone want to add all the features in the comments, like dodging projectiles.\r\n\r\nFrom player's perspective:\r\n* Thrown items now fly through the air like bullets (didn't code them to display proper sprite, though - red '*' has to be enough for now)\r\n* Spitters and corrosives now show an animated bullet too. Also, dynamics of their bullets are more player-like\r\n* Thrown acid bombs will explode into acid even if the player doesn't activate them first\r\n* Projectiles embed themselves into targets if they cut/stab more than they bash. Affects both thrown knives and arrows/bolts\r\n* Nerfed shrapnel a bit: it now deals 50% bashing and 50% stabbing damage, meaning armor counts twice against it.\r\n\r\n___\r\n\r\nFrom the code side:\r\n* Rewrote the throwing function. Moved from `game` to `player. NPCs will now use the same rules as player. It uses `Creature::projectile_attack` to deal the attack.\r\n* Removed most of the `projectile` class, because I hate ancient placeholders with no implementation.\r\n* Removed minor \"caches\" from `projectile` class: `wide` or `drops`. \"WIDE\" is now a flag, `drops` is determined by `unique_ptr<item>` being not nullptr\r\n* Ranged attacks now take and return a struct to describe the attack. I'm not sure if one or two structs would be better (one before, one after the attack). Went with one, because most of the fields would be shared.\r\n* Thrown items can now be activated on drop from projectile. Currently only acid bombs do it, but coding thrown impact grenades would be easy now.\r\n* Rewrote shrapnel code to create a fake NPC and have it \"fire\" the shrapnel around. Less copypasted code.\r\n\r\nTODO:\r\n* [x] \"The debug monster is hit by/dodges Shrapnel's projectile!\"\r\n* [x] Wrap the `unique_ptr<item>` into a less transparent class\r\n* [x] Bring back shrapnel animation skip, so that ANFO doesn't take 10 seconds to animate\r\n* [x] Fix shrapnel crashing the game"},"comment":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/comments/126690486","html_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/13121#issuecomment-126690486","issue_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/13121","id":126690486,"user":{"login":"Coolthulhu","id":1878860,"avatar_url":"https://avatars.githubusercontent.com/u/1878860?v=3","gravatar_id":"","url":"https://api.github.com/users/Coolthulhu","html_url":"https://github.com/Coolthulhu","followers_url":"https://api.github.com/users/Coolthulhu/followers","following_url":"https://api.github.com/users/Coolthulhu/following{/other_user}","gists_url":"https://api.github.com/users/Coolthulhu/gists{/gist_id}","starred_url":"https://api.github.com/users/Coolthulhu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Coolthulhu/subscriptions","organizations_url":"https://api.github.com/users/Coolthulhu/orgs","repos_url":"https://api.github.com/users/Coolthulhu/repos","events_url":"https://api.github.com/users/Coolthulhu/events{/privacy}","received_events_url":"https://api.github.com/users/Coolthulhu/received_events","type":"User","site_admin":false},"created_at":"2015-07-31T13:24:28Z","updated_at":"2015-07-31T13:24:28Z","body":"OK, this should be ready.\r\n\r\nChanged the flag to \"ACT_ON_RANGED_HIT\". Should be unambiguous.\r\n\r\nAdded descriptions of the flags to documentation.\r\n\r\nRefactored the projectile item drop: the pointer is not exposed, instead it is accessed by a getter/setter. For a case where it is null, a static item is returned, for which `is_null()` is true.\r\n\r\nAlso fixed minor bugs:\r\n* Unintended targets on the line of fire were hit more accurately if the player had really bad accuracy vs. the intended target. Shooting far behind intended target could boost accuracy.\r\n* High strength would lower accuracy with thrown weapons, high weight of the item would increase accuracy."}}