Jump to content
  • 0
Sign in to follow this  
luminoray

Party Dynamic Difficulty

Question

Hello, I'd like to implement a simple system for dynamic difficulty depending on the number of members in a party. I'd like enemies to have 50% extra HP for every extra member in the party, but since enemies aren't instanced in this game, a similar effect would be achieved by reducing player damage vs monsters by 33%, stacking multiplicatively.

The formula for damage would pretty much be:

FinalDamage = Damage * (0.66 ^ (PartyMembers - 1))

I also want players to take more damage from monsters when they are in a party, by about 5% for each extra member, stacking additively.

ReceivedDamage = Damage * (1 + 0.05 * (PartyMembers - 1))
 

I'd be very grateful if someone could help guide me in the right direction on how to do this. I believe I could approach the problem by going into the end of the damage calculation code, count the number of party members and perform the operation. Something like:

 

damage = damage * (pow(0.66, p->party.count - 1))

 

And have this calculation only take place if the enemy is a monster.

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Hello. I've been trying to crack this problem, and have made a little bit of progress. I found the part of the code in status.c where damage subtraction takes place, and was able to add a little experimental piece of code to it:

	if( st == &status->dummy )		return 0;	//This is what I added	if (src && src->type == BL_PC && target->type == BL_MOB) {		hp = hp/2;	}	if ((unsigned int)hp >= st->hp) {		if (flag&2) return 0;		hp = st->hp;	}

What happens here is that the hp variable holds the damage being done to the enemy. I also saw that I can add checks to it to determine both the source of the attack, and the target, so I can make any combination Player vs Mob, Player vs Player, etc. I'm 100% sure this works, I've tested it with different tags and combinations. What I'm doing here though, is halving all damage received by mobs coming from players.

 

This has one little problem though, while the damage is being calculated correctly, the damage reported to the client isn't being updated accordingly. This isn't really a big problem on Player vs Mob, as it gives the illusion of the mob having more health (and I don't wish to display monster health anyways), but on Mob vs Player, there will be a difference between the damage reported and the actual damage received.

 

To do:

  • Find out if src->party.count is available to use in the context of status.c
  • BL_HOM is available to use both as a target and a source of damage. Can I apply the party count to the damage they dish out? (I.E. Count the party size of their master)
  • Where can I change the damage being reported to the client? This is for Mob vs Player purposes.
  • How to exclude MVP monsters from this calculation, as they are grouped in BL_MOB.

Edited by luminoray

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.