GitHub PullRequestReviewCommentEvent at 2014-02-01 08:08:17
Repository: endofcodes
Actor: VitSalis
Payload: {"comment":{"url":"https://api.github.com/repos/dionyziz/endofcodes/pulls/comments/9364979","id":9364979,"diff_hunk":"@@ -71,5 +72,54 @@ public function genesis() {\n                 }\n             }\n         }\n+\n+        public function nextRound() {\n+            include_once 'models/resolution.php';\n+            $roundid = count( $this->rounds );\n+            $this->rounds[ $roundid ] = new Round( $this->rounds[ $roundid - 1 ] );\n+            $this->rounds[ $roundid ]->id = $roundid;\n+            $currentRound = $this->rounds[ $roundid ];\n+            foreach ( $currentRound->creatures as $creature ) { \n+                if ( $creature->alive && $creature->intent->action === ACTION_ATACK ) {\n+                    creatureAttack( $creature );\n+                }\n+            }\n+            foreach ( $currentRound->creatures as $creature ) { \n+                if ( $creature->alive && $creature->intent->action === ACTION_MOVE ) {\n+                    creatureMove( $creature );\n+                }\n+            }\n+            foreach ( $currentRound->creatures as $creature ) {\n+                if ( $creature->hp === 0 ) {\n+                    $creature->alive = false;\n+                }\n+            }\n+            $creatureLocation = array( array( array() ) );\n+            foreach ( $currentRound->creatures as $creature ) {\n+                if ( $creature->alive ) {\n+                    $creatureLocation[ $creature->locationx ][ $creature->locationy ][] = $creature;\n+                }\n+            }\n+            $finished = false;\n+            while ( !$finished ) {\n+                $finished = true;\n+                for ( $i = 0; $i < $this->width; ++$i ) {\n+                    for ( $j = 0; $j < $this->height; ++$j ) {\n+                        if ( isset( $creatureLocation[ $i ][ $j ] ) && count( $creatureLocation[ $i ][ $j ] ) > 1 ) {\n+                            $finished = false;\n+                            foreach ( $creatureLocation[ $i ][ $j ] as $key => $creature ) {\n+                                $prevCreature = $this->rounds[ $roundid - 1 ]->creatures[ $creature->id ];","path":"models/game.php","position":57,"original_position":57,"commit_id":"41cc12eef3bcc46c3fdb86d86187514da9f13e3f","original_commit_id":"41cc12eef3bcc46c3fdb86d86187514da9f13e3f","user":{"login":"VitSalis","id":1957592,"avatar_url":"https://gravatar.com/avatar/8ae1e5b3c4d1df49c17ebefcc25f9dc2?d=https%3A%2F%2Fidenticons.github.com%2Ff20394f1d7664b1019b4435467394a2b.png&r=x","gravatar_id":"8ae1e5b3c4d1df49c17ebefcc25f9dc2","url":"https://api.github.com/users/VitSalis","html_url":"https://github.com/VitSalis","followers_url":"https://api.github.com/users/VitSalis/followers","following_url":"https://api.github.com/users/VitSalis/following{/other_user}","gists_url":"https://api.github.com/users/VitSalis/gists{/gist_id}","starred_url":"https://api.github.com/users/VitSalis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VitSalis/subscriptions","organizations_url":"https://api.github.com/users/VitSalis/orgs","repos_url":"https://api.github.com/users/VitSalis/repos","events_url":"https://api.github.com/users/VitSalis/events{/privacy}","received_events_url":"https://api.github.com/users/VitSalis/received_events","type":"User","site_admin":false},"body":"No, $creature holds the value of creature from this round, the one has moved, lost hp etc.. $prevCreature holds the value of the creature of the previous round.","created_at":"2014-02-01T08:08:17Z","updated_at":"2014-02-01T08:08:17Z","html_url":"https://github.com/dionyziz/endofcodes/pull/24#discussion_r9364979","pull_request_url":"https://api.github.com/repos/dionyziz/endofcodes/pulls/24","_links":{"self":{"href":"https://api.github.com/repos/dionyziz/endofcodes/pulls/comments/9364979"},"html":{"href":"https://github.com/dionyziz/endofcodes/pull/24#discussion_r9364979"},"pull_request":{"href":"https://api.github.com/repos/dionyziz/endofcodes/pulls/24"}}}}