Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Something goofy going on with Splash damage calcs

A topic by WoFlhouse created Nov 21, 2023 Views: 218 Replies: 5
Viewing posts 1 to 6

Splash I and Storm I should do the same amount of damage when Splash is unboosted, but instead, without Water Skin Splash simply does 1 damage (near as I can tell, even when Aura has upwards of 60 MATK), while Water Skin I only allows Splash to do the same amount as Storm. It might make more sense to have Splash's damage calc mimic Fire's (where damage is getting added to a base multiple), because something clearly is not working here.

Also, for whatever reason it seems like any Enhance spell (tested with Shadowcloak, Radiance and Flaming Robe) will put Splash at proper base damage instead of 1 dmg.

Okay, so a little tooling around and the solution is to "borrow" Light's code, not Fire's. When the damage formula is changed from:


"a.mat * (a.enhanceSkill?.().id == 169 ? 4 : a.enhanceSkill?.().id == 168 ? 3 : 2) - b.mdf * 2"

to:

"a.mat * (2 + (a.enhanceSkill && a.enhanceSkill() != undefined && a.enhanceSkill().id == 169 ? 2 : 0) + (a.enhanceSkill && a.enhanceSkill() != undefined && a.enhanceSkill().id == 168 ? 1 : 0)) - b.mdf * 2"

Splash I's damage (and Water Skin) works as intended. As an aside, trying to have a nested if:else statement (as in && a.enhanceSkill().id == 169 ? 2 : a.enhanceSkill().id == 168 ? 1 : 0) results in the error that returns Splash as 1 damage. Probably, RPGMV can't handle the logic and is returning a zero, but I'm not a coding or RPGMV expert so I couldn't tell you. There might be a more elegant solution, of course, but this at least works.

(+1)

Oh, you're right! It broke when there was no enhance skill because of a missing null chaining operator. It should actually be

a.mat * (a.enhanceSkill?.()?.id == 169 ? 4 : a.enhanceSkill?.()?.id == 168 ? 3 : 2) - b.mdf * 2

Nice! That is a lot more streamlined.

Complete oversight on my part. I was correctly checking whether the battler *had* an enhanceSkill function to call in the first place (so that it wouldn't error out when enemies use it) but forgot to check whether calling the function actually returned something before using its id in the formula.