Awakened2069/spells.rb
2019-07-04 19:24:58 -04:00

49 lines
3.4 KiB
Ruby

class Spell
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 }
raise "Duplicate spells (on name) detected: #{duplicate_spells.collect{ |k,v| k}.to_list}" if duplicate_spells.length > 0
unpunctuated_spells = spells.select { |spell| spell.rules_text.unpunctuated? || spell.reaches.collect{|reach| reach[1]}.any?(&:unpunctuated?) || spell.adds.any? { |add| add[:effect].unpunctuated? } }
raise "The following spells lack punctuation: #{unpunctuated_spells.collect(&:name).to_list}" if unpunctuated_spells.length > 0
spells
end
end