Re: [CODE HELP NEEDED] Attack Types

From: Eric Helvey (
Date: 02/17/99

Well... if you want to include the type in the attack as well you'll need
to change the interface to the damage function at the minimum... that
would obviously require changing every invocation of the damage

I would personally suggest using bits to represent different types, that
way if you had a Fire Elemental Holy Knight he could be both Fire and
Holy...  but I digress.  I would also suggest using vulnerabilities as
opposed to resistances, since it'll be easier to deal with...

with your modififed damage function that might look something like...

damage(...., int attack_type)

You would get to the section just before you apply the damage to the

if(ch->...->type & attack_type)
        damage <<= 1;

then in your spell or in the hit function... you might have an invocation

damage(ch, vict, ... , ch->...->type);


What part of this problem did you not understand?  To me it seems like the
only issues are investing some time in changing every call to the damage
function and a little rudimentary bit checking... not hard stuff.  If you
intend to actually develop your MUD, I might suggest taking a Data
Structures class at the minimum...


On Wed, 17 Feb 1999, Kaine LaZaro wrote:

> Alright, I didn't get any help when I asked for help, so now I'm going to
> ask again, and give my idea of how to do it, and mabe one of you coders
> who actualy knows what there doing could help me out some.
> I'm going to be making new classes that have a type on them, example: Holy
> Knights are a Holy class and Zombie Mages are an UnHoly class.
> in one of the chr structures for both pc and npcs I'd add:
>   int type;
> and write up this tward the begining of structs.h:
> #define TYPE_NONE   -1
> #define TYPE_HOLY   0
> #define TYPE_UNHOLY 1
> #define MAX_TYPE    2
> Then compain them in pulse_violance...
> Any sugestions etc/help and what not?
> Thanks James
> `Up, Down, Over, and Through, Back arround the Jokes on you!'
>  -- Magic the Gathering
>      +------------------------------------------------------------+
>      | Ensure that you have read the CircleMUD Mailing List FAQ:  |
>      |  |
>      +------------------------------------------------------------+

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  |

This archive was generated by hypermail 2b30 : 12/15/00 PST