#!/usr/bin/python
|
# -*- coding: GBK -*-
|
#---------------------------------------------------------------------
|
#
|
#---------------------------------------------------------------------
|
##@package NormalNPC_Attack_SummonNPC
|
# ÆÕͨNPC¹¥»÷ÕÙ»½NPC
|
#
|
# @author eggxp
|
# @date 2010-4-20
|
# @version 1.5
|
#
|
# @change: "2010-09-06 17:30" panwei GetBattleTypeº¯ÊýÐÞ¸Ä, ÐÂÔö²ÎÊý:¹¥»÷·½
|
# @change: "2010-11-17 19:00" adaws ¼ÓÈëNPCÕóÈÝÅж¨
|
# @change: "2010-11-18 11:00" adaws NPCÕóÈÝÅж¨´íÐÞ¸Ä
|
# @change: "2011-05-05 17:30" Alee ¹¥»÷¹ØÏµÅжÏ
|
# @change: "2012-02-10 20:20" Alee Ìí¼Ó¼¼Äܱط¢Éú״̬
|
#------------------------------------------------------------------------------
|
"""Version = 2012-02-10 20:20"""
|
#---------------------------------------------------------------------
|
import NPCCommon
|
import AttackCommon
|
import ChConfig
|
import IPY_GameWorld
|
import GameWorld
|
import SkillShell
|
import GameObj
|
#---------------------------------------------------------------------
|
|
#---------------------------------------------------------------------
|
|
## ÊÇ·ñ¿ÉÒÔ¹¥»÷
|
# @param curNormalNPC ¹¥»÷·½:ÆÕͨNPC
|
# @param curTagPlayer ·ÀÊØ·½:ÕÙ»½ÊÞ
|
# @param skill ¼¼ÄÜ(ÎÞ->None)
|
# @param tick µ±Ç°Ê±¼ä
|
# @return True or False
|
# @remarks º¯ÊýÏêϸ˵Ã÷.
|
def GetCanAttack(curNormalNPC, curTagSummon, skill, tick):
|
if not AttackCommon.CheckNPCCanAttackTag(curNormalNPC, curTagSummon, skill):
|
return False
|
|
return True
|
|
## »ñµÃ¹ØÏµ
|
# @param curNormalNPC ¹¥»÷·½:ÆÕͨNPC
|
# @param curTagPlayer ·ÀÊØ·½:ÕÙ»½ÊÞ
|
# @param skill ¼¼ÄÜ(ÎÞ->None)
|
# @param tick µ±Ç°Ê±¼ä
|
# @return È磺ChConfig.Type_Relation_Enemy , ChConfig.Def_PASysMessage_None
|
# @remarks º¯ÊýÏêϸ˵Ã÷.
|
def GetTagRelation(curNormalNPC, curTagSummon, skill, tick):
|
#1.²»¹¥»÷¾«Áé
|
if curTagSummon.GetType() == IPY_GameWorld.ntFairy:
|
return ChConfig.Type_Relation_None , ChConfig.Def_PASysMessage_None
|
|
#ÅжÏÕóÓª
|
attackerCampType = NPCCommon.GetFaction(curNormalNPC)
|
defenderCampType = NPCCommon.GetFaction(curTagSummon)
|
|
#2.²»¹¥»÷ÕóÓªÏàͬ£¨²»°üÀ¨¶þÕß¶¼ÎªÖÐÁ¢£©
|
if not (attackerCampType == ChConfig.CampType_Neutral and defenderCampType == ChConfig.CampType_Neutral):
|
if attackerCampType == defenderCampType:
|
return ChConfig.Type_Relation_Friend , ChConfig.Def_PASysMessage_None
|
|
#ÕÙ»½ÊÞµÄÖ÷ÈË
|
curSummonOwner = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotPlayer, curTagSummon)
|
if curSummonOwner == None:
|
curSummonOwner = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotNPC, curTagSummon)
|
|
if curSummonOwner != None:
|
if GameWorld.IsSameObj(curSummonOwner, curNormalNPC) :
|
#3.²»¹¥»÷×Ô¼ºµÄÕÙ»½ÊÞ
|
return ChConfig.Type_Relation_Friend , ChConfig.Def_PASysMessage_None
|
|
#4.²»¹¥»÷NPCÕÙ»½ÊÞ
|
if curSummonOwner.GetGameObjType() == IPY_GameWorld.gotNPC:
|
return ChConfig.Type_Relation_Friend , ChConfig.Def_PASysMessage_None
|
|
return ChConfig.Type_Relation_Enemy , ChConfig.Def_PASysMessage_None
|
|
## ¹¥»÷
|
# @param curNormalNPC ¹¥»÷·½:ÆÕͨNPC
|
# @param curTagPlayer ·ÀÊØ·½:ÕÙ»½ÊÞ
|
# @param skill ¼¼ÄÜ(ÎÞ->None)
|
# @param skillValue ¼¼ÄÜÔöÇ¿
|
# @param skillPercent ¼¼ÄÜÔöÇ¿°Ù·Ö±È
|
# @param skillHurtList ¼¼ÄÜÉËѪÁбí(C++½Ó¿Ú)
|
# @param tick µ±Ç°Ê±¼ä
|
# @return hurtType £º HurtType É˺¦½á¹¹ÌåÀà
|
# @remarks º¯ÊýÏêϸ˵Ã÷.
|
def DoAttack(curNormalNPC, curTagSummonNPC, skill, skillValue, skillPercent, skillHurtList, tick):
|
#¼ÆËã·´µ¯,Ìí¼ÓÉËѪ
|
curNPCBeHP = GameObj.GetHP(curNormalNPC)
|
hurtType = AttackCommon.GetHurtHP(curNormalNPC, curTagSummonNPC, skill, skillValue, skillPercent, tick)
|
hurtHP = hurtType.HurtHP
|
|
#Ìí¼Ó³ðºÞ
|
summonControl = NPCCommon.NPCControl(curTagSummonNPC)
|
summonControl.AddObjDetelToAngryList_ByAttack(curNormalNPC, hurtHP, skill)
|
|
#ÅжÏNPCÊÇ·ñÉËѪ,Èç¹ûÉËѪ,˵Ã÷·´µ¯É˺¦,Òª¼ÓÉËѪÁбí
|
lastHP = curNPCBeHP - GameObj.GetHP(curNormalNPC)
|
|
curTagPlayer = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotPlayer, curTagSummonNPC)
|
|
if curTagPlayer != None :
|
if lastHP > 0 :
|
#Ìí¼ÓÉËѪÁбí
|
AttackCommon.NPCAddObjInHurtList(curTagPlayer, curNormalNPC, curNPCBeHP, lastHP)
|
|
#¸øÕâ¸öÍæ¼ÒµÄÆäËûÕÙ»½ÊÞÔö¼Ó³ðºÞ(´òÖ÷ÈËÓÅÏÈ->ÕâÀïÖ»Ìí¼Ó1µã³ðºÞ)
|
AttackCommon.SummonAddAngryByOwner(curNormalNPC, curTagPlayer, 1)
|
|
#Ìí¼Ó¼¼ÄÜÉ˺¦Í¨ÖªÁбí,(ÓÃÓÚ¹¥»÷½áÊø,ͳһ֪ͨ¿Í»§¶Ë)
|
AttackCommon.AddHurt(curTagSummonNPC, skillHurtList, hurtType.HurtType, hurtHP)
|
return hurtType
|
|
## ´¦Àí¹¥»÷ºóµÄ½á¹û
|
# @param curNormalNPC ¹¥»÷·½:ÆÕͨNPC
|
# @param curTagPlayer ·ÀÊØ·½:ÕÙ»½ÊÞ
|
# @param skill ¼¼ÄÜ(ÎÞ->None)
|
# @param tick µ±Ç°Ê±¼ä
|
# @return True
|
# @remarks º¯ÊýÏêϸ˵Ã÷.
|
def AttackResult(curNormalNPC, curTagSummonNPC, skill, tick):
|
#»ñÈ¡ÕÙ»½ÊÞµÄÖ÷ÈË
|
curTagPlayer = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotPlayer, curTagSummonNPC)
|
if curTagPlayer != None and curTagPlayer.GetHP() > 0 :
|
#½øÈëÕ½¶·×´Ì¬
|
AttackCommon.SetPlayerBattleState(curTagPlayer, tick)
|
|
#ÕÙ»½ÊÞËÀÍö
|
if GameObj.GetHP(curTagSummonNPC) <= 0:
|
curTagSummonNPCControl = NPCCommon.NPCControl(curTagSummonNPC)
|
#ÕÙ»½ÊÞËÀÍö
|
curTagSummonNPCControl.SetKilled()
|
|
return True
|
|