Jump to content

Formulas for damage and such


Kythras

Recommended Posts

I'm curious, did anyone figure out how skills and other factors influence the damage of spells and melee damage? With the code being open source it's probably not very hard to figure out smile

 

I would love to know how skills affect damage in a more accurate way than personal experience. Also useful would be to know how the ability strength of an item (as set in the scenario editor) affects the damage output of a spell.

 

Anyone know anything?

Link to comment
Share on other sites

Quote:
Combat.cpp is the major file for Windows here


Right when it comes to hit something, but for damages it is done in SPECIALS.cpp (apparently needs some functions in there).

Quote:
Magically Apt I will have to research soon

It is checked in the function pc_record_type::statAdj() in PC.cpp which return the skill adjustement to be used in the formulas.

Click to reveal.. (explanation)
short pc_record_type::statAdj(short which)
{
short tr;

tr = skill_bonus[skills[which]]; //gets stat adjutment in the skill_bonus table (GLOBVAR.cpp) which correspond to the level in the which skill

if (which == 2) { //if checked stat is intelligence
if (traits[1] == TRUE) tr++; // if possess the Magically Apt. trait add one to tr
if (hasAbilEquip(99) < 16) tr++; //add one to tr if has one item equipped with ability 99 => this ability is inexistant ... Bug probably ...
}

if (which == 0) // if checked stat is strengh
if (traits[8] == TRUE) tr++; //if posses the Exceptional Strength, add one to tr

return tr;
}


The whole process of hitting/damaging monster is almost decoded, but i will have to finish mapping item abilities to be completely accurate.

I didn't looked into wands neither, but i think it also used the pc_cast() function.

Hope it helps,
Chokboyz
Link to comment
Share on other sites

You are right, i didn't find a 99 ability either. Seems like another bug in the code (i confirm your finding that demons does undead damages and vice versa).

Oddly, i can't find the same function (stat_adj()) in ormus' build (the declaration is here but can't find the function).

 

I finally complete the CONSTS.h file and put it here for anyone to use. Maybe you can confirm the values since you seems to have done the same wink

 

Click to reveal.. (CONSTS.h)
#ifndef _CONSTS_H

#define _CONSTS_H

 

/*

This file contain numerous constans in form of #defines.

Almost all of this constants cannot be changed because

that would make the game work improperly.

*/

 

#define NUM_OF_PCS 6

#define INVALID_PC NUM_OF_PCS

 

#define INVALID_TOWN 200

 

#define NUM_OF_BOATS 30

#define NUM_OF_HORSES 30

 

#define SFX_SMALL_BLOOD 1

#define SFX_MEDIUM_BLOOD 2

#define SFX_LARGE_BLOOD 4

#define SFX_SMALL_SLIME 8

#define SFX_BIG_SLIME 16

#define SFX_ASH 32

#define SFX_BONES 64

#define SFX_RUBBLE 128

 

/* stuff done flags */

#define SDF_IS_PARTY_SPLIT 304][0

#define SDF_PARTY_SPLIT_X 304][1

#define SDF_PARTY_SPLIT_Y 304][2

#define SDF_NO_INSTANT_HELP 306][4 // boolean

 

/* overall mode */

#define MODE_OUTDOORS 0

#define MODE_TOWN 1

#define MODE_TALK_TOWN 2 // looking for someone to talk

#define MODE_COMBAT 10

#define MODE_FIRING 12 // firing from bow or crossbow

#define MODE_THROWING 13 // throwing missle

#define MODE_DROPPING 15

#define MODE_TALKING 20

#define MODE_SHOPPING 21

#define MODE_LOOK_OUTDOORS 35 // looking at something

#define MODE_LOOK_TOWN 36

#define MODE_LOOK_COMBAT 37

 

/* adven.main_status */ //complete

#define MAIN_STATUS_ABSENT 0 // absent, empty slot

#define MAIN_STATUS_ALIVE 1

#define MAIN_STATUS_DEAD 2

#define MAIN_STATUS_DUST 3

#define MAIN_STATUS_STONE 4

#define MAIN_STATUS_FLED 5

#define MAIN_STATUS_SURFACE 6 // fled to surface?

#define MAIN_STATUS_WON 7

/* main status modifiers */

#define MAIN_STATUS_SPLIT 10 // split from party

 

 

/* adven.skills */ //complete

#define SKILL_STRENGTH 0

#define SKILL_DEXTERITY 1

#define SKILL_INTELLIGENCE 2

#define SKILL_EDGED_WEAPONS 3

#define SKILL_BASHING_WEAPONS 4

#define SKILL_POLE_WEAPONS 5

#define SKILL_THROWN_MISSILES 6

#define SKILL_ARCHERY 7

#define SKILL_DEFENSE 8

#define SKILL_MAGE_SPELLS 9

#define SKILL_PRIEST_SPELLS 10

#define SKILL_MAGE_LORE 11

#define SKILL_ALCHEMY 12

#define SKILL_ITEM_LORE 13

#define SKILL_DISARM_TRAPS 14

#define SKILL_LOCKPICKING 15

#define SKILL_ASSASSINATION 16

#define SKILL_POISON 17

#define SKILL_LUCK 18

 

 

/* adven.traits */ //complete

#define TRAIT_TOUGHNESS 0

#define TRAIT_MAGICALLY_APT 1

#define TRAIT_AMBIDEXTROUS 2

#define TRAIT_NIMBLE 3

#define TRAIT_CAVE_LORE 4

#define TRAIT_WOODSMAN 5

#define TRAIT_GOOD_CONST 6

#define TRAIT_HIGHLY_ALERT 7

#define TRAIT_EXCEPTIONAL_STRENGTH 8

#define TRAIT_RECUPERATION 9

#define TRAIT_SLUGGISH 10

#define TRAIT_MAGICALLY_INEPT 11

#define TRAIT_FRAIL 12

#define TRAIT_CHRONIC_DISEASE 13

#define TRAIT_BAD_BACK 14

 

/* adven.race */ //complete

#define RACE_HUMAN 0

#define RACE_NEPHIL 1

#define RACE_SLITH 2

 

/* adven.status*/ //complete - assign a positive value for a help pc effect, a negative for harm pc

#define STATUS_POISONED_WEAPON 0

#define STATUS_BLESS 1

#define STATUS_POISON 2

#define STATUS_HASTE 3

#define STATUS_INVULNERABLE 4

#define STATUS_MAGIC_RESISTANCE 5

#define STATUS_WEBS 6

#define STATUS_DISEASE 7

#define STATUS_INVISIBLE 8 //sanctuary

#define STATUS_DUMB 9

#define STATUS_MARTYRS_SHIELD 10

#define STATUS_ASLEEP 11

#define STATUS_PARALYZED 12

#define STATUS_ACID 13

 

/* damage type*/

/* used as parameter to some functions */

#define DAMAGE_WEAPON 0

#define DAMAGE_FIRE 1

#define DAMAGE_POISON 2

#define DAMAGE_MAGIC 3

#define DAMAGE_UNBLOCKABLE 4 //from the source files - the display is the same as the magic one (damage_monst in SPECIALS.cpp or pc_record_type::runTrap in PARTY.cpp)

#define DAMAGE_COLD 5

#define DAMAGE_UNDEAD 6 //from the source files - the display is the same as the weapon one

#define DAMAGE_DEMON 7 //from the source files - the display is the same as the weapon one

// 8 and 9 aren't defined : doesn't print any damage. According to the source files the 9 is DAMAGE_MARKED though. Wrong ?

#define DAMAGE_MARKED 10 // usage: DAMAGE_MARKED + damage_type

#define DAMAGE_NO_PRINT 30 // usage: DAMAGE_NO_PRINT + damage_type

 

/* trap type */

/* used in pc_record_type::runTrap(...) */

#define TRAP_RANDOM 0

#define TRAP_BLADE 1

#define TRAP_DART 2

#define TRAP_GAS 3 // poisons all

#define TRAP_EXPLOSION 4 // damages all => uses c_town.difficulty rather than trap_level to calculates damages (and even c_town.difficulty /13).

#define TRAP_SLEEP_RAY 5

#define TRAP_NO_TRAP_AFTER_ALL 6

#define TRAP_DRAIN_XP 7

#define TRAP_ALERT 8 // makes town hostile

#define TRAP_FLAMES 9 // damages all => uses trap_level (*5) to calculates damages.

#define TRAP_DUMBFOUND 10 //dumbfound all

#define TRAP_DISEASE 11

#define TRAP_DISEASE_ALL 12

 

/* items.type a.k.a type of weapon */

#define ITEM_EDGED 1

#define ITEM_BASHING 2

#define ITEM_POLE 3

 

/* items.variety a.k.a item type (in editor) */

#define ITEM_TYPE_NO_ITEM 0 //a guess, i can't test it ; but should be accurate => confirmed by the code

#define ITEM_TYPE_ONE_HANDED 1

#define ITEM_TYPE_TWO_HANDED 2

#define ITEM_TYPE_GOLD 3 //a guess, i can't test it ; but should be accurate => confirmed by the code

#define ITEM_TYPE_BOW 4

#define ITEM_TYPE_ARROW 5

#define ITEM_TYPE_THROWN_MISSILE 6

#define ITEM_TYPE_POTION 7 // potion/magic item

#define ITEM_TYPE_SCROLL 8 // scroll/magic item

#define ITEM_TYPE_WAND 9

#define ITEM_TYPE_TOOL 10

#define ITEM_TYPE_FOOD 11 //a guess, i can't test it ; but should be accurate => confirmed by the code

#define ITEM_TYPE_SHIELD 12

#define ITEM_TYPE_ARMOR 13

#define ITEM_TYPE_HELM 14

#define ITEM_TYPE_GLOVES 15

#define ITEM_TYPE_SHIELD_2 16 //don't know why a second type of shield is used ; it is actually checked in the armor code (item >= 12 and <= 17)

#define ITEM_TYPE_BOOTS 17 //(continued) and you can't equip another (12) shield while wearing it ... I didn't find a single item with this property in the bladbase.exs ...

#define ITEM_TYPE_RING 18

#define ITEM_TYPE_NECKLACE 19

#define ITEM_TYPE_WEAPON_POISON 20

#define ITEM_TYPE_NON_USE_OBJECT 21

#define ITEM_TYPE_PANTS 22

#define ITEM_TYPE_CROSSBOW 23

#define ITEM_TYPE_BOLTS 24

#define ITEM_TYPE_MISSILE_NO_AMMO 25 //e.g slings

 

/* items.ability */

 

/* Weapons Ability */

#define ITEM_NO_ABILITY 0

#define ITEM_FLAMING_WEAPON 1

#define ITEM_DEMON_SLAYER 2

#define ITEM_UNDEAD_SLAYER 3

#define ITEM_LIZARD_SLAYER 4

#define ITEM_GIANT_SLAYER 5

#define ITEM_MAGE_SLAYER 6

#define ITEM_PRIEST_SLAYER 7

#define ITEM_BUG_SLAYER 8

#define ITEM_ACIDIC_WEAPON 9

#define ITEM_SOULSUCKER 10

#define ITEM_DRAIN_MISSILES 11

#define ITEM_WEAK_WEAPON 12

#define ITEM_CAUSES_FEAR 13

#define ITEM_POISONED_WEAPON 14

 

/* General Ability */

#define ITEM_PROTECTION 30

#define ITEM_FULL_PROTECTION 31

#define ITEM_FIRE_PROTECTION 32

#define ITEM_COLD_PROTECTION 33

#define ITEM_POISON_PROTECTION 34

#define ITEM_MAGIC_PROTECTION 35

#define ITEM_ACID_PROTECTION 36

#define ITEM_SKILL 37

#define ITEM_STRENGTH 38

#define ITEM_DEXTERITY 39

#define ITEM_INTELLIGENCE 40

#define ITEM_ACCURACY 41

#define ITEM_THIEVING 42

#define ITEM_GIANT_STRENGTH 43

#define ITEM_LIGHTER_OBJECT 44

#define ITEM_HEAVIER_OBJECT 45

#define ITEM_OCCASIONAL_BLESS 46

#define ITEM_OCCASIONAL_HASTE 47

#define ITEM_LIFE_SAVING 48

#define ITEM_PROTECTION_FROM_PETRIFY 49

#define ITEM_REGENERATE 50

#define ITEM_POISON_AUGMENT 51

#define ITEM_DISEASE_PARTY 52

#define ITEM_WILL 53

#define ITEM_FREE_ACTION 54

#define ITEM_SPEED 55

#define ITEM_SLOW_WEARER 56

#define ITEM_PROTECTION_FROM_UNDEAD 57

#define ITEM_PROTECTION_FROM_DEMONS 58

#define ITEM_PROTECTION_FROM_HUMANOIDS 59

#define ITEM_PROTECTION_FROM_REPTILES 60

#define ITEM_PROTECTION_FROM_GIANTS 61

#define ITEM_PROTECTION_FROM_DISEASE 62

 

/* NonSpell Use ; the constant refers to both the positive and negative effect (don't mind the name). */

#define ITEM_POISON_WEAPON 70 //put poison on weapon

#define ITEM_BLESS_USER 71

#define ITEM_CURE_POISON 72

#define ITEM_HASTE_USER 73

#define ITEM_ADD_INVULNERABILITY 74

#define ITEM_ADD_MAGIC_RESISTANCE 75

#define ITEM_ADD_WEB 76

#define ITEM_CAUSE_DISEASE 77

#define ITEM_ADD_SANCTUARY 78

#define ITEM_CAUSE_DUMBFOUND 79

#define ITEM_ADD_MARTYRS_SHIELD 80

#define ITEM_CURE_SLEEP 81

#define ITEM_CURE_PARALYSIS 82

#define ITEM_CURE_ACID 83

#define ITEM_BLISS 84

#define ITEM_ADD_EXPERIENCE 85

#define ITEM_ADD_SKILL_POINTS 86

#define ITEM_ADD_HEALTH 87

#define ITEM_ADD_SPELL_POINTS 88

#define ITEM_DOOM 89

#define ITEM_LIGHT 90

#define ITEM_STEALTH 91

#define ITEM_FIREWALK 92

#define ITEM_FLYING 93

#define ITEM_MAJOR_HEALING 94

 

/* Spell Usable */

 

#define ITEM_SPELL_FLAME 110

#define ITEM_SPELL_FIREBALL 111

#define ITEM_SPELL_FIRESTORM 112

#define ITEM_SPELL_KILL 113

#define ITEM_SPELL_ICE_BOLT 114

#define ITEM_SPELL_SLOW 115

#define ITEM_SPELL_SHOCKWAVE 116

#define ITEM_SPELL_DISPEL_UNDEAD 117

#define ITEM_SPELL_DISPEL_SPIRIT 118

#define ITEM_SPELL_SUMMONING 119

#define ITEM_SPELL_MASS_SUMMONING 120

#define ITEM_SPELL_ACID_SPRAY 121

#define ITEM_SPELL_STINKING_CLOUD 122

#define ITEM_SPELL_SLEEP_FIELD 123

#define ITEM_SPELL_VENOM 124

#define ITEM_SPELL_SHOCKSTORM 125

#define ITEM_SPELL_PARALYSIS 126

#define ITEM_SPELL_WEB_SPELL 127

#define ITEM_SPELL_STRENGTHEN_TARGET 128 //wand of carrunos effect

#define ITEM_SPELL_QUICKFIRE 129

#define ITEM_SPELL_MASS_CHARM 130

#define ITEM_SPELL_MAGIC_MAP 131

#define ITEM_SPELL_DISPEL_BARRIER 132

#define ITEM_SPELL_MAKE_ICE_WALL 133

#define ITEM_SPELL_CHARM_SPELL 134

#define ITEM_SPELL_ANTIMAGIC_CLOUD 135

 

 

/* Reagents */

#define ITEM_HOLLY 150 // Holly/Toadstool

#define ITEM_COMFREY_ROOT 151

#define ITEM_GLOWING_NETTLE 152

#define ITEM_CRYPT_SHROOM 153 // Crypt Shroom/Wormgr.

#define ITEM_ASPTONGUE_MOLD 154

#define ITEM_EMBER_FLOWERS 155

#define ITEM_GRAYMOLD 156

#define ITEM_MANDRAKE 157

#define ITEM_SAPPHIRE 158

#define ITEM_SMOKY_CRYSTAL 159

#define ITEM_RESSURECTION_BALM 160

#define ITEM_LOCKPICKS 161

 

/* Missiles */

 

#define ITEM_MISSILE_RETURNING 170

#define ITEM_MISSILE_LIGHTNING 171

#define ITEM_MISSILE_EXPLODING 172

#define ITEM_MISSILE_ACID 173

#define ITEM_MISSILE_SLAY_UNDEAD 174

#define ITEM_MISSILE_SLAY_DEMON 175

#define ITEM_MISSILE_HEAL_TARGET 176

 

/* Monsters Stuff */

 

/* Skills Same as PC */

 

/* Monster Type */

 

#define MONSTER_TYPE_HUMAN 0

#define MONSTER_TYPE_REPTILE 1

#define MONSTER_TYPE_BEAST 2

#define MONSTER_TYPE_IMPORTANT 3

#define MONSTER_TYPE_MAGE 4

#define MONSTER_TYPE_PRIEST 5

#define MONSTER_TYPE_HUMANOID 6

#define MONSTER_TYPE_DEMON 7

#define MONSTER_TYPE_UNDEAD 8

#define MONSTER_TYPE_GIANT 9

#define MONSTER_TYPE_SLIME 10

#define MONSTER_TYPE_STONE 11

#define MONSTER_TYPE_BUG 12

#define MONSTER_TYPE_DRAGON 13

#define MONSTER_TYPE_MAGICAL_CREATURE 14

 

/* Attack Types */

 

#define MONSTER_ATTACK_SWINGS 0

#define MONSTER_ATTACK_CLAWS 1

#define MONSTER_ATTACK_BITES 2

#define MONSTER_ATTACK_SLIMES 3

#define MONSTER_ATTACK_PUNCHES 4

#define MONSTER_ATTACK_STINGS 5

#define MONSTER_ATTACK_CLUBS 6

#define MONSTER_ATTACK_BURNS 7

#define MONSTER_ATTACK_HARMS 8

#define MONSTER_ATTACK_STABS 9

 

/* Special Ability a.k.a spec_skill */

 

#define MONSTER_NO_SPECIAL_ABILITY 0

#define MONSTER_THROWS_DARTS 1

#define MONSTER_SHOOTS_ARROWS 2

#define MONSTER_THROWS_SPEARS 3

#define MONSTER_THROWS_ROCKS1 4 //4-24 damages

#define MONSTER_THROWS_ROCKS2 5 //5-30 damages

#define MONSTER_THROWS_ROCKS3 6 //6-36 damages

#define MONSTER_THROWS_RAZORDISKS 7

#define MONSTER_PETRIFICATION_RAY 8

#define MONSTER_SP_DRAIN_RAY 9 //spell points drain ray

#define MONSTER_HEAT_RAY 10

#define MONSTER_INVISIBLE 11

#define MONSTER_SPLITS 12

#define MONSTER_MINDLESS 13

#define MONSTER_BREATHES_STINKING_CLOUDS 14

#define MONSTER_ICY_TOUCH 15

#define MONSTER_XP_DRAINING_TOUCH 16

#define MONSTER_ICY_AND_DRAINING_TOUCH 17

#define MONSTER_SLOWING_TOUCH 18

#define MONSTER_SHOOTS_WEB 19

#define MONSTER_GOOD_ARCHER 20

#define MONSTER_STEALS_FOOD 21

#define MONSTER_PERMANENT_MARTYRS_SHIELD 22

#define MONSTER_PARALYSIS_RAY 23

#define MONSTER_DUMBFOUNDING_TOUCH 24

#define MONSTER_DISEASE_TOUCH 25

#define MONSTER_ABSORB_SPELLS 26

#define MONSTER_WEB_TOUCH 27

#define MONSTER_SLEEP_TOUCH 28

#define MONSTER_PARALYSIS_TOUCH 29

#define MONSTER_PETRIFICATION_TOUCH 30

#define MONSTER_ACID_TOUCH 31

#define MONSTER_BREATHES_SLEEP_CLOUDS 32

#define MONSTER_ACID_SPIT 33

#define MONSTER_SHOOTS_SPINES 34

#define MONSTER_DEATH_TOUCH 35

#define MONSTER_INVULNERABILITY 36

#define MONSTER_GUARD 37

 

/* Create Monsters/Fields */

 

#define MONSTER_NO_RADIATE 0

#define MONSTER_RADIATE_FIRE_FIELDS 1

#define MONSTER_RADIATE_ICE_FIELDS 2

#define MONSTER_RADIATE_SHOCK_FIELDS 3

#define MONSTER_RADIATE_ANTIMAGIC_FIELDS 4

#define MONSTER_RADIATE_SLEEP_FIELDS 5

#define MONSTER_RADIATE_STINKING_CLOUDS 6

//as said 7,8 and 9 are unused

#define MONSTER_SUMMON1 10 //5 percent chance

#define MONSTER_SUMMON2 11 //20 percent chance

#define MONSTER_SUMMON3 12 //50 percent chance

//as said 13 and 14 are unused

#define MONSTER_DEATH_TRIGGERS 15 //death triggers global special

 

 

#endif

 

The formulas explanation is halfway done, the first part being the pc attacks a monster part.

 

Chokboyz

Link to comment
Share on other sites

It is the only "stat_adj", thus you have a head without a body, "statAdj" seems to be the norm, thus declaration will need to be altered.

My notes came from the Editor help file, it should be interesting to see how that compares to the code. This will take me some time to compare.

 

I just ran the items properties through Word and Excel, I found a few possible problems:

#define Poision Protection 34 34 Poison Protection FALSE TRUE

#define Sleep Cloud 123 123 Sleep Field FALSE TRUE

#define Grawmold 156 156 Graymold FALSE TRUE

 

As for Word and Excel, a tab stop in Word equates to a new cell in Excel, here is an example of this at work:

 

Original text:

(here white space is represented by @)

#define@ITEM_MISSILE_RETURNING@170

#define@ITEM_MISSILE_LIGHTNING@171

#define@ITEM_MISSILE_EXPLODING@172

#define@ITEM_MISSILE_ACID@173

#define@ITEM_MISSILE_SLAY_UNDEAD@174

#define@ITEM_MISSILE_SLAY_DEMON@175

#define@ITEM_MISSILE_HEAL_TARGET@176

 

Change white spaces to tabs, here tabs are represented by tildes, ~

#define~ITEM_MISSILE_RETURNING~170

#define~ITEM_MISSILE_LIGHTNING~171

#define~ITEM_MISSILE_EXPLODING~172

#define~ITEM_MISSILE_ACID~173

#define~ITEM_MISSILE_SLAY_UNDEAD~174

#define~ITEM_MISSILE_SLAY_DEMON~175

#define~ITEM_MISSILE_HEAL_TARGET~176

 

Change text to Title Case, I first had to change it to lowercase to get this to work.

#Define~Item_Missile_Returning~170

#Define~Item_Missile_Lightning~171

#Define~Item_Missile_Exploding~172

#Define~Item_Missile_Acid~173

#Define~Item_Missile_Slay_Undead~174

#Define~Item_Missile_Slay_Demon~175

#Define~Item_Missile_Heal_Target~176

 

Delete "Item_Missile_"

Returning~170

Lightning~171

Exploding~172

Acid~173

Slay_Undead~174

Slay_Demon~175

Heal_Target~176

 

Now the data is in a format that can be used in Excel to compare it to my own notes. #Define is in a column by itself, so it can be safely ignored.

In Word, Ctrl + H is the shortcut for the Replace function. Check out the More and Special lists.

Traps: BoE Editor help file says that type 6 is "no trap after all".

 

My methods:

Use Gamedlog.rc and Gamestr.rc

Use the Editor help file

 

The monster and item properties seem okay.

 

Link to comment
Share on other sites

The typos have been fixed and SLEEP_CLOUD has been changed to SLEEP_FIELD to match description.

 

I did find the statAdj() function in the code (thanks) and the older stat_adj should indeed be removed (the item 99 bug is also present in statAdj ... what ability should replace this, skill ? will ?).

 

Thanks for cross-checking the values,

Chokboyz

Link to comment
Share on other sites

In this post, I will try, as asked, to describe what happens (code wise) when you attacks a monster (when a monster attacks you or another monster, it is quite different as some things are simplified and others not ...).

To do so, i will explicit the two fonctions used in the process pc_attack() in COMBAT.cpp and damage_monst() in SPECIALS.cpp. The original (windows) code is used for accuracy.

 

Before beginning, here are two things one should know :

  • The minmax(a,b,c) function returns a if c<a ; b if c>b or c if he is in between (with a<B). The function get_ran(c,a,B) returns a random number between a x c and b x c.
  • The Bless/Curse level of a monster or a character is the same variable with positive value being blessed and negative value being cursed (the same is true with haste/slow, ...)
Here we go ...

  1. Hitting a monster (pc_attack())
    • First if the adventurer is absent/dead/dust/stone/whatever_except_here_and_sound or if the adventurer is sleepy or paralysed, don't do a thing.
    • Then checks the weapon(s) equipped by the pc
    • Calculate the hit_adj (hit adjustement) following the formula

       

      hit_adj = (-5 * minmax(-8,8,AdventurerBlessLevel)) + 5 * minmax(-8,8,MonsterBlessLevel)- stat_adj(value_of_dexterity) * 5 + (Adventurer_encumberance) * 5;

       

      Here, the stat_adj is the "value_of_dexterity" index in the following array (begins at 0) : {-3,-3,-2,-1,0,0,1,1,1,2,2,2,3,3,3,3,4,4,4,5,5}

    • Calculate the dmg_adj (damage adjustement) following the formula

       

      dam_adj = minmax(-8,8,AdventurerBlessLevel) - minmax(-8,8,MonsterBlessLevel)+ stat_adj(value_of_strength);

       

      Here, the stat_adj is the "value_of_strength" index in the following array (begins at 0) : {-3,-3,-2,-1,0,0,1,1,1,2,2,2,3,3,3,3,4,4,4,5,5} , plus one if the character has the Exceptional Strength trait.

    • If the target is sleepy or paralysed, substract 80 to hit_adj and add 10 to dmg_adj.
    • If the attacker has an item with the skill ability equipped, add 5 * (item_level / 2 + 1); to hit_adj and item_level / 2 to dmg_adj.
    • If the attacker has an item with the giant strength ability equipped, add item_level * 2 to hit_adj and item_level to dmg_adj.
    • Negates sanctuary for the attacker
    • Then it depends of the weapon(s) equipped
      1. If weaponless, you punch. The hit roll is calculated following the formula :

        hit_roll = get_ran(1,0,100) + hit_adj - 20+5 * (adventurerWebsLevel / 3)

         

        The damage roll is calculated following the formula :

        dmg_roll= get_ran(1,1,4) + dam_adj;

         

        If the hit roll is less or equal to the "value_of_dexterity" index in the following array (size 51) : {20,30,40,45,50,55,60,65,69,73,77,81,84,87,90,92,94,96,97,98,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99} you hit and call the damage_monst() function with dmg_roll as parameter.

      2. You've got at least one weapon.

        It first get the type of weapon you wield.

         

        Then, the hit roll is calculated following the formula :

        hit_roll = get_ran(1,0,100) - 5 + hit_adj - 5 * weapon1_bonus + 5 * (adventurerWebsLevel / 3)

        If you wield a second weapon without having the ambidextrous trait, add 25 to hit_roll.

        If you are a slith wielding a pole weapon, substract 10 to hit_roll.

         

        The damage roll is then calculated following the formula :

        dmg_roll = get_ran(1,1,weapon1_level) + dam_adj + 2 + weapon1_bonus

        If the weapon has the weak weapon ability the damage roll becomes

        dmg_roll * (10 - weapon1.ability_strength) / 10

         

        If the hit roll is less or equal to the "value_of_weapon_skill" index in the following array (size 51) : {20,30,40,45,50,55,60,65,69,73,77,81,84,87,90,92,94,96,97,98,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99} you hit. Else you miss, play the animation and miss sound and goes on to C.

         

        Then it calculates special damage (spec_dam) depending of the weapon ability

        • For a flaming weapon, spec_dam = get_ran(WeaponAbilityLevel,1,6).
        • For a demon slayer weapon, spec_dam = 8 * WeaponAbilityLevel if the monster is a demon.
        • For a undead slayer weapon, spec_dam = 6 * WeaponAbilityLevel if the monster is an undead.
        • For a lizard slayer weapon, spec_dam = 5 * WeaponAbilityLevel if the monster is a reptile.
        • For a giant slayer weapon, spec_dam = 8 * WeaponAbilityLevel if the monster is a giant.
        • For a mage slayer weapon, spec_dam = 4 * WeaponAbilityLevel if the monster is a mage.
        • For a priest slayer weapon, spec_dam = 4 * WeaponAbilityLevel if the monster is a priest.
        • For a bug slayer weapon, spec_dam = 7 * WeaponAbilityLevel if the monster is a bug.
        • If it is a cause fear weapon, it reduces the morale of the monster by 10 * WeaponAbilityLevel if the monster doesn't absorb spell or is magic immuned.

          If magic resistant, it reduces the morale of the monster by 5 * WeaponAbilityLevel (no spec_dam).

           

          Then it checks if you assassinate. To assassinate, the level of the pc must be more or equal to the level of the monster minus 1, his skill in assassination must be more or equal to the level of the monster divided by 2 and the monster mustn't be a splitter (can't assassinate a splitter).

          Then if get_ran(1,0,100) < hit_chance[max(AdventurerAssassinationSkill - MonsterLevel),0)], where hit_chance is the same array as in A, you effectively assassinate and

          add the dmg_roll to spec_dmg.

           

          And finally it damages the monster by calling damage_monst() (see 2 below).

           

          After dealing damages, if the pc has poison on his weapon, the poison level (+2 if he has a poison augment item equipped) on his blade is added to the monster poison counter and the poison level on the blade is reduced.

          Then if the weapon is a poisoned weapon (the ability), it has 1 chance out of 2 to poison the monster with (WeaponAbilityLevel /2) poison level.

          If the weapon is an acid weapon (the ability), it has 1 chance out of 2 to put acid on the monster with (WeaponAbilityLevel /2) acid level.

          If the weapon is a soulsucker weapon (the ability), it has 1 chance out of 2 to heal the pc (WeaponAbilityLevel /2) health.

      3. You have a second weapon equipped.

        It does exactely the same thing a second time except :

        • No race slith adjustment for pole weapon equipped
        • The hit roll is calculated following the formula :

          hit_roll = get_ran(1,0,100) + hit_adj - 5 * weapon2_bonus + 5 * (adventurerWebsLevel / 3)

        • The damage roll is calculated following the formula :

          dmg_roll = get_ran(1,1,weapon2_level) + dam_adj - 1 + weapon2_bonus

        • There is no assassination, nor poison with the second weapon.
      4. It reduces poison on blades (once more), take 4 AP away and finally if the monster has martyr's shield (spell or ability) on and is not killed it damages the pc by the amount of damage done to the monster.
  2. Damaging a monster (damage_monst())

     

    The parameters are dmg_roll (amount of damage) and spec_dmg (amount of special damage, i.e item ability, ...).

    • First if the monster is resistant to the type of damage, the dmg_roll is divided by 2 ; if it's immuned dmg_roll is reduced to 0.
    • Then if the monster absorb magic and the damage type is fire, magic or cold, add dmg_roll to monster's health and stop here.
    • If damage type is fire or cold, and if get_ran(1,0,20) <= MonsterLevel, then dmg_roll is divided by 2.
    • If damage type is magic, and if get_ran(1,0,24) <= MonsterLevel, then dmg_roll is divided by 2.
    • If the monster has the invulnerable ability (a.k.a Rentar-Ihrno in the code), then dmg_roll is divided by 10.
    • The Armor Roll of the monster is calculated following the formula :

      armor_roll = get_ran(1,0,(MonsterArmor * 5/4)) + MonsterLevel / 4;

      If the damage type is weapon (and only weapon ; undead and demons bypass this. Thanks Thuryl) substract armor_roll to dmg_roll.

    • Then if dmg_roll is greater than 0 (dmg_roll + spec_dmg) are deduced to the monster health. If dmg_roll is less or equal to 0, no damage is done and the function stop here (no special damage).
    • Then if it is a splitting monster, split it.
    • Updates the party damage statistic and make the monster hostile and active (a monster see you-like).
    • The splash animation is done and the monster is killed if it health is strictly lesser (<) then 0
    • If the monster is alive, it reduces its morale by 1 if damages done is between 1 and 5, 2 if 6 and 10, 3 if 10 and 20 or 5 if greater than 20.
    • Finally, if you damaged an innocent make the town hostile.

I may have overlooked something since it's a long list of thing, but everything essential should be here.

 

Chokboyz

Link to comment
Share on other sites

This line got somehow squished in 1)B), it is now fixed.

 

Quote:
If the hit roll is less or equal to the "value_of_weapon_skill" index in the following array (size 51) : {20,30,40,45,50,55,60,65,69,73,77,81,84,87,90,92,94,96,97,98,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99} you hit. Else you miss, play the animation and miss sound and goes on to C.

 

Thanks,

Chokboyz

 

Edit : was missing a line in C, with modified hit roll formula, fixed

Quote:
hit_roll = get_ran(1,0,100) + hit_adj - 5 * weapon2_bonus + 5 * (adventurerWebsLevel / 3)
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...