Spell list
This commit is contained in:
parent
b6e3aaa9fb
commit
6c7bb2ff2e
@ -1,13 +1,18 @@
|
||||
require "prawn"
|
||||
require "pry"
|
||||
|
||||
require_relative "spell"
|
||||
require_relative "spells"
|
||||
require_relative "primitive_adds"
|
||||
|
||||
puts "Book of Faces PDF generator"
|
||||
class BookOfFaces
|
||||
FONT_SIZE_CHAPTER = 48
|
||||
FONT_SIZE_SECTION = 24
|
||||
FONT_SIZE_SUBSECTION = 18
|
||||
FONT_SIZE_BODY = 12
|
||||
|
||||
attr_accessor :pdf, :number_name, :chapter_name, :chapter_title, :section_name
|
||||
attr_accessor :pdf, :number_name, :chapter_name, :chapter_title, :section_name, :spells
|
||||
|
||||
def start_chapter(num, name)
|
||||
@number_name = num
|
||||
@ -16,6 +21,8 @@ class BookOfFaces
|
||||
@chapter_title = "Chapter #{number_name}: #{chapter_name}"
|
||||
puts "Starting #{chapter_title}"
|
||||
|
||||
pdf.start_new_page
|
||||
|
||||
pdf.outline.update do
|
||||
puts "\tAdding #{@book_of_faces.chapter_title} on page #{page_number}"
|
||||
section(@book_of_faces.chapter_title, :destination => page_number)
|
||||
@ -79,6 +86,10 @@ class BookOfFaces
|
||||
end
|
||||
|
||||
def generate
|
||||
puts "Parsing spells..."
|
||||
@spells = Spell.spells
|
||||
|
||||
puts "Creating PDF object..."
|
||||
@pdf = Prawn::Document.new(:margin => 0)
|
||||
pdf.default_leading 10
|
||||
|
||||
@ -117,8 +128,6 @@ class BookOfFaces
|
||||
pdf.font_size 24
|
||||
pdf.text "Written by members of the /cofd/ Discord, edited by NEETzsche", :align => :center
|
||||
puts "\tMain credit..."
|
||||
|
||||
pdf.start_new_page
|
||||
|
||||
pdf.outline.define do
|
||||
end
|
||||
@ -142,6 +151,78 @@ class BookOfFaces
|
||||
:exceptional_success => "The willworker not only gives it valuable information, but demonstrates they are particularly capable of learning. They gain a full Experience point, but it can only be spent learning things from the Book of Faces"
|
||||
)
|
||||
|
||||
start_chapter("Two", "Spells")
|
||||
|
||||
spells.group_by(&:primary_arcanum).sort_by { |arcanum, spells| arcanum }.to_h.each do |arcanum, arcanum_spells|
|
||||
arcanum_name = arcanum.to_s.titleize
|
||||
|
||||
puts "Compiling spells for #{arcanum_name}..."
|
||||
|
||||
start_section("#{arcanum_name} Spells")
|
||||
|
||||
arcanum_spells.group_by(&arcanum).sort_by { |rating, spells| rating }.to_h.each do |rating, rating_spells|
|
||||
rating_title = "#{rating.to_dots} #{Spell::RANKS[rating - 1]} of #{arcanum_name}"
|
||||
puts "\tCompiling #{rating_title} spells..."
|
||||
pdf.outline.add_subsection_to("#{arcanum_name} Spells") do
|
||||
@pdf.outline.section rating_title, :destination => @pdf.page_number
|
||||
end
|
||||
|
||||
pdf.font_size FONT_SIZE_SUBSECTION
|
||||
pdf.text rating_title
|
||||
|
||||
rating_spells.sort_by { |spell| spell.name }.each do |spell|
|
||||
puts "\t\tCompiling #{spell.full_title} by #{spell.authors.join(', ')}"
|
||||
|
||||
spell_ary = [{:text => "#{spell.name} (", :font => "Lilith", :color => "004E6D", :size => FONT_SIZE_SECTION}]
|
||||
|
||||
pdf.font_size FONT_SIZE_BODY
|
||||
spell.arcana.each do |arcanum|
|
||||
spell_ary << {:text => arcanum.to_s.titleize, :font => "Lilith", :color => "004E6D", :size => FONT_SIZE_SECTION}
|
||||
spell_ary << {:text => spell.send(arcanum).to_dots, :font => "Goudy", :color => "004E6D", :size => FONT_SIZE_SECTION}
|
||||
end
|
||||
|
||||
spell_ary << {:text => ")", :font => "Lilith", :color => "004E6D", :size => FONT_SIZE_SECTION}
|
||||
|
||||
pdf.formatted_text spell_ary
|
||||
|
||||
pdf.formatted_text [
|
||||
{:text => "Practice:", :styles => [:bold], :font => "Goudy"},
|
||||
{:text => spell.practice, :font => "Goudy"},
|
||||
]
|
||||
|
||||
pdf.formatted_text [
|
||||
{:text => "Primary Factor:", :styles => [:bold], :font => "Goudy"},
|
||||
{:text => spell.primary_factor, :font => "Goudy"},
|
||||
]
|
||||
|
||||
pdf.formatted_text [
|
||||
{:text => "Withstand:", :styles => [:bold], :font => "Goudy"},
|
||||
{:text => spell.withstand, :font => "Goudy"},
|
||||
] if !spell.withstand.nil?
|
||||
|
||||
pdf.formatted_text [
|
||||
{:text => "Suggested Rote Skills:", :styles => [:bold], :font => "Goudy"},
|
||||
{:text => spell.suggested_rote_skills.join(', '), :font => "Goudy"},
|
||||
]
|
||||
|
||||
pdf.formatted_text [
|
||||
{:text => spell.authors.length == 1 ? "Author:" : "Authors:", :styles => [:bold], :font => "Goudy"},
|
||||
{:text => spell.authors.join(', '), :font => "Goudy"},
|
||||
]
|
||||
|
||||
pdf.text spell.rules_text
|
||||
|
||||
spell.reaches.each do |reach|
|
||||
puts reach.inspect
|
||||
pdf.formatted_text [
|
||||
{:text => "+#{reach[0]} Reach:", :styles => [:bold], :font => "Goudy"},
|
||||
{:text => reach[1], :font => "Goudy"},
|
||||
]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
pdf.render_file("book_of_faces.pdf")
|
||||
end
|
||||
end
|
||||
|
19
primitive_adds.rb
Normal file
19
primitive_adds.rb
Normal file
@ -0,0 +1,19 @@
|
||||
class String
|
||||
def titleize
|
||||
gsub(/\w+/i) do |match|
|
||||
ret = match.downcase
|
||||
ret[0] = ret[0].upcase
|
||||
ret
|
||||
end
|
||||
end
|
||||
|
||||
def titleize!
|
||||
replace titleize
|
||||
end
|
||||
end
|
||||
|
||||
class Integer
|
||||
def to_dots
|
||||
"•" * self
|
||||
end
|
||||
end
|
77
spell.rb
Normal file
77
spell.rb
Normal file
@ -0,0 +1,77 @@
|
||||
class Spell
|
||||
ARCANA = [:death, :fate, :forces, :life, :matter, :mind, :prime, :space, :spirit, :time]
|
||||
RANKS = ["Initiate", "Apprentice", "Disciple", "Adept", "Master"]
|
||||
ARCANA.each do |arcanum|
|
||||
attr_accessor arcanum
|
||||
end
|
||||
|
||||
attr_accessor :name,
|
||||
:practice,
|
||||
:primary_factor,
|
||||
:withstand,
|
||||
:suggested_rote_skills,
|
||||
:reaches,
|
||||
:rules_text
|
||||
|
||||
attr_accessor :authors
|
||||
|
||||
def initialize(
|
||||
death: 0,
|
||||
fate: 0,
|
||||
forces: 0,
|
||||
life: 0,
|
||||
matter: 0,
|
||||
mind: 0,
|
||||
prime: 0,
|
||||
space: 0,
|
||||
spirit: 0,
|
||||
time: 0,
|
||||
name:,
|
||||
practice:,
|
||||
primary_factor:,
|
||||
withstand: nil,
|
||||
suggested_rote_skills:,
|
||||
reaches:,
|
||||
rules_text:,
|
||||
authors:)
|
||||
|
||||
@death = death
|
||||
@fate = fate
|
||||
@forces = forces
|
||||
@life = life
|
||||
@matter = matter
|
||||
@mind = mind
|
||||
@prime = prime
|
||||
@space = space
|
||||
@spirit = spirit
|
||||
@time = time
|
||||
@name = name
|
||||
@practice = practice
|
||||
@primary_factor = primary_factor
|
||||
@withstand = withstand
|
||||
@suggested_rote_skills = suggested_rote_skills
|
||||
@reaches = reaches
|
||||
@rules_text = rules_text
|
||||
@authors = authors
|
||||
end
|
||||
|
||||
def primary_arcanum
|
||||
ARCANA.max { |arcanum| self.send(arcanum) }
|
||||
end
|
||||
|
||||
def full_title
|
||||
"#{name} (#{arcana_with_dots.join(', ')})"
|
||||
end
|
||||
|
||||
def arcana
|
||||
ARCANA.select { |arcanum| self.send(arcanum) > 0}
|
||||
end
|
||||
|
||||
def arcana_with_dots
|
||||
arcana.collect { |arcanum| arcanum_with_dots(arcanum) }
|
||||
end
|
||||
|
||||
def arcanum_with_dots(arcanum)
|
||||
"#{arcanum.to_s.titleize} #{self.send(arcanum).to_dots}"
|
||||
end
|
||||
end
|
36
spells.rb
Normal file
36
spells.rb
Normal file
@ -0,0 +1,36 @@
|
||||
class Spell
|
||||
def self.spells
|
||||
spells = []
|
||||
|
||||
spells << Spell.new(
|
||||
:name => "Marionette",
|
||||
:life => 2,
|
||||
:practice => "Ruling",
|
||||
:primary_factor => "Duration",
|
||||
:withstand => "Resolve",
|
||||
:suggested_rote_skills => ["Medicine", "Athletics", "Expression"],
|
||||
:authors => ["Dark Archon"],
|
||||
:rules_text => "The Shaman can control the body of a mundane living thing. At the base level for the Duration of the spell the shaman can only command base life processes such as sleep, hunger, sweat, lacrimation, etc. Doing so may be obvious magic or an Act of Hubris depending upon the situation.",
|
||||
:reaches => [
|
||||
[1, "Marionette can hijack living supernatural creatures."],
|
||||
[2, "The shaman takes over direct control over the muscles and nerves of a life form, forcing it to perform whatever physical tasks the Shaman desires for the Duration. If conscious, the subject is fully aware of the fact that their body is acting outside of their control. This may cause Dissonance if the subject is a Sleeper. The willworker cannot have the target perform Social or Mental tasks."]
|
||||
]
|
||||
|
||||
)
|
||||
|
||||
spells << Spell.new(
|
||||
:name => "It Takes One To Know One",
|
||||
:death => 1,
|
||||
:practice => "Unveiling",
|
||||
:primary_factor => "Duration",
|
||||
:suggested_rote_skills => ["Medicine", "Survival", "Empathy"],
|
||||
:authors => ["Dark Archon"],
|
||||
:rules_text => "Having visited or gazed upon Stygia, Moroi have the most death-like experience outside of actually dying. Being experienced with death and transition, they know how to find the marks that death leaves. For the spell's duration, the caster can measure the amount of contact with the death the target has with a glance. Most people have only a very minor death aura, but a veteran coroner's aura could be startling.",
|
||||
:reaches => [[1, "The caster can distinguish between those who witnessed death and those who have caused it directly. She can also accurately guess how many people have been killed by the target."]]
|
||||
)
|
||||
|
||||
|
||||
|
||||
spells
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user