Skip to content
This repository has been archived by the owner on Oct 16, 2019. It is now read-only.

Commit

Permalink
得点計算(簡易版)の実装と適当に麻雀の役を吐く本日の麻雀役機能の追加
Browse files Browse the repository at this point in the history
  • Loading branch information
ryosan-470 committed Jun 13, 2015
1 parent 5f8e79a commit 9115f08
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 7 deletions.
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,22 @@ gochiusa-bot is "Is the order a rabbit?" BOT.

(Inspired by [Makibot](https://github.com/sanographix/makibot))

## How to contribute

1. [Fork](https://github.com/jtwp470/gochiusa-bot/fork) this repository.
2. Check other pull request because we don't accept a redudant request.
3. Push and submit your pull request.

## Feature

* ごちうさというフレーズに反応してアニメ画像をランダムで吐きます.
* chino / @chino でチノちゃんがランダムでつぶやきます.
* `$`で囲まれた部分をLaTeXと認識して数式を画像化したものを返します.
* 麻雀点数計算機能
* `point 10 han`とかで点数を返します.[実装途中]

## 機能追加
基本的には`scripts/hoge.coffee`にCoffeeScriptで拡張機能を書きます.面白い機能やほしい機能があれば是非プルリクエストやIssueを立てていただけると幸いです.

## How to contribute

1. [Fork](https://github.com/jtwp470/gochiusa-bot/fork) this repository.
2. Check other pull request because we don't accept a redudant request.
3. Push and submit your pull request. (Plz submit your code to accept CI test.)

## License
MIT
MIT License
62 changes: 62 additions & 0 deletions scripts/mahjong.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Description:
# 麻雀
#
# Commands:
# :mahjong / 麻雀 という言葉に反応して役を返します.
# :point %d han / という言葉で得点計算をします
hands = [
":2so: :2so: :3so: :3so: :4so: :4so: :6so: :6so: :6so: :8so: :8so: :hai-hatsu: :hai-hatsu: :hai-hatsu:",
":1man: :1man: :1man: :2man: :2man: :2man: :5so: :6so: :7so: :hai-ton: :hai-ton: :hai-ton: :hai-nan: :hai-nan:",
":1pin: :1pin: :1pin: :1so: :2so: :3so: :4pin: :5pin: :6pin: :hai-nan::hai-nan::hai-nan: :hai-sha::hai-sha:",
":9man: :1pin: :9pin: :1so: :9so: :hai-haku: :hai-hatsu: :hai-chun: :hai-ton: :hai-nan: :hai-sha: :hai-pei:",
":1man: :9man: :1pin: :9pin: :1so: :9so: :hai-haku: :hai-hatsu: :hai-chun: :hai-ton: :hai-nan: :hai-sha: :hai-pei:",
":1man: :9man: :1pin: :9pin: :1so: :9so: :hai-haku: :hai-hatsu: :hai-chun: :hai-ton: :hai-nan: :hai-sha: :hai-pei:",
":1man: :9man: :1pin: :9pin: :1so: :9so: :hai-haku: :hai-hatsu: :hai-chun: :hai-ton: :hai-nan: :hai-sha: :hai-pei:",
":1man: :1man: :1pin: :1pin: :1pin: :1so: :1so: :1so: :9man: :9man: :9man: :9pin: :9pin:",
]

module.exports = (robot) ->
robot.hear /mahjong|麻雀|マージャン|まーじゃん/, (msg) ->
msg.send msg.random hands

robot.hear /point (\d+) han/, (msg) ->
han = parseInt(msg.match[1], 10)
parent_point = 0
children_point = 0

console.log han
switch han
when 1
children_point = 1000
when 2
children_point = 2000
when 3
children_point = 3300
when 4
children_point = 7700
when 5
children_point = 8000
when 6
children_point = 12000
when 7
children_point = 12000
when 8
children_point = 16000
when 9
children_point = 16000
when 10
children_point = 16000
when 11
children_point = 24000
when 12
children_point = 24000
when 13
children_point = 32000
else
children_point = 32000

parent_point = children_point * 1.5

parent_point = parent_point.toString()
children_point = children_point.toString()
msg.send "親は #{parent_point} 点. 子は #{children_point} 点です"

0 comments on commit 9115f08

Please sign in to comment.