|
120 | 120 | target.do_jitter_animation(15) |
121 | 121 | INVOKE_ASYNC(target, TYPE_PROC_REF(/mob, emote), "laugh") |
122 | 122 |
|
123 | | -/** |
124 | | - * Called when a Bloodsucker successfully starts spending their Rank |
125 | | - * args: |
126 | | - * bloodsuckerdatum - the antagonist datum of the Bloodsucker running this. |
127 | | - * target - The Vassal (if any) we are upgrading. |
128 | | - * cost_rank - TRUE/FALSE on whether this will cost us a rank when we go through with it. |
129 | | - * blood_cost - A number saying how much it costs to rank up |
130 | | - * ask - If they want to automatically spend the rest of their ranks |
131 | | - */ |
132 | | -/datum/bloodsucker_clan/proc/on_spend_rank(datum/antagonist/bloodsucker/source, mob/living/carbon/target, cost_rank = TRUE, blood_cost, ask) |
133 | | - SIGNAL_HANDLER |
134 | | - |
135 | | - INVOKE_ASYNC(src, PROC_REF(spend_rank), bloodsuckerdatum, cost_rank, blood_cost, ask) |
136 | | - |
137 | | -/datum/bloodsucker_clan/proc/spend_rank(datum/antagonist/bloodsucker/source, cost_rank = TRUE, blood_cost, ask) |
138 | | - // Purchase Power Prompt |
139 | | - var/list/options = list() |
140 | | - for(var/datum/action/cooldown/bloodsucker/power as anything in bloodsuckerdatum.all_bloodsucker_powers) |
141 | | - if(initial(power.purchase_flags) & BLOODSUCKER_CAN_BUY && !(locate(power) in bloodsuckerdatum.powers)) |
142 | | - options[initial(power.name)] = power |
143 | | - |
144 | | - if(!LAZYLEN(options)) |
145 | | - to_chat(bloodsuckerdatum.owner.current, span_notice("You grow more ancient by the night!")) |
146 | | - else |
147 | | - // Give them the UI to purchase a power. |
148 | | - var/choice = tgui_input_list(bloodsuckerdatum.owner.current, "You have the opportunity to grow more ancient. Select a power to advance your Rank.", "Your Blood Thickens...", options) |
149 | | - // Prevent Bloodsuckers from closing/reopning their coffin to spam Levels. |
150 | | - if(cost_rank && bloodsuckerdatum.bloodsucker_level_unspent <= 0) |
151 | | - return |
152 | | - // Did you choose a power? |
153 | | - if(!choice || !options[choice]) |
154 | | - to_chat(bloodsuckerdatum.owner.current, span_notice("You prevent your blood from thickening just yet, but you may try again later.")) |
155 | | - return |
156 | | - // Prevent Bloodsuckers from closing/reopning their coffin to spam Levels. |
157 | | - if(locate(options[choice]) in bloodsuckerdatum.powers) |
158 | | - to_chat(bloodsuckerdatum.owner.current, span_notice("You prevent your blood from thickening just yet, but you may try again later.")) |
159 | | - return |
160 | | - // Prevent Bloodsuckers from purchasing a power while outside of their Coffin. |
161 | | - if(!istype(bloodsuckerdatum.owner.current.loc, /obj/structure/closet/crate/coffin)) |
162 | | - to_chat(bloodsuckerdatum.owner.current, span_warning("You must be in your Coffin to purchase Powers.")) |
163 | | - return |
164 | | - |
165 | | - // Good to go - Buy Power! |
166 | | - var/datum/action/cooldown/bloodsucker/purchased_power = options[choice] |
167 | | - bloodsuckerdatum.BuyPower(new purchased_power) |
168 | | - bloodsuckerdatum.owner.current.balloon_alert(bloodsuckerdatum.owner.current, "learned [choice]!") |
169 | | - to_chat(bloodsuckerdatum.owner.current, span_notice("You have learned how to use [choice]!")) |
170 | | - |
171 | | - finalize_spend_rank(bloodsuckerdatum, cost_rank, blood_cost, ask) |
172 | | - |
173 | | -/datum/bloodsucker_clan/proc/finalize_spend_rank(datum/antagonist/bloodsucker/source, cost_rank = TRUE, blood_cost, ask) |
174 | | - bloodsuckerdatum.LevelUpPowers() |
175 | | - bloodsuckerdatum.bloodsucker_regen_rate += 0.05 |
176 | | - bloodsuckerdatum.max_blood_volume += 100 |
177 | | - |
178 | | - // Misc. Stats Upgrades |
179 | | - if(ishuman(bloodsuckerdatum.owner.current)) |
180 | | - var/mob/living/carbon/human/user = bloodsuckerdatum.owner.current |
181 | | - var/datum/species/user_species = user.dna.species |
182 | | - user_species.punchdamagelow += 0.5 |
183 | | - // This affects the hitting power of Brawn. |
184 | | - user_species.punchdamagehigh += 0.5 |
185 | | - |
186 | | - // We're almost done - Spend your Rank now. |
187 | | - bloodsuckerdatum.bloodsucker_level++ |
188 | | - if(cost_rank) |
189 | | - bloodsuckerdatum.bloodsucker_level_unspent-- |
190 | | - if(blood_cost) |
191 | | - bloodsuckerdatum.AddBloodVolume(-blood_cost) |
192 | | - |
193 | | - // Ranked up enough to get your true Reputation? |
194 | | - if(bloodsuckerdatum.bloodsucker_level == 4) |
195 | | - bloodsuckerdatum.SelectReputation(am_fledgling = FALSE, forced = TRUE) |
196 | | - |
197 | | - to_chat(bloodsuckerdatum.owner.current, span_notice("You are now a rank [bloodsuckerdatum.bloodsucker_level] Bloodsucker. \ |
198 | | - Your strength, health, feed rate, regen rate, and maximum blood capacity have all increased! \n\ |
199 | | - * Your existing powers have all ranked up as well!")) |
200 | | - if(ask) //please no |
201 | | - bloodsuckerdatum.owner.current.playsound_local(null, 'sound/effects/pope_entry.ogg', 25, TRUE, pressure_affected = FALSE) |
202 | | - bloodsuckerdatum.update_hud() |
203 | | - if(bloodsuckerdatum.bloodsucker_level_unspent && cost_rank) |
204 | | - if(ask) |
205 | | - if(tgui_alert(bloodsuckerdatum.owner.current, "You have leftover ranks, do you want to spend them all?", "Time Management Team", list("Yes", "No")) == "No") |
206 | | - return |
207 | | - spend_rank(bloodsuckerdatum, cost_rank, blood_cost, FALSE) |
208 | 123 |
|
209 | 124 | /** |
210 | 125 | * Called when we are trying to turn someone into a Favorite Vassal |
|
0 commit comments