I've been trying to get battle damage (You hit X for 10 damage) and also skill damage (Your lightning bolt hits X for 10 damage) to work in Smaugfuss 1.7
Here's my code:
---------------------
if ( dt >=0 && dt < top_sn )
skill = skill_table[dt];
dt = TYPE_HIT;
attack = attack_table[0];
if (dt == TYPE_HIT && dam == 0)
{
sprintf(buf1, "$n's %s %s $N badly%c", attack, vp, punct );
sprintf(buf2, "Your %s %s $N badly%c", attack, vp, punct );
sprintf(buf3, "$n's %s %s you badly%c", attack, vp, punct );
}
else
if ( dt == TYPE_HIT ) //damage number & text
{
sprintf( buf1, "$n %s $N%c", vp, punct );
sprintf( buf2, "You %s $N for %i damage%c", vs, dam, punct );
sprintf( buf3, "$n %s you for %i damage%c", vp, dam, punct );
}
else if( dt > TYPE_HIT && is_wielding_poisoned( ch ) )
{
if( dt < TYPE_HIT + sizeof( attack_table ) / sizeof( attack_table[0] ) )
attack = attack_table[dt - TYPE_HIT];
else
{
bug( "Dam_message: bad dt %d from %s in %d.", dt, ch->name, ch->in_room->vnum );
dt = TYPE_HIT;
attack = attack_table[0];
}
snprintf( buf1, 256, "$n's poisoned %s %s $N%c", attack, vp, punct );
snprintf( buf2, 256, "Your poisoned %s %s $N%c", attack, vp, punct );
snprintf( buf3, 256, "$n's poisoned %s %s you%c", attack, vp, punct );
}
else
{
if( skill )
{
attack = skill->noun_damage;
if( dam == 0 )
{
bool found = FALSE;
if( skill->miss_char && skill->miss_char[0] != '\0' )
{
act( AT_HIT, skill->miss_char, ch, NULL, victim, TO_CHAR );
found = TRUE;
}
if( skill->miss_vict && skill->miss_vict[0] != '\0' )
{
act( AT_HITME, skill->miss_vict, ch, NULL, victim, TO_VICT );
found = TRUE;
}
if( skill->miss_room && skill->miss_room[0] != '\0' )
{
if( str_cmp( skill->miss_room, "supress" ) )
act( AT_ACTION, skill->miss_room, ch, NULL, victim, TO_NOTVICT );
found = TRUE;
}
if( found ) /* miss message already sent */
{
if( was_in_room )
{
char_from_room( ch );
char_to_room( ch, was_in_room );
}
return;
}
}
else
{
if( skill->hit_char && skill->hit_char[0] != '\0' )
act( AT_HIT, skill->hit_char, ch, NULL, victim, TO_CHAR );
if( skill->hit_vict && skill->hit_vict[0] != '\0' )
act( AT_HITME, skill->hit_vict, ch, NULL, victim, TO_VICT );
if( skill->hit_room && skill->hit_room[0] != '\0' )
act( AT_ACTION, skill->hit_room, ch, NULL, victim, TO_NOTVICT );
}
}
else if( dt >= TYPE_HIT && dt < TYPE_HIT + sizeof( attack_table ) / sizeof( attack_table[0] ) )
{
if( obj )
attack = obj->short_descr;
else
attack = attack_table[dt - TYPE_HIT];
}
else
{
bug( "Dam_message: bad dt %d from %s in %d.", dt, ch->name, ch->in_room->vnum );
dt = TYPE_HIT;
attack = attack_table[0];
}
sprintf( buf1, "$n's %s %s $N%c", attack, vp, punct );
sprintf( buf2, "Your %s %s $N for %i damage%c", attack, vp, dam, punct );
sprintf( buf3, "$n %s you for %i damage%c", vp, dam, punct );
}
-------------------
Note: I intentionally didn't want observers in the room seeing the damage amount. What I get from this code is:
You hit X for # damage.
X hits you for # damage.
But, when using spells I get the exact same thing.
So my question is, How can get it to show this:
Your lightning bolt smites X for # damage.
X's lightning bolt smites you for # damage.
I appreciate any help you can offer me! |