找回密码
 立即注册
楼主: 大谎言家

余波中的JASS研究

[复制链接]
 楼主| 发表于 2015-5-13 00:22:39 | 显示全部楼层
实际效果比前几个都长

function SMAW_Effect takes location target,unit caster, integer id, integer rpg_l, integer rockettype returns nothing
//参数为目标地点,施法单位,id,rpgl,rockettype
    local real x = GetLocationX(target)
    local real y = GetLocationY(target)//目标位置
    local real z
    local real x1
    local real y1
    local real theta = 0.0
    local integer n = 8
    local real thetastep = 360.0/n//360/8,不知作何
    local real damage
    local real angle
    local integer A = 1
    local group g
    local rect r = Rect(x-300,y-300,x+300,y+300)//不知是什么
    local unit u = CreateUnit(ConvertedPlayer(id),'e003',x,y,0.0)
    local real blastradius = udg_rpg_radius[rpg_l]//目测这个是溅射伤害——实际上是伤害范围
    local real blastdamage = udg_rpg_damage[rpg_l]//这么多变量,见鬼
    if rockettype==3 then //HEAA//穿甲就是高伤害低溅射
        set blastradius = blastradius*0.5
        set blastdamage = blastdamage*1.25//
    endif
    set z = udg_rpg_radius[rpg_l]/2.0
    set g = AMGetUnitsInRange(blastradius, target, null)
    call UnitDamagePoint(caster,0,blastradius,x,y,blastdamage,true,false,udg_SMAWWarhead[id],DAMAGE_TYPE_DEMOLITION,WEAPON_TYPE_WHOKNOWS)//范围伤害单位
    call ForGroup(g, function killexplosive)
    call DestroyGroup(g)
    set udg_soundpath = "war3mapImported\\Explosion2.mp3"//播放音效
    call ExecuteFunc("PlaySoundPath")
    set udg_myinteger = rpg_l
    call EnumDestructablesInRect(r,null,function killtree)//炸树
    call EnumItemsInRect(r,null,function killitem)//炸物品
    call RemoveRect(r)
    call KillUnit(u)
    set r = null
    if rockettype==3 then //HEAA
        call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\Human\\FragmentationShards\\FragBoomSpawn.mdl",x,y))//特效
    else
        call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl",x,y))//特效
    endif
    call EarShockArea(x,y,blastradius+150.0)//耳鸣
    set g = AMGetUnitsInRange(blastradius+50,target,null)
    loop
        set u = FirstOfGroup(g)
        exitwhen u==null
        if GetWidgetLife(u)>0.405 and GetUnitAbilityLevel(u,'Avul')<1 and ShockwaveSafe(u) then
            set angle = Atan2(y-GetUnitY(u),x-GetUnitX(u))
            if GetUnitPointValue(u)==50 then
                call PushUnit(u,angle,20,7.5,0.04)
            else
                call PushUnit(u,angle,30,10.0,0.04)//吹怪
            endif
        endif
        call GroupRemoveUnit(g,u)
    endloop
    call DestroyGroup(g)
    set g = null
    loop
        exitwhen A > n
        set x1 = x+z*Cos(theta)
        set y1 = y+z*Sin(theta)
        if RectContainsCoords(bj_mapInitialPlayableArea,x1,y1) then
            call DestroyEffect(AddSpecialEffect("Abilities\\Weapons\\SteamTank\\SteamTankImpact.mdl",x1,y1))//特效灰尘
        endif
        set theta = theta + thetastep
        set A = A + 1
    endloop
endfunction
回复

使用道具 举报

 楼主| 发表于 2015-5-13 21:46:03 | 显示全部楼层
耳鸣

function EarShockArea takes real x, real y, real dist returns nothing
//参数为坐标和范围
    local unit u
    local integer i = 1
    local integer valid = 1
    local real dx
    local real dy
    loop
        exitwhen i>udg_InitialPlayers
        if GetWidgetLife(udg_Hero[udg_Sorted])>0.405 and GetUnitTypeId(udg_Hero[udg_Sorted])!='h00E' then //Predator is not affected by Tinnitus//英雄是存活的并且无人机不受影响
            set u = udg_Hero[udg_Sorted]
        elseif GetWidgetLife(udg_Pet[udg_Sorted])>0.405 then
            set u = udg_Pet[udg_Sorted]//宠物也受影响
        else
            set valid = 0
        endif
        if valid==1 then
            set dx = GetUnitX(u) - x
            set dy = GetUnitY(u) - y
            if dx*dx+dy*dy<=dist*dist then//判断单位是不是在耳鸣范围内
                set udg_EarShockPlayer = Player(udg_Sorted-1)//耳鸣玩家
                set udg_EarShockTime = 8.0//耳鸣8秒
                call ExecuteFunc("EarShock")
            endif
        endif
        set valid = 1
        set i=i+1
    endloop
    set u = null
endfunction

function EarShock takes nothing returns nothing
    local player p = udg_EarShockPlayer
    local real d = udg_EarShockTime
    local timer t = GetHandleTimer(p,"earshocktimer")
    if t==null then
        set t = CreateTimer()//计时器
        call SetHandleHandle(p,"earshocktimer",t)//储存了数据
        call SetHandleHandle(t,"p",p)
        call TimerStart(t,0.05,true, function EarShock_loop)//开启计时器
    endif
    if p==GetLocalPlayer() then//本地玩家
        call StopSound(gg_snd_ringing,false,false)
        call StartSound(gg_snd_ringing)//停止掉之前的耳鸣
    endif
    call CameraSetEQNoiseForPlayer(p,2.5)//噪音
    call PauseTimer(t)//暂停计时器?
    call SetVolForP(p,0.0)//关掉玩家的声音
    call SetHandleInteger(t,"i",0)
    call PolledWait(0.5)//等待0.5s
    call CameraClearNoiseForPlayer(p)//取消噪音
    call CameraSetTargetNoiseForPlayer(p,4.0,0.02)//又是噪音
    call PolledWait(d-0.5)
    call ResumeTimer(t)
    set t = null
endfunction

function SetVolForP takes player p, real v returns nothing//给玩家设置音量
    if GetLocalPlayer()==p then
        call VolumeGroupSetVolume(SOUND_VOLUMEGROUP_UNITSOUNDS,v*.7)
        call VolumeGroupSetVolume(SOUND_VOLUMEGROUP_SPELLS,v)
        call VolumeGroupSetVolume(SOUND_VOLUMEGROUP_COMBAT,v)
        call VolumeGroupSetVolume(SOUND_VOLUMEGROUP_FIRE,v)
        call VolumeGroupSetVolume(SOUND_VOLUMEGROUP_UI,v)
        call VolumeGroupSetVolume(SOUND_VOLUMEGROUP_AMBIENTSOUNDS,v)
    endif
endfunction

function EarShock_innerloop takes timer t returns nothing//这个应该是音量回复的函数
    local integer i = GetHandleInteger(t,"i")
    local player p = GetHandlePlayer(t,"p")
    if i>20 then
        call FlushHandleLocals(t)
        call DestroyTimer(t)
        call SetHandleHandle(p,"earshocktimer",null)
    else
        call SetVolForP(p,5.0*i) //Add non linearity here if necessary
        call SetHandleInteger(t,"i",i+1)
    endif
endfunction

function EarShock_loop takes nothing returns nothing
    call EarShock_innerloop(GetExpiredTimer())
endfunction

[发帖际遇]: 大谎言家在E区清除1个寄生虫孢子,奖励金钱144天使币.
回复

使用道具 举报

 楼主| 发表于 2015-5-14 23:25:48 | 显示全部楼层
Ammunition Feed
function AmmoFeedConditions takes nothing returns boolean
    return GetSpellAbilityId()=='A034'
