public function run()
 {
     // Barracks Items
     $barracks = Map::where('location_name', 'barracks')->firstOrFail();
     Item::create(['name' => 'sword', 'map_id' => $barracks->id]);
     Item::create(['name' => 'armor', 'map_id' => $barracks->id]);
     Item::create(['name' => 'key', 'map_id' => $barracks->id]);
     // Southwest Tower Item
     $southWestTower = Map::where('location_name', 'southwest_tower_outer')->firstOrFail();
     Item::create(['name' => 'lantern', 'map_id' => $southWestTower->id]);
     // Kitchen Items
     $kitchen = Map::where('location_name', 'kitchen')->firstOrFail();
     Item::create(['name' => 'apple', 'map_id' => $kitchen->id]);
     Item::create(['name' => 'bread', 'map_id' => $kitchen->id]);
     // Reception Room Item
     $receptionRoom = Map::where('location_name', 'reception_room')->firstOrFail();
     Item::create(['name' => 'wine', 'map_id' => $receptionRoom->id]);
     // Wizard Tower Items
     $wizardTower = Map::where('location_name', 'wizard_tower')->firstOrFail();
     Item::create(['name' => 'potion_invisibility', 'map_id' => $wizardTower->id]);
     Item::create(['name' => 'potion_strength', 'map_id' => $wizardTower->id]);
     Item::create(['name' => 'potion_regeneration', 'map_id' => $wizardTower->id]);
     // Dressing Room Item
     $dressingRoom = Map::where('location_name', 'dressing_room')->firstOrFail();
     Item::create(['name' => 'gown', 'map_id' => $dressingRoom->id]);
     // Study Item
     $study = Map::where('location_name', 'study')->firstOrFail();
     Item::create(['name' => 'note', 'map_id' => $study->id]);
     // King Chamber Item
     $kingChamber = Map::where('location_name', 'king_chamber')->firstOrFail();
     Item::create(['name' => 'crown', 'map_id' => $kingChamber->id]);
 }
Example #2
0
 public function isDead()
 {
     $user = Auth::user();
     $health = $user->health;
     if ($health <= 0) {
         // move to game over room
         $update = Auth::user();
         $update->player_location_id = 22;
         $update->save();
         // fetch game over text
         $room = Map::where("id", 22)->firstOrFail();
         return $room->description;
     } else {
         return false;
     }
 }
 public function run()
 {
     // Castle Entrance Guards
     $castleEntrance = Map::where('location_name', 'castle_entrance')->firstOrFail();
     Guard::create(['initial_health' => 10, 'map_id' => $castleEntrance->id]);
     Guard::create(['initial_health' => 10, 'map_id' => $castleEntrance->id]);
     // Barracks Guards
     $barracks = Map::where('location_name', 'barracks')->firstOrFail();
     Guard::create(['initial_health' => 10, 'map_id' => $barracks->id]);
     Guard::create(['initial_health' => 10, 'map_id' => $barracks->id]);
     Guard::create(['initial_health' => 10, 'map_id' => $barracks->id]);
     // North West Tower Guard
     $northWestTower = Map::where('location_name', 'northwest_tower')->firstOrFail();
     Guard::create(['initial_health' => 10, 'map_id' => $northWestTower->id]);
     // Outer Receiving Guard
     $outerReceiving = Map::where('location_name', 'outer_receiving')->firstOrFail();
     Guard::create(['initial_health' => 10, 'map_id' => $outerReceiving->id]);
     Guard::create(['initial_health' => 10, 'map_id' => $outerReceiving->id]);
 }
Example #4
0
 public function fetchDescription($id)
 {
     $room = Map::where("id", $id)->firstOrFail();
     return $room->description;
 }