Novi asked a good question in the Might & Magic discord earlier today:
If a character had -60 Resistance, how does that work? Would that be similar to a character having 0 resistance?
Resistances in MM6-MM8
Re: Resistances in MM6-MM8
Good question! Unfortunately I can't open the disassembly right now, but logically it should be. One can't get worse than not having any resistance: there isn't any code to increase elemental damage (only to decrease if you resist), and one certainly can't get a status condition twice. But of course, the game could be buggy, so it's theoretically possible, albeit unlikely, that resistance is treated as unsigned somewhere, in which case negative resistance would equal near-immunity due to overflow.
Re: Resistances in MM6-MM8
First, practical advice:
Now, speaking about MM8. [Base or Bonus] Resistance is two bytes. Base resistance is unsigned so -60 will be 65495 that will be equaled to immunity if your character is Lich (or other class name with id=1). Otherwise you should get 1 damage.
Bonus Resistance is (surprisingly) unsigned too. Should work the same way because CalcDamageToPlayer uses GetResistance.
MMExtension considers Resistance to be signed.
Code: Select all
Party[0].Resistances[0].Base=-60
Party[1].Resistances[0].Bonus=-60
evt.CastSpell(6, 3, 7, Party.X - 100, Party.Y, Party.Z, Party.X, Party.Y, Party.Z)
Bonus Resistance is (surprisingly) unsigned too. Should work the same way because CalcDamageToPlayer uses GetResistance.
MMExtension considers Resistance to be signed.
Re: Resistances in MM6-MM8
There we go! Although I don't think the player can legitimately get negative base or bonus resistance values. The only times I remember having negative resistances was when using certain artifacts. Have you tried casting fireball on yourself while wielding the Trident of Rulership?
Re: Resistances in MM6-MM8
Resistance = Player.Resistance.Base + CalcStatBonusByMagic + GM Leather Bonus + BaseClassResistance (*) + CalcStatBonusByItems
(*) If BaseClassResistance == 65000, Resistance is equal to 65000 regardless of other components.
Since it's 'jz' after 'test edi, edi', small negative resistance can bring you positive effect if you're lucky. -60 though will bring us fail at the first check, so it will be as if resistance is 0.
(*) If BaseClassResistance == 65000, Resistance is equal to 65000 regardless of other components.
Code: Select all
...
mov ecx, esi
call sub_48DD6B ; GetResistance
mov edi, eax
loc_48CDEE:
mov ebx, [ebp+arg_4]
mov ecx, esi
mov [ebp+arg_4], ebx
call sub_48F54A ; GetClass
cmp eax, 1
jnz short loc_48CE0F
cmp edi, 0FDE8h
jl short loc_48CE0F
xor eax, eax
jmp loc_48CEDF
; ---------------------------------------------------------------------------
loc_48CE0F:
test edi, edi
jz short loc_48CE70
mov ecx, esi
call sub_48C633 ; GetLuck
push eax
mov ecx, esi
call sub_48E18E ; GetStatisticEffect
lea edi, [eax+edi+1Eh]
cmp edi, 1
jge short loc_48CE2E
xor edi, edi
inc edi
loc_48CE2E: ; CODE XREF: sub_48CDA6+83↑j
call sub_4D99F2 ; Rand
cdq
idiv edi
cmp edx, 1Eh
jl short loc_48CE70
sar ebx, 1
mov [ebp+arg_4], ebx
...
Who is online
Users browsing this forum: No registered users and 0 guests