-
Notifications
You must be signed in to change notification settings - Fork 0
/
oaarpg.html
171 lines (142 loc) · 5.91 KB
/
oaarpg.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<div class="main">
<!-- LOGO SECTION -->
<div class="logo section"></div>
<!-- NAME SECTION -->
<div class="name section">
<div class="section-small flex-center">
<label>NAME: </label>
<input name="attr_character_name" type="text">
</div>
<div class="section-small flex-center">
<label>ORDER: </label>
<input name="attr_order" type="text">
</div>
</div>
<!-- MAIN STAT SECTION -->
<div class="stats section">
<div>
<button name="roll_init" type="roll" value="&{template:default} {{name=Initiative}} {{Result=[[d20]]}} &{tracker}"><span>Initiative</span></button>
</div>
<div class="stat-block flex-center">
<label>STRENGTH</label>
<input name="attr_strength" type="number" value="">
<span name="attr_strength_bonus"></span>
<button name="roll_strength" type="roll" value="&{template:default} {{name=Strength}} {{Result=[[d20+(@{strength_bonus})]]}}"></button>
</div>
<div class="stat-block flex-center">
<label>INTELLIGENCE</label>
<input name="attr_intelligence" type="number" value="">
<span name="attr_intelligence_bonus"></span>
<button name="roll_intelligence" type="roll" value="&{template:default} {{name=Intelligence}} {{Result=[[d20+(@{intelligence_bonus})]]}}"></button>
</div>
<div class="stat-block flex-center">
<label>CHARM</label>
<input name="attr_charm" type="number" value="">
<span name="attr_charm_bonus"></span>
<button name="roll_charm" type="roll" value="&{template:default} {{name=Charm}} {{Result=[[d20+(@{charm_bonus})]]}}"></button>
</div>
<div class="stat-block flex-center">
<label>ARCANA</label>
<input name="attr_arcana" type="number" value="">
<span name="attr_arcana_bonus"></span>
<button name="roll_arcana" type="roll" value="&{template:default} {{name=Arcana}} {{Result=[[d20+(@{arcana_bonus})]]}}"></button>
</div>
<div class="stat-block flex-center">
<label>GRACE</label>
<input name="attr_grace" type="number" value="">
<span name="attr_grace_bonus"></span>
<button name="roll_grace" type="roll" value="&{template:default} {{name=Grace}} {{Result=[[d20+(@{grace_bonus})]]}}"></button>
</div>
<div class="stat-block flex-center">
<label>DEFENSE</label>
<input name="attr_defense" type="number" value="10">
<input name="attr_defense_bonus" type="number" value="">
</div>
<div class="stat-block flex-center">
<label>HIT POINTS</label>
<input name="attr_hit_points" type="number" value="">
<input name="attr_hit_points_max" type="number" value="">
</div>
</div>
<!-- RESISTANCE/WEAKNESS/ADVANTAGE SECTION -->
<div class="resistance section flex-center">
<div>
<label>Resistance/</label>
<label>Weakness</label>
<hr>
<label>Advantage/</label>
<label>Disadvantage</label>
</div>
<div>
<input name="attr_resistance1" type="text">
<input name="attr_resistance2" type="text">
<input name="attr_resistance3" type="text">
<input name="attr_resistance4" type="text">
<input name="attr_resistance5" type="text">
</div>
</div>
<!-- BIO SECTION -->
<div class="bio section flex-center flex-middle flex-down">
<label>Bio</label>
<textarea name="attr_bio" placeholder="Bio"></textarea>
</div>
<!-- GOLD SECTION-->
<div class="gold section flex-center">
<label>Gold:</label>
<input name="attr_gold" type="number" value="10">
</div>
<!-- LOAD SECTION -->
<div class="load section flex-center flex-middle flex-down">
<label>Load</label>
<span>
<input name="attr_attack_name" type="text" placeholder="Attack/Weapon Name">
<input name="attr_attack_bonus" type="number" value="">
<input name="attr_attack_damage" type="text" value="1d6" class="small">
<button name="roll_attack" type="roll" value="&{template:default} {{name=@{attack_name}}} {{Attack=[[d20+(@{attack_bonus})]]}} {{Damage=[[@{attack_damage}]]}}" class ="small"></button>
</span>
<textarea name="attr_load" placeholder="Load"></textarea>
</div>
<!-- SKILLED WITH SECTION -->
<div class="skilled section flex-center">
<label>Skilled with: </label>
<input name="attr_skilled_with" type="text">
</div>
<!-- ORDER SKILL SECTION -->
<div class="order-skills section flex-center flex-down">
<label>Order Skills</label>
<textarea name="attr_order_skills" placeholder="Order Skills"></textarea>
</div>
</div>
<input name="attr_strength_bonus" type="hidden" value="0">
<input name="attr_intelligence_bonus" type="hidden" value="0">
<input name="attr_charm_bonus" type="hidden" value="0">
<input name="attr_arcana_bonus" type="hidden" value="0">
<input name="attr_grace_bonus" type="hidden" value="0">
<!-- ---------------------------SHEET WORKERS----------------- -->
<script type="text/worker">
const int = score => parseInt(score, 10) || 0;
// Auto-calculates & updates 'Stat Bonus' based on changes to corresponding 'Base Stat',
// according to the table on page 5 of the Rulebook.
// If the Base stat is less than 1, the sheet sets the bonus to "-2"
const stats = ["strength", "intelligence", "charm", "arcana", "grace"];
stats.forEach(stat => {
on(`change:${stat}`, () => {
getAttrs([stat], values => {
const stat_base = int(values[stat]);
console.log(stat_base);
let stat_bonus = 0;
if (stat_base >= 17) stat_bonus = "+4";
else if (stat_base >= 16) stat_bonus = "+3";
else if (stat_base >= 13) stat_bonus = "+2";
else if (stat_base >= 9) stat_bonus = "+1";
else if (stat_base >= 7) stat_bonus = "0";
else if (stat_base >= 5) stat_bonus = "-1";
else if (stat_base >= 1) stat_bonus = "-2";
else stat_bonus = "-2";
setAttrs({
[`${stat}_bonus`]: stat_bonus
});
});
});
});
</script>