{"action":"created","comment":{"url":"https://api.github.com/repos/OpenRA/OpenRA/pulls/comments/221086373","pull_request_review_id":159652989,"id":221086373,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMTA4NjM3Mw==","diff_hunk":"@@ -35,32 +35,48 @@ public override bool IsValidAgainst(Actor victim, Actor firedBy)\n \t\t\treturn base.IsValidAgainst(victim, firedBy);\n \t\t}\n \n-\t\tpublic int DamageVersus(Actor victim)\n+\t\tpublic int DamageVersus(Actor victim, HitShapeInfo shapeInfo)\n \t\t{\n \t\t\tvar armor = victim.TraitsImplementing<Armor>()\n-\t\t\t\t.Where(a => !a.IsTraitDisabled && a.Info.Type != null && Versus.ContainsKey(a.Info.Type))\n+\t\t\t\t.Where(a => !a.IsTraitDisabled && a.Info.Type != null && Versus.ContainsKey(a.Info.Type) &&\n+\t\t\t\t\t(shapeInfo.ArmorTypes.Count == 0 || shapeInfo.ArmorTypes.Contains(a.Info.Type)))\n \t\t\t\t.Select(a => Versus[a.Info.Type]);\n \n \t\t\treturn Util.ApplyPercentageModifiers(100, armor);\n \t\t}\n \n \t\tpublic override void DoImpact(Target target, Actor firedBy, IEnumerable<int> damageModifiers)\n \t\t{\n-\t\t\t// Used by traits that damage a single actor, rather than a position\n+\t\t\t// Used by traits or warheads that damage a single actor, rather than a position\n \t\t\tif (target.Type == TargetType.Actor)\n-\t\t\t\tDoImpact(target.Actor, firedBy, damageModifiers);\n+\t\t\t{\n+\t\t\t\tvar victim = target.Actor;\n+\n+\t\t\t\t// Cannot be damaged without a Health trait\n+\t\t\t\tif (!victim.Info.HasTraitInfo<HealthInfo>())\n+\t\t\t\t\treturn;\n+\n+\t\t\t\tif (!IsValidAgainst(victim, firedBy))\n+\t\t\t\t\treturn;\n+\n+\t\t\t\tvar closestActiveShape = victim.TraitsImplementing<HitShape>().Where(Exts.IsTraitEnabled)\n+\t\t\t\t\t.MinByOrDefault(t => t.Info.Type.DistanceFromEdge(victim.CenterPosition, victim));\n+\n+\t\t\t\t// Cannot be damaged without an active HitShape\n+\t\t\t\tif (closestActiveShape == null)\n+\t\t\t\t\treturn;\n+\n+\t\t\t\tDoImpact(victim, firedBy, closestActiveShape.Info, damageModifiers);\n+\t\t\t}\n \t\t\telse if (target.Type != TargetType.Invalid)\n \t\t\t\tDoImpact(target.CenterPosition, firedBy, damageModifiers);\n \t\t}\n \n \t\tpublic abstract void DoImpact(WPos pos, Actor firedBy, IEnumerable<int> damageModifiers);\n \n-\t\tpublic virtual void DoImpact(Actor victim, Actor firedBy, IEnumerable<int> damageModifiers)\n+\t\tpublic virtual void DoImpact(Actor victim, Actor firedBy, HitShapeInfo shapeInfo, IEnumerable<int> damageModifiers)\n \t\t{\n-\t\t\tif (!IsValidAgainst(victim, firedBy))","path":"OpenRA.Mods.Common/Warheads/DamageWarhead.cs","position":50,"original_position":50,"commit_id":"edd31fc35478a886e8e9e7d78ac0a0aa60abd94d","original_commit_id":"b3d0281fbf8ba2915ef406a5828e0980066f9a35","user":{"login":"pchote","id":167819,"node_id":"MDQ6VXNlcjE2NzgxOQ==","avatar_url":"https://avatars1.githubusercontent.com/u/167819?v=4","gravatar_id":"","url":"https://api.github.com/users/pchote","html_url":"https://github.com/pchote","followers_url":"https://api.github.com/users/pchote/followers","following_url":"https://api.github.com/users/pchote/following{/other_user}","gists_url":"https://api.github.com/users/pchote/gists{/gist_id}","starred_url":"https://api.github.com/users/pchote/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pchote/subscriptions","organizations_url":"https://api.github.com/users/pchote/orgs","repos_url":"https://api.github.com/users/pchote/repos","events_url":"https://api.github.com/users/pchote/events{/privacy}","received_events_url":"https://api.github.com/users/pchote/received_events","type":"User","site_admin":false},"body":"Removing this from here doesn't sit well with me - this is public, so anything can call it.\r\n\r\nConsidering that this is actually effectively only called from three places (`HealthPercentageWarhead` overrides both this method and the thing that calls it) my preference is to remove this completely and inline the `InflictDamage` calls.","created_at":"2018-09-27T21:41:21Z","updated_at":"2018-09-27T21:52:19Z","html_url":"https://github.com/OpenRA/OpenRA/pull/14991#discussion_r221086373","pull_request_url":"https://api.github.com/repos/OpenRA/OpenRA/pulls/14991","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/OpenRA/OpenRA/pulls/comments/221086373"},"html":{"href":"https://github.com/OpenRA/OpenRA/pull/14991#discussion_r221086373"},"pull_request":{"href":"https://api.github.com/repos/OpenRA/OpenRA/pulls/14991"}}},"pull_request":{"url":"https://api.github.com/repos/OpenRA/OpenRA/pulls/14991","id":177271483,"node_id":"MDExOlB1bGxSZXF1ZXN0MTc3MjcxNDgz","html_url":"https://github.com/OpenRA/OpenRA/pull/14991","diff_url":"https://github.com/OpenRA/OpenRA/pull/14991.diff","patch_url":"https://github.com/OpenRA/OpenRA/pull/14991.patch","issue_url":"https://api.github.com/repos/OpenRA/OpenRA/issues/14991","number":14991,"state":"open","locked":false,"title":"Add ArmorTypes to HitShape and adapt damage warheads","user":{"login":"reaperrr","id":2857877,"node_id":"MDQ6VXNlcjI4NTc4Nzc=","avatar_url":"https://avatars3.githubusercontent.com/u/2857877?v=4","gravatar_id":"","url":"https://api.github.com/users/reaperrr","html_url":"https://github.com/reaperrr","followers_url":"https://api.github.com/users/reaperrr/followers","following_url":"https://api.github.com/users/reaperrr/following{/other_user}","gists_url":"https://api.github.com/users/reaperrr/gists{/gist_id}","starred_url":"https://api.github.com/users/reaperrr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reaperrr/subscriptions","organizations_url":"https://api.github.com/users/reaperrr/orgs","repos_url":"https://api.github.com/users/reaperrr/repos","events_url":"https://api.github.com/users/reaperrr/events{/privacy}","received_events_url":"https://api.github.com/users/reaperrr/received_events","type":"User","site_admin":false},"body":"Supersedes #13675.\r\n\r\nThis allows to assign `Armor` traits to specific `HitShape`s, allowing to make certain parts of actors more vulnerable or durable than others.\r\nCan also be used to simulate directional armor in a good-enough way that this closes #9268 and therefore closes #7718.\r\n\r\nTestcase can be found here: https://github.com/reaperrr/OpenRA/tree/hitshape-armor-v2-test\r\n\r\nThe main problems of #13675 that brought it down, \r\n\r\n> The core of the problem is that this introduces a second channel for applying damage (DoImpact with and without a hitshape) right in the middle of a chain of inheritance and overrides. This makes it very difficult to know which will be used, and means that the same weapon/warheads/vs fired by different means will end up doing different amounts of damage to the same actor.\r\nThis feature really needs to be integrated from the bottom up, and not just bolted on the side. **Require all damaging warheads to specify the hitshape**, and **fix the higher level code to be able to choose the appropriate one based on whatever rules make sense in each case**.\r\n\r\nshould be adressed by this updated version.\r\n\r\nAll damage warheads now absolutely require an enabled hitshape to deal damage to actors, and now that we have the Polygon shape type, there's no real excuse for an actor to have overlapping shapes anymore, so just taking the shape closest to impact for damage calculations should be a sufficient solution.","created_at":"2018-03-25T03:54:34Z","updated_at":"2018-09-27T21:52:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ba11d07e0aad1e9fe0a423c7574dd9baab2e91d8","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/OpenRA/OpenRA/pulls/14991/commits","review_comments_url":"https://api.github.com/repos/OpenRA/OpenRA/pulls/14991/comments","review_comment_url":"https://api.github.com/repos/OpenRA/OpenRA/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OpenRA/OpenRA/issues/14991/comments","statuses_url":"https://api.github.com/repos/OpenRA/OpenRA/statuses/edd31fc35478a886e8e9e7d78ac0a0aa60abd94d","head":{"label":"reaperrr:hitshape-armor-v2","ref":"hitshape-armor-v2","sha":"edd31fc35478a886e8e9e7d78ac0a0aa60abd94d","user":{"login":"reaperrr","id":2857877,"node_id":"MDQ6VXNlcjI4NTc4Nzc=","avatar_url":"https://avatars3.githubusercontent.com/u/2857877?v=4","gravatar_id":"","url":"https://api.github.com/users/reaperrr","html_url":"https://github.com/reaperrr","followers_url":"https://api.github.com/users/reaperrr/followers","following_url":"https://api.github.com/users/reaperrr/following{/other_user}","gists_url":"https://api.github.com/users/reaperrr/gists{/gist_id}","starred_url":"https://api.github.com/users/reaperrr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reaperrr/subscriptions","organizations_url":"https://api.github.com/users/reaperrr/orgs","repos_url":"https://api.github.com/users/reaperrr/repos","events_url":"https://api.github.com/users/reaperrr/events{/privacy}","received_events_url":"https://api.github.com/users/reaperrr/received_events","type":"User","site_admin":false},"repo":{"id":6804707,"node_id":"MDEwOlJlcG9zaXRvcnk2ODA0NzA3","name":"OpenRA","full_name":"reaperrr/OpenRA","private":false,"owner":{"login":"reaperrr","id":2857877,"node_id":"MDQ6VXNlcjI4NTc4Nzc=","avatar_url":"https://avatars3.githubusercontent.com/u/2857877?v=4","gravatar_id":"","url":"https://api.github.com/users/reaperrr","html_url":"https://github.com/reaperrr","followers_url":"https://api.github.com/users/reaperrr/followers","following_url":"https://api.github.com/users/reaperrr/following{/other_user}","gists_url":"https://api.github.com/users/reaperrr/gists{/gist_id}","starred_url":"https://api.github.com/users/reaperrr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reaperrr/subscriptions","organizations_url":"https://api.github.com/users/reaperrr/orgs","repos_url":"https://api.github.com/users/reaperrr/repos","events_url":"https://api.github.com/users/reaperrr/events{/privacy}","received_events_url":"https://api.github.com/users/reaperrr/received_events","type":"User","site_admin":false},"html_url":"https://github.com/reaperrr/OpenRA","description":"An open-source implementation of the Red Alert engine using .NET/mono and OpenGL. Runs on Windows, Linux and OSX. Bugs at http://bugs.open-ra.org/","fork":true,"url":"https://api.github.com/repos/reaperrr/OpenRA","forks_url":"https://api.github.com/repos/reaperrr/OpenRA/forks","keys_url":"https://api.github.com/repos/reaperrr/OpenRA/keys{/key_id}","collaborators_url":"https://api.github.com/repos/reaperrr/OpenRA/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/reaperrr/OpenRA/teams","hooks_url":"https://api.github.com/repos/reaperrr/OpenRA/hooks","issue_events_url":"https://api.github.com/repos/reaperrr/OpenRA/issues/events{/number}","events_url":"https://api.github.com/repos/reaperrr/OpenRA/events","assignees_url":"https://api.github.com/repos/reaperrr/OpenRA/assignees{/user}","branches_url":"https://api.github.com/repos/reaperrr/OpenRA/branches{/branch}","tags_url":"https://api.github.com/repos/reaperrr/OpenRA/tags","blobs_url":"https://api.github.com/repos/reaperrr/OpenRA/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/reaperrr/OpenRA/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/reaperrr/OpenRA/git/refs{/sha}","trees_url":"https://api.github.com/repos/reaperrr/OpenRA/git/trees{/sha}","statuses_url":"https://api.github.com/repos/reaperrr/OpenRA/statuses/{sha}","languages_url":"https://api.github.com/repos/reaperrr/OpenRA/languages","stargazers_url":"https://api.github.com/repos/reaperrr/OpenRA/stargazers","contributors_url":"https://api.github.com/repos/reaperrr/OpenRA/contributors","subscribers_url":"https://api.github.com/repos/reaperrr/OpenRA/subscribers","subscription_url":"https://api.github.com/repos/reaperrr/OpenRA/subscription","commits_url":"https://api.github.com/repos/reaperrr/OpenRA/commits{/sha}","git_commits_url":"https://api.github.com/repos/reaperrr/OpenRA/git/commits{/sha}","comments_url":"https://api.github.com/repos/reaperrr/OpenRA/comments{/number}","issue_comment_url":"https://api.github.com/repos/reaperrr/OpenRA/issues/comments{/number}","contents_url":"https://api.github.com/repos/reaperrr/OpenRA/contents/{+path}","compare_url":"https://api.github.com/repos/reaperrr/OpenRA/compare/{base}...{head}","merges_url":"https://api.github.com/repos/reaperrr/OpenRA/merges","archive_url":"https://api.github.com/repos/reaperrr/OpenRA/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/reaperrr/OpenRA/downloads","issues_url":"https://api.github.com/repos/reaperrr/OpenRA/issues{/number}","pulls_url":"https://api.github.com/repos/reaperrr/OpenRA/pulls{/number}","milestones_url":"https://api.github.com/repos/reaperrr/OpenRA/milestones{/number}","notifications_url":"https://api.github.com/repos/reaperrr/OpenRA/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/reaperrr/OpenRA/labels{/name}","releases_url":"https://api.github.com/repos/reaperrr/OpenRA/releases{/id}","deployments_url":"https://api.github.com/repos/reaperrr/OpenRA/deployments","created_at":"2012-11-21T23:13:26Z","updated_at":"2015-09-20T21:10:57Z","pushed_at":"2018-09-27T21:46:16Z","git_url":"git://github.com/reaperrr/OpenRA.git","ssh_url":"git@github.com:reaperrr/OpenRA.git","clone_url":"https://github.com/reaperrr/OpenRA.git","svn_url":"https://github.com/reaperrr/OpenRA","homepage":"http://open-ra.org","size":137051,"stargazers_count":1,"watchers_count":1,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":0,"open_issues":0,"watchers":1,"default_branch":"bleed"}},"base":{"label":"OpenRA:bleed","ref":"bleed","sha":"8144fca5be948a20e9cf9c1270db5b70c069af3e","user":{"login":"OpenRA","id":409046,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQwOTA0Ng==","avatar_url":"https://avatars0.githubusercontent.com/u/409046?v=4","gravatar_id":"","url":"https://api.github.com/users/OpenRA","html_url":"https://github.com/OpenRA","followers_url":"https://api.github.com/users/OpenRA/followers","following_url":"https://api.github.com/users/OpenRA/following{/other_user}","gists_url":"https://api.github.com/users/OpenRA/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenRA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenRA/subscriptions","organizations_url":"https://api.github.com/users/OpenRA/orgs","repos_url":"https://api.github.com/users/OpenRA/repos","events_url":"https://api.github.com/users/OpenRA/events{/privacy}","received_events_url":"https://api.github.com/users/OpenRA/received_events","type":"Organization","site_admin":false},"repo":{"id":959908,"node_id":"MDEwOlJlcG9zaXRvcnk5NTk5MDg=","name":"OpenRA","full_name":"OpenRA/OpenRA","private":false,"owner":{"login":"OpenRA","id":409046,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQwOTA0Ng==","avatar_url":"https://avatars0.githubusercontent.com/u/409046?v=4","gravatar_id":"","url":"https://api.github.com/users/OpenRA","html_url":"https://github.com/OpenRA","followers_url":"https://api.github.com/users/OpenRA/followers","following_url":"https://api.github.com/users/OpenRA/following{/other_user}","gists_url":"https://api.github.com/users/OpenRA/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenRA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenRA/subscriptions","organizations_url":"https://api.github.com/users/OpenRA/orgs","repos_url":"https://api.github.com/users/OpenRA/repos","events_url":"https://api.github.com/users/OpenRA/events{/privacy}","received_events_url":"https://api.github.com/users/OpenRA/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/OpenRA/OpenRA","description":"Open Source real-time strategy game engine for early Westwood games such as Command & Conquer: Red Alert written in C# using SDL and OpenGL. Runs on Windows, Linux, *BSD and Mac OS X.","fork":false,"url":"https://api.github.com/repos/OpenRA/OpenRA","forks_url":"https://api.github.com/repos/OpenRA/OpenRA/forks","keys_url":"https://api.github.com/repos/OpenRA/OpenRA/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OpenRA/OpenRA/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OpenRA/OpenRA/teams","hooks_url":"https://api.github.com/repos/OpenRA/OpenRA/hooks","issue_events_url":"https://api.github.com/repos/OpenRA/OpenRA/issues/events{/number}","events_url":"https://api.github.com/repos/OpenRA/OpenRA/events","assignees_url":"https://api.github.com/repos/OpenRA/OpenRA/assignees{/user}","branches_url":"https://api.github.com/repos/OpenRA/OpenRA/branches{/branch}","tags_url":"https://api.github.com/repos/OpenRA/OpenRA/tags","blobs_url":"https://api.github.com/repos/OpenRA/OpenRA/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OpenRA/OpenRA/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OpenRA/OpenRA/git/refs{/sha}","trees_url":"https://api.github.com/repos/OpenRA/OpenRA/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OpenRA/OpenRA/statuses/{sha}","languages_url":"https://api.github.com/repos/OpenRA/OpenRA/languages","stargazers_url":"https://api.github.com/repos/OpenRA/OpenRA/stargazers","contributors_url":"https://api.github.com/repos/OpenRA/OpenRA/contributors","subscribers_url":"https://api.github.com/repos/OpenRA/OpenRA/subscribers","subscription_url":"https://api.github.com/repos/OpenRA/OpenRA/subscription","commits_url":"https://api.github.com/repos/OpenRA/OpenRA/commits{/sha}","git_commits_url":"https://api.github.com/repos/OpenRA/OpenRA/git/commits{/sha}","comments_url":"https://api.github.com/repos/OpenRA/OpenRA/comments{/number}","issue_comment_url":"https://api.github.com/repos/OpenRA/OpenRA/issues/comments{/number}","contents_url":"https://api.github.com/repos/OpenRA/OpenRA/contents/{+path}","compare_url":"https://api.github.com/repos/OpenRA/OpenRA/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OpenRA/OpenRA/merges","archive_url":"https://api.github.com/repos/OpenRA/OpenRA/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OpenRA/OpenRA/downloads","issues_url":"https://api.github.com/repos/OpenRA/OpenRA/issues{/number}","pulls_url":"https://api.github.com/repos/OpenRA/OpenRA/pulls{/number}","milestones_url":"https://api.github.com/repos/OpenRA/OpenRA/milestones{/number}","notifications_url":"https://api.github.com/repos/OpenRA/OpenRA/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OpenRA/OpenRA/labels{/name}","releases_url":"https://api.github.com/repos/OpenRA/OpenRA/releases{/id}","deployments_url":"https://api.github.com/repos/OpenRA/OpenRA/deployments","created_at":"2010-10-04T07:38:05Z","updated_at":"2018-09-27T14:38:25Z","pushed_at":"2018-09-27T21:46:18Z","git_url":"git://github.com/OpenRA/OpenRA.git","ssh_url":"git@github.com:OpenRA/OpenRA.git","clone_url":"https://github.com/OpenRA/OpenRA.git","svn_url":"https://github.com/OpenRA/OpenRA","homepage":"http://www.openra.net","size":134855,"stargazers_count":5562,"watchers_count":5562,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1626,"mirror_url":null,"archived":false,"open_issues_count":1474,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":1626,"open_issues":1474,"watchers":5562,"default_branch":"bleed"}},"_links":{"self":{"href":"https://api.github.com/repos/OpenRA/OpenRA/pulls/14991"},"html":{"href":"https://github.com/OpenRA/OpenRA/pull/14991"},"issue":{"href":"https://api.github.com/repos/OpenRA/OpenRA/issues/14991"},"comments":{"href":"https://api.github.com/repos/OpenRA/OpenRA/issues/14991/comments"},"review_comments":{"href":"https://api.github.com/repos/OpenRA/OpenRA/pulls/14991/comments"},"review_comment":{"href":"https://api.github.com/repos/OpenRA/OpenRA/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OpenRA/OpenRA/pulls/14991/commits"},"statuses":{"href":"https://api.github.com/repos/OpenRA/OpenRA/statuses/edd31fc35478a886e8e9e7d78ac0a0aa60abd94d"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"pchote"}}