PageRenderTime 21ms CodeModel.GetById 16ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/TGame/TCommon/Gene/Status/GEStance.cpp

http://awoe.googlecode.com/
C++ | 85 lines | 60 code | 14 blank | 11 comment | 7 complexity | 64241e5324177ae1662d83a7c04b9ebe MD5 | raw file
 1///////////////////////////////////////////////////////////////////////////////////////////////////
 2// GEStance.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 "GEStance.h"
13#include "Entity/EntityIf.h"
14#include "Combat/CombatSysIf.h"
15#include "Gene/GeneCreateDataIf.h"
16
17GEStance::GEStance()
18{
19}
20
21GEStance::~GEStance()
22{
23
24}
25
26bool
27GEStance::onAttach()
28{
29	if (!__super::onAttach())
30	{
31		return false;
32	}
33
34	//
35	//	ImmunityElement
36	int nKey = m_wpSData->getData( ArgIdx_ImmuneElementType, -1);
37	if (nKey!=-1)
38	{
39		m_wpCombat->addImmunity(nKey);
40	}
41
42	for (int idx = ArgIdx_ImmuneGeneCategoryStart; idx<ArgIdx_ImmuneGeneCategoryEnd; idx++)
43	{
44		nKey = m_wpSData->getData( idx, -1);
45		if (nKey!=-1)
46		{
47			m_wpCombat->rmvImmunity(nKey);
48		}
49		else
50		{
51			break;
52		}
53	}
54
55	return true;
56}
57
58bool
59GEStance::onDetach()
60{
61	__super::onDetach();
62
63	//
64	//	ImmunityElement
65	int nKey = m_wpSData->getData( ArgIdx_ImmuneElementType, -1);
66	if (nKey!=-1)
67	{
68		m_wpCombat->rmvImmunity(nKey);
69	}
70
71	for (int idx = ArgIdx_ImmuneGeneCategoryStart; idx<ArgIdx_ImmuneGeneCategoryEnd; idx++)
72	{
73		nKey = m_wpSData->getData( idx, -1);
74		if (nKey!=-1)
75		{
76			m_wpCombat->rmvImmunity(nKey);
77		}
78		else
79		{
80			break;
81		}
82	}
83
84	return true;
85}