private void StartKnockbackAttack(IntVec3 target, float radius) { this.nextKnockbackAttack = (int)(this.Props.knockbackCooldownTicks * Rand.Range(.9f, 1.1f)) + Find.TickManager.TicksGame; this.castingCompleteTick = this.Props.knockbackAttackDelay + Find.TickManager.TicksGame; TM_Action.PawnActionDelay(this.Pawn, this.Props.knockbackAttackDelay, target, this.Pawn.meleeVerbs.TryGetMeleeVerb(this.rangedTarget.Thing)); this.shouldDoKnockBackAttack = true; }
private void StartAoEAttack(IntVec3 center, LocalTargetInfo target) { //Log.Message("starting aoe"); this.nextAoEAttack = (int)(this.Props.aoeCooldownTicks * Rand.Range(.9f, 1.1f)) + Find.TickManager.TicksGame; this.castingCompleteTick = this.Props.aoeAttackDelay + Find.TickManager.TicksGame; TM_Action.PawnActionDelay(this.Pawn, this.Props.aoeAttackDelay, target, this.Pawn.meleeVerbs.TryGetMeleeVerb(this.rangedTarget.Thing)); this.shouldDoAOEAttack = true; }
private void StartRangedAttack() { if (this.rangedTarget != null && TM_Calc.HasLoSFromTo(this.Pawn.Position, this.rangedTarget, this.Pawn, 4, this.Props.maxRangeForFarThreat)) { this.nextRangedAttack = (int)(this.Props.rangedCooldownTicks * Rand.Range(.9f, 1.1f)) + Find.TickManager.TicksGame; this.rangedBurstShots = this.Props.rangedBurstCount; this.rangedNextBurst = Find.TickManager.TicksGame + this.Props.rangedTicksBetweenBursts; this.castingCompleteTick = Find.TickManager.TicksGame + this.Props.rangedAttackDelay; //this.Pawn.CurJob.SetTarget(this.Pawn.jobs.curDriver.rotateToFace, rangedTarget); TM_Action.PawnActionDelay(this.Pawn, this.Props.rangedAttackDelay, this.rangedTarget, this.Pawn.meleeVerbs.TryGetMeleeVerb(this.rangedTarget.Thing)); } }
private void StartChargeAttack(IntVec3 t) { this.nextChargeAttack = this.Props.chargeCooldownTicks + Find.TickManager.TicksGame; bool flag = t != null && t.DistanceToEdge(this.Pawn.Map) > 6; if (flag && t.InBounds(this.Pawn.Map) && t.IsValid && t.Walkable(this.Pawn.Map) && Pawn.Position.DistanceTo(t) <= 60) { this.castingCompleteTick = Find.TickManager.TicksGame + this.Props.chargeAttackDelay; this.flightTarget = t; TM_Action.PawnActionDelay(this.Pawn, this.Props.chargeAttackDelay, t, this.Pawn.meleeVerbs.TryGetMeleeVerb(this.rangedTarget.Thing)); } else { this.flightTarget = null; } }
private void DoTaunt(Map map) { this.nextTaunt = (int)(this.Props.tauntCooldownTicks * Rand.Range(.9f, 1.1f)) + Find.TickManager.TicksGame; if (map != null) { List <Pawn> threatPawns = map.mapPawns.AllPawnsSpawned; bool anyPawnsTaunted = false; if (threatPawns != null && threatPawns.Count > 0) { int count = Mathf.Min(threatPawns.Count, 10); for (int i = 0; i < count; i++) { if (threatPawns[i].Faction != null && this.Pawn.Faction != null && threatPawns[i].Faction.HostileTo(this.Pawn.Faction) && !threatPawns[i].IsColonist) { if (threatPawns[i].jobs != null && threatPawns[i].CurJob != null && threatPawns[i].CurJob.targetA != null && threatPawns[i].CurJob.targetA.Thing != null && threatPawns[i].CurJob.targetA.Thing != this.Pawn) { if (Rand.Chance(this.Props.tauntChance) && (threatPawns[i].Position - this.Pawn.Position).LengthHorizontal < 60) { //Log.Message("taunting " + threatPawns[i].LabelShort + " doing job " + threatPawns[i].CurJobDef.defName + " with follow radius of " + threatPawns[i].CurJob.followRadius); if (threatPawns[i].CurJobDef == JobDefOf.Follow || threatPawns[i].CurJobDef == JobDefOf.FollowClose) { Job job = new Job(JobDefOf.AttackMelee, this.Pawn); threatPawns[i].jobs.TryTakeOrderedJob(job, JobTag.Misc); } else { Job job = new Job(threatPawns[i].CurJobDef, this.Pawn); threatPawns[i].jobs.TryTakeOrderedJob(job, JobTag.Misc); } anyPawnsTaunted = true; //Log.Message("taunting " + threatPawns[i].LabelShort); } } } } if (anyPawnsTaunted) { MoteMaker.ThrowText(this.Pawn.DrawPos, this.Pawn.Map, "TM_Taunting".Translate(), -1); TM_Action.PawnActionDelay(this.Pawn, 30, this.rangedTarget, this.Pawn.meleeVerbs.TryGetMeleeVerb(this.rangedTarget.Thing)); } } } }
private void DoChargeAttack(LocalTargetInfo t) { if (t == null) { t = this.rangedTarget; } this.nextChargeAttack = this.Props.chargeCooldownTicks + Find.TickManager.TicksGame; bool flag = t.Cell != default(IntVec3) && t.Cell.DistanceToEdge(this.Pawn.Map) > 6; float magnitude = (t.Cell - this.Pawn.Position).LengthHorizontal * .35f; if (flag && t.Thing != null) { for (int i = 0; i < 3; i++) { Vector3 moteDirection = TM_Calc.GetVector(this.Pawn.Position, t.Cell); TM_MoteMaker.ThrowGenericMote(TorannMagicDefOf.Mote_GrappleHook, this.Pawn.DrawPos, this.Pawn.Map, Rand.Range(1.1f, 1.4f), 0.15f, .02f + (.08f * i), .3f - (.04f * i), Rand.Range(-10, 10), magnitude + magnitude * i, (Quaternion.AngleAxis(90, Vector3.up) * moteDirection).ToAngleFlat(), Rand.Chance(.5f) ? (Quaternion.AngleAxis(90, Vector3.up) * moteDirection).ToAngleFlat() : (Quaternion.AngleAxis(-90, Vector3.up) * moteDirection).ToAngleFlat()); TM_MoteMaker.ThrowGenericMote(TorannMagicDefOf.Mote_GrappleHook, t.Thing.DrawPos, this.Pawn.Map, Rand.Range(1.1f, 1.4f), 0.15f, .02f + (.08f * i), .3f - (.04f * i), Rand.Range(-10, 10), magnitude + magnitude * i, (Quaternion.AngleAxis(-90, Vector3.up) * moteDirection).ToAngleFlat(), Rand.Chance(.5f) ? (Quaternion.AngleAxis(-90, Vector3.up) * moteDirection).ToAngleFlat() : (Quaternion.AngleAxis(90, Vector3.up) * moteDirection).ToAngleFlat()); } PullObject(t.Thing); TM_Action.PawnActionDelay(this.Pawn, 60, this.rangedTarget, this.Pawn.meleeVerbs.TryGetMeleeVerb(this.rangedTarget.Thing)); } }
private void StartRangedAttack() { if (this.rangedTarget != null && (this.rangedTarget.Cell - this.Pawn.Position).LengthHorizontal <= this.Props.maxRangeForFarThreat) { this.nextRangedAttack = (int)(this.Props.rangedCooldownTicks * Rand.Range(.9f, 1.1f)) + Find.TickManager.TicksGame; this.launchableThing = null; this.launchableThing = FindNearbyObject(ThingCategoryDefOf.Corpses, 1.8f); if (this.launchableThing != null) { this.rangedBurstShots = this.Props.rangedBurstCount; this.rangedNextBurst = Find.TickManager.TicksGame + this.Props.rangedTicksBetweenBursts; this.nextChargeAttack = Find.TickManager.TicksGame + 150; TM_Action.PawnActionDelay(this.Pawn, 120, this.rangedTarget, this.Pawn.meleeVerbs.TryGetMeleeVerb(this.rangedTarget.Thing)); } else if (this.launchableThing == null && Rand.Chance(.1f)) { this.rangedBurstShots = this.Props.rangedBurstCount; this.rangedNextBurst = Find.TickManager.TicksGame + this.Props.rangedTicksBetweenBursts; this.nextChargeAttack = Find.TickManager.TicksGame + 150; TM_Action.PawnActionDelay(this.Pawn, 120, this.rangedTarget, this.Pawn.meleeVerbs.TryGetMeleeVerb(this.rangedTarget.Thing)); } } }
private void StartTaunt(Map map, LocalTargetInfo target) { this.castingCompleteTick = Find.TickManager.TicksGame + this.Props.tauntAttackDelay; TM_Action.PawnActionDelay(this.Pawn, this.Props.tauntAttackDelay, target, this.Pawn.meleeVerbs.TryGetMeleeVerb(this.Pawn)); this.shouldDoTaunt = true; }