private static bool TrySetRelationKind(Faction self, Faction other, FactionRelationKind kind, bool canSendLetter = true) { FactionRelation factionRelation = self.RelationWith(other); if (factionRelation.kind == kind) { return(true); } if (!self.HasGoodwill) { self.SetRelationDirect(other, kind, canSendLetter); return(true); } switch (kind) { case FactionRelationKind.Hostile: self.TryAffectGoodwillWith(other, -75 - factionRelation.baseGoodwill, canSendMessage: false, canSendLetter); return(factionRelation.kind == FactionRelationKind.Hostile); case FactionRelationKind.Neutral: self.TryAffectGoodwillWith(other, -factionRelation.baseGoodwill, canSendMessage: false, canSendLetter); return(factionRelation.kind == FactionRelationKind.Neutral); case FactionRelationKind.Ally: self.TryAffectGoodwillWith(other, 75 - factionRelation.baseGoodwill, canSendMessage: false, canSendLetter); return(factionRelation.kind == FactionRelationKind.Ally); default: throw new NotSupportedException(kind.ToString()); } }
public bool TrySetRelationKind(Faction other, FactionRelationKind kind, bool canSendLetter = true, string reason = null, GlobalTargetInfo?lookTarget = null) { FactionRelation factionRelation = this.RelationWith(other, false); if (factionRelation.kind == kind) { return(true); } switch (kind) { case FactionRelationKind.Hostile: this.TryAffectGoodwillWith(other, -75 - factionRelation.goodwill, false, canSendLetter, reason, lookTarget); return(factionRelation.kind == FactionRelationKind.Hostile); case FactionRelationKind.Neutral: this.TryAffectGoodwillWith(other, -factionRelation.goodwill, false, canSendLetter, reason, lookTarget); return(factionRelation.kind == FactionRelationKind.Neutral); case FactionRelationKind.Ally: this.TryAffectGoodwillWith(other, 75 - factionRelation.goodwill, false, canSendLetter, reason, lookTarget); return(factionRelation.kind == FactionRelationKind.Ally); default: throw new NotSupportedException(kind.ToString()); } }