[Crossfire-wiki] [Crossfire DokuWiki] page added: user:mhoram:scripts:attacktype

no-reply_wiki at metalforge.org no-reply_wiki at metalforge.org
Tue Mar 6 10:24:08 CST 2007


A page in your DokuWiki was added or changed. Here are the details:

Date        : 2007/03/06 10:24
User        : mhoram
Edit Summary: created

Here's a very simple script that takes a number as an argument and outputs the attacktypes corresponding to that value.  Requires Perl.

<code perl>
#!/usr/bin/perl
use warnings;
use strict;

die "Usage: attacktype <number>\n" unless $ARGV[0] =~ /^\d+$/;

my @attacktypes = qw( physical      # taken from include/attack.h
		      magic	
		      fire		
		      electricity	
		      cold		
		      confusion	
		      acid		
		      drain	
		      weaponmagic	
		      ghosthit	
		      poison	
		      slow		
		      paralyze	
		      turn_undead	
		      fear		
		      cancellation 
		      deplete      
		      death        
		      chaos        
		      counterspell 
		      godpower	
		      holyword	
		      blind	
		      internal	
		      life_stealing
		      disease	
		    );

for my $at (0..25){
    if( $ARGV[0] & (2**$at)){
	print "$attacktypes[$at]\n";
    }
}
</code>


IP-Address  : 206.71.197.56
Old Revision: none
New Revision: http://wiki.metalforge.net/doku.php/user:mhoram:scripts:attacktype

-- 
This mail was generated by DokuWiki at
http://wiki.metalforge.net/




More information about the crossfire-wiki mailing list