How davidmasu/adventure works
This is a small Java text adventure. A player enters commands in the console; the interface delegates gameplay actions to Adventure, which coordinates the Player with the current Room and its enemies and items. Map builds the connected rooms and populates them with game content. Player handles movement, inventory, consumables, equipment, and attacks; weapons and item subclasses define the available content. The Main source is indexed as referencing the startup components, but its excerpt was not provided, so startup wiring is shown as unverified.
Main entry points: Player.java Player state · Map.java Map builder · UserInterface.java Command interface · Weapon.java Weapon
Components 18
Command interface
- Startup
src/Main.java - Command interface
src/UserInterface.java
World model
- Map builder
src/Map.java - Room
src/Room.java - Enemy
src/Enemy.java
Gameplay coordination
- Adventure coordinator
src/Adventure.java - Player state
src/Player.java
Items and combat
- Item
src/Item.java - Food
src/Food.java - Liquid
src/Liquid.java - Weapon
src/Weapon.java - Melee weapon
src/MeleeWeapon.java - Ranged weapon
src/RangedWeapon.java - Equip result
src/Equip.java - Attack result
src/Attack.java - Eat result
src/EatResult.java - Drink result
src/DrinkResult.java
Other components
- Player
Connections 30
- Player → Command interface: enters commands
src/UserInterface.java - Command interface → Adventure coordinator: requests actions
src/UserInterface.java - Adventure coordinator → Player state: delegates actions
src/Adventure.java - Adventure coordinator → Room: reads and updates
src/Adventure.java - Adventure coordinator → Enemy: finds target
src/Adventure.java - Player state → Room: moves and searches
src/Player.java - Player state → Item: manages inventory
src/Player.java - Player state → Food: consumes
src/Player.java - Player state → Liquid: drinks
src/Player.java - Player state → Weapon: equips and uses
src/Player.java - Player state → Enemy: attacks
src/Player.java - Command interface → Equip result: handles result
src/UserInterface.java - Command interface → Attack result: handles result
src/UserInterface.java - Command interface → Eat result: handles result
src/UserInterface.java - Command interface → Drink result: handles result
src/UserInterface.java - Map builder → Room: builds rooms
src/Map.java - Map builder → Item: places items
src/Map.java - Map builder → Food: places food
src/Map.java - Map builder → Liquid: places liquids
src/Map.java - Map builder → Weapon: places weapons
src/Map.java - Map builder → Enemy: places enemies
src/Map.java - Enemy → Weapon: attacks with
src/Enemy.java - Food → Item: extends
src/Food.java - Liquid → Item: extends
src/Liquid.java - Weapon → Item: extends
src/Weapon.java - Melee weapon → Weapon: extends
src/MeleeWeapon.java - Ranged weapon → Weapon: extends
src/RangedWeapon.java - Startup → Map builder: startup wiring
src/Main.java - Startup → Adventure coordinator: startup wiring
src/Main.java - Startup → Command interface: startup wiring
src/Main.java