Добавлен ScorpioT1000,
опубликован
Алгоритмы, Наработки и Способности
Способ реализации:
Jass
Тип:
Алгоритм
Ловите, наверное самая быстрая функция по касту "тригерных" магий =)
(По скорости быстрее чем 20 обычных проверок GetSpellAbilityId()=='SPELL ID')
СабСтринг для того чтобы не "тригерные" магии не отлавливал (для нешаряших или недопонявщих.)
(По скорости быстрее чем 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
`
ОЖИДАНИЕ РЕКЛАМЫ...
Чтобы оставить комментарий, пожалуйста, войдите на сайт.
Ну вернет по локализации да. Если нестандартный то надо добавлять строку для локализации
Отредактирован Берги
Оптимизация вредна лишь тогда, когда она преждевременна.