bcdice/BCDice

View on GitHub
lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb

Summary

Maintainability
A
2 hrs
Test Coverage
A
92%

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        functionTable = [
          [1, lambda { mk_technic_decide_table(d1) }],
          [2, lambda { mk_national_style_decide_table(d1) }],
          [3, lambda { mk_resource_decide_table(d1) }],
          [4, lambda { mk_facility_decide_table(d1) }],
Severity: Minor
Found in lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb and 1 other location - About 40 mins to fix
lib/bcdice/game_system/meikyu_kingdom/landscape_table.rb on lines 18..25

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 38.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 13 locations. Consider refactoring.
Open

      def mk_human_resources_decide_table(num)
        table = [
          [1, "あなたの国には、高い見識を持つ知識人がいる。「才覚系生まれ表」でランダムにジョブ1種を選ぶ。そのジョブの逸材を1人獲得する。逸材の名前を決定すること。"],
          [2, "あなたの国には、皆を魅了する好人物がいる。「魅了系生まれ表」でランダムにジョブ1種を選ぶ。そのジョブの逸材を1人獲得する。逸材の名前を決定すること。"],
          [3, "あなたの国には、巧みな技術を持つ専門家がいる。「探索系生まれ表」でランダムにジョブ1種を選ぶ。そのジョブの逸材を1人獲得する。逸材の名前を決定すること。"],
Severity: Major
Found in lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb and 12 other locations - About 15 mins to fix
lib/bcdice/game_system/BarnaKronika.rb on lines 174..184
lib/bcdice/game_system/meikyu_kingdom/tables.rb on lines 467..477
lib/bcdice/game_system/meikyu_kingdom/tables.rb on lines 481..491
lib/bcdice/game_system/meikyu_kingdom/tables.rb on lines 495..505
lib/bcdice/game_system/meikyu_kingdom/tables.rb on lines 509..519
lib/bcdice/game_system/meikyu_kingdom/tables.rb on lines 523..533
lib/bcdice/game_system/meikyu_kingdom/tables.rb on lines 537..547
lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb on lines 108..117
lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb on lines 121..130
lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb on lines 134..143
lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb on lines 147..156
lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb on lines 173..182

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 26.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 13 locations. Consider refactoring.
Open

      def mk_technic_decide_table(num)
        table = [
          [1, "あなたの国は、魔法の研究、開発に力をそそぐ魔道国家である。その国のキャラクターは、星術、召喚、科学スキルの判定を行うとき、その達成値が1点上昇する(最大3点まで上昇する。4回目以降は振り直すこと)。"],
          [2, "あなたの国は、神話的遺物の逸話が残っている。レア一般アイテムの中からランダムに1種を選ぶ。そのレアアイテムのレシピを持っている。【王宮】のある部屋に、そのレア一般アイテムの名前を記入すること。"],
          [3, "あなたの国は、英雄が用いた武具の伝説が残っている。レア武具アイテムの中からランダムに1種を選ぶ。そのレアアイテムのレシピを持っている。【王宮】のある部屋に、そのレア武具アイテムの名前を記入すること。"],
Severity: Major
Found in lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb and 12 other locations - About 15 mins to fix
lib/bcdice/game_system/BarnaKronika.rb on lines 174..184
lib/bcdice/game_system/meikyu_kingdom/tables.rb on lines 467..477
lib/bcdice/game_system/meikyu_kingdom/tables.rb on lines 481..491
lib/bcdice/game_system/meikyu_kingdom/tables.rb on lines 495..505
lib/bcdice/game_system/meikyu_kingdom/tables.rb on lines 509..519
lib/bcdice/game_system/meikyu_kingdom/tables.rb on lines 523..533
lib/bcdice/game_system/meikyu_kingdom/tables.rb on lines 537..547
lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb on lines 121..130
lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb on lines 134..143
lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb on lines 147..156
lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb on lines 160..169
lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb on lines 173..182

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 26.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 13 locations. Consider refactoring.
Open

      def mk_blood_decide_table(num)
        table = [
          [1, "あなたの国は、鬼族の蹂躙を受けた歴史を持ち、混血が進んでいる。その国のキャラクターは新たにスキルを修得するとき、鬼族カテゴリの自分のレベル以下のモンスターが修得しているモンスタースキルの中から、修得するスキルを選ぶことができるようになる。"],
          [2, "あなたの国は、古代に迷宮から姿を消した妖精女王の末裔といわれている。その国のキャラクターは新たにスキルを修得するとき、妖精カテゴリの自分のレベル以下のモンスターが修得しているモンスタースキルの中から、修得するスキルを選ぶことができるようになる。"],
          [3, "あなたの国は、偉大なる古龍が迷宮と化した場所であり、その尊い血を引いているといわれる。その国のキャラクターは新たにスキルを修得するとき、魔獣カテゴリの自分のレベル以下のモンスターが修得しているモンスタースキルの中から、修得するスキルを選ぶことができるようになる。"],
Severity: Major
Found in lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb and 12 other locations - About 15 mins to fix
lib/bcdice/game_system/BarnaKronika.rb on lines 174..184
lib/bcdice/game_system/meikyu_kingdom/tables.rb on lines 467..477
lib/bcdice/game_system/meikyu_kingdom/tables.rb on lines 481..491
lib/bcdice/game_system/meikyu_kingdom/tables.rb on lines 495..505
lib/bcdice/game_system/meikyu_kingdom/tables.rb on lines 509..519
lib/bcdice/game_system/meikyu_kingdom/tables.rb on lines 523..533
lib/bcdice/game_system/meikyu_kingdom/tables.rb on lines 537..547
lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb on lines 108..117
lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb on lines 121..130
lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb on lines 134..143
lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb on lines 147..156
lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb on lines 160..169

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 26.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 13 locations. Consider refactoring.
Open

      def mk_national_style_decide_table(num)
        table = [
          [1, "あなたの国は、古くからあり、伝統を重んじる気風を持つ。宮廷系施設を建設・発展するための価格が1MG軽減される(最大2MGまで軽減される。3回目以降は振り直すこと)。"],
          [2, "あなたの国は、広い国土と高い天井に恵まれている。居住系施設を建設するための価格が1MG軽減される(最大2MGまで軽減される。3回目以降は振り直すこと)。"],
          [3, "あなたの国は、夏星が豊富で、作物がたくさん収穫できる。生産系施設を建設・発展するための価格が1MG軽減される。(最大2MGまで軽減される。3回目以降は振り直すこと)。"],
Severity: Major
Found in lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb and 12 other locations - About 15 mins to fix
lib/bcdice/game_system/BarnaKronika.rb on lines 174..184
lib/bcdice/game_system/meikyu_kingdom/tables.rb on lines 467..477
lib/bcdice/game_system/meikyu_kingdom/tables.rb on lines 481..491
lib/bcdice/game_system/meikyu_kingdom/tables.rb on lines 495..505
lib/bcdice/game_system/meikyu_kingdom/tables.rb on lines 509..519
lib/bcdice/game_system/meikyu_kingdom/tables.rb on lines 523..533
lib/bcdice/game_system/meikyu_kingdom/tables.rb on lines 537..547
lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb on lines 108..117
lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb on lines 134..143
lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb on lines 147..156
lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb on lines 160..169
lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb on lines 173..182

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 26.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 13 locations. Consider refactoring.
Open

      def mk_facility_decide_table(num)
        table = [
          [1, "あなたの国は、その地方を代々統治する伝統ある王国だ。宮廷系施設の中からランダムに1種を選ぶ。自国にその施設を1件建設する。"],
          [2, "あなたの国は、交易路の周囲にあり、多くの人々が流入する。居住系施設の中からランダムに1種を選ぶ。自国にその施設を1件建設する。"],
          [3, "あなたの国は、職人気質のものが多く、物作りがさかんだ。生産系施設の中からランダムに1種を選ぶ。自国にその施設を1件建設する。"],
Severity: Major
Found in lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb and 12 other locations - About 15 mins to fix
lib/bcdice/game_system/BarnaKronika.rb on lines 174..184
lib/bcdice/game_system/meikyu_kingdom/tables.rb on lines 467..477
lib/bcdice/game_system/meikyu_kingdom/tables.rb on lines 481..491
lib/bcdice/game_system/meikyu_kingdom/tables.rb on lines 495..505
lib/bcdice/game_system/meikyu_kingdom/tables.rb on lines 509..519
lib/bcdice/game_system/meikyu_kingdom/tables.rb on lines 523..533
lib/bcdice/game_system/meikyu_kingdom/tables.rb on lines 537..547
lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb on lines 108..117
lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb on lines 121..130
lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb on lines 134..143
lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb on lines 160..169
lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb on lines 173..182

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 26.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 13 locations. Consider refactoring.
Open

      def mk_resource_decide_table(num)
        table = [
          [1, "あなたの国は、過去に善政がしかれ、非常に安定している。セッション開始時の《民の声》の値が1点上昇する(最大3点まで上昇する。4回目以降は振り直すこと)。"],
          [2, "あなたの国は、天然の要害に囲まれており、外敵に襲われにくい。《民》が(2D6)人増加する。"],
          [3, "あなたの国には、名工がつくった武器がある。ランダムに選んだ武具アイテム1個を獲得する。その武具アイテムはレベル1として扱う。"],
Severity: Major
Found in lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb and 12 other locations - About 15 mins to fix
lib/bcdice/game_system/BarnaKronika.rb on lines 174..184
lib/bcdice/game_system/meikyu_kingdom/tables.rb on lines 467..477
lib/bcdice/game_system/meikyu_kingdom/tables.rb on lines 481..491
lib/bcdice/game_system/meikyu_kingdom/tables.rb on lines 495..505
lib/bcdice/game_system/meikyu_kingdom/tables.rb on lines 509..519
lib/bcdice/game_system/meikyu_kingdom/tables.rb on lines 523..533
lib/bcdice/game_system/meikyu_kingdom/tables.rb on lines 537..547
lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb on lines 108..117
lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb on lines 121..130
lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb on lines 147..156
lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb on lines 160..169
lib/bcdice/game_system/meikyu_kingdom_basic/kingdom_table.rb on lines 173..182

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 26.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

There are no issues that match your filters.

Category
Status