Exemplo n.º 1
0
 public static void extra(Player player, int[] possibilities, boolean tavern) {
   if (possibilities.length > 0) {
     int extra = Random.integer_of(possibilities);
     if (player.water + extra > player.water_max) {
       extra = player.water_max - player.water;
       if (extra == 0)
         Type.delay_line(
             "💧: "
                 + Random.text_of(
                     new String[] {
                       "Your waterskin is already full of water, so you add no more.",
                       "There is no room in your waterskin to carry any more water."
                     }));
     } else if (extra == 0 && !tavern)
       Type.delay_line("💧: " + Random.text_of(new String[] {"You acquire no extra water."}));
     player.water += extra;
     if (extra > 0)
       Type.delay_line(
           "💧: "
               + Random.text_of(
                   new String[] {
                     "You fill up your waterskin, increasing your amount of water by "
                         + extra
                         + " to now be "
                         + player.water,
                     "You add " + extra + " water to your waterskin"
                   })
               + ".");
   }
 }
Exemplo n.º 2
0
 private static void drink(
     Player player,
     int amount_min,
     int amount_max,
     int[] extra_possibilities,
     boolean tavern,
     double gas_chance) {
   int amount = Random.integer_from(amount_min, amount_max);
   for (int i = 0; i < amount; i++) {
     Type.delay(".", 1100);
   }
   System.out.println();
   boolean overdrinking_weaken = false;
   Type.delay("💧: ");
   if (player.wetness + amount < player.quenched)
     Type.delay_line(
         Random.text_of(
             new String[] {
               "You could drink some more.",
               "You are still thirsty.",
               "Your throat is still somewhat dry."
             }));
   else if (player.wetness + amount == player.quenched)
     Type.delay_line(
         Random.text_of(
             new String[] {
               "You have drunk enough.",
               "You have quenched your thirst.",
               "You are no longer thirsty."
             }));
   else {
     if (player.wetness == player.quenched) {
       Type.delay_line(
           Random.text_of(new String[] {"You have overdrunk.", "You feel waterlogged."}));
       overdrinking_weaken = true;
       if (gas_chance + .65 <= .9) gas_chance += .65;
       else gas_chance = .9;
     } else
       Type.delay_line(
           Random.text_of(
               new String[] {
                 "You have drunk enough.",
                 "You have quenched your thirst.",
                 "You are no longer thirsty."
               }));
     amount = player.quenched - player.wetness;
   }
   player.wetness += amount;
   player.display_wetnessbar();
   if (overdrinking_weaken) player.weaken(1);
   if (player.wetness >= player.quenched - 1) extra(player, extra_possibilities, tavern);
   gas(gas_chance);
 }
Exemplo n.º 3
0
  public Underdark_Cavern() {
    super();

    context =
        Random.text_of(new String[] {"inside", "within"})
            + " a "
            + Random.text_of(new String[] {"cavern of the Underdark", "dark cavern underground"})
            + ".";
    description =
        Random.text_of(
            new String[] {"The air is stale.", "You notice water trickling next to your feet."});
    large_character_placements =
        new String[] {
          "aside the rock wall",
          "aside the stone wall",
          "aside the stippled wall",
          "on a curved shale table",
          "under some stalactites",
          "between some stalagmites",
          "next to some glowing mushrooms on the wall",
          "next to an ore vein",
          "among a pile of bones",
          "in the hole to another passage",
          "closer to the entrance",
          "in the depth of the cavern",
          "near the back",
          "at the opening to the cavern",
          "on the edge of an acid lake",
          "by a pool of acid"
        };
    noncharacter_placements =
        new String[] {
          "on the rock floor",
          "on the stone floor",
          "on the stippled ground",
          "in a puddle of stagnant water",
          "over a tiny stream of water going through the cracks of the cavern",
          "in some sticky goo"
        };
    moba =
        Array.combine(
            moba_underground_with_gremlin, mobs_permute(new String[] {"Grell", "Otyugh"}));
    if (Random.whole() <= moba_elemental_chance)
      moba =
          Array.combine(
              moba, mobs_permute(new String[] {"Earth_Elemental", "Galeb_Duhr", "Gargoyle"}));
  }
Exemplo n.º 4
0
  public Arena() {
    super();

    context = "in the arena!";
    description =
        Random.text_of(
            new String[] {
              "You stand on worn and bloody sands, surrounded by traps, death machinery, monsters, and gladiators. Bodies lie here and there. Other combatants fight to the death. Crowded stands encircling the colosseum seat uncountable people, cheering on the madness from relative safety."
            });
    large_character_placements =
        new String[] {
          "in a pool of blood",
          "on the dusty and stamped ground",
          "adjacent to a spiky protrusion from an arena block",
          "on a tile away from most other contended zones",
          "against the wall of the stands",
          "on the metal grate trapdoor",
          "on a circular metal grate"
        };
    noncharacter_placements =
        new String[] {
          "among the debris of a tile ground up by action",
          "on the scarred arena surface",
          "on the floor of the main dueling dais"
        };
    moba =
        Array.combine(
            moba_fighters,
            moba_fighters,
            moba_fighters,
            moba_fighters,
            moba_fighters,
            moba_fighters,
            moba_fighters,
            moba_fighters,
            moba_fighters,
            moba_fighters,
            moba_gremlin,
            mobs_permute(
                new String[] {
                  "Gorgon",
                  "Helmed_Horror",
                  "Gorgon",
                  "Helmed_Horror",
                  "Gorgon",
                  "Helmed_Horror",
                  "Gorgon",
                  "Helmed_Horror",
                  "Gorgon",
                  "Helmed_Horror",
                  "Gorgon",
                  "Helmed_Horror",
                  "Gorgon",
                  "Helmed_Horror"
                }));
  }
