1
0
Fork 0
mirror of https://codeberg.org/noisytoot/notnotdnethack.git synced 2025-07-26 23:32:25 +01:00

Merge pull request #1495 from NeroOneTrueKing/patch-hellp-as-ability

Make demon-gating a #monster ability for players
This commit is contained in:
Chris-plus-alphanumericgibberish 2021-05-01 18:24:56 -04:00 committed by GitHub
commit efdf2c3d1c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 54 additions and 47 deletions

View file

@ -2140,6 +2140,7 @@ E int NDECL(dospit);
E int NDECL(doremove);
E int NDECL(dospinweb);
E int NDECL(dosummon);
E int NDECL(dodemonpet);
E int NDECL(dovampminion);
E int NDECL(dotinker);
E int NDECL(dogaze);
@ -3194,7 +3195,6 @@ E int FDECL(attack_checks, (struct monst *, struct obj *));
E boolean FDECL(madness_cant_attack, (struct monst *));
E void FDECL(stumble_onto_mimic, (struct monst *));
E void FDECL(check_caitiff, (struct monst *));
E void NDECL(demonpet);
E void FDECL(steal_it, (struct monst *, struct attack *));
E int FDECL(mattacku, (struct monst *));
E int FDECL(mattackm, (struct monst *, struct monst *));

View file

@ -528,6 +528,15 @@
|| (ptr)->mtyp == PM_FIRE_STORM \
|| (ptr)->mtyp == PM_MOUTH_OF_THE_GOAT \
)
#define gates_in_help(ptr) ((is_demon((ptr)) || is_minion((ptr))) \
&& (ptr)->mtyp != PM_OONA \
&& (ptr)->mtyp != PM_BALROG \
&& (ptr)->mtyp != PM_DURIN_S_BANE \
&& (ptr)->mtyp != PM_SUCCUBUS \
&& (ptr)->mtyp != PM_INCUBUS \
)
#define always_hostile(ptr) (((ptr)->mflagst & MT_HOSTILE) != 0L)
#define always_hostile_mon(mon) (always_hostile((mon)->data))
#define always_peaceful(ptr) (((ptr)->mflagst & MT_PEACEFUL) != 0L)

View file

@ -563,7 +563,8 @@ boolean you_abilities;
add_ability('a', "Use your armor's breath weapon", MATTK_DSCALE);
}
}
if (mon_abilities && is_were(youracedata)){
if (mon_abilities && (is_were(youracedata) || gates_in_help(youracedata))){
/* shared letter; assumes a polyform will only be one or the other */
add_ability('A', "Summon aid", MATTK_SUMM);
}
if (mon_abilities && (can_breathe(youmonst.data) || Race_if(PM_HALF_DRAGON))){
@ -709,7 +710,7 @@ boolean you_abilities;
case MATTK_REMV: return doremove();
case MATTK_GAZE: return dogaze();
case MATTK_TNKR: return dotinker();
case MATTK_SUMM: return dosummon();
case MATTK_SUMM: return (is_were(youracedata) ? dosummon() : dodemonpet());
case MATTK_VAMP: return dovampminion();
case MATTK_WEBS: return dospinweb();
case MATTK_HIDE: return dohide();

View file

@ -599,7 +599,7 @@ int mntmp;
pline(use_thec,monsterc,"gaze at monsters");
if (is_hider(youmonst.data))
pline(use_thec,monsterc,"hide");
if (is_were(youmonst.data))
if (is_were(youmonst.data) || gates_in_help(youmonst.data))
pline(use_thec,monsterc,"summon help");
if (webmaker(youmonst.data))
pline(use_thec,monsterc,"spin a web");
@ -1113,6 +1113,42 @@ dosummon()
return(1);
}
int
dodemonpet()
{
int i;
struct permonst *pm;
struct monst *dtmp;
if (u.uen < 10) {
You("lack the energy to call for help!");
return(0);
}
else if (youmonst.summonpwr >= youmonst.data->mlevel) {
You("don't have the authority to call for any more help!");
return(0);
}
losepw(10);
flags.botl = 1;
i = (!is_demon(youracedata) || !rn2(6))
? ndemon(u.ualign.type) : NON_PM;
pm = i != NON_PM ? &mons[i] : youracedata;
if(pm->mtyp == PM_ANCIENT_OF_ICE || pm->mtyp == PM_ANCIENT_OF_DEATH) {
pm = rn2(4) ? &mons[PM_METAMORPHOSED_NUPPERIBO] : &mons[PM_ANCIENT_NUPPERIBO];
}
if ((dtmp = makemon(pm, u.ux, u.uy, MM_ESUM)) != 0) {
pline("Some hell-p has arrived!");
(void)tamedog(dtmp, (struct obj *)0);
mark_mon_as_summoned(dtmp, &youmonst, 250, 0);
exercise(A_WIS, TRUE);
}
else {
pline("No help arrived.");
}
return(1);
}
static NEARDATA const char food_types[] = { FOOD_CLASS, 0 };
int

View file

@ -406,24 +406,13 @@ int tary;
}
/* Special demon/minion handling code */
if (youdef && !magr->cham && (is_demon(pa) || is_minion(pa)) && !ranged && (magr->summonpwr < magr->data->mlevel)
&& pa->mtyp != PM_OONA
&& pa->mtyp != PM_BALROG
&& pa->mtyp != PM_DURIN_S_BANE
&& pa->mtyp != PM_SUCCUBUS
&& pa->mtyp != PM_INCUBUS
) {
/* mvu only; we don't want it mvm and player's is handled as an ability */
if (youdef && !magr->cham && gates_in_help(pa)&& !ranged && (magr->summonpwr < magr->data->mlevel)) {
if (!magr->mcan && !rn2(13)) {
msummon(magr, (struct permonst *)0);
}
}
if (youagr && is_demon(youracedata) && !rn2(13) && !uwep && (magr->summonpwr < magr->data->mlevel)
&& u.umonnum != PM_SUCCUBUS
&& u.umonnum != PM_INCUBUS
&& u.umonnum != PM_BALROG) {
demonpet();
return MM_MISS;
}
}
/* Special lycanthrope handling code */
if(youdef && !magr->cham && is_were(pa) && !ranged) {

View file

@ -473,34 +473,6 @@ struct monst *mtmp;
}
}
/*
* Send in a demon pet for the hero. Exercise wisdom.
*
* This function used to be inline to damageum(), but the Metrowerks compiler
* (DR4 and DR4.5) screws up with an internal error 5 "Expression Too Complex."
* Pulling it out makes it work.
*/
extern void
demonpet()
{
int i;
struct permonst *pm;
struct monst *dtmp;
pline("Some hell-p has arrived!");
i = (!is_demon(youracedata) || !rn2(6))
? ndemon(u.ualign.type) : NON_PM;
pm = i != NON_PM ? &mons[i] : youracedata;
if(pm->mtyp == PM_ANCIENT_OF_ICE || pm->mtyp == PM_ANCIENT_OF_DEATH) {
pm = rn2(4) ? &mons[PM_METAMORPHOSED_NUPPERIBO] : &mons[PM_ANCIENT_NUPPERIBO];
}
if ((dtmp = makemon(pm, u.ux, u.uy, MM_ESUM)) != 0) {
(void)tamedog(dtmp, (struct obj *)0);
mark_mon_as_summoned(dtmp, &youmonst, 250, 0);
}
exercise(A_WIS, TRUE);
}
/*
* Player uses theft attack against monster.
*