public virtual void Reset() { this.state = VerbState.Idle; this.currentTarget = null; this.burstShotsLeft = 0; this.ticksToNextBurstShot = 0; this.castCompleteCallback = null; this.surpriseAttack = false; }
public virtual void Reset() { state = VerbState.Idle; currentTarget = null; currentDestination = null; burstShotsLeft = 0; ticksToNextBurstShot = 0; castCompleteCallback = null; surpriseAttack = false; }
public virtual void WarmupComplete() { this.burstShotsLeft = this.ShotsPerBurst; this.state = VerbState.Bursting; this.TryCastNextBurstShot(); if (this.CasterIsPawn && this.currentTarget.HasThing) { Pawn pawn = this.currentTarget.Thing as Pawn; if (pawn != null && pawn.IsColonistPlayerControlled) { this.CasterPawn.records.AccumulateStoryEvent(StoryEventDefOf.AttackedPlayer); } } }
protected void TryCastNextBurstShot() { LocalTargetInfo localTargetInfo = this.currentTarget; if (this.Available() && this.TryCastShot()) { if (this.verbProps.muzzleFlashScale > 0.01f) { MoteMaker.MakeStaticMote(this.caster.Position, this.caster.Map, ThingDefOf.Mote_ShotFlash, this.verbProps.muzzleFlashScale); } if (this.verbProps.soundCast != null) { this.verbProps.soundCast.PlayOneShot(new TargetInfo(this.caster.Position, this.caster.Map, false)); } if (this.verbProps.soundCastTail != null) { this.verbProps.soundCastTail.PlayOneShotOnCamera(this.caster.Map); } if (this.CasterIsPawn) { if (this.CasterPawn.thinker != null) { this.CasterPawn.mindState.Notify_EngagedTarget(); } if (this.CasterPawn.mindState != null) { this.CasterPawn.mindState.Notify_AttackedTarget(localTargetInfo); } if (this.CasterPawn.MentalState != null) { this.CasterPawn.MentalState.Notify_AttackedTarget(localTargetInfo); } if (this.TerrainDefSource != null) { this.CasterPawn.meleeVerbs.Notify_UsedTerrainBasedVerb(); } if (!this.CasterPawn.Spawned) { return; } } if (this.verbProps.consumeFuelPerShot > 0f) { CompRefuelable compRefuelable = this.caster.TryGetComp <CompRefuelable>(); if (compRefuelable != null) { compRefuelable.ConsumeFuel(this.verbProps.consumeFuelPerShot); } } this.burstShotsLeft--; } else { this.burstShotsLeft = 0; } if (this.burstShotsLeft > 0) { this.ticksToNextBurstShot = this.verbProps.ticksBetweenBurstShots; if (this.CasterIsPawn) { this.CasterPawn.stances.SetStance(new Stance_Cooldown(this.verbProps.ticksBetweenBurstShots + 1, this.currentTarget, this)); } } else { this.state = VerbState.Idle; if (this.CasterIsPawn) { this.CasterPawn.stances.SetStance(new Stance_Cooldown(this.verbProps.AdjustedCooldownTicks(this, this.CasterPawn), this.currentTarget, this)); } if (this.castCompleteCallback != null) { this.castCompleteCallback(); } } }
protected void TryCastNextBurstShot() { LocalTargetInfo localTargetInfo = currentTarget; if (Available() && TryCastShot()) { if (verbProps.muzzleFlashScale > 0.01f) { MoteMaker.MakeStaticMote(caster.Position, caster.Map, ThingDefOf.Mote_ShotFlash, verbProps.muzzleFlashScale); } if (verbProps.soundCast != null) { verbProps.soundCast.PlayOneShot(new TargetInfo(caster.Position, caster.Map)); } if (verbProps.soundCastTail != null) { verbProps.soundCastTail.PlayOneShotOnCamera(caster.Map); } if (CasterIsPawn) { if (CasterPawn.thinker != null) { CasterPawn.mindState.Notify_EngagedTarget(); } if (CasterPawn.mindState != null) { CasterPawn.mindState.Notify_AttackedTarget(localTargetInfo); } if (CasterPawn.MentalState != null) { CasterPawn.MentalState.Notify_AttackedTarget(localTargetInfo); } if (TerrainDefSource != null) { CasterPawn.meleeVerbs.Notify_UsedTerrainBasedVerb(); } if (CasterPawn.health != null) { CasterPawn.health.Notify_UsedVerb(this, localTargetInfo); } if (EquipmentSource != null) { EquipmentSource.Notify_UsedWeapon(CasterPawn); } if (!CasterPawn.Spawned) { return; } } if (verbProps.consumeFuelPerShot > 0f) { caster.TryGetComp <CompRefuelable>()?.ConsumeFuel(verbProps.consumeFuelPerShot); } burstShotsLeft--; } else { burstShotsLeft = 0; } if (burstShotsLeft > 0) { ticksToNextBurstShot = verbProps.ticksBetweenBurstShots; if (CasterIsPawn) { CasterPawn.stances.SetStance(new Stance_Cooldown(verbProps.ticksBetweenBurstShots + 1, currentTarget, this)); } return; } state = VerbState.Idle; if (CasterIsPawn) { CasterPawn.stances.SetStance(new Stance_Cooldown(verbProps.AdjustedCooldownTicks(this, CasterPawn), currentTarget, this)); } if (castCompleteCallback != null) { castCompleteCallback(); } }
protected void TryCastNextBurstShot() { LocalTargetInfo localTargetInfo = this.currentTarget; if (this.TryCastShot()) { if (this.verbProps.muzzleFlashScale > 0.01f) { MoteMaker.MakeStaticMote(this.caster.Position, this.caster.Map, ThingDefOf.Mote_ShotFlash, this.verbProps.muzzleFlashScale); } if (this.verbProps.soundCast != null) { this.verbProps.soundCast.PlayOneShot(new TargetInfo(this.caster.Position, this.caster.Map, false)); } if (this.verbProps.soundCastTail != null) { this.verbProps.soundCastTail.PlayOneShotOnCamera(this.caster.Map); } if (this.CasterIsPawn) { if (this.CasterPawn.thinker != null) { this.CasterPawn.mindState.Notify_EngagedTarget(); } if (this.CasterPawn.mindState != null) { this.CasterPawn.mindState.Notify_AttackedTarget(localTargetInfo); } if (this.CasterPawn.MentalState != null) { this.CasterPawn.MentalState.Notify_AttackedTarget(localTargetInfo); } if (!this.CasterPawn.Spawned) { return; } } this.burstShotsLeft--; } else { this.burstShotsLeft = 0; } if (this.burstShotsLeft > 0) { this.ticksToNextBurstShot = this.verbProps.ticksBetweenBurstShots; if (this.CasterIsPawn) { this.CasterPawn.stances.SetStance(new Stance_Cooldown(this.verbProps.ticksBetweenBurstShots + 1, this.currentTarget, this)); } } else { this.state = VerbState.Idle; if (this.CasterIsPawn) { this.CasterPawn.stances.SetStance(new Stance_Cooldown(this.verbProps.AdjustedCooldownTicks(this, this.CasterPawn, this.ownerEquipment), this.currentTarget, this)); } if (this.castCompleteCallback != null) { this.castCompleteCallback(); } } }