ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AIType_196.py
@@ -20,12 +20,8 @@
import GameWorld
import NPCCommon
import IPY_GameWorld
import PlayerControl
import IpyGameDataPY
import AttackCommon
import ItemCommon
import AICommon
import GameObj
import ChItem
import random
@@ -246,14 +242,10 @@
#  @param tick 
#  @return 具体伤害值
def OnAttacked(atkObj, curNPC, skill, tick):
    npcControl = NPCCommon.NPCControl(curNPC)
    if GameObj.GetHP(curNPC) < GameObj.GetMaxHP(curNPC) / 2:
        GameObj.SetHP(curNPC, GameObj.GetMaxHP(curNPC))
        GameWorld.DebugLog("半血回满血!")
    curNPC.SetDict(Def_NPCKey_Goblin_AttackedTick, tick) # 设置被攻击时间
    # 每次被攻击掉落物品
    __OnAttackedDropItem(atkObj, curNPC, npcControl)
    return
def OnCheckCanDie(atkObj, curNPC, skill, tick):
@@ -261,65 +253,4 @@
    GameObj.SetHP(curNPC, GameObj.GetMaxHP(curNPC))
    GameWorld.DebugLog("死亡回满血!")
    return False
## 每次被攻击掉落物品
#  @param atkObj 攻击发起者
#  @param curNPC 被攻击NPC
#  @return None
def __OnAttackedDropItem(atkObj, curNPC, npcControl):
    attackPlayer, npcObjType = AttackCommon.GetAttackPlayer(atkObj)
    if npcObjType:
        return
    if not attackPlayer:
        return
    npcID = curNPC.GetNPCID()
    ipyData = IpyGameDataPY.GetIpyGameDataNotLog("TreasureNPC", npcID)
    if not ipyData:
        return
    attackCountDropWeightInfo = ipyData.GetAttackCountDropWeightInfo()
    attackDropWeightList = ipyData.GetAttackDropWeightList()
    attackDropWeightListEx = ipyData.GetAttackDropWeightListEx()
    dropCountEx = ipyData.GetDropCountEx()
    alchemyDiffLV = ipyData.GetAlchemyDiffLV()
    mainItemWeightList = []
    if attackCountDropWeightInfo:
        maxCount = max(attackCountDropWeightInfo)
        attackCount = attackPlayer.NomalDictGetProperty(ChConfig.Def_PDict_NPCAttackCount % npcID) + 1
        if attackCount <= maxCount:
            if attackCount in attackCountDropWeightInfo:
                mainItemWeightList = attackCountDropWeightInfo[attackCount]
            NPCCommon.UpdateNPCAttackCount(attackPlayer, npcID, attackCount, maxCount)
    if mainItemWeightList:
        mainItemWeightList = ItemCommon.GetWeightItemListByAlchemyDiffLV(attackPlayer, mainItemWeightList, alchemyDiffLV)
    elif attackDropWeightList:
        mainItemWeightList = ItemCommon.GetWeightItemListByAlchemyDiffLV(attackPlayer, attackDropWeightList, alchemyDiffLV)
    mainItemInfo = GameWorld.GetResultByWeightList(mainItemWeightList)
    if not mainItemInfo:
        notDropNotify = ipyData.GetNotDropNotify()
        if notDropNotify:
            PlayerControl.NotifyCode(attackPlayer, notDropNotify)
        return
    dropItemList = []
    if mainItemInfo:
        dropItemList.append(mainItemInfo)
    if attackDropWeightListEx and dropCountEx:
        weightListEx = ItemCommon.GetWeightItemListByAlchemyDiffLV(attackPlayer, attackDropWeightListEx, alchemyDiffLV)
        for _ in xrange(dropCountEx):
            itemInfo = GameWorld.GetResultByWeightList(weightListEx)
            if itemInfo:
                dropItemList.append(itemInfo)
    if not dropItemList:
        return
    dropPosX, dropPosY = curNPC.GetPosX(), curNPC.GetPosY()
    ChItem.DoMapDropItem(attackPlayer, dropItemList, npcID, dropPosX, dropPosY, isOnlySelfSee=False)
    return