wayfinder 0.0.5 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/wayfinder +28 -255
- data/lib/wayfinder.rb +80 -80
- metadata +13 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5928745fb8895cbf267a468610e78cf86208d2c
|
4
|
+
data.tar.gz: a20f258d36cb0bc2810a203fad0c86dcd61e8c4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5f8a3715558b10c15886b443d3969c1b44acdb77138730d3751e2a9b558d6381ffa50fc5d8e745107eb27169c46136b1c113a30bfae1bab146571fff5f8f909
|
7
|
+
data.tar.gz: 11c17a5a0252228b97201afa687913ce72d24e3dd29ab9cf9096164ce0474bcce9083e47727bacec683d9f0e928022dc397781707234710ef1f15221b089c289
|
data/bin/wayfinder
CHANGED
@@ -1,270 +1,43 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require 'box'
|
4
3
|
require 'clap'
|
5
4
|
require 'yaml'
|
6
|
-
require
|
7
|
-
require 'wayfinder'
|
8
|
-
require 'debugger'
|
5
|
+
require File.expand_path("../lib/wayfinder", File.dirname(__FILE__))
|
9
6
|
|
10
|
-
source_dir
|
11
|
-
|
12
|
-
|
7
|
+
$source_dir = 'source'
|
8
|
+
$template_file = 'source/template.mote'
|
9
|
+
$output_file = 'README.md'
|
13
10
|
|
14
11
|
Clap.run ARGV,
|
15
|
-
'-s'
|
16
|
-
'
|
17
|
-
'-
|
12
|
+
'-s' => lambda { |param| $source_dir = param },
|
13
|
+
'--source' => lambda { |param| $source_dir = param },
|
14
|
+
'-o' => lambda { |param| $output_file = param },
|
15
|
+
'--output' => lambda { |param| $output_file = param },
|
16
|
+
'-t' => lambda { |param| $template_file = param },
|
17
|
+
'--template' => lambda { |param| $template_file = param }
|
18
|
+
|
19
|
+
|
20
|
+
def load_character
|
21
|
+
source_data = {}
|
22
|
+
%i(main modifiers skills).each do |source_file|
|
23
|
+
source_data[source_file] = YAML.load_file(
|
24
|
+
File.join($source_dir, "#{ source_file.to_s }.yml")
|
25
|
+
)
|
26
|
+
end
|
18
27
|
|
19
|
-
source_data
|
20
|
-
%i(meta stats gear feats buffs skills).each do |source_file|
|
21
|
-
source_data[source_file] = YAML.load_file(File.join(source_dir, "#{ source_file.to_s }.yml"))
|
28
|
+
Wayfinder::Character.new(source_data)
|
22
29
|
end
|
23
30
|
|
24
|
-
character =
|
31
|
+
$character = load_character
|
25
32
|
|
26
33
|
case ARGV[0]
|
27
34
|
when 'console'
|
28
|
-
|
35
|
+
require 'irb'
|
36
|
+
require 'irb/completion'
|
37
|
+
ARGV.clear
|
38
|
+
IRB.start
|
29
39
|
when 'generate'
|
30
|
-
|
31
|
-
|
32
|
-
|
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)) }
|
40
|
+
require 'mote'
|
41
|
+
template = Mote.parse(File.read($template_file), self, [:c])
|
42
|
+
File.open($output_file, 'w') { |f| f.write(template.call(c: $character)) }
|
38
43
|
end
|
39
|
-
|
40
|
-
__END__
|
41
|
-
@@ character_sheet.htm
|
42
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
43
|
-
<html>
|
44
|
-
<head>
|
45
|
-
<meta http-equiv="content-type" content="text-html; charset=utf-8" />
|
46
|
-
<title>Unnamed 1 [0 Points]</title>
|
47
|
-
<style type="text/css">
|
48
|
-
.font4 { font-family: Arial; font-size:4pt; }
|
49
|
-
.font5 { font-family: Arial; font-size:5pt; }
|
50
|
-
.font6 { font-family: Arial; font-size:6pt; }
|
51
|
-
.font7 { font-family: Arial; font-size:7pt; }
|
52
|
-
.font8 { font-family: Arial; font-size:8pt; }
|
53
|
-
.font9 { font-family: Arial; font-size:9pt; }
|
54
|
-
.h { font-family: Arial; font-size:8pt; vertical-align: bottom; }
|
55
|
-
.hs { font-family: Arial; font-size:6pt; border-top-width:1px; border-top: 1pt solid black; vertical-align:top; background: #CCCCCC; }
|
56
|
-
.ah { font-family: Arial; font-size:4pt; text-align:center; }
|
57
|
-
.ab { font-family: Arial; font-size:10pt; text-align:center; color:white; background:black; }
|
58
|
-
.sc { font-family: Arial; font-size: 5pt }
|
59
|
-
.scr { font-family: Arial; font-size: 5pt; text-align:right }
|
60
|
-
.scbr { font-family: Arial; font-size: 5pt; border-right-width:1px; border-right: 1pt solid black; text-align:right}
|
61
|
-
.hph { font-family: Arial; font-size: 7pt; text-align:center; vertical-align:bottom;}
|
62
|
-
.ach { font-family: Arial; font-size: 7pt; text-align:center; vertical-align:middle;}
|
63
|
-
.acb { font-family: Arial; font-size: 9pt; font-weight:bold; text-align:center; vertical-align:middle; border: 1px solid black;}
|
64
|
-
.hphs { font-family: Arial; font-size: 5pt; text-align:center; vertical-align:bottom;}
|
65
|
-
.hpb { font-family: Arial; font-size: 9pt; font-weight:bold; text-align:center; vertical-align:middle; border: 1px solid black;}
|
66
|
-
.hpbb { font-family: Arial; font-size: 9pt; font-weight:bold; color:white; background:black; text-align:center; vertical-align:middle; border: 1px solid black;}
|
67
|
-
.abb { font-family: Arial; font-size:10pt; text-align:center; font-weight:bold; border: 1px solid black;}
|
68
|
-
.abt { font-family: Arial; font-size:10pt; text-align:center; font-weight:bold; border: 5px solid lightgray;}
|
69
|
-
.sptab { font-family: Arial; vertical-align:top;border: 1px solid black; text-align:center;font-size:8pt;}
|
70
|
-
.spname { font-family: Arial; vertical-align:top;border: 1px solid black; text-align:left;font-size:8pt;}
|
71
|
-
.sptop { font-family: Arial; vertical-align:top;border: 1px solid black; text-align:center;font-size:8pt; color:white;}
|
72
|
-
.splevel { font-family: Arial; background:black; text-align:center;font-size:9pt; color:white;}
|
73
|
-
.sphead { font-family: Arial; background:black; text-align:center;font-size:12pt; color:white;}
|
74
|
-
.spcomp { font-family: Arial; vertical-align:top; text-align:left;font-size:6pt;}
|
75
|
-
.spcomp2 { font-family: Arial; vertical-align:top; text-align:left;font-size:5pt;}
|
76
|
-
.spcomp3 { font-family: Arial; vertical-align:top; text-align:left;font-size:9pt;}
|
77
|
-
.topline {
|
78
|
-
border-top-width:1px;
|
79
|
-
border-top: 1pt solid black;
|
80
|
-
font-family: Arial;
|
81
|
-
font-size:6pt;
|
82
|
-
}
|
83
|
-
.border {
|
84
|
-
border: 1px solid black;
|
85
|
-
}
|
86
|
-
.border7 {
|
87
|
-
border: 1px solid black;
|
88
|
-
font-size:7pt;
|
89
|
-
}
|
90
|
-
.border8 {
|
91
|
-
border: 1px solid black;
|
92
|
-
font-size:8pt;
|
93
|
-
}
|
94
|
-
.border9 {
|
95
|
-
border: 1px solid black;
|
96
|
-
font-size:9pt;
|
97
|
-
}
|
98
|
-
.border10 {
|
99
|
-
border: 1px solid black;
|
100
|
-
}
|
101
|
-
.tempborder {
|
102
|
-
font-size:10pt; border: 5px solid lightgray;
|
103
|
-
}
|
104
|
-
.borderbottom {
|
105
|
-
border-bottom-width:1px;
|
106
|
-
border-bottom: 1pt solid black;
|
107
|
-
}
|
108
|
-
.borderright {
|
109
|
-
border-right-width:1px;
|
110
|
-
border-right: 1pt solid black;
|
111
|
-
}
|
112
|
-
.c, .wbc {
|
113
|
-
text-align: center;
|
114
|
-
}
|
115
|
-
TD {
|
116
|
-
font-family: Arial
|
117
|
-
}
|
118
|
-
span.notes p {margin-top:0; margin-bottom:0;}
|
119
|
-
</style>
|
120
|
-
</head>
|
121
|
-
<body bgcolor="white">
|
122
|
-
<table border="0" cellpadding="0" cellspacing="0" width="100%" summary="Master Page Table">
|
123
|
-
<tr>
|
124
|
-
<td rowspan="2" valign="top">
|
125
|
-
<!-- START Abilities Table -->
|
126
|
-
<table summary="Ability Table">
|
127
|
-
<tr>
|
128
|
-
<td align="center" width="20%" class="font4">ABILITY<br />NAME</td>
|
129
|
-
<td align="center" width="20%" class="font4">ABILITY<br />SCORE</td>
|
130
|
-
<td align="center" width="20%" class="font4">ABILITY<br />MODIFIER</td>
|
131
|
-
</tr>
|
132
|
-
<tr>
|
133
|
-
<td class="ab"><b>STR</b></td>
|
134
|
-
<td class="abb">{{ character.strength }}</td>
|
135
|
-
<td class="abb">{{ character.strength_modifier }}</td>
|
136
|
-
</tr>
|
137
|
-
<tr>
|
138
|
-
<td class="ab"><b>DEX</b></td>
|
139
|
-
<td class="abb">{{ character.dexterity }}</td>
|
140
|
-
<td class="abb">{{ character.dexterity_modifier }}</td>
|
141
|
-
</tr>
|
142
|
-
<tr>
|
143
|
-
<td class="ab"><b>CON</b></td>
|
144
|
-
<td class="abb">{{ character.constitution }}</td>
|
145
|
-
<td class="abb">{{ character.constitution_modifier }}</td>
|
146
|
-
</tr>
|
147
|
-
<tr>
|
148
|
-
<td class="ab"><b>INT</b></td>
|
149
|
-
<td class="abb">{{ character.intelligence }}</td>
|
150
|
-
<td class="abb">{{ character.intelligence_modifier }}</td>
|
151
|
-
</tr>
|
152
|
-
<tr>
|
153
|
-
<td class="ab"><b>WIS</b></td>
|
154
|
-
<td class="abb">{{ character.wisdom }}</td>
|
155
|
-
<td class="abb">{{ character.wisdom_modifier }}</td>
|
156
|
-
</tr>
|
157
|
-
<tr>
|
158
|
-
<td class="ab"><b>CHA</b></td>
|
159
|
-
<td class="abb">{{ character.charisma }}</td>
|
160
|
-
<td class="abb">{{ character.charisma_modifier }}</td>
|
161
|
-
</tr>
|
162
|
-
</table>
|
163
|
-
<!-- STOP Abilities Table -->
|
164
|
-
|
165
|
-
</td>
|
166
|
-
<td colspan="2" valign="top">
|
167
|
-
|
168
|
-
<!-- START Hit point Table -->
|
169
|
-
<table summary="HP Table">
|
170
|
-
<tr>
|
171
|
-
<td align="center" width="50"></td>
|
172
|
-
<td align="center" width="25" valign="bottom"></td>
|
173
|
-
<td align="center"></td>
|
174
|
-
<td align="center" width="119" class="font5"><br />WOUNDS/CURRENT HP</td>
|
175
|
-
<td align="center"></td>
|
176
|
-
<td align="center" width="60" class="font5"><br />DAMAGE<br />REDUCTION</td>
|
177
|
-
<td align="center"></td>
|
178
|
-
<td align="center" width="60" class="font5"><br />SPEED</td>
|
179
|
-
</tr>
|
180
|
-
<tr>
|
181
|
-
<td align="center" bgcolor="black"><font style="font-size:9pt" color="white"><b>HP</b></font></td>
|
182
|
-
<td align="center" class="border9"><b>{{ character.hp }}</b></td>
|
183
|
-
<td align="center" class="font7"><br /></td>
|
184
|
-
<td align="center" class="border9">{{ character.received_damage }}/{{ character.current_hp }}<br /></td>
|
185
|
-
<td align="center" class="font7"><br /></td>
|
186
|
-
<td align="center" class="border9"><b> </b></td>
|
187
|
-
<td align="center" class="font7"><br /></td>
|
188
|
-
<td align="center" class="border9"><b><br /></b></td>
|
189
|
-
</tr>
|
190
|
-
</table>
|
191
|
-
<!-- STOP Hit point Table -->
|
192
|
-
<!-- START AC Table -->
|
193
|
-
<table summary="AC Table">
|
194
|
-
<tr>
|
195
|
-
<td align="center" bgcolor="black"><font style="font-size:9pt" color="white"><b>AC</b></font></td>
|
196
|
-
<!-- Thomas Behr 13-02-02: replaced old tokens with new ones -->
|
197
|
-
<td align="center" class="border9"><b>{{ character.ac }}</b></td>
|
198
|
-
</tr>
|
199
|
-
<tr>
|
200
|
-
<td align="center" width="50"></td>
|
201
|
-
</tr>
|
202
|
-
</table>
|
203
|
-
<!-- STOP AC Table -->
|
204
|
-
</td>
|
205
|
-
</tr>
|
206
|
-
<tr>
|
207
|
-
<td valign="top">
|
208
|
-
<!-- START Initiative Table -->
|
209
|
-
<table width="35%" summary="Initiative Table">
|
210
|
-
<tr>
|
211
|
-
<td align="center" bgcolor="black"><font style="font-size:9pt" color="white"><b>INITIATIVE</b></font></td>
|
212
|
-
<td align="center" class="border9"><b>{{ character.initiative }}</b></td>
|
213
|
-
</tr>
|
214
|
-
<tr>
|
215
|
-
</tr>
|
216
|
-
</table>
|
217
|
-
<!-- STOP Initiative Table -->
|
218
|
-
<!-- START Base Attack Table -->
|
219
|
-
<table width="100%" summary="Base Attack Table">
|
220
|
-
<tr>
|
221
|
-
<td align="center" bgcolor="black"><font style="font-size:9pt" color="white"><b>BAB</b></font></td>
|
222
|
-
<td align="center" width="94" class="border10"><b>{{ character.bab }} <br /></b></td>
|
223
|
-
<td align="center" width="50%"><br /></td>
|
224
|
-
</tr>
|
225
|
-
</table>
|
226
|
-
<!-- STOP Base Attack Table -->
|
227
|
-
</td>
|
228
|
-
<td rowspan="2" valign="top" width="50%">
|
229
|
-
</td>
|
230
|
-
</tr>
|
231
|
-
<tr>
|
232
|
-
<td colspan="2" valign="top">
|
233
|
-
<!-- START Saving Throws Table -->
|
234
|
-
<table width="25%" summary="Saving Throws">
|
235
|
-
<tr>
|
236
|
-
<td align="center" bgcolor="black"><font style="font-size:10pt" color="white"><b>Fortitude</b></font>
|
237
|
-
</td>
|
238
|
-
<td align="center" class="border9"><b>{{ character.fortitude }}</b></td>
|
239
|
-
</tr>
|
240
|
-
<tr>
|
241
|
-
<td align="center" bgcolor="black"><font style="font-size:10pt" color="white"><b>Reflex</b></font>
|
242
|
-
</td>
|
243
|
-
<td align="center" class="border9"><b>{{ character.reflex }}</b></td>
|
244
|
-
</tr>
|
245
|
-
<tr>
|
246
|
-
<td align="center" bgcolor="black"><font style="font-size:10pt" color="white"><b>Will</b></font>
|
247
|
-
</td>
|
248
|
-
<td align="center" class="border9"><b>{{ character.will }}</b></td>
|
249
|
-
</tr>
|
250
|
-
</table>
|
251
|
-
<!-- STOP Saving Throws Table -->
|
252
|
-
<!-- START Unarmed Attack Table -->
|
253
|
-
<table cellpadding="0" cellspacing="0" border="0" width="100%" summary="Unarmed Attack Table">
|
254
|
-
<tr>
|
255
|
-
<td align="center" height="25" bgcolor="black" rowspan="2" width="125"><font style="font-size:10pt" color="white"><b>Attack</b></font></td>
|
256
|
-
<td align="center" bgcolor="black" width="110" height="15"><font style="font-size:6pt" color="white"><b>TOTAL ATTACK BONUS</b></font></td>
|
257
|
-
<td align="center" bgcolor="black" width="60" height="15"><font style="font-size:6pt" color="white"><b>DAMAGE</b></font></td>
|
258
|
-
<td align="center" bgcolor="black" width="60" height="15"><font style="font-size:6pt" color="white"><b>CRITICAL</b></font></td>
|
259
|
-
</tr>
|
260
|
-
<tr><td align="center" bgcolor="white" class="border8"><b>{{ character.full_attack.join('/') }}<br /></b></td>
|
261
|
-
<td align="center" bgcolor="white" class="border8"><b>{{ character.damage }}<br /></b></td>
|
262
|
-
<td align="center" bgcolor="white" class="border8"><b>--<br /></b></td>
|
263
|
-
</tr>
|
264
|
-
</table>
|
265
|
-
<!-- STOP Saving Throws Table -->
|
266
|
-
</td>
|
267
|
-
</tr>
|
268
|
-
</table>
|
269
|
-
</body>
|
270
|
-
</html>
|
data/lib/wayfinder.rb
CHANGED
@@ -1,76 +1,93 @@
|
|
1
|
-
|
1
|
+
require 'hashdot'
|
2
2
|
|
3
|
+
module Wayfinder
|
3
4
|
BASE_STATS = %w(strength dexterity constitution wisdom charisma intelligence)
|
4
5
|
|
5
6
|
class Character
|
6
7
|
|
7
|
-
## :
|
8
|
-
## its
|
8
|
+
## :source_data must be a hash with the following keys, each containing the data of
|
9
|
+
## its corresponding yaml file.
|
10
|
+
#
|
11
|
+
# * main - contains hp, base attack bonus, saving throws, xp, name,
|
12
|
+
# basic stats, str, dex, con, wis, int and cha.
|
13
|
+
#
|
14
|
+
# * modifiers - contains descriptions of items, feats, magical effects, or
|
15
|
+
# any other thing that modifies character attributes.
|
9
16
|
#
|
10
|
-
# * meta - contains hp, base attack bonus, saving throws, xp, name,
|
11
|
-
# and other metadata.
|
12
|
-
# * stats - contains basic stats, str, dex, con, wis, int and cha.
|
13
|
-
# * gear - contains descriptions of items that modify the final
|
14
|
-
# computed stats for the character.
|
15
|
-
# * feats - character feats, similar to gear in that it contributes
|
16
|
-
# to the final stack.
|
17
|
-
# * buffs - buffs are temporary modifiers that are expected to change
|
18
|
-
# often, but act much like feats and gear.
|
19
17
|
# * skills - skills contain data on the ranks and associated stats for
|
20
18
|
# each given skill.
|
21
|
-
#
|
22
|
-
## :modifier_stack is an array of gear, feats and buffs and is what will be
|
23
|
-
## iterated while computing final modifiers for all character stats.
|
24
19
|
|
25
|
-
attr_accessor :
|
20
|
+
attr_accessor :source_data
|
26
21
|
|
27
22
|
def initialize(source_data = {})
|
28
|
-
self.
|
29
|
-
self.modifier_stack = [
|
30
|
-
self.source[:gear],
|
31
|
-
self.source[:feats],
|
32
|
-
self.source[:buffs]
|
33
|
-
]
|
23
|
+
self.source_data = source_data
|
34
24
|
end
|
35
25
|
|
36
26
|
BASE_STATS.each do |base_stat|
|
37
27
|
define_method(base_stat) do
|
38
|
-
|
28
|
+
base_ability_scores[base_stat] + modifier_for(base_stat)
|
39
29
|
end
|
40
30
|
|
41
31
|
define_method("#{ base_stat }_modifier") do
|
42
|
-
stat =
|
32
|
+
stat = base_ability_scores[base_stat] + modifier_for(base_stat)
|
43
33
|
(stat - 10) / 2
|
44
34
|
end
|
45
35
|
end
|
46
36
|
|
37
|
+
def base_ability_scores
|
38
|
+
source_data.main.ability_scores
|
39
|
+
end
|
40
|
+
|
41
|
+
def base_saving_throws
|
42
|
+
source_data.main.saving_throws
|
43
|
+
end
|
44
|
+
|
45
|
+
def fortitude
|
46
|
+
base_saving_throws.fortitude + constitution_modifier + modifier_for('fortitude')
|
47
|
+
end
|
48
|
+
|
49
|
+
def reflex
|
50
|
+
base_saving_throws.reflex + dexterity_modifier + modifier_for('reflex')
|
51
|
+
end
|
52
|
+
|
53
|
+
def will
|
54
|
+
base_saving_throws.will + wisdom_modifier + modifier_for('will')
|
55
|
+
end
|
56
|
+
|
57
|
+
def saving_throws
|
58
|
+
{
|
59
|
+
fortitude: fortitude,
|
60
|
+
reflex: reflex,
|
61
|
+
will: will
|
62
|
+
}
|
63
|
+
end
|
64
|
+
|
47
65
|
## Returns an array of items in the modifier stack marked with 'active: true'
|
48
66
|
def active_stack
|
49
|
-
|
67
|
+
source_data.modifiers.select { |item| item.active }
|
50
68
|
end
|
51
69
|
|
52
70
|
## Returns an array of object who affect the specified attribute
|
53
71
|
def stack_for(attribute)
|
54
|
-
|
55
|
-
applicable_stack = []
|
56
|
-
|
57
|
-
self.active_stack.keep_if { |item|
|
58
|
-
# We care about the attributes each modifier affects.
|
72
|
+
related_stack = active_stack.select { |item|
|
59
73
|
item.fetch('modifiers', {}).keys.include?(attribute)
|
60
|
-
}.group_by { |
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
74
|
+
}.group_by { |item| item['type'] }
|
75
|
+
|
76
|
+
# Start by adding all modifiers with no type, or initializing at []
|
77
|
+
applicable_stack = related_stack.delete(nil) || []
|
78
|
+
|
79
|
+
# Then for each of the remaining modifiers by group, pick only the
|
80
|
+
# biggest one.
|
81
|
+
related_stack.each { |_, mods|
|
82
|
+
applicable_stack << mods.sort_by { |m|
|
83
|
+
m.modifiers[attribute]
|
84
|
+
}.last
|
85
|
+
}
|
69
86
|
|
70
87
|
applicable_stack
|
71
88
|
end
|
72
89
|
|
73
|
-
## Outputs the final modifier for the specified attribute.
|
90
|
+
## Outputs the final numeric modifier for the specified attribute.
|
74
91
|
def modifier_for(attribute)
|
75
92
|
modifier = 0
|
76
93
|
|
@@ -82,25 +99,27 @@ module Wayfinder
|
|
82
99
|
end
|
83
100
|
|
84
101
|
def name
|
85
|
-
|
102
|
+
source_data.main.name
|
86
103
|
end
|
87
104
|
|
88
|
-
def
|
89
|
-
|
105
|
+
def alignment
|
106
|
+
source_data.main.alignment
|
90
107
|
end
|
91
108
|
|
92
|
-
|
109
|
+
def xp
|
110
|
+
source_data.main.xp
|
111
|
+
end
|
93
112
|
|
94
113
|
def hp
|
95
|
-
|
114
|
+
source_data.main.hp + modifier_for('hp')
|
96
115
|
end
|
97
116
|
|
98
117
|
def received_damage
|
99
|
-
|
118
|
+
source_data.main.received_damage
|
100
119
|
end
|
101
120
|
|
102
121
|
def current_hp
|
103
|
-
|
122
|
+
hp - received_damage
|
104
123
|
end
|
105
124
|
|
106
125
|
def speed
|
@@ -112,7 +131,7 @@ module Wayfinder
|
|
112
131
|
end
|
113
132
|
|
114
133
|
def bab
|
115
|
-
|
134
|
+
source_data.main.bab
|
116
135
|
end
|
117
136
|
|
118
137
|
def to_hit(base_attack = self.bab)
|
@@ -124,7 +143,7 @@ module Wayfinder
|
|
124
143
|
end
|
125
144
|
|
126
145
|
def full_attack
|
127
|
-
attack_babs = [
|
146
|
+
attack_babs = [bab]
|
128
147
|
|
129
148
|
## Fuck yeah I used a while in ruby, fuck you, fuck everything, EVERYTHING.
|
130
149
|
while attack_babs.last - 5 >= 1
|
@@ -139,53 +158,34 @@ module Wayfinder
|
|
139
158
|
end
|
140
159
|
|
141
160
|
def cmd
|
142
|
-
10 +
|
161
|
+
10 + bab + strength_modifier + dexterity_modifier + modifier_for('cmd')
|
143
162
|
end
|
144
163
|
|
145
164
|
def cmb
|
146
|
-
10 +
|
165
|
+
10 + bab + strength_modifier + modifier_for('cmd')
|
147
166
|
end
|
148
167
|
|
149
168
|
def damage_reduction
|
150
169
|
0 + modifier_for('damage_reduction')
|
151
170
|
end
|
152
171
|
|
153
|
-
## Saving Throws
|
154
|
-
def saving_throws
|
155
|
-
{
|
156
|
-
fortitude: self.fortitude,
|
157
|
-
reflex: self.reflex,
|
158
|
-
will: self.will
|
159
|
-
}
|
160
|
-
end
|
161
|
-
|
162
|
-
def fortitude
|
163
|
-
self.source[:meta]['fortitude'] + constitution_modifier + modifier_for('fortitude')
|
164
|
-
end
|
165
|
-
|
166
|
-
def reflex
|
167
|
-
self.source[:meta]['reflex'] + dexterity_modifier + modifier_for('reflex')
|
168
|
-
end
|
169
|
-
|
170
|
-
def will
|
171
|
-
self.source[:meta]['will'] + wisdom_modifier + modifier_for('will')
|
172
|
-
end
|
173
|
-
|
174
172
|
def skill(skill_name)
|
175
|
-
skill =
|
176
|
-
computed_score = skill.fetch('ranks', 0) + self.send("#{ skill['stat'] }_modifier") + modifier_for(skill_name) + modifier_for('all_skills')
|
173
|
+
skill = source_data.skills.fetch(skill_name, {})
|
177
174
|
|
178
|
-
|
179
|
-
|
180
|
-
|
175
|
+
computed_score = skill.fetch('ranks', 0) +
|
176
|
+
self.send("#{ skill.stat }_modifier") +
|
177
|
+
modifier_for(skill_name) +
|
178
|
+
modifier_for('all_skills')
|
179
|
+
|
180
|
+
computed_score += 3 if skill['class']
|
181
181
|
|
182
182
|
computed_score
|
183
183
|
end
|
184
184
|
|
185
185
|
def skills
|
186
|
-
|
187
|
-
|
188
|
-
|
186
|
+
source_data.skills.map do |name, _|
|
187
|
+
[name, skill(name)]
|
188
|
+
end.to_h
|
189
189
|
end
|
190
190
|
end
|
191
191
|
end
|
metadata
CHANGED
@@ -1,69 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wayfinder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- pote
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: box
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - '>='
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - '>='
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: mote
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
30
16
|
requirements:
|
31
|
-
- -
|
17
|
+
- - ">="
|
32
18
|
- !ruby/object:Gem::Version
|
33
19
|
version: '0'
|
34
20
|
type: :runtime
|
35
21
|
prerelease: false
|
36
22
|
version_requirements: !ruby/object:Gem::Requirement
|
37
23
|
requirements:
|
38
|
-
- -
|
24
|
+
- - ">="
|
39
25
|
- !ruby/object:Gem::Version
|
40
26
|
version: '0'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: clap
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
44
30
|
requirements:
|
45
|
-
- -
|
31
|
+
- - ">="
|
46
32
|
- !ruby/object:Gem::Version
|
47
33
|
version: '0'
|
48
34
|
type: :runtime
|
49
35
|
prerelease: false
|
50
36
|
version_requirements: !ruby/object:Gem::Requirement
|
51
37
|
requirements:
|
52
|
-
- -
|
38
|
+
- - ">="
|
53
39
|
- !ruby/object:Gem::Version
|
54
40
|
version: '0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
42
|
+
name: hashdot
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
58
44
|
requirements:
|
59
|
-
- -
|
45
|
+
- - ">="
|
60
46
|
- !ruby/object:Gem::Version
|
61
47
|
version: '0'
|
62
48
|
type: :runtime
|
63
49
|
prerelease: false
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
65
51
|
requirements:
|
66
|
-
- -
|
52
|
+
- - ">="
|
67
53
|
- !ruby/object:Gem::Version
|
68
54
|
version: '0'
|
69
55
|
description: |-
|
@@ -88,17 +74,17 @@ require_paths:
|
|
88
74
|
- lib
|
89
75
|
required_ruby_version: !ruby/object:Gem::Requirement
|
90
76
|
requirements:
|
91
|
-
- -
|
77
|
+
- - ">="
|
92
78
|
- !ruby/object:Gem::Version
|
93
79
|
version: '0'
|
94
80
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
81
|
requirements:
|
96
|
-
- -
|
82
|
+
- - ">="
|
97
83
|
- !ruby/object:Gem::Version
|
98
84
|
version: '0'
|
99
85
|
requirements: []
|
100
86
|
rubyforge_project:
|
101
|
-
rubygems_version: 2.
|
87
|
+
rubygems_version: 2.2.2
|
102
88
|
signing_key:
|
103
89
|
specification_version: 4
|
104
90
|
summary: Pathfinder RPG character bookkeeping made easy.
|