Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for inability to damage doors. #190

Merged
merged 1 commit into from Nov 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
38 changes: 13 additions & 25 deletions src/act.offensive.cpp
Expand Up @@ -194,9 +194,9 @@ bool perform_hit(struct char_data *ch, char *argument, const char *cmdname)
act("$n attacks the door.", TRUE, ch, 0, 0, TO_ROOM);
act("You aim $p at the door!", FALSE, ch, wielded, 0, TO_CHAR);
}
damage_door(ch, ch->in_room, dir, (int)(GET_OBJ_VAL(wielded, 0) / 2), DAMOBJ_PIERCE);
damage_door(ch, ch->in_room, dir, (int)(GET_WEAPON_POWER(wielded) / 2), DAMOBJ_PIERCE);
return TRUE;
} else if (GET_OBJ_VAL(wielded, 3) >= TYPE_PISTOL) {
} else if (GET_WEAPON_TYPE(wielded) >= WEAP_HOLDOUT) {
if (!has_ammo(ch, wielded))
return TRUE;
WAIT_STATE(ch, PULSE_VIOLENCE * 2);
Expand All @@ -209,30 +209,18 @@ bool perform_hit(struct char_data *ch, char *argument, const char *cmdname)
act("$n attacks the door.", TRUE, ch, 0, 0, TO_ROOM);
act("You aim $p at the door!", FALSE, ch, wielded, 0, TO_CHAR);
}
damage_door(ch, ch->in_room, dir, (int)(GET_OBJ_VAL(wielded, 0) / 2), DAMOBJ_PROJECTILE);
damage_door(ch, ch->in_room, dir, (int)(GET_WEAPON_POWER(wielded) / 2), DAMOBJ_PROJECTILE);
return TRUE;
} else
switch (GET_OBJ_VAL(wielded, 3)) {
case TYPE_PIERCE:
case TYPE_STAB:
case TYPE_SHURIKEN:
type = DAMOBJ_PIERCE;
break;
case TYPE_STING:
case TYPE_SLASH:
case TYPE_CLAW:
case TYPE_THRASH:
case TYPE_ARROW:
case TYPE_THROWING_KNIFE:
type = DAMOBJ_SLASH;
break;
case TYPE_HIT:
case TYPE_BLUDGEON:
case TYPE_POUND:
case TYPE_MAUL:
case TYPE_PUNCH:
type = DAMOBJ_CRUSH;
break;
switch (GET_WEAPON_TYPE(wielded)) {
case WEAP_EDGED:
case WEAP_POLEARM:
case WEAP_WHIP:
type = DAMOBJ_SLASH;
break;
case WEAP_CLUB:
type = DAMOBJ_CRUSH;
break;
default:
if (EXIT(ch, dir)->keyword) {
sprintf(buf, "You can't damage the %s with $p!",
Expand All @@ -253,7 +241,7 @@ bool perform_hit(struct char_data *ch, char *argument, const char *cmdname)
act("$n attacks the door.", TRUE, ch, 0, 0, TO_ROOM);
act("You aim $p at the door!", FALSE, ch, wielded, 0, TO_CHAR);
}
damage_door(ch, ch->in_room, dir, (int)((GET_STR(ch) + GET_OBJ_VAL(wielded, 0)) / 2), type);
damage_door(ch, ch->in_room, dir, (int)((GET_STR(ch) + GET_WEAPON_POWER(wielded)) / 2), type);
} else {

WAIT_STATE(ch, PULSE_VIOLENCE * 2);
Expand Down
15 changes: 15 additions & 0 deletions src/utils.h
Expand Up @@ -674,6 +674,21 @@ extern bool PLR_TOG_CHK(char_data *ch, dword offset);
#define SEEK_END 2
#endif

/* Specific value invocations for item types *****************************/

// ITEM_WEAPON
#define GET_WEAPON_POWER(weapon) (GET_OBJ_VAL((weapon), 0))
#define GET_WEAPON_DAMAGE_CODE(weapon) (GET_OBJ_VAL((weapon), 1))
#define GET_WEAPON_STR_BONUS(weapon) (GET_OBJ_VAL((weapon), 2))
#define GET_WEAPON_TYPE(weapon) (GET_OBJ_VAL((weapon), 3))
#define GET_WEAPON_SKILL(weapon) (GET_OBJ_VAL((weapon), 4))
#define GET_WEAPON_MAX_AMMO(weapon) (GET_OBJ_VAL((weapon), 5))
#define GET_WEAPON_REACH(weapon) (GET_OBJ_VAL((weapon), 6))
#define GET_WEAPON_ATTACH_TOP_VNUM(weapon) (GET_OBJ_VAL((weapon), 7))
#define GET_WEAPON_ATTACH_BARREL_VNUM(weapon) (GET_OBJ_VAL((weapon), 8))
#define GET_WEAPON_ATTACH_UNDER_VNUM(weapon) (GET_OBJ_VAL((weapon), 9))
#define GET_WEAPON_FIREMODES(weapon) (GET_OBJ_VAL((weapon), 10))

/* Misc utils ************************************************************/
#define IS_DAMTYPE_PHYSICAL(type) \
!((type) == TYPE_HIT || (type) == TYPE_BLUDGEON || (type) == TYPE_PUNCH || (type) == TYPE_TASER || (type) == TYPE_CRUSH || (type) == TYPE_POUND)
Expand Down