Files
WulaFallenEmpireRW/Source/WulaFallenEmpire/ThingComp/WULA_WeaponSwitch/CompAbilityEffect_GiveSwitchHediff.cs
2025-10-31 09:57:45 +08:00

32 lines
919 B
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using RimWorld;
using Verse;
namespace WulaFallenEmpire
{
public class CompAbilityEffect_GiveSwitchHediff : CompAbilityEffect
{
public new CompProperties_AbilityGiveHediff Props => (CompProperties_AbilityGiveHediff)props;
public override void Apply(LocalTargetInfo target, LocalTargetInfo dest)
{
base.Apply(target, dest);
if (Props.hediffDef != null)
{
parent.pawn.health.AddHediff(Props.hediffDef);
}
}
public override bool ShouldHideGizmo
{
get
{
// 如果父级Pawn已经有了这个Hediff就隐藏“给予”按钮
if (parent.pawn?.health.hediffSet.HasHediff(Props.hediffDef) ?? false)
{
return true;
}
return base.ShouldHideGizmo;
}
}
}
}