Example #1
0
    def linguistics_restrictions(self):
        from the_tale.linguistics.relations import TEMPLATE_RESTRICTION_GROUP
        from the_tale.linguistics.storage import restrictions_storage

        return (restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.GENDER, self.gender.value).id,
                restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.RACE, self.race.value).id,
                restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.PERSON_TYPE, self.type.value).id)
Example #2
0
def get_word_restrictions(external, word_form):
    if utg_relations.NUMBER in word_form.word.type.properties:
        if word_form.word.properties.is_specified(utg_relations.NUMBER):
            if word_form.word.properties.get(utg_relations.NUMBER).is_SINGULAR:
                return ((external, restrictions_storage.get_restriction(relations.TEMPLATE_RESTRICTION_GROUP.PLURAL_FORM, relations.WORD_HAS_PLURAL_FORM.HAS_NO.value).id), )

    return ((external, restrictions_storage.get_restriction(relations.TEMPLATE_RESTRICTION_GROUP.PLURAL_FORM, relations.WORD_HAS_PLURAL_FORM.HAS.value).id), )
Example #3
0
    def linguistics_restrictions(self):
        from the_tale.linguistics.relations import TEMPLATE_RESTRICTION_GROUP
        from the_tale.linguistics.storage import restrictions_storage

        return (restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.GENDER, self.gender.value).id,
                restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.RACE, self.race.value).id,
                restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.PERSON_TYPE, self.type.value).id)
Example #4
0
def get_word_restrictions(external, word_form):
    if utg_relations.NUMBER in word_form.word.type.properties:
        if word_form.word.properties.is_specified(utg_relations.NUMBER):
            if word_form.word.properties.get(utg_relations.NUMBER).is_SINGULAR:
                return ((external, restrictions_storage.get_restriction(relations.TEMPLATE_RESTRICTION_GROUP.PLURAL_FORM, relations.WORD_HAS_PLURAL_FORM.HAS_NO.value).id), )

    return ((external, restrictions_storage.get_restriction(relations.TEMPLATE_RESTRICTION_GROUP.PLURAL_FORM, relations.WORD_HAS_PLURAL_FORM.HAS.value).id), )
Example #5
0
 def linguistics_restrictions(self):
     from the_tale.linguistics.relations import TEMPLATE_RESTRICTION_GROUP
     from the_tale.linguistics.storage import restrictions_storage
     return (restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.ARTIFACT_TYPE, self.type.value).id,
             restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.ARTIFACT_POWER_TYPE, self.record.power_type.value).id,
             restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.ARTIFACT_RARITY, self.rarity.value).id,
             restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.ARTIFACT_EFFECT, self._effect().TYPE.value).id,
             restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.ARTIFACT, self.record.id).id)
Example #6
0
    def linguistics_restrictions(self):
        from the_tale.linguistics.relations import TEMPLATE_RESTRICTION_GROUP
        from the_tale.linguistics.storage import restrictions_storage

        return (restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.COMPANION, self.record.id).id,
                restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.COMPANION_TYPE, self.record.type.value).id,
                restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.COMPANION_DEDICATION, self.record.dedication.value).id,
                restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.COMPANION_RARITY, self.record.rarity.value).id,
                restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.ARCHETYPE, self.record.archetype.value).id)
Example #7
0
 def linguistics_restrictions(self):
     from the_tale.linguistics.relations import TEMPLATE_RESTRICTION_GROUP
     from the_tale.linguistics.storage import restrictions_storage
     return (restrictions_storage.get_restriction(
         TEMPLATE_RESTRICTION_GROUP.MOB_TYPE, self.record.type.value).id,
             restrictions_storage.get_restriction(
                 TEMPLATE_RESTRICTION_GROUP.MOB, self.record.id).id,
             restrictions_storage.get_restriction(
                 TEMPLATE_RESTRICTION_GROUP.ARCHETYPE,
                 self.record.archetype.value).id)
