{"action":"opened","issue":{"url":"https://api.github.com/repos/Lerondo/Mythe/issues/14","labels_url":"https://api.github.com/repos/Lerondo/Mythe/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/Lerondo/Mythe/issues/14/comments","events_url":"https://api.github.com/repos/Lerondo/Mythe/issues/14/events","html_url":"https://github.com/Lerondo/Mythe/issues/14","id":57938951,"number":14,"title":"DRY","user":{"login":"RichardRam87","id":5513037,"avatar_url":"https://avatars.githubusercontent.com/u/5513037?v=3","gravatar_id":"","url":"https://api.github.com/users/RichardRam87","html_url":"https://github.com/RichardRam87","followers_url":"https://api.github.com/users/RichardRam87/followers","following_url":"https://api.github.com/users/RichardRam87/following{/other_user}","gists_url":"https://api.github.com/users/RichardRam87/gists{/gist_id}","starred_url":"https://api.github.com/users/RichardRam87/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RichardRam87/subscriptions","organizations_url":"https://api.github.com/users/RichardRam87/orgs","repos_url":"https://api.github.com/users/RichardRam87/repos","events_url":"https://api.github.com/users/RichardRam87/events{/privacy}","received_events_url":"https://api.github.com/users/RichardRam87/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-02-17T15:37:12Z","updated_at":"2015-02-17T15:37:12Z","closed_at":null,"body":"```c\npublic void UpdateDamage(int newDamage,int oldDamage)\n\t{\n\t\t_damage -= oldDamage;\n\t\t_damage += newDamage;\n\t}\n\tpublic void UpdateDefence(int newDefence,int oldDefence)\n\t{\n\t\t_defence -= oldDefence;\n\t\t_defence += newDefence;\n\t}\n\tpublic void UpdateStats(int swordId, int shieldId, int helmId, int legsId, int bodyId, int bootsId)\n\t{\n\t\t_damage = basicDamage;\n\t\t_defence = basicDefence;\n\t\tfor (int i = 0; i < 6; i++) \n\t\t{\n\t\t\tint dmg = 0;\n\t\t\tint def = 0;\n\t\t\tswitch(i)\n\t\t\t{\n\t\t\tcase 1:\n\t\t\t\tdmg = ItemDatabase.itemList[swordId].GetItemDamage();\n\t\t\t\tdef = ItemDatabase.itemList[swordId].GetItemDefence();\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tdmg = ItemDatabase.itemList[shieldId].GetItemDamage();\n\t\t\t\tdef = ItemDatabase.itemList[shieldId].GetItemDefence();\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\tdmg = ItemDatabase.itemList[helmId].GetItemDamage();\n\t\t\t\tdef = ItemDatabase.itemList[helmId].GetItemDefence();\n\t\t\t\tbreak;\n\t\t\tcase 4:\n\t\t\t\tdmg = ItemDatabase.itemList[legsId].GetItemDamage();\n\t\t\t\tdef = ItemDatabase.itemList[legsId].GetItemDefence();\n\t\t\t\tbreak;\n\t\t\tcase 5:\n\t\t\t\tdmg = ItemDatabase.itemList[bodyId].GetItemDamage();\n\t\t\t\tdef = ItemDatabase.itemList[bodyId].GetItemDefence();\n\t\t\t\tbreak;\n\t\t\tcase 6:\n\t\t\t\tdmg = ItemDatabase.itemList[bootsId].GetItemDamage();\n\t\t\t\tdef = ItemDatabase.itemList[bootsId].GetItemDefence();\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t_defence += def;\n\t\t\t_damage += dmg;\n\t\t}\n\t} \n```\n\nBestand: https://github.com/Lerondo/Mythe/blob/master/Assets/Scripts/Player/PlayerStats.cs\n\nDeze functies zijn niet DRY (Don't Repeat Yourself).\nJe herhaalt een zelfde type proces afhankelijk van een bepaalde variabele. Dit kan efficiënter."}}