Skip to content

Commit 11698be

Browse files
committed
Add rules text to a bunch more mods
1 parent 0e244c5 commit 11698be

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+113
-24
lines changed

documentation/documentation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -646,8 +646,8 @@ Colors are specified as CSS color strings like `"#808080"` or `"lightblue"`. Exa
646646
- `["noop"]`: does nothing, but you can put it in `interruptible_actions` to make it an interrupt.
647647
- `["push_message", message]`: Sends a message to all players using the current player as a label. Example: `["push_message", "declared riichi"]`
648648
- `["push_system_message", message]`: Sends a message to all players, with no label. Example: `["push_system_message", "Converted each shuugi to 2000 points."]`
649-
- `["add_rule", title, text, priority]`: Adds the string `text` to the rules tab on the left. Keep it brief! `title` is a required string identifier that is also used for deleting this rule later -- you can also specify an existing identifier to append `text` to that rule. `priority` is an optional integer argument that defaults to `0` -- the rules on the rules list are sorted from highest priority to lowest.
650-
- `["update_rule", title, text, priority]`: Same as `"add_rule"`, but only appends text (does nothing if the rule `title` does not exist).
649+
- `["add_rule", title, text, sort_order]`: Adds the string `text` to the rules tab on the left. Keep it brief! `title` is a required string identifier that is also used for deleting this rule later -- you can also specify an existing identifier to append a `text` to that rule (on its own line). `sort_order` is an optional integer argument that defaults to `0` -- the rules on the rules list are sorted from lowest `sort_order` to highest.
650+
- `["update_rule", title, text, sort_order]`: Same as `"add_rule"`, but only appends `text` (does nothing if the rule `title` does not exist).
651651
- `["delete_rule", title]`: Deletes the rule text identified by `title`.
652652
- `["run", fn_name, {"arg1": "value1", ...}]`: Call the given function with the given arguments. A function is essentially a named list of actions. Functions are defined in the toplevel `"functions"` key -- see `riichi.json` for examples. Within a function you may write variables preceded with a dollar sign -- like `$arg1` -- and the value will be replaced with the corresponding `value1` in the (optional) given object. Functions can be called recursively, but this is rarely done, and therefore there is an arbitrary call stack limit of 10 calls.
653653
- `["draw", num, tile]`: Draw `num` tiles. If `tile` is specified, it draws that tile instead of from the wall. Instead of a tile for `tile` you may instead write `"opposite_end"` to draw from the opposite end of the wall (i.e. the dead wall, if one exists)

lib/riichi_advanced/game/game_state/actions.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -799,13 +799,13 @@ defmodule RiichiAdvanced.GameState.Actions do
799799
id = Enum.at(opts, 0, "")
800800
text = Enum.at(opts, 1, "")
801801
priority = Enum.at(opts, 2, nil)
802-
update_in(state.rules_text, &Map.update(&1, id, {text, if priority == nil do 0 else priority end}, fn {orig_text, orig_priority} -> {orig_text <> text, if priority == nil do orig_priority else priority end} end))
802+
update_in(state.rules_text, &Map.update(&1, id, {text, if priority == nil do 0 else priority end}, fn {orig_text, orig_priority} -> {orig_text <> "\n" <> text, if priority == nil do orig_priority else priority end} end))
803803
"update_rule" ->
804804
id = Enum.at(opts, 0, "")
805805
if Map.has_key?(state.rules_text, id) do
806806
text = Enum.at(opts, 1, "")
807807
priority = Enum.at(opts, 2, nil)
808-
update_in(state.rules_text, &Map.update!(&1, id, fn {orig_text, orig_priority} -> {orig_text <> text, if priority == nil do orig_priority else priority end} end))
808+
update_in(state.rules_text, &Map.update!(&1, id, fn {orig_text, orig_priority} -> {orig_text <> "\n" <> text, if priority == nil do orig_priority else priority end} end))
809809
else state end
810810
"delete_rule" ->
811811
id = Enum.at(opts, 0, "")

