/*public override void WarmupComplete() * { * base.WarmupComplete(); * if (ShooterPawn != null && ShooterPawn.skills != null) * { * ShooterPawn.skills.Learn(SkillDefOf.Shooting, 100); * } * }*/ public override ShiftVecReport ShiftVecReportFor(LocalTargetInfo target) { ShiftVecReport report = base.ShiftVecReportFor(target); report.circularMissRadius = this.GetMissRadiusForDist(report.shotDist); // Check for marker ArtilleryMarker marker = null; if (this.currentTarget.HasThing && this.currentTarget.Thing.HasAttachment(ThingDef.Named(ArtilleryMarker.MarkerDef))) { marker = (ArtilleryMarker)this.currentTarget.Thing.GetAttachment(ThingDef.Named(ArtilleryMarker.MarkerDef)); } else if (currentTarget.Cell.InBounds(caster.Map)) { marker = (ArtilleryMarker)this.currentTarget.Cell.GetFirstThing(caster.Map, ThingDef.Named(ArtilleryMarker.MarkerDef)); } if (marker != null) { report.aimingAccuracy = marker.aimingAccuracy; report.sightsEfficiency = marker.sightsEfficiency; report.weatherShift = marker.weatherShift; report.lightingShift = marker.lightingShift; PlayerKnowledgeDatabase.KnowledgeDemonstrated(CE_ConceptDefOf.CE_Spotting, KnowledgeAmount.SpecificInteraction); } // If we don't have a marker check for indirect fire and apply penalty else if (report.shotDist > 75 || !GenSight.LineOfSight(this.caster.Position, report.target.Cell, caster.Map, true)) { report.indirectFireShift = this.VerbPropsCE.indirectFirePenalty * report.shotDist; report.weatherShift = 0f; report.lightingShift = 0f; } return(report); }
protected override bool TryCastShot() { ArtilleryMarker marker = ThingMaker.MakeThing(ThingDef.Named(ArtilleryMarker.MarkerDef)) as ArtilleryMarker; ShiftVecReport report = ShiftVecReportFor(currentTarget); marker.sightsEfficiency = report.sightsEfficiency; marker.aimingAccuracy = report.aimingAccuracy; marker.lightingShift = report.lightingShift; marker.weatherShift = report.weatherShift; GenSpawn.Spawn(marker, this.currentTarget.Cell, caster.Map); // Check for something to attach marker to if (this.currentTarget.HasThing) { CompAttachBase comp = this.currentTarget.Thing.TryGetComp <CompAttachBase>(); if (comp != null) { marker.AttachTo(this.currentTarget.Thing); } } // Show we learned something PlayerKnowledgeDatabase.KnowledgeDemonstrated(CE_ConceptDefOf.CE_Spotting, KnowledgeAmount.SmallInteraction); return(true); }
/*public override void WarmupComplete() * { * base.WarmupComplete(); * if (ShooterPawn != null && ShooterPawn.skills != null) * { * ShooterPawn.skills.Learn(SkillDefOf.Shooting, 100); * } * }*/ public override ShiftVecReport ShiftVecReportFor(LocalTargetInfo target) { ShiftVecReport report = base.ShiftVecReportFor(target); report.circularMissRadius = this.GetMissRadiusForDist(report.shotDist); // Check for marker ArtilleryMarker marker = null; if (this.currentTarget.HasThing && this.currentTarget.Thing.HasAttachment(ThingDef.Named(ArtilleryMarker.MarkerDef))) { marker = (ArtilleryMarker)this.currentTarget.Thing.GetAttachment(ThingDef.Named(ArtilleryMarker.MarkerDef)); } else { marker = (ArtilleryMarker)this.currentTarget.Cell.GetFirstThing(caster.Map, ThingDef.Named(ArtilleryMarker.MarkerDef)); } if (marker != null) { report.aimingAccuracy = marker.aimingAccuracy; report.aimEfficiency = marker.aimEfficiency; report.weatherShift = marker.weatherShift; report.lightingShift = marker.lightingShift; } // If we don't have a marker check for indirect fire and apply penalty else if (report.shotDist > 107 || !GenSight.LineOfSight(this.caster.Position, report.target.Cell, caster.Map, true)) { report.indirectFireShift = this.verbPropsCE.indirectFirePenalty * report.shotDist; report.weatherShift = 0f; report.lightingShift = 0f; } return(report); }
public override void AttachTo(Thing parent) { if (parent != null) { CompAttachBase comp = parent.TryGetComp <CompAttachBase>(); if (comp != null) { if (parent.HasAttachment(ThingDef.Named(ArtilleryMarker.MarkerDef))) { ArtilleryMarker oldMarker = (ArtilleryMarker)parent.GetAttachment(ThingDef.Named(ArtilleryMarker.MarkerDef)); oldMarker.Destroy(); } } } base.AttachTo(parent); }
protected override bool TryCastShot() { ArtilleryMarker marker = ThingMaker.MakeThing(ThingDef.Named(ArtilleryMarker.MarkerDef)) as ArtilleryMarker; ShiftVecReport report = ShiftVecReportFor(currentTarget); marker.aimEfficiency = report.aimEfficiency; marker.aimingAccuracy = report.aimingAccuracy; marker.lightingShift = report.lightingShift; marker.weatherShift = report.weatherShift; GenSpawn.Spawn(marker, this.currentTarget.Cell, caster.Map); // Check for something to attach marker to if (this.currentTarget.HasThing) { CompAttachBase comp = this.currentTarget.Thing.TryGetComp <CompAttachBase>(); if (comp != null) { marker.AttachTo(this.currentTarget.Thing); } } return(true); }