XGM Forum
Сайт - Статьи - Проекты - Ресурсы - Блоги

Форуме в режиме ТОЛЬКО ЧТЕНИЕ. Вы можете задать вопросы в Q/A на сайте, либо создать свой проект или ресурс.
Вернуться   XGM Forum > Warcraft> Барахолка
Ник
Пароль
Войти через VK в один клик
Сайт использует только имя.

Ответ
 
Hate
конь вакуумный
offline
Опыт: 43,117
Активность:
Король-Лич (Артас)
Чтоб не лежало без дела решил выкинуть сюда)
Карта содержит короля лича в виде Артаса с нестандартной озвучкой и способностями. Так же там лежат всякие мелочные функции которые могут кому нибудь пригодиться.
Способности взаимосвязаны, и поэтому если вы захотите вынуть какой либо один спелл, напишите лучше мне в личку или скайп при нехватке опыта.
Некоторые способности могут быть не доработаны.
Всего Артас имеет 4 геройские способности а так же 3 обычные.

Описание способностей

» Обычные

Власть крови

Когда вы атакуете под этой властью, есть 15% вероятность что вы попадете под воздействие ауры крови, которая увеличивает вашу атаку. Затем следует еще 15% вероятности при атаке что ваша атака повысится. Суммируется до 3 раз, эффект рассеивается после 15 секунд если способность снова не активируется, или спустя 15 секунд после достижения 3 ур эффекта.

Власть льда

Когда вас атакуют под этой властью, есть 15% вероятность что вы попадете под воздействие ауры льда, которая увеличивает вашу броню. Затем следует еще 15% что защита повысится. Суммируется до 3 раз, эффект рассеивается после 15 секунд если способность снова не активируется, или спустя 15 секунд после достижения 3 ур эффекта.

Власть нечестивости

Когда вы атакуете или вас атакуют под этой властью, есть 7.5% вероятность что вы попадете под воздействие ауры нечестивости, которая увеличивает вашу скорость передвижения и боя. Затем следует еще 7.5% что скорость бега и боя еще повысится. Суммируется до 3 раз, эффект рассеивается после 15 секунд если способность снова не активируется, или спустя 15 секунд после достижения 3 ур эффекта.
» Геройские

Заражение

Заражение вражеского воина болезнью "Черная чума". Вся скорость уменьшается, при этом он периодически теряет здоровье. При атаке зараженного героем или при срабатывании урона от заражения есть шанс распространить болезнь на соседнего воина, при этом время действия болезни обновляется. Бонус заражения от нечестивости: 4%. Периодический урон: 50% от силы (65% под властью нечестивости)
  • Уровень 1: Уменьшение скорости: 5%, шанс распространения 4% (8%)
  • Уровень 2: Уменьшение скорости: 7%, шанс распространения 6% (10%)
  • Уровень 3: Уменьшение скорости: 10%, шанс распространения 8% (12%)

Буран

Используя магию льда, посылает волну перед собой в радиусе 200. Противники отталкиваются, заледеневают на несколько сек., и становятся неуязвимыми, но получают небольшой урон от холода. При выполнении заклинания под властью льда на Лича накладывается эффект "Оледенение" которое увеличивает защиту.
  • Уровень 1: Время заморозки: 4 сек., 3 урона каждую сек. (Аура на 6% защиты)
  • Уровень 2: Время заморозки: 5 сек., 6 урона каждую сек. (Аура на 8% защиты)
  • Уровень 3: Время заморозки: 6 сек., 9 урона каждую сек. (Аура на 10% защиты)

Войско мертвых

Король-Лич проклинает землю под собой, и в течении 10 сек. все умершие начинают воскрешаться в виде вурдалаков. Вурдалаки могут восстановить здоровье/ману любому союзному или вашему герою жертвуя собой.
  • Уровень 1: Радиус воскрешения: 400, здоровье вурдалака: 330
  • Уровень 2: Радиус воскрешения: 450, здоровье вурдалака: 420
  • Уровень 3: Радиус воскрешения: 500, здоровье вурдалака: 495

Щит крови

Высасывает кровь из окружающих врагов накладывая на них отрицательный эффект "Слабость" длительностью 7 сек (Увеличивает получаемый урон на 12%)., при этом создавая щит из крови который поглощает урон. Кол-во поглощения составляет 40% от макс. здоровья (50% под властью крови) и бонусно по 30 ед. за каждого врага (макс. 5). После того как щит пробьют, 55% (65%) поглощенного урона переводится в здоровье. Время действия 10 сек.

Код и левые библиотеки

» Установки
library LichSettings initializer Init requires ArmyOfDead
include "cj_types.j"
    
define {
    GetHp(u) = GetUnitState(u, UNIT_STATE_LIFE)
    GetMp(u) = GetUnitState(u, UNIT_STATE_MANA)
    GetMaxHp(u) = GetUnitState(u, UNIT_STATE_MAX_LIFE)
    GetMaxMp(u) = GetUnitState(u, UNIT_STATE_MAX_MANA)
    chance(ch) = GetRandomReal(0.01, 100.) <= ch
    Clear(h) = FlushChildHashtable(LichSettings_hash, GetHandleId(h))
    GetData(v) = LoadInteger(LichSettings_hash, GetHandleId(v), 0)
    SetData(v,d) = SaveInteger(LichSettings_hash, GetHandleId(v), 0, d)
    CT = CreateTimer()
    CG = CreateGroup()
    DT(t) = DestroyTimer(t)
    DG(g) = DestroyGroup(g)
    GC(g) = GroupClear(g)
    msg(s) = DisplayTextToForce(bj_FORCE_ALL_PLAYERS, s)
    //=================================================
    LichKing_Id = 'U000'
    My_dummy = 'h000'
    Shield_dummy = 'h001'
    Shield_Effect_dummy = 'h002'
    DEATH_PACK_ID = 'A005'
    DARK_RITUAL_ID = 'A006'
    
    Snowstorm_Id = 'A008'
    Snowstorm_Debuff_Skill_Id = 'A00N'
    Snowstorm_Debuff_Id = 'B00A'
    Snowstorm_Range = 200.
    Snowstorm_TimeLvl1 = 4.
    Snowstorm_DamageLvl1 = 3.
    Snowstorm_TimeLvl2 = 5.
    Snowstorm_DamageLvl2 = 6.
    Snowstorm_TimeLvl3 = 6.
    Snowstorm_DamageLvl3 = 9.
    Snowstorm_Damage_Period = 1.
    Snowstorm_Bonus_Buff_Skill_Id = 'A00Q'
    Snowstorm_Bonus_Buff_Time = 11.
    
    ArmyOfDead_ID = 'A004'
    ArmyOfDead_DUMMY_ID = 'A007'
    ArmyOfDead_TIME = 10.
    
    INFECTION_ID = 'A009'
    INFECTION_DISEASE_LVL1_ID = 'A00B'
    INFECTION_DISEASE_LVL2_ID = 'A00I'
    INFECTION_DISEASE_LVL3_ID = 'A00J'
    INFECTION_BUFF_ID = 'B001'
    INFECTION_SPREAD_CHANCE_LVL1 = 4.
    INFECTION_SPREAD_CHANCE_LVL2 = 6.
    INFECTION_SPREAD_CHANCE_LVL3 = 8.
    INFECTION_UNHOLY_SPREAD_CHANCE_BONUS = 4.
    INFECTION_DAMAGE = 0.5
    INFECTION_UNHOLY_DAMAGE = 0.65
    INFECTION_TIME = 12.
    
    ShieldOfBlood_Id = 'A00A'
    ShieldOfBlood_BuffSkillId = 'A00O'
    ShieldOfBlood_BuffId = 'B008'
    ShieldOfBlood_Weakness_BuffId = 'B009'
    ShieldOfBlood_Time = 10.
    ShieldOfBlood_WeaknessMod = 0.12
    ShieldOfBlood_AbsorbAmount = 0.4
    ShieldOfBlood_AbsorbEnemyBonus = 30.
    ShieldOfBlood_HealAmount = 0.55
    ShieldOfBlood_BloodBonus = 0.1
    ShieldOfBlood_MaxEnemy = 5
        
    BloodPresence_Id = 'A001'
    BloodPresence_AuraId = 'A00F'
    BloodPresence_BuffId = 'B005'
    BloodPresence_BookId = 'A00H'
    BloodPresence_DummyId = 'A00K'
    FrostPresence_Id = 'A003'
    FrostPresence_SkillId = 'A004'
    FrostPresence_Dummy_SkillId = 'A00G'
    FrostPresence_Dummy_BuffId = 'B004'
    FrostPresence_BuffId = 'B006'
    FrostPresence_DummyId = 'A00L'
    UnholyPresence_Id = 'A002'
    UnholyPresence_BuffId = 'B007'
    UnholyPresence_AuraId = 'A00D'
    UnholyPresence_BookId = 'A00E'
    UnholyPresence_DummyId = 'A00M'
}
    
    // globals
    private trigger Useless = CreateTrigger()
    public hashtable hash = InitHashtable()
    public trigger Start = CreateTrigger()
    unit ForFilt_Unit1 = null, ForFilt_Unit2 = null
    
    