lib/riichi_advanced_web/views/game_live.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ defmodule RiichiAdvancedWeb.GameLive do
355355
<label for="rules-popover-checkbox">Rules</label>
356356
<div class="rules-popover-container" :if={not Enum.empty?(@state.rules_text)}>
357357
<div class="rules-popover">
358-
<%= for {title, {text, _priority}} <- Enum.sort_by(@state.rules_text, fn {title, {_text, priority}} -> {priority, title} end) do %>
358+
<%= for {title, {text, _priority}} <- Enum.sort_by(@state.rules_text, fn {_title, {text, priority}} -> {priority, String.length(text)} end) do %>
359359
<div class="rules-popover-rule">
360360
<div class="rules-popover-title"><%= title %></div>
361361
<div class="rules-popover-text"><%= text %></div>

priv/static/mods/agarirenchan.jq

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.after_initialization.actions += [
22
["add_rule", "Agarirenchan", "If the dealer (East wind) wins, the round repeats."],
3-
["update_rule", "Honba", " One honba stick is also added if the dealer (East wind) wins."]
3+
["update_rule", "Honba", "(Agarirenchan) One honba stick is also added if the dealer (East wind) wins."]
44
]
55
|
66
.score_calculation.agarirenchan = true

priv/static/mods/agariyame.jq

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
.after_initialization.actions += [["add_rule", "Agarirenchan", " Agariyame: An exception is if it's the last round and the winning dealer becomes first place -- then the game just ends."]]
1+
.after_initialization.actions += [["update_rule", "Agarirenchan", "(Agariyame) An exception is if it's the last round and the winning dealer becomes first place -- then the game just ends."]]
22
|
33
.agariyame = true

priv/static/mods/aka.jq

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ def replace_n_tiles($tile; $aka; $num):
99
else . end
1010
else . end;
1111

12+
.after_initialization.actions += [["add_rule", "Aka", "\($man)x 5m, \($pin)x 5p, and \($sou)x 5p are replaced with red \"aka dora\" fives that are worth one extra han each."]]
13+
|
1214
# replace 5m,5p,5s in wall with 0m,0p,0s
1315
.wall |= replace_n_tiles("5m"; "0m"; $man)
1416
|

priv/static/mods/ao.jq

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ def replace_n_tiles($tile; $aka; $num):
99
else . end
1010
else . end;
1111

12+
.after_initialization.actions += [["add_rule", "Ao", "\($man)x 5m, \($pin)x 5p, and \($sou)x 5p are replaced with blue \"ao dora\" fives that are worth two extra han each."]]
13+
|
1214
# replace 5m,5p,5s in wall with 25m,25p,25s
1315
.wall |= replace_n_tiles("5m"; "25m"; $man)
1416
|

priv/static/mods/aotenjou.jq

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.after_initialization.actions += [["add_rule", "Aotenjou", "Limit hands are removed. Scores are calculated with the standard han-fu formula: a standard nondealer ron is worth 4 * fu * 2^(2+han), rounded up to the nearest \(.score_calculation.han_fu_rounding_factor // 100)."]]
2+
|
13
.score_calculation.limit_thresholds = []
24
|
35
.score_e_notation = true

priv/static/mods/dora.jq

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.after_initialization.actions += [["add_rule", "Dora", "At the beginning of the game, \($start_indicators) dora indicators are revealed in the dead wall. The tile next in sequence to a dora indicator is considered dora, and each copy of dora in hand is worth 1 extra han."]]
2+
|
13
.max_revealed_tiles = 5
24
|
35
# initial dora flip

priv/static/mods/double_round_wind.jq

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.after_initialization.actions += [["add_rule", "Double Round Wind", "Opposing winds are also round winds. So in East round, West is also a round wind."]]
2+
|
13
.yaku += [{
24
"display_name": "Round Wind",
35
"value": 1,

0 commit comments

Comments
 (0)