public function run() { DB::table('casts')->delete(); Cast::create(['code' => 'people', 'name' => '市民', 'jinroh_team' => 0, 'jinroh_count' => 0, 'jinroh_look' => 0, 'command_code' => '', 'known_each_id' => 0]); Cast::create(['code' => 'jinroh', 'name' => '人狼', 'jinroh_team' => 1, 'jinroh_count' => 1, 'jinroh_look' => 1, 'command_code' => 'kill_others', 'known_each_id' => 1]); Cast::create(['code' => 'teller', 'name' => '占い師', 'jinroh_team' => 0, 'jinroh_count' => 0, 'jinroh_look' => 0, 'command_code' => 'can_check_any', 'known_each_id' => 0]); Cast::create(['code' => 'knight', 'name' => '騎士', 'jinroh_team' => 0, 'jinroh_count' => 0, 'jinroh_look' => 0, 'command_code' => 'save_others', 'known_each_id' => 0]); Cast::create(['code' => 'falsewolf', 'name' => '狼憑き', 'jinroh_team' => 0, 'jinroh_count' => 0, 'jinroh_look' => 1, 'command_code' => '', 'known_each_id' => 0]); Cast::create(['code' => 'betrayer', 'name' => '裏切り者', 'jinroh_team' => 0, 'jinroh_count' => 1, 'jinroh_look' => 0, 'known_each_id' => 0, 'command_code' => '']); Cast::create(['code' => 'freemason', 'name' => '協調者', 'jinroh_team' => 0, 'jinroh_count' => 0, 'jinroh_look' => 0, 'known_each_id' => 1, 'command_code' => '']); Cast::create(['code' => 'mystic', 'name' => '霊媒師', 'jinroh_team' => 0, 'jinroh_count' => 0, 'jinroh_look' => 0, 'known_each_id' => 0, 'command_code' => 'can_check_dead']); }
protected function __findCast($cast) { $cast = Cast::where('code', '=', $cast)->first(); return Mate::where('cast_id', '=', $cast->id)->where('room_id', '=', $this->room->id)->where('is_alive', '=', 1); }
/** * Not yet implemented. * * Returns string with style information (if any). * Returns null if index is invalid or object was not initialized. */ public function get($index) { return Cast::toCharSequence($this->getRaw($index)); }
public function shuffleCast() { $mates = $this->mates->all(); $castArray = $this->__getAllSpecialCastAsArray(); $peopleNumber = $this->mates->count() - count($castArray); $castArray = array_merge($castArray, $this->__sameArray('people', $peopleNumber)); if (empty($castArray)) { return null; } $catchData = range(0, count($castArray) - 1); shuffle($catchData); $newMate = []; foreach ($mates as $mate) { $val = array_pop($catchData); $cast = Cast::where('code', '=', $castArray[$val])->first(); $mate->cast_id = $cast->id; $mate->save(); $newMate[] = $mate; } }