找回密码
 点一下
查看: 1515|回复: 3

关于选取单位组中单位造成伤害,发现重复伤害的问题

[复制链接]
发表于 2010-7-29 14:49:52 | 显示全部楼层 |阅读模式
是在做一个技能的时候发现的,希望高人们帮帮忙

技能说明:将元素能量从身体中爆发,对周围单位造成伤害,伤害受到当前元素能量点数的影响。同时受到元素脉冲的单位将受到特殊效果的影响。每点元素能量增加10/20/30...(以此类推,共10级)点伤害
元素能量是通过使用技能获得的,使用一次技能加1,这个我写在另一个被动技能里了,也是10级,1级最多6点,2级7点。。。(以此类推)

然后问题是,当英雄身边只有一个单位的时候,伤害值是正确的

下面是代码


function Trig_ElementPulse_Find takes nothing returns boolean
    return IsUnitDeadBJ(GetFilterUnit())==false and IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()),GetOwningPlayer(GetTriggerUnit()))==true and GetTriggerUnit()!=GetFilterUnit()
endfunction
function Trig_ElementPulse_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A008' ) ) then
        return false
    endif
    return true
endfunction
function Trig_ElementPulse_Func takes nothing returns nothing
    local unit u=GetTriggerUnit()
    local unit u1=null
    local location p=GetUnitLoc(GetEnumUnit())
    local integer i=GetUnitAbilityLevel(u, 'A008')
    local integer i1=0
    if GetUnitAbilityLevel(u, 'A000') != 0 then
        call DestroyEffect( AddSpecialEffectTargetUnitBJ( "overhead", GetEnumUnit(), "Abilities\\Spells\\Other\\Doom\\DoomDeath.mdl" ))
        set i1=YDWEGetIntegerByInteger( YDWEGetUnitID(u), YDWEGetAbilityTypeID('A000'))
        set u1=CreateUnitAtLoc(GetOwningPlayer(u), 'e001' , p, bj_UNIT_FACING )
        call UnitAddAbility( u1, 'A009')
        call SetUnitAbilityLevel( u1, 'A009', i)
        call IssueTargetOrder( u1, "shadowstrike", GetEnumUnit() )
        if i1<5+GetUnitAbilityLevel(u, 'A007') then
            set i1=i1+1
            call YDWESaveIntegerByInteger( YDWEGetUnitID(u), YDWEGetAbilityTypeID('A000'), i1 )
        endif   
    endif
    if GetUnitAbilityLevel(u, 'A001') != 0 then
        call DestroyEffect( AddSpecialEffectTargetUnitBJ( "overhead", GetEnumUnit(), "Abilities\\Weapons\\Bolt\\BoltImpact.mdl" ))
        set i1=YDWEGetIntegerByInteger( YDWEGetUnitID(u), YDWEGetAbilityTypeID('A001'))
        set u1=CreateUnitAtLoc(GetOwningPlayer(u), 'e001' , p, bj_UNIT_FACING )
        call UnitAddAbility( u1, 'A00B')
        call SetUnitAbilityLevel( u1, 'A00B', i)
        call IssueTargetOrder( u1, "purge", GetEnumUnit() )
        if i1<5+GetUnitAbilityLevel(u, 'A007') then
            set i1=i1+1
            call YDWESaveIntegerByInteger( YDWEGetUnitID(u), YDWEGetAbilityTypeID('A001'), i1 )
        endif  
    endif
    if GetUnitAbilityLevel(u, 'A002') != 0 then
        call DestroyEffect( AddSpecialEffectTargetUnitBJ( "overhead", GetEnumUnit(), "Abilities\\Spells\\Undead\\FreezingBreath\\FreezingBreathMissile.mdl" ))
        set i1=YDWEGetIntegerByInteger( YDWEGetUnitID(u), YDWEGetAbilityTypeID('A002'))
        set u1=CreateUnitAtLoc(GetOwningPlayer(u), 'e001' , p, bj_UNIT_FACING )
        call UnitAddAbility( u1, 'A00A')
        call SetUnitAbilityLevel( u1, 'A00A', i)
        call IssueTargetOrder( u1, "shadowstrike", GetEnumUnit() )
        if i1<5+GetUnitAbilityLevel(u, 'A007') then
            set i1=i1+1
            call YDWESaveIntegerByInteger( YDWEGetUnitID(u), YDWEGetAbilityTypeID('A002'), i1 )
        endif  
    endif
    call UnitDamageTarget( u, GetEnumUnit(), 10*i*i1, false, false, ATTACK_TYPE_MELEE, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS )   
    call RemoveLocation(p)
    set u1=null
    set u=null
endfunction
function Trig_ElementPulse_Actions takes nothing returns nothing
    local unit u=GetTriggerUnit()
    local location p=GetUnitLoc(u)
    local unit u1=CreateUnitAtLoc( GetOwningPlayer(u) , 'e000' , p , 270 )
    call GroupEnumUnitsInRange(udg_Group,GetUnitX(u),GetUnitY(u),350,Condition(function Trig_ElementPulse_Find))
    call ForGroup( udg_Group, function Trig_ElementPulse_Func)
    call RemoveLocation(p)
    set u=null
    set u1=null
    set p=null
endfunction
//===========================================================================
function InitTrig_ElementPulse takes nothing returns nothing
    set gg_trg_ElementPulse = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_ElementPulse, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_ElementPulse, Condition( function Trig_ElementPulse_Conditions ) )
    call TriggerAddAction( gg_trg_ElementPulse, function Trig_ElementPulse_Actions )
endfunction

。。。不知道怎么截图好,只好上传文件了。。。

SpellTest.w3x

119 KB, 下载次数: 10

 楼主| 发表于 2010-7-29 15:38:56 | 显示全部楼层
额,,,原来是增加能量点的时间取的有问题,好愚蠢的错误,,,怪不得没人回答,,,
回复

使用道具 举报

发表于 2010-7-29 19:56:56 | 显示全部楼层
发Jass用【jass】【/jass】将代码括起来,【】换成[],我手机党,没法改
回复

使用道具 举报

 楼主| 发表于 2010-7-29 19:58:07 | 显示全部楼层

回 2楼(疯人¢衰人) 的帖子

哦,哦,了了,3Q
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 点一下

本版积分规则

Archiver|移动端|小黑屋|地精研究院

GMT+8, 2024-5-3 15:26 , Processed in 0.167565 second(s), 22 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表