hxp
5 天以前 388823edfe6308cba6f76ca6dc4f20022c5cb2be
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/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