Author Topic: [Solved] No mana experience on shield hit?  (Read 2968 times)

Offline Nord

  • Commander
  • *****
  • Posts: 1746
  • The Gate is open.
    • View Profile
[Solved] No mana experience on shield hit?
« 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.
« Last Edit: February 12, 2023, 09:44:35 am by Meridian »

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: [Issue]Mana expirience by shield hit.
« Reply #1 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.

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: [Issue]Mana expirience by shield hit.
« Reply #2 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.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9089
    • View Profile
Re: [Issue]Mana expirience by shield hit.
« Reply #3 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?

Offline Nord

  • Commander
  • *****
  • Posts: 1746
  • The Gate is open.
    • View Profile
Re: [Issue]Mana expirience by shield hit.
« Reply #4 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.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9089
    • View Profile
Re: [Issue]Mana expirience by shield hit.
« Reply #5 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;
}
« Last Edit: June 10, 2020, 10:43:55 pm by Meridian »

Offline Nord

  • Commander
  • *****
  • Posts: 1746
  • The Gate is open.
    • View Profile
Re: [Issue]Mana expirience by shield hit.
« Reply #6 on: June 11, 2020, 08:30:41 am »
Oh, like that. Thank you then. Will know.