Git Product home page Git Product logo

bcdice-js's Introduction

!!DEPRECATED!!

Please use https://www.npmjs.com/package/bcdice

bcdice-js

npm package Build Status Coverage Status DevDependencies

BCDice for JavaScript (Browser/Node.js). Transpiled by Opal.

Examples

Usage

  1. Install

    $ npm install --save bcdice-js
  2. Import

    import BCDice from 'bcdice-js'; // ES Modules
    // or
    const BCDice = require('bcdice-js').BCDice; // CommonJS
  3. Preload dicebots (Only on the browser!!)

    import 'bcdice-js/lib/preload-dicebots';
    // or
    require('bcdice-js/lib/preload-dicebots');
    
  4. Create BCDice instance

    const bcdice = new BCDice();
  5. Set dicebot

    bcdice.setGameByTitle('SwordWorld2_0'); // Default: 'DiceBot'
  6. Set message and execute

    bcdice.setMessage('2d');
    console.log(bcdice.dice_command());

Contribution

License

MIT License

Changelog

CHANGELOG.md

bcdice-js's People

Contributors

esnya avatar ysakasin avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bcdice-js's Issues

SwordWorld2_5 サイコロ

こんにちは、bcdice-jsの使用者です。
このプロジェクトはとても便利だと思います。
しかし、node.jsに対するK40+24@8$12r10gfの結果は怪しい。
そして、ダイス目の修正は働いていないようです。
r10が含まれていると、結果は常に1です。
bcdice.setGameByTitle('SwordWorld2_5');
bcdice.setMessage('K20R10');
console.log('K20R10', bcdice.dice_command());

(初めの時がSwordWorldを使用したら大丈夫です
bcdice.setGameByTitle('SwordWorld');
bcdice.setMessage('K40+24@8$12r10gf ');
console.log('K40+24@8$12r10gf ', bcdice.dice_command());)

クトゥルフ神話TRPGの技能判定で大小比較できない

クトゥルフ神話TRPGにおいて技能判定でよく用いる cc<=80 のような大小比較ができない。

どどんとふやBCDice-APIではできているため、bcdice-js固有の問題だと思われる。ねこ卓でも同様の問題が発生している。

問題が起きるサンプルコード

const BCDice = require('bcdice-js').BCDice;

const bcdice = new BCDice();

bcdice.setGameByTitle('Cthulhu');
bcdice.setMessage('cc<=80');
console.log('cc<=80', bcdice.dice_command());

出力

cc<=80 [ ': (1D100) > 67', false ]

期待するダイス結果の例

(1D100<=80) > 71 > 成功

BCDice-APIの場合

https://bcdice.herokuapp.com/v1/diceroll?system=Cthulhu&command=cc%3C=80

参考情報

Cthulhu.rb における ccコマンドは、 1d100のエイリアスおよび追加機能になっている。この判定は Cthulhu#getCheckResultで行なっており、大小比較があるかの判断もこのメソッド内で行なっている。

大小比較の存在判断は正規表現を用いて行われているが、bcdice-js経由だと、これらの判定をすり抜けてしまっているように見える。
https://github.com/torgtaitai/BCDice/blob/e52a91ffe5ad7db35c651a18e0ffe8025be266f7/src/diceBot/Cthulhu.rb#L100

dx2 bug


5dx@7
クリティカル値が参照されない

5dx+2@7
クリティカル値は参照されるが 補正値が参照されない

5dx@7+2
クリティカル値、補正値 両方が参照されない

BCDice original test failures

テスト通らないもの一覧

[
      '_InsaneScp',
      'ArsMagica',
      'AceKillerGene',
      'BloodMoon',
      'Cthulhu7th',
      'Cthulhu7th_Korean',
      'DetatokoSaga',
      'DetatokoSaga_Korean',
      'Dracurouge',
      'Dracurouge_Korean',
      'EarthDawn3',
      'EarthDawn4',
      'EclipsePhase',
      'Elysion',
      'FilledWith',
      'GardenOrder',
      'GurpsFW',
      'IthaWenUa',
      'Kamigakari',
      'KillDeathBusiness',
      'KillDeathBusiness_Korean',
      'MagicaLogia',
      'MetalHeadExtream',
      'OneWayHeroics',
      'Oukahoushin3rd',
      'Peekaboo',
      'PlotTest',
      'Ryutama',
      'ShinMegamiTenseiKakuseihen',
      'Skynauts',
      'SwordWorld2_0',
      'SwordWorld2_5',
      'Warhammer',
      'None',
      'SevenFortressMobius',
      'NightWizard',
      'NightWizard3rd',
      'Postman',
      'StellarKnights',
]

SW_2_5 rolling fail

Hi, i am the user of bcdice-js.
Thank you for your project.
It is very useful.
But I have try K40+24@8$12r10gf on node.js
it just return 1
and ダイス目の修正 seem dont work.

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.