KF2-Server-Extension/ServerExt/Classes/Ext_PerkFieldMedic.uc

244 lines
6.6 KiB
Ucode
Raw Normal View History

2017-10-20 02:00:49 +00:00
Class Ext_PerkFieldMedic extends Ext_PerkBase;
var float RepairArmorRate,AirborneAgentHealRate;
var byte AirborneAgentLevel;
var bool bHealingBoost,bHealingDamageBoost,bHealingShield;
var byte HealingShield;
var const float SelfHealingSurgePct,MaxHealingSpeedBoost,HealingSpeedBoostDuration,MaxHealingDamageBoost,HealingDamageBoostDuration,MaxHealingShield,HealingShieldDuration;
var float HealingSpeedBoostPct, HealingDamageBoostPct, HealingShieldPct;
var bool bUseToxicDamage,bUseSlug,bUseAirborneAgent;
var const class<KFDamageType> ToxicDmgTypeClass;
2020-11-28 20:04:55 +00:00
simulated function ModifyDamageGiven(out int InDamage, optional Actor DamageCauser, optional KFPawn_Monster MyKFPM, optional KFPlayerController DamageInstigator, optional class<KFDamageType> DamageType, optional int HitZoneIdx)
{
local float TempDamage;
TempDamage = InDamage;
2020-11-28 20:12:58 +00:00
if (bUseSlug && WorldInfo.TimeDilation < 1.f && DamageType != none && ClassIsChildOf(DamageType, class'KFDT_Toxic'))
TempDamage += InDamage * 100;
InDamage = Round(TempDamage);
2023-05-14 02:49:12 +00:00
Super.ModifyDamageGiven(InDamage, DamageCauser, MyKFPM, DamageInstigator, DamageType, HitZoneIdx);
}
2020-11-28 20:04:55 +00:00
simulated function ModifyMagSizeAndNumber(KFWeapon KFW, out int MagazineCapacity, optional array< Class<KFPerk> > WeaponPerkClass, optional bool bSecondary=false, optional name WeaponClassname)
{
2020-11-28 20:12:58 +00:00
if (MagazineCapacity>2 && (KFW==None ? WeaponPerkClass.Find(BasePerk)>=0 : IsWeaponOnPerk(KFW))) // Skip boomstick for this.
MagazineCapacity = Min(MagazineCapacity*Modifiers[10], bSecondary ? 150 : 255);
}
2020-11-28 20:04:55 +00:00
function bool RepairArmor(Pawn HealTarget)
2017-10-20 02:00:49 +00:00
{
local KFPawn_Human KFPH;
2020-11-28 20:12:58 +00:00
if (RepairArmorRate>0)
2017-10-20 02:00:49 +00:00
{
KFPH = KFPawn_Human(Healtarget);
2020-11-28 20:12:58 +00:00
if (KFPH != none && KFPH.Armor < KFPH.MaxArmor)
2017-10-20 02:00:49 +00:00
{
2020-11-28 20:04:55 +00:00
KFPH.AddArmor(Round(float(KFPH.MaxArmor) * RepairArmorRate));
2017-10-20 02:00:49 +00:00
return true;
}
}
return false;
}
2020-11-28 21:54:57 +00:00
2020-11-28 20:04:55 +00:00
function bool ModifyHealAmount(out float HealAmount)
2017-10-20 02:00:49 +00:00
{
HealAmount*=Modifiers[9];
return (RepairArmorRate>0);
}
// Di
2020-11-28 20:04:55 +00:00
// simulated function ModifyHealerRechargeTime(out float RechargeRate)
// {
2023-05-14 02:49:12 +00:00
// super.ModifyHealerRechargeTime(RechargeRate)
// RechargeRate /= Clamp(Modifiers[9] * 2, 1.f, 3.f);
// }
2017-10-20 02:00:49 +00:00
2020-11-28 20:04:55 +00:00
function CheckForAirborneAgent(KFPawn HealTarget, class<DamageType> DamType, int HealAmount)
2017-10-20 02:00:49 +00:00
{
2020-11-28 20:12:58 +00:00
if ((AirborneAgentLevel==1 && WorldInfo.TimeDilation<1.f) || AirborneAgentLevel>1)
2020-11-28 20:04:55 +00:00
GiveMedicAirborneAgentHealth(HealTarget, DamType, HealAmount);
2017-10-20 02:00:49 +00:00
}
2020-11-28 20:04:55 +00:00
function GiveMedicAirborneAgentHealth(KFPawn HealTarget, class<DamageType> DamType, int HealAmount)
2017-10-20 02:00:49 +00:00
{
local KFPawn KFP;
local int RoundedExtraHealAmount;
2020-11-28 20:04:55 +00:00
RoundedExtraHealAmount = FCeil(float(HealAmount) * AirborneAgentHealRate);
2017-10-20 02:00:49 +00:00
foreach WorldInfo.Allpawns(class'KFPawn', KFP, HealTarget.Location, 500.f)
{
2020-11-28 20:12:58 +00:00
if (KFP.IsAliveAndWell() && WorldInfo.GRI.OnSameTeam(HealTarget, KFP))
{
2020-11-28 20:04:55 +00:00
if (HealTarget == KFP)
2023-05-14 02:49:12 +00:00
KFP.HealDamage(RoundedExtraHealAmount, PlayerOwner, DamType);
2020-11-28 20:04:55 +00:00
else KFP.HealDamage(RoundedExtraHealAmount + HealAmount, PlayerOwner, DamType);
2017-10-20 02:00:49 +00:00
}
}
}
static function class<KFDamageType> GetToxicDmgTypeClass()
{
return default.ToxicDmgTypeClass;
}
static function int ModifyToxicDmg(int ToxicDamage)
{
local float TempDamage;
TempDamage = float(ToxicDamage) * 1.2;
2020-11-28 20:04:55 +00:00
return FCeil(TempDamage);
}
function NotifyZedTimeStarted()
{
local KFPawn_Human HPawn;
2023-05-14 02:49:12 +00:00
HPawn = KFPawn_Human(PlayerOwner.Pawn);
2023-05-14 02:49:12 +00:00
2020-11-28 20:12:58 +00:00
if (bUseAirborneAgent && HPawn != none && HPawn.IsAliveAndWell())
HPawn.StartAirBorneAgentEvent();
}
2020-11-28 20:04:55 +00:00
simulated function float GetSnarePower(optional class<DamageType> DamageType, optional byte HitZoneIdx)
{
2020-11-28 20:12:58 +00:00
if (bUseSlug && WorldInfo.TimeDilation < 1.f && class<KFDamageType>(DamageType)!=None && class<KFDamageType>(DamageType).Default.ModifierPerkList.Find(BasePerk)>=0)
return 100;
return 0.f;
}
2020-11-28 20:04:55 +00:00
function AddDefaultInventory(KFPawn P)
{
local int i;
i = P.DefaultInventory.Find(class'ExtWeap_Pistol_9mm');
2020-11-28 20:12:58 +00:00
if (i != -1)
P.DefaultInventory[i] = class'ExtWeap_Pistol_MedicS';
super.AddDefaultInventory(P);
}
simulated function bool GetHealingSpeedBoostActive()
{
return bHealingBoost;
}
2020-11-28 21:54:57 +00:00
simulated function byte GetHealingSpeedBoost()
{
return byte(HealingSpeedBoostPct);
}
2020-11-28 21:54:57 +00:00
simulated function byte GetMaxHealingSpeedBoost()
{
return MaxHealingSpeedBoost;
}
2020-11-28 21:54:57 +00:00
simulated function float GetHealingSpeedBoostDuration()
{
return HealingSpeedBoostDuration;
}
2020-11-28 21:54:57 +00:00
simulated function bool GetHealingDamageBoostActive()
{
return bHealingDamageBoost;
}
2020-11-28 21:54:57 +00:00
simulated function byte GetHealingDamageBoost()
{
return byte(HealingDamageBoostPct);
}
2020-11-28 21:54:57 +00:00
simulated function byte GetMaxHealingDamageBoost()
{
return MaxHealingDamageBoost;
}
2020-11-28 21:54:57 +00:00
simulated function float GetHealingDamageBoostDuration()
{
return HealingDamageBoostDuration;
}
2020-11-28 21:54:57 +00:00
simulated function bool GetHealingShieldActive()
{
return bHealingShield;
}
2020-11-28 21:54:57 +00:00
simulated function byte GetHealingShield()
{
return byte(HealingShieldPct);
}
2020-11-28 21:54:57 +00:00
simulated function byte GetMaxHealingShield()
{
return MaxHealingShield;
}
2020-11-28 21:54:57 +00:00
simulated function float GetHealingShieldDuration()
{
return HealingShieldDuration;
}
2020-11-28 21:54:57 +00:00
simulated function float GetSelfHealingSurgePct()
2023-05-14 02:49:12 +00:00
{
return SelfHealingSurgePct;
}
2017-10-20 02:00:49 +00:00
defaultproperties
{
PerkIcon=Texture2D'UI_PerkIcons_TEX.UI_PerkIcon_Medic'
DefTraitList.Remove(class'Ext_TraitMedicPistol')
DefTraitList.Add(class'Ext_TraitAirborne')
DefTraitList.Add(class'Ext_TraitWPMedic')
DefTraitList.Add(class'Ext_TraitAcidicCompound')
DefTraitList.Add(class'Ext_TraitMedBoost')
DefTraitList.Add(class'Ext_TraitMedDamBoost')
DefTraitList.Add(class'Ext_TraitMedShield')
DefTraitList.Add(class'Ext_TraitZedative')
DefTraitList.Add(class'Ext_TraitAirborneAgent')
DefTraitList.Add(class'Ext_TraitArmorRep')
2017-10-20 02:00:49 +00:00
BasePerk=class'KFPerk_FieldMedic'
HealExpUpNum=3
2023-05-14 02:49:12 +00:00
HealingSpeedBoostPct = 10.0f
HealingDamageBoostPct = 5.0f
HealingShieldPct = 10.0f
2023-05-14 02:49:12 +00:00
ToxicDmgTypeClass=class'KFDT_Toxic_AcidicRounds'
2023-05-14 02:49:12 +00:00
2023-05-14 03:01:17 +00:00
SelfHealingSurgePct=0.1f
MaxHealingSpeedBoost=30
HealingSpeedBoostDuration=5.f
MaxHealingDamageBoost=20
HealingDamageBoostDuration=5.f
2023-05-14 02:49:12 +00:00
MaxHealingShield=30
HealingShieldDuration=5.0f
2023-05-14 02:49:12 +00:00
2017-10-20 02:00:49 +00:00
DefPerkStats(0)=(MaxValue=70)
DefPerkStats(9)=(bHiddenConfig=false) // Heal efficiency
DefPerkStats(15)=(bHiddenConfig=false) // Toxic resistance
DefPerkStats(16)=(bHiddenConfig=false) // Sonic resistance
DefPerkStats(17)=(bHiddenConfig=false) // Fire resistance
DefPerkStats(20)=(bHiddenConfig=false) // Heal recharge
2023-05-14 02:49:12 +00:00
2017-10-20 02:00:49 +00:00
PrimaryMelee=class'KFWeap_Knife_FieldMedic'
PrimaryWeapon=None
2017-10-20 02:00:49 +00:00
PerkGrenade=class'KFProj_MedicGrenade'
SuperGrenade=class'ExtProj_SUPERMedGrenade'
SecondaryWeaponDef=class'ExtWeapDef_MedicPistol'
2023-05-14 02:49:12 +00:00
PrimaryWeaponDef=None
2017-10-20 02:00:49 +00:00
KnifeWeaponDef=class'KFWeapDef_Knife_Medic'
GrenadeWeaponDef=class'KFWeapDef_Grenade_Medic'
2023-05-14 02:49:12 +00:00
AutoBuyLoadOutPath=(class'KFWeapDef_MedicSMG', class'KFWeapDef_MedicShotgun', class'KFWeapDef_MedicRifle')
2017-10-20 02:00:49 +00:00
}