Jump to content
  • 0

How to reduce monster atk


Seravy

Question


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.02
  • Content Count:  176
  • Reputation:   60
  • Joined:  01/11/19
  • Last Seen:  

I'm trying to change Signum Cruxis to reduce both atk and def of the targets.

I added to status_calc_watk :

	if(sc->data[SC_STRIPWEAPON] && bl->type != BL_PC)
		watk -= watk * sc->data[SC_STRIPWEAPON]->val2/100;
	if (sc->data[SC_SIGNUMCRUCIS])
		watk -= watk * sc->data[SC_SIGNUMCRUCIS]->val2/200;

and also added the SCB_WATK flag :

	set_sc( AL_CRUCIS		, SC_SIGNUMCRUCIS	, EFST_CRUCIS, SCB_DEF|SCB_WATK );

It doesn't reduce the damage dealt by the affected monster as far as I can tell. I've placed a breakpoint and it actually executes the code, however, watk seems to be zero for every single call which doesn't make much sense to me. Am I doing something wrong? I did exactly the same thing STRIPWEAPON does...so if this isn't working wouldn't that mean that status is broken too?... I tested just in case and yes, divest doesn't seem to reduce the damage I take from spawned ghouls either.

Link to comment
Share on other sites

16 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

 src/map/status.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/map/status.cpp b/src/map/status.cpp
index c338c0e6f..8dd5263a8 100644
--- a/src/map/status.cpp
+++ b/src/map/status.cpp
@@ -258,7 +258,7 @@ void initChangeTables(void)
 	add_sc( AL_PNEUMA		, SC_PNEUMA		);
 	set_sc( AL_INCAGI		, SC_INCREASEAGI	, EFST_INC_AGI, SCB_AGI|SCB_SPEED );
 	set_sc( AL_DECAGI		, SC_DECREASEAGI	, EFST_DEC_AGI, SCB_AGI|SCB_SPEED );
-	set_sc( AL_CRUCIS		, SC_SIGNUMCRUCIS	, EFST_CRUCIS, SCB_DEF );
+	set_sc( AL_CRUCIS		, SC_SIGNUMCRUCIS	, EFST_CRUCIS, SCB_DEF|SCB_BATK );
 	set_sc( AL_ANGELUS		, SC_ANGELUS		, EFST_ANGELUS		, SCB_DEF2 );
 	set_sc( AL_BLESSING		, SC_BLESSING		, EFST_BLESSING		, SCB_STR|SCB_INT|SCB_DEX );
 	set_sc( AC_CONCENTRATION	, SC_CONCENTRATE	, EFST_CONCENTRATION, SCB_AGI|SCB_DEX );
@@ -5984,6 +5984,8 @@ static unsigned short status_calc_batk(struct block_list *bl, struct status_chan
 		batk += batk * sc->data[SC_INCATKRATE]->val1/100;
 	if(sc->data[SC_PROVOKE])
 		batk += batk * sc->data[SC_PROVOKE]->val3/100;
+	if(sc->data[SC_SIGNUMCRUCIS] && bl->type != BL_PC)
+		batk -= batk * sc->data[SC_SIGNUMCRUCIS]->val2 *2 /100;
 #ifndef RENEWAL
 	if(sc->data[SC_CONCENTRATION])
 		batk += batk * sc->data[SC_CONCENTRATION]->val2/100;

its status_calc_batk, you use wrong function

don't ask me why, malufett also wanted to rewrite this shitty piece of code
there were also some concern that .... if you read the code properly,
if a player gets curse, reduce 1/2, get atk reduction, minus a number, then get negative status, reduce 1/4 ... then got buff, add a number... like that
this kind of code doesn't really make sense and the developer just put in the statuses based on the finding from wikipedia (iro client or divine pride)....
we didn't really test the damage in-game to compare with official ragnarok online

Edited by AnnieRuru
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.02
  • Content Count:  176
  • Reputation:   60
  • Joined:  01/11/19
  • Last Seen:  

Oh so it is a bug, I see. It seems to be divest weapon only - curse and other -atk effects I found are  properly present in both the watk and matk  function. I guess people don't divest monsters much so it wasn't noticed.

I tried moving it to batk and it works even less - batk isn't even called for the monsters.

Wait, I don't think monsters have batk. I'm pretty sure their attack was stored in md->status.rhw.atk and atk2 while stats.batk and status.watk were zeroes. I needed to read their attack for the AI to decide when to use safety wall. I see this :

	if(flag&SCB_BATK && b_status->batk) {
		status->batk = status_base_atk(bl,status);
		temp = b_status->batk - status_base_atk(bl,b_status);
		if (temp) {
			temp += status->batk;
			status->batk = cap_value(temp, 0, USHRT_MAX);
		}
		status->batk = status_calc_batk(bl, sc, status->batk);
	}

	if(flag&SCB_WATK) {
#ifndef RENEWAL
		status->rhw.atk = status_calc_watk(bl, sc, b_status->rhw.atk);
		if (!sd) // Should not affect weapon refine bonus
			status->rhw.atk2 = status_calc_watk(bl, sc, b_status->rhw.atk2);

		if (sd && sd->bonus.weapon_atk_rate)
			status->rhw.atk += status->rhw.atk * sd->bonus.weapon_atk_rate / 100;
		if(b_status->lhw.atk) {
			if (sd) {
				sd->state.lr_flag = 1;
				status->lhw.atk = status_calc_watk(bl, sc, b_status->lhw.atk);
				sd->state.lr_flag = 0;
			} else {
				status->lhw.atk = status_calc_watk(bl, sc, b_status->lhw.atk);
				status->lhw.atk2= status_calc_watk(bl, sc, b_status->lhw.atk2);
			}
		}
#else
		if(!b_status->watk) { // We only have left-hand weapon
			status->watk = 0;
			status->watk2 = status_calc_watk(bl, sc, b_status->watk2);
		}
		else status->watk = status_calc_watk(bl, sc, b_status->watk);
#endif

 

So there are 3 different attack stats I see in the status structure.

batk I think this is what I know under the name Status Attack, basically what comes from the players stat points.

watk, watk2 are the min and max weapon attack for renewal players.

lhw and rhw are the the min and max weapon attack for nonrenewal players and rhw is for both renewal and nonrenewal monsters, is that right?

If yes then the calc watk should be called for rhw even when Renewal is defined otherwise all non-player units will never get their atk updated from any effect. That's a pretty serious bug there if I'm right. How did no one notice that, are players really never buffing or debuffing monsters? Or is this actually the official behavior and monsters aren't affected by those effects since renewal? That would be strange too.

If my theory is right, then adding

        status->rhw.atk = status_calc_watk(bl, sc, b_status->rhw.atk);
        status->rhw.atk2 = status_calc_watk(bl, sc, b_status->rhw.atk2);

should fix the problem. Please let me know if that's correct,and won't have unintended side effects on players who I believe aren't supposed to use rhw and lhw under renewal defined?

...meanwhile I can confirm that adding those two lines fixes the reduction effect on monsters. I really hope I'm wrong here but if this is what I think it is then no atk buffs and reductions worked on monsters, including their own effects. Aren't there a bunch of MVPs that can buff their ATK? How come no one ever noticed that, this can't be true?

Edited by Seravy
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

1 hour ago, Seravy said:

Oh so it is a bug, I see. It seems to be divest weapon only - curse and other -atk effects I found are  properly present in both the watk and matk  function. I guess people don't divest monsters much so it wasn't noticed.

If yes then the calc watk should be called for rhw even when Renewal is defined otherwise all non-player units will never get their atk updated from any effect. That's a pretty serious bug there if I'm right. How did no one notice that, are players really never buffing or debuffing monsters? Or is this actually the official behavior and monsters aren't affected by those effects since renewal? That would be strange too.

....Aren't there a bunch of MVPs that can buff their ATK? How come no one ever noticed that, this can't be true?

All I can say you done a good job !!
yeah nobody bother to read this shitty code, nobody (except malufett) wish to rewrite this junk ... and everyone is happy with what we are having XD
suddenly I remember there's a topic for it ... searching .... <-- nvm, found it in Hercules, and Hercules has different function for it
most server running pre-re server are mostly PvP server, so they doesn't bother much about monsters

ok seriously, I just tested and made sure cast blessing on monster DOES increase its attack ...

btw I'm pretty sure I've tested that patch before posting ...
so you are using pre-re ? I tested it on Renewal since I'm using 20180620Re client
the damage done on me from 300-400 damage reduce to 140-280

// reduce more to see it actually works
		batk -= batk * sc->data[SC_SIGNUMCRUCIS]->val2 *4 /100;

 

1 hour ago, Seravy said:

I needed to read their attack for the AI to decide when to use safety wall

there is a script command *getunitdata that can retrieve all the stats available from that unit

// line 17438
			getunitdata_sub(UMOB_ATKMIN, md->status.rhw.atk);
			getunitdata_sub(UMOB_ATKMAX, md->status.rhw.atk2);

 

Edited by AnnieRuru
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.02
  • Content Count:  176
  • Reputation:   60
  • Joined:  01/11/19
  • Last Seen:  

No, I am using renewal. It's the 6 months old version as you are already aware. So maybe this bug was fixed during these 6 months?

Let's see, https://github.com/rathena/rathena/blob/master/src/map/status.cpp

no it's the same as my file at least that part. Okay so here is what I see, this is for a ghoul  - as you can see, batk, watk and watk2 are unused. If it is working on your side then your monsters are storing their attack in a different variable which sounds... unusual at the very least. Can you put a breakpoint at the same position and check? (make sure it's not the player character's stats being calculated).

If the script command fetches the stats from rhw, that seems to indicate it is stored there, so if it worked for you despite that, you might have the recalculation procedure already called for those variables elsewhere. I don't see one in the latest status.cpp but you might have one anyway in yours, or it might be in other files.

btw when saying " I needed to read their attack for the AI to decide when to use safety wall " I meant I already had to access md->status.rhw.atk from the AI (which is in c++, not script) so I already knew the attack was in those variables, it wasn't a question. I haven't dared to try learning how to script yet, I have my hands full already, but thanks anyway, might be useful in the future ?

While at the moment it works for both of us, probably for different reasons, we really should try to figure out if there is a bug in master or not.

bugreport.png

Edited by Seravy
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.02
  • Content Count:  176
  • Reputation:   60
  • Joined:  01/11/19
  • Last Seen:  

 I bet it's because I don't yet have this : https://github.com/rathena/rathena/commit/fe197bfa120aef5fd31c6896122b35fdc06774b4#diff-acba7818fb777457f5cbbcea9293f9c4

Maybe I should try to find a way to update my files anyway, this seems to also fix that "monsters have too low matk" bug which seems to be a very big deal. I better make a complete backup first...

  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.02
  • Content Count:  176
  • Reputation:   60
  • Joined:  01/11/19
  • Last Seen:  

Updating through TortoiseGit seems to have worked EXCEPT I can't find out how to resolve the conflicts in the mobdb file. For the time being I discarded my existing item drop  changes to test the update but eventually I need to find a tool that can show me the differences between the two files by column, not only rows. It doesn't help if I get told "every line is different" well, sure it will be : every monster's atk and matk was updated. I'd like to know which of those lines have differences in the item drop column or in general, which column... is there such a tool somewhere that I'm unaware of? Just showing me the two files side by side and only the different fields within each line is marked red instead of the whole  line? Then I could copy those missing values separately, there aren't all that many...yet. Later though... let's hope there will be no more updates where every monster changes at the same time ? (and yes, git did mark what's different but it did so in the "here these 50 lines are different..well 2 of them somewhere in the middle, have fun with that and there are another 20 blocks like that" way which is completely useless)

btw, the "pull" option in visual studio 2013 didn't work, had to use the external TortoiseGit.  Haven't dared to try updating the client yet. Probably should...

So, removed the recalculations for rwh.watk and watk2 I added as it shouldn't be necessary with this update installed. I left the effect in both the batk and watk recalculations just to be safe - mobs aside there might be other unit types where watk is still relevant. I can confirm that it works as intended now.

Conclusion, that linked update fixed this bug but it certainly existed before (and it was way worse in fact, monsters had incorrect base atk and matk as well).

Now, I need to find a way to fix my mobdb and hope the update didn't break anything else. And update the client...

Edit : client update seems to be working so far. I have the same question though, how do I merge my item description and skill description changes with it? I don't suppose I have to copy-paste the hundreds of entries manually, what tool do people use for this? (at least, comparing files shows the actual differences here...but there are many of them. Changed like 500+ items already...) ...or not, pressing alt-s instantly crashed my client. Maybe the update isn't successful at all...

whatever, I'll use the old client. Is it safe to do that with the new server?

Nevermind, that belongs to client support, asked it there instead.

 

Edited by Seravy
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

10 hours ago, Seravy said:

btw, the "pull" option in visual studio 2013 didn't work, had to use the external TortoiseGit.  Haven't dared to try updating the client yet. Probably should...

already looking forward to see the patch from your project ~

 

10 hours ago, Seravy said:

Edit : client update seems to be working so far. I have the same question though, how do I merge my item description and skill description changes with it? I don't suppose I have to copy-paste the hundreds of entries manually, what tool do people use for this? (at least, comparing files shows the actual differences here...but there are many of them. Changed like 500+ items already...) ...or not, pressing alt-s instantly crashed my client. Maybe the update isn't successful at all...

you have outdated skillinfolist file
download latest Asheraf client translation should fix this issue

 

Spoiler
On 1/23/2019 at 1:07 AM, Seravy said:

No, I am using renewal. It's the 6 months old version as you are already aware. So maybe this bug was fixed during these 6 months?

Let's see, https://github.com/rathena/rathena/blob/master/src/map/status.cpp

HAHAHAHA ~ that's the reason I said rAthena and Hercules used different function
I actually still thought rAthena haven't done the renewal calculation, but Hercules had done it YEARS ago
https://github.com/HerculesWS/Hercules/commit/8faef4ff7ef37f52f24ac6e1e026a418b19db1fe#diff-75b62ece08f52a7c6c3118a195e9194eR59

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.02
  • Content Count:  176
  • Reputation:   60
  • Joined:  01/11/19
  • Last Seen:  

11 hours ago, AnnieRuru said:

already looking forward to see the patch from your project ~

 

Actually, if you're fine with patches and don't want a branch pushed to some remote like the guys on that last project did then I can do that anytime if you tell me how.  Currently I have all the stuff related to that autopilot feature in separate commits from other changes. So all I need is, how to tell git "I want a patch that is these 15 commits and not those 50 others"? I see "create patch serial" but no idea how to use it, doesn't even seem to list my commits. (btw so far all 1st classes are working and also priest and wizard. Other 2nd jobs I haven't done yet. It'll take a long while, I need to actually relearn how to play those classes)

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

11 hours ago, Seravy said:

Actually, if you're fine with patches and don't want a branch pushed to some remote like the guys on that last project did then I can do that anytime if you tell me how.  Currently I have all the stuff related to that autopilot feature in separate commits from other changes. So all I need is, how to tell git "I want a patch that is these 15 commits and not those 50 others"? I see "create patch serial" but no idea how to use it, doesn't even seem to list my commits. (btw so far all 1st classes are working and also priest and wizard. Other 2nd jobs I haven't done yet. It'll take a long while, I need to actually relearn how to play those classes) 

create branch, that's also where most people done wrong
make sure your fork main branch is the same with rathena main branch
https://github.com/rathena/rathena <-- at the top right side, there is a [Fork]
then git pull your fork repo

1. your fork main branch should be the same as rathena main branch
2. create a live branch in your fork that you are currently playing in
3. create another branch in your fork for this project

in other words, your fork repo should have 3 branch

so after you had enough fun in your branch, just commit a patch from your playing branch into another branch that push into github.com
then we can download your fork branch with the [Compare] button on the github

I hope I don't do another screenshot guide, its very time taxing, I'm sure you understand things fast

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.02
  • Content Count:  176
  • Reputation:   60
  • Joined:  01/11/19
  • Last Seen:  

Okay, that's the long and risky one I was avoiding so far. At least this Tortoisegit seems to have some of the familiar functions I didn't see in VC like checkout... so might as well give it a try. Full backup so no actual risk involved I guess...

...fork done. So I assume I'm typing git pull fork's address to cmd. It says merge conflicts. Ehh and I just updated yesterday. Okay this wasn't so bad, like 5 lines changed in one db file. So does this mean I'm now connected to my fork and can push there? Note the files I originally downloaded from elsewhere.

So branches. I already have 2 weeks worth of work done in these files so even if I make branches from here, those will be included in all 3. But I think it's possible to revert them on the branches that don't need them. But based on previous experience, doing that will actually make revert commits which get pushed so in the end it won't be the same as the main branch anyway, is that right?

Wait, if I do a checkout on the state before my commits and make the branches there that should work. How do I do that... oh the "..." is clickable. So I create a new branch here. I don't see the point in making a branch that's the same as the main, is there one? I'm making the autopilot branch first instead. So now I do checkout on that and then...I need to merge my autopilot changes into it, as well as everything that wasn't mine but came from the 6 months of updates, but leave out the rest. Wait, merge is for entire branches, right? This would be...what was it, cherry pick? Ok I don't see that option on the git menu so I'm stuck....think I found it.

Edited by Seravy
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.02
  • Content Count:  176
  • Reputation:   60
  • Joined:  01/11/19
  • Last Seen:  

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.01
  • Content Count:  154
  • Reputation:   6
  • Joined:  10/14/17
  • Last Seen:  

Holy shit your gonna give her a heart attack

  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.02
  • Content Count:  176
  • Reputation:   60
  • Joined:  01/11/19
  • Last Seen:  

Did I do it wrong? I'm worried now.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

no, it is not, how come you have so many unrelated commits ?
https://github.com/HerculesWS/Hercules/compare/master...AnnieRuru:44-strmobinfo <- even this branch is outdated, but still only shows my commits
it should have only your patch in it, but yours has so many commits by other people

so for us to download your work, we just have to put .patch at the end

https://github.com/HerculesWS/Hercules/compare/master...AnnieRuru:44-strmobinfo

https://github.com/HerculesWS/Hercules/compare/master...AnnieRuru:44-strmobinfo.patch

and obviously yours doesn't work

 

I'll try to download your whole folder and compare file by file then,
well, I'll do that when I have the time

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  228
  • Reputation:   19
  • Joined:  10/27/12
  • Last Seen:  

5 hours ago, AnnieRuru said:

I'll try to download your whole folder and compare file by file then,
well, I'll do that when I have the time

Try beyond compare 3 / 4 to speed up your work load...when comparing...

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.02
  • Content Count:  176
  • Reputation:   60
  • Joined:  01/11/19
  • Last Seen:  

The unrelated commits are the update, remember I started with a 6 months outdated rathena. So I have autopilot commits before, and after that 6 month worth of commits. As there were conflicts resolved at the time of updating, not including them seemed like a bad idea. Someone changed the syntax of timers, so it did affect the autopilot feature.

... I have no idea why those update commits show up on compare, the contents should be the same - but I can see that being inconvenient.

...going to the .patch page crashed my browser ?

(PS : it's outdated anyway, since then I implemented like 5 more classes.)

Edited by Seravy
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...