diff --git a/public/main.js b/public/main.js index ab1ce6cd2bdd408822bce7246a81b853ea580e35..294778ff5bbdc8430e8cc88653bb7c32854ce53d 100644 --- a/public/main.js +++ b/public/main.js @@ -5188,6 +5188,7 @@ var $author$project$Creation$new = { abilities: $author$project$OrderedCategories$new($author$project$OrderedCategories$Ability), abilityDotLimit: 3, attributes: $author$project$OrderedCategories$new($author$project$OrderedCategories$Attribute), + backgrounds: 7, freebie: 15, spheres: 6 }; @@ -5223,6 +5224,15 @@ var $author$project$Stats$newAttribute = F2( statType: $author$project$Stats$Attribute(category) }; }); +var $author$project$Stats$Background = {$: 'Background'}; +var $author$project$Stats$newBackground = F2( + function (name, max) { + return { + dots: A3($author$project$BoundedInt$new, 0, 0, max), + name: name, + statType: $author$project$Stats$Background + }; + }); var $author$project$Stats$Sphere = {$: 'Sphere'}; var $author$project$Stats$newSphere = function (name) { return { @@ -5284,7 +5294,39 @@ var $author$project$Stats$new = _List_fromArray( A2($author$project$Stats$newAbility, $author$project$Stats$Knowledge, 'Medicine'), A2($author$project$Stats$newAbility, $author$project$Stats$Knowledge, 'Occult'), A2($author$project$Stats$newAbility, $author$project$Stats$Knowledge, 'Politics'), - A2($author$project$Stats$newAbility, $author$project$Stats$Knowledge, 'Science') + A2($author$project$Stats$newAbility, $author$project$Stats$Knowledge, 'Science'), + A2($author$project$Stats$newBackground, 'Allies', 10), + A2($author$project$Stats$newBackground, 'Alternate Identity', 5), + A2($author$project$Stats$newBackground, 'Arcane', 5), + A2($author$project$Stats$newBackground, 'Avatar', 5), + A2($author$project$Stats$newBackground, 'Backup', 10), + A2($author$project$Stats$newBackground, 'Certification', 5), + A2($author$project$Stats$newBackground, 'Chantry', 10), + A2($author$project$Stats$newBackground, 'Contacts', 10), + A2($author$project$Stats$newBackground, 'Cult', 5), + A2($author$project$Stats$newBackground, 'Demesne', 5), + A2($author$project$Stats$newBackground, 'Destiny', 5), + A2($author$project$Stats$newBackground, 'Dream', 5), + A2($author$project$Stats$newBackground, 'Enhancements', 5), + A2($author$project$Stats$newBackground, 'Fame', 5), + A2($author$project$Stats$newBackground, 'Familiar', 5), + A2($author$project$Stats$newBackground, 'Influence', 10), + A2($author$project$Stats$newBackground, 'Legend', 5), + A2($author$project$Stats$newBackground, 'Library', 10), + A2($author$project$Stats$newBackground, 'Mentor', 5), + A2($author$project$Stats$newBackground, 'Node', 10), + A2($author$project$Stats$newBackground, 'Past Lives', 5), + A2($author$project$Stats$newBackground, 'Patron', 5), + A2($author$project$Stats$newBackground, 'Rank', 5), + A2($author$project$Stats$newBackground, 'Requisitions', 10), + A2($author$project$Stats$newBackground, 'Resources', 10), + A2($author$project$Stats$newBackground, 'Retainers', 5), + A2($author$project$Stats$newBackground, 'Sanctum', 5), + A2($author$project$Stats$newBackground, 'Secret Weapons', 5), + A2($author$project$Stats$newBackground, 'Spies', 10), + A2($author$project$Stats$newBackground, 'Status', 5), + A2($author$project$Stats$newBackground, 'Totem', 5), + A2($author$project$Stats$newBackground, 'Wonder', 5) ]); var $author$project$Character$new = {creationPoints: $author$project$Creation$new, name: 'Default Name', stats: $author$project$Stats$new}; var $elm$core$Platform$Cmd$batch = _Platform_batch; @@ -5458,6 +5500,12 @@ var $author$project$Stats$isAttribute = function (stat) { var $author$project$Stats$attributesInList = function (stats) { return A2($elm$core$List$filter, $author$project$Stats$isAttribute, stats); }; +var $author$project$Stats$isBackground = function (stat) { + return _Utils_eq(stat.statType, $author$project$Stats$Background); +}; +var $author$project$Stats$backgroundsInList = function (stats) { + return A2($elm$core$List$filter, $author$project$Stats$isBackground, stats); +}; var $author$project$BoundedInt$changeTo = F2( function (boundedInt, value) { return ((_Utils_cmp(value, boundedInt.min) < 0) || (_Utils_cmp(value, boundedInt.max) > 0)) ? boundedInt : _Utils_update( @@ -5521,6 +5569,8 @@ var $author$project$Character$changeStat = F2( return $author$project$Stats$attributesInList(character.stats); case 'Ability': return $author$project$Stats$abilitiesInList(character.stats); + case 'Background': + return $author$project$Stats$backgroundsInList(character.stats); default: return _List_Nil; } @@ -5534,6 +5584,8 @@ var $author$project$Character$changeStat = F2( return stat.dots.max; case 'Ability': return character.creationPoints.abilityDotLimit; + case 'Background': + return stat.dots.max; default: return 0; } @@ -6294,6 +6346,48 @@ var $author$project$Main$viewAttributes = F2( ])) ])); }); +var $author$project$Main$viewBackgrounds = F2( + function (cp, backgrounds) { + var basePoints = cp.backgrounds; + var points = basePoints - $author$project$Stats$count(backgrounds); + return A2( + $elm$html$Html$div, + _List_fromArray( + [ + $elm$html$Html$Attributes$class('has-text-centered') + ]), + _List_fromArray( + [ + A2( + $elm$html$Html$p, + _List_Nil, + _List_fromArray( + [ + $elm$html$Html$text('Backgrounds') + ])), + $author$project$Main$creationInfo(points), + A2( + $elm$html$Html$div, + _List_fromArray( + [ + $elm$html$Html$Attributes$class('fixed-grid has-6-cols') + ]), + _List_fromArray( + [ + A2( + $elm$html$Html$div, + _List_fromArray( + [ + $elm$html$Html$Attributes$class('grid') + ]), + A2( + $elm$core$List$map, + $author$project$Main$viewStatInGrid( + $elm$core$List$length(backgrounds)), + A2($elm$core$List$indexedMap, $elm$core$Tuple$pair, backgrounds))) + ])) + ])); + }); var $author$project$Main$OpenModal = function (a) { return {$: 'OpenModal', a: a}; }; @@ -6630,6 +6724,10 @@ var $author$project$Main$view = function (model) { A2($author$project$Main$viewAttributes, model.character.creationPoints.attributes, model.character.stats), A2($author$project$Main$viewAbilities, model.character.creationPoints.abilities, model.character.stats), A2( + $author$project$Main$viewBackgrounds, + model.character.creationPoints, + $author$project$Stats$backgroundsInList(model.character.stats)), + A2( $author$project$Main$viewSpheres, model.character.creationPoints, $author$project$Stats$spheresInList(model.character.stats)), diff --git a/src/Character.elm b/src/Character.elm index 20929506065912c02ff258bc9168c54bd5514bdd..c69287af58ef2318c6fae6e8fe6770aab7b40573 100644 --- a/src/Character.elm +++ b/src/Character.elm @@ -3,7 +3,7 @@ module Character exposing (..) import Creation exposing (CreationPoints) import Stats exposing (Stat, Category) import BoundedInt exposing (BoundedInt) -import OrderedCategories as OCat exposing (CategoriesType) +import OrderedCategories exposing (CategoriesType) type alias Character = { name : String @@ -38,6 +38,7 @@ changeStat character stat = Stats.Sphere -> Stats.spheresInList character.stats Stats.Attribute _ -> Stats.attributesInList character.stats Stats.Ability _ -> Stats.abilitiesInList character.stats + Stats.Background -> Stats.backgroundsInList character.stats _ -> [] max : Int @@ -45,6 +46,7 @@ changeStat character stat = Stats.Sphere -> ( Stats.areteInList character.stats ).dots.value Stats.Attribute _ -> stat.dots.max Stats.Ability _ -> character.creationPoints.abilityDotLimit + Stats.Background -> stat.dots.max _ -> 0 maybeOldDots : Maybe BoundedInt diff --git a/src/Creation.elm b/src/Creation.elm index 6fa81db9a4363779749a94a998dc926f4ef29fa7..a170dddd8f2b793d74ce237f544b70d4b8cdea4d 100644 --- a/src/Creation.elm +++ b/src/Creation.elm @@ -9,6 +9,7 @@ type alias CreationPoints = , attributes : OCat , abilities : OCat , abilityDotLimit : Int + , backgrounds : Int } new : CreationPoints @@ -18,6 +19,7 @@ new = , attributes = OCat.new OCat.Attribute , abilities = OCat.new OCat.Ability , abilityDotLimit = 3 + , backgrounds = 7 } cost : diff --git a/src/Main.elm b/src/Main.elm index 823aca306c16144f3af88ded317442c8eb748325..ed73c48e91a6cd356b6a8837f3fc49fe18083f7d 100644 --- a/src/Main.elm +++ b/src/Main.elm @@ -96,6 +96,7 @@ view model = [ viewEditableText Name model.character.name , viewAttributes model.character.creationPoints.attributes model.character.stats , viewAbilities model.character.creationPoints.abilities model.character.stats + , viewBackgrounds model.character.creationPoints ( Stats.backgroundsInList model.character.stats ) , viewSpheres model.character.creationPoints ( Stats.spheresInList model.character.stats ) , viewArete ( Stats.areteInList model.character.stats ) , viewModal model @@ -253,6 +254,23 @@ viewStatInGrid totalCount indexedStat = ] ] +viewBackgrounds : CreationPoints -> List Stat -> Html Msg +viewBackgrounds cp backgrounds = + let + basePoints : Int + basePoints = cp.backgrounds + points : Int + points = basePoints - ( Stats.count backgrounds ) + in + div [ class "has-text-centered" ] + [ p [] [ text "Backgrounds" ] + , creationInfo points + , div [ class "fixed-grid has-6-cols" ] + [ div [ class "grid" ] + ( List.map ( viewStatInGrid ( List.length backgrounds ) ) ( List.indexedMap Tuple.pair backgrounds ) + ) + ] + ] viewSpheres : CreationPoints -> List Stat -> Html Msg viewSpheres cp spheres = diff --git a/src/Stats.elm b/src/Stats.elm index f527e6eb0d84a35fe9db1c819893d39bbb993a7c..374a1127046572fed63d95f78307821a75b379a0 100644 --- a/src/Stats.elm +++ b/src/Stats.elm @@ -13,6 +13,7 @@ type StatType | Arete | Attribute Category | Ability Category + | Background type Category -- Attributes @@ -78,6 +79,38 @@ new = , newAbility Knowledge "Occult" , newAbility Knowledge "Politics" , newAbility Knowledge "Science" + , newBackground "Allies" 10 + , newBackground "Alternate Identity" 5 + , newBackground "Arcane" 5 + , newBackground "Avatar" 5 + , newBackground "Backup" 10 + , newBackground "Certification" 5 + , newBackground "Chantry" 10 + , newBackground "Contacts" 10 + , newBackground "Cult" 5 + , newBackground "Demesne" 5 + , newBackground "Destiny" 5 + , newBackground "Dream" 5 + , newBackground "Enhancements" 5 + , newBackground "Fame" 5 + , newBackground "Familiar" 5 + , newBackground "Influence" 10 + , newBackground "Legend" 5 + , newBackground "Library" 10 + , newBackground "Mentor" 5 + , newBackground "Node" 10 + , newBackground "Past Lives" 5 + , newBackground "Patron" 5 + , newBackground "Rank" 5 + , newBackground "Requisitions" 10 + , newBackground "Resources" 10 + , newBackground "Retainers" 5 + , newBackground "Sanctum" 5 + , newBackground "Secret Weapons" 5 + , newBackground "Spies" 10 + , newBackground "Status" 5 + , newBackground "Totem" 5 + , newBackground "Wonder" 5 ] newSphere : String -> Stat @@ -108,6 +141,13 @@ newAbility category name = , statType = Ability category } +newBackground : String -> Int -> Stat +newBackground name max = + { name = name + , dots = BoundedInt.new 0 0 max + , statType = Background + } + spheresInList : List Stat -> List Stat spheresInList stats = List.filter isSphere stats @@ -165,6 +205,15 @@ isAbilityOfCategory : Category -> Stat -> Bool isAbilityOfCategory category stat = stat.statType == Ability category + +backgroundsInList : List Stat -> List Stat +backgroundsInList stats = + List.filter isBackground stats + +isBackground : Stat -> Bool +isBackground stat = + stat.statType == Background + dotsOfStatInList : List Stat -> String -> Maybe BoundedInt dotsOfStatInList stats name = let