Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals

special.c File Reference

#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 dependency graph for special.c:

Go to the source code of this file.

Functions

 DECLARE_SPEC_FUN (spec_panther_forest)
 DECLARE_SPEC_FUN (spec_wolf_forest)
 DECLARE_SPEC_FUN (spec_patrolman)
 DECLARE_SPEC_FUN (spec_ogre_member)
 DECLARE_SPEC_FUN (spec_troll_member)
 DECLARE_SPEC_FUN (spec_nasty)
 DECLARE_SPEC_FUN (spec_thief)
 DECLARE_SPEC_FUN (spec_poison)
 DECLARE_SPEC_FUN (spec_mayor)
 DECLARE_SPEC_FUN (spec_janitor)
 DECLARE_SPEC_FUN (spec_guard)
 DECLARE_SPEC_FUN (spec_fido)
 DECLARE_SPEC_FUN (spec_executioner)
 DECLARE_SPEC_FUN (spec_cast_undead)
 DECLARE_SPEC_FUN (spec_cast_mage)
 DECLARE_SPEC_FUN (spec_cast_judge)
 DECLARE_SPEC_FUN (spec_cast_cleric)
 DECLARE_SPEC_FUN (spec_cast_adept)
 DECLARE_SPEC_FUN (spec_breath_lightning)
 DECLARE_SPEC_FUN (spec_breath_gas)
 DECLARE_SPEC_FUN (spec_breath_frost)
 DECLARE_SPEC_FUN (spec_breath_fire)
 DECLARE_SPEC_FUN (spec_breath_acid)
 DECLARE_SPEC_FUN (spec_breath_any)
bool dragon (CHAR_DATA *ch, char *spell_name)
bool spec_breath_acid (CHAR_DATA *ch)
bool spec_breath_any (CHAR_DATA *ch)
bool spec_breath_fire (CHAR_DATA *ch)
bool spec_breath_frost (CHAR_DATA *ch)
bool spec_breath_gas (CHAR_DATA *ch)
bool spec_breath_lightning (CHAR_DATA *ch)
bool spec_cast_adept (CHAR_DATA *ch)
bool spec_cast_cleric (CHAR_DATA *ch)
bool spec_cast_judge (CHAR_DATA *ch)
bool spec_cast_mage (CHAR_DATA *ch)
bool spec_cast_undead (CHAR_DATA *ch)
bool spec_executioner (CHAR_DATA *ch)
bool spec_fido (CHAR_DATA *ch)
bool spec_guard (CHAR_DATA *ch)
bool spec_janitor (CHAR_DATA *ch)
SPEC_FUN * spec_lookup (const char *name)
bool spec_mayor (CHAR_DATA *ch)
char * spec_name (SPEC_FUN *function)
bool spec_nasty (CHAR_DATA *ch)
bool spec_ogre_member (CHAR_DATA *ch)
bool spec_panther_forest (CHAR_DATA *ch)
bool spec_patrolman (CHAR_DATA *ch)
bool spec_poison (CHAR_DATA *ch)
bool spec_thief (CHAR_DATA *ch)
bool spec_troll_member (CHAR_DATA *ch)
bool spec_wolf_forest (CHAR_DATA *ch)

Variables

const struct spec_type spec_table []


Function Documentation

DECLARE_SPEC_FUN spec_panther_forest   ) 
 

DECLARE_SPEC_FUN spec_wolf_forest   ) 
 

DECLARE_SPEC_FUN spec_patrolman   ) 
 

DECLARE_SPEC_FUN spec_ogre_member   ) 
 

DECLARE_SPEC_FUN spec_troll_member   ) 
 

DECLARE_SPEC_FUN spec_nasty   ) 
 

DECLARE_SPEC_FUN spec_thief   ) 
 

DECLARE_SPEC_FUN spec_poison   ) 
 

DECLARE_SPEC_FUN spec_mayor   ) 
 

DECLARE_SPEC_FUN spec_janitor   ) 
 

DECLARE_SPEC_FUN spec_guard   ) 
 

DECLARE_SPEC_FUN spec_fido   ) 
 

DECLARE_SPEC_FUN spec_executioner   ) 
 

DECLARE_SPEC_FUN spec_cast_undead   ) 
 

DECLARE_SPEC_FUN spec_cast_mage   ) 
 

DECLARE_SPEC_FUN spec_cast_judge   ) 
 

