File tree Expand file tree Collapse file tree 9 files changed +95
-89
lines changed Expand file tree Collapse file tree 9 files changed +95
-89
lines changed Original file line number Diff line number Diff line change 1- C:30:"PHPUnit\Runner\TestResultCache":680 :{a:2:{s:7:"defects";a:9:{s:7:"Warning";i:6;s:17:"HeroTest::testOne";i:3;s:18:"HeroTest::testHero";i:4;s:31:"GameTest::testFirstTurnFunction";i:4;s:28:"GameTest::testSkillsFunction";i:3 ;s:26:"GameTest::testLogsMessages";i:4;s:24:"HeroTest::testHeroUpdate";i:4;s:21:"MonsterTest::testHero";i:4;s:27:"MonsterTest::testHeroUpdate";i:4;}s:5:"times";a:9:{s:7:"Warning";d:0.008;s:17:"HeroTest::testOne";d:0.008;s:18:"HeroTest::testHero";d:0.001;s:24:"HeroTest::testHeroUpdate";d:0;s:31:"GameTest::testFirstTurnFunction";d:0.044 ;s:28:"GameTest::testSkillsFunction";d:0.009;s:26:"GameTest::testLogsMessages";d:0.019 ;s:21:"MonsterTest::testHero";d:0;s:27:"MonsterTest::testHeroUpdate";d:0;}}}
1+ C:30:"PHPUnit\Runner\TestResultCache":679 :{a:2:{s:7:"defects";a:9:{s:7:"Warning";i:6;s:17:"HeroTest::testOne";i:3;s:18:"HeroTest::testHero";i:4;s:31:"GameTest::testFirstTurnFunction";i:4;s:28:"GameTest::testSkillsFunction";i:4 ;s:26:"GameTest::testLogsMessages";i:4;s:24:"HeroTest::testHeroUpdate";i:4;s:21:"MonsterTest::testHero";i:4;s:27:"MonsterTest::testHeroUpdate";i:4;}s:5:"times";a:9:{s:7:"Warning";d:0.008;s:17:"HeroTest::testOne";d:0.008;s:18:"HeroTest::testHero";d:0.001;s:24:"HeroTest::testHeroUpdate";d:0;s:31:"GameTest::testFirstTurnFunction";d:0.035 ;s:28:"GameTest::testSkillsFunction";d:0.009;s:26:"GameTest::testLogsMessages";d:0.03 ;s:21:"MonsterTest::testHero";d:0;s:27:"MonsterTest::testHeroUpdate";d:0;}}}
Original file line number Diff line number Diff line change @@ -107,47 +107,5 @@ public function setStats($stats){
107107 $ this ->stats = $ stats ;
108108 }
109109
110-
111-
112110}
113-
114- class buildHeroClass extends Hero {
115-
116- public function buildHero (){
117- $ db = new DataBase ;
118- $ heroDB = $ db ->runQuery (
119- 'SELECT * FROM hero where id=1 '
120- );
121- $ statsHero = $ db ->runQuery (
122- 'SELECT *
123- FROM `attributes_max_min`
124- WHERE subject_type="hero" and subject_id= ' .$ heroDB [0 ]['id ' ]
125- );
126- $ stats = $ this ->getDBStats ($ statsHero );
127- $ this ->setId ($ heroDB [0 ]['id ' ]);
128- $ this ->setLevel ($ heroDB [0 ]['level ' ]);
129- $ this ->setExperience ($ heroDB [0 ]['experience ' ]);
130- $ this ->setName ($ heroDB [0 ]['name ' ]);
131- $ this ->setHealth ($ stats ['health ' ]);
132- $ this ->setStrength ($ stats ['strength ' ]);
133- $ this ->setDefence ($ stats ['defence ' ]);
134- $ this ->setSpeed ($ stats ['speed ' ]);
135- $ this ->setLuck ($ stats ['luck ' ]);
136- $ this ->setStats ($ statsHero );
137- return $ this ;
138- }
139-
140- public function getDBStats ($ statsHero ){
141- $ stats = [
142- 'health ' => 0 ,
143- 'strength ' => 0 ,
144- 'defence ' => 0 ,
145- 'speed ' => 0 ,
146- 'luck ' => 0 ,
147- ];
148- foreach ($ statsHero as $ stat ){
149- $ stats [$ stat ['subject_attribute ' ]] = rand ($ stat ['min ' ], $ stat ['max ' ]);
150- }
151- return $ stats ;
152- }
153- }
111+ ?>
Original file line number Diff line number Diff line change 1+ <?php
2+ class buildHeroClass extends Hero {
3+
4+ public function buildHero (){
5+ $ db = new DataBase ;
6+ $ heroDB = $ db ->runQuery (
7+ 'SELECT * FROM hero where id=1 '
8+ );
9+ $ statsHero = $ db ->runQuery (
10+ 'SELECT *
11+ FROM `attributes_max_min`
12+ WHERE subject_type="hero" and subject_id= ' .$ heroDB [0 ]['id ' ]
13+ );
14+ $ stats = $ this ->getDBStats ($ statsHero );
15+ $ this ->setId ($ heroDB [0 ]['id ' ]);
16+ $ this ->setLevel ($ heroDB [0 ]['level ' ]);
17+ $ this ->setExperience ($ heroDB [0 ]['experience ' ]);
18+ $ this ->setName ($ heroDB [0 ]['name ' ]);
19+ $ this ->setHealth ($ stats ['health ' ]);
20+ $ this ->setStrength ($ stats ['strength ' ]);
21+ $ this ->setDefence ($ stats ['defence ' ]);
22+ $ this ->setSpeed ($ stats ['speed ' ]);
23+ $ this ->setLuck ($ stats ['luck ' ]);
24+ $ this ->setStats ($ statsHero );
25+ return $ this ;
26+ }
27+
28+ public function getDBStats ($ statsHero ){
29+ $ stats = [
30+ 'health ' => 0 ,
31+ 'strength ' => 0 ,
32+ 'defence ' => 0 ,
33+ 'speed ' => 0 ,
34+ 'luck ' => 0 ,
35+ ];
36+ foreach ($ statsHero as $ stat ){
37+ $ stats [$ stat ['subject_attribute ' ]] = rand ($ stat ['min ' ], $ stat ['max ' ]);
38+ }
39+ return $ stats ;
40+ }
41+ }
42+ ?>
Original file line number Diff line number Diff line change @@ -68,17 +68,14 @@ function getLevel(){
6868 return $ this ->level ;
6969 }
7070
71-
7271 function getExperience (){
7372 return $ this ->experience ;
7473 }
7574
76-
7775 function getName (){
7876 return $ this ->name ;
7977 }
8078
81-
8279 function getHealth (){
8380 return $ this ->health ;
8481 }
@@ -105,47 +102,7 @@ function getStats(){
105102
106103 function setStats ($ stats ){
107104 $ this ->stats = $ stats ;
108- }
105+ }
109106
110107}
111-
112- class buildMonsterClass {
113-
114- public function buildMonster ($ id = 1 ){
115- $ db = new DataBase ;
116- $ monsterDB = $ db ->runQuery (
117- 'SELECT * FROM monster where id= ' . $ id
118- );
119- $ statsMonster = $ db ->runQuery (
120- 'SELECT * FROM `attributes_max_min` WHERE subject_type="monster" and subject_id= ' . $ monsterDB [0 ]['id ' ]
121- );
122- $ stats = $ this ->getDBStats ($ statsMonster );
123- $ monster = new Monster (
124- $ monsterDB [0 ]['id ' ],
125- $ monsterDB [0 ]['level ' ],
126- $ monsterDB [0 ]['experience ' ],
127- $ monsterDB [0 ]['name ' ],
128- $ stats ['health ' ],
129- $ stats ['strength ' ],
130- $ stats ['defence ' ],
131- $ stats ['speed ' ],
132- $ stats ['luck ' ]
133- );
134- $ monster ->setStats ($ statsMonster );
135- return $ monster ;
136- }
137-
138- public function getDBStats ($ statsMonster ){
139- $ stats = [
140- 'health ' => 0 ,
141- 'strength ' => 0 ,
142- 'defence ' => 0 ,
143- 'speed ' => 0 ,
144- 'luck ' => 0 ,
145- ];
146- foreach ($ statsMonster as $ stat ){
147- $ stats [$ stat ['subject_attribute ' ]] = rand ($ stat ['min ' ], $ stat ['max ' ]);
148- }
149- return $ stats ;
150- }
151- }
108+ ?>
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ class buildMonsterClass {
4+
5+ public function buildMonster ($ id = 1 ){
6+ $ db = new DataBase ;
7+ $ monsterDB = $ db ->runQuery (
8+ 'SELECT * FROM monster where id= ' . $ id
9+ );
10+ $ statsMonster = $ db ->runQuery (
11+ 'SELECT * FROM `attributes_max_min` WHERE subject_type="monster" and subject_id= ' . $ monsterDB [0 ]['id ' ]
12+ );
13+ $ stats = $ this ->getDBStats ($ statsMonster );
14+ $ monster = new Monster (
15+ $ monsterDB [0 ]['id ' ],
16+ $ monsterDB [0 ]['level ' ],
17+ $ monsterDB [0 ]['experience ' ],
18+ $ monsterDB [0 ]['name ' ],
19+ $ stats ['health ' ],
20+ $ stats ['strength ' ],
21+ $ stats ['defence ' ],
22+ $ stats ['speed ' ],
23+ $ stats ['luck ' ]
24+ );
25+ $ monster ->setStats ($ statsMonster );
26+ return $ monster ;
27+ }
28+
29+ public function getDBStats ($ statsMonster ){
30+ $ stats = [
31+ 'health ' => 0 ,
32+ 'strength ' => 0 ,
33+ 'defence ' => 0 ,
34+ 'speed ' => 0 ,
35+ 'luck ' => 0 ,
36+ ];
37+ foreach ($ statsMonster as $ stat ){
38+ $ stats [$ stat ['subject_attribute ' ]] = rand ($ stat ['min ' ], $ stat ['max ' ]);
39+ }
40+ return $ stats ;
41+ }
42+ }
43+ ?>
Original file line number Diff line number Diff line change 22<?php
33include 'class/database.php ' ;
44include 'class/hero.php ' ;
5+ include 'class/heroBuild.php ' ;
56include 'class/monster.php ' ;
7+ include 'class/monsterBuild.php ' ;
68include 'class/gameEngineClass.php ' ;
79include 'class/logger.php ' ;
810session_start ();
Original file line number Diff line number Diff line change 22
33include_once 'class/database.php ' ;
44include_once 'class/hero.php ' ;
5+ include_once 'class/heroBuild.php ' ;
56include_once 'class/monster.php ' ;
7+ include_once 'class/monsterBuild.php ' ;
68include_once 'class/gameEngineClass.php ' ;
79include_once 'class/logger.php ' ;
810
Original file line number Diff line number Diff line change 11<?php
22
33include_once 'class/hero.php ' ;
4+ include_once 'class/heroBuild.php ' ;
45
56use PHPUnit \Framework \TestCase ;
67
Original file line number Diff line number Diff line change 11<?php
22
33include_once 'class/monster.php ' ;
4+ include_once 'class/monsterBuild.php ' ;
45
56use PHPUnit \Framework \TestCase ;
67
You can’t perform that action at this time.
0 commit comments