/* ** doPoison */ void doPoison(CharData* vict) { int poisonDamage = aff_level(vict, AFF_POISON) + number(1,10); if (affected_by_spell(vict, SPELL_RESIST_POISON)) { switch (number(1,10)) { case 1: case 2: case 3: case 4: case 5: poisonDamage = 1; break; case 6: if (affected_by_spell(vict, SPELL_POISON)) { sendChar(vict, "You fight off the poison and recover.\r\n"); affect_from_char(vict, SPELL_POISON); return; } break; case 7: case 8: case 9: case 10: break; } } damage(vict, vict, poisonDamage/3, SPELL_POISON); }
void sun_blind(struct char_data *ch) { struct affected_type af; if (get_max_level(ch) >= LOW_IMMORTAL) return; if (IS_AFFECTED2(ch, AFF2_SUN_BLIND)) return; if (IS_AFFECTED(ch, AFF_BLIND)) return; if (affected_by_spell(ch, SPELL_SUN_BLIND)) affect_from_char(ch, SPELL_SUN_BLIND); send_to_char("Aaarrrggghh! The sun burns your eyes!\n\r", ch); af.type = SPELL_SUN_BLIND; af.location = APPLY_HITROLL; af.modifier = -4; af.duration = (number(1, 2) + (5 - get_max_level(ch) / 10)); af.bitvector = 0; affect_to_char(ch, &af); af.location = APPLY_AC; af.modifier = +20; affect_to_char(ch, &af); af.modifier = 0; af.location = APPLY_BV2; af.bitvector = AFF2_SUN_BLIND; affect_to_char(ch, &af); }
void appear(struct char_data *ch) { act("$n slowly fade into existence.", FALSE, ch,0,0,TO_ROOM); if (affected_by_spell(ch, SPELL_INVISIBLE)) affect_from_char(ch, SPELL_INVISIBLE); REMOVE_BIT(ch->specials.affected_by, AFF_INVISIBLE); }
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 appear(struct char_data *ch) { if (affected_by_spell(ch, SPELL_INVISIBLE)) affect_from_char(ch, SPELL_INVISIBLE); REMOVE_BIT(AFF_FLAGS(ch), AFF_INVISIBLE | AFF_HIDE); if (GET_LEVEL(ch) < LVL_IMMORT) act("$n slowly fades into existence.", FALSE, ch, 0, 0, CommTarget::TO_ROOM); else act("You feel a strange presence as $n appears, seemingly from nowhere.", FALSE, ch, 0, 0, CommTarget::TO_ROOM); }
/* start one char fighting another (yes, it is horrible, I know... ) */ void set_fighting(struct char_data *ch, struct char_data *vict) { assert(!ch->specials.fighting); ch->next_fighting = combat_list; combat_list = ch; if(IS_AFFECTED(ch,AFF_SLEEP)) affect_from_char(ch,SPELL_SLEEP); ch->specials.fighting = vict; GET_POS(ch) = POSITION_FIGHTING; }
void mag_unaffects(int level, struct char_data *ch, struct char_data *victim, int spellnum, int type) { int spell = 0, msg_not_affected = TRUE; const char *to_vict = NULL, *to_room = NULL; if (victim == NULL) return; switch (spellnum) { case SPELL_HEAL: /* * Heal also restores health, so don't give the "no effect" message * if the target isn't afflicted by the 'blindness' spell. */ msg_not_affected = FALSE; /* fall-through */ case SPELL_CURE_BLIND: spell = SPELL_BLINDNESS; to_vict = "Your vision returns!"; to_room = "There's a momentary gleam in $n's eyes."; break; case SPELL_REMOVE_POISON: spell = SPELL_POISON; to_vict = "A warm feeling runs through your body!"; to_room = "$n looks better."; break; case SPELL_REMOVE_CURSE: spell = SPELL_CURSE; to_vict = "You don't feel so unlucky."; break; default: log("SYSERR: unknown spellnum %d passed to mag_unaffects.", spellnum); return; } if (!affected_by_spell(victim, spell)) { if (msg_not_affected) send_to_char(ch, "%s", NOEFFECT); return; } affect_from_char(victim, spell); if (to_vict != NULL) act(to_vict, FALSE, victim, 0, ch, TO_CHAR); if (to_room != NULL) act(to_room, TRUE, victim, 0, ch, TO_ROOM); }
void check_berserk(CHAR_DATA * ch) { AFFECT_DATA af; struct timed_type timed; int prob; if (affected_by_spell(ch, SPELL_BERSERK) && (GET_HIT(ch) > GET_REAL_MAX_HIT(ch) / 2)) { affect_from_char(ch, SPELL_BERSERK); send_to_char("Предсмертное исступление оставило Вас.\r\n", ch); } //!IS_NPC(ch) && if (can_use_feat(ch, BERSERK_FEAT) && ch->get_fighting() && !timed_by_feat(ch, BERSERK_FEAT) && !AFF_FLAGGED(ch, AFF_BERSERK) && (GET_HIT(ch) < GET_REAL_MAX_HIT(ch) / 4)) { // if (!IS_NPC(ch)) { //Gorrah: вроде бы у мобов скиллы тикают так же, так что глюков быть не должно timed.skill = BERSERK_FEAT; timed.time = 4; timed_feat_to_char(ch, &timed); // } af.type = SPELL_BERSERK; af.duration = pc_duration(ch, 1, 60, 30, 0, 0); af.modifier = 0; af.location = APPLY_NONE; af.battleflag = 0; prob = IS_NPC(ch) ? 601 : (751 - GET_LEVEL(ch) * 5); if (number(1, 1000) < prob) { af.bitvector = AFF_BERSERK; act("Вас обуяла предсмертная ярость!", FALSE, ch, 0, 0, TO_CHAR); act("$n0 исступленно взвыл$g и бросил$u на противника!", FALSE, ch, 0, 0, TO_ROOM); } else { af.bitvector = 0; act("Вы истошно завопили, пытаясь напугать противника. Без толку.", FALSE, ch, 0, 0, TO_CHAR); act("$n0 истошно завопил$g, пытаясь напугать противника. Забавно...", FALSE, ch, 0, 0, TO_ROOM); } affect_join(ch, &af, TRUE, FALSE, TRUE, FALSE); } }
/* start one char fighting another (yes, it is horrible, I know... ) */ void set_fighting(struct char_data *ch, struct char_data *vict) { if (ch == vict) return; if (FIGHTING(ch)) { core_dump(); return; } ch->next_fighting = combat_list; combat_list = ch; if (AFF_FLAGGED(ch, AFF_SLEEP)) affect_from_char(ch, SPELL_SLEEP); FIGHTING(ch) = vict; GET_POS(ch) = POS_FIGHTING; if (!pk_allowed) check_killer(ch, vict); }
void remove_sun_blind(struct char_data *ch) { struct affected_type af; if (get_max_level(ch) >= LOW_IMMORTAL) return; send_to_char("Your vision begins to return.\n\r", ch); act("$n's vision begins to return.\n\r", TRUE, ch, 0, 0, TO_ROOM); affect_from_char(ch, SPELL_SUN_BLIND); af.type = SPELL_SUN_BLIND; af.location = APPLY_HITROLL; af.modifier = -2; af.duration = 1; af.bitvector = 0; affect_to_char(ch, &af); af.location = APPLY_AC; af.modifier = +10; affect_to_char(ch, &af); }
void regen_update( void ) { CharData *i, *next_char; int hit, mana, move; int vivify_level; for( i = character_list; i; i = next_char ) { next_char = i->next; if(affected_by_spell(i, SKILL_EMACIATED) && (GET_COND(i, HUNGER) != 0 || IS_VAMPIRE(i)) && GET_COND(i, THIRST) != 0) { if(!affected_by_spell(i, SKILL_EMACIATED_MANA) && !affected_by_spell(i, SKILL_EMACIATED_HIT)) affect_from_char(i, SKILL_EMACIATED); else if(percentSuccess(4)) { affect_from_char(i, SKILL_EMACIATED_MANA); affect_from_char(i, SKILL_EMACIATED_HIT); } } // Dwarves sober up 3x faster than most races (unless they drink more...) if(IS_DWARF(i) && !number(0, 35)) gain_condition(i, DRUNK, -1); vivify_level = spell_level(i, SPELL_VIVIFY); affect_from_char(i, SPELL_VIVIFY); if(GET_POS(i) <= POS_MEDITATING) { add_affect(i, i, SPELL_VIVIFY, MIN(vivify_level + 1, 100), APPLY_NONE, 0, -1, 0, FALSE, FALSE, FALSE, FALSE); } if(GET_POS(i) >= POS_MORTALLYW) { hit = hit_gain(i); mana = mana_gain(i); move = move_gain(i); if(affected_by_spell(i, SPELL_VIVIFY)) { if(hit > 0) hit += spell_level(i, SPELL_VIVIFY) * GET_MAX_HIT(i)/600; if(mana > 0) mana += spell_level(i, SPELL_VIVIFY) * GET_MAX_MANA(i)/600; if(move > 0) move += spell_level(i, SPELL_VIVIFY) * GET_MAX_MOVE(i)/600; } // Regeneration is increased on pvp holidays. If you're incapactitated, you will // eventually recover. if(pvpHoliday(i)) { if (GET_POS(i) < POS_SLEEPING) hit = 20; else { hit = (hit > 0) ? hit *3 : 20; mana = (mana > 0) ? mana*2 : 40; move = (move > 0) ? move*2 : 40; } } // 72 seconds per tick... if(hit < 0 || GET_HIT(i) < GET_MAX_HIT(i)) { if(hit>0) GET_HIT(i) += hit/72 + (hit % 72 > number(0, 71)? 1:0); else GET_HIT(i) = MAX(GET_HIT(i) + hit/72 + (-hit % 72 > number(0, 71)?-1:0), -9); } else { int surplus = (GET_HIT(i) - GET_MAX_HIT(i)); GET_HIT(i) -= surplus / 72 + (surplus % 72 > number(0, 71)? 1:0); } if(mana>0) GET_MANA(i) = MAX(MIN(GET_MANA(i) + mana/72 + (mana % 72 > number(0, 71)?1:0), GET_MAX_MANA(i)), 0); else GET_MANA(i) = MIN(GET_MANA(i) + mana/72 + (-mana % 72 > number(0, 71)?-1:0), GET_MAX_MANA(i)); if(move>0) GET_MOVE(i) = MIN(GET_MOVE(i) + move/72 + (move % 72 > number(0, 71)?1:0), GET_MAX_MOVE(i)); else GET_MOVE(i) = MAX(MIN(GET_MOVE(i) + move/72 + (-move % 72 > number(0, 71)?-1:0), GET_MAX_MOVE(i)), 0); update_pos(i); } } }
int mag_affect_char(struct spell_info_type *sinfo, int affect_flag, struct char_data *caster, struct char_data *vict, int level) { struct affected_type af; int i; int spell = 0; int unaffect = 0; int circle = (level + 4) / 5; /* innate */ if (level == -1) { SET_BIT(AFF_FLAGS(vict), affect_flag); return 1; } if (sinfo->unaffect) { spell = spells[find_spell_num(sinfo->unaffect)].spellindex; unaffect = 1; } if (!unaffect) { af.type = sinfo->spellindex; af.bitvector = sinfo->spell_plr_bit; af.bitvector2 = sinfo->spell_plr_bit2; af.bitvector3 = sinfo->spell_plr_bit3; if (sinfo->spell_duration) af.duration = sinfo->spell_duration * 12; else af.duration = (SECS_PER_MUD_HOUR * level) / 15; /* level/3 mud hours duration */ af.duration = modBySpecialization(caster, sinfo, af.duration); gain_exp(caster, af.duration * 2); if (strcmp(sinfo->command, "stoneskin") == 0) af.duration = level * 5; for (i = 0; i < NUM_MODIFY; i++) { af.modifier[i] = 0; af.location[i] = 0; } for (i = 0; i < NUM_MODIFY; i++) { if (sinfo->plr_aff[i].location) { if (strcmp(sinfo->command, "vitality") == 0 || strcmp(sinfo->command, "vigorize") == 0) af.modifier[i] = (sinfo->plr_aff[i].modifier * level); else if (strcmp(sinfo->command, "barkskin") == 0) { af.modifier[i] = (sinfo->plr_aff[i].modifier - (3.5 * circle)); } else af.modifier[i] = sinfo->plr_aff[i].modifier; af.location[i] = sinfo->plr_aff[i].location; } } if (IS_NPC(vict) && IS_AFFECTED(vict, sinfo->spell_plr_bit) && IS_AFFECTED2(vict, sinfo->spell_plr_bit2) && IS_AFFECTED3(vict, sinfo->spell_plr_bit3) && !affected_by_spell(vict, sinfo->spellindex)) return 0; if (affected_by_spell(vict, sinfo->spellindex) && !(sinfo->accum_duration || sinfo->accum_affect)) return 0; affect_join(vict, &af, sinfo->accum_duration, sinfo->avg_duration, sinfo->accum_affect, sinfo->avg_affect); } else { if (affected_by_spell(vict, sinfo->spellindex) && !(sinfo->accum_duration || sinfo->accum_affect)) return 0; affect_from_char(vict, spell); } return 1; }
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); }