Villager

Villagers are peaceful entities that play a vital role in the game, particularly within villages. These non-player characters (NPCs) are essential for trading activities, offering a wide range of goods and services to the player. Interacting with villagers and engaging in trade can provide valuable resources, items, and advancements in the game progression.

## Apparition

Villagers randomly appear when a new village is created. They can also appear inside buildings. The number of villagers walking in the city depends of the number of beds present in the village.

## Behavior

Villagers are dynamic entities known for their mobility, often seen moving around rather than remaining stationary. They exhibit a non-aggressive nature, refraining from engaging in hostile actions even when provoked or attacked by other entities. While they are capable of venturing outside their village boundaries, villagers typically return to their village within a few seconds, maintaining a strong connection to their home location.

A right click on a villager allows opening a trading interface and exchange resources. During trading interactions with player, the villager temporarily pause their movement, patiently waiting until the transaction is completed before resuming their usual tasks.

## Like and dislike

Each villager has unique tastes, preferences, and culinary inclinations. They typically have one particular meal that they enjoy and another that they tend to dislike. Understanding the individual preferences of each villager is important when player want to offer a gift: If the player offers an item to a villager that he dislikes, it can result in a decrease in reputation. Conversely, if the player gives something that the villager enjoys or appreciates, it can significantly boost their earned reputation.

Performing a right-click on a villager allows knowing what he likes.

## Interactions with player

Player can initiate interactions with a villager by performing a right-click action. This action triggers the opening of a dedicated window, presenting a range of available actions such as:

* Trade: Exchange items for stellarcoins, or stellarcoins for items. Always improve reputation. Items to trade depends on villager's job
* Give: Give a gift to the current villager. Ensure that this is not something that he dislikes, or reputation is reduced
* Ask: Ask an item to the villager. Strongly reduces the reputation. If the reputation is not high enough for the requested item, the villager can refuse to give it
* Chat: Random sentence, or can also intialite a quest

Note: A public enemy reputation status restricts the player from engaging in trade or chat with villagers. This means that due to their negative reputation, villagers will refuse to interact with the player, denying them the opportunity to trade goods or engage in dialogue.

## Quests

Player can initiate quests by engaging in conversations with villagers, typically in the form of requests for specific items. When presented with a quest, player has the option to accept or refuse. Refusing a quest results in a loss of reputation, while accepting commits the player to completing the task. Once a quest is accepted, the corresponding villager will patiently wait for the quest to be fulfilled.

It's important to note that quests primarily serve to boost reputation rather than offer tangible rewards. Completing quests successfully contributes to the player's standing within the village. However, until a quest is completed, the player cannot initiate a new quest with the same villager, allowing for a focus on one quest at a time.

## Jobs

Each villager is assigned a specific job, which determines the type of items it is capable of selling to the player. The job depend on where the villager is found:

* A villager walking in the village or inside a house (hut, apartment, ...) has a random job
* A villager located inside a specific building (farm, workshop, ...) has a specific job

Below is a table showcasing different jobs with the corresponding buildings where villagers of each profession can be found:

## Naming

In the game, each villager has their name and job displayed above their head, adding a helpful visual element for the player. The names given to villagers are not typical or common names.

## Clothes

The clothing worn by villagers is intricately tailored to reflect their unique jobs and roles within the game. Each villager's attire is designed to represent their occupation. They also have a random item in their hand representing what they are currently doing: lumberjack can have wood or plank, miner can have stone, copper, etc

## Drop

When a villager is killed, it has 20% chance to drop one of their clothes, while the remaining 80% chance is allocated to dropping a specific item associated to their job:

* Lumberjack drops between x10 and x30  jacobean wood
* Miner drops between x8 and x25  stones
* Farmer drops between x3 and x7  potatoes
* Cook drops between x2 and x4  breads
* Toolsmith drops between x3 and x9  irons
* Dyer drops between x3 and x6  poppy
* Engineer drops between x2 and x5  irons
* Builder drops between x9 and x20  torches
* Carpenter drops between x1 and x4  wood barrels
* Crafter drops between x1 and x4  adventurer boxes
* Foreman drops between x6 and x15  marbles
* Armorer drops x1  stone dagger

## History

* Added mechanics job
 0.7.0
* Added interractions (give, trade, ask, chat)
 0.6.0
 0.5.0
 0.4.0
 0.1.0