|
[jass]//===============暴击系统==========================
//参数:1.单位2.几率3.暴击伤害4.动画损伤时间5.是否远程(如果是近战,第4项可以随意填写)5.技能名字
function D_big2_A takes nothing returns nothing
local timer TM = GetExpiredTimer()
local trigger TG2 = I2TG(GetStoredInteger(udg_cache,I2S(H2I(TM )),"TG2"))
call FlushStoredMission(udg_cache,I2S(H2I(TM )))
call FlushStoredMission(udg_cache,I2S(H2I(TG2)))
call DestroyTrigger(TG2)
call DestroyTimer( TM )
set TG2 =null
set TM =null
endfunction
function big3_A takes nothing returns nothing
local trigger TG3 = GetTriggeringTrigger()
local trigger TG2 = I2TG(GetStoredInteger(udg_cache,I2S(H2I(TG3)),"TG2"))
local timer TM= I2TM(GetStoredInteger(udg_cache,I2S(H2I(TG3)),"Timer"))
local unit U = I2U(GetStoredInteger(udg_cache,I2S(H2I(TG3)),"U"))
local unit TU = GetTriggerUnit()
local real D =GetStoredReal(udg_cache,I2S(H2I(TG3)),"D")
local real I =GetStoredReal(udg_cache,I2S(H2I(TG3)),"I")
call FlushStoredMission(udg_cache,I2S(H2I(TG3)))
call FlushStoredMission(udg_cache,I2S(H2I(TG2)))
call FlushStoredMission(udg_cache,I2S(H2I(TM)))
call DestroyTimer(TM)
call DestroyTrigger( TG3 )
call DestroyTrigger(TG2)
if (GetEventDamageSource() == U and GetRandomInt(1, 100)<=I)then
call UnitDamageTarget(U,TU,D,true,false,ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
endif
set TG3 = null
set TG2 = null
set TM = null
set TU =null
set U =null
endfunction
function big2_A takes nothing returns nothing
local trigger TG2 = GetTriggeringTrigger()
local trigger TG3 = I2TG(GetStoredInteger(udg_cache,I2S(H2I(TG2)),"TG3"))
local timer TM = I2TM(GetStoredInteger(udg_cache,I2S(H2I(TG2)),"Timer"))
call FlushStoredMission(udg_cache,I2S(H2I(TG3)))
call FlushStoredMission(udg_cache,I2S(H2I(TG2)))
call FlushStoredMission(udg_cache,I2S(H2I(TM)))
call DestroyTimer(TM)
call DestroyTrigger(TG2)
call DestroyTrigger( TG3 )
set TG3 = null
set TG2 = null
set TM = null
endfunction
function big_A takes nothing returns nothing
local timer TM = CreateTimer()
local unit U = GetTriggerUnit()
local trigger TG = GetTriggeringTrigger()
local trigger TG2 = CreateTrigger()
local trigger TG3 = CreateTrigger()
local integer I = GetStoredInteger(udg_cache,I2S(H2I(TG)),"I")
local real D = GetStoredReal(udg_cache,I2S(H2I(TG)),"D")
local real T = GetStoredReal(udg_cache,I2S(H2I(TG)),"T")
local boolean TL = GetStoredBoolean(udg_cache,I2S(H2I(TG)),"TL")
call StoreInteger(udg_cache,I2S(H2I(TG3)),"U",H2I(U))
call StoreReal(udg_cache,I2S(H2I(TG3)),"D",D)
call StoreReal(udg_cache,I2S(H2I(TG3)),"I",I)
call StoreInteger(udg_cache,I2S(H2I(TG2)),"Timer",H2I(TM))
call StoreInteger(udg_cache,I2S(H2I(TG3)),"Timer",H2I(TM))
call StoreInteger(udg_cache,I2S(H2I(TM)),"TG2",H2I(TG2))
call StoreInteger(udg_cache,I2S(H2I(TG2)),"TG3",H2I(TG3))
call StoreInteger(udg_cache,I2S(H2I(TG3)),"TG2",H2I(TG2))
call TriggerRegisterUnitEvent( TG2, U, EVENT_UNIT_ISSUED_TARGET_ORDER )//发布指定目标命令
call TriggerRegisterUnitEvent( TG2, U, EVENT_UNIT_ISSUED_POINT_ORDER )//发布指定点命令
call TriggerRegisterUnitEvent( TG2, U, EVENT_UNIT_ISSUED_ORDER )//发布无目标命令
call TriggerAddAction( TG2, function big2_A )
call TriggerRegisterUnitEvent( TG3, GetEventTargetUnit() , EVENT_UNIT_DAMAGED ) //指定单位接受伤害
call TriggerAddAction( TG3,function big3_A )
if (TL==true)then
call TimerStart(TM,T,false,function D_big2_A)
else
call FlushStoredMission(udg_cache,I2S(H2I(TM)))
call DestroyTimer(TM)
endif
set TM =null
set U =null
set TG= null
set TG2 =null
set TG3 =null
endfunction
function Big_Dam takes unit U,integer I,real D,real T,boolean TL,string S returns nothing
local trigger TG = CreateTrigger()
call StoreInteger(udg_cache,S,I2S(H2I(U)),H2I(TG))
call StoreBoolean(udg_cache,I2S(H2I(TG)),"TL",TL)
call StoreInteger(udg_cache,I2S(H2I(TG)),"I",I)
call StoreReal(udg_cache,I2S(H2I(TG)),"D",D)
call StoreReal(udg_cache,I2S(H2I(TG)),"T",T)
call TriggerRegisterUnitEvent( TG, U, EVENT_UNIT_TARGET_IN_RANGE )//指定单位获得攻击目标
call TriggerAddAction( TG, function big_A )
endfunction
//========================删除暴击=====================
//参数:1.单位2.技能名字
function Del_Big_Dam takes unit U,string S returns nothing
local trigger TG = I2TG(GetStoredInteger(udg_cache,S,I2S(H2I(U))))
call FlushStoredMission(udg_cache,I2S(H2I(TG)))
call FlushStoredMission(udg_cache,S)
call DestroyTrigger(TG)
set TG = null
endfunction[/jass]
此系统可以避免 S流...
并且 可以精确输出伤害
可以衍生出很多形式的 几率技能
鉴于之前函数比较混乱
刚刚进行了改进和 整理
目前比较函数清楚
此函数 对于之前所提出来的局限性...
发现其实 延迟技能 的话 要出现BUG是非常小几率的....(具体只有在一个技能 伤害非常非常慢...就是比如一个投射无 飞出去的很慢....而且 就在此时你单位获取了目标...而且你的 攻击还没到达...那个 技能伤害刚好到达...而且 满足几率...
这个几率非常小...而且基本没有满足所有条件的技能出现....)
不过对于持续伤害 ...可能 出现BUG的几率就比较大点了...
所以用这个函数的话...英雄还是不能有持续伤害技能...或者持续伤害的伤害输出单位不是 此英雄 |
评分
-
查看全部评分
|