wayfinder 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/wayfinder +25 -46
- data/lib/wayfinder.rb +34 -4
- metadata +30 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e79fa064d4cb9ac71b713c26f5861b4708c1de8b
|
4
|
+
data.tar.gz: 8ceb7131687cb6eb167435d3060842b4d72005f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56a97597af28f2efb5f0c904b4226552193fbb13f379e985604cb37d328dcb61c46739dd075acb60a2a8af13aa5ceaa11bbcbd73e43cc07b25dbc86ff57e7367
|
7
|
+
data.tar.gz: 5efb1eef1ad3fb85a1165ba287b27e77f7e06197168e12e671bc047d1beb8e8629488ecbd3267d41f194938ac898032efd467c5b2f338f35aa13e3f9ce2dab98
|
data/bin/wayfinder
CHANGED
@@ -1,23 +1,40 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'box'
|
4
|
+
require 'clap'
|
4
5
|
require 'yaml'
|
5
6
|
require 'mote'
|
6
7
|
require 'wayfinder'
|
8
|
+
require 'debugger'
|
9
|
+
|
10
|
+
source_dir = 'source'
|
11
|
+
output_file = 'README.md'
|
12
|
+
template_file = 'source/template.md'
|
13
|
+
|
14
|
+
Clap.run ARGV,
|
15
|
+
'-s' => lambda { |param| source_dir = param },
|
16
|
+
'-o' => lambda { |param| output_file = param },
|
17
|
+
'-t' => lambda { |param| template_file = param }
|
7
18
|
|
8
19
|
source_data = {}
|
9
20
|
%i(meta stats gear feats buffs skills).each do |source_file|
|
10
|
-
source_data[source_file] = YAML.load_file("#{ source_file.to_s }.yml")
|
21
|
+
source_data[source_file] = YAML.load_file(File.join(source_dir, "#{ source_file.to_s }.yml"))
|
11
22
|
end
|
12
23
|
|
13
24
|
character = Wayfinder::Character.new(source_data)
|
14
|
-
template = Mote.parse(Box::FILES['character_sheet.htm'],
|
15
|
-
self,
|
16
|
-
[:character]
|
17
|
-
)
|
18
25
|
|
19
|
-
|
20
|
-
|
26
|
+
case ARGV[0]
|
27
|
+
when 'console'
|
28
|
+
debugger; 1
|
29
|
+
when 'generate'
|
30
|
+
template = if File.exists?(template_file)
|
31
|
+
Mote.parse(File.read(template_file), self, [:character])
|
32
|
+
else
|
33
|
+
output_file = 'character_sheet.htm'
|
34
|
+
Mote.parse(Box::FILES['character_sheet.htm'], self, [:character])
|
35
|
+
end
|
36
|
+
|
37
|
+
File.open(output_file, 'w') { |f| f.write(template.call(character: character)) }
|
21
38
|
end
|
22
39
|
|
23
40
|
__END__
|
@@ -164,7 +181,7 @@ __END__
|
|
164
181
|
<td align="center" bgcolor="black"><font style="font-size:9pt" color="white"><b>HP</b></font></td>
|
165
182
|
<td align="center" class="border9"><b>{{ character.hp }}</b></td>
|
166
183
|
<td align="center" class="font7"><br /></td>
|
167
|
-
<td align="center" class="border9">{{ character.received_damage }}<br /></td>
|
184
|
+
<td align="center" class="border9">{{ character.received_damage }}/{{ character.current_hp }}<br /></td>
|
168
185
|
<td align="center" class="font7"><br /></td>
|
169
186
|
<td align="center" class="border9"><b> </b></td>
|
170
187
|
<td align="center" class="font7"><br /></td>
|
@@ -209,44 +226,6 @@ __END__
|
|
209
226
|
<!-- STOP Base Attack Table -->
|
210
227
|
</td>
|
211
228
|
<td rowspan="2" valign="top" width="50%">
|
212
|
-
|
213
|
-
<!-- STOP PSI Power Points Table -->
|
214
|
-
<!-- START Skills Table -->
|
215
|
-
<table cellpadding="0" cellspacing="0" border="0" width="100%" summary="Skills Table">
|
216
|
-
<tr>
|
217
|
-
<td colspan="3" bgcolor="black" align="center"><font style="font-size: 9pt" color="white"><b>SKILLS</b></font>
|
218
|
-
</td>
|
219
|
-
</tr>
|
220
|
-
<tr>
|
221
|
-
<td align="left" class="border" valign="top">
|
222
|
-
<table cellpadding="0" cellspacing="0" border="0" width="100%" summary="Skills Table">
|
223
|
-
<tr><td align="left" class="borderbottom"><font style="font-size: 5pt"> Name</font></td><td align="left" class="borderbottom"><font style="font-size: 5pt">Abb</font></td><td align="right" class="borderbottom"><font style="font-size: 5pt">Rnk</font></td><td align="right" class="borderbottom"><font style="font-size: 5pt">Tot </font></td><td align="left" class="borderbottom"><font style="font-size: 5pt"> Name</font></td><td align="left" class="borderbottom"><font style="font-size: 5pt">Abb</font></td><td align="right" class="borderbottom"><font style="font-size: 5pt">Rnk</font></td><td align="right" class="borderbottom"><font style="font-size: 5pt">Tot </font></td><td align="left" class="borderbottom"><font style="font-size: 5pt"> Name</font></td><td align="left" class="borderbottom"><font style="font-size: 5pt">Abb</font></td><td align="right" class="borderbottom"><font style="font-size: 5pt">Rnk</font></td><td align="right" class="borderbottom"><font style="font-size: 5pt">Tot </font></td><tr>
|
224
|
-
<tr><td align="left"><font style="font-size: 5pt"> Acrobatics</font></td><td align="left"><font style="font-size: 5pt">DEX</font></td><td align="right"><font style="font-size: 5pt">0.0</font></td><td align="right" class="borderright"><font style="font-size: 5pt">-11 </font></td><td align="left"><font style="font-size: 5pt"> Disguise</font></td><td align="left"><font style="font-size: 5pt">CHA</font></td><td align="right"><font style="font-size: 5pt">0.0</font></td><td align="right" class="borderright"><font style="font-size: 5pt">-5 </font></td><td align="left"><font style="font-size: 5pt"> Ride</font></td><td align="left"><font style="font-size: 5pt">DEX</font></td><td align="right"><font style="font-size: 5pt">0.0</font></td><td align="right" class="borderright"><font style="font-size: 5pt">-11 </font></td><tr><tr><td align="left"><font style="font-size: 5pt"> Acrobatics (Jump)</font></td><td align="left"><font style="font-size: 5pt">DEX</font></td><td align="right"><font style="font-size: 5pt">0.0</font></td><td align="right" class="borderright"><font style="font-size: 5pt">-23 </font></td><td align="left"><font style="font-size: 5pt"> Escape Artist</font></td><td align="left"><font style="font-size: 5pt">DEX</font></td><td align="right"><font style="font-size: 5pt">0.0</font></td><td align="right" class="borderright"><font style="font-size: 5pt">-11 </font></td><td align="left"><font style="font-size: 5pt"> Sense Motive</font></td><td align="left"><font style="font-size: 5pt">WIS</font></td><td align="right"><font style="font-size: 5pt">0.0</font></td><td align="right" class="borderright"><font style="font-size: 5pt">-5 </font></td><tr><tr><td align="left"><font style="font-size: 5pt"> Appraise</font></td><td align="left"><font style="font-size: 5pt">INT</font></td><td align="right"><font style="font-size: 5pt">0.0</font></td><td align="right" class="borderright"><font style="font-size: 5pt">-5 </font></td><td align="left"><font style="font-size: 5pt"> Fly</font></td><td align="left"><font style="font-size: 5pt">DEX</font></td><td align="right"><font style="font-size: 5pt">0.0</font></td><td align="right" class="borderright"><font style="font-size: 5pt">-11 </font></td><td align="left"><font style="font-size: 5pt"> Stealth</font></td><td align="left"><font style="font-size: 5pt">DEX</font></td><td align="right"><font style="font-size: 5pt">0.0</font></td><td align="right" class="borderright"><font style="font-size: 5pt">-11 </font></td><tr><tr><td align="left"><font style="font-size: 5pt"> Bluff</font></td><td align="left"><font style="font-size: 5pt">CHA</font></td><td align="right"><font style="font-size: 5pt">0.0</font></td><td align="right" class="borderright"><font style="font-size: 5pt">-5 </font></td><td align="left"><font style="font-size: 5pt"> Heal</font></td><td align="left"><font style="font-size: 5pt">WIS</font></td><td align="right"><font style="font-size: 5pt">0.0</font></td><td align="right" class="borderright"><font style="font-size: 5pt">-5 </font></td><td align="left"><font style="font-size: 5pt"> Survival</font></td><td align="left"><font style="font-size: 5pt">WIS</font></td><td align="right"><font style="font-size: 5pt">0.0</font></td><td align="right" class="borderright"><font style="font-size: 5pt">-5 </font></td><tr><tr><td align="left"><font style="font-size: 5pt"> Climb</font></td><td align="left"><font style="font-size: 5pt">STR</font></td><td align="right"><font style="font-size: 5pt">0.0</font></td><td align="right" class="borderright"><font style="font-size: 5pt">-3 </font></td><td align="left"><font style="font-size: 5pt"> Intimidate</font></td><td align="left"><font style="font-size: 5pt">CHA</font></td><td align="right"><font style="font-size: 5pt">0.0</font></td><td align="right" class="borderright"><font style="font-size: 5pt">-5 </font></td><td align="left"><font style="font-size: 5pt"> Swim</font></td><td align="left"><font style="font-size: 5pt">STR</font></td><td align="right"><font style="font-size: 5pt">0.0</font></td><td align="right" class="borderright"><font style="font-size: 5pt">-3 </font></td><tr><tr><td align="left"><font style="font-size: 5pt"> Craft (Untrained)</font></td><td align="left"><font style="font-size: 5pt">INT</font></td><td align="right"><font style="font-size: 5pt">0.0</font></td><td align="right" class="borderright"><font style="font-size: 5pt">-5 </font></td><td align="left"><font style="font-size: 5pt"> Perception</font></td><td align="left"><font style="font-size: 5pt">WIS</font></td><td align="right"><font style="font-size: 5pt">0.0</font></td><td align="right" class="borderright"><font style="font-size: 5pt">-5 </font></td><tr><tr><td align="left"><font style="font-size: 5pt"> Diplomacy</font></td><td align="left"><font style="font-size: 5pt">CHA</font></td><td align="right"><font style="font-size: 5pt">0.0</font></td><td align="right" class="borderright"><font style="font-size: 5pt">-5 </font></td><td align="left"><font style="font-size: 5pt"> Perform (Untrained)</font></td><td align="left"><font style="font-size: 5pt">CHA</font></td><td align="right"><font style="font-size: 5pt">0.0</font></td><td align="right" class="borderright"><font style="font-size: 5pt">-5 </font></td><tr>
|
225
|
-
</table>
|
226
|
-
</td>
|
227
|
-
</tr>
|
228
|
-
</table>
|
229
|
-
<!-- STOP Skills Table -->
|
230
|
-
<!-- START Special Attacks Table -->
|
231
|
-
<!-- STOP Special Attacks Table -->
|
232
|
-
<!-- START Animal Tricks Table -->
|
233
|
-
<!-- STOP Animal Tricks Table -->
|
234
|
-
<!-- START Special Quality Table -->
|
235
|
-
<!-- STOP Special Quality Table -->
|
236
|
-
<!-- START Special Abilities Table -->
|
237
|
-
|
238
|
-
<!-- STOP Special Abilities Table -->
|
239
|
-
<!-- START Feats Table -->
|
240
|
-
<table cellpadding="0" cellspacing="0" border="0" width="100%" summary="Feats Table">
|
241
|
-
<tr>
|
242
|
-
<td colspan="1" bgcolor="black" align="center"><font style="font-size: 9pt" color="white"><b>FEATS</b></font></td>
|
243
|
-
</tr>
|
244
|
-
<tr>
|
245
|
-
<td align="left" width="100%" class="border7"></td>
|
246
|
-
</tr>
|
247
|
-
</table>
|
248
|
-
<!-- STOP Feats Table -->
|
249
|
-
|
250
229
|
</td>
|
251
230
|
</tr>
|
252
231
|
<tr>
|
data/lib/wayfinder.rb
CHANGED
@@ -44,10 +44,16 @@ module Wayfinder
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
+
|
48
|
+
## Returns an array of items in the modifier stack marked with 'active: true'
|
49
|
+
def active_stack
|
50
|
+
self.modifier_stack.map(&:values).flatten.keep_if { |item| item['active'] }
|
51
|
+
end
|
52
|
+
|
47
53
|
## Returns an array of object who affect the specified attribute
|
48
54
|
def stack_for(attribute)
|
49
|
-
self.
|
50
|
-
item
|
55
|
+
self.active_stack.each do |item|
|
56
|
+
item.fetch('modifiers', {}).keys.include?(attribute)
|
51
57
|
end
|
52
58
|
end
|
53
59
|
|
@@ -55,12 +61,20 @@ module Wayfinder
|
|
55
61
|
def modifier_for(attribute)
|
56
62
|
modifier = 0
|
57
63
|
stack_for(attribute).each do |mod|
|
58
|
-
modifier += mod
|
64
|
+
modifier += mod.fetch('modifiers', {}).fetch(attribute, 0)
|
59
65
|
end
|
60
66
|
|
61
67
|
modifier
|
62
68
|
end
|
63
69
|
|
70
|
+
def name
|
71
|
+
self.source[:meta]['name']
|
72
|
+
end
|
73
|
+
|
74
|
+
def xp
|
75
|
+
self.source[:meta]['xp']
|
76
|
+
end
|
77
|
+
|
64
78
|
## Combat
|
65
79
|
|
66
80
|
def hp
|
@@ -75,6 +89,10 @@ module Wayfinder
|
|
75
89
|
self.hp - self.received_damage
|
76
90
|
end
|
77
91
|
|
92
|
+
def speed
|
93
|
+
30 + modifier_for('speed')
|
94
|
+
end
|
95
|
+
|
78
96
|
def initiative
|
79
97
|
dexterity_modifier + modifier_for('initiative')
|
80
98
|
end
|
@@ -95,7 +113,7 @@ module Wayfinder
|
|
95
113
|
attack_babs = [self.bab]
|
96
114
|
|
97
115
|
## Fuck yeah I used a while in ruby, fuck you, fuck everything, EVERYTHING.
|
98
|
-
while attack_babs.last - 5
|
116
|
+
while attack_babs.last - 5 >= 1
|
99
117
|
attack_babs << attack_babs.last - 5
|
100
118
|
end
|
101
119
|
|
@@ -106,6 +124,18 @@ module Wayfinder
|
|
106
124
|
10 + dexterity_modifier + modifier_for('ac')
|
107
125
|
end
|
108
126
|
|
127
|
+
def cmd
|
128
|
+
10 + self.bab + strength_modifier + dexterity_modifier + modifier_for('cmd')
|
129
|
+
end
|
130
|
+
|
131
|
+
def cmb
|
132
|
+
10 + self.bab + strength_modifier + modifier_for('cmd')
|
133
|
+
end
|
134
|
+
|
135
|
+
def damage_reduction
|
136
|
+
0 + modifier_for('damage_reduction')
|
137
|
+
end
|
138
|
+
|
109
139
|
## Saving Throws
|
110
140
|
def saving_throws
|
111
141
|
{
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wayfinder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PoTe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: box
|
@@ -38,6 +38,34 @@ dependencies:
|
|
38
38
|
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: clap
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: debugger
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
41
69
|
description: |-
|
42
70
|
Wayfinder assumes you'll keep your character described in yaml following a set of conventions, all the data points are
|
43
71
|
aggregated together to generate a nicely formatted output from the input data, with all the numbers crunched in for you.
|