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

Platelet factories & crash tests #763

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
8 changes: 4 additions & 4 deletions src/act.other.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -761,10 +761,10 @@ ACMD(do_use)
if (do_drug_take(ch, obj))
return;
} else if (GET_OBJ_SPEC(obj) && GET_OBJ_SPEC(obj) == anticoagulant) {
for (struct obj_data *cyber = ch->bioware; cyber; cyber = cyber->next_content) {
if (GET_OBJ_VAL(cyber, 0) == BIO_PLATELETFACTORY) {
GET_OBJ_VAL(cyber, 5) = 36;
GET_OBJ_VAL(cyber, 6) = 0;
for (struct obj_data *bio = ch->bioware; bio; bio = bio->next_content) {
if (GET_BIOWARE_TYPE(bio) == BIO_PLATELETFACTORY) {
GET_BIOWARE_PLATELETFACTORY_DATA(bio) = 36;
GET_BIOWARE_PLATELETFACTORY_DIFFICULTY(bio) = 0;
break;
}
}
Expand Down
39 changes: 30 additions & 9 deletions src/fight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ void death_cry(struct char_data * ch, idnum_t cause_of_death_idnum)

void raw_kill(struct char_data * ch, idnum_t cause_of_death_idnum)
{
struct obj_data *bio, *obj, *o;
struct obj_data *obj, *o;
struct room_data *dest_room;

if (CH_IN_COMBAT(ch))
Expand Down Expand Up @@ -926,21 +926,26 @@ void raw_kill(struct char_data * ch, idnum_t cause_of_death_idnum)
make_corpse(ch);

if (!IS_NPC(ch)) {
for (bio = ch->bioware; bio; bio = bio->next_content) {
// Disable bioware etc that resets on death.
for (struct obj_data *bio = ch->bioware; bio; bio = bio->next_content) {
switch (GET_BIOWARE_TYPE(bio)) {
case BIO_ADRENALPUMP:
if (GET_OBJ_VAL(bio, 5) > 0) {
if (GET_BIOWARE_PUMP_ADRENALINE(bio) > 0) {
for (int affect_idx = 0; affect_idx < MAX_OBJ_AFFECT; affect_idx++)
affect_modify(ch,
bio->affected[affect_idx].location,
bio->affected[affect_idx].modifier,
bio->obj_flags.bitvector, FALSE);
GET_OBJ_VAL(bio, 5) = 0;
GET_BIOWARE_PUMP_ADRENALINE(bio) = 0;
}
break;
case BIO_PAINEDITOR:
GET_BIOWARE_IS_ACTIVATED(bio) = 0;
break;
case BIO_PLATELETFACTORY:
GET_BIOWARE_PLATELETFACTORY_DATA(bio) = 36;
GET_BIOWARE_PLATELETFACTORY_DIFFICULTY(bio) = 0;
break;
}
}

Expand Down Expand Up @@ -2353,6 +2358,18 @@ void docwagon_retrieve(struct char_data *ch) {
if (CH_IN_COMBAT(ch))
stop_fighting(ch);

// Stop their vehicle
jdevnull marked this conversation as resolved.
Show resolved Hide resolved
if ((ch->in_veh && AFF_FLAGGED(ch, AFF_PILOT)) || PLR_FLAGGED(ch, PLR_REMOTE)) {
struct veh_data *veh;
RIG_VEH(ch, veh);

send_to_veh("Now driverless, the vehicle slows to a stop.\r\n", veh, ch, FALSE);
AFF_FLAGS(ch).RemoveBits(AFF_PILOT, AFF_RIG, ENDBIT);
stop_chase(veh);
if (!veh->dest)
veh->cspeed = SPEED_OFF;
}

// Stop all their sustained spells as if they died.
if (GET_SUSTAINED(ch)) {
end_all_sustained_spells(ch);
Expand Down Expand Up @@ -2380,18 +2397,22 @@ void docwagon_retrieve(struct char_data *ch) {
for (struct obj_data *bio = ch->bioware; bio; bio = bio->next_content) {
switch (GET_BIOWARE_TYPE(bio)) {
case BIO_ADRENALPUMP:
if (GET_OBJ_VAL(bio, 5) > 0) {
for (int i = 0; i < MAX_OBJ_AFFECT; i++)
if (GET_BIOWARE_PUMP_ADRENALINE(bio) > 0) {
for (int affect_idx = 0; affect_idx < MAX_OBJ_AFFECT; affect_idx++)
affect_modify(ch,
bio->affected[i].location,
bio->affected[i].modifier,
bio->affected[affect_idx].location,
bio->affected[affect_idx].modifier,
bio->obj_flags.bitvector, FALSE);
GET_OBJ_VAL(bio, 5) = 0;
GET_BIOWARE_PUMP_ADRENALINE(bio) = 0;
}
break;
case BIO_PAINEDITOR:
GET_BIOWARE_IS_ACTIVATED(bio) = 0;
break;
case BIO_PLATELETFACTORY:
GET_BIOWARE_PLATELETFACTORY_DATA(bio) = 36;
GET_BIOWARE_PLATELETFACTORY_DIFFICULTY(bio) = 0;
break;
}
}

Expand Down
58 changes: 35 additions & 23 deletions src/limits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -660,32 +660,44 @@ bool check_bioware(struct char_data *ch)
return FALSE;
}

struct obj_data *bio;
struct obj_data *bio = NULL, *platelets = NULL;
int synthacardium = 0;
for (bio = ch->bioware; bio; bio = bio->next_content) {
if (GET_BIOWARE_TYPE(bio) == BIO_PLATELETFACTORY)
{
if (--GET_BIOWARE_PLATELETFACTORY_DATA(bio) < 1) {
GET_BIOWARE_PLATELETFACTORY_DATA(bio) = 12;
if (success_test(GET_REAL_BOD(ch), 3 + GET_BIOWARE_PLATELETFACTORY_DIFFICULTY(bio)) < 1) {
send_to_char("Your blood seems to erupt.\r\n", ch);
act("$n collapses to the floor, twitching.", TRUE, ch, 0, 0, TO_ROOM);
if (damage(ch, ch, 10, TYPE_BIOWARE, PHYSICAL))
return TRUE;
} else {
send_to_char("Your heart strains, and you have a feeling of impending doom. Your need for blood thinners is dire!\r\n", ch);
}
GET_BIOWARE_PLATELETFACTORY_DIFFICULTY(bio)++;
}
if (GET_BIOWARE_PLATELETFACTORY_DATA(bio) == 4)
send_to_char("You kinda feel like you should be taking some aspirin.\r\n", ch);
else if (GET_BIOWARE_PLATELETFACTORY_DATA(bio) == 3)
send_to_char("You could definitely go for some aspirin right now.\r\n", ch);
else if (GET_BIOWARE_PLATELETFACTORY_DATA(bio) <= 2)
send_to_char("You really feel like you need to take some aspirin.\r\n", ch);
else if (GET_BIOWARE_PLATELETFACTORY_DATA(bio) == 1)
send_to_char("Your heart strains, and you have a feeling of impending doom. Your need for blood thinners is dire!\r\n", ch);
// Find the 'ware we care about
if (GET_BIOWARE_TYPE(bio) == BIO_PLATELETFACTORY) {
platelets = bio;
} else if (GET_BIOWARE_TYPE(bio) == BIO_SYNTHACARDIUM) {
synthacardium = GET_BIOWARE_RATING(bio);
}

if (platelets && synthacardium)
break;
}

if (platelets) {
// Embolism
if (--GET_BIOWARE_PLATELETFACTORY_DATA(platelets) < 1) {
GET_BIOWARE_PLATELETFACTORY_DATA(platelets) = 12;
if (success_test(GET_REAL_BOD(ch) + synthacardium, 3 + GET_BIOWARE_PLATELETFACTORY_DIFFICULTY(platelets)) < 1) {
send_to_char("Your blood seems to erupt.\r\n", ch);
act("$n collapses to the floor, twitching.", TRUE, ch, 0, 0, TO_ROOM);
if (damage(ch, ch, 10, TYPE_BIOWARE, PHYSICAL))
return TRUE;
} else {
send_to_char("Your heart strains, and you have a feeling of impending doom. Your need for blood thinners is dire!\r\n", ch);
}
GET_BIOWARE_PLATELETFACTORY_DIFFICULTY(platelets)++;
}

// Warning messages start 4 mud hours out
if (GET_BIOWARE_PLATELETFACTORY_DATA(platelets) == 4)
send_to_char("You kinda feel like you should be taking some aspirin.\r\n", ch);
else if (GET_BIOWARE_PLATELETFACTORY_DATA(platelets) == 3)
send_to_char("You could definitely go for some aspirin right now.\r\n", ch);
else if (GET_BIOWARE_PLATELETFACTORY_DATA(platelets) == 2)
send_to_char("You really feel like you need to take some aspirin.\r\n", ch);
else if (GET_BIOWARE_PLATELETFACTORY_DATA(platelets) == 1)
send_to_char("Your heart strains, and you have a feeling of impending doom. Your need for blood thinners is dire!\r\n", ch);
}
return FALSE;
}
Expand Down
Loading