Пример #1
0
  private static void gas(double chance) {
    if (Random.whole() <= chance) {
      Wait.milliseconds(322);
      System.out.print("\n\n");

      Burp burp = new Burp();
      if (Random.whole() <= .12) gas(1);
    }
  }
Пример #2
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);
   }
 }
Пример #3
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] + ".";
    }
  }