Exemplo n.º 5
0
 private String article_species_for_random_combatant_from_moba() {
   String combatant = Text.lower(Random.text_of(moba));
   combatant = combatant.substring(combatant.indexOf(".") + 1);
   for (int i = 0; i < combatant.length(); i++) {
     if (combatant.charAt(i) == '_')
       combatant = combatant.substring(0, i) + " " + combatant.substring(i + 1);
   }
   if (Text.vowel(combatant)) return "an " + combatant;
   else return "a " + combatant;
 }
Exemplo n.º 6
0
 public void spectacle() {
   String first_combatant = article_species_for_random_combatant_from_moba(),
       second_combatant = article_species_for_random_combatant_from_moba();
   if (first_combatant.equals(second_combatant))
     second_combatant = "another " + second_combatant.substring(second_combatant.indexOf(" ") + 1);
   Type.delay_line(
       Random.text_of(new String[] {"Off to your side", "Behind you", "In the distance"})
           + ", "
           + first_combatant
           + " "
           + Random.text_of(
               new String[] {
                 "fights",
                 "skirmishes with",
                 "is engaged in combat with",
                 "is in a melee with",
                 "is struggling against",
                 "is getting slaughtered by"
               })
           + " "
           + second_combatant
           + ".");
 }
Exemplo n.º 7
0
 public Pause() {
   if (Act.input_backup.contains("pause") && Random.binary()) {
     Halt halt = new Halt();
   } else {
     Type.delay(
         Random.text_of(
             new String[] {
               "You pause for a moment.",
               "You pause for a moment, absorbing the view.",
               "You pause to admire your surroundings.",
               "You take a moment to admire your surroundings."
             }));
     for (int i = 0; i < Random.integer_from(1, 4); i++) Type.delay(".", 750);
     System.out.println();
   }
 }
Exemplo n.º 8
0
 public void event(Player player) {
   spectacle();
   if (player.health > 8 && Random.whole() <= .767) {
     System.out.println();
     Type.delay_line(
         Random.text_of(
             new String[] {
               "You bump into a spike!",
               "You are standing in a pool of acid!",
               "Flames shoot out of a wall, singeing you!",
               "A poison dart shoots out of a wall, burying into you!",
               "You get zapped as you step onto a metal grate!"
             }));
     player.trap_weaken(Random.integer_from(5, 8));
   }
 }
Exemplo n.º 9
0
  public Mountain_Range() {
    super();

    context = "in a mountain range.";
    description =
        Random.text_of(
            new String[] {
              "The other peaks you can see from this vantage point are snowy.",
              "A horde of goblins is marching out of a hole in a nearby mountain.",
              "A large bird is soaring from this mountain away to another.",
              "A giant is trudging down a steep path below you."
            });
    large_character_placements =
        new String[] {
          "halfway up a mountain, along a narrow rocky walkway",
          "next to some of the many boulders where the two nearest mountains meet",
          "just outside of a hole in the mountain",
          "near a steep peak",
          "on a narrow incline",
          "on a rocky ledge off of the mountain",
          "by the trees of the foothills",
          "at the top of a slope in the foothills",
          "among the debris of a settled avalanche",
          "in the crag between two broken rock faces",
          "inside a tunnel going through near the mountaintop",
          "against a sheer rock wall"
        };
    noncharacter_placements =
        new String[] {"among the grass and scattered rocks of the mountainside"};
    moba =
        Array.combine(
            moba_gremlin,
            mobs_permute(
                new String[] {"Hill_Giant", "Hill_Giant", "Hill_Giant", "Manticore", "Roc"}));
    if (Random.whole() <= moba_roamers_chance) moba = Array.combine(moba, moba_roamers);
    if (Random.whole() <= moba_elemental_chance)
      moba =
          Array.combine(
              moba, mobs_permute(new String[] {"Earth_Elemental", "Galeb_Duhr", "Gargoyle"}));
    if (Random.whole() <= moba_giant_chance)
      moba =
          Array.combine(
              moba,
              mobs_permute(new String[] {"Fire_Giant", "Frost_Giant", "Stone_Giant", "Yeti"}));
  }
Exemplo n.º 10
0
  public Desert() {
    super();

    context = "in the desert.";
    description =
        Random.text_of(
            new String[] {
              "Dry air whistles in your ears.",
              "Spiders skid across the sands.",
              "There is no oasis in sight.",
              "Hot wind rearranges the sandy particles. The sand is soft and warm under your boots."
            });
    large_character_placements =
        new String[] {
          "upon a drift of the sandy dune",
          "next to a spiky cactus",
          "between a large and small pair of cacti"
        };
    noncharacter_placements =
        new String[] {
          "under some sand",
          "on the sand",
          "on the hard dirt",
          "on the dirty sand",
          "on the dry ground",
          "on the arid desert surface"
        };
    moba =
        Array.combine(
            moba_harpies_with_gremlin,
            moba_roamers,
            mobs_permute(
                new String[] {
                  "Dust_Mephit",
                  "Dust_Mephit",
                  "Dust_Mephit",
                  "Dust_Mephit",
                  "Dust_Mephit",
                  "Dust_Mephit",
                  "Dust_Mephit",
                  "Dust_Mephit",
                  "Dust_Mephit"
                }));
  }
Exemplo n.º 11
0
 public Drink(Player player, Scenario scenario, boolean World, boolean from_Ahead) {
   boolean tavern = scenario.environment.tavern,
       waterskin_specific =
           Array.subcontainment_case_ignored(
               Act.input_backup,
               Array.combine(triggers_subsafe_uncolloquial_specific, new String[] {"inv"})),
       resupplying =
           Array.subcontainment_case_ignored(
               Act.input_backup, triggers_subsafe_uncolloquial_resupplies),
       resupplying_order = Random.binary();
   if (resupplying && resupplying_order) {
     Eat eat = new Eat(player, scenario, true, World, from_Ahead);
   }
   String quench_your_thirst_phrase =
       Random.text_of(triggers_subsafe_verbs_colloquial)
           + " your "
           + Random.text_of(triggers_subsafe_objects_colloquial);
   if (World || from_Ahead) {
     if (tavern && (!waterskin_specific || resupplying)) {
       if (resupplying) extra(player, new int[] {player.water_max - player.water}, tavern);
       else {
         Type.delay(
             Random.text_of(new String[] {"🍶", "🍷"})
                 + ": You "
                 + Random.text_of(ordering_statements)
                 + Random.text_of(new String[] {"", " at the bar"})
                 + ".");
         drink(player, 1, player.quenched, new int[] {0, 1, 1, 2, 2, 3}, tavern, .2);
       }
     } else if (Array.subcontainment_case_ignored(
             Act.input_backup, triggers_subsafe_uncolloquial_ordering)
         || Array.containment_case_ignored(
             triggers_nonsubsafe_uncolloquial_ordering, Act.input_backup)) {
       Type.delay_line(
           Random.text_of(
               new String[] {"You are not in a tavern.", "There is no bartender here!"}));
     } else if ((!waterskin_specific && scenario.environment.water && Random.whole() <= .95)
         || (scenario.environment.water && resupplying)) {
       Wait.milliseconds(400);
       Type.delay(
           "💧: "
               + Random.text_of(
                   new String[] {
                     "You find some water available here", "You access the water source here"
                   })
               + ".");
       if (resupplying) extra(player, new int[] {player.water_max - player.water}, tavern);
       else {
         if (scenario.environment.snowy)
           Type.delay_line(
               "❄: "
                   + Random.text_of(
                       new String[] {
                         "You feel cold.",
                         "That was chilling.",
                         "You shiver.",
                         "That was cold water!"
                       }));
         drink(
             player,
             1,
             Random.integer_of(new int[] {player.quenched - 1, player.quenched}),
             new int[] {0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 3},
             tavern,
             .1);
       }
     } else if (player.water >= 1 && !resupplying) {
       int drunk = 1;
       if (Random.whole() <= .8) {
         drunk = player.quenched - player.wetness;
         while (drunk > player.water) drunk--;
         if (drunk == 0) drunk = 1;
       } else drunk = Random.integer_of(new int[] {1, 1, 1, 1, 1, 2, 2, 2, 3});
       player.water -= drunk;
       Type.delay(
           "💧: You "
               + Random.text_of(
                   new String[] {
                     "drink"
                         + Random.text_of(
                             new String[] {
                               "",
                               " "
                                   + Random.text_of(
                                       new String[] {
                                         "some water",
                                         "some of your water",
                                         "from your waterskin",
                                         "some water from your waterskin",
                                         "a few sips of water"
                                             + Random.text_of(
                                                 new String[] {"", " from your waterskin"})
                                       }),
                             }),
                     "sip "
                         + Random.text_of(
                             new String[] {
                               "some water",
                               "on some water",
                               "some of your water",
                               "on some of your water",
                               "from your waterskin",
                               "on your waterskin",
                               "some water from your waterskin"
                             }),
                     Random.text_of(triggers_subsafe_colloquial_guzzles)
                         + " "
                         + Random.text_of(
                             new String[] {
                               "some water", "some of your water", "some water from your waterskin"
                             }),
                     quench_your_thirst_phrase
                   })
               + ".");
       drink(player, drunk, drunk, new int[] {}, tavern, .1);
     }
     // type a statement explaining why the player cannot drink //
     else {
       if (resupplying)
         Type.delay_line(
             Random.text_of(
                     new String[] {
                       "There is no drinkable water nearby",
                       "You have no clean water around to fill your waterskin with"
                     })
                 + ".");
       else
         Type.delay_line(
             "You have no water"
                 + Random.text_of(
                     new String[] {
                       "",
                       " "
                           + Random.text_of(new String[] {"", "available", "left"})
                           + Random.text_of(
                               new String[] {"", " to " + quench_your_thirst_phrase + " with"}),
                       "in your waterskin, nor is there any good water around",
                       "on hand, and there is nothing here to " + quench_your_thirst_phrase,
                       "with you, and there is no good drinking water here"
                     })
                 + ".");
     }
   } else {
     if (resupplying) Type.delay_line("You have no time to resupply during combat!");
     else {
       Type.delay_line(
           "You have no time to "
               + Random.text_of(
                   new String[] {
                     "drink",
                     Random.text_of(triggers_subsafe_colloquial_guzzles)
                         + " "
                         + Random.text_of(new String[] {"", "any "})
                         + "water",
                     "take a "
                         + Random.text_of(triggers_subsafe_colloquial_guzzles)
                         + Random.text_of(new String[] {"", " of water"}),
                     quench_your_thirst_phrase,
                   })
               + " during combat!");
     }
   }
   if (resupplying && !resupplying_order) {
     Eat eat = new Eat(player, scenario, true, World, from_Ahead);
   }
 }
Exemplo n.º 12
0
  public Tavern() {
    super();

    // tavern toggle //
    tavern = true;

    // context //
    String context_place;
    if (Random.whole() <= .7) context_place = Random.text_of(context_places_common);
    else context_place = Random.text_of(context_places_rare);
    context = Random.text_of(new String[] {"at", "inside", "in"}) + " The ";
    switch (Random.integer_to(15)) {
      case 0:
        {
          context += Random.text_of(context_object_adjectives) + " " + context_place;
          break;
        }
      case 1:
        {
          context +=
              context_place
                  + " of the "
                  + Random.text_of(context_object_adjectives)
                  + " "
                  + Random.text_of(context_characters);
          break;
        }
      case 2:
        {
          context +=
              Random.text_of(context_object_adjectives)
                  + " "
                  + Random.text_of(context_objects)
                  + Random.text_of(new String[] {" " + context_place, ""});
          break;
        }
      case 3:
        {
          context +=
              context_place
                  + " of the "
                  + Random.text_of(context_character_adjectives)
                  + " "
                  + Random.text_of(context_characters);
          break;
        }
      case 4:
        {
          context +=
              Random.text_of(context_character_adjectives)
                  + " "
                  + Random.text_of(
                      new String[] {
                        Random.text_of(context_characters)
                            + Random.text_of(new String[] {" " + context_place, ""}),
                        Random.text_of(context_characters_possessive) + " " + context_place
                      });
          break;
        }
      case 5:
        {
          context += context_place + " of the " + Random.text_of(context_characters_plural);
          break;
        }
      case 6:
        {
          context += context_place + " of " + Random.text_of(context_characters_plural);
          break;
        }
      case 7:
        {
          context +=
              Random.text_of(context_objects)
                  + " and the "
                  + Random.text_of(context_objects)
                  + Random.text_of(new String[] {" " + context_place, ""});
          break;
        }
      case 8:
        {
          context +=
              Random.text_of(context_object_adjectives)
                  + " "
                  + Random.text_of(context_objects)
                  + Random.text_of(new String[] {" " + context_place, ""});
          break;
        }
      case 9:
        {
          context +=
              Random.text_of(context_characters_possessive)
                  + " "
                  + Random.text_of(context_objects)
                  + " "
                  + context_place;
          break;
        }
      case 10:
        {
          context +=
              Random.text_of(context_character_adjectives)
                  + " "
                  + Random.text_of(context_characters_possessive)
                  + " "
                  + Random.text_of(context_objects)
                  + Random.text_of(new String[] {" " + context_place, ""});
          break;
        }
      case 11:
        {
          context += Random.text_of(context_characters_possessive) + " " + context_place;
          break;
        }
      case 12:
        {
          context +=
              Random.text_of(context_character_adjectives)
                  + " "
                  + Random.text_of(context_characters_possessive)
                  + " "
                  + context_place;
          break;
        }
      case 13:
        {
          context +=
              Random.text_of(context_characters)
                  + " and "
                  + Random.text_of(context_characters)
                  + " "
                  + context_place;
          break;
        }
      case 14:
        {
          context +=
              Random.text_of(context_characters)
                  + " and the "
                  + Random.text_of(context_objects)
                  + Random.text_of(new String[] {" " + context_place, ""});
          break;
        }
      case 15:
        {
          context +=
              Random.text_of(context_objects)
                  + " and the "
                  + Random.text_of(context_characters)
                  + Random.text_of(new String[] {" " + context_place, ""});
          break;
        }
        // error //
      default:
        {
          System.out.println("ERROR:\nTavern:\nswitch chose default instead of a case");
        }
    }
    context += Random.text_of(new String[] {".", ".", ".", "..."});

    // description //
    description =
        Random.text_of(
            new String[] {
              "It's late, and most of the people here are tired. The inn's fireplace is crackling softly...",
              "The tavern is large, and largely undecorated, except for an extravagant rug at the entryway.",
              "The inn is warm and well lit inside. The lights flicker against various artworks hanging on the walls, depicting both adventurous and everyday scenes.",
              "The barkeep tends to the bar, wiping it clean. There is an impressive array of bottles and kegs behind him.",
              "The tavern is small, but well decorated. Adventuring paraphernalia are hung on the walls — items such as a crossbow, a bandolier, a helmet, and a broadsword.",
              "There are many barrels of mead stacked in the corner, enough to last the tavern for at least a year.",
              "Flickering candles are mounted on the walls, lending a midnight atmosphere. A large chandelier hangs from the center of the ceiling."
            });
    if (Random.whole() <= .35) {
      if (Random.whole() <= .3)
        description +=
            " Some open games of dice and cards rest on the tables for late night players.";
      else {
        if (Random.whole() <= .33)
          description = "Card and dice games are being played tonight. " + description;
        else if (Random.whole() <= .66)
          description +=
              " There is a band in tonight, playing a jovial tune with lute, flute, and drums on a platform in the back of the tavern.";
        else
          description =
              "Card and dice games are being played tonight. "
                  + description
                  + " There is a band of flute and lute players in the back of the tavern, providing a relaxing atmosphere.";
      }
    }

    // placements //
    large_character_placements =
        new String[] {
          "by the doorway", Random.text_of(new String[] {"at", "beside"}) + " the bar", "on a table"
        };
    nonlarge_character_placements =
        new String[] {
          "seated on a stool at the bar",
          "in the seat at a table",
          "by the mead barrels",
          "behind the bar"
        };
    noncharacter_placements =
        new String[] {
          "on the wooden floor",
          "on the mantle of the fireplace",
          "in the fireplace",
          "in a crate",
          "on a shelf in the back",
          "mounted on the wall",
          "against the wall",
          "on the rug at the door",
          "in the lockbox under the counter of the bar",
          "by some ingredient pouches behind the bar",
          "under a wall-mounted candle"
        };
    // moba //
    if (Random.whole() <= .857) moba = new String[] {};
    else moba = mobs_permute(new String[] {"Thug"});

    // occupants //
    occupants =
        new String[] {
          Random.text_of(new String[] {"the barkeep", "the bartender", "the innkeeper"})
        };
    int more_occupants =
        Random.integer_from(2, 7); // rough overcount because repeats will get discarded //
    for (int i = 0; i < more_occupants; i++) {
      String additional_occupant = Random.text_of(possible_occupants);
      if (!Array.containment(occupants, additional_occupant))
        occupants = Array.combine(occupants, new String[] {additional_occupant});
    }
    // occupants statement //
    occupants_statement =
        Random.text_of(new String[] {"The", "Tonight's"})
            + " "
            + Random.text_of(new String[] {"occupants", "occupants", "residents"})
            + " include ";
    for (int i = 0; i < occupants.length; i++) {
      if (i < occupants.length - 2) occupants_statement += occupants[i] + ", ";
      else if (i < occupants.length - 1) occupants_statement += occupants[i] + ", and ";
      else occupants_statement += occupants[i] + ".";
    }
  }
Exemplo n.º 13
0
public class Tavern extends Common_Interior_Basic {
  //////// name randomization sets
  // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  private static final String[]
      // adjectives //
      context_general_adjectives =
          {
            "Alabaster",
            "Ancient",
            "Beautiful",
            "Blue",
            "Boring",
            "Colorful",
            "Damned",
            "Divine",
            "Exotic",
            "Foul",
            "Great",
            "Green",
            "Impure",
            "Legendary",
            "Lucky",
            "Marked",
            "Modest",
            "New",
            "Old",
            "Purple",
            "Pure",
            "Queer",
            "Red",
            "Unique",
            "Vile",
            "Yellow"
          },
      context_object_adjectives =
          Array.combine(
              new String[] {
                "Broken",
                "Cheap",
                "Common",
                "Duplicate",
                "Elegant",
                "Expensive",
                "Fine",
                "Inexpensive",
                "Magical",
                "New",
                "Rare",
                "Rusty",
                "Shattered",
                "Stolen",
                "Worn",
                "Wet"
              },
              context_general_adjectives),
      context_character_adjectives =
          Array.combine(
              new String[] {
                "Alert",
                "Artistic",
                "Bold",
                "Boring",
                "Charming",
                "Corrupt",
                "Creative",
                "Crying",
                "Dancing",
                "Dead",
                "Deadly",
                "Destitute",
                "Dying",
                "Elated",
                "Excited",
                "Foul",
                "Funny",
                "Glad",
                "Good",
                "Grinning",
                "Happy",
                "Howling",
                "Idiotic",
                "Illuminated",
                "Immoral",
                "Immortal",
                "Intelligent",
                "Jealous",
                "Joyous",
                "Keen",
                "Killing",
                "Kind",
                "Laughing",
                "Loving",
                "Mad",
                "Mean",
                "Morose",
                "Naked",
                "Needy",
                "Outraged",
                "Outrageous",
                "Prancing",
                "Quiet",
                "Rich",
                "Roaming",
                "Sad",
                "Screaming",
                "Smart",
                "Smiling",
                "Strong",
                "Swaggering",
                "Travelling",
                "Unquiet",
                "Violent",
                "Virtuous",
                "Vulgar",
                "Wandering",
                "Wealthy",
                "Weeping",
                "Wise",
                "Young",
                "Zestful"
              },
              context_general_adjectives),
      // subjects //
      context_objects =
          {
            "Amulet",
            "Arm",
            "Barrel",
            "Battle",
            "Beak",
            "Blessing",
            "Book",
            "Booty",
            "Bottle",
            "Bow",
            "Casque",
            "Cauldron",
            "Chant",
            "Claw",
            "Claws",
            "Club",
            "Conflict",
            "Crime",
            "Crossbow",
            "Crown",
            "Cup",
            "Deception",
            "Decree",
            "Edict",
            "Elixir",
            "Fang",
            "Fangs",
            "Feather",
            "Fight",
            "Fist",
            "Flagon",
            "Flask",
            "Flight",
            "Fur",
            "Gallop",
            "Grimoire",
            "Hand",
            "Hanging",
            "Head",
            "Hoof",
            "Horn",
            "Horn-tip",
            "Law",
            "Lineage",
            "Mane",
            "Mug",
            "Pelt",
            "Potion",
            "Prayer",
            "Rule",
            "Scale",
            "Scales",
            "Scripture",
            "Scroll",
            "Sentence",
            "Slither",
            "Staff",
            "Strife",
            "Struggle",
            "Sword",
            "Tabard",
            "Tail",
            "Talisman",
            "Talisman",
            "Theft",
            "Throne",
            "Tooth",
            "Triumph",
            "Venom",
            "Victim",
            "Victory",
            "Wand",
            "War",
            "Web",
            "Wineskin",
            "Wing",
            "Wings"
          },
      context_characters =
          {
            "Alchemist",
            "Alderman",
            "Angel",
            "Ape",
            "Artisan",
            "Bard",
            "Bird",
            "Boatman",
            "Bodyguard",
            "Bull",
            "Butcher",
            "Cat",
            "Centaur",
            "Cleric",
            "Coachman",
            "Conjurer",
            "Conjuress",
            "Courier",
            "Craftsman",
            "Crusader",
            "Demon",
            "Devil",
            "Dog",
            "Dragon",
            "Duke",
            "Dutchess",
            "Eagle",
            "Earl",
            "Empress",
            "Emperor",
            "Enchanter",
            "Enchantress",
            "Father",
            "Fish",
            "Fisherman",
            "Footpad",
            "Fox",
            "Giant",
            "Gnoll",
            "Goat",
            "Goblin",
            "Harpies",
            "Hawk",
            "Herdsman",
            "Highwayman",
            "Hobgoblin",
            "Horse",
            "Imp",
            "Jackal",
            "King",
            "Knight",
            "Laborer",
            "Ladies",
            "Lion",
            "Magi",
            "Marquessa",
            "Marquis",
            "Mercenaries",
            "Merchant",
            "Militaman",
            "Minister",
            "Minstrel",
            "Minotaur",
            "Monkey",
            "Naga",
            "Necromancer",
            "Ogre",
            "Owl",
            "Paladin",
            "Peasant",
            "Pedlar",
            "Phoenix",
            "Pony",
            "Priest",
            "Priestess'",
            "Prince",
            "Princess",
            "Quail",
            "Queen",
            "Raven",
            "Robber",
            "Rogue",
            "Seaman",
            "Serpent",
            "Servant",
            "Snake",
            "Soldier",
            "Sorceress",
            "Sorceror",
            "Spider",
            "Swindler",
            "Thief",
            "Tiger",
            "Toll-Keeper",
            "Trader",
            "Troll",
            "Unicorn",
            "Virgin",
            "Warrior",
            "Witch",
            "Wizard",
            "Wolf"
          },
      context_characters_possessive =
          {
            "Alchemist's",
            "Alderman's",
            "Angel's",
            "Ape's",
            "Artisan's",
            "Bard's",
            "Bird's",
            "Boatman's",
            "Bodyguard's",
            "Bull's",
            "Butcher's",
            "Cat's",
            "Centaur's",
            "Cleric's",
            "Coachman's",
            "Conjurer's",
            "Conjuress'",
            "Courier's",
            "Craftsman's",
            "Crusader's",
            "Demon's",
            "Devil's",
            "Dog's",
            "Dragon's",
            "Duke's",
            "Dutchess'",
            "Eagle's",
            "Earl's",
            "Empress'",
            "Emperor's",
            "Enchanter's",
            "Enchantress'",
            "Father's",
            "Fish's",
            "Fisherman's",
            "Footpad's",
            "Fox's",
            "Giant's",
            "Gnoll's",
            "Goat's",
            "Goblin's",
            "Harpy's",
            "Hawk's",
            "Herdsman's",
            "Highwayman's",
            "Hobgoblin's",
            "Horse's",
            "Imp's",
            "Jackal's",
            "King's",
            "Knight's",
            "Laborer's",
            "Lady",
            "Lion's",
            "Magus'",
            "Marquessa's",
            "Marquis'",
            "Mercenary's",
            "Merchant's",
            "Militiaman's",
            "Minister's",
            "Minstrel's",
            "Minotaur's",
            "Monkey's",
            "Naga's",
            "Necromancer's",
            "Ogre's",
            "Owl's",
            "Paladin's",
            "Peasant's",
            "Pedlar's",
            "Phoenix's",
            "Pony's",
            "Priest's",
            "Priestess'",
            "Prince's",
            "Princess'",
            "Quail's",
            "Queen's",
            "Raven's",
            "Robber's",
            "Rogue's",
            "Seaman's",
            "Serpent's",
            "Servant's",
            "Snake's",
            "Soldier's",
            "Sorceress'",
            "Sorceror's",
            "Spider's",
            "Swindler's",
            "Thief's",
            "Tiger's",
            "Toll-Keeper's",
            "Troll's",
            "Trader's",
            "Unicorn's",
            "Virgin's",
            "Warrior's",
            "Witch's",
            "Wizard's",
            "Wolf's"
          },
      context_characters_plural =
          {
            "Alchemists",
            "Aldermen",
            "Angels",
            "Apes",
            "Artisans",
            "Bards",
            "Birds",
            "Boatmen",
            "Bodyguards",
            "Bulls",
            "Butchers",
            "Cats",
            "Centaurs",
            "Clerics",
            "Coachmen",
            "Conjurers",
            "Conjuresses",
            "Couriers",
            "Craftsmen",
            "Crusaders",
            "Demons",
            "Devils",
            "Dogss",
            "Dragons",
            "Dukes",
            "Dutchesses",
            "Eagles",
            "Earls",
            "Empresses",
            "Emperors",
            "Enchanters",
            "Ennchantress'",
            "Fathers",
            "Fishermen",
            "Fishes",
            "Footpads",
            "Foxes",
            "Giants",
            "Gnolls",
            "Goats",
            "Goblins",
            "Guild",
            "Harpies",
            "Hawks",
            "Herdsmen",
            "Highwaymen",
            "Hobgoblins",
            "Horses",
            "Imps",
            "Jackals",
            "Kings",
            "Knights",
            "Laborers",
            "Ladies",
            "Lions",
            "Magus'",
            "Marquessas",
            "Marquis'",
            "Mercenaries",
            "Merchants",
            "Militiamen",
            "Ministers",
            "Minstrels",
            "Minotaurs",
            "Monkeys",
            "Nagas",
            "Necromancers",
            "Ogres",
            "Owls",
            "Paladins",
            "Peasants",
            "Pedlars",
            "Phoenixes",
            "Ponies",
            "Priestess",
            "Priests",
            "Princes",
            "Princesses",
            "Quails",
            "Queens",
            "Ravens",
            "Robbers",
            "Rogues",
            "Seamen",
            "Serpents",
            "Servants",
            "Snakes",
            "Soldiers",
            "Sorceresses",
            "Sorcerors",
            "Spiders",
            "Swindlers",
            "Thieves",
            "Tigers",
            "Toll-Keepers",
            "Traders",
            "Trolls",
            "Unicorns",
            "Virgins",
            "Warriors",
            "Witches",
            "Wizards",
            "Wolves"
          },
      context_places_common = {"Tavern", "Tavern", "Inn", "Bar"},
      context_places_rare = {"Alehouse", "Brewery", "Saloon", "Lodge", "Hall", "Stein"};
  /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  // occupants randomization set //
  public final String[] possible_occupants = {
    "a farmhand",
    "a pair of arguing drunks",
    "a couple of brawling men",
    "a wench",
    "a meditating monk",
    "a suspicious robed figure",
    "a ranger",
    "an elven lady",
    "a surly dwarf",
    "a gnome",
    "a fiddling gnome",
    "an engrossed bookreader",
    "an artisan",
    "a dapper halfling",
    "a waitress",
    "a hooded man",
    "a peasant lady",
    "a bearded man",
    "an old lady",
    "an old man",
    "a boy",
    "a girl",
    "a playing band",
    "a dwarven lass",
    "a well-dressed lady",
    "several rowdy dwarves",
    "a miner",
    "a thirsty laborer",
    "a swordarm",
    "an attractive woman",
    "a ragged drunkard",
    "a drunk farmer",
    "a farmer",
    "a salty pirate",
    "a crewman",
    "a deckhand",
    "the captain of the guard",
    "a seaman",
    "a colorful mystic",
    "a cloaked halfling",
    "a fat halfling",
    "a half-orc mercenary",
    "a nobleman",
    "a waiter",
    "a serving lady",
    "a serving boy",
    "a cook",
    "a brewer",
    "a sleeping adventurer",
    "a handsome lad",
    "a snoring man",
    "a snoring dwarf",
    "an elf maiden",
    "a male elf",
    "a well-equipped adventurer",
    "a traveling merchant",
    "a fat man",
    "a thug",
    "a bald mercenary",
    "a half-orc",
    "a peasant man",
    "a priest",
    "a priestess",
    "a guardsman",
    "a guardswoman",
    "a shifty-eyed rogue",
    "a rogue",
    "a cowled adventurer",
    "a noblewoman",
    "a "
        + Random.text_of(new String[] {"", "singing "})
        + Random.text_of(
            new String[] {"female bard", "male bard", "minstrel lady", "male minstrel"})
        + Random.text_of(new String[] {"", " playing a flute", " playing a lute"})
  };
  // occupants properties //
  String[] occupants;
  String occupants_statement;

  public Tavern() {
    super();

    // tavern toggle //
    tavern = true;

    // context //
    String context_place;
    if (Random.whole() <= .7) context_place = Random.text_of(context_places_common);
    else context_place = Random.text_of(context_places_rare);
    context = Random.text_of(new String[] {"at", "inside", "in"}) + " The ";
    switch (Random.integer_to(15)) {
      case 0:
        {
          context += Random.text_of(context_object_adjectives) + " " + context_place;
          break;
        }
      case 1:
        {
          context +=
              context_place
                  + " of the "
                  + Random.text_of(context_object_adjectives)
                  + " "
                  + Random.text_of(context_characters);
          break;
        }
      case 2:
        {
          context +=
              Random.text_of(context_object_adjectives)
                  + " "
                  + Random.text_of(context_objects)
                  + Random.text_of(new String[] {" " + context_place, ""});
          break;
        }
      case 3:
        {
          context +=
              context_place
                  + " of the "
                  + Random.text_of(context_character_adjectives)
                  + " "
                  + Random.text_of(context_characters);
          break;
        }
      case 4:
        {
          context +=
              Random.text_of(context_character_adjectives)
                  + " "
                  + Random.text_of(
                      new String[] {
                        Random.text_of(context_characters)
                            + Random.text_of(new String[] {" " + context_place, ""}),
                        Random.text_of(context_characters_possessive) + " " + context_place
                      });
          break;
        }
      case 5:
        {
          context += context_place + " of the " + Random.text_of(context_characters_plural);
          break;
        }
      case 6:
        {
          context += context_place + " of " + Random.text_of(context_characters_plural);
          break;
        }
      case 7:
        {
          context +=
              Random.text_of(context_objects)
                  + " and the "
                  + Random.text_of(context_objects)
                  + Random.text_of(new String[] {" " + context_place, ""});
          break;
        }
      case 8:
        {
          context +=
              Random.text_of(context_object_adjectives)
                  + " "
                  + Random.text_of(context_objects)
                  + Random.text_of(new String[] {" " + context_place, ""});
          break;
        }
      case 9:
        {
          context +=
              Random.text_of(context_characters_possessive)
                  + " "
                  + Random.text_of(context_objects)
                  + " "
                  + context_place;
          break;
        }
      case 10:
        {
          context +=
              Random.text_of(context_character_adjectives)
                  + " "
                  + Random.text_of(context_characters_possessive)
                  + " "
                  + Random.text_of(context_objects)
                  + Random.text_of(new String[] {" " + context_place, ""});
          break;
        }
      case 11:
        {
          context += Random.text_of(context_characters_possessive) + " " + context_place;
          break;
        }
      case 12:
        {
          context +=
              Random.text_of(context_character_adjectives)
                  + " "
                  + Random.text_of(context_characters_possessive)
                  + " "
                  + context_place;
          break;
        }
      case 13:
        {
          context +=
              Random.text_of(context_characters)
                  + " and "
                  + Random.text_of(context_characters)
                  + " "
                  + context_place;
          break;
        }
      case 14:
        {
          context +=
              Random.text_of(context_characters)
                  + " and the "
                  + Random.text_of(context_objects)
                  + Random.text_of(new String[] {" " + context_place, ""});
          break;
        }
      case 15:
        {
          context +=
              Random.text_of(context_objects)
                  + " and the "
                  + Random.text_of(context_characters)
                  + Random.text_of(new String[] {" " + context_place, ""});
          break;
        }
        // error //
      default:
        {
          System.out.println("ERROR:\nTavern:\nswitch chose default instead of a case");
        }
    }
    context += Random.text_of(new String[] {".", ".", ".", "..."});

    // description //
    description =
        Random.text_of(
            new String[] {
              "It's late, and most of the people here are tired. The inn's fireplace is crackling softly...",
              "The tavern is large, and largely undecorated, except for an extravagant rug at the entryway.",
              "The inn is warm and well lit inside. The lights flicker against various artworks hanging on the walls, depicting both adventurous and everyday scenes.",
              "The barkeep tends to the bar, wiping it clean. There is an impressive array of bottles and kegs behind him.",
              "The tavern is small, but well decorated. Adventuring paraphernalia are hung on the walls — items such as a crossbow, a bandolier, a helmet, and a broadsword.",
              "There are many barrels of mead stacked in the corner, enough to last the tavern for at least a year.",
              "Flickering candles are mounted on the walls, lending a midnight atmosphere. A large chandelier hangs from the center of the ceiling."
            });
    if (Random.whole() <= .35) {
      if (Random.whole() <= .3)
        description +=
            " Some open games of dice and cards rest on the tables for late night players.";
      else {
        if (Random.whole() <= .33)
          description = "Card and dice games are being played tonight. " + description;
        else if (Random.whole() <= .66)
          description +=
              " There is a band in tonight, playing a jovial tune with lute, flute, and drums on a platform in the back of the tavern.";
        else
          description =
              "Card and dice games are being played tonight. "
                  + description
                  + " There is a band of flute and lute players in the back of the tavern, providing a relaxing atmosphere.";
      }
    }

    // placements //
    large_character_placements =
        new String[] {
          "by the doorway", Random.text_of(new String[] {"at", "beside"}) + " the bar", "on a table"
        };
    nonlarge_character_placements =
        new String[] {
          "seated on a stool at the bar",
          "in the seat at a table",
          "by the mead barrels",
          "behind the bar"
        };
    noncharacter_placements =
        new String[] {
          "on the wooden floor",
          "on the mantle of the fireplace",
          "in the fireplace",
          "in a crate",
          "on a shelf in the back",
          "mounted on the wall",
          "against the wall",
          "on the rug at the door",
          "in the lockbox under the counter of the bar",
          "by some ingredient pouches behind the bar",
          "under a wall-mounted candle"
        };
    // moba //
    if (Random.whole() <= .857) moba = new String[] {};
    else moba = mobs_permute(new String[] {"Thug"});

    // occupants //
    occupants =
        new String[] {
          Random.text_of(new String[] {"the barkeep", "the bartender", "the innkeeper"})
        };
    int more_occupants =
        Random.integer_from(2, 7); // rough overcount because repeats will get discarded //
    for (int i = 0; i < more_occupants; i++) {
      String additional_occupant = Random.text_of(possible_occupants);
      if (!Array.containment(occupants, additional_occupant))
        occupants = Array.combine(occupants, new String[] {additional_occupant});
    }
    // occupants statement //
    occupants_statement =
        Random.text_of(new String[] {"The", "Tonight's"})
            + " "
            + Random.text_of(new String[] {"occupants", "occupants", "residents"})
            + " include ";
    for (int i = 0; i < occupants.length; i++) {
      if (i < occupants.length - 2) occupants_statement += occupants[i] + ", ";
      else if (i < occupants.length - 1) occupants_statement += occupants[i] + ", and ";
      else occupants_statement += occupants[i] + ".";
    }
  }

  public void spectacle() {
    Type.delay_line(occupants_statement);
  }

  public void event(Player player) {
    spectacle();
    if (player.health < player.healthy) {
      Type.delay("You find respite here.");
      int amount = Random.integer_from(1, 4);
      for (int i = 0; i < amount; i++) {
        Type.delay(".", 1250);
      }
      System.out.println();
      player.recover(1 + amount);
    }
  }
}