MCPcopy Create free account
hub / github.com/crawl/crawl / untransform

Function untransform

crawl-ref/source/transform.cc:2193–2336  ·  view source on GitHub ↗

* End the player's transformation and return them to having no * form. * @param skip_move If true, skip any move that was in progress before * the transformation ended. * @param scale_hp Whether keep the player's HP percentage the same if * their max HP changes. (Should be false for * talisman-related shapeshifting,

Source from the content-addressed store, hash-verified

2191 * entering a new form, what form is that?
2192 */
2193void untransform(bool skip_move, bool scale_hp, bool preserve_equipment,
2194 transformation new_form)
2195{
2196 // Skip if there's nothing that needs doing.
2197 if (you.form == transformation::none)
2198 return;
2199
2200 const transformation old_form = you.form;
2201 const bool was_flying = you.airborne();
2202
2203 if (!form_can_wield(old_form))
2204 you.received_weapon_warning = false;
2205
2206 const string message = get_form(old_form)->get_untransform_message();
2207 if (!message.empty())
2208 mprf(MSGCH_DURATION, "%s", message.c_str());
2209
2210 set_form(transformation::none, 0, scale_hp);
2211
2212 const int str_mod = get_form(old_form)->str_mod;
2213 const int dex_mod = get_form(old_form)->dex_mod;
2214
2215 if (str_mod)
2216 notify_stat_change(STAT_STR, -str_mod, true);
2217
2218 if (dex_mod)
2219 notify_stat_change(STAT_DEX, -dex_mod, true);
2220
2221 // This will keep merfolk boots melded, if mertail is currently active.
2222 you.equipment.unmeld_all_equipment();
2223
2224 if (old_form == transformation::fortress_crab)
2225 you.equipment.shift_twohander_to_slot(SLOT_OFFHAND);
2226
2227 // Update regarding talisman properties, just in case we didn't actually
2228 // meld or unmeld anything.
2229 you.equipment.update();
2230
2231 if (old_form == transformation::death)
2232 {
2233 _print_death_brand_changes(you.weapon(), false);
2234 _print_death_brand_changes(you.offhand_weapon(), false);
2235 }
2236 else if (old_form == transformation::sun_scarab)
2237 {
2238 if (monster* ember = get_solar_ember())
2239 {
2240 monster_die(*ember, KILL_RESET, NON_MONSTER);
2241 mprf(MSGCH_DURATION, "Your tiny sun winks out.");
2242 }
2243 }
2244 else if (old_form == transformation::rime_yak)
2245 {
2246 you.duration[DUR_RIME_YAK_AURA] = 0;
2247 end_terrain_change(TERRAIN_CHANGE_RIME_YAK);
2248 }
2249 else if (old_form == transformation::werewolf)
2250 you.duration[DUR_WEREFURY] = 0;

Callers 5

_extra_sacrifice_codeFunction · 0.85
transformFunction · 0.85
return_to_default_formFunction · 0.85
excommunicationFunction · 0.85
finishMethod · 0.85

Calls 15

form_can_wieldFunction · 0.85
get_formFunction · 0.85
mprfFunction · 0.85
set_formFunction · 0.85
notify_stat_changeFunction · 0.85
get_solar_emberFunction · 0.85
monster_dieFunction · 0.85
end_terrain_changeFunction · 0.85
calc_mpFunction · 0.85
unequip_itemFunction · 0.85
ash_check_bondageFunction · 0.85

Tested by

no test coverage detected