#!/usr/bin/perl use strict; use File::Find::Iterator; use Encode; my $self = 'unk-'; # 自キャラの名前 my $number = 2; # ログの番号 my %t; map { $t{$_} = 0 } qw(total physical physical_damage physical_avg physical_miss spell_low spell_low_damage spell_low_avg spell_mid spell_mid_damage spell_mid_avg spell_high spell_high_damage spell_high_avg spell_miss miss_the_mark physical_avoid penetrate penetrate_damage penetrate_avoid penetrate_rate penetrate_damage_avg penetrate_avoid_avg evasion_rate total_evasion_rate); my $files = File::Find::Iterator->create(dir => ["./"], filter => \&islog); sub islog { /mlog_\d\d_\d\d_\d\d_$number.txt$/ } while (my $f = $files->next) { open(FILE, $f); while () { Encode::from_to($_, 'shiftjis', 'utf8'); next unless /(Bisque Trooper|Elgadin Trooper)→$self/; $t{total}++; if (/魔法攻撃ミス/) { $t{spell_miss}++; } elsif (/攻撃ミス/) { $t{physical_miss}++; } elsif (/ミス ザ マーク/) { $t{miss_the_mark}++; } elsif (/ダメージ回避$/) { $t{physical_avoid}++; } elsif (/(\d+) ダメージ((\d+) ダメージ回避)/) { $t{penetrate}++; $t{penetrate_damage} += $1; $t{penetrate_avoid} += $2; } elsif (/魔法攻撃 (\d+) ダメージ/) { if ($1 < 30) { $t{spell_low}++; $t{spell_low_damage} += $1; } elsif ($1 < 60) { $t{spell_mid}++; $t{spell_mid_damage} += $1; } else { $t{spell_high}++; $t{spell_high_damage} += $1; } } elsif (/(\d+) ダメージ/) { $t{physical}++; $t{physical_damage} += $1; } } close FILE; } $t{physical_avg} = int($t{physical_damage} / $t{physical}) if $t{physical}; $t{spell_low_avg} = int($t{spell_low_damage} / $t{spell_low}) if $t{spell_low}; $t{spell_mid_avg} = int($t{spell_mid_damage} / $t{spell_mid}) if $t{spell_mid}; $t{spell_high_avg} = int($t{spell_high_damage} / $t{spell_high}) if $t{spell_high}; $t{penetrate_damage_avg} = int($t{penetrate_damage} / $t{penetrate}) if $t{penetrate}; $t{penetrate_avoid_avg} = int($t{penetrate_avoid} / $t{penetrate}) if $t{penetrate}; $t{penetrate_rate} = int($t{penetrate} * 100 / ($t{penetrate} + $t{physical_avoid})) if $t{penetrate} + $t{physical_avoid}; $t{evasion_rate} = int($t{physical_miss} * 100 / ($t{physical} + $t{physical_miss})) if $t{physical} + $t{physical_miss}; my $total_evasion = $t{physical_miss} + $t{physical_avoid} + $t{penetrate}; $t{total_evasion_rate} = int($total_evasion * 100 / ($total_evasion + $t{physical})) if $total_evasion + $t{physical}; print << "OUT"; physical hit $t{physical} avg $t{physical_avg} miss $t{physical_miss} evasion rate $t{evasion_rate}% miss the mark $t{miss_the_mark} shielded avoid $t{physical_avoid} penetrate $t{penetrate} (avg $t{penetrate_damage_avg} damage $t{penetrate_avoid_avg} avoid) penetrate rate $t{penetrate_rate}% spell hit (~29) $t{spell_low} avg $t{spell_low_avg} hit (30~59) $t{spell_mid} avg $t{spell_mid_avg} hit (60~) $t{spell_high} avg $t{spell_high_avg} miss $t{spell_miss} total evasion rate $t{total_evasion_rate}% OUT exit;