Skip to content

Commit 3cd6082

Browse files
authored
More matrix fixes (luciensadi#802)
* Fix program unload active memory handling * Fix system_test rolls output * Fix missing dumpshock damage + some cleanup * Psyche provides +1 int, not +2
1 parent e85f412 commit 3cd6082

2 files changed

Lines changed: 14 additions & 16 deletions

File tree

src/newmatrix.cpp

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ void unload_active_program(struct matrix_icon *persona, struct obj_data *soft)
9696
{
9797
if (!persona || !soft) return;
9898
struct obj_data *temp = NULL;
99-
persona->decker->active -= GET_PROGRAM_SIZE(soft);
99+
persona->decker->active += GET_PROGRAM_SIZE(soft);
100100
REMOVE_FROM_LIST(soft, persona->decker->software, next_content);
101101
extract_obj(soft);
102102
}
@@ -339,9 +339,11 @@ bool dumpshock(struct matrix_icon *icon)
339339
{
340340
if (!icon) return FALSE;
341341

342-
if (icon->decker && icon->decker->ch)
342+
struct char_data *ch = icon->decker->ch;
343+
344+
if (icon->decker && ch)
343345
{
344-
send_to_char(icon->decker->ch, "You are dumped from the matrix!\r\n");
346+
send_to_char(ch, "You are dumped from the matrix!\r\n");
345347
snprintf(buf, sizeof(buf), "%s^n depixelates and vanishes from the host.\r\n", CAP(icon->name));
346348
send_to_host(icon->in_host, buf, icon, FALSE);
347349

@@ -363,10 +365,10 @@ bool dumpshock(struct matrix_icon *icon)
363365
}
364366
}
365367

366-
int resist = -success_test(GET_WIL(icon->decker->ch), matrix[icon->in_host].security);
368+
int resist = -success_test(GET_WIL(ch), matrix[icon->in_host].security);
367369
int dam = convert_damage(stage(resist, MIN(matrix[icon->in_host].color + 1, DEADLY)));
368370

369-
struct obj_data *jack = get_datajack(icon->decker->ch, FALSE);
371+
struct obj_data *jack = get_datajack(ch, FALSE);
370372

371373
if (GET_OBJ_TYPE(jack) == ITEM_CYBERWARE) {
372374
if (GET_CYBERWARE_TYPE(jack) == CYB_DATAJACK) {
@@ -384,22 +386,17 @@ bool dumpshock(struct matrix_icon *icon)
384386
// Trode net.
385387
snprintf(buf, sizeof(buf), "$n suddenly jerks forward and rips the 'trode net off of $s head!");
386388
}
387-
act(buf, FALSE, icon->decker->ch, NULL, NULL, TO_ROOM);
389+
act(buf, FALSE, ch, NULL, NULL, TO_ROOM);
388390
icon->decker->PERSONA = NULL;
389-
PLR_FLAGS(icon->decker->ch).RemoveBit(PLR_MATRIX);
390391
if (icon->decker->deck && GET_OBJ_VAL(icon->decker->deck, 0) == 0) {
391-
act("Smoke emerges from $n's $p.", FALSE, icon->decker->ch, icon->decker->deck, NULL, TO_ROOM);
392-
act("Smoke emerges from $p.", FALSE, icon->decker->ch, icon->decker->deck, NULL, TO_CHAR);
392+
act("Smoke emerges from $n's $p.", FALSE, ch, icon->decker->deck, NULL, TO_ROOM);
393+
act("Smoke emerges from $p.", FALSE, ch, icon->decker->deck, NULL, TO_CHAR);
393394
}
394-
struct char_data *ch = icon->decker->ch;
395395
extract_icon(icon);
396396
PLR_FLAGS(ch).RemoveBit(PLR_MATRIX);
397397
SendGMCPMatrixInfo(ch);
398398
SendGMCPMatrixDeck(ch);
399399

400-
// No reason to double-damage
401-
if (!PLR_FLAGGED(ch, PLR_MATRIX))
402-
return FALSE;
403400
// If they're stunned or dead, there's no reason to take dumpshock damage.
404401
if (GET_POS(ch) <= POS_STUNNED)
405402
return FALSE;
@@ -444,6 +441,8 @@ int system_test(rnum_t host, struct char_data *ch, int type, int software, int m
444441
}
445442

446443
int target = HOST.stats[type][MTX_STAT_RATING];
444+
snprintf(rollbuf, sizeof(rollbuf), "System test against %s with software %s: Starting TN %d", acifs_strings[type], programs[software].name, target);
445+
447446
if (PERSONA->type == ICON_LIVING_PERSONA) {
448447
// We lower the TN by the channel rating
449448
int channel_rating = GET_OTAKU_PATH(ch) == OTAKU_PATH_TECHNOSHAM ? 1 : 0;
@@ -476,13 +475,12 @@ int system_test(rnum_t host, struct char_data *ch, int type, int software, int m
476475
}
477476
}
478477
}
479-
snprintf(rollbuf, sizeof(rollbuf), "System test against %s with software %s: Starting TN %d", acifs_strings[type], programs[software].name, target);
480478

481479
int skill = get_skill(ch, SKILL_COMPUTER, target) + MIN(GET_MAX_HACKING(ch), GET_REM_HACKING(ch));
482480
GET_REM_HACKING(ch) -= skill - get_skill(ch, SKILL_COMPUTER, detect);
483481
detect = 0;
484482

485-
snprintf(ENDOF(rollbuf), sizeof(rollbuf) - strlen(rollbuf), ", after get_skill %d, plus called modifier %d is %d", target, modifier, target + modifier);
483+
snprintf(ENDOF(rollbuf), sizeof(rollbuf) - strlen(rollbuf), ", after get_skill %d", target);
486484

487485
if (modifier) {
488486
target += modifier;

src/otaku.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ int get_otaku_int(struct char_data *ch) {
8989
/* Handling Drugs */
9090
int detox_force = affected_by_spell(ch, SPELL_DETOX);
9191
if (GET_DRUG_STAGE(ch, DRUG_PSYCHE) == DRUG_STAGE_ONSET && !IS_DRUG_DETOX(DRUG_PSYCHE, detox_force))
92-
int_stat += 2;
92+
int_stat++;
9393

9494
return int_stat;
9595
}

0 commit comments

Comments
 (0)