Refactored the TakeDamage API to take equipped weapon and armor into consideration (PvP untested)
http://forum.mc-server.org/showthread.php?tid=625 git-svn-id: http://mc-server.googlecode.com/svn/trunk@1087 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
@@ -28,8 +28,8 @@
|
||||
|
||||
|
||||
|
||||
cMonster::cMonster()
|
||||
: m_Target(0)
|
||||
cMonster::cMonster(void)
|
||||
: m_Target(NULL)
|
||||
, m_bMovingToDestination(false)
|
||||
, m_DestinationTime( 0 )
|
||||
, m_Gravity( -9.81f)
|
||||
@@ -318,20 +318,23 @@ void cMonster::HandlePhysics(float a_Dt)
|
||||
|
||||
|
||||
|
||||
void cMonster::TakeDamage(int a_Damage, cEntity* a_Instigator)
|
||||
void cMonster::DoTakeDamage(TakeDamageInfo & a_TDI)
|
||||
{
|
||||
cPawn::TakeDamage( a_Damage, a_Instigator );
|
||||
m_Target = a_Instigator;
|
||||
AddReference( m_Target );
|
||||
super::DoTakeDamage(a_TDI);
|
||||
if (a_TDI.Attacker != NULL)
|
||||
{
|
||||
m_Target = a_TDI.Attacker;
|
||||
AddReference(m_Target);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cMonster::KilledBy( cEntity* a_Killer )
|
||||
void cMonster::KilledBy(cPawn * a_Killer)
|
||||
{
|
||||
cPawn::KilledBy( a_Killer );
|
||||
super::KilledBy(a_Killer);
|
||||
m_DestroyTimer = 0;
|
||||
}
|
||||
|
||||
@@ -513,7 +516,7 @@ void cMonster::Attack(float a_Dt)
|
||||
{
|
||||
// Setting this higher gives us more wiggle room for attackrate
|
||||
m_AttackInterval = 0.0;
|
||||
((cPawn *)m_Target)->TakeDamage((int)m_AttackDamage, this);
|
||||
((cPawn *)m_Target)->TakeDamage(*this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user