NerdanelVampire: This is probably one of those problems that are either really simple or really subtle. I want to know from where a combat system's test_hit function is called, and specifically what determines the value of the "chance" input field. I've tried using the grep command, but for some reason it didn't bring up anything relevant.

I've been trying to modify Zothiqband's combat probabilities to correspond to ToME 2 and get rid of the nigh-invincible snakes, but it's kind of hard when I can't find which piece of code to modify...

NerdanelVampire: Oh, apparently the page name doesn't support underscores, so I'll repeat that the function is called test_hit.

EtMarc: I don't use it, but as far as I remember from when I created my combat system, it is from the combat subsystem (I don't remember which file).

Using grep, I find it in combat_*_default subsystems.

NerdanelVampire: The problem is that I have forked the combat_*_default subsystems in order to unify them, and test_hit is getting called from somewhere outside, and I cannot find where... I can see where the functions themselves are defined, but not where their arguments come from, and that's a critical problem. If this issue is not solved I might just end up ignoring the to-hit chance fed into a function and calculating it again from the scratch so that I at least know what it does.

EtMarc: Oups, sorry. I misunderstood you.

subsystems/combat_weapon_default.lua - line 437

-- Test for hit
if combat.default_weapon.test_hit(obj, m_ptr, chance) then

I guess the other systems have similar effect. Chance is calculated at line 421.

NerdanelVampire: There it is! Sometimes I wonder how I can be so blind... I'm pretty embarrassed about this page...

Module Developers Discussion/Dealing with test hit (last edited 2008-02-16 01:35:06 by NerdanelVampire)