|
Jass 初学 技能转换成功
要求:英雄在指定等级30级可以自动学到某个厉害技能.并在50级提升此技能一个等级.70级也上升
如果英雄拿到某物品后则转换这个技能,变成另外一个技能,卸下此物品就回到原先的那个技能.
拿了物品后 转变好的技能如果英雄到50级,也会提升该技能等级.(不是原先那技能)
卸下物品,则原先的技能也已经提升了.
Jass 如下:
[codes=jass]globals
// Generated
trigger gg_trg_dingfeng = null
trigger gg_trg_dingfeng1 = null
endglobals
//===========================================================================
// Trigger: dingfeng
//===========================================================================
function Trig_dingfeng_Conditions takes nothing returns boolean
if ( not ( GetUnitTypeId(GetTriggerUnit()) == GetUnitTypeId(gg_unit_O000_0205) ) ) then
return false
endif
return true
endfunction
function Trig_dingfeng_Func001Func002Func004C takes nothing returns boolean
if ( not ( GetUnitAbilityLevelSwapped('A052', GetTriggerUnit()) == 2 ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetTriggerUnit(), 'shcw') == false ) ) then
return false
endif
if ( not ( GetHeroLevel(GetTriggerUnit()) >= 70 ) ) then
return false
endif
return true
endfunction
function Trig_dingfeng_Func001Func002C takes nothing returns boolean
if ( not ( GetUnitAbilityLevelSwapped('A052', GetTriggerUnit()) == 1 ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetTriggerUnit(), 'shcw') == false ) ) then
return false
endif
if ( not ( GetHeroLevel(GetTriggerUnit()) >= 50 ) ) then
return false
endif
return true
endfunction
function Trig_dingfeng_Func001C takes nothing returns boolean
if ( not ( GetHeroLevel(GetTriggerUnit()) >= 30 ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetTriggerUnit(), 'shcw') == false ) ) then
return false
endif
if ( not ( GetUnitAbilityLevelSwapped('A052', GetTriggerUnit()) < 1 ) ) then
return false
endif
return true
endfunction
function Trig_dingfeng_Actions takes nothing returns nothing
if ( Trig_dingfeng_Func001C() ) then
call UnitAddAbilityBJ( 'A052', GetTriggerUnit() )
call DisplayTextToForce( GetPlayersAll(), ( GetPlayerName(GetOwningPlayer(GetTriggerUnit())) + "领悟了终级技能:|Cff00ff00残月!" ) )
else
if ( Trig_dingfeng_Func001Func002C() ) then
call IncUnitAbilityLevelSwapped( 'A052', GetTriggerUnit() )
call DisplayTextToForce( GetPlayersAll(), ( GetPlayerName(GetOwningPlayer(GetTriggerUnit())) + "|Cff00ff00残月的等级已经提升了!" ) )
else
if ( Trig_dingfeng_Func001Func002Func004C() ) then
call IncUnitAbilityLevelSwapped( 'A052', GetTriggerUnit() )
call DisplayTextToForce( GetPlayersAll(), ( GetPlayerName(GetOwningPlayer(GetTriggerUnit())) + "|Cff00ff00残月的等级已经提升了!" ) )
call DestroyTrigger( GetTriggeringTrigger() )
else
endif
endif
endif
endfunction
//===========================================================================
function InitTrig_dingfeng takes nothing returns nothing
set gg_trg_dingfeng = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_dingfeng, EVENT_PLAYER_HERO_LEVEL )
call TriggerAddCondition( gg_trg_dingfeng, Condition( function Trig_dingfeng_Conditions ) )
call TriggerAddAction( gg_trg_dingfeng, function Trig_dingfeng_Actions )
endfunction
//===========================================================================
// Trigger: dingfeng1
//===========================================================================
function Trig_dingfeng1_Conditions takes nothing returns boolean
if ( not ( GetUnitTypeId(GetTriggerUnit()) == GetUnitTypeId(gg_unit_O000_0205) ) ) then
return false
endif
return true
endfunction
function Trig_dingfeng1_Func001Func002Func004C takes nothing returns boolean
if ( not ( GetUnitAbilityLevelSwapped('A054', GetTriggerUnit()) == 2 ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetTriggerUnit(), 'shcw') == true ) ) then
return false
endif
if ( not ( GetHeroLevel(GetTriggerUnit()) >= 70 ) ) then
return false
endif
return true
endfunction
function Trig_dingfeng1_Func001Func002C takes nothing returns boolean
if ( not ( GetUnitAbilityLevelSwapped('A054', GetTriggerUnit()) == 1 ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetTriggerUnit(), 'shcw') == true ) ) then
return false
endif
if ( not ( GetHeroLevel(GetTriggerUnit()) >= 50 ) ) then
return false
endif
return true
endfunction
function Trig_dingfeng1_Func001C takes nothing returns boolean
if ( not ( GetHeroLevel(GetTriggerUnit()) >= 30 ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetTriggerUnit(), 'shcw') == true ) ) then
return false
endif
if ( not ( GetUnitAbilityLevelSwapped('A054', GetTriggerUnit()) < 1 ) ) then
return false
endif
return true
endfunction
function Trig_dingfeng1_Actions takes nothing returns nothing
if ( Trig_dingfeng1_Func001C() ) then
call UnitAddAbilityBJ( 'A054', GetTriggerUnit() )
call DisplayTextToForce( GetPlayersAll(), ( GetPlayerName(GetOwningPlayer(GetTriggerUnit())) + "领悟了终级技能:|Cff00ff00冷月!" ) )
else
if ( Trig_dingfeng1_Func001Func002C() ) then
call IncUnitAbilityLevelSwapped( 'A054', GetTriggerUnit() )
call DisplayTextToForce( GetPlayersAll(), ( GetPlayerName(GetOwningPlayer(GetTriggerUnit())) + "|Cff00ff00冷月的等级已经提升了!" ) )
else
if ( Trig_dingfeng1_Func001Func002Func004C() ) then
call IncUnitAbilityLevelSwapped( 'A054', GetTriggerUnit() )
call DisplayTextToForce( GetPlayersAll(), ( GetPlayerName(GetOwningPlayer(GetTriggerUnit())) + "|Cff00ff00冷月的等级已经提升了!" ) )
call DestroyTrigger( GetTriggeringTrigger() )
else
endif
endif
endif
endfunction
//===========================================================================
function InitTrig_dingfeng1 takes nothing returns nothing
set gg_trg_dingfeng1 = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_dingfeng1, EVENT_PLAYER_HERO_LEVEL )
call TriggerAddCondition( gg_trg_dingfeng1, Condition( function Trig_dingfeng1_Conditions ) )
call TriggerAddAction( gg_trg_dingfeng1, function Trig_dingfeng1_Actions )
endfunction
//===========================================================================
function InitCustomTriggers takes nothing returns nothing
call InitTrig_dingfeng( )
call InitTrig_dingfeng1( )
endfunction[/codes]
写好此技能后然后用 [ 工程升级 代码(ANeg) ] 这个技能 编辑 残月,冷月 代码 A052,A054 即可 把工程升级技能编辑到武器(代码:shcw)上 大功告成
此Jass我用在地图中可以当专署武器使用
英雄在升到终极技能后拿到专署武器后终极技能转变成另外更厉害的终极技能.
请高人看下 是否有更加简单的编写程序 请指出. |
|