Example #8
0
    def linguistics_restrictions(self):
        from the_tale.linguistics.relations import TEMPLATE_RESTRICTION_GROUP
        from the_tale.linguistics.storage import restrictions_storage

        restrictions = [restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.RACE, self.race.value).id,
                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.HABIT_HONOR, self.habit_honor.interval.value).id,
                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.HABIT_PEACEFULNESS, self.habit_honor.interval.value).id,
                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.TERRAIN, self.terrain.value).id]

        restrictions.extend(self._modifier.linguistics_restrictions())

        return tuple(restrictions)
Example #9
0
    def linguistics_restrictions(self):
        from the_tale.game.companions import relations as companion_relations

        constants = self.linguistics_restrictions_constants()

        terrains = map_logic.get_terrain_linguistics_restrictions(self.position.get_terrain())

        return (constants +
                terrains +
                (restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.ACTION_TYPE, self.actions.current_action.ui_type.value).id,
                 restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.COMPANION_EXISTENCE,
                                                      companion_relations.COMPANION_EXISTENCE.HAS.value if self.companion else companion_relations.COMPANION_EXISTENCE.HAS_NO.value).id))
Example #10
0
def get_terrain_linguistics_restrictions(terrain):

    if _TERRAIN_LINGUISTICS_CACHE:
        return _TERRAIN_LINGUISTICS_CACHE[terrain]

    for terrain_record in TERRAIN.records:
        _TERRAIN_LINGUISTICS_CACHE[terrain_record] = ( restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.TERRAIN, terrain_record.value).id,
                                                       restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.META_TERRAIN, terrain_record.meta_terrain.value).id,
                                                       restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.META_HEIGHT, terrain_record.meta_height.value).id,
                                                       restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.META_VEGETATION, terrain_record.meta_vegetation.value).id )

    return _TERRAIN_LINGUISTICS_CACHE[terrain]
Example #11
0
    def linguistics_restrictions(self):
        from the_tale.linguistics.relations import TEMPLATE_RESTRICTION_GROUP
        from the_tale.linguistics.storage import restrictions_storage

        restrictions = [
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.ARTIFACT_TYPE, self.type.value).id,
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.ARTIFACT_POWER_TYPE,
                self.record.power_type.value).id,
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.ARTIFACT_RARITY,
                self.rarity.value).id,
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.ARTIFACT_EFFECT,
                self._effect().TYPE.value).id,
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.ARTIFACT, self.record.id).id,
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.WEAPON_TYPE,
                self.record.weapon_type.value).id,
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.MATERIAL,
                self.record.material.value).id
        ]

        for damage_type in self.record.weapon_type.damage_types:
            restrictions.append(
                restrictions_storage.get_restriction(
                    TEMPLATE_RESTRICTION_GROUP.DAMAGE_TYPE,
                    damage_type.value).id)

        return restrictions
Example #12
0
 def linguistics_restrictions(self):
     from the_tale.linguistics.relations import TEMPLATE_RESTRICTION_GROUP
     from the_tale.linguistics.storage import restrictions_storage
     return (restrictions_storage.get_restriction(
         TEMPLATE_RESTRICTION_GROUP.ARTIFACT_TYPE, self.type.value).id,
             restrictions_storage.get_restriction(
                 TEMPLATE_RESTRICTION_GROUP.ARTIFACT_POWER_TYPE,
                 self.record.power_type.value).id,
             restrictions_storage.get_restriction(
                 TEMPLATE_RESTRICTION_GROUP.ARTIFACT_RARITY,
                 self.rarity.value).id,
             restrictions_storage.get_restriction(
                 TEMPLATE_RESTRICTION_GROUP.ARTIFACT_EFFECT,
                 self._effect().TYPE.value).id,
             restrictions_storage.get_restriction(
                 TEMPLATE_RESTRICTION_GROUP.ARTIFACT, self.record.id).id)
