找回密码
 点一下
查看: 1127|回复: 4

这个伤害是怎么算的啊,我每0.05s造成(0.5+n/5000.0)执行420次,n是敌对单位数目

[复制链接]
发表于 2013-7-20 11:00:48 | 显示全部楼层 |阅读模式
本帖最后由 Simonade 于 2013-7-20 11:31 编辑

globals
    hashtable h=InitHashtable()
endglobals
//========================================================================
function Scale takes integer T returns nothing
    local unit dummy=LoadUnitHandle(h,0,0)
    call SetUnitScale(dummy,3.0+T*0.0125,3.0+T*0.0125,3.0+T*0.0125)
    set dummy=null
endfunction
//=========================================================================
function IsDrop takes nothing returns boolean
    return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(LoadUnitHandle(h,0,0)))==true   
endfunction
//=========================================================================
function Grow takes nothing returns nothing
    local timer t=GetExpiredTimer()
    local location point=LoadLocationHandle(h,GetHandleId(t),0)
    local unit dummy=LoadUnitHandle(h,0,0)
    local integer T=LoadInteger(h,GetHandleId(t),10)
    local integer n=LoadInteger(h,GetHandleId(t),11) //
    local group g=CreateGroup()
    local unit u
    local location loc
    local real ang
    set T=T+1
    call SaveInteger(h,GetHandleId(t),10,T)
    call BJDebugMsg("位置11111111111111"+I2S(T))
    call Scale(T)
    call BJDebugMsg("位置222222222222222222222222222222"+I2S(T))
    call GroupEnumUnitsInRange(g,GetLocationX(point),GetLocationY(point),500.0+(n/200.0)*100.0,Condition(function IsDrop))//Condition(function IsDrop)
    call BJDebugMsg("位置33333333333333333333333333333333333333333333333333333333"+I2S(T))
    loop
        set u=FirstOfGroup(g)
    exitwhen u==null
        set loc=GetUnitLoc(u)
        set ang=Atan2(GetLocationY(point)-GetLocationY(loc),GetLocationX(point)-GetLocationX(loc))
        call SetUnitX(u,GetLocationX(loc)+(5.0+n/25.0)*Cos(ang+1.0833-T*0.0025))
        call SetUnitY(u,GetLocationY(loc)+(5.0+n/25.0)*Sin(ang+1.0833-T*0.0025))
        call RemoveLocation(loc)
        call GroupRemoveUnit(g,u)
        call UnitDamageTarget(dummy,u,0.5+n/5000.0,false,false,ATTACK_TYPE_MELEE,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)//就是这里了单位数量n还不到100啊                                   
        set u=null        set loc=null
        set n=n+1
    endloop
    call SaveInteger(h,GetHandleId(t),11,n)
    if T==420 then
        call PauseTimer(t)
        call DestroyTimer(t)
        call RemoveLocation(point)
        call DestroyEffect(LoadEffectHandle(h,GetHandleId(point),0))//call DestroyEffect(LoadEffectHandle(h,GetHandleId(point),1))
        call FlushChildHashtable(h,GetHandleId(point))
        call FlushChildHashtable(h,GetHandleId(t))
        call RemoveUnit(dummy)          //LoadUnitHandle(h,0,0)
    endif
    call BJDebugMsg(I2S(n))
    set t=null
    set point=null
    set dummy=null
    set g=null
endfunction
//=======================================================
function Start takes nothing returns nothing
    local timer t
    local location point
    local unit dummy
    local effect eff1               //local effect eff2
    if GetSpellAbilityId()!='AUdd' then
        return
    endif
        set point=GetSpellTargetLoc()
        set eff1=AddSpecialEffect("war3mapImported\\Black.mdl",GetLocationX(point),GetLocationY(point))
        //set eff2=AddSpecialEffect("war3mapImported\\GrudgeAura.mdl",GetLocationX(point),GetLocationY(point))
        set dummy=CreateUnit(GetOwningPlayer(GetTriggerUnit()),'e001',GetLocationX(point),GetLocationY(point),0.0)
        call SaveEffectHandle(h,GetHandleId(point),0,eff1)       //call SaveEffectHandle(h,GetHandleId(point),1,eff2)
        call SaveUnitHandle(h,0,0,dummy)
        set t=CreateTimer()
        call SaveLocationHandle(h,GetHandleId(t),0,point)
        call TimerStart(t,0.05,true,function Grow)
    set t=null
    set point=null
    set dummy=null
    set eff1=null        //set eff2=null
endfunction
//===========================================================================
function InitTrig_blackhole takes nothing returns nothing
    local trigger t=CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddAction(t,function Start)
    set t=null
endfunction
//
//call Scale(T,point)
//loop
    //exitwhen i==2
    //call SetFogStateRadius(Player(i),FOG_OF_WAR_FOGGED,GetLocationX(point),GetLocationY(point),30.0+T*0.75,false)
    //set i=i+1
//endloop








黑洞吸的单位越多就吸引力越强,范围越大,结果把全图的单位都吸过来了。。。

黑洞吸的单位越多就吸引力越强,范围越大,结果把全图的单位都吸过来了。。。

太初黑洞测试版.w3x

50.75 KB, 下载次数: 0

发表于 2013-7-20 11:04:40 | 显示全部楼层
jass看不懂。不发言。

点评

啊,这个伤害计算是怎么个回事呢就是每0.05s造成(0.5+n/5000.0)点伤害,执行420次,n是每次单位组选取范围单位的计数:1到(单位组总共单位数目)。结果造成的伤害太大了,已经不是误差而是错误了。。。本来  详情 回复 发表于 2013-7-20 11:11
回复

使用道具 举报

 楼主| 发表于 2013-7-20 11:11:49 | 显示全部楼层
asd8645123123 发表于 2013-7-20 11:04
jass看不懂。不发言。

啊,这个伤害计算是怎么个回事呢就是每0.05s造成(0.5+n/5000.0)点伤害,执行420次,n是每次单位组选取范围单位的计数:1到(单位组总共单位数目)。结果造成的伤害太大了,已经不是误差而是错误了。。。本来想造成700到800点伤害,结果是2000到6000伤害。。。
回复

使用道具 举报

发表于 2013-7-25 02:47:59 | 显示全部楼层
本帖最后由 kp1997 于 2013-7-25 02:58 编辑

是不是数部队的时候n没有还原成0令n越来越大....我看了一遍都没有还原n的动作在
只是看到了n=n+1

点评

谢谢。。。对。。。已经改过来了  详情 回复 发表于 2013-7-25 10:19
回复

使用道具 举报

 楼主| 发表于 2013-7-25 10:19:27 | 显示全部楼层
kp1997 发表于 2013-7-25 02:47
是不是数部队的时候n没有还原成0令n越来越大....我看了一遍都没有还原n的动作在
只是看到了n=n+1

谢谢。。。对。。。已经改过来了
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-2 22:06 , Processed in 0.956938 second(s), 31 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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