Author Topic: [DONE][Suggestion] "Stunning improves morale" mod option  (Read 3345 times)

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9091
    • View Profile
[DONE][Suggestion] "Stunning improves morale" mod option
« on: September 25, 2019, 01:27:59 am »
I don't remember who asked for this, but here goes, it's just a global variable:

Code: [Select]
stunningImprovesMorale: true     # default false

Basically when someone stuns an enemy, they get a similar morale bonus as for killing them.
Only once though, to prevent abuse of repeatedly reviving and stunning an enemy.
The winning team also gets (a smaller) morale bonus.
The losing team does not get any morale penalty.

Works for both xcom and aliens.

If someone wants to know exact numbers, here's the code, it's short and should be relatively easy to read:

Code: [Select]
// morale change when an enemy is stunned (only for the first time!)
if (getMod()->getStunningImprovesMorale() && murderer && !victim->getStatistics()->wasUnconcious)
{
if ((victim->getOriginalFaction() == FACTION_PLAYER && murderer->getFaction() == FACTION_HOSTILE) ||
            (victim->getOriginalFaction() == FACTION_HOSTILE && murderer->getFaction() == FACTION_PLAYER))
{
// the murderer gets a morale bonus if he is of a different faction (excluding neutrals)
murderer->moraleChange(20);

for (auto winner : *_save->getUnits())
{
if (!winner->isOut() && winner->getArmor()->getSize() == 1 && winner->getOriginalFaction() == murderer->getOriginalFaction())
{
// the winning squad gets a morale increase (the losing squad is NOT affected)
winner->moraleChange(10);
}
}
}
}
« Last Edit: September 25, 2019, 12:05:48 pm by Meridian »

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11722
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [DONE][Suggestion] "Stunning improves morale" mod option
« Reply #1 on: September 25, 2019, 11:40:00 am »
Which is default?

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9091
    • View Profile
Re: [DONE][Suggestion] "Stunning improves morale" mod option
« Reply #2 on: September 25, 2019, 12:05:08 pm »
Which is default?

The vanilla compatible is the default, as always :)

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11722
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [DONE][Suggestion] "Stunning improves morale" mod option
« Reply #3 on: September 25, 2019, 12:11:47 pm »
Thanks! :)

Offline HT

  • Colonel
  • ****
  • Posts: 456
    • View Profile
Re: [DONE][Suggestion] "Stunning improves morale" mod option
« Reply #4 on: September 25, 2019, 05:33:05 pm »
Thanks! This is highly welcome, especially for Piratez, if it ever uses it, which I hope it does, as otherwise it forced you to go on a killing spree even if you wanted to capture people due the combat fatigue mechanic.