public override string ToString() { string text = (!focus.IsValid) ? string.Empty : focus.ToString(); string text2 = (!focusSecond.IsValid) ? string.Empty : (", second=" + focusSecond.ToString()); string text3 = (!(radius > 0f)) ? string.Empty : (", rad=" + radius.ToString("F2")); return("(" + def + " " + text + text2 + text3 + ")"); }
public override string ToString() { string text = focus.IsValid ? focus.ToString() : ""; string text2 = focusSecond.IsValid ? (", second=" + focusSecond.ToString()) : ""; string text3 = (radius > 0f) ? (", rad=" + radius.ToString("F2")) : ""; return("(" + def + " " + text + text2 + text3 + ")"); }
public override string ToString() { string text = (focus.IsValid ? focus.ToString() : ""); string text2 = (focusSecond.IsValid ? (", second=" + focusSecond.ToString()) : ""); string text3 = ((radius > 0f) ? (", rad=" + radius.ToString("F2")) : ""); return(string.Concat("(", def, " ", text, text2, text3, ")")); }
public JobTarget(LocalTargetInfo t) { if (t.HasThing) { name = t.Thing.Label; } else { name = "?" + t.ToString(); } location = new Location(t.Cell); }
public bool TryLaunchProjectileCheck(ThingDef projectileDef, LocalTargetInfo launchTarget) { DebugMessage(launchTarget.ToString()); var flag = TryFindShootLineFromTo(caster.Position, launchTarget, out var shootLine); if (verbProps.requireLineOfSight && verbProps.stopBurstWithoutLos && !flag) { Messages.Message("AU_NoLineOfSight".Translate(), MessageTypeDefOf.RejectInput); return(false); } var drawPos = caster.DrawPos; var projectile = (Projectile_AbilityBase)GenSpawn.Spawn(projectileDef, shootLine.Source, caster.Map); projectile.extraDamages = UseAbilityProps.extraDamages; projectile.localSpawnThings = UseAbilityProps.thingsToSpawn; verbProps.soundCast?.PlayOneShot(new TargetInfo(caster.Position, caster.Map, false)); verbProps.soundCastTail?.PlayOneShotOnCamera(); if (DebugViewSettings.drawShooting) { MoteMaker.ThrowText(caster.DrawPos, caster.Map, "ToHit", -1f); } ProjectileHitFlags projectileHitFlags4 = ProjectileHitFlags.IntendedTarget; if (this.canHitNonTargetPawnsNow) { projectileHitFlags4 |= ProjectileHitFlags.NonTargetPawns; } if (!this.currentTarget.HasThing || this.currentTarget.Thing.def.Fillage == FillCategory.Full) { projectileHitFlags4 |= ProjectileHitFlags.NonTargetWorld; } DebugMessage(launchTarget.ToString()); projectile.Launch(caster, Ability.Def, drawPos, launchTarget, projectileHitFlags4, null, UseAbilityProps.hediffsToApply, UseAbilityProps.mentalStatesToApply, UseAbilityProps.thingsToSpawn); return(true); }
public override string ToString() { string text = def.ToString() + " (" + GetUniqueLoadID() + ")"; if (targetA.IsValid) { text = text + " A=" + targetA.ToString(); } if (targetB.IsValid) { text = text + " B=" + targetB.ToString(); } if (targetC.IsValid) { text = text + " C=" + targetC.ToString(); } return(text); }
public override string ToString() { return(target.ToString()); }
protected bool?TryLaunchProjectile(ThingDef projectileDef, LocalTargetInfo launchTarget) { DebugMessage(launchTarget.ToString()); var flag = TryFindShootLineFromTo(caster.Position, launchTarget, out var shootLine); if (verbProps.stopBurstWithoutLos && !flag) { DebugMessage("Targeting cancelled"); return(false); } var drawPos = caster.DrawPos; var projectile = (Projectile_AbilityBase)GenSpawn.Spawn(projectileDef, shootLine.Source, caster.Map); projectile.extraDamages = UseAbilityProps.extraDamages; projectile.localSpawnThings = UseAbilityProps.thingsToSpawn; //projectile. FreeIntercept = canFreeInterceptNow && !projectile.def.projectile.flyOverhead; var shotReport = ShotReport.HitReportFor(caster, this, launchTarget); verbProps.soundCast?.PlayOneShot(new TargetInfo(caster.Position, caster.Map, false)); verbProps.soundCastTail?.PlayOneShotOnCamera(); // if (!UseAbilityProps.AlwaysHits) // { // Thing randomCoverToMissInto = shotReport.GetRandomCoverToMissInto(); // ThingDef targetCoverDef = (randomCoverToMissInto == null) ? null : randomCoverToMissInto.def; // if (!Rand.Chance(shotReport.ChanceToNotGoWild_IgnoringPosture)) // { // if (DebugViewSettings.drawShooting) // MoteMaker.ThrowText(caster.DrawPos, caster.Map, "ToWild", -1f); // shootLine.ChangeDestToMissWild(); // ProjectileHitFlags projectileHitFlags2; // if (Rand.Chance(0.5f)) // { // projectileHitFlags2 = ProjectileHitFlags.NonTargetWorld; // } // else // { // projectileHitFlags2 = ProjectileHitFlags.NonTargetWorld; // if (this.canHitNonTargetPawnsNow) // { // projectileHitFlags2 |= ProjectileHitFlags.NonTargetPawns; // } // } // projectile.Launch(caster, Ability.Def, drawPos, shootLine.Dest, projectileHitFlags2, EquipmentSource, // UseAbilityProps.hediffsToApply, UseAbilityProps.mentalStatesToApply, // UseAbilityProps.thingsToSpawn); // return true; // } // if (!Rand.Chance(shotReport.ChanceToNotHitCover)) // { // if (DebugViewSettings.drawShooting) // MoteMaker.ThrowText(caster.DrawPos, caster.Map, "ToCover", -1f); // if (launchTarget.Thing != null && launchTarget.Thing.def.category == ThingCategory.Pawn) // { // randomCoverToMissInto = shotReport.GetRandomCoverToMissInto(); // ProjectileHitFlags projectileHitFlags3 = ProjectileHitFlags.NonTargetWorld; // if (this.canHitNonTargetPawnsNow) // { // projectileHitFlags3 |= ProjectileHitFlags.NonTargetPawns; // } // projectile.Launch(caster, Ability.Def, drawPos, randomCoverToMissInto, projectileHitFlags3, null, // UseAbilityProps.hediffsToApply, UseAbilityProps.mentalStatesToApply, // UseAbilityProps.thingsToSpawn); // return true; // } // } // } if (DebugViewSettings.drawShooting) { MoteMaker.ThrowText(caster.DrawPos, caster.Map, "ToHit", -1f); } ProjectileHitFlags projectileHitFlags4 = ProjectileHitFlags.IntendedTarget; if (this.canHitNonTargetPawnsNow) { projectileHitFlags4 |= ProjectileHitFlags.NonTargetPawns; } if (!this.currentTarget.HasThing || this.currentTarget.Thing.def.Fillage == FillCategory.Full) { projectileHitFlags4 |= ProjectileHitFlags.NonTargetWorld; } DebugMessage(launchTarget.ToString()); projectile.Launch(caster, Ability.Def, drawPos, launchTarget, projectileHitFlags4, null, UseAbilityProps.hediffsToApply, UseAbilityProps.mentalStatesToApply, UseAbilityProps.thingsToSpawn); return(true); }
protected new bool?TryLaunchProjectile(ThingDef projectileDef, LocalTargetInfo launchTarget) { DebugMessage(launchTarget.ToString()); var flag = TryFindShootLineFromTo(caster.Position, launchTarget, out var shootLine); if (verbProps.stopBurstWithoutLos && !flag) { DebugMessage("Targeting cancelled"); return(false); } var drawPos = caster.DrawPos; var projectile2 = (Projectile_AbilityBase)GenSpawn.Spawn(projectileDef, shootLine.Source, caster.Map); projectile2.extraDamages = UseAbilityProps.extraDamages; projectile2.localSpawnThings = UseAbilityProps.thingsToSpawn; verbProps.soundCast?.PlayOneShot(new TargetInfo(caster.Position, caster.Map, false)); verbProps.soundCastTail?.PlayOneShotOnCamera(); if (DebugViewSettings.drawShooting) { MoteMaker.ThrowText(caster.DrawPos, caster.Map, "ToHit", -1f); } if (this.verbProps.forcedMissRadius > 0.5f) { float num = VerbUtility.CalculateAdjustedForcedMiss(this.verbProps.forcedMissRadius, this.currentTarget.Cell - this.caster.Position); if (num > 0.5f) { int max = GenRadial.NumCellsInRadius(num); int num2 = Rand.Range(0, max); if (num2 > 0) { IntVec3 c = this.currentTarget.Cell + GenRadial.RadialPattern[num2]; this.ThrowDebugText("ToRadius"); this.ThrowDebugText("Rad\nDest", c); ProjectileHitFlags projectileHitFlags = ProjectileHitFlags.NonTargetWorld; if (Rand.Chance(0.5f)) { projectileHitFlags = ProjectileHitFlags.All; } if (!this.canHitNonTargetPawnsNow) { projectileHitFlags &= ~ProjectileHitFlags.NonTargetPawns; } // projectile2.Launch(CasterPawn, drawPos, c, this.currentTarget, projectileHitFlags, caster, null); projectile2.Launch(caster, Ability.Def, drawPos, c, projectileHitFlags, null, UseAbilityProps.hediffsToApply, UseAbilityProps.mentalStatesToApply, UseAbilityProps.thingsToSpawn); return(true); } } } ShotReport shotReport = ShotReport.HitReportFor(this.caster, this, this.currentTarget); Thing randomCoverToMissInto = shotReport.GetRandomCoverToMissInto(); ThingDef targetCoverDef = (randomCoverToMissInto == null) ? null : randomCoverToMissInto.def; if (!Rand.Chance(shotReport.AimOnTargetChance_IgnoringPosture)) { shootLine.ChangeDestToMissWild(shotReport.AimOnTargetChance_StandardTarget); this.ThrowDebugText("ToWild" + ((!this.canHitNonTargetPawnsNow) ? string.Empty : "\nchntp")); this.ThrowDebugText("Wild\nDest", shootLine.Dest); ProjectileHitFlags projectileHitFlags2 = ProjectileHitFlags.NonTargetWorld; if (Rand.Chance(0.5f) && this.canHitNonTargetPawnsNow) { projectileHitFlags2 |= ProjectileHitFlags.NonTargetPawns; } // projectile2.Launch(CasterPawn, drawPos, shootLine.Dest, this.currentTarget, projectileHitFlags2, caster, targetCoverDef); projectile2.Launch(caster, Ability.Def, drawPos, shootLine.Dest, projectileHitFlags2, null, UseAbilityProps.hediffsToApply, UseAbilityProps.mentalStatesToApply, UseAbilityProps.thingsToSpawn); return(true); } if (this.currentTarget.Thing != null && this.currentTarget.Thing.def.category == ThingCategory.Pawn && !Rand.Chance(shotReport.PassCoverChance)) { this.ThrowDebugText("ToCover" + ((!this.canHitNonTargetPawnsNow) ? string.Empty : "\nchntp")); this.ThrowDebugText("Cover\nDest", randomCoverToMissInto.Position); ProjectileHitFlags projectileHitFlags3 = ProjectileHitFlags.NonTargetWorld; if (this.canHitNonTargetPawnsNow) { projectileHitFlags3 |= ProjectileHitFlags.NonTargetPawns; } // projectile2.Launch(CasterPawn, drawPos, randomCoverToMissInto, this.currentTarget, projectileHitFlags3, caster, targetCoverDef); projectile2.Launch(caster, Ability.Def, drawPos, randomCoverToMissInto, projectileHitFlags3, null, UseAbilityProps.hediffsToApply, UseAbilityProps.mentalStatesToApply, UseAbilityProps.thingsToSpawn); return(true); } ProjectileHitFlags projectileHitFlags4 = ProjectileHitFlags.IntendedTarget; if (this.canHitNonTargetPawnsNow) { projectileHitFlags4 |= ProjectileHitFlags.NonTargetPawns; } if (!this.currentTarget.HasThing || this.currentTarget.Thing.def.Fillage == FillCategory.Full) { projectileHitFlags4 |= ProjectileHitFlags.NonTargetWorld; } this.ThrowDebugText("ToHit" + ((!this.canHitNonTargetPawnsNow) ? string.Empty : "\nchntp")); if (this.currentTarget.Thing != null) { // projectile2.Launch(CasterPawn, drawPos, this.currentTarget, this.currentTarget, projectileHitFlags4, caster, targetCoverDef); projectile2.Launch(caster, Ability.Def, drawPos, currentTarget, projectileHitFlags4, null, UseAbilityProps.hediffsToApply, UseAbilityProps.mentalStatesToApply, UseAbilityProps.thingsToSpawn); this.ThrowDebugText("Hit\nDest", this.currentTarget.Cell); } else { // projectile2.Launch(CasterPawn, drawPos, shootLine.Dest, this.currentTarget, projectileHitFlags4, caster, targetCoverDef); projectile2.Launch(caster, Ability.Def, drawPos, shootLine.Dest, projectileHitFlags4, null, UseAbilityProps.hediffsToApply, UseAbilityProps.mentalStatesToApply, UseAbilityProps.thingsToSpawn); this.ThrowDebugText("Hit\nDest", shootLine.Dest); } /* * ProjectileHitFlags projectileHitFlags4 = ProjectileHitFlags.IntendedTarget; * if (this.canHitNonTargetPawnsNow) * { * projectileHitFlags4 |= ProjectileHitFlags.NonTargetPawns; * } * if (!this.currentTarget.HasThing || this.currentTarget.Thing.def.Fillage == FillCategory.Full) * { * projectileHitFlags4 |= ProjectileHitFlags.NonTargetWorld; * } * DebugMessage(launchTarget.ToString()); * projectile2.Launch(caster, Ability.Def, drawPos, launchTarget, projectileHitFlags4, null, * UseAbilityProps.hediffsToApply, * UseAbilityProps.mentalStatesToApply, UseAbilityProps.thingsToSpawn); */ return(true); }