hate.code
hate.code · 2.4 KB
From the archive linkdead.tar.gz
Download the archive « Back to the archive contents
/* ====================== hate.c prototypes =============================== */
bool hates_you(int p, int i);
#define no_hate(P) ((hates_who(P) == -1) ? true : false)
int hates_who(int p);
void clear_all_hate(void);
void clear_hate(int i);
void hatecom(void);
void send_hate_msg(int m, int p);
void set_hate(int p, int i);
void set_hate_str(int p, char *str);
void should_hate(int m, int p, int d);
**-------------------------------------
** resurcom() resurect command
/* stop the mobile from hating people */
clear_hate(a);
>>
>> strcpy(pname(a), pinit[c].p_name);
>> setploc(a, ploc(mynum));
**-------------------------------
** resetmobiles()
>> setpspeed(a, m->p_speed);
>> setpdam(a, m->p_dam);
>> setparmor(a, m->p_armor);
>> setpwimpy(a, m->p_wimpy);
>> setpscore(a, -1);
clear_hate(a);
** ------------------------------------------------
** parse.c, add the call to the verb.
case VERB_HATES:
hatecom();
break;
** ------------------------------------------------
** mobile.c
** There is no way to simply past this code into yours
** however the 3 points at which hate is used can be added to the chkfight()
** function you use.
for (mon = plist(ploc(plx)); mon != NOL; mon = pnext(mon)) {
if ((mon<max_players) || /* Mob is a player */
((pagg(mon) == 0) && (no_hate(mon))) || /* No reason to start */
EMPTY(pname(mon)) || (pstr(mon) < 0) || /* or mob is dead. */
ststflg(mon, SFL_OCCUPIED) || /* or mob is aliased */
testpeace(mon) || /* or it is peaceful */
(pfighting(mon) >= 0)) /* or Already fighting */
continue;
/* See if the mob wants to hit the player. */
if (mtstflg(mon,MFL_DEAD) || mtstflg(mon,MFL_MAGICDEAD))
continue;
/* If not aggressive, continue only if hate plx */
if ((pagg(mon) <= 0) && (!hates_you(mon, plx)))
continue;
if (hates_you(mon, plx)) {
send_hate_msg(mon, plx);
hit_player(mon,plx,pwpn(mon)); /* Start the fight */
break;
}
** ------------------------------------------------
** fight.c, in hit_player() and anywhere else you want to have
** a chance that a mobile should start to hate a player.
>> /* call wound_player */
>> wound_player(attacker, victim, d, -1);
>>
/* Decide if we should hate attacker for this. mob only */
should_hate(victim, attacker, d);
}