Lord Ganja Posted March 4, 2016 Posted March 4, 2016 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! Quote
0 Playtester Posted March 15, 2016 Posted March 15, 2016 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; 1 Quote
0 Lord Ganja Posted March 15, 2016 Author Posted March 15, 2016 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. Quote
0 Playtester Posted March 16, 2016 Posted March 16, 2016 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. Quote
0 Lord Ganja Posted March 17, 2016 Author Posted March 17, 2016 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? Quote
0 Playtester Posted March 17, 2016 Posted March 17, 2016 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. Quote
0 Lord Ganja Posted March 17, 2016 Author Posted March 17, 2016 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! Quote
0 Playtester Posted March 17, 2016 Posted March 17, 2016 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. Quote
0 Lord Ganja Posted March 18, 2016 Author Posted March 18, 2016 (edited) 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 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 March 18, 2016 by Lord Ganja Quote
0 Playtester Posted March 19, 2016 Posted March 19, 2016 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. Quote
0 Lord Ganja Posted March 20, 2016 Author Posted March 20, 2016 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. Quote
0 Playtester Posted March 20, 2016 Posted March 20, 2016 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. 1 Quote
0 Lord Ganja Posted March 21, 2016 Author Posted March 21, 2016 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. Quote
0 Playtester Posted March 21, 2016 Posted March 21, 2016 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. ^^; Quote
Question
Lord Ganja
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
db/skill_damage_db.txt
^ 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!
14 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.