|  |  |  | 
|---|
|  |  |  | import ChConfig | 
|---|
|  |  |  | import IPY_GameWorld | 
|---|
|  |  |  | import IpyGameDataPY | 
|---|
|  |  |  | import SkillCommon | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 关于血量的函数这里只包装最简单的超DWORD处理 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | # #  目前当目标身上多个buff都有同一效果时(如定身),在一个buff消失时会解除该状态 | 
|---|
|  |  |  | # #  故该状态标记仅为一个非精确的标记,应用中请注意!!!(当且仅当多个buff有同一个效果时会提前结束该状态) | 
|---|
|  |  |  | #=============================================================================== | 
|---|
|  |  |  | def GetPyPlayerState(gameObj, pyState): | 
|---|
|  |  |  | def GetPyPlayerState(gameObj, pyState, ownerID = 0, ownerType = 0): | 
|---|
|  |  |  | curState = gameObj.GetDictByKey(ChConfig.Def_PlayerKey_CurState) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | state = curState & pow(2, pyState) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if state and ownerID: | 
|---|
|  |  |  | # 进一步判断是否释放者 | 
|---|
|  |  |  | return True if IsInStateEffectByOwner(gameObj, ChConfig.Def_Skill_Effect_BuffState, pyState, ownerID, ownerType) else False | 
|---|
|  |  |  | return state | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 大于等于2个状态 则不清理状态 | 
|---|
|  |  |  | def IsInStateEffectByOwner(curObj, effectID, stateType, ownerID, ownerType): | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for buffType in xrange(IPY_GameWorld.bfBuff, IPY_GameWorld.btBufMax): | 
|---|
|  |  |  | if buffType in ChConfig.Def_BuffType_OnlyPlayer: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  |  | 
|---|
|  |  |  | buffTuple = SkillCommon.GetBuffManagerByBuffType(curObj, buffType) | 
|---|
|  |  |  | #通过类型获取目标的buff管理器为空,则跳出 | 
|---|
|  |  |  | if buffTuple == (): | 
|---|
|  |  |  | continue | 
|---|
|  |  |  |  | 
|---|
|  |  |  | buffManager = buffTuple[0] | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for i in range(buffManager.GetEffectCount()): | 
|---|
|  |  |  | effect = buffManager.GetEffect(i) | 
|---|
|  |  |  | if not effect: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if effect.GetEffectID() != effectID: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if effect.GetEffectValue(0) != stateType: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if buffManager.GetEffectOwnerID() != ownerID: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if buffManager.GetEffectOwnerType() != ownerType: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return True | 
|---|
|  |  |  | return False | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def ClearPyPlayerState(gameObj): | 
|---|
|  |  |  | gameObj.SetDict(ChConfig.Def_PlayerKey_CurState, 0) | 
|---|
|  |  |  | return | 
|---|