endfunction

function AmmoFeed takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local player p = GetOwningPlayer(u)
    local integer i = GetConvertedPlayerId(p)
    local integer r = udg_Reloading//变量声明
    local real factor = I2R(GetUnitAbilityLevel(udg_Hero,'A02O'))*0.5//这个是装弹时间的计算
    if (r==0 or r==4) and udg_Magazines!=0 and GetUnitUserData(u)-udg_Rounds>=100 then//装填状态,弹夹不为零,以及弹药数量不高于
        call UnitAddAbility(udg_Hero,'A02H') //Reload Animation//装填动画效果
        call UnitAddAbility(udg_Hero,'A07Y') //500 Sight range reduction//减小视野
        call ShiftMoveSpeed(udg_Hero,1.4)//减慢移动速度——压根就不能动好嘛
        call PauseUnit(udg_Hero,true)//暂停单位不就不能动了嘛
        call PolledWait(3.75-factor)//等待3.75-等级减少的装弹时间
        set udg_Magazines = udg_Magazines - 1//设置弹夹数量
        set udg_Rounds = udg_Rounds + 100//设置弹药数量
        call SetPlayerState(p,PLAYER_STATE_RESOURCE_GOLD,udg_Rounds)//设置玩家属性
        call SetPlayerState(p,PLAYER_STATE_RESOURCE_LUMBER,udg_Magazines)//设置玩家属性
        call MachineGunLink(udg_Hero)//不知什么函数
        call PauseUnit(udg_Hero,false)//恢复单位
        call PolledWait(0.65)//等待0.65s
        set bj_meleeNearestMineDist = GetUnitX(udg_Hero)
        set bj_lastTransmissionDuration = GetUnitY(udg_Hero)
        set udg_soundpath = "war3mapImported\\Reload.wav"//播放音效
        call ExecuteFunc("PlaySoundPath3D")
        call UnitRemoveAbility(udg_Hero,'A02H')//删除动画效果
        call UnitRemoveAbility(udg_Hero,'A07Y') //500 Sight range reduction//删除减少视野
    else
        call IssueImmediateOrder(udg_Hero,"holdposition")//发布hold命令
        call DisplayTimedTextToPlayer( p, 0, 0, 5.0, "现在无法使用弹药供给." )//不能用
    endif
    set u = null
endfunction

function MachineGunLink takes unit u returns nothing
    set bj_meleeNearestMineDist = GetUnitX(u)
    set bj_lastTransmissionDuration = GetUnitY(u)
    set udg_soundpath = "war3mapImported\\AmmoLink.mp3"
    call ExecuteFunc("PlaySoundPath3D")//不就是一个播放音效的函数有必要这么搞么
endfunction
回复

使用道具 举报

 楼主| 发表于 2015-5-19 18:30:36 | 显示全部楼层
攻击音效

Attack Sounds
function AttackSounds takes nothing returns nothing
    local unit u = GetAttacker()
    local player p = GetOwningPlayer(GetAttacker())
    local integer i = GetUnitTypeId(u)
    local integer id = GetConvertedPlayerId(p)
    local real dx = GetUnitX(u) - GetUnitX(GetTriggerUnit())
    local real dy = GetUnitY(u) - GetUnitY(GetTriggerUnit())//声明变量
    local integer current = udg_Second
    if (i=='H003' and udg_Reloading[id]==0) or ((i=='z00F' or i=='z00G') and GetLoadState(I2S(H2I(u)))==1) then //Marksman//狙击手
        if current-udg_MarksmanShotLimit!=0 then//简单点说就是现在能够开枪,
            set bj_meleeNearestMineDist = GetUnitX(u )
            set bj_lastTransmissionDuration = GetUnitY(u)
            set udg_soundpath = "war3mapImported\\MarksmanRifle.wav"//播放音效
        else
            set udg_MarksmanShotLimit = current//不明,大概跟攻击限制有关
        endif
        if GetUnitAbilityLevel(u,'A04S')>0 or i=='z00G' then//狙击小兵,声音要更小
            set udg_Sound3DVolume = 75
        else
            set udg_Sound3DVolume = 110
        endif
        call ExecuteFunc("PlaySoundPath3D")
        if SquareRoot(dx*dx+dy*dy)>=600.0 and GetUnitAbilityLevel(udg_Marksman,'A016')!=0 then//有减震消声器直接丧尸变友军……屌
            call SetPlayerAlliance(Player(13),p,ALLIANCE_PASSIVE,true)
            call SetPlayerAlliance(Player(14),p,ALLIANCE_PASSIVE,true)
            call PolledWait(0.5)
            call SetPlayerAlliance(Player(13),p,ALLIANCE_PASSIVE,false)
            call SetPlayerAlliance(Player(14),p,ALLIANCE_PASSIVE,false)
        endif
        set udg_Sound3DVolume = 127
    elseif (i=='H007' and udg_Reloading[id]==0) or ((i=='z004' or i=='z003') and GetLoadState(I2S(H2I(u)))==1) then //Engineer//工头
        if (current-udg_EngyShotLimit!=0) then
            set bj_meleeNearestMineDist = GetUnitX(u)
            set bj_lastTransmissionDuration = GetUnitY(u)
            set udg_soundpath = "war3mapImported\\m3-1.wav"
            call ExecuteFunc("PlaySoundPath3D")
        else
            set udg_EngyShotLimit = current
        endif
    endif
    set u = null
endfunction

//===========================================================================
function InitTrig_Attack_Sounds takes nothing returns nothing
    set gg_trg_Attack_Sounds = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_Attack_Sounds,EVENT_PLAYER_UNIT_ATTACKED)
    call TriggerAddAction(gg_trg_Attack_Sounds,function AttackSounds)
endfunction
回复

使用道具 举报

 楼主| 发表于 2015-6-3 21:24:40 | 显示全部楼层
我在想,余波里的移动速度真是不科学,看看这个设置移动速度的函数是怎么做的。

function ShiftMoveSpeed takes unit u, real shift returns nothing
两个参数,单位和shift,大概是改变的移动速度
    local string s = I2S(H2I(u))//不明,大概是把u给转换成字符型,这个是当做密钥用的
    local real ms
    if GetWidgetLife(u)>0.405 then//单位活着
        set ms = GetStoredReal(udg_gc_handlevars,s,"MoveSpeed")//读取移动速度
        call StoreReal(udg_gc_handlevars,s,"MoveSpeed",ms+shift)//储存移动速度
        call SetUnitMoveSpeed( u, GetUnitDefaultMoveSpeed(u) + ms + shift )//单位默认移动速度+ms(读取移动速度)+shift(移动速度改变量)
    endif
endfunction

结论:这还是谜一般的意义不明……不知道是怎么做到不受技能效果影响的

[ 本帖最后由 大谎言家 于 2015-6-3 21:30 编辑 ]
回复

使用道具 举报

发表于 2015-6-10 19:25:53 | 显示全部楼层
Jass看不下去了,各种H2I I2H 然而并不知道他转换来干什么卵用
回复

使用道具 举报

 楼主| 发表于 2015-7-22 16:29:01 | 显示全部楼层

回复 36楼楼长 工头 的帖子

H2I和I2H是转换物体的句柄

句柄是Jass中类似于指针的一种东西,指向的是物体的数据在内存中的地址
回复

使用道具 举报

发表于 2015-9-22 10:27:18 | 显示全部楼层
就希望能把余波改成1.24下能玩
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|夜天使联盟论坛

GMT+8, 2026-10-5 17:54 , Processed in 0.027072 second(s), 21 queries .

Powered by Discuz! X5.0

© 2005-2025  技术支持 by 夜天使联盟.

快速回复 返回顶部 返回列表