K
Kefka
Guest
Hey tirlititi,
I just realised I haven't bothered you with detailed questions for a while, so here I go again, lol!
Anyway, I've been playing around with DnSpy again and I tried altering the damage calculation formulas for Frog Drop, Thievery, and Dragon Crest to also factor in the target's defense. Here's my code:
Code: [Select]
It's working fine so far except for one thing: When the enemy's defense is higher than the Number of steals/dragons/frogs, I experience some sort of 'damage underflow bug' and start dealing really wierd 10-digit damage numbers (or was it 12 digits? Don't remember.). Do you by chance know how to avoid this? If the enemy's defense is higher, I'd like the damage to be 0. I've copied the basic outline of the script from other attacks that deal 0 damage when the enemy's defense is too high, like Lancer, Drain or Osmose, and then merely adjusted the parameters accordingly to match my formulas. But I must be missing something important.
Edit: Nevermind, I figured it out! The code I posted turned out to be fine after all, but in my file I had an older version of the code, probably due to not saving properly last time.
I just realised I haven't bothered you with detailed questions for a while, so here I go again, lol!
Anyway, I've been playing around with DnSpy again and I tried altering the damage calculation formulas for Frog Drop, Thievery, and Dragon Crest to also factor in the target's defense. Here's my code:
Code: [Select]
Code:
case 66: { CALC_VAR calc_VAR37 = calc_VAR; calc_VAR37.tg_flags |= 1; calc_VAR.df_pow = (short)target.defence.p_def; if (ff.frog_no - calc_VAR.df_pow / 2 > 0) { if (calc_VAR.at_num < 1) { calc_VAR.at_num = 1; } int num22; if (ff.frog_no != 0) { if ((num22 = (short)(caster.level * (ff.frog_no - calc_VAR.df_pow / 2))) > 9999) { num22 = 9999; } else { num22 = (short)(caster.level * (ff.frog_no - calc_VAR.df_pow / 2)); } } else { num22 = 1; } calc_VAR.tg_hp = (short)num22; } break; } case 67: { CALC_VAR calc_VAR38 = calc_VAR; calc_VAR38.tg_flags |= 1; calc_VAR.df_pow = (short)target.defence.p_def; if (ff.steal_no - calc_VAR.df_pow > 0) { if (calc_VAR.at_num < 1) { calc_VAR.at_num = 1; } int num23; if ((num23 = (ff.steal_no - calc_VAR.df_pow) * (short)caster.elem.dex / 2) > 9999) { num23 = 9999; } else { num23 = (short)((ff.steal_no - calc_VAR.df_pow) * (short)caster.elem.dex / 2); } calc_VAR.tg_hp = (short)num23; } break; } case 68: { CALC_VAR calc_VAR39 = calc_VAR; calc_VAR39.tg_flags |= 1; calc_VAR.df_pow = (short)target.defence.p_def; if (ff.dragon_no - calc_VAR.df_pow > 0) { if (calc_VAR.at_num < 1) { calc_VAR.at_num = 1; } int num24; if ((num24 = (ff.dragon_no - calc_VAR.df_pow) * ff.dragon_no) > 9999) { num24 = 9999; } else { num24 = (short)((ff.dragon_no - calc_VAR.df_pow) * ff.dragon_no); } calc_VAR.tg_hp = (short)num24; } break;
Edit: Nevermind, I figured it out! The code I posted turned out to be fine after all, but in my file I had an older version of the code, probably due to not saving properly last time.
Last edited:

