回答編集履歴
2
修正
answer
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
if($this->plugin->game->$hp_key==0){$teams_has_zero_hp[$color]=$this->$color;}
|
9
9
|
}
|
10
10
|
if(empty($teams_has_zero_hp)){return null;}
|
11
|
-
return array_keys($teams_has_zero_hp ,min($teams_has_zero_hp))
|
11
|
+
return array_keys($teams_has_zero_hp ,min($teams_has_zero_hp));
|
12
12
|
}
|
13
13
|
```
|
14
14
|
|
1
修正
answer
CHANGED
@@ -5,13 +5,17 @@
|
|
5
5
|
public function getMinTeam(){
|
6
6
|
$teams_has_zero_hp=[];
|
7
7
|
foreach(['red'=>'rhp','green'=>'ghp','blue'=>'bhp','yellow'=>'yhp'] as $color=>$hp_key){
|
8
|
-
if($this->plugin->game->$hp_key==0){$teams_has_zero_hp[]=$this->$color;}
|
8
|
+
if($this->plugin->game->$hp_key==0){$teams_has_zero_hp[$color]=$this->$color;}
|
9
9
|
}
|
10
|
-
if(
|
10
|
+
if(empty($teams_has_zero_hp)){return null;}
|
11
|
-
return min($teams_has_zero_hp);
|
11
|
+
return array_keys($teams_has_zero_hp ,min($teams_has_zero_hp))[0];
|
12
12
|
}
|
13
13
|
```
|
14
14
|
|
15
15
|
お節介なことを言うと、チームのクラスを作って
|
16
16
|
ゲームクラスは各々のチームをプロパティで持つんじゃなく
|
17
|
-
配列でチームの情報をまとめて持った方が取り回しがいいと思う
|
17
|
+
配列でチームの情報をまとめて持った方が取り回しがいいと思う
|
18
|
+
|
19
|
+
---
|
20
|
+
|
21
|
+
仕様を読み違えてたので修正
|