2017-10-20 02:00:49 +00:00
|
|
|
class ExtWidget_BossHealthBar extends KFGFxWidget_BossHealthBar;
|
|
|
|
|
|
|
|
var transient array<KFPawn_Monster> BossList;
|
|
|
|
var transient float NextBossDistTime,LastHP,LastShield;
|
|
|
|
var transient byte NumBosses;
|
|
|
|
var transient bool bVisib,bHasInit;
|
|
|
|
|
|
|
|
function TickHud(float DeltaTime)
|
|
|
|
{
|
2020-11-28 20:12:58 +00:00
|
|
|
if (!KFPC.bHideBossHealthBar && BossList.Length>0)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
2020-11-28 20:12:58 +00:00
|
|
|
if (KFPC.WorldInfo.RealTimeSeconds>LastUpdateTime && HasBossesAlive())
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
LastUpdateTime = KFPC.WorldInfo.RealTimeSeconds + UpdateTickTime;
|
2020-11-28 20:12:58 +00:00
|
|
|
if (!bVisib)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
LastHP = -1;
|
|
|
|
LastShield = -1;
|
|
|
|
bVisib = true;
|
|
|
|
SetVisible(true);
|
|
|
|
}
|
|
|
|
UpdateBossInfo();
|
|
|
|
}
|
|
|
|
}
|
2020-11-28 20:12:58 +00:00
|
|
|
else if (bHasInit)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
NumBosses = 0;
|
|
|
|
bHasInit = false;
|
|
|
|
BossList.Length = 0;
|
2020-11-28 20:12:58 +00:00
|
|
|
if (bVisib)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
bVisib = false;
|
|
|
|
SetVisible(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
final function bool HasBossesAlive()
|
|
|
|
{
|
|
|
|
local int i;
|
|
|
|
|
2020-11-28 20:12:58 +00:00
|
|
|
for (i=(BossList.Length-1); i>=0; --i)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
2020-11-28 20:12:58 +00:00
|
|
|
if (BossList[i]==None || BossList[i].bDeleteMe || BossList[i].GetTeamNum()==0)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
BossList.Remove(i,1);
|
|
|
|
--NumBosses;
|
|
|
|
}
|
2020-11-28 20:12:58 +00:00
|
|
|
else if (!BossList[i].IsAliveAndWell())
|
2017-10-20 02:00:49 +00:00
|
|
|
BossList.Remove(i,1);
|
|
|
|
}
|
|
|
|
return (BossList.Length>0);
|
|
|
|
}
|
|
|
|
|
2017-10-20 02:12:29 +00:00
|
|
|
function SetBossPawn(KFInterface_MonsterBoss NewBoss)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
2020-11-28 20:12:58 +00:00
|
|
|
if (!KFPC.bHideBossHealthBar && NewBoss!=None && NewBoss.GetMonsterPawn().IsAliveAndWell())
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
bHasInit = true;
|
|
|
|
++NumBosses;
|
2017-10-20 02:12:29 +00:00
|
|
|
BossList.AddItem(NewBoss.GetMonsterPawn());
|
2017-10-20 02:00:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
final function UpdateBossInfo()
|
|
|
|
{
|
|
|
|
local float V;
|
|
|
|
local KFPawn_Monster B;
|
|
|
|
|
2020-11-28 20:12:58 +00:00
|
|
|
if (NextBossDistTime<KFPC.WorldInfo.RealTimeSeconds)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
NextBossDistTime = KFPC.WorldInfo.RealTimeSeconds + 1.f;
|
|
|
|
CheckBestBoss();
|
|
|
|
}
|
|
|
|
|
2017-10-20 02:12:29 +00:00
|
|
|
V = (BossPawn!=None ? FClamp(float(BossPawn.GetMonsterPawn().Health) / float(BossPawn.GetMonsterPawn().HealthMax),0.f,1.f) : 0.f);
|
2020-11-28 20:12:58 +00:00
|
|
|
if (LastHP!=V)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
LastHP = V;
|
|
|
|
SetFloat("currentHealthPercentValue",V);
|
|
|
|
}
|
|
|
|
|
|
|
|
V = 0.f;
|
2020-11-28 20:12:58 +00:00
|
|
|
if (NumBosses>1)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
foreach BossList(B)
|
|
|
|
V += FClamp(float(B.Health) / float(B.HealthMax),0.f,1.f);
|
|
|
|
V /= NumBosses;
|
|
|
|
}
|
2020-11-28 20:12:58 +00:00
|
|
|
if (LastShield!=V)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
LastShield = V;
|
|
|
|
SetFloat("currentShieldPercecntValue",V);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
final function CheckBestBoss()
|
|
|
|
{
|
|
|
|
local KFPawn_Monster B,Best;
|
|
|
|
local vector Pos;
|
|
|
|
local float Dist,BestDist;
|
|
|
|
|
|
|
|
Pos = (KFPC.ViewTarget!=None ? KFPC.ViewTarget.Location : KFPC.Location);
|
|
|
|
foreach BossList(B)
|
|
|
|
{
|
|
|
|
Dist = VSizeSq(Pos-B.Location);
|
2020-11-28 20:12:58 +00:00
|
|
|
if (Best==None || Dist<BestDist)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
Best = B;
|
|
|
|
BestDist = Dist;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-28 20:12:58 +00:00
|
|
|
if (Best!=BossPawn)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
BossPawn = Best;
|
2017-10-20 02:12:29 +00:00
|
|
|
SetBossName(Best.static.GetLocalizedName());
|
2017-10-20 02:00:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function OnNamePlateHidden();
|
|
|
|
|
|
|
|
function UpdateBossHealth();
|
|
|
|
|
|
|
|
function UpdateBossBattlePhase(int BattlePhase);
|
|
|
|
|
|
|
|
function UpdateBossShield(float NewShieldPercect);
|
|
|
|
|
|
|
|
DefaultProperties
|
|
|
|
{
|
|
|
|
}
|