{"action":"created","issue":{"url":"https://api.github.com/repos/endless-sky/endless-sky/issues/853","repository_url":"https://api.github.com/repos/endless-sky/endless-sky","labels_url":"https://api.github.com/repos/endless-sky/endless-sky/issues/853/labels{/name}","comments_url":"https://api.github.com/repos/endless-sky/endless-sky/issues/853/comments","events_url":"https://api.github.com/repos/endless-sky/endless-sky/issues/853/events","html_url":"https://github.com/endless-sky/endless-sky/pull/853","id":140554756,"number":853,"title":"Applying Damage to Plundered Outfits","user":{"login":"brazencavalier","id":261083,"avatar_url":"https://avatars.githubusercontent.com/u/261083?v=3","gravatar_id":"","url":"https://api.github.com/users/brazencavalier","html_url":"https://github.com/brazencavalier","followers_url":"https://api.github.com/users/brazencavalier/followers","following_url":"https://api.github.com/users/brazencavalier/following{/other_user}","gists_url":"https://api.github.com/users/brazencavalier/gists{/gist_id}","starred_url":"https://api.github.com/users/brazencavalier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brazencavalier/subscriptions","organizations_url":"https://api.github.com/users/brazencavalier/orgs","repos_url":"https://api.github.com/users/brazencavalier/repos","events_url":"https://api.github.com/users/brazencavalier/events{/privacy}","received_events_url":"https://api.github.com/users/brazencavalier/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-03-14T01:53:38Z","updated_at":"2016-03-15T14:33:40Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/endless-sky/endless-sky/pulls/853","html_url":"https://github.com/endless-sky/endless-sky/pull/853","diff_url":"https://github.com/endless-sky/endless-sky/pull/853.diff","patch_url":"https://github.com/endless-sky/endless-sky/pull/853.patch"},"body":"This is my first contribution to the project, I don't think I'm duplicating anyone else's issue/pull request but I apologies if I am or am in any other way breaching the contribution guidelines.\r\n\r\n**RATIONALE**\r\n\r\nThe value of plundered outfits is quite high, making a militaristic approach to money-making (especially later game) far more valuable than trading. Not only does it limit available play styles, but it doesn't recall to modern or classical piracy, in which plundering civilian goods is far more common and worthwhile (especially during the age of sail) than plundering weapons and military vessels. It's one of the reasons I especially like the death dues mechanic because it harkens to the shares system employed by many historical pirates.\r\n\r\nThis attempts to address the issue also raised in #227, but in a different way. It would also conflict (but could be made compatible with) #852. I intentionally didn't mess with the equality in purchase/sale price of purchased outfits because I like the ability to test out different outfit combinations and progressively upgrade without incurring financial penalty.\r\n\r\n**LORE**\r\n\r\nWhen you plunder a ship for outfits, you're not carefully removing them with specialist training and tools as would be done at an outfitter. You and your crew, possibly in a combat situation, are hastily removing them with whatever cutting equipment you have available. Hence the plundered outfits will be in a far worse condition than those newly purchased and will require some cost to repair to an installable state, and may otherwise only be good to be sold as scrap. Ammunition, like goods, is easily removable and transportable and hence not at risk of being damaged.\r\n\r\n**MECHANICS**\r\n\r\nThe concept of damaged outfits is added to outfits carried in the cargo hold. Damage is a binary state, and the cargo hold will keep a track of the number of total & damaged outfits.The only way to acquire damaged outfits is through plundering other ships. All plundered outfits will be damaged, except for ammunition to maintain consistency with the ability to use freshly plundered ammunition straight away.\r\n\r\nDamaged outfits take up the same space in your cargo hold, cannot be installed at an outfitter and are only sold for 10% of the standard price. They can be repaired (which replaces the buy/install option) at an outfitter, which requires 90% of the standard price to install them on a ship.\r\n\r\nA ship with X total outfits of which Y are damaged will display this in their ship info view and outfitter panel as:\r\n\r\nX (Y dam.)\r\n\r\nDamageable outfits (i.e. all except ammunition) display their \"cost if damaged\" and \"cost to repair\" in the outfitter information screen.\r\n\r\n**ISSUES/IMPROVEMENTS**\r\n\r\n- Damage/repair costs are not displayed in the outfitter map view.\r\n- The \"X (Y dam.)\" display style may be confusing, but using the full \"X (Y damaged)\" overflows in some displays.\r\n- The display style may be ugly/inconsistent.\r\n- The damaged/undamaged cost ratio (10%) is hard baked into the code and universal for all damageable outfits.\r\n- Damageable/undamageable outfits are hard baked into the code based on membership of the \"Ammunition\" category.\r\n- An outfit cannot be repaired unless it can be immediately installed.\r\n- Damaged outfits are always sold before undamaged ones, and undamaged outfits are always installed before damaged ones. I don't see a problem with denying player choice here, but I may have missed something.\r\n- When selling a damaged outfit to an outfitter, it is immediately repaired and can only be repurchased at full price.\r\n\r\n**FURTHER WORK**\r\n\r\n- I'd like to scale the damaged cost based on the outfit cost to mass ratio (CMR), such that most plundered outfits are similar in value to plundered goods. Damaged early human tech outfits would have a lower CMR than goods, late alien tech would be higher, but represent an even smaller fraction of its total value. e.g. The Korath Tek'nel Reactor has a current CMR of 100,000, when damaged it is 10,000, still over 6x times more valuable than the most expensive luxury goods.\r\n- A flat cost reduction (perhaps 50%) on outfits (damaged and undamaged) sold using the \"Sell All\" function on planets that lack an outfitter, representing the decreased demand for outfits where they cannot be installed.\r\n- Calculating the cost of items in a cargo hold is performed separately across a number of class files, but always uses similar methodology. Refactoring a lot of this code into the CargoHold class would improve maintainability for modifications such as this.\r\n- The same methodology could be applied to boarded ships (combat damage/sabotage by defenders), damaging their outfits/hulls and requiring one-off paid repairs to bring them back to full functionality.\r\n\r\n**UNRELATED FIXES**\r\n\r\nThe OutfitterPanel::CanBuy method incorrectly returned true for outfits in the player's cargo hold that exceeded the ship outfit space limits, the method has been fixed (although also modified to account for repairing damaged outfits)."},"comment":{"url":"https://api.github.com/repos/endless-sky/endless-sky/issues/comments/196846954","html_url":"https://github.com/endless-sky/endless-sky/pull/853#issuecomment-196846954","issue_url":"https://api.github.com/repos/endless-sky/endless-sky/issues/853","id":196846954,"user":{"login":"jmhorjus","id":1497842,"avatar_url":"https://avatars.githubusercontent.com/u/1497842?v=3","gravatar_id":"","url":"https://api.github.com/users/jmhorjus","html_url":"https://github.com/jmhorjus","followers_url":"https://api.github.com/users/jmhorjus/followers","following_url":"https://api.github.com/users/jmhorjus/following{/other_user}","gists_url":"https://api.github.com/users/jmhorjus/gists{/gist_id}","starred_url":"https://api.github.com/users/jmhorjus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmhorjus/subscriptions","organizations_url":"https://api.github.com/users/jmhorjus/orgs","repos_url":"https://api.github.com/users/jmhorjus/repos","events_url":"https://api.github.com/users/jmhorjus/events{/privacy}","received_events_url":"https://api.github.com/users/jmhorjus/received_events","type":"User","site_admin":false},"created_at":"2016-03-15T14:33:40Z","updated_at":"2016-03-15T14:33:40Z","body":"Yeah, I think it makes sense for \"New\"-->\"Used\"-->\"Very Used\"-->\"Damaged\" to be points on the same continuum. What I currently call \"age\" could be renamed/re-understood as \"wear\". \r\n\r\nCurrently there's no limit on \"age\" and at a certain point the age just stops effecting price. First step is to have the \"wear\" itself stop accumulating at a certain level - the part is now \"well worn\" and not noticeably getting worse.  Then outfits with *more* wear than that \"well worn\" level could be considered \"damaged\" and need to be repaired before they could be installed.\r\n\r\nThen you could have a plundered outfit take a little extra \"wear\" when being plundered. (Balance wise, I'd like to not knock more than another half off of even the heaviest and most valuable outfits though - so that if you capture two of something you can always at least sell one for 25% and use the money to repair the other one from 25% to 50%.)\r\n\r\nI don't like the idea of determining damage level by the hull damage on the disabled ship, since that is super hard to control (unless you never use any non-laser weapon) and can go up or down if a ship is assisted and then disabled again. Perhaps use a small random factor plus the item's weight?  The heavier something is the harder it's likely to be to extract it in one piece after all.  "}}