from a ring of magical power) is available. [2664906] This does not apply to HP costs because there's no way to abuse that. In theory it might still be possible to get negative real MP with the high/low magic mutations.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9347 c06c8d41-db1a-0410-9941-cceddc491573
KXZZNIE7SKHNX5T34URQMCBSCRAX4NBXUQPAAGAYC2FT3XZJDEAAC
LQKLC4OOGX6U3AGUEA44HJKXQVKQUVIQQOUDESMM4TJEY2YGFMQQC
Z5GQUATUKFUCZWG2TX62Y4WHENKK4NHJALNFF4BJ7KZK2DGGVYZQC
YKTMDZB5HVAP2IJGCOJQMIBH6CAD47O62SGRP4XNOAQ55EA3OSJQC
I3GNXBIGS7FK6WL3ZSVPRM6FRICFU4FCIJQFK6VB4YLF2SBLGIXAC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
LABXKXWWQY2V4FUDLGVTDYHXINAP6KRHZDHBQ2FE22FFOEIZPL6QC
ZBPZZ5A7AB2VFZKQ2UJXVDGUK22OCZJCEN2RWTGDGK3VXFCCDKVAC
52XHD5LKS6UVLXBYUXMPTMVMTXQ6FBUFXJ2TAW6R7CSJY7OXWVJAC
RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC
5HBRQ2QZTFBQE2Z2CFADUI2D52LO5Z5CNHXHA7BJP3LGO7FJPUCQC
MOT3YZFRY3JG2MH3GN2VD6IY3IJSAXJUXMXS222TXWKRFCENOCDQC
3SVWI6KK6IFQ6SB6L3TIC7QIGDITU5QLVAG5C7X57HH75ZHW7T2AC
CFWPAA7X7JQBNHFFEY7FJUZZ56YIQXGXEQ7EEVZMJ65YCPNO2L5AC
CCVMHSW2XB6RY3B6QRISMTF36QZ5ZA2VW2IFO7EBFUL4EKJ6HWDQC
3ZWALZFSTSIVYXY4BAY6ANGINTDACZC6RSSJTEMQSTSUIE66YOBQC
FBK5ECMQ6HJSQSN7C3DICKJIRJ3CSO3CHCQ3ONPBKLLSHDGPBQ7QC
7K5P2GRF6QUXTMERG2R3BB6DZFQYJQ6V2KNPMBPFDLOP36NQILPAC
XEC3L6W6TGIRWHINULNLKCIP4UBMHFYE33WJL7272I2GRRCFZBWAC
3BYA46OYLVN6ZPGAZD5OGIMMH5PRWGNSU3ITJRCVBE6P5HYYYAYQC
UVJBHQ5KGUIEFRHKTYQPKSXYDUDKTRAXINUXGJJJ6QGNCR6JO7ZAC
BZMLXBTB63CXPZZPFXM4VLE7IBXPBEZ6YLM4MSNQGJR4L5IBM3OAC
CH7JECYYH35H4TRHRNRTRJCQTQLZ2WRH62TKV72SUIU2RTK5OH7AC
JM7UAK777RAVDAVLQLEOBRTGNW2B47S5G55XITJXO243IUNZHVYQC
S34LKQDIQJLIWVIPASOJBBZ6ZCXDHP5KPS7TRBZJSCDRVNCLK6UAC
BINKDWGFGUPTOA7IE5KK4ZIELGU5WC3X47MYXOWU4X43EGAC5DUAC
WXSNNK2RXP3DQFAEQGQUZJHFWXJC7ZKG2WURZGL566UDM4YXFSWQC
// last_updated Sept 20 -- bwr
/* ***********************************************************************
* called from: acr - chardump - player - skills - stuff
* *********************************************************************** */
std::string player_title( void );
void init_skill_order( void );
// last_updated 24may2000 {dlb}
/* ***********************************************************************
* called from: acr - it_use2 - item_use - newgame - ouch - player - skills
* *********************************************************************** */
int calc_mp(bool real_mp = false);
// last_updated 24may2000 {dlb}
/* ***********************************************************************
* called from: ability - acr - food - it_use2 - misc - mutation -
* newgame - ouch - player - skills - spells1 - transfor
* *********************************************************************** */
int calc_hp(bool real_hp = false);
void init_skill_order();
// last_updated 24may2000 {dlb}
/* ***********************************************************************
* called from: newgame - skills - skills2
* *********************************************************************** */
int hitp = get_real_hp(!real_hp, false);
you.hp_max = hitp;
deflate_hp( you.hp_max, false );
return (hitp);
} // end calc_hp()
you.hp_max = get_real_hp(true, false);
deflate_hp(you.hp_max, false);
}
int enp;
// base_magic_points2 accounts for species and magic potions
enp = (you.base_magic_points2 - 5000);
int spell_extra = (you.experience_level * you.skills[SK_SPELLCASTING]) / 4;
int invoc_extra = (you.experience_level * you.skills[SK_INVOCATIONS]) / 6;
if (spell_extra > invoc_extra)
enp += spell_extra;
else
enp += invoc_extra;
you.max_magic_points = stepdown_value( enp, 9, 18, 45, 100 );
// this is our "rotted" base (applied after scaling):
you.max_magic_points += (you.base_magic_points - 5000);
// Yes, we really do want this duplication... this is so the stepdown
// doesn't truncate before we apply the rotted base. We're doing this
// the nice way. -- bwr
if (you.max_magic_points > 50)
you.max_magic_points = 50;
// now applied after scaling so that power items are more useful -- bwr
if (!real_mp)
you.max_magic_points += player_magical_power();
// analogous to ROBUST/FRAIL
you.max_magic_points *= (10 + player_mutation_level(MUT_HIGH_MAGIC)
- player_mutation_level(MUT_LOW_MAGIC));
you.max_magic_points /= 10;
if (you.max_magic_points > 50)
you.max_magic_points = 50 + ((you.max_magic_points - 50) / 2);
if (you.max_magic_points < 0)
you.max_magic_points = 0;
if (you.magic_points > you.max_magic_points)
you.magic_points = you.max_magic_points;
you.max_magic_points = get_real_mp(true);
you.magic_points = std::min(you.magic_points, you.max_magic_points);
/* ***********************************************************************
* called from: ability - effects - fight - it_use3 - ouch - spell -
* spells - spells2 - spells3 - spells4
* *********************************************************************** */
void dec_hp(int hp_loss, bool fatal, const char *aux = NULL);
/* ***********************************************************************
* called from: ability - it_use3 - spell - spells3
* *********************************************************************** */
bool enough_hp (int minimum, bool suppress_msg);
/* ***********************************************************************
* called from: ability - it_use3
* *********************************************************************** */
bool enough_mp (int minimum, bool suppress_msg);
bool enough_hp(int minimum, bool suppress_msg);
bool enough_mp(int minimum, bool suppress_msg, bool include_items = true);
/* ***********************************************************************
* called from: ability - fight - it_use3 - monstuff - ouch - spell
* *********************************************************************** */
void dec_hp(int hp_loss, bool fatal, const char *aux = NULL);
{
unwind_var<int> hpmax(you.hp_max);
unwind_var<int> hp(you.hp);
unwind_var<int> mpmax(you.max_magic_points);
unwind_var<int> mp(you.magic_points);
// calculate "real" values for note-taking, i.e. ignore Berserk,
// transformations or equipped items
calc_hp(true);
calc_mp(true);
// Get "real" values for note-taking, i.e. ignore Berserk,
// transformations or equipped items.
const int note_maxhp = get_real_hp(false, false);
const int note_maxmp = get_real_mp(false);
char buf[200];
sprintf(buf, "HP: %d/%d MP: %d/%d",
you.hp, you.hp_max, you.magic_points, you.max_magic_points);
take_note(Note(NOTE_XP_LEVEL_CHANGE, you.experience_level, 0, buf));
}
char buf[200];
sprintf(buf, "HP: %d/%d MP: %d/%d",
std::min(you.hp, note_maxhp), note_maxhp,
std::min(you.magic_points, note_maxmp), note_maxmp);
take_note(Note(NOTE_XP_LEVEL_CHANGE, you.experience_level, 0, buf));
}
int get_real_mp(bool include_items)
{
// base_magic_points2 accounts for species
int enp = (you.base_magic_points2 - 5000);
int spell_extra = (you.experience_level * you.skills[SK_SPELLCASTING]) / 4;
int invoc_extra = (you.experience_level * you.skills[SK_INVOCATIONS]) / 6;
enp += std::max(spell_extra, invoc_extra);
enp = stepdown_value(enp, 9, 18, 45, 100);
// this is our "rotted" base (applied after scaling):
enp += (you.base_magic_points - 5000);
// Yes, we really do want this duplication... this is so the stepdown
// doesn't truncate before we apply the rotted base. We're doing this
// the nice way. -- bwr
enp = std::min(enp, 50);
// Now applied after scaling so that power items are more useful -- bwr
if (include_items)
enp += player_magical_power();
// Analogous to ROBUST/FRAIL
enp *= (10 + player_mutation_level(MUT_HIGH_MAGIC)
- player_mutation_level(MUT_LOW_MAGIC));
enp /= 10;
if (enp > 50)
enp = 50 + ((enp - 50) / 2);
enp = std::max(enp, 0);
return enp;
if (!enough_mp( abil.mp_cost, false ))
// Note that mutation shenanigans might leave us with negative MP,
// so don't fail in that case if there's no MP cost.
if (abil.mp_cost > 0
&& !enough_mp(abil.mp_cost, false, !(abil.flags & ABFLAG_PERMANENT_MP)))