#include "stinc.h"
#include "stgame.h"
#include "stgameaow.h"

gzGameAow::gzGameAow()
{
	this->RegisterEvent(EVT_OBJECT_DAMAGE);
}
void gzGameAow::Object_Damaged(gzEventObjectDamage &evt)
{
	if (evt.m_defender && evt.m_defender->As_BuildingGameObj())
	{
		// Hourglass hill attack blocker
		if (!gzGameMgr->m_settings->m_AllowHillAttack)
		{
			if (evt.m_damage > 0.0f && evt.m_attacker && evt.m_attacker->As_SmartGameObj() && evt.m_attacker->As_SmartGameObj()->Player)
			{
				if (!stricmp(cGame->MapName.m_Buffer, "C&C_Hourglass.mix"))
				{
					nc_Vector3 pos;
					evt.m_attacker->Get_Position(&pos);
					if (pos.Z >= 33.0f)
						evt.Skip();
				}
			}
		}
		if (this->m_settings->m_EnableInvincibleBuildings)
			evt.Skip();
	}
}
