#!/usr/bin/python
|
# -*- coding: GBK -*-
|
#---------------------------------------------------------------------
|
#
|
#---------------------------------------------------------------------
|
##@package SummonNPC_Attack_NormalNPC
|
# @todo: ÕÙ»½ÊÞ¹¥»÷ÆÕͨNPC
|
#
|
# @author: panwei
|
# @date 2010-09-06
|
# @version 2.1
|
#
|
# @change: "2010-09-06 17:30" panwei GetBattleTypeº¯ÊýÐÞ¸Ä, ÐÂÔö²ÎÊý:¹¥»÷·½
|
# @change: "2010-11-18 11:00" adaws NPCÕóÈÝÅж¨´íÐÞ¸Ä
|
# @change: "2010-11-18 13:50" chenxuewei NpcɱËÀNPCʱ֪ͨ¸±±¾
|
# @change: "2011-04-15 14:00" chenxuewei ÐÞ¸´bug9922:ÊØ»¤Çô³µ,·¶Î§¼¼ÄÜ(Íæ¼ÒÕÙ»ØÒþÐÎNPC·ÅȺ¹¥¼¼ÄÜ)¿É¹¥»÷¼º·½Çô³µ¡¢ÊØÎÀ
|
# @change: "2011-05-11 13:45" Alee ÕÙ»½ÊÞÊÇÏÝÚåÔò°Ñ³ðºÞ¸øÖ÷ÈË
|
# @change: "2011-05-12 14:00" Alee ÏÝÚå¸ÄΪÁé³ðºÞÈ«×ªÒÆ¸øÖ÷ÈË
|
# @change: "2011-05-12 17:00" chenxuewei AttackResultÕÙ»½ÊÞÓÐûÖ÷È˶¼Ö»ÒªÍ¨Öª¸±±¾Ò»´Î¼´¿É£¬±ÜÃâÖØ¸´Í¨Öª
|
# @change: "2012-02-10 20:20" Alee Ìí¼Ó¼¼Äܱط¢Éú״̬
|
# @change: "2013-01-03 17:00" wdb È¥³ýnpc¹¥»÷Ôì³ÉµÄÉËѪ¼Ç¼
|
# @change: "2013-11-08 18:00" hxp Ôö¼ÓNPC±»¹¥»÷Âß¼Èë¿Ú
|
# @change: "2016-09-28 21:00" hxp ²»ËÀbossÂß¼Ö§³Ö
|
#------------------------------------------------------------------------------
|
#"""Version = 2016-09-28 21:00"""
|
#---------------------------------------------------------------------
|
import NPCCommon
|
import IPY_GameWorld
|
import AttackCommon
|
import ChConfig
|
import GameWorld
|
import FBLogic
|
import SkillShell
|
import ChNPC
|
import GameObj
|
#---------------------------------------------------------------------
|
|
#---------------------------------------------------------------------
|
## ÊÇ·ñ¿ÉÒÔ¹¥»÷
|
# @param curNormalNPC ¹¥»÷·½:ÕÙ»½ÊÞ
|
# @param curTagPlayer ·ÀÊØ·½:ÆÕͨNPC
|
# @param skill ¼¼ÄÜ(ÎÞ->None)
|
# @param tick µ±Ç°Ê±¼ä
|
# @return ²¼¶ûÖµ
|
# @remarks º¯ÊýÏêϸ˵Ã÷.
|
def GetCanAttack(curSummonNPC, curTagNormalNPC, skill, tick):
|
|
return AttackCommon.CheckNPCCanAttackTag(curSummonNPC, curTagNormalNPC, skill)
|
|
#---------------------------------------------------------------------
|
## »ñµÃ¹ØÏµ
|
# @param curNormalNPC ¹¥»÷·½:ÕÙ»½ÊÞ
|
# @param curTagPlayer ·ÀÊØ·½:ÆÕͨNPC
|
# @param skill ¼¼ÄÜ(ÎÞ->None)
|
# @param tick µ±Ç°Ê±¼ä
|
# @return ¹ØÏµÁбí È磺[ChConfig.Type_Relation_Enemy , ChConfig.Def_PASysMessage_None]
|
# @remarks »ñµÃ¹ØÏµÁбí
|
def GetTagRelation(curSummonNPC, curTagNormalNPC, skill, tick):
|
|
#·ÀÊØ·½ÕóÓª
|
defenderCampType = NPCCommon.GetFaction(curTagNormalNPC)
|
|
#Íæ¼ÒµÄÕÙ»½ÊÞ²ÅÄܹ¥»÷ÆÕͨNPC
|
npcOwner_Player = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotPlayer, curSummonNPC)
|
|
if npcOwner_Player != None:
|
|
#²»¹¥»÷ÕýÒåµÄÐèҪȥ±£»¤µÄ ÕâÀïÓÐÅ®ÉñºÍÊØÎÀ
|
if defenderCampType == ChConfig.CampType_Justice:
|
return ChConfig.Type_Relation_Friend, ChConfig.Def_PASysMessage_None
|
|
return ChConfig.Type_Relation_Enemy, ChConfig.Def_PASysMessage_None
|
|
#¹¥»÷·½ÕóÓª
|
attackerCampType = curSummonNPC.GetDictByKey(ChConfig.Def_NpcDictKey_CampType)
|
if attackerCampType != defenderCampType:
|
return ChConfig.Type_Relation_Enemy, ChConfig.Def_PASysMessage_None
|
return ChConfig.Type_Relation_Friend, ChConfig.Def_PASysMessage_None
|
#---------------------------------------------------------------------
|
## ¹¥»÷
|
# @param curNormalNPC ¹¥»÷·½:ÕÙ»½ÊÞ
|
# @param curTagPlayer ·ÀÊØ·½:ÆÕͨNPC
|
# @param skill ¼¼ÄÜ(ÎÞ->None)
|
# @param skillValue ¼¼ÄÜÔöÇ¿
|
# @param skillPercent ¼¼ÄÜÔöÇ¿°Ù·Ö±È
|
# @param skillHurtList ¼¼ÄÜÉËѪÁбí(C++½Ó¿Ú)
|
# @param tick µ±Ç°Ê±¼ä
|
# @return hurtType £º HurtType É˺¦½á¹¹ÌåÀà
|
# @remarks ¹¥»÷Âß¼
|
def DoAttack(curSummonNPC, curTagNPC, skill, skillValue, skillPercent, skillHurtList, tick):
|
curTagNPCHPBeforeAtk = GameObj.GetHP(curTagNPC)
|
hurtType = AttackCommon.GetHurtHP(curSummonNPC, curTagNPC, skill,
|
skillValue, skillPercent, tick)
|
hurtHP = hurtType.HurtHP
|
#---±»¹¥»÷µÄNPCÌí¼Ó³ðºÞ---
|
curTagNPCControl = NPCCommon.NPCControl(curTagNPC)
|
curTagNPCControl.AddObjDetelToAngryList_ByAttack(curSummonNPC, hurtHP, skill)
|
|
#---±»¹¥»÷µÄNPCÌí¼ÓÉËѪ---
|
|
#¹¥»÷·½ÎªÕÙ»½ÊÞ,Ìí¼Óµ½Ö÷ÈËÉËѪÖÐ
|
summonOwner = NPCCommon.GetSummonOwnerDetel(curSummonNPC)
|
|
#2013-1-3,È¥³ýnpc¹¥»÷Ôì³ÉµÄÉËѪ¼Ç¼
|
if summonOwner != None:
|
|
# ÕÙ»½ÊÞÖ÷ÈËÎªÍæ¼Ò£¬ÉËѪ
|
if summonOwner.GetGameObjType() == IPY_GameWorld.gotPlayer:
|
AttackCommon.NPCAddObjInHurtList(summonOwner, curTagNPC, curTagNPCHPBeforeAtk, hurtHP)
|
|
addAngry = hurtHP
|
if skill != None:
|
addAngry += skill.GetSkillAngry()
|
|
#Ò²Ìí¼ÓÒ»·ÝÖ÷È˵ijðºÞ(±©·çÑ©ÕâÀàµÄ²»¿É¹¥»÷ÕÙ»½¼¼ÄÜ, ÒªNPC¹¥»÷Ö÷ÈË)
|
curTagNPCControl.AddObjToAngryList(summonOwner, addAngry)
|
|
#---¹¹½¨ÉËѪÁбí---
|
|
#Ìí¼Ó¼¼ÄÜÉ˺¦Í¨ÖªÁбí,(ÓÃÓÚ¹¥»÷½áÊø,ͳһ֪ͨ¿Í»§¶Ë)
|
AttackCommon.AddHurt(curTagNPC, skillHurtList, hurtType.HurtType, hurtHP)
|
#ChNPC.OnUndeathBossHurt(curTagNPC, hurtHP)
|
return hurtType
|
#---------------------------------------------------------------------
|
## ´¦Àí¹¥»÷ºóµÄ½á¹û
|
# @param curNormalNPC ¹¥»÷·½:ÕÙ»½ÊÞ
|
# @param curTagPlayer ·ÀÊØ·½:ÆÕͨNPC
|
# @param skill ¼¼ÄÜ(ÎÞ->None)
|
# @param tick µ±Ç°Ê±¼ä
|
# @return ÎÞÒâÒå
|
# @remarks ´¦Àí¹¥»÷ºóµÄ½á¹û
|
def AttackResult(curSummonNPC, curTagNPC, skill, tick):
|
|
if ChNPC.OnUndeathBossAttacked(curTagNPC):
|
return
|
|
#---NPC»¹»î×Å---
|
if GameObj.GetHP(curTagNPC) > 0:
|
ChNPC.OnNPCAttacked(curSummonNPC, curTagNPC, skill, tick)
|
return
|
|
#---NPC±»»÷ɱ---
|
#Íæ¼Ò»÷ɱNPC¸±±¾´¥·¢Æ÷
|
curPlayer = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotPlayer, curSummonNPC)
|
|
if not ChNPC.OnCheckCanDie(curPlayer, curTagNPC, skill, tick):
|
return
|
|
#2011-05-12 chenxuewei ÓÐûÖ÷È˶¼Ö»ÒªÍ¨ÖªÒ»´Î¼´¿É£¬±ÜÃâÖØ¸´Í¨Öª
|
if curPlayer != None:
|
NPCCommon.OnPlayerAttackNPCDie(curTagNPC, curPlayer, skill)
|
FBLogic.DoFB_Player_KillNPC(curPlayer, curTagNPC, tick)
|
else:
|
#¸±±¾
|
FBLogic.DoFB_Npc_KillNPC(curSummonNPC, curTagNPC, tick)
|
|
#µ÷ÓÃͳһ»÷ɱÂß¼
|
curTagNPCControl = NPCCommon.NPCControl(curTagNPC)
|
curTagNPCControl.SetKilled()
|
return
|
#---------------------------------------------------------------------
|