| 1 | #!/usr/bin/env perl | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # Copyright (C) 2012-2023 Alex Schroeder <alex@gnu.org> | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # This program is free software: you can redistribute it and/or modify it under | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # the terms of the GNU General Public License as published by the Free Software | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # Foundation, either version 3 of the License, or (at your option) any later | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # version. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | # This program is distributed in the hope that it will be useful, but WITHOUT | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | # You should have received a copy of the GNU General Public License along with | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | # this program. If not, see <http://www.gnu.org/licenses/>. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | =encoding utf8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | =head1 NAME | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | Game::CharacterSheetGenerator - a web app to generate character sheets | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | =head1 DESCRIPTION | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | Character Sheet Generator is a web application that generates characters for the | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | Halberts & Helmets game. It does two things: it generates the stats for random | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | characters, and it populates a SVG file with those values. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | Here's an example of the stats generated: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | name: Diara | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | str: 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | dex: 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | con: 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | int: 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | wis: 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | cha: 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | level: 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | xp: 0 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | thac0: 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | class: halfling | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | hp: 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | ac: 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | property: backpack | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | property: rope | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | property: leather armour | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | property: silver dagger | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | property: sling | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | property: pouch with 30 stones | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | abilities: 1/6 for normal tasks | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | abilities: 2/6 to hide and sneak | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | abilities: 5/6 to hide and sneak outside | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | abilities: +1 for ranged weapons | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | abilities: AC -2 against giants | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | charsheet: Charactersheet-landscape-target20.svg | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | breath: 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | poison: 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | petrify: 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | wands: 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | spells: 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | Think of it as key value pairs. Some keys have multiple values, resulting in | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | multiline values. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | The SVG file acts as a template. For every key in the character, a C<text> | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | element with a matching id is searched and if found, C<tspan> elements matching | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | the value are inserted. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | The C<charsheet> key is special because it tells the app which file to load. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | On a technical level, Character Sheet Generator is a web app based on the | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | Mojolicious framework. This class in particular uses L<Mojolicious::Lite>. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | See L<Mojolicious::Guides> for more information. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | =cut | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | package Game::CharacterSheetGenerator; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 11 | our $VERSION = 1.04; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 11 | ▶ | use Modern::Perl; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 11 | ▶ | use Game::CharacterSheetGenerator::ElfNames qw(elf_name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 11 | ▶ | use Game::CharacterSheetGenerator::DwarfNames qw(dwarf_name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 11 | ▶ | use Game::CharacterSheetGenerator::HalflingNames qw(halfling_name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 11 | ▶ | use Game::CharacterSheetGenerator::HumanNames qw(human_name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 11 | ▶ | use Mojolicious::Lite; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 11 | ▶ | use Mojo::UserAgent; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 11 | ▶ | use Mojo::Log; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 11 | ▶ | use File::ShareDir "dist_dir"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 11 | ▶ | use I18N::AcceptLanguage; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 11 | ▶ | use XML::LibXML; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 11 | ▶ | use List::Util qw(first shuffle max); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 11 | ▶ | use POSIX qw(floor ceil); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 11 | ▶ | use Cwd; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 11 | ▶ | no warnings qw(uninitialized numeric); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | # Commands for the command line! | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 11 | push @{app->commands->namespaces}, "Game::CharacterSheetGenerator::Command"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | # Change scheme if "X-Forwarded-Proto" header is set (presumably to HTTPS) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 33 | ▶ | app->hook(before_dispatch => sub { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.2
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 33 | my $c = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 33 | ▶ | $c->req->url->base->scheme("https") | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 11 | if $c->req->headers->header("X-Forwarded-Proto") } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | =head2 Configuration | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | As a Mojolicious application, it will read a config file called | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | F<character-sheet-generator.conf> in the same directory, if it exists. As the | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | default log level is "debug", one use of the config file is to change the log | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | level using the C<loglevel> key, and if you're not running the server in a | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | terminal, using the C<logfile> key to set a file. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | The default map and table are stored in the F<contrib> directory. You can change | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | this directory using the C<contrib> key. By default, the directory included with | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | the distribution is used. Thus, if you're a developer, you probably want to use | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | something like the following to use the files from the source directory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | The code also needs to know where the Face Generator can be found, if at all. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | You can set the URL using the C<face_generator_url> key. If you're a developer | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | and have it running locally on port 3020, this is what you'd use: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | loglevel => "debug", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | logfile => undef, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | contrib => "share", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | face_generator_url => "http://localhost:3020", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | =cut | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 11 | plugin Config => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | default => { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | loglevel => "warn", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | logfile => undef, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | contrib => undef, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | file => getcwd() . "/character-sheet-generator.conf", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 11 | my $log = Mojo::Log->new; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 11 | $log->level(app->config("loglevel")); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 11 | $log->path(app->config("logfile")); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 11 | ▶ | $log->debug($log->path ? "Logfile is " . $log->path : "Logging to stderr"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 11 | ▶ | my $dist_dir = app->config("contrib") // dist_dir("Game-CharacterSheetGenerator"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
app()->config("contrib") // dist_dir("Game-CharacterSheetGenerator")
MC/DC0%0/2
app()->config("contrib") // dist_dir("Game-CharacterSheetGenerator")
app()->config("contrib")
dist_dir("Game-CharacterSheetGenerator")
Truth table33%1/3
A // B
A= app()->config("contrib")B= dist_dir("Game-CharacterSheetGenerator")
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 11 | $log->debug("Reading contrib files from $dist_dir"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 12 | ▶ | sub translations { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
translations: called CC=1 SCAR=0.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | # strings in sinqle quotes are translated into German if necessary | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | # use %0, %1, etc. for parameters | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 12 | my %translations = split(/\n/, q{%0 gold | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | %0 Gold | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | %0 silver | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | %0 Silber | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | %0: How much does this cost? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | %0: Wieviel kostet das? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | +1 bonus to ranged weapons | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | +1 für Fernwaffen | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | +4 to hit and double damage backstabbing | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | +4 und Schaden ×2 für hinterhältigen Angriff | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 1/6 for normal tasks | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 1/6 für normale Aufgaben | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 2/6 to find secret constructions and traps | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 2/6 um Geheimbauten und Fallen zu finden | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 2/6 to find secret or concealed doors | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 2/6 um geheime und versteckte Türen zu finden | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 2/6 to hear noise | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 2/6 um Geräusche zu hören | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 2/6 to hide and sneak | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 2/6 für Verstecken und Schleichen | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 5/6 to hide and sneak outdoors | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 5/6 für Verstecken und Schleichen im Freien | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | %d/6 for all activities | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | %d/6 für alle Aktivitäten | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | AC -2 vs. opponents larger than humans | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | Rüstung -2 bei Gegnern über Menschengrösse | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | Charactersheet-landscape-target20.svg | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | Charakterblatt-quer-target20.svg | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | Hireling-target20.svg | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | Mietling-target20.svg | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | Classes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | Klassen | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | Property | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | Eigentum | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | Spells: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | Zaubersprüche: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | Unknown Price | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | Unbekannter Preis | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | and | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | und | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | backpack | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | Rucksack | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | battle axe | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | Kriegsaxt | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | case with 30 bolts | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | Kiste mit 30 Bolzen | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | chain mail | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | Kettenhemd | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | charm person | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | Person bezaubern | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | club | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | Keule | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | crossbow | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | Armbrust | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | d6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | W6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | dagger | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | Dolch | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | detect magic | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | Magie entdecken | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | dwarf | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | Zwerg | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | elderly man | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | älterer Mann | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | elderly woman | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | ältere Frau | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | elf | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | Elf | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | fighter | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | Krieger | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | flask of oil | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | Ölflasche | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | floating disc | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | Schwebende Scheibe | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | halfling | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | Halbling | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | hand axe | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | Handaxt | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | helmet | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | Helm | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | dog | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | Hund | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | hireling | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | Mietling | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | porter | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | Träger | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | hold portal | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | Portal verschliessen | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 12 iron spikes and hammer | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 12 Eisenkeile und Hammer | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 3 stakes and hammer | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 3 Holzpfähle und Hammer | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | lantern | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | Laterne | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | leather armor | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | Lederrüstung | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | light | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | Licht | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | long bow | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | Langbogen | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | long sword | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | Langschwert | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | mace | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | Streitkeule | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | magic missile | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | Magisches Geschoss | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | magic-user | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | Magier | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | man | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | Mann | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | mirror | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | Spiegel | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | plate mail | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | Plattenpanzer | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | pole arm | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | Stangenwaffe | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | pouch with 30 stones | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | Beutel mit 30 Steinen | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | protection from evil | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | Schutz vor Bösem | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | quiver with 20 arrows | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | Köcher mit 20 Pfeilen | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | read languages | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | Sprachen lesen | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | read magic | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | Magie lesen | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | rope | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | Seil | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | shield | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | Schild | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | short bow | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | Kurzbogen | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | short sword | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | Kurzschwert | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | silver dagger | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | Silberner Dolch | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | sleep | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | Schlaf | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | sling | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | Schleuder | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | spear | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | Speer | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | spell book | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | Zauberbuch | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | staff | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | Stab | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | thief | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | Dieb | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | thieves’ tools | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | Diebeswerkzeug | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 6 torches | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 6 Fackeln | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | two handed sword | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | Zweihänder | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | ventriloquism | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | Bauchreden | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | war hammer | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | Kriegshammer | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | wolfsbane | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | Eisenhut (sog. Wolfsbann) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | garlic | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | Knoblauch | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | woman | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | Frau | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | pole | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | Stab | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | young man | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | junger Mann | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | young woman | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | junge Frau | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | rations (1 week) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | Wegzehrung (1 Woche) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 12 | return \%translations; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 11 | my $translation = translations(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 11 | our $lang; # we'll set it in random_parameters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 38713 | ▶ | sub T { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
T: called CC=5 SCAR=16.1
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 38713 | my ($en, @arg) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 38713 | my $suffix = ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | # handle (2) suffixes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 38713 | ▶ | if ($en =~ /(.*)( \(\d+\))$/) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 5 | $en = $1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 5 | $suffix = $2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 38713 | ▶ | if ($translation->{$en} and $lang eq "de") { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$translation->{$en} and $Game::CharacterSheetGenerator::lang eq "de"
MC/DC100%2/2
$translation->{$en} and $Game::CharacterSheetGenerator::lang eq "de"
$translation->{$en}
$Game::CharacterSheetGenerator::lang eq "de"
Truth table100%3/3
A and B
A= $translation->{$en}B= $Game::CharacterSheetGenerator::lang eq "de"
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 19071 | $en = $translation->{$en}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | # utf8::encode($en); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 38713 | ▶ | for (my $i = 0; $i < scalar @arg; $i++) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 275 | my $s = $arg[$i]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 275 | $en =~ s/%$i/$s/g; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 38713 | return $en . $suffix; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 13 | ▶ | sub svg_read { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
svg_read: called CC=4 SCAR=16.8
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 13 | my ($char) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 13 | ▶ | my $filename = $char->{charsheet} || 'Charactersheet-landscape-target20.svg'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$char->{'charsheet'} || 'Charactersheet-landscape-target20.svg'
MC/DC100%1/1
$char->{'charsheet'} || 'Charactersheet-landscape-target20.svg'
$char->{'charsheet'}
Truth table100%2/2
A
A= $char->{'charsheet'}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 13 | my $doc; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 13 | ▶ | if (-f "$dist_dir/$filename") { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 13 | $doc = XML::LibXML->load_xml(location => "$dist_dir/$filename"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | } else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | my $ua = Mojo::UserAgent->new; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | my $tx = $ua->get($filename); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | ▶ | die "«$filename»: " . $tx->res->error->{message} . "\n" unless $tx->res->is_success; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | $doc = XML::LibXML->load_xml(string => $tx->res->body); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 13 | return ($char, $doc); # used as parameters for svg_transform | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 313 | ▶ | sub replace_text { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
replace_text: called CC=11 SCAR=27.4
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 313 | my ($parser, $node, $str) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 313 | my @line = split(/\\\\/, $str); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | # is this multiline in the template | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | # (ignore text nodes, go for tspans only) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 313 | my $dy; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 313 | my $tspans = $node->find(qq{svg:tspan}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 313 | ▶ | if ($tspans->size() > 1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 15 | $dy = $tspans->get_node(2)->getAttribute("y") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | - $tspans->get_node(1)->getAttribute("y"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | } else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | # mismatch, attempt readable compromise | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 298 | @line = (join(", ", @line)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | # delete the tspan nodes of the text node | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 313 | $node->removeChildNodes(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 313 | my $tspan = XML::LibXML::Element->new("tspan"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 313 | $tspan->setAttribute("x", $node->getAttribute("x")); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 313 | $tspan->setAttribute("y", $node->getAttribute("y")); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 313 | ▶ | while (@line) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 402 | my $line = shift(@line); # cannot have this in while cond because of "0" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 402 | ▶ | next if $line eq ''; # cannot parse empty strings | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 367 | my $fragment = $parser->parse_balanced_chunk(T($line)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 367 | foreach my $child ($fragment->childNodes) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 367 | my $tag = $child->nodeName; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 367 | ▶ | if ($tag eq "strong" or $tag eq "b") { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition33%1/3
$tag eq "strong" or $tag eq "b"
MC/DC0%0/2
$tag eq "strong" or $tag eq "b"
$tag eq "strong"
$tag eq "b"
Truth table33%1/3
A or B
A= $tag eq "strong"B= $tag eq "b"
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | my $node = XML::LibXML::Element->new("tspan"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | $node->setAttribute("style", "font-weight:bold"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | $node->appendText($child->textContent); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | $tspan->appendChild($node); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | ▶ | } elsif ($tag eq "em" or $tag eq "i") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$tag eq "em" or $tag eq "i"
MC/DC0%0/2
$tag eq "em" or $tag eq "i"
$tag eq "em"
$tag eq "i"
Truth table33%1/3
A or B
A= $tag eq "em"B= $tag eq "i"
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | my $node = XML::LibXML::Element->new("tspan"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | $node->setAttribute("style", "font-style:italic"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | $node->appendText($child->textContent); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | $tspan->appendChild($node); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | } elsif ($tag eq "a") { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | $child->setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | $child->getAttribute("href")); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 0 | $child->removeAttribute("href"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | $tspan->appendChild($child); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | } else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 367 | $tspan->appendText($child->textContent); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 367 | $node->appendChild($tspan); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 367 | ▶ | if (@line) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 89 | $tspan = $tspan->cloneNode(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 89 | $tspan->setAttribute("y", $tspan->getAttribute("y") + $dy); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 12 | ▶ | sub svg_transform { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
svg_transform: called CC=9 SCAR=22.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 12 | my ($self, $char, $doc) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 12 | my $parser = XML::LibXML->new; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 12 | my $svg = XML::LibXML::XPathContext->new; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 12 | $svg->registerNs("svg", "http://www.w3.org/2000/svg"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 12 | for my $id (keys %$char) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 709 | ▶ | next unless $id =~ /^[-a-z0-9]+$/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 709 | my $nodes = $svg->find(qq{//svg:text[\@id="$id"]}, $doc); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 709 | for my $node ($nodes->get_nodelist) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 313 | replace_text($parser, $node, $char->{$id}, $doc); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 313 | next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 709 | $nodes = $svg->find(qq{//svg:image[\@id="$id"]}, $doc); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 709 | for my $node ($nodes->get_nodelist) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | $node->setAttributeNS("http://www.w3.org/1999/xlink", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 6 | "xlink:href", $char->{$id}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 6 | next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | # $self is not set when using the random command | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | # (Game::CharacterSheetGenerator::Command::random). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 12 | ▶ | if ($self) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 12 | my $nodes = $svg->find(qq{//svg:a[\@id="link"]/attribute::xlink:href}, $doc); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 12 | for my $node ($nodes->get_nodelist) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 12 | my $params = Mojo::Parameters->new; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 12 | for my $key (@{$char->{provided}}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 260 | ▶ | $params->append($key => $char->{$key}||''); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$char->{$key} || ''
MC/DC100%1/1
$char->{$key} || ''
$char->{$key}
Truth table100%2/2
A
A= $char->{$key}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 12 | $node->setValue($self->url_for("edit")->query($params)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 12 | return $doc; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 1 | ▶ | sub svg_show_id { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
svg_show_id: called CC=8 SCAR=20.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 1 | my ($char, $doc) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 1 | my $svg = XML::LibXML::XPathContext->new; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 1 | $svg->registerNs("svg", "http://www.w3.org/2000/svg"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 1 | for my $node ($svg->find(qq{//svg:text/svg:tspan/..}, $doc)->get_nodelist) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 91 | my $id = $node->getAttribute("id"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 91 | ▶ | next if $id =~ /^text[0-9]+(-[0-9]+)*$/; # skip Inkscape default texts | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 91 | ▶ | next unless $id =~ /^[-a-z0-9]+$/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 87 | $node->removeChildNodes(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 87 | $node->appendText($id); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 87 | my $style = $node->getAttribute("style"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 87 | $style =~ s/font-size:\d+px/font-size:8px/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 87 | ▶ | $style =~ s/fill:#\d+/fill:magenta/ or $style .= ";fill:magenta"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 87 | $node->setAttribute("style", $style); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 1 | for my $node ($svg->find(qq{//svg:image}, $doc)->get_nodelist) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 1 | my $id = $node->getAttribute("id"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 1 | ▶ | next if $id =~ /^text[0-9]+(-[0-9]+)*$/; # skip Inkscape default texts | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 1 | ▶ | next unless $id =~ /^[-a-z0-9]+$/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 1 | my $text = XML::LibXML::Element->new("text"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 1 | $text->setAttribute("x", $node->getAttribute("x") + 5); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 1 | $text->setAttribute("y", $node->getAttribute("y") + 10); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 1 | $text->appendText($id); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 1 | $text->setAttribute("style", "font-size:8px;fill:magenta"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 1 | $node->addSibling($text); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 1 | return $doc; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 692 | ▶ | sub bonus { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bonus: called CC=7 SCAR=19.5
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 692 | my $n = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 692 | ▶ | return "-3" if $n <= 3; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 691 | ▶ | return "-2" if $n <= 5; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 665 | ▶ | return "-1" if $n <= 8; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 513 | ▶ | return "" if $n <= 12; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 144 | ▶ | return "+1" if $n <= 15; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 25 | ▶ | return "+2" if $n <= 17; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 1 | return "+3"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 9 | ▶ | sub cha_bonus { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cha_bonus: called CC=5 SCAR=19.4
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 9 | my $n = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 9 | ▶ | return "-2" if $n <= 3; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 9 | ▶ | return "-1" if $n <= 8; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 7 | ▶ | return "" if $n <= 12; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 0 | ▶ | return "+1" if $n <= 17; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 0 | return "+2"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 112 | ▶ | sub number { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
number: called CC=1 SCAR=0.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 112 | return sprintf("%+d", shift); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 13 | ▶ | sub character { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
character: called CC=38 SCAR=41.1
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 13 | my $char = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 13 | my $melee_only = $char->{class} eq T("dog"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 13 | for my $id (qw(str dex con int wis cha)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 78 | ▶ | if ($char->{$id} and not defined $char->{"$id-bonus"}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$char->{$id} and not defined $$char{"$id-bonus"}
MC/DC100%2/2
$char->{$id} and not defined $$char{"$id-bonus"}
$char->{$id}
not defined $$char{"$id-bonus"}
Truth table100%3/3
A and not(B)
A= $char->{$id}B= not defined $$char{"$id-bonus"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 55 | $char->{"$id-bonus"} = bonus($char->{$id}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 13 | ▶ | if ($char->{cha} and not defined $char->{reaction}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$char->{"cha"} and not defined $char->{"reaction"}
MC/DC50%1/2
$char->{"cha"} and not defined $char->{"reaction"}
$char->{"cha"}
not defined $char->{"reaction"}
Truth table66%2/3
A and not(B)
A= $char->{"cha"}B= not defined $char->{"reaction"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 9 | $char->{reaction} = cha_bonus($char->{cha}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 13 | ▶ | if (not $char->{loyalty}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 13 | $char->{loyalty} = 7 + $char->{"cha-bonus"}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 13 | ▶ | if (not defined $char->{hirelings}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 13 | $char->{hirelings} = 4 + $char->{"cha-bonus"}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 13 | ▶ | if (defined $char->{"ac"} and not defined $char->{"aac"}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
defined $char->{"ac"} and not defined $char->{"aac"}
MC/DC50%1/2
defined $char->{"ac"} and not defined $char->{"aac"}
defined $char->{"ac"}
not defined $char->{"aac"}
Truth table66%2/3
A and not(B)
A= defined $char->{"ac"}B= not defined $char->{"aac"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 9 | $char->{"aac"} = 20 - $char->{"ac"}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | ▶ | } elsif (not defined $char->{"ac"} and defined $char->{"aac"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
not defined $char->{"ac"} and defined $char->{"aac"}
MC/DC0%0/2
not defined $char->{"ac"} and defined $char->{"aac"}
not defined $char->{"ac"}
defined $char->{"aac"}
Truth table33%1/3
not(A) and B
A= not defined $char->{"ac"}B= defined $char->{"aac"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | 0 | $char->{"ac"} = 20 - $char->{"aac"}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 13 | ▶ | if (defined $char->{"to-hit"} and not defined $char->{"thac0"}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
defined $char->{"to-hit"} and not defined $char->{"thac0"}
MC/DC0%0/2
defined $char->{"to-hit"} and not defined $char->{"thac0"}
defined $char->{"to-hit"}
not defined $char->{"thac0"}
Truth table33%1/3
A and not(B)
A= defined $char->{"to-hit"}B= not defined $char->{"thac0"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 0 | $char->{"thac0"} = 20 - $char->{"to-hit"}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | ▶ | } elsif (not defined $char->{"to-hit"} and defined $char->{"thac0"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
not defined $char->{"to-hit"} and defined $char->{"thac0"}
MC/DC50%1/2
not defined $char->{"to-hit"} and defined $char->{"thac0"}
not defined $char->{"to-hit"}
defined $char->{"thac0"}
Truth table66%2/3
not(A) and B
A= not defined $char->{"to-hit"}B= defined $char->{"thac0"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 9 | $char->{"to-hit"} = 20 - $char->{"thac0"}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 13 | ▶ | if (defined $char->{"thac0"}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 9 | ▶ | if (not defined $char->{"melee-thac0"}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 9 | $char->{"melee-thac0"} = $char->{"thac0"} - $char->{"str-bonus"}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 9 | ▶ | if (not defined $char->{"range-thac0"} and not $melee_only) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $char->{"range-thac0"} or $melee_only
MC/DC50%1/2
defined $char->{"range-thac0"} or $melee_only
defined $char->{"range-thac0"}
$melee_only
Truth table66%2/3
A or B
A= defined $char->{"range-thac0"}B= $melee_only
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 7 | $char->{"range-thac0"} = $char->{"thac0"} - $char->{"dex-bonus"}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 9 | ▶ | if (not defined $char->{"other-thac0"} and not $melee_only) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $char->{"other-thac0"} or $melee_only
MC/DC0%0/2
defined $char->{"other-thac0"} or $melee_only
defined $char->{"other-thac0"}
$melee_only
Truth table33%1/3
A or B
A= defined $char->{"other-thac0"}B= $melee_only
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 9 | $char->{"other-thac0"} = $char->{"thac0"}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 13 | ▶ | if (defined $char->{"to-hit"}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 9 | ▶ | if (not defined $char->{"melee-to-hit"}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 9 | $char->{"melee-to-hit"} = number($char->{"to-hit"} + $char->{"str-bonus"}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 9 | ▶ | if (not defined $char->{"range-to-hit"} and not $melee_only) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $char->{"range-to-hit"} or $melee_only
MC/DC0%0/2
defined $char->{"range-to-hit"} or $melee_only
defined $char->{"range-to-hit"}
$melee_only
Truth table33%1/3
A or B
A= defined $char->{"range-to-hit"}B= $melee_only
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 9 | $char->{"range-to-hit"} = number($char->{"to-hit"} + $char->{"dex-bonus"}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 9 | ▶ | if (not defined $char->{"other-to-hit"} and not $melee_only) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $char->{"other-to-hit"} or $melee_only
MC/DC0%0/2
defined $char->{"other-to-hit"} or $melee_only
defined $char->{"other-to-hit"}
$melee_only
Truth table33%1/3
A or B
A= defined $char->{"other-to-hit"}B= $melee_only
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 9 | $char->{"other-to-hit"} = number($char->{"to-hit"}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 13 | for my $type ("melee", "range", "other") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 39 | ▶ | next unless defined $char->{"$type-thac0"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 27 | ▶ | for (my $n = 0; $n <= 9; $n++) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 270 | my $val = $char->{"$type-thac0"} - $n; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 270 | ▶ | $val = 20 if $val > 20; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 270 | ▶ | $val = 1 if $val < 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 270 | ▶ | $char->{"$type$n"} = $val unless $char->{"$type$n"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 13 | ▶ | if (not defined $char->{damage}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 13 | $char->{damage} = 1 . T('d6'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 13 | ▶ | if (not defined $char->{"melee-damage"}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 13 | $char->{"melee-damage"} = $char->{damage} . $char->{"str-bonus"}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 13 | ▶ | if (not defined $char->{"range-damage"}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 13 | $char->{"range-damage"} = $char->{damage}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 13 | ▶ | if (not defined $char->{"other-damage"}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 13 | $char->{"other-damage"} = $char->{damage}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 13 | saves($char); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | # This function is called when preparing data for display in SVG. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 13 | ▶ | sub compute_data { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
compute_data: called CC=1 SCAR=0.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 13 | my ($char, $language) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 13 | local $lang = $language; # make sure T works as intended | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 13 | character($char); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 306 | ▶ | sub starting_gold { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
starting_gold: called CC=4 SCAR=14.1
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 306 | my $class = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | 306 | ▶ | return 0 if $class eq T('hireling') or $class eq T('porter') or $class eq T('dog'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
$class eq T("hireling") or $class eq T("porter") or $class eq T("dog")
$class eq T("hireling") or $class eq T("porter")
MC/DC33%1/3
$class eq T("hireling") or $class eq T("porter") or $class eq T("dog")
$class eq T("hireling")
$class eq T("porter")
$class eq T("dog")
Truth table50%2/4
A or B or C
A= $class eq T("hireling")B= $class eq T("porter")C= $class eq T("dog")
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 305 | return roll_3d6() * 10; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 11 | my %price_cache; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 307 | ▶ | sub equipment { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
equipment: called CC=7 SCAR=19.5
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | 307 | my $char = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 307 | my $xp = $char->{xp}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 307 | my $level = $char->{level}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 307 | my $class = $char->{class}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 307 | ▶ | return if $xp or $level > 1 or not $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
$xp or $level > 1 or not $class
$xp or $level > 1
MC/DC33%1/3
$xp or $level > 1 or not $class
$xp
$level > 1
not $class
Truth table50%2/4
A or B or not(C)
A= $xpB= $level > 1C= not $class
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 306 | get_price_cache($char); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 306 | my $money = starting_gold($class); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 306 | my @property; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | # free spellbook for arcane casters | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 306 | ▶ | if (member($class, T('magic-user'), T('elf'))) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | 107 | push(@property, T('spell book')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | 306 | ($money, @property) = buy_basics($char, $money, $class, @property); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | 306 | ($money, @property) = buy_armor($char, $money, $class, @property); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 306 | ($money, @property) = buy_weapon($char, $money, $class, @property); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | 306 | ($money, @property) = buy_tools($char, $money, $class, @property); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 306 | ($money, @property) = buy_light($char, $money, $class, @property); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | 306 | ($money, @property) = buy_gear($char, $money, $class, @property); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 306 | ($money, @property) = buy_protection($char, $money, $class, @property); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | 306 | my $gold = int($money); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | 306 | my $silver = int(10 * ($money - $gold) + 0.5);; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 306 | ▶ | push(@property, T('%0 gold', $gold)) if $gold; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 306 | ▶ | push(@property, T('%0 silver', $silver)) if $silver; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | 306 | provide($char, "property", join("\\\\", @property)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | # This is computed at runtime because of the translations. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | 306 | ▶ | sub get_price_cache { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_price_cache: called CC=1 SCAR=0.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | 306 | my $char = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | 306 | %price_cache = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | T('backpack') => 5, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | T('rations (1 week)') => 15, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | T('thieves’ tools') => 25, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | T('lantern') => 10, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | T('flask of oil') => 2, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | T('6 torches') => 1, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | T('rope') => 1, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | T('3 stakes and hammer') => 3, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | T('12 iron spikes and hammer') => 3, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | T('pole') => 1, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | T('wolfsbane') => 10, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | T('garlic') => 1, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | T('mirror') => 5, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | T('leather armor') => 20, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | T('chain mail') => 40, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | T('plate mail') => 60, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | T('shield') => 10, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | T('helmet') => 10, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | T('club') => 3, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | T('mace') => 5, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | T('war hammer') => 5, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | T('staff') => 2, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | T('dagger') => 3, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | T('silver dagger') => 30, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | T('two handed sword') => 15, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | T('battle axe') => 7, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | T('pole arm') => 7, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | T('long sword') => 10, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | T('short sword') => 7, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | T('long bow') => 40, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | T('quiver with 20 arrows') => 5, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | T('short bow') => 25, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | T('crossbow') => 30, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | T('case with 30 bolts') => 10, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | T('sling') => 2, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | T('pouch with 30 stones') => 0, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | T('hand axe') => 4, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | T('spear') => 3, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | 6390 | ▶ | sub price { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
price: called CC=2 SCAR=7.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | 6390 | my ($char, $item) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | 6390 | my $price = $price_cache{$item}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | 6390 | ▶ | if (not defined $price) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | 0 | $log->error(T('Unknown Price'), T('%0: How much does this cost?', $item)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | 0 | return 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | 6390 | return $price; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | # add($item, \@property) modifies @property directly | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | 3586 | ▶ | sub add { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add: called CC=5 SCAR=16.4
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | 3586 | my ($item, $property) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | 3586 | foreach (@$property) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 19739 | ▶ | if ($_ eq $item) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 269 | ▶ | if (/\(\d+\)$/) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | 0 | my $n = $1++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | 0 | s/\(\d+\)$/($n)/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | } else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | 269 | $_ .= " (2)"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | 269 | $item = undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 269 | last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | 3586 | ▶ | if ($item) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | 3317 | push(@$property, $item); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | # Use array references to buy one of several alternatives. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | # Buy a and b, or buy c instead: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | # ($money, @property) = buy($char, [[a, b], c], $money, @property) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | 4024 | ▶ | sub buy { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
buy: called CC=12 SCAR=24.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | 4024 | my ($char, $item, $money, @property) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | 4024 | ▶ | if (ref $item eq "ARRAY") { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | 2024 | for my $elem (@$item) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | 2841 | ▶ | if (ref $elem eq "ARRAY") { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | 1294 | my $price = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | 1294 | for my $thing (@$elem) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | 2843 | $price += price($char, $thing); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 1294 | ▶ | if ($money >= $price) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | 549 | $money -= $price; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | 549 | ▶ | $elem->[-1] .= " (${price}gp)" if $char->{debug}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | 549 | foreach (@$elem) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 1106 | add($_, \@property); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | 549 | last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | } else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | 1547 | my $price = price($char, $elem); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | 1547 | ▶ | if ($money >= $price) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | 1172 | $money -= $price; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | 1172 | ▶ | $elem .= " (${price}gp)" if $char->{debug}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | 1172 | add($elem, \@property); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | 1172 | last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | } else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | 2000 | my $price = price($char, $item); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | 2000 | ▶ | if ($money >= $price) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | 1308 | $money -= $price; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | 1308 | ▶ | $item .= " (${price}gp)" if $char->{debug}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | 1308 | add($item, \@property); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | 4024 | return ($money, @property); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | 306 | ▶ | sub buy_basics { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
buy_basics: called CC=2 SCAR=7.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | 306 | my ($char, $money, $class, @property) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | 306 | ▶ | push(@property, "- $money gp -") if $char->{debug}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | 306 | ($money, @property) = buy($char, T('backpack'), $money, @property); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | 306 | ($money, @property) = buy($char, T('rations (1 week)'), $money, @property); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | 306 | return ($money, @property); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | 306 | ▶ | sub buy_tools { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
buy_tools: called CC=3 SCAR=11.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | 306 | my ($char, $money, $class, @property) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | 306 | ▶ | push(@property, "- $money gp -") if $char->{debug}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | 306 | ▶ | if ($class eq T('thief')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | 47 | ($money, @property) = buy($char, T('thieves’ tools'), $money, @property); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | 306 | return ($money, @property); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 306 | ▶ | sub buy_light { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
buy_light: called CC=2 SCAR=7.1
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | 306 | my ($char, $money, $class, @property) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | 306 | ▶ | push(@property, "- $money gp -") if $char->{debug}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | 306 | return buy($char, [[T('lantern'), T('flask of oil')], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | T('6 torches')], | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | $money, @property); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | 306 | ▶ | sub buy_gear { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
buy_gear: called CC=2 SCAR=7.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | 306 | my ($char, $money, $class, @property) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | 306 | ▶ | push(@property, "- $money gp -") if $char->{debug}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | 306 | my @preferences = shuffle( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | T('rope'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | T('12 iron spikes and hammer'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | T('3 stakes and hammer'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | T('pole')); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | 306 | return buy($char, \@preferences, $money, @property); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | 306 | ▶ | sub buy_protection { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
buy_protection: called CC=2 SCAR=7.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | 306 | my ($char, $money, $class, @property) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | 306 | ▶ | push(@property, "- $money gp -") if $char->{debug}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | 306 | my @preferences = shuffle( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | T('garlic'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | T('wolfsbane'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | T('mirror')); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | 306 | return buy($char, \@preferences, $money, @property); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | 306 | ▶ | sub buy_armor { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
buy_armor: called CC=9 SCAR=22.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | 306 | my ($char, $money, $class, @property) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | 306 | ▶ | push(@property, "- $money gp -") if $char->{debug}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | 306 | my $budget = $money / 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | 306 | $money -= $budget; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | 306 | ▶ | if ($class eq T('magic-user')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | # no armor | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | } elsif ($class eq T('thief')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | # leather, no shield, no helmet | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | 47 | ($budget, @property) = buy($char, T('leather armor'), $budget, @property); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | } else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | # any armor | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | 188 | ($budget, @property) = buy($char, [T('plate mail'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | T('chain mail'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | T('leather armor')], $budget, @property); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | 188 | ($budget, @property) = buy($char, T('shield'), $budget, @property); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | 188 | ($budget, @property) = buy($char, T('helmet'), $budget, @property); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | # compute AC | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | 306 | my $dex = $char->{dex}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | 306 | my $ac = 9 - bonus($dex); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | 306 | ▶ | if (member(T('plate mail'), @property)) { $ac -= 6; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | 96 | elsif (member(T('chain mail'), @property)) { $ac -= 4; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | 100 | elsif (member(T('leather armor'), @property)) { $ac -= 2; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | 306 | ▶ | if (member(T('shield'), @property)) { $ac -= 1; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | 306 | ▶ | if ($class eq T('halfling')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | 22 | $ac .= "/" . ($ac - 2); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | 306 | provide($char, "ac", $ac); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | 306 | return ($money + $budget, @property); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | 306 | ▶ | sub buy_melee_weapon { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
buy_melee_weapon: called CC=13 SCAR=28.2
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | 306 | my $char = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | 306 | my ($money, $class, @property) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | 306 | my $str = $char->{str}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | 306 | my $hp = $char->{hp}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | 306 | my $shield = member(T('shield'), @property); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | 306 | my @preferences; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | 306 | ▶ | if ($class eq T('magic-user')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 8 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | 71 | @preferences = shuffle( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | T('dagger'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | T('staff')); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | } elsif ($class eq T('fighter')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | 77 | ▶ | if (good($str) | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
good($str) and $hp > 6 and not $shield
good($str) and $hp > 6
MC/DC0%0/3
good($str) and $hp > 6 and not $shield
good($str)
$hp > 6
not $shield
Truth table50%2/4
A and B and not(C)
A= good($str)B= $hp > 6C= not $shield
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | and $hp > 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | and not $shield) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | # prefer a shield! | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | 0 | push(@preferences, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | shuffle(T('two handed sword'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | T('battle axe'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | T('pole arm'))); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | 77 | push(@preferences, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | T('long sword'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | T('short sword'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | T('mace')); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | } elsif ($class eq T('dwarf')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | 52 | push(@preferences, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | T('war hammer'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | T('mace'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | T('short sword')); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | } elsif ($class eq T('halfling')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | 22 | @preferences = (T('short sword'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | T('mace'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | T('club')); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | } elsif ($class eq T('elf')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | 36 | @preferences = (T('long sword'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | T('short sword')); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | } elsif ($class eq T('thief')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | 47 | @preferences = (T('long sword'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | T('short sword'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | T('mace'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | T('club')); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | } elsif ($class eq T('hireling')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | 1 | @preferences = (T('spear'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | T('club')); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | ▶ | } elsif ($class eq T('porter') or $class eq T('dog')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$class eq T("porter") or $class eq T("dog")
MC/DC0%0/2
$class eq T("porter") or $class eq T("dog")
$class eq T("porter")
$class eq T("dog")
Truth table0%0/3
A or B
A= $class eq T("porter")B= $class eq T("dog")
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | 0 | @preferences = (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | } else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | 0 | $log->warn("Unknown class $class has no preferred weapons"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | 306 | return buy($char, \@preferences, $money, @property); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | 306 | ▶ | sub buy_throwing_weapon { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
buy_throwing_weapon: called CC=4 SCAR=13.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | 306 | my $char = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | 306 | my ($money, $class, @property) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | 306 | my @preferences; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | # Don't buy daggers because those are bought anyway. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | 306 | ▶ | if ($class eq T('dwarf') or member(T('battle axe'), @property)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$class eq T("dwarf") or member(T("battle axe"), @property)
MC/DC50%1/2
$class eq T("dwarf") or member(T("battle axe"), @property)
$class eq T("dwarf")
member(T("battle axe"), @property)
Truth table66%2/3
A or B
A= $class eq T("dwarf")B= member(T("battle axe"), @property)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | 52 | push(@preferences, [T('hand axe'), T('hand axe')]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | 52 | push(@preferences, T('hand axe')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | 306 | ▶ | if ($class eq T('fighter')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | 77 | push(@preferences, T('spear')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | 306 | return buy($char, \@preferences, $money, @property); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | 306 | ▶ | sub buy_ranged_weapon { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
buy_ranged_weapon: called CC=6 SCAR=17.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | 306 | my $char = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | 306 | my ($money, $class, @property) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | 306 | my @preferences; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | 306 | my $dex = $char->{dex}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | 306 | ▶ | if (($class eq T('fighter') or $class eq T('elf')) | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$class eq T("fighter") || $class eq T("elf") and average($dex)
$class eq T("fighter") or $class eq T("elf")
MC/DC100%3/3
$class eq T("fighter") || $class eq T("elf") and average($dex)
$class eq T("fighter")
$class eq T("elf")
average($dex)
Truth table100%5/5
A or B and C
A= $class eq T("fighter")B= $class eq T("elf")C= average($dex)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | and average($dex)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | 83 | push(@preferences, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | [T('long bow'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | T('quiver with 20 arrows'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | T('quiver with 20 arrows')], | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | [T('long bow'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | T('quiver with 20 arrows')]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | 306 | ▶ | if ($class ne T('magic-user')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | 235 | ▶ | if (average($dex)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | 172 | push(@preferences, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | [T('short bow'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | T('quiver with 20 arrows'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | T('quiver with 20 arrows')], | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | [T('short bow'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | T('quiver with 20 arrows')]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | 235 | push(@preferences, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | [T('crossbow'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | T('case with 30 bolts')]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | 235 | push(@preferences, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | [T('sling'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | T('pouch with 30 stones')]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | 306 | return buy($char, \@preferences, $money, @property); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | 306 | ▶ | sub buy_weapon { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
buy_weapon: called CC=2 SCAR=6.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | 306 | my $char = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | 306 | my ($money, $class, @property) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | 306 | ▶ | push(@property, "- $money gp -") if $char->{debug}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | 306 | my $budget = $money / 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | 306 | $money -= $budget; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | 306 | ($budget, @property) = buy_melee_weapon($char, $budget, $class, @property); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | 306 | ($budget, @property) = buy_throwing_weapon($char, $budget, $class, @property); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | 306 | ($budget, @property) = buy_ranged_weapon($char, $budget, $class, @property); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | 306 | ($budget, @property) = buy($char, T('silver dagger'), $budget, @property); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | 306 | ($budget, @property) = buy($char, T('dagger'), $budget, @property); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | 306 | ($budget, @property) = buy($char, T('dagger'), $budget, @property); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | 306 | return ($money + $budget, @property); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | 107 | ▶ | sub spellbook { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
spellbook: called CC=1 SCAR=0.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | 107 | my $char = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | 107 | return T('Spells:') . " " | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | . one(T('charm person'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | T('detect magic'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | T('floating disc'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | T('hold portal'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | T('light'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | T('magic missile'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | T('protection from evil'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | T('read languages'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | T('read magic'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | T('shield'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | T('sleep'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | T('ventriloquism')); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | 17 | ▶ | sub saves { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
saves: called CC=13 SCAR=25.7
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | 17 | my $char = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | 17 | my $class = $char->{class}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | 17 | my $level = $char->{level}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | 17 | my ($breath, $poison, $petrify, $wands, $spells); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | 17 | ▶ | if ($class eq T('dwarf') or $class eq T('halfling')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
Condition66%2/3
$class eq T("dwarf") or $class eq T("halfling")
MC/DC50%1/2
$class eq T("dwarf") or $class eq T("halfling")
$class eq T("dwarf")
$class eq T("halfling")
Truth table66%2/3
A or B
A= $class eq T("dwarf")B= $class eq T("halfling")
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | 2 | ($breath, $poison, $petrify, $wands, $spells) = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | improve([13, 8, 10, 9, 12], [3, 2, 2, 2, 2], int(($level-1)/3)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | } elsif ($class eq T('elf')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | 0 | ($breath, $poison, $petrify, $wands, $spells) = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | improve([15, 12, 13, 13, 15], 2, int(($level-1)/3)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | ▶ | } elsif ($class eq T('fighter') or $class eq T('dog')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$class eq T("fighter") or $class eq T("dog")
MC/DC50%1/2
$class eq T("fighter") or $class eq T("dog")
$class eq T("fighter")
$class eq T("dog")
Truth table66%2/3
A or B
A= $class eq T("fighter")B= $class eq T("dog")
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | 4 | ($breath, $poison, $petrify, $wands, $spells) = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | improve([15, 12, 14, 13, 16], 2, int(($level-1)/3)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | } elsif ($class eq T('magic-user')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | 2 | ($breath, $poison, $petrify, $wands, $spells) = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | improve([16, 13, 13, 13, 14], 2, int(($level-1)/5)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | } elsif ($class eq T('thief')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | 2 | ($breath, $poison, $petrify, $wands, $spells) = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | improve([16, 14, 13, 15, 14], 2, int(($level-1)/4)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | } else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | 7 | ($breath, $poison, $petrify, $wands, $spells) = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | (17, 14, 16, 15, 18); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | # This is the default, if any | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | 17 | $breath -= $char->{"wis-bonus"}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | 17 | $poison -= $char->{"wis-bonus"}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | 17 | $petrify -= $char->{"wis-bonus"}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | 17 | $wands -= $char->{"wis-bonus"}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | 17 | $spells -= $char->{"wis-bonus"}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | # Set classic saves, unless they already exist | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | 17 | ▶ | provide($char, "breath", defined $char->{"breath-bonus"} ? 20 - $char->{"breath-bonus"} : $breath); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | 17 | ▶ | provide($char, "poison", defined $char->{"poison-bonus"} ? 20 - $char->{"poison-bonus"} : $poison); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | 17 | ▶ | provide($char, "petrify", defined $char->{"petrify-bonus"} ? 20 - $char->{"petrify-bonus"} : $petrify); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | 17 | ▶ | provide($char, "wands", defined $char->{"wands-bonus"} ? 20 - $char->{"wands-bonus"} : $wands); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | 17 | ▶ | provide($char, "spells", defined $char->{"spells-bonus"} ? 20 - $char->{"spells-bonus"} : $spells); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | # Set Target 20 saves, unless they already exist | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | 17 | provide($char, "breath-bonus", number(20 - $char->{"breath"})); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | 17 | provide($char, "poison-bonus", number(20 - $char->{"poison"})); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | 17 | provide($char, "petrify-bonus", number(20 - $char->{"petrify"})); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | 17 | provide($char, "wands-bonus", number(20 - $char->{"wands"})); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | 17 | provide($char, "spells-bonus", number(20 - $char->{"spells"})); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | 10 | ▶ | sub improve { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
improve: called CC=4 SCAR=13.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | 10 | my $saves = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | 10 | my $improvement = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | 10 | my $steps = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | 10 | ▶ | for (my $i = 0; $i < @$saves; $i++) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | 50 | ▶ | $saves->[$i] -= ref($improvement) ? $improvement->[$i] : $improvement for 1 .. $steps; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | 10 | return @$saves; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | 100 | ▶ | sub d3 { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
d3: called CC=1 SCAR=0.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | 100 | return 1 + int(rand(3)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | 122 | ▶ | sub d4 { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
d4: called CC=1 SCAR=0.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | 122 | return 1 + int(rand(4)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | 6576 | ▶ | sub d6 { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
d6: called CC=1 SCAR=0.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | 6576 | return 1 + int(rand(6)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | 129 | ▶ | sub d8 { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
d8: called CC=1 SCAR=0.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | 129 | return 1 + int(rand(8)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | 0 | ▶ | sub d10 { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
d10: not called CC=1 SCAR=6.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | 0 | return 1 + int(rand(10)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | 0 | ▶ | sub d12 { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
d12: not called CC=1 SCAR=6.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | 0 | return 1 + int(rand(12)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1059 | 2141 | ▶ | sub roll_3d6 { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
roll_3d6: called CC=1 SCAR=0.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1060 | 2141 | return d6() + d6() + d6(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1063 | 0 | ▶ | sub roll_3d8 { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
roll_3d8: not called CC=1 SCAR=6.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | 0 | return d8() + d8() + d8(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1066 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1067 | 307 | ▶ | sub best { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
best: called CC=3 SCAR=11.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | 307 | my $best = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1069 | 307 | my $max = $_[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1070 | 307 | ▶ | for (my $i = 1; $i < 6; $i++) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1071 | 1535 | ▶ | if ($_[$i] > $max) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1072 | 377 | $best = $i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1073 | 377 | $max = $_[$best]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1074 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1075 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1076 | 307 | my @stat = qw(str dex con int wis cha); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1077 | 307 | return $stat[$best]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1079 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | 1776 | ▶ | sub above { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
above: called CC=3 SCAR=11.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1081 | 1776 | my $limit = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1082 | 1776 | my $n = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1083 | 1776 | ▶ | for (my $i = 0; $i <= $#_; $i++) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1084 | 3185 | ▶ | $n++ if $_[$i] > $limit; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1085 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1086 | 1776 | return $n; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1087 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1088 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1089 | 470 | ▶ | sub good { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
good: called CC=1 SCAR=0.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1090 | 470 | return above(12, @_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1091 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1092 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1093 | 1306 | ▶ | sub average { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
average: called CC=1 SCAR=0.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1094 | 1306 | return above(8, @_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1095 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1096 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1097 | # use prototype so that Perl knows that there are only three arguments, which | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1098 | # allows wrap to use wantarray when used to wrap $value | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1099 | 5207 | ▶ | sub provide ($$$) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
provide: called CC=3 SCAR=11.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1100 | 5207 | my ($char, $key, $value) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1101 | # empty strings get overwritten, but zero does not get overwritten | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1102 | 5207 | ▶ | return unless not defined $char->{$key} or $char->{$key} eq ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not defined $char->{$key} or $char->{$key} eq ""
MC/DC50%1/2
not defined $char->{$key} or $char->{$key} eq ""
not defined $char->{$key}
$char->{$key} eq ""
Truth table66%2/3
not(A) or B
A= not defined $char->{$key}B= $char->{$key} eq ""
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1103 | # early provided values are removed | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1104 | 5177 | my @provided = grep { $_ ne $key } @{$char->{provided}}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1105 | 5177 | $char->{provided} = [@provided, $key]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1106 | 5177 | $char->{$key} = $value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1107 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1108 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1109 | 0 | ▶ | sub provided { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
provided: not called CC=2 SCAR=17.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1110 | 0 | my ($char, $key) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1111 | 0 | ▶ | return grep { $_ eq $key } @{$char->{provided}} if @{$char->{provided}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1112 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1113 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1114 | 386 | ▶ | sub one { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
one: called CC=1 SCAR=0.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1115 | 386 | my $i = int(rand(scalar @_)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1116 | 386 | return $_[$i]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1117 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1118 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1119 | 0 | ▶ | sub two { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
two: not called CC=2 SCAR=17.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1120 | 0 | my $i = int(rand(scalar @_)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1121 | 0 | my $j = int(rand(scalar @_)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1122 | 0 | ▶ | $j = int(rand(scalar @_)) until $i != $j; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1123 | 0 | return ($_[$i], $_[$j]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1124 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1125 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1126 | 2249 | ▶ | sub member { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
member: called CC=3 SCAR=11.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1127 | 2249 | my $element = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1128 | 2249 | foreach (@_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1129 | 6855 | ▶ | return 1 if $element eq $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1130 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1131 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1132 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1133 | 0 | ▶ | sub wrap { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
wrap: not called CC=5 SCAR=34.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1134 | 0 | my ($text, $width) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1135 | 0 | my @result; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1136 | 0 | ▶ | while (length($text) > $width) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1137 | 0 | my $n = $width; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1138 | 0 | ▶ | while ($n > 0) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1139 | 0 | ▶ | if (substr($text, $n, 1) eq " ") { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1140 | 0 | push(@result, substr($text, 0, $n)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1141 | 0 | $text = substr($text, $n + 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1142 | 0 | last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1143 | } else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1144 | 0 | $n--; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1145 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1146 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1147 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1148 | 0 | push(@result, $text); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1149 | 0 | ▶ | return @result if wantarray; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1150 | 0 | return join("\\\\", @result); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1151 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1152 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1153 | 11 | my $traits = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1154 | # http://charaktereigenschaften.miroso.de/ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1155 | de => [qw{ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1156 | aalglatt abenteuerlustig abfällig abgebrüht abgehoben abgeklärt abgestumpft | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1157 | absprachefähig abwartend abweisend abwägend achtsam affektiert affig aggressiv | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1158 | agil akkurat akribisch aktiv albern altklug altruistisch ambitioniert | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1159 | anarchisch angeberisch angepasst angriffslustig angsteinflößend angstvoll | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1160 | anhänglich anmutig anpassungsfähig ansprechend anspruchslos anspruchsvoll | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1161 | anstrengend anzüglich arbeitswütig arglistig arglos argwöhnisch arrogant artig | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1162 | asketisch athletisch attraktiv aufbegehrend aufbrausend aufdringlich aufgedreht | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1163 | aufgeregt aufgeschlossen aufgeweckt aufhetzerisch aufmerksam | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1164 | aufmerksamkeitsbedürftig aufmüpfig aufopfernd aufrichtig aufschneiderisch | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1165 | aufsässig ausdauernd ausdruckslos ausdrucksstark ausfallend ausgeflippt | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1166 | ausgefuchst ausgeglichen ausländerfeindlich ausnutzbar autark authentisch | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1167 | autonom autoritär außergewöhnlich barbarisch barmherzig barsch bedacht | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1168 | bedrohlich bedrückt bedächtig bedürfnislos beeinflussbar befangen befehlerisch | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1169 | begeistert begeisterungsfähig begierig begnügsam begriffsstutzig behaglich | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1170 | beharrlich behende beherrscht beherzt behutsam behäbig beirrbar belastbar | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1171 | belebend beliebt bemüht bequem berechnend beredsam berüchtigt bescheiden | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1172 | besessen besitzergreifend besonders besonnen besorgt besserwissend | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1173 | besserwisserisch bestechend bestechlich bestialisch bestimmend bestimmerisch | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1174 | beständig betriebsam betrügerisch betörend bewandert bewusst bezaubernd bieder | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1175 | bigott bissig bitter bizarr blasiert blass blauäugig blumig blutrünstig bockig | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1176 | bodenständig borniert boshaft brav breitspurig brisant brummig brutal bärbeißig | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1177 | bösartig böse böswillig chaotisch charismatisch charmant chauvinistisch | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1178 | cholerisch clever cool couragiert damenhaft dankbar defensiv dekadent | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1179 | demagogisch demütig depressiv derb desorganisiert despotisch destruktiv | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1180 | determinativ devot dezent dezidiert diabolisch dickhäutig dickköpfig diffus | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1181 | diktatorisch diplomatisch direkt diskret distanziert distinguiert diszipliniert | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1182 | disziplinlos divenhaft dogmatisch doktrinär dominant doof dramatisch | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1183 | dramatisierend draufgängerisch dreist drängend dubios duckmäuserisch duldsam | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1184 | dumm durchblickend durcheinander durchschaubar durchschauend durchsetzungsstark | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1185 | durchtrieben dusselig dynamisch dämlich dünkelhaft dünnhäutig echt edel | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1186 | effizient egoistisch egoman egozentrisch ehrenhaft ehrenwert ehrfürchtig | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1187 | ehrgeizig ehrlich eifersüchtig eifrig eigen eigenartig eigenbestimmt | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1188 | eigenbrödlerisch eigenmächtig eigennützig eigensinnig eigenständig eigenwillig | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1189 | eilig einfach einfallslos einfallsreich einfältig einfühlsam eingebildet | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1190 | eingeschüchtert einladend einnehmend einsam einsatzbereit einschüchternd | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1191 | einseitig einsichtig einträchtig eintönig einzelgängerisch einzigartig eisern | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1192 | eiskalt eitel ekelig elastisch elefantös elegant elitär emotional empathisch | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1193 | empfindlich empfindsam empfindungsvoll emsig energetisch energiegeladen | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1194 | energievoll energisch engagiert engstirnig entgegenkommend enthaltsam enthemmt | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1195 | enthusiastisch entscheidungsfreudig entschieden entschlossen entspannt | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1196 | enttäuscht erbarmungslos erbärmlich erfinderisch erfolgsorientiert erfrischend | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1197 | ergeben erhaben erlebnisse ermutigend ernst ernsthaft erotisch erwartungsvoll | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1198 | exaltiert exorbitant experimentierfreudig extravagant extravertiert | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1199 | extrovertiert exzentrisch facettenreich fair falsch familiär fantasielos | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1200 | fantasiereich fantasievoll fantastisch fatalistisch faul feige fein feindselig | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1201 | feinfühlig feinsinnig feminin fesselnd feurig fies fixiert flatterhaft fleissig | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1202 | fleißig flexibel folgsam fordernd forsch fragil frech freiheitskämfend | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1203 | freiheitsliebend freimütig freizügig fremdbestimmend fremdbestimmt freudvoll | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1204 | freundlich friedfertig friedlich friedliebend friedlos friedselig friedvoll | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1205 | frigide frisch frohgemut frohnatur frohsinnig fromm frostig fröhlich furchtlos | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1206 | furchtsam furios fügsam fürsorglich galant gallig gamsig garstig gastfreundlich | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1207 | gebieterisch gebildet gebührend gedankenlos gediegen geduldig gefallsüchtig | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1208 | gefährlich gefällig gefügig gefühllos gefühlsbetont gefühlskalt gefühlvoll | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1209 | geheimnisvoll gehemmt gehorsam gehässig geistreich geizig geladen gelassen | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1210 | geldgierig geltungssüchtig gemein gemütvoll genauigkeitsliebend generös genial | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1211 | genügsam gepflegt geradlinig gerecht gerechtigkeitsliebend gerissen gescheit | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1212 | geschickt geschmeidig geschwätzig gesellig gesprächig gesundheitsbewusst | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1213 | gewaltsam gewalttätig gewieft gewissenhaft gewissenlos gewitzt gewöhnlich | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1214 | gierig giftig glamurös glaubensstark gleichgültig gleichmütig gläubig gnadenlos | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1215 | gottergeben gottesfürchtig grantig grausam grazil griesgrämig grimmig grob | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1216 | grotesk großherzig großkotzig großmäulig großmütig großspurig großzügig | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1217 | gräßlich größenwahnsinnig grübelnd gründlich gutgläubig gutherzig gutmütig | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1218 | gönnerhaft gütig haarspalterisch habgierig habsüchtig halsstarrig harmlos | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1219 | harmoniebedürftig harmoniesüchtig hart hartherzig hartnäckig hasenherzig | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1220 | hasserfüllt hedonistisch heimatverbunden heimtückisch heiter hektisch | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1221 | heldenhaft heldenmütig hellhörig hemmungslos herablassend herausfordernd | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1222 | heroisch herrisch herrlich herrschsüchtig herzerfrischend herzlich herzlos | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1223 | hetzerisch heuchlerisch hibbelig hilflos hilfsbereit hingebungsvoll | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1224 | hinterfotzig hintergründig hinterhältig hinterlistig hinterwäldlerisch | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1225 | hirnrissig hitzig hitzköpfig hochbegabt hochfahrend hochmütig hochnäsig | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1226 | hochtrabend humorlos humorvoll hyperkorrekt hysterisch hämisch hässlich | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1227 | häuslich höflich höflichkeitsliebend höhnisch hübsch ichbezogen idealistisch | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1228 | ideenreich idiotisch ignorant impertinent impulsiv inbrünstig individualistisch | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1229 | infam infantil initiativ inkompetent inkonsequent innovativ instinktiv integer | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1230 | intelektuell intelligent intensiv interessiert intolerant intrigant | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1231 | introvertiert intuitiv ironisch irre jovial jugendlich jung jähzornig | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1232 | kalkulierend kalt kaltblütig kaltherzig kaltschnäuzig kapriziös kasuistisch | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1233 | katzig kauzig keck kess ketzerisch keusch kinderlieb kindisch kindlich klar | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1234 | kleingeistig kleinkariert kleinlaut kleinlich kleinmütig klug knackig knallhart | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1235 | knickrig kokett komisch kommunikationsfähig kommunikativ kompetent kompliziert | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1236 | kompromissbereit konfliktfreudig konfliktscheu konkret konsequent konservativ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1237 | konsistent konstant kontaktarm kontaktfreudig kontraproduktiv kontrareligiös | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1238 | kontrolliert konziliant kooperativ kopffrorm kopflastig kordial korrekt korrupt | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1239 | kosmopolitisch kraftvoll krank kratzbürstig kreativ kriecherisch | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1240 | kriegstreiberisch kriminell kritisch kritkfähig kräftig kulant kultiviert | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1241 | kumpelhaft kurios kämpferisch kühl kühn künstlerisch künstlich labil lachhaft | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1242 | lahm lammfromm langmütig langweilig larmoyant launisch laut lebendig | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1243 | lebensbejahend lebensfroh lebenslustig lebhaft leicht leichtfertig leichtfüssig | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1244 | leichtgläubig leichtlebig leichtsinnig leidenschaftlich leidlich leise | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1245 | leistungsbereit leistungsstark lernbereit lethargisch leutselig liberal lieb | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1246 | liebenswert liebevoll lieblich lieblos locker loyal lustlos lustvoll | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1247 | lösungsorientiert lügnerisch lüstern machtbesessen machtgierig machthaberisch | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1248 | machthungrig mager magisch manipulativ markant martialisch maskulin | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1249 | masochistisch materialistisch matriachalisch maßlos melancholisch memmenhaft | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1250 | menschenscheu menschenverachtend merkwürdig mies mild militant mimosenhaft | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1251 | minimalistisch misanthropisch missgünstig missmutig misstrauisch mitfühlend | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1252 | mitleiderregend mitleidlos mitleidslos mitteilsam modisch mollig mondän | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1253 | moralisch motivierend motiviert musikalisch mutig männerfeindlich mürrisch | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1254 | mütterlich nachdenklich nachgiebig nachlässig nachsichtig nachtragend naiv | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1255 | naturfreudig naturverbunden natürlich nebulös neckisch negativ neiderfüllt | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1256 | neidisch nervig nervös nett neugierig neurotisch neutral nichtssagend | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1257 | niedergeschlagen niederträchtig niedlich nihilistisch nonchalant normal notgeil | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1258 | nutzlos nüchtern oberflächlich objektiv obszön offen offenherzig | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1259 | opportunistisch oppositionell optimistisch ordentlich ordinär ordnungsfähig | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1260 | ordnungsliebend organisiert orientierungslos originell paranoid passiv patent | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1261 | patriarchisch patriotisch pedantisch pejorativ penibel perfektionistisch | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1262 | pervers pessimistisch pfiffig pflegeleicht pflichtbewusst pflichtversessen | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1263 | phantasievoll philanthropisch phlegmatisch phobisch pingelig planlos plump | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1264 | polarisierend politisch positiv pragmatisch prinzipientreu problembewusst | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1265 | profilierungssüchtig progressiv prollig promiskuitiv prophetisch protektiv | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1266 | provokant prüde psychotisch putzig pünktlich qualifiziert quengelig querdenkend | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1267 | querulant quicklebendig quirlig quälend rabiat rachsüchtig radikal raffiniert | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1268 | rastlos ratgebend rational ratlos ratsuchend rau reaktionsschnell reaktionär | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1269 | realistisch realitätsfremd rebellisch rechthaberisch rechtlos rechtschaffend | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1270 | redegewandt redelustig redselig reflektiert rege reif reiselustig reizbar | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1271 | reizend reizvoll religiös renitent reserviert resigniert resolut respektlos | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1272 | respektvoll reumütig rigoros risikofreudig robust romantisch routineorientiert | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1273 | ruhelos ruhig ruppig rückgratlos rücksichtslos rücksichtsvoll rüde sachlich | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1274 | sadistisch sanft sanftmütig sanguinisch sardonisch sarkastisch sauertöpfisch | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1275 | schadenfroh schamlos scheinheilig scheu schlagfertig schlampig schlau | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1276 | schmeichelhaft schneidig schnell schnippisch schnoddrig schreckhaft schrullig | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1277 | schullehrerhaft schusselig schwach schweigsam schwermütig schäbig schöngeistig | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1278 | schüchtern seicht selbstbewusst selbstdarstellerisch selbstgefällig | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1279 | selbstgerecht selbstherrlich selbstkritisch selbstlos selbstreflektierend | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1280 | selbstsicher selbstständig selbstsüchtig selbstverliebt selbstzweifelnd seltsam | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1281 | senil sensationslüstern sensibel sensitiv sentimental seriös sexistisch sexy | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1282 | sicherheitsbedürftig sinnlich skeptisch skrupellos skurril smart solidarisch | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1283 | solide sonnig sorgfältig sorglos sorgsam souverän sparsam spaßig spießig | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1284 | spirituell spitzfindig spontan sportlich sprachbegabt spritzig sprunghaft | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1285 | spröde spöttisch staatsmännisch stabil stachelig standhaft stark starr | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1286 | starrköpfig starrsinnig stereotypisch stilbewusst still stilsicher stilvoll | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1287 | stinkig stoisch stolz strahlend strategisch streberhaft strebsam streitsüchtig | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1288 | streng strikt stumpf stur sturköpfig störend störrisch stürmisch subjektiv | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1289 | subtil suchend suchtgefährdet suspekt sympathisch süchtig tadellos taff | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1290 | tagträumerisch taktisch taktlos taktvoll talentiert tatkräftig tatlos teamfähig | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1291 | temperamentlos temperamentvoll tiefgründig tierlieb tolerant toll tollkühn | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1292 | tollpatschig tough transparent traurig treu trotzig träge träumerisch | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1293 | trübsinnig tyrannisch töricht tüchtig ulkig umgänglich umsichtig umständlich | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1294 | umtriebig unabhängig unanständig unantastbar unartig unaufrichtig | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1295 | unausgeglichen unbedeutend unbeherrscht unbeirrbar unbelehrbar unberechenbar | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1296 | unbeschreiblich unbeschwert unbesonnen unbeständig unbeugsam undankbar | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1297 | undiszipliniert undurchschaubar undurchsichtig unehrlich uneigennützig uneinig | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1298 | unentschlossen unerbittlich unerreichbar unerschrocken unerschütterlich | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1299 | unerträglich unfair unfein unflätig unfolgsam unfreundlich ungeduldig | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1300 | ungehorsam ungehörig ungerecht ungeschickt ungesellig ungestüm ungewöhnlich | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1301 | ungezogen ungezügelt unglaubwürdig ungläubig unhöflich unkompliziert | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1302 | unkonventionell unkonzentriert unmenschlich unnachgiebig unnahbar unordentlich | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1303 | unparteiisch unproblematisch unpünktlich unrealistisch unreflektiert unruhig | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1304 | unsachlich unscheinbar unschlüssig unschuldig unselbständig unsensibel unsicher | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1305 | unstet unternehmungsfreudig unternehmungslustig untertänig unterwürfig untreu | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1306 | unverschämt unverwechselbar unverzagt unzufrieden unzuverlässig verachtend | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1307 | verantwortungsbewusst verantwortungslos verantwortungsvoll verbindlich | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1308 | verbissen verbittert verbrecherisch verfressen verführerisch vergebend | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1309 | vergesslich verhandlungsstark verharrend verkopft verlangend verletzbar | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1310 | verletzend verliebt verlogen verlustängstlich verlässlich vermittelnd | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1311 | vernetzend vernünftig verrucht verräterisch verrückt verschlagen verschlossen | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1312 | verschmitzt verschroben verschüchtert versiert verspielt versponnen | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1313 | verständnislos verständnisvoll verstört vertrauensvoll vertrauenswürdig | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1314 | verträumt verwahrlost verwegen verwirrt verwundert verwöhnt verzweifelt | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1315 | vielfältig vielschichtig vielseitig vital vorausschauend voreingenommen vorlaut | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1316 | vornehm vorsichtig vorwitzig väterlich wagemutig waghalsig wahnhaft wahnsinnig | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1317 | wahnwitzig wahrhaftig wahrheitsliebend wankelmütig warm warmherzig wechselhaft | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1318 | wehmütig weiblich weich weinselig weise weitsichtig weltfremd weltoffen wendig | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1319 | wichtigtuerisch widerlich widerspenstig widersprüchlich widerstandsfähig wild | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1320 | willenlos willensschwach willensstark willig willkürlich wirsch wissbegierig | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1321 | wissensdurstig witzig wohlerzogen wohlgesinnt wortkarg wählerisch würdelos | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1322 | würdevoll xanthippisch zaghaft zappelig zartbesaitet zartfühlend zauberhaft | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1323 | zaudernd zerbrechlich zerdenkend zerknautscht zerstreut zerstörerisch zickig | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1324 | zielbewusst zielführend zielorientiert zielstrebig zimperlich zufrieden | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1325 | zugeknöpft zuhörend zukunftsgläubig zupackend zurechnungsfähig zurückhaltend | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1326 | zuverlässig zuversichtlich zuvorkommend zwanghaft zweifelnd zwiegespalten | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1327 | zwingend zäh zärtlich zögerlich züchtig ängstlich ätzend öde überdreht | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1328 | überemotional überfürsorglich übergenau überheblich überkandidelt überkritisch | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1329 | überlebensfähig überlegen überlegt übermütig überragend überraschend | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1330 | überreagierend überschwenglich übersensibel überspannt überwältigent}], | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1331 | # http://www.roleplayingtips.com/tools/1000-npc-traits/ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1332 | en => [qw{able abrasive abrupt absent minded abusive accepting | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1333 | accident prone accommodating accomplished action oriented active | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1334 | adaptable substance abusing adorable adventurous affable affected | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1335 | affectionate afraid uncommited aggressive agnostic agreeable alert | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1336 | alluring aloof altruistic always hungry always late ambiguous | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1337 | ambitious amiable amused amusing angry animated annoyed annoying | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1338 | anti-social anxious apathetic apologetic appreciative apprehensive | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1339 | approachable argumentative aristocratic arrogant artistic ashamed | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1340 | aspiring assertive astonished attentive audacious austere | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1341 | authoritarian authoritative available average awful awkward babbling | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1342 | babyish bad bashful beautiful belligerent bewildered biter | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1343 | blames others blasé blowhard boastful boisterous bold boorish bored | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1344 | boring bossy boundless brainy brash bratty brave brazen bright | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1345 | brilliant brotherly brutish bubbly busy calculating callous calm | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1346 | candid capable capricious carefree careful careless caring caustic | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1347 | cautious changeable charismatic charming chaste cheerful cheerless | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1348 | childish chivalrous civilised classy clean clever close closed clumsy | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1349 | coarse cocky coherent cold cold hearted combative comfortable | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1350 | committed communicative compassionate competent complacent compliant | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1351 | composed compulsive conceited concerned condescending confident | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1352 | confused congenial conscientious considerate consistent constricting | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1353 | content contented contrarian contrite controlling conversational | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1354 | cooperative coquettish courageous courteous covetous cowardly cowering | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1355 | coy crabby crafty cranky crazy creative credible creepy critical cross | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1356 | crude cruel cuddly cultured curious cutthroat cynical dainty dangerous | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1357 | daring dark dashing dauntless dazzling debonair deceitful deceiving | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1358 | decent decisive decorous deep defeated defective deferential defiant | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1359 | deliberate delicate delightful demanding demonic dependable dependent | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1360 | depressed deranged despicable despondent detached detailed determined | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1361 | devilish devious devoted dignified diligent direct disaffected | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1362 | disagreeable discerning disciplined discontented discouraged discreet | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1363 | disgusting dishonest disillusioned disinterested disloyal dismayed | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1364 | disorderly disorganized disparaging disrespectful dissatisfied | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1365 | dissolute distant distraught distressed disturbed dogmatic domineering | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1366 | dorky doubtful downtrodden draconian dramatic dreamer dreamy dreary | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1367 | dubious dull dumb dutiful dynamic eager easygoing eccentric educated | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1368 | effervescent efficient egocentric egotistic elated eloquent | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1369 | embarrassed embittered embraces change eminent emotional empathetic | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1370 | enchanting encouraging enduring energetic engaging enigmatic | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1371 | entertaining enthusiastic envious equable erratic ethical evasive evil | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1372 | exacting excellent excessive excitable excited exclusive expansive | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1373 | expert extravagant extreme exuberant fabulous facetious faded fair | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1374 | faith in self faithful faithless fake fanatical fanciful fantastic | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1375 | fatalistic fearful fearless feisty ferocious fidgety fierce fiery | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1376 | fighter filthy fine finicky flagging flakey flamboyant flashy fleeting | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1377 | flexible flighty flippant flirty flustered focused foolish forceful | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1378 | forgetful forgiving formal fortunate foul frank frantic fresh fretful | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1379 | friendly frightened frigid frugal frustrated fuddy duddy fun | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1380 | fun loving funny furious furtive fussy gabby garrulous gaudy generous | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1381 | genial gentle giddy giggly gives up easily giving glamorous gloomy | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1382 | glorious glum goal orientated good goofy graceful gracious grandiose | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1383 | grateful greedy gregarious grieving grouchy growly gruesome gruff | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1384 | grumpy guarded guilt ridden guilty gullible haggling handsome happy | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1385 | hard hard working hardy harmonious harried harsh hateful haughty | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1386 | healthy heart broken heartless heavy hearted hedonistic helpful | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1387 | helpless hesitant high high self esteem hilarious homeless honest | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1388 | honor bound honorable hopeful hopeless hormonal horrible hospitable | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1389 | hostile hot headed huffy humble humorous hurt hysterical ignorant ill | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1390 | ill-bred imaginative immaculate immature immobile immodest impartial | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1391 | impatient imperial impolite impotent impractical impudent impulsive | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1392 | inactive incoherent incompetent inconsiderate inconsistent indecisive | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1393 | independent indifferent indiscrete indiscriminate indolent indulgent | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1394 | industrious inefficient inept inflexible inimitable innocent | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1395 | inquisitive insecure insensitive insightful insincere insipid | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1396 | insistent insolent instinctive insulting intellectual intelligent | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1397 | intense interested interrupting intimidating intolerant intrepid | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1398 | introspective introverted intuitive inventive involved irresolute | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1399 | irresponsible irreverent irritable irritating jackass jaded jealous | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1400 | jittery joking jolly jovial joyful joyous judgmental keen kenderish | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1401 | kind hearted kittenish knowledgeable lackadaisical lacking languid | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1402 | lascivious late lazy leader lean lethargic level lewd liar licentious | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1403 | light-hearted likeable limited lineat lingering lively logical lonely | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1404 | loquacious lordly loud loudmouth lovable lovely loves challenge loving | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1405 | low confidence lowly loyal lucky lunatic lying macho mad malicious | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1406 | manipulative mannerly materialistic matronly matter-of-fact mature | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1407 | mean meek melancholy melodramatic mentally slow merciful mercurial | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1408 | messy meticulous mild mischievous miserable miserly mistrusting modern | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1409 | modest moody moping moralistic motherly motivated mysterious nagging | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1410 | naive narcissistic narrow-minded nasty naughty neat | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1411 | needs social approval needy negative negligent nervous neurotic | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1412 | never hungry nibbler nice night owl nihilistic nimble nit picker | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1413 | no purpose no self confidence noble noisy nonchalant nosy | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1414 | not trustworthy nuanced nuisance nurturing nut obedient obese obliging | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1415 | obnoxious obscene obsequious observant obstinate odd odious open | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1416 | open-minded opinionated opportunistic optimistic orcish orderly | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1417 | organized ornery ossified ostentatious outgoing outrageous outspoken | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1418 | overbearing overweight overwhelmed overwhelming paces pacifistic | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1419 | painstaking panicky paranoid particular passionate passive | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1420 | passive-aggressive pathetic patient patriotic peaceful penitent | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1421 | pensive perfect perfectionist performer perserverant perseveres | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1422 | persevering persistent persuasive pert perverse pessimistic petty | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1423 | petulant philanthropic picky pious pitiful placid plain playful | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1424 | pleasant pleasing plotting plucky polite pompous poor popular positive | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1425 | possessive practical precise predictable preoccupied pretentious | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1426 | pretty prim primitive productive profane professional promiscuous | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1427 | proper protective proud prudent psychotic puckish punctilious punctual | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1428 | purposeful pushy puzzled quarrelsome queer quick quick tempered quiet | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1429 | quirky quixotic rambunctious random rash rational rawboned realistic | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1430 | reasonable rebellious recalcitrant receptive reckless reclusive | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1431 | refined reflective regretful rejects change relaxed relents reliable | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1432 | relieved religious reluctant remorseful repugnant repulsive resentful | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1433 | reserved resilient resolute resourceful respectful responsible | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1434 | responsive restless retiring rhetorical rich right righteous rigid | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1435 | risk-taking romantic rough rowdy rude rugged ruthless sacrificing sad | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1436 | sadistic safe sagely saintly salient sanctimonious sanguine sarcastic | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1437 | sassy satisfied saucy savage scared scarred scary scattered scheming | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1438 | scornful scrawny scruffy secretive secure sedate seductive selective | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1439 | self-centered self-confident self-conscious self-controlling | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1440 | self-directed self-disciplined self-giving self-reliant self-serving | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1441 | selfish selfless senile sensitive sensual sentimental serene serious | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1442 | sexual sexy shallow shameless sharp sharp-tongued sharp-witted | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1443 | sheepish shiftless shifty short shrewd shy silent silky silly simian | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1444 | simple sincere sisterly skillful sleazy sloppy slovenly slow paced | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1445 | slutty sly small-minded smart smiling smooth sneaky snob sociable | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1446 | soft-hearted soft-spoken solitary sore sorry sour spendthrift spiteful | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1447 | splendid spoiled spontaneous spunky squeamish stately static steadfast | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1448 | sterile stern stimulating stingy stoical stolid straight laced strange | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1449 | strict strident strong strong willed stubborn studious stupid suave | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1450 | submissive successful succinct sulky sullen sultry supercilious | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1451 | superstitious supportive surly suspicious sweet sympathetic systematic | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1452 | taciturn tacky tactful tactless talented talkative tall tardy tasteful | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1453 | temperamental temperate tenacious tense tentative terrible terrified | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1454 | testy thankful thankless thick skinned thorough thoughtful thoughtless | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1455 | threatening thrifty thrilled tight timid tired tireless tiresome | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1456 | tolerant touchy tough trivial troubled truculent trusting trustworthy | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1457 | truthful typical ugly unappreciative unassuming unbending unbiased | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1458 | uncaring uncommitted unconcerned uncontrolled unconventional | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1459 | uncooperative uncoordinated uncouth undependable understanding | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1460 | undesirable undisciplined unenthusiastic unfeeling unfocused | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1461 | unforgiving unfriendly ungrateful unhappy unhelpful uninhibited unkind | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1462 | unmotivated unpredictable unreasonable unreceptive unreliable | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1463 | unresponsive unrestrained unruly unscrupulous unselfish unsure | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1464 | unsympathetic unsystematic unusual unwilling upbeat upset uptight | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1465 | useful vacant vague vain valiant vengeful venomous verbose versatile | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1466 | vigorous vindictive violent virtuous visual vivacious volatile | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1467 | voracious vulgar vulnerable warlike warm hearted wary wasteful weak | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1468 | weary weird well grounded whimsical wholesome wicked wild willing wise | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1469 | wishy washy withdrawn witty worldly worried worthless wretched | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1470 | xenophobic youthful zany zealous}], }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1471 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1472 | # one way to test this on the command-line: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1473 | # perl halberdsnhelmets.pl get --redirect /characters | w3m -T text/html | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1474 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1475 | 307 | ▶ | sub name { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
name: called CC=4 SCAR=13.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1476 | 307 | my ($class, $name) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1477 | 307 | ▶ | if ($class eq T('halfling')) { return halfling_name($name) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1478 | 36 | elsif ($class eq T('elf')) { return elf_name($name) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1479 | 52 | elsif ($class eq T('dwarf')) { return dwarf_name($name) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1480 | 197 | return human_name($name); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1481 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1482 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1483 | 100 | ▶ | sub traits { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
traits: called CC=10 SCAR=23.1
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1484 | 100 | my ($char, $language) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1485 | 100 | local $lang = $language; # make sure T works as intended | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1486 | 100 | my $description = $char->{name} . ", "; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1487 | 100 | my $d; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1488 | 100 | ▶ | if ($char->{gender} eq "F") { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1489 | 57 | $d = d3(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1490 | } elsif ($char->{gender} eq "M") { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1491 | 43 | $d = 3 + d3(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1492 | } else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1493 | 0 | $d = d6(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1494 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1495 | 100 | ▶ | if ($d == 1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 6 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1496 | 11 | $description .= T('young woman'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1497 | } elsif ($d == 2) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1498 | 25 | $description .= T('woman'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1499 | } elsif ($d == 3) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1500 | 21 | $description .= T('elderly woman'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1501 | } elsif ($d == 4) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1502 | 15 | $description .= T('young man'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1503 | } elsif ($d == 5) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1504 | 18 | $description .= T('man'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1505 | } elsif ($d == 6) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1506 | 10 | $description .= T('elderly man'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1507 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1508 | 100 | $description .= ", "; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1509 | 100 | my $trait = one(@{$traits->{$lang}}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1510 | 100 | $description .= $trait; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1511 | 100 | my $other = one(@{$traits->{$lang}}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1512 | 100 | ▶ | if ($other ne $trait) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1513 | 100 | $description .= " " . T('and') . " " . $other; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1514 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1515 | 100 | provide($char, "traits", $description); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1516 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1517 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1518 | 307 | ▶ | sub random { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
random: called CC=48 SCAR=40.7
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1519 | 307 | my $char = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1520 | # keys that can be provided: name, class, charsheet | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1521 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1522 | 307 | my $class = $char->{class}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1523 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1524 | 307 | ▶ | my ($str, $dex, $con, $int, $wis, $cha) = | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
$class eq T("hireling") or $class eq T("porter") or $class eq T("dog")
$class eq T("hireling") or $class eq T("porter")
MC/DC33%1/3
$class eq T("hireling") or $class eq T("porter") or $class eq T("dog")
$class eq T("hireling")
$class eq T("porter")
$class eq T("dog")
Truth table50%2/4
A or B or C
A= $class eq T("hireling")B= $class eq T("porter")C= $class eq T("dog")
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1525 | $class eq T('hireling') || $class eq T('porter') || $class eq T('dog') | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1526 | ? (10, 10, 10, 10, 10, 10) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1527 | : (roll_3d6(), roll_3d6(), roll_3d6(), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1528 | roll_3d6(), roll_3d6(), roll_3d6()); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1529 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1530 | # if a class is provided, make sure minimum requirements are met | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1531 | 307 | ▶ | if ($class eq T('dwarf')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1532 | 0 | ▶ | $con = roll_3d6() until average($con); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1533 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1534 | 307 | ▶ | if ($class eq T('elf')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1535 | 0 | ▶ | $int = roll_3d6() until average($int); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1536 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1537 | 307 | ▶ | if ($class eq T('halfling')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1538 | 0 | ▶ | $con = roll_3d6() until average($con); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1539 | 0 | ▶ | $dex = roll_3d6() until average($dex); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1540 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1541 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1542 | 307 | provide($char, "str", $str); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1543 | 307 | provide($char, "dex", $dex); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1544 | 307 | provide($char, "con", $con); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1545 | 307 | provide($char, "int", $int); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1546 | 307 | provide($char, "wis", $wis); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1547 | 307 | provide($char, "cha", $cha); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1548 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1549 | 307 | provide($char, "xp", "0"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1550 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1551 | 307 | ▶ | if ($class eq T('hireling') or $class eq T('porter')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
$class eq T("hireling") or $class eq T("porter")
MC/DC50%1/2
$class eq T("hireling") or $class eq T("porter")
$class eq T("hireling")
$class eq T("porter")
Truth table66%2/3
A or B
A= $class eq T("hireling")B= $class eq T("porter")
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1552 | 1 | provide($char, "level", "0"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1553 | 1 | provide($char, "thac0", 20); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1554 | } elsif ($class eq T('dog')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1555 | 0 | provide($char, "ac", "7"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1556 | 0 | provide($char, "level", "2"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1557 | 0 | provide($char, "thac0", 17); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1558 | } else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1559 | 306 | provide($char, "level", "1"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1560 | 306 | provide($char, "thac0", 19); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1561 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1562 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1563 | 307 | my $best = best($str, $dex, $con, $int, $wis, $cha); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1564 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1565 | 307 | ▶ | if (not $class) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1566 | 302 | ▶ | if (average($con) and $best eq "str") { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 6 branches
Condition100%3/3
average($con) and $best eq "str"
MC/DC100%2/2
average($con) and $best eq "str"
average($con)
$best eq "str"
Truth table100%3/3
A and B
A= average($con)B= $best eq "str"
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1567 | 52 | $class = T('dwarf'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1568 | ▶ | } elsif (average($int) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%6/6
average($int) and good($str, $dex) and d6() > 2
average($int) and good($str, $dex)
MC/DC100%3/3
average($int) and good($str, $dex) and d6() > 2
average($int)
good($str, $dex)
d6() > 2
Truth table100%4/4
A and B and C
A= average($int)B= good($str, $dex)C= d6() > 2
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1569 | and good($str, $dex) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1570 | and d6() > 2) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1571 | 36 | $class = T('elf'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1572 | ▶ | } elsif (average($str, $dex, $con) == 3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%6/6
average($str, $dex, $con) == 3 and good($str, $dex, $con) and d6() > 2
average($str, $dex, $con) == 3 and good($str, $dex, $con)
MC/DC100%3/3
average($str, $dex, $con) == 3 and good($str, $dex, $con) and d6() > 2
average($str, $dex, $con) == 3
good($str, $dex, $con)
d6() > 2
Truth table100%4/4
A and B and C
A= average($str, $dex, $con) == 3B= good($str, $dex, $con)C= d6() > 2
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1573 | and good($str, $dex, $con) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1574 | and d6() > 2) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1575 | 22 | $class = T('halfling'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1576 | ▶ | } elsif (average($str, $dex, $con) >= 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%9/9
average($str, $dex, $con) >= 2 and $best eq "str" || $best eq "con" or good($str, $dex, $con) >= 2
average($str, $dex, $con) >= 2 and $best eq "str" || $best eq "con"
$best eq "str" or $best eq "con"
MC/DC100%4/4
average($str, $dex, $con) >= 2 and $best eq "str" || $best eq "con" or good($str, $dex, $con) >= 2
average($str, $dex, $con) >= 2
$best eq "str"
$best eq "con"
good($str, $dex, $con) >= 2
Truth table83%5/6
A and B or C or D
A= average($str, $dex, $con) >= 2B= $best eq "str"C= $best eq "con"D= good($str, $dex, $con) >= 2
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1577 | and ($best eq "str" or $best eq "con") | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1578 | or good($str, $dex, $con) >= 2) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1579 | 47 | $class = T('fighter'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1580 | } elsif ($best eq "int") { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1581 | 46 | $class = T('magic-user'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1582 | } elsif ($best eq "dex") { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1583 | 20 | $class = T('thief'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1584 | } else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1585 | 79 | my @candidates = (T('thief'), T('magic-user'), T('fighter')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1586 | 79 | $class = one(@candidates); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1587 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1588 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1589 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1590 | 307 | provide($char, "class", $class); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1591 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1592 | 307 | ▶ | unless ($char->{name}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1593 | 305 | my ($name, $gender) = name($class); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1594 | 305 | provide($char, "name", $name); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1595 | 305 | $char->{gender} = $gender; # don't put it on the character sheet | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1596 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1597 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1598 | 307 | ▶ | unless ($char->{gender}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1599 | 2 | my ($name, $gender) = name($class, $char->{name}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1600 | 2 | $char->{gender} = $gender; # don't put it on the character sheet | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1601 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1602 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1603 | 307 | ▶ | if ($class eq T('halfling')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1604 | 22 | provide($char, "range-thac0", 18 - bonus($dex)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1605 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1606 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1607 | 307 | my $level = $char->{level}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1608 | 307 | my $hp = $char->{hp}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1609 | 307 | ▶ | if (not $hp) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1610 | 307 | ▶ | if ($class eq T('fighter') or $class eq T('dwarf') or $class eq T('dog')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition83%5/6
$class eq T("fighter") or $class eq T("dwarf") or $class eq T("dog")
$class eq T("fighter") or $class eq T("dwarf")
MC/DC66%2/3
$class eq T("fighter") or $class eq T("dwarf") or $class eq T("dog")
$class eq T("fighter")
$class eq T("dwarf")
$class eq T("dog")
Truth table75%3/4
A or B or C
A= $class eq T("fighter")B= $class eq T("dwarf")C= $class eq T("dog")
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1611 | 129 | $hp += max(1, d8() + bonus($con)) for 1.. $level; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1612 | 129 | ▶ | $hp += 2 if $class eq T('dog'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1613 | ▶ | } elsif ($class eq T('elf') or $class eq T('halfling')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$class eq T("elf") or $class eq T("halfling")
MC/DC100%2/2
$class eq T("elf") or $class eq T("halfling")
$class eq T("elf")
$class eq T("halfling")
Truth table100%3/3
A or B
A= $class eq T("elf")B= $class eq T("halfling")
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1614 | 58 | $hp += max(1, d6() + bonus($con)) for 1.. $level; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1615 | } else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1616 | # hirelings with level 0 still get hp | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1617 | 120 | $hp += max(1, d4() + bonus($con)) for 1.. max($level, 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1618 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1619 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1620 | 307 | provide($char, "hp", $hp); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1621 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1622 | 307 | equipment($char); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1623 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1624 | 307 | my $abilities = abilities($char); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1625 | # spellbook | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1626 | 307 | ▶ | if ($class eq T('magic-user') or $class eq T('elf')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$class eq T("magic-user") or $class eq T("elf")
MC/DC100%2/2
$class eq T("magic-user") or $class eq T("elf")
$class eq T("magic-user")
$class eq T("elf")
Truth table100%3/3
A or B
A= $class eq T("magic-user")B= $class eq T("elf")
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1627 | 107 | $abilities .= "\\\\" . spellbook(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1628 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1629 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1630 | 307 | provide($char, "abilities", $abilities); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1631 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1632 | 307 | ▶ | if (not $char->{charsheet}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1633 | 307 | ▶ | if ($class eq T('hireling') or $class eq T('porter') or $class eq T('dog')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
$class eq T("hireling") or $class eq T("porter") or $class eq T("dog")
$class eq T("hireling") or $class eq T("porter")
MC/DC33%1/3
$class eq T("hireling") or $class eq T("porter") or $class eq T("dog")
$class eq T("hireling")
$class eq T("porter")
$class eq T("dog")
Truth table50%2/4
A or B or C
A= $class eq T("hireling")B= $class eq T("porter")C= $class eq T("dog")
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1634 | 1 | provide($char, "charsheet", T('Hireling-target20.svg')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1635 | } else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1636 | 306 | provide($char, "charsheet", T('Charactersheet-landscape-target20.svg')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1637 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1638 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1639 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1640 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1641 | 307 | ▶ | sub abilities { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
abilities: called CC=6 SCAR=17.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1642 | 307 | my $char = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1643 | 307 | my $class = $char->{class}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1644 | 307 | my $abilities = T('1/6 for normal tasks'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1645 | 307 | ▶ | if ($class eq T('elf')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1646 | 36 | $abilities .= "\\\\" . T('2/6 to hear noise'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1647 | 36 | $abilities .= "\\\\" . T('2/6 to find secret or concealed doors'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1648 | } elsif ($class eq T('dwarf')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1649 | 52 | $abilities .= "\\\\" . T('2/6 to hear noise'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1650 | 52 | $abilities .= "\\\\" . T('2/6 to find secret constructions and traps'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1651 | } elsif ($class eq T('halfling')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1652 | 22 | $abilities .= "\\\\" . T('2/6 to hear noise'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1653 | 22 | $abilities .= "\\\\" . T('2/6 to hide and sneak'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1654 | 22 | $abilities .= "\\\\" . T('5/6 to hide and sneak outdoors'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1655 | 22 | $abilities .= "\\\\" . T('+1 bonus to ranged weapons'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1656 | 22 | $abilities .= "\\\\" . T('AC -2 vs. opponents larger than humans'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1657 | } elsif ($class eq T('thief')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1658 | 48 | my $level = $char->{level}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1659 | 48 | my $n = 2 + int($char->{level} / 3); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1660 | 48 | ▶ | $n = 5 if $n > 5; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1661 | # override the 1/6 for normal tasks | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1662 | 48 | $abilities = sprintf(T('%d/6 for all activities'), $n); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1663 | 48 | $abilities .= "\\\\" . T('+4 to hit and double damage backstabbing'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1664 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1665 | 307 | return $abilities; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1666 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1667 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1668 | 0 | ▶ | sub classes { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
classes: not called CC=1 SCAR=6.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1669 | return { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1670 | 0 | T('dwarf') => "D", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1671 | T('elf') => "E", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1672 | T('halfling') => "H", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1673 | T('fighter') => "F", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1674 | T('magic-user') => "M", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1675 | T('thief') => "T", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1676 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1677 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1678 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1679 | 307 | ▶ | sub random_parameters { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
random_parameters: called CC=3 SCAR=11.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1680 | 307 | my ($char, $language) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1681 | 307 | local $lang = $language; # make sure T works as intended | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1682 | 307 | random($char); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1683 | # choose a random portrait based on the character gender or class | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1684 | 307 | ▶ | if (member("portrait", @_)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1685 | 7 | ▶ | provide($char, "portrait", portrait($char)) unless $char->{portrait}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1686 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1687 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1688 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1689 | 7 | ▶ | sub portrait { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
portrait: called CC=11 SCAR=46.8
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1690 | 7 | my $char = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1691 | 7 | ▶ | my $face_generator_url = app->config("face_generator_url") or return ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1692 | 0 | my $artist = "alex"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1693 | 0 | my $gender = $char->{gender}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1694 | 0 | ▶ | if ($char->{class} eq T('elf') | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
Condition0%0/3
$char->{"class"} eq T("elf") or $char->{"race"} eq T("elf")
MC/DC0%0/2
$char->{"class"} eq T("elf") or $char->{"race"} eq T("elf")
$char->{"class"} eq T("elf")
$char->{"race"} eq T("elf")
Truth table0%0/3
A or B
A= $char->{"class"} eq T("elf")B= $char->{"race"} eq T("elf")
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1695 | or $char->{race} eq T('elf')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1696 | 0 | $gender = "elf"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1697 | ▶ | } elsif ($char->{class} eq T('dwarf') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$char->{"class"} eq T("dwarf") or $char->{"race"} eq T("dwarf")
MC/DC0%0/2
$char->{"class"} eq T("dwarf") or $char->{"race"} eq T("dwarf")
$char->{"class"} eq T("dwarf")
$char->{"race"} eq T("dwarf")
Truth table0%0/3
A or B
A= $char->{"class"} eq T("dwarf")B= $char->{"race"} eq T("dwarf")
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1698 | or $char->{race} eq T('dwarf')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1699 | 0 | $gender = "dwarf"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1700 | } elsif ($char->{class} eq T('dog')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1701 | 0 | $artist = "alex3"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1702 | 0 | $gender = "dog"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1703 | } elsif ($gender eq "F") { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1704 | 0 | $gender = "woman"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1705 | } elsif ($gender eq "M") { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1706 | 0 | $gender = "man"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1707 | } else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1708 | 0 | $gender = one("woman", "man"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1709 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1710 | 0 | my $url = Mojo::URL->new("$face_generator_url/redirect/$artist/$gender"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1711 | 0 | my $ua = Mojo::UserAgent->new; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1712 | 0 | my $tx = $ua->get($url); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1713 | 0 | ▶ | if ($tx->res->code == 302) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1714 | 0 | $url->path($tx->res->headers->location); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1715 | } else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1716 | $log->warn("Did you configure the face_generator_url setting in the config file correctly? " | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1717 | . "It is currently set to $face_generator_url. " | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1718 | . ($tx->res->code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1719 | ? "It returns: " . $tx->res->code . " " . $tx->res->message | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1720 | 0 | ▶ | : "The error: " . $tx->res->error->{message})); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1721 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1722 | 0 | return $url; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1723 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1724 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1725 | 2 | ▶ | sub characters { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
characters: called CC=2 SCAR=6.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1726 | 2 | my ($char, $lang) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1727 | 2 | my @characters; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1728 | 2 | ▶ | for (my $i = 0; $i < 50; $i++) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1729 | 100 | my %one = %$char; # defaults | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1730 | 100 | random_parameters(\%one, $lang); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1731 | 100 | traits(\%one, $lang); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1732 | 100 | push(@characters, \%one); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1733 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1734 | 2 | return \@characters; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1735 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1736 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1737 | 2 | ▶ | sub stats { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stats: called CC=9 SCAR=22.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1738 | 2 | my ($char, $language, $n) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1739 | 2 | local $lang = $language; # make sure T works as intended | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1740 | 2 | my (%class, %property); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1741 | 2 | ▶ | for (my $i = 0; $i < $n; $i++) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1742 | 200 | my %one = %$char; # defaults | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1743 | 200 | random_parameters(\%one, $lang); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1744 | 200 | $class{$one{class}}++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1745 | 200 | foreach (split(/\\\\/, $one{property})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1746 | 2395 | $property{$_}++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1747 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1748 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1749 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1750 | 2 | $n = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1751 | 2 | my $txt = T('Classes') . "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1752 | 2 | foreach (sort { $class{$b} <=> $class{$a} } keys %class) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1753 | 12 | $txt .= sprintf "%25s %4d\n", $_, $class{$_}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1754 | 12 | $n += $class{$_}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1755 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1756 | 2 | $txt .= sprintf "%25s %4d\n", "total", $n; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1757 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1758 | 2 | $txt .= T('Property') . "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1759 | 2 | foreach (sort { $property{$b} <=> $property{$a} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1760 | keys %property) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1761 | 147 | ▶ | next if /starting gold:/ or /gold$/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
/starting gold:/u or /gold$/u
MC/DC50%1/2
/starting gold:/u or /gold$/u
/starting gold:/u
/gold$/u
Truth table66%2/3
A or B
A= /starting gold:/uB= /gold$/u
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1762 | 106 | ▶ | next if /Startgold:/ or /Gold$/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
/Startgold:/u or /Gold$/u
MC/DC50%1/2
/Startgold:/u or /Gold$/u
/Startgold:/u
/Gold$/u
Truth table66%2/3
A or B
A= /Startgold:/uB= /Gold$/u
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1763 | 70 | $txt .= sprintf "%25s %4d\n", $_, $property{$_}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1764 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1765 | 2 | return $txt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1766 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1767 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1768 | 0 | ▶ | sub url_encode { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
url_encode: not called CC=4 SCAR=30.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1769 | 0 | my $str = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1770 | 0 | ▶ | return '' unless defined $str; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1771 | 0 | utf8::encode($str); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1772 | 0 | my @letters = split(//, $str); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1773 | 0 | my %safe = map {$_ => 1} ("a" .. "z", "A" .. "Z", "0" .. "9", "-", "_", ".", "!", "~", "*", "\"", "(", ")", "#"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1774 | 0 | foreach my $letter (@letters) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1775 | 0 | ▶ | $letter = sprintf("%%%02x", ord($letter)) unless $safe{$letter}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1776 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1777 | 0 | return join('', @letters); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1778 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1779 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1780 | 20 | ▶ | sub init { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=2 SCAR=6.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1781 | 20 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1782 | 20 | my %char = %{$self->req->params->to_hash}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1783 | 20 | my @provided; # We want to remember the order! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1784 | 20 | my @pairs = @{$self->req->params->pairs}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1785 | 20 | ▶ | while (@pairs) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1786 | 125 | my $key = shift @pairs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1787 | 125 | my $value = shift @pairs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1788 | 125 | push(@provided, $key); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1789 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1790 | 20 | $char{provided} = \@provided; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1791 | 20 | return \%char; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1792 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1793 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1794 | 7 | ▶ | sub lang { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
lang: called CC=1 SCAR=0.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1795 | 7 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1796 | 7 | my $acceptor = I18N::AcceptLanguage->new(defaultLanguage => "en"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1797 | 7 | return $acceptor->accepts($self->req->headers->accept_language, [qw(en de)]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1798 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1799 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1800 | 11 | plugin "Config" => {default => {}}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1801 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1802 | 2 | ▶ | get "/" => sub { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1803 | 2 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1804 | 2 | $self->redirect_to($self->url_with("main" => {lang => lang($self)})); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1805 | 11 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1806 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1807 | 3 | ▶ | get "/:lang" => [lang => qr/(?:en|de)/] => sub { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1808 | 3 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1809 | 3 | my $lang = $self->param("lang"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1810 | 3 | my $query = $self->req->query_params->to_string; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1811 | 3 | ▶ | if ($query) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1812 | # deprecated | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1813 | 1 | $query =~ tr/;/&/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1814 | 1 | my $params = Mojo::Parameters->new($query); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1815 | 1 | return $self->redirect_to($self->url_for("char" => {lang => $lang})->query(@$params)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1816 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1817 | 2 | $self->render(template => "index.$lang"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1818 | 11 | } => "main"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1819 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1820 | 11 | get "/help" => "help"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1821 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1822 | 11 | get "/hilfe" => "hilfe"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1823 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1824 | 2 | ▶ | get "/random" => sub { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1825 | 2 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1826 | 2 | $self->redirect_to($self->url_with("random" => {lang => lang($self)})); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1827 | 11 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1828 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1829 | 0 | ▶ | get "/random/text/:lang" => sub { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1830 | 0 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1831 | 0 | my $char = init($self); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1832 | 0 | my $lang = $self->param("lang"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1833 | 0 | random_parameters($char, $lang, "portrait"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1834 | 0 | compute_data($char, $lang); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1835 | 0 | $self->render(template => "text.$lang", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1836 | format => "txt", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1837 | char => $char); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1838 | 11 | } => "text"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1839 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1840 | 6 | ▶ | get "/random/:lang" => [lang => qr/(?:en|de)/] => sub { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1841 | 6 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1842 | 6 | my $char = init($self); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1843 | 6 | my $lang = $self->param("lang"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1844 | 6 | random_parameters($char, $lang, "portrait"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1845 | 6 | compute_data($char, $lang); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1846 | 6 | my $svg = svg_transform($self, svg_read($char)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1847 | 6 | $self->render(format => "svg", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1848 | data => $svg->toString()); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1849 | 11 | } => "random"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1850 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1851 | 0 | ▶ | get "/char" => sub { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1852 | 0 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1853 | 0 | $self->redirect_to($self->url_with("char" => {lang => lang($self)})); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1854 | 11 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1855 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1856 | 6 | ▶ | get "/char/:lang" => [lang => qr/(?:en|de)/] => sub { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1857 | 6 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1858 | 6 | my $char = init($self); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1859 | 6 | my $lang = $self->param("lang"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1860 | # no random parameters | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1861 | 6 | compute_data($char, $lang); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1862 | 6 | my $svg = svg_transform($self, svg_read($char)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1863 | 6 | $self->render(format => "svg", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1864 | data => $svg->toString()); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1865 | 11 | } => "char"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1866 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1867 | # deprecated | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1868 | 1 | ▶ | get "/link/:lang" => [lang => qr/(?:en|de)/] => sub { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1869 | 1 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1870 | 1 | my $lang = $self->param("lang"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1871 | 1 | my $query = $self->req->query_params; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1872 | 1 | $query =~ tr/;/&/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1873 | 1 | my $params = Mojo::Parameters->new($query); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1874 | 1 | $self->redirect_to($self->url_for("edit" => {lang => lang($self)})->query(@$params)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1875 | 11 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1876 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1877 | 0 | ▶ | get "/edit" => sub { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1878 | 0 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1879 | 0 | $self->redirect_to(edit => {lang => lang($self)}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1880 | 11 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1881 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1882 | 3 | ▶ | get "/edit/:lang" => [lang => qr/(?:en|de)/] => sub { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1883 | 3 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1884 | 3 | my $char = init($self); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1885 | 3 | my $lang = $self->param("lang"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1886 | 3 | $self->render(template => "edit.$lang", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1887 | char => $char); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1888 | 11 | } => "edit"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1889 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1890 | 0 | ▶ | get "/redirect" => sub { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1891 | 0 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1892 | 0 | $self->redirect_to($self->url_with("redirect" => {lang => lang($self)})); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1893 | 11 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1894 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1895 | 2 | ▶ | get "/redirect/:lang" => [lang => qr/(?:en|de)/] => sub { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1896 | 2 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1897 | 2 | my $lang = $self->param("lang"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1898 | 2 | my $input = $self->param("input"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1899 | 2 | my $params = Mojo::Parameters->new; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1900 | 2 | my $last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1901 | 2 | ▶ | while ($input =~ /^([-a-z0-9]*): *(.*?)\r?$/gm) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1902 | 76 | ▶ | if ($1 eq $last or $1 eq "") { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$1 eq $last or $1 eq ""
MC/DC50%1/2
$1 eq $last or $1 eq ""
$1 eq $last
$1 eq ""
Truth table66%2/3
A or B
A= $1 eq $lastB= $1 eq ""
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1903 | 25 | $params->param($1 => $params->param($1) . "\\\\$2"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1904 | } else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1905 | 51 | $params->append($1 => $2); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1906 | 51 | $last = $1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1907 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1908 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1909 | 2 | $self->redirect_to($self->url_for("char" => {lang => $lang})->query($params)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1910 | 11 | } => "redirect"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1911 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1912 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1913 | 1 | ▶ | get "/show" => sub { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1914 | 1 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1915 | 1 | my $char = init($self); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1916 | 1 | my $svg = svg_show_id(svg_read($char)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1917 | 1 | $self->render(format => "svg", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1918 | data => $svg->toString()); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1919 | 11 | } => "show"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1920 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1921 | 0 | ▶ | get "/characters" => sub { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1922 | 0 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1923 | 0 | $self->redirect_to($self->url_with("characters" => {lang => lang($self)})); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1924 | 11 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1925 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1926 | 2 | ▶ | get "/characters/:lang" => [lang => qr/(?:en|de)/] => sub { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1927 | 2 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1928 | 2 | my $lang = $self->param("lang"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1929 | 2 | my $char = init($self); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1930 | 2 | $self->render(template => "characters.$lang", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1931 | width => "100%", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1932 | characters => characters($char, $lang)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1933 | 11 | } => "characters"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1934 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1935 | 1 | ▶ | get "/stats" => sub { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1936 | 1 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1937 | 1 | $self->redirect_to($self->url_with("stats" => {lang => lang($self), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1938 | n => 100})); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1939 | 11 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1940 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1941 | 1 | ▶ | get "/stats/:n" => [n => qr/\d+/] => sub { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1942 | 1 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1943 | 1 | my $n = $self->param("n"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1944 | 1 | $self->redirect_to($self->url_with("stats" => {lang => lang($self), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1945 | n => $n})); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1946 | 11 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1947 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1948 | 1 | ▶ | get "/stats/:lang" => [lang => qr/(?:en|de)/] => sub { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1949 | 1 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1950 | 1 | my $lang = $self->param("lang"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1951 | 1 | $self->redirect_to($self->url_with("stats" => {lang => $lang, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1952 | n => 100})); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1953 | 11 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1954 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1955 | 2 | ▶ | get "/stats/:lang/:n" => [lang => qr/(?:en|de)/, n => qr/\d+/] => sub { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1956 | 2 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1957 | 2 | my $lang = $self->param("lang"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1958 | 2 | my $n = $self->param("n"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1959 | 2 | my $char = init($self); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1960 | 2 | $self->render(format => "txt", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1961 | text => stats($char, $lang, $n)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1962 | 11 | } => "stats"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1963 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1964 | 11 | ▶ | app->secrets([app->config("secret")]) if app->config("secret"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1965 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1966 | 11 | app->start; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1967 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1968 | __DATA__ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||