#!/usr/bin/python # -*- coding: GBK -*- #--------------------------------------------------------------------- # #--------------------------------------------------------------------- ##@package Item_Add_PetHP # @todo: ³èÎïÒ©¼Á, ²¹ºì # # @author: panwei # @date 2010-07-02 # @version 1.4 # # @change: "2011-02-23 17:30" panwei ɾ³ýÍâ²ãͳһÁ÷Ïò¼Ç¼, µ¥¸öÎïÆ·µ÷ÓÃͳһÁ÷Ïò¼Ç¼ # @change: "2012-06-18 18:00" jiang ÐÞ¸ÄItemCommon.DelItemº¯ÊýµÄ²ÎÊýÓÃÓÚOssʼþ¼Ç¼ # @change: "2012-07-18 17:40" Alee ¾«¼òÁ÷ÏòÊä³ö # @change: "2015-05-07 11:00" hxp ÐÞ¸ÄÌáʾ #------------------------------------------------------------------------------ """Version = 2015-05-07 11:00""" #--------------------------------------------------------------------- import PlayerControl import PetControl import ChConfig import ItemCommon import GameObj #--------------------------------------------------------------------- #È«¾Ö±äÁ¿ #--------------------------------------------------------------------- #--------------------------------------------------------------------- ## Âß¼­ÊµÏÖ //·µ»ØÖµÎªÊÇ·ñʹÓóɹ¦(Íâ²ãÍ¨ÖªÌØÐ§) # @param curPlayer µ±Ç°Íæ¼Ò # @param curRoleItem µ±Ç°Ö÷½ÇʹÓõÄÎïÆ· # @param tick µ±Ç°Ê±¼ä # @return True or False ·µ»ØÖµÎªÊÇ·ñʹÓóɹ¦(Íâ²ãÍ¨ÖªÌØÐ§) # @remarks º¯ÊýÏêϸ˵Ã÷. def UseItem(curPlayer, curRoleItem, tick): useItemID = curRoleItem.GetItemTypeID() #---»ñµÃ³öÕ½µÄ³èÎï--- rolePetMgr = curPlayer.GetPetMgr() fightPet = rolePetMgr.GetFightPet() if fightPet == None: PlayerControl.NotifyCode(curPlayer, "Pet_liubo_381601", [useItemID]) return False fightPetHP = GameObj.GetHP(fightPet) fightPetMaxHP = GameObj.GetMaxHP(fightPet) if fightPetHP == fightPetMaxHP: PlayerControl.NotifyCode(curPlayer, "Pet_liubo_493922") return False #---»ñµÃ±íÖеÄÀÛ¼ÓÖµaֵΪf% bֵΪ¹Ì¶¨Öµ curEff = curRoleItem.GetEffectByIndex(0) addValue = curEff.GetEffectValue(0) / float(ChConfig.Def_MaxRateValue) + curEff.GetEffectValue(1) PetControl.AddPetHP(fightPet, int(addValue)) #¿ÛÎïÆ· ItemCommon.DelItem(curPlayer, curRoleItem, 1, True) #//·µ»ØÖµ×ªCD return True