Example #13
0
 def _linguistics_restrictions():
     from the_tale.linguistics.relations import TEMPLATE_RESTRICTION_GROUP
     from the_tale.linguistics.storage import restrictions_storage
     return [
         restrictions_storage.get_restriction(
             TEMPLATE_RESTRICTION_GROUP.RACE, RACE.index_name[race].value)
     ]
Example #14
0
 def _linguistics_restrictions():
     from the_tale.linguistics.relations import TEMPLATE_RESTRICTION_GROUP
     from the_tale.linguistics.storage import restrictions_storage
     return [
         restrictions_storage.get_restriction(
             TEMPLATE_RESTRICTION_GROUP.RACE,
             getattr(RACE, race).value)
     ]
Example #15
0
    def linguistics_restrictions(self):
        from the_tale.linguistics.relations import TEMPLATE_RESTRICTION_GROUP
        from the_tale.linguistics.storage import restrictions_storage

        return [
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.TERRAIN, self.terrain.value)
        ]
Example #16
0
    def __init__(self, weapon, material, power_type):
        from the_tale.linguistics.relations import TEMPLATE_RESTRICTION_GROUP
        from the_tale.linguistics.storage import restrictions_storage

        self.type = weapon
        self.material = material
        self.power_type = power_type

        restrictions = [
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.ARTIFACT_TYPE,
                relations.ARTIFACT_TYPE.MAIN_HAND.value).id,
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.ARTIFACT_POWER_TYPE,
                self.power_type.value).id,
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.ARTIFACT_RARITY,
                relations.RARITY.NORMAL.value).id,
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.ARTIFACT_EFFECT,
                relations.ARTIFACT_EFFECT.NO_EFFECT.value).id,
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.WEAPON_TYPE,
                self.type.weapon_type.value).id,
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.MATERIAL, self.material.value).id
        ]

        for damage_type in self.type.weapon_type.damage_types:
            restrictions.append(
                restrictions_storage.get_restriction(
                    TEMPLATE_RESTRICTION_GROUP.DAMAGE_TYPE,
                    damage_type.value).id)

        self._restrictions = restrictions
Example #17
0
    def _linguistics_restrictions():
        from the_tale.linguistics.relations import TEMPLATE_RESTRICTION_GROUP
        from the_tale.linguistics.storage import restrictions_storage

        return (
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.CITY_MODIFIER, CITY_MODIFIERS.index_name[modifier].value
            ).id,
        )
Example #18
0
    def linguistics_restrictions(self):
        from the_tale.linguistics.relations import TEMPLATE_RESTRICTION_GROUP
        from the_tale.linguistics.storage import restrictions_storage

        return (restrictions_storage.get_restriction(
            TEMPLATE_RESTRICTION_GROUP.COMPANION, self.record.id).id,
                restrictions_storage.get_restriction(
                    TEMPLATE_RESTRICTION_GROUP.COMPANION_TYPE,
                    self.record.type.value).id,
                restrictions_storage.get_restriction(
                    TEMPLATE_RESTRICTION_GROUP.COMPANION_DEDICATION,
                    self.record.dedication.value).id,
                restrictions_storage.get_restriction(
                    TEMPLATE_RESTRICTION_GROUP.COMPANION_RARITY,
                    self.record.rarity.value).id,
                restrictions_storage.get_restriction(
                    TEMPLATE_RESTRICTION_GROUP.ARCHETYPE,
                    self.record.archetype.value).id)
Example #19
0
    def linguistics_restrictions(self):
        constants = self.linguistics_restrictions_constants()

        terrains = map_logic.get_terrain_linguistics_restrictions(
            self.position.get_terrain())

        return constants + terrains + (restrictions_storage.get_restriction(
            TEMPLATE_RESTRICTION_GROUP.ACTION_TYPE,
            self.actions.current_action.ui_type.value).id, )
