diff options
author | LogicParrot <LogicParrot@users.noreply.github.com> | 2017-09-02 15:30:55 +0200 |
---|---|---|
committer | LogicParrot <LogicParrot@users.noreply.github.com> | 2017-09-02 15:30:55 +0200 |
commit | e8dd3278eaf66a49eea74769d1215944d6985d58 (patch) | |
tree | 1c2bf2cb4ea065586daf1812f43725f6689dac1c /src/Mobs/Behaviors/BehaviorAttackerSuicideBomber.cpp | |
parent | squsshme (diff) | |
download | cuberite-e8dd3278eaf66a49eea74769d1215944d6985d58.tar cuberite-e8dd3278eaf66a49eea74769d1215944d6985d58.tar.gz cuberite-e8dd3278eaf66a49eea74769d1215944d6985d58.tar.bz2 cuberite-e8dd3278eaf66a49eea74769d1215944d6985d58.tar.lz cuberite-e8dd3278eaf66a49eea74769d1215944d6985d58.tar.xz cuberite-e8dd3278eaf66a49eea74769d1215944d6985d58.tar.zst cuberite-e8dd3278eaf66a49eea74769d1215944d6985d58.zip |
Diffstat (limited to 'src/Mobs/Behaviors/BehaviorAttackerSuicideBomber.cpp')
-rw-r--r-- | src/Mobs/Behaviors/BehaviorAttackerSuicideBomber.cpp | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/src/Mobs/Behaviors/BehaviorAttackerSuicideBomber.cpp b/src/Mobs/Behaviors/BehaviorAttackerSuicideBomber.cpp index ddf30326a..a704e77da 100644 --- a/src/Mobs/Behaviors/BehaviorAttackerSuicideBomber.cpp +++ b/src/Mobs/Behaviors/BehaviorAttackerSuicideBomber.cpp @@ -12,8 +12,7 @@ cBehaviorAttackerSuicideBomber::cBehaviorAttackerSuicideBomber() : m_bIsBlowing(false), m_bIsCharged(false), - m_BurnedWithFlintAndSteel(false), - m_ExplodingTimer(0) + m_BurnedWithFlintAndSteel(false) { } @@ -22,20 +21,11 @@ cBehaviorAttackerSuicideBomber::cBehaviorAttackerSuicideBomber() : -bool cBehaviorAttackerSuicideBomber::StrikeTarget(int a_StrikeTickCnt) +bool cBehaviorAttackerSuicideBomber::DoStrike(int a_StrikeTickCnt) { UNUSED(a_StrikeTickCnt); - ASSERT(GetTarget() != nullptr);// mobTodo guaranteed ? - if ((!TargetIsInStrikeRadius()) && (!m_BurnedWithFlintAndSteel)) - { - if (m_bIsBlowing) - { - m_bIsBlowing = false; - m_Parent->GetWorld()->BroadcastEntityMetadata(*m_Parent); - } - } // phase 1: start blowing up if (a_StrikeTickCnt == 1) @@ -48,15 +38,24 @@ bool cBehaviorAttackerSuicideBomber::StrikeTarget(int a_StrikeTickCnt) return false; } - return false; + ASSERT(m_bIsBlowing); + if (((GetTarget() == nullptr) || (!TargetIsInStrikeRadius())) && (!m_BurnedWithFlintAndSteel)) + { + m_bIsBlowing = false; + m_Parent->GetWorld()->BroadcastEntityMetadata(*m_Parent); + return true; + } if (a_StrikeTickCnt == 30) { - // mobTodo && (m_Parent->GetHealth() > 0.0) guaranteed ? + ASSERT(m_Parent->GetHealth() > 0.0); m_Parent->GetWorld()->DoExplosionAt((m_bIsCharged ? 5 : 3), m_Parent->GetPosX(), m_Parent->GetPosY(), m_Parent->GetPosZ(), false, esMonster, this); m_Parent->Destroy(); // Just in case we aren't killed by the explosion + return true; } + + return false; } @@ -77,7 +76,7 @@ void cBehaviorAttackerSuicideBomber::OnRightClicked(cPlayer & a_Player) m_bIsBlowing = true; m_Parent->GetWorld()->BroadcastEntityMetadata(*m_Parent); m_BurnedWithFlintAndSteel = true; - m_Parent->PinBehavior(this); + Strike(); } } } |