Пример #1
0
        protected override bool TryCastShot()
        {
            Building_Megumin meg = this.caster as Building_Megumin;

            if (meg == null)
            {
                Log.Error("Verb_Megumin used by a caster that is not a Building_Megumin?");
            }

            Map map = meg.TargetMap;

            if (map == null)
            {
                Log.Error("Null map to cast megumin verb. Yikes.");
                return(false);
            }

            var targetCell = this.currentTarget.Cell;

            Log.Message($"MegVerb: Firing on map: {map}, target: {targetCell}");

            CustomOrbitalStrike beam = (CustomOrbitalStrike)GenSpawn.Spawn(AADefOf.CustomOrbitalStrike_AA, targetCell, map, WipeMode.Vanish);

            beam.duration                = Building_Megumin.DURATION_TICKS;
            beam.instigator              = this.caster;
            beam.weaponDef               = ((base.EquipmentSource != null) ? base.EquipmentSource.def : null);
            beam.DamageDefs              = new DamageDef[] { AADefOf.SkyBeamBlast_AA, AADefOf.EnergyBurn_AA };
            beam.UpdatesPerTick          = 20;
            beam.ArmorPen                = 1.3f;                 // To make it viable against mechanoids and heavy raiders.
            beam.DamageAmountRange       = new IntRange(35, 45); // Applied up to 18 times per tick, that's a lot of damage.
            beam.CorpseDamageAmountRange = new IntRange(3, 6);   // Does less damage to corpses, so that there is something left over after the devastation, although this may be OP (killing entire army and keeping their gear).
            beam.StartStrike();

            // Spawn huge explosion once the beam fires.
            GenExplosion.DoExplosion(currentTarget.Cell, caster.Map, Building_Megumin.EXPLOSION_RADIUS, AADefOf.EnergyBurn_AA, caster, Building_Megumin.EXPLOSION_DAMAGE, Building_Megumin.EXPLOSION_PEN, AADefOf.Explosion_Antimatter_Large_AA);

            if (caster != null)
            {
                beam.OnStrikeOver += ((Building_Megumin)caster).OnStrikeEnd;
            }

            return(true);
        }
 internal void OnStrikeEnd(CustomOrbitalStrike _)
 {
     StopFireLaser();
 }