Example #20
0
    def linguistics_restrictions_constants(self):
        from the_tale.linguistics.relations import TEMPLATE_RESTRICTION_GROUP
        from the_tale.linguistics.storage import restrictions_storage
        from the_tale.game.map import logic as map_logic

        terrains = map_logic.get_terrain_linguistics_restrictions(self.terrain)

        return (restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.MOB_TYPE, self.record.type.value).id,
                restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.MOB, self.record.id).id,
                restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.ARCHETYPE, self.record.archetype.value).id,
                restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.COMMUNICATION_VERBAL, self.record.communication_verbal.value).id,
                restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.COMMUNICATION_GESTURES, self.record.communication_gestures.value).id,
                restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.COMMUNICATION_TELEPATHIC, self.record.communication_telepathic.value).id,
                restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.INTELLECT_LEVEL, self.record.intellect_level.value).id,
                restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.ACTOR, game_relations.ACTOR.MOB.value).id,
                restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.ACTION_TYPE, self.action_type.value).id) + terrains
Example #21
0
def sync_restriction(group, external_id, name):
    restriction = restrictions_storage.get_restriction(group, external_id)

    if restriction is None:
        return create_restriction(group, external_id, name)

    restriction.name = name
    models.Restriction.objects.filter(id=restriction.id).update(name=name)
    restrictions_storage.update_version()

    return restriction
Example #22
0
def sync_restriction(group, external_id, name):
    restriction = restrictions_storage.get_restriction(group, external_id)

    if restriction is None:
        return create_restriction(group, external_id, name)

    restriction.name = name
    models.Restriction.objects.filter(id=restriction.id).update(name=name)
    restrictions_storage.update_version()

    return restriction
Example #23
0
    def linguistics_restrictions(self):
        from the_tale.linguistics.relations import TEMPLATE_RESTRICTION_GROUP
        from the_tale.linguistics.storage import restrictions_storage

        return (restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.GENDER, self.gender.value).id,
                restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.RACE, self.race.value).id,
                restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.HABIT_HONOR, self.habit_honor.interval.value).id,
                restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.HABIT_PEACEFULNESS, self.habit_honor.interval.value).id,
                restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.ARCHETYPE, self.preferences.archetype.value).id,
                restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.TERRAIN, self.position.get_terrain().value).id,
                restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.ACTION_TYPE, self.actions.current_action.ui_type.value).id)
Example #24
0
def _construct_coins(value):
    from the_tale.game import relations as game_relations
    from the_tale.linguistics.storage import restrictions_storage

    value = int(value)

    utg_name = utg_constructors.construct_integer(value)

    # check from greater amount to zero
    for record in reversed(game_relations.COINS_AMOUNT.records):
        if record.minumum <= value:
            sum_restriction = restrictions_storage.get_restriction(
                relations.TEMPLATE_RESTRICTION_GROUP.COINS_AMOUNT,
                record.value).id
            return (utg_name, [sum_restriction])
Example #25
0
def generate_history(name_forms, gender, race, honor, peacefulness, archetype, upbringing, first_death, age):
    from the_tale.linguistics import logic as linguistics_logic
    from the_tale.linguistics.lexicon.dictionary import noun
    from the_tale.linguistics.relations import TEMPLATE_RESTRICTION_GROUP
    from the_tale.linguistics.storage import restrictions_storage
    from the_tale.linguistics import objects as linguistics_objects

    name = noun(name_forms+['']*6, 'мр,од,ед' if gender.is_MALE else 'жр,од,ед')

    restrictions = (restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.GENDER, gender.value).id,
                    restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.RACE, race.value).id,
                    restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.HABIT_HONOR, honor.value).id,
                    restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.HABIT_PEACEFULNESS, peacefulness.value).id,
                    restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.ARCHETYPE, archetype.value).id,
                    restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.UPBRINGING, upbringing.value).id,
                    restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.FIRST_DEATH, first_death.value).id,
                    restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.AGE, age.value).id)

    hero_variable = linguistics_objects.UTGVariable(word=name, restrictions=restrictions)

    types = ['hero_history_birth',
             'hero_history_childhood',
             'hero_history_death']

    texts = []

    for type in types:
        lexicon_key, externals, restrictions = linguistics_logic.prepair_get_text(type, {'hero': hero_variable})

        text = linguistics_logic.render_text(lexicon_key=lexicon_key,
                                             externals=externals,
                                             restrictions=restrictions,
                                             quiet=True,
                                             with_nearest_distance=True,
                                             fake_text=lambda *argv, **kwargs: None)
        texts.append(text)

    return texts
