Esempio n. 1
0
        public double GetEffectiveShipIpBonus(Faction attacker)
        {
            double planetDropshipDefs = (PlanetStructures.Where(x => x.IsActive).Sum(x => x.StructureType.EffectDropshipDefense) ?? 0);
            int    dropshipsSent      = (PlanetFactions.Where(x => x.Faction == attacker).Sum(x => (int?)x.Dropships) ?? 0);

            return(Math.Max(0, (dropshipsSent - planetDropshipDefs)) * GlobalConst.InfluencePerShip);
        }
Esempio n. 2
0
 public bool CanMatchMakerPlay(Faction attacker)
 {
     if (CanDropshipsAttack(attacker) ||
         PlanetFactions.Where(x => x.FactionID == attacker.FactionID).Sum(y => y.Dropships) >
         PlanetStructures.Where(x => x.IsActive).Sum(y => y.StructureType.EffectDropshipDefense))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Esempio n. 3
0
 public bool CheckWarpAttack(Faction attacker, Func <TreatyEffectType, bool> preventingTreaty)
 {
     if (!Galaxy.IsDefault)
     {
         return(false);                      // no exo-galaxy strikes
     }
     if (OwnerFactionID == attacker.FactionID || attacker.GaveTreatyRight(this, preventingTreaty))
     {
         return(false);                                                                                          // attacker allied cannot strike
     }
     if (PlanetStructures.Any(x => x.IsActive && x.StructureType.EffectBlocksJumpgate == true))
     {
         return(false);                                                                                       // inhibitor active
     }
     return(true);
 }
Esempio n. 4
0
 public bool CanFirePlanetBuster(Faction attacker)
 {
     if (!Galaxy.IsDefault)
     {
         return(false);                      // no exo-galaxy strikes
     }
     if (OwnerFactionID == attacker.FactionID || attacker.GaveTreatyRight(this, x => x.EffectPreventBomberAttack == true))
     {
         return(false);                                                                                                                  // attacker allied cannot strike
     }
     if (PlanetStructures.Any(x => x.StructureType.EffectIsVictoryPlanet == true || x.StructureType.OwnerChangeWinsGame))
     {
         return(false);                                                                                                                 // artefact protects planet
     }
     return(true);
 }
Esempio n. 5
0
 public int GetUpkeepCost()
 {
     return(PlanetStructures.Sum(y => (int?)y.StructureType.UpkeepEnergy) ?? 0);
 }
Esempio n. 6
0
 public double GetEffectiveIpDefense()
 {
     return(PlanetStructures.Where(x => x.IsActive).Sum(x => x.StructureType.EffectReduceBattleInfluenceGain) ?? 0);
 }