#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "merc.h"
#include "interp.h"
#include "magic.h"
#include "recycle.h"
Include dependency graph for magic.c:

Go to the source code of this file.
Functions | |
| void wear_obj | args ((CHAR_DATA *ch, OBJ_DATA *obj, bool fReplace)) |
| bool remove_obj | args ((CHAR_DATA *ch, int iWear, bool fReplace)) |
| void say_spell | args ((CHAR_DATA *ch, int sn)) |
| bool | check_dispel (int dis_level, CHAR_DATA *victim, int sn) |
| void | do_cast (CHAR_DATA *ch, char *argument) |
| int | find_spell (CHAR_DATA *ch, const char *name) |
| int | mana_cost (CHAR_DATA *ch, int min_mana, int level) |
| void | obj_cast_spell (int sn, int level, CHAR_DATA *ch, CHAR_DATA *victim, OBJ_DATA *obj) |
| bool | saves_dispel (int dis_level, int spell_level, int duration) |
| bool | saves_spell (int level, CHAR_DATA *victim, int dam_type) |
| void | say_spell (CHAR_DATA *ch, int sn) |
| int | skill_lookup (const char *name) |
| int | slot_lookup (int slot) |
| void | spell_acid_blast (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_acid_breath (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_armor (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_bless (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_blindness (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_burning_hands (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_call_lightning (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_calm (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_cancellation (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_cause_critical (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_cause_light (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_cause_serious (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_chain_lightning (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_change_sex (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_charm_person (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_chill_touch (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_colour_spray (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_continual_light (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_control_weather (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_create_food (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_create_rose (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_create_spring (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_create_water (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_cure_blindness (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_cure_critical (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_cure_disease (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_cure_light (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_cure_poison (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_cure_serious (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_curse (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_demonfire (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_detect_evil (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_detect_good (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_detect_hidden (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_detect_invis (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_detect_magic (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_detect_poison (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_dispel_evil (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_dispel_good (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_dispel_magic (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_earthquake (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_enchant_armor (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_enchant_weapon (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_energy_drain (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_faerie_fire (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_faerie_fog (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_fire_breath (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_fireball (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_fireproof (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_flamestrike (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_floating_disc (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_fly (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_frenzy (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_frost_breath (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_gas_breath (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_gate (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_general_purpose (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_giant_strength (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_harm (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_haste (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_heal (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_heat_metal (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_high_explosive (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_holy_word (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_identify (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_infravision (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_invis (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_know_alignment (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_lightning_bolt (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_lightning_breath (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_locate_object (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_magic_missile (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_mass_healing (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_mass_invis (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_null (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_pass_door (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_plague (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_poison (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_protection_evil (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_protection_good (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_ray_of_truth (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_recharge (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_refresh (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_remove_curse (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_sanctuary (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_shield (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_shocking_grasp (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_sleep (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_slow (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_stone_skin (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_summon (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_teleport (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_tribul_kill (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_ventriloquate (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_weaken (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
| void | spell_word_of_recall (int sn, int level, CHAR_DATA *ch, void *vo, int target) |
Variables | |
| char * | target_name |
|
|
|
|
|
|
|
|
|
|
||||||||||||||||
|
Definition at line 263 of file magic.c. References affect_strip(), affect_data::duration, FALSE, is_affected(), affect_data::level, affect_data::next, saves_dispel(), send_to_char(), skill_table, TRUE, and affect_data::type. Referenced by spell_cancellation(), spell_cure_blindness(), spell_cure_disease(), spell_cure_poison(), spell_dispel_magic(), spell_haste(), spell_remove_curse(), and spell_slow(). 00264 {
00265 AFFECT_DATA *af;
00266
00267 if (is_affected (victim, sn))
00268 {
00269 for (af = victim->affected; af != NULL; af = af->next)
00270 {
00271 if (af->type == sn)
00272 {
00273 if (!saves_dispel (dis_level, af->level, af->duration))
00274 {
00275 affect_strip (victim, sn);
00276 if (skill_table[sn].msg_off)
00277 {
00278 send_to_char (skill_table[sn].msg_off, victim);
00279 send_to_char ("\n\r", victim);
00280 }
00281 return TRUE;
00282 }
00283 else
00284 af->level--;
00285 }
00286 }
00287 }
00288 return FALSE;
00289 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 306 of file magic.c. References AFF_CHARM, bug(), check_improve(), check_killer(), class_table, FALSE, char_data::fighting, find_spell(), class_type::fMana, get_char_room(), get_obj_carry(), get_obj_here(), get_skill(), global_peace, char_data::in_room, IS_AFFECTED, is_name(), IS_NPC, is_safe(), is_safe_spell(), char_data::master, MAX_INPUT_LENGTH, skill_type::minimum_position, multi_hit(), char_data::next_in_room, number_percent(), one_argument(), room_index_data::people, say_spell(), send_to_char(), skill_type::skill_level, skill_table, skill_type::spell_fun, spell_null(), str_cmp(), TAR_CHAR_DEFENSIVE, TAR_CHAR_OFFENSIVE, TAR_CHAR_SELF, TAR_IGNORE, TAR_OBJ_CHAR_DEF, TAR_OBJ_CHAR_OFF, TAR_OBJ_INV, TARGET_CHAR, target_name, TARGET_NONE, TARGET_OBJ, TRUE, TYPE_UNDEFINED, UMAX, and WAIT_STATE. 00307 {
00308 char arg1[MAX_INPUT_LENGTH];
00309 char arg2[MAX_INPUT_LENGTH];
00310 CHAR_DATA *victim;
00311 OBJ_DATA *obj;
00312 void *vo;
00313 int mana;
00314 int sn;
00315 int target;
00316
00317 /*
00318 * Switched NPC's can cast spells, but others can't.
00319 */
00320 if (IS_NPC (ch) && ch->desc == NULL)
00321 return;
00322
00323 target_name = one_argument (argument, arg1);
00324 one_argument (target_name, arg2);
00325
00326 if (arg1[0] == '\0')
00327 {
00328 send_to_char ("Cast which what where?\n\r", ch);
00329 return;
00330 }
00331
00332 if ((sn = find_spell (ch, arg1)) < 1
00333 || skill_table[sn].spell_fun == spell_null || (!IS_NPC (ch)
00334 && (ch->level <
00335 skill_table
00336 [sn].skill_level
00337 [ch->class]
00338 || ch->
00339 pcdata->learned[sn]
00340 == 0)))
00341 {
00342 send_to_char ("You don't know any spells of that name.\n\r", ch);
00343 return;
00344 }
00345
00346 if (ch->position < skill_table[sn].minimum_position)
00347 {
00348 send_to_char ("You can't concentrate enough.\n\r", ch);
00349 return;
00350 }
00351
00352 if (ch->level + 2 == skill_table[sn].skill_level[ch->class])
00353 mana = 50;
00354 else
00355 mana = UMAX (skill_table[sn].min_mana,
00356 100 / (2 + ch->level -
00357 skill_table[sn].skill_level[ch->class]));
00358
00359 /*
00360 * Locate targets.
00361 */
00362 victim = NULL;
00363 obj = NULL;
00364 vo = NULL;
00365 target = TARGET_NONE;
00366
00367 switch (skill_table[sn].target)
00368 {
00369 default:
00370 bug ("Do_cast: bad target for sn %d.", sn);
00371 return;
00372
00373 case TAR_IGNORE:
00374 break;
00375
00376 case TAR_CHAR_OFFENSIVE:
00377 if (arg2[0] == '\0')
00378 {
00379 if ((victim = ch->fighting) == NULL)
00380 {
00381 send_to_char ("Cast the spell on whom?\n\r", ch);
00382 return;
00383 }
00384 }
00385 else
00386 {
00387 /* if (!str_cmp(target_name, "all") && ch->level > 52)
00388 {
00389 char at_buf[MAX_STRING_LENGTH];
00390
00391 for (d = descriptor_list; d != NULL; d = d->next)
00392 {
00393 if (IS_NPC(d->character))
00394 continue;
00395 free_string(at_buf);
00396 strcat(at_buf, d->character->name);
00397 strcat(at_buf, " ");
00398 strcat(at_buf, "c ");
00399 strcat(at_buf, arg1);
00400 strcat(at_buf, d->character->name);
00401 do_function(ch, &do_at,at_buf );
00402
00403 }
00404 }*/
00405 if ((victim = get_char_room (ch, target_name)) == NULL)
00406 {
00407 send_to_char ("They aren't here.\n\r", ch);
00408 return;
00409 }
00410 }
00411 /*
00412 if ( ch == victim )
00413 {
00414 send_to_char( "You can't do that to yourself.\n\r", ch );
00415 return;
00416 }
00417 */
00418
00419 extern bool global_peace;
00420 if (global_peace)
00421 {
00422 send_to_char("The gods of peace have spoken. There will be no fighting.\n\r",ch);
00423 return;
00424 }
00425
00426 if (!IS_NPC (ch))
00427 {
00428
00429 if (is_safe (ch, victim) && victim != ch)
00430 {
00431 send_to_char ("Not on that target.\n\r", ch);
00432 return;
00433 }
00434 check_killer (ch, victim);
00435 }
00436 /*
00437 if (!IS_NPC(victim) && ch->clan == 0 && victim != ch)
00438 {
00439 send_to_char("Join a clan if you wish to attack players.\n\r",ch);
00440 return;
00441 }
00442 if (!IS_NPC(victim) && victim->clan == 0 && victim != ch)
00443 {
00444 send_to_char("They are not in a clan.\n\r",ch);
00445 return;
00446 }
00447 */
00448 if (IS_AFFECTED (ch, AFF_CHARM) && ch->master == victim)
00449 {
00450 send_to_char ("You can't do that on your own follower.\n\r",
00451 ch);
00452 return;
00453 }
00454
00455 vo = (void *) victim;
00456 target = TARGET_CHAR;
00457 break;
00458
00459 case TAR_CHAR_DEFENSIVE:
00460 if (arg2[0] == '\0')
00461 {
00462 victim = ch;
00463 }
00464 else
00465 {
00466 if ((victim = get_char_room (ch, target_name)) == NULL)
00467 {
00468 send_to_char ("They aren't here.\n\r", ch);
00469 return;
00470 }
00471 }
00472
00473 vo = (void *) victim;
00474 target = TARGET_CHAR;
00475 break;
00476
00477 case TAR_CHAR_SELF:
00478 if (arg2[0] != '\0' && !is_name (target_name, ch->name))
00479 {
00480 send_to_char ("You cannot cast this spell on another.\n\r",
00481 ch);
00482 return;
00483 }
00484
00485 vo = (void *) ch;
00486 target = TARGET_CHAR;
00487 break;
00488
00489 case TAR_OBJ_INV:
00490 if (arg2[0] == '\0')
00491 {
00492 send_to_char ("What should the spell be cast upon?\n\r", ch);
00493 return;
00494 }
00495
00496 if ((obj = get_obj_carry (ch, target_name, ch)) == NULL)
00497 {
00498 send_to_char ("You are not carrying that.\n\r", ch);
00499 return;
00500 }
00501
00502 vo = (void *) obj;
00503 target = TARGET_OBJ;
00504 break;
00505
00506 case TAR_OBJ_CHAR_OFF:
00507 if (arg2[0] == '\0')
00508 {
00509 if ((victim = ch->fighting) == NULL)
00510 {
00511 send_to_char ("Cast the spell on whom or what?\n\r", ch);
00512 return;
00513 }
00514
00515 target = TARGET_CHAR;
00516 }
00517 else if ((victim = get_char_room (ch, target_name)) != NULL)
00518 {
00519 target = TARGET_CHAR;
00520 }
00521
00522 if (target == TARGET_CHAR)
00523 { /* check the sanity of the attack */
00524 if ((is_safe_spell (ch, victim, FALSE) && victim != ch))
00525 {
00526 send_to_char ("Not on that target.\n\r", ch);
00527 return;
00528 }
00529 /*if (!IS_NPC(victim) && ch->clan == 0 &&!IS_NPC(ch) && victim != ch)
00530 {
00531 send_to_char("Join a clan if you wish to attack players.\n\r",ch);
00532 return;
00533 }
00534 if (!IS_NPC(victim) && !IS_NPC(ch) && victim->clan == 0 && victim != ch)
00535 {
00536 send_to_char("They are not in a clan.\n\r",ch);
00537 return;
00538 }*/
00539
00540
00541 if (IS_AFFECTED (ch, AFF_CHARM) && ch->master == victim)
00542 {
00543 send_to_char
00544 ("You can't do that on your own follower.\n\r", ch);
00545 return;
00546 }
00547
00548 if (!IS_NPC (ch))
00549 check_killer (ch, victim);
00550
00551 vo = (void *) victim;
00552 }
00553 else if ((obj = get_obj_here (ch, target_name)) != NULL)
00554 {
00555 vo = (void *) obj;
00556 target = TARGET_OBJ;
00557 }
00558 else
00559 {
00560 send_to_char ("You don't see that here.\n\r", ch);
00561 return;
00562 }
00563 break;
00564
00565 case TAR_OBJ_CHAR_DEF:
00566 if (arg2[0] == '\0')
00567 {
00568 vo = (void *) ch;
00569 target = TARGET_CHAR;
00570 }
00571 else if ((victim = get_char_room (ch, target_name)) != NULL)
00572 {
00573 vo = (void *) victim;
00574 target = TARGET_CHAR;
00575 }
00576 else if ((obj = get_obj_carry (ch, target_name, ch)) != NULL)
00577 {
00578 vo = (void *) obj;
00579 target = TARGET_OBJ;
00580 }
00581 else
00582 {
00583 send_to_char ("You don't see that here.\n\r", ch);
00584 return;
00585 }
00586 break;
00587 }
00588
00589 if (!IS_NPC (ch) && ch->mana < mana)
00590 {
00591 send_to_char ("You don't have enough mana.\n\r", ch);
00592 return;
00593 }
00594
00595 if (str_cmp (skill_table[sn].name, "ventriloquate"))
00596 say_spell (ch, sn);
00597
00598 if (ch->level > 51)
00599 {
00600 }
00601 else
00602 {
00603 WAIT_STATE (ch, skill_table[sn].beats);
00604 }
00605
00606
00607 if (number_percent () > get_skill (ch, sn))
00608 {
00609 send_to_char ("You lost your concentration.\n\r", ch);
00610 check_improve (ch, sn, FALSE, 1);
00611 if (ch->level > 51)
00612 {
00613 }
00614 else{
00615
00616 ch->mana -= mana / 2;
00617 }
00618 }
00619 else
00620 {
00621 if (ch->level > 51) {}else {ch->mana -= mana;}
00622 if (IS_NPC (ch) || class_table[ch->class].fMana)
00623 /* class has spells */
00624 (*skill_table[sn].spell_fun) (sn, ch->level, ch, vo, target);
00625 else
00626 (*skill_table[sn].spell_fun) (sn, 3 * ch->level / 4, ch, vo, target);
00627 check_improve (ch, sn, TRUE, 1);
00628 }
00629
00630 if ((skill_table[sn].target == TAR_CHAR_OFFENSIVE
00631 || (skill_table[sn].target == TAR_OBJ_CHAR_OFF
00632 && target == TARGET_CHAR)) && victim != ch
00633 && victim->master != ch)
00634 {
00635 CHAR_DATA *vch;
00636 CHAR_DATA *vch_next;
00637
00638 for (vch = ch->in_room->people; vch; vch = vch_next)
00639 {
00640 vch_next = vch->next_in_room;
00641 if (victim == vch && victim->fighting == NULL)
00642 {
00643 check_killer (victim, ch);
00644 multi_hit (victim, ch, TYPE_UNDEFINED);
00645 break;
00646 }
00647 }
00648 }
00649
00650 return;
00651 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 73 of file magic.c. References IS_NPC, LOWER, MAX_SKILL, skill_type::skill_level, skill_lookup(), skill_table, and str_prefix(). Referenced by do_cast(). 00074 {
00075 /* finds a spell the character can cast if possible */
00076 int sn, found = -1;
00077
00078 if (IS_NPC (ch))
00079 return skill_lookup (name);
00080
00081 for (sn = 0; sn < MAX_SKILL; sn++)
00082 {
00083 if (skill_table[sn].name == NULL)
00084 break;
00085 if (LOWER (name[0]) == LOWER (skill_table[sn].name[0])
00086 && !str_prefix (name, skill_table[sn].name))
00087 {
00088 if (found == -1)
00089 found = sn;
00090 if (ch->level >= skill_table[sn].skill_level[ch->class]
00091 && ch->pcdata->learned[sn] > 0)
00092 return sn;
00093 }
00094 }
00095 return found;
00096 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 292 of file magic.c. References UMAX. 00293 {
00294 if (ch->level + 2 == level)
00295 return 1000;
00296 return UMAX (min_mana, (100 / (2 + ch->level - level)));
00297 }
|
|
||||||||||||||||||||||||
|
Definition at line 658 of file magic.c. References bug(), check_killer(), FALSE, char_data::fighting, global_peace, char_data::in_room, is_safe(), is_safe_spell(), MAX_SKILL, multi_hit(), char_data::next_in_room, room_index_data::people, send_to_char(), skill_table, skill_type::spell_fun, TAR_CHAR_DEFENSIVE, TAR_CHAR_OFFENSIVE, TAR_CHAR_SELF, TAR_IGNORE, TAR_OBJ_CHAR_DEF, TAR_OBJ_CHAR_OFF, TAR_OBJ_INV, TARGET_CHAR, target_name, TARGET_NONE, TARGET_OBJ, and TYPE_UNDEFINED. Referenced by do_brandish(), do_eat(), do_quaff(), do_recite(), and do_zap(). 00660 {
00661 void *vo;
00662 extern bool global_peace;
00663 int target = TARGET_NONE;
00664
00665 if (sn <= 0)
00666 return;
00667
00668 if (sn >= MAX_SKILL || skill_table[sn].spell_fun == 0)
00669 {
00670 bug ("Obj_cast_spell: bad sn %d.", sn);
00671 return;
00672 }
00673
00674 switch (skill_table[sn].target)
00675 {
00676 default:
00677 bug ("Obj_cast_spell: bad target for sn %d.", sn);
00678 return;
00679
00680 case TAR_IGNORE:
00681 vo = NULL;
00682 break;
00683
00684 case TAR_CHAR_OFFENSIVE:
00685 if (victim == NULL)
00686 victim = ch->fighting;
00687 if (victim == NULL)
00688 {
00689 send_to_char ("You can't do that.\n\r", ch);
00690 return;
00691 }
00692 if (global_peace)
00693 {
00694 send_to_char("The gods of peace have spoken. There will be no fighting\n\r",ch);
00695 return;
00696 }
00697
00698 if (is_safe (ch, victim) && ch != victim)
00699 {
00700 send_to_char ("Something isn't right...\n\r", ch);
00701 return;
00702 }
00703 vo = (void *) victim;
00704 target = TARGET_CHAR;
00705 break;
00706
00707 case TAR_CHAR_DEFENSIVE:
00708 case TAR_CHAR_SELF:
00709 if (victim == NULL)
00710 victim = ch;
00711 vo = (void *) victim;
00712 target = TARGET_CHAR;
00713 break;
00714
00715 case TAR_OBJ_INV:
00716 if (obj == NULL)
00717 {
00718 send_to_char ("You can't do that.\n\r", ch);
00719 return;
00720 }
00721 vo = (void *) obj;
00722 target = TARGET_OBJ;
00723 break;
00724
00725 case TAR_OBJ_CHAR_OFF:
00726 if (victim == NULL && obj == NULL)
00727 {
00728 if (ch->fighting != NULL)
00729 victim = ch->fighting;
00730 else
00731 {
00732 send_to_char ("You can't do that.\n\r", ch);
00733 return;
00734 }
00735 }
00736
00737 if (victim != NULL)
00738 {
00739 if (is_safe_spell (ch, victim, FALSE) && ch != victim)
00740 {
00741 send_to_char ("Somehting isn't right...\n\r", ch);
00742 return;
00743 }
00744
00745 vo = (void *) victim;
00746 target = TARGET_CHAR;
00747 }
00748 else
00749 {
00750 vo = (void *) obj;
00751 target = TARGET_OBJ;
00752 }
00753 break;
00754
00755
00756 case TAR_OBJ_CHAR_DEF:
00757 if (victim == NULL && obj == NULL)
00758 {
00759 vo = (void *) ch;
00760 target = TARGET_CHAR;
00761 }
00762 else if (victim != NULL)
00763 {
00764 vo = (void *) victim;
00765 target = TARGET_CHAR;
00766 }
00767 else
00768 {
00769 vo = (void *) obj;
00770 target = TARGET_OBJ;
00771 }
00772
00773 break;
00774 }
00775
00776 target_name = "";
00777 (*skill_table[sn].spell_fun) (sn, level, ch, vo, target);
00778
00779
00780
00781 if ((skill_table[sn].target == TAR_CHAR_OFFENSIVE
00782 || (skill_table[sn].target == TAR_OBJ_CHAR_OFF
00783 && target == TARGET_CHAR)) && victim != ch
00784 && victim->master != ch)
00785 {
00786 CHAR_DATA *vch;
00787 CHAR_DATA *vch_next;
00788
00789 for (vch = ch->in_room->people; vch; vch = vch_next)
00790 {
00791 vch_next = vch->next_in_room;
00792 if (victim == vch && victim->fighting == NULL)
00793 {
00794 check_killer (victim, ch);
00795 multi_hit (victim, ch, TYPE_UNDEFINED);
00796 break;
00797 }
00798 }
00799 }
00800
00801 return;
00802 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 246 of file magic.c. References number_percent(), and URANGE. Referenced by check_dispel(), spell_bless(), spell_curse(), spell_dispel_magic(), and spell_remove_curse(). 00247 {
00248 int save;
00249
00250 if (duration == -1)
00251 spell_level += 5;
00252 /* very hard to dispel permanent effects */
00253
00254 save = 50 + (spell_level - dis_level) * 5;
00255 save = URANGE (5, save, 95);
00256 //rintf_to_char(victim, "%d (dispell) save throw", save);
00257
00258 return number_percent () < save;
00259 }
|
Here is the call graph for this function:

|
||||||||||||||||
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 132 of file magic.c. References act, char_data::in_room, IS_NPC, MAX_STRING_LENGTH, char_data::next_in_room, room_index_data::people, skill_table, str_prefix(), and TO_VICT. Referenced by do_cast(). 00133 {
00134 char buf[MAX_STRING_LENGTH];
00135 char buf2[MAX_STRING_LENGTH];
00136 CHAR_DATA *rch;
00137 char *pName;
00138 int iSyl;
00139 int length;
00140
00141 struct syl_type {
00142 char *old;
00143 char *new;
00144 };
00145
00146 static const struct syl_type syl_table[] = {
00147 {" ", " "},
00148 {"ar", "abra"},
00149 {"au", "kada"},
00150 {"bless", "fido"},
00151 {"blind", "nose"},
00152 {"bur", "mosa"},
00153 {"cu", "judi"},
00154 {"de", "oculo"},
00155 {"en", "unso"},
00156 {"light", "dies"},
00157 {"lo", "hi"},
00158 {"mor", "zak"},
00159 {"move", "sido"},
00160 {"ness", "lacri"},
00161 {"ning", "illa"},
00162 {"per", "duda"},
00163 {"ra", "gru"},
00164 {"fresh", "ima"},
00165 {"re", "candus"},
00166 {"son", "sabru"},
00167 {"tect", "infra"},
00168 {"tri", "cula"},
00169 {"ven", "nofo"},
00170 {"a", "a"}, {"b", "b"}, {"c", "q"}, {"d", "e"},
00171 {"e", "z"}, {"f", "y"}, {"g", "o"}, {"h", "p"},
00172 {"i", "u"}, {"j", "y"}, {"k", "t"}, {"l", "r"},
00173 {"m", "w"}, {"n", "i"}, {"o", "a"}, {"p", "s"},
00174 {"q", "d"}, {"r", "f"}, {"s", "g"}, {"t", "h"},
00175 {"u", "j"}, {"v", "z"}, {"w", "x"}, {"x", "n"},
00176 {"y", "l"}, {"z", "k"},
00177 {"", ""}
00178 };
00179
00180 buf[0] = '\0';
00181 for (pName = skill_table[sn].name; *pName != '\0'; pName += length)
00182 {
00183 for (iSyl = 0; (length = strlen (syl_table[iSyl].old)) != 0; iSyl++)
00184 {
00185 if (!str_prefix (syl_table[iSyl].old, pName))
00186 {
00187 strcat (buf, syl_table[iSyl].new);
00188 break;
00189 }
00190 }
00191
00192 if (length == 0)
00193 length = 1;
00194 }
00195
00196 sprintf (buf2, "$n utters the words, '%s'.", buf);
00197 sprintf (buf, "$n utters the words, '%s'.", skill_table[sn].name);
00198
00199 for (rch = ch->in_room->people; rch; rch = rch->next_in_room)
00200 {
00201 if (rch != ch)
00202 act ((!IS_NPC (rch) && ch->class == rch->class) ? buf : buf2,
00203 ch, NULL, rch, TO_VICT);
00204 }
00205
00206 return;
00207 }
|
Here is the call graph for this function:

|
Here is the call graph for this function:

|
|
Definition at line 104 of file magic.c. References bug(), fBootDb, MAX_SKILL, and skill_table. Referenced by load_old_obj(). 00105 {
00106 extern bool fBootDb;
00107 int sn;
00108
00109 if (slot <= 0)
00110 return -1;
00111
00112 for (sn = 0; sn < MAX_SKILL; sn++)
00113 {
00114 if (slot == skill_table[sn].slot)
00115 return sn;
00116 }
00117
00118 if (fBootDb)
00119 {
00120 bug ("Slot_lookup: bad slot %d.", slot);
00121 abort ();
00122 }
00123
00124 return -1;
00125 }
|
Here is the call graph for this function:

|
||||||||||||||||||||||||
|
Definition at line 824 of file magic.c. References DAM_ACID, damage(), dice(), saves_spell(), and TRUE. 00826 {
00827 CHAR_DATA *victim = (CHAR_DATA *) vo;
00828 int dam;
00829
00830 dam = dice (level, 12);
00831 if (saves_spell (level, victim, DAM_ACID))
00832 dam /= 2;
00833 damage (ch, victim, dam, sn, DAM_ACID, TRUE);
00834 return;
00835 }
|
Here is the call graph for this function:

|
||||||||||||||||||||||||
|
Definition at line 4825 of file magic.c. References acid_effect(), act, DAM_ACID, damage(), dice(), number_range(), saves_spell(), TARGET_CHAR, TO_CHAR, TO_NOTVICT, TO_VICT, TRUE, and UMAX. 04827 {
04828 CHAR_DATA *victim = (CHAR_DATA *) vo;
04829 int dam, hp_dam, dice_dam, hpch;
04830
04831 act ("$n spits acid at $N.", ch, NULL, victim, TO_NOTVICT);
04832 act ("$n spits a stream of corrosive acid at you.", ch, NULL, victim,
04833 TO_VICT);
04834 act ("You spit acid at $N.", ch, NULL, victim, TO_CHAR);
04835
04836 hpch = UMAX (12, ch->hit);
04837 hp_dam = number_range (hpch / 11 + 1, hpch / 6);
04838 dice_dam = dice (level, 16);
04839
04840 dam = UMAX (hp_dam + dice_dam / 10, dice_dam + hp_dam / 10);
04841
04842 if (saves_spell (level, victim, DAM_ACID))
04843 {
04844 acid_effect (victim, level / 2, dam / 4, TARGET_CHAR);
04845 damage (ch, victim, dam / 2, sn, DAM_ACID, TRUE);
04846 }
04847 else
04848 {
04849 acid_effect (victim, level, dam, TARGET_CHAR);
04850 damage (ch, victim, dam, sn, DAM_ACID, TRUE);
04851 }
04852 }
|
Here is the call graph for this function:

|
||||||||||||||||||||||||
|
Definition at line 839 of file magic.c. References act, affect_to_char(), APPLY_AC, affect_data::bitvector, affect_data::duration, is_affected(), affect_data::level, affect_data::location, affect_data::modifier, send_to_char(), TO_AFFECTS, TO_CHAR, affect_data::type, and affect_data::where. Referenced by spec_cast_adept(). 00840 {
00841 CHAR_DATA *victim = (CHAR_DATA *) vo;
00842 AFFECT_DATA af;
00843
00844 if (is_affected (victim, sn))
00845 {
00846 if (victim == ch)
00847 send_to_char ("You are already armored.\n\r", ch);
00848 else
00849 act ("$N is already armored.", ch, NULL, victim, TO_CHAR);
00850 return;
00851 }
00852 af.where = TO_AFFECTS;
00853 af.type = sn;
00854 af.level = level;
00855 af.duration = 24;
00856 af.modifier = -20;
00857 af.location = APPLY_AC;
00858 af.bitvector = 0;
00859 affect_to_char (victim, &af);
00860 send_to_char ("You feel someone protecting you.\n\r", victim);
00861 if (ch != victim)
00862 act ("$N is protected by your magic.", ch, NULL, victim, TO_CHAR);
00863 return;
00864 }
|
Here is the call graph for this function:
