Skip to content

Commit

Permalink
feedback-based fixes
Browse files Browse the repository at this point in the history
- text refinement
- event triggering
- enemy display outposts
- power on hunter's lodge
  • Loading branch information
Mehni committed Jul 29, 2018
1 parent b3217ae commit 79cecf7
Show file tree
Hide file tree
Showing 13 changed files with 66 additions and 48 deletions.
Binary file modified Assemblies/MoreFactionInteraction.dll
Binary file not shown.
3 changes: 3 additions & 0 deletions Defs/RuleDefs/SymbolResolver_Rules_BasePart_Outdoors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@
<li Class="SymbolResolver_BasePart_Outdoors_Leaf_Empty">
<selectionWeight>0.01</selectionWeight>
</li>
<!-- <li Class="SymbolResolver_BasePart_Outdoors_Leaf_PowerPlant">
<selectionWeight>0.3</selectionWeight>
</li> Still handled by GenStep_Power -->
<li Class="MoreFactionInteraction.World_Incidents.GenStep_SymbolResolver.MFI_SymbolResolver_BasePart_Outdoors_Leaf_Farm">
<selectionWeight>0.65</selectionWeight>
</li>
Expand Down
2 changes: 1 addition & 1 deletion Defs/Sites/Parts/MigratoryHerd.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<linkWithSite>MFI_HuntersLodgePart</linkWithSite>
<order>451</order>
<genStep Class="GenStep_Power">
<canSpawnPowerGenerators>false</canSpawnPowerGenerators>
<canSpawnPowerGenerators>true</canSpawnPowerGenerators>
</genStep>
</GenStepDef>

Expand Down
6 changes: 3 additions & 3 deletions Languages/English/Keyed/Incidents.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<MFI_LetterLabel_HarvestRequest>Help wanted</MFI_LetterLabel_HarvestRequest>
<MFI_LetterHarvestRequest>A nearby settlement, {0}, contacts you with a special request. Their fields have yielded far more than originally expected, and they could really use your help with the harvest.\n\nThis request expires after: {1}\n\nIf you want to help them, send a caravan with capable growers. You can review this offer by selecting {0} on the world map.</MFI_LetterHarvestRequest>
<MFI_CommandFulfillBumperCropHarvestConfirm>Offer your help in harvesting? {0} will spend some time here.</MFI_CommandFulfillBumperCropHarvestConfirm>
<MFI_CommandFulfillBumperCropHarvestConfirm>Offer your help in harvesting? {0} will temporarily be unable to move while harvesting takes place.</MFI_CommandFulfillBumperCropHarvestConfirm>
<MFI_MessageBumperCropNoGrower>No conscious, capable grower.</MFI_MessageBumperCropNoGrower>
<MFI_HarvestRequestInfo>Requesting help with harvesting. ({0} left)</MFI_HarvestRequestInfo>
<MFI_CommandHelpOutHarvesting>Help harvest</MFI_CommandHelpOutHarvesting>
Expand All @@ -32,7 +32,7 @@
<MFI_MysticalShamanLetter>Someone who claims to be a representative of {0} contacts us with a tall tale of a mystical shaman who has mastered the &quot;healer's hand&quot; to cure any injury or missing part. They'll tell us the location of this mysterious and normally reclusive person for a small fee of {1} silver.</MFI_MysticalShamanLetter>
<MFI_MysticalShamanTitle>Mystical Shaman</MFI_MysticalShamanTitle>

<MFI_MysticalShamanFoundNoSickPawn>The Shaman emerges from his polyester teepee just before your caravan announces their presence. He judges you silently with one crossed eye that penetrates through each of your caravan members deepest vitae and one eye that quivers more and more as he assesses your groups health. He orders you to wait a respectable distance while he retreats back in his teepee. Moments later you hear the rustling of fabric and the sound of a muffalo being spurred on.\n\nIt seems the mystical shaman packed up and left.</MFI_MysticalShamanFoundNoSickPawn>
<MFI_MysticalShamanDoesHisMagic>The Shaman seems to have been expecting you, and with great practice regales you the tale of his &quot;healer's hands&quot;. When he's down he invites {0} in to his teepee. There is a brief shake of the screen before {0} re-emerges, feeling much better.</MFI_MysticalShamanDoesHisMagic>
<MFI_MysticalShamanFoundNoSickPawn>The Shaman emerges from his polyester teepee just before your caravan announces their presence. He judges your group silently, passing one quivering eye over your decidedly healthy group, the other eye crossed in apparent meditation. Visibly sweating, he orders you to wait a respectable distance while he retreats back in his teepee. Moments later you hear the rustling of fabric and the sound of a muffalo being spurred on.\n\nIt seems the mystical shaman packed up and left.</MFI_MysticalShamanFoundNoSickPawn>
<MFI_MysticalShamanDoesHisMagic>The Shaman seems to have been expecting you, and with great practice regales you the tale of his &quot;healer's hands&quot;. Once finished, he invites {0} into his teepee. There is a brief shake of the screen before {0} re-emerges, feeling much better.</MFI_MysticalShamanDoesHisMagic>

