int get_speed (CHAR_DATA * ch)
{
int count = 21;
char buf[MAX_STRING_LENGTH];
if (ch->class == 0) count–; // sorcerer
if (ch->class == 1) count -= 3; // bishop
if (ch->class == 2) count -= 9; // ninja
if (ch->class == 3) count -= 11; // hoplite
if (ch->class == 4) count -= 9; // templar
if (ch->class == 5) count -= 8; // avenger
if (ch->class == 6) count–; // lich
if (ch->class == 7) count -= 3; // shaman
if (ch->class == 8) count -= 3; // druid
if (ch->class == 9) count -= 9; // assassin
// if (IS_NPC(ch)) count–;
sprintf (buf, "Violence Pulse: %d.\n\r", count);
send_to_char (buf, ch);
return count;
}
void violence_update (void)
{
CHAR_DATA *ch;
CHAR_DATA *ch_next;
CHAR_DATA *victim;
for (ch = first_fight; ch != NULL; ch = ch_next)
{
ch_next = ch->next_fight;
if ( ch->action[0] == ACTION_CASTING )
update_casting(ch);
if ((victim = ch->fighting) == NULL || ch->in_room == NULL)
{
stop_fighting(ch, FALSE);
continue;
}
if ( IS_AWAKE(ch) && IS_AWAKE(victim) &&
ch->in_room == victim->in_room )
{
if ( –ch->init <= 0 )
{
multi_hit( ch, victim, TYPE_UNDEFINED );
ch->init = get_speed(ch);
}
else continue;
}
else
stop_fighting( ch, FALSE );
if ((victim = ch->fighting) == NULL)
{
stop_fighting(ch, FALSE);
continue;
}
/*
* Fun for the whole family!
*/
check_assist (ch, victim);
if (IS_NPC (ch))
{
if (HAS_TRIGGER (ch, TRIG_FIGHT))
mp_percent_trigger (ch, victim, NULL, NULL, TRIG_FIGHT);
if (HAS_TRIGGER (ch, TRIG_HPCNT))
mp_hprct_trigger (ch, victim);
}
}
return;
}
void update_casting(void)
{
CHAR_DATA *ch, *ch_next;
// AWESOME SPELL SYSTEM!
for ( ch = first_fight; ch != NULL; ch = ch_next )
{
ch_next = ch->next_fight;
// Booya baby!
if (ch->spell_timer > 0)
{
ch->spell_timer–;
if(number_range(0, 7) == 3)
act_cast(ch);
}
// This is what happens to people that cast
if (ch->spell_timer == 1)
{
char buf[MSL];
// Always display the cast message!
act_final(ch);
// Ensure we are do not exceed our max (memory-leak protection)
snprintf(buf, MSL, "%s %s", ch->casting, ch->casting2);
// Initiate the command
do_function(ch, &do_cast, buf);
// Free the characters casting data
free_cast(ch);
// Ensure buf is nul, as to prevent memory leaks (heed my advice!)
buf[0] = '\0';
}
}
return;
}
Godwars Delux get_speed function fight.c
Godwars Deluxe Violence update function in fight.c
my get_speed function in update.c