Example #26
0
    def linguistics_restrictions(self):
        from the_tale.linguistics.relations import TEMPLATE_RESTRICTION_GROUP
        from the_tale.linguistics.storage import restrictions_storage

        return (restrictions_storage.get_restriction(
            TEMPLATE_RESTRICTION_GROUP.GENDER, self.gender.value).id,
                restrictions_storage.get_restriction(
                    TEMPLATE_RESTRICTION_GROUP.RACE, self.race.value).id,
                restrictions_storage.get_restriction(
                    TEMPLATE_RESTRICTION_GROUP.HABIT_HONOR,
                    self.habit_honor.interval.value).id,
                restrictions_storage.get_restriction(
                    TEMPLATE_RESTRICTION_GROUP.HABIT_PEACEFULNESS,
                    self.habit_honor.interval.value).id,
                restrictions_storage.get_restriction(
                    TEMPLATE_RESTRICTION_GROUP.ARCHETYPE,
                    self.preferences.archetype.value).id,
                restrictions_storage.get_restriction(
                    TEMPLATE_RESTRICTION_GROUP.TERRAIN,
                    self.position.get_terrain().value).id,
                restrictions_storage.get_restriction(
                    TEMPLATE_RESTRICTION_GROUP.ACTION_TYPE,
                    self.actions.current_action.ui_type.value).id)
Example #27
0
 def _linguistics_restrictions():
     from the_tale.linguistics.relations import TEMPLATE_RESTRICTION_GROUP
     from the_tale.linguistics.storage import restrictions_storage
     return [restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.RACE, getattr(RACE, race).value)]
Example #28
0
    def linguistics_restrictions_constants(self):
        if not hasattr(self, '_cached_modifiers'):
            self._cached_modifiers = {}

        if '#linguistics_restrictions' in self._cached_modifiers:
            return self._cached_modifiers['#linguistics_restrictions']

        restrictions = (restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.GENDER, self.gender.value).id,
                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.RACE, self.race.value).id,
                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.HABIT_HONOR, self.habit_honor.interval.value).id,
                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.HABIT_PEACEFULNESS, self.habit_peacefulness.interval.value).id,
                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.ARCHETYPE, self.preferences.archetype.value).id,
                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.COMMUNICATION_VERBAL, self.communication_verbal.value).id,
                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.COMMUNICATION_GESTURES, self.communication_gestures.value).id,
                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.COMMUNICATION_TELEPATHIC, self.communication_telepathic.value).id,
                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.INTELLECT_LEVEL, self.intellect_level.value).id,
                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.ACTOR, game_relations.ACTOR.HERO.value).id,
                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.MOB_TYPE, self.mob_type.value).id,

                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.BEING_STRUCTURE, self.structure.value).id,
                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.BEING_MOVEMENT, self.movement.value).id,
                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.BEING_BODY, self.body.value).id,
                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.BEING_SIZE, self.size.value).id,
                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.BEING_ORIENTATION, self.orientation.value).id,

                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.UPBRINGING, self.upbringing.value).id,
                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.FIRST_DEATH, self.first_death.value).id,
                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.AGE, self.death_age.value).id,)

        self._cached_modifiers['#linguistics_restrictions'] = restrictions

        return restrictions
