PageRenderTime 20ms CodeModel.GetById 11ms app.highlight 5ms RepoModel.GetById 2ms app.codeStats 0ms

/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
 9
10
11#include "stdafx.h"
12#include "GECharm.h"
13#include "Entity/EntityIf.h"
14#include "Combat/CombatSysIf.h"
15#include "Gene/GeneCreateDataIf.h"
16
17GECharm::GECharm() 
18{
19}
20bool
21GECharm::onAttach()
22{
23	if (!__super::onAttach())
24	{
25		return false;
26	}
27
28	if (m_wpHost->getType()==Entity::ett_Monster)
29	{
30		m_wpCombat->setFaction(Combat::FC_Player);
31	}
32	else if (m_wpHost->getType()==Entity::ett_Player)
33	{
34		m_wpCombat->setState(Combat::CBS_Forbidden);
35		m_wpHost->setMoveState(Move::mst_Freeze);
36	}
37	return true;
38}
39
40bool
41GECharm::onDetach()
42{
43	if (m_wpHost->getType()==Entity::ett_Monster)
44	{
45		m_wpCombat->setFaction(Combat::FC_Player);
46	}
47	else if (m_wpHost->getType()==Entity::ett_Player)
48	{
49		m_wpCombat->setState(Combat::CBS_Ready);
50		m_wpHost->setMoveState(Move::mst_Idle);
51	}
52	return __super::onDetach();
53}