19 themes/skins available for your browsing pleasure. A variety of looks, 6 AC2 exclusives - Featuring SMACX, Civ6 Firaxis, and two CivII themes.[new Theme Select Box, bottom right sidebar - works for lurkers, too]
0 Members and 1 Guest are viewing this topic.
int UNIT_morale_retrieve_root(int unitID, int droneRiotToggle, int moraleUpgradeToggle) { int factionID = unit_data[unitID].faction_id; if(!factionID) // checking if native life AI faction return UNIT_morale_retrieve_native_AI(unitID, moraleUpgradeToggle); int nMoraleFin, nProtoId = unit_data[unitID].proto_id, nMoraleMod; if(unit_basic_data[nProtoId].plan == UNIT_Management::PLAN_INFO_WARFARE){ nMoraleMod = faction_data[factionID].SE_probe; if(nMoraleMod < 0) nMoraleMod = 0; if(nMoraleMod > 3) nMoraleMod = 3; if(BASE_has_secret_project(BASE_Management::FACL_TELEPATHIC_MATRIX-BASE_Management::FACL_HUMAN_GENOME_PROJ, factionID)) nMoraleMod += 2; // "All of your probe teams receive a +2 morale modifier." for(int nTech = 0; nTech < MAX_TECHNOLOGY_NUM; nTech++){ if(technology_data[nTech].TECH_struct_flags & TECH_Managment::TECH_flags_improve_probe){ if(TECH_check_faction_has(nTech, factionID)) nMoraleMod++; } } nMoraleFin = unit_data[unitID].morale + nMoraleMod; if(nMoraleFin < 2) nMoraleFin = 2; // Disciplined if(nMoraleFin > 6) nMoraleFin = 6; // Elite }else{ // all other unit types if(nProtoId < MAX_BASIC_UNIT_NUM && unit_wpn_data[unit_basic_data[nProtoId].weapon_id].offensive < 0){ // checking if one of basic #UNITS in alpha/x.txt with PSI offensive nMoraleFin = unit_data[unitID].morale; }else{ // non-PSI basic units and all other new prototypes nMoraleMod = faction_data[factionID].SE_morale; // current Social Engineering Morale if(nMoraleMod < -4) nMoraleMod = -4; // see #SOCMORALE in alpha/x.txt else if(nMoraleMod > 4) nMoraleMod = 4; if(nMoraleMod < -1) nMoraleMod++; else if(nMoraleMod > 1) nMoraleMod--; int factionMorale = faction_basic_data[factionID].special_rules_MORALE; // parsed from faction txt file if(factionMorale < 0) nMoraleMod += factionMorale; // applying negative modifier int unitHomeBase = unit_data[unitID].home_base_id; // base unit was built in if(unitHomeBase >= 0){ if(BASE_has_facility_ex(BASE_Management::FACL_CHILDREN_CRECHE, unitHomeBase, 0) && nMoraleMod < 0) nMoraleMod /= 2; // halving if negative bonus only if(BASE_has_facility_ex(BASE_Management::FACL_BROOD_PIT, unitHomeBase, 0) && nProtoId < MAX_BASIC_UNIT_NUM){ if(unit_wpn_data[unit_basic_data[nProtoId].weapon_id].offensive < 0 || nProtoId == UNIT_Management::BSC_SPORE_LAUNCHER && nMoraleMod < 0) nMoraleMod /= 2; // never accessed because of MAX_BASIC_UNIT_NUM check ; PSI basic units handled above } } if(factionMorale > 0) nMoraleMod += factionMorale; // applying positive modifier int factionMoraleTgl = faction_basic_data[factionID].special_rules_bitfield & SMACX_CORE::FACT_MORALE; if(factionMoraleTgl && nMoraleMod < 0) nMoraleMod = 0; // "Morale modifier (if 0, indicates an exemption from negative modifiers from other sources)." if(droneRiotToggle && unitHomeBase >= 0 && base_data[unitHomeBase].base_struct_status_bitfield & BASE_Management::DRONE_RIOTS_ACTIVE && !factionMoraleTgl){ nMoraleMod--; if(nMoraleMod < 0) nMoraleMod = 0; // potential bug with this logic zeroing out negative bonus if(nMoraleMod > 6) nMoraleMod = 6; } nMoraleFin = unit_data[unitID].morale + nMoraleMod; } if(nMoraleFin < 0) nMoraleFin = 0; // Very Green (Hatchling) if(nMoraleFin > 6) nMoraleFin = 6; // Elite (Demon Boil) } return nMoraleFin;}
The SE_morale variable is based solely on cumulative Social Engineering morale value. The ones that effect it are:Fundamentalist : +1Power : +2Wealth : -2Eudaimonic : -2Thought Control : +2When faction files are parsed, it stores MORALE value in special_rules_MORALE. It does looks like it's being counted multiple times, but it isn't. It first checks to see if it's less than zero, and then applies penalty if so. I believe this is so that if SE_morale is negative and/or faction penalty exists, then the base facility modification of the halving of penalty is done before bonuses. After the facility check, then it applies positive bonus. If special_rules_MORALE is zero in faction files, then FACT_MORALE gets set and zeros out any negative penalty per description.
nMoraleMod = faction_data[factionID].SE_morale; // current Social Engineering Morale if(nMoraleMod < -4) nMoraleMod = -4; // see #SOCMORALE in alpha/x.txt else if(nMoraleMod > 4) nMoraleMod = 4; if(nMoraleMod < -1) nMoraleMod++; else if(nMoraleMod > 1) nMoraleMod--; int factionMorale = faction_basic_data[factionID].special_rules_MORALE; // parsed from faction txt file if(factionMorale < 0) nMoraleMod += factionMorale; // applying negative modifier int unitHomeBase = unit_data[unitID].home_base_id; // base unit was built in if(unitHomeBase >= 0){ if(BASE_has_facility_ex(BASE_Management::FACL_CHILDREN_CRECHE, unitHomeBase, 0) && nMoraleMod < 0) nMoraleMod /= 2; // halving if negative bonus only if(BASE_has_facility_ex(BASE_Management::FACL_BROOD_PIT, unitHomeBase, 0) && nProtoId < MAX_BASIC_UNIT_NUM){ if(unit_wpn_data[unit_basic_data[nProtoId].weapon_id].offensive < 0 || nProtoId == UNIT_Management::BSC_SPORE_LAUNCHER && nMoraleMod < 0) nMoraleMod /= 2; // never accessed because of MAX_BASIC_UNIT_NUM check ; PSI basic units handled above } } if(factionMorale > 0) nMoraleMod += factionMorale; // applying positive modifier
Just wondering...which is the location where this code is found?
This is how I read this section of code:1. Get the Morale SE rating from the faction's government/economy/values/future society settings, not including any inherent bonuses or penalties.2. Set this number to -4 if it's less than -4, or set it to 4 if it's greater than 4.3. Add 1 if it is less than -1, or subtract 1 if it is greater than 1.4. Now grab the faction's inherent Morale bonus or penalty.5. If the faction has an inherent Morale penalty, apply it now.6. Check the unit's home base and divide a negative Morale modifier by 2 if it has a Children's Creche.7. If the faction has an inherent Morale bonus, apply it now.Is this correct?
Quote from: Fal on May 05, 2013, 07:45:49 pmThis is how I read this section of code:1. Get the Morale SE rating from the faction's government/economy/values/future society settings, not including any inherent bonuses or penalties.2. Set this number to -4 if it's less than -4, or set it to 4 if it's greater than 4.3. Add 1 if it is less than -1, or subtract 1 if it is greater than 1.4. Now grab the faction's inherent Morale bonus or penalty.5. If the faction has an inherent Morale penalty, apply it now.6. Check the unit's home base and divide a negative Morale modifier by 2 if it has a Children's Creche.7. If the faction has an inherent Morale bonus, apply it now.Is this correct?This is correct.
Quote from: scient on May 05, 2013, 08:12:38 pmQuote from: Fal on May 05, 2013, 07:45:49 pmThis is how I read this section of code:1. Get the Morale SE rating from the faction's government/economy/values/future society settings, not including any inherent bonuses or penalties.2. Set this number to -4 if it's less than -4, or set it to 4 if it's greater than 4.3. Add 1 if it is less than -1, or subtract 1 if it is greater than 1.4. Now grab the faction's inherent Morale bonus or penalty.5. If the faction has an inherent Morale penalty, apply it now.6. Check the unit's home base and divide a negative Morale modifier by 2 if it has a Children's Creche.7. If the faction has an inherent Morale bonus, apply it now.Is this correct?This is correct.Then it looks like a faction bonus to Morale should be able to get around the +3 cap. For example, the Spartans running Power/Thought Control would have +4 Morale from their SE choices, which will increase a unit with base Green Morale to Veteran. Then their inherent +2 Morale bonus should apply afterwards and make the unit Elite, but this doesn't happen.Edit: I've also been unable to get drone riots to remove a negative Morale modifier.
or loading an existing game.