User Name:


Forgot your password?
Vote for Us!
parse description bug
Dec 15, 2017, 10:08 pm
By Remcon
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
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
Author: Johan Lindh
Submitted by: Vladaar
Users Online
CommonCrawl, DotBot, Yahoo!, Majestic-12, Google

Members: 0
Guests: 13
Newest Member
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Bugfix Lists » SWR FUSS Bugfix List » [Bug] Spell dice forumlas ret...
Forum Rules | Mark all | Recent Posts

[Bug] Spell dice forumlas return incorrect results when parsed
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Sep 12, 2005, 6:19 pm
Go to the top of the page
Go to the bottom of the page

Black Hand
JoinedJan 1, 2002

Bug: Spell dice forumlas return incorrect results when parsed. Damage caps do not work.
Danger: Medium - Returns values outside expected ranges, making some spells far too powerful.
Found by: Too many people to count
Fixed by: Remcon


magic.c, rd_parse

    * get rid of brackets if they surround the entire expresion
   if( ( *texp == '(' ) && !index( texp + 1, '(' ) && texp[strlen( texp ) - 1] == ')' )
      texp[strlen( texp ) - 1] = '\0';

Change to:
    * get rid of brackets if they surround the entire expresion
   if( ( *texp == '(' ) && texp[strlen( texp ) - 1] == ')' )
      texp[strlen( texp ) - 1] = '\0';

At the root of a number of problems in spell/skill dice formulas is the rd_parse function. What it does is take a spell formula, parse the variables, and return a value within the range specified by that formula. Something similar to this:

ld6+(l/2) { 500

A seemingly simple formula, it takes the caster's level, rolls it as that many 6 sided dice. The value of that is then added to half of the caster's level. The left brace indicates this formula wants a cap, and the cap is set to 500, so the most this spell should do in damage is 500 points. The bug in rd_parse would outright ignore any caps, minimums or maximums, so this spell in reality could have become quite devastating and thus provide a huge advantage to the classes that could cast it. Once fixed, the formula does need to be rewritten in proper syntax to acheive the desired result, and should now look like:

(ld6+(l/2)) { 500

Notice that the expression on the left side of the brace is entirely surrounded in parentheses. If this is not done then the cap would only apply to the expression closest to it on the right of an operator, such as +, -, * or /

This bug has been long-standing, very persistant, and dozens of coders have attempted in some way or another to fix it. Often with comically large 100-200+ line rewrites of various portions and whole new wrapper functions around those. Our own coding staff on Alsherok spent months trying to fix this, and it became so frustrating we began jokingly referring to it as "The function whose name shall not be spoken". It was basically treated as evil incarnate. A cancer upon the code. It has quite a history behind it. How ironic that the fix for it would literally be a single line, and only a portion of that single line.
Pages:<< prev 1 next >>