Наверное самая быстрая функция по касту "тригерных" магий

Добавлен , опубликован
Алгоритмы, Наработки и Способности
Способ реализации:
Jass
Тип:
Алгоритм
Ловите, наверное самая быстрая функция по касту "тригерных" магий =)
(По скорости быстрее чем 20 обычных проверок GetSpellAbilityId()=='SPELL ID')
СабСтринг для того чтобы не "тригерные" магии не отлавливал (для нешаряших или недопонявщих.)

function SpellCast takes nothing returns boolean
local string s=GetObjectName(GetSpellAbilityId())
if SubString(s,StringLength(s)-4,StringLength(s))=="Exec" then
 call ExecuteFunc(s)
endif
return false
endfunction

function InitTrig_Spell_Cast takes nothing returns nothing
local trigger t=CreateTrigger()
call TriggerAddCondition(t,Condition(function SpellCast))
call TriggerRegisterPlayerUnitEvent(t,Player(0x00),EVENT_PLAYER_UNIT_SPELL_CAST,null)
call TriggerRegisterPlayerUnitEvent(t,Player(0x01),EVENT_PLAYER_UNIT_SPELL_CAST,null)
call TriggerRegisterPlayerUnitEvent(t,Player(0x02),EVENT_PLAYER_UNIT_SPELL_CAST,null)
call TriggerRegisterPlayerUnitEvent(t,Player(0x03),EVENT_PLAYER_UNIT_SPELL_CAST,null)
call TriggerRegisterPlayerUnitEvent(t,Player(0x04),EVENT_PLAYER_UNIT_SPELL_CAST,null)
call TriggerRegisterPlayerUnitEvent(t,Player(0x05),EVENT_PLAYER_UNIT_SPELL_CAST,null)
call TriggerRegisterPlayerUnitEvent(t,Player(0x06),EVENT_PLAYER_UNIT_SPELL_CAST,null)
call TriggerRegisterPlayerUnitEvent(t,Player(0x07),EVENT_PLAYER_UNIT_SPELL_CAST,null)
call TriggerRegisterPlayerUnitEvent(t,Player(0x08),EVENT_PLAYER_UNIT_SPELL_CAST,null)
call TriggerRegisterPlayerUnitEvent(t,Player(0x09),EVENT_PLAYER_UNIT_SPELL_CAST,null)
call TriggerRegisterPlayerUnitEvent(t,Player(0x0A),EVENT_PLAYER_UNIT_SPELL_CAST,null)
call TriggerRegisterPlayerUnitEvent(t,Player(0x0B),EVENT_PLAYER_UNIT_SPELL_CAST,null)
call TriggerRegisterPlayerUnitEvent(t,Player(0x0C),EVENT_PLAYER_UNIT_SPELL_CAST,null)
call TriggerRegisterPlayerUnitEvent(t,Player(0x0D),EVENT_PLAYER_UNIT_SPELL_CAST,null)
call TriggerRegisterPlayerUnitEvent(t,Player(0x0E),EVENT_PLAYER_UNIT_SPELL_CAST,null)
call TriggerRegisterPlayerUnitEvent(t,Player(0x0F),EVENT_PLAYER_UNIT_SPELL_CAST,null)
set t=null
endfunction
`
ОЖИДАНИЕ РЕКЛАМЫ...
0
16
4 года назад
0
мизерное мизерному рознь. вот, например, добавил опцию для отключения обновления таблицы. игроку она не нужна, а у меня реплей на 50 минут мотается теперь 6 минут вместо семи. А в абсолютном значении всего 6% ускорения за счет лишнего if .
Оптимизация вредна лишь тогда, когда она преждевременна.
0
32
4 года назад
0
DracoL1ch, вот наконец-то слова похожие на правду и подкреплённые каким либо значением в 6% а не просто это метафорическое "быстрее"
Чтобы оставить комментарий, пожалуйста, войдите на сайт.