</LanguageData>
28 changes: 14 additions & 14 deletions Languages/English/Keyed/Keys.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
<!--settings -->
<MFI_ticksToUpgrade>Time until pirates upgrade their outposts to bases</MFI_ticksToUpgrade>
<MFI_timeModifierBetweenFactionInteraction>Time modifier between faction interaction</MFI_timeModifierBetweenFactionInteraction>
<MFI_traderWealthOffsetFromTimesTraded>Modifier to silver brought by traders (scales with interaction-frequency)</MFI_traderWealthOffsetFromTimesTraded>
<MFI_traderWealthOffsetFromTimesTraded>Modifier to silver brought by traders (scales with interaction frequency)</MFI_traderWealthOffsetFromTimesTraded>

<MFI_LetterLabelBanditOutpostUpgraded>Bandit outpost upgraded</MFI_LetterLabelBanditOutpostUpgraded>
<MFI_LetterBanditOutpostUpgraded>Pirates from {0} have upgraded a nearby outpost of theirs to a base!\n\nThey'll sent out occasional raiding parties to test your defences, and to settle new outposts that may become bases.</MFI_LetterBanditOutpostUpgraded>
<MFI_LetterBanditOutpostUpgraded>Pirates from {0} have upgraded a nearby outpost to a base!\n\nThey'll sent out occasional raiding parties to test your defences, and to settle new outposts that may become bases.</MFI_LetterBanditOutpostUpgraded>
<MFI_DesperateTrader>Desperate trader</MFI_DesperateTrader>
<MFI_TraderSent>{0} thanks you. Their trade caravan will arrive in about {1}.</MFI_TraderSent>
<MFI_Trader>trader</MFI_Trader>

<MFI_CaravanWorking>Caravan is working.</MFI_CaravanWorking>
<MFI_CaravanWorking>Caravan can't move during harvesting work.</MFI_CaravanWorking>

<MFI_FactionWarPeaceTalksIntroduction>The two opposing faction leaders {0} and {1} each made quarters in opposite corners of the make-shift camp. Tensions are high as your negotiator {2} walks in. The past few days have been taxing on all parties involved, and your negotiator knows that what they'll say can have far reaching consequences.\n\n{2} has the following options:</MFI_FactionWarPeaceTalksIntroduction>

Expand All @@ -21,25 +21,25 @@
<MFI_FactionWarPeaceTalksBrokerPeace>Broker peace between the two factions</MFI_FactionWarPeaceTalksBrokerPeace>

<!-- Faction war, favour one faction over the other -->
<MFI_FactionWarFavourFactionDisaster>The talks were a disaster. Neither faction appreciated your negotiator's attempt to butter up {0} and efforts to seek out a victor in the strife were considered an act of aggression and the peace talks broke down as a result.\n\nRelations with {0} have deteriorated somewhat.\n\nRelations with {1} have deteriorated massively.</MFI_FactionWarFavourFactionDisaster>
<MFI_FactionWarFavourFactionBackFire>The talks have backfired. While faction delegates discussed key differences, dissuasions your negotiator made were seen as unconstructive towards the goals and the talks soon devolved.\n\nRelations with {0} deteriorated.\n\nRelations with {1} have deteriorated massively.</MFI_FactionWarFavourFactionBackFire>
<MFI_FactionWarFavourFactionFlounder>The talks floundered. As faction delegates communicated clearly on their most important issues, your negotiator was not able to make any meaningful contributions to the peace talks.\n\nRelations with {0} have increased somewhat.\n\nRelations with {1} deteriorated considerably.</MFI_FactionWarFavourFactionFlounder>
<MFI_FactionWarFavourFactionSuccess>The talks were a success. Delegates of both factions hammered out a basic treaty, and your negotiator managed to sway the talks and convince {1} to make amends with {0}.\n\nRelations with {0} increased considerably.\n\nRelations with {1} deteriorated somewhat.</MFI_FactionWarFavourFactionSuccess>
<MFI_FactionWarFavourFactionDisaster>The talks were a disaster. Neither faction appreciated your negotiator's attempt to butter up {0}. Efforts to seek out a victor in the strife were considered an act of aggression and the peace talks broke down as a result.\n\nRelations with {0} have deteriorated somewhat.\n\nRelations with {1} have deteriorated massively.</MFI_FactionWarFavourFactionDisaster>
<MFI_FactionWarFavourFactionBackFire>The talks have backfired. While faction delegates discussed key differences, dissuasions your negotiator made were seen as unconstructive towards the goals and the talks soon broke down.\n\nRelations with {0} deteriorated.\n\nRelations with {1} have deteriorated massively.</MFI_FactionWarFavourFactionBackFire>
<MFI_FactionWarFavourFactionFlounder>The talks floundered. Faction delegates expressed their key issues clearly, but your negotiator was not able to make any meaningful contributions to the peace talks.\n\nRelations with {0} have increased somewhat.\n\nRelations with {1} deteriorated considerably.</MFI_FactionWarFavourFactionFlounder>
<MFI_FactionWarFavourFactionSuccess>The talks were a success. Your negotiator managed to convince {1} to make amends with {0}, and their delegates hammered out a basic treaty.\n\nRelations with {0} increased considerably.\n\nRelations with {1} deteriorated somewhat.</MFI_FactionWarFavourFactionSuccess>
<MFI_FactionWarFavourFactionTriumph>The talks were a great triumph! Your negotiator played a large role in convincing {1} to pay reparations for past aggressions, much to the delight of {0}.\n\nRelations with {0} increased massively.\n\nRelations with {1} deteriorated.</MFI_FactionWarFavourFactionTriumph>

<!-- Faction war, sabotage to benefit colony -->
<MFI_FactionWarSabotageDisaster>The sabotage was a massive failure. The delegates quickly uncovered your negotiator's intent to sabotage and both factions turned against you! As your caravan made a hurried departure, warriors from both factions caught up with it and attacked!\n\nRelations with {0} have broken down. They are now hostile towards you.\n\nRelations with {1} have broken down. They are now hostile towards you.</MFI_FactionWarSabotageDisaster>
<MFI_FactionWarSabotageBackFire>The sabotage has backfired. As delegates exchanged pleasantries and subsequently got down to business, they soon realised the unconstructive nature of your negotiator and excluded them from the talks.\n\nRelations with {0} deteriorated massively.\n\nRelations with {1} deteriorated massively.</MFI_FactionWarSabotageBackFire>
<MFI_FactionWarSabotageFlounder>The sabotage floundered. Your negotiator proved unable to get a word in edge-wise or provide meaningful contributions to the peace talks one way or the other.\n\nRelations with {0} and {1} remain unchanged.</MFI_FactionWarSabotageFlounder>
<MFI_FactionWarSabotageSuccess >The sabotage was a dubious success. While delegates bickered over important issues, your negotiator navigated the political minefield and left an amicable impression on both factions while ensuring no actual progress was made.\n\nRelations with {0} increased considerably.\n\nRelations with {1} increased considerably.</MFI_FactionWarSabotageSuccess>
<MFI_FactionWarSabotageTriumph >The sabotage was a great triumph of sorts! Delegates of both factions were expertly played out against one another, and not long after the initial greetings the discussion broke down into insults and recriminations while both aggressors were left with a very favourable impression of your faction.\n\nRelations with {0} have increased immensely.\n\nRelations with {1} have increased immensely.</MFI_FactionWarSabotageTriumph>
<MFI_FactionWarSabotageDisaster>The sabotage was a massive failure. The delegates quickly uncovered your negotiator's intent and both factions turned against you! Your caravan made a hurried departure, but warriors from both factions caught up with it and attacked!\n\nRelations with {0} have broken down. They are now hostile towards you.\n\nRelations with {1} have broken down. They are now hostile towards you.</MFI_FactionWarSabotageDisaster>
<MFI_FactionWarSabotageBackFire>The sabotage has backfired. Not long after delegates exchanged pleasantries, they caught on to the unconstructive nature of your negotiator and excluded them from the talks.\n\nRelations with {0} deteriorated massively.\n\nRelations with {1} deteriorated massively.</MFI_FactionWarSabotageBackFire>
<MFI_FactionWarSabotageFlounder>The sabotage floundered. Your negotiator proved unable to get a word in or provide meaningful contributions to the peace talks one way or the other.\n\nRelations with {0} and {1} remain unchanged.</MFI_FactionWarSabotageFlounder>
<MFI_FactionWarSabotageSuccess>The sabotage was a dubious success. While delegates bickered over important issues, your negotiator navigated the political minefield and left an amicable impression on both factions while ensuring no actual progress was made.\n\nRelations with {0} increased considerably.\n\nRelations with {1} increased considerably.</MFI_FactionWarSabotageSuccess>
<MFI_FactionWarSabotageTriumph>The sabotage was a great triumph of sorts! Delegates were expertly played out against one another, and not long after the initial greetings, the discussion broke down into insults and recriminations while both aggressors were left with a very favourable impression of your faction.\n\nRelations with {0} have increased immensely.\n\nRelations with {1} have increased immensely.</MFI_FactionWarSabotageTriumph>

<!-- Faction war, broker peace -->
<MFI_FactionWarBrokerPeaceDisaster>The talks were a disaster. The delegates barely got past their initial greetings before the discussion broke down into insults and recriminations. Nothing your negotiator said was met with any approval, and relations with both opposing factions are worse than before.\n\nRelations with {0} deteriorated.\n\nRelations with {1} deteriorated.</MFI_FactionWarBrokerPeaceDisaster>
<MFI_FactionWarBrokerPeaceBackFire>The talks have backfired. Despite exchanging some pleasantries, the delegates made no progress on substantive issues, and multiple statements were interpreted as insults. They've decided to resume and reschedule the peace talks for a later date.\n\nRelations with {0} remain unchanged.\n\nRelations with {1} remain unchanged.</MFI_FactionWarBrokerPeaceBackFire>
<MFI_FactionWarBrokerPeaceFlounder>The talks floundered. Delegates managed to communicate clearly and with basic respect, but were not able to make progress on any genuine issues until your negotiator arrived. They played a large part in assuaging fears and smoothing over ruffled feathers.\n\nRelations with {0} have increased somewhat.\n\nRelations with {1} have increased somewhat.</MFI_FactionWarBrokerPeaceFlounder>
<MFI_FactionWarBrokerPeaceSuccess >The talks were a success. Thanks in no small part to your negotiator, delegates reached new mutual understanding on several substantial issues.\n\nRelations with {0} have increased considerably.\n\nRelations with {1} have increased considerably.</MFI_FactionWarBrokerPeaceSuccess>
<MFI_FactionWarBrokerPeaceTriumph >The talks were a great triumph! Your negotiator quickly connected the delegates and paved the way to truly see each others' perspective on the most difficult issues of the day.\n\nRelations with {0} have increased immensely.\n\nRelations with {1} have increased immensely.</MFI_FactionWarBrokerPeaceTriumph>
<MFI_FactionWarBrokerPeaceSuccess>The talks were a success. Thanks in no small part to your negotiator, delegates reached new mutual understanding on several substantial issues.\n\nRelations with {0} have increased considerably.\n\nRelations with {1} have increased considerably.</MFI_FactionWarBrokerPeaceSuccess>
<MFI_FactionWarBrokerPeaceTriumph>The talks were a great triumph! Your negotiator quickly connected the delegates and paved the way to truly see each others' perspective on the most difficult issues of the day.\n\nRelations with {0} have increased immensely.\n\nRelations with {1} have increased immensely.</MFI_FactionWarBrokerPeaceTriumph>

<MFI_FactionWarProgress>Faction war progress</MFI_FactionWarProgress>
<MFI_UnrestIsBrewing>Faction unrest is brewing</MFI_UnrestIsBrewing>
Expand Down
18 changes: 9 additions & 9 deletions MoreFactionInteraction/General/HarmonyPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ static HarmonyPatches()
postfix: new HarmonyMethod(type: typeof(HarmonyPatches), name: nameof(WorldReachUtility_PostFix)));
#endregion

harmony.Patch(original: AccessTools.Method(type: typeof(DebugWindowsOpener), name: "ToggleDebugActionsMenu"), prefix: null, postfix: null,
transpiler: new HarmonyMethod(type: typeof(HarmonyPatches), name: nameof(DebugWindowsOpener_ToggleDebugActionsMenu_Patch)));
//harmony.Patch(original: AccessTools.Method(type: typeof(DebugWindowsOpener), name: "ToggleDebugActionsMenu"), prefix: null, postfix: null,
// transpiler: new HarmonyMethod(type: typeof(HarmonyPatches), name: nameof(DebugWindowsOpener_ToggleDebugActionsMenu_Patch)));

harmony.Patch(original: AccessTools.Method(type: typeof(Tradeable), name: "InitPriceDataIfNeeded"), prefix: null, postfix: null,
transpiler: new HarmonyMethod(type: typeof(HarmonyPatches), name: nameof(ErrorSuppressionSssh)));
Expand All @@ -65,13 +65,13 @@ private static IEnumerable<CodeInstruction> ErrorSuppressionSssh(IEnumerable<Cod
}
}

//thx Brrainz
private static IEnumerable<CodeInstruction> DebugWindowsOpener_ToggleDebugActionsMenu_Patch(IEnumerable<CodeInstruction> instructions)
{
ConstructorInfo from = AccessTools.Constructor(type: typeof(Dialog_DebugActionsMenu));
ConstructorInfo to = AccessTools.Constructor(type: typeof(Dialog_MFIDebugActionMenu));
return instructions.MethodReplacer(from: from, to: to);
}
////thx Brrainz
//private static IEnumerable<CodeInstruction> DebugWindowsOpener_ToggleDebugActionsMenu_Patch(IEnumerable<CodeInstruction> instructions)
//{
// ConstructorInfo from = AccessTools.Constructor(type: typeof(Dialog_DebugActionsMenu));
// ConstructorInfo to = AccessTools.Constructor(type: typeof(Dialog_MFIDebugActionMenu));
// return instructions.MethodReplacer(from: from, to: to);
//}

#region MoreTraders
private static void TraderStocker_OverStockerPostFix(ref List<Thing> __result, ref ThingSetMakerParams parms)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ protected override bool TryExecuteWorker(IncidentParms parms)
}

private bool TryFindBetrothed(out Pawn betrothed) => (from potentialPartners in PawnsFinder.AllMapsCaravansAndTravelingTransportPods_Alive_FreeColonistsAndPrisoners_NoCryptosleep
// where !LovePartnerRelationUtility.HasAnyLovePartner(potentialPartners) || LovePartnerRelationUtility.ExistingMostLikedLovePartner(potentialPartners, false) == this.marriageSeeker //to consider: Y/N ?
select potentialPartners).TryRandomElementByWeight(weightSelector: (Pawn marriageSeeker2) => this.marriageSeeker.relations.SecondaryLovinChanceFactor(otherPawn: marriageSeeker2), result: out betrothed);

private static bool TryFindMarriageSeeker(out Pawn marriageSeeker) => (from x in Find.WorldPawns.AllPawnsAlive
Expand Down
6 changes: 5 additions & 1 deletion MoreFactionInteraction/More Flavour/MysticalShaman.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ internal class WorstCaravanPawnUtility
public static Pawn FindSickestPawn(Caravan caravan)
{
tempPawns.Clear();
foreach (Pawn pawn in caravan.PawnsListForReading) tempPawns.Add(key: pawn, value: CalcHealthThreatenedScore(usedBy: pawn));
//Muffalo 1 deserves a chance to get healed too.
foreach (Pawn pawn in caravan.PawnsListForReading)
tempPawns.Add(key: pawn,
value: CalcHealthThreatenedScore(usedBy: pawn) / ( pawn.RaceProps.Humanlike ? 1 : 2 ));

tempPawns.RemoveAll(predicate: x => x.Value == 0);
return tempPawns.FirstOrDefault(predicate: x => x.Value.Equals(obj: tempPawns.Values.Max())).Key;
}
Expand Down
Loading

0 comments on commit 79cecf7

Please sign in to comment.