[{"name":"Warrior","comment":" Contains the essential logic for rendering and defining the game. The `Map` and `Player` modules will probably be more interesting.\n\n@docs Model, Msg\n@docs PlayerTurnFunction\n@docs Config, program\n\n","unions":[{"name":"Model","comment":" The game model.\n","args":[],"cases":[]},{"name":"Msg","comment":" The game message type.\n","args":[],"cases":[]}],"aliases":[{"name":"Config","comment":" How would you like the game to be played? Which maps would you like to see the player try on, and how many milliseconds should we wait before showing the next turn?\n","args":[],"type":"{ maps : List.List Warrior.Map.Map, player : Warrior.PlayerTurnFunction, msPerTurn : Basics.Float }"},{"name":"PlayerTurnFunction","comment":" The type signature of an AI turn function\n","args":[],"type":"Warrior.Player.Player -> Warrior.Map.Map -> Warrior.Player.Action"}],"values":[{"name":"program","comment":" Use this in your main function to start the game.\n","type":"Warrior.Config -> Platform.Program () Warrior.Model Warrior.Msg"}],"binops":[]},{"name":"Warrior.Coordinate","comment":" Coordinates are simple records that describes a position on a map\n\n@docs Coordinate\n\n","unions":[],"aliases":[{"name":"Coordinate","comment":" A Coordinate is the intersection of column x and row y.\n","args":[],"type":"{ x : Basics.Int, y : Basics.Int }"}],"values":[],"binops":[]},{"name":"Warrior.Direction","comment":" Directions are usually used to specify where an action is applied.\n\n@docs Direction\n@docs all\n\n","unions":[{"name":"Direction","comment":" The different directions a player can move, look and attack. Note that there are no diagonal directions.\n","args":[],"cases":[["Left",[]],["Right",[]],["Up",[]],["Down",[]]]}],"aliases":[],"values":[{"name":"all","comment":" A simple list containing all Direction values. Handy when combined with `List.filter` or `List.map`\n","type":"List.List Warrior.Direction.Direction"}],"binops":[]},{"name":"Warrior.Item","comment":" A warrior might find and use different items on their quest.\n\n@docs Item\n\n","unions":[{"name":"Item","comment":" The different items that can be encountered and used during the game.\n","args":[],"cases":[["Sword",[]]]}],"aliases":[],"values":[],"binops":[]},{"name":"Warrior.Map","comment":" The functions in this module allows you to create your own maps, or simply ask questions about the map currently being played.\n\n@docs Map, Config, Tile\n\n\n# Player API\n\n@docs canMoveOnto, canMoveOntoTile, isExitPoint, look\n\n\n# Creation API\n\n@docs init, withExitPoint, withItem, withNPC, withSpawnPoint, withWalledArea, armLastNpc, setNpcs\n\n\n# Internals\n\n@docs coordinateFrom, npcs, removeItem, spawnPoints, view\n\n","unions":[{"name":"Map","comment":" A map, or level.\n","args":[],"cases":[]},{"name":"Tile","comment":" Describes what is on a specific coordinate of a map.\n","args":[],"cases":[["Wall",[]],["Empty",[]],["SpawnPoint",[]],["Player",[]],["Item",["Warrior.Item.Item"]],["Exit",[]]]}],"aliases":[{"name":"Config","comment":" Describes how large a map should be in rows and columns. Use this when creating your own maps.\n","args":[],"type":"{ rows : Basics.Int, columns : Basics.Int }"}],"values":[{"name":"armLastNpc","comment":" Places an item into the inventory of the last villain added with the `withNPC` function.\n","type":"Warrior.Item.Item -> Warrior.Map.Map -> Warrior.Map.Map"},{"name":"canMoveOnto","comment":" Checks if a Move action can be performed.\n","type":"Warrior.Coordinate.Coordinate -> Warrior.Map.Map -> Basics.Bool"},{"name":"canMoveOntoTile","comment":" Checks if a Move action can be formed onto the given tile.\n","type":"Warrior.Map.Tile -> Basics.Bool"},{"name":"coordinateFrom","comment":" Ignore this function.\n","type":"Warrior.Direction.Direction -> Warrior.Coordinate.Coordinate -> Warrior.Coordinate.Coordinate"},{"name":"init","comment":" Initialize an empty map of a given size where every tile is empty. Use the the following `with` functions to make the map more interesting.\n","type":"Warrior.Map.Config -> Warrior.Map.Map"},{"name":"isExitPoint","comment":" Checks to see if a specific coordinate on the map is an exit point.\n","type":"Warrior.Map.Map -> Warrior.Coordinate.Coordinate -> Basics.Bool"},{"name":"look","comment":" Provides a list of everything the player can see in a specific direction. The first item of the list will be the one tile away from the player. The second item will be two tiles away, etc.\n","type":"Warrior.Direction.Direction -> Warrior.Coordinate.Coordinate -> Warrior.Map.Map -> List.List Warrior.Map.Tile"},{"name":"npcs","comment":" Framework function\n","type":"Warrior.Map.Map -> List.List ( Warrior.Player.Player, Warrior.Player.Player -> Warrior.Map.Map -> Warrior.Player.Action )"},{"name":"removeItem","comment":" Removes an item from the map. This function can be ignored as it will be called by the framework.\n","type":"Warrior.Coordinate.Coordinate -> Warrior.Map.Map -> Maybe.Maybe ( Warrior.Item.Item, Warrior.Map.Map )"},{"name":"setNpcs","comment":" Replace all villains with the provided list. Might be less code than using multiple `withNPC` calls.\n","type":"List.List ( Warrior.Player.Player, Warrior.Player.Player -> Warrior.Map.Map -> Warrior.Player.Action ) -> Warrior.Map.Map -> Warrior.Map.Map"},{"name":"spawnPoints","comment":" A list of all points where players can spawn.\n","type":"Warrior.Map.Map -> List.List Warrior.Coordinate.Coordinate"},{"name":"view","comment":" Framework function\n","type":"List.List Warrior.Coordinate.Coordinate -> Warrior.Map.Map -> Element.Element a"},{"name":"withExitPoint","comment":" Marks a coordinate on the map where the player needs to go to advance to the next map.\n","type":"Warrior.Coordinate.Coordinate -> Warrior.Map.Map -> Warrior.Map.Map"},{"name":"withItem","comment":" Places an item on the map which can be picked up by players.\n","type":"Warrior.Coordinate.Coordinate -> Warrior.Item.Item -> Warrior.Map.Map -> Warrior.Map.Map"},{"name":"withNPC","comment":" Places a villain on the specific coordinate of the map, using the supplied function to know what to do each turn. You can find pre-made turn functions in the `Warrior.Npc` module.\n","type":"Warrior.Coordinate.Coordinate -> (Warrior.Player.Player -> Warrior.Map.Map -> Warrior.Player.Action) -> Warrior.Map.Map -> Warrior.Map.Map"},{"name":"withSpawnPoint","comment":" Marks a coordinate on the map where the player will spawn.\n","type":"Warrior.Coordinate.Coordinate -> Warrior.Map.Map -> Warrior.Map.Map"},{"name":"withWalledArea","comment":" Turns every tile between two coordinates into walls.\n","type":"Warrior.Coordinate.Coordinate -> Warrior.Coordinate.Coordinate -> Warrior.Map.Map -> Warrior.Map.Map"}],"binops":[]},{"name":"Warrior.Maps","comment":" A selection of pre-made maps to test your hero.\n\n@docs all, movement, fighting\n\n\n# Movement only\n\n@docs straight, inverseL, loop, withDeadEndLeft, withDeadEndRight, openSpace, openSpaceReverse\n\n\n# Fighing only\n\n@docs straightGuard, straightPowerfulGuard, straightGuardPickupSword\n\n","unions":[],"aliases":[],"values":[{"name":"all","comment":" A list of all pre-made maps.\n","type":"List.List Warrior.Map.Map"},{"name":"fighting","comment":" A list of maps which require fighting in addition to navigation.\n","type":"List.List Warrior.Map.Map"},{"name":"inverseL","comment":" ","type":"Warrior.Map.Map"},{"name":"loop","comment":" ","type":"Warrior.Map.Map"},{"name":"movement","comment":" A list of map that only require navigation.\n","type":"List.List Warrior.Map.Map"},{"name":"openSpace","comment":" ","type":"Warrior.Map.Map"},{"name":"openSpaceReverse","comment":" ","type":"Warrior.Map.Map"},{"name":"straight","comment":" ","type":"Warrior.Map.Map"},{"name":"straightGuard","comment":" ","type":"Warrior.Map.Map"},{"name":"straightGuardPickupSword","comment":" ","type":"Warrior.Map.Map"},{"name":"straightPowerfulGuard","comment":" ","type":"Warrior.Map.Map"},{"name":"withDeadEndLeft","comment":" ","type":"Warrior.Map.Map"},{"name":"withDeadEndRight","comment":" ","type":"Warrior.Map.Map"}],"binops":[]},{"name":"Warrior.Npc.Dummy","comment":" A dummy. A villain which just stands still no matter what happens.\n\n@docs takeTurn\n\n","unions":[],"aliases":[],"values":[{"name":"takeTurn","comment":" Use this function with the `withNPC` function of the `Map` module to add dangerous opponents to a map.\n","type":"Warrior.Player.Player -> Warrior.Map.Map -> Warrior.Player.Action"}],"binops":[]},{"name":"Warrior.Npc.StationaryAttacker","comment":" AI of a villain which attacks anything that gets close.\n\n@docs takeTurn\n\n","unions":[],"aliases":[],"values":[{"name":"takeTurn","comment":" Use this function with the `withNPC` function of the `Map` module to add dangerous opponents to a map.\n","type":"Warrior.Player.Player -> Warrior.Map.Map -> Warrior.Player.Action"}],"binops":[]},{"name":"Warrior.Player","comment":" The player record contains all known state for playable, as well as non-playable characters in the game. You'll probably need the functions in this module to make decisions about your next turn.\n\n@docs Player, PlayerRole, Action\n\n@docs spawnHero, spawnVillain, addItem, addAction, withPosition, attack\n\n@docs position, health, alive, attackDamage, heal, inventory, maxHealth, previousActions\n\n","unions":[{"name":"Action","comment":" The different actions which can be performed on a given turn.\n","args":[],"cases":[["Wait",[]],["Move",["Warrior.Direction.Direction"]],["Pickup",[]],["Heal",[]],["Attack",["Warrior.Direction.Direction"]]]},{"name":"Player","comment":" This record contains the state of a given player. Playable or non-playable.\n","args":[],"cases":[]},{"name":"PlayerRole","comment":" This type allows us to seperate playable from non-playable characters. Villains are players which belong to a specific map, where they serve as obstacles.\n","args":[],"cases":[["Hero",[]],["Villain",[]]]}],"aliases":[],"values":[{"name":"addAction","comment":" Adds an action to the list of previous actions. Is called by the framework and can be safely ignored.\n","type":"Warrior.Player.Action -> Warrior.Player.Player -> Warrior.Player.Player"},{"name":"addItem","comment":" Add an item to the players inventory. You do not need to concern yourself with this function, as the framework will use this as the result of a Pickup action.\n","type":"Warrior.Item.Item -> Warrior.Player.Player -> Warrior.Player.Player"},{"name":"alive","comment":" Checks if the player is alive.\n","type":"Warrior.Player.Player -> Basics.Bool"},{"name":"attack","comment":" This function will be called by the framework as a result of the Attack action, and can be safely ignored.\n","type":"Warrior.Player.Player -> Warrior.Player.Player -> Warrior.Player.Player"},{"name":"attackDamage","comment":" Returns how much damage this player will do as the result of an attack. This takes the items in the players inventory into account.\n","type":"Warrior.Player.Player -> Basics.Int"},{"name":"heal","comment":" This function will be called by the framework as a result of the Heal action, and can be safely ignored.\n","type":"Warrior.Player.Player -> Warrior.Player.Player"},{"name":"health","comment":" Get the health of a player.\n","type":"Warrior.Player.Player -> Basics.Int"},{"name":"inventory","comment":" Get all the items that the player has in their posession.\n","type":"Warrior.Player.Player -> List.List Warrior.Item.Item"},{"name":"maxHealth","comment":" Get the maximum health the player can have. The player usually starts with this amount of health at the start of a map.\n","type":"Warrior.Player.Player -> Basics.Int"},{"name":"position","comment":" Retrieve the current position of a player.\n","type":"Warrior.Player.Player -> Warrior.Coordinate.Coordinate"},{"name":"previousActions","comment":" Get a list of previous actions, and the player state before those actions occured. The list is in reverse order. Meaning that the previous action performed by the player is the first item. If the list is empty, this must be the first turn of the game.\n","type":"Warrior.Player.Player -> List.List ( Warrior.Player.Player, Warrior.Player.Action )"},{"name":"spawnHero","comment":" Initializes a hero. You do not need to concern yourself with this function, as it will be called by the framework.\n","type":"Warrior.Coordinate.Coordinate -> Warrior.Player.Player"},{"name":"spawnVillain","comment":" Initializes a villain. You do not need to concern yourself with this function, as it will be called by the framework.\n","type":"Warrior.Coordinate.Coordinate -> Warrior.Player.Player"},{"name":"withPosition","comment":" Change the current position of a player. This will be used by the framework to advance the state of the game. You do not need to concern yourself with this function.\n","type":"Warrior.Coordinate.Coordinate -> Warrior.Player.Player -> Warrior.Player.Player"}],"binops":[]}]