Jump to content
  • Advertisement
Sign in to follow this  
SEnergy

[Game] Buffs increasing damage?

This topic is 2514 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

well, I started to make a game, but I have a little "problem" here, how can I make a spell/buff that will increase damage of next spell?

so let's say I have spell "Flaming Hands" that will increase fire damage by 100% for the next 10 sec, now, I wanna cast Fireball that will deal intellect*2 damage, sooo, I discovered only 1 way how to do this:

http://pastebin.com/1iJq6pMx

so, I don't know if this is a good way, cuz I have to write all the buffs there etc, so, can someone who already have created some RPG help me? or give me better idea or something?

Thanks!

Share this post


Link to post
Share on other sites
Advertisement
[font=courier new,courier,monospace][font=arial,helvetica,sans-serif]I'm surprised nobody has answered this yet.

The answer depends on how complex you want it to be. If you have more spells, with variety of affects, then you can create elaborate systems. If you have only a few of them, a few simple tricks will do the job.

Ideally, you need to setup a table with all the modifiers: Name of Spell, Attributes (fire,water,earth,air, etc.), Modifers (what it modifies). For example:[/font][/font]

Name | Attributes | Damage | Damage %
----------------------------------------------------------------
Flaming Hands | F | 0 | 100
Lightning Bolt | A | 20 | 0


[font=arial, helvetica, sans-serif]The format is up to you. You [/font][font=courier new,courier,monospace][font=arial,helvetica,sans-serif]read the table, and put into a class:[/font][/font]

[font=arial,helvetica,sans-serif]class Spell {
std::string name;
int attr;
int dmg;
float dmgMuliplier;

}

// add flaming hands effect to player. You want to have an array of all spells currently affecting the player.
player->applySpell(&flamingHands);

int Player::getDamage() {
int dmg = intellect * 2;
// iterate through each spell, and apply all the effects
for (int i=0; i<spells.size(); ++i) {
// check attributes, fire, water, etc.
dmg += dmg * spells->dmgMuliplier;
dmg += spells->dmg;
}
return dmg;
}
[/font]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!