/* walk even though they could fly at will. */ void affect_total(struct char_data *ch) { struct affected_type *af; int i,j; char buff[200]; for(i=0; i<MAX_WEAR; i++) { if (ch->equipment[i]) for(j=0; j<MAX_OBJ_AFFECT; j++) affect_modify(ch, ch->equipment[i]->affected[j].location, (int)ch->equipment[i]->affected[j].modifier, ch->equipment[i]->obj_flags.bitvector, FALSE); } for(af = ch->affected; af; af=af->next) if(af->type != SPELL_FLY) affect_modify(ch, af->location, (int) af->modifier, af->bitvector, FALSE); ch->tmpabilities = ch->abilities; for(i=0; i<MAX_WEAR; i++) { if (ch->equipment[i]) for(j=0; j<MAX_OBJ_AFFECT; j++) affect_modify(ch, ch->equipment[i]->affected[j].location, (int) ch->equipment[i]->affected[j].modifier, ch->equipment[i]->obj_flags.bitvector, TRUE); } for(af = ch->affected; af; af=af->next) if(af->type != SPELL_FLY) affect_modify(ch, af->location, (int)af->modifier, af->bitvector, TRUE); /* Make certain values are between 0..25, not < 0 and not > 25! */ i = ((!IS_PC(ch)) ? 25 :18); /* f**k polies */ GET_DEX(ch) = MAX(3,MIN(GET_DEX(ch), i)); GET_INT(ch) = MAX(3,MIN(GET_INT(ch), i)); GET_WIS(ch) = MAX(3,MIN(GET_WIS(ch), i)); GET_CON(ch) = MAX(3,MIN(GET_CON(ch), i)); GET_STR(ch) = MAX(3,GET_STR(ch)); if (!IS_PC(ch)) { GET_STR(ch) = MIN(GET_STR(ch), i); } else if(GET_RACE(ch) != RACE_OGRE) { if (GET_STR(ch) > 18) { GET_ADD(ch) = 100; GET_STR(ch) = 18; } } else { /* warning: I am counting on ChangeStrength() */ /* to be working for this to be safe :) */ GET_STR(ch) = MIN(22,GET_STR(ch)); } }
/* Remove an affected_type structure from a char (called when duration reaches zero). Pointer *af must never be NIL! Frees mem and calls affect_location_apply */ void affect_remove( struct char_data *ch, struct affected_type *af ) { struct affected_type *hjp; assert(ch->affected); affect_modify(ch, af->location, af->modifier, af->bitvector, FALSE); /* remove structure *af from linked list */ if (ch->affected == af) { /* remove head of list */ ch->affected = af->next; } else { for(hjp = ch->affected; (hjp->next) && (hjp->next != af); hjp = hjp->next); if (hjp->next != af) { log("FATAL : Could not locate affected_type in ch->affected. (handler.c, affect_remove)"); exit(1); } hjp->next = af->next; /* skip the af element */ } free ( af ); affect_total(ch); }
/* Remove an affected_type structure from a char (called when duration reaches zero). Pointer *af must never be NIL! Frees mem and calls affect_location_apply */ void affect_remove( struct char_data *ch, struct affected_type *af ) { struct affected_type *hjp; if (!ch->affected) { logE("affect removed from char without affect"); logE(GET_NAME(ch)); return; } affect_modify(ch, af->location, (int) af->modifier, af->bitvector, FALSE); /* remove structure *af from linked list */ if (ch->affected == af) { /* remove head of list */ ch->affected = af->next; } else { for(hjp = ch->affected; (hjp->next) && (hjp->next != af); hjp = hjp->next); if (hjp->next != af) { logE("Could not locate affected_type in ch->affected. (handler.c, affect_remove)"); return; } hjp->next = af->next; /* skip the af element */ } free ( af ); affect_total(ch); }
struct obj_data *unequip_char(struct char_data *ch, int pos) { int j; struct obj_data *obj; assert(pos>=0 && pos<MAX_WEAR); assert(ch->equipment[pos]); obj = ch->equipment[pos]; assert(!obj->in_obj && obj->in_room == NOWHERE && !obj->carried_by); if (GET_ITEM_TYPE(obj) == ITEM_ARMOR) GET_AC(ch) += apply_ac(ch, pos); ch->equipment[pos] = 0; obj->equipped_by = 0; obj->eq_pos = -1; for(j=0; j<MAX_OBJ_AFFECT; j++) affect_modify(ch, obj->affected[j].location, (int)obj->affected[j].modifier, obj->obj_flags.bitvector, FALSE); affect_total(ch); return(obj); }
struct aff_stash * stash_creature_affects(struct creature *ch) { // Save vital statistics struct aff_stash *result = NULL; struct affected_type *cur_aff; int pos; CREATE(result, struct aff_stash, 1); // Remove all spell affects without deleting them result->saved_affs = ch->affected; ch->affected = NULL; for (cur_aff = result->saved_affs; cur_aff; cur_aff = cur_aff->next) affect_modify(ch, cur_aff->location, cur_aff->modifier, cur_aff->bitvector, cur_aff->aff_index, false); for (pos = 0; pos < NUM_WEARS; pos++) { if (GET_EQ(ch, pos)) result->saved_eq[pos] = raw_unequip_char(ch, pos, EQUIP_WORN); if (GET_IMPLANT(ch, pos)) result->saved_impl[pos] = raw_unequip_char(ch, pos, EQUIP_IMPLANT); if (GET_TATTOO(ch, pos)) result->saved_tattoo[pos] = raw_unequip_char(ch, pos, EQUIP_TATTOO); } return result; }
/* Update the stats on a morph */ void update_morph_stats(char_data *ch, bool add) { if (!IS_NPC(ch) && GET_MORPH(ch) != MORPH_NONE) { if (morph_data[GET_MORPH(ch)].aff_bits) { affect_modify(ch, 0, 0, morph_data[GET_MORPH(ch)].aff_bits, add); } affect_modify(ch, APPLY_STRENGTH, morph_modifier(ch, APPLY_STRENGTH), 0, add); affect_modify(ch, APPLY_DEXTERITY, morph_modifier(ch, APPLY_DEXTERITY), 0, add); affect_modify(ch, APPLY_CHARISMA, morph_modifier(ch, APPLY_CHARISMA), 0, add); affect_modify(ch, APPLY_GREATNESS, morph_modifier(ch, APPLY_GREATNESS), 0, add); affect_modify(ch, APPLY_INTELLIGENCE, morph_modifier(ch, APPLY_INTELLIGENCE), 0, add); affect_modify(ch, APPLY_WITS, morph_modifier(ch, APPLY_WITS), 0, add); affect_modify(ch, APPLY_HEALTH, morph_modifier(ch, APPLY_HEALTH), 0, add); affect_modify(ch, APPLY_MOVE, morph_modifier(ch, APPLY_MOVE), 0, add); affect_modify(ch, APPLY_MANA, morph_modifier(ch, APPLY_MANA), 0, add); } }
/* restoring original abilities, and then affecting all again */ void affect_total(struct char_data *ch) { struct affected_type *af; int i,j; for(i=0; i<MAX_WEAR; i++) { if (ch->equipment[i]) for(j=0; j<MAX_OBJ_AFFECT; j++) affect_modify(ch, ch->equipment[i]->affected[j].location, ch->equipment[i]->affected[j].modifier, ch->equipment[i]->obj_flags.bitvector, FALSE); } for(af = ch->affected; af; af=af->next) affect_modify(ch, af->location, af->modifier, af->bitvector, FALSE); ch->tmpabilities = ch->abilities; for(i=0; i<MAX_WEAR; i++) { if (ch->equipment[i]) for(j=0; j<MAX_OBJ_AFFECT; j++) affect_modify(ch, ch->equipment[i]->affected[j].location, ch->equipment[i]->affected[j].modifier, ch->equipment[i]->obj_flags.bitvector, TRUE); } for(af = ch->affected; af; af=af->next) affect_modify(ch, af->location, af->modifier, af->bitvector, TRUE); /* Make certain values are between 0..25, not < 0 and not > 25! */ i = (IS_NPC(ch) ? 25 :25); GET_DEX(ch) = MAX(0,MIN(GET_DEX(ch), i)); GET_INT(ch) = MAX(0,MIN(GET_INT(ch), i)); GET_WIS(ch) = MAX(0,MIN(GET_WIS(ch), i)); GET_CON(ch) = MAX(0,MIN(GET_CON(ch), i)); GET_STR(ch) = MAX(0,MIN(GET_STR(ch), i)); }
/* Insert an affect_type in a char_data structure Automatically sets apropriate bits and apply's */ void affect_to_char(struct char_data * ch, struct affected_type * af) { struct affected_type *affected_alloc; CREATE(affected_alloc, struct affected_type, 1); *affected_alloc = *af; affected_alloc->next = ch->affected; ch->affected = affected_alloc; affect_modify(ch, af->location, af->modifier, af->bitvector, TRUE); affect_total(ch); }
void AddAffects( struct char_data *ch, struct obj_data *o) { int i; for (i=0;i<MAX_OBJ_AFFECT;i++) { if (o->affected[i].location != APPLY_NONE) { affect_modify(ch, o->affected[i].location, (int)o->affected[i].modifier, o->obj_flags.bitvector, TRUE); } else { return; } } }
/* * Give an affect to a char. */ void affect_to_char( CHAR_DATA *ch, AFFECT_DATA *paf ) { AFFECT_DATA *paf_new; void *vo; paf_new = new_affect(); *paf_new = *paf; paf_new->next = ch->affected; ch->affected = paf_new; vo = (void *) ch; add_weave_list( vo, NODE_WEAVE_CHAR ); affect_modify( ch, paf_new, TRUE ); return; }
void affect_obj_remove( OBJ_DATA *obj, AFFECT_DATA *paf) { if ( obj->affected == NULL ) { bug( "Affect_obj_remove: no affect.", 0 ); return; } if (obj->carried_by != NULL && obj->wear_loc != -1) affect_modify( obj->carried_by, paf, FALSE ); if ( paf == obj->affected ) { obj->affected = paf->next; } else { AFFECT_DATA *prev; for ( prev = obj->affected; prev != NULL; prev = prev->next ) { if ( prev->next == paf ) { prev->next = paf->next; break; } } if ( prev == NULL ) { bug( "Affect_obj_remove: cannot find paf.", 0 ); return; } } if ( obj->affected == NULL ) { void *vo; vo = (void *) obj; rem_weave_list( obj, NODE_WEAVE_OBJ ); } paf->next = affect_free; affect_free = paf->next; return; }
struct obj_data *unequip_char(struct char_data * ch, int pos) { int j; struct obj_data *obj; assert(pos >= 0 && pos < NUM_WEARS); assert(GET_EQ(ch, pos)); obj = GET_EQ(ch, pos); obj->worn_by = NULL; obj->worn_on = -1; if (GET_OBJ_TYPE(obj) == ITEM_ARMOR) GET_AC(ch) += apply_ac(ch, pos); if (ch->in_room != NOWHERE) { if (pos == WEAR_LIGHT && GET_OBJ_TYPE(obj) == ITEM_LIGHT) if (GET_OBJ_VAL(obj, 2)) /* if light is ON */ world[ch->in_room].light--; } else { log("SYSERR: ch->in_room = NOWHERE when un-equipping char."); } GET_EQ(ch, pos) = NULL; for (j = 0; j < MAX_OBJ_AFFECT; j++) affect_modify(ch, obj->affected[j].location, obj->affected[j].modifier, obj->obj_flags.bitvector, FALSE); if (affected_by_spell(ch, SKILL_ENVENOM) && (pos == WEAR_WIELD)) { send_to_char("As your weapon leaves your hand, the venom on it dissipates.\r\n", ch); affect_from_char(ch, SKILL_ENVENOM); } if (affected_by_spell(ch, SPELL_ADAMANT_MACE) && (pos == WEAR_WIELD)) affect_from_char(ch, SPELL_ADAMANT_MACE); affect_total(ch); return (obj); }
void equip_char(struct char_data *ch, struct obj_data *obj, int pos) { int j; assert(pos>=0 && pos<MAX_WEAR); assert(!(ch->equipment[pos])); if (obj->carried_by) { log("EQUIP: Obj is carried_by when equip."); return; } if (obj->in_room!=NOWHERE) { log("EQUIP: Obj is in_room when equip."); return; } if ((IS_OBJ_STAT(obj, ITEM_ANTI_EVIL) && IS_EVIL(ch)) || (IS_OBJ_STAT(obj, ITEM_ANTI_GOOD) && IS_GOOD(ch)) || (IS_OBJ_STAT(obj, ITEM_ANTI_NEUTRAL) && IS_NEUTRAL(ch))) { if (ch->in_room != NOWHERE) { /* act("You are zapped by $p and instantly drop it.", FALSE, ch, obj, 0, TO_CHAR); act("$n is zapped by $p and instantly drop it.", FALSE, ch, obj, 0, TO_ROOM); obj_to_room(obj, ch->in_room); return; */ } else { log("ch->in_room = NOWHERE when equipping char."); } } ch->equipment[pos] = obj; if (GET_ITEM_TYPE(obj) == ITEM_ARMOR) GET_AC(ch) -= apply_ac(ch, pos); for(j=0; j<MAX_OBJ_AFFECT; j++) affect_modify(ch, obj->affected[j].location, obj->affected[j].modifier, obj->obj_flags.bitvector, TRUE); affect_total(ch); }
void restore_creature_affects(struct creature *ch, struct aff_stash *aff_stash) { struct affected_type *cur_aff; int pos; for (pos = 0; pos < NUM_WEARS; pos++) { if (aff_stash->saved_eq[pos]) equip_char(ch, aff_stash->saved_eq[pos], pos, EQUIP_WORN); if (aff_stash->saved_impl[pos]) equip_char(ch, aff_stash->saved_impl[pos], pos, EQUIP_IMPLANT); if (aff_stash->saved_tattoo[pos]) equip_char(ch, aff_stash->saved_tattoo[pos], pos, EQUIP_TATTOO); } for (cur_aff = aff_stash->saved_affs; cur_aff; cur_aff = cur_aff->next) affect_modify(ch, cur_aff->location, cur_aff->modifier, cur_aff->bitvector, cur_aff->aff_index, true); ch->affected = aff_stash->saved_affs; affect_total(ch); }
/* ========================================================================= NAME : tattoo_af() DESCRIPTION: add or remove the affects of a tattoo RETURNS : n/a WARNINGS : HISTORY : Created by dlkarnes 970418 OTHER : ========================================================================= */ #define MAX_TAT_AFFECTS 3 /*change if necessary */ void tattoo_af( struct char_data *ch, bool add ) { struct affected_type af[MAX_TAT_AFFECTS]; int i = 0; if (!ch || !GET_TATTOO(ch)) return; for (i = 0; i < MAX_TAT_AFFECTS; i++) { af[i].type = 0; af[i].bitvector = AFF_NOTHING; af[i].modifier = 0; af[i].location = APPLY_NONE; } switch (GET_TATTOO(ch)) { case TATTOO_DRAGON: af[0].location = APPLY_DAMROLL; af[0].modifier = 2; af[1].location = APPLY_STR; af[1].modifier = 2; break; case TATTOO_TIGER: af[0].location = APPLY_DEX; af[0].modifier = 1; af[1].location = APPLY_MOVE; af[1].modifier = 10; break; case TATTOO_TRIBAL: af[0].location = APPLY_DEX; af[0].modifier = 1; break; case TATTOO_WORM: af[0].location = APPLY_DAMROLL; af[0].modifier = 2; break; case TATTOO_SWORDS: af[0].location = APPLY_DAMROLL; af[0].modifier = 1; af[1].location = APPLY_HITROLL; af[1].modifier = 1; break; case TATTOO_EAGLE: af[0].location = APPLY_MOVE; af[0].modifier = 20; break; case TATTOO_HEART: af[0].location = APPLY_HIT; af[0].modifier = 20; break; case TATTOO_STAR: af[0].location = APPLY_MANA; af[0].modifier = 20; break; case TATTOO_SPIDER: af[0].location = APPLY_DEX; af[0].modifier = 3; break; case TATTOO_JYHAD: af[0].location = APPLY_DAMROLL; af[0].modifier = 1; break; case TATTOO_MOM: af[0].location = APPLY_WIS; af[0].modifier = 3; break; case TATTOO_FOX: af[0].location = APPLY_INT; af[0].modifier = 1; break; case TATTOO_OWL: af[0].location = APPLY_WIS; af[0].modifier = 1; break; default: break; } for (i = 0; i < MAX_TAT_AFFECTS; i++) if (af[i].location != APPLY_NONE) affect_modify(ch, af[i].location, af[i].modifier, af[i].bitvector, add); }
void equip_char(struct char_data * ch, struct obj_data * obj, int pos) { int j; int invalid_class(struct char_data *ch, struct obj_data *obj); int invalid_race(struct char_data *ch, struct obj_data *obj); assert(pos >= 0 && pos < NUM_WEARS); if (GET_EQ(ch, pos)) { GET_NAME(ch, chname); sprintf(buf, "SYSERR: Char is already equipped: %s, %s", chname, obj->short_description); FREE_NAME(chname); log(buf); return; } if (obj->carried_by) { log("SYSERR: EQUIP: Obj is carried_by when equip."); return; } if (obj->in_room != NOWHERE) { log("SYSERR: EQUIP: Obj is in_room when equip."); return; } /* Let's change the messages here. Soli, 8/12/99 */ if ((IS_OBJ_STAT(obj, ITEM_ANTI_EVIL) && IS_EVIL(ch)) || (IS_OBJ_STAT(obj, ITEM_ANTI_GOOD) && IS_GOOD(ch)) || (IS_OBJ_STAT(obj, ITEM_ANTI_NEUTRAL) && IS_NEUTRAL(ch))) { act("You are zapped by $p and instantly let go of it.", FALSE, ch, obj, 0, TO_CHAR); act("$n is zapped by $p and instantly lets go of it.", FALSE, ch, obj, 0, TO_ROOM); obj_to_char(obj, ch); /* changed to drop in inventory instead of * ground */ return; } /* I'm moving the other two to a seperate function, checked before we actually wear the eq. Soli, 8/12/99 */ GET_EQ(ch, pos) = obj; obj->worn_by = ch; obj->worn_on = pos; if (GET_OBJ_TYPE(obj) == ITEM_ARMOR) GET_AC(ch) -= apply_ac(ch, pos); if (ch->in_room != NOWHERE) { if (pos == WEAR_LIGHT && GET_OBJ_TYPE(obj) == ITEM_LIGHT) if (GET_OBJ_VAL(obj, 2)) /* if light is ON */ world[ch->in_room].light++; } else { log("SYSERR: ch->in_room = NOWHERE when equipping char."); } for (j = 0; j < MAX_OBJ_AFFECT; j++) affect_modify(ch, obj->affected[j].location, obj->affected[j].modifier, obj->obj_flags.bitvector, TRUE); affect_total(ch); }
void affect_from_char_II(struct char_data * ch, int skill, int type, int action) { struct affected_type *aff, *next; struct affected_type *temp; struct affected_type af[3]; int i, k; bool accum_affect = FALSE, accum_duration = FALSE; for (aff = ch->affected; aff; aff = next) { next = aff->next; if (aff->type == type) { affect_modify(ch, aff->location, aff->modifier, aff->bitvector, FALSE); REMOVE_FROM_LIST(aff, ch->affected, next); free(aff); affect_total(ch); } } if (action == 2) { switch (skill) { case SPELL_POLYMORPH: if (PLR_FLAGGED(ch, PLR_RABBIT)){ REMOVE_BIT(PLR_FLAGS(ch), PLR_RABBIT); REMOVE_BIT(PRF_FLAGS(ch), PRF_NOTSELF); send_to_char("You feel yourself growing, and your ears shrinking. You no longer feel like a rabbit.\r\n", ch); act("$n's body grows, $s ears shrinking. $n no longer looks like a rabbit.\r\n", 0, ch, 0, 0, TO_ROOM); } if (PLR_FLAGGED(ch, PLR_BIRD)) { REMOVE_BIT(PLR_FLAGS(ch), PLR_BIRD); REMOVE_BIT(PRF_FLAGS(ch), PRF_NOTSELF); send_to_char("You feel yourself growing and your feathers falling away. You no longer feel like a bird.\r\n", ch); act("$n's body grows, $s feathers falling away as it expands. $n no longer looks like a bird.\r\n", 0, ch, 0, 0, TO_ROOM); } if (PLR_FLAGGED(ch, PLR_WOLF)) { REMOVE_BIT(PLR_FLAGS(ch), PLR_WOLF); REMOVE_BIT(PRF_FLAGS(ch), PRF_NOTSELF); send_to_char("You feel your your fur shed and your teeth shrink. You no longer feel like a wolf.\r\n", ch); act("$n's teeth shrink, $s fur shedding. $n no longer looks like a wolf.\r\n", 0, ch, 0, 0, TO_ROOM); } if (PLR_FLAGGED(ch, PLR_BEAR)) { REMOVE_BIT(PLR_FLAGS(ch), PLR_BEAR); REMOVE_BIT(PRF_FLAGS(ch), PRF_NOTSELF); send_to_char("Your claws shrink as does the rest of your body. You no longer feel like a bear.\r\n", ch); act("$n's claws shrink as does the rest of $s body. $n no longer looks like a bear.\r\n", 0, ch, 0, 0, TO_ROOM); } if (PLR_FLAGGED(ch, PLR_CAT)){ REMOVE_BIT(PLR_FLAGS(ch), PLR_CAT); REMOVE_BIT(PRF_FLAGS(ch), PRF_NOTSELF); send_to_char("You feel your body growing, and your fur shedding. You no longer feel like a cat.\r\n", ch); act("$n's body slowly grows, $s fur shedding. $n no longer looks like a cat.\r\n", 0, ch, 0, 0, TO_ROOM); } for (k = 0; k < NUM_WEARS; k++) if (GET_EQ(ch, k)){ GET_OBJ_DISGUISE(GET_EQ(ch, k)) = 0; } if (affected_by_spell(ch, SPELL_FLIGHT)) affect_from_char_II(ch, SPELL_FLIGHT, SPELL_FLIGHT, 1); if (affected_by_spell(ch, SPELL_HASTE)) affect_from_char_II(ch, SPELL_HASTE, SPELL_HASTE, 1); break; case SKILL_STANCE: if (!AFF_FLAGGED(ch, AFF_TIRED)) { for (i = 0; i < 3; i++) { af[0].type = SPELL_DONTUSEME; af[0].location = APPLY_HITROLL; af[0].modifier = 2; af[0].duration = 7; af[0].bitvector = AFF_STANCE; af[1].type = SPELL_DONTUSEME; af[1].location = APPLY_AC; af[1].modifier = -50; af[1].duration = 7; af[1].bitvector = AFF_STANCE; af[2].type = SPELL_DONTUSEME; af[2].location = APPLY_STR; af[2].modifier = 2; af[2].duration = 7; af[2].bitvector = AFF_STANCE; if (af[i].bitvector || (af[i].location != APPLY_NONE)) { affect_join(ch, af+i, accum_duration, FALSE, accum_affect, FALSE); } } } break; default: break; } } }
/* * Remove an affected_type structure from a char (called when duration * reaches zero). Pointer *af must never be NIL! Frees mem and calls * affect_location_apply */ void affect_remove(struct char_data * ch, struct affected_type * af, int output) { struct affected_type *temp; struct affected_type aff; bool accum_affect = FALSE; int k; if (ch->affected == NULL) { core_dump(); return; } switch (af->type) { case SPELL_CHARM: { struct char_data* victim = ch->master; if (output == 0) break; affect_modify(ch, af->location, af->modifier, af->bitvector, FALSE); REMOVE_FROM_LIST(af, ch->affected, next); free(af); affect_total(ch); if (ch->master) { stop_follower(ch); } if (victim) { if(IS_NPC(ch)) { SET_BIT(MOB_FLAGS(ch), MOB_AGGRESSIVE | MOB_MEMORY); } if (mag_savingthrow(victim, SAVING_SPELL)) { hit(victim, ch, TYPE_UNDEFINED); } } return; } case SPELL_LIGHT: if (output == 0) break; if (!af->next || (af->next->type != af->type) || (af->next->duration > 0)) { if (world[ch->in_room].name != (char*) NULL) { world[ch->in_room].light -= 10; } } break; case SPELL_DARKNESS: if (output == 0) break; if (!af->next || (af->next->type != af->type) || (af->next->duration > 0)) { if (world[ch->in_room].name != (char*) NULL) { world[ch->in_room].light += 10; } } break; case SPELL_BLACK_PLAGUE: mag_affects(30, ch, ch, SPELL_BREATH_OF_LIFE, SAVING_SPELL); break; case SPELL_CALL_ANIMAL_SPIRIT: case SPELL_ANIMAL_SUMMONING: case SPELL_ANIMAL_SUMMONING_II: case SPELL_ANIMAL_SUMMONING_III: case SPELL_CONJURE_ELEMENTAL: case SPELL_GREATER_ELEMENTAL: case SPELL_DUST_DEVIL: case SPELL_STICKS_TO_SNAKES: case SPELL_SUMMON_INSECTS: case SPELL_AERIAL_SERVANT: case SPELL_SUMMON_GUARD: if (IS_NPC(ch)) { if (GET_POS(ch) > POS_DEAD) { if (output == 1) { affect_modify(ch, af->location, af->modifier, af->bitvector, FALSE); REMOVE_FROM_LIST(af, ch->affected, next); free(af); affect_total(ch); GET_NAME(ch, chname); stop_fighting(ch); /*Fighting Bug Fix Jasrags*/ sprintf(buf, "%s disappears into thin air as the summoning ends.", chname); act(buf, FALSE, world[ch->in_room].people, 0, 0, TO_ROOM); FREE_NAME(chname); extract_char(ch); ch = NULL; return; } } } break; case SPELL_POLYMORPH: if (!PRF_FLAGGED(ch, PRF_NOTSELF)) { affect_modify(ch, af->location, af->modifier, af->bitvector, FALSE); REMOVE_FROM_LIST(af, ch->affected, next); free(af); affect_total(ch); return; } break; case SPELL_DONTUSEME: if(AFF_FLAGGED(ch, AFF_STANCE) && !AFF_FLAGGED(ch, AFF_TIRED)) { aff.type = SKILL_STANCE; aff.duration = 2; aff.location = APPLY_STR; aff.modifier = -2; aff.bitvector = AFF_TIRED; accum_affect = FALSE; affect_to_char(ch, &aff); } break; default: break; } if (output && (af->type > 0) && (af->type <= MAX_SPELLS) && af->type != SPELL_POLYMORPH && af->type != SPELL_DONTUSEME) { if (!af->next || (af->next->type != af->type) || (af->next->duration > 0)) { if (*spell_wear_off_msg[af->type]) { send_to_char(spell_wear_off_msg[af->type], ch); send_to_char("\r\n", ch); } } } if (output && (af->type > 0) && (af->type <= MAX_SPELLS) && af->type == SPELL_POLYMORPH) { if (!af->next || (af->next->type != af->type) || (af->next->duration > 0)) { if (PLR_FLAGGED(ch, PLR_RABBIT)){ REMOVE_BIT(PLR_FLAGS(ch), PLR_RABBIT); REMOVE_BIT(PRF_FLAGS(ch), PRF_NOTSELF); send_to_char("You feel yourself growing, and your ears shrinking. You no longer feel like a rabbit.\r\n", ch); act("$n's body grows, $s ears shrinking. $n no longer looks like a rabbit.\r\n", 0, ch, 0, 0, TO_ROOM); } if (PLR_FLAGGED(ch, PLR_BIRD)) { REMOVE_BIT(PLR_FLAGS(ch), PLR_BIRD); REMOVE_BIT(PRF_FLAGS(ch), PRF_NOTSELF); send_to_char("You feel yourself growing and your feathers falling away. You no longer feel like a bird.\r\n", ch); act("$n's body grows, $s feathers falling away as it expands. $n no longer looks like a bird.\r\n", 0, ch, 0, 0, TO_ROOM); } if (PLR_FLAGGED(ch, PLR_WOLF)) { REMOVE_BIT(PLR_FLAGS(ch), PLR_WOLF); REMOVE_BIT(PRF_FLAGS(ch), PRF_NOTSELF); send_to_char("You feel your your fur shed and your teeth shrink. You no longer feel like a wolf.\r\n", ch); act("$n's teeth shrink, $s fur shedding. $n no longer looks like a wolf.\r\n", 0, ch, 0, 0, TO_ROOM); } if (PLR_FLAGGED(ch, PLR_BEAR)) { REMOVE_BIT(PLR_FLAGS(ch), PLR_BEAR); REMOVE_BIT(PRF_FLAGS(ch), PRF_NOTSELF); send_to_char("Your claws shrink as does the rest of your body. You no longer feel like a bear.\r\n", ch); act("$n's claws shrink as does the rest of $s body. $n no longer looks like a bear.\r\n", 0, ch, 0, 0, TO_ROOM); } if (PLR_FLAGGED(ch, PLR_CAT)){ REMOVE_BIT(PLR_FLAGS(ch), PLR_CAT); REMOVE_BIT(PRF_FLAGS(ch), PRF_NOTSELF); send_to_char("You feel your body growing, and your fur shedding. You no longer feel like a cat.\r\n", ch); act("$n's body slowly grows, $s fur shedding. $n no longer looks like a cat.\r\n", 0, ch, 0, 0, TO_ROOM); } for (k = 0; k < NUM_WEARS; k++) if (GET_EQ(ch, k)){ GET_OBJ_DISGUISE(GET_EQ(ch, k)) = 0; } } } affect_modify(ch, af->location, af->modifier, af->bitvector, FALSE); REMOVE_FROM_LIST(af, ch->affected, next); free(af); affect_total(ch); }
/* restoring original abilities, and then affecting all again */ void affect_total(struct char_data * ch) { struct affected_type *af; int i, j, newint, change, oldint; oldint = mem_int_app(ch); for (i = 0; i < NUM_WEARS; i++) { if (GET_EQ(ch, i)) { for (j = 0; j < MAX_OBJ_AFFECT; j++) { affect_modify(ch, GET_EQ(ch, i)->affected[j].location, GET_EQ(ch, i)->affected[j].modifier, GET_EQ(ch, i)->obj_flags.bitvector, FALSE); } } } for (af = ch->affected; af; af = af->next) { affect_modify(ch, af->location, af->modifier, af->bitvector, FALSE); } ch->aff_abils = ch->real_abils; for (i = 0; i < NUM_WEARS; i++) { if (GET_EQ(ch, i)) { for (j = 0; j < MAX_OBJ_AFFECT; j++) { affect_modify(ch, GET_EQ(ch, i)->affected[j].location, GET_EQ(ch, i)->affected[j].modifier, GET_EQ(ch, i)->obj_flags.bitvector, TRUE); } } } for (af = ch->affected; af; af = af->next) { affect_modify(ch, af->location, af->modifier, af->bitvector, TRUE); } /* Make certain values are between 0..25, not < 0 and not > 25! */ // i = (IS_NPC(ch) ? 25 : // (GET_LEVEL(ch) > LVL_IMMORT) ? 25 : 20); i = 25; GET_DEX(ch) = MAX(0, MIN(GET_DEX(ch), i)); GET_INT(ch) = MAX(0, MIN(GET_INT(ch), i)); GET_WIS(ch) = MAX(0, MIN(GET_WIS(ch), i)); GET_CON(ch) = MAX(0, MIN(GET_CON(ch), i)); GET_STR(ch) = MAX(0, GET_STR(ch)); if (IS_NPC(ch)) { GET_STR(ch) = MIN(GET_STR(ch), i); } else { /* PDH 4/29/99 * new method for STRs over 18 and such * now, when PC str > 18/00 go up to 19, 20, etc... */ int addOver100 = 0; if ( (GET_STR(ch) > 18) && (ch->real_abils.str_add != -1) ) { /* STR that is NOT naturally over 18 */ i = GET_ADD(ch) + ((GET_STR(ch) - 18) * 10); if ( i >= 110 ) { /* 19, 20, 21, ... 25 */ addOver100 = ( i - 100) / 10; GET_ADD(ch) = 0; GET_STR(ch) = MIN(25, 18 + addOver100); } else { GET_ADD(ch) = MIN(i, 100); GET_STR(ch) = 18; } } else { /* STR that is naturally over 18 (ie. minotaur) */ } } newint = mem_int_app(ch); change = newint - oldint; if (change) shift_memtimes(ch, change); }
void equip_char(struct char_data *ch, struct obj_data *obj, int pos) { int j; assert(pos>=0 && pos<MAX_WEAR); assert(!(ch->equipment[pos])); if (obj->carried_by) { logE("EQUIP: Obj is carried_by when equip."); assert(0); } if (obj->in_room!=NOWHERE) { logE("EQUIP: Obj is in_room when equip."); assert(0); return; } /* if the item is limited, check its ego. use some funky function to determine if pc's ego is higher than objs' ego.. if it is, proceed.. otherwise, deny. */ j = ItemEgoClash(ch, obj, 0); if (j < -5) { act("$p almost seems to say 'You're much too puny to use me, twerp!'",0, ch, obj, 0, TO_CHAR); act("$p falls to the floor",0,ch, obj, 0, TO_CHAR); act("$p removes itself, and falls to the floor",0,ch, obj, 0, TO_ROOM); obj_to_room(obj, ch->in_room); do_save(ch,"",0); return; } else if (j < 0) { act("$p almost seems to say 'You're pretty puny. I don't want to be seen with you!\n", 0, ch, obj, 0, TO_CHAR); act("$p falls to the floor",0,ch, obj, 0, TO_CHAR); act("$p removes itself, and falls to the floor",0,ch, obj, 0, TO_ROOM); obj_to_room(obj, ch->in_room); do_save(ch,"",0); return; } if (ItemAlignClash(ch, obj)) { if (ch->in_room != NOWHERE) { act("You are zapped by $p and instantly drop it.", FALSE, ch, obj, 0, TO_CHAR); act("$n is zapped by $p and instantly drop it.", FALSE, ch, obj, 0, TO_ROOM); obj_to_room(obj, ch->in_room); do_save(ch,"",0); return; } else { logE("ch->in_room = NOWHERE when equipping char."); assert(0); } } if (IS_AFFECTED(ch, AFF_SNEAK) && IsRestricted(GetItemClassRestrictions(obj), CLASS_THIEF)) affect_from_char(ch, SKILL_SNEAK); ch->equipment[pos] = obj; obj->equipped_by = ch; obj->eq_pos = pos; if (GET_ITEM_TYPE(obj) == ITEM_ARMOR) GET_AC(ch) -= apply_ac(ch, pos); for(j=0; j<MAX_OBJ_AFFECT; j++) affect_modify(ch, obj->affected[j].location, (int)obj->affected[j].modifier, obj->obj_flags.bitvector, TRUE); if (GET_ITEM_TYPE(obj) == ITEM_WEAPON) { /* some nifty manuevering for strength */ if (IS_NPC(ch) && !IS_SET(ch->specials.act, ACT_POLYSELF)) GiveMinStrToWield(obj, ch); } affect_total(ch); }
/* * Remove an affect from a char. */ void affect_remove( CHAR_DATA *ch, AFFECT_DATA *paf ) { if ( ch->affected == NULL ) { bug( "Affect_remove: no affect.", 0 ); return; } affect_modify( ch, paf, FALSE ); if ( paf->type == gsn_shape_change || paf->type == gsn_disguise ) { if ( !IS_NPC(ch) ) { free_string( ch->pcdata->new_name ); free_string( ch->pcdata->new_last ); free_string( ch->pcdata->new_title ); free_string( ch->pcdata->new_desc ); ch->pcdata->new_name = NULL; ch->pcdata->new_last = NULL; ch->pcdata->new_title = NULL; ch->pcdata->new_desc = NULL; } } if ( paf->type == skill_lookup("set limb") ) { if ( cure_condition(ch, BODY_RIGHT_LEG, paf->strength) ) act( "$o right leg seems more straight now.", ch, NULL, NULL, TO_ALL ); else if ( cure_condition(ch, BODY_LEFT_LEG, paf->strength) ) act( "$o left leg seems more straight now.", ch, NULL, NULL, TO_ALL ); else if ( cure_condition(ch, BODY_RIGHT_ARM, paf->strength) ) act( "$o right arm seems more straight now.", ch, NULL, NULL, TO_ALL ); else if ( cure_condition(ch, BODY_LEFT_ARM, paf->strength) ) act( "$o left arm seems more straight now.", ch, NULL, NULL, TO_ALL ); } if ( paf == ch->affected ) { ch->affected = paf->next; } else { AFFECT_DATA *prev; for ( prev = ch->affected; prev != NULL; prev = prev->next ) { if ( prev->next == paf ) { prev->next = paf->next; break; } } if ( prev == NULL ) { bug( "Affect_remove: cannot find paf.", 0 ); return; } } if ( ch->affected == NULL ) { void *vo; vo = (void *) ch; rem_weave_list( vo, NODE_WEAVE_CHAR ); } paf->next = affect_free; affect_free = paf->next; return; }