/TGame/TCommon/Gene/Status/GECharm.cpp

http://awoe.googlecode.com/ · C++ · 53 lines · 40 code · 6 blank · 7 comment · 7 complexity · 9cb18974042345b26af0602a1bc99414 MD5 · raw file

  1. ///////////////////////////////////////////////////////////////////////////////////////////////////
  2. // GECharm.cpp
  3. // 2010?1?20?
  4. // Copyright ?2007, 2010, 8DWorld, Inc. All rights reserved.
  5. //
  6. //
  7. ///////////////////////////////////////////////////////////////////////////////////////////////////
  8. #include "stdafx.h"
  9. #include "GECharm.h"
  10. #include "Entity/EntityIf.h"
  11. #include "Combat/CombatSysIf.h"
  12. #include "Gene/GeneCreateDataIf.h"
  13. GECharm::GECharm()
  14. {
  15. }
  16. bool
  17. GECharm::onAttach()
  18. {
  19. if (!__super::onAttach())
  20. {
  21. return false;
  22. }
  23. if (m_wpHost->getType()==Entity::ett_Monster)
  24. {
  25. m_wpCombat->setFaction(Combat::FC_Player);
  26. }
  27. else if (m_wpHost->getType()==Entity::ett_Player)
  28. {
  29. m_wpCombat->setState(Combat::CBS_Forbidden);
  30. m_wpHost->setMoveState(Move::mst_Freeze);
  31. }
  32. return true;
  33. }
  34. bool
  35. GECharm::onDetach()
  36. {
  37. if (m_wpHost->getType()==Entity::ett_Monster)
  38. {
  39. m_wpCombat->setFaction(Combat::FC_Player);
  40. }
  41. else if (m_wpHost->getType()==Entity::ett_Player)
  42. {
  43. m_wpCombat->setState(Combat::CBS_Ready);
  44. m_wpHost->setMoveState(Move::mst_Idle);
  45. }
  46. return __super::onDetach();
  47. }