Ejemplo n.º 1
0
        public void Demolish(Actor saboteur, bool continueNorth, bool continueSouth)
        {
            var initialDamage = Health.DamageState;

            self.World.AddFrameEndTask(w =>
            {
                Combat.DoExplosion(saboteur, "Demolish", self.CenterPosition);
                self.World.WorldActor.Trait <ScreenShaker>().AddEffect(15, self.CenterPosition, 6);
                self.Kill(saboteur);
            });

            // Destroy adjacent spans (long bridges)
            if (continueNorth && northNeighbour != null)
            {
                var delay = initialDamage == DamageState.Dead || NeighbourIsDeadShore(northNeighbour) ?
                            0 : Info.RepairPropagationDelay;

                self.World.AddFrameEndTask(w => w.Add(new DelayedAction(delay, () =>
                                                                        northNeighbour.Demolish(saboteur, true, false))));
            }

            if (continueSouth && southNeighbour != null)
            {
                var delay = initialDamage == DamageState.Dead || NeighbourIsDeadShore(southNeighbour) ?
                            0 : Info.RepairPropagationDelay;

                self.World.AddFrameEndTask(w => w.Add(new DelayedAction(delay, () =>
                                                                        southNeighbour.Demolish(saboteur, false, true))));
            }
        }
Ejemplo n.º 2
0
 void Detonate()
 {
     self.World.AddFrameEndTask(w =>
     {
         if (info.DetonationWeapon != null)
         {
             Combat.DoExplosion(self, info.DetonationWeapon, self.CenterPosition);
         }
         self.Kill(self);
     });
 }
Ejemplo n.º 3
0
        public void Killed(Actor self, AttackInfo e)
        {
            if (self.World.SharedRandom.Next(100) > self.Info.Traits.Get <ExplodesInfo>().Chance)
            {
                return;
            }

            var weapon = ChooseWeaponForExplosion(self);

            if (weapon != null)
            {
                var move     = self.TraitOrDefault <IMove>();
                var altitude = move != null ? move.Altitude : 0;
                Combat.DoExplosion(e.Attacker, weapon, self.CenterLocation, altitude);
            }
        }
Ejemplo n.º 4
0
        public void OnCrush(Actor crusher)
        {
            if (crusher.HasTrait <MineImmune>() || self.Owner.Stances[crusher.Owner] == Stance.Ally)
            {
                return;
            }

            var mobile = crusher.TraitOrDefault <Mobile>();

            if (mobile != null && !info.DetonateClasses.Intersect(mobile.Info.Crushes).Any())
            {
                return;
            }

            Combat.DoExplosion(self, info.Weapon, crusher.CenterLocation, 0);
            self.QueueActivity(new RemoveSelf());
        }
Ejemplo n.º 5
0
        public void Tick(Actor self)
        {
            if (!deployed)
            {
                return;
            }

            if (++tick >= info.ThumpInterval)
            {
                if (info.ThumpDamageWeapon != null)
                {
                    Combat.DoExplosion(self, info.ThumpDamageWeapon, self.CenterPosition);
                }
                screenShaker.AddEffect(info.ThumpShakeTime, self.CenterPosition, info.ThumpShakeIntensity, info.ThumpShakeMultiplier);
                tick = 0;
            }
        }
Ejemplo n.º 6
0
        public void Killed(Actor self, AttackInfo e)
        {
            if (self.World.SharedRandom.Next(100) > Info.Chance)
            {
                return;
            }

            if (Info.InfDeath != null && e.Warhead != null && !Info.InfDeath.Contains(e.Warhead.InfDeath))
            {
                return;
            }

            var weapon = ChooseWeaponForExplosion(self);

            if (weapon != null)
            {
                Combat.DoExplosion(e.Attacker, weapon, self.CenterPosition);
            }
        }
Ejemplo n.º 7
0
        public void Detonate(Actor self, Actor detonatedBy)
        {
            var move     = self.TraitOrDefault <IMove>();
            var info     = self.Info.Traits.Get <AttackBaseInfo>();
            var altitude = move != null ? move.Altitude : 0;

            self.World.AddFrameEndTask(w =>
            {
                if (self.Destroyed)
                {
                    return;
                }
                Combat.DoExplosion(self, info.PrimaryWeapon, self.CenterLocation, altitude);

                // Remove from world
                self.Kill(self);
                detonatedBy.Owner.Kills++;
                self.Owner.Deaths++;
                self.Destroy();
            });
        }
Ejemplo n.º 8
0
        public void Killed(Actor self, AttackInfo e)
        {
            if (self.World.SharedRandom.Next(100) > Info.Chance)
            {
                return;
            }

            if (Info.InfDeath != null && e.Warhead != null && !Info.InfDeath.Contains(e.Warhead.InfDeath))
            {
                return;
            }

            var weapon = ChooseWeaponForExplosion(self);

            if (weapon != null)
            {
                var move     = self.TraitOrDefault <IMove>();
                var altitude = move != null ? move.Altitude : 0;
                Combat.DoExplosion(e.Attacker, weapon, self.CenterLocation, altitude);
            }
        }
Ejemplo n.º 9
0
 public override void Activate(Actor collector)
 {
     Combat.DoExplosion(self, ((ExplodeCrateActionInfo)info).Weapon, collector.CenterPosition);
     base.Activate(collector);
 }
Ejemplo n.º 10
0
 public override void Activate(Actor collector)
 {
     Combat.DoExplosion(self, (info as ExplodeCrateActionInfo).Weapon, collector.CenterLocation, 0);
     base.Activate(collector);
 }