aliens

Author Topic: Traing bravery  (Read 12316 times)

Offline karadoc

  • Colonel
  • ****
  • Posts: 232
    • View Profile
Traing bravery
« on: September 20, 2016, 04:18:41 am »
Since the implementation of pilots, bravery has become a much more important stat. It's very useful to have a team of high bravery pilots for every base, and so training soldier for bravery is more important than it use to be.

The thing is, training bravery is not as easy as training other abilities. Most stats can be casually improved to high levels just by doing ordinary things in missions, without any special effort. (There are ways to accelerate the improvement of any stat, but generally it's enough to just equip gear that will help with the stat you want to improve... eg. carrying a couple of boom fruit can give you the opportunity to improve your throwing without too much effort. Carrying a fast weapon (particularly a fast melee weapon) can give you plenty of chances to improve reactions, etc.

But bravery, in my experience, doesn't improve much beyond ~60 through normal play. The only way I know of to reliably improve bravery is to keep a soldier's moral low for several turns; and that tends to only happen if I'm doing something special to deliberately keep their moral low - such as making them wear a slave outfit and shooting them myself; or doing lots of psi attacks with the witch outfit; or taking combat drugs (and using smokes to boost moral if moral isn't high enough to take the drugs to drop the moral!)


However, I'm pretty sure I've seen soldiers get bravery increases without their moral having been low. So I'm thinking that there must be some other way to train it. Maybe something to do with healing things? Or some particular weapon? I don't know.

I'd prefer to be able to train bravery with just a few tweaks to normal play (such as using a particular weapon), rather than having to do weird stuff like shoot my own soldiers. So I'm wondering, what are the best ways to train bravery?

Before pilots, I didn't bother trying to train bravery at all; because no one panics anyway in an ordinary mission. There's too much moral bonus from killing enemies or from +bravery armour for moral to ever be a serious issue. On higher difficulties it seems that bravery is even less important, because there's just more stuff to kill - and hence boost moral!

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1931
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: Traing bravery
« Reply #1 on: September 20, 2016, 06:18:28 am »
Meridian added experience gain on interceptions - if I remember correctly, the pilots on the craft that dealt the final blow have a chance to gain at least bravery (something like 20% chance for +10, configurable in ruleset), possibly firing and reactions too.  Before the pilot update, I believe it was also made possible to train bravery by healing enemy wounds.  So try putting the low-bravery gals on civvie shootdown duty, give them light firearms to inflict wounds but not kill, and make vodka a standard part of their kit?

Offline Dioxine

  • Commander
  • *****
  • Posts: 5424
  • punk not dead
    • View Profile
    • Nocturnal Productions
Re: Traing bravery
« Reply #2 on: September 20, 2016, 06:23:35 am »
Vodka won't do it. You need a real medkit of some sort. Also the 'enemy' part is exploitable, but primarly you get bravery for healing your own troops.

Offline H0lyD4wg

  • Squaddie
  • *
  • Posts: 9
    • View Profile
Re: Traing bravery
« Reply #3 on: September 20, 2016, 06:48:02 am »
What counts as a real medkit? Anything that actually restores some HP (so, bandages and X-Grog et cetera), or only things that are some kind of bag or box with a red cross symbol on them?

Offline legionof1

  • Moderator
  • Commander
  • ***
  • Posts: 1899
  • Bullets go that way. Money comes this way.
    • View Profile
Re: Traing bravery
« Reply #4 on: September 20, 2016, 07:46:54 am »
HP recovery is the key not wounds.

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1931
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: Traing bravery
« Reply #5 on: September 20, 2016, 02:29:14 pm »
That would explain why I thought it was tuned down a little too much, I was trying vodka as a standard stunned-enemy-stabilizer, and wasn't paying attention to bravery gains on my grog-toting gals.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8644
    • View Profile
Re: Traing bravery
« Reply #6 on: September 20, 2016, 05:12:55 pm »
Just to prevent misinformation:
 - Vodka counts as well Vodka could count as well, if it had been marked as bravery-training item
 - Healing both your own troops and enemy/neutral troops works as well

Bravery experience is awarded when fatal wounds of any unit are healed (1 exp per fatal wound).

Bravery increases (+10) if the experience is high enough to pass RNG test:

Code: [Select]
if (_expBravery && stats->bravery < caps.bravery)
{
if (_expBravery > RNG::generate(0,10)) stats->bravery += 10;
}
« Last Edit: September 20, 2016, 06:20:32 pm by Meridian »

