def description(self, fraction = None): people = _(u'The {culture} people').format(culture=self.adjective) if fraction is not None: people += _(u' constitute {proportion}% of the population and').format( proportion = int(100 * fraction)) land = _(u'land') size = self.region[1].sizedescription() if size: land = u' '.join([size, land]) land = _(u'{People} originated in the {land} known to them as {name}.').format( People=people, land=land, name=self.region[0]) land = land + self.region[1].resourcedescription(self.region[0]) desc = [] for c in self.characteristics: noun = c.indefinite() if noun: desc.append(noun) physical = _(u'Physically, the {members} have {characteristics}.').format( members = self.plural, characteristics = conjunction(desc)) return u'\n\n'.join([land, physical])
def resourcedescription(self, name): land = u'' for kind, label in [(FoodSource, _(u'food sources')), (FreshWater, _(u'fresh water')), (TradeGood, _(u'trade goods'))]: sources = [r for r in self.resources if isinstance(r, kind)] if not sources: land = u' '.join([land, _(u'{place} has little in the way of {resource}.').format( place=name, resource=label)]) continue summary = conjunction([s.description() for s in sources]) amount = sum([s.amount for s in sources]) if amount < 0.75: summary = _(u'With but {sources}, {place} has only limited {resource}.').format( sources=summary, place=name, resource=label) elif amount > 2.25: summary = _(u'With {sources}, {place} is blessed with an abundance of {resource}.').format( sources=summary, place=name, resource=label) else: summary = _(u'{place} has {sources}.').format( sources=summary, place=name) land = u' '.join([land, summary]) return land
def description(self): name = _(u'The culture of {name}.').format(name=self.noun) if len(self.ethnicities) == 1: ethnicity = '\n\n'.join( [_(u'The {people} are ethnically homogeneous.').format( people=self.plural), self.ethnicities[0][1].description()]) else: ethnicity = '\n\n'.join( [_(u'The {cultural} population is made up of people of the {ethnic} ethnicities.').format( cultural=self.adjective, ethnic=conjunction([e[1].adjective for e in self.ethnicities]))] + [e[1].description(e[0]) for e in self.ethnicities]) return '\n\n'.join([name, ethnicity])