15 Jul, 2010, triskaledia wrote in the 1st comment:
I'm trying to get an understanding of how saves work little better.
When I first started MUDding, people said saves help decide how much
damage would be taken by the victim, and if the victim would even be hit.
—–Going to be using the Inlay System by Samantha, and was wanting to
add a few more gems. One of them I'm planning on modifying saves—–
/*
* Compute a saving throw.
* Negative apply's make saving throw better.
*/
bool saves_spell (int level, CHAR_DATA * victim, int dam_type)
{
int save;

save = 50 + (victim->level - level) * 5 - victim->saving_throw * 2;
if (IS_AFFECTED (victim, AFF_BERSERK))
save += victim->level / 2;

switch (check_immune (victim, dam_type))
{
case IS_IMMUNE:
return TRUE;
case IS_RESISTANT:
save += 2;
break;
case IS_VULNERABLE:
save -= 2;
break;
}
if (!IS_NPC (victim) && class_table[victim->class].fMana)
save = 9 * save / 10;
save = URANGE (5, save, 95);
return number_percent () < save;
}

That is the stock saves_spell code.
The "int level" is the characters level? I'm looking at saves = 50 + (level 50 mob - level 40 character) * 5 - (-15 victim->spell_throwing) * 2; So… 70 saves, +5, then check resistant/vuln… lets say it's just not immune/res/vuln to anything, for my sanity. Let's also assume the class isn't whatever fMana is - I'm assuming that's the if the class is a caster or not. Then we save = urange(5, 75(because of the math earlier), 95). Then return number_percent () < save;
What is the urange thing? I've looked at it before, and I usually end up changing it to random_number(what-I-Like, to-what-I-Like).
Alright, in spells you get some spells with saves_spell or !saves_spell.
So following all this, if number_percent () < save we do the !saves_spell stuff, and if number_percent () > save we do the saves_spell stuff? Also, I am assuming number_percent() is a random number between 1 and 100?
15 Jul, 2010, ralgith wrote in the 2nd comment:
It really depends on how each MUD has their saving throws calculated.

On my own MUD I've set it up so if the player makes the save, they take half damage… but if they make a critical save they only take 1/4 damage. A critical save meaning they nailed the best 10% of the needed saving thrown.
15 Jul, 2010, Tonitrus wrote in the 3rd comment:
triskaledia said:
What is the urange thing?

urange(minimum, x, maximum). Basically:
`if x < minimum:    x = minimumif x > maximum:    x = maximum`

So urange(5, 75, 95) gives you 75. urange(5, -3, 95) gives you 5. urange(5, 10000000000, 95) gives you 95, etc.
That's how it works on SMAUG, anyway, not sure about Rom, but it looks like the same idea.

[edited to make me sound less retarded (it's a work in progress)]
15 Jul, 2010, ralgith wrote in the 4th comment:
Yeah, CircleMUD has a similar macro called LIMIT, though I tend to forget to use it and I manually write out convoluted MIN(upper_limit, MAX(lower_limit, value)) instead ;) yay forgetfulness ;)

Actually I think LIMIT was introduced with OasisOLC as a faster replacement for the MIN/MAX macros. And I prefer the LIMIT syntax to your URANGE syntax too.
LIMIT(value, lower_limit, upper_limit)
I personally find putting the value between the upper and lower to be silly and convoluted… and definitely non-standard. But hey, that's just me ;) And I suppose I could always alias LIMIT to URANGE in such code bases as yours. :)

#define LIMIT(val, low, high) URANGE((low), (val), (high))

But I think maybe I'm too tired, starting to rattle on about my own likes and dislikes and getting way off topic.

Back to the topic at hand, do you better understand it now? If not what else can we help describe better for you?
15 Jul, 2010, ATT_Turan wrote in the 5th comment:
Well, not that you're wrong for having preferences, but the point in putting the value in between the upper and lower is to mirror what the macro does - returns the input value if it's in between the other two.
15 Jul, 2010, Tyche wrote in the 6th comment:
triskaledia said:
What is the urange thing? I've looked at it before, and I usually end up changing it to random_number(what-I-Like, to-what-I-Like).

You might want to go find the places you've changed it and change it back. ;-)

In this particular case, it guarantees that there's always a least a 5% chance of failure or success with a saving throw.
Very D&D-ish
15 Jul, 2010, quixadhal wrote in the 7th comment:
As always, I suggest you find a cheap used copy of the AD&D 2nd edition rulebooks and read them. That is the original model most MUD's borrow from, and knowing how the combat system works in the paper RPG makes understanding the code much easier.
15 Jul, 2010, ralgith wrote in the 8th comment:
And if you choose to modify the system or redo parts of it from scratch you really do need to understand it.

Also you need to have a clear and concise goal outlined BEFORE you begin your modifications. Know what results you want, and then test for them once you have your new algorithm in place.
15 Jul, 2010, Davion wrote in the 9th comment:
Oh Saves. Ralgith, sit down, let me tell you a story about saves.

Long ago there were these magical bracers known as Laerkai Power. These bracers were powerhouses! I'm talkin hit/dam out the wazzoo, and a wee bit of HP. They also ADDED 25 to saves. Everyone wore two of these bracers just for the stats.

Along came a great Necromancer known as Ictaros. He was searching the world for an explanation on what Saves exactly did. He stumbled upon a set of bracers, well, rather Iron Shackles which SUBTRACTED 6 saves. Most of the other EQ was saves-neutral, so after awhile and some persuading some immortals, Ictaros found out that with his Iron Shackles on his saves were -12, and everyone else was anywhere from 40-60.

Soon after, people were gunnin for Ictaros' head (it was worth a cool million ;)) and he was wondering what kind of advantage he'd have over people. So, first person stepped up, all spelled up and twitching from quaffing too many potions and cotton-mouthed from the pills. Ictaros instantly dispelled ALL the affects. Next move, heat metal. 90% of the EQ of this hero fell to the ground. Sleep and charm followed.

From them on, Ictaros was one of the most legendary PKers on ADP. This is all because of these things called Saves.
15 Jul, 2010, ralgith wrote in the 10th comment:
lol @Davion. Great story ;)
16 Jul, 2010, Ssolvarain wrote in the 11th comment:
As always, I suggest you find a cheap used copy of the AD&D 2nd edition rulebooks and read them. That is the original model most MUD's borrow from, and knowing how the combat system works in the paper RPG makes understanding the code much easier.

Meh, can we get an excerpt?
16 Jul, 2010, ralgith wrote in the 12th comment:
Ssolvarain said:
As always, I suggest you find a cheap used copy of the AD&D 2nd edition rulebooks and read them. That is the original model most MUD's borrow from, and knowing how the combat system works in the paper RPG makes understanding the code much easier.

Meh, can we get an excerpt?

An excerpt would only work for the saves… but the whole of most MUDs is based on these rules. Thats why I have the books as PDF files.

And an excerpt would be much too large too, its a good several pages, some of which from other sections of the book.
Random Picks

0.0/12