public override bool CanCastPowerCheck(AbilityContext context, out string reason) { if (base.CanCastPowerCheck(context, out reason)) { reason = ""; if (Def != null && Def is VitaeAbilityDef vampDef) { if (Pawn.IsVampire()) { if (Pawn.BloodNeed().CurBloodPoints < vampDef.bloodCost) { reason = "ROMV_NotEnoughBloodPoints".Translate(vampDef.bloodCost); return(false); } } else if (Pawn.IsGhoul()) { if (Pawn.BloodNeed().CurGhoulVitaePoints < vampDef.bloodCost) { reason = "ROMV_NotEnoughBloodPoints".Translate(vampDef.bloodCost); return(false); } } } return(true); } return(false); }
void checkAbilityContext(AbilityContext context) { acmd.showMenu( this, context == this.abilityContext ); }
//public override void Notify_AbilityFailed(bool refund) //{ // base.Notify_AbilityFailed(refund); // if (refund) // { // if (SemblanceDef.usesAmmunition != null && Pawn.inventory.GetDirectlyHeldThings().ToList().Find(s => s.def == SemblanceDef.usesAmmunition) == null) // { // Pawn.inventory.GetDirectlyHeldThings().TryAdd(ThingMaker.MakeThing(SemblanceDef.usesAmmunition), 1); // } // if (SemblanceDef.auraCost > 0f) // { // AbilityUserAura.aura.currentEnergy += SemblanceDef.auraCost; // } // } //} public override bool CanCastPowerCheck(AbilityContext context, out string reason) { bool baseResult = base.CanCastPowerCheck(context, out reason); if (baseResult) { if (SemblanceDef.usesAmmunition != null && Pawn.inventory.GetDirectlyHeldThings().ToList().Find(s => s.def == SemblanceDef.usesAmmunition) == null) { baseResult = false; reason = "DisabledNoDustPowderAmmunition".Translate(SemblanceDef.usesAmmunition.label).CapitalizeFirst(); } if (SemblanceDef.auraCost > 0f && SemblanceDef.auraCost >= AbilityUserAura.aura.currentEnergy) { baseResult = false; reason = "DisabledNotEnoughAura".Translate(Pawn.Name.ToStringShort); } if (SemblanceDef == RWBYDefOf.Adam_UnleashDamage && Pawn.TryGetComp <CompAbilityUserAura>() is CompAbilityUserAura comp1 && comp1.aura is Aura_Adam aura_Adam && aura_Adam.absorbedDamage == 0) { baseResult = false; reason = "DisabledNoDamageAbosrbed".Translate(Pawn.Name.ToStringShort); } if (SemblanceDef == RWBYDefOf.Adam_UnleashDamage && (Pawn.equipment.Primary == null || !Pawn.equipment.Primary.def.IsMeleeWeapon)) { baseResult = false; reason = "DisabledNoMeleeWeapon".Translate(Pawn.Name.ToStringShort); } if (SemblanceDef == RWBYDefOf.Yang_ReturnDamage && Pawn.TryGetComp <CompAbilityUserAura>() is CompAbilityUserAura comp2 && comp2.aura is Aura_Yang aura_Yang && aura_Yang.absorbedDamage == 0) { baseResult = false; reason = "DisabledNoDamageAbosrbed".Translate(Pawn.Name.ToStringShort); } } return(baseResult); }
public override bool CanCastPowerCheck(AbilityContext context, out string reason) { if (!base.CanCastPowerCheck(context, out reason)) { return(false); } reason = ""; if (Def == null || Def is not ForceAbilityDef forceDef) { return(true); } if (forceDef.requiredAlignmentType != ForceAlignmentType.None) { if (forceDef.requiredAlignmentType != ForceUtility.GetForceAlignmentType(Pawn)) { reason = "PJ_WrongAlignment".Translate(Pawn.LabelShort); return(false); } } if (ForceUser?.ForcePool != null) { if (forceDef.forcePoolCost > 0 && ActualForceCost > Pawn.GetForcePool()?.CurLevel) { reason = "PJ_DrainedForcePool".Translate(Pawn.LabelShort); return(false); } } if (AbilityUser?.AbilityUser == null) { return(true); } if (AbilityUser?.AbilityUser?.apparel == null) { return(true); } if (AbilityUser?.AbilityUser?.apparel?.WornApparel == null || !(AbilityUser?.AbilityUser?.apparel?.WornApparelCount > 0)) { return(true); } if (AbilityUser?.AbilityUser?.apparel?.WornApparel?.FirstOrDefault(x => x.def == ThingDefOf.Apparel_ShieldBelt) == null) { return(true); } reason = "PJ_UsingShieldBelt".Translate(Pawn.LabelShort); return(false); }
public override bool CanCastPowerCheck(AbilityContext context, out string reason) { bool flag = base.CanCastPowerCheck(context, out reason); bool result; if (flag) { reason = ""; TMAbilityDef tmAbilityDef; bool flag1 = base.Def != null && (tmAbilityDef = (base.Def as TMAbilityDef)) != null; if (flag1) { bool flag4 = this.MagicUser.Mana != null; if (flag4) { bool flag5 = magicDef.manaCost > 0f && this.ActualManaCost > this.MagicUser.Mana.CurLevel; if (flag5) { reason = "TM_NotEnoughMana".Translate(new object[] { base.Pawn.LabelShort }); result = false; return(result); } } } List <Apparel> wornApparel = base.Pawn.apparel.WornApparel; for (int i = 0; i < wornApparel.Count; i++) { if (!wornApparel[i].AllowVerbCast(base.Pawn.Position, base.Pawn.Map, base.abilityUser.Pawn.TargetCurrentlyAimingAt, this.Verb) && (this.magicDef.defName == "TM_LightningCloud" || this.magicDef.defName == "Laser_LightningBolt" || this.magicDef.defName == "TM_LightningStorm" || this.magicDef.defName == "TM_EyeOfTheStorm" || this.magicDef.defName.Contains("Laser_FrostRay") || this.magicDef.defName == "TM_Blizzard" || this.magicDef.defName == "TM_Snowball" || this.magicDef.defName == "TM_Icebolt" || this.magicDef.defName == "TM_Firestorm" || this.magicDef.defName == "TM_Fireball" || this.magicDef.defName == "TM_Fireclaw" || this.magicDef.defName == "TM_Firebolt" || this.magicDef.defName.Contains("TM_MagicMissile") || this.magicDef.defName.Contains("TM_DeathBolt") || this.magicDef.defName.Contains("TM_ShadowBolt") || this.magicDef.defName == "TM_Poison")) { reason = "TM_ShieldBlockingPowers".Translate(new object[] { base.Pawn.Label, wornApparel[i].Label }); return(false); } } result = true; } else { result = false; } return(result); }
public override bool CanOverpowerTarget(AbilityContext context, LocalTargetInfo target, out string reason) { reason = ""; if (target.Thing is not PawnGhost) { return(base.CanOverpowerTarget(context, target, out reason)); } Messages.Message( "PJ_ForceResisted".Translate(target.Thing.LabelShort, AbilityUser.AbilityUser.LabelShort, Def.label), MessageTypeDefOf.NegativeEvent); return(false); }
public override bool CanCastPowerCheck(AbilityContext context, out string reason) { bool flag = base.CanCastPowerCheck(context, out reason); bool result; if (flag) { reason = ""; TMAbilityDef tmAbilityDef; bool flag1 = base.Def != null && (tmAbilityDef = (base.Def as TMAbilityDef)) != null; if (flag1) { bool flag4 = this.MightUser.Stamina != null; if (flag4) { bool flag5 = mightDef.staminaCost > 0f && this.ActualStaminaCost > this.MightUser.Stamina.CurLevel; if (flag5) { reason = "TM_NotEnoughStamina".Translate(new object[] { base.Pawn.LabelShort }); result = false; return(result); } } } List <Apparel> wornApparel = base.Pawn.apparel.WornApparel; for (int i = 0; i < wornApparel.Count; i++) { if (!wornApparel[i].AllowVerbCast(base.Pawn.Position, base.Pawn.Map, base.abilityUser.Pawn.TargetCurrentlyAimingAt) && (this.mightDef.defName == "TM_Headshot" || this.mightDef.defName == "TM_DisablingShot" || this.mightDef.defName == "TM_DisablingShot_I" || this.mightDef.defName == "TM_DisablingShot_II" || this.mightDef.defName == "TM_DisablingShot_III" || this.mightDef.defName == "TM_AntiArmor" || this.mightDef.defName == "TM_ArrowStorm" || this.mightDef.defName == "TM_ArrowStorm_I" || this.mightDef.defName == "TM_ArrowStorm_II" || this.mightDef.defName == "TM_ArrowStorm_III" || this.mightDef.defName == "TM_Mimic")) { reason = "TM_ShieldBlockingPowers".Translate(new object[] { base.Pawn.Label, wornApparel[i].Label }); return(false); } } result = true; } else { result = false; } return(result); }
public override bool CanCastPowerCheck(AbilityContext context, out string reason) { bool flag = base.CanCastPowerCheck(context, out reason); bool result; if (flag) { reason = ""; WizardAbilityDef wizardAbilityDef; bool flag2 = base.Def != null && (wizardAbilityDef = (base.Def as WizardAbilityDef)) != null; if (flag2) { } result = true; } else { result = false; } return(result); }
public override void OnInspectorGUI() { DrawDefaultInspector(); GUI.enabled = !EditorApplication.isPlaying; if (GUILayout.Button("Auto set abilityIDs (Editor Only)")) { AbilityContext ac = (AbilityContext)target; int nextID = 0; List <PlayerAbility> abilities = new List <PlayerAbility>(); abilities.AddRange(ac.GetComponents <PlayerAbility>()); abilities.AddRange(ac.GetComponentsInChildren <PlayerAbility>()); foreach (PlayerAbility pa in abilities) { pa.abilityID = nextID; nextID++; EditorUtility.SetDirty(pa); } } }
public static bool PawnAbility_GetJob_Prefix(PawnAbility __instance, AbilityContext context, LocalTargetInfo target, ref Job __result) { Job job; Log.Message("target is " + target.Thing.LabelShort); AbilityDef abilityDef = Traverse.Create(root: __instance).Field(name: "powerdef").GetValue <AbilityDef>(); Log.Message("ability def is " + abilityDef.defName); Verb_UseAbility verb = Traverse.Create(root: __instance).Field(name: "verb").GetValue <Verb_UseAbility>(); Log.Message("verb is " + verb); if (verb == null) { Verb_UseAbility verb_UseAbility = (Verb_UseAbility)Activator.CreateInstance(abilityDef.MainVerb.verbClass); verb_UseAbility.caster = __instance.Pawn; verb_UseAbility.Ability = __instance; verb_UseAbility.verbProps = abilityDef.MainVerb; verb = verb_UseAbility; } if (verb != null) { Log.Message("verb is no longer null"); } job = abilityDef.GetJob(verb.UseAbilityProps.AbilityTargetCategory, target); job.playerForced = true; job.verbToUse = verb; job.count = context == AbilityContext.Player ? 1 : 0; //Count 1 for Player : 0 for AI if (target != null) { if (target.Thing is Pawn pawn2) { job.killIncappedTarget = pawn2.Downed; } } __result = job; return(false); }
public void Init(HealthSystem healthSystem, AbilitySystem abilitySystem, Transform abilitiesContainer, MainCameraStorage mainCameraStorage, Slider playerHealth, InputManager inputManager) { _healthSystem = healthSystem; _playerHealth = playerHealth; _abilitySystem = abilitySystem; _machineGunVisualizer = new MachineGunVisualizer(_machineGunLineRenderer, _machineGunLineDuration); var deps = new TankDeps(_machineGunVisualizer); abilitySystem.Init(_abilities, new ToParentFactory <AbilityUi, IAbilityUi>(_abilityUiPrefab, abilitiesContainer), in deps); mainCameraStorage.Set(_playerCamera); _inputManager = inputManager; inputManager.OnAbilityPressed += () => { _abilitySystem.Fire(in _abilityContext); }; inputManager.OnNextAbilityPressed += _abilitySystem.NextAbility; inputManager.OnPreviousAbilityPressed += _abilitySystem.PreviousAbility; _abilityContext = new AbilityContext(transform, _towerEnd); base.Init(healthSystem); }
public override bool CanCastPowerCheck(AbilityContext context, out string reason) { bool flag = base.CanCastPowerCheck(context, out reason); bool result; if (flag) { reason = ""; TMAbilityDef tmAbilityDef; bool flag1 = base.Def != null && (tmAbilityDef = (base.Def as TMAbilityDef)) != null; if (flag1) { bool flag4 = this.MightUser.Stamina != null; if (flag4) { bool flag5 = mightDef.staminaCost > 0f && this.ActualStaminaCost > this.MightUser.Stamina.CurLevel; if (flag5) { reason = "TM_NotEnoughStamina".Translate( base.Pawn.LabelShort ); result = false; return(result); } if (mightDef.chiCost > 0f) { bool flag6 = this.MightUser.Pawn.health.hediffSet.HasHediff(TorannMagicDefOf.TM_ChiHD, false) ? (this.ActualChiCost * 100) > this.MightUser.Pawn.health.hediffSet.GetFirstHediffOfDef(TorannMagicDefOf.TM_ChiHD, false).Severity : true; if (flag6) { reason = "TM_NotEnoughChi".Translate( base.Pawn.LabelShort ); result = false; return(result); } } bool flagNeed = mightDef.requiredNeed != null && this.MightUser.Pawn.needs.TryGetNeed(mightDef.requiredNeed) != null && this.MightUser.Pawn.needs.TryGetNeed(mightDef.requiredNeed).CurLevel > this.ActualNeedCost; if (flagNeed) { reason = "TM_NotEnoughEnergy".Translate( base.Pawn.LabelShort, mightDef.requiredNeed.label ); result = false; return(result); } bool flagHediff = mightDef.requiredHediff != null && this.MightUser.Pawn.health.hediffSet.HasHediff(mightDef.requiredHediff) && this.MightUser.Pawn.health.hediffSet.GetFirstHediffOfDef(mightDef.requiredHediff).Severity > this.ActualHediffCost; if (flagHediff) { reason = "TM_NotEnoughEnergy".Translate( base.Pawn.LabelShort, mightDef.requiredHediff.label ); result = false; return(result); } } } if (MightUser.specWpnRegNum == -1 && (this.mightDef == TorannMagicDefOf.TM_PistolWhip || this.mightDef == TorannMagicDefOf.TM_SuppressingFire || this.mightDef == TorannMagicDefOf.TM_Mk203GL || this.mightDef == TorannMagicDefOf.TM_Buckshot || this.mightDef == TorannMagicDefOf.TM_BreachingCharge)) { if (MightUser.Pawn.equipment != null && MightUser.Pawn.equipment.Primary != null) { reason = "TM_MustHaveWeaponType".Translate( base.Pawn.LabelShort, base.Pawn.equipment.Primary.def.label, "specialized weapon" ); } else { reason = "TM_IncompatibleWeapon".Translate(); } return(false); } List <Apparel> wornApparel = base.Pawn.apparel.WornApparel; for (int i = 0; i < wornApparel.Count; i++) { if (!wornApparel[i].AllowVerbCast(base.Pawn.Position, base.Pawn.Map, base.abilityUser.Pawn.TargetCurrentlyAimingAt, this.Verb) && (this.mightDef.defName == "TM_Headshot" || this.mightDef.defName == "TM_DisablingShot" || this.mightDef.defName == "TM_DisablingShot_I" || this.mightDef.defName == "TM_DisablingShot_II" || this.mightDef.defName == "TM_DisablingShot_III" || this.mightDef.defName == "TM_AntiArmor" || this.mightDef.defName == "TM_ArrowStorm" || this.mightDef.defName == "TM_ArrowStorm_I" || this.mightDef.defName == "TM_ArrowStorm_II" || this.mightDef.defName == "TM_ArrowStorm_III" || this.mightDef == TorannMagicDefOf.TM_PsionicStorm || this.mightDef.defName == "TM_PsionicBlast" || this.mightDef.defName == "TM_PsionicBlast_I" || this.mightDef.defName == "TM_PsionicBlast_II" || this.mightDef.defName == "TM_PsionicBlast_III" || this.mightDef == TorannMagicDefOf.TM_TempestStrike || this.mightDef == TorannMagicDefOf.TM_SuppressingFire || this.mightDef == TorannMagicDefOf.TM_Mk203GL || this.mightDef == TorannMagicDefOf.TM_Buckshot || this.mightDef.defName == "TM_Mimic")) { reason = "TM_ShieldBlockingPowers".Translate( base.Pawn.Label, wornApparel[i].Label ); return(false); } } if (TM_Calc.HasHateHediff(this.MightUser.Pawn) && this.MightUser.Pawn.story.traits.HasTrait(TorannMagicDefOf.DeathKnight)) { Hediff hediff = null; for (int h = 0; h < this.MightUser.Pawn.health.hediffSet.hediffs.Count; h++) { if (this.MightUser.Pawn.health.hediffSet.hediffs[h].def.defName.Contains("TM_HateHD")) { hediff = this.MightUser.Pawn.health.hediffSet.hediffs[h]; } } if (hediff != null) { if ((this.mightDef == TorannMagicDefOf.TM_Spite || this.mightDef == TorannMagicDefOf.TM_Spite_I || this.mightDef == TorannMagicDefOf.TM_Spite_II || this.mightDef == TorannMagicDefOf.TM_Spite_III) && hediff.Severity < 20f) { reason = "TM_NotEnoughHate".Translate( base.Pawn.LabelShort, "Spite" ); return(false); } } else { return(false); } } if (this.MightUser.Pawn.story.traits.HasTrait(TorannMagicDefOf.TM_Psionic)) { if (this.MightUser.Pawn.health.hediffSet.HasHediff(HediffDef.Named("TM_PsionicHD"), false)) { float psiEnergy = this.MightUser.Pawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("TM_PsionicHD"), false).Severity; if ((this.mightDef.defName == "TM_PsionicBlast" || this.mightDef.defName == "TM_PsionicBlast_I" || this.mightDef.defName == "TM_PsionicBlast_II" || this.mightDef.defName == "TM_PsionicBlast_III") && psiEnergy < 20f) { reason = "TM_NotEnoughPsionicEnergy".Translate( base.Pawn.Label, "Psionic Blast" ); return(false); } if ((this.mightDef == TorannMagicDefOf.TM_PsionicDash && psiEnergy < 8f)) { reason = "TM_NotEnoughPsionicEnergy".Translate( base.Pawn.Label, "Psionic Dash" ); return(false); } int stormCost = 65 - (5 * (this.MightUser.MightData.MightPowerSkill_PsionicStorm.FirstOrDefault((MightPowerSkill x) => x.label == "TM_PsionicStorm_eff").level)); if ((this.mightDef == TorannMagicDefOf.TM_PsionicStorm && psiEnergy < stormCost)) { reason = "TM_NotEnoughPsionicEnergy".Translate( base.Pawn.Label, "Psionic Storm" ); return(false); } } else { return(false); } } TMAbilityDef tmad = this.mightDef; if (tmad != null && tmad.requiredWeaponsOrCategories != null && tmad.IsRestrictedByEquipment(this.Pawn)) { reason = "TM_IncompatibleWeaponType".Translate( base.Pawn.LabelShort, tmad.label); return(false); } result = true; } else { result = false; } return(result); }
public override bool CanCastPowerCheck(AbilityContext context, out string reason) { bool flag = base.CanCastPowerCheck(context, out reason); bool result; if (flag) { reason = ""; TMAbilityDef tmAbilityDef; bool flag1 = base.Def != null && (tmAbilityDef = (base.Def as TMAbilityDef)) != null; if (flag1) { bool flag4 = this.MightUser.Stamina != null; if (flag4) { bool flag5 = mightDef.staminaCost > 0f && this.ActualStaminaCost > this.MightUser.Stamina.CurLevel; if (flag5) { reason = "TM_NotEnoughStamina".Translate( base.Pawn.LabelShort ); result = false; return(result); } bool flag6 = mightDef.chiCost > 0f && this.MightUser.Pawn.health.hediffSet.HasHediff(TorannMagicDefOf.TM_ChiHD, false) && (this.ActualChiCost * 100) > this.MightUser.Pawn.health.hediffSet.GetFirstHediffOfDef(TorannMagicDefOf.TM_ChiHD, false).Severity; if (flag6) { reason = "TM_NotEnoughChi".Translate( base.Pawn.LabelShort ); result = false; return(result); } } } List <Apparel> wornApparel = base.Pawn.apparel.WornApparel; for (int i = 0; i < wornApparel.Count; i++) { if (!wornApparel[i].AllowVerbCast(base.Pawn.Position, base.Pawn.Map, base.abilityUser.Pawn.TargetCurrentlyAimingAt, this.Verb) && (this.mightDef.defName == "TM_Headshot" || this.mightDef.defName == "TM_DisablingShot" || this.mightDef.defName == "TM_DisablingShot_I" || this.mightDef.defName == "TM_DisablingShot_II" || this.mightDef.defName == "TM_DisablingShot_III" || this.mightDef.defName == "TM_AntiArmor" || this.mightDef.defName == "TM_ArrowStorm" || this.mightDef.defName == "TM_ArrowStorm_I" || this.mightDef.defName == "TM_ArrowStorm_II" || this.mightDef.defName == "TM_ArrowStorm_III" || this.mightDef.defName == "TM_PsionicStorm" || this.mightDef.defName == "TM_PsionicBlast" || this.mightDef.defName == "TM_PsionicBlast_I" || this.mightDef.defName == "TM_PsionicBlast_II" || this.mightDef.defName == "TM_PsionicBlast_III" || this.mightDef == TorannMagicDefOf.TM_ThrowingKnife || this.mightDef.defName == "TM_Mimic")) { reason = "TM_ShieldBlockingPowers".Translate( base.Pawn.Label, wornApparel[i].Label ); return(false); } } if (TM_Calc.HasHateHediff(this.MightUser.Pawn) && this.MightUser.Pawn.story.traits.HasTrait(TorannMagicDefOf.DeathKnight)) { Hediff hediff = null; for (int h = 0; h < this.MightUser.Pawn.health.hediffSet.hediffs.Count; h++) { if (this.MightUser.Pawn.health.hediffSet.hediffs[h].def.defName.Contains("TM_HateHD")) { hediff = this.MightUser.Pawn.health.hediffSet.hediffs[h]; } } if (hediff != null) { if ((this.mightDef.defName == "TM_Spite" || this.mightDef.defName == "TM_Spite_I" || this.mightDef.defName == "TM_Spite_II" || this.mightDef.defName == "TM_Spite_III") && hediff.Severity < 20f) { reason = "TM_NotEnoughHate".Translate( base.Pawn.LabelShort, "Spite" ); return(false); } } else { return(false); } } if (this.MightUser.Pawn.story.traits.HasTrait(TorannMagicDefOf.TM_Psionic)) { if (this.MightUser.Pawn.health.hediffSet.HasHediff(HediffDef.Named("TM_PsionicHD"), false)) { float psiEnergy = this.MightUser.Pawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("TM_PsionicHD"), false).Severity; if ((this.mightDef.defName == "TM_PsionicBlast" || this.mightDef.defName == "TM_PsionicBlast_I" || this.mightDef.defName == "TM_PsionicBlast_II" || this.mightDef.defName == "TM_PsionicBlast_III") && psiEnergy < 20f) { reason = "TM_NotEnoughPsionicEnergy".Translate( base.Pawn.Label, "Psionic Blast" ); return(false); } if ((this.mightDef.defName == "TM_PsionicDash" && psiEnergy < 8f)) { reason = "TM_NotEnoughPsionicEnergy".Translate( base.Pawn.Label, "Psionic Dash" ); return(false); } int stormCost = 65 - (this.MightUser.MightData.MightPowerSkill_PsionicStorm.FirstOrDefault((MightPowerSkill x) => x.label == "TM_PsionicStorm_eff").level); if ((this.mightDef.defName == "TM_PsionicStorm" && psiEnergy < stormCost)) { reason = "TM_NotEnoughPsionicEnergy".Translate( base.Pawn.Label, "Psionic Storm" ); return(false); } } else { return(false); } } result = true; } else { result = false; } return(result); }
public override bool CanCastPowerCheck(AbilityContext context, out string reason) { bool flag = base.CanCastPowerCheck(context, out reason); bool result; if (flag) { reason = ""; TMAbilityDef tmAbilityDef; bool flag1 = base.Def != null && (tmAbilityDef = (base.Def as TMAbilityDef)) != null; if (flag1) { bool flag4 = this.MagicUser.Mana != null; if (flag4) { bool flag5 = magicDef.manaCost > 0f && this.ActualManaCost > this.MagicUser.Mana.CurLevel; if (flag5) { reason = "TM_NotEnoughMana".Translate( base.Pawn.LabelShort ); result = false; return result; } if (magicDef.bloodCost > 0f) { bool flag6 = this.MagicUser.Pawn.health.hediffSet.HasHediff(HediffDef.Named("TM_BloodHD"), false) ? (this.ActualBloodCost * 100) > this.MagicUser.Pawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("TM_BloodHD"), false).Severity : true; if (flag6) { reason = "TM_NotEnoughBlood".Translate( base.Pawn.LabelShort ); result = false; return result; } } bool flagMute = this.MagicUser.Pawn.health.hediffSet.HasHediff(TorannMagicDefOf.TM_MuteHD); if(flagMute) { reason = "TM_CasterMute".Translate( base.Pawn.LabelShort ); result = false; return result; } bool flagNeed = magicDef.requiredNeed != null && this.MagicUser.Pawn.needs.TryGetNeed(magicDef.requiredNeed) != null && this.MagicUser.Pawn.needs.TryGetNeed(magicDef.requiredNeed).CurLevel > this.ActualNeedCost; if(flagNeed) { reason = "TM_NotEnoughEnergy".Translate( base.Pawn.LabelShort, magicDef.requiredNeed.label ); result = false; return result; } bool flagHediff = magicDef.requiredHediff != null && this.MagicUser.Pawn.health.hediffSet.HasHediff(magicDef.requiredHediff) && this.MagicUser.Pawn.health.hediffSet.GetFirstHediffOfDef(magicDef.requiredHediff).Severity > this.ActualHediffCost; if (flagHediff) { reason = "TM_NotEnoughEnergy".Translate( base.Pawn.LabelShort, magicDef.requiredHediff.label ); result = false; return result; } } else if (this.Pawn.story.traits.HasTrait(TorannMagicDefOf.Faceless)) { CompAbilityUserMight mightComp = this.Pawn.GetComp<CompAbilityUserMight>(); bool flag7 = mightComp != null && mightComp.Stamina != null && magicDef.manaCost > 0f && this.magicDef.manaCost > mightComp.Stamina.CurLevel; if (flag7) { reason = "TM_NotEnoughStamina".Translate( base.Pawn.LabelShort ); result = false; return result; } } } List<Apparel> wornApparel = base.Pawn.apparel.WornApparel; for (int i = 0; i < wornApparel.Count; i++) { if (!wornApparel[i].AllowVerbCast(base.Pawn.Position, base.Pawn.Map, base.abilityUser.Pawn.TargetCurrentlyAimingAt, this.Verb) && (this.magicDef.defName == "TM_LightningCloud" || this.magicDef.defName == "Laser_LightningBolt" || this.magicDef.defName == "TM_LightningStorm" || this.magicDef.defName == "TM_EyeOfTheStorm" || this.magicDef.defName.Contains("Laser_FrostRay") || this.magicDef.defName == "TM_Blizzard" || this.magicDef.defName == "TM_Snowball" || this.magicDef.defName == "TM_Icebolt" || this.magicDef.defName == "TM_Firestorm" || this.magicDef.defName == "TM_Fireball" || this.magicDef.defName == "TM_Fireclaw" || this.magicDef.defName == "TM_Firebolt" || this.magicDef.defName.Contains("TM_MagicMissile") || this.magicDef.defName.Contains("TM_DeathBolt") || this.magicDef.defName.Contains("TM_ShadowBolt") || this.magicDef.defName == "TM_BloodForBlood" || this.magicDef.defName == "TM_IgniteBlood" || this.magicDef.defName == "TM_Poison" || this.magicDef == TorannMagicDefOf.TM_ArcaneBolt) ) { reason = "TM_ShieldBlockingPowers".Translate( base.Pawn.Label, wornApparel[i].Label ); return false; } } result = true; } else { result = false; } return result; }
public AbilityController(AbilityContext context) { _context = context; }