TeaM KingS
[center]Ola Convidado, seja bem vindo ao TeaM KingS !

Nós temos tutoriais sobre o WarCraft World Editor: se você tiver alguma duvida pode perguntar que os moderadores ou membros experientes vão lhe ajudar.

Para melhor utilizar nossos recursos é extremamente recomendado que esteja logado em nosso fórum e que leia o nosso regulamento oficial.

Também temos fóruns sobre DotA AllstarS, com guias, estratégias, e muito mais!




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

TeaM KingS
[center]Ola Convidado, seja bem vindo ao TeaM KingS !

Nós temos tutoriais sobre o WarCraft World Editor: se você tiver alguma duvida pode perguntar que os moderadores ou membros experientes vão lhe ajudar.

Para melhor utilizar nossos recursos é extremamente recomendado que esteja logado em nosso fórum e que leia o nosso regulamento oficial.

Também temos fóruns sobre DotA AllstarS, com guias, estratégias, e muito mais!


TeaM KingS
Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.

[Spell] Attack Boost

2 participantes

Ir para baixo

[Spell] Attack Boost Empty [Spell] Attack Boost

Mensagem por Gilgamesh 2013-07-10, 20:47

Descrição da Spell:
O herói encanta sua arma com uma força mística, ativando algumas habilidades ocultas durante algum tempo ou durante certa quantidade de ataques.

Plataforma da Spell:
vJass

Requisitos:
JNGP (Jass New Generation Pack) v5d
USMWE v5

Setup (JESP):
Código:
module MiscBoostSetup

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

    public static constant method BUFF_RAWCODE takes nothing returns integer
        return 'B000'
    endmethod

    public static constant method AMOUNT_OF_BUFFS takes nothing returns integer
        return 3
    endmethod

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

    public static constant method DUMMY_SPELL_RAWCODE_02 takes nothing returns integer
        return 'A001'
    endmethod

    public static constant method DUMMY_SPELL_RAWCODE_03 takes nothing returns integer
        return 'A002'
    endmethod

    public static method ATTACK_AMOUNT_FACTOR takes integer level returns integer
        return 3 + (level * 2)
    endmethod

endmodule
Corpo do Script:
Código:
module MiscBoostAttack

    private static method checkAttacks takes nothing returns boolean
        local unit u = GetAttacker()
        local player p = null
        local integer i = 0
        if GetUnitAbilityLevel(u,BUFF_RAWCODE())>0 then
            set p = GetOwningPlayer(u)
            set attacks[GetPlayerId(p)] = attacks[GetPlayerId(p)] - 1
            if attacks[GetPlayerId(p)] == 0 then
                if AMOUNT_OF_BUFFS()==1 then
                    call UnitRemoveAbility(u,DUMMY_SPELL_RAWCODE_01())
                    call UnitRemoveAbility(u,BUFF_RAWCODE())
                elseif AMOUNT_OF_BUFFS()==2 then
                    call UnitRemoveAbility(u,DUMMY_SPELL_RAWCODE_01())
                    call UnitRemoveAbility(u,DUMMY_SPELL_RAWCODE_02())
                    call UnitRemoveAbility(u,BUFF_RAWCODE())
                elseif AMOUNT_OF_BUFFS()==3 then
                    call UnitRemoveAbility(u,DUMMY_SPELL_RAWCODE_01())
                    call UnitRemoveAbility(u,DUMMY_SPELL_RAWCODE_02())
                    call UnitRemoveAbility(u,DUMMY_SPELL_RAWCODE_03())
                    call UnitRemoveAbility(u,BUFF_RAWCODE())
                endif
            endif
            set p = null
        endif
        set u = null
        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(18),null)
            set i = i + 1
            exitwhen i == 13
        endloop
        call TriggerAddCondition(t,Condition(function thistype.checkAttacks))
        set t = null
    endmethod

endmodule

struct MiscBoost extends array
    implement MiscBoostSetup
    implement MiscBoostAttack

    private static integer array attacks
    private static hashtable hash = InitHashtable()

    private static method checkAvailable takes nothing returns nothing
        local timer t = GetExpiredTimer()
        local unit u = LoadUnitHandle(hash,GetHandleId(t),StringHash("caster"))
        local player p = GetOwningPlayer(u)
        if GetUnitAbilityLevel(u,BUFF_RAWCODE())==0 then
            if AMOUNT_OF_BUFFS()==1 then
                call UnitRemoveAbility(u,DUMMY_SPELL_RAWCODE_01())
            elseif AMOUNT_OF_BUFFS()==2 then
                call UnitRemoveAbility(u,DUMMY_SPELL_RAWCODE_01())
                call UnitRemoveAbility(u,DUMMY_SPELL_RAWCODE_02())
            elseif AMOUNT_OF_BUFFS()==3 then
                call UnitRemoveAbility(u,DUMMY_SPELL_RAWCODE_01())
                call UnitRemoveAbility(u,DUMMY_SPELL_RAWCODE_02())
                call UnitRemoveAbility(u,DUMMY_SPELL_RAWCODE_03())
            endif
            set attacks[GetPlayerId(p)] = 0
            call FlushChildHashtable(hash,GetHandleId(t))
            call PauseTimer(t)
            call DestroyTimer(t)
        endif
        set u = null
        set t = null
    endmethod

    private static method SetSpellLevel takes unit un,integer in,integer in2 returns nothing
        call UnitAddAbility(un,in)
        call SetUnitAbilityLevel(un,in,in2)
    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
        if GetSpellAbilityId()==SPELL_RAWCODE() then
            set u = GetTriggerUnit()
            set p = GetOwningPlayer(u)
            set i = GetUnitAbilityLevel(u,GetSpellAbilityId())
            set t = CreateTimer()
            call SaveUnitHandle(hash,GetHandleId(t),StringHash("caster"),u)
            if AMOUNT_OF_BUFFS()==1 then
                call SetSpellLevel(u,DUMMY_SPELL_RAWCODE_01(),i)
            elseif AMOUNT_OF_BUFFS()==2 then
                call SetSpellLevel(u,DUMMY_SPELL_RAWCODE_01(),i)
                call SetSpellLevel(u,DUMMY_SPELL_RAWCODE_02(),i)
            elseif AMOUNT_OF_BUFFS()==3 then
                call SetSpellLevel(u,DUMMY_SPELL_RAWCODE_01(),i)
                call SetSpellLevel(u,DUMMY_SPELL_RAWCODE_02(),i)
                call SetSpellLevel(u,DUMMY_SPELL_RAWCODE_03(),i)
            endif
            call TimerStart(t,.1,true,function thistype.checkAvailable)
            set attacks[GetPlayerId(p)] = ATTACK_AMOUNT_FACTOR(i)
            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
Notas:
 O campo destacado de amarelo na imagem abaixo indica quantos e quais buffs serão usados na spell, tendo como limite o número 3. Já os campos em verde servem para definir quais buffs estarão disponíveis.
[Spell] Attack Boost 10_07_2013_18_59_49
 Altere o valor conforme sua necessidade. Se desejar adicionar apenas o primeiro buff, utilize 1. Se desejar adicionar o primeiro e o segundo buff, utilize 2. Se desejar adicionar os três buffs, utilize 3.
-----

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).
Gilgamesh
Gilgamesh

Número de Posts : 313
Data de inscrição : 11/05/2013
Reputação : 69 Pontos : 23549

Warning Necropost
[Spell] Attack Boost Left_bar_bleue0 / 1000 / 100[Spell] Attack Boost Right_bar_bleue


http://www.DotCastleBR.forumeiros.com

Ir para o topo Ir para baixo

[Spell] Attack Boost Empty Re: [Spell] Attack Boost

Mensagem por Bills 2013-07-11, 19:08

vjass no Team Kings? As coisas estão evoluindo por aqui.

Mas enfim, parabens pelo seu código gilgamesh, sem leak nenhum. Só achei estranho você usar functions para retornar valores constantes, você poderia ter declarados variáveis mesmo. Mas você deve ter seus motivos e isso não atrapalha em nada, deixa pra lá.

Creio que você deve conhecer os sistemas Table e CTL, mas penso que não usou eles para deixa essa magia sem dependências. certo?

enfim... +rep

Ah boa sorte com seu projeto =)
Bills
Bills

Número de Posts : 1446
Data de inscrição : 04/12/2010
Reputação : 173 Pontos : 31079

Warning Necropost
[Spell] Attack Boost Left_bar_bleue35 / 10035 / 100[Spell] Attack Boost Right_bar_bleue


Ir para o topo Ir para baixo

[Spell] Attack Boost Empty Re: [Spell] Attack Boost

Mensagem por Gilgamesh 2013-07-11, 20:06

Grato pelo comentário camarada Bills...

O motivo de eu utilizar funções ao invés variáveis é por que aprendi assim nas aulas do Hive á um tempinho. Acredito que facilita a utilização dos leigos e também porque já acostumei. ")

Abraço...
Gilgamesh
Gilgamesh

Número de Posts : 313
Data de inscrição : 11/05/2013
Reputação : 69 Pontos : 23549

Warning Necropost
[Spell] Attack Boost Left_bar_bleue0 / 1000 / 100[Spell] Attack Boost Right_bar_bleue


http://www.DotCastleBR.forumeiros.com

Ir para o topo Ir para baixo

[Spell] Attack Boost Empty Re: [Spell] Attack Boost

Mensagem por Conteúdo patrocinado


Conteúdo patrocinado


Ir para o topo Ir para baixo

Ir para o topo

- Tópicos semelhantes

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