DotCastle BR™

[Spell] Throw Axe 2.0 Lion_shield
Olá Visitante!, seja bem-vindo ao fórum oficial DotCastle BR™️.

Nosso fórum é dedicado á criadores e editores de mapas para Warcraft III através do World Editor.

Aqui você encontrará spells, systems, tutoriais e muito mais ao alcance de um clique.

Conecte-se agora mesmo para acessar livremente o nosso conteúdo.

Nossos 35 usuários já postaram um total de 92 mensagens.


Participe do fórum, é rápido e fácil

DotCastle BR™

[Spell] Throw Axe 2.0 Lion_shield
Olá Visitante!, seja bem-vindo ao fórum oficial DotCastle BR™️.

Nosso fórum é dedicado á criadores e editores de mapas para Warcraft III através do World Editor.

Aqui você encontrará spells, systems, tutoriais e muito mais ao alcance de um clique.

Conecte-se agora mesmo para acessar livremente o nosso conteúdo.

Nossos 35 usuários já postaram um total de 92 mensagens.
DotCastle BR™
Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.
DotCastle BR™

Conecte-se e apresente-se para receber 25 pontos!
Nossos 35 usuários já postaram o total de 92 mensagens!
O DotCastle BR™ está ativo a 3915 dias.
Ei Convidado, você postou 0 de 92 mensagens!
Participe postando suas dúvidas. Compartilhe seus projetos. O DotCastle BR™ tem prazer em ajudar!
Não deixe de conferir as regras do fórum.

Você não está conectado. Conecte-se ou registre-se

[Spell] Throw Axe 2.0

Ir para baixo  Mensagem [Página 1 de 1]

1[Spell] Throw Axe 2.0 Empty [Spell] Throw Axe 2.0 Sáb Jul 06, 2013 4:59 am

Hisoka

Hisoka
Administrador
Administrador

Descrição da Spell:
O herói encanta seu machado e o arremessa em uma direção, causando danos á todos os inimigos no caminho. Ao término do percurso, o machado explode causando danos adicionais aos inimigos próximos.

Changelog:
v2.0 - Agora o projétil corta ás árvores que atingir;
v2.0 - Erro na direção do projétil corrigido.

Plataforma da Spell:
vJass

Requisitos:
JNGP (Jass New Generation Pack)

Setup (JESP):

Código:
module ThrowAxeSetup

    public static constant method PROJECTILE_RAWCODE takes nothing returns integer
        return 'dumm'
    endmethod
    
    public static constant method DUMMY_RAWCODE takes nothing returns integer
        return 'e000'
    endmethod

    public static constant method SPELL_RAWCODE takes nothing returns integer
        return 'A000'
    endmethod

    public static method SPELL_DAMAGE_FACTOR takes integer level returns integer
        return (level * 100)
    endmethod
    
    public static constant method SPELL_CONSTANT_RANGE takes nothing returns real
        return 1000.00
    endmethod

endmodule
Corpo do Script (Parte 1):

Código:
struct ThrowAxe extends array
    implement ThrowAxeSetup
    implement ThrowAxePart2

    private static hashtable hash = InitHashtable()

    private static method FlyUnit takes unit whichUnit,real whichHeight,real whichRate returns nothing
        call UnitAddAbility(whichUnit,'Amrf')
        call SetUnitFlyHeight(whichUnit,whichHeight,whichRate)
        call UnitRemoveAbility(whichUnit,'Amrf')
    endmethod

    private static method AngleAB takes location whichLocA,location whichLocB returns real
        local real r = 180. / 3.14159 * Atan2(GetLocationY(whichLocB) - GetLocationY(whichLocA),GetLocationX(whichLocB) - GetLocationX(whichLocA))
        return r
    endmethod

    private static method checkSpell takes nothing returns boolean
        local unit u = null
        local player p = null
        local integer i = 0
        local timer t = null
        local group g1 = null
        local group g2 = null
        local group g3 = null
        local unit d = null
        local location l1 = null
        local location l2 = null
        if GetSpellAbilityId()==SPELL_RAWCODE() then
            set u = GetTriggerUnit()
            set p = GetOwningPlayer(u)
            set i = GetUnitAbilityLevel(u,GetSpellAbilityId())
            set t = CreateTimer()
            set g1 = CreateGroup()
            set g2 = CreateGroup()
            set g3 = CreateGroup()
            set l1 = Location(GetUnitX(u),GetUnitY(u))
            set l2 = GetSpellTargetLoc()
            set d = CreateUnit(p,PROJECTILE_RAWCODE(),GetUnitX(u),GetUnitY(u),AngleAB(l1,l2))
            call FlyUnit(d,85.,0.)
            call SaveUnitHandle(hash,GetHandleId(t),StringHash("caster"),u)
            call SaveUnitHandle(hash,GetHandleId(t),StringHash("dummy"),d)
            call SaveInteger(hash,GetHandleId(t),StringHash("lvl"),i)
            call SaveGroupHandle(hash,GetHandleId(t),StringHash("g1"),g1)
            call SaveGroupHandle(hash,GetHandleId(t),StringHash("g2"),g2)
            call SaveGroupHandle(hash,GetHandleId(t),StringHash("g3"),g3)
            call SaveLocationHandle(hash,GetHandleId(t),StringHash("l1"),l1)
            call TimerStart(t,.04,true,function thistype.doLoop)
            set l1 = null
            set l2 = null
            set d = null
            set g3 = null
            set g2 = null
            set g1 = null
            set t = null
            set p = null
            set u = null
        endif
        return false
    endmethod

    private static method onInit takes nothing returns nothing
        local trigger t = CreateTrigger()
        local integer i = 0
        loop
            call TriggerRegisterPlayerUnitEvent(t,Player(i),ConvertPlayerUnitEvent(274),null)
            set i = i + 1
            exitwhen i == 12
        endloop
        call TriggerAddCondition(t,Condition(function thistype.checkSpell))
        set t = null
    endmethod