DECLARE_SPEC_FUN spec_cast_cleric   ) 
 

DECLARE_SPEC_FUN spec_cast_adept   ) 
 

DECLARE_SPEC_FUN spec_breath_lightning   ) 
 

DECLARE_SPEC_FUN spec_breath_gas   ) 
 

DECLARE_SPEC_FUN spec_breath_frost   ) 
 

DECLARE_SPEC_FUN spec_breath_fire   ) 
 

DECLARE_SPEC_FUN spec_breath_acid   ) 
 

DECLARE_SPEC_FUN spec_breath_any   ) 
 

bool dragon CHAR_DATA ch,
char *  spell_name
 

Definition at line 471 of file special.c.

References FALSE, char_data::fighting, char_data::in_room, char_data::next_in_room, number_bits(), room_index_data::people, POS_FIGHTING, skill_lookup(), skill_table, skill_type::spell_fun, TARGET_CHAR, and TRUE.

Referenced by dragon_lookup(), spec_breath_acid(), spec_breath_fire(), spec_breath_frost(), and spec_breath_lightning().

00472 {
00473     CHAR_DATA *victim;
00474     CHAR_DATA *v_next;
00475     int sn;
00476 
00477     if (ch->position != POS_FIGHTING)
00478         return FALSE;
00479 
00480     for (victim = ch->in_room->people; victim != NULL; victim = v_next)
00481     {
00482         v_next = victim->next_in_room;
00483         if (victim->fighting == ch && number_bits (3) == 0)
00484             break;
00485     }
00486 
00487     if (victim == NULL)
00488         return FALSE;
00489 
00490     if ((sn = skill_lookup (spell_name)) < 0)
00491         return FALSE;
00492     (*skill_table[sn].spell_fun) (sn, ch->level, ch, victim, TARGET_CHAR);
00493     return TRUE;
00494 }

Here is the call graph for this function:

bool spec_breath_acid CHAR_DATA ch  ) 
 

Definition at line 528 of file special.c.

References dragon().

Referenced by spec_breath_any().

00529 {
00530     return dragon (ch, "acid breath");
00531 }

Here is the call graph for this function:

bool spec_breath_any CHAR_DATA ch  ) 
 

Definition at line 501 of file special.c.

References FALSE, number_bits(), POS_FIGHTING, spec_breath_acid(), spec_breath_fire(), spec_breath_frost(), spec_breath_gas(), and spec_breath_lightning().

00502 {
00503     if (ch->position != POS_FIGHTING)
00504         return FALSE;
00505 
00506     switch (number_bits (3))
00507     {
00508         case 0:
00509             return spec_breath_fire (ch);
00510         case 1:
00511         case 2:
00512             return spec_breath_lightning (ch);
00513         case 3:
00514             return spec_breath_gas (ch);
00515         case 4:
00516             return spec_breath_acid (ch);
00517         case 5:
00518         case 6:
00519         case 7:
00520             return spec_breath_frost (ch);
00521     }
00522 
00523     return FALSE;
00524 }

Here is the call graph for this function:

bool spec_breath_fire CHAR_DATA ch  ) 
 

Definition at line 535 of file special.c.

References dragon().

Referenced by spec_breath_any().

00536 {
00537     return dragon (ch, "fire breath");
00538 }

Here is the call graph for this function:

bool spec_breath_frost CHAR_DATA ch  ) 
 

Definition at line 542 of file special.c.

References dragon().

Referenced by spec_breath_any().

00543 {
00544     return dragon (ch, "frost breath");
00545 }

Here is the call graph for this function:

bool spec_breath_gas CHAR_DATA ch  ) 
 

Definition at line 549 of file special.c.

References FALSE, POS_FIGHTING, skill_lookup(), skill_table, skill_type::spell_fun, TARGET_CHAR, and TRUE.

Referenced by spec_breath_any().

00550 {
00551     int sn;
00552 
00553     if (ch->position != POS_FIGHTING)
00554         return FALSE;
00555 
00556     if ((sn = skill_lookup ("gas breath")) < 0)
00557         return FALSE;
00558     (*skill_table[sn].spell_fun) (sn, ch->level, ch, NULL, TARGET_CHAR);
00559     return TRUE;
00560 }

Here is the call graph for this function:

bool spec_breath_lightning CHAR_DATA ch  ) 
 

