• R/O
  • SSH
  • HTTPS

jinrousiki: Commit


Commit MetaInfo

Revision2322 (tree)
Time2019-02-03 16:06:33
Authorumethyl

Log Message

ArrayFilter::CountKey()

Change Summary

Incremental Difference

--- trunk/dev/test/data/vote_target_night.php (revision 2321)
+++ trunk/dev/test/data/vote_target_night.php (revision 2322)
@@ -63,6 +63,7 @@
6363 //['user_no' => 14, RequestDataVote::TARGET => 18, 'type' => VoteAction::CHILD_FOX],
6464 //['user_no' => 14, RequestDataVote::TARGET => 13, 'type' => VoteAction::VOODOO_KILLER],
6565 //['user_no' => 14, RequestDataVote::TARGET => 5, 'type' => VoteAction::JAMMER],
66+ //['user_no' => 15, RequestDataVote::TARGET => 6, 'type' => VoteAction::POSSESSED],
6667 //['user_no' => 16, RequestDataVote::TARGET => '11 6 1 2 3 4 5', 'type' => VoteAction::STEP_MAGE],
6768 //['user_no' => 17, RequestDataVote::TARGET => 22, 'type' => VoteAction::FAIRY],
6869 //['user_no' => 18, RequestDataVote::TARGET => 20, 'type' => VoteAction::VOODOO_FOX],
--- trunk/include/functions.php (revision 2321)
+++ trunk/include/functions.php (revision 2322)
@@ -527,6 +527,11 @@
527527 return self::Concat($list, ',');
528528 }
529529
530+ //カウント
531+ public static function CountKey(array $list, $key = null) {
532+ return count(self::GetKeyList($list, $key));
533+ }
534+
530535 /* 更新系 */
531536 //初期化
532537 public static function Initialize(array &$list, $target, $value = []) {
--- trunk/include/role/holy_priest.php (revision 2321)
+++ trunk/include/role/holy_priest.php (revision 2322)
@@ -7,11 +7,11 @@
77 RoleLoader::LoadFile('priest');
88 class Role_holy_priest extends Role_priest {
99 protected function IgnoreResult() {
10- return ! DB::$ROOM->IsDate(5);
10+ return false === DB::$ROOM->IsDate(5);
1111 }
1212
1313 protected function IgnoreSetPriest() {
14- return ! DB::$ROOM->IsDate(4);
14+ return false === DB::$ROOM->IsDate(4);
1515 }
1616
1717 protected function IsAggregatePriestCamp() {
@@ -33,7 +33,7 @@
3333 }
3434 //Text::p($stack, "◆Camp [{$this->role}]");
3535
36- DB::$ROOM->ResultAbility($result, count(array_keys($stack)), null, $user->id);
36+ DB::$ROOM->ResultAbility($result, ArrayFilter::CountKey($stack), null, $user->id);
3737 }
3838 }
3939 }
--- trunk/include/role/possessed_mad.php (revision 2321)
+++ trunk/include/role/possessed_mad.php (revision 2322)
@@ -22,7 +22,7 @@
2222
2323 protected function OutputAddResult() {
2424 RoleHTML::OutputPossessed();
25- if (! $this->IgnoreFilterVoteDo()) {
25+ if (false === $this->IgnoreFilterVoteDo()) {
2626 RoleHTML::OutputAbilityResult('ability_possessed_mad', null);
2727 }
2828 }
@@ -58,7 +58,7 @@
5858 }
5959
6060 protected function IsVoteCheckboxLive($live) {
61- return ! $live;
61+ return false === $live;
6262 }
6363
6464 protected function IgnoreVoteCheckboxDummyBoy() {
@@ -66,7 +66,7 @@
6666 }
6767
6868 protected function IgnoreFinishVote() {
69- return ! $this->IsAddVote();
69+ return false === $this->IsAddVote();
7070 }
7171
7272 //死者憑依情報セット
@@ -80,7 +80,7 @@
8080 return false;
8181 } elseif (RoleUser::LimitedPossessed($user)) {
8282 return false;
83- } elseif (! $user->IsSame($user->GetReal())) {
83+ } elseif (false === $user->IsSame($user->GetReal())) {
8484 return false;
8585 }
8686 $this->AddStack($user->id, 'possessed_dead');
@@ -95,7 +95,7 @@
9595 final public function SetPossessed() {
9696 $stack = $this->GetStack('possessed_dead');
9797 foreach ($stack as $id => $target_id) {
98- if (count(array_keys($stack, $target_id)) == 1) { //競合判定
98+ if (ArrayFilter::CountKey($stack, $target_id) == 1) { //競合判定
9999 $this->AddStack($target_id, RoleVoteSuccess::POSSESSED, $id);
100100 }
101101 }
Show on old repository browser