Browse Source

Accommodate Reaches with Mana costs by letting Reach arrays have 3 values instead of one

master
The Stranjer 4 years ago
parent
commit
791282327f
2 changed files with 13 additions and 5 deletions
  1. +12
    -4
      shards_of_power.rb
  2. +1
    -1
      spells.rb

+ 12
- 4
shards_of_power.rb View File

@@ -249,10 +249,18 @@ class ShardsOfPower
g.text spell.rules_text, :inline_format => true

spell.reaches.each do |reach|
g.formatted_text [
{:text => "+#{reach[0]} Reach: ", :styles => [:bold], :font => "Goudy"},
{:text => reach[1], :font => "Goudy"},
]
reach_cost = mana_cost = reach_rules = nil
if reach.size == 3
g.formatted_text [
{:text => "+#{reach[0]} Reach, #{reach[1]} Mana: ", :styles => [:bold], :font => "Goudy"},
{:text => reach[2], :font => "Goudy"},
]
else
g.formatted_text [
{:text => "+#{reach[0]} Reach: ", :styles => [:bold], :font => "Goudy"},
{:text => reach[1], :font => "Goudy"},
]
end
end

spell.adds.each do |add|


+ 1
- 1
spells.rb View File

@@ -1285,7 +1285,7 @@ class Spell
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? } }
unpunctuated_spells = spells.select { |spell| spell.rules_text.unpunctuated? || spell.reaches.collect{|reach| reach.size == 2 ? reach[1] : reach[2] }.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



Loading…
Cancel
Save