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 obj_data *unequip_char(struct char_data *ch, int pos) { int j; struct obj_data *obj; if ((pos < 0 || pos >= NUM_WEARS) || GET_EQ(ch, pos) == NULL) { core_dump(); return (NULL); } 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 (IN_ROOM(ch) != NOWHERE) { if (pos == WEAR_LIGHT && GET_OBJ_TYPE(obj) == ITEM_LIGHT) if (GET_OBJ_VAL(obj, 2)) /* if light is ON */ world[IN_ROOM(ch)].light--; } else log("SYSERR: IN_ROOM(ch) = NOWHERE when unequipping char %s.", GET_NAME(ch)); GET_EQ(ch, pos) = NULL; for (j = 0; j < MAX_OBJ_AFFECT; j++) affect_modify_ar(ch, obj->affected[j].location, obj->affected[j].modifier, GET_OBJ_AFFECT(obj), FALSE); affect_total(ch); return (obj); }
void equip_char(struct char_data *ch, struct obj_data *obj, int pos) { int j; if (pos < 0 || pos >= NUM_WEARS) { core_dump(); return; } if (GET_EQ(ch, pos)) { log("SYSERR: Char is already equipped: %s, %s", GET_NAME(ch), obj->short_description); return; } if (obj->carried_by) { log("SYSERR: EQUIP: Obj is carried_by when equip."); return; } if (IN_ROOM(obj) != NOWHERE) { log("SYSERR: EQUIP: Obj is in_room when equip."); return; } if (invalid_align(ch, obj) || invalid_class(ch, obj)) { 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); /* Changed to drop in inventory instead of the ground. */ obj_to_char(obj, ch); return; } 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 (IN_ROOM(ch) != NOWHERE) { if (pos == WEAR_LIGHT && GET_OBJ_TYPE(obj) == ITEM_LIGHT) if (GET_OBJ_VAL(obj, 2)) /* if light is ON */ world[IN_ROOM(ch)].light++; } else log("SYSERR: IN_ROOM(ch) = NOWHERE when equipping char %s.", GET_NAME(ch)); for (j = 0; j < MAX_OBJ_AFFECT; j++) affect_modify_ar(ch, obj->affected[j].location, obj->affected[j].modifier, GET_OBJ_AFFECT(obj), TRUE); affect_total(ch); }
int DamageItem(struct char_data *ch, struct obj_data *o) { int temp,i; if (!o) return 0; if (ROOM_FLAGGED(ch->in_room, ROOM_ARENA | ROOM_PEACEFUL)) return 0; temp = number(1, 2); if(GET_OBJ_COND(o) == 101){ return FALSE; } else{ for (i = 0; i < NUM_WEARS; i++) { if (GET_EQ(ch, i)) GET_AC(ch) += apply_ac(ch, i); } GET_OBJ_COND(o) -= temp; for (i = 0; i < NUM_WEARS; i++) { if (GET_EQ(ch, i)) GET_AC(ch) -= apply_ac(ch, i); } } save_char(ch, NOWHERE); sprintf(buf, "&G%s&g was &Gdamaged&g in the combat!&n\r\n", (CAN_SEE_OBJ(ch, o) ? CAP(o->short_description) : "Something")); send_to_char(buf, ch); if (GET_OBJ_COND(o) < 0) { GET_OBJ_COND(o) = 0; return TRUE; } return FALSE; }
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 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 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); }