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); }
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); } }
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); }
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); }
public int GetUpkeepCost() { return(PlanetStructures.Sum(y => (int?)y.StructureType.UpkeepEnergy) ?? 0); }
public double GetEffectiveIpDefense() { return(PlanetStructures.Where(x => x.IsActive).Sum(x => x.StructureType.EffectReduceBattleInfluenceGain) ?? 0); }