public override void Tick() { base.Tick(); if (this.Growth >= 0.75f && Rand.Chance(0.1f) && Find.TickManager.TicksGame % Rand.RangeInclusive(60, 100) == 0) { //PurpleIvyMoteMaker.ThrowEMPLightningGlow(this.Position.ToVector3Shifted(), this.Map, 0.3f); PurpleIvyMoteMaker.ThrowLightningBolt(this.Position.ToVector3Shifted(), this.Map); } if (Find.TickManager.TicksGame % 2000 == 0) { base.TickLong(); if (this.Growth >= 0.25f) { base.ThrowGasOrAdjustGasSize(4f); base.DoDamageToBuildings(); if (this.CanMutate == true) { this.TryMutate(); } } } if (Find.TickManager.TicksGame % Rand.RangeInclusive(250, 500) == 0) { if (this.Growth >= 0.25f) { base.DoDamageToThings(); } if (!NestsNearby()) { this.TakeDamage(new DamageInfo(DamageDefOf.Deterioration, 1f)); } } }
public override void Tick() { if (Find.TickManager.TicksGame % 60 == 0) { List <Thing> list = new List <Thing>(); try { if (GenGrid.InBounds(this.Position, this.Map)) { list = this.Map.thingGrid.ThingsListAt(this.Position); } } catch { return; } if (list == null || list.Count <= 0) { return; } for (int i = 0; i < list.Count; i++) { if (list[i] == null || list[i].Faction == PurpleIvyData.AlienFaction) { continue; } switch (list[i]) { case Pawn _: { try { PurpleIvyMoteMaker.ThrowToxicSmoke(this.Position.ToVector3Shifted(), this.Map); Pawn pawn = (Pawn)list[i]; if (!pawn.RaceProps.IsMechanoid) { HealthUtility.AdjustSeverity(pawn, HediffDefOf.ToxicBuildup, 0.005f); HealthUtility.AdjustSeverity(pawn, PurpleIvyDefOf.PI_VaporToxicFilth, 1f); } } catch { } break; } case Plant _: { if (list[i].def != PurpleIvyDefOf.PurpleIvy && list[i].def != PurpleIvyDefOf.PI_Nest && list[i].def != PurpleIvyDefOf.PlantVenomousToothwort && list[i].def != PurpleIvyDefOf.PI_CorruptedTree) { PurpleIvyMoteMaker.ThrowToxicSmoke(this.Position.ToVector3Shifted(), this.Map); list[i].TakeDamage(new DamageInfo(PurpleIvyDefOf.PI_ToxicBurn, 1)); } break; } } } } }
public override void PreApplyDamage(ref DamageInfo dinfo, out bool absorbed) { if (dinfo.Instigator is Pawn) { this.Map.GetComponent <MapComponent_MapEvents>().LastAttacked = Find.TickManager.TicksGame; } PurpleIvyMoteMaker.ThrowToxicGas(this.Position.ToVector3Shifted() + Gen.RandomHorizontalVector(1f), this.Map, 1f); base.PreApplyDamage(ref dinfo, out absorbed); }
public override void TickRare() { base.TickRare(); pumpfreq--; if (pumpfreq <= 0) { PurpleIvyMoteMaker.ThrowToxicGas(base.Position.ToVector3Shifted(), this.Map, 1f); pumpfreq = 3; } }
protected override void ExplosionVisualEffectCenter(Explosion explosion) { for (int i = 0; i < 4; i++) { PurpleIvyMoteMaker.ThrowToxicGas(explosion.Position.ToVector3Shifted() + Gen.RandomHorizontalVector(explosion.radius * 0.7f), explosion.Map, 1f); } //if (this.def.explosionInteriorMote != null) //{ // int num = Mathf.RoundToInt(3.14159274f * explosion.radius * explosion.radius / 6f); // for (int j = 0; j < num; j++) // { // MoteMaker.ThrowExplosionInteriorMote(explosion.Position.ToVector3Shifted() + Gen.RandomHorizontalVector(explosion.radius * 0.7f), explosion.Map, this.def.explosionInteriorMote); // } //} }
public static void ThrowExplosionCell(IntVec3 cell, Map map, ThingDef moteDef, Color color) { if (!cell.ShouldSpawnMotesAt(map)) { return; } Mote moteThrown = (Mote)ThingMaker.MakeThing(moteDef, null); moteThrown.exactRotation = (float)(90 * Rand.RangeInclusive(0, 3)); moteThrown.exactPosition = cell.ToVector3Shifted(); moteThrown.instanceColor = new Color(0.368f, 0f, 1f); GenSpawn.Spawn(moteThrown, cell, map, WipeMode.Vanish); if (Rand.Value < 0.7f) { PurpleIvyMoteMaker.ThrowDustPuff(cell.ToVector3Shifted(), map, 1.2f); } }
public override void Tick() { if (this.contents.SingleContainedThing is Building_Meteorite) { PurpleIvyMoteMaker.ThrowToxicGas(DrawPos, this.Map, 1f); PurpleIvyMoteMaker.ThrowLightningGlow(DrawPos, this.Map, 1f); } else if (this.contents.SingleContainedThing is AlienQueen) { MoteMaker.ThrowSmoke(DrawPos, this.Map, 3f); PurpleIvyMoteMaker.ThrowLightningGlow(DrawPos, this.Map, 3f); } this.ticksToImpact--; if (this.ticksToImpact <= 0) { this.PodImpact(); } if (!this.soundPlayed && this.ticksToImpact < 100) { this.soundPlayed = true; MeteorIncoming.LandSound.PlayOneShot(new TargetInfo(base.Position, base.Map, false)); } }
public override void FireEvent() { base.FireEvent(); if (!this.strikeLoc.IsValid) { this.strikeLoc = CellFinderLoose.RandomCellWith((IntVec3 sq) => GenGrid.Standable(sq, this.map) && !this.map.roofGrid.Roofed(sq), this.map, 1000); } this.boltMesh = LightningBoltMeshPool.RandomBoltMesh; if (!GridsUtility.Fogged(this.strikeLoc, this.map)) { GenExplosion.DoExplosion(this.strikeLoc, this.map, 8f, DamageDefOf.EMP, null, -1, -1f, null, null, null, null, null, 0f, 1, false, null, 0f, 1, 0f, false); Vector3 loc = this.strikeLoc.ToVector3Shifted(); for (int i = 0; i < 4; i++) { PurpleIvyMoteMaker.ThrowEMPSmoke(loc, this.map, 2f); PurpleIvyMoteMaker.ThrowEMPMicroSparks(loc, this.map); PurpleIvyMoteMaker.ThrowEMPLightningGlow(loc, this.map, 4.5f); } } SoundInfo soundInfo = SoundInfo.InMap(new TargetInfo(this.strikeLoc, this.map, false), 0); SoundStarter.PlayOneShot(SoundDefOf.Thunder_OnMap, soundInfo); }
protected virtual void Ignite() { Map map = Map; Destroy(); var radius = def.projectile.explosionRadius; var cellsToAffect = SimplePool <List <IntVec3> > .Get(); cellsToAffect.Clear(); cellsToAffect.AddRange(def.projectile.damageDef.Worker.ExplosionCellsToHit(Position, map, radius)); for (int i = 0; i < 4; i++) { PurpleIvyMoteMaker.ThrowToxicPostExplosionSmoke(Position.ToVector3Shifted() + Gen.RandomHorizontalVector(radius * 0.7f), map, radius * 0.6f); } //Fire explosion should be tiny. if (this.def.projectile.explosionEffect != null) { Effecter effecter = this.def.projectile.explosionEffect.Spawn(); effecter.Trigger(new TargetInfo(this.Position, map, false), new TargetInfo(this.Position, map, false)); effecter.Cleanup(); } PurpleIvyUtils.DoExplosion(this.Position, map, this.def.projectile.explosionRadius, this.def.projectile.damageDef, this.launcher, this.def.projectile.GetDamageAmount(1, null), this.def.projectile.GetArmorPenetration(1, null), this.def.projectile.soundExplode, this.equipmentDef, this.def, null, this.def.projectile.postExplosionSpawnThingDef, this.def.projectile.postExplosionSpawnChance, this.def.projectile.postExplosionSpawnThingCount, this.def.projectile.applyDamageToExplosionCellsNeighbors, this.def.projectile.preExplosionSpawnThingDef, this.def.projectile.preExplosionSpawnChance, this.def.projectile.preExplosionSpawnThingCount, this.def.projectile.explosionChanceToStartFire, this.def.projectile.explosionDamageFalloff); }
public override void Tick() { if (Find.TickManager.TicksGame % 60 == 0) { List <Thing> list = new List <Thing>(); try { if (GenGrid.InBounds(this.Position, this.Map)) { list = this.Map.thingGrid.ThingsListAt(this.Position); } } catch { return; } if (list == null || list.Count <= 0) { return; } for (int i = 0; i < list.Count; i++) { if (list[i] == null || list[i].Faction == PurpleIvyData.AlienFaction) { continue; } switch (list[i]) { //If we find a pawn and its not a hatchling case Pawn _: { try { //PurpleIvyMoteMaker.ThrowToxicSmoke(this.Position.ToVector3Shifted(), this.Map); Pawn pawn = (Pawn)list[i]; if (!pawn.RaceProps.IsMechanoid) { pawn.TakeDamage(new DamageInfo(PurpleIvyDefOf.PI_ToxicBurn, 1, 0, -1, this, pawn.health.hediffSet.GetNotMissingParts(0, 0, null, null) .Where(x => x.groups.Contains(BodyPartGroupDefOf.Legs)) .FirstOrDefault())); HealthUtility.AdjustSeverity(pawn, HediffDefOf.ToxicBuildup, 0.01f); HealthUtility.AdjustSeverity(pawn, PurpleIvyDefOf.PI_AlienBlood, 1f); } } catch { } break; } //If we find a plant case Plant _: { if (list[i].def != PurpleIvyDefOf.PurpleIvy && list[i].def != PurpleIvyDefOf.PI_Nest && list[i].def != PurpleIvyDefOf.PlantVenomousToothwort && list[i].def != PurpleIvyDefOf.PI_CorruptedTree) { PurpleIvyMoteMaker.ThrowToxicSmoke(this.Position.ToVector3Shifted(), this.Map); list[i].TakeDamage(new DamageInfo(PurpleIvyDefOf.PI_ToxicBurn, 1)); } break; } } } } }
public override void ExplosionAffectCell(Explosion explosion, IntVec3 c, List <Thing> damagedThings, List <Thing> ignoredThings, bool canThrowMotes) { if (this.def.explosionCellMote != null && canThrowMotes) { Mote mote = c.GetFirstThing(explosion.Map, this.def.explosionCellMote) as Mote; if (mote != null) { mote.spawnTick = Find.TickManager.TicksGame; } else { float t = Mathf.Clamp01((explosion.Position - c).LengthHorizontal / explosion.radius); Color color = Color.Lerp(this.def.explosionColorCenter, this.def.explosionColorEdge, t); PurpleIvyMoteMaker.ThrowExplosionCell(c, explosion.Map, this.def.explosionCellMote, color); } } DamageWorker_AddInjuryNoCamShaker.thingsToAffect.Clear(); float num = float.MinValue; bool flag = false; List <Thing> list = explosion.Map.thingGrid.ThingsListAt(c); for (int i = 0; i < list.Count; i++) { Thing thing = list[i]; if (thing.def.category != ThingCategory.Mote && thing.def.category != ThingCategory.Ethereal) { if (thing.Faction != PurpleIvyData.AlienFaction) { DamageWorker_AddInjuryNoCamShaker.thingsToAffect.Add(thing); if (thing.def.Fillage == FillCategory.Full && thing.def.Altitude > num) { flag = true; num = thing.def.Altitude; } } } } for (int j = 0; j < DamageWorker_AddInjuryNoCamShaker.thingsToAffect.Count; j++) { if (DamageWorker_AddInjuryNoCamShaker.thingsToAffect[j].def.Altitude >= num) { if (DamageWorker_AddInjuryNoCamShaker.thingsToAffect[j] is Pawn) { Pawn pawn = (Pawn)DamageWorker_AddInjuryNoCamShaker.thingsToAffect[j]; if (Rand.Chance(0.3f)) { pawn.stances.stunner.StunFor(Rand.RangeInclusive(100, 200), explosion.instigator); } } this.ExplosionDamageThing(explosion, DamageWorker_AddInjuryNoCamShaker.thingsToAffect[j], damagedThings, ignoredThings, c); } } if (!flag) { this.ExplosionDamageTerrain(explosion, c); } if (this.def.explosionSnowMeltAmount > 0.0001f) { float lengthHorizontal = (c - explosion.Position).LengthHorizontal; float num2 = 1f - lengthHorizontal / explosion.radius; if (num2 > 0f) { explosion.Map.snowGrid.AddDepth(c, -num2 * this.def.explosionSnowMeltAmount); } } if (this.def == DamageDefOf.Bomb || this.def == DamageDefOf.Flame) { List <Thing> list2 = explosion.Map.listerThings.ThingsOfDef(ThingDefOf.RectTrigger); for (int k = 0; k < list2.Count; k++) { RectTrigger rectTrigger = (RectTrigger)list2[k]; if (rectTrigger.activateOnExplosion && rectTrigger.Rect.Contains(c)) { rectTrigger.ActivatedBy(null); } } } }
public void DoDamageToThings() { List <Thing> list = new List <Thing>(); try { if (GenGrid.InBounds(this.Position, this.Map)) { list = this.Map.thingGrid.ThingsListAt(this.Position); } } catch { return; } if (list == null || list.Count <= 0) { return; } for (int i = 0; i < list.Count; i++) { if (list[i] == null || list[i].Faction == PurpleIvyData.AlienFaction) { continue; } if (list[i].def.IsCorpse) { this.DoDamageToCorpse((Corpse)list[i]); } else { switch (list[i]) { case Pawn _: { this.DoDamageToPawn((Pawn)list[i]); break; } case StickyGoo stickyGoo: { if (stickyGoo.HasAnyContents) { var thing = stickyGoo.ContainedThing; if (thing is Pawn pawn) { var damageInfo = new DamageInfo(DamageDefOf.Scratch, 1, 0f, -1f, this, null, null); pawn.TakeDamage(damageInfo); this.Growth += 0.001f; if (pawn.TryGetComp <AlienInfection>() == null) { var hediff = (AlienInfectionHediff)HediffMaker.MakeHediff (PurpleIvyDefOf.PI_AlienInfection, pawn); hediff.instigator = PawnKindDef.Named("Genny_ParasiteOmega"); pawn.health.AddHediff(hediff); } if (Rand.Chance(0.1f) && pawn.health.hediffSet.GetFirstHediffOfDef(PurpleIvyDefOf.PI_AlienMutation) == null) { var hediff3 = HediffMaker.MakeHediff(PurpleIvyDefOf.PI_AlienMutation, pawn, null); pawn.health.AddHediff(hediff3, null, null, null); } } else if (thing is Corpse corpse) { this.DoDamageToCorpse(corpse); stickyGoo.EjectContents(); } } break; } case Plant _: { if (list[i].def != PurpleIvyDefOf.PurpleIvy && list[i].def != PurpleIvyDefOf.PI_Nest && list[i].def != PurpleIvyDefOf.PlantVenomousToothwort && list[i].def != PurpleIvyDefOf.PI_CorruptedTree) { PurpleIvyMoteMaker.ThrowToxicSmoke(this.Position.ToVector3Shifted(), this.Map); //FilthMaker.TryMakeFilth(this.Position, this.Map, PurpleIvyDefOf.PI_ToxicFilth); list[i].TakeDamage(new DamageInfo(PurpleIvyDefOf.PI_ToxicBurn, 1)); } break; } } } } }