Jump to content
  • 0

Stuck on implementing dual-element atks for mobs


Humble_Bee

Question


  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.03
  • Content Count:  112
  • Reputation:   9
  • Joined:  09/22/19
  • Last Seen:  

So I noticed that Magnum Break added elemental damage to standard attacks, almost making them dual-element. I want to do something similar where I reduce weapon damage for standard attacks for mobs by half, and then add that half back in in another element- Magnum Break style. I made some headway- I found where the code is that calculates elemental damage for mobs. I even coded it where the mobs can use dual-element attacks. My problem comes in in the damage calculations. When I wear armor that receives 100% damage in both elements, everything is fine. When I wear armor where one element receives 100% damage and the other element receives 50% resistance, it works fine. For example, I have Orc Zombies normally hitting me for 200 damage, even with the dual-attack (half nonelement, half undead). If I wear a poison element armor, my code correctly reduces the damage to 150 (100 nonelement stays the same, undead lowers by 50). My problem appears to come in when one element adds damage (150%) and the other reduces it (50%). The game might be taking the sign of the first element (+ or - / increase or decrease damage) and applying it to the other element as well- (150% and 50% should balance to 100%, but might be becoming 200%), though sometimes the numbers don't seem quite right. Anyone have any clues on this?

My code (This is found in the "battle_calc_element_damage" section of battle.cpp):
 

	//Elemental attribute fix
	if(!(nk&NK_NO_ELEFIX)) {
		//Non-pc physical melee attacks (mob, pet, homun) are "non elemental", they deal 100% to all target elements
		//However the "non elemental" attacks still get reduced by "Neutral resistance"
		//Also non-pc units have only a defending element, but can inflict elemental attacks using skills [exneval]
		if(battle_config.attack_attr_none&src->type){
			if(((!skill_id && !right_element) || (skill_id && (element == -1 || !right_element))) &&
				(wd->flag&(BF_SHORT|BF_WEAPON)) == (BF_SHORT|BF_WEAPON))
            wd->damage = wd->damage/2;
            wd->damage += battle_attr_fix(src, target, wd->damage, sstatus->def_ele, tstatus->def_ele, tstatus->ele_lv);};


Since that code isn't working and I've spent hours trying different things to get it to work, I've settled for doing a random roll where it swaps out nonelemental damage and defensive element damage half of the time each. It's not as enjoyable for me, but it will do until I figure out the actual answer:

 

	//Elemental attribute fix
	if(!(nk&NK_NO_ELEFIX)) {
		//Non-pc physical melee attacks (mob, pet, homun) are "non elemental", they deal 100% to all target elements
		//However the "non elemental" attacks still get reduced by "Neutral resistance"
		//Also non-pc units have only a defending element, but can inflict elemental attacks using skills [exneval]
		if(battle_config.attack_attr_none&src->type){
			if(((!skill_id && !right_element) || (skill_id && (element == -1 || !right_element))) &&
				(wd->flag&(BF_SHORT|BF_WEAPON)) == (BF_SHORT|BF_WEAPON)){
			
			if(rnd() % 100 < 50)
		    wd->damage = battle_attr_fix(src, target, wd->damage, sstatus->def_ele, tstatus->def_ele, tstatus->ele_lv);
			if(rnd() % 100 >= 50)
			return;
			
			};
			
		   };

 

Also, has anyone tested Magnum Break by changing it to Water element and seeing how it fares damage-wise against a Fire element mob? I'd be curious to see if Magnum Break would be buggy if it weren't a pure Fire attack. Thanks for any assistance!

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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...