Definition at line 564 of file special.c.

References dragon().

Referenced by spec_breath_any().

00565 {
00566     return dragon (ch, "lightning breath");
00567 }

Here is the call graph for this function:

bool spec_cast_adept CHAR_DATA ch  ) 
 

Definition at line 571 of file special.c.

References act, can_see(), FALSE, char_data::in_room, IS_AWAKE, IS_NPC, char_data::level, char_data::next_in_room, number_bits(), room_index_data::people, skill_lookup(), spell_armor(), spell_bless(), spell_cure_blindness(), spell_cure_disease(), spell_cure_light(), spell_cure_poison(), spell_refresh(), TARGET_CHAR, TO_ROOM, and TRUE.

00572 {
00573     CHAR_DATA *victim;
00574     CHAR_DATA *v_next;
00575 
00576     if (!IS_AWAKE (ch))
00577         return FALSE;
00578 
00579     for (victim = ch->in_room->people; victim != NULL; victim = v_next)
00580     {
00581         v_next = victim->next_in_room;
00582         if (victim != ch && can_see (ch, victim) && number_bits (1) == 0
00583             && !IS_NPC (victim) && victim->level < 11)
00584             break;
00585     }
00586 
00587     if (victim == NULL)
00588         return FALSE;
00589 
00590     switch (number_bits (4))
00591     {
00592         case 0:
00593             act ("$n utters the word 'abrazak'.", ch, NULL, NULL, TO_ROOM);
00594             spell_armor (skill_lookup ("armor"), ch->level, ch, victim,
00595                          TARGET_CHAR);
00596             return TRUE;
00597 
00598         case 1:
00599             act ("$n utters the word 'fido'.", ch, NULL, NULL, TO_ROOM);
00600             spell_bless (skill_lookup ("bless"), ch->level, ch, victim,
00601                          TARGET_CHAR);
00602             return TRUE;
00603 
00604         case 2:
00605             act ("$n utters the words 'judicandus noselacri'.", ch, NULL,
00606                  NULL, TO_ROOM);
00607             spell_cure_blindness (skill_lookup ("cure blindness"), ch->level,
00608                                   ch, victim, TARGET_CHAR);
00609             return TRUE;
00610 
00611         case 3:
00612             act ("$n utters the words 'judicandus dies'.", ch, NULL, NULL,
00613                  TO_ROOM);
00614             spell_cure_light (skill_lookup ("cure light"), ch->level, ch,
00615                               victim, TARGET_CHAR);
00616             return TRUE;
00617 
00618         case 4:
00619             act ("$n utters the words 'judicandus sausabru'.", ch, NULL, NULL,
00620                  TO_ROOM);
00621             spell_cure_poison (skill_lookup ("cure poison"), ch->level, ch,
00622                                victim, TARGET_CHAR);
00623             return TRUE;
00624 
00625         case 5:
00626             act ("$n utters the word 'candusima'.", ch, NULL, NULL, TO_ROOM);
00627             spell_refresh (skill_lookup ("refresh"), ch->level, ch, victim,
00628                            TARGET_CHAR);
00629             return TRUE;
00630 
00631         case 6:
00632             act ("$n utters the words 'judicandus eugzagz'.", ch, NULL, NULL,
00633                  TO_ROOM);
00634             spell_cure_disease (skill_lookup ("cure disease"), ch->level, ch,
00635                                 victim, TARGET_CHAR);
00636     }
00637 
00638     return FALSE;
00639 }

Here is the call graph for this function:

bool spec_cast_cleric CHAR_DATA ch  ) 
 

Definition at line 643 of file special.c.

References FALSE, char_data::fighting, char_data::in_room, char_data::next_in_room, number_bits(), room_index_data::people, POS_FIGHTING, skill_lookup(), skill_table, skill_type::spell_fun, TARGET_CHAR, and TRUE.

00644 {
00645     CHAR_DATA *victim;
00646     CHAR_DATA *v_next;
00647     char *spell;
00648     int sn;
00649 
00650     if (ch->position != POS_FIGHTING)
00651         return FALSE;
00652 
00653     for (victim = ch->in_room->people; victim != NULL; victim = v_next)
00654     {
00655         v_next = victim->next_in_room;
00656         if (victim->fighting == ch && number_bits (2) == 0)
00657             break;
00658     }
00659 
00660     if (victim == NULL)
00661         return FALSE;
00662 
00663     for (;;)
00664     {
00665         int min_level;
00666 
00667         switch (number_bits (4))
00668         {
00669             case 0:
00670                 min_level = 0;
00671                 spell = "blindness";
00672                 break;
00673             case 1:
00674                 min_level = 3;
00675                 spell = "cause serious";
00676                 break;
00677             case 2:
00678                 min_level = 7;
00679                 spell = "earthquake";
00680                 break;
00681             case 3:
00682                 min_level = 9;
00683                 spell = "cause critical";
00684                 break;
00685             case 4:
00686                 min_level = 10;
00687                 spell = "dispel evil";
00688                 break;
00689             case 5:
00690                 min_level = 12;
00691                 spell = "curse";
00692                 break;
00693             case 6:
00694                 min_level = 12;
00695                 spell = "change sex";
00696                 break;
00697             case 7:
00698                 min_level = 13;
00699                 spell = "flamestrike";
00700                 break;
00701             case 8:
00702             case 9:
00703             case 10:
00704                 min_level = 15;
00705                 spell = "harm";
00706                 break;
00707             case 11:
00708                 min_level = 15;
00709                 spell = "plague";
00710                 break;
00711             default:
00712                 min_level = 16;
00713                 spell = "dispel magic";
00714                 break;
00715         }
00716 
00717         if (ch->level >= min_level)
00718             break;
00719     }
00720 
00721     if ((sn = skill_lookup (spell)) < 0)
00722         return FALSE;
00723     (*skill_table[sn].spell_fun) (sn, ch->level, ch, victim, TARGET_CHAR);
00724     return TRUE;
00725 }

Here is the call graph for this function:

bool spec_cast_judge CHAR_DATA ch  ) 
 

Definition at line 727 of file special.c.

References FALSE, char_data::fighting, char_data::in_room, char_data::next_in_room, number_bits(), room_index_data::people, POS_FIGHTING, skill_lookup(), skill_table, skill_type::spell_fun, TARGET_CHAR, and TRUE.

00728 {
00729     CHAR_DATA *victim;
00730     CHAR_DATA *v_next;
00731     char *spell;
00732     int sn;
00733 
00734     if (ch->position != POS_FIGHTING)
00735         return FALSE;
00736 
00737     for (victim = ch->in_room->people; victim != NULL; victim = v_next)
00738     {
00739         v_next = victim->next_in_room;
00740         if (victim->fighting == ch && number_bits (2) == 0)
00741             break;
00742     }
00743 
00744     if (victim == NULL)
00745         return FALSE;
00746 
00747     spell = "high explosive";
00748     if ((sn = skill_lookup (spell)) < 0)
00749         return FALSE;
00750     (*skill_table[sn].spell_fun) (sn, ch->level, ch, victim, TARGET_CHAR);
00751     return TRUE;
00752 }

Here is the call graph for this function:

bool spec_cast_mage CHAR_DATA ch  ) 
 

Definition at line 756 of file special.c.

References FALSE, char_data::fighting, char_data::in_room, char_data::next_in_room, number_bits(), room_index_data::people, POS_FIGHTING, skill_lookup(), skill_table, skill_type::spell_fun, TARGET_CHAR, and TRUE.

Referenced by spec_mayor().

00757 {
00758     CHAR_DATA *victim;
00759     CHAR_DATA *v_next;
00760     char *spell;
00761     int sn;
00762 
00763     if (ch->position != POS_FIGHTING)
00764         return FALSE;
00765 
00766     for (victim = ch->in_room->people; victim != NULL; victim = v_next)
00767     {
00768         v_next = victim->next_in_room;
00769         if (victim->fighting == ch && number_bits (2) == 0)
00770             break;
00771     }
00772 
00773     if (victim == NULL)
00774         return FALSE;
00775 
00776     for (;;)
00777     {
00778         int min_level;
00779 
00780         switch (number_bits (4))
00781         {
00782             case 0:
00783                 min_level = 0;
00784                 spell = "blindness";
00785                 break;
00786             case 1:
00787                 min_level = 3;
00788                 spell = "chill touch";
00789                 break;
00790             case 2:
00791                 min_level = 7;
00792                 spell = "weaken";
00793                 break;
00794             case 3:
00795                 min_level = 8;
00796                 spell = "teleport";
00797                 break;
00798             case 4:
00799                 min_level = 11;
00800                 spell = "colour spray";
00801                 break;
00802             case 5:
00803                 min_level = 12;
00804                 spell = "change sex";
00805                 break;
00806             case 6:
00807                 min_level = 13;
00808                 spell = "energy drain";
00809                 break;
00810             case 7:
00811             case 8:
00812             case 9:
00813                 min_level = 15;
00814                 spell = "fireball";
00815                 break;
00816             case 10:
00817                 min_level = 20;
00818                 spell = "plague";
00819                 break;
00820             default:
00821                 min_level = 20;
00822                 spell = "acid blast";
00823                 break;
00824         }
00825 
00826         if (ch->level >= min_level)
00827             break;
00828     }
00829 
00830     if ((sn = skill_lookup (spell)) < 0)
00831         return FALSE;
00832     (*skill_table[sn].spell_fun) (sn, ch->level, ch, victim, TARGET_CHAR);
00833     return TRUE;
00834 }

