Пример #1
0
        public void startHelping(Faction faction, RoadConstructionSite site, Pawn negotiator)
        {
            // Test success or failure of the negotiator, plus amount of help obtained (based on negotiation value & roll)
            float negotiationValue = negotiator.GetStatValue(StatDefOf.NegotiationAbility, true);
            float failChance       = helpRequestFailChance / negotiationValue;
            float roll             = Rand.Value;
            float amountOfHelp     = helpBaseAmount * (1 + negotiationValue * roll * 5);
            //Log.Message(String.Format("[RotR] - Negotiation for road construction help : negotiation value = {0:0.00} , fail chance = {1:P} , roll = {2:0.00} , help = {3:0.00}", negotiationValue , failChance, roll , amountOfHelp));

            // Calculate how long the faction needs to start helping
            SettlementInfo closestSettlement = site.closestSettlementOfFaction(faction);
            int            tick = Find.TickManager.TicksGame + closestSettlement.distance;

            // Determine amount of help per tick
            float amountPerTick = Math.Max(Rand.Gaussian(helpPerTickMedian, helpPerTickVariance), helpPerTickMin);

            setCurrentlyHelping(faction);
            site.initiateFactionHelp(faction, tick, amountOfHelp, amountPerTick);
        }