UserMode::POSSESSED_CANCEL
@@ -9,9 +9,10 @@ | ||
9 | 9 | |
10 | 10 | //-- 定数リスト (User/Mode) --// |
11 | 11 | class UserMode { |
12 | - const DEAD = 'dead'; | |
13 | - const SUICIDE = 'suicide'; | |
14 | - const REVIVE = 'revive'; | |
15 | - const LOST = 'lost'; | |
16 | - const POSSESSED_RESET = 'possessed_reset'; | |
12 | + const DEAD = 'dead'; | |
13 | + const SUICIDE = 'suicide'; | |
14 | + const REVIVE = 'revive'; | |
15 | + const LOST = 'lost'; | |
16 | + const POSSESSED_CANCEL = 'possessed_cancel'; | |
17 | + const POSSESSED_RESET = 'possessed_reset'; | |
17 | 18 | } |
@@ -24,7 +24,7 @@ | ||
24 | 24 | $wolf = $this->GetWolfVoter(); |
25 | 25 | if (count($stack) > 0) { |
26 | 26 | foreach ($stack as $id) { |
27 | - DB::$USER->ByID($id)->possessed_cancel = true; | |
27 | + DB::$USER->ByID($id)->Flag()->On(UserMode::POSSESSED_CANCEL); | |
28 | 28 | } |
29 | 29 | } elseif (RoleUser::IsPossessed($user) && ! $user->IsSame($user->GetVirtual())) { |
30 | 30 | if (! RoleUser::IsPossessedTarget($user)) { |
@@ -32,7 +32,7 @@ | ||
32 | 32 | } |
33 | 33 | $user->Flag()->On(UserMode::POSSESSED_RESET); |
34 | 34 | } elseif ($wolf->IsRole('possessed_wolf') && $wolf->IsSame($user)) { |
35 | - $wolf->possessed_cancel = true; | |
35 | + $wolf->Flag()->On(UserMode::POSSESSED_CANCEL); | |
36 | 36 | } else { |
37 | 37 | return; |
38 | 38 | } |
@@ -110,7 +110,9 @@ | ||
110 | 110 | //占い結果取得 (憑依キャンセル判定 → 呪殺対象判定 → 占い判定) |
111 | 111 | protected function GetMageResult(User $user) { |
112 | 112 | $this->MagePossessedCancel($user); |
113 | - if ($this->IsMageKill($user)) $this->AddStack($user->id, 'mage_kill'); | |
113 | + if ($this->IsMageKill($user)) { | |
114 | + $this->AddStack($user->id, 'mage_kill'); | |
115 | + } | |
114 | 116 | return $this->DistinguishMage($user); |
115 | 117 | } |
116 | 118 |
@@ -117,7 +119,7 @@ | ||
117 | 119 | //憑依キャンセル判定 |
118 | 120 | final protected function MagePossessedCancel(User $user) { |
119 | 121 | if (RoleUser::IsPossessedTarget($user)) { |
120 | - $user->possessed_cancel = true; | |
122 | + $user->Flag()->On(UserMode::POSSESSED_CANCEL); | |
121 | 123 | } |
122 | 124 | } |
123 | 125 |
@@ -219,7 +219,7 @@ | ||
219 | 219 | final protected function RevivePossessedCancel(User $user) { |
220 | 220 | if (RoleUser::IsPossessedTarget($user)) { |
221 | 221 | $user->Flag()->Off(UserMode::POSSESSED_RESET); |
222 | - $user->possessed_cancel = true; | |
222 | + $user->Flag()->On(UserMode::POSSESSED_CANCEL); | |
223 | 223 | } |
224 | 224 | } |
225 | 225 |
@@ -49,21 +49,23 @@ | ||
49 | 49 | $user = DB::$USER->ByID($id); //憑依者 |
50 | 50 | $target = DB::$USER->ByID($target_id); //憑依予定先 |
51 | 51 | $virtual = $user->GetVirtual(); //現在の憑依先 |
52 | - if (! isset($user->possessed_cancel)) $user->possessed_cancel = null; | |
53 | 52 | |
54 | - // 憑依成立している恋人なら、後追いが発生していないか確認する | |
55 | - if ($user->IsOff(UserMode::POSSESSED_RESET) && | |
56 | - ! $user->possessed_cancel && $user->IsRole('lovers')) { | |
53 | + //憑依成立している恋人なら、後追いが発生していないか確認する | |
54 | + if ($user->IsOff(UserMode::POSSESSED_RESET) && $user->IsOff(UserMode::POSSESSED_CANCEL) && | |
55 | + $user->IsRole('lovers')) { | |
57 | 56 | if (is_null($followed_list)) { |
58 | 57 | $followed_list = RoleLoader::Load('lovers')->Followed(false, true); |
59 | 58 | } |
60 | 59 | |
61 | - if (in_array($user->id, $followed_list)) $user->possessed_cancel = true; | |
60 | + if (in_array($user->id, $followed_list)) { | |
61 | + $user->Flag()->On(UserMode::POSSESSED_CANCEL); | |
62 | + } | |
62 | 63 | } |
63 | 64 | |
64 | - if ($user->IsDead(true)) { //憑依者死亡 | |
65 | + //憑依者死亡 > 憑依リセット > 憑依失敗 > 憑依成功 | |
66 | + if ($user->IsDead(true)) { | |
65 | 67 | if (isset($target->id)) $this->PossessedCancelWolfKill($target); |
66 | - } elseif ($user->IsOn(UserMode::POSSESSED_RESET)) { //憑依リセット | |
68 | + } elseif ($user->IsOn(UserMode::POSSESSED_RESET)) { | |
67 | 69 | if (isset($target->id)) $this->PossessedCancelWolfKill($target); |
68 | 70 | if (! $user->IsSame($virtual)) { //憑依中なら元の体に戻される |
69 | 71 | //憑依先のリセット処理 |
@@ -77,10 +79,10 @@ | ||
77 | 79 | DB::$ROOM->ResultDead($user->handle_name, DeadReason::REVIVE_SUCCESS); |
78 | 80 | } |
79 | 81 | continue; |
80 | - } elseif ($user->possessed_cancel || $target->IsOn(UserMode::REVIVE)) { //憑依失敗 | |
82 | + } elseif ($user->IsOn(UserMode::POSSESSED_CANCEL) || $target->IsOn(UserMode::REVIVE)) { | |
81 | 83 | $this->PossessedCancelWolfKill($target); |
82 | 84 | continue; |
83 | - } else { //憑依成功 | |
85 | + } else { | |
84 | 86 | if ($user->IsRole('possessed_wolf')) { |
85 | 87 | $target->Flag()->Off(UserMode::DEAD); //死亡フラグをリセット |
86 | 88 | DB::$USER->Kill($target->id, DeadReason::POSSESSED_TARGETED); //憑依先の死亡処理 |
@@ -49,11 +49,11 @@ | ||
49 | 49 | //憑依予定者が居たらキャンセル |
50 | 50 | if (array_key_exists($user->id, $this->GetStack($role))) { |
51 | 51 | $user->Flag()->Off(UserMode::POSSESSED_RESET); |
52 | - $user->possessed_cancel = true; | |
52 | + $user->Flag()->On(UserMode::POSSESSED_CANCEL); | |
53 | 53 | } elseif ($this->InStack($user->id, $role)) { |
54 | 54 | //憑依中の犬神に憑依しようとした憑狼を検出 |
55 | 55 | $stack = $this->GetStackKey($role, $user->id); |
56 | - DB::$USER->ByID($stack[0])->possessed_cancel = true; | |
56 | + DB::$USER->ByID($stack[0])->Flag()->On(UserMode::POSSESSED_CANCEL); | |
57 | 57 | } |
58 | 58 | |
59 | 59 | //特殊ケースなのでベタに処理 |
@@ -27,9 +27,10 @@ | ||
27 | 27 | } |
28 | 28 | |
29 | 29 | //-- 憑依妨害判定 --// |
30 | - if (count($stack = $this->GetStackKey('possessed', $user->id)) > 0) { | |
30 | + $stack = $this->GetStackKey('possessed', $user->id); | |
31 | + if (count($stack) > 0) { | |
31 | 32 | foreach ($stack as $id) { |
32 | - DB::$USER->ByID($id)->possessed_cancel = true; | |
33 | + DB::$USER->ByID($id)->Flag()->On(UserMode::POSSESSED_CANCEL); | |
33 | 34 | } |
34 | 35 | $this->AddSuccess($user->id, $this->role . '_success'); |
35 | 36 | } |