Here is the call graph for this function:

bool spec_cast_undead CHAR_DATA ch  ) 
 

Definition at line 838 of file special.c.

References FALSE, char_data::fighting, char_data::in_room, char_data::next_in_room, number_bits(), room_index_data::people, POS_FIGHTING, skill_lookup(), skill_table, skill_type::spell_fun, TARGET_CHAR, and TRUE.

00839 {
00840     CHAR_DATA *victim;
00841     CHAR_DATA *v_next;
00842     char *spell;
00843     int sn;
00844 
00845     if (ch->position != POS_FIGHTING)
00846         return FALSE;
00847 
00848     for (victim = ch->in_room->people; victim != NULL; victim = v_next)
00849     {
00850         v_next = victim->next_in_room;
00851         if (victim->fighting == ch && number_bits (2) == 0)
00852             break;
00853     }
00854 
00855     if (victim == NULL)
00856         return FALSE;
00857 
00858     for (;;)
00859     {
00860         int min_level;
00861 
00862         switch (number_bits (4))
00863         {
00864             case 0:
00865                 min_level = 0;
00866                 spell = "curse";
00867                 break;
00868             case 1:
00869                 min_level = 3;
00870                 spell = "weaken";
00871                 break;
00872             case 2:
00873                 min_level = 6;
00874                 spell = "chill touch";
00875                 break;
00876             case 3:
00877                 min_level = 9;
00878                 spell = "blindness";
00879                 break;
00880             case 4:
00881                 min_level = 12;
00882                 spell = "poison";
00883                 break;
00884             case 5:
00885                 min_level = 15;
00886                 spell = "energy drain";
00887                 break;
00888             case 6:
00889                 min_level = 18;
00890                 spell = "harm";
00891                 break;
00892             case 7:
00893                 min_level = 21;
00894                 spell = "teleport";
00895                 break;
00896             case 8:
00897                 min_level = 20;
00898                 spell = "plague";
00899                 break;
00900             default:
00901                 min_level = 18;
00902                 spell = "harm";
00903                 break;
00904         }
00905 
00906         if (ch->level >= min_level)
00907             break;
00908     }
00909 
00910     if ((sn = skill_lookup (spell)) < 0)
00911         return FALSE;
00912     (*skill_table[sn].spell_fun) (sn, ch->level, ch, victim, TARGET_CHAR);
00913     return TRUE;
00914 }

Here is the call graph for this function:

bool spec_executioner CHAR_DATA ch  ) 
 

Definition at line 917 of file special.c.

References can_see(), COMM_NOSHOUT, do_function(), do_yell(), FALSE, char_data::in_room, IS_AWAKE, IS_NPC, IS_SET, MAX_STRING_LENGTH, multi_hit(), char_data::name, char_data::next_in_room, room_index_data::people, PLR_KILLER, PLR_THIEF, REMOVE_BIT, TRUE, and TYPE_UNDEFINED.