Offline Eddie

  • Commander
  • *****
  • Posts: 560
    • View Profile
Re: Traing bravery
« Reply #7 on: September 20, 2016, 05:23:17 pm »
Bravery is trained by items which have "experienceTrainingMode: 19". Bandages have that, but vodka and grog don't.
So no, vodka doesn't train bravery.

Things that train bravery:
- bandages
- first aid kit
- small medipack
- medipack
- super medipack

The saviour medipack trains psy and not bravery.

Other things that I have found in the rouleset that train bravery:
- wand of bliss
- bad touch + good touch
- medipack of nurse outfit
- cake

It would be nice if there were some melee weapons that trained bravery, like there are melee weapons that train reaction. Bravery is actually quite useful early game because the handle is the best early game stunning weapon. With high bravery, the damage output of the handle can compete with the cattle prod even vs medium armored enemies (osiron security)
« Last Edit: September 20, 2016, 05:47:08 pm by Eddie »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8644
    • View Profile
Re: Traing bravery
« Reply #8 on: September 20, 2016, 06:19:40 pm »
Bravery is trained by items which have "experienceTrainingMode: 19".

You're right, forgot about that.

Offline karadoc

  • Colonel
  • ****
  • Posts: 232
    • View Profile
Re: Traing bravery
« Reply #9 on: September 21, 2016, 12:55:44 am »
Thanks for the info.

20% chance of increase for shooting down a ship is pretty good. So now that I know that, I won't feel bad about using 70-90 bravery pilots.

As for healing wounds giving bravery experience, I'm left wondering if there are any other exceptions or special cases. I definitely have noticed that when soldiers are using a nurse outfit and doing a lot of healing, they improve their bravery (and saviour outfits don't have the same effect); but in an attempt to get better bravery training I tried shooting my own troops a lot and healing them up.

I had a few soldiers in slave armour, and I shot them a heap of times with fletchette guns to create wounds which I then healed. I wasn't keeping count of the heals, but I know I had a few soldiers heal 8 wounds (because their first-aid kits ran out); and others healed 4 (with small medikits)...   in any case, there was a huge amount of healing going on; and no one at all got any bravery increase at the end of the mission.

So, was that just crazy bad luck? Or does the game not count wounds that are self-inflicted? Or perhaps the healing doesn't count no armour which has natural regen? Or something else?

