| 1 | package Acme::CoC::Util; | ||||||||||
| 2 | 3 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 3 | ▶ | use utf8; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 3 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 3 | ▶ | use parent qw/Exporter/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 3 | ▶ | use Smart::Args; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 3 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 3 | our @EXPORT = qw/ | |||||||||
| 11 | eq_any | ||||||||||
| 12 | is_ccb | ||||||||||
| 13 | get_target | ||||||||||
| 14 | is_extream | ||||||||||
| 15 | is_hard | ||||||||||
| 16 | is_failed | ||||||||||
| 17 | /; | ||||||||||
| 18 | |||||||||||
| 19 | 4 | ▶ | sub eq_any { | ||||||||
|
Subroutine
eq_any: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||
| 20 | 4 | my ($target, $array) = @_; | |||||||||
| 21 | 4 | for my $item (@{ $array }) { | |||||||||
| 22 | 10 | ▶ | return 1 if $target eq $item; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | } | ||||||||||
| 24 | } | ||||||||||
| 25 | |||||||||||
| 26 | 12 | ▶ | sub is_ccb { | ||||||||
|
Subroutine
is_ccb: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 27 | 12 | my ($command) = @_; | |||||||||
| 28 | 12 | return $command =~ /skill|ccb|cc/; | |||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | 7 | ▶ | sub get_target { | ||||||||
|
Subroutine
get_target: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 32 | 7 | my ($command) = @_; | |||||||||
| 33 | 7 | $command =~ /(cc|ccb) ([1-9][0-9]*)/; | |||||||||
| 34 | 7 | return $2; | |||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | 5 | ▶ | sub is_extream { | ||||||||
|
Subroutine
is_extream: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 38 | 5 | my ($dice, $target) = @_; | |||||||||
| 39 | 5 | my $rate = sprintf("%.5g", ($dice / $target)); | |||||||||
| 40 | 5 | return $rate <= 0.20000; | |||||||||
| 41 | } | ||||||||||
| 42 | |||||||||||
| 43 | 5 | ▶ | sub is_hard { | ||||||||
|
Subroutine
is_hard: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 44 | 5 | my ($dice, $target) = @_; | |||||||||
| 45 | 5 | my $rate = sprintf("%.5g", ($dice / $target)); | |||||||||
| 46 | 5 | return $rate <= 0.50000; | |||||||||
| 47 | } | ||||||||||
| 48 | |||||||||||
| 49 | 4 | ▶ | sub is_failed { | ||||||||
|
Subroutine
is_failed: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 50 | 4 | my ($dice, $target) = @_; | |||||||||
| 51 | 4 | return $dice > $target; | |||||||||
| 52 | } | ||||||||||
| 53 | |||||||||||
| 54 | 3 | 1; | |||||||||