RoyalFlare 发表于 2014-12-8 14:31:19

经人指点统一了一下风格-DotA无敌斩

范围伤害版:

function Trig_wdz_Conditions takes nothing returns boolean
return ((GetSpellAbilityId()=='A0MO'))
endfunction
function Trig_wdz_Func012002003 takes nothing returns boolean
if IsUnitAliveBJ(GetFilterUnit()) and IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_wdz_danwei)) and IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE)==false then
    call UnitDamageTargetBJ(udg_wdz_danwei,GetFilterUnit(),(((udg_LiShi_FuSheng_WD*10.00)+(udg_LiShi_FuSheng_WD*10.00))+(udg_LiShi_FuSheng_WD*10.00)),ATTACK_TYPE_CHAOS,DAMAGE_TYPE_UNIVERSAL)
endif
return false
endfunction
function MoveLocationOfLoc takes location loc1,location loc2 ,boolean bool returns nothing
call MoveLocation(loc1,GetLocationX(loc2),GetLocationY(loc2))
if bool then
    call RemoveLocation(loc2)
endif
endfunction
function Trig_wdz_Actions takes nothing returns nothing
local location loc1=Location(0,0)
local location loc2=Location(0,0)
set udg_wdz_danwei=GetTriggerUnit()
set udg_wdz_danwei=GetSpellTargetUnit()
set udg_LiShi_FuSheng_WD=I2R(GetHeroStr(GetTriggerUnit(), true))
set udg_LiShi_FuSheng_WD=I2R(GetHeroAgi(GetTriggerUnit(), true))
set udg_LiShi_FuSheng_WD=I2R(GetHeroInt(GetTriggerUnit(), true))
call TriggerSleepAction(0.20)
call PauseUnitBJ(true,udg_wdz_danwei)
call SetUnitInvulnerable(udg_wdz_danwei,true)
call SetUnitTimeScalePercent(udg_wdz_danwei,300.00)
call AddSpecialEffectTargetUnitBJ("chest",udg_wdz_danwei,"Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile.mdl")
set udg_SFX=GetLastCreatedEffectBJ()
call MoveLocation(loc1,GetUnitX(udg_wdz_danwei),GetUnitY(udg_wdz_danwei))
call MoveLocation(loc2,GetUnitX(udg_wdz_danwei),GetUnitY(udg_wdz_danwei))
call MoveLocationOfLoc(loc1,PolarProjectionBJ(loc1,(DistanceBetweenPoints(loc1,loc2)+GetRandomReal(0.00,360.00)),AngleBetweenPoints(loc1,loc2)),TRUE)
call SetUnitPositionLocFacingLocBJ(udg_wdz_danwei,loc1,loc2)
call UnitDamageTargetBJ(udg_wdz_danwei,udg_wdz_danwei,(((udg_LiShi_FuSheng_WD*10.00)+(udg_LiShi_FuSheng_WD*10.00))+(udg_LiShi_FuSheng_WD*10.00)),ATTACK_TYPE_CHAOS,DAMAGE_TYPE_UNIVERSAL)
call SetUnitAnimation(udg_wdz_danwei,"Attack")
if udg_wdz_zu==null then
    set udg_wdz_zu=CreateGroup()
endif
call GroupEnumUnitsInRange(udg_wdz_zu,GetUnitX(udg_wdz_danwei),GetUnitY(udg_wdz_danwei),300,Condition(function Trig_wdz_Func012002003))
set bj_forLoopAIndex=1
set bj_forLoopAIndexEnd=(GetUnitAbilityLevelSwapped('A0MO',udg_wdz_danwei)*4)
loop
    exitwhen bj_forLoopAIndex>bj_forLoopAIndexEnd
    call TriggerSleepAction(0.20)
    call MoveLocation(loc1,GetUnitX(udg_wdz_danwei),GetUnitY(udg_wdz_danwei))
    call MoveLocation(loc2,GetUnitX(udg_wdz_danwei),GetUnitY(udg_wdz_danwei))
    call MoveLocationOfLoc(loc1,PolarProjectionBJ(loc1,(DistanceBetweenPoints(loc1,loc2)+GetRandomReal(0.00,360.00)),AngleBetweenPoints(loc1,loc2)),TRUE)
    call SetUnitPositionLocFacingLocBJ(udg_wdz_danwei,loc1,loc2)
    call GroupEnumUnitsInRange(udg_wdz_zu,GetUnitX(udg_wdz_danwei),GetUnitY(udg_wdz_danwei),300,Condition(function Trig_wdz_Func012002003))
    call SetUnitAnimation(udg_wdz_danwei,"Attack")
    call AddSpecialEffectTargetUnitBJ("overhead",udg_wdz_danwei,"Abilities\\Spells\\Human\\Thunderclap\\ThunderclapTarget.mdl")
    call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl",GetUnitX(udg_wdz_danwei),GetUnitY(udg_wdz_danwei)))
    set udg_SFX=GetLastCreatedEffectBJ()
    call PauseUnitBJ(true,udg_wdz_danwei)
    call TriggerSleepAction(0.01)
    call DestroyEffectBJ(udg_SFX)
    call PauseUnitBJ(false,udg_wdz_danwei)
    set bj_forLoopAIndex=bj_forLoopAIndex+1
endloop
call SetUnitTimeScalePercent(udg_wdz_danwei,100.00)
call PauseUnitBJ(false,udg_wdz_danwei)
call SetUnitAnimation(udg_wdz_danwei,"Stand Ready")
call SetUnitInvulnerable(udg_wdz_danwei,false)
call DestroyEffectBJ(udg_SFX)
call RemoveLocation(loc1)
call RemoveLocation(loc2)
set loc1=null
set loc2=null
endfunction
function InitTrig_wdz takes nothing returns nothing
set gg_trg_wdz=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_wdz,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_wdz,Condition(function Trig_wdz_Conditions))
call TriggerAddAction(gg_trg_wdz,function Trig_wdz_Actions)
endfunction

单体伤害版:

function Trig_wdz_Conditions takes nothing returns boolean
    return ((GetSpellAbilityId()=='A0MO'))
endfunction
function Trig_wdz_Func012002003001 takes nothing returns boolean
    return (IsUnitAliveBJ(GetFilterUnit())==true)
endfunction
function Trig_wdz_Func012002003002001 takes nothing returns boolean
    return (IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_wdz_danwei))==true)
endfunction
function Trig_wdz_Func012002003002002 takes nothing returns boolean
    return (IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE)==false)
endfunction
function Trig_wdz_Func012002003002 takes nothing returns boolean
    return GetBooleanAnd(Trig_wdz_Func012002003002001(),Trig_wdz_Func012002003002002())
endfunction
function Trig_wdz_Func012002003 takes nothing returns boolean
    return GetBooleanAnd(Trig_wdz_Func012002003001(),Trig_wdz_Func012002003002())
endfunction
function Trig_wdz_Func013Func001C takes nothing returns boolean
    if (not (CountUnitsInGroup(udg_wdz_zu)>=1)) then
      return false
    endif
    return true
