OpenXcom Forum

Modding => OpenXcom Extended => OXCE Suggestions DONE => Topic started by: Meridian on September 25, 2019, 01:27:59 am

Title: [DONE][Suggestion] "Stunning improves morale" mod option
Post by: Meridian 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);
}
}
}
}
Title: Re: [DONE][Suggestion] "Stunning improves morale" mod option
Post by: Solarius Scorch on September 25, 2019, 11:40:00 am
Which is default?
Title: Re: [DONE][Suggestion] "Stunning improves morale" mod option
Post by: Meridian on September 25, 2019, 12:05:08 pm
Which is default?

The vanilla compatible is the default, as always :)
Title: Re: [DONE][Suggestion] "Stunning improves morale" mod option
Post by: Solarius Scorch on September 25, 2019, 12:11:47 pm
Thanks! :)
Title: Re: [DONE][Suggestion] "Stunning improves morale" mod option
Post by: HT 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.