{"action":"created","comment":{"url":"https://api.github.com/repos/amfeng/runebound/pulls/comments/35478844","id":35478844,"diff_hunk":"@@ -18,11 +19,68 @@ BattleAction.prototype.execute = function() {\n     this.defend();\n   } else if (this.action === \"heal\") {\n     this.heal();\n+  } else if (this.action === \"regainMp\") {\n+    this.regainMp();\n   } else if (this.action === \"flee\") {\n     this.flee();\n+  } else {\n+    this.useItem();\n   }\n };\n \n+BattleAction.prototype.useItem = function() {\n+  var that = this;\n+  this.targets.forEach(function (t) {\n+    var result = {};\n+    result.targetName = t.name;\n+    result.type = \"item\";\n+    result.itemName = that.skill.name;\n+\n+    var amount = Math.floor(that.skill.baseDamage);\n+    result.amount = amount;\n+    if (that.skill.actionType === \"heal\") {\n+      t.heal(amount);\n+      result.attribute = \"hp\";\n+    } else if (that.skill.actionType === \"regainMp\") {","path":"lib/battle_action.js","position":34,"original_position":34,"commit_id":"f57ae33f7f67fc8b1b94253040e7eaca9acdae4d","original_commit_id":"f57ae33f7f67fc8b1b94253040e7eaca9acdae4d","user":{"login":"jamesshieh","id":1072654,"avatar_url":"https://avatars.githubusercontent.com/u/1072654?v=3","gravatar_id":"","url":"https://api.github.com/users/jamesshieh","html_url":"https://github.com/jamesshieh","followers_url":"https://api.github.com/users/jamesshieh/followers","following_url":"https://api.github.com/users/jamesshieh/following{/other_user}","gists_url":"https://api.github.com/users/jamesshieh/gists{/gist_id}","starred_url":"https://api.github.com/users/jamesshieh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamesshieh/subscriptions","organizations_url":"https://api.github.com/users/jamesshieh/orgs","repos_url":"https://api.github.com/users/jamesshieh/repos","events_url":"https://api.github.com/users/jamesshieh/events{/privacy}","received_events_url":"https://api.github.com/users/jamesshieh/received_events","type":"User","site_admin":false},"body":"Cant handle elixirs yet :P going to have to change the item schemas probably","created_at":"2015-07-25T02:50:28Z","updated_at":"2015-07-25T02:50:28Z","html_url":"https://github.com/amfeng/runebound/pull/34#discussion_r35478844","pull_request_url":"https://api.github.com/repos/amfeng/runebound/pulls/34","_links":{"self":{"href":"https://api.github.com/repos/amfeng/runebound/pulls/comments/35478844"},"html":{"href":"https://github.com/amfeng/runebound/pull/34#discussion_r35478844"},"pull_request":{"href":"https://api.github.com/repos/amfeng/runebound/pulls/34"}}},"pull_request":{"url":"https://api.github.com/repos/amfeng/runebound/pulls/34","id":40827697,"html_url":"https://github.com/amfeng/runebound/pull/34","diff_url":"https://github.com/amfeng/runebound/pull/34.diff","patch_url":"https://github.com/amfeng/runebound/pull/34.patch","issue_url":"https://api.github.com/repos/amfeng/runebound/issues/34","number":34,"state":"closed","locked":false,"title":"Item usage","user":{"login":"jamesshieh","id":1072654,"avatar_url":"https://avatars.githubusercontent.com/u/1072654?v=3","gravatar_id":"","url":"https://api.github.com/users/jamesshieh","html_url":"https://github.com/jamesshieh","followers_url":"https://api.github.com/users/jamesshieh/followers","following_url":"https://api.github.com/users/jamesshieh/following{/other_user}","gists_url":"https://api.github.com/users/jamesshieh/gists{/gist_id}","starred_url":"https://api.github.com/users/jamesshieh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamesshieh/subscriptions","organizations_url":"https://api.github.com/users/jamesshieh/orgs","repos_url":"https://api.github.com/users/jamesshieh/repos","events_url":"https://api.github.com/users/jamesshieh/events{/privacy}","received_events_url":"https://api.github.com/users/jamesshieh/received_events","type":"User","site_admin":false},"body":"Adding the ability to use items in the menu and battle.\r\n\r\nNow items can carry with them any skill which will impart effects on the target during battle and out of battle. \r\n\r\nCan also be used to make spell scrolls items and such!\r\n\r\nEach item needs its own skill right now because the battle action still uses the skill.name to write out the effects of the item usage. \r\n\r\nAlso inventory doesn't update after you use an item yet. ","created_at":"2015-07-25T00:48:23Z","updated_at":"2015-07-25T02:50:28Z","closed_at":"2015-07-25T02:01:03Z","merged_at":"2015-07-25T02:01:03Z","merge_commit_sha":"0806fd2aa124bd573c2dadd84d9b4c5fdd1023ec","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/amfeng/runebound/pulls/34/commits","review_comments_url":"https://api.github.com/repos/amfeng/runebound/pulls/34/comments","review_comment_url":"https://api.github.com/repos/amfeng/runebound/pulls/comments{/number}","comments_url":"https://api.github.com/repos/amfeng/runebound/issues/34/comments","statuses_url":"https://api.github.com/repos/amfeng/runebound/statuses/f57ae33f7f67fc8b1b94253040e7eaca9acdae4d","head":{"label":"amfeng:item_usage","ref":"item_usage","sha":"f57ae33f7f67fc8b1b94253040e7eaca9acdae4d","user":{"login":"amfeng","id":286015,"avatar_url":"https://avatars.githubusercontent.com/u/286015?v=3","gravatar_id":"","url":"https://api.github.com/users/amfeng","html_url":"https://github.com/amfeng","followers_url":"https://api.github.com/users/amfeng/followers","following_url":"https://api.github.com/users/amfeng/following{/other_user}","gists_url":"https://api.github.com/users/amfeng/gists{/gist_id}","starred_url":"https://api.github.com/users/amfeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amfeng/subscriptions","organizations_url":"https://api.github.com/users/amfeng/orgs","repos_url":"https://api.github.com/users/amfeng/repos","events_url":"https://api.github.com/users/amfeng/events{/privacy}","received_events_url":"https://api.github.com/users/amfeng/received_events","type":"User","site_admin":false},"repo":{"id":29114259,"name":"runebound","full_name":"amfeng/runebound","owner":{"login":"amfeng","id":286015,"avatar_url":"https://avatars.githubusercontent.com/u/286015?v=3","gravatar_id":"","url":"https://api.github.com/users/amfeng","html_url":"https://github.com/amfeng","followers_url":"https://api.github.com/users/amfeng/followers","following_url":"https://api.github.com/users/amfeng/following{/other_user}","gists_url":"https://api.github.com/users/amfeng/gists{/gist_id}","starred_url":"https://api.github.com/users/amfeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amfeng/subscriptions","organizations_url":"https://api.github.com/users/amfeng/orgs","repos_url":"https://api.github.com/users/amfeng/repos","events_url":"https://api.github.com/users/amfeng/events{/privacy}","received_events_url":"https://api.github.com/users/amfeng/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/amfeng/runebound","description":"","fork":false,"url":"https://api.github.com/repos/amfeng/runebound","forks_url":"https://api.github.com/repos/amfeng/runebound/forks","keys_url":"https://api.github.com/repos/amfeng/runebound/keys{/key_id}","collaborators_url":"https://api.github.com/repos/amfeng/runebound/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/amfeng/runebound/teams","hooks_url":"https://api.github.com/repos/amfeng/runebound/hooks","issue_events_url":"https://api.github.com/repos/amfeng/runebound/issues/events{/number}","events_url":"https://api.github.com/repos/amfeng/runebound/events","assignees_url":"https://api.github.com/repos/amfeng/runebound/assignees{/user}","branches_url":"https://api.github.com/repos/amfeng/runebound/branches{/branch}","tags_url":"https://api.github.com/repos/amfeng/runebound/tags","blobs_url":"https://api.github.com/repos/amfeng/runebound/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/amfeng/runebound/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/amfeng/runebound/git/refs{/sha}","trees_url":"https://api.github.com/repos/amfeng/runebound/git/trees{/sha}","statuses_url":"https://api.github.com/repos/amfeng/runebound/statuses/{sha}","languages_url":"https://api.github.com/repos/amfeng/runebound/languages","stargazers_url":"https://api.github.com/repos/amfeng/runebound/stargazers","contributors_url":"https://api.github.com/repos/amfeng/runebound/contributors","subscribers_url":"https://api.github.com/repos/amfeng/runebound/subscribers","subscription_url":"https://api.github.com/repos/amfeng/runebound/subscription","commits_url":"https://api.github.com/repos/amfeng/runebound/commits{/sha}","git_commits_url":"https://api.github.com/repos/amfeng/runebound/git/commits{/sha}","comments_url":"https://api.github.com/repos/amfeng/runebound/comments{/number}","issue_comment_url":"https://api.github.com/repos/amfeng/runebound/issues/comments{/number}","contents_url":"https://api.github.com/repos/amfeng/runebound/contents/{+path}","compare_url":"https://api.github.com/repos/amfeng/runebound/compare/{base}...{head}","merges_url":"https://api.github.com/repos/amfeng/runebound/merges","archive_url":"https://api.github.com/repos/amfeng/runebound/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/amfeng/runebound/downloads","issues_url":"https://api.github.com/repos/amfeng/runebound/issues{/number}","pulls_url":"https://api.github.com/repos/amfeng/runebound/pulls{/number}","milestones_url":"https://api.github.com/repos/amfeng/runebound/milestones{/number}","notifications_url":"https://api.github.com/repos/amfeng/runebound/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/amfeng/runebound/labels{/name}","releases_url":"https://api.github.com/repos/amfeng/runebound/releases{/id}","created_at":"2015-01-12T02:04:37Z","updated_at":"2015-02-22T20:34:08Z","pushed_at":"2015-07-25T02:01:06Z","git_url":"git://github.com/amfeng/runebound.git","ssh_url":"git@github.com:amfeng/runebound.git","clone_url":"https://github.com/amfeng/runebound.git","svn_url":"https://github.com/amfeng/runebound","homepage":null,"size":6596,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":16,"forks":0,"open_issues":16,"watchers":1,"default_branch":"master"}},"base":{"label":"amfeng:master","ref":"master","sha":"6a96dc0b63d879491360578589dab2e8b76afd5e","user":{"login":"amfeng","id":286015,"avatar_url":"https://avatars.githubusercontent.com/u/286015?v=3","gravatar_id":"","url":"https://api.github.com/users/amfeng","html_url":"https://github.com/amfeng","followers_url":"https://api.github.com/users/amfeng/followers","following_url":"https://api.github.com/users/amfeng/following{/other_user}","gists_url":"https://api.github.com/users/amfeng/gists{/gist_id}","starred_url":"https://api.github.com/users/amfeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amfeng/subscriptions","organizations_url":"https://api.github.com/users/amfeng/orgs","repos_url":"https://api.github.com/users/amfeng/repos","events_url":"https://api.github.com/users/amfeng/events{/privacy}","received_events_url":"https://api.github.com/users/amfeng/received_events","type":"User","site_admin":false},"repo":{"id":29114259,"name":"runebound","full_name":"amfeng/runebound","owner":{"login":"amfeng","id":286015,"avatar_url":"https://avatars.githubusercontent.com/u/286015?v=3","gravatar_id":"","url":"https://api.github.com/users/amfeng","html_url":"https://github.com/amfeng","followers_url":"https://api.github.com/users/amfeng/followers","following_url":"https://api.github.com/users/amfeng/following{/other_user}","gists_url":"https://api.github.com/users/amfeng/gists{/gist_id}","starred_url":"https://api.github.com/users/amfeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amfeng/subscriptions","organizations_url":"https://api.github.com/users/amfeng/orgs","repos_url":"https://api.github.com/users/amfeng/repos","events_url":"https://api.github.com/users/amfeng/events{/privacy}","received_events_url":"https://api.github.com/users/amfeng/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/amfeng/runebound","description":"","fork":false,"url":"https://api.github.com/repos/amfeng/runebound","forks_url":"https://api.github.com/repos/amfeng/runebound/forks","keys_url":"https://api.github.com/repos/amfeng/runebound/keys{/key_id}","collaborators_url":"https://api.github.com/repos/amfeng/runebound/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/amfeng/runebound/teams","hooks_url":"https://api.github.com/repos/amfeng/runebound/hooks","issue_events_url":"https://api.github.com/repos/amfeng/runebound/issues/events{/number}","events_url":"https://api.github.com/repos/amfeng/runebound/events","assignees_url":"https://api.github.com/repos/amfeng/runebound/assignees{/user}","branches_url":"https://api.github.com/repos/amfeng/runebound/branches{/branch}","tags_url":"https://api.github.com/repos/amfeng/runebound/tags","blobs_url":"https://api.github.com/repos/amfeng/runebound/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/amfeng/runebound/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/amfeng/runebound/git/refs{/sha}","trees_url":"https://api.github.com/repos/amfeng/runebound/git/trees{/sha}","statuses_url":"https://api.github.com/repos/amfeng/runebound/statuses/{sha}","languages_url":"https://api.github.com/repos/amfeng/runebound/languages","stargazers_url":"https://api.github.com/repos/amfeng/runebound/stargazers","contributors_url":"https://api.github.com/repos/amfeng/runebound/contributors","subscribers_url":"https://api.github.com/repos/amfeng/runebound/subscribers","subscription_url":"https://api.github.com/repos/amfeng/runebound/subscription","commits_url":"https://api.github.com/repos/amfeng/runebound/commits{/sha}","git_commits_url":"https://api.github.com/repos/amfeng/runebound/git/commits{/sha}","comments_url":"https://api.github.com/repos/amfeng/runebound/comments{/number}","issue_comment_url":"https://api.github.com/repos/amfeng/runebound/issues/comments{/number}","contents_url":"https://api.github.com/repos/amfeng/runebound/contents/{+path}","compare_url":"https://api.github.com/repos/amfeng/runebound/compare/{base}...{head}","merges_url":"https://api.github.com/repos/amfeng/runebound/merges","archive_url":"https://api.github.com/repos/amfeng/runebound/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/amfeng/runebound/downloads","issues_url":"https://api.github.com/repos/amfeng/runebound/issues{/number}","pulls_url":"https://api.github.com/repos/amfeng/runebound/pulls{/number}","milestones_url":"https://api.github.com/repos/amfeng/runebound/milestones{/number}","notifications_url":"https://api.github.com/repos/amfeng/runebound/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/amfeng/runebound/labels{/name}","releases_url":"https://api.github.com/repos/amfeng/runebound/releases{/id}","created_at":"2015-01-12T02:04:37Z","updated_at":"2015-02-22T20:34:08Z","pushed_at":"2015-07-25T02:01:06Z","git_url":"git://github.com/amfeng/runebound.git","ssh_url":"git@github.com:amfeng/runebound.git","clone_url":"https://github.com/amfeng/runebound.git","svn_url":"https://github.com/amfeng/runebound","homepage":null,"size":6596,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":16,"forks":0,"open_issues":16,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/amfeng/runebound/pulls/34"},"html":{"href":"https://github.com/amfeng/runebound/pull/34"},"issue":{"href":"https://api.github.com/repos/amfeng/runebound/issues/34"},"comments":{"href":"https://api.github.com/repos/amfeng/runebound/issues/34/comments"},"review_comments":{"href":"https://api.github.com/repos/amfeng/runebound/pulls/34/comments"},"review_comment":{"href":"https://api.github.com/repos/amfeng/runebound/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/amfeng/runebound/pulls/34/commits"},"statuses":{"href":"https://api.github.com/repos/amfeng/runebound/statuses/f57ae33f7f67fc8b1b94253040e7eaca9acdae4d"}}}}