endfunction
function Trig_wdz_Actions takes nothing returns nothing
    set udg_wdz_danwei=GetTriggerUnit()
    set udg_wdz_danwei=GetSpellTargetUnit()
    set udg_LiShi_FuSheng_WD=I2R(GetHeroStr(GetTriggerUnit(), true))
    set udg_LiShi_FuSheng_WD=I2R(GetHeroAgi(GetTriggerUnit(), true))
    set udg_LiShi_FuSheng_WD=I2R(GetHeroInt(GetTriggerUnit(), true))
    call TriggerSleepAction(0.20)
    call PauseUnitBJ(true,udg_wdz_danwei)
    call SetUnitInvulnerable(udg_wdz_danwei,true)
    call SetUnitTimeScalePercent(udg_wdz_danwei,300.00)
    call AddSpecialEffectTargetUnitBJ("chest",udg_wdz_danwei,"Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile.mdl")
    set udg_SFX=GetLastCreatedEffectBJ()
    call SetUnitPositionLocFacingLocBJ(udg_wdz_danwei,PolarProjectionBJ(GetUnitLoc(udg_wdz_danwei),(DistanceBetweenPoints(GetUnitLoc(udg_wdz_danwei),GetUnitLoc(udg_wdz_danwei))+GetRandomReal(0.00,360.00)),AngleBetweenPoints(GetUnitLoc(udg_wdz_danwei),GetUnitLoc(udg_wdz_danwei))),GetUnitLoc(udg_wdz_danwei))
    call UnitDamageTargetBJ(udg_wdz_danwei,udg_wdz_danwei,(((udg_LiShi_FuSheng_WD*10.00)+(udg_LiShi_FuSheng_WD*10.00))+(udg_LiShi_FuSheng_WD*10.00)),ATTACK_TYPE_CHAOS,DAMAGE_TYPE_UNIVERSAL)
    call SetUnitAnimation(udg_wdz_danwei,"Attack")
    set udg_wdz_zu=GetUnitsInRangeOfLocMatching(600.00,GetUnitLoc(udg_wdz_danwei),Condition(function Trig_wdz_Func012002003))
    set bj_forLoopAIndex=1
    set bj_forLoopAIndexEnd=(GetUnitAbilityLevelSwapped('A0MO',udg_wdz_danwei)*4)
    loop
      exitwhen bj_forLoopAIndex>bj_forLoopAIndexEnd
      if (Trig_wdz_Func013Func001C()) then
            call TriggerSleepAction(0.20)
            set udg_wdz_danwei=GroupPickRandomUnit(udg_wdz_zu)
            call SetUnitPositionLocFacingLocBJ(udg_wdz_danwei,PolarProjectionBJ(GetUnitLoc(udg_wdz_danwei),(DistanceBetweenPoints(GetUnitLoc(udg_wdz_danwei),GetUnitLoc(udg_wdz_danwei))+GetRandomReal(0.00,360.00)),AngleBetweenPoints(GetUnitLoc(udg_wdz_danwei),GetUnitLoc(udg_wdz_danwei))),GetUnitLoc(udg_wdz_danwei))
            call SetUnitAnimation(udg_wdz_danwei,"Attack")
            call UnitDamageTargetBJ(udg_wdz_danwei,udg_wdz_danwei,( ( ( udg_LiShi_FuSheng_WD * 10.00 ) + ( udg_LiShi_FuSheng_WD * 10.00 ) ) + ( udg_LiShi_FuSheng_WD * 10.00 ) ),ATTACK_TYPE_CHAOS,DAMAGE_TYPE_UNIVERSAL)
            call AddSpecialEffectTargetUnitBJ("overhead",udg_wdz_danwei,"Abilities\\Spells\\Human\\Thunderclap\\ThunderclapTarget.mdl")
            call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl",GetUnitX(udg_wdz_danwei),GetUnitY(udg_wdz_danwei)))
            set udg_SFX=GetLastCreatedEffectBJ()
            call PauseUnitBJ(true,udg_wdz_danwei)
            call TriggerSleepAction(0.01)
            call DestroyEffectBJ(udg_SFX)
            call PauseUnitBJ(false,udg_wdz_danwei)
      else
            call DoNothing()
      endif
      set bj_forLoopAIndex=bj_forLoopAIndex+1
    endloop
    call SetUnitTimeScalePercent(udg_wdz_danwei,100.00)
    call PauseUnitBJ(false,udg_wdz_danwei)
    call SetUnitAnimation(udg_wdz_danwei,"Stand Ready")
    call SetUnitInvulnerable(udg_wdz_danwei,false)
    call DestroyEffectBJ(udg_SFX)
endfunction
function InitTrig_wdz takes nothing returns nothing
    set gg_trg_wdz=CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_wdz,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(gg_trg_wdz,Condition(function Trig_wdz_Conditions))
    call TriggerAddAction(gg_trg_wdz,function Trig_wdz_Actions)
endfunction

从某张技能演示地图中获得的代码 稍微加工了1下 关联了属性伤害 献给需要的人

RoyalFlare 发表于 2014-12-8 14:37:01

本帖最后由 RoyalFlare 于 2014-12-8 14:42 编辑



蓝蓝路与她的小伙伴们 我感受到了深深的恶意 看上去有种跨时代的感觉

o0木子0o 发表于 2014-12-8 17:30:56

都看晕掉了+_+

RoyalFlare 发表于 2014-12-9 02:13:33

本帖最后由 RoyalFlare 于 2014-12-9 10:18 编辑

@o0木子0o 帮忙看1下这段代码 为何总是提示语法错误 if/then/else的用法错了麽?
我就合理利用空间不另外开帖子了 论坛不能上传后缀名为txt和j的文件 真是差劲
不能把实数转换为布尔值 那麽这里要怎麽办?

