Skip to content

Commit

Permalink
Added BREAK STEALTH and notification about it when you're affected by…
Browse files Browse the repository at this point in the history
… stealth.
  • Loading branch information
luciensadi committed Jun 30, 2024
1 parent 42a50ae commit 489cd3c
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/act.comm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ ACMD(do_say)
if (check_for_banned_content(argument, ch))
return;

FAILURE_CASE(subcmd != SCMD_OSAY && !PLR_FLAGGED(ch, PLR_MATRIX) && !IS_NPC(ch) && !char_can_make_noise(ch),
"You can't seem to make any noise.");
if (subcmd != SCMD_OSAY && !PLR_FLAGGED(ch, PLR_MATRIX) && !IS_NPC(ch) && !char_can_make_noise(ch, "You can't seem to make any noise.\r\n"))
return;

FAILURE_CASE(IS_RIGGING(ch), "You have no mouth.");

Expand Down
17 changes: 15 additions & 2 deletions src/act.obj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4943,15 +4943,28 @@ ACMD(do_break)
if (is_abbrev(argument, "mindlink")) {
for (struct sustain_data *sust = GET_SUSTAINED(ch); sust; sust = sust->next) {
if (sust->spell == SPELL_MINDLINK) {
send_to_char("You dissolve your mindlink.\r\n", ch);
end_sustained_spell(ch, sust);
send_to_char("You dissolve any mindlinks cast on you.\r\n", ch);
end_all_sustained_spells_of_type_affecting_ch(SPELL_MINDLINK, 0, ch);
return;
}
}
send_to_char("You are not currently under a mindlink.\r\n", ch);
return;
}

// Stealth.
if (is_abbrev(argument, "silence") || is_abbrev(argument, "stealth")) {
for (struct sustain_data *sust = GET_SUSTAINED(ch); sust; sust = sust->next) {
if (sust->spell == SPELL_STEALTH) {
send_to_char("You reject any stealth spells cast on you.\r\n", ch);
end_all_sustained_spells_of_type_affecting_ch(SPELL_STEALTH, 0, ch);
return;
}
}
send_to_char("You are not currently under a stealth spell.\r\n", ch);
return;
}

// Tooth compartment.
if (is_abbrev(argument, "tooth compartment") || is_abbrev(argument, "compartment")) {
struct obj_data *obj = ch->cyberware, *contents = NULL;
Expand Down
3 changes: 2 additions & 1 deletion src/newecho.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,8 @@ ACMD(do_new_echo) {
return;

// Can't speak? No emote speech for you. NOTE: Wrapping your speech in single quotes to avoid this is a punishable exploit.
FAILURE_CASE(strchr(argument, '"') != NULL && !char_can_make_noise(ch), "You can't seem to make any noise.\r\n");
if (strchr(argument, '"') != NULL && !char_can_make_noise(ch, "You can't seem to make any noise.\r\n"))
return;

// Double up percentages. This is necessary to prevent unexpected insertion of data during format runs.
char *pct_reader = argument;
Expand Down
20 changes: 12 additions & 8 deletions src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3009,18 +3009,22 @@ bool char_can_make_noise(struct char_data *ch, const char *message) {
bool is_stealth = affected_by_spell(ch, SPELL_STEALTH);
bool is_silence = get_ch_in_room(ch)->silence[ROOM_NUM_SPELLS_OF_TYPE] > 0;

if (is_silence && ch->desc) {
// The silence spell only affects players if they're the caster or are grouped with them.
is_silence = spell_affecting_ch_is_cast_by_ch_or_group_member(ch, SPELL_SILENCE);
}
if (!ch->desc)
return is_stealth || is_silence;

if (is_stealth || is_silence) {
// Can't make noise.
if (message) {
if (is_silence) {
// The silence spell only affects players if they're the caster or are grouped with them.
if (spell_affecting_ch_is_cast_by_ch_or_group_member(ch, SPELL_SILENCE)) {
send_to_char(message, ch);
send_to_char(ch, "(OOC: You're %s.)\r\n", is_stealth ? "under a stealth spell" : "in a silent room");
send_to_char("(OOC: You're in a silent room.)", ch);
return FALSE;
}
// fall through: spell was cast by non group member.
}

if (is_stealth) {
// reject: spell was cast directly on char, and they've been given instructions on breaking it.
send_to_char(ch, "(OOC: You're affected by a stealth spell. You can end it with ^WBREAK STEALTH^n.)");
return FALSE;
}

Expand Down
2 changes: 1 addition & 1 deletion src/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ struct obj_data *get_mount_ammo(struct obj_data *mount);
struct obj_data *stop_manning_weapon_mounts(struct char_data *ch, bool send_message);
struct obj_data *get_mount_manned_by_ch(struct char_data *ch);
void terminate_mud_process_with_message(const char *message, int error_code);
bool char_can_make_noise(struct char_data *ch, const char *message = NULL);
bool char_can_make_noise(struct char_data *ch, const char *message);
struct char_data *get_driver(struct veh_data *veh);
struct obj_data *find_matching_obj_in_container(struct obj_data *container, vnum_t vnum);
bool attach_attachment_to_weapon(struct obj_data *attachment, struct obj_data *weapon, struct char_data *ch, int location, bool override=0);
Expand Down

0 comments on commit 489cd3c

Please sign in to comment.