From 4ff284edf33cbbfcb123e2ba01dead78793e9dc8 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 11 十二月 2023 16:47:01 +0800
Subject: [PATCH] 10019 【砍树】回合战斗(每回合攻击顺序改为按攻击速度倒序;每个阵营支持多个战斗实例)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py |   43 ++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 42 insertions(+), 1 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
index b517a41..2f74743 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
@@ -148,7 +148,7 @@
 def SetSuppressFightPower(curNPC, value): return curNPC.SetThunderDef(min(value, ShareDefine.Def_UpperLimit_DWord))
 def GetCommendFightPower(curNPC): return curNPC.GetFireDef() # 火防代表推荐战力
 def GetDropOwnerType(curNPC): return curNPC.GetThunderAtk() # 雷攻代表掉落归属类型
-def GetFaction(curNPC): return curNPC.GetCountry()
+def GetFaction(curNPC): return GameObj.GetFaction(curNPC)
 def GetSkillAtkRate(curNPC): return curNPC.GetPoisionAtk() # 毒攻代表NPC技能伤害加成万分率
 def GetFinalHurt(curNPC): return curNPC.GetFireAtk() # 火攻代表NPC最终固定伤害加成, 普攻也有效果
 def SetFinalHurt(curNPC, hurt): return curNPC.SetFireAtk(hurt) # 火攻代表NPC最终固定伤害加成, 普攻也有效果
@@ -2269,6 +2269,10 @@
 # @return 如果召唤失败返回None 否则返回召唤的NPC的实例
 # @remarks 在地图里召唤NPC 根据NPCID 出生点 AI类型 和TICK
 def SummonMapNpc(npcId, rebornX, rebornY, aiType=0, lastTime=0, playerID=0, sightLevel=0, refreshID=0, pvpPlayerID=0):
+    npcData = GameWorld.GetGameData().FindNPCDataByID(npcId)
+    if not npcData:
+        GameWorld.ErrLog("找不到该NPCID: %s" % npcId)
+        return
     curSummon = GameWorld.GetNPCManager().AddPlayerSummonNPC()
     if not curSummon:
         return
@@ -2306,6 +2310,43 @@
     #__NotifyMapPlayerSummonMapNPC(npcId, rebornX, rebornY)
     return curSummon
 
+def SummonNPC(gameObj, npcID, rebornX, rebornY):
+    ''' 某个实例进行召唤,有从属关系
+    '''
+    npcData = GameWorld.GetGameData().FindNPCDataByID(npcID)
+    if not npcData:
+        GameWorld.ErrLog("找不到该NPCID: %s" % npcID)
+        return
+    if gameObj.GetGameObjType() == IPY_GameWorld.gotPlayer:
+        curSummon = gameObj.SummonNewNPC()
+        curSummon.SetLV(gameObj.GetLV())
+        curSummon.SetCountry(gameObj.GetCountry())
+        curSummon.GetNPCAngry().Init(ChConfig.Def_SummonNPC_Angry_Count)
+        curSummon.SetOwner(gameObj)
+    else:
+        sumCount, angryCount = 1, 3
+        if not gameObj.AddSummonCount(sumCount, npcID, angryCount):
+            return
+        #取新增的一只,最后一个
+        index = gameObj.GetSummonCount() - 1
+        if index < 0:
+            return 
+        curSummon = gameObj.GetSummonNPCAt(index)
+        
+    if not curSummon:
+        return
+    
+    tick = GameWorld.GetGameWorld().GetTick()
+    curSummon.SetNPCTypeID(npcID)
+    curSummon.SetBornTime(tick)
+    InitNPC(curSummon)     
+    curSummon.SetSightLevel(gameObj.GetSightLevel())
+    
+    curSummon.Reborn(rebornX, rebornY, False)
+    NPCControl(curSummon).DoNPCRebornCommLogic(tick)
+    #curSummon.RefreshView()
+    return curSummon
+
 ## 通知地图内玩家,地图出现召唤NPC
 # @param npcId: NPCID
 # @param rebornX: 出生点X

--
Gitblit v1.8.0