Coder Social home page Coder Social logo

edge's Introduction

Edge

Setup instructions

You can roll by calling Edge.Dice.roll_dicepool() with something like the following: Edge.Dice.roll_dicepool(%Edge.Dice.DicePool{boost: 5, difficulty: 1, ability: 3, proficiency: 3, challenge: 1}) That may spit out an Edge.Dice.DicePool that looks like this:

%Edge.Dice.DicePool{
  sender: "Game Master",
  boost: 0,
  setback: 0,
  ability: 0,
  difficulty: 0,
  proficiency: 0,
  challenge: 0,
  force: 0,
  success: 3,
  failure: 0,
  advantage: 2,
  threat: 0,
  triumph: 1,
  despair: 1,
  light: 0,
  dark: 0
}

You can pipe an Edge.Dice.DicePool into the Edge.Dice.generate_string(dicepool) function to receive a tuple of {%DicePool, result_string}. This could look like the following:

Edge.Dice.roll_dicepool(%Edge.Dice.DicePool{boost: 5, difficulty: 1, ability: 3, proficiency: 3, challenge: 1}) |> Edge.Dice.generate_string()

{%Edge.Dice.DicePool{
   sender: "Game Master",
   boost: 0,
   setback: 0,
   ability: 0,
   difficulty: 0,
   proficiency: 0,
   challenge: 0,
   force: 0,
   success: 2,
   failure: 0,
   advantage: 11,
   threat: 0,
   triumph: 1,
   despair: 0,
   light: 0,
   dark: 0
 }, "Game Master has rolled 2 successes, 11 advantages and a triumph!"}

A clean way to capture the results is to receive the tuple from the generate_string function like so: {%Edge.Dice.DicePool{} = dicepool, result_string} = Edge.Dice.roll_dicepool(%Edge.Dice.DicePool{}) |> Edge.Dice.generate_string() Using that method will let us have quicker access to the values of the struct like dicepool.success, dicepool.triumph etc.

Important to note that dice are 'washed'- That is, if you generate 1 success and 1 failure, they will both cancel each other out and end up at 0- A failed roll. Same goes for advantage and disadvantage. Additionally, the dicepool that you pass to the Edge.Dice.roll_dicepool function works by rolling the dice and removing it from the dice pool. Seeing all of your dice in the result as 0 is normal, as that means they have been rolled.

If we made a dice pool like %Edge.Dice.DicePool{ability: 1, failure: 500} you would fail the roll all the time, because after the ability dice is rolled, you may still have 498 leftover failures from the modified roll. These may be from talents or (if you're like me and you like to fudge rolls a little) from environmental conditions.

Installation

You can install this dice roller by adding this git repo to your deps section.

def deps do
  [
    {:edge, git: "https://github.com/veliandev/edge.git"}
  ]
end

edge's People

Contributors

fatiguedev avatar

Stargazers

Adrian-Paul Carrières avatar

Watchers

 avatar

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.