OpenXcom Forum

Modding => OpenXcom Extended => OXCE Support => Topic started by: Nord on June 10, 2020, 11:26:43 am

Title: [Solved] No mana experience on shield hit?
Post by: Nord on June 10, 2020, 11:26:43 am
Like i see, damage dealt to unit's shield brings no expirience. Because of final damage=0, i think. At least no mana expirience. Dont know what can be done here, though.
Title: Re: [Issue]Mana expirience by shield hit.
Post by: Yankes on June 10, 2020, 07:04:28 pm
One way I see this could be fix by allowing scripts manually access current exp stats. This will have some quirks and need some custom scripts to recreate logic that now is in code.

Alternate we could expand exp grain to have more info what exactly happened before.
Title: Re: [Issue]Mana expirience by shield hit.
Post by: ohartenstein23 on June 10, 2020, 07:23:30 pm
This could also be solved by a script to keep track of number of hits that didn't get through the shield, then read that number at the end of battle and award stat gains to mana as if it was experience.
Title: Re: [Issue]Mana expirience by shield hit.
Post by: Meridian on June 10, 2020, 07:54:47 pm
Like i see, damage dealt to unit's shield brings no expirience. Because of final damage=0, i think. At least no mana expirience. Dont know what can be done here, though.

I don't see any reason why this wouldn't work.
Damage is completely irrelevant for experience, only hit or miss counts.
I tried this using shields in piratez, and a shield hit is perfectly capable of giving standard experience and also mana experience.

How can I test your case Nord?
Title: Re: [Issue]Mana expirience by shield hit.
Post by: Nord on June 10, 2020, 10:28:41 pm
I noticed it when try my new mod, using magic staff against shielded enemy. Staff have mana expirience rate at 150, so use of it must add at least one point. But on mission end was no mana increade.
I shall check twice, though.
Title: Re: [Issue]Mana expirience by shield hit.
Post by: Meridian on June 10, 2020, 10:34:29 pm
I noticed it when try my new mod, using magic staff against shielded enemy. Staff have mana expirience rate at 150, so use of it must add at least one point. But on mission end was no mana increade.
I shall check twice, though.

1 mana experience point can still result in 0 mana stat increase (50% chance)... if mana is configured as a primary stat
(same for all other 6 primary stats, see: https://www.ufopaedia.org/index.php/Experience#How_Experience_Points_Are_Applied)

here's the conversion formula:
Code: [Select]
/**
 * Converts the number of experience to the stat increase.
 * @param Experience counter.
 * @return Stat increase.
 */
int BattleUnit::improveStat(int exp) const
{
if      (exp > 10) return RNG::generate(2, 6);
else if (exp > 5)  return RNG::generate(1, 4);
else if (exp > 2)  return RNG::generate(1, 3);
else if (exp > 0)  return RNG::generate(0, 1);
else               return 0;
}
Title: Re: [Issue]Mana expirience by shield hit.
Post by: Nord on June 11, 2020, 08:30:41 am
Oh, like that. Thank you then. Will know.