• R/O
  • SSH
  • HTTPS

jinrousiki: Commit


Commit MetaInfo

Revision2323 (tree)
Time2019-02-03 17:07:35
Authorumethyl

Log Message

ArrayFilter::AddMerge()

Change Summary

Incremental Difference

--- trunk/include/database/db_class.php (revision 2322)
+++ trunk/include/database/db_class.php (revision 2323)
@@ -830,7 +830,7 @@
830830 //プロパティ格納
831831 private function Store($key, array $list) {
832832 if (count($this->$key) > 0) {
833- ArrayFilter::Merge($this->$key, $list);
833+ ArrayFilter::AddMerge($this->$key, $list);
834834 } else {
835835 $this->$key = $list;
836836 }
--- trunk/include/database/talk_db_class.php (revision 2322)
+++ trunk/include/database/talk_db_class.php (revision 2323)
@@ -84,7 +84,7 @@
8484 $stack[] = RoomScene::HEAVEN;
8585 }
8686 $query->WhereIn('scene', count($stack));
87- ArrayFilter::Merge($list, $stack);
87+ ArrayFilter::AddMerge($list, $stack);
8888 break;
8989 }
9090 $query->Table($table)->Select($column);
--- trunk/include/functions.php (revision 2322)
+++ trunk/include/functions.php (revision 2323)
@@ -592,7 +592,7 @@
592592 }
593593
594594 //配列追加
595- public static function Merge(array &$list, $data) {
595+ public static function AddMerge(array &$list, $data) {
596596 if (is_array($data)) {
597597 $list = array_merge($list, $data);
598598 }
--- trunk/include/game_vote_functions.php (revision 2322)
+++ trunk/include/game_vote_functions.php (revision 2323)
@@ -876,9 +876,9 @@
876876 //処理対象コマンドチェック
877877 $stack = VoteActionGroup::$init;
878878 if (DB::$ROOM->IsDate(1)) {
879- ArrayFilter::Merge($stack, VoteActionGroup::$init_first);
879+ ArrayFilter::AddMerge($stack, VoteActionGroup::$init_first);
880880 } else {
881- ArrayFilter::Merge($stack, VoteActionGroup::$init_after);
881+ ArrayFilter::AddMerge($stack, VoteActionGroup::$init_after);
882882 }
883883 $vote_data = RoleManager::GetVoteData();
884884 ArrayFilter::Initialize($vote_data, $stack);
@@ -943,7 +943,7 @@
943943
944944 $stack = VoteActionGroup::$step;
945945 if (DB::$ROOM->date > 1) {
946- ArrayFilter::Merge($stack, VoteActionGroup::$step_after);
946+ ArrayFilter::AddMerge($stack, VoteActionGroup::$step_after);
947947 }
948948
949949 $vote_data = RoleManager::GetVoteData();
@@ -954,13 +954,16 @@
954954 if (DB::$ROOM->IsDate(1)) {
955955 foreach (RoleFilterData::$step_copy as $role) { //コピー型の処理
956956 foreach (DB::$USER->GetRoleUser($role) as $user) {
957- if (! $user->IsDummyBoy()) RoleLoader::LoadMain($user)->Step();
957+ if (false === $user->IsDummyBoy()) {
958+ RoleLoader::LoadMain($user)->Step();
959+ }
958960 }
959961 }
960962 }
961963
962964 EventManager::Step(); //天候処理
963- foreach ($vote_data[VoteAction::SILENT_WOLF] as $id => $target_id) { //ステルス投票カウントアップ
965+ //ステルス投票カウントアップ
966+ foreach ($vote_data[VoteAction::SILENT_WOLF] as $id => $target_id) {
964967 DB::$USER->ByID($id)->LostAbility();
965968 }
966969 }
--- trunk/include/html/info_html_class.php (revision 2322)
+++ trunk/include/html/info_html_class.php (revision 2323)
@@ -85,7 +85,7 @@
8585 $stack = [];
8686 foreach (CastConfig::$role_list as $key => $value) {
8787 if ($key < $min) continue;
88- ArrayFilter::Merge($stack, array_keys($value));
88+ ArrayFilter::AddMerge($stack, array_keys($value));
8989 if ($key == $max) break;
9090 }
9191 $role_list = RoleDataManager::Sort(array_unique($stack)); //表示順を決定
@@ -106,7 +106,9 @@
106106 }
107107 TableHTML::OutputTr($str);
108108 if ($key == $max) break;
109- if ($key % 20 == 0) Text::Output($header);
109+ if ($key % 20 == 0) {
110+ Text::Output($header);
111+ }
110112 }
111113 TableHTML::OutputFooter(false);
112114 }
--- trunk/include/html/media/icon_html_class.php (revision 2322)
+++ trunk/include/html/media/icon_html_class.php (revision 2323)
@@ -79,7 +79,7 @@
7979 foreach ($stack as $data) {
8080 $url_option[] = URL::GetList($request, $data);
8181 }
82- ArrayFilter::Merge($list, IconDB::SetQueryIn($query, $request, $stack));
82+ ArrayFilter::AddMerge($list, IconDB::SetQueryIn($query, $request, $stack));
8383 }
8484 }
8585
@@ -86,7 +86,7 @@
8686 $stack = self::OutputSelector(RequestDataIcon::KEYWORD, IconMessage::KEYWORD);
8787 if (0 < count($stack)) {
8888 $keyword = $stack[0];
89- ArrayFilter::Merge($list, IconDB::SetQueryLike($query, $keyword));
89+ ArrayFilter::AddMerge($list, IconDB::SetQueryLike($query, $keyword));
9090 } else {
9191 $keyword = '';
9292 }
--- trunk/include/option/option_class.php (revision 2322)
+++ trunk/include/option/option_class.php (revision 2323)
@@ -51,7 +51,7 @@
5151 $stack = Cast::Stack()->Get(Cast::DELETE);
5252 foreach (OptionFilterData::$add_sub_role as $option) {
5353 if (DB::$ROOM->IsOption($option) && OptionLoader::LoadFile($option)) {
54- ArrayFilter::Merge($stack, OptionLoader::Load($option)->Cast());
54+ ArrayFilter::AddMerge($stack, OptionLoader::Load($option)->Cast());
5555 }
5656 }
5757 Cast::Stack()->Set(Cast::DELETE, $stack);
--- trunk/include/option/wish_role.php (revision 2322)
+++ trunk/include/option/wish_role.php (revision 2323)
@@ -16,7 +16,9 @@
1616 //希望役職リスト取得
1717 public function GetWishRole() {
1818 $stack = ['none'];
19- if (! DB::$ROOM->IsOption($this->name)) return $stack;
19+ if (false === DB::$ROOM->IsOption($this->name)) {
20+ return $stack;
21+ }
2022
2123 //固有判定
2224 if (DB::$ROOM->IsChaosWish()) {
@@ -30,10 +32,12 @@
3032 //普通村ベース
3133 array_push($stack, 'human', 'wolf');
3234 if (DB::$ROOM->IsQuiz()) {
33- ArrayFilter::Merge($stack, OptionLoader::Load('quiz')->GetWishRole());
35+ ArrayFilter::AddMerge($stack, OptionLoader::Load('quiz')->GetWishRole());
3436 } else {
3537 array_push($stack, 'mage', 'necromancer', 'mad', 'guard', 'common');
36- if (DB::$ROOM->IsOption('detective')) $stack[] = 'detective_common';
38+ if (DB::$ROOM->IsOption('detective')) {
39+ $stack[] = 'detective_common';
40+ }
3741 $stack[] = 'fox';
3842 }
3943
@@ -40,11 +44,11 @@
4044 //追加役職
4145 foreach (OptionFilterData::$add_wish_role as $option) {
4246 if (DB::$ROOM->IsOption($option)) {
43- ArrayFilter::Merge($stack, OptionLoader::Load($option)->GetWishRole());
47+ ArrayFilter::AddMerge($stack, OptionLoader::Load($option)->GetWishRole());
4448 }
4549 }
4650
47- if (DB::$ROOM->IsOptionGroup('mania') && ! in_array('mania', $stack)) {
51+ if (DB::$ROOM->IsOptionGroup('mania') && false === in_array('mania', $stack)) {
4852 $stack[] = 'mania';
4953 }
5054 return $stack;
--- trunk/include/role/guard.php (revision 2322)
+++ trunk/include/role/guard.php (revision 2323)
@@ -61,7 +61,7 @@
6161 final public function Guard(User $user) {
6262 $stack = []; //護衛者検出
6363 foreach (RoleLoader::LoadFilter('guard') as $filter) {
64- ArrayFilter::Merge($stack, $filter->GetGuard($user->id));
64+ ArrayFilter::AddMerge($stack, $filter->GetGuard($user->id));
6565 }
6666 //Text::p($stack, sprintf('◆List [gurad/%s]', $this->GetVoter()->uname));
6767
--- trunk/include/role/role_data_manager_class.php (revision 2322)
+++ trunk/include/role/role_data_manager_class.php (revision 2323)
@@ -123,10 +123,12 @@
123123 //表示対象サブ役職取得
124124 public static function GetDisplayList(array $list) {
125125 $stack = [];
126- if (count($list) < 1) return $stack;
126+ if (count($list) < 1) {
127+ return $stack;
128+ }
127129
128130 foreach (['real', 'virtual'] as $name) {
129- ArrayFilter::Merge($stack, RoleFilterData::${'display_' . $name});
131+ ArrayFilter::AddMerge($stack, RoleFilterData::${'display_' . $name});
130132 }
131133 //Text::p($stack, '◆SubRole');
132134
--- trunk/include/role/step_scanner.php (revision 2322)
+++ trunk/include/role/step_scanner.php (revision 2323)
@@ -45,7 +45,7 @@
4545 $max = DB::$USER->Count();
4646 $stack = [];
4747 foreach ($list as $id) {
48- ArrayFilter::Merge($stack, array_values(Position::GetChain($id, $max)));
48+ ArrayFilter::AddMerge($stack, array_values(Position::GetChain($id, $max)));
4949 }
5050
5151 $around_list = [];
@@ -58,7 +58,9 @@
5858 //確率判定
5959 $rate = min(80, count($around_list) * 10);
6060 //Text::p($rate, '◆Rate');
61- if (Lottery::Percent(100 - $rate)) return;
61+ if (Lottery::Percent(100 - $rate)) {
62+ return false;
63+ }
6264
6365 //会話能力者判定
6466 $step_flag = false;
@@ -71,6 +73,8 @@
7173 break;
7274 }
7375 }
74- if ($step_flag) $this->Step($list);
76+ if (true === $step_flag) {
77+ $this->Step($list);
78+ }
7579 }
7680 }
--- trunk/include/room_class.php (revision 2322)
+++ trunk/include/room_class.php (revision 2323)
@@ -59,7 +59,7 @@
5959 $option_role = RoomDB::Get('option_role');
6060 }
6161 $this->option_role = new OptionParser($option_role);
62- ArrayFilter::Merge($this->option_list, array_keys($this->option_role->list));
62+ ArrayFilter::AddMerge($this->option_list, array_keys($this->option_role->list));
6363 }
6464
6565 //ゲームオプションの展開処理
--- trunk/include/user_class.php (revision 2322)
+++ trunk/include/user_class.php (revision 2323)
@@ -859,6 +859,15 @@
859859 }
860860
861861 //霊界の配役公開判定
862+ /*
863+ 非公開条件
864+ ・身代わり君は判定対象外
865+ ・天人存在 (能力発動前)
866+ ・イタコ生存 (投票前)
867+ ・時間差コピー能力者 (投票前 / 能力発動前)
868+ ・蘇生能力者生存
869+ ・イタコ/口寄せシステム発動中
870+ */
862871 public function IsOpenCast() {
863872 $evoke_scanner = [];
864873 $mind_evoke = [];
@@ -866,20 +875,29 @@
866875 if ($user->IsDummyBoy()) continue;
867876
868877 if ($user->IsRole('revive_priest')) {
869- if ($user->IsActive()) return false;
878+ if ($user->IsActive()) {
879+ return false;
880+ }
870881 } elseif ($user->IsRole('evoke_scanner')) {
871882 if ($user->IsLive()) {
872- if (DB::$ROOM->IsDate(1)) return false;
883+ if (DB::$ROOM->IsDate(1)) {
884+ return false;
885+ }
873886 $evoke_scanner[] = $user->id;
874887 }
875888 } elseif (RoleUser::IsDelayCopy($user)) {
876- if (DB::$ROOM->IsDate(1) || ! is_null($user->GetMainRoleTarget())) return false;
889+ //厳密には1日目の投票前に死亡した場合は公開可となるがレアケースなので対応しない
890+ if (DB::$ROOM->IsDate(1) || false === is_null($user->GetMainRoleTarget())) {
891+ return false;
892+ }
877893 } elseif (RoleUser::IsRevive($user) || $user->IsRole('revive_mania')) {
878- if ($user->IsLive()) return false;
894+ if ($user->IsLive()) {
895+ return false;
896+ }
879897 }
880898
881899 if ($user->IsRole('mind_evoke')) {
882- ArrayFilter::Merge($mind_evoke, $user->GetPartner('mind_evoke'));
900+ ArrayFilter::AddMerge($mind_evoke, $user->GetPartner('mind_evoke'));
883901 }
884902 }
885903 return count(array_intersect($evoke_scanner, $mind_evoke)) < 1;
Show on old repository browser