ok.. got it all done for soulfeed except for this...

Posted by Alyce on Mon 05 Sep 2016 06:15 AM — 5 posts, 19,089 views.

#0
ok.. I got the soulfeed in.


void do_soulfeed( CHAR_DATA* ch, const char* )
{
   OBJ_DATA *obj;

  if( ( obj = get_eq_char( ch, WEAR_WIELD ) ) == NULL  )
   {
      send_to_char( "You must be holding the weapon you wish to feed.\r\n", ch );
      return;
   }
  if( ( obj = get_eq_char( ch, WEAR_WIELD ) ) != NULL && ( obj->value[4] >= 4 ))
   {
      send_to_char( "You have fed this weapon as much as you can.\r\n", ch );
      return;
   }
  if( ( obj = get_eq_char( ch, WEAR_WIELD ) ) != NULL && ( obj->value[4] <= 3 ))
   {

        if ( ch->pcdata->souls <= 1999)
        {
                send_to_char( "You do not have the souls\r\n", ch );
                return;
        }
        else
        obj->value[4] += 1;
        ch->pcdata->souls -= 2000;
      send_to_char( "The souls of the vanquished infuse into this weapon.\r\n", ch );
      return;
   }


}


it works. it increases the itemvalue 4 on the weapon as it should.

now.. I want to have that affect the total damage output... this is what I have...


//soul fed weapons bonus
 OBJ_DATA *obj;
   if( ( obj = get_eq_char( ch, WEAR_WIELD ) ) == NULL || ( obj->value[4] == 0))
        dam = dam;
   if( ( obj = get_eq_char( ch, WEAR_WIELD ) ) != NULL && ( obj->value[4] == 1))
        dam = (dam * 1.5);
   if( ( obj = get_eq_char( ch, WEAR_WIELD ) ) != NULL && ( obj->value[4] == 2))
        dam = (dam * 2);
   if( ( obj = get_eq_char( ch, WEAR_WIELD ) ) != NULL && ( obj->value[4] == 3))
        dam = (dam * 2.5);
   if( ( obj = get_eq_char( ch, WEAR_WIELD ) ) != NULL && ( obj->value[4] == 4))
        dam = (dam * 3);


I stuck this in fight.c by the damage modifiers but when I soulfeed the weapon, it is not returning any extra damage. Should I stick this into another location in fight.c or is there something wrong with this code?

It compiles fine, no warnings and there is no crashing when fighting... it soulfeeds just fine and the weapon value[4] increases by incriments as it should.

What say you, oh grand masters of the code?
#1
Actually.. I got it.. I just put it RIGHT after the backstab portion in fight.c

If anyone wants to use the above, be my guest :)
#2
If anyone is interested, I can make a full snippet for this. I have the victim-> level * characters luck for the amount of souls acquired. (that formula can be changed)

I also have it show up on the Identify spell.


Object 'a finely honed sword' is a weapon, with wear location:  take wield
Special properties:  magic
Its weight is 2, value is 0.
Damage is 200 to 200 (average 200).
The soul level of this weapon is: 4
Affects hit roll by 2.
Affects damage roll by 1.
Australia Forum Administrator #3

 OBJ_DATA *obj;


It would be faster and clearer to call get_eq_char once. eg.


 OBJ_DATA *obj = get_eq_char( ch, WEAR_WIELD )
#4
I updated the snippet per your recommendation