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

Function transform

crawl-ref/source/transform.cc:2132–2174  ·  view source on GitHub ↗

* Attempts to transform the player into the specified form. * * If the player is already in that form, attempt to refresh its duration and * power. * * @param dur The duration of the transformation (0 if the * transformation should be permanent.) * @param which_trans The form which the player should become. * @param involuntary Checks for

Source from the content-addressed store, hash-verified

2130 * Otherwise, false.
2131 */
2132bool transform(int dur, transformation which_trans, bool involuntary,
2133 bool using_talisman)
2134{
2135 // Zin's protection.
2136 if (have_passive(passive_t::resist_polymorph)
2137 && x_chance_in_y(you.piety(), piety_breakpoint(5))
2138 && which_trans != transformation::none)
2139 {
2140 simple_god_message(" protects your body from unnatural transformation!");
2141 return false;
2142 }
2143
2144 if (!involuntary && crawl_state.is_god_acting())
2145 involuntary = true;
2146
2147 if (!check_transform_into(which_trans, involuntary,
2148 using_talisman ? you.active_talisman() : nullptr))
2149 {
2150 return false;
2151 }
2152
2153 // If swapping to a different talisman of the same type, make sure to
2154 // activate properties of the new one.
2155 if (using_talisman && you.form == which_trans
2156 && is_artefact(*you.active_talisman()))
2157 {
2158 you.equipment.update();
2159 equip_artefact_effect(*you.active_talisman(), nullptr, false);
2160
2161 return true;
2162 }
2163
2164 // Vampire should shift into bat swarm without reverting to fully untransformed in the middle
2165 if (you.form != transformation::none
2166 && !(you.form == transformation::vampire && which_trans == transformation::bat_swarm))
2167 {
2168 untransform(true, !using_talisman, !using_talisman, which_trans);
2169 }
2170
2171 _enter_form(dur, which_trans, using_talisman);
2172
2173 return true;
2174}
2175
2176/**
2177 * End the player's transformation and return them to having no

Callers 15

wizard_transformFunction · 0.85
stringifyFunction · 0.85
card_effectFunction · 0.85
_handle_accidental_deathFunction · 0.85
return_to_default_formFunction · 0.85
polymorphMethod · 0.85
operator()Method · 0.85
_do_abilityFunction · 0.85
effectMethod · 0.85

Calls 13

have_passiveFunction · 0.85
x_chance_in_yFunction · 0.85
piety_breakpointFunction · 0.85
simple_god_messageFunction · 0.85
check_transform_intoFunction · 0.85
is_artefactFunction · 0.85
equip_artefact_effectFunction · 0.85
untransformFunction · 0.85
_enter_formFunction · 0.85
pietyMethod · 0.80
is_god_actingMethod · 0.80
active_talismanMethod · 0.80

Tested by

no test coverage detected