private void Start_Act(){
int id = GetSpellAbilityId()
    if id == INFECTION_ID {
        Infection_Actions(GetSpellAbilityUnit(),GetSpellTargetUnit(),GetUnitAbilityLevel(GetSpellAbilityUnit​(),id))
    }
    elseif id == DEATH_PACK_ID {
        SetUnitState(GetSpellTargetUnit(),UNIT_STATE_LIFE, (GetHp(GetTriggerUnit())*0.6)+GetHp(GetSpellTargetUnit()))
        TriggerSleepAction(0.1)
        KillUnit(GetTriggerUnit())
    }
    elseif id == DARK_RITUAL_ID {
        SetUnitState(GetSpellTargetUnit(),UNIT_STATE_MANA, (GetHp(GetTriggerUnit())*0.6)+GetMp(GetSpellTargetUnit()))
        TriggerSleepAction(0.1)
        KillUnit(GetTriggerUnit())
    }
    elseif id == ArmyOfDead_ID {
        ArmyOfDead_Actions(GetSpellAbilityUnit(),GetUnitAbilityLevel(GetSpellAbilityUnit(),id))
    }
    elseif id == Snowstorm_Id {
        if GetSpellTargetUnit() == null {
            Snowstorm_Actions(GetSpellAbilityUnit(),GetSpellTargetX(),GetSpellTargetY(),GetUnitAbilityLevel(GetS​pellAbilityUnit(),id))
        }
        else {
            Snowstorm_Actions(GetSpellAbilityUnit(),GetUnitX(GetSpellTargetUnit()),GetUnitY(GetSpellTargetUnit()​),GetUnitAbilityLevel(GetSpellAbilityUnit(),id))
        }
    }
    elseif id == ShieldOfBlood_Id {
        ShieldOfBlood_Actions(GetSpellAbilityUnit())
    }
    elseif id == BloodPresence_Id {
        bj_lastCreatedUnit = CreateUnit(GetOwningPlayer(GetSpellAbilityUnit()),My_dummy,GetUnitX(GetSpellAbilityUnit()),GetUnitY(​GetSpellAbilityUnit()),0.)
        UnitRemoveAbility(GetSpellAbilityUnit(),FrostPresence_BuffId)
        UnitRemoveAbility(GetSpellAbilityUnit(),UnholyPresence_BuffId)
        UnitAddAbility(bj_lastCreatedUnit,BloodPresence_DummyId)
        IssueTargetOrder(bj_lastCreatedUnit,"bloodlust",GetSpellAbilityUnit())
        UnitApplyTimedLife(bj_lastCreatedUnit,0,2.)
    }
    elseif id == FrostPresence_Id {
        bj_lastCreatedUnit = CreateUnit(GetOwningPlayer(GetSpellAbilityUnit()),My_dummy,GetUnitX(GetSpellAbilityUnit()),GetUnitY(​GetSpellAbilityUnit()),0.)
        UnitRemoveAbility(GetSpellAbilityUnit(),BloodPresence_BuffId)
        UnitRemoveAbility(GetSpellAbilityUnit(),UnholyPresence_BuffId)
        UnitAddAbility(bj_lastCreatedUnit,FrostPresence_DummyId)
        IssueTargetOrder(bj_lastCreatedUnit,"bloodlust",GetSpellAbilityUnit())
        UnitApplyTimedLife(bj_lastCreatedUnit,0,2.)
   }
    elseif id == UnholyPresence_Id {
        bj_lastCreatedUnit = CreateUnit(GetOwningPlayer(GetSpellAbilityUnit()),My_dummy,GetUnitX(GetSpellAbilityUnit()),GetUnitY(​GetSpellAbilityUnit()),0.)
        UnitRemoveAbility(GetSpellAbilityUnit(),FrostPresence_BuffId)
        UnitRemoveAbility(GetSpellAbilityUnit(),BloodPresence_BuffId)
        UnitAddAbility(bj_lastCreatedUnit,UnholyPresence_DummyId)
        IssueTargetOrder(bj_lastCreatedUnit,"bloodlust",GetSpellAbilityUnit())
        UnitApplyTimedLife(bj_lastCreatedUnit,0,2.)
    }
}
    
private void Useless_Actions(){
    if IsUnitInGroup(GetTriggerUnit(), DamageDetect_Group) {
        GroupRemoveUnit(DamageDetect_Group, GetTriggerUnit())
    }
    if IsUnitInGroup(GetTriggerUnit(), DamageBlocking_Group) {
        GroupRemoveUnit(DamageBlocking_Group, GetTriggerUnit())
    }
}
    
private void Init(){
    TriggerRegisterAnyUnitEventBJ(Useless, EVENT_PLAYER_UNIT_DEATH)
    TriggerAddAction(Useless,function Useless_Actions)
    TriggerRegisterAnyUnitEventBJ( Start, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    TriggerAddAction( Start, function Start_Act )
    bj_forLoopAIndex = -1
    while (bj_forLoopAIndex++ != bj_MAX_PLAYERS) {
        SetPlayerAbilityAvailable(Player(bj_forLoopAIndex),BloodPresence_BookId, false)
        SetPlayerAbilityAvailable(Player(bj_forLoopAIndex),UnholyPresence_BookId, false)
        SetPlayerAbilityAvailable(Player(bj_forLoopAIndex),Snowstorm_Bonus_Buff_Skill_Id, false)
    }
}

endlibrary
» Заражение
library Infection initializer Init requires MISC

    // globals
    private trigger Infection_DamageDetect = CreateTrigger()
    group DamageDetect_Group = CG
    private location Loc = Location(0.,0.)
    
private struct Inf
    unit caster,target
    real duration
    timer t
    
    void remove (){
        this.caster = null
        Clear(this.target)
        this.target = null
        DT(this.t)
        this.t = null
        this.destroy()
    }
endstruct


void DiseaseTime(){
timer t = GetExpiredTimer()
Inf st = GetData(t)
    if GetUnitAbilityLevel(st.target, INFECTION_BUFF_ID) != 0 {
        if GetUnitAbilityLevel(st.caster, UnholyPresence_BuffId) == 1 {
            UnitDamageTarget(st.caster,st.target,GetHeroStr(st.caster,true)*INFECTION_UNHOLY_DAMAGE,true,false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_DISEASE, WEAPON_TYPE_WHOKNOWS)
            TextUp(I2S(R2I(GetHeroStr(st.caster,true)*INFECTION_UNHOLY_DAMAGE)), st.target, 9., 20., 100., 20.) 
        }
        else {
            UnitDamageTarget(st.caster,st.target,GetHeroStr(st.caster,true)*INFECTION_DAMAGE,true,false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_DISEASE, WEAPON_TYPE_WHOKNOWS)
            TextUp(I2S(R2I(GetHeroStr(st.caster,true)*INFECTION_DAMAGE)), st.target, 9., 20., 100., 20.) 
        }
    }
    if (st.duration <= 0. or GetUnitAbilityLevel(st.target, INFECTION_BUFF_ID) == 0 or GetHp(st.target) <= 0.045) {
        UnitRemoveAbility(st.target, INFECTION_DISEASE_LVL1_ID)
        UnitRemoveAbility(st.target, INFECTION_DISEASE_LVL2_ID)
        UnitRemoveAbility(st.target, INFECTION_DISEASE_LVL3_ID)
        UnitRemoveAbility(st.target, INFECTION_BUFF_ID)
        st.remove()
        Clear(t)
    }
    else {
        st.duration -= 2.
    }
t = null
}

void Infection_Actions(unit caster, unit target, int abillvl){
Inf st
timer t = CT
    if GetUnitAbilityLevel(target, INFECTION_BUFF_ID) == 0 {
        st = Inf.create()
        if abillvl == 1 {
            UnitAddAbility(target, INFECTION_DISEASE_LVL1_ID)
        }
        elseif abillvl == 2 {
            UnitAddAbility(target, INFECTION_DISEASE_LVL2_ID)
        }
        elseif abillvl == 3 {
            UnitAddAbility(target, INFECTION_DISEASE_LVL3_ID)
        }
        st.caster = caster
        st.target = target
        st.duration = INFECTION_TIME
        st.t = t
        SetData(t,st)
        SetData(target,st)
        TimerStart(t, 2., true, function DiseaseTime)
    }
    else {
        st = GetData(target)
        st.duration = INFECTION_TIME
    }
    if GetUnitAbilityLevel(caster, UnholyPresence_BuffId) == 1 {
        UnitDamageTarget(caster,target,GetHeroStr(caster,true)*INFECTION_UNHOLY_DAMAGE,true,false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_DISEASE, WEAPON_TYPE_WHOKNOWS)
        TextUp(I2S(R2I(GetHeroStr(caster,true)*INFECTION_UNHOLY_DAMAGE)), target, 9., 20., 100., 20.) 
    }
    else {
        UnitDamageTarget(caster,target,GetHeroStr(caster,true)*INFECTION_DAMAGE,true,false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_DISEASE, WEAPON_TYPE_WHOKNOWS)
        TextUp(I2S(R2I(GetHeroStr(caster,true)*INFECTION_DAMAGE)), target, 9., 20., 100., 20.) 
    }
    if not IsUnitInGroup(target, DamageDetect_Group) {
        GroupAddUnit(DamageDetect_Group, target)
        TriggerRegisterUnitEvent(Infection_DamageDetect,target,EVENT_UNIT_DAMAGED)
    }
t = null
}

bool Spread_Filter(){
return (GetHp(GetFilterUnit()) > 0.045 and IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(ForFilt_Unit1)) and GetFilterUnit() != ForFilt_Unit2)
}

void Spread_Extended_Actions(unit source, unit target, bool b){
Inf st = GetData(target)
timer LightTimer
group g = CG
unit SpreadTarget
real source_z, target_z
    bj_lastCreatedEffect = AddSpecialEffectTarget("Pestilence.mdx",target,"overhead")
    DestroyEffect(bj_lastCreatedEffect)
    st.duration = INFECTION_TIME
    if b {
        UnitDamageTarget(source,target,GetHeroStr(source,true)*INFECTION_UNHOLY_DAMAGE,true,false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_DISEASE, WEAPON_TYPE_WHOKNOWS)
        TextUp(I2S(R2I(GetHeroStr(source,true)*INFECTION_UNHOLY_DAMAGE)), target, 9., 20., 100., 20.) 
    }
    else {
        UnitDamageTarget(source,target,GetHeroStr(source,true)*INFECTION_DAMAGE,true,false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_DISEASE, WEAPON_TYPE_WHOKNOWS)
        TextUp(I2S(R2I(GetHeroStr(source,true)*INFECTION_DAMAGE)), target, 9., 20., 100., 20.) 
    }
    ForFilt_Unit1 = source; ForFilt_Unit2 = target
    GroupEnumUnitsInRange(g,GetUnitX(target),GetUnitY(target),500.,Filter(function Spread_Filter))
    SpreadTarget = RandomFromGroup(g)
    if SpreadTarget != null {
        LightTimer = CT
        Infection_Actions(source, SpreadTarget, GetUnitAbilityLevel(source,INFECTION_ID))
        MoveLocation(Loc,GetUnitX(SpreadTarget),GetUnitY(SpreadTarget)); source_z = GetLocationZ(Loc)
        MoveLocation(Loc,GetUnitX(target),GetUnitY(target)); target_z = GetLocationZ(Loc)
        DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\Banish\\BanishTarget.mdl",GetUni​tX(target),GetUnitY(target)))
        bj_lastCreatedEffect = AddSpecialEffectTarget("Pestilence.mdx",SpreadTarget,"overhead")
        DestroyEffect(bj_lastCreatedEffect)
        SaveLightningHandle(LichSettings_hash,GetHandleId(LightTimer), 0, AddLightningEx("DRAL", true, GetUnitX(SpreadTarget),GetUnitY(SpreadTarget), source_z+45.,GetUnitX(target),GetUnitY(target), target_z+45.))
        TimerStart(LightTimer, 1.5, false, function LightningEffect)
        LightTimer = null
        SpreadTarget = null
    }
g = null
}

