Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions _core/lib/sw2/edit-chara-palette-option.pl
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ sub chatPaletteFormOptional {
</table>
<div class="add-del-button"><a onclick="addPaletteAttack()">▼</a><a onclick="delPaletteAttack()">▲</a></div>
@{[ ::input "paletteAttackNum","hidden" ]}
<ul class="annotate">
<li>
オプション名を<code>|</code>で区切って列記すると、すでに定義されている他のオプションを参照して組み合わせられます。<br>
その場合、組み合わせたオプションの修正値は、すべて空欄にしてください。<br>
(例: 名称に<code>魔力撃 | 全力攻撃Ⅱ</code>と記述すると、<code>魔力撃</code>という名称のオプションと<code>全力攻撃Ⅱ</code>という名称のオプションを組み合わせた効果になります)
</ul>
</details>
<details id="palette-magic" @{[ $pc{"paletteMagic1Name"} ? 'open' : '' ]}>
<summary class="header2">魔法の追加オプション</summary>
Expand Down
72 changes: 68 additions & 4 deletions _core/lib/sw2/palette-sub.pl
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,69 @@ sub palettePreset {
last;
}
}

# オプションの組み合わせの解決
{
my @fieldNames = ('Acc', 'Crit', 'Dmg', 'Roll');
my %options = ();

foreach my $paNum (1 .. $::pc{paletteAttackNum}) {
my $paName = $::pc{"paletteAttack${paNum}Name"};
next if $paName eq '';
next if $paName =~ /[||]/;
next unless grep { $::pc{"paletteAttack${paNum}${_}"} } @fieldNames;

my %option = ();
foreach my $fieldName (@fieldNames) {
next unless $::pc{"paletteAttack${paNum}${fieldName}"};
$option{$fieldName} = $::pc{"paletteAttack${paNum}${fieldName}"};
}

$options{$paName} = \%option;
}

foreach my $paNum (1 .. $::pc{paletteAttackNum}) {
my $paName = $::pc{"paletteAttack${paNum}Name"};
next if $paName eq '';
next unless $paName =~ /[||]/;
next if grep { $::pc{"paletteAttack${paNum}${_}"} } @fieldNames;

my %option = ();
$option{$_} = [] foreach @fieldNames;

foreach my $referenceName (split(/\s*[||]\s*/, $paName)) {
next unless $options{$referenceName};
my %referredOption = %{$options{$referenceName}};

foreach my $fieldName (keys %referredOption) {
my @list = @{$option{$fieldName}};
push(@list, $referredOption{$fieldName});
$option{$fieldName} = \@list;
}
}

foreach my $fieldName (@fieldNames) {
my @list = @{$option{$fieldName}};
next unless @list;

if ($fieldName ne 'Roll') {
$::pc{"paletteAttack${paNum}${fieldName}"} = join('+', @list);
}
else {
# 「出目修正」は単純な '+' での結合では済まないケースがある.

my $composed = $list[0];
if ($#list > 0) {
foreach (1..$#list) {
$composed .= '+' if $list[$_] =~ /^\d/;
$composed .= $list[$_];
}
}
$::pc{"paletteAttack${paNum}${fieldName}"} = $composed;
}
}
}
}

foreach (1 .. $::pc{weaponNum}){
next if $::pc{'weapon'.$_.'Acc'}.$::pc{'weapon'.$_.'Rate'}.
Expand Down Expand Up @@ -524,7 +587,9 @@ sub palettePreset {
$text .= "+{追加D修正}";
if($::pc{'paletteAttack'.$paNum.'Roll'}){
$::pc{'paletteAttack'.$paNum.'Roll'} =~ s/^+//;
$text .= "$+{クリレイ}\#$::pc{'paletteAttack'.$paNum.'Roll'}";
$text .= "$+{クリレイ}";
$text .= '#' if $::pc{'paletteAttack'.$paNum.'Roll'} =~ /^\d/;
$text .= $::pc{'paletteAttack'.$paNum.'Roll'};
}
else {
$text .= "{出目修正}";
Expand All @@ -535,8 +600,7 @@ sub palettePreset {
$text .= $bot{YTC} ? '首切' : $bot{BCD} ? 'r5' : '';
}
$text .= " ダメージ";
$text .= extractWeaponMarks($::pc{'weapon'.$_.'Name'}.$::pc{'weapon'.$_.'Note'}) unless $bot{BCD};
$text .= "/$::pc{'weapon'.$_.'Name'}$::pc{'weapon'.$_.'Usage'}" if $bot{BCD};
$text .= "/$::pc{'weapon'.$_.'Name'}@{[extractWeaponMarks($::pc{'weapon'.$_.'Note'})]}$::pc{'weapon'.$_.'Usage'}";
$text .= "(${partName})" if $partName && $bot{BCD};
$text .= "\n";
}
Expand Down Expand Up @@ -567,7 +631,7 @@ sub palettePreset {
if($dmgTexts{$paNum} eq $dmgTexts{$paNum - 1}){
$activeName = $::pc{'paletteAttack'.($paNum - 1).'Name'} ? "+$::pc{'paletteAttack'.($paNum - 1).'Name'}" : '';
}
$text .= $bot{BCD} ? ($dmgTexts{$paNum} =~ s/(\n)/$activeName$1/gr) : $dmgTexts{$paNum};
$text .= ($dmgTexts{$paNum} =~ s/(\n)/$activeName$1/gr);
$text .= "\n";
}
}
Expand Down