Nyhilo / Duck-Disciple-Bot

A bot for adding helpful tools to the Infinite Nomic discord
http://nomic.gay
MIT License
3 stars 2 forks source link

Add capability to roll on loot tables #5

Closed Nyhilo closed 2 years ago

Nyhilo commented 3 years ago

Suggested implementation:

Keep a page on the wiki with existing loot tables with a defined syntax. I.e.:

{|
! roll || result
| 1    || thing 1
| 2    || thing 1
| 3    || thing 2
...
| n    | [whatever]
|}

The name of the table should be denoted by a comma-separated list in the heading for the table, ie:

## Colour, color

(names are case-insensitive)

Syntax for rolling on the table should be &loot <table name>, i.e.:

&loot color

Issues

The primary issue this would present is that people forget to update the page. I suggest two solutions to this:

  1. If possible, instead of keeping the values on a separate wiki page, add a data-attribute to the tables in the ruleset itself and see if we can hook into those. i.e.:
    {| data-name="colour,color"
    ! roll || result
    | 1    || thing 1
    | 2    || thing 1
    | 3    || thing 2
    |}
  2. Failing that, return a last-revision value in the response from the bot. i.e.:
    This table was last revised at 00:00, 2021/04/01
    Your color is `Red`

    This will require figuring out how to get that revisal info however.

Nyhilo commented 2 years ago

This is now planned to be implemented as a weighted &pool command.

An example for the Community Garden growth table:

Watering:

To determine the plant's growth, any person may randomly select an entry from the following Growth Pool.
# Entries | Result
        6 | Nothing Happens
        1 | The plant becomes eligible for a development roll today. 
        2 | The trunk grows 1 centimeter.
        2 | The trunk sprouts 1 new leaf at its current height.
        0 | If the trunk has not grown a bud within 5 centimeters of
            its current height, the trunk grows a new bud at its
            current height. Otherwise, the trunk sprouts 1 new leaf 
            at its current height.

Admiration:

When admiring the plant, the Admirer may select a result from the Growth Pool. If the plant has been admired at least once previously during a day it attempts to grow, add 2 entries of the first selected result to the pool for that attempt.

The bot can hold a saved table in its memory that anyone could edit.

&pool info growth would list something similar to what I put in the codeblock above &pool add growth "some string" # would add # entries with "some string" to the table. If it matches an existing string, then it adds to that result's entry count. &pool remove growth "some string" # does the opposite &pool roll growth selects an entry at random from the table &pool roll growth "some string" # adds # entries, default 1, of "some string" to the pool before rolling, but just for that roll.

Nyhilo commented 2 years ago

Documenting two more commands here:

&pool create <tablename> [global] - Create a new table in the current sever, the bot admin can optionally make it globally available &pool remove <tablename> - Remove a table in the current server. Only the bot admin can remove global tables

Nyhilo commented 2 years ago

The base implementation of this feature is done :D