void Spread_Actions(){
unit source, victim
int lvl
    if (GetUnitAbilityLevel(GetTriggerUnit(), INFECTION_BUFF_ID) > 0 and GetUnitAbilityLevel(GetEventDamageSource(), INFECTION_ID) > 0) {
        source = GetEventDamageSource(); victim = GetTriggerUnit()
        lvl = GetUnitAbilityLevel(source, INFECTION_ID)
        if GetUnitAbilityLevel(source, UnholyPresence_BuffId) == 1 {
            if lvl == 1 {
                if chance(INFECTION_SPREAD_CHANCE_LVL1+INFECTION_UNHOLY_SPREAD_CHANCE_BONUS) {
                    Spread_Extended_Actions(source,victim,true)
                }
            }
            elseif lvl == 2 {
                if chance(INFECTION_SPREAD_CHANCE_LVL2+INFECTION_UNHOLY_SPREAD_CHANCE_BONUS) {
                    Spread_Extended_Actions(source,victim,true)
                }
            }
            elseif lvl == 3 {
                if chance(INFECTION_SPREAD_CHANCE_LVL3+INFECTION_UNHOLY_SPREAD_CHANCE_BONUS) {
                    Spread_Extended_Actions(source,victim,true)
                }
            }
        }
        else {
            if lvl == 1 {
                if chance(INFECTION_SPREAD_CHANCE_LVL1) {
                    Spread_Extended_Actions(source,victim,false)
                }
            }
            elseif lvl == 2 {
                if chance(INFECTION_SPREAD_CHANCE_LVL2) {
                    Spread_Extended_Actions(source,victim,false)
                }
            }
            elseif lvl == 3 {
                if chance(INFECTION_SPREAD_CHANCE_LVL3) {
                    Spread_Extended_Actions(source,victim,false)
                }
            }
        }
    source = null; victim = null
    }
}

private void Init (){
    TriggerAddAction(Infection_DamageDetect,function Spread_Actions)
}

endlibrary
» Буран
library SnowstormA

private struct Freezing
    unit victim
    real duration, tick
    int ability_lvl
    
    void remove (timer t){
        this.victim = null
        Clear(t)
        DT(t)
        this.destroy()
    }
endstruct


void SufferFromCold(){
timer t = GetExpiredTimer()
Freezing fz = GetData(t)
    if (fz.duration <= 0. or GetUnitState(fz.victim, UNIT_STATE_LIFE) <= 0.045){
        SetUnitInvulnerable(fz.victim, false)
        SetUnitTimeScale(fz.victim, 1.)
        UnitRemoveAbility(fz.victim, Snowstorm_Debuff_Skill_Id)
        UnitRemoveAbility(fz.victim, Snowstorm_Debuff_Id)
        PauseUnit(fz.victim, false)
        fz.remove(t)
    }
    else {
        fz.duration -= 0.1
        fz.tick += 0.1
            if fz.tick == Snowstorm_Damage_Period {
                fz.tick = 0.
                if fz.ability_lvl == 1 { 
                    SetUnitState(fz.victim, UNIT_STATE_LIFE, GetHp(fz.victim)-Snowstorm_DamageLvl1) 
                    TextUp(I2S(R2I(Snowstorm_DamageLvl1)), fz.victim, 9., 20., 20., 100.)
                }
                elseif fz.ability_lvl == 2 { 
                    SetUnitState(fz.victim, UNIT_STATE_LIFE, GetHp(fz.victim)-Snowstorm_DamageLvl2) 
                    TextUp(I2S(R2I(Snowstorm_DamageLvl2)), fz.victim, 9., 20., 20., 100.)
                }
                elseif fz.ability_lvl == 3 { 
                    SetUnitState(fz.victim, UNIT_STATE_LIFE, GetHp(fz.victim)-Snowstorm_DamageLvl3) 
                    TextUp(I2S(R2I(Snowstorm_DamageLvl3)), fz.victim, 9., 20., 20., 100.) 
                }
            }
    }
t = null
}

void Freeze_Burns(unit victim, int abil_lvl){
timer t = CT
Freezing fz = Freezing.create()
    SetUnitInvulnerable(victim, true)
    SetUnitTimeScale(victim, 0.)
    fz.victim = victim
    if abil_lvl == 1 {
        fz.duration = Snowstorm_TimeLvl1
    }
    elseif abil_lvl == 2 {
        fz.duration = Snowstorm_TimeLvl2
    }
    elseif abil_lvl == 3 {
        fz.duration = Snowstorm_TimeLvl3
    }
    fz.ability_lvl = abil_lvl
    UnitAddAbility(victim, Snowstorm_Debuff_Skill_Id)
    SetData(t, fz)
    TimerStart(t, 0.1, true, function SufferFromCold)
t = null
}

endlibrary


library SnowstormB requires MISC


void EndSnowstormBonus(){
timer t = GetExpiredTimer()
    UnitRemoveAbility(LoadUnitHandle(LichSettings_hash, GetHandleId(t), 0), Snowstorm_Bonus_Buff_Skill_Id)
Clear(t)
DT(t)
t = null
}
     
void Snowstorm_Actions(unit caster, real x, real y, int abillvl){
timer t
group g = CG
real angle = ABUC(caster,x,y)
unit temporary
    TriggerSleepAction(0.1)
    ShakeByUnit (caster, 0.7, 1050., 3)
    ForFilt_Unit1 = caster
    GroupEnumUnitsInRange(g, x, y, Snowstorm_Range, Filter(function ShieldOfBlood_Filter))
        while(FirstOfGroup(g) != null){
            temporary = FirstOfGroup(g)
            MoveIni(temporary, ABU(caster, temporary), 48., 5. , 1, true, abillvl)
            GroupRemoveUnit(g, temporary)
        }
    if GetUnitAbilityLevel(caster, FrostPresence_BuffId) == 1 {
       t = CT
       SaveUnitHandle(LichSettings_hash, GetHandleId(t), 0, caster)
       UnitAddAbility(caster, Snowstorm_Bonus_Buff_Skill_Id)
       TimerStart(t, Snowstorm_Bonus_Buff_Time, false, function EndSnowstormBonus)
    }
DG(g)
g = null
temporary = null
t = null
}

endlibrary
» Войско мертвых
library ArmyOfDead requires MISC

private struct AOD
    unit dummy
    effect spec
endstruct


void ArmyOfDead_EndActions(){
timer t = GetExpiredTimer()
AOD st = GetData(t)
    KillUnit(st.dummy)
    DestroyEffect(st.spec)
    st.dummy = null
    st.spec = null
st.destroy()
Clear(t)    
DT(t)
t = null    
}

void ArmyOfDead_Actions(unit caster, int abillvl){
AOD st = AOD.create()
timer t = CT
    st.dummy = CreateUnit(GetOwningPlayer(caster), My_dummy, GetUnitX(caster),GetUnitY(caster),0.)
    st.spec = AddSpecialEffect("GrudgeAura.mdx",GetUnitX(caster),GetUnitY(caster))
    SetUnitAbilityLevel(st.dummy, ArmyOfDead_DUMMY_ID ,abillvl)
    SetData(t,st)
    TimerStart(t, ArmyOfDead_TIME, false, function ArmyOfDead_EndActions)
    IssueImmediateOrder(st.dummy,"raisedeadon")
    AddSound("rsd1.wav",GetUnitX(caster),GetUnitY(caster))
t = null
}

endlibrary
» Щит крови
library ShieldOfBlood initializer Init requires MISC

define {
    GetAbsorb(h) = LoadReal(LichSettings_hash, GetHandleId(h),0)
    SetAbsorb(h,d) = SaveReal(LichSettings_hash, GetHandleId(h), 0, d)
}

    //globals
    private trigger DamageTaking = CreateTrigger()
    private unit need
    private timer someTimer, tm = CT
    group DamageBlocking_Group = CG
    
    
private struct SOB
    unit caster
    effect seal
    
    void remove(){
        this.caster = null
        this.seal = null
        this.destroy()
    }
endstruct 

private struct FullStruct
    unit target
    real abs, dm
    
    static thistype new(unit A, real ab, real dg){
        thistype NewStruct = thistype.create()
        NewStruct.target = A
        NewStruct.abs = ab
        NewStruct.dm = dg
        return NewStruct
    }
