/* returns false if mob needed to cast a room affect spell */ bool ready_heal_room( CHAR_DATA * ch ) { bool ready = TRUE; if ( ( !IS_SET( ch->in_room->affected_by, ROOM_BV_HEAL_REGEN ) ) && ( ch->hit < ch->max_hit * 75 / 100 ) ) { if ( ch->mana >= mana_cost( ch, skill_lookup( "healing light" ) ) ) { ready = FALSE; do_cast( ch, "'healing light'" ); return ready; } } if ( ( !IS_SET( ch->in_room->affected_by, ROOM_BV_MANA_REGEN ) ) && ( ch->mana < ch->max_mana * 75 / 100 ) ) { if ( ch->mana >= mana_cost( ch, skill_lookup( "mana flare" ) ) ) { ready = FALSE; do_cast( ch, "'mana flare'" ); return ready; } } return ready; }
void Character::spell_cure_blindness (int sn, int lvl, void *vo) { Character *victim = (Character *) vo; if (!victim->has_affect(skill_lookup("blindness"))) return; victim->affect_strip (skill_lookup("blindness")); victim->send_to_char ("Your vision returns!\r\n"); if (this != victim) send_to_char ("Ok.\r\n"); return; }
void Character::spell_remove_curse (int sn, int lvl, void *vo) { Character *victim = (Character *) vo; if (victim->has_affect(skill_lookup("curse"))) { victim->affect_strip (skill_lookup("curse")); victim->send_to_char ("You feel better.\r\n"); if (this != victim) send_to_char ("Ok.\r\n"); } return; }
/* * Core procedure for dragons. */ bool dragon( CHAR_DATA *ch, char *spell_name ) { CHAR_DATA *victim; CHAR_DATA *v_next; int sn; if ( ch->position != POS_FIGHTING && ch->position != POS_EVASIVE && ch->position != POS_DEFENSIVE && ch->position != POS_AGGRESSIVE && ch->position != POS_BERSERK ) return FALSE; for ( victim = ch->in_room->first_person; victim; victim = v_next ) { v_next = victim->next_in_room; if ( who_fighting( victim ) == ch && number_bits( 2 ) == 0 ) break; } if ( !victim ) return FALSE; if ( ( sn = skill_lookup( spell_name ) ) < 0 ) return FALSE; (*skill_table[sn]->spell_fun) ( sn, ch->level, ch, victim ); return TRUE; }
/* use for processing a skill or group for addition */ void group_add( CHAR_DATA *ch, const char *name, bool deduct) { int sn = skill_lookup(name); int gn = group_lookup(name); if (IS_NPC(ch)) /* NPCs do not have skills */ return; if (sn != -1) { if (ch->pcdata->learned[sn] == 0) /* i.e. not known */ { ch->pcdata->learned[sn] = 1; if (deduct) ch->pcdata->points += skill_table[sn].rating[ch->iclass]; } return; } /* now check groups */ if (gn != -1) { if (ch->pcdata->group_known[gn] == FALSE) { ch->pcdata->group_known[gn] = TRUE; if (deduct) ch->pcdata->points += group_table[gn].rating[ch->iclass]; } gn_add(ch,gn); /* make sure all skills in the group are known */ } }
int can_see_help(CHAR_DATA *ch, MYSQL_ROW row, bool fOnlyResult) { int sn = skill_lookup(row[2]); if(!str_cmp(row[2],"olc")) { if(ch->pcdata->security > 0) return TRUE; else return FALSE; } if(atoi(row[3]) > ch->level && ch->level > 0) return FALSE; if(atoi(row[3]) == 51 && (!str_cmp(row[2],"heroimm") && !IS_HEROIMM(ch))) return FALSE; if(sn > 1 && get_skill(ch,sn) < 1) { send_to_char("Viewing that helpfile requires a skill you do not have.\n\r",ch); return FALSE; } return TRUE; }
void do_chaosblast(CHAR_DATA *ch, char *argument) { CHAR_DATA *victim; char arg [MAX_INPUT_LENGTH]; int sn; int level; int spelltype; argument = one_argument( argument, arg ); if (IS_NPC(ch)) return; if (!IS_CLASS(ch, CLASS_DROW) || (!IS_SET(ch->special, SPC_DROW_MAG) && ch->generation > 2)) { return;} if ( ( victim = get_char_room( ch, arg ) ) == NULL ) if ((victim = ch->fighting) == NULL) { send_to_char( "They aren't here.\n\r", ch ); return; } if (ch->mana < 750) { send_to_char("You don't have enough mana.\n\r", ch); return;} if ( ( sn = skill_lookup( "chaos blast" ) ) < 0 ) return; spelltype = skill_table[sn].target; level = ch->spl[spelltype]/3; act("You concentrate your power on $N.",ch,NULL,victim,TO_CHAR); act("$n concentrates $s power on you.",ch,NULL,victim,TO_VICT); (*skill_table[sn].spell_fun) ( sn, level, ch, victim ); WAIT_STATE( ch, 12 ); ch->mana = ch->mana - 750; return; }
bool spec_cast_judge( CHAR_DATA *ch ) { CHAR_DATA *victim; CHAR_DATA *v_next; char *spell; int sn; if ( ch->position != POS_FIGHTING ) return FALSE; for ( victim = ch->in_room->people; victim != NULL; victim = v_next ) { v_next = victim->next_in_room; if ( victim->fighting == ch && number_bits( 2 ) == 0 ) break; } if ( victim == NULL ) return FALSE; spell = "high explosive"; if ( ( sn = skill_lookup( spell ) ) < 0 ) return FALSE; (*skill_table[sn].spell_fun) ( sn, ch->level, ch, victim,TARGET_CHAR); return TRUE; }
void do_harmony( CHAR_DATA *ch, char *argument ) { CHAR_DATA *victim; char arg[MAX_INPUT_LENGTH]; int sn, level; argument = one_argument( argument, arg ); if (IS_NPC(ch)) return; if (!IS_CLASS(ch, CLASS_ANGEL)) { send_to_char("Huh?\n\r",ch); return; } if (ch->pcdata->powers[ANGEL_HARMONY] < 5) { send_to_char("Your not in contact with your inner harmonies.\n\r",ch); return; } if ((victim = get_char_room(ch, arg)) == NULL) { send_to_char("They are not here.\n\r", ch); return; } level = number_range(100,200); sn = skill_lookup("spirit kiss"); if (sn > 0) (*skill_table[sn].spell_fun) (sn,level,ch,victim); WAIT_STATE(ch,12); return; }
/* use for processing a skill or group for addition */ void group_add( CHAR_DATA *ch, const char *name, bool deduct) { int sn,gn; if (IS_NPC(ch)) /* NPCs do not have skills */ return; sn = skill_lookup(name); if (sn != -1 && sn != gsn_gladiator_skill && sn != gsn_duelist_skill && sn != gsn_barbarian_skill && sn != gsn_dragoon_skill && sn != gsn_skirmisher_skill && sn != gsn_tactician_skill) { if (ch->pcdata->learned[sn] == 0) { ch->pcdata->learned[sn] = 1; } return; } /* now check groups */ gn = group_lookup(name); if (gn != -1) { if (ch->pcdata->group_known[gn] == FALSE) { ch->pcdata->group_known[gn] = TRUE; } gn_add(ch,gn); /* make sure all skills in the group are known */ } }
void do_new_prereq (CHAR_DATA *ch, char *argy) { SPELL_DATA *spell; int i; DEFINE_COMMAND ("zprerequisite", do_new_prereq, POSITION_DEAD, 0, LOG_NORMAL, "Allows you to see prerequisites to the skill-big tree format.") if (IS_MOB (ch)) return; for (i = 0; i < 100; i ++) vert_line[i] = FALSE; for (i = 0; i < SKILL_COUNT; i++) used_spell[i] = FALSE; if (argy[0] == '\0' || (spell = skill_lookup (argy, -1)) == NULL) { send_to_char ("Syntax: Prereq <skill/spell/prof name>\n\r", ch); return; } xprereq(ch, spell); /* Now clean up our static bool */ return; }
char * how_good (CHAR_DATA *ch, int gsn) { static char bf[256]; int i; int learned = 0; SPELL_DATA *spl; bf[0] = '\0'; if (IS_MOB(ch)) { strcpy (bf, "No Mobs Plz"); return bf; } if ((spl = skill_lookup(NULL, gsn)) == NULL) { strcpy (bf, "No spell!"); return (bf); } else { if (learned != 100) learned = ch->pcdata->learned[gsn]; for (i = 0; i < 20; i++) { if (pow.learned[i] != NULL && learned >= pow.low_range[i] && learned <= pow.high_range[i]) { strcpy (bf, pow.learned[i]); return (bf); } } } return bf; }
void power_up_mob( CHAR_DATA * ch ) { int num_percent; /* * you can only have one cloak spell */ if ( !IS_AFFECTED( ch, AFF_CLOAK_ABSORPTION ) && !IS_AFFECTED( ch, AFF_CLOAK_REFLECTION ) && !IS_AFFECTED( ch, AFF_CLOAK_FLAMING ) ) { num_percent = number_percent( ); if ( num_percent > 75 ) { if ( ch->mana >= mana_cost( ch, skill_lookup( "cloak:flaming" ) ) ) do_cast( ch, "'cloak:flaming'" ); return; } if ( num_percent > 50 ) { if ( ch->mana >= mana_cost( ch, skill_lookup( "cloak:reflection" ) ) ) do_cast( ch, "cloak:reflection" ); return; } if ( num_percent > 25 ) { if ( ch->mana >= mana_cost( ch, skill_lookup( "cloak:absorption" ) ) ) do_cast( ch, "cloak:absorption" ); return; } } /* * usually i only have mobs do one thing per round but what they hell * * let the kids have their fun :) */ if ( !IS_AFFECTED( ch, AFF_SANCTUARY ) ) if ( ch->mana >= mana_cost( ch, skill_lookup( "sanctuary" ) ) ) do_cast( ch, "sanctuary" ); if ( !IS_AFFECTED( ch, AFF_PROTECT ) ) if ( ch->mana >= mana_cost( ch, skill_lookup( "protection" ) ) ) do_cast( ch, "protection" ); if ( !IS_AFFECTED( ch, skill_lookup( "bless" ) ) ) if ( ch->mana >= mana_cost( ch, skill_lookup( "bless" ) ) ) do_cast( ch, "bless" ); if ( !IS_AFFECTED( ch, skill_lookup( "stone skin" ) ) ) if ( ch->mana >= mana_cost( ch, skill_lookup( "stone skin" ) ) ) do_cast( ch, "stone" ); return; }
/* check improve for styles */ void check_style_improve( CHAR_DATA *ch, int style, int multiplier ) { int chance,sn,skill,gn,i; char test[MSL]; if(style == 0 || style >= 100) return; sn = skill_lookup( style_table[style].name ); chance = 10 * int_app[get_curr_stat(ch,STAT_INT)].learn; chance /= ( multiplier * 4); chance += ch->level * 2; if(number_range(1,1000) > chance) return; ch->pcdata->learned[sn]++; if(ch->pcdata->learned[sn] > 100) ch->pcdata->learned[sn] = 100; /* check for newly learned style skills */ for(i=0; i<MAX_STYLE_SKILL; i++) { skill = skill_lookup(style_percent[i].name); if(skill > 0) { gn = gn_skill_lookup(skill); if(gn > 1) { if(!str_prefix(group_table[gn].name,style_table[style].name)) { if(ch->pcdata->learned[sn] == style_percent[i].percent) { sprintf(test,"%sYou make a breakthrough in your understanding of the %s style!%s", get_char_color(ch, "lightyellow"), style_table[style].name, END_COLOR(ch)); act(test,ch,0,0,TO_CHAR); sprintf(test,"You feel ready to learn the %s skill.",style_percent[i].name); act(test,ch,0,0,TO_CHAR); } } } } } }
void handle_reaction(CHAR_DATA *ch, CHAR_DATA *victim) { if(skill_lookup("counter") == victim->reaction_num) { if(number_range(1,100) < 60) f_multi_hit( victim, ch, TYPE_UNDEFINED ); } }
bool spec_cast_cleric( CHAR_DATA *ch ) { CHAR_DATA *victim; CHAR_DATA *v_next; char *spell; int sn; summon_if_hating( ch ); if ( ch->position != POS_FIGHTING && ch->position != POS_EVASIVE && ch->position != POS_DEFENSIVE && ch->position != POS_AGGRESSIVE && ch->position != POS_BERSERK ) return FALSE; for ( victim = ch->in_room->first_person; victim; victim = v_next ) { v_next = victim->next_in_room; if ( who_fighting( victim ) == ch && number_bits( 2 ) == 0 ) break; } if ( !victim || victim == ch ) return FALSE; for ( ;; ) { int min_level; switch ( number_bits( 4 ) ) { case 0: min_level = 0; spell = "cause light"; break; case 1: min_level = 3; spell = "cause serious"; break; case 2: min_level = 6; spell = "earthquake"; break; case 3: min_level = 7; spell = "blindness"; break; case 4: min_level = 9; spell = "cause critical"; break; case 5: min_level = 10; spell = "dispel evil"; break; case 6: min_level = 12; spell = "curse"; break; case 7: min_level = 13; spell = "flamestrike"; break; case 8: case 9: case 10: min_level = 15; spell = "harm"; break; default: min_level = 16; spell = "dispel magic"; break; } if ( ch->level >= min_level ) break; } if ( ( sn = skill_lookup( spell ) ) < 0 ) return FALSE; (*skill_table[sn]->spell_fun) ( sn, ch->level, ch, victim ); return TRUE; }
void assemble_sequence(struct list *sequence, char *description) { int lskill = -1, rskill = -1; string_to_lower_case(description); char *tok = strtok(description, "/"); while (tok) { if (!strcmp(tok, "switch")) { action_t a = { switch_slot, 0 }; list_add(sequence, &a); } else { char *separator = strchr(tok, ':'); if (separator) { *separator = '\0'; char *side = tok; char *s_skill = ++separator; int skill = skill_lookup(s_skill); if (skill >= 0) { if (!strcmp(side, "left") && skill >= 0) { if (skill != lskill) { action_t a = { swap_left, skill }; list_add(sequence, &a); lskill = skill; } action_t a = { cast_left, 0 }; list_add(sequence, &a); } else if (!strcmp(side, "right") && skill >= 0) { if (skill != rskill) { action_t a = { swap_right, skill }; list_add(sequence, &a); rskill = skill; } action_t a = { cast_right, 0 }; list_add(sequence, &a); } else if (!strcmp(side, "self") && skill >= 0) { if (skill != rskill) { action_t a = { swap_right, skill }; list_add(sequence, &a); rskill = skill; } action_t a = { cast_self, 0 }; list_add(sequence, &a); } } } } tok = strtok(NULL, "/"); } }
bool spec_cast_mage( CHAR_DATA *ch ) { CHAR_DATA *victim; CHAR_DATA *v_next; char *spell; int sn; summon_if_hating( ch ); if ( ch->position != POS_FIGHTING && ch->position != POS_EVASIVE && ch->position != POS_DEFENSIVE && ch->position != POS_AGGRESSIVE && ch->position != POS_BERSERK ) return FALSE; for ( victim = ch->in_room->first_person; victim; victim = v_next ) { v_next = victim->next_in_room; if ( who_fighting( victim ) && number_bits( 2 ) == 0 ) break; } if ( !victim || victim == ch ) return FALSE; for ( ;; ) { int min_level; switch ( number_bits( 4 ) ) { case 0: min_level = 0; spell = "black hand"; break; case 1: min_level = 3; spell = "chill touch"; break; case 2: min_level = 7; spell = "weaken"; break; case 3: min_level = 8; spell = "galvanic whip"; break; case 4: min_level = 11; spell = "colour spray"; break; case 5: min_level = 12; spell = "weaken"; break; case 6: min_level = 13; spell = "energy drain"; break; case 7: min_level = 14; spell = "spectral furor"; break; case 8: case 9: min_level = 15; spell = "fireball"; break; default: min_level = 20; spell = "acid blast"; break; } if ( ch->level >= min_level ) break; } if ( ( sn = skill_lookup( spell ) ) < 0 ) return FALSE; (*skill_table[sn]->spell_fun) ( sn, ch->level, ch, victim ); return TRUE; }
void objfun_cast_fight(OBJ_DATA *obj, CHAR_DATA *keeper) { int sn; CHAR_DATA *victim; int min_lev; char *spell = ""; if (keeper == NULL || (keeper->fighting == NULL) || (obj->item_type != ITEM_WEAPON)) return; if ((get_eq_char(keeper, WEAR_WIELD) != obj) && (get_eq_char(keeper, WEAR_WIELD_2) != obj)) return; /* Must be wielded to work */ for (victim = keeper->in_room->first_person; victim != NULL; victim = victim->next_in_room) if (victim->fighting == keeper && number_bits(2) == 0) break; if ((victim == NULL) || (victim->is_free != FALSE)) return; switch (number_range(0, 5)) { case 0: min_lev = 5; spell = "magic missile"; break; case 1: min_lev = 7; spell = "colour spray"; break; case 2: min_lev = 8; spell = "chill touch"; break; case 3: min_lev = 30; spell = "fireball"; break; case 4: min_lev = 55; spell = "flamestrike"; break; case 5: min_lev = 30; spell = "lightning bolt"; break; } if ((sn = skill_lookup(spell)) < 0) return; act("$p glows brightly at $n!", victim, obj, NULL, TO_ROOM); act("$p glows brightly at you!", victim, obj, NULL, TO_CHAR); obj_cast_spell(sn, obj->level, keeper, victim, obj); return; }
bool spec_breath_gas( CHAR_DATA *ch ) { int sn; if ( ch->position != POS_FIGHTING ) return FALSE; if ( ( sn = skill_lookup( "gas breath" ) ) < 0 ) return FALSE; (*skill_table[sn].spell_fun) ( sn, ch->level, ch, NULL,TARGET_CHAR); return TRUE; }
void do_mpcast( CHAR_DATA *ch, char *argument ) { CHAR_DATA *vch; OBJ_DATA *obj; void *victim = NULL; char spell[ MAX_INPUT_LENGTH ], target[ MAX_INPUT_LENGTH ]; int sn; argument = one_argument( argument, spell ); one_argument( argument, target ); if ( spell[0] == '\0' ) { bug( "MpCast - Bad syntax from vnum %d.", IS_NPC(ch) ? ch->pIndexData->vnum : 0 ); return; } if ( ( sn = skill_lookup( spell ) ) < 0 ) { bug( "MpCast - No such spell from vnum %d.", IS_NPC(ch) ? ch->pIndexData->vnum : 0 ); return; } vch = get_char_room( ch, target ); obj = get_obj_here( ch, target ); switch ( skill_table[sn].target ) { default: return; case TAR_IGNORE: break; case TAR_CHAR_OFFENSIVE: if ( vch == NULL || vch == ch ) return; victim = ( void * ) vch; break; case TAR_CHAR_DEFENSIVE: victim = vch == NULL ? ( void *) ch : (void *) vch; break; case TAR_CHAR_SELF: victim = ( void *) ch; break; case TAR_OBJ_CHAR_DEF: case TAR_OBJ_CHAR_OFF: case TAR_OBJ_INV: if ( obj == NULL ) return; victim = ( void * ) obj; } (*skill_table[sn].spell_fun)( sn, ch->level, ch, victim, skill_table[sn].target ); return; }
bool spec_cast_undead( CHAR_DATA *ch ) { CHAR_DATA *victim; CHAR_DATA *v_next; char *spell; int sn; summon_if_hating( ch ); if ( ch->position != POS_FIGHTING && ch->position != POS_EVASIVE && ch->position != POS_DEFENSIVE && ch->position != POS_AGGRESSIVE && ch->position != POS_BERSERK ) return FALSE; for ( victim = ch->in_room->first_person; victim; victim = v_next ) { v_next = victim->next_in_room; if ( who_fighting( victim ) == ch && number_bits( 2 ) == 0 ) break; } if ( !victim || victim == ch ) return FALSE; for ( ;; ) { int min_level; switch ( number_bits( 4 ) ) { case 0: min_level = 0; spell = "chill touch"; break; case 1: min_level = 11; spell = "weaken"; break; case 2: min_level = 12; spell = "curse"; break; case 3: min_level = 13; spell = "blindness"; break; case 4: min_level = 14; spell = "poison"; break; case 5: min_level = 15; spell = "energy drain"; break; case 6: min_level = 18; spell = "harm"; break; default: min_level = 40; spell = "gate"; break; } if ( ch->level >= min_level ) break; } if ( ( sn = skill_lookup( spell ) ) < 0 ) return FALSE; (*skill_table[sn]->spell_fun) ( sn, ch->level, ch, victim ); return TRUE; }
void Character::spell_faerie_fog (int sn, int lvl, void *vo) { act ("$n conjures a cloud of purple smoke.", NULL, NULL, TO_ROOM); send_to_char ("You conjure a cloud of purple smoke.\r\n"); CharIter ich; for (ich = in_room->people.begin(); ich != in_room->people.end(); ich++) { if (*ich == this || (*ich)->saves_spell (lvl)) continue; (*ich)->affect_strip (skill_lookup("invis")); (*ich)->affect_strip (skill_lookup("mass invis")); (*ich)->affect_strip (skill_lookup("sneak")); REMOVE_BIT ((*ich)->affected_by, AFF_HIDE); REMOVE_BIT ((*ich)->affected_by, AFF_INVISIBLE); REMOVE_BIT ((*ich)->affected_by, AFF_SNEAK); (*ich)->act ("$n is revealed!", NULL, NULL, TO_ROOM); (*ich)->send_to_char ("You are revealed!\r\n"); } return; }
void Character::spell_cure_poison (int sn, int lvl, void *vo) { Character *victim = (Character *) vo; int pois = skill_lookup("poison"); if (victim->has_affect(pois)) { victim->affect_strip (pois); act ("$N looks better.", NULL, victim, TO_NOTVICT); victim->send_to_char ("A warm feeling runs through your body.\r\n"); send_to_char ("Ok.\r\n"); } return; }
void char_data::set_cooldown( const char *skill ) { int sn = skill_lookup(skill); if ( sn < 0 ) return; if ( skill_table[sn].cooldown <= COOLDOWN_NONE ) return; cooldown[skill_table[sn].cooldown] += skill_table[sn].beats; return; }
bool spec_cast_cleric( CHAR_DATA *ch ) { CHAR_DATA *victim; CHAR_DATA *v_next; char *spell; int sn; if ( ch->position != POS_FIGHTING ) return FALSE; for ( victim = ch->in_room->people; victim != NULL; victim = v_next ) { v_next = victim->next_in_room; if ( victim->fighting == ch && number_bits( 2 ) == 0 ) break; } if ( victim == NULL ) return FALSE; for ( ;; ) { int min_level; switch ( number_bits( 4 ) ) { case 0: min_level = 0; spell = "blindness"; break; case 1: min_level = 3; spell = "cause serious"; break; case 2: min_level = 7; spell = "earthquake"; break; case 3: min_level = 9; spell = "cause critical"; break; case 4: min_level = 10; spell = "dispel evil"; break; case 5: min_level = 12; spell = "curse"; break; case 6: min_level = 12; spell = "change sex"; break; case 7: min_level = 13; spell = "flamestrike"; break; case 8: case 9: case 10: min_level = 15; spell = "harm"; break; case 11: min_level = 15; spell = "plague"; break; default: min_level = 16; spell = "dispel magic"; break; } if ( ch->level >= min_level ) break; } if ( ( sn = skill_lookup( spell ) ) < 0 ) return FALSE; (*skill_table[sn].spell_fun) ( sn, ch->level, ch, victim,TARGET_CHAR); return TRUE; }
bool spec_cast_adept( CHAR_DATA *ch ) { CHAR_DATA *victim; CHAR_DATA *v_next; if ( !IS_AWAKE(ch) ) return FALSE; for ( victim = ch->in_room->people; victim != NULL; victim = v_next ) { v_next = victim->next_in_room; if ( victim != ch && can_see( ch, victim ) && number_bits( 1 ) == 0 ) break; } if ( victim == NULL ) return FALSE; switch ( number_bits( 3 ) ) { case 0: act( "$n utters the word 'tehctah'.", ch, NULL, NULL, TO_ROOM ); spell_armor( skill_lookup( "armor" ), ch->level, ch, victim ); return TRUE; case 1: act( "$n utters the word 'nhak'.", ch, NULL, NULL, TO_ROOM ); spell_bless( skill_lookup( "bless" ), ch->level, ch, victim ); return TRUE; case 2: act( "$n utters the word 'yeruf'.", ch, NULL, NULL, TO_ROOM ); spell_cure_blindness( skill_lookup( "cure blindness" ), ch->level, ch, victim ); return TRUE; case 3: act( "$n utters the word 'garf'.", ch, NULL, NULL, TO_ROOM ); spell_cure_light( skill_lookup( "cure light" ), ch->level, ch, victim ); return TRUE; case 4: act( "$n utters the words 'rozar'.", ch, NULL, NULL, TO_ROOM ); spell_cure_poison( skill_lookup( "cure poison" ), ch->level, ch, victim ); return TRUE; case 5: act( "$n utters the words 'nadroj'.", ch, NULL, NULL, TO_ROOM ); spell_refresh( skill_lookup( "refresh" ), ch->level, ch, victim ); return TRUE; } return FALSE; }
bool spec_cast_mage( CHAR_DATA *ch ) { CHAR_DATA *victim; CHAR_DATA *v_next; char *spell; int sn; if ( ch->position != POS_FIGHTING ) return FALSE; for ( victim = ch->in_room->people; victim != NULL; victim = v_next ) { v_next = victim->next_in_room; if ( victim->fighting == ch && number_bits( 2 ) == 0 ) break; } if ( victim == NULL ) return FALSE; for ( ;; ) { int min_level; switch ( number_bits( 4 ) ) { case 0: min_level = 0; spell = "blindness"; break; case 1: min_level = 3; spell = "chill touch"; break; case 2: min_level = 7; spell = "weaken"; break; case 3: min_level = 8; spell = "teleport"; break; case 4: min_level = 11; spell = "colour spray"; break; case 5: min_level = 12; spell = "change sex"; break; case 6: min_level = 13; spell = "energy drain"; break; case 7: case 8: case 9: min_level = 15; spell = "fireball"; break; case 10: min_level = 20; spell = "plague"; break; default: min_level = 20; spell = "acid blast"; break; } if ( ch->level >= min_level ) break; } if ( ( sn = skill_lookup( spell ) ) < 0 ) return FALSE; (*skill_table[sn].spell_fun) ( sn, ch->level, ch, victim,TARGET_CHAR); return TRUE; }
void mob_regen_check( CHAR_DATA * ch, CHAR_DATA * target, bool need_flee ) { char buf[MAX_STRING_LENGTH]; if ( target == NULL ) target = ch; if ( ch->mana >= mana_cost( ch, skill_lookup( "heal" ) ) ) snprintf( buf, MSL, "'heal' %s", target->name.c_str() ); else if ( ch->mana >= mana_cost( ch, skill_lookup( "cure critical" ) ) ) snprintf( buf, MSL, "'cure critical' %s", target->name.c_str() ); else if ( ch->mana >= mana_cost( ch, skill_lookup( "cure serious" ) ) ) snprintf( buf, MSL, "'cure serious' %s", target->name.c_str() ); else if ( need_flee == TRUE ) { do_flee( ch, "" ); return; } else if ( need_flee == FALSE ) return; do_cast( ch, buf ); return; }
bool spec_cast_undead( CHAR_DATA *ch ) { CHAR_DATA *victim; CHAR_DATA *v_next; char *spell; int sn; if ( ch->position != POS_FIGHTING ) return FALSE; for ( victim = ch->in_room->people; victim != NULL; victim = v_next ) { v_next = victim->next_in_room; if ( victim->fighting == ch && number_bits( 2 ) == 0 ) break; } if ( victim == NULL ) return FALSE; for ( ;; ) { int min_level; switch ( number_bits( 4 ) ) { case 0: min_level = 0; spell = "curse"; break; case 1: min_level = 3; spell = "weaken"; break; case 2: min_level = 6; spell = "chill touch"; break; case 3: min_level = 9; spell = "blindness"; break; case 4: min_level = 12; spell = "poison"; break; case 5: min_level = 15; spell = "energy drain"; break; case 6: min_level = 18; spell = "harm"; break; case 7: min_level = 21; spell = "teleport"; break; default: min_level = 24; spell = "gate"; break; } if ( ch->level >= min_level ) break; } if ( ( sn = skill_lookup( spell ) ) < 0 ) return FALSE; (*skill_table[sn].spell_fun) ( sn, ch->level, ch, victim ); return TRUE; }