Give dragon armor extra effects

Dragon scales and dragon scale mails will provide some extra effects
when worn:

 - blue:   very fast speed
 - black:  level-drain resistance
 - green:  sickness resistance
 - gold:   hallucination resistance
 - orange: free action
 - red:    infravision
 - white:  slow digestion
 - yellow: stoning resistance

gray and silver don't have extra effects - those two are already the
best ones, so don't need any.
This commit is contained in:
Pasi Kallinen
2021-12-20 23:22:07 +02:00
parent 0bc396282d
commit ef1eeed755
3 changed files with 95 additions and 4 deletions

View File

@@ -717,6 +717,7 @@ mark some messages as urgent ("You die*.", having equipment stolen, being
if a leashed pet changed name (#name m) or an unnamed pet changed type if a leashed pet changed name (#name m) or an unnamed pet changed type
(polymorph or grow-up) and perm_invent was On, persistent inventory (polymorph or grow-up) and perm_invent was On, persistent inventory
display didn't get updated to show the leash's changed information display didn't get updated to show the leash's changed information
give some dragon armor extra effects when worn
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository Fixes to 3.7.0-x Problems that Were Exposed Via git Repository

View File

@@ -66,7 +66,8 @@
/* Intrinsics only */ /* Intrinsics only */
#define HSick_resistance u.uprops[SICK_RES].intrinsic #define HSick_resistance u.uprops[SICK_RES].intrinsic
#define Sick_resistance (HSick_resistance || defends(AD_DISE, uwep)) #define ESick_resistance u.uprops[SICK_RES].extrinsic
#define Sick_resistance (HSick_resistance || ESick_resistance || defends(AD_DISE, uwep))
#define Invulnerable u.uprops[INVULNERABLE].intrinsic /* [Tom] */ #define Invulnerable u.uprops[INVULNERABLE].intrinsic /* [Tom] */

View File

@@ -30,6 +30,7 @@ static int Gloves_on(void);
static void wielding_corpse(struct obj *, boolean); static void wielding_corpse(struct obj *, boolean);
static int Shield_on(void); static int Shield_on(void);
static int Shirt_on(void); static int Shirt_on(void);
static void dragon_armor_handling(struct obj *, boolean);
static void Amulet_on(void); static void Amulet_on(void);
static void learnring(struct obj *, boolean); static void learnring(struct obj *, boolean);
static void Ring_off_or_gone(struct obj *, boolean); static void Ring_off_or_gone(struct obj *, boolean);
@@ -691,16 +692,100 @@ Shirt_off(void)
return 0; return 0;
} }
/* handle extra abilities for hero wearing dragon scale armor */
static void
dragon_armor_handling(struct obj *otmp, boolean puton)
{
if (!otmp)
return;
switch (otmp->otyp) {
/* grey: no extra effect */
/* silver: no extra effect */
case BLACK_DRAGON_SCALES:
case BLACK_DRAGON_SCALE_MAIL:
if (puton) {
EDrain_resistance |= W_ARM;
} else {
EDrain_resistance &= ~W_ARM;
}
break;
case BLUE_DRAGON_SCALES:
case BLUE_DRAGON_SCALE_MAIL:
if (puton) {
if (!Very_fast)
pline("You speed up%s.", Fast ? " a bit more" : "");
EFast |= W_ARM;
} else {
EFast &= ~W_ARM;
if (!Very_fast && !g.context.takeoff.cancelled_don)
pline("You slow down.");
}
break;
case GREEN_DRAGON_SCALES:
case GREEN_DRAGON_SCALE_MAIL:
if (puton) {
ESick_resistance |= W_ARM;
} else {
ESick_resistance &= ~W_ARM;
}
break;
case RED_DRAGON_SCALES:
case RED_DRAGON_SCALE_MAIL:
if (puton) {
EInfravision |= W_ARM;
} else {
EInfravision &= ~W_ARM;
}
see_monsters();
break;
case GOLD_DRAGON_SCALES:
case GOLD_DRAGON_SCALE_MAIL:
(void) make_hallucinated((long) !puton,
g.program_state.restoring ? FALSE : TRUE,
W_ARM);
break;
case ORANGE_DRAGON_SCALES:
case ORANGE_DRAGON_SCALE_MAIL:
if (puton) {
Free_action |= W_ARM;
} else {
Free_action &= ~W_ARM;
}
break;
case YELLOW_DRAGON_SCALES:
case YELLOW_DRAGON_SCALE_MAIL:
if (puton) {
EStone_resistance |= W_ARM;
} else {
EStone_resistance &= ~W_ARM;
}
break;
case WHITE_DRAGON_SCALES:
case WHITE_DRAGON_SCALE_MAIL:
if (puton) {
ESlow_digestion |= W_ARM;
} else {
ESlow_digestion &= ~W_ARM;
}
break;
default:
break;
}
}
static int static int
Armor_on(void) Armor_on(void)
{ {
/*
* Gold DSM requires special handling since it emits light when worn.
*/
if (!uarm) /* no known instances of !uarm here but play it safe */ if (!uarm) /* no known instances of !uarm here but play it safe */
return 0; return 0;
uarm->known = 1; /* suit's +/- evident because of status line AC */ uarm->known = 1; /* suit's +/- evident because of status line AC */
dragon_armor_handling(uarm, TRUE);
/*
* Gold DSM requires special handling since it emits light when worn.
*/
if (artifact_light(uarm) && !uarm->lamplit) { if (artifact_light(uarm) && !uarm->lamplit) {
begin_burn(uarm, FALSE); begin_burn(uarm, FALSE);
if (!Blind) if (!Blind)
@@ -721,6 +806,8 @@ Armor_off(void)
setworn((struct obj *) 0, W_ARM); setworn((struct obj *) 0, W_ARM);
g.context.takeoff.cancelled_don = FALSE; g.context.takeoff.cancelled_don = FALSE;
dragon_armor_handling(otmp, FALSE);
if (was_arti_light && !artifact_light(otmp)) { if (was_arti_light && !artifact_light(otmp)) {
end_burn(otmp, FALSE); end_burn(otmp, FALSE);
if (!Blind) if (!Blind)
@@ -745,6 +832,8 @@ Armor_gone(void)
setnotworn(uarm); setnotworn(uarm);
g.context.takeoff.cancelled_don = FALSE; g.context.takeoff.cancelled_don = FALSE;
dragon_armor_handling(otmp, FALSE);
if (was_arti_light && !artifact_light(otmp)) { if (was_arti_light && !artifact_light(otmp)) {
end_burn(otmp, FALSE); end_burn(otmp, FALSE);
if (!Blind) if (!Blind)