/
main.tpa
127 lines (113 loc) · 3.52 KB
/
main.tpa
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
// separate immunity for individual spells
// because many spell erroneously use paralyse opcode in addition to web
LAF LIST_WEB_SPELLS RET_ARRAY web_spells = spells END
// icon for item ability
COPY_EXISTING ~%WIZARD_WEB%.spl~ override
READ_LONG SPL_extended_headers_offset eh_off
READ_ASCII (eh_off + SPL_HEAD_memorised_icon) web_icon
BUT_ONLY
OUTER_SPRINT custom_web ~g_web2x~
COPY_EXISTING ~web.pro~ ~override/%custom_web%.pro~
// not using var because of how ADD_PROJECTILE works, but this must be the same as spell name
ADD_PROJECTILE ~override/g_web2x.pro~
OUTER_SET pro_id = "%g_web2x%"
COPY_EXISTING ~%WIZARD_WEB%.spl~ ~override/%custom_web%.spl~
READ_LONG SPL_extended_headers_offset eh_off
WRITE_SHORT (eh_off + SPL_HEAD_projectile) ~%pro_id%~
BUT_ONLY
// double size
OUTER_SET PRO_trigger_radius_offset = 0x204
OUTER_SET PRO_aoe_size_offset = 0x206
COPY_EXISTING ~%custom_web%.pro~ ~override~
WRITE_SHORT PRO_trigger_radius_offset 362 // 256 * sqrt(2)
WRITE_SHORT PRO_aoe_size_offset 362 // 256 * sqrt(2)
BUT_ONLY
// actual cloak
COPY_EXISTING ~clck22.itm~ ~override~
READ_STRREF NAME2 name_shandalars_cloak
SAY NAME1 ~%name_shandalars_cloak%~
SAY NAME2 @1
SAY DESC @2
WRITE_SHORT ITM_lore_to_id 170
WRITE_LONG ITM_usability_flags 0
LPF DELETE_ITEM_HEADER INT_VAR header_type = "-1" END // some leftover
LPF ADD_ITEM_EQEFFECT
INT_VAR
opcode = OPCODE_protection_from_opcode
target = TARGET_FX_self
timing = TIMING_while_equipped
parameter2 = OPCODE_web_effect
resist_dispel = NONMAGICAL
END
LPF ADD_ITEM_EQEFFECT
INT_VAR
opcode = OPCODE_prevent_special_effect_icon
target = TARGET_FX_self
timing = TIMING_while_equipped
parameter2 = ICON_webbed
resist_dispel = NONMAGICAL
END
// extra protection from individual spells
PHP_EACH web_spells AS index => spell BEGIN
PATCH_IF FILE_EXISTS_IN_GAME "%spell%.spl" BEGIN
LPF ADD_ITEM_EQEFFECT
INT_VAR
opcode = OPCODE_protection_from_spell
target = TARGET_FX_self
timing = TIMING_while_equipped
resist_dispel = NONMAGICAL
STR_VAR
resource = EVAL ~%spell%~
END
END
END
// and from self
LPF ADD_ITEM_EQEFFECT
INT_VAR
opcode = OPCODE_protection_from_spell
target = TARGET_FX_self
timing = TIMING_while_equipped
resist_dispel = NONMAGICAL
STR_VAR
resource = ~%custom_web%~
END
// save vs poison bonus
LPF ADD_ITEM_EQEFFECT
INT_VAR
opcode = OPCODE_save_vs_death_mod
target = TARGET_FX_self
timing = TIMING_while_equipped
parameter1 = 2 //amount
parameter2 = MOD_TYPE_cumulative
resist_dispel = NONMAGICAL
END
// web spell ability
LPF ADD_ITEM_HEADER
INT_VAR
range = 60 // I think 60 is correct?
insert_point = 0
charges = 1
depletion = DEPLETION_recharges
flags = FLAG_HEAD_recharge_after_rest
target = TARGET_HEAD_area
STR_VAR
icon = ~%web_icon%~
END
LPF ALTER_ITEM_HEADER INT_VAR identify = 1 END
// web spell
LPF ADD_ITEM_EFFECT
INT_VAR
opcode = OPCODE_cast_spell_at_point
parameter1 = 10 // default casting level from items
parameter2 = CASTING_TYPE_instant
timing = TIMING_permanent
target = TARGET_FX_self // doesn't work without it for some reason
STR_VAR
resource = ~%custom_web%~
END
BUT_ONLY
// set unidentified, 1 charge
COPY_EXISTING ~dezkie.cre~ ~override~
REMOVE_CRE_ITEM ~clck22~
ADD_CRE_ITEM ~clck22~ #1 #0 #0 ~none~ ~cloak~
BUT_ONLY