2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
# File 'lib/natural_20/cli/builder/wizard_builder.rb', line 2
def wizard_builder(build_values)
@wizard_info = session.load_class('wizard')
@class_values ||= {
attributes: [],
saving_throw_proficiencies: %w[intelligence wisdom],
equipped: [],
inventory: [{
type: 'spellbook',
qty: 1
}],
prepared_spells: [],
spellbook: []
}
starting_equipment = []
starting_equipment << prompt.select(t('builder.wizard.select_starting_weapon')) do |q|
q.choice t('object.weapons.quarterstaff'), :quarterstaff
q.choice t('object.weapons.dagger'), :dagger
end
starting_equipment << prompt.select(t('builder.wizard.select_starting_weapon_2')) do |q|
q.choice t('object.component_pouch'), :component_pouch
q.choice t('object.arcane_focus'), :arcane_focus
end
starting_equipment.each do |equip|
case equip
when :quarterstaff
@class_values[:equipped] << 'quarterstaff'
when :dagger
@class_values[:equipped] << 'dagger'
when :component_pouch
@class_values[:inventory] << {
type: 'component_pouch',
qty: 1
}
when :arcane_focus
arcane_focus = prompt.select(t('builder.wizard.select_arcane_focus')) do |q|
%w[crytal orb rod staff wand].each do |equip|
q.choice t(:"object.#{equip}"), equip
end
end
@class_values[:inventory] << {
type: arcane_focus,
qty: 1
}
end
end
@class_values[:prepared_spells] = prompt.multi_select(t('builder.wizard.select_cantrip'), min: 3, max: 3) do |q|
@wizard_info.dig(:spell_list, :cantrip).each do |cantrip|
next unless session.load_spell(cantrip)
q.choice t(:"spell.#{cantrip}"), cantrip
end
end
@class_values[:spellbook] = prompt.multi_select(t('builder.wizard.select_spells'), min: 6, max: 6) do |q|
@wizard_info.dig(:spell_list, :level_1).each do |spell|
next unless session.load_spell(spell)
q.choice t(:"spell.#{spell}"), spell
end
end
prepared_spells_count = modifier_table(build_values[:ability][:int]) + 1
@class_values[:prepared_spells] = prompt.multi_select(t('builder.wizard.select_prepared_spells'), min: prepared_spells_count, max: prepared_spells_count) do |q|
@class_values[:spellbook].each do |spell|
q.choice t(:"spell.#{spell}"), spell
end
end
@class_values
end
|