endstruct

private struct Buff
    unit caster
    real time, absorb_amount
    unit eff
endstruct


void ReversVulnerable(){
    SetUnitInvulnerable(need, false)
}

// this runned if unit have full life
void DamageBlocking_FullLifeCheck () {
FullStruct fs = GetData(GetExpiredTimer())
    if fs.abs > fs.dm
        SetUnitState(fs.target, UNIT_STATE_LIFE, GetUnitState(fs.target, UNIT_STATE_LIFE)+fs.dm)
        SetAbsorb(fs.target, GetAbsorb(fs.target)-(fs.dm))
    elseif fs.abs < fs.dm
        SetUnitState(fs.target, UNIT_STATE_LIFE, GetUnitState(fs.target, UNIT_STATE_LIFE)+(fs.dm - (fs.dm - fs.abs)))
        SetAbsorb(fs.target, 0.)
    endif
fs.target = null
fs.destroy()
Clear(GetExpiredTimer())
DestroyTimer(GetExpiredTimer())
}

// main func
void Damage_Blocking(){
FullStruct fs
real HP, dmg, residue, absorb, angle

    if (GetEventDamage() > 0 and GetUnitAbilityLevel(GetTriggerUnit(), ShieldOfBlood_BuffId) > 0)
        need = GetTriggerUnit()
        absorb = GetAbsorb(need)
        HP = GetUnitState(need, UNIT_STATE_LIFE)
        dmg = GetEventDamage()
        
        angle = ABU(need,GetEventDamageSource())
        bj_lastCreatedUnit = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), Shield_dummy, GetUnitX(need)+(14.*Cos(angle*bj_DEGTORAD)), GetUnitY(need)+(14.*Sin(angle*bj_DEGTORAD)), angle)
        SetUnitPathing(bj_lastCreatedUnit, false)
        UnitAddAbility(bj_lastCreatedUnit, 'Arav')
        SetUnitX(bj_lastCreatedUnit,GetUnitX(need)+(13.*Cos(angle*bj_DEGTORAD)))
        SetUnitY(bj_lastCreatedUnit,GetUnitY(need)+(13.*Sin(angle*bj_DEGTORAD)))  
        SetUnitFlyHeight(bj_lastCreatedUnit, GetUnitFlyHeight(need),0.)
        AddSound("Abilities\\Spells\\Orc\\MirrorImage\\MirrorImage.wav",GetUnitX(need), GetUnitY(need))
        
        if HP == GetUnitState(need, UNIT_STATE_MAX_LIFE)
            if dmg > HP
                residue = (dmg - absorb)
                if residue > HP
                else
                    SetUnitState(need, UNIT_STATE_LIFE, (HP-residue))
                    SetAbsorb(need, 0.)
                    SetUnitInvulnerable(need, true)
                    TimerStart(tm, 0.000, false, function ReversVulnerable)
                endif
            else
                someTimer = CreateTimer()
                fs = FullStruct.new(need,absorb,dmg)
                SetData(someTimer, fs)
                TimerStart(someTimer, 0.0, false, function DamageBlocking_FullLifeCheck)
            endif
        else
            if dmg > HP
                residue = (absorb+HP)-dmg
                if residue < 0.
                elseif residue > 0.
                    SetUnitInvulnerable(need, true)
                    TimerStart(tm, 0.000, false, function ReversVulnerable)
                    SetAbsorb(need, GetAbsorb(need)-dmg)
                    if GetAbsorb(need) < 0. { SetUnitState(need, UNIT_STATE_LIFE, HP-(dmg - absorb)) }
                endif
            elseif absorb > dmg
                SetUnitState(need, UNIT_STATE_LIFE, HP+dmg)
                SetAbsorb(need ,GetAbsorb(need)-dmg)
            elseif absorb < dmg
                SetUnitState(need, UNIT_STATE_LIFE, HP+(dmg - (dmg - absorb)))
                SetAbsorb(need , 0.)
            endif
        endif
    elseif (GetEventDamage() > 0 and GetUnitAbilityLevel(GetTriggerUnit(), ShieldOfBlood_Weakness_BuffId) > 0)
        SetUnitState(GetTriggerUnit(),UNIT_STATE_LIFE,GetHp(GetTriggerUnit())-(GetEventDamage() * ShieldOfBlood_WeaknessMod))
    endif
    
}

void BuffTick (){
Buff bts = GetData(GetExpiredTimer())
real CurrentAbsorbAmount = GetAbsorb(bts.caster)
    if (bts.time <= 0. or GetUnitAbilityLevel(bts.caster,ShieldOfBlood_BuffId) == 0 or CurrentAbsorbAmount <= 0.)
        UnitRemoveAbility(bts.caster,ShieldOfBlood_BuffSkillId)
        UnitRemoveAbility(bts.caster,ShieldOfBlood_BuffId)
        if GetUnitAbilityLevel(bts.caster, BloodPresence_BuffId) == 1 {
            SetUnitState(bts.caster, UNIT_STATE_LIFE, GetHp(bts.caster) + ( (bts.absorb_amount-CurrentAbsorbAmount) * (ShieldOfBlood_HealAmount+ShieldOfBlood_BloodBonus) ))
        }
        else {
            SetUnitState(bts.caster, UNIT_STATE_LIFE, GetHp(bts.caster) + ( (bts.absorb_amount-CurrentAbsorbAmount) * ShieldOfBlood_HealAmount) )
        }
        DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.​mdl",bts.caster,"origin"))
        KillUnit(bts.eff)
        RemoveUnit(bts.eff)
        bts.eff = null
        Clear(bts.caster)
        bts.caster = null
        bts.destroy()
        Clear(GetExpiredTimer())
        DestroyTimer(GetExpiredTimer())
    else
        bts.time -= 0.03
        SetUnitX(bts.eff, GetUnitX(bts.caster))
        SetUnitY(bts.eff, GetUnitY(bts.caster))
    endif
}

bool ShieldOfBlood_Filter(){
return (IsUnitType(GetFilterUnit(),UNIT_TYPE_DEAD) == false and IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(ForFilt_Unit1)) and IsUnitType(GetFilterUnit(),UNIT_TYPE_MAGIC_IMMUNE) == false)
}

void ShieldOfBlood_ForGroup(){
timer t = CT
location loc = Location(0.,0.)
real source_z, target_z
unit enumed = GetEnumUnit(), target = ForFilt_Unit1, d = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), My_dummy, GetUnitX(enumed),GetUnitY(enumed),0.)
    MoveLocation(loc,GetUnitX(enumed),GetUnitY(enumed)); source_z = GetLocationZ(loc)
    MoveLocation(loc,GetUnitX(target),GetUnitY(target)); target_z = GetLocationZ(loc)
    DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.​mdl", enumed, "chest"))
    IssueTargetOrder(d, "cripple", enumed)
    SaveLightningHandle(LichSettings_hash,GetHandleId(t), 0, AddLightningEx("AFOD", true, GetUnitX(enumed),GetUnitY(enumed), source_z+45.,GetUnitX(target),GetUnitY(target), target_z+45.))
    if IsUnitInGroup(enumed, DamageBlocking_Group) { }
    else { 
        TriggerRegisterUnitEvent(DamageTaking, enumed, EVENT_UNIT_DAMAGED) 
        GroupAddUnit(DamageBlocking_Group,enumed)
    }
    TimerStart(t, 1., false, function LightningEffect)
RemoveLocation(loc)
loc = null
enumed = null; target = null
t = null
}
    
void AbsorbingBlood(){
timer t = GetExpiredTimer()
SOB st = GetData(t)
Buff bts  = Buff.create()
group g = CG
int count 
real absorb_amount
    if GetUnitState(st.caster, UNIT_STATE_LIFE) > 0.045 {
        ForFilt_Unit1 = st.caster
        GroupEnumUnitsInRange(g, GetUnitX(st.caster),GetUnitY(st.caster), 500., Filter(function ShieldOfBlood_Filter))
        ForGroup(g, function ShieldOfBlood_ForGroup)
        count = CountUnitsInGroup(g)
        if count > ShieldOfBlood_MaxEnemy { count = ShieldOfBlood_MaxEnemy }
    
        if GetUnitAbilityLevel(st.caster, BloodPresence_BuffId) == 1 
        {absorb_amount = (GetMaxHp(st.caster) * (ShieldOfBlood_AbsorbAmount+ShieldOfBlood_BloodBonus)) + (count * 30.)}
        else 
        {absorb_amount = (GetMaxHp(st.caster) * ShieldOfBlood_AbsorbAmount) + (count * 30.)}
    
        SetAbsorb(st.caster, absorb_amount)
        UnitAddAbility(st.caster,ShieldOfBlood_BuffSkillId)
        if IsUnitInGroup(st.caster, DamageBlocking_Group) { }
        else { 
            TriggerRegisterUnitEvent(DamageTaking, st.caster, EVENT_UNIT_DAMAGED)
            GroupAddUnit(DamageBlocking_Group,st.caster)
        }
        bts.caster = st.caster
        bts.time = ShieldOfBlood_Time
        bts.absorb_amount = absorb_amount
        bts.eff = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),Shield_Effect_dummy,GetUnitX(st.caster),GetUnitY(st.caster​), GetRandomReal(0.,360.))
        someTimer = CreateTimer()
        SetData(someTimer, bts)
        TimerStart(someTimer, 0.03, true, function BuffTick)
    }
    else {
        bts.destroy()
    }
Clear(t)
DT(t)
GC(g)
DG(g)
g = null
t = null
}

void SealRemove(){
SOB st = GetData(GetExpiredTimer())
DestroyEffect(st.seal)
st.remove()
Clear(GetExpiredTimer())
DT(GetExpiredTimer())
}

void ShieldOfBlood_Actions(unit caster){
timer t = CT, t2 = CT
SOB st = SOB.create()
    st.caster = caster
    st.seal = AddSpecialEffectTarget("DeathSeal.mdx",caster,"origin")
    SetData(t,st)
    SetData(t2,st)
    TimerStart(t, 2.134, false, function SealRemove)
    TimerStart(t2, 1.534, false, function AbsorbingBlood)
t = null; t2 = null
}

private void Init(){
    TriggerAddAction(DamageTaking, function Damage_Blocking)
}

endlibrary
» Власти
library Presences initializer Init requires MISC

//globals
    private trigger Attacked = CreateTrigger()
    private timer Buff_Timer = CT
    private int Frost_Level = 0
    

void RemovingPresence(){
    UnitRemoveAbility(LoadUnitHandle(LichSettings_hash, GetHandleId(Buff_Timer), 0),GetData(Buff_Timer))
Frost_Level = 0
}
    
void Presences_Act(unit source, unit target){
int lvl
unit u
    if (GetUnitAbilityLevel(source, BloodPresence_BuffId) > 0) {
        lvl = GetUnitAbilityLevel(source, BloodPresence_AuraId)
        if lvl == 0 {
            if chance(15.) {
                UnitAddAbility(source, BloodPresence_BookId)
                SetData(Buff_Timer, BloodPresence_BookId)
                SaveUnitHandle(LichSettings_hash, GetHandleId(Buff_Timer),0, source)
                TimerStart(Buff_Timer, 15., false, function RemovingPresence)
                UnitRemoveAbility(source, FrostPresence_BuffId)
                UnitRemoveAbility(source, UnholyPresence_BookId)
            }
        }
        elseif lvl == 1 {
            if chance(15.) {
                SetUnitAbilityLevel(source, BloodPresence_AuraId, 2)
                SetData(Buff_Timer, BloodPresence_BookId)
                SaveUnitHandle(LichSettings_hash, GetHandleId(Buff_Timer),0, source)
                TimerStart(Buff_Timer, 15., false, function RemovingPresence)
                UnitRemoveAbility(source, FrostPresence_BuffId)
                UnitRemoveAbility(source, UnholyPresence_BookId)
            }
        }
        elseif lvl == 2 {
            if chance(15.) {
                SetUnitAbilityLevel(source, BloodPresence_AuraId, 3)
                SetData(Buff_Timer, BloodPresence_BookId)
                SaveUnitHandle(LichSettings_hash, GetHandleId(Buff_Timer),0, source)
                TimerStart(Buff_Timer, 15., false, function RemovingPresence)
                UnitRemoveAbility(source, FrostPresence_BuffId)
                UnitRemoveAbility(source, UnholyPresence_BookId)
            }
        }
    }
    elseif GetUnitAbilityLevel(target,FrostPresence_BuffId) > 0 {
        lvl = Frost_Level
        if lvl == 0 {
            if chance(15.) {
                bj_lastCreatedUnit = CreateUnit(GetOwningPlayer(target), My_dummy, GetUnitX(target), GetUnitY(target), 0.)
                IssueTargetOrder(bj_lastCreatedUnit, "frostarmor", target)
                SetData(Buff_Timer, 0)
                SaveUnitHandle(LichSettings_hash, GetHandleId(Buff_Timer),0, target)
                TimerStart(Buff_Timer, 15., false, function RemovingPresence)
                UnitRemoveAbility(source, BloodPresence_BookId)
                UnitRemoveAbility(source, UnholyPresence_BookId)
                Frost_Level = 1
            }
        }
        elseif lvl == 1 {
            if chance(15.) {
                bj_lastCreatedUnit = CreateUnit(GetOwningPlayer(target), My_dummy, GetUnitX(target), GetUnitY(target), 0.)
                SetUnitAbilityLevel(bj_lastCreatedUnit, FrostPresence_Dummy_SkillId, 2)
                IssueTargetOrder(bj_lastCreatedUnit, "frostarmor", target)
                SetData(Buff_Timer, 0)
                SaveUnitHandle(LichSettings_hash, GetHandleId(Buff_Timer),0, target)
                TimerStart(Buff_Timer, 15., false, function RemovingPresence)
                UnitRemoveAbility(source, BloodPresence_BookId)
                UnitRemoveAbility(source, UnholyPresence_BookId)
                Frost_Level = 2
            }
        }
        elseif lvl == 2 {
            if chance(15.) {
                bj_lastCreatedUnit = CreateUnit(GetOwningPlayer(target), My_dummy, GetUnitX(target), GetUnitY(target), 0.)
                SetUnitAbilityLevel(bj_lastCreatedUnit, FrostPresence_Dummy_SkillId, 3)
                IssueTargetOrder(bj_lastCreatedUnit, "frostarmor", target)
                SetData(Buff_Timer, 0)
                SaveUnitHandle(LichSettings_hash, GetHandleId(Buff_Timer),0, target)
                TimerStart(Buff_Timer, 15., false, function RemovingPresence)
                UnitRemoveAbility(source, BloodPresence_BookId)
                UnitRemoveAbility(source, UnholyPresence_BookId)
                Frost_Level = 3
            }
        }
    }
    elseif GetUnitAbilityLevel(target,UnholyPresence_BuffId) > 0 or GetUnitAbilityLevel(source,UnholyPresence_BuffId) > 0 {
        if GetUnitTypeId(target) == LichKing_Id { u = target }
        elseif GetUnitTypeId(source) == LichKing_Id { u = source }
        lvl = GetUnitAbilityLevel(u, UnholyPresence_AuraId)
        if lvl == 0 {
            if chance(7.5) {
                UnitAddAbility(u, UnholyPresence_BookId)
                SetData(Buff_Timer, UnholyPresence_BookId)
                SaveUnitHandle(LichSettings_hash, GetHandleId(Buff_Timer),0, u)
                TimerStart(Buff_Timer, 15., false, function RemovingPresence)
                UnitRemoveAbility(source, BloodPresence_BookId)
                UnitRemoveAbility(source, FrostPresence_BuffId)
            }
        }
        elseif lvl == 1 {
            if chance(7.5) {
                SetUnitAbilityLevel(u, UnholyPresence_AuraId, 2)
                SetData(Buff_Timer, UnholyPresence_BookId)
                SaveUnitHandle(LichSettings_hash, GetHandleId(Buff_Timer),0, u)
                TimerStart(Buff_Timer, 15., false, function RemovingPresence)
                UnitRemoveAbility(source, BloodPresence_BookId)
                UnitRemoveAbility(source, FrostPresence_BuffId)
            }
        }
        elseif lvl == 2 {
            if chance(7.5) {
                SetUnitAbilityLevel(u, UnholyPresence_AuraId, 3)
                SetData(Buff_Timer, UnholyPresence_BookId)
                SaveUnitHandle(LichSettings_hash, GetHandleId(Buff_Timer),0, u)
                TimerStart(Buff_Timer, 15., false, function RemovingPresence)
                UnitRemoveAbility(source, BloodPresence_BookId)
                UnitRemoveAbility(source, FrostPresence_BuffId)
            }
        }
        u = null
    }
}

