Re: Boat w/ extra values

From: Ryan Dean (rydean@psd.k12.co.us)
Date: 02/15/99


Ok, I took a look at has_boat and found this will find a boat in an
inventory:
  for (obj = ch->carrying; obj; obj = obj->next_content)
    if (GET_OBJ_TYPE(obj) == ITEM_BOAT && (find_eq_pos(ch, obj, NULL) <
0)) { }
yet it still crashes ANY idea what is the problem?



On Mon, 15 Feb 1999, Cj Stremick wrote:

> Boats aren't worn.  Passing an "ITEM_" constant to the GET_EQ macro is BAD
> news.  You should probably look into the "has_boat" function.  That might
> help you understand how boats work.
>
> -C
>
>
> ----- Original Message -----
> From: Ryan Dean <rydean@psd.k12.co.us>
> To: <CIRCLE@post.queensu.ca>
> Sent: Monday, February 15, 1999 10:48 AM
> Subject:  Boat w/ extra values
>
>
> >Hello again I am trying to make it so that if you have a boat it helps
> >your hp, damroll, hitroll, etc but ONLY in SEC_WATER_NOSWIM...so in the
> >hit function i tried adding some variables - here is my function tell me
> >what you think
> >Some info:
> >I have circle 30.14 etc
> >The mud runs fine until i fight in SECT_WATER_NOSWIM hehe funny.
> >
> >The code:
> >void hit(struct char_data * ch, struct char_data * victim, int type)
> >{
> >  struct obj_data *wielded = GET_EQ(ch, WEAR_WIELD);
> >  struct obj_data *obj= GET_EQ(ch,ITEM_BOAT); <-
> >
> >  int w_type, victim_ac, calc_thaco, dam, diceroll;
> >
> >
> >
> >
> >  /* Do some sanity checking, in case someone flees, etc. */
> >  if (ch->in_room != victim->in_room) {
> >    if (FIGHTING(ch) && FIGHTING(ch) == victim)
> >      stop_fighting(ch);
> >    return;
> >  }
> >
> >  /* Find the weapon type (for display purposes only) */
> >  if (has_boat(ch) && (SECT(ch->in_room) == SECT_WATER_NOSWIM))
> >    w_type = GET_OBJ_VAL(obj, 0) + TYPE_HIT;
> >  else if (wielded && GET_OBJ_TYPE(wielded) == ITEM_WEAPON)
> >    w_type = GET_OBJ_VAL(wielded, 3) + TYPE_HIT;
> >  else {
> >    if (IS_NPC(ch) && (ch->mob_specials.attack_type != 0))
> >     w_type = ch->mob_specials.attack_type + TYPE_HIT;
> >    else
> >      w_type = TYPE_HIT;
> >  }
> >
> >  /* Calculate the THAC0 of the attacker */
> >  if (!IS_NPC(ch))
> >    calc_thaco = thaco((int) GET_CLASS(ch), (int) GET_LEVEL(ch));
> >  else          /* THAC0 for monsters is set in the HitRoll */
> >    calc_thaco = 20;
> >
> >  calc_thaco -= str_app[STRENGTH_APPLY_INDEX(ch)].tohit;
> >  calc_thaco -= GET_HITROLL(ch);
> >  calc_thaco -= (int) ((GET_INT(ch) - 13) / 1.5);       /* Intelligence
> >helps! */
> >  calc_thaco -= (int) ((GET_WIS(ch) - 13) / 1.5);       /* So does wisdom
> >*/
> >
> >  /* Calculate the raw armor including magic armor.  Lower AC is better.
> >*/
> >  victim_ac = GET_AC(victim) / 10;
> >  if (has_boat(victim) && (SECT(victim->in_room) == SECT_WATER_NOSWIM))
> >  victim_ac -= GET_OBJ_VAL(obj,3) / 10; <- (I know i should make this
> >another value like objv with victim instead of character but hey)
> >
> >  if (AWAKE(victim))
> >    victim_ac += dex_app[GET_DEX(victim)].defensive;
> >  victim_ac = MAX(-10, victim_ac);      /* -10 is lowest */
> >  /* roll the die and take your chances... */
> >  diceroll = number(1, 20);
> >
> >  /* decide whether this is a hit or a miss */
> >  if ((((diceroll < 20) && AWAKE(victim)) &&
> >       ((diceroll == 1) || ((calc_thaco - diceroll) > victim_ac)))) {
> >    /* the attacker missed the victim */
> >    if (type == SKILL_BACKSTAB)
> >      damage(ch, victim, 0, SKILL_BACKSTAB);
> >    else
> >      damage(ch, victim, 0, w_type);
> >  } else {
> >    /* okay, we know the guy has been hit.  now calculate damage. */
> >    /* Start with the damage bonuses: the damroll and strength apply */
> >    dam = str_app[STRENGTH_APPLY_INDEX(ch)].todam;
> >    dam += GET_DAMROLL(ch);
> >    if (has_boat(ch) && (SECT(ch->in_room) == SECT_WATER_NOSWIM)) {
> >      dam += dice(GET_OBJ_VAL(obj,1),GET_OBJ_VAL(obj,2));<-
> >
> >    } else {
> >blah blah blah
> >
> >.... thats all the code i edited
> >Sorry bout that huge snippet but please could ya help me out i think my
> >problem is where the <-'s are
> >
> >
> >     +------------------------------------------------------------+
> >     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
> >     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
> >     +------------------------------------------------------------+
> >
>
>
>      +------------------------------------------------------------+
>      | Ensure that you have read the CircleMUD Mailing List FAQ:  |
>      |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
>      +------------------------------------------------------------+
>


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST