Jump to content
  • 0
Sign in to follow this  
arthurcunha1991

Damage CR_ACIDDEMONSTRATION:

Question

3 answers to this question

Recommended Posts

  • 0
	case CR_ACIDDEMONSTRATION:
#ifdef RENEWAL
		{// [malufett]
			int64 matk=0, atk;
			short tdef = status->get_total_def(target);
			short tmdef =  status->get_total_mdef(target);
			int targetVit = min(120, status_get_vit(target));
			short totaldef = (tmdef + tdef - ((uint64)(tmdef + tdef) >> 32)) >> 1; // FIXME: What's the >> 32 supposed to do here? tmdef and tdef are both 16-bit...

			matk = battle->calc_magic_attack(src, target, skill_id, skill_lv, mflag).damage;
			atk = battle->calc_base_damage(src, target, skill_id, skill_lv, nk, false, s_ele, ELE_NEUTRAL, EQI_HAND_R, (sc && sc->data[SC_MAXIMIZEPOWER]?1:0)|(sc && sc->data[SC_WEAPONPERFECT]?8:0), md.flag);
			md.damage = matk + atk;
			if( src->type == BL_MOB ){
				totaldef = (tdef + tmdef) >> 1;
				md.damage = 7 * targetVit * skill_lv * (atk + matk) / 100;
				/*
				// Pending [malufett]
				if( unknown condition ){
					md.damage = 7 * md.damage % 20;
					md.damage = 7 * md.damage / 20;
				}*/
			}else{
				float vitfactor = 0.0f, ftemp;

				if( (vitfactor=(status_get_vit(target)-120.0f)) > 0)
					vitfactor = (vitfactor * (matk + atk) / 10) / status_get_vit(target);
				ftemp = max(0, vitfactor) + (targetVit * (matk + atk)) / 10;
				md.damage = (int64)(ftemp * 70 * skill_lv / 100);
				if (target->type == BL_PC)
					md.damage >>= 1;
			}
			md.damage -= totaldef;
			if( tsc && tsc->data[SC_LEXAETERNA] ) {
				md.damage <<= 1;
				status_change_end(target, SC_LEXAETERNA, INVALID_TIMER);
			}
		}
#else
		// updated the formula based on a Japanese formula found to be exact [Reddozen]
		if(tstatus->vit+sstatus->int_) //crash fix
			md.damage = (int)(7*tstatus->vit*sstatus->int_*sstatus->int_ / (10*(tstatus->vit+sstatus->int_)));
		else
			md.damage = 0;
		if (tsd) md.damage>>=1;
#endif
		// Some monsters have totaldef higher than md.damage in some cases, leading to md.damage < 0
		if( md.damage < 0 )
			md.damage = 0;
		if( md.damage > INT_MAX>>1 )
			//Overflow prevention, will anyone whine if I cap it to a few billion?
			//Not capped to INT_MAX to give some room for further damage increase.
			md.damage = INT_MAX>>1;
		break;

In battle_calc_misc_attack (battle.c)

Share this post


Link to post
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.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.