Need to understand orcish bonuses for weapon spreadsheet


Questions, Explanations, Howtos

User avatar

Vestibule Violator

Posts: 1533

Joined: Thursday, 16th December 2010, 20:52

Post Friday, 28th January 2011, 17:37

Need to understand orcish bonuses for weapon spreadsheet

I'm trying to figure out how to average the orcish equipment bonus for my weapon spreadsheet (see work in progress attached, it's come a long way!)

From fight.cc:1571:
  Code:
 if (get_equip_race(*weapon) == ISFLAG_ORCISH
            && you.species == SP_HILL_ORC)
        {
            if (you.religion == GOD_BEOGH && !player_under_penance())
            {
#ifdef DEBUG_DIAGNOSTICS
                const int orig_damage = damage;
#endif
                if (you.piety > 80 || coinflip())
                    damage++;

                damage +=
                    random2avg(
                        div_rand_round(
                            std::min(static_cast<int>(you.piety), 180), 33), 2);
#ifdef DEBUG_DIAGNOSTICS
                mprf(MSGCH_DIAGNOSTICS, "Damage: %d -> %d, Beogh bonus: %d",
                     orig_damage, damage, damage - orig_damage);
#endif
            }

            if (coinflip())
                damage++;
        }


I assume coinflip is a 50% probability.

Working up from the bottom:
- You have a 50% chance of adding 1 to base damage for any orcish character with orcish weapons.
- If you worship Beogh and are not under penance:
- if piety is over 80, you get another 50% chance of another +1 base damage
- you have a chance of _up to_ another 2 to base damage that depends somehow on your piety and the factors of 180 and 33.

It's that last part I don't know how to interpret. Can anyone help?
User avatar

Vestibule Violator

Posts: 1533

Joined: Thursday, 16th December 2010, 20:52

Post Friday, 28th January 2011, 20:29

Re: Need to understand orcish bonuses for weapon spreadsheet

Okay, attached is a significantly improved spreadsheet:

- Data validation and select boxes - weapon stats are automatically inserted when weapon is chosen.
- A separate sheet for characte info that is applied to all weapons - saves having to update your stats in multiple columns etc.
- (Very crudely) figures monster AC and your % chance to hit into an avg. damage per turn calculation
- adjusts for character size, weapon hands needed, shield delays, haste, might, berserk, racial bonuses, and more...

I have hidden all the lines of the calculations that I am fairly sure of, but there are some lines that I am not quite sure of yet. These are not hidden, and are coloured pink. If anyone could help me figure out those lines it would be great.
Attachments
DCSS Weapon calculator 0.3.zip
(25.25 KiB) Downloaded 16 times
User avatar

Dungeon Master

Posts: 4031

Joined: Thursday, 16th December 2010, 20:37

Location: France

Post Friday, 28th January 2011, 20:30

Re: Need to understand orcish bonuses for weapon spreadsheet

div_rand_round divides a number by another, and randomly round the result up or down depending on remainder. So div_rand_round(10, 3) returns 3 or 4, but on average it returns 10/3.
random2avg(a, b) does the same as random2(a), but makes b rolls and average the result.
So the formula here takes the piety, caps it at 180 and then divides it by 33. This gives us a number between 0 and 6. Then we roll twice for this number and average the result. At max piety, it must average to 2 I guess.
<+Grunt> You dereference an invalid pointer! Ouch! That really hurt! The game dies...
User avatar

Vestibule Violator

Posts: 1533

Joined: Thursday, 16th December 2010, 20:52

Post Monday, 31st January 2011, 23:01

Re: Need to understand orcish bonuses for weapon spreadsheet

Thanks.

I'm going to post an updated version in my main thread for this tool.

Now the main thing left is some figuring for Monster AC, and for chance to hit. I've added the base to hit values for str-weight adjusted dexterity, fighting skill and weapon skill, but do not yet have the armour and shield penalties figured out - I think these start at player.cc:2042.

Return to Coding

Who is online

Users browsing this forum: No registered users and 5 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.