class Commander
require_relative “Archivist.rb” require_relative “Builder.rb”
Attributes
archivist[R]
builder[R]
Public Instance Methods
prompter()
click to toggle source
# File lib/Commander.rb, line 140 def prompter startup character = sel_concept sel_screen(@builder) sel_aspect(:ancestries, @builder) sel_aspect(:backgrounds, @builder) sel_aspect(:classes, @builder) sel_screen(@builder) puts "Press ENTER to return to the main menu." gets end
sel_aspect(aspect, character)
click to toggle source
# File lib/Commander.rb, line 120 def sel_aspect(aspect, character) @archivist.send(aspect).keys.each_with_index { |option, index| puts "#{index+1} - #{option}"} choice = gets.chomp until @archivist.confirm(choice, aspect) @archivist.summarize(choice, aspect) puts "Will you play a #{choice}? Y/N" confirm = gets.chomp.capitalize[0] if confirm == "Y" character.send("#{aspect}=", choice) else sel_aspect(aspect, character) end end
sel_concept()
click to toggle source
# File lib/Commander.rb, line 95 def sel_concept name = gets.chomp @archivist = Archivist.new @builder = Builder.new(name) end
sel_screen(character)
click to toggle source
# File lib/Commander.rb, line 103 def sel_screen(character) puts " _______________ ___ ___ ___ __ __ __ _ _ _" puts "|" puts "| #{character.name}" puts "|_______________ ___ ___ ___ __ __ __ _ _ _" puts "|" if character.ancestries puts "| Ancestry: #{character.ancestries}" if character.ancestries puts "| Background: #{character.backgrounds}" if character.backgrounds puts "| Class: #{character.classes}" if character.classes puts "|" if character.classes puts "'" puts "'" puts "'" end
startup()
click to toggle source
# File lib/Commander.rb, line 87 def startup puts "A legend begins with a name." puts puts " Who are you?" end
terminus()
click to toggle source
# File lib/Commander.rb, line 72 def terminus puts puts "Fare thee well, and may your ventures be magical!" puts puts "__________________________________________________________________" puts " __ .__ _____.__ .___ " puts " ___________ _/ |_| |___/ ____\\__| ____ __| _/___________ " puts " \\____ \\__ \\\\ __\\ | \\ __\\| |/ \\ / __ |/ __ \\_ __ \\ " puts " | |_> > __ \\| | | Y \\ | | | | \\/ /_/ \\ ___/| | \\/ " puts " | __(____ /__| |___| /__| |__|___| /\\____ |\\___ >__| " puts " |__| \\/ \\/ \\/ \\/ \\/ " puts "__________________________________________________________________" puts end
titlecard()
click to toggle source
# File lib/Commander.rb, line 8 def titlecard puts "__________________________________________________________________" puts " __ .__ _____.__ .___ " puts " ___________ _/ |_| |___/ ____\\__| ____ __| _/___________ " puts " \\____ \\__ \\\\ __\\ | \\ __\\| |/ \\ / __ |/ __ \\_ __ \\ " puts " | |_> > __ \\| | | Y \\ | | | | \\/ /_/ \\ ___/| | \\/ " puts " | __(____ /__| |___| /__| |__|___| /\\____ |\\___ >__| " puts " |__| \\/ \\/ \\/ \\/ \\/ " puts "__________________________________________________________________" puts puts "Welcome to Pathfinder, a game of adventure and imagination." puts "This application will help you organize basic character ideas." puts "__________________________________________________________________" puts end