Example #29
0
 def _linguistics_restrictions():
     from the_tale.linguistics.relations import TEMPLATE_RESTRICTION_GROUP
     from the_tale.linguistics.storage import restrictions_storage
     return (restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.CITY_MODIFIER, getattr(CITY_MODIFIERS, modifier).value).id, )
Example #30
0
    def linguistics_restrictions_constants(self):
        from the_tale.linguistics.relations import TEMPLATE_RESTRICTION_GROUP
        from the_tale.linguistics.storage import restrictions_storage
        from the_tale.game.map import logic as map_logic

        from the_tale.game.companions import relations as companion_relations

        terrains = map_logic.get_terrain_linguistics_restrictions(self.terrain)

        restrictions = [
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.MOB_TYPE,
                self.record.type.value).id,
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.MOB, self.record.id).id,
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.ARCHETYPE,
                self.record.archetype.value).id,
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.COMMUNICATION_VERBAL,
                self.record.communication_verbal.value).id,
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.COMMUNICATION_GESTURES,
                self.record.communication_gestures.value).id,
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.COMMUNICATION_TELEPATHIC,
                self.record.communication_telepathic.value).id,
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.INTELLECT_LEVEL,
                self.record.intellect_level.value).id,
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.ACTOR,
                game_relations.ACTOR.MOB.value).id,
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.ACTION_TYPE,
                self.action_type.value).id,
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.COMPANION_EXISTENCE,
                companion_relations.COMPANION_EXISTENCE.HAS_NO.value).id,
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.BEING_STRUCTURE,
                self.record.structure.value).id,
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.BEING_MOVEMENT,
                self.record.movement.value).id,
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.BEING_BODY,
                self.record.body.value).id,
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.BEING_SIZE,
                self.record.size.value).id,
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.BEING_ORIENTATION,
                self.record.orientation.value).id
        ]

        for feature in self.record.features:
            restrictions.append(
                restrictions_storage.get_restriction(
                    TEMPLATE_RESTRICTION_GROUP.BEING_FEATURE,
                    feature.value).id)

        restrictions.extend(terrains)

        return restrictions
Example #31
0
    def linguistics_restrictions(self):
        from the_tale.linguistics.relations import TEMPLATE_RESTRICTION_GROUP
        from the_tale.linguistics.storage import restrictions_storage

        restrictions = [
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.COMPANION, self.record.id).id,
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.ACTOR,
                game_relations.ACTOR.COMPANION.value).id,
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.COMPANION_DEDICATION,
                self.record.dedication.value).id,
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.ARCHETYPE,
                self.record.archetype.value).id,
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.COMMUNICATION_VERBAL,
                self.record.communication_verbal.value).id,
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.COMMUNICATION_GESTURES,
                self.record.communication_gestures.value).id,
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.COMMUNICATION_TELEPATHIC,
                self.record.communication_telepathic.value).id,
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.INTELLECT_LEVEL,
                self.record.intellect_level.value).id,
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.MOB_TYPE,
                self.record.type.value).id,
            restrictions_storage.get_restriction(
                TEMPLATE_RESTRICTION_GROUP.COMPANION_EXISTENCE,
                relations.COMPANION_EXISTENCE.HAS_NO.value).id
        ]

        if self._hero:
            terrain = self._hero.position.get_terrain()

            restrictions.extend(
                (restrictions_storage.get_restriction(
                    TEMPLATE_RESTRICTION_GROUP.ACTION_TYPE,
                    self._hero.actions.current_action.ui_type.value).id,
                 restrictions_storage.get_restriction(
                     TEMPLATE_RESTRICTION_GROUP.TERRAIN, terrain.value).id,
                 restrictions_storage.get_restriction(
                     TEMPLATE_RESTRICTION_GROUP.META_TERRAIN,
                     terrain.meta_terrain.value).id,
                 restrictions_storage.get_restriction(
                     TEMPLATE_RESTRICTION_GROUP.META_HEIGHT,
                     terrain.meta_height.value).id,
                 restrictions_storage.get_restriction(
                     TEMPLATE_RESTRICTION_GROUP.META_VEGETATION,
                     terrain.meta_vegetation.value).id))

        return restrictions
