Jump to content

Manage Skill Damage [2.1]


Lilith

Recommended Posts


  • Group:  Members
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  159
  • Reputation:   1
  • Joined:  12/21/11
  • Last Seen:  

this work for eA?

working for me, Im using eA, the version 2

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  344
  • Topics Per Day:  0.08
  • Content Count:  1060
  • Reputation:   1
  • Joined:  02/13/12
  • Last Seen:  

Hi... not really know how to use it, since my server GC can deal 99999k DMG with MVP....

so im goign to use this.. is it just copy and paste it and then the dmg will become low?

http://rathena.org/board/tracker/issue-6506-edp-cross-impact/

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.00
  • Content Count:  326
  • Reputation:   19
  • Joined:  09/27/12
  • Last Seen:  

No, you need to install the differential (source mod), compile, and then configure the database file as instructed in the first post.

I wouldn't necessarily consider this intermediate, but if you're not familiar with source modifications I wouldn't use it.

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  153
  • Topics Per Day:  0.04
  • Content Count:  2285
  • Reputation:   745
  • Joined:  06/16/12
  • Last Seen:  

@D3ath, open the file, and read thema manually..

@GM Takumirai, recheck your skill.h, I think you missed some lines from the .patch file

@PapaZola, I've implemented that script for my eA and 3CeAM, working properly (if you know how to change part, to match it with each emulator)

@joaopedrorios, maybe you can make new mapflag, "managedamage", and add the flag to manage skill damage option..

@donkeyg, of course you must add the .patch file to your server before u can enjoy your damage reduction~

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  132
  • Reputation:   2
  • Joined:  02/02/12
  • Last Seen:  

Does anyone have any idea why it stopped working in the latest revisions?

I updated it from .914 to .986 and now the patch won't work anymore :(.

No errors on mapserver and yes I've re-applied the patch a couple of times

Edited by Cephaler
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.00
  • Content Count:  326
  • Reputation:   19
  • Joined:  09/27/12
  • Last Seen:  

There was a huge change a couple revisions ago, I had over 10 conflictions... Some of which weren't even important or nothing more than white space. I haven't had issues with this patch since then... But I did a ton of the updating manually.

I'll take a look more closely this evening and let you know what I find.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  132
  • Reputation:   2
  • Joined:  02/02/12
  • Last Seen:  

There was a huge change a couple revisions ago, I had over 10 conflictions... Some of which weren't even important or nothing more than white space. I haven't had issues with this patch since then... But I did a ton of the updating manually.

I'll take a look more closely this evening and let you know what I find.

Thanks :)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.00
  • Content Count:  326
  • Reputation:   19
  • Joined:  09/27/12
  • Last Seen:  

I'm waiting until the Code Revision Reversion goes into effect before I update again, I just wanted to let you know.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  132
  • Reputation:   2
  • Joined:  02/02/12
  • Last Seen:  

I'm waiting until the Code Revision Reversion goes into effect before I update again, I just wanted to let you know.

Thanks, it still doesn't work for me :(

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  4
  • Reputation:   0
  • Joined:  11/14/12
  • Last Seen:  

Great Idea you had! I was coding something really similar using a db.txt file too. You should add some general options as battleconfigs, like general damage cap, general damage reduction or increase, etc as I did on mine.

Also.. I was looking through your code and noticed this.

md.damage = md.damage += md.damage*battle_SAD(sd, target, skill_num)/100;

Isn't the '= md.damage' redundant?

Also this.

int flag = map[sd->bl.m].flag.restricted?8*map[sd->bl.m].zone:0;
map[sd->bl.m].flag.restricted && skill_db[skill_num].flag&flag

if map[sd->bl.m].flag.restricted exists you asign 8*map[sd->bl.m].zone at flag otherwise 0, then on the other condition if map[sd->bl.m].flag.restricted exists and the bit value you asigned to flag is in skill_db[skill_num].flag it triggers the condition. that logic is redundant too, because in the case if map[sd->bl.m].flag.restricted doesn't exists, as you stated an && on the second condition would be redundant if the second condition don't triggers because of the 0. I think would be better just like this.

map[sd->bl.m].flag.restricted && skill_db[skill_num].flag&(8*map[sd->bl.m].zone)

Great contribution! Have a nice day!

I'm waiting until the Code Revision Reversion goes into effect before I update again, I just wanted to let you know.

Thanks, it still doesn't work for me :(

Open your battle.c src file.

Find this line

struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list *target,int skill_num,int skill_lv,int mflag);

add before

static int battle_SAD(struct map_session_data *sd, struct block_list *target, int skill_num)
{
int dmg = 0;
int flag = map[sd->bl.m].flag.restricted?8*map[sd->bl.m].zone:0;
if((skill_db[skill_num].flag&1 && !map_flag_vs(sd->bl.m))
|| (skill_db[skill_num].flag&2 && map[sd->bl.m].flag.pvp)
|| (skill_db[skill_num].flag&4 && map_flag_gvg(sd->bl.m))
|| (skill_db[skill_num].flag&8 && map[sd->bl.m].flag.battleground)
|| (map[sd->bl.m].flag.restricted && skill_db[skill_num].flag&flag))
{
 switch(target->type)
 {
  case BL_PC:
dmg = skill_db[skill_num].pc_damage;
break;
  case BL_MOB:
if(((TBL_MOB*)target)->status.mode&MD_BOSS)
 dmg = skill_db[skill_num].boss_damage;
else
 dmg = skill_db[skill_num].mob_damage;
break;
  default:
dmg = skill_db[skill_num].other_damage;
break;
 }
}
return dmg;
}

Look for this line.

  	 if( sd )
	{
		if (skill_num && (i = pc_skillatk_bonus(sd, skill_num)))
			ATK_ADDRATE(i);

add like this

if( sd )
  	 if( sd )
	{
		ATK_ADDRATE(battle_SAD(sd, target, skill_num));
		if (skill_num && (i = pc_skillatk_bonus(sd, skill_num)))
			ATK_ADDRATE(i);

Look for this line

 if(sd) {
  //Damage bonuses

Add this

 if(sd) {
					MATK_ADDRATE(battle_SAD(sd, target, skill_num));
  //Damage bonuses

Look for this line

if (sd && (i = pc_skillatk_bonus(sd, skill_num)))
 md.damage += md.damage*i/100;

Replace like this

if (sd)
{
 if(i = pc_skillatk_bonus(sd, skill_num))
  md.damage += md.damage*i/100;

 md.damage = md.damage += md.damage*battle_SAD(sd, target, skill_num)/100;
}

On skill.c src file

Find this line

/*==========================================
 * DB reading.
 * skill_db.txt

Add before

static bool skill_parse_row_skilldamage(char* split[], int columns, int current)
{
int i = atoi(split[0]);
i = skill_get_index(i);
if( !i ) // invalid skill id
 return false;

skill_db[i].flag  = atoi(split[1]);
skill_db[i].pc_damage  = atoi(split[2]);
skill_db[i].mob_damage  = atoi(split[3]);
skill_db[i].boss_damage  = atoi(split[4]);
skill_db[i].other_damage = atoi(split[5]);
return true;
}

Find this line

sv_readdb(db_path, "skill_changematerial_db.txt"

Add after

sv_readdb(db_path, "skill_damage_db.txt"	  , ',',   5,  6, MAX_SKILL_DB, skill_parse_row_skilldamage);

On skill.h src file

Find this line

 int unit_interval;
 int unit_target;
 int unit_flag;

Add after

int flag;
int pc_damage,mob_damage,other_damage,boss_damage;

Compile and you're done. Don't forget to create your db file. It should work perfectly on the latest revision.

Edited by Random
Link to comment
Share on other sites

  • 3 weeks later...

  • Group:  Members
  • Topic Count:  26
  • Topics Per Day:  0.01
  • Content Count:  80
  • Reputation:   0
  • Joined:  07/03/12
  • Last Seen:  

after all this procedure where can I find my db file?? I didnt understand what u said about this Don't forget to create your db file. It should work perfectly on the latest

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.00
  • Content Count:  326
  • Reputation:   19
  • Joined:  09/27/12
  • Last Seen:  

Great Idea you had! I was coding something really similar using a db.txt file too. You should add some general options as battleconfigs, like general damage cap, general damage reduction or increase, etc as I did on mine.

Also.. I was looking through your code and noticed this.

md.damage = md.damage += md.damage*battle_SAD(sd, target, skill_num)/100;

Isn't the '= md.damage' redundant?

Also this.

int flag = map[sd->bl.m].flag.restricted?8*map[sd->bl.m].zone:0;
map[sd->bl.m].flag.restricted && skill_db[skill_num].flag&flag

if map[sd->bl.m].flag.restricted exists you asign 8*map[sd->bl.m].zone at flag otherwise 0, then on the other condition if map[sd->bl.m].flag.restricted exists and the bit value you asigned to flag is in skill_db[skill_num].flag it triggers the condition. that logic is redundant too, because in the case if map[sd->bl.m].flag.restricted doesn't exists, as you stated an && on the second condition would be redundant if the second condition don't triggers because of the 0. I think would be better just like this.

map[sd->bl.m].flag.restricted && skill_db[skill_num].flag&(8*map[sd->bl.m].zone)

Great contribution! Have a nice day!

I'm waiting until the Code Revision Reversion goes into effect before I update again, I just wanted to let you know.

Thanks, it still doesn't work for me :(

Open your battle.c src file.

Find this line

struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list *target,int skill_num,int skill_lv,int mflag);

add before

static int battle_SAD(struct map_session_data *sd, struct block_list *target, int skill_num)
{
int dmg = 0;
int flag = map[sd->bl.m].flag.restricted?8*map[sd->bl.m].zone:0;
if((skill_db[skill_num].flag&1 && !map_flag_vs(sd->bl.m))
|| (skill_db[skill_num].flag&2 && map[sd->bl.m].flag.pvp)
|| (skill_db[skill_num].flag&4 && map_flag_gvg(sd->bl.m))
|| (skill_db[skill_num].flag&8 && map[sd->bl.m].flag.battleground)
|| (map[sd->bl.m].flag.restricted && skill_db[skill_num].flag&flag))
{
 switch(target->type)
 {
  case BL_PC:
dmg = skill_db[skill_num].pc_damage;
break;
  case BL_MOB:
if(((TBL_MOB*)target)->status.mode&MD_BOSS)
 dmg = skill_db[skill_num].boss_damage;
else
 dmg = skill_db[skill_num].mob_damage;
break;
  default:
dmg = skill_db[skill_num].other_damage;
break;
 }
}
return dmg;
}

Look for this line.

  	 if( sd )
	{
		if (skill_num && (i = pc_skillatk_bonus(sd, skill_num)))
			ATK_ADDRATE(i);

add like this

if( sd )
  	 if( sd )
	{
		ATK_ADDRATE(battle_SAD(sd, target, skill_num));
		if (skill_num && (i = pc_skillatk_bonus(sd, skill_num)))
			ATK_ADDRATE(i);

Look for this line

 if(sd) {
  //Damage bonuses

Add this

 if(sd) {
					MATK_ADDRATE(battle_SAD(sd, target, skill_num));
  //Damage bonuses

Look for this line

if (sd && (i = pc_skillatk_bonus(sd, skill_num)))
 md.damage += md.damage*i/100;

Replace like this

if (sd)
{
 if(i = pc_skillatk_bonus(sd, skill_num))
  md.damage += md.damage*i/100;

 md.damage = md.damage += md.damage*battle_SAD(sd, target, skill_num)/100;
}

On skill.c src file

Find this line

/*==========================================
 * DB reading.
 * skill_db.txt

Add before

static bool skill_parse_row_skilldamage(char* split[], int columns, int current)
{
int i = atoi(split[0]);
i = skill_get_index(i);
if( !i ) // invalid skill id
 return false;

skill_db[i].flag  = atoi(split[1]);
skill_db[i].pc_damage  = atoi(split[2]);
skill_db[i].mob_damage  = atoi(split[3]);
skill_db[i].boss_damage  = atoi(split[4]);
skill_db[i].other_damage = atoi(split[5]);
return true;
}

Find this line

sv_readdb(db_path, "skill_changematerial_db.txt"

Add after

sv_readdb(db_path, "skill_damage_db.txt"	  , ',',   5,  6, MAX_SKILL_DB, skill_parse_row_skilldamage);

On skill.h src file

Find this line

 int unit_interval;
 int unit_target;
 int unit_flag;

Add after

int flag;
int pc_damage,mob_damage,other_damage,boss_damage;

Compile and you're done. Don't forget to create your db file. It should work perfectly on the latest revision.

So, are all these necessary for the mod to work on the current revision, or are these just your efficiency changes? I haven't had a chance to test it but I wanted to make sure before I changed everything because I keep getting revision errors and I'm trying to avoid as many as possible.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  23
  • Reputation:   1
  • Joined:  12/18/12
  • Last Seen:  

Hello Lilith,

I got this error when i patched my SVN.

Rejected patch hunks for 'battle.c' - TortoiseUDiff

--- src/map/battle.c

+++ src/map/battle.c

@@ -4319,8 +4355,13 @@

md.damage= (int)( (int64)md.damage * cardfix / 10000 );

}

- if (sd && (i = pc_skillatk_bonus(sd, skill_num)))

- md.damage += md.damage*i/100;

+ if (sd)

+ {

+ if(i = pc_skillatk_bonus(sd, skill_num))

+ md.damage += md.damage*i/100;

+

+ md.damage = md.damage += md.damage*battle_SAD(sd, target, skill_num)/100;

+ }

if(md.damage < 0)

md.damage = 0;

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.00
  • Content Count:  118
  • Reputation:   6
  • Joined:  12/20/12
  • Last Seen:  

thanks a lot!!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  87
  • Reputation:   4
  • Joined:  08/09/12
  • Last Seen:  

It doesn't seem to work with the latest revision. I really need this badly :(

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  85
  • Reputation:   17
  • Joined:  12/25/11
  • Last Seen:  

Version 1.1 its working fine in rev 17058.. i will test 2.0

note: apply patch this manually

Edited by Angel
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  280
  • Topics Per Day:  0.06
  • Content Count:  841
  • Reputation:   17
  • Joined:  04/16/12
  • Last Seen:  

Update please.

Due to this revision,

http://trac.rathena.org/changeset/17065/rathena

all codes were messed up. Thanks!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  85
  • Reputation:   17
  • Joined:  12/25/11
  • Last Seen:  

This the patch for rev 17066 and its working.

I have only one doubt, where put (int64) in this part, i put there but maybe iam wrong.

md.damage = md.damage += (int64)md.damage*battle_SAD(sd, target, skill_id)/100;

I hope Lilith clarify the doubt.

Regards.

@ emong you were right tnks. fixed

Manage Skill Damage_2.0 r17066.patch

Edited by Angel
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  280
  • Topics Per Day:  0.06
  • Content Count:  841
  • Reputation:   17
  • Joined:  04/16/12
  • Last Seen:  

This the patch for rev 17066 and its working.

I have only one doubt, where put (int64) in this part, i put there but maybe iam wrong.

md.damage = md.damage += (int64)md.damage*battle_SAD(sd, target, skill_id)/100;

I hope Lilith clarify the doubt.

Regards.

did you not change this line?


static int battle_SAD(struct map_session_data *sd, struct block_list *target, int skill_num)
+{
+ int dmg = 0;
+ int flag = map[sd->bl.m].flag.restricted?8*map[sd->bl.m].zone:0;
+
+ if(skill_db[skill_num].flag&1 && !map_flag_vs(sd->bl.m) ||
+ skill_db[skill_num].flag&2 && map[sd->bl.m].flag.pvp ||
+ skill_db[skill_num].flag&4 && map_flag_gvg(sd->bl.m) ||
+ skill_db[skill_num].flag&8 && map[sd->bl.m].flag.battleground ||
+ map[sd->bl.m].flag.restricted && skill_db[skill_num].flag&flag)
+ {
+ 
+ switch(target->type)
+ {
+ case BL_PC:
+ dmg = skill_db[skill_num].pc_damage;
+ break;
+ case BL_MOB:
+ if(((TBL_MOB*)target)->status.mode&MD_BOSS)
+ dmg = skill_db[skill_num].boss_damage;
+ else
+ dmg = skill_db[skill_num].mob_damage;
+ break;
+ default:
+ dmg = skill_db[skill_num].other_damage;
+ break;
+ }
+ }
+ 
+ return dmg;
+}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.00
  • Content Count:  326
  • Reputation:   19
  • Joined:  09/27/12
  • Last Seen:  

What about all that stuff Random said? All those changes? Does that fix the issue?

Where is Lilith? XD

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  85
  • Reputation:   17
  • Joined:  12/25/11
  • Last Seen:  

Random only explain how to add the mod of Lilith manually, i don´t see any change made for he.

he only said that is redundant and advised that can be better in some part of the line:

map[sd->bl.m].flag.restricted && skill_db[skill_num].flag&(8*map[sd->bl.m].zone)

But the mod of lilith work fine.

Edited by Angel
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  280
  • Topics Per Day:  0.06
  • Content Count:  841
  • Reputation:   17
  • Joined:  04/16/12
  • Last Seen:  

From the previous update, isn't skill_num replaced by skill_id?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  85
  • Reputation:   17
  • Joined:  12/25/11
  • Last Seen:  

From the previous update, isn't skill_num replaced by skill_id?

Yup, i changed skill_num for skill_id, its in the patch.

Edited by Angel
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  87
  • Reputation:   4
  • Joined:  08/09/12
  • Last Seen:  

it worked, thanks

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  592
  • Reputation:   31
  • Joined:  11/14/11
  • Last Seen:  

can anyone produce a new .patch file for this?

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...