Extend profiles from 280 to 312 bytes with legacy compatibility. Keep tower relics run-local and share the profile bankroll.
239 lines
5.3 KiB
PHP
239 lines
5.3 KiB
PHP
; Artifact settlement owns caps, inventory and observer/tower isolation.
|
|
PreviewArtifactSignature3D PROC uses esi ecx source:DWORD
|
|
mov esi,source
|
|
mov ecx,9
|
|
mov eax,0A57C0DEh
|
|
preview_artifact_sign:
|
|
rol eax,5
|
|
xor eax,[esi]
|
|
add eax,9E3779B9h
|
|
add esi,4
|
|
loop preview_artifact_sign
|
|
ret
|
|
PreviewArtifactSignature3D ENDP
|
|
|
|
ArtifactSaveSignature3D PROC uses esi ecx edx source:DWORD
|
|
mov esi,source
|
|
mov ecx,SAVE_ARTIFACT_SIGN_SIZE/4
|
|
mov eax,0A57C0DEh
|
|
artifact_sign_word:
|
|
rol eax,5
|
|
xor eax,[esi]
|
|
mov edx,eax
|
|
shr edx,16
|
|
xor eax,edx
|
|
add eax,9E3779B9h
|
|
add esi,4
|
|
loop artifact_sign_word
|
|
ret
|
|
ArtifactSaveSignature3D ENDP
|
|
|
|
ValidateArtifactSave3D PROC uses esi edi source:DWORD
|
|
mov esi,source
|
|
cmp DWORD PTR [esi+280],32465241h
|
|
jne artifact_save_invalid
|
|
cmp DWORD PTR [esi+304],2
|
|
jne artifact_save_invalid
|
|
invoke ArtifactSaveSignature3D,esi
|
|
cmp eax,[esi+308]
|
|
jne artifact_save_invalid
|
|
mov edi,284
|
|
@@:
|
|
cmp DWORD PTR [esi+edi],99
|
|
ja artifact_save_invalid
|
|
add edi,4
|
|
cmp edi,300
|
|
jb @B
|
|
cmp DWORD PTR [esi+300],15
|
|
ja artifact_save_invalid
|
|
mov eax,1
|
|
ret
|
|
artifact_save_invalid:
|
|
xor eax,eax
|
|
ret
|
|
ValidateArtifactSave3D ENDP
|
|
|
|
ArtifactCredit3D PROC amount:DWORD
|
|
mov eax,1000000000
|
|
sub eax,bankroll
|
|
cmp eax,amount
|
|
jbe @F
|
|
mov eax,amount
|
|
@@:
|
|
add bankroll,eax
|
|
ret
|
|
ArtifactCredit3D ENDP
|
|
|
|
ResetArtifacts3D PROC
|
|
mov charmCloverUses,0
|
|
mov charmHorseshoeUses,0
|
|
mov charmSkullUses,0
|
|
mov charmDevilUses,0
|
|
mov charmEnabledMask3D,7
|
|
ret
|
|
ResetArtifacts3D ENDP
|
|
|
|
ClampArtifacts3D PROC uses esi ecx
|
|
lea esi,charmCloverUses
|
|
mov ecx,4
|
|
@@:
|
|
cmp DWORD PTR [esi],CHARM_MAX_USES
|
|
jbe artifact_clamp_next
|
|
mov DWORD PTR [esi],CHARM_MAX_USES
|
|
artifact_clamp_next:
|
|
add esi,4
|
|
loop @B
|
|
and charmEnabledMask3D,15
|
|
test charmEnabledMask3D,8
|
|
jz @F
|
|
and charmEnabledMask3D,12
|
|
@@:
|
|
ret
|
|
ClampArtifacts3D ENDP
|
|
|
|
ToggleArtifact3D PROC index:DWORD
|
|
mov ecx,index
|
|
cmp ecx,3
|
|
ja artifact_toggle_done
|
|
btc charmEnabledMask3D,ecx
|
|
cmp ecx,3
|
|
jne @F
|
|
test charmEnabledMask3D,8
|
|
jz artifact_toggle_save
|
|
and charmEnabledMask3D,12
|
|
jmp artifact_toggle_save
|
|
@@:
|
|
cmp ecx,2
|
|
je artifact_toggle_save
|
|
and charmEnabledMask3D,7
|
|
artifact_toggle_save:
|
|
call SaveProgress3D
|
|
artifact_toggle_done:
|
|
ret
|
|
ToggleArtifact3D ENDP
|
|
|
|
TriggerCharmLossProtection PROC uses ebx ecx edx betAmount:DWORD
|
|
cmp obsActive3D,0
|
|
jne artifact_loss_none
|
|
cmp tournamentMode,0
|
|
jne artifact_loss_none
|
|
cmp betAmount,0
|
|
je artifact_loss_none
|
|
test charmEnabledMask3D,8
|
|
jz artifact_loss_clover
|
|
cmp charmDevilUses,0
|
|
je artifact_loss_none
|
|
dec charmDevilUses
|
|
call SaveProgress3D
|
|
jmp artifact_loss_none
|
|
artifact_loss_clover:
|
|
test charmEnabledMask3D,1
|
|
jz artifact_loss_none
|
|
cmp charmCloverUses,0
|
|
je artifact_loss_none
|
|
mov eax,betAmount
|
|
inc eax
|
|
shr eax,1
|
|
cmp eax,10000
|
|
jbe @F
|
|
mov eax,10000
|
|
@@:
|
|
invoke ArtifactCredit3D,eax
|
|
test eax,eax
|
|
jz artifact_loss_none
|
|
dec charmCloverUses
|
|
invoke CopyString3D,OFFSET msgCharmCloverSave,OFFSET flashMessage
|
|
mov flashTimer,140
|
|
call SaveProgress3D
|
|
mov eax,1
|
|
ret
|
|
artifact_loss_none:
|
|
xor eax,eax
|
|
ret
|
|
TriggerCharmLossProtection ENDP
|
|
|
|
; Input is NET profit, never gross payout or returned stake.
|
|
TriggerCharmWinBonus PROC uses ebx ecx edx winAmount:DWORD
|
|
cmp obsActive3D,0
|
|
jne artifact_bonus_none
|
|
cmp tournamentMode,0
|
|
jne artifact_bonus_none
|
|
cmp winAmount,0
|
|
je artifact_bonus_none
|
|
test charmEnabledMask3D,8
|
|
jz artifact_bonus_horse
|
|
cmp charmDevilUses,0
|
|
je artifact_bonus_none
|
|
mov eax,winAmount
|
|
cmp eax,10000
|
|
jbe @F
|
|
mov eax,10000
|
|
@@:
|
|
invoke ArtifactCredit3D,eax
|
|
test eax,eax
|
|
jz artifact_bonus_none
|
|
dec charmDevilUses
|
|
mov ebx,eax
|
|
invoke CopyString3D,OFFSET msgCharmDevilSave,OFFSET flashMessage
|
|
jmp artifact_bonus_save
|
|
artifact_bonus_horse:
|
|
test charmEnabledMask3D,2
|
|
jz artifact_bonus_none
|
|
cmp charmHorseshoeUses,0
|
|
je artifact_bonus_none
|
|
mov eax,winAmount
|
|
mov ecx,35
|
|
mul ecx
|
|
mov ecx,100
|
|
div ecx
|
|
test eax,eax
|
|
jnz @F
|
|
inc eax
|
|
@@:
|
|
cmp eax,5000
|
|
jbe @F
|
|
mov eax,5000
|
|
@@:
|
|
invoke ArtifactCredit3D,eax
|
|
test eax,eax
|
|
jz artifact_bonus_none
|
|
dec charmHorseshoeUses
|
|
mov ebx,eax
|
|
invoke CopyString3D,OFFSET msgCharmHorseshoeWin,OFFSET flashMessage
|
|
artifact_bonus_save:
|
|
mov flashTimer,140
|
|
call SaveProgress3D
|
|
mov eax,ebx
|
|
ret
|
|
artifact_bonus_none:
|
|
xor eax,eax
|
|
ret
|
|
TriggerCharmWinBonus ENDP
|
|
|
|
TriggerCharmBulletProtection PROC
|
|
cmp obsActive3D,0
|
|
jne artifact_bullet_none
|
|
cmp tournamentMode,0
|
|
je artifact_bullet_normal
|
|
cmp towerBulletUses3D,0
|
|
je artifact_bullet_none
|
|
dec towerBulletUses3D
|
|
invoke CopyString3D,OFFSET towerBulletMessage3D,OFFSET flashMessage
|
|
mov flashTimer,140
|
|
mov eax,1
|
|
ret
|
|
artifact_bullet_normal:
|
|
test charmEnabledMask3D,4
|
|
jz artifact_bullet_none
|
|
cmp charmSkullUses,0
|
|
je artifact_bullet_none
|
|
dec charmSkullUses
|
|
invoke CopyString3D,OFFSET msgCharmSkullSave,OFFSET flashMessage
|
|
mov flashTimer,140
|
|
call SaveProgress3D
|
|
mov eax,1
|
|
ret
|
|
artifact_bullet_none:
|
|
xor eax,eax
|
|
ret
|
|
TriggerCharmBulletProtection ENDP
|