public float GetPointsNeededForTypeForCiv(GreatPersonType type, ICivilization civ)
        {
            int   predecessorsOfGroup = 0;
            float startingCost        = 0f;

            if (UnitConfig.GreatPeopleCivilianTypes.Contains(type))
            {
                predecessorsOfGroup = UnitConfig.GreatPeopleCivilianTypes.Sum(
                    relatedType => GetPredecessorsOfTypeForCiv(relatedType, civ)
                    );

                startingCost = CivConfig.CivilianGreatPersonStartingCost;
            }
            else if (UnitConfig.GreatPeopleMilitaryTypes.Contains(type))
            {
                predecessorsOfGroup = UnitConfig.GreatPeopleMilitaryTypes.Sum(
                    relatedType => GetPredecessorsOfTypeForCiv(relatedType, civ)
                    );

                startingCost = CivConfig.MilitaryGreatPersonStartingCost;
            }
            else
            {
                predecessorsOfGroup = GetPredecessorsOfTypeForCiv(type, civ);

                startingCost = CivConfig.CivilianGreatPersonStartingCost;
            }

            return(startingCost * Mathf.Pow(CivConfig.GreatPersonPredecessorCostMultiplier, predecessorsOfGroup));
        }
Ejemplo n.º 2
0
        private void GreatPersonRequested(GreatPersonType type)
        {
            if (FreeGreatPeopleCanon.GetFreeGreatPeopleForCiv(ObjectToDisplay) > 0)
            {
                GreatPersonFactory.BuildGreatPerson(type, ObjectToDisplay);

                FreeGreatPeopleCanon.RemoveFreeGreatPersonFromCiv(ObjectToDisplay);

                Refresh();
            }
        }
Ejemplo n.º 3
0
        public IUnitTemplate GetTemplateForGreatPersonType(GreatPersonType type)
        {
            switch (type)
            {
            case GreatPersonType.GreatAdmiral:   return(GreatAdmiralTemplate);

            case GreatPersonType.GreatArtist:    return(GreatAristTemplate);

            case GreatPersonType.GreatEngineer:  return(GreatEngineerTemplate);

            case GreatPersonType.GreatGeneral:   return(GreatGeneralTemplate);

            case GreatPersonType.GreatMerchant:  return(GreatMerchantTemplate);

            case GreatPersonType.GreatScientist: return(GreatScientistTemplate);

            default: throw new NotImplementedException("No template for great person type " + type);
            }
        }
Ejemplo n.º 4
0
        public IUnit BuildGreatPerson(GreatPersonType type, ICivilization owner)
        {
            if (!CanBuildGreatPerson(type, owner))
            {
                throw new InvalidOperationException("CanBuildGreatPerson must return true on the arguments");
            }

            var civCapital      = CapitalCityCanon.GetCapitalOfCiv(owner);
            var capitalLocation = CityLocationCanon.GetOwnerOfPossession(civCapital);

            var personTemplate = UnitConfig.GetTemplateForGreatPersonType(type);

            var location = GetValidNearbyCell(capitalLocation, personTemplate, owner);

            var newPerson = UnitFactory.BuildUnit(location, personTemplate, owner);

            CivSignals.GreatPersonBorn.OnNext(new GreatPersonBirthData()
            {
                Owner = owner, GreatPerson = newPerson, Type = type
            });

            return(newPerson);
        }
        public void SetPointsTowardsTypeForCiv(GreatPersonType type, ICivilization civ, float newPoints)
        {
            var pointList = GetListForCiv(civ, PointsOfCiv);

            pointList[(int)type] = newPoints;
        }
        public void AddPointsTowardsTypeForCiv(GreatPersonType type, ICivilization civ, float pointsAdded)
        {
            var pointList = GetListForCiv(civ, PointsOfCiv);

            pointList[(int)type] += pointsAdded;
        }
        public float GetPointsTowardsTypeForCiv(GreatPersonType type, ICivilization civ)
        {
            var pointList = GetListForCiv(civ, PointsOfCiv);

            return(pointList[(int)type]);
        }
        public int GetPredecessorsOfTypeForCiv(GreatPersonType type, ICivilization civ)
        {
            var predecessorList = GetListForCiv(civ, PredecessorsOfCiv);

            return(predecessorList[(int)type]);
        }
Ejemplo n.º 9
0
 public bool CanBuildGreatPerson(GreatPersonType type, ICivilization owner)
 {
     return(CapitalCityCanon.GetCapitalOfCiv(owner) != null);
 }