魔兽地图编辑器吧 关注:65,195贴子:3,838,391
  • 20回复贴,共1

【分享】模拟眩晕系统

只看楼主收藏回复

来源:hiveworkshop网
作者:iAyanami
配置略微繁琐,新手劝退
原理就是马甲扔火球


IP属地:上海1楼2024-06-12 10:02回复
    不如风暴锤


    IP属地:安徽2楼2024-06-12 10:13
    收起回复
      广告
      立即查看


      IP属地:上海3楼2024-06-12 10:17
      收起回复
        library StunSystem uses Table
        //********************************************************************************
        // Stun - Version 1.2.0.0 - By iAyanami aka Ayanami
        //********************************************************************************
        //
        // Stun:
        // - An easy to use system that stuns units
        // - Able to keep track of the remaining stun duration
        //
        // Requirements:
        // - JASS NewGen
        // - Table
        //
        // Functions:
        // - Stun.apply takes unit whichUnit, real duration, boolean stack returns nothing
        // * whichUnit is the target to be stunned
        // * duration is the duration of the stun
        // * stack is to determine if the stun should be a stacking one or not
        // * true - the stun will stack, the duration of the stun will add up with the previous duration
        // * false - the stun will not stack, the unit will be stunned for the longer stun duration
        //
        // - Stun.getDuration takes unit whichUnit returns real
        // * whichUnit is the target to check
        // * returns the remaining stun duration
        //
        // - Stun.stop takes unit whichUnit returns nothing
        // * removes stun from the target
        //
        // How to import:
        // - Copy the whole "Stun" Trigger Folder into your map
        // - Save the map. Close and re-opem the map.
        // - You should have a new unit (Stun Dummy), ability (Stun (System)) and buff (Stun (System)) created
        // - Read through the Configuration part of the code
        //
        // Credits:
        // - Bribe for Table
        //
        //********************************************************************************
        // CONFIGURABLES
        //********************************************************************************
        globals
        // timer period. lower the value, the more accurate but might cause decrease in
        // performance
        private constant real PERIOD = 0.03125
        // raw code of ability "Stun (System)"
        private constant integer ABILID = 'A006'
        // raw code of buff "Stun (System)"
        private constant integer BUFFID = 'B002'
        // raw code of unit "Stun Dummy"
        private constant integer STUNID = 'n00N'
        endglobals
        //********************************************************************************
        // CODE
        //********************************************************************************
        // initialization
        module Init
        private static method onInit takes nothing returns nothing
        set table = Table.create()
        set caster = CreateUnit(Player(13), STUNID, 0, 0, 0)
        call UnitAddAbility(caster, ABILID)
        endmethod
        endmodule
        struct Stun extends array
        private unit u
        private real dur
        private thistype next
        private thistype prev
        private static Table table
        private static timer t = CreateTimer()
        private static unit caster
        private static integer count = 0
        // remove the stun and deallocate
        private method destroy takes nothing returns nothing
        call UnitRemoveAbility(this.u, BUFFID)
        if this.next != 0 then
        set this.next.prev = this.prev
        endif
        set this.prev.next = this.next
        set this.dur = 0
        set this.prev = thistype(0).prev
        set thistype(0).prev = this
        if thistype(0).next == 0 then
        call PauseTimer(t)
        endif
        call table.remove(GetHandleId(this.u))
        endmethod
        // iterating through all instances every PERIOD
        private static method iterate takes nothing returns nothing
        local thistype this = thistype(0)
        loop
        set this = this.next
        exitwhen this == 0
        if this.dur <= 0 or IsUnitType(this.u, UNIT_TYPE_DEAD) or GetUnitTypeId(this.u) == 0 then
        call this.destroy()
        else
        set this.dur = this.dur - PERIOD
        endif
        endloop
        endmethod
        // immediately removes stun for the specified unit
        // ex: call Stun.stop(whichTarget)
        static method stop takes unit u returns nothing
        local integer id = GetHandleId(u)
        if table.has(id) then
        call thistype(table[id]).destroy()
        endif
        endmethod
        // gets the duration left for stun, not stunned units always return 0
        // ex: local real r = Stun.getDuration(whichTarget)
        static method getDuration takes unit u returns real
        return thistype(table[GetHandleId(u)]).dur
        endmethod
        // stunning specified target and to see if the stun is a stacking one or not
        // ex: call Stun.apply(whichTarget, 5.0, false)
        static method apply takes unit u, real dur, boolean b returns nothing
        local thistype this
        local integer id = GetHandleId(u)
        if table.has(id) then
        set this = table[id]
        else
        if thistype(0).prev == 0 then
        set count = count + 1
        set this = count
        else
        set this = thistype(0).prev
        set thistype(0).prev = thistype(0).prev.prev
        endif
        if thistype(0).next == 0 then
        call TimerStart(t, PERIOD, true, function thistype.iterate)
        else
        set thistype(0).next.prev = this
        endif
        set this.next = thistype(0).next
        set thistype(0).next = this
        set this.prev = thistype(0)
        set table[id] = this
        set this.u = u
        set this.dur = 0
        call IssueTargetOrder(caster, "firebolt", this.u)
        endif
        if b and dur > 0 then
        set this.dur = this.dur + dur
        else
        if this.dur < dur then
        set this.dur = dur
        endif
        endif
        endmethod
        implement Init
        endstruct
        endlibrary


        IP属地:上海4楼2024-06-12 10:18
        回复
          就是个劣版buff系统啊 没啥用


          IP属地:安徽5楼2024-06-12 10:32
          收起回复
            可以替代JAPI眩晕么


            IP属地:广东6楼2024-06-12 10:40
            收起回复
              另外,本系统依赖Table系统,字数超限无法发送
              我连使用说明一起打包到网盘了
              链接:https://pan.baidu.com/s/1gV2FxCvX2nVGXcp5ClmT2g?pwd=hcdy
              提取码:hcdy


              IP属地:上海7楼2024-06-12 10:49
              回复
                一时想不到这个系统的应用场合


                IP属地:北京8楼2024-06-12 10:58
                收起回复
                  广告
                  立即查看
                  和我想的差不多,给单位一个风暴锤,设置100级,每个等级的眩晕时间成线性关系,然后要眩晕多久直接调等级就OK了


                  IP属地:江西来自Android客户端10楼2024-09-25 15:09
                  收起回复
                    如果你觉得这个对你没用大可以滑过去,我不懂为什么非要去否定它的存在意义,是想显自己能耐吗?
                    真有能力麻烦分享一个更好的
                    我也仅仅是看吧里没人做这个事 分享一下自己在用的


                    IP属地:上海11楼2024-09-25 23:42
                    回复