2012-12-21 06:04:08 -05:00
2011-12-25 17:47:12 -05:00
# pragma once
2012-09-23 16:53:08 -04:00
# include "Monster.h"
2011-12-25 17:47:12 -05:00
2012-12-21 06:04:08 -05:00
class cPassiveMonster :
public cMonster
2011-12-25 17:47:12 -05:00
{
2012-12-21 06:04:08 -05:00
typedef cMonster super ;
2015-11-30 04:07:55 -05:00
2011-12-25 17:47:12 -05:00
public :
2014-09-17 13:40:10 -04:00
cPassiveMonster ( const AString & a_ConfigName , eMonsterType a_MobType , const AString & a_SoundHurt , const AString & a_SoundDeath , double a_Width , double a_Height ) ;
2012-12-21 06:04:08 -05:00
2015-01-11 16:12:26 -05:00
virtual void Tick ( std : : chrono : : milliseconds a_Dt , cChunk & a_Chunk ) override ;
2015-11-29 13:13:31 -05:00
virtual void OnRightClicked ( cPlayer & a_Player ) override ;
2012-12-21 06:04:08 -05:00
2015-07-31 10:49:10 -04:00
/** When hit by someone, run away */
2014-04-25 18:32:30 -04:00
virtual bool DoTakeDamage ( TakeDamageInfo & a_TDI ) override ;
2015-07-31 10:49:10 -04:00
2015-11-14 10:42:26 -05:00
/** Returns the items that the animal of this class follows when a player holds it in hand. */
virtual void GetFollowedItems ( cItems & a_Items ) { }
2014-01-29 13:15:26 -05:00
2015-11-29 13:13:31 -05:00
/** Returns the items that make the animal breed - this is usually the same as the ones that make the animal follow, but not necessarily. */
virtual void GetBreedingItems ( cItems & a_Items ) { GetFollowedItems ( a_Items ) ; }
2015-12-12 14:55:58 -05:00
/** Called after the baby is born, allows the baby to inherit the parents' properties (color, etc.) */
virtual void InheritFromParents ( cPassiveMonster * a_Parent1 , cPassiveMonster * a_Parent2 ) { }
2015-11-30 04:07:55 -05:00
/** Returns the partner which the monster is currently mating with. */
2015-11-29 13:13:31 -05:00
cPassiveMonster * GetPartner ( void ) const { return m_LovePartner ; }
2015-11-30 04:07:55 -05:00
/** Start the mating process. Causes the monster to keep bumping into the partner until m_MatingTimer reaches zero. */
2015-11-29 13:13:31 -05:00
void EngageLoveMode ( cPassiveMonster * a_Partner ) ;
2015-11-30 04:07:55 -05:00
/** Finish the mating process. Called after a baby is born. Resets all breeding related timers and sets m_LoveCooldown to 20 minutes. */
2015-11-29 13:13:31 -05:00
void ResetLoveMode ( ) ;
2015-11-30 04:07:55 -05:00
/** Returns whether the monster has just been fed and is ready to mate. If this is "true" and GetPartner isn't "nullptr", then the monster is mating. */
2015-11-29 13:13:31 -05:00
bool IsInLove ( ) const { return ( m_LoveTimer > 0 ) ; }
2015-11-30 04:07:55 -05:00
/** Returns whether the monster is tired of breeding and is in the cooldown state. */
2015-11-29 13:13:31 -05:00
bool IsInLoveCooldown ( ) const { return ( m_LoveCooldown > 0 ) ; }
protected :
2015-11-30 04:07:55 -05:00
/** The monster's breeding partner. */
2015-11-29 13:13:31 -05:00
cPassiveMonster * m_LovePartner ;
2015-11-30 04:07:55 -05:00
/** If above 0, the monster is in love mode, and will breed if a nearby monster is also in love mode. Decrements by 1 per tick till reaching zero. */
2015-11-29 13:13:31 -05:00
int m_LoveTimer ;
2015-11-30 04:07:55 -05:00
/** If above 0, the monster is in cooldown mode and will refuse to breed. Decrements by 1 per tick till reaching zero. */
2015-11-29 13:13:31 -05:00
int m_LoveCooldown ;
2015-11-30 04:07:55 -05:00
/** The monster is engaged in mating, once this reaches zero, a baby will be born. Decrements by 1 per tick till reaching zero, then a baby is made and ResetLoveMode() is called. */
2015-11-29 13:13:31 -05:00
int m_MatingTimer ;
} ;
2012-12-21 06:04:08 -05:00
2011-12-25 17:47:12 -05:00