From c9a1a09ef004d9411724cceddb0b91eeff8b60ad Mon Sep 17 00:00:00 2001 From: The Stranjer <791672+TheStranjer@users.noreply.github.com> Date: Thu, 4 Jul 2019 19:24:58 -0400 Subject: [PATCH] Some updates --- spell.rb | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ spells.rb | 34 +++++++++++++++++++++++++++- writeup.rb | 26 +++++++++++++++++++++ 3 files changed, 135 insertions(+), 1 deletion(-) diff --git a/spell.rb b/spell.rb index 2092559..c4bfd52 100644 --- a/spell.rb +++ b/spell.rb @@ -83,4 +83,80 @@ class Spell def arcanum_with_dots(arcanum) [arcanum, self.send(arcanum)].to_arcanum_with_dots end + + def render(rating_title = nil) + puts "\t\tCompiling #{full_title} by #{authors.join(', ')}" + pdf.outline.add_subsection_to(rating_title) do + @pdf.outline.section full_title, :destination => @pdf.page_number + end + + pdf.group do |g| + unless rating_title.nil? + g.font_size Awakened2069::FONT_SIZE_SECTION + g.text rating_title + end + + spell_ary = [{:text => "#{name} (", :font => "Lilith", :color => "004E6D", :size => Awakened2069::FONT_SIZE_SUBSECTION}] + + g.font_size Awakened2069::FONT_SIZE_BODY + previous = false + arcana.each do |arcanum| + spell_ary << {:text => ", ", :font => "Lilith", :color => "004E6D", :size => Awakened2069::FONT_SIZE_SUBSECTION} if previous + spell_ary << {:text => arcanum.to_s.titleize, :font => "Lilith", :color => "004E6D", :size => Awakened2069::FONT_SIZE_SUBSECTION} + spell_ary << {:text => self.send(arcanum).to_dots, :color => "004E6D", :size => Awakened2069::FONT_SIZE_SUBSECTION, :character_spacing => -5} + + previous = true + end + + spell_ary << {:text => " )", :font => "Lilith", :styles => [], :color => "004E6D", :size => Awakened2069::FONT_SIZE_SUBSECTION, :character_spacing => -3} + + g.formatted_text spell_ary + + g.formatted_text [ + {:text => "Practice: ", :styles => [:bold], :font => "Goudy"}, + {:text => practice, :font => "Goudy"}, + ] + + g.formatted_text [ + {:text => "Primary Factor: ", :styles => [:bold], :font => "Goudy"}, + {:text => primary_factor, :font => "Goudy"}, + ] + + g.formatted_text [ + {:text => "Withstand: ", :styles => [:bold], :font => "Goudy"}, + {:text => withstand, :font => "Goudy"}, + ] if !withstand.nil? + + g.formatted_text [ + {:text => "Cost: ", :styles => [:bold], :font => "Goudy"}, + {:text => cost, :font => "Goudy"}, + ] if !cost.nil? + + g.formatted_text [ + {:text => "Suggested Rote Skills: ", :styles => [:bold], :font => "Goudy"}, + {:text => suggested_rote_skills.join(', '), :font => "Goudy"}, + ] + + g.formatted_text [ + {:text => authors.length == 1 ? "Author: " : "Authors: ", :styles => [:bold], :font => "Goudy"}, + {:text => authors.join(', '), :font => "Goudy"}, + ] + + g.text rules_text, :inline_format => true + + reaches.each do |reach| + g.formatted_text [ + {:text => "+#{reach[0]} Reach: ", :styles => [:bold], :font => "Goudy"}, + {:text => reach[1], :font => "Goudy"}, + ] + end + + adds.each do |add| + g.formatted_text [ + {:text => "#{add[:verb] ? add[:verb] : "Add"} #{add[:arcana].collect { |arcanum, rating| [arcanum, rating].to_arcanum_with_dots }.to_list(:separator => add[:separator])}: ", :styles => [:bold], :font => "Goudy"}, + {:text => add[:effect], :font => "Goudy"}, + ] + end + end + end end \ No newline at end of file diff --git a/spells.rb b/spells.rb index ee90fa8..5e2cca5 100644 --- a/spells.rb +++ b/spells.rb @@ -1,7 +1,39 @@ class Spell - def self.spells + def self.spells(pdf) spells = [] + spells << Spell.new( + :name => "Add Contact", + :forces => 1, + :practice => "Compelling", + :primary_factor => "Duration", + :withstand => "Resolve", + :suggested_rote_skills => ["Computer", "Politics", "Socialize"], + :authors => ["NEETzsche"], + :rules_text => "With this spell, the willworker can add someone to their contacts list without having to pay up for it, or have mundane computer knowledge. For the Duration of the spell, the two people may communicate as though they were on each other's contact lists.", + :reaches => [ + [2, "The effect is Lasting."] + ], + :pdf => pdf + ) + + spells << Spell.new( + :name => "Control Computer", + :forces => 2, + :practice => "Ruling", + :primary_factor => "Duration", + :suggested_rote_skills => ["Computer", "Crafts", "Science"], + :authors => ["NEETzsche"], + :rules_text => "With this spell, the willworker can control a computer or other similar digital device. He can make it do anything the device can normally do, like run or install existing apps, visit websites, or share its GPS location data. The spell cannot, however, make the device do something more sophisticated than it normally could. The willworker must know specifically what the device should do unconditionally upon casting, and cannot change her mind on its effects on-the-fly.", + :adds => [ + {:arcana => { :fate => 2 }, :effect => "When Reaching as above, willworker can implant software with outright subjective parameters."}, + ], + :reaches => [ + [1, "The willworker can implant custom software into the device, either software he has written personally beforehand or software that he envisions in his mind. The software must be computable and must not require more system resources than the device can process. For example, he could implant a program that decrypts the owner's passwords and sends them off to some third party source because that requires minimal system resources, but he could not implant a program that instantly mines the next BitCoin, because someone's smartphone likely lacks the required processing power to do this. He also could not implant software that uses conditionals that are outright subjective, like separating someone's \"shitposts\" from their \"effortposts\" and putting them in separate folders."] + ], + :pdf => pdf + ) + # TESTS duplicate_spells = spells.group_by(&:name).select {| k, v| v.length > 1 } diff --git a/writeup.rb b/writeup.rb index f0cf35e..1863c25 100644 --- a/writeup.rb +++ b/writeup.rb @@ -220,6 +220,32 @@ class Awakened2069 pdf.text "Awakened society views the post-Internet computer networks as a bifurcate structure. The aforementioned disparate computer networks, with some of the problems and benefits of the now-antiquituous Internet, along with their mundane improvements, are typically referred to as the Lower Layer. Sometimes this is called the Fallen Layer, although that is not as popular. While it is definitely possible for someone to transmit their written or spoken thoughts, their full body motion, and even their mundane consciousness outright into these Fallen networks, can a person transmit the contents of their soul through it. Simply put: not really.\nThe lower layer has many systems in place. Users can communicate but cannot do so freely; government and corporate controls abound restrict who can speak to who. Ridiculous fees have been added to adding people to contact lists, so as to control who people speak to more than how much they do so. Adding someone to your contacts list is a Resources 1 expenditure. Creating a network connection where many people may speak freely to each other, like a chat room or web forum, is a Resources 2 expenditure. Naturally, this can be bypassed, either with a successful Intelligence + Computer roll (at a -2 penalty for a group chat) or a successful casting of the Forces 2 spell \"Control Computer.\" For a group setting, the willworker must use +1 Reach to create a group chat. Finally, to give these group chats plot armor, one can also purchase the Secure Forum Merit.", :inline_format => true, :indent_paragraphs => INDENT_SIZE end + start_chapter "Spells" + + Spell.spells(pdf).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") + pdf.column_box([0, pdf.cursor], :columns => 2, :width => pdf.bounds.width) do + 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 + + rating_spells.first.render(rating_title) + rating_spells + .reject { |spell| spell == rating_spells.first } + .each(&:render) + end + end + end + + pdf.render_file("writeup.pdf") end end