bool Presences_Cond(){
    if (GetUnitAbilityLevel(GetAttacker(),BloodPresence_BuffId) > 0 or GetUnitAbilityLevel(GetTriggerUnit(),FrostPresence_BuffId) > 0 or GetUnitAbilityLevel(GetTriggerUnit(),UnholyPresence_BuffId) > 0 or GetUnitAbilityLevel(GetAttacker(),UnholyPresence_BuffId) > 0) {
        Presences_Act(GetAttacker(),GetTriggerUnit())
    }
return false
}
    
private void Init(){
    TriggerRegisterAnyUnitEventBJ(Attacked, EVENT_PLAYER_UNIT_ATTACKED)
    TriggerAddCondition(Attacked, Condition(function Presences_Cond))
}

endlibrary
» MISC
library MISC
    
//globals
    sound udg_SimError = null


real DBU (unit A, unit B) {
real dx = GetUnitX(B) - GetUnitX(A)
real dy = GetUnitY(B) - GetUnitY(A)
    return SquareRoot(dx * dx + dy * dy)
}

real ABU (unit A, unit B) {
    return Atan2(GetUnitY(B)-GetUnitY(A), GetUnitX(B)-GetUnitX(A))*bj_RADTODEG
}

real ABUC (unit A, real B_x, real B_y) {
    return Atan2(B_y-GetUnitY(A), B_x-GetUnitX(A))*bj_RADTODEG
}

real TBU (unit A, unit B, real speed) {
real dx = GetUnitX(B) - GetUnitX(A)
real dy = GetUnitY(B) - GetUnitY(A)
    return (SquareRoot(dx * dx + dy * dy)/speed)
}

function SimError takes player ForPlayer, string msg1 returns nothing
  if udg_SimError==null then
    set udg_SimError=CreateSoundFromLabel( "InterfaceError",false,false,false,10,10)
  endif
  if (GetLocalPlayer() == ForPlayer) then
    call ClearTextMessages()
    call DisplayTimedTextToPlayer( ForPlayer, 0.52, -1.00, 2.00, "|cffffcc00"+msg1+"|r" )
    call StartSound( udg_SimError )
  endif
endfunction

void TextUp(string s, unit u, real size,real r,real g, real b) {
//real sp =(64 * 0.071) / 128
real x1 = 0.0355 * Cos(90. * bj_DEGTORAD)
real y1 = 0.0355 * Sin(90. * bj_DEGTORAD)
    bj_lastCreatedTextTag = CreateTextTag()
    SetTextTagText(bj_lastCreatedTextTag, s, (size * 0.023) / 10)
    SetTextTagPosUnit(bj_lastCreatedTextTag, u, 7)
    SetTextTagColor(bj_lastCreatedTextTag, PercentToInt(r, 255), PercentToInt(g, 255), PercentToInt(b,255), 0)
    SetTextTagVelocity(bj_lastCreatedTextTag, x1,y1)
    SetTextTagPermanent(bj_lastCreatedTextTag, false)
    SetTextTagLifespan(bj_lastCreatedTextTag, 2.5)
    SetTextTagFadepoint(bj_lastCreatedTextTag, 0)
}

void Text(string s, unit u, unit u2, real size,real r,real g, real b) {
//real sp =(64 * 0.071) / 128
real x1 = 0.0355 * Cos(ABU(u,u2) * bj_DEGTORAD)
real y1 = 0.0355 * Sin(ABU(u,u2) * bj_DEGTORAD)
    bj_lastCreatedTextTag = CreateTextTag()
    SetTextTagText(bj_lastCreatedTextTag, s, (size * 0.023) / 10)
    //SetTextTagPos(bj_lastCreatedTextTag, x, y, 7)
    SetTextTagPosUnit(bj_lastCreatedTextTag, u2, 7)
    SetTextTagColor(bj_lastCreatedTextTag, PercentToInt(r, 255), PercentToInt(g, 255), PercentToInt(b,255), 0)
    SetTextTagVelocity(bj_lastCreatedTextTag, x1,y1)
    SetTextTagPermanent(bj_lastCreatedTextTag, false)
    SetTextTagLifespan(bj_lastCreatedTextTag, 2.5)
    SetTextTagFadepoint(bj_lastCreatedTextTag, 0)
}

void AddSound(string s, real x, real y) {
sound snd = CreateSound(s, false, true, true, 10, 10, "CombatSoundsEAX")
    SetSoundChannel(snd, 40)
    SetSoundVolume(snd, 127)
    SetSoundPitch(snd, 1)
    SetSoundDistances(snd, 600, 10000)
    SetSoundDistanceCutoff(snd, 2100)
    SetSoundConeAngles(snd, 0.0, 0.0, 127)
    SetSoundConeOrientation(snd, 0.0, 0.0, 0.0)
    SetSoundPosition(snd, x, y, 50)
    StartSound(snd)
    KillSoundWhenDone(snd)
snd = null
}

function RandomEnum takes nothing returns nothing
local integer r = GetRandomInt(1,bj_groupRandomConsidered)
local unit u = GetEnumUnit()
    if r != 1 then
        call GroupRemoveUnit(bj_groupAddGroupDest, u)
    else
        set bj_groupRandomCurrentPick = u
    endif
set u = null
endfunction

function RandomFromGroup takes group g returns unit
    set bj_groupRandomConsidered = CountUnitsInGroup(g)
    call ForGroup(g, function RandomEnum)
    call GroupClear(bj_groupAddGroupDest)
    call DestroyGroup(bj_groupAddGroupDest)
return bj_groupRandomCurrentPick
endfunction

void LightningEffect(){
DestroyLightning(LoadLightningHandle(LichSettings_hash,GetHandleId(GetExpiredTimer()), 0))
FlushChildHashtable(LichSettings_hash,GetHandleId(GetExpiredTimer()))
DT(GetExpiredTimer())
}

endlibrary
» SimpleMoving
library SimpleMoving needs SnowstormA

//globals
	private group MovingGroup = CreateGroup()
    private hashtable hash = InitHashtable()


define  {
        saveS = SaveInteger(hash, GetHandleId(t), 0,DB)
        loadS = LoadInteger(hash, GetHandleId(t), 0)
        }

struct Move
    unit un
    real x, y, time, angle, mod
    bool pause
    int ablvl
    
method dcr takes void returns void
    this.time = this.time-0.02
endmethod
    
method extinction takes void returns void
    this.mod = this.mod/1.3
    this.x = this.mod * Cos(this.angle * bj_DEGTORAD)
    this.y = this.mod * Sin(this.angle * bj_DEGTORAD)
endmethod 

endstruct


private function PeriodicMoving takes nothing returns nothing
timer t = GetExpiredTimer()
Move DB = loadS
real xu = GetUnitX(DB.un)
real yu = GetUnitY(DB.un)
real some
    if (DB.time <= 0 or not IsUnitInGroup(DB.un, MovingGroup) or GetUnitState(DB.un, UNIT_STATE_LIFE) <= 0.045) then
        DestroyTimer(t)
        if DB.pause then 
            PauseUnit(DB.un,false)
        endif
        GroupRemoveUnit(MovingGroup, DB.un)
        FlushChildHashtable(hash,GetHandleId(t))
        DB.destroy()
    else
        SetUnitPosition( DB.un, xu+DB.x, yu+DB.y)
        DB.time -= 0.02
    endif
t = null
endfunction

private function PeriodicStagger takes nothing returns nothing
timer t = GetExpiredTimer()
Move DB = loadS
real x1 = GetUnitX(DB.un)
real y1 = GetUnitY(DB.un)
    if (DB.mod <= 0.8 or not IsUnitInGroup(DB.un, MovingGroup) or GetUnitState(DB.un, UNIT_STATE_LIFE) <= 0.045) then
        GroupRemoveUnit(MovingGroup, DB.un)
        if DB.pause then 
            Freeze_Burns(DB.un, DB.ablvl)
        endif
        IssueImmediateOrder(DB.un, "stop")
        FlushChildHashtable(hash,GetHandleId(t))
        DB.destroy()
        DestroyTimer(t)
    else
        SetUnitPosition( DB.un,x1+DB.x,y1+DB.y)
        DB.mod /= 1.3
        DB.x = DB.mod * Cos(DB.angle * bj_DEGTORAD)
        DB.y = DB.mod * Sin(DB.angle * bj_DEGTORAD)
    endif
t = null
endfunction

function MoveIni takes unit u, real angle, real Mod, real time , integer Switch, boolean pause, int ablvl returns nothing
timer t = CreateTimer()
int h = GetHandleId(t)
Move DB = Move.create()
    DB.x = (Mod * Cos(angle * bj_DEGTORAD))
    DB.y = (Mod * Sin(angle * bj_DEGTORAD))
    //------------------------------------------------
    DB.un = u
    DB.time = time
    DB.angle = angle
    DB.mod = Mod
    DB.pause = pause
    DB.ablvl = ablvl
    saveS
    if pause then
        call PauseUnit(u,true)
    endif
//------------------------------------------------
UnitAddAbility(u, 'Arav')
UnitRemoveAbility(u, 'Arav')
//SetUnitPathing(u, false)
    if Switch == 1 then
        call TimerStart(t, 0.02, true, function PeriodicStagger)
        call GroupAddUnit(MovingGroup, u)
    else
        call TimerStart(t, 0.02, true, function PeriodicMoving)
        call GroupAddUnit(MovingGroup, u)
    endif
set t = null
endfunction

endlibrary
» LocalShake
library LocalShake

define private clear(h) = FlushChildHashtable(hash, GetHandleId(h))

//globals
    private int g_power = 0
    private force Force_Filter = CreateForce(), CopyedForce = CreateForce()
    private hashtable hash = InitHashtable()

    
private void ForceAddForce (){
    ForceAddPlayer(CopyedForce, GetEnumPlayer())
}

force CopyForce(force f){
CopyedForce = CreateForce()
    ForForce(f, function ForceAddForce)
return CopyedForce
}

//----------------=================-------------------

private function f_end takes nothing returns nothing
    CameraClearNoiseForPlayer(GetEnumPlayer())
endfunction

private function f_start_power takes nothing returns nothing
    CameraSetEQNoiseForPlayer( GetEnumPlayer(), g_power )
endfunction

private void shake_time () {
force f = LoadForceHandle(hash, GetHandleId(GetExpiredTimer()), 0)
     ForForce(f, function f_end)
ForceClear(f)
clear(GetExpiredTimer())
DestroyTimer(GetExpiredTimer())
DestroyForce(f)
f = null
}

private bool players_filter(){
    ForceAddPlayer(Force_Filter, GetOwningPlayer(GetFilterUnit()))
return false
}

void ShakeByUnit (unit u, real time, real range, int power) {
group g = CreateGroup()
timer t = CreateTimer()
force f1
    GroupEnumUnitsInRange(g, GetUnitX(u),GetUnitY(u), range, Filter(function players_filter))
    f1 = CopyForce(Force_Filter)
    SaveForceHandle(hash, GetHandleId(t), 0, f1)
    TimerStart(t, time, false, function shake_time)
    g_power = power
    ForForce(f1, function f_start_power)
DestroyGroup(g)
g = null
t = null
f1 = null
}

void ShakeByCoords (real shake_x, real shake_y, real time, real range, int power) {
group g = CreateGroup()
timer t = CreateTimer()
force f1
    GroupEnumUnitsInRange(g, shake_x, shake_y, range, Filter(function players_filter))
    f1 = CopyForce(Force_Filter)
    SaveForceHandle(hash, GetHandleId(t), 0, f1)
    TimerStart(t, time, false, function shake_time)
    g_power = power
    ForForce(f1, function f_start_power)
DestroyGroup(g)
g = null
t = null
f1 = null
}

endlibrary
Так же выражаю благодарность тем чьи модели и иконки используются в карте.
Миниатюры
Кликните на картинку для увеличения
Название:  Руны.JPG
Просмотров: 111
Размер:  3.5 Кбайт  Кликните на картинку для увеличения
Название:  Способности.JPG
Просмотров: 90
Размер:  4.8 Кбайт  
Прикрепленные файлы
Тип файла: w3x Lich king.w3x (1.66 Мбайт, 198 просмотров )
Старый 30.04.2013, 16:19
Ответ

Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск

Ваши права в разделе
Вы не можете создавать темы
Вы не можете отвечать на сообщения
Вы не можете прикреплять файлы
Вы можете скачивать файлы

BB-коды Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход



Часовой пояс GMT +3, время: 02:01.