globals
real array udg_JiNengShi_Su
endglobals
function Trig_FrostNova_Conditions takes nothing returns boolean
    if(not(GetUnitAbilityLevelSwapped('A00S',GetAttacker())>=1))then
      return false
    endif
    return true
endfunction

function Trig_FrostNova_Func001Func007001003001 takes nothing returns boolean
    return(IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(GetAttacker()))==true)
endfunction
function Trig_FrostNova_Func001Func007001003002 takes nothing returns boolean
    return(IsUnitAliveBJ(GetFilterUnit())==true)
endfunction
function Trig_FrostNova_Func001Func007001003 takes nothing returns boolean
    return GetBooleanAnd(Trig_FrostNova_Func001Func007001003001(),Trig_FrostNova_Func001Func007001003002())
endfunction
function Trig_FrostNova_Func001Func007A takes nothing returns nothing
    call AddSpecialEffectTargetUnitBJ("overhead",GetEnumUnit(),"Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl")
    call DestroyEffect(GetLastCreatedEffectBJ())
    call UnitDamageTargetBJ(GetAttacker(),GetEnumUnit(),(((udg_JiNengShi_Su+udg_JiNengShi_Su)+udg_JiNengShi_Su)+(udg_JiNengShi_Su*100.00)),ATTACK_TYPE_CHAOS,DAMAGE_TYPE_UNIVERSAL)
endfunction
function Trig_FrostNova_Func001C takes nothing returns boolean
    if(not(GetRandomReal(1.00,1000.00))<=((SquareRoot(I2R(GetHeroInt(GetAttacker(),true)))+(I2R(GetUnitAbilityLevelSwapped('A00S',GetAttacker()))+100.00))))then
      return false
    endif
    return true
endfunction
function Trig_FrostNova_Actions takes nothing returns nothing
if(Trig_FrostNova_Func001C())then
    set udg_JiNengShi_Su=I2R(GetHeroStr(GetAttacker(),true))
    set udg_JiNengShi_Su=I2R(GetHeroAgi(GetAttacker(),true))
    set udg_JiNengShi_Su=I2R(GetHeroInt(GetAttacker(),true))
    set udg_JiNengShi_Su=I2R(GetUnitAbilityLevel(GetAttacker(), 'A00S'))
    call ForGroupBJ(GetUnitsInRangeOfLocMatching(800.00,GetUnitLoc(GetAttackedUnitBJ()),Condition(function Trig_FrostNova_Func001Func007001003)),function Trig_FrostNova_Func001Func007A)
    call DestroyGroup(GetLastCreatedGroup())
else
endif
endfunction
//===========================================================================
function InitTrig_FrostNova takes nothing returns nothing
set gg_trg_FrostNova=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_FrostNova,EVENT_PLAYER_UNIT_ATTACKED)
call TriggerAddCondition(gg_trg_FrostNova,Condition(function Trig_FrostNova_Conditions))
call TriggerAddAction(gg_trg_FrostNova,function Trig_FrostNova_Actions)
endfunction

RoyalFlare 发表于 2014-12-9 02:15:43

本帖最后由 RoyalFlare 于 2014-12-9 10:17 编辑


function Trig_FrostNova_Func001C takes nothing returns boolean
    if(not(GetRandomReal(1.00,1000.00)))<=((SquareRoot(I2R(GetHeroInt(GetAttacker(),true)))+(I2R(GetUnitAbilityLevelSwapped('A00S',GetAttacker()))+100.00))))then
      return false
    endif
    return true
endfunction

if/Then/Else的返回条件具体格式要求是怎麽样的? 我知道不能把整数和实数转换为布尔值条件进行判断 有什麽解决办法?
@chyj4747 @希瓦 @zhuzeitou

希瓦 发表于 2014-12-10 01:40:23

RoyalFlare 发表于 2014-12-9 02:15
if/Then/Else的返回条件具体格式要求是怎麽样的? 我知道不能把整数和实数转换为布尔值条件进行判断 有什 ...

if的返回条件是什么意思……
把整数转换为布尔值又是什么意思……

chyj4747 发表于 2014-12-10 11:19:39

(not(GetRandomReal(1.00,1000.00)))
你自己看这个东西的括号。。

not一个实数当然会报错

RoyalFlare 发表于 2014-12-10 12:20:22

本帖最后由 RoyalFlare 于 2014-12-10 12:21 编辑

不得已的情况下我只好用了1个愚蠢的办法 好吧我承认我Jass半桶水
用双斜线注释掉了 问题虽然解决了但是还是想知道解决的方法 谢谢
没有动手能力的伸手党死了也活该

function Trig_FrostNova_Conditions takes nothing returns boolean
    if(not(GetUnitAbilityLevelSwapped('A00S',GetAttacker())>=1))then
      return false
    endif
    return true
endfunction

function Trig_FrostNova_Func001Func007001003001 takes nothing returns boolean
    return(IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(GetAttacker()))==true)
endfunction
function Trig_FrostNova_Func001Func007001003002 takes nothing returns boolean
    return(IsUnitAliveBJ(GetFilterUnit())==true)
endfunction
function Trig_FrostNova_Func001Func007001003 takes nothing returns boolean
    return GetBooleanAnd(Trig_FrostNova_Func001Func007001003001(),Trig_FrostNova_Func001Func007001003002())
endfunction
function Trig_FrostNova_Func001Func007A takes nothing returns nothing
    call AddSpecialEffectTargetUnitBJ("overhead",GetEnumUnit(),"Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl")
    call DestroyEffect(GetLastCreatedEffectBJ())
    call UnitDamageTargetBJ(GetAttacker(),GetEnumUnit(),(((udg_JiNengShi_Su+udg_JiNengShi_Su)+udg_JiNengShi_Su)+(udg_JiNengShi_Su*100.00)),ATTACK_TYPE_CHAOS,DAMAGE_TYPE_UNIVERSAL)
endfunction
//function Trig_FrostNova_Func001C takes nothing returns boolean
    //if(not(GetRandomReal(1.00,1000.00)<=((SquareRoot(I2R(GetHeroInt(GetAttacker(),true)))+(I2R(GetUnitAbilityLevelSwapped('A00S',GetAttacker()))+100.00))))then
      //return false
    //endif
    //return true
//endfunction
function Trig_FrostNova_Actions takes nothing returns nothing
    //if(Trig_FrostNova_Func001C())then
    if ((GetRandomReal(1.00,1000.00)<=((SquareRoot(I2R(GetHeroInt(GetAttacker(),true)))+(I2R(GetUnitAbilityLevelSwapped('A00S',GetAttacker()))+100.00))))) then
      set udg_JiNengShi_Su=I2R(GetHeroStr(GetAttacker(),true))
      set udg_JiNengShi_Su=I2R(GetHeroAgi(GetAttacker(),true))
      set udg_JiNengShi_Su=I2R(GetHeroInt(GetAttacker(),true))
      set udg_JiNengShi_Su=I2R(GetUnitAbilityLevel(GetAttacker(), 'A00S'))
      call ForGroupBJ(GetUnitsInRangeOfLocMatching(800.00,GetUnitLoc(GetAttackedUnitBJ()),Condition(function Trig_FrostNova_Func001Func007001003)),function Trig_FrostNova_Func001Func007A)
      call DestroyGroup(GetLastCreatedGroup())
    else
    endif
endfunction
//===========================================================================
function InitTrig_FrostNova takes nothing returns nothing
    set gg_trg_FrostNova=CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_FrostNova,EVENT_PLAYER_UNIT_ATTACKED)
    call TriggerAddCondition(gg_trg_FrostNova,Condition(function Trig_FrostNova_Conditions))
    call TriggerAddAction(gg_trg_FrostNova,function Trig_FrostNova_Actions)
endfunction

chyj4747 发表于 2014-12-11 10:32:54

我的意思是你括号括错了。。应该是把两个数字互相比较的部分括起来,然后外面再加not

lijiemeide 发表于 2015-1-7 20:53:03

看不懂,顶一下

lijiemeide 发表于 2015-1-7 20:53:17

顶一下

lijiemeide 发表于 2015-1-7 20:53:29

需要10个ga

lijiemeide 发表于 2015-1-7 20:53:35

9个了

lijiemeide 发表于 2015-1-7 20:53:41

8个了

lijiemeide 发表于 2015-1-7 20:53:49

7个还来

563858554 发表于 2016-5-11 14:37:28

貌似纯T都没有这么复杂
页: [1]
查看完整版本: 经人指点统一了一下风格-DotA无敌斩