endstruct
Corpo do Script (Parte 2):

Código:
module ThrowAxePart2
    private static player p

    private static method DistanceAB takes location whichLocA,location whichLocB returns real
        local real r1 = GetLocationX(whichLocB) - GetLocationX(whichLocA)
        local real r2 = GetLocationY(whichLocB) - GetLocationY(whichLocA)
        return SquareRoot(r1 * r1 + r2 * r2)
    endmethod

    private static method ProjectionX takes real realX,real whichDist,real whichAngle returns real
        local real x = realX + whichDist * Cos(whichAngle * 3.14159 / 180.)
        return x
    endmethod

    private static method ProjectionY takes real realY,real whichDist,real whichAngle returns real
        local real y = realY + whichDist * Sin(whichAngle * 3.14159 / 180.)
        return y
    endmethod

    private static method killDestruct takes nothing returns nothing
        local destructable u = GetEnumDestructable()
        if GetDestructableLife(GetFilterDestructable())<75 and not IsDestructableInvulnerable(GetFilterDestructable()) then
            call KillDestructable(u)
        endif
        set u = null
    endmethod

    public static method doLoop takes nothing returns nothing
        local timer t = GetExpiredTimer()
        local unit u = LoadUnitHandle(hash,GetHandleId(t),StringHash("caster"))
        local unit d = LoadUnitHandle(hash,GetHandleId(t),StringHash("dummy"))
        local unit f = null
        local player p = GetOwningPlayer(u)
        local integer i = LoadInteger(hash,GetHandleId(t),StringHash("lvl"))
        local group g1 = LoadGroupHandle(hash,GetHandleId(t),StringHash("g1"))
        local group g2 = LoadGroupHandle(hash,GetHandleId(t),StringHash("g2"))
        local group g3 = LoadGroupHandle(hash,GetHandleId(t),StringHash("g3"))
        local location l1 = LoadLocationHandle(hash,GetHandleId(t),StringHash("l1"))
        local location l2 = null
        local real x = ProjectionX(GetUnitX(d),50.,GetUnitFacing(d))
        local real y = ProjectionY(GetUnitY(d),50.,GetUnitFacing(d))
        local effect e = null
        local effect e2 = null
        local destructable f2 = null
        local thistype exe = 0
        call SetUnitPosition(d,x,y)
        set l2 = Location(GetUnitX(d),GetUnitY(d))
        call GroupEnumUnitsInRange(g1,GetUnitX(d),GetUnitY(d),128.,null)
        set thistype.p = p
        call EnumDestructablesInCircleBJ(128,Location(GetUnitX(d),GetUnitY(d)),function thistype.killDestruct)
        loop
            set f = FirstOfGroup(g1)
            if GetUnitState(f,ConvertUnitState(0))>0 and IsUnitEnemy(f,p) and not IsUnitType(f,ConvertUnitType(15)) and not IsUnitInGroup(f,g2) then
                set e2 = AddSpecialEffect("Objects\\Spawnmodels\\Human\\HumanBlood\\HumanBloodKnight.mdl",GetUnitX(f),GetUnitY(f))
                call UnitDamageTarget(d,f,I2R(SPELL_DAMAGE_FACTOR(i)),false,false,ConvertAttackType(0),ConvertDamageType(4),ConvertWeaponType(0))
                call GroupAddUnit(g2,f)
                call DestroyEffect(e2)
                set e2 = null
            endif
            call GroupRemoveUnit(g1,f)
            exitwhen f == null
        endloop
        if DistanceAB(l1,l2) >= SPELL_CONSTANT_RANGE() then
            set e = AddSpecialEffect("Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl",GetUnitX(d),GetUnitY(d))
            call GroupEnumUnitsInRange(g1,GetUnitX(d),GetUnitY(d),312.,null)
            loop
                set f = FirstOfGroup(g1)
                if GetUnitState(f,ConvertUnitState(0))>0 and IsUnitEnemy(f,p) then
                    call UnitDamageTarget(d,f,I2R(SPELL_DAMAGE_FACTOR(i)),false,false,ConvertAttackType(0),ConvertDamageType(14),ConvertWeaponType(0))
                    call GroupAddUnit(g2,f)
                endif
                call GroupRemoveUnit(g1,f)
                exitwhen f == null
            endloop
            call FlushChildHashtable(hash,GetHandleId(t))
            call PauseTimer(t)
            call DestroyTimer(t)
            call KillUnit(d)
            call DestroyGroup(g1)
            call DestroyGroup(g2)
            call DestroyGroup(g3)
            call RemoveLocation(l1)
            call RemoveLocation(l2)
            call DestroyEffect(e)
        endif
        set e = null
        set l2 = null
        set l1 = null
        set g3 = null
        set g2 = null
        set g1 = null
        set p = null
        set d = null
        set u = null
        set t = null
    endmethod

endmodule
Download (Demo Map)
 - Open Source: pode ser aberto no World Editor.

JNGP (Link Externo)
 - Página de download da ferramenta
 - Instruções de uso e instalação na página de download (inglês).

https://dotcastlebr.forumeiros.com

Ir para o topo  Mensagem [Página 1 de 1]

Permissões neste sub-fórum
Não podes responder a tópicos