mirror of
https://github.com/vegapnk/RJW-Genes.git
synced 2024-08-15 00:23:31 +00:00
Centralized Faction Goodwill Penalties in a single Helper
This commit is contained in:
parent
f5917052ab
commit
4623333605
7 changed files with 49 additions and 59 deletions
|
@ -84,19 +84,8 @@ namespace RJW_Genes.Genes.Special
|
|||
ModLog.Message($"[Sexual Age Drainer] {receiver} was too young ({receiver.ageTracker.AgeBiologicalYears}), and remains unchanged.");
|
||||
}
|
||||
|
||||
HandleFactionGoodWillPenalties(receiver, giver);
|
||||
FactionUtility.HandleFactionGoodWillPenalties(receiver, giver, "rjw_genes_GoodwillChangedReason_aged_pawn_with_sex_gene",FACTION_GOODWILL_CHANGE);
|
||||
}
|
||||
|
||||
private static void HandleFactionGoodWillPenalties(Pawn actor, Pawn target)
|
||||
{
|
||||
if (
|
||||
target.Faction != null && actor.Faction != null
|
||||
&& target.Faction != actor.Faction
|
||||
&& target.Faction != Faction.OfPlayer)
|
||||
{
|
||||
HistoryEventDef reason = DefDatabase<HistoryEventDef>.GetNamedSilentFail("rjw_genes_GoodwillChangedReason_youthed_pawn_with_sex_gene");
|
||||
target.Faction.TryAffectGoodwillWith(actor.Faction, FACTION_GOODWILL_CHANGE, true, true, reason, target);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,14 +68,7 @@ namespace RJW_Genes
|
|||
stealer.genes.AddGene(stolenGene.def, AddAsXenogene);
|
||||
victim.genes.RemoveGene(stolenGene);
|
||||
|
||||
if (
|
||||
victim.Faction != null && stealer.Faction != null
|
||||
&& victim.Faction != stealer.Faction
|
||||
&& victim.Faction != Faction.OfPlayer) {
|
||||
|
||||
HistoryEventDef reason = DefDatabase<HistoryEventDef>.GetNamedSilentFail("rjw_genes_GoodwillChangedReason_StoleGene");
|
||||
victim.Faction.TryAffectGoodwillWith(stealer.Faction, FACTION_GOODWILL_CHANGE, true, true, reason, victim);
|
||||
}
|
||||
FactionUtility.HandleFactionGoodWillPenalties(stealer, victim, "rjw_genes_GoodwillChangedReason_StoleGene", FACTION_GOODWILL_CHANGE);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -42,12 +42,12 @@ namespace RJW_Genes.Genes.Special
|
|||
if (GeneUtility.IsYouthFountain(props.pawn))
|
||||
{
|
||||
ChangeAgeForPawn(props.partner, props.pawn);
|
||||
HandleFactionGoodWillPenalties(props.pawn, props.partner);
|
||||
FactionUtility.HandleFactionGoodWillPenalties(props.pawn, props.partner, "rjw_genes_GoodwillChangedReason_youthed_pawn_with_sex_gene",+1);
|
||||
}
|
||||
if (GeneUtility.IsYouthFountain(props.partner))
|
||||
{
|
||||
ChangeAgeForPawn(props.pawn,props.partner);
|
||||
HandleFactionGoodWillPenalties(props.partner, props.pawn);
|
||||
FactionUtility.HandleFactionGoodWillPenalties(props.pawn, props.partner, "rjw_genes_GoodwillChangedReason_youthed_pawn_with_sex_gene", +1);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -71,17 +71,6 @@ namespace RJW_Genes.Genes.Special
|
|||
}
|
||||
|
||||
|
||||
private static void HandleFactionGoodWillPenalties(Pawn actor, Pawn target)
|
||||
{
|
||||
if (
|
||||
target.Faction != null && actor.Faction != null
|
||||
&& target.Faction != actor.Faction
|
||||
&& target.Faction != Faction.OfPlayer)
|
||||
{
|
||||
HistoryEventDef reason = DefDatabase<HistoryEventDef>.GetNamedSilentFail("rjw_genes_GoodwillChangedReason_youthed_pawn_with_sex_gene");
|
||||
target.Faction.TryAffectGoodwillWith(actor.Faction, FACTION_GOODWILL_CHANGE, true, true, reason, target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue