在1.11b+的暗黑2游戏中,使用下列公式可对无形防具进行公式打孔,并可获得额外50%防御值奖励:
1 Tal(7#) + 1 Thul(10#) + 1 完美黄宝石 + 普通盔甲 = 同类型带孔盔甲 3Zzx\ohL
插孔数会随机变化。
这个Bug的出现,直接导致所有无形超强防具变成垃圾。
我们先看看这个Bug是如何产生的。
利用公式打孔,其基本过程如下:
1、首先将原防具A完全复制成一个新的防具B;
2、对B进行随机孔数生成;
3、如果B是无形物品,则进行50%防御值奖励,并将最终防御值记录在物品上。
注意,对无形武器进行公式打孔,同样可以获得50%的攻击值奖励,但是由于游戏计算伤害值的时候,并不是使用记录在物品上的攻击值进行计算,所以应该没什么影响。
这个Bug的产生就是当进行第1步的时候,忘记了A如果是无形的,则已经进行过50%的奖励了(在物品掉落时),后面再第3步又奖励了一次,导致Bug产生。
比如一件防御是148的AP+,如果在掉落时决定是一件无形的,则进行50%防御值奖励(还有别的需求奖励),则最终防御值是222。如果用公式打孔,则最终防御值变成333。
为了消除这个Bug,可以将步骤修改如下:
1、首先将原防具A完全复制成一个新的防具B;
1.1、如果防具B是无形的,则将其防御值*2/3,即去掉无形奖励;
2、对B进行随机孔数生成;
3、如果B是无形物品,则进行50%防御值奖励,并将最终防御值记录在物品上。
这样的话,就可以修正这个Bug。具体代码如下:
.text:6FC57901 call ItemDuplicateFunc
.text:6FC57906 mov edi, eax
.text:6FC57908 push 4
.text:6FC5790A push edi
.text:6FC5790B mov [esp+ebx*4+13Ch+var_10C], edi
.text:6FC5790F call D2Common_10572_ChangeCurrentMode
将上述call D2Common_10572_ChangeCurrentMode修改为call EthBugFix 即可。
EthBugFix proc
; edi==item
cmp dword ptr [edi],4
jnz orig_code
mov eax,[edi+14h]
test eax,eax
jz orig_code
mov eax,[eax+18h]
and eax,400000h
jz orig_code
Ethereal_Item:
pushad
mov ebx,3
push 0
push 15h ;mindamage
push edi
call D2COMMON_10061_GetUnitStat
lea eax,[eax+eax]
cdq
div ebx
push 0
push eax
push 15h
push edi
call D2Common_10590_SetStat
push 0
push 16h ;maxdamage
push edi
call D2COMMON_10061_GetUnitStat
lea eax,[eax+eax]
cdq
div ebx
push 0
push eax
push 16h
push edi
call D2Common_10590_SetStat
push 0
push 17h ;secondary_mindamage
push edi
call D2COMMON_10061_GetUnitStat
lea eax,[eax+eax]
cdq
div ebx
push 0
push eax
push 17h
push edi
call D2Common_10590_SetStat
push 0
push 18h ;secondary_maxdamage
push edi
call D2COMMON_10061_GetUnitStat
lea eax,[eax+eax]
cdq
div ebx
push 0
push eax
push 18h
push edi
call D2Common_10590_SetStat
push 0
push 9Fh ;item_throw_mindamage
push edi
call D2COMMON_10061_GetUnitStat
lea eax,[eax+eax]
cdq
div ebx
push 0
push eax
push 9Fh
push edi
call D2Common_10590_SetStat
push 0
push 0A0h ;item_throw_maxdamage
push edi
call D2COMMON_10061_GetUnitStat
lea eax,[eax+eax]
cdq
div ebx
push 0
push eax
push 0A0h
push edi
call D2Common_10590_SetStat
push 0
push 1Fh ;armorclass
push edi
call D2COMMON_10061_GetUnitStat
lea eax,[eax+eax]
cdq
div ebx
push 0
push eax
push 1Fh
push edi
call D2Common_10590_SetStat
popad
orig_code:
mov eax,D2Common_10572_ChangeCurrentMode
jmp eax
EthBugFix endp |