(Incidentally, I reckon slave armour might be a bit too powerful for it's very low cost.)

Offline Eddie

  • Commander
  • *****
  • Posts: 560
    • View Profile
Re: Traing bravery
« Reply #10 on: September 21, 2016, 04:24:20 am »
Each bravery xp gives you a 10% chance to increase bravery at the end of the mission. With 10 or more bravery xp you have a guaranteed bravery increase. Each wound you heal with a medikit gives one bravery xp. As I posted above, the medipack of the nurse outfit gives bravery xp.

One thing that I am not sure about: using medikits for other things (painkillers, stimulant) might also give bravery xp.

Offline karadoc

  • Colonel
  • ****
  • Posts: 232
    • View Profile
Re: Traing bravery
« Reply #11 on: September 21, 2016, 04:53:54 am »
Vodka won't do it. You need a real medkit of some sort. Also the 'enemy' part is exploitable, but primarly you get bravery for healing your own troops.
I just looked at the source code to get an answer for why I didn't gain bravery when I tried to exploit / test the system by shooting my own soldiers and healing them. By the look of it, you don't get any bravery experience from healing your own troops. You only get it from healing the enemy.

As far as I can tell, here's how it works. `medikitHeal` calls `awardExperience` if you've healed (any) fatal wound. But the first thing `awardExperience` does is to check if the target is an enemy or not. If it is not an enemy, you don't get any experience.

Code: [Select]
void TileEngine::medikitHeal(BattleAction *action, BattleUnit *target, int bodyPart)
{
const RuleItem *rule = action->weapon->getRules();

if (target->getFatalWound(bodyPart))
{
https:// award experience only if healed body part has a fatal wound (to prevent abuse)
awardExperience(action->actor, action->weapon, target, false);
}

target->heal(bodyPart, rule->getWoundRecovery(), rule->getHealthRecovery());
action->weapon->setHealQuantity(action->weapon->getHealQuantity() - 1);

_save->getBattleGame()->playSound(action->weapon->getRules()->getHitSound());
}

Code: [Select]
bool TileEngine::awardExperience(BattleUnit *unit, BattleItem *weapon, BattleUnit *target, bool rangeAtack)
{
if (!target)
{
return false;
}
else
{
https:// only enemies count, not friends or neutrals
if (target->getOriginalFaction() != FACTION_HOSTILE) return false;

https:// mind-controlled enemies don't count though!
if (target->getFaction() != FACTION_HOSTILE) return false;
}
https:// ...

Offline karadoc

  • Colonel
  • ****
  • Posts: 232
    • View Profile
Re: Traing bravery
« Reply #12 on: September 21, 2016, 08:48:16 am »
I was having vague memories that the awardExperience function use to have a special case for healing. So I pulled up an older version of the code.

Behold!
Code: [Select]
bool TileEngine::awardExperience(BattleUnit *unit, BattleItem *weapon, BattleUnit *target, bool rangeAtack)
{
if (!weapon)
{
return false;
}

if (!target)
{
return false;
}
else if (weapon->getRules()->getBattleType() != BT_MEDIKIT)
{
https:// only enemies count, not friends or neutrals
if (target->getOriginalFaction() != FACTION_HOSTILE) return false;

https:// mind-controlled enemies don't count though!
if (target->getFaction() != FACTION_HOSTILE) return false;
}
https:// ...
So in the older code, the check for enemies isn't performed if the 'weapon' is of medikit type. I'm not sure if that covers all of the healing items; and I'm not sure why it was changed. (I haven't tried to find the commit that changed it.)

My best guess is that it was changed because it was easily exploitable. So to solve that, I have a suggestion: only award the experience if the most recent attack was from an enemy. Like this:
Code: [Select]
bool TileEngine::awardExperience(BattleUnit *unit, BattleItem *weapon, BattleUnit *target, bool rangeAtack)
{
if (!weapon)
{
return false;
}

if (!target)
{
return false;
}
else if (!(weapon->getRules()->getBattleType() == BT_MEDIKIT && target->killedBy() == FACTION_HOSTILE))
{
https:// Only give experience for actions performed on enemies...
https:// ... unless the action is to heal a wound which was inflicted by an enemy

https:// only enemies count, not friends or neutrals
if (target->getOriginalFaction() != FACTION_HOSTILE) return false;

https:// mind-controlled enemies don't count though!
if (target->getFaction() != FACTION_HOSTILE) return false;
}
https:// ...
`killedBy` is set whenever a unit is shot and has fatal wounds. (The unit doesn't actually need to have died.) So this is a reliable way to make sure the soldier has actually come under enemy fire.

It would still be exploitable in the sense that a player could inflict wounds, then deliberately get shot by a very weak enemy, then heal the wounds... but I don't think that kind of exploitation is any easier than using the kind of 'low moral' tactics I was describing earlier.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8644
    • View Profile
Re: Traing bravery
« Reply #13 on: September 21, 2016, 10:06:42 am »
I was having vague memories that the awardExperience function use to have a special case for healing. So I pulled up an older version of the code.

Yes, it had!

Looks like it was incorrectly merged :(
https://github.com/MeridianOXC/OpenXcom/commit/016406cabb25b3cbb6cb92defdb0f9b72b86c706
This merging thingy really makes me worry more and more... I don't know how much longer I can merge without breaking more and more stuff.

I'll fix this one, thanks for the investigation and suggestion.
« Last Edit: September 21, 2016, 10:09:23 am by Meridian »

Offline Dioxine

  • Commander
  • *****
  • Posts: 5424
  • punk not dead
    • View Profile
    • Nocturnal Productions
Re: Traing bravery
« Reply #14 on: September 21, 2016, 10:13:29 am »
Well, the game has a large player base, so any bugs created by incorrect merging will be found, eventually. So no reason to over worry. By the way, while we're at it, I'd vote for including Karadoc's fix as well.

As for bravery training, my favorite way is as follows: you'll get a lot by using any outfit with a large combat stress increase (like Rags). You can get easily to 50-60 that way, especially when Warehouse/Temple missions spawn in some urbanized terrain and take a lot of turns (or you can linger before finishing any mission, if you're into exploits). After that, Battle Flag and Wench outfit's attacks are a good way to get all the way to 100 (also both get more powerful as your Bravery rises).