diff options
Diffstat (limited to 'src/Mobs/Blaze.cpp')
-rw-r--r-- | src/Mobs/Blaze.cpp | 51 |
1 files changed, 22 insertions, 29 deletions
diff --git a/src/Mobs/Blaze.cpp b/src/Mobs/Blaze.cpp index 5778c7ef2..34c784737 100644 --- a/src/Mobs/Blaze.cpp +++ b/src/Mobs/Blaze.cpp @@ -6,12 +6,33 @@ #include "../Entities/FireChargeEntity.h" +void FireballShootingFunction(cBehaviorAttackerRanged & a_Behavior, + cMonster & a_Attacker, cPawn & a_Attacked) +{ + UNUSED(a_Behavior); + + // Setting this higher gives us more wiggle room for attackrate + Vector3d Speed = a_Attacker.GetLookVector() * 4; + Speed.y = Speed.y + 3; + + auto FireCharge = cpp14::make_unique<cFireChargeEntity>(&a_Attacker, + a_Attacked.GetPosX(), a_Attacked.GetPosY() + 1, a_Attacked.GetPosZ(), Speed); + auto FireChargePtr = FireCharge.get(); + FireChargePtr->Initialize(std::move(FireCharge), *(a_Attacker.GetWorld())); +} + + + cBlaze::cBlaze(void) : - super(mtBlaze, "entity.blaze.hurt", "entity.blaze.death", 0.6, 1.8) + super(mtBlaze, "entity.blaze.hurt", "entity.blaze.death", 0.6, 1.8), + m_BehaviorAttackerRanged(FireballShootingFunction, 3, 5) { m_EMPersonality = AGGRESSIVE; + m_BehaviorAttackerRanged.AttachToMonster(*this); + m_BehaviorDoNothing.AttachToMonster(*this); + m_BehaviorAggressive.AttachToMonster(*this); SetGravity(-8.0f); SetAirDrag(0.05f); GetMonsterConfig("Blaze"); @@ -29,31 +50,3 @@ void cBlaze::GetDrops(cItems & a_Drops, cEntity * a_Killer) AddRandomDropItem(a_Drops, 0, 1 + LootingLevel, E_ITEM_BLAZE_ROD); } } - - - - -// mobTODO -/* -bool cBlaze::Attack(std::chrono::milliseconds a_Dt) -{ - if ((GetTarget() != nullptr) && (m_AttackCoolDownTicksLeft == 0)) - { - // Setting this higher gives us more wiggle room for attackrate - Vector3d Speed = GetLookVector() * 20; - Speed.y = Speed.y + 1; - - auto FireCharge = cpp14::make_unique<cFireChargeEntity>(this, GetPosX(), GetPosY() + 1, GetPosZ(), Speed); - auto FireChargePtr = FireCharge.get(); - if (!FireChargePtr->Initialize(std::move(FireCharge), *m_World)) - { - return false; - } - - ResetAttackCooldown(); - // ToDo: Shoot 3 fireballs instead of 1. - - return true; - } - return false; -}*/ |