Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
Bug in get_exp_worth( )
Oct 10, 2017, 1:26 am
By GatewaySysop
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Users Online
CommonCrawl, Sogou, Yahoo!

Members: 0
Guests: 5
Stats
Files
Topics
Posts
Members
Newest Member
477
3,705
19,232
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » SWR FUSS » mobs attack once more than th...
Forum Rules | Mark all | Recent Posts

mobs attack once more than they should
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Dec 31, 2008, 4:16 am
Go to the top of the page
Go to the bottom of the page

Samsa
Fledgling
GroupMembers
Posts15
JoinedAug 29, 2008

When mob->numattacks is greater than 0, mobs attack once more. For example, if we set a mob to have one attack it will attack twice.

fight.c (495-504):

   if( IS_NPC( ch ) && ch->numattacks > 0 )
   {
      for( schance = 0; schance <= ch->numattacks; schance++ )
      {
         retcode = one_hit( ch, victim, dt );
         if( retcode != rNONE || who_fighting( ch ) != victim )
            return retcode;
      }
      return retcode;
   }

should be:

   if( IS_NPC( ch ) && ch->numattacks > 0 )
   {
      for( schance = 0; schance < ch->numattacks; schance++ )
      {
         retcode = one_hit( ch, victim, dt );
         if( retcode != rNONE || who_fighting( ch ) != victim )
            return retcode;
      }
      return retcode;
   }


This bug is already fixed in smaug.
       
Post is unread #2 Dec 31, 2008, 10:46 am   Last edited Dec 31, 2008, 10:47 am by ayuri
Go to the top of the page
Go to the bottom of the page

ayuri
Magician
GroupMembers
Posts239
JoinedJun 13, 2008

Looks like SWFoteFUSS could have the same bug. (Correct me if I'm wrong as I'm still learning)...

From SWFoteFUSS fight.c:
   if( IS_NPC( ch ) && ch->numattacks > 0 )
   {  
      for( schance = 0; schance <= ( ch->numattacks ); schance++ )
      {  
         retcode = one_hit( ch, victim, dt );
         if( retcode != rNONE || who_fighting( ch ) != victim )
            return retcode;
      }
      return retcode;
   }


Note: I've not tested it out in game to verify. Sorry.
Ayuri
       
Post is unread #3 Dec 31, 2008, 11:22 am
Go to the top of the page
Go to the bottom of the page

David Haley
Sorcerer
GroupMembers
Posts903
JoinedJan 29, 2007

Yes, looks like SWFoteFUSS has the same behavior. Whether or not it's a bug depends on the semantics of num_attacks: if you take it to mean that everybody has one attack, and num_attacks defines the number of additional attacks, <= is correct. If you take num_attacks to mean what the variable name looks like it should mean, I agree that < is correct.
       
Post is unread #4 Dec 31, 2008, 11:48 am
Go to the top of the page
Go to the bottom of the page

Keberus
Conjurer
GroupFUSS Project Team
Posts341
JoinedJun 4, 2005

ayuri said:

Looks like SWFoteFUSS could have the same bug. (Correct me if I'm wrong as I'm still learning)...

From SWFoteFUSS fight.c:
   if( IS_NPC( ch ) && ch->numattacks > 0 )
   {  
      for( schance = 0; schance <= ( ch->numattacks ); schance++ )
      {  
         retcode = one_hit( ch, victim, dt );
         if( retcode != rNONE || who_fighting( ch ) != victim )
            return retcode;
      }
      return retcode;
   }


Note: I've not tested it out in game to verify. Sorry.
Ayuri


Well, make_mobile in db.c sets num_attacks = 0, that means if you change the code above to use '<' instead of '<=' then a mob wouldn't attack at all, I think the best way to fix this, would to change the above to '<' and change the num_attacks in make_mobile to 1, so by default all mobs get thier num attacks set to 1, instead of zero.
       
Post is unread #5 Dec 31, 2008, 11:51 am
Go to the top of the page
Go to the bottom of the page

David Haley
Sorcerer
GroupMembers
Posts903
JoinedJan 29, 2007

Keb: that's why I suspected the semantics might be the non-intuitive version. It's interesting that it's defaulted to zero. I wonder if somebody was trying to fix the number of attacks, and made it <= instead of setting the default to 1 instead?
       
Post is unread #6 Jan 1, 2009, 9:01 am   Last edited Jan 1, 2009, 9:02 am by Samsa
Go to the top of the page
Go to the bottom of the page

Samsa
Fledgling
GroupMembers
Posts15
JoinedAug 29, 2008

Well, make_mobile in db.c sets num_attacks = 0, that means if you change the code above to use '<' instead of '<=' then a mob wouldn't attack at all


No, if you look at the if before the for, you'll see that for mobs with num_attacks = 0, this won't ever be executed.

if( IS_NPC( ch ) && ch->numattacks > 0 )


       
Post is unread #7 Jan 1, 2009, 11:02 am   Last edited Jan 1, 2009, 11:03 am by Keberus
Go to the top of the page
Go to the bottom of the page

Keberus
Conjurer
GroupFUSS Project Team
Posts341
JoinedJun 4, 2005

You're right, thats my fault. I should've looked a little more closely. But nonetheless I think the numattacks in make_mobile should still be changed to 1, and the <= should be changed to < because this will still fix the issue.
       
Post is unread #8 Jan 1, 2009, 11:37 am
Go to the top of the page
Go to the bottom of the page

Kayle
Off the Edge of the Map
GroupAdministrators
Posts1,195
JoinedMar 21, 2006

I find myself in agreement with Keb. make_mobile should set the default numattacks to 1and it should be < not <=.
       
Post is unread #9 Jan 1, 2009, 11:52 am
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

So long as there aren't any other hidden pitfalls with changing that default, I think this is a simple solution to the problem.
       
Post is unread #10 Jan 1, 2009, 6:28 pm   Last edited Jan 2, 2009, 3:38 pm by Keberus
Go to the top of the page
Go to the bottom of the page

Keberus
Conjurer
GroupFUSS Project Team
Posts341
JoinedJun 4, 2005

Okay, I just grepped through stock FoteFuss source code, and there is one other place that could be changed. in

build.c, fold_area

Locate:
      if( pMobIndex->perm_str != 13 || pMobIndex->perm_int != 13
          || pMobIndex->perm_wis != 13 || pMobIndex->perm_dex != 13
          || pMobIndex->perm_con != 13 || pMobIndex->perm_cha != 13
          || pMobIndex->perm_lck != 13
          || pMobIndex->hitroll != 0 || pMobIndex->damroll != 0
          || pMobIndex->race != 0
          || pMobIndex->attacks != 0 || pMobIndex->defenses != 0
          || pMobIndex->height != 0 || pMobIndex->weight != 0
          || pMobIndex->speaks != 0 || pMobIndex->speaking != 0
          || pMobIndex->xflags != 0 || pMobIndex->numattacks != 0 || pMobIndex->vip_flags != 0 )
         complexmob = TRUE;


And change the line that references numattacks to be != 1...so it would look like:
      if( pMobIndex->perm_str != 13 || pMobIndex->perm_int != 13
          || pMobIndex->perm_wis != 13 || pMobIndex->perm_dex != 13
          || pMobIndex->perm_con != 13 || pMobIndex->perm_cha != 13
          || pMobIndex->perm_lck != 13
          || pMobIndex->hitroll != 0 || pMobIndex->damroll != 0
          || pMobIndex->race != 0
          || pMobIndex->attacks != 0 || pMobIndex->defenses != 0
          || pMobIndex->height != 0 || pMobIndex->weight != 0
          || pMobIndex->speaks != 0 || pMobIndex->speaking != 0
          || pMobIndex->xflags != 0 || pMobIndex->numattacks != 1 || pMobIndex->vip_flags != 0 )
         complexmob = TRUE;


Otherwise by default it would think that all mobs were 'complex' just because their numattacks was 1 instead of 0. This seems to be the only other thing that needs changed, as least as far as stock fotefuss goes.

Edited: I changed attacks before, instead of numattacks which is what I meant to do
       
Post is unread #11 Jan 2, 2009, 6:28 am
Go to the top of the page
Go to the bottom of the page

David Haley
Sorcerer
GroupMembers
Posts903
JoinedJan 29, 2007

          || pMobIndex->attacks != 1 || pMobIndex->defenses != 0
          || pMobIndex->height != 0 || pMobIndex->weight != 0
          || pMobIndex->speaks != 0 || pMobIndex->speaking != 0
          || pMobIndex->xflags != 0 || pMobIndex->numattacks != 0

You changed "attacks" but not "numattacks", why?

It might be worth looking up every occurrence of both of these variables to see what exactly they do...
       
Post is unread #12 Jan 2, 2009, 3:39 pm
Go to the top of the page
Go to the bottom of the page

Keberus
Conjurer
GroupFUSS Project Team
Posts341
JoinedJun 4, 2005

Heh, I'm sorry I meant numattacks but for some reason, changed attacks in the post. I edited it the post to correct my mistake.
       
Pages:<< prev 1 next >>