hch
2018-11-24 b4ba68e227370e3dc9dfca06ce5b9c8225bf4faa
4997 【后端】【1.3】冰晶矿脉AI--技能指定NPCID使用
3个文件已修改
41 ■■■■■ 已修改文件
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BaseAttack.py 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/SkillShell.py 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BaseAttack.py
@@ -557,6 +557,10 @@
        #关系
        relation = GetTagRelation(attacker, defender, curSkill, tick)
        return relation[0] == ChConfig.Type_Relation_Friend
    elif curSkillUseTag == ChConfig.Def_UseSkillTag_AppointNPC:
        if defender and GameObj.GetHP(defender) > 0 :
            return True
        return False
    
    return __CheckCanAttack(attacker , defender , curSkill , tick)
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -573,7 +573,7 @@
Def_Skill_Effect_AttackMove = 2100    # NPC位移战斗
Def_Skill_Effect_RandSkill = 2101    # 从效果值获取随机技能
Def_Skill_Effect_HPPerLimit = 2102    # 血量限制
Def_Skill_Effect_AppointNPC = 2103    # 指定释放的NPCID 和 Def_UseSkillTag_AppointNPC 搭配使用
#-----------
#变身技能(召唤)效果ID
Def_Skill_Effect_SummonMapNPC = 1162
@@ -1181,6 +1181,7 @@
    Def_UseSkillTag_SummonMaster,      #召唤兽主人 12
    Def_UseSkillTag_CanAttackBaseNPC,      #可攻击的野外小怪(含精英)怪物 13
    Def_UseSkillTag_FriendNPC,         #友好NPC 14
    Def_UseSkillTag_AppointNPC,         #指定NPC 15 必须和效果值配合 Def_Skill_Effect_AppointNPC
    
) = range( 0, Def_UseSkillTag_Type )
@@ -1202,6 +1203,7 @@
    Def_UseSkillTag_SummonMaster : [IPY_GameWorld.gotPlayer, IPY_GameWorld.gotNPC],
    Def_UseSkillTag_CanAttackBaseNPC : [IPY_GameWorld.gotNPC],
    Def_UseSkillTag_FriendNPC : [IPY_GameWorld.gotNPC],
    Def_UseSkillTag_AppointNPC : [IPY_GameWorld.gotNPC],
}
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/SkillShell.py
@@ -347,6 +347,13 @@
# @return 返回值真, 检查通过
# @remarks 自定义函数, NPC使用有对象技能
def NPCUseSkillTag(curNPC, curTag, curSkill, tick):
    skillTag = GetSkillAffectTag(curSkill)
    if skillTag == ChConfig.Def_UseSkillTag_AppointNPC:
        # 指定释放的NPCID 和 Def_UseSkillTag_AppointNPC 搭配使用
        curTag = GetAppointNPCBySkillEffect(curSkill)
        if not curTag:
            return False
    if not NPCCanUseSkillTag(curNPC, curTag, curSkill, tick):
        return False
    
@@ -363,6 +370,29 @@
        curNPC.SetDict(ChConfig.Def_NPC_Dict_AtkMovePosY, 0)
        
    return result
# 指定释放的NPCID 和 Def_UseSkillTag_AppointNPC 搭配使用
def GetAppointNPCBySkillEffect(curSkill):
    npcID = 0
    effectID = ChConfig.Def_Skill_Effect_AppointNPC
    for i in xrange(0, curSkill.GetEffectCount()):
        curEffect = curSkill.GetEffect(i)
        curEffectID = curEffect.GetEffectID()
        if not curEffectID:
            #策划有可能中途删除,不用return
            continue
        #不是需要的效果
        if curEffectID != effectID:
            continue
        npcID = curEffect.GetEffectValue(0)
        break
    if not npcID:
        return None
    return GameWorld.FindNPCByNPCID(npcID)
# 计算NPC技能位移坐标,预警和非预警都可以用
@@ -511,6 +541,9 @@
# @return 返回值真, 检查通过
def NPCCanUseSkillTag(curNPC, curTag, curSkill, tick):
    skillTag = GetSkillAffectTag(curSkill)
    if skillTag == ChConfig.Def_UseSkillTag_AppointNPC:
        return True
    #---对象判定---
    if IsToPetOwnerSkill(curNPC, skillTag):
        return True