本文整理汇总了C#中Pawn.RecruitPenalty方法的典型用法代码示例。如果您正苦于以下问题:C# Pawn.RecruitPenalty方法的具体用法?C# Pawn.RecruitPenalty怎么用?C# Pawn.RecruitPenalty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pawn
的用法示例。
在下文中一共展示了Pawn.RecruitPenalty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TryGuestRecruit
public static bool TryGuestRecruit(Pawn recruiter, Pawn guest)
{
if (recruiter == null || guest == null || guest.guest == null) return false;
recruiter.skills.Learn(SkillDefOf.Social, 35f);
float recruitDifficulty = guest.guest.RecruitDifficulty;
if (guest.needs.mood.CurLevel*100 >= recruitDifficulty)
{
float recruitChance = recruiter.GetStatValue(StatDefOf.RecruitPrisonerChance);
recruitChance *= 1f - recruitDifficulty/100f;
if (recruitChance < 0.011f)
{
recruitChance = 0.011f;
}
if (DebugSettings.instantRecruit)
{
recruitChance = 1f;
}
if (Rand.Value <= recruitChance)
{
//Log.Message("txtRecruitSuccess");
Find.LetterStack.ReceiveLetter(labelRecruitSuccess,
string.Format(txtRecruitSuccess, recruiter, guest, recruitChance.ToStringPercent()),
LetterType.Good, guest);
//if (guest.JailerFaction != null)
if (guest.Faction != recruiter.Faction)
{
if (guest.Faction != null)
{
guest.Faction.AffectGoodwillWith(Faction.OfColony, -guest.RecruitPenalty());
if (guest.RecruitPenalty() >= 1)
{
//Log.Message("txtRecruitFactionAnger");
var message = "";
if (guest.Faction.leader != null)
{
message = string.Format(txtRecruitFactionAnger, guest.Faction.leader.Name, guest.Faction.name, guest.Nickname, (-guest.RecruitPenalty()).ToStringByStyle(ToStringStyle.FloatZero, ToStringNumberSense.Offset));
Find.LetterStack.ReceiveLetter(labelRecruitFactionChiefAnger, message, LetterType.BadNonUrgent);
}
else
{
message = string.Format(txtRecruitFactionAngerLeaderless, guest.Faction.name, guest.Nickname, (-guest.RecruitPenalty()).ToStringByStyle(ToStringStyle.FloatZero, ToStringNumberSense.Offset));
Find.LetterStack.ReceiveLetter(labelRecruitFactionAnger, message, LetterType.BadNonUrgent);
}
}
else if (guest.RecruitPenalty() <= -1)
{
//Log.Message("txtRecruitFactionPlease");
var message = "";
if (guest.Faction.leader != null)
{
message = string.Format(txtRecruitFactionPlease, guest.Faction.leader.Name, guest.Faction.name, guest.Nickname, (-guest.RecruitPenalty()).ToStringByStyle(ToStringStyle.FloatZero, ToStringNumberSense.Offset));
Find.LetterStack.ReceiveLetter(labelRecruitFactionChiefPlease, message, LetterType.Good);
}
else
{
message = string.Format(txtRecruitFactionPleaseLeaderless, guest.Faction.name, guest.Nickname, (-guest.RecruitPenalty()).ToStringByStyle(ToStringStyle.FloatZero, ToStringNumberSense.Offset));
Find.LetterStack.ReceiveLetter(labelRecruitFactionPlease, message, LetterType.Good);
}
}
}
//guest.mindState.duty = null;
AdoptGuest(guest, recruiter.Faction);
}
var taleParams = new object[] {recruiter, guest};
TaleRecorder.RecordTale(TaleDef.Named("Recruited"), taleParams);
return true;
}
Messages.Message(string.Format(txtRecruitFail, recruiter, guest, recruitChance.ToStringPercent()), MessageSound.Negative);
}
//Messages.Message(string.Format(txtRecruitFailMood, recruiter.Nickname, guest), MessageSound.Negative);
//var difference = recruitDifficulty - guest.needs.mood.CurLevel;
//var thought = ThoughtDef.Named(difference >= 10 ? "GuestOffended" : "GuestConvinced");
// guest.needs.mood.thoughts.TryGainThought(thought);
float chance = recruiter.GetStatValue(statOffendGuestChance);
if (Rand.Value < chance)
{
var isAbrasive = recruiter.story.traits.HasTrait(TraitDefOf.Abrasive);
int multiplier = isAbrasive ? 2 : 1;
string multiplierText = multiplier > 1 ? " x" + multiplier : string.Empty;
//Log.Message("textAnger");
string textAnger = recruiter.gender == Gender.Female ? txtRecruitAngerSelfF : txtRecruitAngerSelfM;
Messages.Message(string.Format(textAnger, recruiter.Nickname, guest.Nickname, chance.ToStringPercent(), multiplierText), MessageSound.Negative);
guest.Faction.AffectGoodwillWith(Faction.OfColony, -1f + 0.045f * recruiter.skills.GetSkill(SkillDefOf.Social).level);
for (int i = 0; i < multiplier; i++)
{
guest.needs.mood.thoughts.TryGainThought(ThoughtDef.Named("GuestOffended"));
}
}
else
{
var statValue = recruiter.GetStatValue(statRecruitEffectivity);
var floor = Mathf.FloorToInt(statValue);
int multiplier = floor + (Rand.Value < statValue - floor?1:0);
string multiplierText = multiplier > 1 ? " x" + multiplier : string.Empty;
//Log.Message("textPlease");
//.........这里部分代码省略.........