• R/O
  • SSH
  • HTTPS

jinrousiki: Commit


Commit MetaInfo

Revision2414 (tree)
Time2019-11-06 03:07:39
Authorumethyl

Log Message

Role_mage:最適化

Change Summary

Incremental Difference

--- trunk/include/role/black_wisp.php (revision 2413)
+++ trunk/include/role/black_wisp.php (revision 2414)
@@ -7,6 +7,6 @@
77 RoleLoader::LoadFile('wisp');
88 class Role_black_wisp extends Role_wisp {
99 protected function GetWispRole($reverse) {
10- return $reverse ? 'human' : 'wolf';
10+ return (true === $reverse) ? 'human' : 'wolf';
1111 }
1212 }
--- trunk/include/role/critical_mage.php (revision 2413)
+++ trunk/include/role/critical_mage.php (revision 2414)
@@ -7,7 +7,7 @@
77 RoleLoader::LoadFile('mage');
88 class Role_critical_mage extends Role_mage {
99 protected function MageAction(User $user) {
10- if ($user->IsLive(true) && ! RoleUser::IsAvoid($user)) {
10+ if ($user->IsLive(true) && false === RoleUser::IsAvoid($user)) {
1111 $user->AddRole('critical_luck');
1212 }
1313 }
--- trunk/include/role/emerald_fox.php (revision 2413)
+++ trunk/include/role/emerald_fox.php (revision 2414)
@@ -2,7 +2,7 @@
22 /*
33 ◆翠狐 (emerald_fox)
44 ○仕様
5- ・占い:共鳴者付加
5+ ・占い:共鳴者付加 (念話できない妖狐カウント)
66 */
77 RoleLoader::LoadFile('fox');
88 class Role_emerald_fox extends Role_fox {
@@ -30,8 +30,8 @@
3030 }
3131
3232 public function MageSuccess(User $user) {
33- if (! RoleUser::IsFoxCount($user) ||
34- ! ($user->IsMainGroup(CampGroup::CHILD_FOX) || RoleUser::IsLonely($user))) {
33+ if (false === RoleUser::IsFoxCount($user) ||
34+ false === ($user->IsMainGroup(CampGroup::CHILD_FOX) || RoleUser::IsLonely($user))) {
3535 return false;
3636 }
3737
--- trunk/include/role/involve_tengu.php (revision 2413)
+++ trunk/include/role/involve_tengu.php (revision 2414)
@@ -25,7 +25,9 @@
2525 //陣営情報収集
2626 $camp_list = [];
2727 foreach (DB::$USER->Get() as $user) {
28- if ($user->IsDead()) continue;
28+ if ($user->IsDead()) {
29+ continue;
30+ }
2931 $camp_list[$user->GetMainCamp($start)][] = $user->id; //キャッシュを参照しない
3032 }
3133 //Text::p($camp_list, "◆Camp/Base [{$this->role}]");
@@ -52,7 +54,9 @@
5254 $stack = [];
5355 foreach ($camp_list[$camp] as $id) {
5456 $user = DB::$USER->ByID($id);
55- if ($user->IsRole('lovers') || RoleUser::IsAvoid($user)) continue; //対象外判定
57+ if ($user->IsRole('lovers') || RoleUser::IsAvoid($user)) { //対象外判定
58+ continue;
59+ }
5660 $stack[] = $id;
5761 }
5862 //Text::p($stack, "◆Target [{$this->role}]");
--- trunk/include/role/mage.php (revision 2413)
+++ trunk/include/role/mage.php (revision 2414)
@@ -92,7 +92,7 @@
9292 if ($this->CallParent('IgnoreCursed')) {
9393 return false;
9494 } elseif (RoleUser::IsCursed($user) || $this->InStack($user->id, 'voodoo')) {
95- return ! RoleUser::GuardCurse($this->GetActor());
95+ return false === RoleUser::GuardCurse($this->GetActor());
9696 } else {
9797 return false;
9898 }
@@ -136,7 +136,9 @@
136136 } elseif ($user->IsRoleGroup('spell')) {
137137 return true;
138138 } elseif ($user->IsMainGroup(CampGroup::FOX)) {
139- return ! $user->IsRole('white_fox', 'black_fox', 'mist_fox', 'tiger_fox', 'sacrifice_fox');
139+ return false === $user->IsRole(
140+ 'white_fox', 'black_fox', 'mist_fox', 'tiger_fox', 'sacrifice_fox'
141+ );
140142 } else {
141143 return false;
142144 }
@@ -147,7 +149,9 @@
147149 foreach (RoleFilterData::$jammer_mage_result as $role) {
148150 if ($user->IsRole($role)) {
149151 $result = RoleLoader::Load($role)->GetJammerMageResult($user, $reverse);
150- if (isset($result)) return $result;
152+ if (isset($result)) {
153+ return $result;
154+ }
151155 }
152156 }
153157
@@ -157,7 +161,7 @@
157161 $user->IsRole('boss_chiroptera')) {
158162 return 'chiroptera';
159163 } else {
160- return ($this->IsMageWolf($user) xor $reverse) ? 'wolf' : 'human';
164+ return ($this->IsMageWolf($user) xor true === $reverse) ? 'wolf' : 'human';
161165 }
162166 }
163167
@@ -164,7 +168,7 @@
164168 //占い人狼判定 (人狼系 > 個別)
165169 final protected function IsMageWolf(User $user) {
166170 if ($user->IsMainGroup(CampGroup::WOLF)) {
167- return ! $user->IsRole('boss_wolf') && ! RoleUser::IsSiriusWolf($user);
171+ return false === $user->IsRole('boss_wolf') && false === RoleUser::IsSiriusWolf($user);
168172 } else {
169173 return $user->IsRole(
170174 'suspect', 'cute_mage', 'swindle_mad', 'black_fox', 'cute_chiroptera', 'cute_avenger'
@@ -202,12 +206,14 @@
202206
203207 //呪殺身代わり能力者取得
204208 final protected function GetMageKillSacrificeList() {
205- if (DB::$ROOM->IsEvent('no_sacrifice')) return []; //天候判定
209+ if (DB::$ROOM->IsEvent('no_sacrifice')) { //天候判定
210+ return [];
211+ }
206212
207213 $stack = [];
208214 foreach (RoleFilterData::$sacrifice_mage as $role) {
209215 foreach (DB::$USER->GetRoleUser($role) as $target) {
210- if ($target->IsLive(true) && ! RoleUser::IsAvoidLovers($target, true)) {
216+ if ($target->IsLive(true) && false === RoleUser::IsAvoidLovers($target, true)) {
211217 $stack[] = $target->id;
212218 }
213219 }
--- trunk/include/role/meteor_tengu.php (revision 2413)
+++ trunk/include/role/meteor_tengu.php (revision 2414)
@@ -7,7 +7,7 @@
77 RoleLoader::LoadFile('tengu');
88 class Role_meteor_tengu extends Role_tengu {
99 protected function TenguKill(User $user) {
10- if (! RoleUser::IsAvoid($user)) {
10+ if (false === RoleUser::IsAvoid($user)) {
1111 DB::$USER->Kill($user->id, DeadReason::TENGU_KILLED);
1212 }
1313 }
--- trunk/include/role/psycho_mage.php (revision 2413)
+++ trunk/include/role/psycho_mage.php (revision 2414)
@@ -24,7 +24,7 @@
2424 if ($user->IsMainCamp(Camp::OGRE) || $user->IsMainCamp(Camp::LOVERS)) {
2525 return $user->DistinguishCamp();
2626 } elseif ($user->IsMainGroup(CampGroup::MAD)) {
27- return $this->GetLiarResult(! $user->IsRole('swindle_mad'));
27+ return $this->GetLiarResult(false === $user->IsRole('swindle_mad'));
2828 } elseif ($user->IsMainGroup(CampGroup::DEPRAVER) || $user->IsRoleGroup('dummy')) {
2929 return $this->GetLiarResult(true);
3030 } else {
@@ -39,6 +39,6 @@
3939
4040 //精神判定結果取得
4141 private function GetLiarResult($flag) {
42- return $flag ? 'psycho_mage_liar' : 'psycho_mage_normal';
42+ return (true === $flag) ? 'psycho_mage_liar' : 'psycho_mage_normal';
4343 }
4444 }
--- trunk/include/role/role_class.php (revision 2413)
+++ trunk/include/role/role_class.php (revision 2414)
@@ -828,10 +828,10 @@
828828
829829 //-- 投票集計処理 (夜) --//
830830 //成功データ追加
831- final protected function AddSuccess($target, $data = null, $null = false) {
831+ final protected function AddSuccess($target, $data = null, $set_null = false) {
832832 $name = is_null($data) ? $this->role : $data;
833833 $stack = RoleManager::Stack()->Get($name);
834- $stack[$target] = (true === $null) ? null : true;
834+ $stack[$target] = (true === $set_null) ? null : true;
835835 RoleManager::Stack()->Set($name, $stack);
836836 }
837837
--- trunk/include/role/role_user_class.php (revision 2413)
+++ trunk/include/role/role_user_class.php (revision 2414)
@@ -324,7 +324,7 @@
324324 }
325325 }
326326
327- if ($curse) {
327+ if (true === $curse) {
328328 DB::$USER->Kill($user->id, DeadReason::CURSED);
329329 }
330330 return false;
--- trunk/include/role/sheep_wisp.php (revision 2413)
+++ trunk/include/role/sheep_wisp.php (revision 2414)
@@ -16,6 +16,6 @@
1616 }
1717
1818 protected function GetWispRole($reverse) {
19- return $reverse ? 'wolf' : 'human';
19+ return (true === $reverse) ? 'wolf' : 'human';
2020 }
2121 }
--- trunk/include/role/tengu.php (revision 2413)
+++ trunk/include/role/tengu.php (revision 2414)
@@ -92,19 +92,25 @@
9292 }
9393
9494 public function Mage(User $user) {
95- if ($this->IsJammer($user) || $this->IsCursed($user)) return false;
95+ if ($this->IsJammer($user) || $this->IsCursed($user)) {
96+ return false;
97+ }
9698 $this->GetMageResult($user);
9799 }
98100
99101 protected function GetMageResult(User $user) {
100- if ($this->IgnoreTenguTarget($user)) return false;
101- if (! Lottery::Percent($this->GetTenguMageRate($user))) return false;
102+ if ($this->IgnoreTenguTarget($user)) {
103+ return false;
104+ }
105+ if (false === Lottery::Percent($this->GetTenguMageRate($user))) {
106+ return false;
107+ }
102108 $this->TenguKill($user);
103109 }
104110
105111 //神通力発動対象外判定
106112 protected function IgnoreTenguTarget(User $user) {
107- return ! $user->IsMainGroup(
113+ return false === $user->IsMainGroup(
108114 CampGroup::GUARD, CampGroup::ASSASSIN, CampGroup::WOLF, CampGroup::CHILD_FOX
109115 );
110116 }
--- trunk/include/role/tengu_spell_wisp.php (revision 2413)
+++ trunk/include/role/tengu_spell_wisp.php (revision 2414)
@@ -7,6 +7,6 @@
77 RoleLoader::LoadFile('wisp');
88 class Role_tengu_spell_wisp extends Role_wisp {
99 protected function GetWispRole($reverse) {
10- return $reverse ? 'human' : 'wolf';
10+ return (true === $reverse) ? 'human' : 'wolf';
1111 }
1212 }
Show on old repository browser