Use a macro for all foo_RES to MR_foo conversions
This makes it easier to understand what is happening in each of those places, and also much easier to find the places that conversion between hero and monster resistances happens (since you can now just grep for "res_to_mr"). I think I got all the instances where the macro should be used but I'm not 100% sure since there wasn't a single unique term to search for to find them all. I replaced the modifications to give_u_to_m_resistances made in the previous commit, so that it now uses the same macro as other conversions, since otherwise it would be much harder to find the complete list of places where conversions between hero and monster properties happen.
This commit is contained in:
@@ -1682,33 +1682,28 @@ mon_give_prop(struct monst *mtmp, int prop)
|
||||
control or whatever, ignore it. */
|
||||
switch (prop) {
|
||||
case FIRE_RES:
|
||||
intrinsic = MR_FIRE;
|
||||
msg = "%s shivers slightly.";
|
||||
break;
|
||||
case COLD_RES:
|
||||
intrinsic = MR_COLD;
|
||||
msg = "%s looks quite warm.";
|
||||
break;
|
||||
case SLEEP_RES:
|
||||
intrinsic = MR_SLEEP;
|
||||
msg = "%s looks wide awake.";
|
||||
break;
|
||||
case DISINT_RES:
|
||||
intrinsic = MR_DISINT;
|
||||
msg = "%s looks very firm.";
|
||||
break;
|
||||
case SHOCK_RES:
|
||||
intrinsic = MR_ELEC;
|
||||
msg = "%s crackles with static electricity.";
|
||||
break;
|
||||
case POISON_RES:
|
||||
intrinsic = MR_POISON;
|
||||
msg = "%s looks healthy.";
|
||||
break;
|
||||
default:
|
||||
return; /* can't give it */
|
||||
break;
|
||||
}
|
||||
intrinsic = res_to_mr(prop);
|
||||
|
||||
/* Don't give message if it already had this property intrinsically, but
|
||||
still do grant the intrinsic if it only had it from mresists.
|
||||
|
||||
Reference in New Issue
Block a user