| | |
| | | import GameWorld
|
| | | import ChConfig
|
| | | import IpyGameDataPY
|
| | | #import SkillBoosts
|
| | | import SkillCommon
|
| | | import BuffSkill
|
| | | import SkillShell
|
| | |
| | | import PetControl
|
| | | import QuestCommon
|
| | |
|
| | | #GameWorld.ImportAll("Script\\Skill\\", "SkillBoosts")
|
| | | GameWorld.ImportAll("Script\\Skill\\", "PassiveBuff")
|
| | |
|
| | |
|
| | |
| | | if not mission_1:
|
| | | return
|
| | |
|
| | | if int(strIndex) > mission_1.GetProperty("OpenSkillSlots"):
|
| | | if (pow(2, int(strIndex)) & mission_1.GetProperty("OpenSkillSlots")) == 0:
|
| | | return
|
| | |
|
| | | PlayerControl.NomalDictSetProperty(curPlayer,
|
| | |
| | |
|
| | | GetPassiveEffManager().RegistPassiveBuff(curPlayer)
|
| | |
|
| | | # 助战神兽技能
|
| | | GetPassiveEffManager().RegistPassiveEffDogz(curPlayer)
|
| | |
|
| | | #-被动逻辑处理--------------------------------------------------------------------------------------------------
|
| | | ##离开地图处理
|
| | |
| | | def GetTriggerTypeByEffectID(effectID):
|
| | | # 临时配置
|
| | | tdict = {
|
| | | 2102:ChConfig.TriggerType_BeAttackOver, # 被攻击后触发 20
|
| | | 2104:ChConfig.TriggerType_LockHP, # 锁血触发技能 63
|
| | | 2105:ChConfig.TriggerType_BeLuckyHit, # 被会心一击触发技能 64
|
| | | |
| | | 4000:ChConfig.TriggerType_BuffState, # 进入4012的某个状态触发技能 2
|
| | | 4001:ChConfig.TriggerType_TagBuffState, # 目标进入4012的某个状态触发技能 2
|
| | | 4002:ChConfig.TriggerType_AddDamagePer, # 提高增加伤害属性值,计算时 3
|
| | |
| | | 4048:ChConfig.TriggerType_MissSkill, # 闪避后触发释放技能
|
| | | 4049:ChConfig.TriggerType_MissSuccessPer, # 闪避成功率提升
|
| | | 4050:ChConfig.TriggerType_OneDamage, # 伤害降低到1点
|
| | | 4051:ChConfig.TriggerType_LuckyHit, # 会心一击时增加会心伤害百分比 50
|
| | | 4052:ChConfig.TriggerType_Buff_SuckBloodPer, # 攻击 百分比吸血
|
| | | 4053:ChConfig.TriggerType_AddLayer, # BUFF层级增加时 52
|
| | | 4054:ChConfig.TriggerType_AttackAddSkillPer, # 所有攻击伤害(SkillPer)增加,含普攻,计算时 5
|
| | | 4055:ChConfig.TriggerType_StormAttackReduceCD, # 类剑刃风暴攻击后触发效果
|
| | | 4056:ChConfig.TriggerType_PassiveBuffValue, ## 被动buff值计算中二次获取被动值 54
|
| | | 4057:ChConfig.TriggerType_AttackKillHappen, ## 对被动技能斩杀的概率增强 55
|
| | | 4058:ChConfig.TriggerType_AddBuffOver, # 添加buff之后触发技能 56
|
| | | 4059:ChConfig.TriggerType_StormAttackOneByOne, # 类剑刃风暴攻击1对1触发技能 57
|
| | | 4060:ChConfig.TriggerType_StormAttackOver, # 类剑刃风暴攻击后触发技能 57
|
| | | 4061:ChConfig.TriggerType_AttackOverPassive, # 攻击(对敌技能)后被动技能被触发在其他被动效果处理后调用,触发顺序原因
|
| | | 4062:ChConfig.TriggerType_AttackAddFinalPer, # 增加最终伤害百分比 59
|
| | | 4063:ChConfig.TriggerType_SummonDie, #自身召唤兽死亡触发技能 60
|
| | | 4064:ChConfig.TriggerType_GiftReduceCD, # 天赋减少CD9, #CD
|
| | | 4065:ChConfig.TriggerType_DamageReducePVP, # PVP减少伤害
|
| | | 4066:ChConfig.TriggerType_AddDamagePer, # 提高增加伤害属性值,计算时 3
|
| | | 4067:ChConfig.TriggerType_ProDefValue, # 神兵护盾值下降时 62
|
| | | 4068:ChConfig.TriggerType_LockHP, # 锁血触发技能 63
|
| | | }
|
| | | return tdict.get(effectID, -1)
|
| | | return tdict.get(effectID, -1) |
| | | #===========================================================================
|
| | | # # 此表配置 影响类型
|
| | | # ipyData = IpyGameDataPY.GetIpyGameData('SkillEffect', effectID)
|
| | |
| | | 4511:ChConfig.TriggerType_AttackAddFinalValue, #攻击增加输出伤害11
|
| | | 4512:ChConfig.TriggerType_ReduceHurtHPPer, # 百分比减少攻击计算后伤害
|
| | | 4513:ChConfig.TriggerType_AttackAddFinalValue, #攻击增加输出伤害11
|
| | | 4515:ChConfig.TriggerType_AddIceAtkPer, # BUFF类:攻击附加真实伤害百分比 |
| | | 4515:ChConfig.TriggerType_AddIceAtkPer, # BUFF类:攻击附加真实伤害百分比
|
| | | 4516:ChConfig.TriggerType_ChangeHurtToHP, # BUFF类:buff中把受到伤害的xx%转化为生命值
|
| | | 4517:ChConfig.TriggerType_DebuffOff, # BUFF类: 抵消debuff
|
| | | 4518:ChConfig.TriggerType_ForbidenCure, # BUFF类: 禁止治疗 53
|
| | | 4519:ChConfig.TriggerType_WillDead, # BUFF类: 进入濒死状态 25
|
| | | 4520:ChConfig.TriggerType_AddLayer, # BUFF类: 目标BUFF层级增加时 52
|
| | | 4521:ChConfig.TriggerType_BeLuckyHitSubPer, # 减少受到的会心伤害 65
|
| | | |
| | | 803:ChConfig.TriggerType_BloodShield, # 血盾
|
| | | 806:ChConfig.TriggerType_BloodShield, # 血盾
|
| | | 807:ChConfig.TriggerType_BloodShield, # 血盾
|
| | | 808:ChConfig.TriggerType_BloodShield, # 血盾
|
| | | }
|
| | | return tdict.get(effectID, -1)
|
| | |
| | | self.AffectBuffDict = {} # 当前正受影响的效果buff, key为触发点
|
| | | self.AffectSkillDict = {} # 被动技能 {(触发模式, 被影响的技能ID):[被动技能ID,效果]
|
| | | self.AffectPassiveSkillSetDict = {} # 被动技能装备 {(触发模式, 被影响的技能ID):[被动技能ID,效果]
|
| | | |
| | | self.AffectDogzSkillDict = {} # 神兽助战技能
|
| | |
|
| | | #记录会影响其他技能或者被动触发释放技能的BUFF
|
| | | def AddBuffInfoByEffect(self, effect, skillID):
|
| | |
| | | return self.AffectBuffDict.get((triggerType, 0), {})
|
| | |
|
| | |
|
| | | # 重刷神兽助战技能
|
| | | def RefreshDogzBattleSkill(self):
|
| | | self.AffectDogzSkillDict = {}
|
| | | skills = FindDogzBattleSkills(self.gameObj)
|
| | | |
| | | for curSkill in skills:
|
| | | if not SkillCommon.isPassiveTriggerSkill(curSkill):
|
| | | continue
|
| | | |
| | | skillTypeID = curSkill.GetSkillTypeID()
|
| | | |
| | | connSkillID = SkillShell.GetConnectSkillID(curSkill) # 关联技能ID, 0代表不限技能
|
| | | for i in xrange(curSkill.GetEffectCount()):
|
| | | curEffect = curSkill.GetEffect(i)
|
| | | effectID = curEffect.GetEffectID()
|
| | | if effectID == 0:
|
| | | continue
|
| | | |
| | | triggerType = GetTriggerTypeByEffectID(effectID)
|
| | | if triggerType == -1:
|
| | | continue
|
| | | |
| | | key = (triggerType,connSkillID)
|
| | | if key not in self.AffectDogzSkillDict:
|
| | | self.AffectDogzSkillDict[key] = []
|
| | | |
| | | self.AffectDogzSkillDict[key].append((skillTypeID, effectID))
|
| | | |
| | | return self.AffectDogzSkillDict
|
| | | |
| | | |
| | | # 重刷可装备的被动技能
|
| | | def RefreshPassiveSkillSet(self):
|
| | | self.AffectPassiveSkillSetDict = {}
|
| | |
| | | if not SkillCommon.isPassiveTriggerSkill(curSkill):
|
| | | continue
|
| | |
|
| | | if curSkill.GetFuncType() == ChConfig.Def_SkillFuncType_FbPassiveSkill:
|
| | | # 被动技能需装备
|
| | | if curSkill.GetFuncType() in [ChConfig.Def_SkillFuncType_FbPassiveSkill,
|
| | | ChConfig.Def_SkillFuncType_Dogz]:
|
| | | # 被动技能和神兽需设置才有效
|
| | | continue
|
| | |
|
| | | skillTypeID = curSkill.GetSkillTypeID()
|
| | |
| | | ## skillList=self.AffectSkillDict.get((triggerType, connSkillID), [])再用extend会导致AffectSkillDict无限增长
|
| | | skillList.extend(self.AffectSkillDict.get((triggerType, connSkillID), []))
|
| | | skillList.extend(self.AffectPassiveSkillSetDict.get((triggerType, connSkillID), []))
|
| | | skillList.extend(self.AffectDogzSkillDict.get((triggerType, connSkillID), []))
|
| | | if connSkillID != 0 and connSkillID != ChConfig.Def_SkillID_Somersault:
|
| | | skillList.extend(self.AffectSkillDict.get((triggerType, 0), []))
|
| | | skillList.extend(self.AffectPassiveSkillSetDict.get((triggerType, 0), []))
|
| | | |
| | | skillList.extend(self.AffectDogzSkillDict.get((triggerType, 0), []))
|
| | | return skillList
|
| | |
|
| | | #所有obj的被动效果管理
|
| | |
| | | self.AddPassiveEff(gameObj, passiveEff)
|
| | | else:
|
| | | passiveEff.RefreshPassiveSkillSet()
|
| | | return
|
| | | |
| | | |
| | | # 人物需同步注册神兽技能
|
| | | def RegistPassiveEffDogz(self, gameObj):
|
| | | passiveEff = self.GetPassiveEff(gameObj)
|
| | | if not passiveEff:
|
| | | # 强制刷新所有被动技能
|
| | | passiveEff = PassiveEff(gameObj)
|
| | | if not passiveEff.RefreshDogzBattleSkill():
|
| | | return
|
| | | self.AddPassiveEff(gameObj, passiveEff)
|
| | | else:
|
| | | passiveEff.RefreshDogzBattleSkill()
|
| | | return
|
| | |
|
| | |
|
| | |
| | | # #===========================================================================
|
| | | # OnPassiveSkillTrigger(attacker, target, ChConfig.TriggerType_AttackOver, tick)
|
| | |
|
| | | # 判断PK关系是否可攻击 Def_BattleRelationType_CommNoBoss也可攻击 只是攻击无效果
|
| | | def CheckBattleRelationType(skillBattleType, battleRelationType):
|
| | | if skillBattleType in [ChConfig.Def_BattleRelationType_Comm, ChConfig.Def_BattleRelationType_CommNoBoss]:
|
| | | return True
|
| | | |
| | | #if battleRelationType in [ChConfig.Def_BattleRelationType_Comm, ChConfig.Def_BattleRelationType_CommNoBoss]:
|
| | | # return True
|
| | | |
| | | if skillBattleType != battleRelationType:
|
| | | # PK模式的判定
|
| | | return False
|
| | | return True
|
| | | #===============================================================================
|
| | | # # 判断PK关系是否可攻击 Def_BattleRelationType_CommNoBoss也可攻击 只是攻击无效果
|
| | | # def CheckBattleRelationType(skillBattleType, battleRelationType):
|
| | | # if skillBattleType in [ChConfig.Def_BattleRelationType_Comm, ChConfig.Def_BattleRelationType_CommNoBoss]:
|
| | | # return True
|
| | | # |
| | | # #if battleRelationType in [ChConfig.Def_BattleRelationType_Comm, ChConfig.Def_BattleRelationType_CommNoBoss]:
|
| | | # # return True
|
| | | # |
| | | # if skillBattleType != battleRelationType:
|
| | | # # PK模式的判定
|
| | | # return False
|
| | | # return True
|
| | | #===============================================================================
|
| | |
|
| | | # 查找被动技能时的对象
|
| | | def GetPassiveDefender(attacker, defender):
|
| | |
| | | return GameWorld.GetObj(curHurt.GetObjID(), curHurt.GetObjType())
|
| | |
|
| | |
|
| | | # 被动技能触发释放
|
| | | def OnPassiveSkillTrigger(attacker, defender, connSkill, triggerType, tick, isEnhanceSkill=False, skillIDSet=None):
|
| | | # 多种被动技能优先触发释放一个,如被动 血量40%触发无敌技能,血量一定是停留在40%
|
| | | # 先锁血,后触发技能 同 DelayUsePassiveTriggerSkill 使用
|
| | | def OnPassiveSkillLockHP(attacker, defender, connSkill, triggerType, tick, isEnhanceSkill=False):
|
| | | attacker = FindRealAttacker(attacker)
|
| | | if not attacker:
|
| | | return False
|
| | | return 0, 0
|
| | |
|
| | | stopPassiveSkill = False # 被动技能不能再触发被动技能,但可以触发天赋技能
|
| | | if connSkill:
|
| | | if not connSkill.GetFuncType():
|
| | | # 非功能类技能,避免死循环
|
| | | return False
|
| | | return 0, 0
|
| | | if SkillCommon.isPassiveSkill(connSkill):
|
| | | #GameWorld.DebugLog("被动技能不能再次触发被动技能")
|
| | | return False
|
| | | stopPassiveSkill = True
|
| | |
|
| | | if SkillCommon.GetUsingPassiveSkill(attacker) and triggerType != ChConfig.TriggerType_BuffState:
|
| | | # 防范被动技能触发的 非被动技能
|
| | | GameWorld.DebugLog("被动技能不能再次触发被动技能---%s"%triggerType)
|
| | | return
|
| | | stopPassiveSkill = True
|
| | |
|
| | | passiveEff = GetPassiveEffManager().GetPassiveEff(attacker)
|
| | | if not passiveEff:
|
| | | return False
|
| | | |
| | | return 0, 0
|
| | | |
| | | connSkillID = connSkill.GetSkillTypeID() if connSkill else 0
|
| | | skills = passiveEff.GetPassiveSkillsByTriggerType(triggerType, connSkillID)
|
| | | if not skills:
|
| | | return False
|
| | | |
| | | return 0, 0
|
| | | |
| | | defender = GetPassiveDefender(attacker, defender)
|
| | |
|
| | | # 当前战斗关系 pvp pve
|
| | | battleRelationType = AttackCommon.GetBattleRelationType(attacker, defender)
|
| | | #GameWorld.DebugLog("OnPassiveSkillTrigger-----------%s-%s"%(skills, battleRelationType))
|
| | | #GameWorld.DebugLog("OnPriorityPassiveSkillTrigger-----------%s-%s"%(skills, battleRelationType))
|
| | | |
| | | lockHPPerMax = 0 ## 取有效的最高血量
|
| | | lockHPSkillID = 0
|
| | | for skillTypeID, effectID in skills:
|
| | | if connSkillID == skillTypeID:
|
| | | continue
|
| | | curSkill = attacker.GetSkillManager().FindSkillBySkillTypeID(skillTypeID)
|
| | | if not curSkill:
|
| | | continue
|
| | |
|
| | | if stopPassiveSkill and curSkill.GetFuncType() != ChConfig.Def_SkillFuncType_GiftSkill:
|
| | | # 只有天赋才可以再次被触发
|
| | | continue |
| | | |
| | | effect = SkillCommon.GetSkillEffectByEffectID(curSkill, effectID)
|
| | | if not effect:
|
| | | continue
|
| | |
| | | continue
|
| | |
|
| | | skillBattleType = SkillCommon.GetSkillBattleType(curSkill)
|
| | | if not CheckBattleRelationType(skillBattleType, battleRelationType):
|
| | | if not AttackCommon.CheckBattleRelationType(skillBattleType, battleRelationType):
|
| | | # PK模式的判定
|
| | | continue
|
| | | |
| | | pyName = "PassiveSkill_%s" % effectID
|
| | | callFunc = GameWorld.GetExecFunc(PassiveBuff, "%s.%s" % (pyName, "CheckCanHappen"))
|
| | | if not callFunc:
|
| | | continue
|
| | | if not callFunc(attacker, defender, effect, curSkill):
|
| | | continue
|
| | | |
| | | # 最终取最高值来决定当前生命值,卡血设定
|
| | | if effect.GetEffectValue(0) > lockHPPerMax:
|
| | | lockHPPerMax = effect.GetEffectValue(0)
|
| | | lockHPSkillID = skillTypeID
|
| | | |
| | | return lockHPSkillID, lockHPPerMax
|
| | |
|
| | |
|
| | | # 锁血功能的技能 含人物和宠物
|
| | | def OnObjsPassiveSkillLockHP(attacker, defender, connSkill, triggerType, tick,):
|
| | | if attacker.GetGameObjType() != IPY_GameWorld.gotPlayer:
|
| | | return 0
|
| | | |
| | | lockHPSkillID, lockHPPerMax = OnPassiveSkillLockHP(attacker, defender, connSkill, triggerType, tick)
|
| | | rolePet = attacker.GetPetMgr().GetFightPet()
|
| | | if rolePet:
|
| | | lockHPSkillIDPet, lockHPPerMaxPet = OnPassiveSkillLockHP(rolePet, defender, connSkill, triggerType, tick)
|
| | | |
| | | if lockHPPerMax + lockHPPerMaxPet == 0:
|
| | | # 无触发
|
| | | return 0
|
| | | |
| | | # 触发宠物技能标志
|
| | | if lockHPPerMaxPet > lockHPPerMax:
|
| | | rolePet.SetDict(ChConfig.Def_PlayerKey_LockHPSkillID, lockHPSkillIDPet)
|
| | | return lockHPPerMaxPet
|
| | | |
| | | if lockHPPerMax == 0:
|
| | | return 0
|
| | | |
| | | # 触发人物技能标志
|
| | | attacker.SetDict(ChConfig.Def_PlayerKey_LockHPSkillID, lockHPSkillID)
|
| | | return lockHPPerMax
|
| | |
|
| | |
|
| | | # 从伤血延后到技能结束触发被动技能
|
| | | def DelayUsePassiveTriggerSkill(attacker, curSkill, defender, tick):
|
| | | if attacker.GetGameObjType() != IPY_GameWorld.gotPlayer:
|
| | | return
|
| | | |
| | | # 检查是宠物还是人物技能
|
| | | skillTypeID = attacker.GetDictByKey(ChConfig.Def_PlayerKey_LockHPSkillID)
|
| | | if not skillTypeID:
|
| | | rolePet = attacker.GetPetMgr().GetFightPet()
|
| | | if not rolePet:
|
| | | return
|
| | | skillTypeID = rolePet.GetDictByKey(ChConfig.Def_PlayerKey_LockHPSkillID)
|
| | | if not skillTypeID:
|
| | | return
|
| | | attacker = rolePet
|
| | | GameWorld.DebugLog("DelayUsePassiveTriggerSkill-----pet")
|
| | | |
| | | # 一定要清标志
|
| | | attacker.SetDict(ChConfig.Def_PlayerKey_LockHPSkillID, 0)
|
| | | |
| | | curSkill = attacker.GetSkillManager().FindSkillBySkillTypeID(skillTypeID)
|
| | | if not curSkill:
|
| | | return
|
| | | |
| | | GameWorld.DebugLog("DelayUsePassiveTriggerSkill-----skillTypeID-%s"%skillTypeID)
|
| | | # 设置标志避免被动技能触发被动技能, 被动当中可能会触发多种类型技能,故不用isPassiveSkill做屏蔽
|
| | | SkillCommon.SetUsingPassiveSkill(attacker, 1)
|
| | | if not SkillShell.UsePassiveTriggerSkill(attacker, curSkill, defender, tick):
|
| | | # 不管技能是否是否成功都必须进入CD
|
| | | SkillCommon.SetSkillRemainTime(curSkill, PlayerControl.GetReduceSkillCDPer(attacker), tick, attacker)
|
| | | |
| | | SkillCommon.SetUsingPassiveSkill(attacker, 0)
|
| | | return
|
| | |
|
| | |
|
| | | # 灵宠部分技能需要通过主人触发,灵宠自己触发的逻辑依然走 OnPassiveSkillTrigger
|
| | | def OnPetPassiveSkillTrigger(attacker, defender, connSkill, triggerType, tick):
|
| | | if attacker.GetGameObjType() != IPY_GameWorld.gotPlayer:
|
| | | return
|
| | | |
| | | rolePet = attacker.GetPetMgr().GetFightPet()
|
| | | #无出战宠物
|
| | | if rolePet == None:
|
| | | return
|
| | |
|
| | | OnPassiveSkillTrigger(rolePet, defender, connSkill, triggerType, tick)
|
| | |
|
| | |
|
| | | # 被动技能触发释放
|
| | | def OnPassiveSkillTrigger(attacker, defender, connSkill, triggerType, tick, isEnhanceSkill=False, skillIDSet=None):
|
| | | attacker = FindRealAttacker(attacker)
|
| | | if not attacker:
|
| | | return False
|
| | |
|
| | | stopPassiveSkill = False # 被动技能不能再触发被动技能,但可以触发天赋技能
|
| | | if connSkill:
|
| | | if not connSkill.GetFuncType():
|
| | | # 非功能类技能,避免死循环
|
| | | return False
|
| | | if SkillCommon.isPassiveSkill(connSkill):
|
| | | #GameWorld.DebugLog("被动技能不能再次触发被动技能")
|
| | | #return False
|
| | | stopPassiveSkill = True
|
| | | |
| | | if SkillCommon.GetUsingPassiveSkill(attacker) and triggerType != ChConfig.TriggerType_BuffState:
|
| | | # 防范被动技能触发的 非被动技能
|
| | | #GameWorld.DebugLog("被动技能释放中不能再次触发被动技能---%s"%triggerType)
|
| | | #return |
| | | stopPassiveSkill = True
|
| | | |
| | | passiveEff = GetPassiveEffManager().GetPassiveEff(attacker)
|
| | | if not passiveEff:
|
| | | return False
|
| | | |
| | | connSkillID = connSkill.GetSkillTypeID() if connSkill else 0
|
| | | skills = passiveEff.GetPassiveSkillsByTriggerType(triggerType, connSkillID)
|
| | | if not skills:
|
| | | return False
|
| | | |
| | | defender = GetPassiveDefender(attacker, defender)
|
| | |
|
| | | result = False
|
| | | # 当前战斗关系 pvp pve
|
| | | battleRelationType = AttackCommon.GetBattleRelationType(attacker, defender)
|
| | | #GameWorld.DebugLog("OnPassiveSkillTrigger-----------%s-%s"%(skills, battleRelationType))
|
| | | for skillTypeID, effectID in skills:
|
| | | if connSkillID == skillTypeID:
|
| | | continue
|
| | | curSkill = attacker.GetSkillManager().FindSkillBySkillTypeID(skillTypeID)
|
| | | if not curSkill:
|
| | | continue
|
| | |
|
| | | if stopPassiveSkill and curSkill.GetFuncType() != ChConfig.Def_SkillFuncType_GiftSkill:
|
| | | # 只有天赋才可以再次被触发
|
| | | continue |
| | | |
| | | effect = SkillCommon.GetSkillEffectByEffectID(curSkill, effectID)
|
| | | if not effect:
|
| | | continue
|
| | |
|
| | | if SkillCommon.RefreshSkillRemainTime(curSkill, tick):
|
| | | continue
|
| | | result = True # 代表有效触发,但不关系触发结果
|
| | | |
| | | skillBattleType = SkillCommon.GetSkillBattleType(curSkill)
|
| | | if not AttackCommon.CheckBattleRelationType(skillBattleType, battleRelationType):
|
| | | # PK模式的判定
|
| | | continue
|
| | |
|
| | |
| | | curSkill.SetRemainTime(0) # 一次攻击多次调用 ,在外层统一调用CD
|
| | | skillIDSet.add(skillTypeID)
|
| | | SkillCommon.SetUsingPassiveSkill(attacker, 0)
|
| | | |
| | | return True
|
| | | |
| | | # 代表有效触发,但不关系触发结果, 外层根据需求使用,如减少循环判断 |
| | | return result
|
| | |
|
| | |
|
| | | #ntSummon:(3)普通召唤兽,可继承主人基础属性如攻击 |
| | | #ntElf:(4)玩家替身,完全拥有玩家属性和被动功能
|
| | | #ntFairy :(7)同ntSummon,但技能可触发被动功能
|
| | |
|
| | | # ntElf 定义为人物使用对地持续性技能,并且人物可以移动,则需要ntElf做依托物的情况
|
| | | # 那么ntElf执行人物的伤害计算和被动触发效果
|
| | |
| | | return attacker
|
| | |
|
| | | npcType = attacker.GetType()
|
| | | if npcType not in [IPY_GameWorld.ntPet, IPY_GameWorld.ntElf]:
|
| | | if npcType not in [IPY_GameWorld.ntPet, IPY_GameWorld.ntElf, IPY_GameWorld.ntFairy]:
|
| | | if attacker.GetIsBoss():
|
| | | return attacker
|
| | | return
|
| | |
| | | # --宠物
|
| | | return attacker
|
| | |
|
| | | if npcType == IPY_GameWorld.ntElf:
|
| | | else:
|
| | | # ntElf 定义为人物使用对地持续性技能,并且人物可以移动,则需要ntElf做依托物的情况
|
| | | # 那么ntElf执行人物的伤害计算和被动触发效果
|
| | | attacker = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotPlayer, attacker)
|
| | |
| | | if not attacker:
|
| | | return 0
|
| | |
|
| | | stopPassiveSkill = False # 被动技能不能再触发被动技能,但可以触发天赋技能
|
| | | if connSkill and SkillCommon.isPassiveSkill(connSkill):
|
| | | #GameWorld.DebugLog("被动技能不能再次触发被动技能")
|
| | | return 0
|
| | | #return 0
|
| | | stopPassiveSkill = True
|
| | | |
| | | passiveEff = GetPassiveEffManager().GetPassiveEff(attacker)
|
| | | if not passiveEff:
|
| | | return 0
|
| | |
| | | curValue = 0
|
| | |
|
| | | for skillTypeID, effectID in skills:
|
| | | if connSkillID == skillTypeID:
|
| | | continue
|
| | | curSkill = attacker.GetSkillManager().FindSkillBySkillTypeID(skillTypeID)
|
| | | if not curSkill:
|
| | | continue
|
| | | if stopPassiveSkill and curSkill.GetFuncType() != ChConfig.Def_SkillFuncType_GiftSkill:
|
| | | # 只有天赋才可以再次被触发
|
| | | continue |
| | | |
| | | if curSkill.GetCoolDownTime() and SkillCommon.RefreshSkillRemainTime(curSkill, tick):
|
| | | #有配置CD的才判断
|
| | | continue
|
| | |
| | | if not effect:
|
| | | continue
|
| | | skillBattleType = SkillCommon.GetSkillBattleType(curSkill)
|
| | | if not CheckBattleRelationType(skillBattleType, battleRelationType):
|
| | | if not AttackCommon.CheckBattleRelationType(skillBattleType, battleRelationType):
|
| | | continue
|
| | |
|
| | | pyName = "PassiveSkill_%s" % effectID
|
| | | |
| | |
|
| | | callFunc = GameWorld.GetExecFunc(PassiveBuff, "%s.%s" % (pyName, "CheckCanHappen"))
|
| | |
|
| | | # 条件不满足
|
| | |
| | | #tick = GameWorld.GetGameWorld().GetTick()
|
| | | skillList = []
|
| | | for skillTypeID, effectID in skills:
|
| | | if connSkillID == skillTypeID:
|
| | | continue
|
| | | curSkill = attacker.GetSkillManager().FindSkillBySkillTypeID(skillTypeID)
|
| | | #if SkillCommon.RefreshSkillRemainTime(curSkill, tick):
|
| | | # continue
|
| | |
| | | if not effect:
|
| | | continue
|
| | | skillBattleType = SkillCommon.GetSkillBattleType(curSkill)
|
| | | if not CheckBattleRelationType(skillBattleType, battleRelationType):
|
| | | if not AttackCommon.CheckBattleRelationType(skillBattleType, battleRelationType):
|
| | | continue
|
| | |
|
| | | pyName = "PassiveSkill_%s" % effectID
|
| | |
| | | battleRelationType = AttackCommon.GetBattleRelationType(attacker, defender)
|
| | |
|
| | | for skillTypeID, effectID in skills:
|
| | | if connSkillID == skillTypeID:
|
| | | continue
|
| | | curSkill = attacker.GetSkillManager().FindSkillBySkillTypeID(skillTypeID)
|
| | | if not curSkill:
|
| | | continue
|
| | |
| | | if SkillCommon.RefreshSkillRemainTime(curSkill, tick):
|
| | | continue
|
| | | skillBattleType = SkillCommon.GetSkillBattleType(curSkill)
|
| | | if not CheckBattleRelationType(skillBattleType, battleRelationType):
|
| | | if not AttackCommon.CheckBattleRelationType(skillBattleType, battleRelationType):
|
| | | # PK模式的判定
|
| | | continue
|
| | |
|
| | |
| | | return False
|
| | |
|
| | |
|
| | |
|
| | | #------------------------Buff类 被动触发, 并非全是被动技能-----------------------------------------------
|
| | |
|
| | | #buff类触发释放技能,无CD验证
|
| | | def OnPassiveBuffTrigger(attacker, defender, useSkill, triggerType, tick):
|
| | | # 被动技能触发但无需释放,如抵消debuff,只需走CD即可
|
| | | def OnPassiveBuffHappen(attacker, defender, tagSkill, triggerType, tick):
|
| | | attacker = FindRealAttacker(attacker)
|
| | | if not attacker:
|
| | | return
|
| | | if useSkill:
|
| | | if not useSkill.GetFuncType():
|
| | | # 非功能类技能,避免死循环
|
| | | return
|
| | | if SkillCommon.isPassiveSkill(useSkill):
|
| | | #GameWorld.DebugLog("被动技能不能再次触发被动技能")
|
| | | return
|
| | | |
| | | if SkillCommon.GetUsingPassiveSkill(attacker):
|
| | | # 防范被动技能触发的 非被动技能
|
| | | GameWorld.DebugLog("被动技能不能再次触发被动技能---%s"%triggerType)
|
| | | return
|
| | | |
| | | |
| | | return False
|
| | |
|
| | | passiveEff = GetPassiveEffManager().GetPassiveEff(attacker)
|
| | | if not passiveEff:
|
| | | return
|
| | | |
| | | return False
|
| | | buffDict = passiveEff.GetBuffsByTriggerType(triggerType)
|
| | | if not buffDict:
|
| | | return
|
| | | return False
|
| | |
|
| | | defender = GetPassiveDefender(attacker, defender)
|
| | | |
| | | # 当前战斗关系 pvp pve
|
| | | battleRelationType = AttackCommon.GetBattleRelationType(attacker, defender)
|
| | | skillBattleType = SkillCommon.GetSkillBattleType(tagSkill)
|
| | | if not AttackCommon.CheckBattleRelationType(skillBattleType, battleRelationType):
|
| | | return
|
| | |
|
| | | tagSkillID = tagSkill.GetSkillID() if tagSkill else 0
|
| | |
|
| | | for skillID, effectList in buffDict.items():
|
| | | if tagSkillID == skillID:
|
| | | continue
|
| | | for passiveEffect in effectList:
|
| | | # 被动触发的技能
|
| | | pyName = "PassiveBuff_%s"%passiveEffect.GetEffectID()
|
| | |
| | | if not callFunc:
|
| | | continue
|
| | |
|
| | | if not callFunc(attacker, defender, passiveEffect, skillID):
|
| | | if not callFunc(attacker, defender, passiveEffect, tagSkill):
|
| | | continue
|
| | | |
| | | callFunc = GameWorld.GetExecFunc(PassiveBuff, "%s.%s" % (pyName, "DoLogic"))
|
| | | if callFunc:
|
| | | callFunc(attacker, defender, passiveEffect, tagSkill, skillID)
|
| | |
|
| | | return True
|
| | | |
| | | return False
|
| | | #------------------------Buff类 被动触发, 并非全是被动技能-----------------------------------------------
|
| | |
|
| | | #buff类触发释放技能,无CD验证
|
| | | def OnPassiveBuffTrigger(attacker, defender, useSkill, triggerType, tick):
|
| | | attacker = FindRealAttacker(attacker)
|
| | | if not attacker:
|
| | | return
|
| | |
|
| | | stopPassiveSkill = False # 被动技能不能再触发被动技能,但可以触发天赋技能
|
| | | if useSkill:
|
| | | if not useSkill.GetFuncType():
|
| | | # 非功能类技能,避免死循环
|
| | | return
|
| | | if SkillCommon.isPassiveSkill(useSkill):
|
| | | #GameWorld.DebugLog("被动技能不能再次触发被动技能")
|
| | | #return
|
| | | stopPassiveSkill = True
|
| | | |
| | | if SkillCommon.GetUsingPassiveSkill(attacker):
|
| | | # 防范被动技能触发的 非被动技能
|
| | | #GameWorld.DebugLog("被动技能不能再次触发被动技能---%s"%triggerType)
|
| | | #return
|
| | | stopPassiveSkill = True
|
| | | |
| | | passiveEff = GetPassiveEffManager().GetPassiveEff(attacker)
|
| | | if not passiveEff:
|
| | | return
|
| | | |
| | | buffDict = passiveEff.GetBuffsByTriggerType(triggerType)
|
| | | if not buffDict:
|
| | | return
|
| | |
|
| | | defender = GetPassiveDefender(attacker, defender)
|
| | | |
| | | # 当前战斗关系 pvp pve
|
| | | battleRelationType = AttackCommon.GetBattleRelationType(attacker, defender)
|
| | | useSkillID = useSkill.GetSkillID() if useSkill else 0
|
| | |
|
| | | for skillID, effectList in buffDict.items():
|
| | | if skillID == useSkillID:
|
| | | continue
|
| | | for passiveEffect in effectList:
|
| | | # 被动触发的技能
|
| | | pyName = "PassiveBuff_%s"%passiveEffect.GetEffectID()
|
| | | curSkill = GameWorld.GetGameData().GetSkillBySkillID(skillID)
|
| | | if not curSkill:
|
| | | continue
|
| | | if stopPassiveSkill and curSkill.GetFuncType() != ChConfig.Def_SkillFuncType_GiftSkill:
|
| | | # 只有天赋才可以再次被触发
|
| | | continue |
| | | callFunc = GameWorld.GetExecFunc(PassiveBuff, "%s.%s" % (pyName, "CheckCanHappen"))
|
| | | if not callFunc:
|
| | | continue
|
| | | |
| | | if not callFunc(attacker, defender, passiveEffect, skillID, useSkill=useSkill):
|
| | | continue
|
| | |
|
| | | callFunc = GameWorld.GetExecFunc(PassiveBuff, "%s.%s" % (pyName, "GetSkillData"))
|
| | |
| | | continue
|
| | |
|
| | | skillBattleType = SkillCommon.GetSkillBattleType(skillData)
|
| | | if not CheckBattleRelationType(skillBattleType, battleRelationType):
|
| | | if not AttackCommon.CheckBattleRelationType(skillBattleType, battleRelationType):
|
| | | # PK模式的判定
|
| | | continue
|
| | |
|
| | |
| | | attacker = FindRealAttacker(attacker)
|
| | | if not attacker:
|
| | | return 0
|
| | | |
| | | stopPassiveSkill = False # 被动技能不能再触发被动技能,但可以触发天赋技能
|
| | | if useSkill and SkillCommon.isPassiveSkill(useSkill):
|
| | | #GameWorld.DebugLog("被动技能不能再次触发被动技能")
|
| | | return 0
|
| | | #return 0
|
| | | stopPassiveSkill = True
|
| | |
|
| | |
|
| | | passiveEff = GetPassiveEffManager().GetPassiveEff(attacker)
|
| | | if not passiveEff:
|
| | |
| | | # 当前战斗关系 pvp pve
|
| | | battleRelationType = AttackCommon.GetBattleRelationType(attacker, defender)
|
| | | skillBattleType = SkillCommon.GetSkillBattleType(useSkill)
|
| | | if not CheckBattleRelationType(skillBattleType, battleRelationType):
|
| | | if not AttackCommon.CheckBattleRelationType(skillBattleType, battleRelationType):
|
| | | return 0
|
| | | |
| | | |
| | | useSkillID = useSkill.GetSkillID() if useSkill else 0
|
| | | #tick = GameWorld.GetGameWorld().GetTick()
|
| | | curValue = 0
|
| | |
|
| | | |
| | | for skillID, effectList in buffDict.items():
|
| | | if skillID == useSkillID:
|
| | | continue
|
| | | curSkill = GameWorld.GetGameData().GetSkillBySkillID(skillID)
|
| | | if not curSkill:
|
| | | continue
|
| | | |
| | | for passiveEffect in effectList:
|
| | | if stopPassiveSkill and curSkill.GetFuncType() != ChConfig.Def_SkillFuncType_GiftSkill:
|
| | | # 只有天赋才可以再次被触发
|
| | | continue |
| | | |
| | | # 被动触发的技能
|
| | | pyName = "PassiveBuff_%s"%passiveEffect.GetEffectID()
|
| | |
|
| | |
| | | if not callFunc:
|
| | | continue
|
| | |
|
| | | if not callFunc:
|
| | | continue
|
| | | |
| | | # 条件不满足
|
| | | if not callFunc(attacker, defender, passiveEffect, skillID):
|
| | | if not callFunc(attacker, defender, passiveEffect, skillID, useSkill=useSkill):
|
| | | continue
|
| | |
|
| | | callFunc = GameWorld.GetExecFunc(PassiveBuff, "%s.%s" % (pyName, "GetValue"))
|
| | | if callFunc is None:
|
| | | continue
|
| | |
|
| | | # 如被动技能:千幻冥炎真实伤害从2变4倍
|
| | | curValue += GetPassiveSkillValueByTriggerType(attacker, defender, curSkill, ChConfig.TriggerType_PassiveBuffValue)
|
| | | curValue += callFunc(attacker, defender, passiveEffect)
|
| | |
|
| | | return curValue
|
| | |
|
| | |
|
| | | # 因为要兼容低等级技能,所以技能只能是在助战的时候,先删除神兽技能再学习新的助战神兽技能
|
| | | def PlayerDogzSkill(curPlayer):
|
| | |
|
| | | dogzSkills = [] # 需要学习的技能
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | for i in xrange(ipyDataMgr.GetDogzCount()):
|
| | | ipyData = ipyDataMgr.GetDogzByIndex(i)
|
| | | if not GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_DogzFightState, i):
|
| | | continue
|
| | | |
| | | dogzSkills.extend(ipyData.GetHelpBattleSkills())
|
| | | |
| | | delDogzSkills = [] # 删除不在助战神兽队列的技能
|
| | | skillManager = curPlayer.GetSkillManager()
|
| | | for i in xrange(skillManager.GetSkillCount()):
|
| | | curSkill = skillManager.GetSkillByIndex(i)
|
| | | if curSkill.GetFuncType() != ChConfig.Def_SkillFuncType_Dogz:
|
| | | continue
|
| | | skillID = curSkill.GetSkillID()
|
| | | |
| | | delDogzSkills.append(skillID)
|
| | | |
| | | GameWorld.DebugLog("PlayerDogzSkill:%s - 删除%s"%(dogzSkills, delDogzSkills))
|
| | | |
| | | # 删除神兽技能
|
| | | for skillID in delDogzSkills:
|
| | | skillManager.DeleteSkillBySkillID(skillID, False)
|
| | | |
| | | # 添加助战技能,同类技能取最高
|
| | | dogzSkills.sort()
|
| | | for skillID in dogzSkills:
|
| | | skillData = GameWorld.GetGameData().GetSkillBySkillID(skillID)
|
| | | if not skillData:
|
| | | continue
|
| | | if skillData.GetSkillType() == ChConfig.Def_SkillType_AttrSkillNoLearn:
|
| | | # 同技能可多个叠加的技能不能学,算属性时直接取表
|
| | | continue
|
| | | |
| | | skillManager.LearnSkillByID(skillID, False)
|
| | | |
| | | # 刷被动效果
|
| | | GetPassiveEffManager().RegistPassiveEffDogz(curPlayer)
|
| | | return
|
| | |
|
| | |
|
| | | # 获取助战神兽的技能列表
|
| | | def FindDogzBattleSkills(gameObj):
|
| | | skills = []
|
| | | if gameObj.GetGameObjType() != IPY_GameWorld.gotPlayer:
|
| | | return skills
|
| | | |
| | | skillManager = gameObj.GetSkillManager()
|
| | | for i in xrange(skillManager.GetSkillCount()):
|
| | | curSkill = skillManager.GetSkillByIndex(i)
|
| | | if not curSkill:
|
| | | continue
|
| | | |
| | | if curSkill.GetFuncType() != ChConfig.Def_SkillFuncType_Dogz:
|
| | | continue
|
| | | skills.append(curSkill)
|
| | | |
| | | return skills
|