… | |
… | |
269 | my ($self, $arch_name, @map_stack) = @_; |
269 | my ($self, $arch_name, @map_stack) = @_; |
270 | |
270 | |
271 | my @c = |
271 | my @c = |
272 | grep { |
272 | grep { |
273 | $_->flag (cf::FLAG_IS_CAULDRON) |
273 | $_->flag (cf::FLAG_IS_CAULDRON) |
274 | and $_->archetype->name eq $arch_name |
274 | and $_->arch->name eq $arch_name |
275 | } @map_stack; |
275 | } @map_stack; |
276 | |
276 | |
277 | $self->{cauldron} = $c[0]; |
277 | $self->{cauldron} = $c[0]; |
278 | } |
278 | } |
279 | |
279 | |
… | |
… | |
380 | |
380 | |
381 | sub value { |
381 | sub value { |
382 | my ($self, $group, $archname) = @_; |
382 | my ($self, $group, $archname) = @_; |
383 | |
383 | |
384 | my @objs = grep { |
384 | my @objs = grep { |
385 | $_->archetype->name eq $archname |
385 | $_->arch->name eq $archname |
386 | } @{$self->{ingredients}->{$group} || []}; |
386 | } @{$self->{ingredients}->{$group} || []}; |
387 | |
387 | |
388 | my $sum = 0; |
388 | my $sum = 0; |
389 | for (@objs) { |
389 | for (@objs) { |
390 | $sum += ($_->nrof || 1) * $_->value; |
390 | $sum += ($_->nrof || 1) * $_->value; |
… | |
… | |
407 | |
407 | |
408 | my @out; |
408 | my @out; |
409 | |
409 | |
410 | for (@{$ingred->{$group}}) { |
410 | for (@{$ingred->{$group}}) { |
411 | if (defined $archname) { |
411 | if (defined $archname) { |
412 | if ($_->archetype->name eq $archname) { |
412 | if ($_->arch->name eq $archname) { |
413 | Jeweler::Util::remove ($_); |
413 | Jeweler::Util::remove ($_); |
414 | } else { |
414 | } else { |
415 | push @out, $_; |
415 | push @out, $_; |
416 | } |
416 | } |
417 | } else { |
417 | } else { |
… | |
… | |
659 | my $rv = $r->{resist}->{$_}; |
659 | my $rv = $r->{resist}->{$_}; |
660 | "(resist " . (lc $Jeweler::RESMAP{$_}) . " " . ($rv > 0 ? '+' : '') . $rv . ")" |
660 | "(resist " . (lc $Jeweler::RESMAP{$_}) . " " . ($rv > 0 ? '+' : '') . $rv . ")" |
661 | } grep { $r->{resist}->{$_} } @Jeweler::RESISTS), |
661 | } grep { $r->{resist}->{$_} } @Jeweler::RESISTS), |
662 | (map { |
662 | (map { |
663 | my $rv = $r->{stat}->{$_}; |
663 | my $rv = $r->{stat}->{$_}; |
664 | "(" . (lc $_) . ($rv > 0 ? '+' : '') . $rv . ")" |
664 | "(" . (ucfirst lc $_) . ($rv > 0 ? '+' : '') . $rv . ")" |
665 | } grep { $r->{stat}->{$_} } keys %{$r->{stat}}), |
665 | } grep { $r->{stat}->{$_} } keys %{$r->{stat}}), |
666 | (map { |
666 | (map { |
667 | my $rv = $r->{spec}->{$_}; |
667 | my $rv = $r->{spec}->{$_}; |
668 | "(" . (lc $_) . ($rv > 0 ? '+' : '') . $rv . ")" |
668 | "(" . (lc $_) . ($rv > 0 ? '+' : '') . $rv . ")" |
669 | } grep { $r->{spec}->{$_} } keys %{$r->{spec}}))) |
669 | } grep { $r->{spec}->{$_} } keys %{$r->{spec}}))) |
… | |
… | |
691 | $obj->{spec}{ac} = $stats->ac; |
691 | $obj->{spec}{ac} = $stats->ac; |
692 | $obj->{spec}{speed} = $stats->exp; |
692 | $obj->{spec}{speed} = $stats->exp; |
693 | $obj->{spec}{food} = $stats->food; |
693 | $obj->{spec}{food} = $stats->food; |
694 | |
694 | |
695 | $obj->{name} = $thing->name; |
695 | $obj->{name} = $thing->name; |
696 | $obj->{arch} = $thing->archetype->name; |
696 | $obj->{arch} = $thing->arch->name; |
697 | $obj->{face} = $thing->face; |
697 | $obj->{face} = $thing->face; |
698 | |
698 | |
699 | $self->{hash} = $obj |
699 | $self->{hash} = $obj |
700 | } |
700 | } |
701 | |
701 | |
… | |
… | |
981 | and return 1; |
981 | and return 1; |
982 | } elsif ($i % 3 == 1) { |
982 | } elsif ($i % 3 == 1) { |
983 | $thing->title eq $match |
983 | $thing->title eq $match |
984 | and return 1; |
984 | and return 1; |
985 | } else { # $i % 3 == 2 |
985 | } else { # $i % 3 == 2 |
986 | $thing->archetype->name eq $match |
986 | $thing->arch->name eq $match |
987 | and return 1; |
987 | and return 1; |
988 | } |
988 | } |
989 | $i++; |
989 | $i++; |
990 | } |
990 | } |
991 | return 0; |
991 | return 0; |