-
Notifications
You must be signed in to change notification settings - Fork 15
/
item-sword.rant
122 lines (110 loc) · 3.83 KB
/
item-sword.rant
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
[%enchant-item: item] {
@{
@if @not [has: <item>; enchantments]: {
<item/enchantments = (::)>
}
<$damage = 0; $weight = 0>
# Apply enchantment
[augment-self: <item/enchantments>; (:: {{
fire <damage = 2> @weight 10 |
ice <damage = 1> @weight 12 |
lightning <damage = 3> @weight 5 |
wind <damage = 1; weight = -1> @weight 8 |
time @weight 3 |
demon <damage = 12> @weight 1
}} = 1)]
# Apply bonus damage from enchantment
[augment-self: <item>; (:: <damage>; <weight>)]
}
}
[%refine-item: item] {
<$weight = <item/weight>; $damage = <item/damage>>
[rand: 1; 3 > %refine-amount]
@if <weight> @gt; 0: { <weight = <weight> / <refine-amount>> }
<damage = <damage> * <refine-amount> * [randf: 1; 1.5]>
<item/damage = <damage>>
<item/weight = <weight>>
<item/refined = <refine-amount>>
}
[%name-sword: item] {
@{
{
{
{Big|Great|{Iron|Bronze|Steel}|Gleaming|Shiny|Long|Battle|Standard|War{|time}|{Knight's|Warrior's}|Vengeful}
|
{Masterful|Godly|Last|Amazing|Holy|Fearful|Abundant} @weight {[len: <item/enchantments ? "">] - 2} * 10
|
{Boring|Ordinary|Average|Common|Standard} @weight @not <item/enchantments?> @and @not <item/refined?>
} @weight [either: <item/enchantments?>; 1; 3]
|
{Horrible|Terrible|Hell|Damned|Banished|Fate|Cryptid|Headless|Risen|Punished|Devil's|Horned} @weight <item/enchantments/demon ? 0> * 3
|
{Blazing|Hot|Flaming|Fiery|Ember|Lava|Magma|Sun|Smoldering|Smoking|{Red|White}-hot} @weight <item/enchantments/fire ? 0>
|
{Roaring|Freezing|Bitter|Sub-zero|Frosty|Frigid|Winter} @weight <item/enchantments/ice ? 0>
|
{Whistling|Howling|Flighted|Airborne|Gusting|Tornadic|Soaring} @weight <item/enchantments/wind ? 0>
|
{Century|Early|Late|Speedy|Slow-motion|Midnight} @weight <item/enchantments/time ? 0>
}\s
{
{{Sword|Cutter|Blade}|{Smasher|Slicer|Dicer|Cutter-Upper}|Cutlass|Broadsword|Scimitar|Machete|Katana|Greatsword @weight <item/weight> * 0.7}
|
{Sunbeam|Heatstroke|Sun|Burninator|Crucible|Flame|Nuclear Fuel Rod @weight 0.01} @weight <item/enchantments/fire ? 0>
|
{Glacier|Blizzard|Snowstorm|Icicle|Freezer|Coldsnap|Flash Freeze|Avalanche} @weight <item/enchantments/ice ? 0>
|
{Hurricane|Leafblower|Windstorm|Tornado|Twister|Gale|{Wing|Feather}} @weight <item/enchantments/wind ? 0>
|
{
{Nightmare|Apocalypse|Temptress|Devil|Summoner|Ritual|Tragedy|Horseman}
|
{Lake of Fire|{Flames|Fires} of Hell|{Soul|Sin|Sinner}-{Burner|Melter|Smelter}} @weight <item/enchantments/fire ? 0> * 10
} @weight <item/enchantments/demon ? 0>
|
{Clockstopper|Sundial} @weight <item/enchantments/time ? 0>
}
}
@if <item/refined?>: {
\s\({Hardened|Fine|Refined|Special Edition}\)
}
{ @edit name: <item/name = <name>> }
}
[%gen-base-sword-stats] {
<
%weight = [randf: 0.1; 10];
%damage = <weight> / 16.0 + [randf: 1; 10];
>
(:: <weight>; <damage>)
}
[%gen-sword] {
# Generate the base stats for the sword
[gen-base-sword-stats > %sword]
# Enchant it
@if [maybe: 0.9]: {
[rep: {1 @weight 10 | 2 @weight 3 | 3 @weight 1}] {
[enchant-item: <sword>]
}
}
# Refine it
@if [maybe: 0.05]: {
[refine-item: <sword>]
}
# Name it
[name-sword: <sword>]
# Return the sword to the caller
<sword>
}
[%stat-num-str: n] {
[num-fmt-precision: 2]
""<n>
}
[rep: 10][sep: \n]
{
[gen-sword |> cat:
<[]/name>\n;
~" - Enchantments: " <[]/enchantments ? none>\n;
~" - Weight: " [stat-num-str: <[]/weight>]\n;
~" - Damage: " [stat-num-str: <[]/damage>]
]
}