• R/O
  • SSH
  • HTTPS

jinrousiki: コミット


コミットメタ情報

リビジョン1961 (tree)
日時2017-04-14 22:20:51
作者umethyl

ログメッセージ

Role_poison:スコープ調整

変更サマリ

差分

--- trunk/include/role/poison_guard.php (revision 1960)
+++ trunk/include/role/poison_guard.php (revision 1961)
@@ -7,11 +7,11 @@
77 */
88 RoleLoader::LoadFile('guard');
99 class Role_poison_guard extends Role_guard {
10+ public function IsPoison() {
11+ return DB::$ROOM->IsNight();
12+ }
13+
1014 public function IgnoreGuard(User $user) {
1115 return null;
1216 }
13-
14- public function IsPoison() {
15- return DB::$ROOM->IsNight();
16- }
1717 }
--- trunk/include/role/snipe_poison.php (revision 1960)
+++ trunk/include/role/snipe_poison.php (revision 1961)
@@ -6,7 +6,7 @@
66 */
77 RoleLoader::LoadFile('poison');
88 class Role_snipe_poison extends Role_poison {
9- public function IsPoisonTarget(User $user) {
9+ protected function IsPoisonTarget(User $user) {
1010 $target = $this->GetVoteUser();
1111 return $user->IsCamp($target->GetCamp(true), true) && ! RoleUser::IsAvoidLovers($target, true);
1212 }
--- trunk/include/role/poison.php (revision 1960)
+++ trunk/include/role/poison.php (revision 1961)
@@ -17,11 +17,12 @@
1717 foreach ($list as $uname) {
1818 $user = DB::$USER->ByRealUname($uname);
1919 if ($user->IsDead(true) || $this->IsAvoidPoison($user)) continue;
20+
2021 if ($this->CallParent('IsPoisonTarget', $user)) {
2122 if ($user->IsRole('aspirator')) { //吸毒者判定
2223 $aspirator[] = $user->id;
2324 } else {
24- $stack[] = $user->id;
25+ $stack[] = $user->id;
2526 }
2627 }
2728 }
@@ -28,13 +29,18 @@
2829 return count($aspirator) > 0 ? $aspirator : $stack;
2930 }
3031
32+ //毒回避判定
33+ private function IsAvoidPoison(User $user) {
34+ return $user->IsRole(RoleFilterData::$avoid_poison) || RoleUser::IsAvoid($user, true);
35+ }
36+
3137 //毒対象者判定
32- public function IsPoisonTarget(User $user) {
38+ protected function IsPoisonTarget(User $user) {
3339 return true;
3440 }
3541
36- //毒回避判定
37- private function IsAvoidPoison(User $user) {
38- return $user->IsRole(RoleFilterData::$avoid_poison) || RoleUser::IsAvoid($user, true);
42+ //人狼襲撃毒死無効判定
43+ final public function IgnorePoisonEat(User $user) {
44+ return ! $this->CallParent('IsPoisonTarget', $user);
3945 }
4046 }
--- trunk/include/role/poison_vampire.php (revision 1960)
+++ trunk/include/role/poison_vampire.php (revision 1961)
@@ -8,7 +8,7 @@
88 class Role_poison_vampire extends Role_vampire {
99 public $mix_in = array('poison');
1010
11- public function IsPoisonTarget(User $user) {
11+ protected function IsPoisonTarget(User $user) {
1212 return $user->IsRole('psycho_infected') || $user->IsPartner('infected', $this->GetID());
1313 }
1414 }
--- trunk/include/role/poison_jealousy.php (revision 1960)
+++ trunk/include/role/poison_jealousy.php (revision 1961)
@@ -8,7 +8,7 @@
88 public $mix_in = array('poison');
99 public $display_role = 'poison';
1010
11- public function IsPoisonTarget(User $user) {
11+ protected function IsPoisonTarget(User $user) {
1212 return $user->IsRole('lovers');
1313 }
1414 }
--- trunk/include/role/incubate_poison.php (revision 1960)
+++ trunk/include/role/incubate_poison.php (revision 1961)
@@ -19,7 +19,7 @@
1919 return DB::$ROOM->date > 4;
2020 }
2121
22- public function IsPoisonTarget(User $user) {
22+ protected function IsPoisonTarget(User $user) {
2323 return RoleUser::IsInhuman($user);
2424 }
2525 }
--- trunk/include/role/poison_wolf.php (revision 1960)
+++ trunk/include/role/poison_wolf.php (revision 1961)
@@ -8,7 +8,7 @@
88 class Role_poison_wolf extends Role_wolf {
99 public $mix_in = array('poison');
1010
11- public function IsPoisonTarget(User $user) {
11+ protected function IsPoisonTarget(User $user) {
1212 return ! $user->IsMainGroup(CampGroup::WOLF);
1313 }
1414 }
--- trunk/include/role/wolf.php (revision 1960)
+++ trunk/include/role/wolf.php (revision 1961)
@@ -170,7 +170,7 @@
170170
171171 //襲撃毒死回避判定
172172 foreach (RoleLoader::LoadUser($target, 'avoid_poison_eat') as $filter) {
173- if (! $filter->IsPoisonTarget($poison_target)) return;
173+ if ($filter->IgnorePoisonEat($poison_target)) return;
174174 }
175175 RoleLoader::LoadMain($poison_target)->PoisonDead(); //毒死処理
176176 }
--- trunk/include/role/poison_avenger.php (revision 1960)
+++ trunk/include/role/poison_avenger.php (revision 1961)
@@ -8,7 +8,7 @@
88 class Role_poison_avenger extends Role_avenger {
99 public $mix_in = array('poison');
1010
11- public function IsPoisonTarget(User $user) {
11+ protected function IsPoisonTarget(User $user) {
1212 return RoleUser::IsInhuman($user) || $user->IsPartner($this->GetPartnerRole(), $this->GetID());
1313 }
1414 }
--- trunk/include/role/poison_ogre.php (revision 1960)
+++ trunk/include/role/poison_ogre.php (revision 1961)
@@ -12,6 +12,10 @@
1212 public $mix_in = array('poison');
1313 public $reduce_rate = 3;
1414
15+ protected function IsPoisonTarget(User $user) {
16+ return RoleUser::IsInhuman($user) || $user->IsMainCamp(Camp::OGRE);
17+ }
18+
1519 protected function IgnoreAssassin(User $user) {
1620 return $user->IsRole('quiz');
1721 }
@@ -20,10 +24,6 @@
2024 $user->AddRole('panelist');
2125 }
2226
23- public function IsPoisonTarget(User $user) {
24- return RoleUser::IsInhuman($user) || $user->IsMainCamp(Camp::OGRE);
25- }
26-
2727 public function Win($winner) {
2828 return $winner == 'quiz' || $this->IsActorLive();
2929 }
--- trunk/include/role/poison_fox.php (revision 1960)
+++ trunk/include/role/poison_fox.php (revision 1961)
@@ -9,11 +9,11 @@
99 class Role_poison_fox extends Role_fox {
1010 public $mix_in = array('poison');
1111
12+ protected function IsPoisonTarget(User $user) {
13+ return ! RoleUser::IsFoxCount($user);
14+ }
15+
1216 public function IsResistWolf() {
1317 return false;
1418 }
15-
16- public function IsPoisonTarget(User $user) {
17- return ! RoleUser::IsFoxCount($user);
18- }
1919 }
--- trunk/include/role/poison_doll.php (revision 1960)
+++ trunk/include/role/poison_doll.php (revision 1961)
@@ -8,7 +8,7 @@
88 class Role_poison_doll extends Role_doll {
99 public $mix_in = array('poison');
1010
11- public function IsPoisonTarget(User $user) {
11+ protected function IsPoisonTarget(User $user) {
1212 return ! $this->IsDoll($user);
1313 }
1414 }
--- trunk/include/role/poison_chiroptera.php (revision 1960)
+++ trunk/include/role/poison_chiroptera.php (revision 1961)
@@ -7,7 +7,7 @@
77 class Role_poison_chiroptera extends Role {
88 public $mix_in = array('poison');
99
10- public function IsPoisonTarget(User $user) {
10+ protected function IsPoisonTarget(User $user) {
1111 return RoleUser::IsInhuman($user) || $user->IsMainCamp(Camp::CHIROPTERA);
1212 }
1313 }
--- trunk/include/role/strong_poison.php (revision 1960)
+++ trunk/include/role/strong_poison.php (revision 1961)
@@ -8,7 +8,7 @@
88 class Role_strong_poison extends Role_poison {
99 public $display_role = 'poison';
1010
11- public function IsPoisonTarget(User $user) {
11+ protected function IsPoisonTarget(User $user) {
1212 return RoleUser::IsInhuman($user);
1313 }
1414 }
--- trunk/include/role/dummy_poison.php (revision 1960)
+++ trunk/include/role/dummy_poison.php (revision 1961)
@@ -12,7 +12,7 @@
1212 return DB::$ROOM->IsDay();
1313 }
1414
15- public function IsPoisonTarget(User $user) {
15+ protected function IsPoisonTarget(User $user) {
1616 return RoleUser::IsDreamTarget($user);
1717 }
1818 }
--- trunk/include/role/guide_poison.php (revision 1960)
+++ trunk/include/role/guide_poison.php (revision 1961)
@@ -6,7 +6,7 @@
66 */
77 RoleLoader::LoadFile('poison');
88 class Role_guide_poison extends Role_poison {
9- public function IsPoisonTarget(User $user) {
9+ protected function IsPoisonTarget(User $user) {
1010 return $user->IsRoleGroup('poison');
1111 }
1212 }
--- trunk/include/role/alchemy_pharmacist.php (revision 1960)
+++ trunk/include/role/alchemy_pharmacist.php (revision 1961)
@@ -10,10 +10,12 @@
1010 public $mix_in = array('poison');
1111
1212 protected function SetDetoxFlag($uname) {
13- if (! $this->GetActor()->detox) $this->GetActor()->{$this->role} = true;
13+ if (! $this->GetActor()->detox) {
14+ $this->GetActor()->{$this->role} = true;
15+ }
1416 }
1517
16- public function IsPoisonTarget(User $user) {
18+ protected function IsPoisonTarget(User $user) {
1719 return ! $user->IsCamp(Camp::HUMAN);
1820 }
1921 }
旧リポジトリブラウザで表示