Jump to content
  • 0

HELP skil_damage_db & asura strike damage cap


Lord Ganja

Question


  • Group:  Members
  • Topic Count:  141
  • Topics Per Day:  0.03
  • Content Count:  444
  • Reputation:   22
  • Joined:  06/18/12
  • Last Seen:  

I just noticed that when I cap the asura strike damage and reduce it's damage with skill_damage_db.txt, the capped damage is also reduced.


 


e.g.


battle.c



if (skill_id == MO_EXTREMITYFIST )
        damage = min(damage,500);

db/skill_damage_db.txt



MO_EXTREMITYFIST,1,4095,-50,-50,-50,-50 // asura strike deals -50% damage

^ capped damage is 500, reduce by -50%, so the max output damage will become 250.


 


Is it possible to be like this:


- Capped damage is 500, reduce by -50%, the output damage will still be 500.


- The reduce damage will be calculated first before comparing the reduced output damage to the cap damage.


so if the reduced damage is higher than the cap damage, it will return the cap damage.


 


Thanks in advance!


Link to comment
Share on other sites

14 answers to this question

Recommended Posts

  • 0

  • Group:  Developer
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  802
  • Reputation:   229
  • Joined:  01/30/13
  • Last Seen:  

Just don't use skill_damage_db then. It's harder to reorganize it to be applied first than it is to just put whatever damage code you want for your server in battle.c.

 

Basically you just want to half the damage for players but before you cap the damage, right?

 

So in battle.c:

		case MO_EXTREMITYFIST:
			skillratio += 100 * (7 + sstatus->sp / 10);
			skillratio = min(500000,skillratio); //We stop at roughly 50k SP for overflow protection
			break;
Just change it to e.g.

		case MO_EXTREMITYFIST:
			skillratio += 100 * (7 + sstatus->sp / 10);
			if (tsd) skillratio /= 2; //Half damage for players
			skillratio = min(500000,skillratio); //We stop at roughly 50k SP for overflow protection
			break;
  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  141
  • Topics Per Day:  0.03
  • Content Count:  444
  • Reputation:   22
  • Joined:  06/18/12
  • Last Seen:  

bump*

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  141
  • Topics Per Day:  0.03
  • Content Count:  444
  • Reputation:   22
  • Joined:  06/18/12
  • Last Seen:  

Just don't use skill_damage_db then. It's harder to reorganize it to be applied first than it is to just put whatever damage code you want for your server in battle.c.

 

Basically you just want to half the damage for players but before you cap the damage, right?

 

So in battle.c:

		case MO_EXTREMITYFIST:
			skillratio += 100 * (7 + sstatus->sp / 10);
			skillratio = min(500000,skillratio); //We stop at roughly 50k SP for overflow protection
			break;
Just change it to e.g.

		case MO_EXTREMITYFIST:
			skillratio += 100 * (7 + sstatus->sp / 10);
			if (tsd) skillratio /= 2; //Half damage for players
			skillratio = min(500000,skillratio); //We stop at roughly 50k SP for overflow protection
			break;

Thanks for this idea!!

Btw is it possible to separate damage from monsters to players?

like if target is a player the damage if halved

while if the target is a monster(mvps, mobs) the damage is 3/4.

Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  802
  • Reputation:   229
  • Joined:  01/30/13
  • Last Seen:  

That's what I already did in the example above.

if(sd) = Source is a player

if(tsd) = Target is a player

Just put whatever damage code you want there.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  141
  • Topics Per Day:  0.03
  • Content Count:  444
  • Reputation:   22
  • Joined:  06/18/12
  • Last Seen:  

That's what I already did in the example above.

if(sd) = Source is a player

if(tsd) = Target is a player

Just put whatever damage code you want there.

 

 

I tried your code if (tsd) skillratio /= 2

It gives half damage to both players and monsters. Is it possible to separate them?

Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  802
  • Reputation:   229
  • Joined:  01/30/13
  • Last Seen:  

Um, don't know how I should put it, but it's impossible that if(tsd) is true when the target is a monster.

Because:

struct map_session_data *tsd = BL_CAST(BL_PC, src);

The cast is only done for BL_PC not BL_MOB. Not to mention that a mob has no map_session_data so it would just crash at that point if you tried that.

if (tsd && tsd->weight)
	skillratio += 100 * tsd->weight / tsd->max_weight;

It's also used for SL_KNUCKLEARROW already. =o

 

Make sure you do a full a full recompile, removed that row in skill_damage_db.txt and restart the map server.

 

When it still doesn't work, start the map-server via visual studio and put a breakpoint at that line to see what happens.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  141
  • Topics Per Day:  0.03
  • Content Count:  444
  • Reputation:   22
  • Joined:  06/18/12
  • Last Seen:  