Example #32
0
    def linguistics_restrictions(self):
        from the_tale.linguistics.relations import TEMPLATE_RESTRICTION_GROUP
        from the_tale.linguistics.storage import restrictions_storage

        restrictions = [restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.COMPANION, self.record.id).id,
                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.ACTOR, game_relations.ACTOR.COMPANION.value).id,
                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.COMPANION_DEDICATION, self.record.dedication.value).id,
                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.ARCHETYPE, self.record.archetype.value).id,
                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.COMMUNICATION_VERBAL, self.record.communication_verbal.value).id,
                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.COMMUNICATION_GESTURES, self.record.communication_gestures.value).id,
                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.COMMUNICATION_TELEPATHIC, self.record.communication_telepathic.value).id,
                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.INTELLECT_LEVEL, self.record.intellect_level.value).id,
                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.MOB_TYPE, self.record.type.value).id ]
        if self._hero:
            terrain = self._hero.position.get_terrain()

            restrictions.extend((restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.ACTION_TYPE, self._hero.actions.current_action.ui_type.value).id,
                                 restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.TERRAIN, terrain.value).id,
                                 restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.META_TERRAIN, terrain.meta_terrain.value).id,
                                 restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.META_HEIGHT, terrain.meta_height.value).id,
                                 restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.META_VEGETATION, terrain.meta_vegetation.value).id))

        return restrictions
Example #33
0
 def _linguistics_restrictions():
     from the_tale.linguistics.relations import TEMPLATE_RESTRICTION_GROUP
     from the_tale.linguistics.storage import restrictions_storage
     return [restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.RACE, RACE.index_name[race].value)]
Example #34
0
    def linguistics_restrictions(self):
        from the_tale.linguistics.relations import TEMPLATE_RESTRICTION_GROUP
        from the_tale.linguistics.storage import restrictions_storage

        return [restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.TERRAIN, self.terrain.value)]
Example #35
0
    def linguistics_restrictions_constants(self):
        if not hasattr(self, '_cached_modifiers'):
            self._cached_modifiers = {}

        if '#linguistics_restrictions' in self._cached_modifiers:
            return self._cached_modifiers['#linguistics_restrictions']

        restrictions = (restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.GENDER, self.gender.value).id,
                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.RACE, self.race.value).id,
                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.HABIT_HONOR, self.habit_honor.interval.value).id,
                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.HABIT_PEACEFULNESS, self.habit_honor.interval.value).id,
                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.ARCHETYPE, self.preferences.archetype.value).id,
                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.COMMUNICATION_VERBAL, self.communication_verbal.value).id,
                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.COMMUNICATION_GESTURES, self.communication_gestures.value).id,
                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.COMMUNICATION_TELEPATHIC, self.communication_telepathic.value).id,
                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.INTELLECT_LEVEL, self.intellect_level.value).id,
                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.ACTOR, game_relations.ACTOR.HERO.value).id,
                        restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.MOB_TYPE, self.mob_type.value).id,)

        self._cached_modifiers['#linguistics_restrictions'] = restrictions

        return restrictions
Example #36
0
    def linguistics_restrictions(self):
        constants = self.linguistics_restrictions_constants()

        terrains = map_logic.get_terrain_linguistics_restrictions(self.position.get_terrain())

        return constants + terrains + (restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.ACTION_TYPE, self.actions.current_action.ui_type.value).id,)
Example #37
0
 def linguistics_restrictions(self):
     from the_tale.linguistics.relations import TEMPLATE_RESTRICTION_GROUP
     from the_tale.linguistics.storage import restrictions_storage
     return (restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.MOB_TYPE, self.record.type.value).id,
             restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.MOB, self.record.id).id,
             restrictions_storage.get_restriction(TEMPLATE_RESTRICTION_GROUP.ARCHETYPE, self.record.archetype.value).id )