#! perl # wizard commands cf::register_command goto => 0, sub { my ($ob, $arg) = @_; return unless $ob->may ("command_goto"); my $portal = cf::object::new "exit"; $portal->slaying ($arg); $portal->stats->hp (0); $portal->stats->sp (0); $portal->apply ($ob); $portal->free; }; cf::register_command wizpass => 0, sub { my ($ob, $arg) = @_; return unless $ob->may ("command_wizpass"); my $new_val = length $arg ? $arg * 1 : !$ob->flag (cf::FLAG_WIZPASS); $ob->flag (cf::FLAG_WIZPASS, $new_val); $ob->reply (undef, $new_val ? "You will now walk through walls.\n" : "You will now be stopped by walls.\n", ); }; cf::register_command wizcast => 0, sub { my ($ob, $arg) = @_; return unless $ob->may ("command_wizcast"); my $new_val = length $arg ? $arg * 1 : !$ob->flag (cf::FLAG_WIZCAST); $ob->flag (cf::FLAG_WIZCAST, $new_val); $ob->reply (undef, $new_val ? "You can now cast spells anywhere." : "You now cannot cast spells in no-magic areas.", ); };