Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hero skin #463

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions HeroSkin.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
SKINTOTAL HERO_ID(SKIN0) SKIN1 SKIN2 SKIN3 SKIN4 SKIN5 SKIN6 SKIN7
7 Hpal Huth Hlgr Hpb1 Hpb2 Hapm Hart Harf
4 Hamg Hgam Hant Haah Hjai nmed Hjas 0
1 Hmkg Hmbr 0 0 0 0 0 0
1 Hblm Hkal 0 0 0 0 0 0
4 Obla Osam Opgh Ogrh Nbbc 0 0 0
3 Ofar Odrt Oths Othr odkt Ogld Ofth 0
0 Otch 0 0 0 0 0 0 0
1 Oshd Orkn 0 0 0 0 0 0
1 Udea Harf Udef Uart 0 0 0 0
2 Ulic uktg Uktl uktn Uclc 0 0 0
6 Udre Ubal Utic Uvar Uvng Udth Umal 0
1 Ucrl Uanb 0 0 0 0 0 0
5 Ekee Ecen Ekgg Emfr Efur Emns Ekce 0
1 Emoo Etyr 0 0 0 0 0 0
1 Edem Eevi Edef 0 0 0 0 0
1 Ewar Ewrd 0 0 0 0 0 0
0 Nalc 0 0 0 0 0 0 0
1 Nngs Hvsh 0 0 0 0 0 0
0 Ntin 0 0 0 0 0 0 0
1 Nbst Orex 0 0 0 0 0 0
3 Nplh Nmag Npld Nman 0 0 0 0
0 Nfir 0 0 0 0 0 0 0
1 Npbm Nsjs 0 0 0 0 0 0
3 Nbrn Usyl uswb Hvwd 0 0 0 0
4 changes: 4 additions & 0 deletions REFORGED/custom_common.eai
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@ boolean AatpAbility = true
function VersionCheck takes nothing returns nothing

endfunction

function BlzSetUnitSkinAMAI takes unit u, integer i returns nothing
call BlzSetUnitSkin(u, i)
endfunction
#ENDIF
6 changes: 5 additions & 1 deletion ROC/custom_common.eai
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ function VersionCheck takes nothing returns nothing
endif
endfunction

function BlzSetUnitSkinAMAI takes unit u, integer i returns nothing

endfunction

function GetBJMaxPlayers takes nothing returns integer
return bj_MAX_PLAYERS_AMAI
endfunction
Expand Down Expand Up @@ -119,4 +123,4 @@ function BlzGroupGetSize takes group whichGroup returns integer
set g = null
return i
endfunction
#ENDIF
#ENDIF
4 changes: 4 additions & 0 deletions TFT/custom_common.eai
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ function VersionCheck takes nothing returns nothing
endif
endfunction

function BlzSetUnitSkinAMAI takes unit u, integer i returns nothing

endfunction

function GetBJMaxPlayers takes nothing returns integer
return bj_MAX_PLAYERS_AMAI
endfunction
Expand Down
36 changes: 27 additions & 9 deletions common.eai
Original file line number Diff line number Diff line change
Expand Up @@ -11444,20 +11444,38 @@ endif
endfunction

//============================================================================
function InitHeroInfo takes integer hn returns nothing
if hero_loc[hn] != null then
call RemoveLocation(hero_loc[hn])
endif
set hero_loc[hn] = GetUnitLoc(hero_unit[hn])
if hero_enemy_loc[hn] != null then
call RemoveLocation(hero_enemy_loc[hn])
#DEFINE $SKINSTART$ 3
#DEFINE $SKINEND$ 9
function GetHeroSkin takes integer hn returns nothing
local integer i = 0
local integer array skin
if p_rare[profile] < 1 or GetRandomInt(0, 100) < 20 then // not fully use new skin , random int use original skin - 0 : change skin will change proper name (AI Scripts cannot use GetHeroProperName and BlzSetHeroProperName)
return
#INCLUDETABLE <HeroSkin.txt> #EFR
elseif old_id[hero[hn]] == '%2' then
#FOR $X$ FROM $SKINSTART$ TO $SKINEND$
set skin[#EVAL{$X$-2}] = '%$X$'
#ENDFOR
set i = GetRandomInt(1, %1)
#AFTERINCLUDE
#ENDINCLUDE
else
return // unknow hero
endif
if hero_ally_loc[hn] != null then
call RemoveLocation(hero_ally_loc[hn])
if skin[i] != '0' then
call BlzSetUnitSkinAMAI(hero_unit[hn], skin[i]) // set skin API at 1.33+ and some unit at 1.32+ , old WE make map cannot use - so just in case check max player num
endif
endfunction
#UNDEF $SKINSTART$
#UNDEF $SKINEND$

function InitHeroInfo takes integer hn returns nothing
set hero_loc[hn] = GetUnitLoc(hero_unit[hn])
set hero_dir[hn] = Location(0,0)
set hero_enemy_loc[hn] = Location(0,0)
set hero_ally_loc[hn] = Location(0,0)
set hero_hp[hn] = 1
call GetHeroSkin(hn)
endfunction

function HeroReviver takes nothing returns nothing
Expand Down