Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sub condense {
- my ($augs) = @_;
- my $augRef = {
- MINOR => 0x01,
- BASIC => 0x02,
- STD => 0x04,
- GOOD => 0x08,
- EXC => 0x10,
- SUP => 0x20,
- ULT => 0x40,
- };
- my $destination = shift(@{$augs});
- my $augCount = {
- Minor => shift(@{$augs}) || 0,
- Basic => shift(@{$augs}) || 0,
- Std => shift(@{$augs}) || 0,
- Good => shift(@{$augs}) || 0,
- Exc => shift(@{$augs}) || 0,
- Sup => shift(@{$augs}) || 0,
- Ult => shift(@{$augs}) || 0,
- };
- if (!defined $augRef->{(uc($destination))}) {
- return "Augmenter type $destination does not seem to exist. Maybe you included a '.'?";
- }
- my $totalPoints = 0;
- while (my ($type, $num) = each (%{$augCount})) {
- if (!isNumber($num)) {
- return "Not a number for aug type $type\n";
- }
- $totalPoints += ($augRef->{(uc($type))} * $num);
- }
- my $result = floor($totalPoints/($augRef->{(uc($destination))}));
- return "The combination of those augmenters will make $result $destination augs.";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement