// File: /workspace/github_cpp_makefile_star2_O2/wrighteagle2d[P]wrighteaglebase/Debug/../src/WorldState.cpp
// Function: WorldStateUpdater::UpdateSelfSense()
void WorldStateUpdater::UpdateSelfSense() {
  SelfState().UpdateNeckDir(PlayerParam::instance().ConvertAngle(
      mpObserver->Sense().GetNeckDir())); //这个即使没有视觉也要更新

  SelfState().UpdateStamina(mpObserver->Sense().GetStamina()); //更新体力
  SelfState().UpdateEffort(mpObserver->Sense().GetEffort());   //更新effort
  SelfState().UpdateCapacity(
      mpObserver->Sense().GetCapacity()); //更新就体力容量

  // update recovery
  double buff = Min(SelfState().GetRecovery() * SelfState().GetStaminaIncMax(),
                    SelfState().GetCapacity());
  buff = ((int)(buff * 100)) / 100.0; //精度设置为0.01 太精确了会影响计算
  if (mpObserver->CurrentTime().T() > 0 &&
      mpObserver->Sense().GetStamina() - buff <
          ServerParam::instance().staminaMax() *
              ServerParam::instance().recoverDecThr()) {
    double recovery =
        SelfState().GetRecovery() - ServerParam::instance().recoverDec();
    if (recovery < ServerParam::instance().recoverMin()) {
      recovery = ServerParam::instance().recoverMin();
    }

    if (mpObserver->CurrentTime().T() % ServerParam::instance().halfTime() ==
            0 &&
        ServerParam::instance().nrNormalHalfs() >= 0 &&
        mpObserver->CurrentTime().T() <
            ServerParam::instance().halfTime() *
                ServerParam::instance().nrNormalHalfs()) {
      recovery = 1.0;
    }

    SelfState().UpdateRecovery(recovery);
  }

  //更新自己的tackleban
  SelfState().UpdateTackleBan(mpObserver->Sense().GetTackleExpires());
  SelfState().UpdateFoulChargedCycle(mpObserver->Sense().GetFoulChargedCycle());

  //更新自己的catchban 暂时没有

  //更新自己的armpoint
  if (mpObserver->Sense().GetArmMovableBan() > 0) {
    SelfState().UpdateArmPoint(mpObserver->Sense().GetArmTargetDir(), 0, 1,
                               mpObserver->Sense().GetArmTargetDist(),
                               mpObserver->Sense().GetArmMovableBan(),
                               mpObserver->Sense().GetArmExpires());
  } else {
    SelfState().UpdateArmPoint(
        mpObserver->Sense().GetArmTargetDir(), SelfState().GetArmPointDelay(),
        SelfState().GetArmPointConf(), mpObserver->Sense().GetArmTargetDist(),
        mpObserver->Sense().GetArmMovableBan(),
        mpObserver->Sense().GetArmExpires());
  }

  //更新自己的FocusOn
  SelfState().UpdateFocusOn(mpObserver->Sense().GetFocusSide(),
                            mpObserver->Sense().GetFocusUnum());

  //更新自己的视角
  SelfState().UpdateViewWidth(mpObserver->Sense().GetViewWidth());

  SelfState().UpdateCardType(mpObserver->Sense().GetCardType());
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movslq 0x14(%rdi), %rax
movq 0x8(%rdi), %rcx
imulq $0x178, %rax, %rax      # imm = 0x178
leaq (%rax,%rcx), %r14
addq $-0xd0, %r14
callq 0x38d94
movq (%rbx), %rax
movsd 0x150(%rax), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x5183a
addsd 0x6010(%rip), %xmm0     # 0x57848
jmp 0x51848
ucomisd %xmm0, %xmm1
jbe 0x51848
addsd 0x5818(%rip), %xmm0     # 0x57060
movsd 0x57f8(%rip), %xmm1     # 0x57048
movq %r14, %rdi
xorl %esi, %esi
callq 0x382f8
movslq 0x14(%rbx), %rax
movq (%rbx), %rcx
movq 0x8(%rbx), %rdx
imulq $0x178, %rax, %rax      # imm = 0x178
leaq (%rax,%rdx), %rdi
addq $-0xd0, %rdi
movsd 0x128(%rcx), %xmm0
movsd %xmm0, 0x78(%rdi)
movsd 0x130(%rcx), %xmm0
movsd %xmm0, 0x80(%rdi)
movsd 0x138(%rcx), %xmm0
movsd %xmm0, 0x88(%rdi)
movsd 0x90(%rdi), %xmm0
movsd %xmm0, -0x20(%rbp)
callq 0x1cd18
movq (%rbx), %rsi
movq 0x8(%rbx), %rcx
cmpl $0x0, 0xc(%rsi)
movl 0x14(%rbx), %edx
jle 0x519d3
movslq %edx, %rdx
imulq $0x178, %rdx, %rdx      # imm = 0x178
movsd -0x20(%rbp), %xmm1
mulsd (%rax), %xmm1
movsd -0x48(%rcx,%rdx), %xmm0
minsd %xmm1, %xmm0
movsd 0x5e19(%rip), %xmm1     # 0x57708
mulsd %xmm1, %xmm0
cvttpd2dq %xmm0, %xmm0
cvtdq2pd %xmm0, %xmm0
divsd %xmm1, %xmm0
movsd 0x128(%rsi), %xmm1
subsd %xmm0, %xmm1
movsd %xmm1, -0x20(%rbp)
callq 0x3db2c
movsd 0x3048(%rax), %xmm0
movsd %xmm0, -0x28(%rbp)
callq 0x3db2c
movsd -0x28(%rbp), %xmm0
mulsd 0x3060(%rax), %xmm0
ucomisd -0x20(%rbp), %xmm0
movl 0x14(%rbx), %edx
movq 0x8(%rbx), %rcx
jbe 0x519d3
movslq %edx, %rax
imulq $0x178, %rax, %rax      # imm = 0x178
movsd -0x40(%rcx,%rax), %xmm0
movsd %xmm0, -0x20(%rbp)
callq 0x3db2c
movsd -0x20(%rbp), %xmm0
subsd 0x3070(%rax), %xmm0
movsd %xmm0, -0x20(%rbp)
callq 0x3db2c
movsd 0x3068(%rax), %xmm0
ucomisd -0x20(%rbp), %xmm0
jbe 0x51998
callq 0x3db2c
movsd 0x3068(%rax), %xmm0
movsd %xmm0, -0x20(%rbp)
movq (%rbx), %rax
movl 0xc(%rax), %r14d
callq 0x3db2c
movq %rax, %rcx
movl %r14d, %eax
cltd
idivl 0x3238(%rcx)
testl %edx, %edx
je 0x51ae2
movslq 0x14(%rbx), %rdx
movq 0x8(%rbx), %rcx
imulq $0x178, %rdx, %rax      # imm = 0x178
movsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x40(%rcx,%rax)
decl %edx
movslq %edx, %rax
imulq $0x178, %rax, %rax      # imm = 0x178
leaq (%rcx,%rax), %rdi
addq $0xa8, %rdi
movq (%rbx), %rax
movl 0x1a0(%rax), %ecx
movl %ecx, 0xc8(%rdi)
movl 0x1ac(%rax), %ecx
movl %ecx, 0x124(%rdi)
movl 0x178(%rax), %edx
movsd 0x188(%rax), %xmm0
testl %edx, %edx
jle 0x51a31
movsd 0x180(%rax), %xmm2
movl 0x17c(%rax), %ecx
movsd 0x561b(%rip), %xmm1     # 0x57048
xorl %esi, %esi
jmp 0x51a4d
movl 0xe8(%rdi), %esi
movsd 0xf0(%rdi), %xmm1
movsd 0x180(%rax), %xmm2
movl 0x17c(%rax), %ecx
callq 0x3834a
movslq 0x14(%rbx), %rax
movq (%rbx), %rcx
movq 0x8(%rbx), %rdx
movzbl 0x194(%rcx), %esi
movl 0x198(%rcx), %ecx
shlq $0x20, %rcx
orq %rsi, %rcx
imulq $0x178, %rax, %rax      # imm = 0x178
movq %rcx, 0x28(%rax,%rdx)
andl $0x0, 0x30(%rax,%rdx)
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
movq %rcx, 0x38(%rax,%rdx)
movslq 0x14(%rbx), %rcx
movq (%rbx), %rdx
movq 0x8(%rbx), %rax
imulq $0x178, %rcx, %rcx      # imm = 0x178
movl 0x120(%rdx), %esi
movl %esi, 0x48(%rcx,%rax)
movl 0x1a8(%rdx), %edx
movl 0xa0(%rcx,%rax), %esi
testl %esi, %esi
je 0x51ac8
cmpl $0x2, %edx
jne 0x51ad7
cmpl $0x1, %esi
jne 0x51ad7
addq %rcx, %rax
addq $-0xd0, %rax
movl %edx, 0x170(%rax)
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x3db2c
cmpl $0x0, 0x3240(%rax)
js 0x519b9
movq (%rbx), %rax
movl 0xc(%rax), %r14d
callq 0x3db2c
movl 0x3238(%rax), %r15d
callq 0x3db2c
imull 0x3240(%rax), %r15d
cmpl %r15d, %r14d
jge 0x519b9
movsd 0x5523(%rip), %xmm0     # 0x57048
movsd %xmm0, -0x20(%rbp)
jmp 0x519b9
nop