public override void Damage(float damage, float pushTime, Vector2 pushSpeed, BasicShipGameObject Damager, AttackType attackType)
        {
            float PreviousShieldDamage = Math.Min(ShieldDamage, ShieldToughness);
            float PreviousHullDamage   = Math.Min(HullDamage, HullToughness);

            base.Damage(damage, pushTime, pushSpeed, Damager, attackType);

            float DamageAmount = (Math.Min(ShieldDamage, ShieldToughness) - PreviousShieldDamage) + (Math.Min(HullDamage, HullToughness) - PreviousHullDamage);

            if (DamageAmount > 0)
            {
                if (DamageAmount > 0.25f)
                {
                    TextParticleSystem.AddParticle(new Vector3(Position.X(), Y, Position.Y()), ((int)(DamageAmount * 4)).ToString(), (byte)Damager.GetTeam());
                }

                if (Damager.GetType().IsSubclassOf(typeof(UnitShip)))
                {
                    UnitShip s = (UnitShip)Damager;
                    //if (s.IsGhostMode)
                    //  return;
                }

                if (Damager.GetTeam() == NeutralManager.NeutralTeam)
                {
                    FactionManager.AddDamage(DamageAmount * 4);
                }
                else
                {
                    FactionManager.AddDamage(Damager.GetTeam(), DamageAmount * 4);
                }
            }
        }
        public void MakeMoney()
        {
            if (WaveManager.ActiveTeam == GetTeam())
            {
                UpdateMapPosition();

                int ProdBase = MyRock.ProductionAmount.get();
                if (IsUpdgraded)
                {
                    ProdBase += 100;
                }
                if (WaveManager.CurrentWave > 15)
                {
                    ProdBase *= 2;
                }

                if (BonusProduction)
                {
                    ProdBase *= WaveManager.GameSpeed;
                }
                else
                {
                    BonusProduction = true;
                }

                int Production = ProdBase;


                if (Production > 0)
                {
                    FactionManager.AddCells(FactionNumber, Production);
                    TextParticleSystem.AddParticle(new Vector3(Position.X(), Y, Position.Y()), Production.ToString(), (byte)GetTeam(), TextParticleSystemIcons.CellsTexture);
                }
            }
        }
Ejemplo n.º 3
0
 public void MakeMoney()
 {
     if (WaveManager.ActiveTeam == GetTeam())
     {
         FactionManager.AddEnergy(FactionNumber, Production);
         FactionManager.AddCells(FactionNumber, Production);
         TextParticleSystem.AddParticle(new Vector3(Position.X(), Y, Position.Y()), Production.ToString(), (byte)GetTeam(), TextParticleSystemIcons.CellsTexture);
     }
 }
        public override void Damage(float damage, float pushTime, Vector2 pushSpeed, BasicShipGameObject Damager, AttackType attackType)
        {
            if ((InvTime < 1 && (FieldStateTime < 1 || fieldState != FieldState.Cloaked)) || attackType == AttackType.Explosion || attackType == AttackType.Melee)
            {
                if (CanCloak)
                {
                    SoundManager.Play3DSound("UnitCloak", new Vector3(Position.X(), Y, Position.Y()), 0.25f, 800, 2);

                    fieldState     = FieldState.Cloaked;
                    HasCloaked     = true;
                    CanCloak       = false;
                    FieldStateTime = GetCloakTime();
                }
                else
                {
                    if (attackType != AttackType.White)
                    {
                        SummonUnits();
                    }

                    NoShootTime = MaxNoShootTime;
                    if (attackType == AttackType.White)
                    {
                        ThreatLevel *= 1.5f;
                    }

                    if (!PathFindingManager.CollisionLine(Position.get(), Damager.Position.get()))
                    {
                        AngerTime           = MaxAngerTime;
                        CurrentAttackTarget = Damager;
                    }

                    base.Damage(damage, pushTime, pushSpeed, Damager, attackType);

                    if (HullDamage >= HullToughness && Damager.FactionNumber != NeutralManager.NeutralFaction && ScoreToGive > 0)
                    {
                        if (CanDeathSound)
                        {
                            SoundManager.Play3DSound(DeathSound, new Vector3(Position.X(), Y, Position.Y()), DeathVolume * 0.5f, DeathDistance, DeathExponenent * 2);
                        }

                        ScoreToGive = (int)(ScoreToGive * (0.75f + 0.25f * UnitLevel) * (IsHuge ? 1.25f : 1) *
                                            (HasCloaked || CanCloak ? 1.5f : 1) * (CanSummon || HasSummoned ? 4 : 1));
                        TextParticleSystem.AddParticle(new Vector3(Position.X(), Y, Position.Y()), ScoreToGive.ToString(), (byte)Damager.GetTeam());
                        FactionManager.AddScore(Damager.FactionNumber, ScoreToGive);
                        FactionManager.Factions[Damager.FactionNumber].roundReport.UnitKills++;
                        ScoreToGive = 0;
                    }
                }
            }
        }