Um, don't know how I should put it, but it's impossible that if(tsd) is true when the target is a monster.

Because:

struct map_session_data *tsd = BL_CAST(BL_PC, src);

The cast is only done for BL_PC not BL_MOB. Not to mention that a mob has no map_session_data so it would just crash at that point if you tried that.

if (tsd && tsd->weight)
	skillratio += 100 * tsd->weight / tsd->max_weight;

It's also used for SL_KNUCKLEARROW already. =o

 

Make sure you do a full a full recompile, removed that row in skill_damage_db.txt and restart the map server.

 

When it still doesn't work, start the map-server via visual studio and put a breakpoint at that line to see what happens.

 

I already did a full recompile.

removed the asura strike from skill damage_db.txt

restart the map server(im only trying it on test server)

and it still give half damage to both monster and player.

 

What I haven't done yet is

 

When it still doesn't work, start the map-server via visual studio and put a breakpoint at that line to see what happens.

 

 

^ how do I start map-server via visual studio and put a breakpoint?

 

anyway thanks for you support! :D

Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  802
  • Reputation:   229
  • Joined:  01/30/13
  • Last Seen:  

Not using visual studio? I just start it by pressing the green triangle button. =p

 

And break you can put by just pressing on the left side of the window where the code is (a red dot appears).

 

If your code is a bit different from you can also copy it in here.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  141
  • Topics Per Day:  0.03
  • Content Count:  444
  • Reputation:   22
  • Joined:  06/18/12
  • Last Seen:  

Not using visual studio? I just start it by pressing the green triangle button. =p

 

And break you can put by just pressing on the left side of the window where the code is (a red dot appears).

 

If your code is a bit different from you can also copy it in here.

 

I'm using visual studio 2010. Is this the green triangle button? I can't seem to see the red dot that appears. lol

post-5465-0-57709400-1458275319_thumb.png

 

 

anyway here's my code.

case MO_EXTREMITYFIST:
			if(sstatus->sp <= 6000)
				skillratio += 100 * (7 + sstatus->sp / 10);
			else // Asura strike SP damage max is 6k
				skillratio += 100 * (7 + 6000 / 10);
			if (tsd)
				skillratio /= 2; //Half damage for players
			skillratio = min(500000,skillratio); //We stop at roughly 50k SP for overflow protection
			break; 

Btw i'm using the latest rA git revision.

Edited by Lord Ganja
Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  802
  • Reputation:   229
  • Joined:  01/30/13
  • Last Seen:  

In that code you already cap it before you do the division, but the halving damage for players should work.

 

Yes, the marked button lets you run the map-server. Breakpoints can be placed by clicking on the small grey bar left of the source code.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  141
  • Topics Per Day:  0.03
  • Content Count:  444
  • Reputation:   22
  • Joined:  06/18/12
  • Last Seen:  

In that code you already cap it before you do the division, but the halving damage for players should work.

 

Yes, the marked button lets you run the map-server. Breakpoints can be placed by clicking on the small grey bar left of the source code.

 

Yeah. I dunno why it gives half damage to both players and monsters though.

 

anyway I guess it will still be good. I just think it would be better if I could separate damage from monsters and players.

Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  802
  • Reputation:   229
  • Joined:  01/30/13
  • Last Seen:  

Ok, there's actually a bug in that function, that's why it doesn't work.


static int battle_calc_attack_skill_ratio(struct Damage wd, struct block_list *src,struct block_list *target,uint16 skill_id,uint16 skill_lv)
{
	struct map_session_data *sd = BL_CAST(BL_PC, src);
	struct map_session_data *tsd = BL_CAST(BL_PC, target);

Put this at the top of the function to fix it.

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  141
  • Topics Per Day:  0.03
  • Content Count:  444
  • Reputation:   22
  • Joined:  06/18/12
  • Last Seen:  

Ok, there's actually a bug in that function, that's why it doesn't work.

static int battle_calc_attack_skill_ratio(struct Damage wd, struct block_list *src,struct block_list *target,uint16 skill_id,uint16 skill_lv)
{
	struct map_session_data *sd = BL_CAST(BL_PC, src);
	struct map_session_data *tsd = BL_CAST(BL_PC, target);

Put this at the top of the function to fix it.

 

Thank you Playtester! Maybe it should also be reported on github rAthena issues.

Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  802
  • Reputation:   229
  • Joined:  01/30/13
  • Last Seen:  

Yeah I put it in the Knuckle Arrow issue because that's literary the only skill that uses tsd officially. I wanted to fix it yesterday but then realized fixing Knuckle Arrow will take too much time, so I gave up. ^^;

Link to comment
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.   Paste as plain text instead

  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.

×
×
  • Create New...