00918 {
00919     char buf[MAX_STRING_LENGTH];
00920     CHAR_DATA *victim;
00921     CHAR_DATA *v_next;
00922     char *crime;
00923 
00924     if (!IS_AWAKE (ch) || ch->fighting != NULL)
00925         return FALSE;
00926 
00927     crime = "";
00928     for (victim = ch->in_room->people; victim != NULL; victim = v_next)
00929     {
00930         v_next = victim->next_in_room;
00931 
00932         if (!IS_NPC (victim) && IS_SET (victim->act, PLR_KILLER)
00933             && can_see (ch, victim))
00934         {
00935             crime = "KILLER";
00936             break;
00937         }
00938 
00939         if (!IS_NPC (victim) && IS_SET (victim->act, PLR_THIEF)
00940             && can_see (ch, victim))
00941         {
00942             crime = "THIEF";
00943             break;
00944         }
00945     }
00946 
00947     if (victim == NULL)
00948         return FALSE;
00949 
00950     sprintf (buf, "%s is a %s!  PROTECT THE INNOCENT!  MORE BLOOOOD!!!",
00951              victim->name, crime);
00952     REMOVE_BIT (ch->comm, COMM_NOSHOUT);
00953     do_function (ch, &do_yell, buf);
00954     multi_hit (ch, victim, TYPE_UNDEFINED);
00955     return TRUE;
00956 }

Here is the call graph for this function:

bool spec_fido CHAR_DATA ch  ) 
 

Definition at line 960 of file special.c.

References act, obj_data::contains, room_index_data::contents, extract_obj(), FALSE, obj_data::in_room, IS_AWAKE, ITEM_CORPSE_NPC, obj_data::item_type, obj_data::next_content, obj_from_obj(), obj_to_room(), TO_ROOM, and TRUE.

00961 {
00962     OBJ_DATA *corpse;
00963     OBJ_DATA *c_next;
00964     OBJ_DATA *obj;
00965     OBJ_DATA *obj_next;
00966 
00967     if (!IS_AWAKE (ch))
00968         return FALSE;
00969 
00970     for (corpse = ch->in_room->contents; corpse != NULL; corpse = c_next)
00971     {
00972         c_next = corpse->next_content;
00973         if (corpse->item_type != ITEM_CORPSE_NPC)
00974             continue;
00975 
00976         act ("$n savagely devours a corpse.", ch, NULL, NULL, TO_ROOM);
00977         for (obj = corpse->contains; obj; obj = obj_next)
00978         {
00979             obj_next = obj->next_content;
00980             obj_from_obj (obj);
00981             obj_to_room (obj, ch->in_room);
00982         }
00983         extract_obj (corpse);
00984         return TRUE;
00985     }
00986 
00987     return FALSE;
00988 }

Here is the call graph for this function:

bool spec_guard CHAR_DATA ch  ) 
 

Definition at line 992 of file special.c.

References act, char_data::alignment, can_see(), COMM_NOSHOUT, do_function(), do_yell(), FALSE, char_data::in_room, IS_AWAKE, IS_NPC, IS_SET, MAX_STRING_LENGTH, multi_hit(), char_data::name, char_data::next_in_room, room_index_data::people, PLR_KILLER, PLR_THIEF, REMOVE_BIT, TO_ROOM, TRUE, and TYPE_UNDEFINED.

00993 {
00994     char buf[MAX_STRING_LENGTH];
00995     CHAR_DATA *victim;
00996     CHAR_DATA *v_next;
00997     CHAR_DATA *ech;
00998     char *crime;
00999     int max_evil;
01000 
01001     if (!IS_AWAKE (ch) || ch->fighting != NULL)
01002         return FALSE;
01003 
01004     max_evil = 300;
01005     ech = NULL;
01006     crime = "";
01007 
01008     for (victim = ch->in_room->people; victim != NULL; victim = v_next)
01009     {
01010         v_next = victim->next_in_room;
01011 
01012         if (!IS_NPC (victim) && IS_SET (victim->act, PLR_KILLER)
01013             && can_see (ch, victim))
01014         {
01015             crime = "KILLER";
01016             break;
01017         }
01018 
01019         if (!IS_NPC (victim) && IS_SET (victim->act, PLR_THIEF)
01020             && can_see (ch, victim))
01021         {
01022             crime = "THIEF";
01023             break;
01024         }
01025 
01026         if (victim->fighting != NULL
01027             && victim->fighting != ch && victim->alignment < max_evil)
01028         {
01029             max_evil = victim->alignment;
01030             ech = victim;
01031         }
01032     }
01033 
01034     if (victim != NULL)
01035     {
01036         sprintf (buf, "%s is a %s!  PROTECT THE INNOCENT!!  BANZAI!!",
01037                  victim->name, crime);
01038         REMOVE_BIT (ch->comm, COMM_NOSHOUT);
01039         do_function (ch, &do_yell, buf);
01040         multi_hit (ch, victim, TYPE_UNDEFINED);
01041         return TRUE;
01042     }
01043 
01044     if (ech != NULL)
01045     {
01046         act ("$n screams 'PROTECT THE INNOCENT!!  BANZAI!!",
01047              ch, NULL, NULL, TO_ROOM);
01048         multi_hit (ch, ech, TYPE_UNDEFINED);
01049         return TRUE;
01050     }
01051 
01052     return FALSE;
01053 }

Here is the call graph for this function:

bool spec_janitor CHAR_DATA ch  ) 
 

Definition at line 1057 of file special.c.

References act, can_loot(), room_index_data::contents, obj_data::cost, FALSE, obj_data::in_room, IS_AWAKE, IS_SET, ITEM_DRINK_CON, ITEM_TAKE, ITEM_TRASH, obj_data::item_type, obj_data::next_content, obj_from_room(), obj_to_char(), TO_ROOM, TRUE, and obj_data::wear_flags.

01058 {
01059     OBJ_DATA *trash;
01060     OBJ_DATA *trash_next;
01061 
01062     if (!IS_AWAKE (ch))
01063         return FALSE;
01064 
01065     for (trash = ch->in_room->contents; trash != NULL; trash = trash_next)
01066     {
01067         trash_next = trash->next_content;
01068         if (!IS_SET (trash->wear_flags, ITEM_TAKE) || !can_loot (ch, trash))
01069             continue;
01070         if (trash->item_type == ITEM_DRINK_CON
01071             || trash->item_type == ITEM_TRASH || trash->cost < 10)
01072         {
01073             act ("$n picks up some trash.", ch, NULL, NULL, TO_ROOM);
01074             obj_from_room (trash);
01075             obj_to_char (trash, ch);
01076             return TRUE;
01077         }
01078     }
01079 
01080     return FALSE;
01081 }

Here is the call graph for this function:

SPEC_FUN* spec_lookup const char *  name  ) 
 

Definition at line 101 of file special.c.

References spec_type::function, LOWER, spec_table, and str_prefix().

Referenced by do_string(), load_specials(), and MEDIT().

00102 {
00103     int i;
00104 
00105     for (i = 0; spec_table[i].name != NULL; i++)
00106     {
00107         if (LOWER (name[0]) == LOWER (spec_table[i].name[0])
00108             && !str_prefix (name, spec_table[i].name))
00109             return spec_table[i].function;
00110     }
00111 
00112     return 0;
00113 }

Here is the call graph for this function:

bool spec_mayor CHAR_DATA ch  ) 
 

Definition at line 1085 of file special.c.

References act, do_close(), do_function(), do_open(), FALSE, time_info_data::hour, move_char(), POS_SLEEPING, POS_STANDING, spec_cast_mage(), time_info, TO_ROOM, and TRUE.

01086 {
01087     static const char open_path[] =
01088         "W3a3003b33000c111d0d111Oe333333Oe22c222112212111a1S.";
01089 
01090     static const char close_path[] =
01091         "W3a3003b33000c111d0d111CE333333CE22c222112212111a1S.";
01092 
01093     static const char *path;
01094     static int pos;
01095     static bool move;
01096 
01097     if (!move)
01098     {
01099         if (time_info.hour == 6)
01100         {
01101             path = open_path;
01102             move = TRUE;
01103             pos = 0;
01104         }
01105 
01106         if (time_info.hour == 20)
01107         {
01108             path = close_path;
01109             move = TRUE;
01110             pos = 0;
01111         }
01112     }
01113 
01114     if (ch->fighting != NULL)
01115         return spec_cast_mage (ch);
01116     if (!move || ch->position < POS_SLEEPING)
01117         return FALSE;
01118 
01119     switch (path[pos])
01120     {
01121         case '0':
01122         case '1':
01123         case '2':
01124         case '3':
01125             move_char (ch, path[pos] - '0', FALSE);
01126             break;
01127 
01128         case 'W':
01129             ch->position = POS_STANDING;
01130             act ("$n awakens and groans loudly.", ch, NULL, NULL, TO_ROOM);
01131             break;
01132 
01133         case 'S':
01134             ch->position = POS_SLEEPING;
01135             act ("$n lies down and falls asleep.", ch, NULL, NULL, TO_ROOM);
01136             break;
01137 
01138         case 'a':
01139             act ("$n says 'Hello Honey!'", ch, NULL, NULL, TO_ROOM);
01140             break;
01141 
01142         case 'b':
01143             act
01144                 ("$n says 'What a view!  I must do something about that dump!'",
01145                  ch, NULL, NULL, TO_ROOM);
01146             break;
01147 
01148         case 'c':
01149             act
01150                 ("$n says 'Vandals!  Youngsters have no respect for anything!'",
01151                  ch, NULL, NULL, TO_ROOM);
01152             break;
01153 
01154         case 'd':
01155             act ("$n says 'Good day, citizens!'", ch, NULL, NULL, TO_ROOM);
01156             break;
01157 
01158         case 'e':
01159             act ("$n says 'I hereby declare the city of Midgaard open!'",
01160                  ch, NULL, NULL, TO_ROOM);
01161             break;
01162 
01163         case 'E':
01164             act ("$n says 'I hereby declare the city of Midgaard closed!'",
01165                  ch, NULL, NULL, TO_ROOM);
01166             break;
01167 
01168         case 'O':
01169 /*    do_function(ch, &do_unlock, "gate" ); */
01170             do_function (ch, &do_open, "gate");
01171             break;
01172 
01173         case 'C':
01174             do_function (ch, &do_close, "gate");
01175 /*    do_function(ch, &do_lock, "gate" ); */
01176             break;
01177 
01178         case '.':
01179             move = FALSE;
01180             break;
01181     }
01182 
01183     pos++;
01184     return FALSE;
01185 }

Here is the call graph for this function:

char* spec_name SPEC_FUN *  function  ) 
 

Definition at line 115 of file special.c.

References spec_type::name, and spec_table.

Referenced by do_mstat(), MEDIT(), and save_specials().

00116 {
00117     int i;
00118 
00119     for (i = 0; spec_table[i].function != NULL; i++)
00120     {
00121         if (function == spec_table[i].function)
00122             return spec_table[i].name;
00123     }
00124 
00125     return NULL;
00126 }

bool spec_nasty CHAR_DATA ch  ) 
 

Definition at line 409 of file special.c.

References act, do_backstab(), do_flee(), do_function(), do_murder(), FALSE, char_data::fighting, char_data::gold, char_data::in_room, IS_AWAKE, IS_NPC, char_data::next_in_room, number_bits(), room_index_data::people, POS_FIGHTING, TO_CHAR, TO_NOTVICT, TO_VICT, and TRUE.

00410 {
00411     CHAR_DATA *victim, *v_next;
00412     long gold;
00413 
00414     if (!IS_AWAKE (ch))
00415     {
00416         return FALSE;
00417     }
00418 
00419     if (ch->position != POS_FIGHTING)
00420     {
00421         for (victim = ch->in_room->people; victim != NULL; victim = v_next)
00422         {
00423             v_next = victim->next_in_room;
00424             if (!IS_NPC (victim)
00425                 && (victim->level > ch->level)
00426                 && (victim->level < ch->level + 10))
00427             {
00428                 do_function (ch, &do_backstab, victim->name);
00429                 if (ch->position != POS_FIGHTING)
00430                 {
00431                     do_function (ch, &do_murder, victim->name);
00432                 }
00433 
00434                 /* should steal some coins right away? :) */
00435                 return TRUE;
00436             }
00437         }
00438         return FALSE;            /*  No one to attack */
00439     }
00440 
00441     /* okay, we must be fighting.... steal some coins and flee */
00442     if ((victim = ch->fighting) == NULL)
00443         return FALSE;            /* let's be paranoid.... */
00444 
00445     switch (number_bits (2))
00446     {
00447         case 0:
00448             act ("$n rips apart your coin purse, spilling your gold!",
00449                  ch, NULL, victim, TO_VICT);
00450             act ("You slash apart $N's coin purse and gather his gold.",
00451                  ch, NULL, victim, TO_CHAR);
00452             act ("$N's coin purse is ripped apart!",
00453                  ch, NULL, victim, TO_NOTVICT);
00454             gold = victim->gold / 10;    /* steal 10% of his gold */
00455             victim->gold -= gold;
00456             ch->gold += gold;
00457             return TRUE;
00458 
0045