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

Function check_transform_into

crawl-ref/source/transform.cc:1857–1903  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1855}
1856
1857bool check_transform_into(transformation which_trans, bool involuntary,
1858 const item_def* talisman)
1859{
1860
1861 if (!involuntary && talisman && you.active_talisman()
1862 && !check_warning_inscriptions(*you.active_talisman(), OPER_REMOVE))
1863 {
1864 canned_msg(MSG_OK);
1865 return false;
1866 }
1867 if (!involuntary && talisman && you.active_talisman() != talisman
1868 && !check_warning_inscriptions(*talisman , OPER_PUTON))
1869 {
1870 canned_msg(MSG_OK);
1871 return false;
1872 }
1873
1874 const string reason = cant_transform_reason(which_trans, involuntary, true);
1875 if (!reason.empty())
1876 {
1877 if (!involuntary)
1878 mpr(reason);
1879 return false;
1880 }
1881
1882 // XXX: This is left out of cant_transform_reason because it can involve
1883 // melding and unwinding the player's entire inventory, which feels a
1884 // bit heavyweight for item_is_useless()
1885 const auto feat = env.grid(you.pos());
1886 if (!involuntary && feat_dangerous_for_form(which_trans, feat, talisman))
1887 {
1888 mprf("Transforming right now would cause you to %s!",
1889 feat == DNGN_DEEP_WATER ? "drown" : "burn");
1890 return false;
1891 }
1892
1893 if (!involuntary && get_form(which_trans)->mult_hp(100) < 90)
1894 {
1895 if (!yesno("This transformation would significantly lower your maximum hit points. "
1896 "Transform anyway?", true, 'n'))
1897 {
1898 return false;
1899 }
1900 }
1901
1902 return true;
1903}
1904
1905static void _print_death_brand_changes(item_def *weapon, bool entering_death)
1906{

Callers 3

use_talismanFunction · 0.85
transformFunction · 0.85
evoke_itemFunction · 0.85

Calls 13

canned_msgFunction · 0.85
cant_transform_reasonFunction · 0.85
mprFunction · 0.85
feat_dangerous_for_formFunction · 0.85
mprfFunction · 0.85
get_formFunction · 0.85
yesnoFunction · 0.85
active_talismanMethod · 0.80
gridMethod · 0.80
mult_hpMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected