[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Spells and fireballs

I'm trying to create a combat system for a RPG, but the magic is giving
me some problems. First: I'm programming in c++.

When the combat is going on I intend to create a combat engine that
handles where the creatures and obejts are located on the battle field,
and also handles who's turn it is.

When the creature casts a spell which sends a ball (like a fireball)
against an enemy, the spell gives a spell_ball object to the combat
engine. The spell_ball haves a function that handles impact:

virtual ?? impact(creature *);

The reason that the function is virtual is that I plan to derive a new
class for each spell, and then reimplement the impact function.

My problem is that a firebolt which only damages the target it hits
directly, does not need to return anything, but a fireball that damages
an area need to return an int that tells the radius of damage. If those
where the only two options, I would not have any problems, but som
spells like to return an array of new spell_balls (consider a spell that
shatters into 10 new small pieces when it hits an object). How do I
handle this most gracefully?

Peter Poulsen
Aalborg, Denmark

E-mail: peter_poulsen@mail1.stofanet.dk
Phone: +45 98 15 47 05

To unsubscribe, e-mail: linuxgames-unsubscribe@sunsite.auc.dk
For additional commands, e-mail: linuxgames-help@sunsite.auc.dk