2013-07-29 11:13:03 +00:00
|
|
|
|
|
|
|
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
|
|
|
|
|
|
|
|
#include "Blaze.h"
|
2013-11-04 20:46:56 +00:00
|
|
|
#include "../World.h"
|
2014-04-28 00:03:06 +00:00
|
|
|
#include "../Entities/FireChargeEntity.h"
|
2013-07-29 11:13:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cBlaze::cBlaze(void) :
|
2014-06-07 07:40:01 +00:00
|
|
|
super("Blaze", mtBlaze, "mob.blaze.hit", "mob.blaze.death", 0.6, 1.8)
|
2013-07-29 11:13:03 +00:00
|
|
|
{
|
2015-03-30 23:42:32 +00:00
|
|
|
SetGravity(-8.0f);
|
2015-03-31 15:03:35 +00:00
|
|
|
SetAirDrag(0.05f);
|
2013-07-29 11:13:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void cBlaze::GetDrops(cItems & a_Drops, cEntity * a_Killer)
|
|
|
|
{
|
2014-10-20 20:55:07 +00:00
|
|
|
if ((a_Killer != nullptr) && (a_Killer->IsPlayer() || a_Killer->IsA("cWolf")))
|
2014-02-23 18:44:58 +00:00
|
|
|
{
|
2015-05-19 18:32:10 +00:00
|
|
|
unsigned int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
|
2014-02-23 18:44:58 +00:00
|
|
|
AddRandomDropItem(a_Drops, 0, 1 + LootingLevel, E_ITEM_BLAZE_ROD);
|
|
|
|
}
|
2013-07-29 11:13:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-11-04 20:46:56 +00:00
|
|
|
|
2015-11-08 12:44:17 +00:00
|
|
|
bool cBlaze::Attack(std::chrono::milliseconds a_Dt)
|
2013-11-04 20:46:56 +00:00
|
|
|
{
|
2016-02-01 20:49:34 +00:00
|
|
|
if ((GetTarget() != nullptr) && (m_AttackCoolDownTicksLeft == 0))
|
2013-11-04 20:46:56 +00:00
|
|
|
{
|
|
|
|
// Setting this higher gives us more wiggle room for attackrate
|
|
|
|
Vector3d Speed = GetLookVector() * 20;
|
|
|
|
Speed.y = Speed.y + 1;
|
|
|
|
cFireChargeEntity * FireCharge = new cFireChargeEntity(this, GetPosX(), GetPosY() + 1, GetPosZ(), Speed);
|
2014-10-20 20:55:07 +00:00
|
|
|
if (FireCharge == nullptr)
|
2013-11-04 20:46:56 +00:00
|
|
|
{
|
2015-11-08 12:44:17 +00:00
|
|
|
return false;
|
2013-11-04 20:46:56 +00:00
|
|
|
}
|
2014-06-08 19:58:08 +00:00
|
|
|
if (!FireCharge->Initialize(*m_World))
|
2013-11-04 20:46:56 +00:00
|
|
|
{
|
|
|
|
delete FireCharge;
|
2014-10-20 20:55:07 +00:00
|
|
|
FireCharge = nullptr;
|
2015-11-08 12:44:17 +00:00
|
|
|
return false;
|
2013-11-04 20:46:56 +00:00
|
|
|
}
|
2016-01-12 10:11:10 +00:00
|
|
|
ResetAttackCooldown();
|
2013-11-04 20:46:56 +00:00
|
|
|
// ToDo: Shoot 3 fireballs instead of 1.
|
2015-11-08 12:44:17 +00:00
|
|
|
return true;
|
2013-11-04 20:46:56 +00:00
|
|
|
}
|
2015-11-08 12:44:17 +00:00
|
|
|
return false;
|
2014-03-25 17:15:05 +00:00
|
|
|
}
|