hxp
2024-09-18 d0d6f28bee730ee64bf46adffa4f768d6af6ac0c
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
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
##@package Skill.GameSkills.SkillModule_49
#
# @todo:»»Ñª¹¥»÷
# @author hxp
# @date 2024-04-02
# @version 1.0
#
# ÏêϸÃèÊö: ÏûºÄ×ÔÉíx%µ±Ç°ÉúÃüÖµ£¬¿Û³ýµÐ·½µÈ¶îÉúÃüÖµ£¬×î¸ß²»³¬¹ý×ÔÉíx%¹¥»÷¡£
#           Ð§¹û1£º AÖµ-ÏûºÄѪÁ¿°Ù·Ö±È£¬BÖµ-×î¸ß²»³¬¹ý¹¥»÷°Ù·Ö±È
#
#-------------------------------------------------------------------------------
#"""Version = 2024-04-02 19:00"""
#-------------------------------------------------------------------------------
 
import ChConfig
import SkillCommon
import BaseAttack
import GameWorld
import GameObj
 
def UseSkill(attacker, defender, curSkill, tagRoundPosX, tagRoundPosY, isEnhanceSkill, tick):
    if not defender:
        return
    
    curHP = GameObj.GetHP(attacker)
    tagHP = GameObj.GetHP(defender)
    if curHP <= 1 or tagHP <= 0:
        return
    
    skillEffect = curSkill.GetEffect(0)
    lostHPPer = skillEffect.GetEffectValue(0)
    maxAtkPer = skillEffect.GetEffectValue(1)
    
    maxHP = GameObj.GetMaxHP(attacker)
    maxAtk = attacker.GetMaxAtk()
    
    hpHurtValue = int(maxHP * lostHPPer / float(ChConfig.Def_MaxRateValue))
    atkHurtValue = int(maxAtk * maxAtkPer / float(ChConfig.Def_MaxRateValue))
    
    hurtValue = min(hpHurtValue, atkHurtValue, tagHP, curHP - 1) # ÖÁÉÙ±£Áô1µÎѪ
    
    GameWorld.DebugLog("        »»Ñª: atkID=%s,defID=%s,skillID=%s,hurtValue=%s,hpHurtValue=%s,atkHurtValue=%s,curHP=%s,tagHP=%s" 
                       % (attacker.GetID(), defender.GetID(), curSkill.GetSkillID(), hurtValue, hpHurtValue, atkHurtValue, curHP, tagHP))
    lostHP = SkillCommon.SkillLostHP(defender, curSkill, attacker, hurtValue, tick, isDoAttackResult=False, skillAffect=False)
    if lostHP:
        SkillCommon.SkillLostHP(attacker, curSkill, attacker, hurtValue, tick, isDoAttackResult=False, skillAffect=False)
    return BaseAttack.DoSkillEx_AttackSucess(attacker, defender, curSkill, tick, isEnhanceSkill)