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
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
##@package Skill.GameSkills.SkillModule_51
#
# @todo:´ò³öÄ¿±êxxÊôÐÔµÄX%É˺¦£¬µ¥Ìå¹¥»÷ 
# @author hxp
# @date 2024-04-07
# @version 1.0
#
# ÏêϸÃèÊö: 
#    Ð§¹û1£ºAÖµ-°Ù·Ö±È BÖµ-Ä¿±êÊôÐÔË÷Òý
#    Ð§¹û2£ºAÖµ-²»³¬¹ý×ÔÉí°Ù·Ö±È,0²»ÏÞÖÆ BÖµ-×ÔÉíÊôÐÔË÷Òý
#
#-------------------------------------------------------------------------------
#"""Version = 2024-04-07 18:00"""
#-------------------------------------------------------------------------------
 
import ChConfig
import SkillCommon
import EffGetSet
import GameWorld
 
def UseSkill(attacker, defender, curSkill, tagRoundPosX, tagRoundPosY, isEnhanceSkill, tick):
    if not defender:
        return
    
    tagEffect = curSkill.GetEffect(0)
    skillPer = tagEffect.GetEffectValue(0) / float(ChConfig.Def_MaxRateValue)
    tagAttrIndex = tagEffect.GetEffectValue(1)
    
    tagAttrValue = EffGetSet.GetValueByEffIndex(defender, tagAttrIndex)
    hurtValue = int(tagAttrValue * skillPer)
    #GameWorld.DebugLog("´ò³öÄ¿±êxxÊôÐÔµÄxxÉ˺¦! atkID=%s,defID=%s,tagAttrIndex=%s,tagAttrValue=%s,skillPer=%s,hurtValue=%s" 
    #                   % (attacker.GetID(), defender.GetID(), tagAttrIndex, tagAttrValue, skillPer, hurtValue))
    
    selfEffect = curSkill.GetEffect(1)
    selfPer = selfEffect.GetEffectValue(0) / float(ChConfig.Def_MaxRateValue)
    selfAttrIndex = selfEffect.GetEffectValue(1)
    if selfPer:
        selfAttrValue = EffGetSet.GetValueByEffIndex(attacker, selfAttrIndex)
        hurtValueMax = int(selfAttrValue * selfPer)
        hurtValue = min(hurtValue, hurtValueMax)
        #GameWorld.DebugLog("    ×î¸ß²»³¬¹ý×ÔÉíÊôÐÔ! selfAttrIndex=%s,selfAttrValue=%s,selfPer=%s,hurtValueMax=%s" 
        #                   % (selfAttrIndex, selfAttrValue, selfPer, hurtValueMax))
        
    return SkillCommon.SkillLostHP(defender, curSkill.GetSkillTypeID(), attacker, hurtValue, tick)