GithubHelp home page GithubHelp logo

mrlegowatch / roleplayingcore Goto Github PK

View Code? Open in Web Editor NEW
32.0 4.0 5.0 318 KB

Role playing game core logic in the Swift language.

License: MIT License

Objective-C 0.20% Swift 99.80%
swift role-playing framework dice dice-rolls dnd dungeons-and-dragons character-sheet rpg

roleplayingcore's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

roleplayingcore's Issues

Implement a DiceRoll value type so that SimpleDice can also be a value type.

SimpleDice is a class (reference type) in order to avoid polluting the Dice protocol with a mutable roll() function, that is immutable for most clients. SimpleDice is different because it needs to store intermediate rolls in an Int array, in order to describe them (roll description). For example, "3d4" might produce a roll description of "(3 + 1 + 5)".

I propose changing the roll() function to return a DiceRoll value type, that holds both the result and the roll description, so that the SimpleDice can be a value type.

Pros:

  • all Dice implementations are value types

Cons:

  • the roll description isn't often required by clients, so represents wasted string "computation"
  • clients are now required to extract the result from the DiceRoll

DiceParser can't handle regular expressions of dice strings

The current requirement for DiceParser is to parse dice strings that are typically specified for hit points, with rolls, modifiers, dropping a throw, and compound dice (multiple dice sub-expressions). The building blocks are there, but the current parser implementation can't handle regular expressions beyond a single compound dice string (e.g., 3d6-2d4 works, but 3d6-2d4+1 does not).

Next steps:

  • Decide if a full parser is a requirement (what is the requested feature?)
  • Choose the smallest, simplest implementation of a full parser (e.g., leverage RegEx, stick to Foundation types, etc.)

UnitCurrency.baseUnit() requires initialization from load() otherwise it unwraps nil

UnitCurrency requires being initialized from load() in order to allow customization for domain-specific currency (D&D 'coinage', space/future 'credits', etc.), but this means that baseUnit() can't return an unwrapped default currency if load() hasn't been called yet. The first loaded currency with a 'default' property wins.

Ideas to consider:

  • provide a default unit currency (e.g., "gp") whose symbol etc. can be overridden thru load()
  • allow the last loaded currency with a 'default' property to win

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.