Created
November 12, 2024 12:12
-
-
Save noqisofon/e08d2ca940061ec12e75cd26d347c541 to your computer and use it in GitHub Desktop.
( ノ╹◡◡╹)ノ 生成されたキャラの名前を 6 から 12 個抜き出して、wiz なキャラ設定を付けてくかもしれない
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my @katakana-female-names = './katakana-female-names000.tsv'.IO.lines; | |
my @katakana-male-names = './katakana-male-names000.tsv'.IO.lines; | |
my @klasses = <戦士 盗賊 僧侶 魔法使い 侍 君主 司教>; | |
my @sexes = <男 女>; | |
my @alignment = <善 中立 悪>; | |
my @races = <人間 ドワーフ エルフ ホブ ノーム>; | |
my $generate-amount = (6..12).pick; | |
for zip(@klasses.roll($generate-amount), @sexes.roll($generate-amount), @alignment.roll($generate-amount), @races.roll($generate-amount)) -> [$klass, $sex, $alignment, $race] { | |
my $name = do given $sex { | |
when '女' { @katakana-female-names.pick; } | |
when '男' { @katakana-male-names.pick; } | |
}; | |
my %record = (name => $name, sex => $sex, alignment => $alignment, klass => $klass, race => $race); | |
# 盗賊のドワーフが生成された場合、実際には選べないため振り直す。 | |
if $klass ~~ '盗賊' and $race ~~ 'ドワーフ' { | |
%record<race> = @races.grep({ $_ !~~ $race }).pick; | |
} | |
# あるアライメントだと特定のクラスにつくことができないという制限がある。 | |
if $klass ~~ '盗賊' and $alignment ~~ '善' { | |
%record<alignment> = @alignment.grep({ $_ !~~ $alignment }).pick; | |
} | |
if $klass ~~ ('僧侶', '司教').one and $alignment ~~ '中立' { | |
%record<alignment> = @alignment.grep({ $_ !~~ $alignment }).pick; | |
} | |
if $klass ~~ '侍' and $alignment ~~ '悪' { | |
%record<alignment> = @alignment.grep({ $_ !~~ $alignment }).pick; | |
} | |
if $klass ~~ '君主' and $alignment ~~ ('中立', '悪') { | |
%record<alignment> = '善'; | |
} | |
if $klass ~~ '忍者' and $alignment ~~ ('善', '中立') { | |
%record<alignment> = '悪'; | |
} | |
say %record<name sex race alignment klass>.join(','); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment