private void TryLaunchProjectile(ThingDef projectileDef, LocalTargetInfo launchTarget) { Vector3 drawPos = this.ExactPosition; Projectile_AbilityBase projectile_AbilityBase = (Projectile_AbilityBase)GenSpawn.Spawn(projectileDef, this.ExactPosition.ToIntVec3(), this.Map); //ShotReport shotReport = ShotReport.HitReportFor(this.pawn, this.verb, launchTarget); SoundDef expr_C8 = TorannMagicDefOf.TM_AirWoosh; if (expr_C8 != null) { SoundStarter.PlayOneShot(expr_C8, new TargetInfo(this.ExactPosition.ToIntVec3(), this.Map, false)); } projectile_AbilityBase.Launch(this.pawn, TorannMagicDefOf.TM_PsionicBlast, drawPos, launchTarget, ProjectileHitFlags.All, null, null, null, null); }
public static void ApplyMentalStates(Pawn victim, Pawn caster, List <ApplyMentalStates> localApplyMentalStates, AbilityUser.AbilityDef localAbilityDef, Projectile_AbilityBase abilityProjectile) { if (localApplyMentalStates != null) { if (localApplyMentalStates.Count > 0) { foreach (var mentalStateGiver in localApplyMentalStates) { var success = false; var checkValue = Rand.Value; var str = localAbilityDef.LabelCap + " (" + caster.LabelShort + ")"; if (checkValue <= mentalStateGiver.applyChance) { if (mentalStateGiver.mentalStateDef == MentalStateDefOf.Berserk && victim.RaceProps.intelligence < Intelligence.Humanlike) { if (caster == victim || abilityProjectile?.CanOverpower(caster, victim) != false) { success = true; victim.mindState.mentalStateHandler.TryStartMentalState( MentalStateDefOf.Manhunter, str, true); } } else { if (caster == victim || abilityProjectile?.CanOverpower(caster, victim) != false) { success = true; victim.mindState.mentalStateHandler.TryStartMentalState( mentalStateGiver.mentalStateDef, str, true); } } } if (success) { victim.Drawer.Notify_DebugAffected(); MoteMaker.ThrowText(victim.DrawPos, victim.Map, mentalStateGiver.mentalStateDef.LabelCap + ": " + StringsToTranslate.AU_CastSuccess, -1f); } else { MoteMaker.ThrowText(victim.DrawPos, victim.Map, mentalStateGiver.mentalStateDef.LabelCap + ": " + StringsToTranslate.AU_CastFailure, -1f); } } } } }
public static void ApplyHediffs(Pawn victim, Pawn caster, List <ApplyHediffs> localApplyHediffs, Projectile_AbilityBase abilityProjectile) { if (localApplyHediffs != null) { if (localApplyHediffs.Count > 0) { foreach (var hediffs in localApplyHediffs) { var success = false; if (Rand.Value <= hediffs.applyChance) { if (victim == caster || abilityProjectile?.CanOverpower(caster, victim) != false) { HealthUtility.AdjustSeverity(victim, hediffs.hediffDef, hediffs.severity); success = true; } } if (success) { victim.Drawer.Notify_DebugAffected(); MoteMaker.ThrowText(victim.DrawPos, victim.Map, hediffs.hediffDef.LabelCap + ": " + StringsToTranslate.AU_CastSuccess, -1f); } else { MoteMaker.ThrowText(victim.DrawPos, victim.Map, StringsToTranslate.AU_CastFailure, -1f); } } } } }