コード例 #1
0
 //shoots an arrow at specified adjacent room
 //returns true if it hits, false if it missses
 public bool shoot(int room)
 {
     //does player have arrows
     if (player.getNumOfArrows() > 0)
     {
         //removes arrow
         player.updateInventory(-1, 0);
         //checks to see if hit
         if (map.getWumpusLocation() == room)
         {
             //returns true when hit
             return(true);
         }
     }
     //returns false when miss
     return(false);
 }