Commit Graph

56 Commits

Author SHA1 Message Date
Kistaro Windrider c30aca1f31
Better error management.
* "Uncooperative cards" is now a warning.
* Cards and actions get "Then" invoked before the card processor considers erroring out.
* Terminal UI: Errors and warnings from actions are displayed during the response; they're not only added to the temporary messages now.
2023-04-15 20:59:21 -07:00
Kistaro Windrider abb00e30c3
Debug action to adjust debug level. 2023-04-15 20:16:54 -07:00
Kistaro Windrider 65c01318f0
Fix UI urgency handling.
Only cards can block other cards or actions from being used due to urgency, so only display the `[URGENT!]` header for cards. Debug actions can't be blocked, so skip the "urgency conflict" check for those.
2023-04-15 19:43:11 -07:00
Kistaro Windrider 2b788f517c
Add action counter spoofer. 2023-04-15 19:36:53 -07:00
Kistaro Windrider 74fac625f2
Implement standard debuggers.
These debug actions are added to all players by default.
2023-04-15 19:16:08 -07:00
Kistaro Windrider 54711b36a8
Display debug enactables.
Includes some refactoring work to pull out common code and express the idea of "wait, which panel, exactly?".
2023-04-15 17:17:51 -07:00
Kistaro Windrider 6c3c936dbd
Debug Actions: Another set of permanent actions.
These are only reachable in debug mode.
2023-04-15 16:06:55 -07:00
Kistaro Windrider ad9e5764f1
Allow renaming of extracted stats via tag. 2023-04-04 12:14:04 -07:00
Kistaro Windrider 99e372a4db
Fix it
Pointer vs. value receivers are... interesting.
2023-04-04 11:37:02 -07:00
Kistaro Windrider 3e34e25f54
Major stats upgrade.
StatLiteral: just emit a stat in the obvious way. Plus helper functions.

Can also identify stats via struct tags, no more Stored type!

Can also identify stat methods via name (with compatible types).
2023-04-04 11:12:07 -07:00
Kistaro Windrider 1464070339
Fix excess divider mess in message display. 2023-04-03 01:45:38 -07:00
Kistaro Windrider 74a2493ef4
Clear screen before displaying panel in stats mode. 2023-04-02 19:37:55 -07:00
Kistaro Windrider 2c2e68ff93
Fix shadowing bug in rules engine. 2023-04-02 19:36:28 -07:00
Kistaro Windrider d13e04e2f4
Debug utility function and comments 2023-04-02 19:35:07 -07:00
Kistaro Windrider 57348f7ebf
Add a bunch of logging. 2023-04-02 19:33:44 -07:00
Kistaro Windrider 9796c2e970
First round of substantial bug fixes 2023-04-02 19:25:53 -07:00
Kistaro Windrider 0f21020647
More fencepost errors! 2023-04-02 19:08:26 -07:00
Kistaro Windrider e96d81a7b4
Fencepost error!
Also the title is visible.
2023-04-02 19:07:05 -07:00
Kistaro Windrider 3a7bf9c2fb
Don't adjust twice. 2023-04-02 19:05:15 -07:00
Kistaro Windrider 00ea284cbc
Nil is not an error, much less a serious one. 2023-04-02 19:03:39 -07:00
Kistaro Windrider 2480a1631b
Implement a very crude "game" as a test. Also updates Player. 2023-04-02 19:01:40 -07:00
Kistaro Windrider 2875dc5af8
Implement review mode.
This finishes the UI.
2023-04-02 13:58:56 -07:00
Kistaro Windrider 74ca51b21d
actions mode, prompt cleanup
Fixes some off-by-one errors. A 1-indexed UI in a 0-indexed language is always going to be prone to those and I will no doubt find more when I have enough of a test program to experiment with...
2023-04-02 13:19:26 -07:00
Kistaro Windrider 5a2158f525
Implement Stats Mode.
Also rewords some prompts. Might as well be thorough in accepting reasonable inputs.
2023-04-02 12:54:52 -07:00
Kistaro Windrider 25a9eed3f0
Prompt for player choices on cards.
Also handles errors in the display/prompt logic somewhat better.
2023-04-02 12:44:29 -07:00
Kistaro Windrider 592c877852
More display components. 2023-04-02 00:43:17 -07:00
Kistaro Windrider e1eac9de0f
displayStatsMenu 2023-04-02 00:36:12 -07:00
Kistaro Windrider 7371cddab3
Add more dividers 2023-04-02 00:28:34 -07:00
Kistaro Windrider aecd8683b2
Restructure loop, basic display functions 2023-04-02 00:26:34 -07:00
Kistaro Windrider a62de999ea
Panel display, MultiMessage. 2023-04-02 00:20:37 -07:00
Kistaro Windrider 3eb087201f
more terminal utility functions 2023-04-02 00:09:17 -07:00
Kistaro Windrider c73545fd07
Implement screen clear. 2023-04-02 00:02:25 -07:00
Kistaro Windrider 34e1f3166f
Main display mode skeleton 2023-04-01 23:59:53 -07:00
Kistaro Windrider af9d9a6579
Skeleton of prototypical UI. 2023-04-01 23:22:50 -07:00
Kistaro Windrider 9e659ecf41
InitPlayer
InitPlayer creates very not-ready Player with its basic data structures initialized to an empty, ready-for-data state.
2023-04-01 22:19:42 -07:00
Kistaro Windrider 09fdf19948
CardOption.Enable
Make it possible for a card to display an option but not actually allow it to be selected. It's up to the UI layer to decide how to display options that are not enabled. The option text should probably contiain a note on why the option cannot be selected...
2023-04-01 22:09:05 -07:00
Kistaro Windrider 45e1eeebf7
Play cards. 2023-04-01 21:18:48 -07:00
Kistaro Windrider 576a2dd69e
Implement drawing and running a turn. 2023-04-01 20:52:46 -07:00
Kistaro Windrider a6b2c92f86
Comment and reorganize Player. 2023-04-01 20:04:20 -07:00
Kistaro Windrider 75de281cee
Refactor Strip (already).
Stripping cards from the Hand will also be useful, so I pulled the logic of Strip out into arrayutil (more efficiently, too) and rewrote deck.Strip to use it.
2023-04-01 19:40:28 -07:00
Kistaro Windrider 222d4375ee
deck.Strip -- remove cards
Given a function that identifies cards to remove, remove them from the deck. This can be used to find and strip out cards that are only conditionally appropriate (and aren't appropriate anymore).
2023-04-01 19:31:50 -07:00
Kistaro Windrider b806264154
Fraction-specified shufflers.
Convenience methods for "shuffle the bottom third of the deck" and stuff like that.
2023-04-01 19:23:14 -07:00
Kistaro Windrider b8c0e5603a
Add a general shuffler and deck shuffling. 2023-04-01 19:13:42 -07:00
Kistaro Windrider 20561c574c
sliceutil: helpers for mid-slice insert/delete.
Manipulating the hand, deck, etc. is going to use these operations a lot.
2023-04-01 18:49:06 -07:00
Kistaro Windrider 99e9e35b1d
Card.Drawn, to give cards a chance to not show up
A card can be shuffled into the deck because of a certain condition, and then that condition could cease to apply. If the card should not be presented to the player, it gets one last chance to hide.

There is currently no direct mechanism for making a card _already in the hand_ disappear if it is not relevant, although there are various ways to implement a Rule to do this.
2023-04-01 18:05:57 -07:00
Kistaro Windrider fd35090b34
Generics tutorial on Rule 2023-04-01 17:56:31 -07:00
Kistaro Windrider d569e77fc9
Fix InsertRandomRange warnings.
I was using the wrong format string.
2023-04-01 14:39:56 -07:00
Kistaro Windrider bcfd42970b
BasicStatsPanel
Implement a stats panel with a name, intro text, and a rule for how to pull stats out of a collection.
2023-04-01 14:38:45 -07:00
Kistaro Windrider b324a39918
Explain generic types and add DebugLevel to Player
This simulation engine is intended for people who are interested in game design, not computer programming -- the engine wants to do all the engine stuff so the simulation can be implemented with less familiarity with the language. Generics, however, are not widely regarded as a "new programmer" thing -- even though they're surprisingly familiar, in the end  (slice-of-T, map-from-K-to-V). So a long comment explaining a bit about what's going on seems warranted.
2023-04-01 13:32:25 -07:00
Kistaro Windrider 7f8dcd63d6
Introduce InfoPanel.
InfoPanels are information displays that do not cost actions. One of them (the Prompt) is shown at the main menu; others can be made available as options in the menu, ether on an ongoing basis or for the current/next turn only.
2023-04-01 12:30:39 -07:00