public override void DrawHighlight(LocalTargetInfo target) { AbilityDef def = ability.def; DrawRadius(); if (CanHitTarget(target) && IsApplicableTo(target)) { if (def.HasAreaOfEffect) { if (target.IsValid) { GenDraw.DrawTargetHighlightWithLayer(target.CenterVector3, AltitudeLayer.MetaOverlays); GenDraw.DrawRadiusRing(target.Cell, def.EffectRadius, RadiusHighlightColor); } } else { GenDraw.DrawTargetHighlightWithLayer(target.CenterVector3, AltitudeLayer.MetaOverlays); } } if (target.IsValid) { ability.DrawEffectPreviews(target); } }
public void GainAbility(AbilityDef def) { if (!abilities.Any((Ability a) => a.def == def)) { abilities.Add(Activator.CreateInstance(def.abilityClass, pawn, def) as Ability); } }
public override void Initialize(CompProperties props) { base.Initialize(props); CompProperties_Neurotrainer compProperties_Neurotrainer = (CompProperties_Neurotrainer)props; ability = compProperties_Neurotrainer.ability; skill = compProperties_Neurotrainer.skill; }
public void RemoveAbility(AbilityDef def) { Ability ability = abilities.FirstOrDefault((Ability x) => x.def == def); if (ability != null) { abilities.Remove(ability); } }
public Ability GetAbility(AbilityDef def) { for (int i = 0; i < abilities.Count; i++) { if (abilities[i].def == def) { return(abilities[i]); } } return(null); }
private static IEnumerable <StatDrawEntry> StatsToDraw(AbilityDef def) { yield return(DescriptionEntry(def)); StatRequest statRequest = StatRequest.For(def); foreach (StatDef item in DefDatabase <StatDef> .AllDefs.Where((StatDef st) => st.Worker.ShouldShowFor(statRequest))) { yield return(new StatDrawEntry(item.category, item, def.GetStatValueAbstract(item), StatRequest.For(def))); } }
public override void DoEffect(Pawn user) { base.DoEffect(user); AbilityDef ability = Ability; user.abilities.GainAbility(ability); if (PawnUtility.ShouldSendNotificationAbout(user)) { Messages.Message("AbilityNeurotrainerUsed".Translate(user.Named("USER"), ability.LabelCap), user, MessageTypeDefOf.PositiveEvent); } }
public static void DrawStatsReport(Rect rect, AbilityDef def) { if (cachedDrawEntries.NullOrEmpty()) { StatRequest req = StatRequest.ForEmpty(); cachedDrawEntries.AddRange(def.SpecialDisplayStats(req)); cachedDrawEntries.AddRange(from r in StatsToDraw(def) where r.ShouldDisplay select r); FinalizeCachedDrawEntries(cachedDrawEntries); } DrawStatsWorker(rect, null, null); }
public static StatRequest For(AbilityDef def) { if (def == null) { Log.Error("StatRequest for null def."); return(ForEmpty()); } StatRequest result = default(StatRequest); result.thingInt = null; result.stuffDefInt = null; result.defInt = def; result.qualityCategoryInt = QualityCategory.Normal; return(result); }
public override string GetStatDrawEntryLabel(StatDef stat, float value, ToStringNumberSense numberSense, StatRequest optionalReq, bool finalized = true) { if (optionalReq.ForAbility) { AbilityDef abilityDef = optionalReq.AbilityDef; if (abilityDef.AnyCompOverridesPsyfocusCost) { if (abilityDef.PsyfocusCostRange.Span > float.Epsilon) { return((abilityDef.PsyfocusCostRange.min * 100f).ToString("0.##") + "-" + stat.ValueToString(abilityDef.PsyfocusCostRange.max, numberSense, finalized)); } return(stat.ValueToString(abilityDef.PsyfocusCostRange.max, numberSense, finalized)); } } return(base.GetStatDrawEntryLabel(stat, value, numberSense, optionalReq, finalized)); }
public override GizmoResult GizmoOnGUI(Vector2 topLeft, float maxWidth) { AbilityDef def = ability.def; Pawn pawn = ability.pawn; disabled = false; if (def.EntropyGain > float.Epsilon) { Hediff hediff = pawn.health.hediffSet.hediffs.FirstOrDefault((Hediff h) => h.def == HediffDefOf.PsychicAmplifier); if (hediff == null || hediff.Severity < (float)def.level) { DisableWithReason("CommandPsycastHigherLevelPsylinkRequired".Translate(def.level)); } else if (pawn.psychicEntropy.WouldOverflowEntropy(def.EntropyGain + PsycastUtility.TotalEntropyFromQueuedPsycasts(pawn))) { DisableWithReason("CommandPsycastWouldExceedEntropy".Translate(def.label)); } } GizmoResult result = base.GizmoOnGUI(topLeft, maxWidth); float num = topLeft.y + 3f; float num2 = ((def.EntropyGain > float.Epsilon) ? 15 : 0) + ((def.PsyfocusCost > float.Epsilon) ? 15 : 0); if (num2 > 0f) { GUI.DrawTexture(new Rect(topLeft.x + GetWidth(maxWidth) - 38f, num, 43f, num2), TexUI.GrayTextBG); } Text.Font = GameFont.Tiny; if (def.EntropyGain > float.Epsilon) { TaggedString taggedString = "NeuralHeatLetter".Translate() + ": " + def.EntropyGain.ToString(); float x = Text.CalcSize(taggedString).x; Rect rect = new Rect(topLeft.x + GetWidth(maxWidth) - x - 2f, num, x, 18f); Widgets.Label(rect, taggedString); num += rect.height - 4f; } if (def.PsyfocusCost > float.Epsilon) { TaggedString taggedString2 = "PsyfocusLetter".Translate() + ": " + def.PsyfocusCost.ToStringPercent(); float x2 = Text.CalcSize(taggedString2).x; Widgets.Label(new Rect(topLeft.x + GetWidth(maxWidth) - x2 - 2f, num, x2, 18f), taggedString2); } return(result); }
public override IEnumerable <string> ConfigErrors(AbilityDef parentDef) { foreach (string item in base.ConfigErrors(parentDef)) { yield return(item); } if (psyfocusCostForMinor < 0f) { yield return("psyfocusCostForMinor must be defined "); } if (psyfocusCostForMajor < 0f) { yield return("psyfocusCostForMajor must be defined "); } if (psyfocusCostForExtreme < 0f) { yield return("psyfocusCostForExtreme must be defined "); } }
protected override void DisabledCheck() { AbilityDef def = ability.def; Pawn pawn = ability.pawn; disabled = false; if (def.EntropyGain > float.Epsilon) { Hediff hediff = pawn.health.hediffSet.hediffs.FirstOrDefault((Hediff h) => h.def == HediffDefOf.PsychicAmplifier); if (hediff == null || hediff.Severity < (float)def.level) { DisableWithReason("CommandPsycastHigherLevelPsylinkRequired".Translate(def.level)); } else if (pawn.psychicEntropy.WouldOverflowEntropy(def.EntropyGain + PsycastUtility.TotalEntropyFromQueuedPsycasts(pawn))) { DisableWithReason("CommandPsycastWouldExceedEntropy".Translate(def.label)); } } base.DisabledCheck(); }
public static void TryGiveMentalStateWithDuration(MentalStateDef def, Pawn p, AbilityDef ability, StatDef multiplierStat) { if (p.mindState.mentalStateHandler.TryStartMentalState(def, null, forceWake: true)) { float num = ability.statBases.GetStatValueFromList(StatDefOf.Ability_Duration, 10f); if (multiplierStat != null) { num *= p.GetStatValue(multiplierStat); } p.mindState.mentalStateHandler.CurState.forceRecoverAfterTicks = num.SecondsToTicks(); } }
// Token: 0x06003FD2 RID: 16338 RVA: 0x00152695 File Offset: 0x00150895 public EquipmentAbility(Pawn pawn, AbilityDef def) : base(pawn, def) { }
public Ability(Pawn pawn, AbilityDef def) { this.pawn = pawn; this.def = def; Initialize(); }
public static float GetStatValueAbstract(this AbilityDef def, StatDef stat) { return(stat.Worker.GetValueAbstract(def)); }
public Psycast(Pawn pawn, AbilityDef def) : base(pawn, def) { }
public float GetValueAbstract(AbilityDef def) { return(GetValue(StatRequest.For(def))); }