~sjm/builds-character

cc4c5f1916f76e7609abd2e1668c54ff74bfc25b — Sam Marshall 3 years ago e298247 master
feat: display possible foci

also added a basic test character to the data/test-char.json file.
4 files changed, 52 insertions(+), 5 deletions(-)

A data/test-char.json
M readme.org
M src/UI/Entry.purs
M src/UI/Foci/PossibleList.purs
A data/test-char.json => data/test-char.json +14 -0
@@ 0,0 1,14 @@
{"xp":0,"class":"warrior","attributes":{"str":10,"dex":10,"con":10,"int":5,"wis":11,"cha":8},"background":"Dilettante",
 "possibleFoci":[
     { "name":"Alert"
       , "description":"\nYou are keenly aware of your surroundings and virtually\nimpossible to take you unaware. You have an instinctive\nalacrity of response that helps you act before less wary\npersons can think to move.\n"
       , "levelOne":"\nGain notice as a bonus skill. You cannot be surprised,\nnor can others use the Execution Attack option on you.\nWhen you roll initiative, roll twice and take the\nbest result.\n"
       , "levelTwo":"\nYou always act first in a combat round unless someone\nelse involved is also Alert.\n"
     }
     ,   { "name": "Armsman"
	   , "description": "You have unusual competence with thrown weapons and melee attacks. This focus' benefits do not apply to unarmed attacks or projectile weapons. For thrown weapons, you can't use the benefits of the Armsman focus at the same time as Gunslinger."
	   , "levelOne": "Gain stab as a bonus skill. You can draw or sheath a Stowed melee or thrown weapon as an Instant action. You may add your Stab skill level to a melee or thrown weapon's damage roll or shock damage, assuming it has any to begin with"
	   , "levelTwo": "Your primitive melee and thrown weapons count as TL4 weapons for the purpose of overcoming advanced armours. Even on a miss with a melee weapon, you do an unmodified 1d4 damage to the target, plus any Shock damage. This bonus damage doesn't apply to thrown weapons or attacks that use the Punch skill."
	 }
 ]
}

M readme.org => readme.org +2 -1
@@ 44,7 44,6 @@ Weapons have damage dice and stuff, armour has armour class.
**** Model Goal
**** fromJson should return an Either CharParseError Character
*** Doing
**** Display Possible Foci

*** Done
**** DONE save sheet on update


@@ 198,3 197,5 @@ yup. wn pasg t Aff bk ou to t Aff runr so it ws g lost. wks nw
***** bug: focus Zt n updt in rlti

done

**** Display Possible Foci

M src/UI/Entry.purs => src/UI/Entry.purs +1 -1
@@ 92,7 92,7 @@ component =
                []
                [ HH.slot _possibleFoci unit PossibleFoci.component possibleFoci addPossibleFocus ]
            , HH.div
                [ Util.classes [ "mb-4" ] ]
                [ Util.classes [ "my-4" ] ]
                [ HH.slot _importBox unit ImportBox.component unit importCharacter ]
            , HH.div_ [ HH.slot_ _exportBox unit ExportBox.component char ]
            ]

M src/UI/Foci/PossibleList.purs => src/UI/Foci/PossibleList.purs +35 -3
@@ 12,6 12,7 @@ import Halogen.HTML.Events as HE
import Halogen.Hooks as Hooks
import Type.Proxy (Proxy(..))
import UI.Foci.PossibleList.Add as Add
import UI.Util as Util

-- list the possible foci so the user can select one.
type Input


@@ 26,8 27,29 @@ data Query s

_addFocus = Proxy :: Proxy "addFocus"

focusSubheading :: forall w i. String -> HH.HTML w i
focusSubheading title =
  HH.h2
    [ Util.classes [ "pl-2", "font-medium", "text-gray-500" ] ]
    [ HH.text title ]

focusDetail :: forall w i. String -> HH.HTML w i
focusDetail detail =
  HH.p
    [ Util.classes [ "pl-3", "text-gray-800" ] ]
    [ HH.text detail ]

focus :: forall w i. CF.Focus -> HH.HTML w i
focus f = HH.div [] [ HH.h1_ [ HH.text (L.view CF._name f) ] ]
focus f = HH.div [] [ HH.h1
                        [ Util.classes [ "font-bold", "text-lg" ] ]
                        [ HH.text (L.view CF._name f) ]
                    , focusSubheading "Description"
                    , focusDetail (L.view CF._description f)
                    , focusSubheading "Level One"
                    , focusDetail (L.view CF._levelOne f)
                    , focusSubheading "Level Two"
                    , focusDetail (L.view CF._levelTwo f)
                    ]

component :: forall m. H.Component Query Input Message m
component =


@@ 49,10 71,20 @@ component =

    Hooks.pure do
      HH.div
        []
        [ ] 
        [ HH.div [] (focus <$> foci)
        , if adding then
            HH.slot _addFocus unit Add.component unit addFocus
          else
            HH.button [ HE.onClick toggleAdding ] [ HH.text "add focus" ]
            HH.button
              [ HE.onClick toggleAdding
              , Util.classes
                  [ "border"
                  , "border-black"
                  , "border-2"
                  , "p-2"
                  , "mt-2"
                  ]
              ]
              [ HH.text "add focus" ]
        ]