Skinney / elm-warrior / Warrior

You'll need the functions and Action type in this module to implement a turn function. The Map module can also be of some assistance.


type alias Warrior =
Internal.Warrior

This type represents a warrior.


type Action
    = Wait
    | Heal
    | Pickup
    | Move Direction
    | Attack Direction

The different actions which can be performed on a given turn. Wait will simply skip your turn. Heal let's the warrior recover some health. How much is influenced by the existence of potions in your inventory. Pickup will pick an item from the tile you are on, and place it on your inventory. Move let's you move one tile in any direction. Attack will make you attack in any direction. If another warrior is there that warrior will lose health. How much is influenced by the existance of a sword in your inventory.

id : Warrior -> String

The id, or name, of the warrior.

position : Warrior -> Coordinate

Retrieve the current position of a warrior.

health : Warrior -> Basics.Int

Get the health of a warrior.

maxHealth : Warrior -> Basics.Int

Get the maximum health the warrior can have. The warrior will start a map with this much health.

healingPotential : Warrior -> Basics.Int

Calculates much health the warrior could potentially recover as the result of a heal action. This function doesn't consider your current health; you will never heal past your maxHealth.

attackDamage : Warrior -> Basics.Int

Calculates how much damage the warrior will do as the result of an attack. The returned value depends on the items in the inventory.

inventory : Warrior -> List Item

A list of all the items a warrior has in its possession.